From patchwork Sun Feb 18 18:57:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 202855 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp913295dyc; Sun, 18 Feb 2024 11:02:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVXwwY1iTsUM9omMAjoEk9313NXRzw2WzMRqHc4NzToOlE8zv9rexAyKNij6Cvrx0CZRyLvTg1Z4FOAay8WOO6mOtTgIA== X-Google-Smtp-Source: AGHT+IFhcHT3xFW76HVYLDO07++M2+GA9WGHq+it9DXAO10zuRu5ACL8PII4sw4NlqFFGf6VkcBu X-Received: by 2002:a05:6a20:94c6:b0:19e:8866:9e56 with SMTP id ht6-20020a056a2094c600b0019e88669e56mr19727906pzb.11.1708282968363; Sun, 18 Feb 2024 11:02:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708282968; cv=pass; d=google.com; s=arc-20160816; b=0M9juBWlqehuXP8ZEaW4Z+dP74q/cb6kDRhSUPkK7DPpb4T8sgJ3zfWGw+wZTsHojK G+vFUK6/m7q8GPAYKGHKMm3Ku8yuXMLYDqXOk7wN0jKrlqQXVj9gJ51+Vp6AbAn2mwaj DPmRbRinywv5nzmDRWghSvk4Y1XNvit0S6cGqr+6AojfH47pgGeXjkFuxvJJSendbrVq VeVCSrFc01AjJg95bVYPLxxqE6tRnm2466GZvfHOs3/y4o/spRDePcCp3CYoG/oxxQUo 8+hyvBT1tA+KgyJm58A9uRKJdlr3w/FXmKJ5amfUE2tGqCasY3ccdQPEU/pbeDk1GEku HJCQ== 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=GUbvpoY1vkrIaf4t1+bOO9YGAlSrhJitnWRmUehFKmc=; fh=HcERdsKYkHJGsPxhUapFKZrjBQucHLNy3P6fbmo6vhw=; b=WNc6krjmE3vFvRiY3UvQ+dSI9JQKcpWjoFlBZQ5piCuP8yYSNyqSb2mnZh6FmTAmiz v6Tm6ELj1SOagXjz/L77vMi3ovnJQS96KszHcoSuxXRMHGB2ZqqdIHCIn4bQ10NdeggU yYff1CvfOoSYZuFpzTcLf2BLZ4rxC8tMF7KwIpYMSbLYA0qBzS4uTmdRebMoGbQLSo+n X6s3dz9z8zCSAJlhFnBw3NvfKWI9J5JlZmfg6udT/MRr8CwFuiQcnMPWPQwwrMkR2tXl oELmeb1fmCVXNnQw/5pCYMWVbhTa8aX4luAbkcaYeCMrProrAVq+MaZshzkS94B4xJiz SfyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kxf6wz3G; 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-70516-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70516-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id m22-20020a63f616000000b005d8e38097f8si3144797pgh.265.2024.02.18.11.02.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:02:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70516-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kxf6wz3G; 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-70516-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70516-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id AC543B211F1 for ; Sun, 18 Feb 2024 19:02:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 524F976C85; Sun, 18 Feb 2024 18:58:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kxf6wz3G"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="5wm9tfqa" 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 A292D7317A for ; Sun, 18 Feb 2024 18:57:57 +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=1708282679; cv=none; b=nPpM93eBy+4c56RG3dRpRKHaeKRaNf/2YxTC4zoABYBM+UdoBdn1veetzkAhV4YhLPrRX7mLRvR3CzqcVmHuHsgGESvJDu6ubKl2iCAf0oUCppHh6Es48s/nL0VuAL3oTk00GboafuvpyKdiH1BsNpj2VlIXJUZyEWa+xSQcGBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282679; c=relaxed/simple; bh=9MS2P3GionMP7c/6VZMtfIJf7yMWxofhT265EbuKiDI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L5vW3rahW7wFn1bkbFGNkQ07MvFg9JSsoUWBYhIY7BefMZM+xCqcxUaN96gTGuym/OGCXJ9FlfU/3nWSaLcwIhP+meX8wQimcmQWS45MTMlHor8ACdZhfxqEYpukdpwkf8DbRLlV37zSFCR3KahtbErh2kmifDwebBTNLpPc65k= 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=kxf6wz3G; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=5wm9tfqa; 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=1708282676; 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=GUbvpoY1vkrIaf4t1+bOO9YGAlSrhJitnWRmUehFKmc=; b=kxf6wz3GUu4qdeFhzXpICe2cGfNBJSkLoT82KX/lAcZbK1dpaDV/emR2wz9uRLKOm+7pfV X+65xFM6mk8goNdIDmv2Jm7NzIGQE0DHhH/fVd+3jNKDsTSF/cfMY8YcxIz3z8RKWnF4lH 4yAjPwxF7ORRa1JtkbmQdQLOx04iIefHtB3a34F0yRu19Yl7rKB17/M3lnBFsI52GYqL3m kGPiT6n+5j5nKi6vPBIyJ0LRhiqo9I9qM6neXMzdICMbTtpcsLiU2b47FmUcOkziXOeCyY BmiguoKf+t3UIdk5pyMCAUtol6CnxZM50YfQ0OiQvu68h708WfRRiJUnaOqDbw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708282676; 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=GUbvpoY1vkrIaf4t1+bOO9YGAlSrhJitnWRmUehFKmc=; b=5wm9tfqaTzyXeL2PKtyecqBe9en8uVauawNKYe+bAlM4JD8JFvwFjfMjY+AJsxeI8QH6y9 U5DlklXhgWwT55Aw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Andrew Morton , Josh Poimboeuf , "Peter Zijlstra (Intel)" , Kefeng Wang , "Guilherme G. Piccoli" , Uros Bizjak , Arnd Bergmann Subject: [PATCH printk v2 23/26] panic: Mark emergency section in warn Date: Sun, 18 Feb 2024 20:03:23 +0106 Message-Id: <20240218185726.1994771-24-john.ogness@linutronix.de> In-Reply-To: <20240218185726.1994771-1-john.ogness@linutronix.de> References: <20240218185726.1994771-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791264521766850809 X-GMAIL-MSGID: 1791264521766850809 From: Thomas Gleixner Mark the full contents of __warn() as an emergency section. In this 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. Co-developed-by: John Ogness Signed-off-by: John Ogness Signed-off-by: Thomas Gleixner (Intel) Reviewed-by: Petr Mladek --- kernel/panic.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/panic.c b/kernel/panic.c index 86813305510f..d30d261f9246 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -667,6 +667,8 @@ struct warn_args { void __warn(const char *file, int line, void *caller, unsigned taint, struct pt_regs *regs, struct warn_args *args) { + nbcon_cpu_emergency_enter(); + disable_trace_on_warning(); if (file) @@ -697,6 +699,8 @@ void __warn(const char *file, int line, void *caller, unsigned taint, /* Just a warning, don't kill lockdep. */ add_taint(taint, LOCKDEP_STILL_OK); + + nbcon_cpu_emergency_exit(); } #ifdef CONFIG_BUG