From patchwork Thu Mar 2 19:56:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 63549 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp43468wrd; Thu, 2 Mar 2023 12:02:17 -0800 (PST) X-Google-Smtp-Source: AK7set+CvD8vXEJav5Kxov5mNR2ZYWaWa04RBmT+7tVas7nuhMfCdo/Dr47bveTOdJ8acGzkL4RE X-Received: by 2002:a17:903:1c1:b0:19d:20f7:dafa with SMTP id e1-20020a17090301c100b0019d20f7dafamr13130787plh.43.1677787337026; Thu, 02 Mar 2023 12:02:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677787337; cv=none; d=google.com; s=arc-20160816; b=cDRPUJzTRnfloDlxok7mVPwj9whLQ0hodhYHituzpWnvyey+6imo2YnLjqGUo60Mes rgFKa7OBSXuriV1qU7S182RNRDOtGE8w2Q1+rI1tT6GpsyI/p0DPuRaWWD2g/ss0j/LP JwkkdNCy2SeU8jY8Df9DzRqm2TeRgiTD/VdLon7FyvCezA8DGYOv0JIXrlQojhxwBZTy j8B51TjO0nTb0b/xKk7evWvknKoPrwByKjT0kGOsBVVocDJ1bMIHjiXaKAz4T7qQyGWm GXFA8MiuOTUhsEpLt/MvPiY/MqLNVug5FWXIQ81JtxMjTqmc0pXIsYhdzkJ9oUw1NbXo VfTw== 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:dkim-signature :dkim-signature:from; bh=BQXtIuVdKd6aYDdz0BrUrqG+XHrNJCfdUZckqmV0CGk=; b=ZwgoO2GnPze3xO4Y3g32aUesWWM5x3MH6J0RrghhkC5O5R4Rxp9DfgM10RzzY85pIs iw9jdlhq9HkcM/u3cXxBVnsfhHQpa85HqNqP6MMJIPGQl21q5tngYpbBDUszyVuVNrU1 +ohqd/LTK4mOz7eGC5bxjhqXcVz4vRd+NQl15HmsdLFXwqQbB4kDdLunOtgM+0Kv1jBj IwYrmbhyQD4BeiISUE6ZyNUsiboGuuTW/gOISd88p7ZaqaeiXTjM14GTsZ/EG6RfBhtR NoW5DOTzxKxpVr+N3/ZkAFhAxdv+Am87W2htZ8YtbIL7NH5o5Ndwksr1taZlxaFurt7u G49g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=lKgPdymx; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Ivxb5hj7; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kt4-20020a170903088400b00194bcc88b52si187929plb.363.2023.03.02.12.02.03; Thu, 02 Mar 2023 12:02:17 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=lKgPdymx; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Ivxb5hj7; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229674AbjCBT6d (ORCPT + 99 others); Thu, 2 Mar 2023 14:58:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230027AbjCBT5w (ORCPT ); Thu, 2 Mar 2023 14:57:52 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A55B48E31; Thu, 2 Mar 2023 11:57:51 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1677787067; 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=BQXtIuVdKd6aYDdz0BrUrqG+XHrNJCfdUZckqmV0CGk=; b=lKgPdymx4ineOUjiWIUNWjOABTzLnRXZY8vvYPeuGMuZWqnHBPU9P2t7cAZ2XErOH9TERp mZFVRGlsJDT9mmyXB2vyT/So853g8vXuVt0VrWgeqBDYsl2CQQ0l/JwodkN74KwAeCGd7h GbpcdgKqBRioGBN6RgjmRl6VGTdc6mG/ld1dhiHAbSFr325qgbqtxcA6nLqVVVwzYoamSw 5bzTiusEtufwdgqd2sHwYpbUlebWmaJfgTvsT4WsSdbX//sVYn4zvF7Fe7ewscZJUCIgOq D1Om2f5V4LFfkUtA+45GZzB61yGT32SHDtw4CnLx9Ttz5eih0506JYBj2XPFog== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1677787067; 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=BQXtIuVdKd6aYDdz0BrUrqG+XHrNJCfdUZckqmV0CGk=; b=Ivxb5hj77f/zf0BVQiuddIlSIi9XtkPI5IZVsai/WeryhUuVI7T0Rj3XQdt8Hfl+dPYn3e khSAw2pY/t5rqSBQ== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , rcu@vger.kernel.org Subject: [PATCH printk v1 17/18] rcu: Add atomic write enforcement for rcu stalls Date: Thu, 2 Mar 2023 21:02:17 +0106 Message-Id: <20230302195618.156940-18-john.ogness@linutronix.de> In-Reply-To: <20230302195618.156940-1-john.ogness@linutronix.de> References: <20230302195618.156940-1-john.ogness@linutronix.de> MIME-Version: 1.0 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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?1759287534635491673?= X-GMAIL-MSGID: =?utf-8?q?1759287534635491673?= Invoke the atomic write enforcement functions for rcu stalls to ensure that the information gets out to the consoles. It is important to note that if there are any legacy consoles registered, they will be attempting to directly print from the printk-caller context, which may jeopardize the reliability of the atomic consoles. Optimally there should be no legacy consoles registered. Signed-off-by: John Ogness --- kernel/rcu/tree_stall.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h index 5653560573e2..25207a213e7a 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -8,6 +8,7 @@ */ #include +#include ////////////////////////////////////////////////////////////////////////////// // @@ -551,6 +552,7 @@ static void rcu_check_gp_kthread_expired_fqs_timer(void) static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps) { + enum cons_prio prev_prio; int cpu; unsigned long flags; unsigned long gpa; @@ -566,6 +568,8 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps) if (rcu_stall_is_suppressed()) return; + prev_prio = cons_atomic_enter(CONS_PRIO_EMERGENCY); + /* * OK, time to rat on our buddy... * See Documentation/RCU/stallwarn.rst for info on how to debug @@ -620,6 +624,8 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps) panic_on_rcu_stall(); rcu_force_quiescent_state(); /* Kick them all. */ + + cons_atomic_exit(CONS_PRIO_EMERGENCY, prev_prio); } static void print_cpu_stall(unsigned long gps)