Skip to content

KVM: SVM: Fix soft int/ex re-injection

Maciej S. Szmigiero kvm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest12 patches 5 repliesIn review
  2. v15 patches 14 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12KVM: nSVM: Sync next_rip field from vmcb12 to vmcb02arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.h+20 -30 replies
2/12KVM: SVM: Don't BUG if userspace injects an interrupt with GIF=0arch/x86/kvm/svm/svm.c+0 -20 replies
3/12KVM: SVM: Unwind "speculative" RIP advancement if INTn injection "fails"arch/x86/kvm/svm/svm.c+15 -80 replies
4/12KVM: SVM: Stuff next_rip on emulated INT3 injection if NRIPS is supportedarch/x86/kvm/svm/svm.c+5 -10 replies
5/12KVM: SVM: Re-inject INT3/INTO instead of retrying the instructionarch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+129 -430 replies
6/12KVM: SVM: Re-inject INTn instead of retrying the insn on "failure"arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c+22 -80 replies
7/12KVM: x86: Trace re-injected exceptionsarch/x86/kvm/trace.h arch/x86/kvm/x86.c+17 -110 replies
8/12KVM: x86: Print error code in exception injection tracepoint iff validarch/x86/kvm/trace.h+4 -30 replies
9/12KVM: x86: Differentiate Soft vs. Hard IRQs vs. reinjected in tracepointarch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/svm.c arch/x86/kvm/trace.h +2 more+19 -120 replies
10/12KVM: nSVM: Transparently handle L1 -> L2 NMI re-injectionarch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+20 -00 replies
11/12KVM: selftests: nSVM: Add svm_nested_soft_inject_testtools/testing/selftests/kvm/.gitignore tools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/include/x86_64/processor.h +2 more+249 -10 replies
12/12KVM: nSVM: Drop support for CPUs without NRIPS (NextRIP Save) supportarch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c+16 -170 replies

Reviews trailers per patch

6 of 12 patches have a Reviewed-by or Acked-by.

PatchMaxim LevitskySean Christopherson
1/12R-b
2/12
3/12R-b
4/12R-b
5/12
6/12
7/12R-b
8/12R-b
9/12
10/12
11/12R-b
12/12Not-signed-off-by

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

Read the v3 thread

Cover letter [PATCH v3 00/12] KVM: SVM: Fix soft int/ex re-injection

From: "Maciej S. Szmigiero" <[email protected]>

This series is an updated version of Sean's SVM soft interrupt/exception re-injection fixes patch set, which in turn extended and generalized my nSVM L1 -> L2 event injection fixes series.

Detailed list of changes in this version:
* "Downgraded" the commit affecting !nrips CPUs to just drop nested SVM support for such parts instead of SVM support in general,

* Removed the BUG_ON() from svm_inject_irq() completely, instead of replacing it with WARN() - Maxim has pointed out it can still be triggered by userspace via KVM_SET_VCPU_EVENTS,

* Updated the new KVM self-test to switch to an alternate IDT before attempting a second L1 -> L2 injection to cause intervening NPF again,

* Added a fix for L1/L2 NMI state confusion during L1 -> L2 NMI re-injection,

* Updated the new KVM self-test to also check for the NMI injection scenario being fixed (that was found causing issues with a real guest),

* Changed "kvm_inj_virq" trace event "reinjected" field type to bool,

* Integrated the fix from patch 5 for nested_vmcb02_prepare_control() call argument in svm_set_nested_state() to patch 1,

* Collected Maxim's "Reviewed-by:" for tracepoint patches.

Previous versions:
Sean's v2:
https://lore.kernel.org/kvm/[email protected]

Sean's v1:
https://lore.kernel.org/kvm/[email protected]

My original series:
https://lore.kernel.org/kvm/[email protected]

Maciej S. Szmigiero (4):
KVM: nSVM: Sync next_rip field from vmcb12 to vmcb02
KVM: SVM: Don't BUG if userspace injects an interrupt with GIF=0
KVM: nSVM: Transparently handle L1 -> L2 NMI re-injection
KVM: selftests: nSVM: Add svm_nested_soft_inject_test

Sean Christopherson (8):
KVM: SVM: Unwind "speculative" RIP advancement if INTn injection

    "fails"

KVM: SVM: Stuff next_rip on emulated INT3 injection if NRIPS is
supported
KVM: SVM: Re-inject INT3/INTO instead of retrying the instruction
KVM: SVM: Re-inject INTn instead of retrying the insn on "failure"
KVM: x86: Trace re-injected exceptions
KVM: x86: Print error code in exception injection tracepoint iff valid
KVM: x86: Differentiate Soft vs. Hard IRQs vs. reinjected in
tracepoint
KVM: nSVM: Drop support for CPUs without NRIPS (NextRIP Save) support

 arch/x86/include/asm/kvm_host.h               |   2 +-
 arch/x86/kvm/svm/nested.c                     |  55 ++++-
 arch/x86/kvm/svm/svm.c                        | 179 +++++++++++----
 arch/x86/kvm/svm/svm.h                        |   8 +-
 arch/x86/kvm/trace.h                          |  31 ++-
 arch/x86/kvm/vmx/vmx.c                        |   4 +-
 arch/x86/kvm/x86.c                            |  20 +-
 tools/testing/selftests/kvm/.gitignore        |   3 +-
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/include/x86_64/processor.h  |  17 ++
 .../selftests/kvm/include/x86_64/svm_util.h   |  12 +
 .../kvm/x86_64/svm_nested_soft_inject_test.c  | 217 ++++++++++++++++++
 12 files changed, 478 insertions(+), 71 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86_64/svm_nested_soft_inject_test.c