From patchwork Thu Mar 23 04:39:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 13184954 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 BB189C6FD1C for ; Thu, 23 Mar 2023 04:40:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230174AbjCWEkl (ORCPT ); Thu, 23 Mar 2023 00:40:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbjCWEkY (ORCPT ); Thu, 23 Mar 2023 00:40:24 -0400 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9796630B29; Wed, 22 Mar 2023 21:40:06 -0700 (PDT) Received: by mail-qt1-x833.google.com with SMTP id x1so25328035qtr.7; Wed, 22 Mar 2023 21:40:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679546405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:from:to:cc:subject :date:message-id:reply-to; bh=2eKmVKjQslDGUSFDeB71iLgQhY5mnH9+mfjAkHwLddk=; b=cQdr4XV2Eq7TBZvTX97/MtD3GkBTe7HSo850bFHa4RaMkHLplHqXHJcAIjfTVTiZ1g Le3232ttFxE++p1kpQK32Wzz7Zt6o5q3+OuoH9ieu8zLZwcQea074CxdkMiZq0WgP8Vr 1fj396ReY5xeEoQfWYPZG6tA6F7pSUzETAQ7vcCg3FM8pJwj6rGCxvAW4le2UlvwAlJB LS039M+P/Do0luclFqa2yvYcFVrIxQ2pPjJ1/lBE2ZDbEf2meLEUqHU7yzSuzs9DOCE4 jVsXu4D2/2iylKddPL1K9YQIu9u2oHXbAQCN0d0WIZYOmVHjawFW3/D25UZe1oO+Kc8h z35w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679546405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2eKmVKjQslDGUSFDeB71iLgQhY5mnH9+mfjAkHwLddk=; b=1RuOfcYG9EJcpg1bphdNjOPgHSF1ELV1WH7svdRGBuyfRoIA1nIRq6Y2tA7xgRGeIr njLL28uabfwqCUANsY5wmsJo3FZ+R4DOaKGIUDrmeBv6vm4YdAdkYI8LUOhE9Fc6Oq1R N3ci70lAevv2sKxacIEIZl6BJnR8bB3cBlioF4ujGTzTzXfgFeaKVcAW4zv3YKGgouQR T+ZhQt+VWjNTMX4ls0fwAqv+yHuOlmGbDYIweetoAUtVVIZD2dIdQ8UwoZSwg0jUWG6L V1/Naa0IIuth7upv+BVJisN+A4nnH0R0tMcV/Latb8rEyTMx5RQqtMpBYGlit9ZZcDFo B2Qg== X-Gm-Message-State: AO0yUKXOPGuONlI+9jbF7WmHrOoqGESGxkYYaejkUStCc2obVry88mgG GOcVWAT7Afl/fIebKCJcuRQ= X-Google-Smtp-Source: AK7set+nvPp9HapX8hErMkucpMWsU/jrsPLLDWvqTyPNIdQx1riUEseEqkVxprkJoe+qfhdzbRxv0g== X-Received: by 2002:ac8:58cb:0:b0:3e3:824f:45f1 with SMTP id u11-20020ac858cb000000b003e3824f45f1mr6962454qta.27.1679546405211; Wed, 22 Mar 2023 21:40:05 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id k3-20020ac84743000000b003e07c09cabcsm7230814qtp.4.2023.03.22.21.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 21:40:04 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 62E1827C0054; Thu, 23 Mar 2023 00:40:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 23 Mar 2023 00:40:04 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegfedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeegleejiedthedvheeggfejveefjeejkefgveffieeujefhueeigfegueeh geeggfenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Mar 2023 00:40:03 -0400 (EDT) From: Boqun Feng To: rcu@vger.kernel.org Cc: Davidlohr Bueso , "Paul E. McKenney" , Josh Triplett , Frederic Weisbecker , Neeraj Upadhyay , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Shuah Khan , Bhaskar Chowdhury , Boqun Feng , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Zqiang Subject: [PATCH rcu v2 08/10] rcutorture: Create nocb kthreads only when testing rcu in CONFIG_RCU_NOCB_CPU=y kernels Date: Wed, 22 Mar 2023 21:39:33 -0700 Message-Id: <20230323043935.1221184-9-boqun.feng@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230323043935.1221184-1-boqun.feng@gmail.com> References: <20230323043935.1221184-1-boqun.feng@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: Zqiang Given a non-zero rcutorture.nocbs_nthreads module parameter, the specified number of nocb kthreads will be created, regardless of whether or not the RCU implementation under test is capable of offloading callbacks. Please note that even vanilla RCU is incapable of offloading in kernels built with CONFIG_RCU_NOCB_CPU=n. And when the RCU implementation is incapable of offloading callbacks, there is no point in creating those kthreads. This commit therefore checks the cur_ops.torture_type module parameter and CONFIG_RCU_NOCB_CPU Kconfig option in order to avoid creating unnecessary nocb tasks. Signed-off-by: Zqiang Reviewed-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney [ boqun: Fix checkpatch warning ] Signed-off-by: Boqun Feng --- kernel/rcu/rcutorture.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index c0b2fd687bbb..e046d2c6fe10 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -3525,6 +3525,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();