@@ -6416,9 +6416,9 @@ More architecture-specific flags detailing state of the VCPU that may
6416
6416
affect the device's behavior. Current defined flags::
6417
6417
6418
6418
/* x86, set if the VCPU is in system management mode */
6419
- #define KVM_RUN_X86_SMM (1 << 0)
6419
+ #define KVM_RUN_X86_SMM (1 << 0)
6420
6420
/* x86, set if bus lock detected in VM */
6421
- #define KVM_RUN_BUS_LOCK (1 << 1)
6421
+ #define KVM_RUN_X86_BUS_LOCK (1 << 1)
6422
6422
/* arm64, set for KVM_EXIT_DEBUG */
6423
6423
#define KVM_DEBUG_ARCH_HSR_HIGH_VALID (1 << 0)
6424
6424
@@ -7764,29 +7764,31 @@ Valid bits in args[0] are::
7764
7764
#define KVM_BUS_LOCK_DETECTION_OFF (1 << 0)
7765
7765
#define KVM_BUS_LOCK_DETECTION_EXIT (1 << 1)
7766
7766
7767
- Enabling this capability on a VM provides userspace with a way to select
7768
- a policy to handle the bus locks detected in guest. Userspace can obtain
7769
- the supported modes from the result of KVM_CHECK_EXTENSION and define it
7770
- through the KVM_ENABLE_CAP.
7771
-
7772
- KVM_BUS_LOCK_DETECTION_OFF and KVM_BUS_LOCK_DETECTION_EXIT are supported
7773
- currently and mutually exclusive with each other. More bits can be added in
7774
- the future.
7775
-
7776
- With KVM_BUS_LOCK_DETECTION_OFF set, bus locks in guest will not cause vm exits
7777
- so that no additional actions are needed. This is the default mode.
7778
-
7779
- With KVM_BUS_LOCK_DETECTION_EXIT set, vm exits happen when bus lock detected
7780
- in VM. KVM just exits to userspace when handling them. Userspace can enforce
7781
- its own throttling or other policy based mitigations.
7782
-
7783
- This capability is aimed to address the thread that VM can exploit bus locks to
7784
- degree the performance of the whole system. Once the userspace enable this
7785
- capability and select the KVM_BUS_LOCK_DETECTION_EXIT mode, KVM will set the
7786
- KVM_RUN_BUS_LOCK flag in vcpu-run->flags field and exit to userspace. Concerning
7787
- the bus lock vm exit can be preempted by a higher priority VM exit, the exit
7788
- notifications to userspace can be KVM_EXIT_BUS_LOCK or other reasons.
7789
- KVM_RUN_BUS_LOCK flag is used to distinguish between them.
7767
+ Enabling this capability on a VM provides userspace with a way to select a
7768
+ policy to handle the bus locks detected in guest. Userspace can obtain the
7769
+ supported modes from the result of KVM_CHECK_EXTENSION and define it through
7770
+ the KVM_ENABLE_CAP. The supported modes are mutually-exclusive.
7771
+
7772
+ This capability allows userspace to force VM exits on bus locks detected in the
7773
+ guest, irrespective whether or not the host has enabled split-lock detection
7774
+ (which triggers an #AC exception that KVM intercepts). This capability is
7775
+ intended to mitigate attacks where a malicious/buggy guest can exploit bus
7776
+ locks to degrade the performance of the whole system.
7777
+
7778
+ If KVM_BUS_LOCK_DETECTION_OFF is set, KVM doesn't force guest bus locks to VM
7779
+ exit, although the host kernel's split-lock #AC detection still applies, if
7780
+ enabled.
7781
+
7782
+ If KVM_BUS_LOCK_DETECTION_EXIT is set, KVM enables a CPU feature that ensures
7783
+ bus locks in the guest trigger a VM exit, and KVM exits to userspace for all
7784
+ such VM exits, e.g. to allow userspace to throttle the offending guest and/or
7785
+ apply some other policy-based mitigation. When exiting to userspace, KVM sets
7786
+ KVM_RUN_X86_BUS_LOCK in vcpu-run->flags, and conditionally sets the exit_reason
7787
+ to KVM_EXIT_X86_BUS_LOCK.
7788
+
7789
+ Note! Detected bus locks may be coincident with other exits to userspace, i.e.
7790
+ KVM_RUN_X86_BUS_LOCK should be checked regardless of the primary exit reason if
7791
+ userspace wants to take action on all detected bus locks.
7790
7792
7791
7793
7.23 KVM_CAP_PPC_DAWR1
7792
7794
----------------------
0 commit comments