Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp69205ybk; Thu, 14 May 2020 16:30:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjT42dR9/zlSERpqgHtBk0E6/Kp0LeWYNn2Gl7izxRbB3/FvyI09/ny4a0RLex+calRsoC X-Received: by 2002:a50:c045:: with SMTP id u5mr447127edd.122.1589499051353; Thu, 14 May 2020 16:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589499051; cv=none; d=google.com; s=arc-20160816; b=AMkrXN06H7BgGKI8wlVkkku+TE15sBqHYQZkJSfqYmPj37BagEISvOT4pWRWIUilqZ Z0LM4PTv+EaBCzuE2ETBBTe67fFRCE+2wTZXMSjHduxer5WIron8KIE7YhM5z1Wo6v2C QVNuedZDbDoH+H5RFsm8KCS68pimMdrx1IZk3QWdaSoT4l0bcdKkRaclee25VNbjwZX1 rg1fH3CQseABlgy5B8UvYSoiVF1D3+eTCiuDep8H3ypA5iYkHEi1mwpamf/BWM1VVsL4 47UzrOzMoRd6h/3WJN2XBb6T9f1J5Jbo3vhoVD/uGeRRr+Zh5NisSWv9ljkxPd4d5f51 Gz6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uoNiiOE73c5RtYnI2ii0I0EAmmsH7TtVO4ZI0k+qw2o=; b=QBniKKux8XprWQUtS37gAD0oNRtDfWtfHu1JjUbONQpkpazD4QcH6IQknpDDQgXcFq oqsSbtYpr5R5pmTZixp2HYfF3HbH+dMi6e439BAaDJ/y6ROWDmr7C4QIVmS/3xrcDQqm oxBrPvBaBKemCXsdERNhYf+MlCstYHNXhu1XImTji6Gr37sYNWD6ytBeiOtcmzh6rJYM vHobR7nXlh2HnSO1d4/8pM200Tjn+0pGhsMqeVY/q7P7hksC/H5XNSmuMkIWNk4W2WNy Hp8HLtSIg8p86ozs8EACZKw7abe1w3PH3zdn6ZiqRQaNt2sSj2nbkpuVr7AufgvovYiq 4GWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F2NspCxO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si229029ejh.210.2020.05.14.16.30.28; Thu, 14 May 2020 16:30:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F2NspCxO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728611AbgENWa0 (ORCPT + 99 others); Thu, 14 May 2020 18:30:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:41614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728482AbgENWa0 (ORCPT ); Thu, 14 May 2020 18:30:26 -0400 Received: from localhost (lfbn-ncy-1-985-231.w90-101.abo.wanadoo.fr [90.101.63.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 561A92065F; Thu, 14 May 2020 22:30:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589495425; bh=JfZ06iD6joUXIwH8ooSqgCGK+kgADmqALTGYVV5apCs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F2NspCxOGZkToo3+fx8xJC+Qf2ygjE+T7gb19UvYVE1wxrBTPpnfLEZYXpFUrH64p ISqhwDBUmhLLT3spWx6FVO+VlFnbN7F6MnAcMmxYWlIqhlLC9fbcxwomU5a/d5ZoTb VtekT5VPwn3OZ7WMLvTCrEDaWl+5uhESQh/HKZuw= Date: Fri, 15 May 2020 00:30:23 +0200 From: Frederic Weisbecker To: "Paul E. McKenney" Cc: LKML , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Josh Triplett Subject: Re: [PATCH 08/10] rcu: Allow to deactivate nocb on a CPU Message-ID: <20200514223021.GA4071@lenoir> References: <20200513164714.22557-1-frederic@kernel.org> <20200513164714.22557-9-frederic@kernel.org> <20200513183831.GV2869@paulmck-ThinkPad-P72> <20200513224525.GA18303@lenoir> <20200514154707.GL2869@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200514154707.GL2869@paulmck-ThinkPad-P72> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 14, 2020 at 08:47:07AM -0700, Paul E. McKenney wrote: > On Thu, May 14, 2020 at 12:45:26AM +0200, Frederic Weisbecker wrote: > This last seems best to me. The transition from CBLIST_NOT_OFFLOADED > to CBLIST_OFFLOADING of course needs to be on the CPU in question with > at least bh disabled. Probably best to be holding rcu_nocb_lock(), > but that might just be me being overly paranoid. So that's in the case of offloading, right? Well, I don't think we'd need to even disable bh nor lock nocb. We just need the current CPU to see the local update of cblist->offloaded = CBLIST_OFFLOADING before the kthread is unparked: cblist->offloaded = CBLIST_OFFLOADING; /* Make sure subsequent softirq lock nocb */ barrier(); kthread_unpark(rdp->nocb_cb_thread); Now, although that guarantees that nocb_cb will see CBLIST_OFFLOADING upon unparking, it's not guaranteed that the nocb_gp will see it on its next round. Ok so eventually you're right, I should indeed lock nocb... > > > > > +static long rcu_nocb_rdp_deoffload(void *arg) > > > > +{ > > > > + struct rcu_data *rdp = arg; > > > > + > > > > + WARN_ON_ONCE(rdp->cpu != raw_smp_processor_id()); > > > > + __rcu_nocb_rdp_deoffload(rdp); > > > > + > > > > + return 0; > > > > +} > > > > > > For example, is the problem caused by invocations of this > > > rcu_nocb_rdp_deoffload() function? > > > > How so? > > It looked to me like it wasn't excluding either rcu_barrier() or CPU > hotplug. It might also not have been pinning onto the CPU in question, > but that might just be me misremembering. Then again, I didn't see a > call to it, so maybe its callers set things up appropriately. > > OK, I will bite... What is the purpose of rcu_nocb_rdp_deoffload()? ;-) Ah it's called using work_on_cpu() which launch a workqueue on the target and waits for completion. And that whole thing is protected inside the barrier mutex and hotplug. > Agreed! And I do believe that concurrent callback execution will > prove better than a possibly indefinite gap in callback execution. Mutual agreement! :-) Thanks.