-
Notifications
You must be signed in to change notification settings - Fork 6
args cleanup #1072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
args cleanup #1072
Conversation
2357024 to
67620ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements an "init handoff" mechanism to transfer configuration from the dataplane-init process to the dataplane worker process using sealed memory file descriptors (memfd). The changes introduce comprehensive argument parsing, hardware device scanning, and zero-copy configuration serialization using rkyv.
Key changes:
- Complete rewrite of
init/src/main.rsto handle device detection, VFIO binding, and configuration handoff - Extensive documentation and type refinement in
args/src/lib.rsincludingNetworkDeviceDescription,LaunchConfiguration, andFinalizedMemFile - Addition of
ProfilingConfigSectionfor Pyroscope integration
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| init/src/main.rs | Implements hardware scanning, device validation, VFIO binding, and configuration serialization/handoff to dataplane worker |
| init/Cargo.toml | Adds dependencies for args parsing, command-fds, miette, rkyv, serde, and tracing |
| args/src/lib.rs | Adds extensive documentation, renames PortArg to NetworkDeviceDescription, adds ProfilingConfigSection, refines configuration types |
| dataplane/Cargo.toml | Adds rkyv dependency for configuration deserialization |
| Dockerfile | Changes entrypoint from /dataplane to /dataplane-init and copies artifact to both paths |
| Cargo.lock | Updates various dependency versions (clap, cc, hashbrown, indexmap, etc.) |
args/src/lib.rs
Outdated
| )] | ||
| #[rkyv(attr(derive(PartialEq, Eq, Debug)))] | ||
| pub struct ProfilingConfigSection { | ||
| /// The URL of the pryroscope url |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'pryroscope' to 'pyroscope'.
| /// The URL of the pryroscope url | |
| /// The URL of the pyroscope server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not fixed
args/src/lib.rs
Outdated
| pub tracing: TracingConfigSection, | ||
| /// Metrics collection configuration | ||
| pub metrics: MetricsConfigSection, | ||
| /// Profileing collection configuration |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'Profileing' to 'Profiling'.
| /// Profileing collection configuration | |
| /// Profiling collection configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not fixed
f6a5cf8 to
33ede97
Compare
init/src/main.rs
Outdated
|
|
||
| let launch_config = launch_config.to_owned_fd(); | ||
|
|
||
| let io_err = std::process::Command::new("/bin/dataplane") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the path to the dataplane should be configurable via cmd line of init itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? It is fixed in the container?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The location of dataplane will be fix in image, yes. Both things (init and dataplane) will be part of the image, so it would be okay to hardcode it. OTH, making it configurable just gives you more flexibility and makes things less implicit. But we can address this later if needed. We just need to make sure that the image builder ensures that dataplane is at /bin/dataplane (or change the init to just "dataplane" and make sure /bin is in the PATH?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't agree with this logic. I think that flexibility is an active hazard in that the process executing the dataplane is highly privileged. Giving a lever to control what is executed is a useless hazard.
Fredi-raspall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me Daniel. Thanks!
Please address the small typos detected by copilot.
qmonnet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please split your first commit. Description says “update documentation”, but it does also a number of other modifications to the code. They look minor, but the size of the commit makes it hard to follow what it does.
I think we should also consider mentioning when some code or docs is AI-generated (it looks like some of you docs are).
args/src/lib.rs
Outdated
| /// Number of dataplane worker threads / cores | ||
| pub dataplane_workers: usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be used in this commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal is to fill out the file. Not consume the file. That is for another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, in that case it would be worth mentioning it in the commit description, in my opinion. At the moment the title says docs(args): basic docs for LaunchConfiguration, which implies we only add docs in that commit, and it's not clear at all why we also add new fields to the struct.
| /// Metrics collection configuration | ||
| pub metrics: MetricsConfigSection, | ||
| /// Profileing collection configuration | ||
| pub profiling: ProfilingConfigSection, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, I see where you set the field but I can't find where you read it. I may have missed it, which is also a good indicator this commit contains too many things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't read it in this PR. The goal is to fill out the file, not consume it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same discussion as above #1072 (comment)
|
Now that we've done |
33ede97 to
4d1cab8
Compare
f089606 to
ccf7366
Compare
ccf7366 to
d061f9f
Compare
These are largely ai generated and then human edited. Co-authored-by: claude sonnet 4.5 Signed-off-by: Daniel Noland <[email protected]>
The lints in this crate were too permissive. Signed-off-by: Daniel Noland <[email protected]>
Signed-off-by: Daniel Noland <[email protected]>
Signed-off-by: Daniel Noland <[email protected]>
Signed-off-by: Daniel Noland <[email protected]>
New config file section to set up and manage pyroscope. Signed-off-by: Daniel Noland <[email protected]>
This allows a child process to inherit configuration from a parent process. Signed-off-by: Daniel Noland <[email protected]>
Signed-off-by: Daniel Noland <[email protected]>
Introduce a trait which describes things which may be finalized into truly read only memory. Signed-off-by: Daniel Noland <[email protected]>
Signed-off-by: Daniel Noland <[email protected]>
Assert is preferred to if + panic. Signed-off-by: Daniel Noland <[email protected]>
Fixes for clippy pedantic and general style. Signed-off-by: Daniel Noland <[email protected]>
This commit series introduces new functionality which broke the prior tests. This commit amends the tests to account for that. Signed-off-by: Daniel Noland <[email protected]>
Signed-off-by: Daniel Noland <[email protected]>
Signed-off-by: Daniel Noland <[email protected]>
Clippy doesn't like the match, so switch to if. Signed-off-by: Daniel Noland <[email protected]>
Signed-off-by: Daniel Noland <[email protected]>
This is needed for consistency with the DPDK driver. Signed-off-by: Daniel Noland <[email protected]>
In addition to being needed for future work, this is needed to make cargo doc pass. Signed-off-by: Daniel Noland <[email protected]>
We never use deserialize, and it doesn't play well with unsafe. Just remove. Signed-off-by: Daniel Noland <[email protected]>
These are needed for upcoming DPDK functionality. Signed-off-by: Daniel Noland <[email protected]>
This is duplicate with PortArgs. Likely PortArgs will need to be renamed to NetworkDeviceDescription to keep git history intact in a future commit. Failing to do so will likely require a massive rework of commit history. For now, just deleting one of them should suffice. Signed-off-by: Daniel Noland <[email protected]>
Failure to consume self here leaves you open to the chance that the immutable criteria on the lifetime will expire and the user will attempt to mutate sealed memory (which will fail). Signed-off-by: Daniel Noland <[email protected]>
d061f9f to
a3ff7d9
Compare
Partially addresses #1051
This is somewhat messy due to the integration push. I intend to clean it up, but I think it should be merged as soon as possible in order to avoid bit rot on the dpdk integration which follows this.