@@ -8019,8 +8019,8 @@ guest according to the bits in the KVM_CPUID_FEATURES CPUID leaf
8019
8019
(0x40000001). Otherwise, a guest may use the paravirtual features
8020
8020
regardless of what has actually been exposed through the CPUID leaf.
8021
8021
8022
- 8.29 KVM_CAP_DIRTY_LOG_RING
8023
- ---------------------------
8022
+ 8.29 KVM_CAP_DIRTY_LOG_RING/KVM_CAP_DIRTY_LOG_RING_ACQ_REL
8023
+ ----------------------------------------------------------
8024
8024
8025
8025
:Architectures: x86
8026
8026
:Parameters: args[0] - size of the dirty log ring
@@ -8078,6 +8078,11 @@ on to the next GFN. The userspace should continue to do this until the
8078
8078
flags of a GFN have the DIRTY bit cleared, meaning that it has harvested
8079
8079
all the dirty GFNs that were available.
8080
8080
8081
+ Note that on weakly ordered architectures, userspace accesses to the
8082
+ ring buffer (and more specifically the 'flags' field) must be ordered,
8083
+ using load-acquire/store-release accessors when available, or any
8084
+ other memory barrier that will ensure this ordering.
8085
+
8081
8086
It's not necessary for userspace to harvest the all dirty GFNs at once.
8082
8087
However it must collect the dirty GFNs in sequence, i.e., the userspace
8083
8088
program cannot skip one dirty GFN to collect the one next to it.
@@ -8106,6 +8111,14 @@ KVM_CAP_DIRTY_LOG_RING with an acceptable dirty ring size, the virtual
8106
8111
machine will switch to ring-buffer dirty page tracking and further
8107
8112
KVM_GET_DIRTY_LOG or KVM_CLEAR_DIRTY_LOG ioctls will fail.
8108
8113
8114
+ NOTE: KVM_CAP_DIRTY_LOG_RING_ACQ_REL is the only capability that
8115
+ should be exposed by weakly ordered architecture, in order to indicate
8116
+ the additional memory ordering requirements imposed on userspace when
8117
+ reading the state of an entry and mutating it from DIRTY to HARVESTED.
8118
+ Architecture with TSO-like ordering (such as x86) are allowed to
8119
+ expose both KVM_CAP_DIRTY_LOG_RING and KVM_CAP_DIRTY_LOG_RING_ACQ_REL
8120
+ to userspace.
8121
+
8109
8122
8.30 KVM_CAP_XEN_HVM
8110
8123
--------------------
8111
8124
0 commit comments