Skip to content

Add bus lock VM exit support

Chenyi Qiang kvm lkml 9 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest posting 3/34 patches 0 repliesNew
  2. v5 posting 2/30 of 4 patches 0 repliesSuperseded
  3. v5 posting 1/34 patches 1 replyApplied
Earlier versions · 6
VersionPostedPatchesRepliesStatus
v4 posting 2/22 patches4 repliesSuperseded
v4 posting 1/20 of 2 patches0 repliesSuperseded
v3 RFC2 patches2 repliesSuperseded
v2 RFC posting 2/22 patches1 replySuperseded
v2 RFC posting 1/22 patches5 repliesSuperseded
v1 RFC2 patches9 repliesSuperseded

Changes in v5 from the cover letter

- rebase on top of v5.11-rc1
- no difference compared with the last version
- v5:https://lore.kernel.org/lkml/[email protected]/

Patches in v5 posting 3/3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM: VMX: Convert vcpu_vmx.exit_reason to a unionarch/x86/kvm/vmx/nested.c arch/x86/kvm/vmx/vmx.c arch/x86/kvm/vmx/vmx.h+86 -490 replies
2/4KVM: X86: Reset the vcpu->run->flags at the beginning of vcpu_runarch/x86/kvm/x86.c+4 -10 replies
3/4KVM: VMX: Enable bus lock VM exitarch/x86/include/asm/kvm_host.h arch/x86/include/asm/vmx.h arch/x86/include/asm/vmxfeatures.h +7 more+83 -40 replies
4/4KVM: X86: Add the Document for KVM_CAP_X86_BUS_LOCK_EXITDocumentation/virt/kvm/api.rst+42 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [RESEND v5 0/4] Add bus lock VM exit support

Hi all,

Resend a rebased version. Hope to receive your comments.

---

This patch series add the support for bus lock VM exit in KVM. It is a sub-feature of bus lock detection. When it is enabled by the VMM, the processor generates a "Bus Lock" VM exit following execution of an instruction if the processor detects that one or more bus locks were caused the instruction was being executed (due to either direct access by the instruction or stuffed accesses like through A/D updates).

Bus lock VM exit will introduce a new modifier bit (bit 26) in exit_reason field in VMCS which indicates bus lock VM exit is preempted by a higher priority VM exit. The first patch is to apply Sean's refactor for vcpu_vmx.exit_reason as a preparation patch for bus lock VM exit support.

The second patch is the refactor for vcpu->run->flags. Bus lock VM exit will introduce a new field in the flags to inform the userspace that there's a bus lock detected in guest. It's also a preparation patch.

The third patch is the concrete enabling working for bus lock VM exit. Add the support to set the capability to enable bus lock VM exit. The current implementation is just exiting to userspace when handling the bus lock detected in guest.

The detail of throttling policy in user space is still to be discussed. We may enforce ratelimit on bus lock in guest, inject some sleep time, or... We hope to get more ideas on this.

Document for Bus Lock Detection is now available at the latest "Intel Architecture Instruction Set Extensions Programming Reference".

Document Link:
https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

---

Changelogs

v5->v5:
- rebase on top of v5.11-rc1
- no difference compared with the last version
- v5:https://lore.kernel.org/lkml/[email protected]/

v4->v5:
- rebase on top on v5.10-rc2
- add preparation patch that reset the vcpu->run->flags at the beginning of the vcpu_run.(Suggested by Sean)
- set the KVM_RUN_BUS_LOCK for all bus lock exit to avoid checking both exit_reason and run->flags
- add the document to introduce the new kvm capability (KVM_CAP_X86_BUS_LOCK_EXIT)
- v4:https://lore.kernel.org/lkml/[email protected]/

v3->v4:
- rebase on top of v5.9
- some code cleanup.
- v3:https://lore.kernel.org/lkml/[email protected]/

v2->v3:
- use a bitmap to get/set the capability of bus lock detection. we support exit and off mode currently.
- put the handle of exiting to userspace in vmx.c, thus no need to define a shadow to track vmx->exit_reason.bus_lock_detected.
- remove the vcpu->stats.bus_locks since every bus lock exits to userspace.
- v2:https://lore.kernel.org/lkml/[email protected]/

v1->v2:
- resolve Vitaly's comment to introduce the KVM_EXIT_BUS_LOCK and a capability to enable it.
- add the support to exit to user space when handling bus locks.
- extend the vcpu->run->flags to indicate bus lock detected for other exit reasons when exiting to user space.
- v1:https://lore.kernel.org/lkml/[email protected]/

---

Chenyi Qiang (3):
KVM: X86: Reset the vcpu->run->flags at the beginning of vcpu_run
KVM: VMX: Enable bus lock VM exit
KVM: X86: Add the Document for KVM_CAP_X86_BUS_LOCK_EXIT

Sean Christopherson (1):
KVM: VMX: Convert vcpu_vmx.exit_reason to a union

 Documentation/virt/kvm/api.rst     |  45 ++++++++++++-
 arch/x86/include/asm/kvm_host.h    |   7 ++
 arch/x86/include/asm/vmx.h         |   1 +
 arch/x86/include/asm/vmxfeatures.h |   1 +
 arch/x86/include/uapi/asm/kvm.h    |   1 +
 arch/x86/include/uapi/asm/vmx.h    |   4 +-
 arch/x86/kvm/vmx/capabilities.h    |   6 ++
 arch/x86/kvm/vmx/nested.c          |  42 +++++++-----
 arch/x86/kvm/vmx/vmx.c             | 105 +++++++++++++++++++----------
 arch/x86/kvm/vmx/vmx.h             |  25 ++++++-
 arch/x86/kvm/x86.c                 |  28 +++++++-
 include/uapi/linux/kvm.h           |   5 ++
 12 files changed, 214 insertions(+), 56 deletions(-)
Signature · 1 line
2.17.1