|SUCCESS| [v1, 1/1] vfio: fix device lookup with no-IOMMU mode enabled
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Thu Oct 15 20:41:20 CEST 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/171462
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-15
# DPDK Patch Review
## ERRORS
None identified.
## WARNINGS
None identified.
## INFO
### Pre-existing code note: missing error propagation
**File:** `lib/eal/linux/eal_vfio_cdev.c`
**Line (surrounding context):** `closedir(dir);`
The function `vfio_cdev_get_device_num()` calls `closedir(dir)` but does not check for errors. While `closedir()` rarely fails in practice, POSIX allows it to return -1 and set `errno` on failure (e.g., invalid dirp, I/O error). This is pre-existing code (not introduced by this patch) and is noted here for completeness.
For reference, the pattern appears in the existing code around line 276-277 in the patch context. Not a blocking issue for this patch.
### Observation: error handling improvement in cdev_open_device_fd
**File:** `lib/eal/linux/eal_vfio_cdev.c`
**Added lines:** Loop through `cdev_prefixes[]` attempting to open device
The new loop structure in `cdev_open_device_fd()` correctly handles `ENOENT` to try the next prefix, and breaks on any other error or success. This is a solid improvement over the previous switch-based approach. The logic correctly preserves non-ENOENT errors (e.g., `EACCES`) and reports them without attempting fallback, which is the right behavior.
### Observation: errno handling in vfio_open_group_sysfs
**File:** `lib/eal/linux/eal_vfio_group.c`
**Modified section:** Try-fallback pattern for group open
The patch removes the `errno = 0;` reset before the first `open()`, relying instead on checking `errno == ENOENT` after each failed open. This is correct: `open()` sets `errno` on failure, and checking `errno` only when `fd < 0` is the standard pattern. The removal of the reset eliminates an unnecessary operation without changing behavior.
The final check `if (fd < 0 && errno == ENOENT)` correctly distinguishes "group does not exist" from other errors (permissions, fd exhaustion, etc.), which matches the documented return semantics (return `-ENOENT` specifically when the group doesn't exist).
---
**Summary:**
The patch correctly addresses the issue where devices behind real IOMMUs were not found when no-IOMMU mode was globally enabled. The try-regular-first-then-noiommu pattern is applied consistently in both cdev and group modes. Error handling is preserved or improved throughout. No correctness bugs, style violations, or API compliance issues identified.
Review-Result: CLEAN
More information about the test-report
mailing list