|WARNING| sched: fix data race in RED random number generation

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Sat Oct 10 04:23:54 CEST 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/170988

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-10

# DPDK Patch Review

## ERRORS

### 1. Race condition in shared random state (Error)

**File:** lib/sched/rte_red.h, line 278

**Issue:** The patch removes thread-unsafe shared state (`rte_red_rand_seed`, `rte_red_rand_val`) but does not add any release notes documenting the ABI break from removing these exported symbols.

**Original code:**
```c
RTE_EXPORT_SYMBOL(rte_red_rand_val)
uint32_t rte_red_rand_val = 0;
RTE_EXPORT_SYMBOL(rte_red_rand_seed)
uint32_t rte_red_rand_seed = 0;
```

The patch removes these exported symbols, which is an ABI break. While the release notes mention removing `rte_fast_rand()`, they do NOT mention removing the exported `rte_red_rand_val` and `rte_red_rand_seed` symbols.

**Required fix:**
Add to release notes under "Removed Items":
```rst
* sched: Removed exported symbols ``rte_red_rand_val`` and ``rte_red_rand_seed``
  which were internal random number generator state inadvertently exposed in the ABI.
```

### 2. Missing ABI section in release notes (Error)

**File:** doc/guides/rel_notes/release_26_11.rst

**Issue:** Removal of exported symbols `rte_red_rand_val` and `rte_red_rand_seed` is an ABI change that should be documented in the ABI Changes section, not just Removed Items.

**Required fix:**
Add an "ABI Changes" section (or add to existing one) with:
```rst
* sched: Removed inadvertently exported symbols ``rte_red_rand_val`` and
  ``rte_red_rand_seed`` which were internal state of the RED random number generator.
```

## WARNINGS

None.

## INFO

### 1. Typo in release notes (Info)

**File:** doc/guides/rel_notes/release_26_11.rst, line 229

```rst
There is no prior deprecation notice for relatedd symbols.
```

Should be "related" not "relatedd" (double 'd'). This is in a comment in the commit message, but the same text appears in the release notes.

---

## Summary

The patch correctly fixes the thread-safety issue by replacing the custom, thread-unsafe random number generator with `rte_rand()`. However, it introduces an ABI break by removing exported symbols without complete documentation in the release notes. The "Removed Items" section mentions `rte_fast_rand()` but omits the two exported global variables `rte_red_rand_val` and `rte_red_rand_seed`.

The correctness of the change is sound: `rte_rand()` is thread-safe and provides better randomness. The inline function `__rte_red_drop()` no longer has a data race on the shared `rte_red_rand_val` variable.

Review-Result: ERROR


More information about the test-report mailing list