Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2360701lqz; Tue, 2 Apr 2024 15:22:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUl1OPJ77uKuwMUcVXF1+CXD72rPeTh/10cmUbKXhnlL15qTljtzo/c/bU5IWbDI5wdqpdK7aSrAYUtUX9vfXs9KAarjC3gvIYmgBS8Zg== X-Google-Smtp-Source: AGHT+IEVvrOujqbJpjGAw5pSCC1zzGWgVKTlCg8KNSGOOLRLqk5gtByD5lNvP3VhtX+4AZQl5Q6W X-Received: by 2002:a17:906:4889:b0:a4e:4389:7dc0 with SMTP id v9-20020a170906488900b00a4e43897dc0mr9039224ejq.69.1712096575186; Tue, 02 Apr 2024 15:22:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712096575; cv=pass; d=google.com; s=arc-20160816; b=soPNUbnxYotnI07sDcYOfcTdIaO1ZWnJLXopOyRZLPe7qZRe8byIeodmGMWNvgjxRn clxxg5cTb/zB/+bbl8ia6nYYrpJBTvMEmJDgfkwztdvYl2zAhUz627acrP5py+jC74jF KuTHBtS7OZLdhA6FbJRDGyRpPQ8QkIeRWk7tykCRSaxFW0acWvSc99CsswC1LRvKyvCj l6WzjyPTTco0rgbJQHHbt1NHQgVwOVjDKPIq4t7QPphiKFwV50fSBpmrl0vDrLxGmMDM 1HOB38ZFlVxU3TnKQuolXhJYM4l1eK6CrPL7erlb5AZjtSwIuhgnUUsg9fELGSqHEPqO zBOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:dkim-signature:dkim-signature:from; bh=Oz8b+gVj+4FTYt+4Ek3fAB/5aQD+Yo6GKug3uRyPfAM=; fh=Zc51f6kezQIPGE+VpfICBLFP+oyouiLrY2CJAQIy7as=; b=Km/bqbl5Dsgeg6AS6BTFsC6F1qcbMJQxwtIfoMErIbyAV93mIdPBuq8NuZSCl7RsNM ldJq2KPbBFpsFAHXoTS0XLu0kxB0ffgoVpbCeLdl+qKHwvyUIZKdg78AXcUjVG6RqxsN cbwrNtYPpeudN9MMiSCEF2LW/rOTrTJJ2P+8wdY/DGDv5fiE8rXGcVt51eofUlx9bVj9 CcIsQriMWbnYj76CNkRpUDVaWrXhGMQscoZPNqqw/OAHSv5w/2DqETyHyVFnnZxHX7Yk 1TvvV4gQ7tlrFuDzVQZK90HlvNbYSzzUGUpMgW0OU+hRqxZy/lBty3HmWfurXpLn1WwD w+lw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dO5zg+CI; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-128786-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128786-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t10-20020a17090605ca00b00a46a6762d7esi6191921ejt.539.2024.04.02.15.22.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:22:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128786-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dO5zg+CI; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-128786-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128786-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6CF2F1F27823 for ; Tue, 2 Apr 2024 22:16:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A1C416A9BF; Tue, 2 Apr 2024 22:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dO5zg+CI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tJQ7G1rI" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8791916A1E0; Tue, 2 Apr 2024 22:11:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712095913; cv=none; b=ufCH7A+SAi81/QoI9XfXkwXq+mKWhT1W0JL4hH6AnZ3NDHP4GkNMX18YPN5sOj/P/kE/x//zhdQgrtDtQDYIg4iRrpTzTJDTe+QSDpUMTGbmsC+81QNjpokRSpg0QnqahWaN3nTvdvgKZwKzg82y3ISKDrtEboeWT7FK6/vcpxk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712095913; c=relaxed/simple; bh=j2Ps0sUvXa5FFGYYiI49hHUu4c3C8/680t0hKerAtnE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lxD9CEzr2fW3C3irAi7nkVfYJCApzIOoD2EL4x4nKfL2hkovSqTmiLrxum6avcbM2XPc/MH5YrGrtV2dmp/PE8u5Zq7Huge5j0ezS2hxGP0VloA6ftNZBVJXRcpBcMtNNQIc+zCpTfWUOCe88OWYxuF72ykgOvST3tJLt7snURI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dO5zg+CI; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tJQ7G1rI; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712095909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Oz8b+gVj+4FTYt+4Ek3fAB/5aQD+Yo6GKug3uRyPfAM=; b=dO5zg+CIEKrGHq6Dupt6+7LhUYJm8SL8mpx+fM39W+ss2I4gf69o4rlCBRIb1DlGbLdVt7 zRuxtuyTf7992BY+eL2tf6+sihsQOD3mGXtFtS7TtRQu1Waz5+MAgIZKSvqSjVWz93j44M 8x+4q2/6NhaJ8z4fw0r9JlQVgFea5lW0E3t4nht/eirqYEYziaD2uxF//KlKBoWZKiz5Eh rYq0dkzhDtx4yoTwZj57jOp/mlOHqDQT1NPhY+CDRf6n+hzUec95YRcOGbFj8UlAbv3Vqj dt7S04iw10YX/sIekI3Z7fmoCvJHrVXrOkl6+vgY5XF2eKmMy//bxFTnf9eXvQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712095909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Oz8b+gVj+4FTYt+4Ek3fAB/5aQD+Yo6GKug3uRyPfAM=; b=tJQ7G1rIEdNc01IoZPTdXpUmpC/eTVUsUntyOQgUHvlfBkOFe1UroCGIagflpVGvGuEmWR JijfC4O3+oaJ4VBA== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , rcu@vger.kernel.org Subject: [PATCH printk v4 26/27] rcu: Mark emergency section in rcu stalls Date: Wed, 3 Apr 2024 00:17:28 +0206 Message-Id: <20240402221129.2613843-27-john.ogness@linutronix.de> In-Reply-To: <20240402221129.2613843-1-john.ogness@linutronix.de> References: <20240402221129.2613843-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Mark emergency sections wherever multiple lines of rcu stall information are generated. In an emergency section the CPU will not perform console output for the printk() calls. Instead, a flushing of the console output is triggered when exiting the emergency section. This allows the full message block to be stored as quickly as possible in the ringbuffer. Signed-off-by: John Ogness --- kernel/rcu/tree_exp.h | 7 +++++++ kernel/rcu/tree_stall.h | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index 6b83537480b1..0a135e94da08 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -7,6 +7,7 @@ * Authors: Paul E. McKenney */ +#include #include static void rcu_exp_handler(void *unused); @@ -571,6 +572,9 @@ static void synchronize_rcu_expedited_wait(void) return; if (rcu_stall_is_suppressed()) continue; + + nbcon_cpu_emergency_enter(); + j = jiffies; rcu_stall_notifier_call_chain(RCU_STALL_NOTIFY_EXP, (void *)(j - jiffies_start)); trace_rcu_stall_warning(rcu_state.name, TPS("ExpeditedStall")); @@ -624,6 +628,9 @@ static void synchronize_rcu_expedited_wait(void) rcu_exp_print_detail_task_stall_rnp(rnp); } jiffies_stall = 3 * rcu_exp_jiffies_till_stall_check() + 3; + + nbcon_cpu_emergency_exit(); + panic_on_rcu_stall(); } } diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h index 5d666428546b..f4d73ca20c76 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -7,6 +7,7 @@ * Author: Paul E. McKenney */ +#include #include #include @@ -604,6 +605,8 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps) if (rcu_stall_is_suppressed()) return; + nbcon_cpu_emergency_enter(); + /* * OK, time to rat on our buddy... * See Documentation/RCU/stallwarn.rst for info on how to debug @@ -655,6 +658,8 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps) rcu_check_gp_kthread_expired_fqs_timer(); rcu_check_gp_kthread_starvation(); + nbcon_cpu_emergency_exit(); + panic_on_rcu_stall(); rcu_force_quiescent_state(); /* Kick them all. */ @@ -675,6 +680,8 @@ static void print_cpu_stall(unsigned long gps) if (rcu_stall_is_suppressed()) return; + nbcon_cpu_emergency_enter(); + /* * OK, time to rat on ourselves... * See Documentation/RCU/stallwarn.rst for info on how to debug @@ -703,6 +710,8 @@ static void print_cpu_stall(unsigned long gps) jiffies + 3 * rcu_jiffies_till_stall_check() + 3); raw_spin_unlock_irqrestore_rcu_node(rnp, flags); + nbcon_cpu_emergency_exit(); + panic_on_rcu_stall(); /* -- 2.39.2