Skip to content
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

Use VTL-aware direct hypercall to get/set registers when possible #125

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

Conversation

stunes-ms
Copy link
Contributor

Modify ProcessorRunner::get_reg and ProcessorRunner::set_reg to use a direct hypercall when possible, instead of our dedicated get/set-register ioctl. Certain registers have special handling in the kernel ioctl handler. Those are left as-is. Get/set for other registers is now made with a direct hypercall.

This has the benefit of being VTL-aware, so this change also adds a VTL parameter.

This change also removes some proliferation of
(g|s)et_vp_registers?(_inner)?, hopefully making it simpler and cleaner. The singular (g|s)et_vp_register is left as an ergonomic convenience.

One unaddressed capability is making ioctls/hypercalls on a batch of registers. This is not strictly a regression, because MSHV_VP_MAX_REGISTERS was previously 1.

@smalis-msft
Copy link
Contributor

Probably don't want to merge this until the VMM tests are back online, given that past iterations have definitely broken them

openhcl/hcl/src/ioctl.rs Outdated Show resolved Hide resolved
openhcl/hcl/src/ioctl.rs Show resolved Hide resolved
openhcl/hcl/src/ioctl.rs Outdated Show resolved Hide resolved
openhcl/hcl/src/ioctl.rs Show resolved Hide resolved
openhcl/hcl/src/ioctl.rs Outdated Show resolved Hide resolved
openhcl/virt_mshv_vtl/src/processor/mshv/arm64.rs Outdated Show resolved Hide resolved
openhcl/virt_mshv_vtl/src/processor/tdx/mod.rs Outdated Show resolved Hide resolved
@stunes-ms stunes-ms force-pushed the user/mikestunes/get-set-vtl branch 2 times, most recently from 341b249 to fff8705 Compare October 25, 2024 17:15
smalis-msft
smalis-msft previously approved these changes Oct 25, 2024
@smalis-msft
Copy link
Contributor

2024-10-25T17:36:30.4833152Z 2024-10-25T17:36:23.768666Z INFO openvmm_log: 18.837411200s INFO underhill_log: inner_level="6" inner_target="kmsg" "[U] task 'set_idle_task', thread 'tp' panicked at openhcl/hcl/src/ioctl.rs:1238:17:" fields={} extra={"timestamp": "16.373058000s"}
2024-10-25T17:36:30.4836425Z 2024-10-25T17:36:23.783801Z INFO openhcl_log: <6>[ 16.392066] [U] assertion failed: matches!(name, HvX64RegisterName::GuestOsId)

smalis-msft
smalis-msft previously approved these changes Oct 29, 2024
openhcl/hcl/src/ioctl.rs Outdated Show resolved Hide resolved
openhcl/hcl/src/ioctl.rs Outdated Show resolved Hide resolved
openhcl/virt_mshv_vtl/src/processor/mshv/arm64.rs Outdated Show resolved Hide resolved
sluck-msft
sluck-msft previously approved these changes Nov 5, 2024
openhcl/hcl/src/ioctl.rs Outdated Show resolved Hide resolved
openhcl/hcl/src/ioctl.rs Outdated Show resolved Hide resolved
Copy link
Member

@jstarks jstarks left a comment

Choose a reason for hiding this comment

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

see comments

openhcl/hcl/src/ioctl.rs Outdated Show resolved Hide resolved
@stunes-ms
Copy link
Contributor Author

see comments

Thanks John! Will handle batching and adding TODO comments tomorrow.

@stunes-ms stunes-ms requested a review from a team as a code owner November 11, 2024 19:24
Modify ProcessorRunner::get_reg and ProcessorRunner::set_reg to use a
direct hypercall when possible, instead of our dedicated
get/set-register ioctl. Certain registers have special handling in the
kernel ioctl handler. Those are left as-is. Get/set for other registers
is now made with a direct hypercall.

This has the benefit of being VTL-aware, so this change also adds a VTL
parameter.

This change also removes some proliferation of
(g|s)et_vp_registers?(_inner)?, hopefully making it simpler and cleaner.
The singular (g|s)et_vp_register is left as an ergonomic convenience.

One unaddressed capability is making ioctls/hypercalls on a batch of
registers. This is not strictly a regression, because
MSHV_VP_MAX_REGISTERS was previously 1.
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