Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617AbdJLIxm (ORCPT ); Thu, 12 Oct 2017 04:53:42 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:36208 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751368AbdJLIxl (ORCPT ); Thu, 12 Oct 2017 04:53:41 -0400 Date: Thu, 12 Oct 2017 10:53:35 +0200 From: Sebastian Andrzej Siewior To: "Paul E. McKenney" Cc: Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] srcu: queue work without holding the lock Message-ID: <20171012085334.slen6jkovswhxbt7@linutronix.de> References: <20170922152806.22860-1-bigeasy@linutronix.de> <20170922152806.22860-2-bigeasy@linutronix.de> <20170922184610.GT3521@linux.vnet.ibm.com> <20170928160357.anfyrkwq32tyamez@linutronix.de> <20170929011046.GW3521@linux.vnet.ibm.com> <20171010214313.GA19221@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20171010214313.GA19221@linux.vnet.ibm.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017-10-10 14:43:13 [-0700], Paul E. McKenney wrote: > diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c > index 6d5880089ff6..558f9e7b283e 100644 > --- a/kernel/rcu/srcutree.c > +++ b/kernel/rcu/srcutree.c > @@ -830,7 +866,7 @@ void __call_srcu(struct srcu_struct *sp, struct rcu_head *rhp, > rhp->func = func; > local_irq_save(flags); > sdp = this_cpu_ptr(sp->sda); > - raw_spin_lock_rcu_node(sdp); > + spin_lock_rcu_node(sdp); This and the same thing in srcu_might_be_idle() does not work because local_irq_save() + spin_lock() != spin_lock_irqsave() but local_irq_save() + raw_spinlock = raw_spin_lock_irqsave() I think that preempt_disable() for a stable this_cpu_ptr() is enough here. I replaced local_irq_save() with local_lock_irqsave() on RT which provides a per-CPU spinlock (for mutual exclusion) and disables interrupts in !RT mode. I've been testing this for a while and it seems to work. Thank you. > rcu_segcblist_enqueue(&sdp->srcu_cblist, rhp, false); > rcu_segcblist_advance(&sdp->srcu_cblist, > rcu_seq_current(&sp->srcu_gp_seq)); Sebastian