[PATCH v2 0/2] dma-debug: skip irrelevant buckets for partial syncs

From: Juanlu Herrero

Date: Fri Dec 04 2026 - 18:07:38 EST


Skip buckets that cannot contain a partial sync. Use the full lookup for
wrapped ranges or a miss after skipping buckets. Add targeted KUnit tests.

On a ConnectX-7 host with IOMMU translation and DMA-debug enabled,
mean whole-selftest runtimes for 20 runs per kernel and pool size were:

area pages before v2
65536 3.094 s 2.223 s
131072 3.136 s 2.372 s

These include setup and teardown; registration syscall medians were
largely unchanged. All 80 runs passed without DMA-debug errors. Thor
runs were inconclusive and reported existing SG segment-size violations.

The benchmark used iou-zcrx -s -i eth0 -q 1 -a <pages> -d, with the -a
selftest option from v1. That networking change is excluded here.

Validation: four KUnit tests with KASAN/lockdep, W=1 and checkpatch.
A/B lookup tests matched the original diagnostics across 1,789 cases.

Codex assisted with implementation, review and validation.

v1: https://lore.kernel.org/r/20261110-zcrx-dma-debug-registration-v1-0-48743ea61631@xxxxxxxxxxxx

Signed-off-by: Juanlu Herrero <juanlu@xxxxxxxxxxxx>
---
Changes in v2:
- Retry the full lookup after a miss if any buckets were skipped.
- Use the full lookup immediately for overflowing sync ranges.
- Add lookup tests for partial syncs, invalid sizes and overflowing ranges.
- Shorten the bound comment.
- Drop the networking selftest change to keep this series in DMA.

---
Juanlu Herrero (2):
dma-debug: skip irrelevant buckets for partial syncs
dma-debug: test bucket bounds and sync lookup

kernel/dma/Kconfig | 10 ++
kernel/dma/debug.c | 60 +++++++++--
kernel/dma/tests/debug_kunit.c | 223 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 284 insertions(+), 9 deletions(-)
---
base-commit: 310735e3e4cc57f38c739487b5ecbda7fec57d12
change-id: 20261027-zcrx-dma-debug-registration-03221ef6a7d4

Best regards,
--
Juanlu Herrero