Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp72182ybk; Thu, 14 May 2020 16:36:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJwX0IU/JrIDzgzFjlBaVu08j4zF6a3Eva4D6FPD5+ITh0qlr7AF1kvvMuYPu3ug69lRe+ X-Received: by 2002:a17:906:3952:: with SMTP id g18mr410098eje.191.1589499381883; Thu, 14 May 2020 16:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589499381; cv=none; d=google.com; s=arc-20160816; b=WApA7MyebnaWp8QVyB9gdZCDjs22Sb1Sm7YZD9l8MXNKXtUu0eLhuRXIKS2HnUPzr1 sqBZHCos2nj2PkTLCVyJubkTUPgFDzIMvYb6TztlYtnzBCe4MY7RQJD7INMxzwdiJnZr BmnW5ob/nxGsxGJLrMqbmxw7rMzRyiUdB5CHsjG6mAB5n+laW9sh/DWoIZOULjOlPh42 jthW/dA+kahB/StCIySqzZ51jlndXfaa+L6dNpzdJoV/6bjbF6ROeqN/AFIzCcobmpak +3Y8KLgWI66iYk4AYfjRSl/MOnHrXL/dhwbADRJqFFyrPbrEk5T3wWV6SdLekKqdN23J 9dBw== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=8nFXDZ6l9akviBu4hB97AFlcyVamJtlgs7mZYolAqo0=; b=tu2KJaBElCDbvzUwiKo4jpg/y9WkCiFBJOhOlKzD4FIQUsgXJpYDfTzrjTM4d89rMZ vS208fCwHf3LJ02YsdqOG8PQcfu8cw3giAbh1JW1KtiyIGbixQrhUgjf8nn0YshotVjB Z1aDXnDfcTaao7Odoo8j2I2GGEkck3+Vm8SQ3V5nEnTxT1O4G2Hqj2JyedtsDJzkzTbw 3AY6NVsWeZjNMzGsWl3b2E7eA3ajfrPazPq8ebLDc9tBRDndQgHIGXOYNIUxSa3NXfqq L2YO71J6nUWLgaN+FqxFBFBC0ukjKJay1Iq94eOdYRdySWPGH//7aREJLntSoNGrDTb5 vvJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ibZRUddv; 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 d17si219011ejh.334.2020.05.14.16.35.58; Thu, 14 May 2020 16:36:21 -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=ibZRUddv; 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 S1728865AbgENWrg (ORCPT + 99 others); Thu, 14 May 2020 18:47:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:47934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728229AbgENWrg (ORCPT ); Thu, 14 May 2020 18:47:36 -0400 Received: from paulmck-ThinkPad-P72.home (unknown [50.39.105.78]) (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 7B66320709; Thu, 14 May 2020 22:47:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589496455; bh=iQBGql9/hs9lhCfJ/JyxvS/wQesl/AufJOUCGqFFWQ8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=ibZRUddvhZ1wDWv1IkPJnerw0O6RDh4blVoFd375pCwbmKBVOq5sVFF0dtdkbvxdF Ja1jhAHAr/D2x8rdRM/Tx8b1VCYqzIgyZyIP5TSs9UhQfqBTd8wSuPDb9yci3UmV1o UJYxVXWhy42JbmNyWHxK6WLj0UuBr7N6qBCLD9PQ= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 6265235229C6; Thu, 14 May 2020 15:47:35 -0700 (PDT) Date: Thu, 14 May 2020 15:47:35 -0700 From: "Paul E. McKenney" To: Frederic Weisbecker 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: <20200514224735.GA2869@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org 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> <20200514223021.GA4071@lenoir> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200514223021.GA4071@lenoir> 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 Fri, May 15, 2020 at 12:30:23AM +0200, Frederic Weisbecker wrote: > 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... I suspect that our future selves would hate us much less if we held that lock. ;-) > > > > > +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. Ah! Yet again, color me blind. Thanx, Paul > > Agreed! And I do believe that concurrent callback execution will > > prove better than a possibly indefinite gap in callback execution. > > Mutual agreement! :-) > > Thanks.