linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Suleiman Souhlal <suleiman@google.com>,
	rcu@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] rcu: call kvm_check_and_clear_guest_paused unconditionally
Date: Mon, 19 Jul 2021 11:06:44 -0700	[thread overview]
Message-ID: <20210719180644.GY4397@paulmck-ThinkPad-P17-Gen-1> (raw)
In-Reply-To: <YPEly3zNxNUjuc5i@google.com>

On Fri, Jul 16, 2021 at 03:23:07PM +0900, Sergey Senozhatsky wrote:
> On (21/07/16 14:41), Sergey Senozhatsky wrote:
> > @@ -657,6 +657,13 @@ static void check_cpu_stall(struct rcu_data *rdp)
> >  	unsigned long js;
> >  	struct rcu_node *rnp;
> >  
> > +	/*
> > +	 * If a virtual machine is stopped by the host it can look to
> > +	 * the watchdog like an RCU stall. Check to see if the host
> > +	 * stopped the vm.
> > +	 */
> > +	kvm_check_and_clear_guest_paused();
> > +
> >  	lockdep_assert_irqs_disabled();
> >  	if ((rcu_stall_is_suppressed() && !READ_ONCE(rcu_kick_kthreads)) ||
> >  	    !rcu_gp_in_progress())
> > @@ -699,14 +706,6 @@ static void check_cpu_stall(struct rcu_data *rdp)
> >  	    (READ_ONCE(rnp->qsmask) & rdp->grpmask) &&
> >  	    cmpxchg(&rcu_state.jiffies_stall, js, jn) == js) {
> >  
> > -		/*
> > -		 * If a virtual machine is stopped by the host it can look to
> > -		 * the watchdog like an RCU stall. Check to see if the host
> > -		 * stopped the vm.
> > -		 */
> > -		if (kvm_check_and_clear_guest_paused())
> > -			return;
> > -
> >  		/* We haven't checked in, so go dump stack. */
> >  		print_cpu_stall(gps);
> >  		if (READ_ONCE(rcu_cpu_stall_ftrace_dump))
> > @@ -717,14 +716,6 @@ static void check_cpu_stall(struct rcu_data *rdp)
> >  		   ULONG_CMP_GE(j, js + RCU_STALL_RAT_DELAY) &&
> >  		   cmpxchg(&rcu_state.jiffies_stall, js, jn) == js) {
> >  
> > -		/*
> > -		 * If a virtual machine is stopped by the host it can look to
> > -		 * the watchdog like an RCU stall. Check to see if the host
> > -		 * stopped the vm.
> > -		 */
> > -		if (kvm_check_and_clear_guest_paused())
> > -			return;
> > -
> >  		/* They had a few time units to dump stack, so complain. */
> >  		print_other_cpu_stall(gs2, gps);
> >  		if (READ_ONCE(rcu_cpu_stall_ftrace_dump))
> 
> This patch depends on
> https://lore.kernel.org/lkml/20210716053405.1243239-1-senozhatsky@chromium.org/
> 
> If that x86/kvm patch lands, then we need to handle
> PVCLOCK_GUEST_STOPPED in watchdogs.

OK, please let me know how and when you would like to proceed.

> In theory, this patch opens a small race window, if the VCPU gets preempted
> after kvm_check_and_clear_guest_paused() (external interrupt, etc.)
> But it's hard to tell how likely the problem is.

There is always attempting to provoke it, possibly accompanied by
artificially widening the race window.

							Thanx, Paul

      reply	other threads:[~2021-07-19 18:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16  5:41 [RFC PATCH] rcu: call kvm_check_and_clear_guest_paused unconditionally Sergey Senozhatsky
2021-07-16  6:23 ` Sergey Senozhatsky
2021-07-19 18:06   ` Paul E. McKenney [this message]

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=20210719180644.GY4397@paulmck-ThinkPad-P17-Gen-1 \
    --to=paulmck@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=suleiman@google.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).