Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3256828iog; Mon, 20 Jun 2022 15:24:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vpLY1QgYgMF1MWdC9w1ZgoRpezAp3+PXcx737LfiG9B2dG3Ya5MHwcFuOZac7MfdmfaEnk X-Received: by 2002:a17:906:3087:b0:6f4:2901:608a with SMTP id 7-20020a170906308700b006f42901608amr23233144ejv.646.1655763840441; Mon, 20 Jun 2022 15:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655763840; cv=none; d=google.com; s=arc-20160816; b=sy3NjfqoUnUgGcXOTM1VFgw6tVHwO0j6u6eXYEyeTCRSBnq+HcHs/4q2hSKny40Feq XslByCpXi2vfgUQLXhujK6qI3U3lvZRRR29VLT0PRYbg52w+WtZrY+nW5vTCcpcggcTS /wwDdfF74RghRJr2OtzusNhzoMese4SrOk+1qgylK73DZIJgqgJUOKYR6afAFL0qyrjM GXwxQcct/5t3OqCOWJmdUJo0qWFPdALKi8XxTLuQ4GRps2n45BetipDPTW8YLgK1a0qI K7Y0Y1ZdHYiGEIkiYUvZyoyguzxRWxRgiSkGC2DOf7OCGhuqWuYegbnMRSg9OvBSfOd7 Su6w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FaIHTLNHLcXH6uHkyPKL8w65E2kEg+rPt36IZKR5Z2g=; b=jbpe9NexAx5DHlxjSXweENWXuaUCAuk1DbfP2bP5oK1a4OQQ1/fqr74A3N98+lM8Nl cVkO4I6ezFaK13ZAGKxzAedfweG6CLzqgPICVS7batX6CDqCfdWeKvtAoXyqj46rRzcY x36Z16hkXk6COtxQACfn0LxyUfE2YpAQ1UGxk50aRyZul5cCwWBR/eG2C08gDERsZvCa e4YSIclAJNEVJRnjXL1sJkdtDAQRJnL6yT/7q7SL4UirjVzoA+eeHt5APgRluiq3AT5s TFJ/2zqcP5fPRE6LDIWWs2R+K3XRDjWSZ6kLL7NrBS1V81cIscAuP85R9evjQ6bIT/xT I6ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tNZtaJ+c; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j18-20020a056402239200b0043583f0f23bsi3538573eda.495.2022.06.20.15.23.35; Mon, 20 Jun 2022 15:24:00 -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=tNZtaJ+c; 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 S1344398AbiFTWVY (ORCPT + 99 others); Mon, 20 Jun 2022 18:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244520AbiFTWUm (ORCPT ); Mon, 20 Jun 2022 18:20:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E0511B7B6; Mon, 20 Jun 2022 15:20:37 -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 ams.source.kernel.org (Postfix) with ESMTPS id 903ACB81648; Mon, 20 Jun 2022 22:20:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45DCAC3411C; Mon, 20 Jun 2022 22:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655763634; bh=IE9ivt9U+MAy3rcGS7RqeSn8fZ9nZNRTzcq4pLgoURo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tNZtaJ+cm+x9uTAURYlLmWtUMNpLi05YFqr1zKb0c36rsUEZgY9b1I5cO0XD3JF3Y vxVv4F90l4lds2d2dOZXEps6L/+TIdVDQHwFyFcavGtTDz4qKGqRPuuhksUpR2EH4b MrDwVn/r/YvI6ghkZAYsBIbbua6y4dbfpPw47CueV7NibuDQS8/fCitGiDuLwQxp8o T5CItYE8FkkD4WB8PDTqUnbaPI5P3IuxhCjk2sRQ2mmsNapUsVP5CPgeVALndbF9zq kBjW83g939y8flEsLCkzCbGs9I2I8dlkMOheoXX5zsGnmzozHUMl0uP71NkNK5nNKV CjXGHB1n/HyqA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id F40C45C05C8; Mon, 20 Jun 2022 15:20:33 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, rostedt@goodmis.org, Patrick Wang , "Paul E . McKenney" Subject: [PATCH rcu 02/12] rcu: Avoid tracing a few functions executed in stop machine Date: Mon, 20 Jun 2022 15:20:22 -0700 Message-Id: <20220620222032.3839547-2-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20220620222022.GA3839466@paulmck-ThinkPad-P17-Gen-1> References: <20220620222022.GA3839466@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Patrick Wang Stop-machine recently started calling additional functions while waiting: ---------------------------------------------------------------- Former stop machine wait loop: do { cpu_relax(); => macro ... } while (curstate != STOPMACHINE_EXIT); ----------------------------------------------------------------- Current stop machine wait loop: do { stop_machine_yield(cpumask); => function (notraced) ... touch_nmi_watchdog(); => function (notraced, inside calls also notraced) ... rcu_momentary_dyntick_idle(); => function (notraced, inside calls traced) } while (curstate != MULTI_STOP_EXIT); ------------------------------------------------------------------ These functions (and the functions that they call) must be marked notrace to prevent them from being updated while they are executing. The consequences of failing to mark these functions can be severe: rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: rcu: 1-...!: (0 ticks this GP) idle=14f/1/0x4000000000000000 softirq=3397/3397 fqs=0 rcu: 3-...!: (0 ticks this GP) idle=ee9/1/0x4000000000000000 softirq=5168/5168 fqs=0 (detected by 0, t=8137 jiffies, g=5889, q=2 ncpus=4) Task dump for CPU 1: task:migration/1 state:R running task stack: 0 pid: 19 ppid: 2 flags:0x00000000 Stopper: multi_cpu_stop+0x0/0x18c <- stop_machine_cpuslocked+0x128/0x174 Call Trace: Task dump for CPU 3: task:migration/3 state:R running task stack: 0 pid: 29 ppid: 2 flags:0x00000000 Stopper: multi_cpu_stop+0x0/0x18c <- stop_machine_cpuslocked+0x128/0x174 Call Trace: rcu: rcu_preempt kthread timer wakeup didn't happen for 8136 jiffies! g5889 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 rcu: Possible timer handling issue on cpu=2 timer-softirq=594 rcu: rcu_preempt kthread starved for 8137 jiffies! g5889 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 ->cpu=2 rcu: Unless rcu_preempt kthread gets sufficient CPU time, OOM is now expected behavior. rcu: RCU grace-period kthread stack dump: task:rcu_preempt state:I stack: 0 pid: 14 ppid: 2 flags:0x00000000 Call Trace: schedule+0x56/0xc2 schedule_timeout+0x82/0x184 rcu_gp_fqs_loop+0x19a/0x318 rcu_gp_kthread+0x11a/0x140 kthread+0xee/0x118 ret_from_exception+0x0/0x14 rcu: Stack dump where RCU GP kthread last ran: Task dump for CPU 2: task:migration/2 state:R running task stack: 0 pid: 24 ppid: 2 flags:0x00000000 Stopper: multi_cpu_stop+0x0/0x18c <- stop_machine_cpuslocked+0x128/0x174 Call Trace: This commit therefore marks these functions notrace: rcu_preempt_deferred_qs() rcu_preempt_need_deferred_qs() rcu_preempt_deferred_qs_irqrestore() Signed-off-by: Patrick Wang Acked-by: Steven Rostedt (Google) Signed-off-by: Paul E. McKenney --- kernel/rcu/tree_plugin.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index c8ba0fe17267c..440d9e02a26e0 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -460,7 +460,7 @@ static bool rcu_preempt_has_tasks(struct rcu_node *rnp) * be quite short, for example, in the case of the call from * rcu_read_unlock_special(). */ -static void +static notrace void rcu_preempt_deferred_qs_irqrestore(struct task_struct *t, unsigned long flags) { bool empty_exp; @@ -581,7 +581,7 @@ rcu_preempt_deferred_qs_irqrestore(struct task_struct *t, unsigned long flags) * is disabled. This function cannot be expected to understand these * nuances, so the caller must handle them. */ -static bool rcu_preempt_need_deferred_qs(struct task_struct *t) +static notrace bool rcu_preempt_need_deferred_qs(struct task_struct *t) { return (__this_cpu_read(rcu_data.cpu_no_qs.b.exp) || READ_ONCE(t->rcu_read_unlock_special.s)) && @@ -595,7 +595,7 @@ static bool rcu_preempt_need_deferred_qs(struct task_struct *t) * evaluate safety in terms of interrupt, softirq, and preemption * disabling. */ -static void rcu_preempt_deferred_qs(struct task_struct *t) +static notrace void rcu_preempt_deferred_qs(struct task_struct *t) { unsigned long flags; -- 2.31.1.189.g2e36527f23