Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BF5CC636D4 for ; Fri, 3 Feb 2023 17:51:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233630AbjBCRvk (ORCPT ); Fri, 3 Feb 2023 12:51:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbjBCRve (ORCPT ); Fri, 3 Feb 2023 12:51:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C435386B4; Fri, 3 Feb 2023 09:51:26 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6F662B82B71; Fri, 3 Feb 2023 17:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D6CAC433EF; Fri, 3 Feb 2023 17:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675446684; bh=UajoyW9n+yiaQw+xQj/VWfYTICp5snUgdh2mt8zSTVI=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=FYliuYY7TBloFrvBYEvn5cjfa5hASN+DrCzpJ+ZgxZ2yrR0MUvv57Cw5egWMWUgpN 4ckb9eFaC371ZQAOXbhzItzRo82CdoPdtoty99AWHMwymSZoJHw5B2khR7HgPZs5oX sMrohWMiU0oYOdY4ReCWUKMNNQ0lKYC6iC3EvbP7/t3MePhH6Gd+4XVNaUcJYQ12/t 4R+KnEskeAu2KMpIruZq3Qo5VnKjGB8JKNFjx3n/x3LdmBe0FRGmL6pAD2CswzqnLF T3gH/VoGIkQizGp3Ww2lLmiLqi/COPAKRi8dGh9+3Lobuib1QndspEB6ibQk0EyJiQ cMBY9v08yytmg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B91AC5C06D0; Fri, 3 Feb 2023 09:51:23 -0800 (PST) Date: Fri, 3 Feb 2023 09:51:23 -0800 From: "Paul E. McKenney" To: Joel Fernandes Cc: Zqiang , frederic@kernel.org, quic_neeraju@quicinc.com, rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] rcutorture: Create nocb tasks only for rcu testing and CONFIG_RCU_NOCB_CPU=y kernel Message-ID: <20230203175123.GK2948950@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20230203064054.3418539-1-qiang1.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 03, 2023 at 12:29:23PM -0500, Joel Fernandes wrote: > On Fri, Feb 3, 2023 at 1:35 AM Zqiang wrote: > > > > When setting nocbs_nthreads to start rcutorture test with a non-zero value, > > the nocb tasks will be created and invoke rcu_nocb_cpu_offload/deoffload() > > to toggle CPU's callback-offload state, but this is meaningless for non-rcu > > testing or CONFIG_RCU_NOCB_CPU=n kernel create nocb tasks to periodically > > toggle CPU's callback-offload state and adds unnecessary testing overhead. > > > > This commit therefore add checks for cur_ops types and CONFIG_RCU_NOCB_CPU > > options when nocbs_nthreads is non-zero to avoid unnecessary nocb task > > creation. > > > > Signed-off-by: Zqiang > > Reviewed-by: Joel Fernandes (Google) Queued and pushed, thank you both! Note that this loses testing of the offload/de-offload API when there is nothing to offload or de-offload, but that is not necessarily the job of rcutorture. Or if it is the job of rcutorture, perhaps it is a single pair of calls somewhere. And that can certainly be a separate patch. But perhaps Frederic has an opinion on what testing is needed for this case, and if so where that testing should live. Thanx, Paul > thanks, > > - Joel > > > > --- > > kernel/rcu/rcutorture.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > > index 297da28ce92d..d01127e0e8cd 100644 > > --- a/kernel/rcu/rcutorture.c > > +++ b/kernel/rcu/rcutorture.c > > @@ -3708,6 +3708,12 @@ rcu_torture_init(void) > > pr_alert("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n"); > > fqs_duration = 0; > > } > > + if (nocbs_nthreads != 0 && (cur_ops != &rcu_ops || > > + !IS_ENABLED(CONFIG_RCU_NOCB_CPU))) { > > + pr_alert("rcu-torture types: %s and CONFIG_RCU_NOCB_CPU=%d, nocb toggle disabled.\n", > > + cur_ops->name, IS_ENABLED(CONFIG_RCU_NOCB_CPU)); > > + nocbs_nthreads = 0; > > + } > > if (cur_ops->init) > > cur_ops->init(); > > > > -- > > 2.25.1 > >