Page MenuHomeFreeBSD

vmm: Remove the per-vm cookie argument from vmmops taking a vcpu.
ClosedPublic

Authored by jhb on Oct 27 2022, 3:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 3:21 AM
Unknown Object (File)
Wed, Oct 16, 2:49 AM
Unknown Object (File)
Tue, Oct 15, 6:15 PM
Unknown Object (File)
Tue, Oct 15, 6:15 PM
Unknown Object (File)
Oct 12 2024, 11:07 AM
Unknown Object (File)
Oct 11 2024, 3:14 AM
Unknown Object (File)
Oct 9 2024, 9:56 PM
Unknown Object (File)
Oct 9 2024, 4:31 PM

Details

Summary

This requires storing a reference the per-vm cookie in the
CPU-specific vCPU structure. Take advantage of this new field to
remove no-longer-needed function arguments in the CPU-specific
backends. In particular, stop passing the per-vm cookie to functions
that either don't use it or only use it for KTR traces.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

corvink added inline comments.
sys/amd64/vmm/amd/svm.c
286

Why do we keep sc fore this function?

sys/amd64/vmm/amd/svm.c
286

At this stage in the patches sc is still used below to get to sc->vm for vm_set_tsc_offset. Later in the series it does get removed once VCPU_CTR1 and vm_set_tsc_offset no longer need it (D37162)

corvink added inline comments.
sys/amd64/vmm/amd/svm.c
286

A few lines below, you're removing sc from svm_set_intercept. VCPU_CTR3 is called there with vcpu->sc-vm. Many other functions get patched the same way here.

This revision is now accepted and ready to land.Nov 4 2022, 6:42 AM
sys/amd64/vmm/amd/svm.c
286

I think the strategy I followed was "remove the function arguments other than struct vcpu once all non-KTR-related bits stopped using it". So in this case it is about vm_set_tsc_offset and waiting until it changes. I mostly followed this strategy just to make it a series of changes vs one giant change. That said, it doesn't really matter when it changes within the series.