Skip to content

TDX: Pull TLB flush ringbuf struct into support/, add tests #1387

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

smalis-msft
Copy link
Contributor

@smalis-msft smalis-msft commented May 20, 2025

The added tests use loom to ensure that all possible order of operations work correctly. This required tweaking the orderings we use. Can be reviewed commit-by-commit.

@smalis-msft smalis-msft requested review from a team as code owners May 20, 2025 19:23
@smalis-msft smalis-msft added the backport_2505 Change should be backported to the release/2505 branch label May 20, 2025
@@ -1817,6 +1817,18 @@ pub mod hypercall {
#[repr(transparent)]
pub struct HvGvaRange(pub u64);

impl From<u64> for HvGvaRange {
Copy link
Member

Choose a reason for hiding this comment

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

why

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So that the new support crate can return a T rather than a raw u64

Copy link
Member

Choose a reason for hiding this comment

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

This seems error prone for other users of HvGvaRange.

Copy link
Contributor Author

@smalis-msft smalis-msft May 20, 2025

Choose a reason for hiding this comment

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

They could always do .0 or HvGvaRange(foo) before, this just works with generics.

Copy link
Member

Choose a reason for hiding this comment

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

I just worry that things like gpa.into() are going to creep in, which will work as long as gpa doesn't have any low bits set... but will cause random failures if there are low bits set.

Copy link
Contributor Author

@smalis-msft smalis-msft May 20, 2025

Choose a reason for hiding this comment

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

That's fair, but From + Into definitely feels like the right API to be exposing from the ringbuf itself so that you don't lose the type of whatever you're storing, right? Unless you'd rather the callers had to do the translations, but that just feels annoying.

@jstarks
Copy link
Member

jstarks commented May 20, 2025

Looks like loom doesn't build for Windows-aarch64.

@smalis-msft
Copy link
Contributor Author

Yeah, this generator dependency doesn't support it. Well we only run this on x86 anyways so...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport_2505 Change should be backported to the release/2505 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants