linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: avi@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: RCU+KVM: making CPU guest mode a quiescent state.
Date: Tue, 26 Apr 2011 08:55:28 -0700	[thread overview]
Message-ID: <20110426155528.GD2135@linux.vnet.ibm.com> (raw)
In-Reply-To: <20110426123824.GD22443@redhat.com>

On Tue, Apr 26, 2011 at 03:38:24PM +0300, Gleb Natapov wrote:
> Hello Paul,
> 
> I have a question about RCU + KVM. 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). It looks like it will be beneficial to treat guest
> mode as quiescent state, just like user-mode execution. How can this be
> done? I was trying to find how RCU knows about cpu entering user-mode,
> but it seems that it does this by checking CPU mode in a timer interrupt
> (update_process_times()->rcu_check_callbacks()). This will not work for
> guest mode detection since timer interrupt will kick CPU out of a guest
> mode and timer interrupt will always see CPU in kernel mode. Do we have
> a simple function to call to notify RCU that CPU passed quiescent state
> which we can call just before entering guest?

Hello, Gleb,

You could call rcu_note_context_switch(), passing it the current
CPU.  Please note that preemption -must- be disabled when calling
this.  You could call this just after exiting the guest as well
as just before entering guest.

Longer term, it might be interesting to try Frederic Weisbecker's
patch, which disables scheduling-clock interrupts while in user
mode if there is only one runnable task on the CPU in question.

							Thanx, Paul

  reply	other threads:[~2011-04-26 18:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 12:38 RCU+KVM: making CPU guest mode a quiescent state Gleb Natapov
2011-04-26 15:55 ` Paul E. McKenney [this message]
2011-04-27  7:47   ` Avi Kivity
2011-04-27  7:56     ` Gleb Natapov
2011-04-27 22:30     ` Paul E. McKenney
2011-04-27 12:41   ` Gleb Natapov
2011-04-27 22:32     ` Paul E. McKenney

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