Repository navigation
#56 Fixed failed init leaves hugepage files behind in /dev/hugepages, blocking subsequent runs - #58
Merged
Merged
Conversation
cliffburdick
reviewed
May 6, 2026
|
|
||
| ??? failure "Insufficient free hugepages: x MiB free, ~y MiB required for this config." | ||
|
|
||
| DAQIRI's preflight check has caught a hugepage shortfall before EAL was initialized, so no files were left in `/dev/hugepages`. The critical log prints a breakdown (kind:HUGE MRs, dummy queues, per-pool overhead, EAL fixed overhead) and the exact `echo N | sudo tee ...` command to allocate enough pages — copy-paste it. See [Configure hugepages first](#configure-hugepages-first) for the full sizing guide and persistent grub recipe. |
Collaborator
There was a problem hiding this comment.
We shouldn't mention EAL here since it's an implementation detail.
Member
Author
There was a problem hiding this comment.
I removed the reference and pushed the changes.
cliffburdick
approved these changes
May 6, 2026
5 tasks done
dleshchev
added a commit
that referenced
this pull request
May 12, 2026
* #56 - Default-init MemoryRegionConfig::adj_size_ and ttl_size_ to 0 The hugepage preflight added by #58 reads MemoryRegionConfig::adj_size_ before any backend populates it, falling back to buf_size_ only when adj_size_ == 0. Since these fields had no default initializer, construction left them with indeterminate values, so the fallback rarely fired. On configs with kind: huge memory regions, the preflight would multiply num_bufs by garbage and demand petabytes of hugepages, aborting init before rte_eal_init(). Reproduces on origin/main with every DPDK bench that has a CPU-side huge memory region (HDS, reorder, reorder_quantize). tx_rx was unaffected because its memory regions are all kind: device. Default-init adj_size_ and ttl_size_ to 0 so the existing fallback path in estimate_required_hugepages() works as intended. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Denis Leshchev <dleshchev@nvidia.com> * #44 - Gate num_bufs auto-bump to queue-backed memory regions The auto-bump added by #48 iterates every MemoryRegionConfig and bumps num_bufs to 3x the NIC ring whenever it falls below 1.5x ring. That logic is correct for MRs that back an RX or TX queue's mempool -- undersizing those deadlocks the worker once the ring fills, which is exactly what #44 set out to prevent. But the bump fires unconditionally, including on MRs that aren't bound to any queue. The reorder configs intentionally use small num_bufs with large buf_size for the reorder target -- e.g. daqiri_bench_raw_tx_rx_reorder_seq_1024.yaml sets Reorder_RX_GPU.num_bufs=128 with buf_size=2031616 (~260 MiB total) because each buffer holds one fully reordered batch and the region isn't a queue mempool. The bump inflates this to ~50 GiB, which the device cannot DMA-map and init fails: [WARN] MR 'Reorder_RX_GPU' had num_bufs=128 ... Bumping to 24576 [CRITICAL] Could not DMA map EXT memory: -1 err=Invalid argument [CRITICAL] Failed to map MRs Collect the names of MRs referenced by any RX/TX queue's mrs_ list, and only bump those. Reorder targets and any future auxiliary MRs are left at the user-configured num_bufs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Denis Leshchev <dleshchev@nvidia.com> --------- Signed-off-by: Denis Leshchev <dleshchev@nvidia.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #56. Two things are added:
echo N | sudo tee ...command to run.rte_eal_cleanup()and removes any leftover hugepage files from/dev/hugepagesand/mnt/hugeon every init error and on shutdown.Both helpers live in the
Managerbase class, so anything that useslibdaqiri.so— alldaqiri_bench_*, alldaqiri_example_*, the Python bindings, and any external program — gets the fix without code changes. Both backends that talk to DPDK (dpdkandrdma) call the helpers frominitialize()andshutdown().Changes
Code
src/manager.{h,cpp}: adds two helpers to theManagerbase class.check_hugepage_availability()reads/sys/kernel/mm/hugepagesto find how many pages are free, then adds up everything DAQIRI will need: eachkind: HUGEmemory region in the YAML, the dummy queues DAQIRI adds on its own, per-pool overhead, and DPDK's own fixed overhead. If the total is more than what is free, it logs each piece of the sum and prints the exactecho N | sudo tee ...command the user should run. Works for both 2 MiB and 1 GiB pages.cleanup_eal()callsrte_eal_cleanup()and then deletes any leftover<file-prefix>map_*files in/dev/hugepagesand/mnt/huge.src/managers/dpdk/daqiri_dpdk_mgr.cpp:initialize().initialize()fails beforeinitialized_ = trueis set, a small guard object runscleanup_eal()automatically as it goes out of scope. This covers every error path without having to add cleanup at eachreturn.shutdown()now frees the rings beforerte_eal_cleanup()(the previous order was wrong and could touch freed memory).eal_initialized_is true, so it does not touch memory that has already been cleaned up.src/managers/rdma/daqiri_rdma_mgr.cpp: the same four changes as the DPDK manager — preflight at the top ofinitialize(), scope guard for error paths, ring frees beforerte_eal_cleanup()inshutdown(), and a destructor that checkseal_initialized_.Docs
docs/tutorials/benchmarking_examples.md: short "Configure hugepages first" callout pointing at the new check, plus a tighter FAQ pair (preflight path + SIGKILL-orphan cleanup).docs/tutorials/system_configuration.md(DGX Spark tab): bumpedhugepages=3→hugepages=4in the grub recipe to match the shipped Spark YAML's footprint.Tests run
nr_hugepages=1, rundaqiri_bench_raw_tx_rx_spark.yamlecho 381 | sudo tee ...;/dev/hugepagesemptynr_hugepages=2048, rundaqiri_bench_raw_sw_loopback.yamlRemoved leftover hugepage file ...lines on shutdown;HugePages_Freerestored0000:ff:ff.0) to force post-EAL failureFailed to get port number; scope guard runsrte_eal_cleanup();/dev/hugepagesemptyrm(the original symptom)mkdocs build --strictHow a reviewer can validate
Build inside the container, then walk through the checklist. After each run, check
/dev/hugepagesand/mnt/hugeare empty (nomap_*files left behind).cmake -S . -B build -DBUILD_SHARED_LIBS=ON -DDAQIRI_BUILD_PYTHON=OFF -DDAQIRI_MGR="dpdk socket rdma"thencmake --build build -j(run inside the container as the current user). Build succeeds with no errors.nr_hugepages=1, then rundaqiri_bench_raw_gpudirect ./examples/daqiri_bench_raw_tx_rx_spark.yaml --seconds 1. Exit is non-zero, the log shows the per-piece breakdown and anecho N | sudo tee ...recipe,/dev/hugepagesand/mnt/hugeare empty, andHugePages_Freein/proc/meminfois unchanged.nr_hugepages=2048, then rundaqiri_bench_raw_gpudirect ./examples/daqiri_bench_raw_sw_loopback.yaml --seconds 5. Exit is0, the log showsRemoved leftover hugepage file ...lines on shutdown,/dev/hugepagesand/mnt/hugeare empty, andHugePages_Freereturns to2048.examples/daqiri_bench_raw_tx_rx_spark.yaml, replace the PCIe BDFs with bogus values (e.g.0000:ff:ff.0), and run the bench against that file. The log showsFailed to get port number, the scope guard firesrte_eal_cleanup(), and/dev/hugepagesand/mnt/hugeare empty.rm. The second run starts cleanly with noCannot allocate memoryor stale-file errors.mkdocs build --strictis clean.