Skip to contentSkip to conversation

Documentation of the kvm->srcu lock

DISCUSSION Thomas Huth 3 participants 5 messages Sep 9, 2013 KVM

lore
Share & tools
lore
#0 lore raw

Hi all!

I am quite new to KVM, and I recently had to struggle with the kvm->srcu lock a little bit ... documentation for this lock seems to be quite sparse, I've only found some descriptions in mailing list archives (the description at the following URL is quite good:
http://www.mail-archive.com/[email protected]/msg90003.html ).

So I wonder whether it would be helpful for others, too, if some information about this lock was added to the documentation file Documentation/virtual/kvm/locking.txt for example? I'd like to suggest the following text as a first draft (using some information from the URL above):

Name: kvm->srcu
Type: srcu lock
Arch: any
Protects: - kvm->memslots
- kvm->buses
Comment: The srcu read lock must be held while accessing memslots (e.g.
when using gfn_to_* functions) and while accessing in-kernel MMIO/PIO address->device structure mapping (kvm->buses). The srcu index can be stored in kvm_vcpu->srcu_idx per vcpu if it is needed by multiple functions.

What do you think? Since I am not an expert in this area, extension and/or corrections are very welcome!

Regards,
Thomas

maintainer
#1 lore raw

Il 09/09/2013 14:00, Thomas Huth ha scritto:

Quoted 26 lines

Hi all!

I am quite new to KVM, and I recently had to struggle with the kvm->srcu lock a little bit ... documentation for this lock seems to be quite sparse, I've only found some descriptions in mailing list archives (the description at the following URL is quite good:
http://www.mail-archive.com/[email protected]/msg90003.html ).

So I wonder whether it would be helpful for others, too, if some information about this lock was added to the documentation file Documentation/virtual/kvm/locking.txt for example? I'd like to suggest the following text as a first draft (using some information from the URL above):

Name: kvm->srcu
Type: srcu lock
Arch: any
Protects: - kvm->memslots

(quoted diff) +0 -0
 		- kvm->buses
 Comment:	The srcu read lock must be held while accessing memslots (e.g.
 		when using gfn_to_* functions) and while accessing in-kernel
 		MMIO/PIO address->device structure mapping (kvm->buses).
 		The srcu index can be stored in kvm_vcpu->srcu_idx per vcpu
 		if it is needed by multiple functions.
Quoted 2 lines

What do you think? Since I am not an expert in this area, extension and/or corrections are very welcome!

Yes, this looks good. Xiao, any suggestions?

Paolo

Reviewed-by
#2 lore raw
Quoted 27 lines · Paolo Bonzini

Il 09/09/2013 14:00, Thomas Huth ha scritto:

Quoted 26 lines

Hi all!

I am quite new to KVM, and I recently had to struggle with the kvm->srcu lock a little bit ... documentation for this lock seems to be quite sparse, I've only found some descriptions in mailing list archives (the description at the following URL is quite good:
http://www.mail-archive.com/[email protected]/msg90003.html ).

So I wonder whether it would be helpful for others, too, if some information about this lock was added to the documentation file Documentation/virtual/kvm/locking.txt for example? I'd like to suggest the following text as a first draft (using some information from the URL above):

Name: kvm->srcu
Type: srcu lock
Arch: any
Protects: - kvm->memslots

(quoted diff) +0 -0
 		- kvm->buses
 Comment:	The srcu read lock must be held while accessing memslots (e.g.
 		when using gfn_to_* functions) and while accessing in-kernel
 		MMIO/PIO address->device structure mapping (kvm->buses).
 		The srcu index can be stored in kvm_vcpu->srcu_idx per vcpu
 		if it is needed by multiple functions.
Quoted 4 lines
Quoted 2 lines

What do you think? Since I am not an expert in this area, extension and/or corrections are very welcome!

Yes, this looks good. Xiao, any suggestions?

It's nice indeed! :)

#3 lore raw

Am Mon, 09 Sep 2013 20:26:49 +0800
schrieb Xiao Guangrong <[email protected]>:

Quoted 28 lines · Paolo Bonzini
Quoted 27 lines

Il 09/09/2013 14:00, Thomas Huth ha scritto:

Quoted 26 lines

Hi all!

I am quite new to KVM, and I recently had to struggle with the kvm->srcu lock a little bit ... documentation for this lock seems to be quite sparse, I've only found some descriptions in mailing list archives (the description at the following URL is quite good:
http://www.mail-archive.com/[email protected]/msg90003.html ).

So I wonder whether it would be helpful for others, too, if some information about this lock was added to the documentation file Documentation/virtual/kvm/locking.txt for example? I'd like to suggest the following text as a first draft (using some information from the URL above):

Name: kvm->srcu
Type: srcu lock
Arch: any
Protects: - kvm->memslots

(quoted diff) +0 -0
 		- kvm->buses
 Comment:	The srcu read lock must be held while accessing memslots (e.g.
 		when using gfn_to_* functions) and while accessing in-kernel
 		MMIO/PIO address->device structure mapping (kvm->buses).
 		The srcu index can be stored in kvm_vcpu->srcu_idx per vcpu
 		if it is needed by multiple functions.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

What do you think? Since I am not an expert in this area, extension and/or corrections are very welcome!

Yes, this looks good. Xiao, any suggestions?

It's nice indeed! :)

Great :-) ... ok, can you then simply pick up the above text or shall I submit a real patch for that file?

Thomas

maintainer
#4 lore raw

Il 09/09/2013 14:47, Thomas Huth ha scritto:

Quoted 34 lines

Am Mon, 09 Sep 2013 20:26:49 +0800
schrieb Xiao Guangrong <[email protected]>:

Quoted 31 lines · Paolo Bonzini
Quoted 30 lines

Il 09/09/2013 14:00, Thomas Huth ha scritto:

Quoted 28 lines

Hi all!

I am quite new to KVM, and I recently had to struggle with the kvm->srcu lock a little bit ... documentation for this lock seems to be quite sparse, I've only found some descriptions in mailing list archives (the description at the following URL is quite good:
http://www.mail-archive.com/[email protected]/msg90003.html ).

So I wonder whether it would be helpful for others, too, if some information about this lock was added to the documentation file Documentation/virtual/kvm/locking.txt for example? I'd like to suggest the following text as a first draft (using some information from the URL above):

Name: kvm->srcu
Type: srcu lock
Arch: any
Protects: - kvm->memslots

(quoted diff) +0 -0
 		- kvm->buses
 Comment:	The srcu read lock must be held while accessing memslots (e.g.
 		when using gfn_to_* functions) and while accessing in-kernel
 		MMIO/PIO address->device structure mapping (kvm->buses).
 		The srcu index can be stored in kvm_vcpu->srcu_idx per vcpu
 		if it is needed by multiple functions.

What do you think? Since I am not an expert in this area, extension and/or corrections are very welcome!

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Yes, this looks good. Xiao, any suggestions?

It's nice indeed! :)

Great :-) ... ok, can you then simply pick up the above text or shall I submit a real patch for that file?

Sending a patch would be appreciated.

Paolo