microsoft / machnet

Machnet provides applications like databases and finance an easy way to access low-latency DPDK-based messaging on public cloud VMs. 750K RPS on Azure at 61 us P99.9.
MIT License
67 stars 18 forks source link

Bug in InitDpdk: First arg in rte_args ignored #41

Open ssaroiu opened 3 weeks ago

ssaroiu commented 3 weeks ago

Dpdk::InitDpdk calls rte_eal_init with rte_args, which are command-line options without the program name (basename). A typical rte_args might look like --log-level=eal,8 --proc-type=auto or -c 0x0 -n 6.

However, rte_eal_init expects the traditional argc, argv format, including the program name. In its implementation, rte_eal_init ignores argv[0] and processes arguments starting from argv[1].

As a result, the first parameter in rte_args is ignored by DPDK.

I tested a simple fix by adding a dummy first argument, but this feels like a hack. I can submit a PR with this fix if you'd like. Let me know.

Example of fix in my code

image

anujkaliaiitd commented 3 weeks ago

Hi Stefan. This fix looks good to me, thanks! Please feel free to push directly. This probably explains the trouble I had with enabling DPDK debug logs in Machnet. It might be useful to keep the original eal,8 log filter, but it's fine to change it to 1 if you're finding that better.

ssaroiu commented 3 weeks ago

Thanks Anuj.

I issued PR #42 with this fix. I feel more comfortable if you do a reviewing pass before merging into main.

Note that I also changed the core mask for some of the tests from "0x0" to "0x1". A core mask of "0x0" makes no sense and DPDK would complain: EAL: No lcores in coremask: [0x0] EAL: invalid coremask syntax

Changing the mask to 0x1 fixed the issue.