public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, will@kernel.org,
	hch@lst.de, axboe@kernel.dk, chris@chris-wilson.co.uk,
	davem@davemloft.net, kuba@kernel.org, fweisbec@gmail.com,
	oleg@redhat.com, vincent.guittot@linaro.org
Subject: Re: [RFC][PATCH v3 6/6] rcu/tree: Use irq_work_queue_remote()
Date: Wed, 28 Oct 2020 13:15:54 -0700	[thread overview]
Message-ID: <20201028201554.GE3249@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <20201028200243.GJ2651@hirez.programming.kicks-ass.net>

On Wed, Oct 28, 2020 at 09:02:43PM +0100, Peter Zijlstra wrote:
> On Wed, Oct 28, 2020 at 03:54:28PM +0100, Peter Zijlstra wrote:
> > On Wed, Oct 28, 2020 at 12:07:13PM +0100, Peter Zijlstra wrote:
> > > AFAICT we only need/use irq_work_queue_on() on remote CPUs, since we
> > > can directly access local state.  So avoid the IRQ_WORK dependency and
> > > use the unconditionally available irq_work_queue_remote().
> > > 
> > > This survives a number of TREE01 runs.
> > 
> > OK, Paul mentioned on IRC that while it is extremely unlikely, this code
> > does not indeed guarantee it will not try to IPI self.
> > 
> > I'll try again.
> 
> This is the best I could come up with.. :/
> 
> ---
> Subject: rcu/tree: Use irq_work_queue_remote()
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Wed Oct 28 11:53:40 CET 2020
> 
> All sites that consume rcu_iw_gp_seq seem to have rcu_node lock held,
> so setting it probably should too. Also the effect of self-IPI here
> would be setting rcu_iw_gp_seq to the value we just set it to
> (pointless) and clearing rcu_iw_pending, which we just set, so don't
> set it.
> 
> Passes TREE01.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  kernel/rcu/tree.c |   10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -1308,14 +1308,16 @@ static int rcu_implicit_dynticks_qs(stru
>  			resched_cpu(rdp->cpu);
>  			WRITE_ONCE(rdp->last_fqs_resched, jiffies);
>  		}
> -#ifdef CONFIG_IRQ_WORK
> +		raw_spin_lock_rcu_node(rnp);

The caller of rcu_implicit_dynticks_qs() already holds this lock.
Please see the force_qs_rnp() function and its second call site,
to which rcu_implicit_dynticks_qs() is passed as an argument.

But other than that, this does look plausible.  And getting rid of
that #ifdef is worth something.  ;-)

							Thanx, Paul

>  		if (!rdp->rcu_iw_pending && rdp->rcu_iw_gp_seq != rnp->gp_seq &&
>  		    (rnp->ffmask & rdp->grpmask)) {
> -			rdp->rcu_iw_pending = true;
>  			rdp->rcu_iw_gp_seq = rnp->gp_seq;
> -			irq_work_queue_on(&rdp->rcu_iw, rdp->cpu);
> +			if (likely(rdp->cpu != smp_processor_id())) {
> +				rdp->rcu_iw_pending = true;
> +				irq_work_queue_remote(rdp->cpu, &rdp->rcu_iw);
> +			}
>  		}
> -#endif
> +		raw_spin_unlock_rcu_node(rnp);
>  	}
>  
>  	return 0;

  reply	other threads:[~2020-10-28 22:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28 11:07 [PATCH v3 0/6] smp: irq_work / smp_call_function rework Peter Zijlstra
2020-10-28 11:07 ` [PATCH v3 1/6] irq_work: Cleanup Peter Zijlstra
2020-10-28 13:01   ` Frederic Weisbecker
2020-10-28 11:07 ` [PATCH v3 2/6] smp: Cleanup smp_call_function*() Peter Zijlstra
2020-10-28 13:25   ` Frederic Weisbecker
2020-10-28 11:07 ` [PATCH v3 3/6] irq_work: Optimize irq_work_single() Peter Zijlstra
2020-10-28 12:06   ` Frederic Weisbecker
2020-10-28 11:07 ` [PATCH v3 4/6] irq_work: Unconditionally build on SMP Peter Zijlstra
2020-10-28 13:34   ` Frederic Weisbecker
2020-10-28 14:52     ` Peter Zijlstra
2020-10-28 11:07 ` [PATCH v3 5/6] irq_work: Provide irq_work_queue_remote() Peter Zijlstra
2020-10-28 13:40   ` Frederic Weisbecker
2020-10-28 14:38     ` Peter Zijlstra
2020-10-28 14:53     ` Peter Zijlstra
2020-10-28 14:56       ` Frederic Weisbecker
2020-10-28 11:07 ` [RFC][PATCH v3 6/6] rcu/tree: Use irq_work_queue_remote() Peter Zijlstra
2020-10-28 14:54   ` Peter Zijlstra
2020-10-28 20:02     ` Peter Zijlstra
2020-10-28 20:15       ` Paul E. McKenney [this message]
2020-10-29  9:10         ` Peter Zijlstra
2020-10-29 16:04           ` Paul E. McKenney
2020-10-29 16:14             ` Peter Zijlstra
2020-10-29  9:15         ` Peter Zijlstra
2020-10-29 16:06           ` 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=20201028201554.GE3249@paulmck-ThinkPad-P72 \
    --to=paulmck@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=chris@chris-wilson.co.uk \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=hch@lst.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    --cc=will@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