KVM: Start lock documentation
Subsystems (2)
PATCH 1/1 KVM: Start lock documentation
The goal of this document shall be
- overview of all locks used in KVM core
- provide details on the scope of each lock
- explain the lock type, specifically of a raw spin locks
- provide a lock ordering guide
Start with one dependency chain and two locks.
--- Documentation/kvm/locking.txt | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 Documentation/kvm/locking.txt
Documentation/kvm/locking.txt new file +30 -0
@@ -0,0 +1,30 @@ +KVM Lock Overview +================= + +1. Acquisition Orders +--------------------- + +kvm_lock ++-> kvm::srcu / kvm::lock + +-> kvm::slots_lock + +-> kvm::mmu_lock +... + + +2. Reference +------------ + +Name: kvm_lock +Type: raw_spinlock +Arch: any +Protects: - vm_list + - hardware virtualization enable/disable +Comment: 'raw' because hardware enabling/disabling must be atomic /wrt + migration. + +Name: kvm_arch::tsc_write_lock +Type: raw_spinlock +Arch: x86 +Protects: - kvm_arch::{last_tsc_write,last_tsc_nsec,last_tsc_offset} + - tsc offset in vmcb +Comment: 'raw' because updating the tsc offsets must not be preempted.
Signature · 1 line
1.7.1
Quoted 40 lines · Jan Kiszka
The goal of this document shall be
- overview of all locks used in KVM core
- provide details on the scope of each lock
- explain the lock type, specifically of a raw spin locks
- provide a lock ordering guideStart with one dependency chain and two locks.
Signed-off-by Jan Kiszka <[email protected]>--- Documentation/kvm/locking.txt | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 Documentation/kvm/locking.txtDocumentation/kvm/locking.txt new file +20
-0@@ -0,0 +1,30 @@ +KVM Lock Overview +================= + +1. Acquisition Orders +--------------------- + +kvm_lock ++-> kvm::srcu / kvm::lock + +-> kvm::slots_lock + +-> kvm::mmu_lock +... + + +2. Reference +------------ + +Name: kvm_lock +Type: raw_spinlock +Arch: any +Protects: - vm_list
Documentation/kvm/locking.txt line 30
Quoted 10 lines
Documentation/kvm/locking.txt new file +10
-0+ - hardware virtualization enable/disable +Comment: 'raw' because hardware enabling/disabling must be atomic /wrt + migration. + +Name: kvm_arch::tsc_write_lock +Type: raw_spinlock +Arch: x86 +Protects: - kvm_arch::{last_tsc_write,last_tsc_nsec,last_tsc_offset} + - tsc offset in vmcb +Comment: 'raw' because updating the tsc offsets must not be preempted.
Sorry, Zach, you should likely have a look at this as well.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 21 lines · Jan Kiszka
The goal of this document shall be
- overview of all locks used in KVM core
- provide details on the scope of each lock
- explain the lock type, specifically of a raw spin locks
- provide a lock ordering guideStart with one dependency chain and two locks.
Signed-off-by Jan Kiszka <[email protected]>--- Documentation/kvm/locking.txt | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 Documentation/kvm/locking.txtDocumentation/kvm/locking.txt new file +1
-0@@ -0,0 +1,30 @@ +KVM Lock Overview
Documentation/kvm/locking.txt line 11
Quoted 10 lines
Documentation/kvm/locking.txt new file +10
-0+================= + +1. Acquisition Orders +--------------------- + +kvm_lock ++-> kvm::srcu / kvm::lock + +-> kvm::slots_lock + +-> kvm::mmu_lock +...
Its not easy to understand what you mean here. What kvm_lock has to do with the ordering described below it?
Other than that, "Reference" section structure is fine... (yeah, Avi has been asking it for ages).
Quoted 24 lines
Documentation/kvm/locking.txt new file +18
-0+ +2. Reference +------------ + +Name: kvm_lock +Type: raw_spinlock +Arch: any +Protects: - vm_list + - hardware virtualization enable/disable +Comment: 'raw' because hardware enabling/disabling must be atomic /wrt + migration. + +Name: kvm_arch::tsc_write_lock +Type: raw_spinlock +Arch: x86 +Protects: - kvm_arch::{last_tsc_write,last_tsc_nsec,last_tsc_offset} + - tsc offset in vmcb +Comment: 'raw' because updating the tsc offsets must not be preempted.Signature · 5 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 26 lines · Marcelo Tosatti
Quoted 25 lines · Jan Kiszka
The goal of this document shall be
- overview of all locks used in KVM core
- provide details on the scope of each lock
- explain the lock type, specifically of a raw spin locks
- provide a lock ordering guideStart with one dependency chain and two locks.
Signed-off-by Jan Kiszka<[email protected]>--- Documentation/kvm/locking.txt | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-)create mode 100644
Documentation/kvm/locking.txtDocumentation/kvm/locking.txt new file +5
-0@@ -0,0 +1,30 @@ +KVM Lock Overview +================= + +1. Acquisition Orders +---------------------
Quoted 9 lines
Documentation/kvm/locking.txt line 11
Quoted 6 lines
Documentation/kvm/locking.txt new file +6
-0+ +kvm_lock ++-> kvm::srcu / kvm::lock + +-> kvm::slots_lock + +-> kvm::mmu_lock +...Its not easy to understand what you mean here. What
kvm_lockhas to do with the ordering described below it?
Yeah, I meant to make the same comment but forgot. I suggest a union of paths:
kvm::srcu (read) -> { fields }
| kvm::slots_lock(write) -> { fields }
but let's start with the reference section.
Quoted 27 lines · Marcelo Tosatti
Quoted 26 lines · Jan Kiszka
The goal of this document shall be
- overview of all locks used in KVM core
- provide details on the scope of each lock
- explain the lock type, specifically of a raw spin locks
- provide a lock ordering guideStart with one dependency chain and two locks.
Signed-off-by Jan Kiszka <[email protected]>--- Documentation/kvm/locking.txt | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 Documentation/kvm/locking.txtDocumentation/kvm/locking.txt new file +6
-0@@ -0,0 +1,30 @@ +KVM Lock Overview +================= + +1. Acquisition Orders +--------------------- +
Quoted 8 lines
Documentation/kvm/locking.txt line 11
Quoted 5 lines
Documentation/kvm/locking.txt new file +5
-0+kvm_lock ++-> kvm::srcu / kvm::lock + +-> kvm::slots_lock + +-> kvm::mmu_lock +...Its not easy to understand what you mean here. What
kvm_lockhas to do with the ordering described below it?
kvm_lock is the head of this chain, i.e. there are code paths where it is taken first, then kvm::lock, etc.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 34 lines · Jan Kiszka
Quoted 33 lines · Marcelo Tosatti
Quoted 31 lines · Jan Kiszka
The goal of this document shall be
- overview of all locks used in KVM core
- provide details on the scope of each lock
- explain the lock type, specifically of a raw spin locks
- provide a lock ordering guideStart with one dependency chain and two locks.
Signed-off-by Jan Kiszka<[email protected]>---
Documentation/kvm/locking.txt | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-)create mode 100644
Documentation/kvm/locking.txtdiff --git
a/Documentation/kvm/locking.txtb/Documentation/kvm/locking.txtnew file mode 100644
index 0000000..23f9092
---/dev/null
+++b/Documentation/kvm/locking.txt
@@ -0,0 +1,30 @@
+KVM Lock Overview
+=================
+
+1. Acquisition Orders
+---------------------
+
+kvm_lock
++->kvm::srcu/kvm::lock
+ +->kvm::slots_lock
+ +->kvm::mmu_lock
+...
Quoted 6 lines
Quoted 2 lines
Its not easy to understand what you mean here. What
kvm_lockhas to do with the ordering described below it?
kvm_lockis the head of this chain, i.e. there are code paths where it is taken first, thenkvm::lock, etc.
Right, but it is not mandatory for most fields protected by the lock.
So we have
- which locks _may_ nest, and how
- which locks _must_ nest, and how, to access a particular field (may
depend on type of access for rcu)
Signature · 1 line
error compiling committee.c: too many arguments to function
Avi Kivity
AppliedQuoted 8 lines · Jan Kiszka
The goal of this document shall be
- overview of all locks used in KVM core
- provide details on the scope of each lock
- explain the lock type, specifically of a raw spin locks
- provide a lock ordering guideStart with one dependency chain and two locks.
Applied, with the dependency chain omitted, thanks.
Future patches which affect locking will be required to update this document.
Signature · 1 line
error compiling committee.c: too many arguments to function