|WARNING| app/dma_perf: skip case if worker maps to main lcore

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Wed Jun 24 09:48:18 CEST 2026


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

_AI Code Review_

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

# DPDK Patch Review

## Summary
This patch adds early validation to reject test cases where a worker lcore is the same as the EAL main lcore, preventing a deadlock where the main thread would wait on itself.

---

## Errors

None found.

---

## Warnings

### 1. Missing return code propagation

**File:** `app/test-dma-perf/main.c`

The existing `run_test()` function has void return type and uses `return` without a value to skip test cases. The new check follows this pattern, but there's no way for the caller to distinguish between:
- Normal test completion
- Test skipped due to insufficient lcores
- Test skipped due to worker-on-main-lcore conflict

**Suggested fix:**

The existing code already has this issue and is not introduced by this patch, but it would be clearer if `run_test()` returned an `int` status code:

```c
static int
run_test(uint32_t case_id, struct test_configure *case_cfg)
{
	/* ... */
	if (nb_lcores < case_cfg->num_worker + 1) {
		printf("Case %u: Not enough lcores.\n", case_id);
		return -EINVAL;
	}

	for (uint32_t i = 0; i < case_cfg->num_worker; i++) {
		worker_lcore = case_cfg->dma_config[i].lcore_dma_map.lcore;
		if (worker_lcore == main_lcore) {
			printf("Case %u: worker %u (lcore %u) cannot run on the EAL main lcore (%u).\n",
			       case_id, i, worker_lcore, main_lcore);
			return -EINVAL;
		}
	}
	/* ... */
	return 0;
}
```

However, since this patch is a targeted fix for a deadlock and the void return pattern is already established throughout the file, changing the return type would be a separate refactoring. This is acceptable for a stable backport.

---

## Info

### 1. Variable declaration style

**File:** `app/test-dma-perf/main.c`

The patch declares variables at the start of the function block, consistent with existing code in this file. This is acceptable per DPDK guidelines (both C89-style declarations at block start and C99-style declarations at point of first use are allowed).

### 2. Loop bounds check

The loop iterates over `case_cfg->num_worker` which is validated earlier in the function against available lcores. The check is safe.

### 3. Message clarity

The error message clearly identifies the conflict and provides all relevant lcore IDs for debugging.

---

## Conclusion

The patch correctly addresses the deadlock issue described. The fix is minimal, clear, and appropriate for backporting to stable branches. No correctness bugs or coding standard violations were found.


More information about the test-report mailing list