public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Q: What is the struct kvm srcu protecting?
@ 2013-05-02 18:22 David Daney
  2013-05-03  1:48 ` Marcelo Tosatti
  0 siblings, 1 reply; 5+ messages in thread
From: David Daney @ 2013-05-02 18:22 UTC (permalink / raw)
  To: kvm

Hi,

I am working on the MIPS KVM port, and am trying to figure out under 
which circumstances do I need to srcu_read_lock()/srcu_read_unlock() the 
kvm->srcu.

I am looking at implementing something similar to arch/x86/kvm/x86.c at 
__msr_io(), where we see:

.
.
.
	idx = srcu_read_lock(&vcpu->kvm->srcu);
	for (i = 0; i < msrs->nmsrs; ++i)
		if (do_msr(vcpu, entries[i].index, &entries[i].data))
			break;
	srcu_read_unlock(&vcpu->kvm->srcu, idx);
.
.
.

Why is the srcu_read_lock() taken here?  I see no srcu_dereference() in 
the code path that would indicate the need for obtaining the lock.

I have a feeling that I am missing some essential concept about the 
design of this code, but I don't know what it is.

Can someone explain what is happening here?


Thanks in advance,
David Daney

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-05  7:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-02 18:22 Q: What is the struct kvm srcu protecting? David Daney
2013-05-03  1:48 ` Marcelo Tosatti
2013-05-03 10:51   ` Gleb Natapov
2013-05-03 17:21     ` David Daney
2013-05-05  7:37       ` Gleb Natapov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox