Message ID | 20240218185726.1994771-25-john.ogness@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-70517-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp913065dyc; Sun, 18 Feb 2024 11:02:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVrGIoIO3VSSORULd0yN5HZBhlL2EedAS/rjTH0+k3HUZUzUwgK1NKK9zzLiyRG4L/sHof6yrw8a2z6D/fftgCLfwS+dQ== X-Google-Smtp-Source: AGHT+IH5+LxZBpGap1TLFkMGu/UAsJjLrDW2nr55hFRxLfXCV7kcjNUJmsX+pllPcf4QGNbqaBRg X-Received: by 2002:a17:906:5586:b0:a3e:6eee:f108 with SMTP id y6-20020a170906558600b00a3e6eeef108mr1182357ejp.52.1708282948313; Sun, 18 Feb 2024 11:02:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708282948; cv=pass; d=google.com; s=arc-20160816; b=rxCr1Gz7HNRU8JUkqqgSF8J6/x8GEde1LTOH0XANUCBqs6HoyyfAYv7ulOzfK+wNq7 owKo2Mwylw/mFP7435CVVLYOve0v17BVxqjAsPIn3EIEztgLZYLbvmqpHYeReUukqTxU 90JpvZdkT1M2cwCt79E0jFdzYJUybYmrArmI4mxA4CBcxTb88yDNskN1IGGzV0rWJFQ7 cIWjbsMCiE7ea2egBEPtQhn445DP8aB8nK7iuDjg9svAIu0JOiKLD57QijEp1W33QNlC RTL6HbBaoXMfUlxIYOQ2Bu7TrMHp3sqoSC+51pazc4i1BSGImbOXTCXuhgbQB1OZeS6f XgPw== 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=vuY4H6DNfOvqdhuJgmJkGITg1xVtZYUjr6s1BV/VGVM=; fh=AqkoYHEBm5sznhcIUwO8PhD1+RF2lHOeWSnt73YGpuY=; b=sqznE+dX6wTjj+GI0gyPgbxOWMdmOkOwHZ+FgzDouWlWg/K1IAUeJCgpHR3vLSzLhJ nyy+LGBXclvn448Nnx9wd2jU+O1mn7lU95MpW606aFHOnIwcGMwB3urjEvDN1XIX9s+u BZ635q4+M6wKlfkrJsv9MfozpNVFwdpp3Hc8H3BMY10Iya2brxTKhIld+K/GgU0otdyc mqB+eFY4EyHV5YPGpkFP+x6YdIPRu1lUEJLqRxnQNsngDxvF7JbFny8tDVAJr+cRAqBS wU+SuHnVh8PrVzkGYrHueFppZ8UsvGHk4tJ8jnmdlaNMNk4ziXW9u7cHg7r65VloLB77 DDfQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ctirOIaN; 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-70517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70517-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w12-20020a17090652cc00b00a3d06c73e18si1820790ejn.603.2024.02.18.11.02.28 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:02:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ctirOIaN; 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-70517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70517-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E90BC1F21893 for <ouuuleilei@gmail.com>; 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 569E476C87; 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="ctirOIaN"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="RqqpxluB" 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 534B973198 for <linux-kernel@vger.kernel.org>; Sun, 18 Feb 2024 18:57:58 +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=1708282680; cv=none; b=FRfx2MhUkqDiKpd1FenA3lmhxgcxpSHOr6pmymypQNz1K531ATUuYHQI4fd3cZqekERkSNSmG6+yD0XnxaABv2x3V22oq/IyHUFZ3k5t0zU2CERFkO2AZOqqcnOQofpAoBTFwvnw1szfILnoKVtR8oAQFUfxqA/U5QADqiDArG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282680; c=relaxed/simple; bh=KzZOuY5lO3xJJiP/W1QN+WoXmg5dBEU4teyAhbH6PyM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QhGxNcUIbkS9OP1rqDZcWodK6ojIBKL0YCafEtygoppKL6NOT6yQaELhUzbhjWoIeq8yngbOZNeQgWo0x04U/opmwg/ABi3cABNKy9hgS+NWyNq4e6N1Ittjwf1I81PbIb4mJoytunPeK+iyuVDZ6aC8QmiXQjzy+/Qi2+G13tQ= 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=ctirOIaN; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=RqqpxluB; 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 <john.ogness@linutronix.de> 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=vuY4H6DNfOvqdhuJgmJkGITg1xVtZYUjr6s1BV/VGVM=; b=ctirOIaNRIvgvx3YlEoT7eH4LHmxuqM1FokSoyH0oWhdq5jTYW+lYL/44OKj6rsAY5RpHU frOqOjhxm1qw2g0xiZ155kVd/OxpvloShfzpNUx01Sk4PcAmjHDs5XFq5SY3zojwP44Niq kzuFFtUdhdYhkhJLWdxnh7H0aJNevyyCAHMDzAD1jkPltPwhfq/vDUtYAATl5c/c/QkGSh YhQOiylqDCC57M3b5lC4o3b+XocaT2fVAfMSuZLrpWxyx0vIeYKO/wyA9D9YvImqOK+KfG 4ygRkaJdPAqFfgSlKNV+NsklnZIxpcjlLBCaLg1NSY7N9DGFfkGz0zQmyiqZ5w== 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=vuY4H6DNfOvqdhuJgmJkGITg1xVtZYUjr6s1BV/VGVM=; b=RqqpxluB27iUY1upXjEPYku+xInDFnSzwmsETUKpBmIETtkeLCPFtzkFtxr0vooC1/lybD z01lu3AituTxVGBQ== To: Petr Mladek <pmladek@suse.com> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>, Steven Rostedt <rostedt@goodmis.org>, Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>, "Peter Zijlstra (Intel)" <peterz@infradead.org>, Josh Poimboeuf <jpoimboe@kernel.org>, "Guilherme G. Piccoli" <gpiccoli@igalia.com>, Arnd Bergmann <arnd@arndb.de>, Kefeng Wang <wangkefeng.wang@huawei.com>, Uros Bizjak <ubizjak@gmail.com> Subject: [PATCH printk v2 24/26] panic: Mark emergency section in oops Date: Sun, 18 Feb 2024 20:03:24 +0106 Message-Id: <20240218185726.1994771-25-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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791264500768819036 X-GMAIL-MSGID: 1791264500768819036 |
Series |
wire up write_atomic() printing
|
|
Commit Message
John Ogness
Feb. 18, 2024, 6:57 p.m. UTC
Mark an emergency section beginning with oops_enter() until the
end of oops_exit(). 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.
The very end of oops_exit() performs a kmsg_dump(). This is not
included in the emergency section because it is another
flushing mechanism that should occur after the consoles have
been triggered to flush.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
kernel/panic.c | 2 ++
1 file changed, 2 insertions(+)
Comments
On Sun 2024-02-18 20:03:24, John Ogness wrote: > Mark an emergency section beginning with oops_enter() until the > end of oops_exit(). 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. > > The very end of oops_exit() performs a kmsg_dump(). This is not > included in the emergency section because it is another > flushing mechanism that should occur after the consoles have > been triggered to flush. > > Signed-off-by: John Ogness <john.ogness@linutronix.de> > --- > kernel/panic.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/kernel/panic.c b/kernel/panic.c > index d30d261f9246..9fa44bc38f46 100644 > --- a/kernel/panic.c > +++ b/kernel/panic.c > @@ -634,6 +634,7 @@ bool oops_may_print(void) > */ > void oops_enter(void) > { > + nbcon_cpu_emergency_enter(); > tracing_off(); > /* can't trust the integrity of the kernel anymore: */ > debug_locks_off(); > @@ -656,6 +657,7 @@ void oops_exit(void) > { > do_oops_enter_exit(); The comment above oops_enter() function says: /* * Called when the architecture enters its oops handler, before it prints * anything. If this is the first CPU to oops, and it's oopsing the first * time then let it proceed. * * This is all enabled by the pause_on_oops kernel boot option. We do all * this to ensure that oopses don't scroll off the screen. It has the * side-effect of preventing later-oopsing CPUs from mucking up the display, * too. * * It turns out that the CPU which is allowed to print ends up pausing for * the right duration, whereas all the other CPUs pause for twice as long: * once in oops_enter(), once in oops_exit(). */ and indeed do_oops_enter_exit(); does the waiting. IMHO, we should enter() the emergency context after waiting in oops_enter(). And exit() it before waiting in oops_exit(). Aka void oops_enter(void) { tracing_off(); /* can't trust the integrity of the kernel anymore: */ debug_locks_off(); do_oops_enter_exit(); + nbcon_cpu_emergency_enter(); if (sysctl_oops_all_cpu_backtrace) trigger_all_cpu_backtrace(); } void oops_exit(void) { + nbcon_cpu_emergency_exit(); do_oops_enter_exit(); print_oops_end_marker(); kmsg_dump(KMSG_DUMP_OOPS); } > print_oops_end_marker(); > + nbcon_cpu_emergency_exit(); > kmsg_dump(KMSG_DUMP_OOPS); > } Otherwise, it looks good. Best Regards, Petr
diff --git a/kernel/panic.c b/kernel/panic.c index d30d261f9246..9fa44bc38f46 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -634,6 +634,7 @@ bool oops_may_print(void) */ void oops_enter(void) { + nbcon_cpu_emergency_enter(); tracing_off(); /* can't trust the integrity of the kernel anymore: */ debug_locks_off(); @@ -656,6 +657,7 @@ void oops_exit(void) { do_oops_enter_exit(); print_oops_end_marker(); + nbcon_cpu_emergency_exit(); kmsg_dump(KMSG_DUMP_OOPS); }