Skip to content

vhost-device-gpu: Expose more options as CLI flags #797

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

Merged
merged 7 commits into from
Jan 22, 2025

Conversation

mtjhrc
Copy link
Contributor

@mtjhrc mtjhrc commented Jan 2, 2025

Summary of the PR

This PR adds command line arguments to explicitly configure which capsets to enable and flags to pass to the Rutabaga backend. By specifying the individual capsets explicitly this also fixes a TODO, which hard-coded the number of enabled capsets.

Not all possible capsets from the underlying backends are currently exposed, this exposes only those that at least partially work without blob resources. Previously all capsets, were implicitly enabled (the default in RutabagaBuilder).

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

@mtjhrc mtjhrc changed the title vhost-user-gpu: Expose more options as CLI flags vhost-device-gpu: Expose more options as CLI flags Jan 2, 2025
@mtjhrc mtjhrc force-pushed the improved-cli branch 7 times, most recently from 34e9f4b to 33d97c0 Compare January 7, 2025 16:42
@mtjhrc mtjhrc marked this pull request as ready for review January 7, 2025 16:52
Copy link
Member

@epilys epilys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments, will take a longer look tomorrow

@dorindabassey
Copy link
Collaborator

Thanks for the PR, just one small thing - this PR is below the existing code coverage, can you add enough tests to make it up to the previous code coverage?

@mtjhrc mtjhrc force-pushed the improved-cli branch 3 times, most recently from f4c67cc to 4787a30 Compare January 8, 2025 14:48
@mtjhrc
Copy link
Contributor Author

mtjhrc commented Jan 8, 2025

Thanks for the PR, just one small thing - this PR is below the existing code coverage, can you add enough tests to make it up to the previous code coverage?

I added more tests:

  • test_config_from_args (this actually replaces the test which tested only the capset_names_into_capset part of argument handling)
  • test_default_cli_flags
  • test_gpu_mode_display_eq_arg_name.

Now the coverage should be 88.00% (up from 87.80% without this PR).

@mtjhrc mtjhrc force-pushed the improved-cli branch 2 times, most recently from 956ce52 to 679dedd Compare January 20, 2025 14:17
@stefano-garzarella
Copy link
Member

@mtjhrc can you check musl CI, something is failing: https://buildkite.com/rust-vmm/vhost-device-ci/builds/2957#01948413-0e80-4786-b583-62f6266fc826

Can you also rebase on latest main?

Thanks,
Stefano

The name of the project/backend is "virglrenderer", the dash was added by
clap. Adding the dash seems confusing to the user, the old name is kept
as a hidden alias.

Signed-off-by: Matej Hrica <[email protected]>
Remove capset constants definitions in protocol.rs, these are unecessary,
because we use the constants defined in the Rutabaga crate.

Signed-off-by: Matej Hrica <[email protected]>
Do not build the GPU device for musl targets. To compile it properly would
require setting up a build enivorment with all the native dependencies
compiled with musl as well.

Signed-off-by: Matej Hrica <[email protected]>
Remove the workaround to disable compiling the code on non-gnu targets.
(the CI now doesn't attempt compiling on musl)

Signed-off-by: Matej Hrica <[email protected]>
This was an oversight - for the user to be able to use the crate as a
library, the start_backend needs to be part of the public API.

Signed-off-by: Matej Hrica <[email protected]>
Add command line arguments for configuring which capsets and features are
enabled when configuring Rutabaga.

Since we now specify the capsets explicitly we can drop the MAX_NUM_CAPSETS
constant and fix the TODO.

The curently exposed capsets for virglrenderer are: virgl and virgl2.
For gfxstream they are: gfxstream-vulkan and gfxstream-gles.

Signed-off-by: Matej Hrica <[email protected]>
Update the README to better reflect the limitations of not supporting blob
resources and remove the note about hardcoded number of capsets that has been
fixed.

Signed-off-by: Matej Hrica <[email protected]>
@mtjhrc
Copy link
Contributor Author

mtjhrc commented Jan 22, 2025

As per @epilys suggestion, I excluded the gpu from building with musl in the CI - seems like much nicer solution then then conditional compilation disabling everything 😄

@stefano-garzarella stefano-garzarella enabled auto-merge (rebase) January 22, 2025 14:15
@stefano-garzarella stefano-garzarella merged commit ec0f309 into rust-vmm:main Jan 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants