kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com,
	avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: make guest mode entry to be rcu quiescent state
Date: Tue, 3 May 2011 12:42:41 -0300	[thread overview]
Message-ID: <20110503154240.GA6898@amt.cnet> (raw)
In-Reply-To: <20110503133901.GW2265@redhat.com>

On Tue, May 03, 2011 at 04:39:01PM +0300, Gleb Natapov wrote:
> > > > On Thu, Apr 28, 2011 at 12:52:03PM +0300, Gleb Natapov wrote:
> > > > > KVM does not hold any references to rcu protected data when it switches
> > > > > CPU into a guest mode. In fact switching to a guest mode is very similar
> > > > > to exiting to userspase from rcu point of view. In addition CPU may stay
> > > > > in a guest mode for quite a long time (up to one time slice). Lets treat
> > > > > guest mode as quiescent state, just like we do with user-mode execution.
> > > > > 
> > > > > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > > > > ---
> > > > >  include/linux/kvm_host.h |    1 +
> > > > >  1 files changed, 1 insertions(+), 0 deletions(-)
> > > > > 
> > > > > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> > > > > index 0bc3d37..a347bce 100644
> > > > > --- a/include/linux/kvm_host.h
> > > > > +++ b/include/linux/kvm_host.h
> > > > > @@ -593,6 +593,7 @@ static inline void kvm_guest_enter(void)
> > > > >  {
> > > > >  	account_system_vtime(current);
> > > > >  	current->flags |= PF_VCPU;
> > > > > +	rcu_note_context_switch(smp_processor_id());
> > > > >  }
> > > > >  
> > > > >  static inline void kvm_guest_exit(void)
> > > > > -- 
> > > > > 1.7.2.3
> > > > 
> > > > Please have it in x86's vcpu_enter_guest, then its more explicit
> > > > (uncertain about the context of kvm_guest_enter call in other arches).
> > > > 
> > > I checked all of them and kvm_guest_enter() is always called with local
> > > irq disabled. Paul confirmed that rcu_note_context_switch() can be
> > > called in such context.
> > 
> > OK then. Perhaps have an assert to verify interrupts are disabled?
> Yes. Can add BUG_ON(preemptible()).

Also please add a comment to explain whats going on. The commit message
above seems appropriate.

  reply	other threads:[~2011-05-03 15:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28  9:52 [PATCH 0/2] make kvm guest mode to be rcu quiescent state Gleb Natapov
2011-04-28  9:52 ` [PATCH 1/2] rcu: export rcu_note_context_switch() function Gleb Natapov
2011-04-28 10:01   ` Avi Kivity
2011-04-28 10:11     ` Gleb Natapov
2011-04-29  8:36   ` Paul E. McKenney
2011-04-29  8:39     ` Paul E. McKenney
2011-04-29 18:02       ` Gleb Natapov
2011-04-29 18:23         ` Gleb Natapov
2011-04-30 12:59         ` Paul E. McKenney
2011-04-30 19:43           ` Avi Kivity
2011-05-02 10:56           ` Gleb Natapov
2011-05-02 13:36             ` Paul E. McKenney
2011-05-02 14:10               ` Gleb Natapov
2011-05-03  6:25                 ` Paul E. McKenney
2011-05-04 13:10                   ` Gleb Natapov
2011-04-28  9:52 ` [PATCH 2/2] KVM: make guest mode entry to be rcu quiescent state Gleb Natapov
2011-05-03 13:13   ` Marcelo Tosatti
2011-05-03 13:20     ` Avi Kivity
2011-05-03 13:21     ` Gleb Natapov
2011-05-03 13:29       ` Marcelo Tosatti
2011-05-03 13:39         ` Gleb Natapov
2011-05-03 15:42           ` Marcelo Tosatti [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-04 13:31 [PATCH 0/2] make kvm guest mode " Gleb Natapov
2011-05-04 13:31 ` [PATCH 2/2] KVM: make guest mode entry " Gleb Natapov
2011-05-11  9:57   ` Avi Kivity

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=20110503154240.GA6898@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).