aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/traceevent/plugins/plugin_function.c
diff options
context:
space:
mode:
authorYosry Ahmed <[email protected]>2025-11-08 00:45:21 +0000
committerPaolo Bonzini <[email protected]>2025-11-09 07:50:13 +0000
commit8a4821412cf2c1429fffa07c012dd150f2edf78c (patch)
tree8df83bff036010c86955182b0b5ce91960e094c5 /tools/lib/traceevent/plugins/plugin_function.c
parentKVM: nSVM: Always recalculate LBR MSR intercepts in svm_update_lbrv() (diff)
downloadkernel-8a4821412cf2c1429fffa07c012dd150f2edf78c.tar.gz
kernel-8a4821412cf2c1429fffa07c012dd150f2edf78c.zip
KVM: nSVM: Fix and simplify LBR virtualization handling with nested
The current scheme for handling LBRV when nested is used is very complicated, especially when L1 does not enable LBRV (i.e. does not set LBR_CTL_ENABLE_MASK). To avoid copying LBRs between VMCB01 and VMCB02 on every nested transition, the current implementation switches between using VMCB01 or VMCB02 as the source of truth for the LBRs while L2 is running. If L2 enables LBR, VMCB02 is used as the source of truth. When L2 disables LBR, the LBRs are copied to VMCB01 and VMCB01 is used as the source of truth. This introduces significant complexity, and incorrect behavior in some cases. For example, on a nested #VMEXIT, the LBRs are only copied from VMCB02 to VMCB01 if LBRV is enabled in VMCB01. This is because L2's writes to MSR_IA32_DEBUGCTLMSR to enable LBR are intercepted and propagated to VMCB01 instead of VMCB02. However, LBRV is only enabled in VMCB02 when L2 is running. This means that if L2 enables LBR and exits to L1, the LBRs will not be propagated from VMCB02 to VMCB01, because LBRV is disabled in VMCB01. There is no meaningful difference in CPUID rate in L2 when copying LBRs on every nested transition vs. the current approach, so do the simple and correct thing and always copy LBRs between VMCB01 and VMCB02 on nested transitions (when LBRV is disabled by L1). Drop the conditional LBRs copying in __svm_{enable/disable}_lbrv() as it is now unnecessary. VMCB02 becomes the only source of truth for LBRs when L2 is running, regardless of LBRV being enabled by L1, drop svm_get_lbr_vmcb() and use svm->vmcb directly in its place. Fixes: 1d5a1b5860ed ("KVM: x86: nSVM: correctly virtualize LBR msrs when L2 is running") Cc: [email protected] Signed-off-by: Yosry Ahmed <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Bonzini <[email protected]>
Diffstat (limited to 'tools/lib/traceevent/plugins/plugin_function.c')
0 files changed, 0 insertions, 0 deletions