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)
Sun, Apr 21, 8:17 PM
Unknown Object (File)
Mar 4 2024, 7:35 AM
Unknown Object (File)
Feb 15 2024, 6:02 AM
Unknown Object (File)
Feb 15 2024, 5:57 AM
Unknown Object (File)
Feb 15 2024, 5:57 AM
Unknown Object (File)
Feb 15 2024, 3:53 AM
Unknown Object (File)
Feb 4 2024, 8:49 AM
Unknown Object (File)
Dec 29 2023, 7:18 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.