public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney.cavm@gmail.com>
To: kvm@vger.kernel.org
Subject: Q: What is the struct kvm srcu protecting?
Date: Thu, 02 May 2013 11:22:52 -0700	[thread overview]
Message-ID: <5182AEFC.9070703@gmail.com> (raw)

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

             reply	other threads:[~2013-05-02 18:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02 18:22 David Daney [this message]
2013-05-03  1:48 ` Q: What is the struct kvm srcu protecting? Marcelo Tosatti
2013-05-03 10:51   ` Gleb Natapov
2013-05-03 17:21     ` David Daney
2013-05-05  7:37       ` Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5182AEFC.9070703@gmail.com \
    --to=ddaney.cavm@gmail.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox