From patchwork Fri Jun 9 12:05:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 105591 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp904778vqr; Fri, 9 Jun 2023 05:21:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ77v38Nr57BNlI5TVCESYfhR2w8l9RHn3qt0oY2bbt8U5odedEqxFtJMDciJBHVlN0xIk9m X-Received: by 2002:a05:6a20:938f:b0:10b:f590:5a26 with SMTP id x15-20020a056a20938f00b0010bf5905a26mr931734pzh.26.1686313276212; Fri, 09 Jun 2023 05:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686313276; cv=none; d=google.com; s=arc-20160816; b=maeJWtIWOEL6wlwUSMR9pk5ud0ePsCriAPJ/3s486KRjrvek2SSLuaT1Sq4Kh0iKkD aEq0FI17PMoK9hjNTm73yX4b68LOYAI+XKrh6ID3aq1obAW1WbANAf6t1W+DNqyxzTNn y0Bv4C61ueJOty3Z7Pa3LKL5rjz3VLDrwsQpOymV4DDxKD3WmfTPU2gutEdHcK4wcCYY PVcO0443CQBOnbHTqY+3LnvfHSCRgFrEnri2ZqMe5x6lQCdv/1ID2ua21vUFnKiJuiOB oOiBYAzJxkUE5tAetrfkWllkLozl9pClAFxuezggBCCPjnkh+HaWxS6KoiCPPNWvW9id zdVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KBgYjdu1mD/Ne93be43aZc56tHxoisikgYYMwiu2y4o=; b=iPRF0SlF+c9S0e4WVlFz2nqvW9NMENesoQ2Tu3NfowCEjlK9K/W4EbYb4AgoErRB+P MPSH9AJrSX2oPWZVwVMAxdRzrQ3UvkLy0LQdqDPFzLaWOA+7e/hh2+AW642XViiccNIS JArFn9CFDque2JZlEkGlsfn/iFEdcKhyDEAnFY21pSNEWSLGfpeB+hqOEfeYi6+z+rzy bICid7BM9kp6ZJKDB37HPDdhBRwBm18hY1ygNjGtRdu4OLaAmsowv6Zc/pkVPiAYYTzK KCDKOcKMQJPFsU8ac7bO7pBgUk06Yy7C2ai6hZRRIZ8rnKzao1f3Ux6HTOZPkOfzAu+N bt8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rl2CDehT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i8-20020a170902c94800b001a6d4ec7c89si2773001pla.222.2023.06.09.05.21.00; Fri, 09 Jun 2023 05:21:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rl2CDehT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S240013AbjFIMFi (ORCPT + 99 others); Fri, 9 Jun 2023 08:05:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239376AbjFIMFc (ORCPT ); Fri, 9 Jun 2023 08:05:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65E212129; Fri, 9 Jun 2023 05:05:31 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id C24F765780; Fri, 9 Jun 2023 12:05:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CAF2C4339B; Fri, 9 Jun 2023 12:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686312330; bh=Mulyl6e7rJ5peE1a5uzhgduBw1OBr/XzNRcGnx3foV0=; h=From:To:Cc:Subject:Date:From; b=rl2CDehTUEs0xIEUKQ8eoHoGIVQcpJqakRt2Xp1wyiJgxVlglzXcw1vg7CDg0D9oB YE1qAFd3+uCnM9VTJMM18+APiuVCPxfiaY+BaCP8QAbuXGmEDj1MHiKd76AE21FO5L 6B2PrSZ4zVReUEI6ZpkgEZ3STpvyxe6kAq06AoGMIcj01XwQ6YmRfgnaKncQv4yTxY xj6M0E4YKInelfjWdyiM/MprConNe/jKvSoh6ViDXcLRPt1zAgTnUsAvS0SQY9ei4f XrNxAUKG2NdcojrP5vRxa7IuF2budoT4hjKmMoIzxvTqwk/lChLJBCkC+hWM1uUJ7U 94TwrYpH45aLA== From: Arnd Bergmann To: "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Davidlohr Bueso Cc: Arnd Bergmann , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Mukesh Ojha , Nicolas Saenz Julienne , Zhen Lei , Qiuxu Zhuo , rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rcuscale: fix building with RCU_TINY Date: Fri, 9 Jun 2023 14:05:14 +0200 Message-Id: <20230609120522.3921015-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768227630049642546?= X-GMAIL-MSGID: =?utf-8?q?1768227630049642546?= From: Arnd Bergmann Both the CONFIG_TASKS_RCU and CONFIG_TASKS_RUDE_RCU options are broken when RCU_TINY is enabled as well, as some functions are missing a declaration. In file included from kernel/rcu/update.c:649: kernel/rcu/tasks.h:1271:21: error: no previous prototype for 'get_rcu_tasks_rude_gp_kthread' [-Werror=missing-prototypes] 1271 | struct task_struct *get_rcu_tasks_rude_gp_kthread(void) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/rcu/rcuscale.c:330:27: error: 'get_rcu_tasks_rude_gp_kthread' undeclared here (not in a function); did you mean 'get_rcu_tasks_trace_gp_kthread'? 330 | .rso_gp_kthread = get_rcu_tasks_rude_gp_kthread, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | get_rcu_tasks_trace_gp_kthread In file included from /home/arnd/arm-soc/kernel/rcu/update.c:649: kernel/rcu/tasks.h:1113:21: error: no previous prototype for 'get_rcu_tasks_gp_kthread' [-Werror=missing-prototypes] 1113 | struct task_struct *get_rcu_tasks_gp_kthread(void) | ^~~~~~~~~~~~~~~~~~~~~~~~ Also, building with CONFIG_TASKS_RUDE_RCU but not CONFIG_TASKS_RCU is broken because of some missing stub functions: kernel/rcu/rcuscale.c:322:27: error: 'tasks_scale_read_lock' undeclared here (not in a function); did you mean 'srcu_scale_read_lock'? 322 | .readlock = tasks_scale_read_lock, | ^~~~~~~~~~~~~~~~~~~~~ | srcu_scale_read_lock kernel/rcu/rcuscale.c:323:27: error: 'tasks_scale_read_unlock' undeclared here (not in a function); did you mean 'srcu_scale_read_unlock'? 323 | .readunlock = tasks_scale_read_unlock, | ^~~~~~~~~~~~~~~~~~~~~~~ | srcu_scale_read_unlock Move the declarations outside of the RCU_TINY #ifdef and duplicate the shared stub functions to address all of the above. Fixes: 88d7ff818f0ce ("rcuscale: Add RCU Tasks Rude testing") Fixes: 755f1c5eb416b ("rcuscale: Measure RCU Tasks Trace grace-period kthread CPU time") Signed-off-by: Arnd Bergmann --- kernel/rcu/rcu.h | 14 ++++++++------ kernel/rcu/rcuscale.c | 13 +++++++++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h index 9829d8161b213..5befd8780dcd3 100644 --- a/kernel/rcu/rcu.h +++ b/kernel/rcu/rcu.h @@ -505,18 +505,20 @@ void rcu_async_relax(void); void rcupdate_announce_bootup_oddness(void); #ifdef CONFIG_TASKS_RCU_GENERIC void show_rcu_tasks_gp_kthreads(void); -# ifdef CONFIG_TASKS_RCU -struct task_struct *get_rcu_tasks_gp_kthread(void); -# endif // # ifdef CONFIG_TASKS_RCU -# ifdef CONFIG_TASKS_RUDE_RCU -struct task_struct *get_rcu_tasks_rude_gp_kthread(void); -# endif // # ifdef CONFIG_TASKS_RUDE_RCU #else /* #ifdef CONFIG_TASKS_RCU_GENERIC */ static inline void show_rcu_tasks_gp_kthreads(void) {} #endif /* #else #ifdef CONFIG_TASKS_RCU_GENERIC */ void rcu_request_urgent_qs_task(struct task_struct *t); #endif /* #else #ifdef CONFIG_TINY_RCU */ +#ifdef CONFIG_TASKS_RCU +struct task_struct *get_rcu_tasks_gp_kthread(void); +#endif // # ifdef CONFIG_TASKS_RCU + +#ifdef CONFIG_TASKS_RUDE_RCU +struct task_struct *get_rcu_tasks_rude_gp_kthread(void); +#endif // # ifdef CONFIG_TASKS_RUDE_RCU + #define RCU_SCHEDULER_INACTIVE 0 #define RCU_SCHEDULER_INIT 1 #define RCU_SCHEDULER_RUNNING 2 diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 5ce3b4e7ce711..a0eae19007088 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -316,11 +316,20 @@ static struct rcu_scale_ops tasks_ops = { * Definitions for RCU-tasks-rude scalability testing. */ +static int tasks_rude_scale_read_lock(void) +{ + return 0; +} + +static void tasks_rude_scale_read_unlock(int idx) +{ +} + static struct rcu_scale_ops tasks_rude_ops = { .ptype = RCU_TASKS_RUDE_FLAVOR, .init = rcu_sync_scale_init, - .readlock = tasks_scale_read_lock, - .readunlock = tasks_scale_read_unlock, + .readlock = tasks_rude_scale_read_lock, + .readunlock = tasks_rude_scale_read_unlock, .get_gp_seq = rcu_no_completed, .gp_diff = rcu_seq_diff, .async = call_rcu_tasks_rude,