Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: KVM: make corrections to locking.rst

Correct grammar and punctuation.
Use "read-only" for consistency.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20230612030810.23376-3-rdunlap@infradead.org

authored by

Randy Dunlap and committed by
Jonathan Corbet
c37fa9db 4c60d499

+9 -9
+9 -9
Documentation/virt/kvm/locking.rst
··· 67 67 2. Write-Protection: The SPTE is present and the fault is caused by 68 68 write-protect. That means we just need to change the W bit of the spte. 69 69 70 - What we use to avoid all the race is the Host-writable bit and MMU-writable bit 70 + What we use to avoid all the races is the Host-writable bit and MMU-writable bit 71 71 on the spte: 72 72 73 73 - Host-writable means the gfn is writable in the host kernel page tables and in ··· 130 130 A solution for indirect sp could be to pin the gfn, for example via 131 131 kvm_vcpu_gfn_to_pfn_atomic, before the cmpxchg. After the pinning: 132 132 133 - - We have held the refcount of pfn that means the pfn can not be freed and 133 + - We have held the refcount of pfn; that means the pfn can not be freed and 134 134 be reused for another gfn. 135 135 - The pfn is writable and therefore it cannot be shared between different gfns 136 136 by KSM. ··· 186 186 The Dirty bit is lost in this case. 187 187 188 188 In order to avoid this kind of issue, we always treat the spte as "volatile" 189 - if it can be updated out of mmu-lock, see spte_has_volatile_bits(), it means, 189 + if it can be updated out of mmu-lock [see spte_has_volatile_bits()]; it means 190 190 the spte is always atomically updated in this case. 191 191 192 192 3) flush tlbs due to spte updated 193 193 194 - If the spte is updated from writable to readonly, we should flush all TLBs, 194 + If the spte is updated from writable to read-only, we should flush all TLBs, 195 195 otherwise rmap_write_protect will find a read-only spte, even though the 196 196 writable spte might be cached on a CPU's TLB. 197 197 198 198 As mentioned before, the spte can be updated to writable out of mmu-lock on 199 - fast page fault path, in order to easily audit the path, we see if TLBs need 200 - be flushed caused by this reason in mmu_spte_update() since this is a common 199 + fast page fault path. In order to easily audit the path, we see if TLBs needing 200 + to be flushed caused this reason in mmu_spte_update() since this is a common 201 201 function to update spte (present -> present). 202 202 203 203 Since the spte is "volatile" if it can be updated out of mmu-lock, we always 204 - atomically update the spte, the race caused by fast page fault can be avoided, 204 + atomically update the spte and the race caused by fast page fault can be avoided. 205 205 See the comments in spte_has_volatile_bits() and mmu_spte_update(). 206 206 207 207 Lockless Access Tracking: ··· 283 283 :Arch: x86 284 284 :Protects: wakeup_vcpus_on_cpu 285 285 :Comment: This is a per-CPU lock and it is used for VT-d posted-interrupts. 286 - When VT-d posted-interrupts is supported and the VM has assigned 286 + When VT-d posted-interrupts are supported and the VM has assigned 287 287 devices, we put the blocked vCPU on the list blocked_vcpu_on_cpu 288 - protected by blocked_vcpu_on_cpu_lock, when VT-d hardware issues 288 + protected by blocked_vcpu_on_cpu_lock. When VT-d hardware issues 289 289 wakeup notification event since external interrupts from the 290 290 assigned devices happens, we will find the vCPU on the list to 291 291 wakeup.