Skip to content

KVM: SVM: A fix and cleanups for VMCB intercepts

Sean Christopherson kvm lkml 1 version Applied

Status from this message: Applied to kvm-x86 nested, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest8 patches 6 repliesApplied

Changes in v2 from the cover letter

- Fix the aforementioned bug.
- Split recalc_intercepts() instead of simply renaming it.
- Move the new WARN in nested_vmcb02_recalc_intercepts() to its own patch.
- Use less weird local variables even if they aren't consistent with the existing code...
- ... and then change some names in the existing code to provide consistency.

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/8KVM: SVM: Explicitly mark vmcb01 dirty after modifying VMCB interceptsarch/x86/kvm/svm/nested.c+3 -11 reply
2/8KVM: SVM: Separate recalc_intercepts() into nested vs. non-nested partsarch/x86/kvm/svm/nested.c arch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c +1 more+25 -161 reply
3/8KVM: nSVM: WARN and abort vmcb02 intercepts recalc if vmcb02 isn't activearch/x86/kvm/svm/nested.c+3 -00 replies
4/8KVM: nSVM: Directly (re)calc vmcb02 intercepts from nested_vmcb02_prepare_control()arch/x86/kvm/svm/nested.c+1 -11 reply
5/8KVM: nSVM: Use intuitive local variables in nested_vmcb02_recalc_intercepts()arch/x86/kvm/svm/nested.c+16 -190 replies
6/8KVM: nSVM: Use vmcb12_is_intercept() in nested_sync_control_from_vmcb02()arch/x86/kvm/svm/nested.c+1 -10 replies
7/8KVM: nSVM: Move vmcb_ctrl_area_cached.bus_lock_rip to svm_nested_statearch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+6 -61 reply
8/8KVM: nSVM: Capture svm->nested.ctl as vmcb12_ctrl when preparing vmcb02arch/x86/kvm/svm/nested.c+19 -201 reply

Reviews trailers per patch

5 of 8 patches have a Reviewed-by or Acked-by.

PatchYosry Ahmed
1/8R-b
2/8R-b
3/8
4/8R-b
5/8
6/8
7/8R-b
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/8] KVM: SVM: A fix and cleanups for VMCB intercepts

Fix a likely-benign bug where KVM fails to mark vmcb01 intercepts as dirty after recalculating intercepts while L2 is active, then do a bunch of related cleanup, e.g. to split recalc_intercepts() into nested vs. non-nested functionality.

v2:
- Fix the aforementioned bug.
- Split recalc_intercepts() instead of simply renaming it.
- Move the new WARN in nested_vmcb02_recalc_intercepts() to its own patch.
- Use less weird local variables even if they aren't consistent with the existing code...
- ... and then change some names in the existing code to provide consistency.

v1: https://lkml.kernel.org/r/20260112182022.771276-1-yosry.ahmed%40linux.dev

Sean Christopherson (6):
KVM: SVM: Explicitly mark vmcb01 dirty after modifying VMCB intercepts
KVM: SVM: Separate recalc_intercepts() into nested vs. non-nested
parts
KVM: nSVM: Directly (re)calc vmcb02 intercepts from
nested_vmcb02_prepare_control()
KVM: nSVM: Use intuitive local variables in
nested_vmcb02_recalc_intercepts()
KVM: nSVM: Move vmcb_ctrl_area_cached.bus_lock_rip to svm_nested_state
KVM: nSVM: Capture svm->nested.ctl as vmcb12_ctrl when preparing

    vmcb02

Yosry Ahmed (2):
KVM: nSVM: WARN and abort vmcb02 intercepts recalc if vmcb02 isn't
active
KVM: nSVM: Use vmcb12_is_intercept() in
nested_sync_control_from_vmcb02()

 arch/x86/kvm/svm/nested.c | 88 +++++++++++++++++++--------------------
 arch/x86/kvm/svm/sev.c    |  2 +-
 arch/x86/kvm/svm/svm.c    |  6 +--
 arch/x86/kvm/svm/svm.h    | 28 +++++++++----
 4 files changed, 67 insertions(+), 57 deletions(-)

base-commit: 183bb0ce8c77b0fd1fb25874112bc8751a461e49

Signature · 1 line
2.53.0.345.g96ddfc5eaa-goog