Message ID | 20240206213902.GA1490631@lichtman.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1840934dyb; Tue, 6 Feb 2024 13:44:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqPb8dNlieXacKgI61J8tt50/OtroMr3gYic67/KyuY5qlTEXto+CMJ0l2pIueRmrt292s X-Received: by 2002:ad4:5ca6:0:b0:68c:a6ac:ea86 with SMTP id q6-20020ad45ca6000000b0068ca6acea86mr7470983qvh.2.1707255875107; Tue, 06 Feb 2024 13:44:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707255875; cv=pass; d=google.com; s=arc-20160816; b=MqfaP1TecnjGGiMN4gGexeTcqSi0nqDBC3fnWn+jflAqDTSv+UWJS2MVX2fv8v/pNc pAuw0YHzBxjqK6jKzdTrfpGXrFTG62oIJEcR0TwdvHWPiXCgoUWMiya7m+4GFik3ahh1 vquSOaQCj2EUDGIezy1Elb0MPfD5GMY1clM9dR0ixTTcBCygO4lkBUqqNIpPJ5pD1lCc Cn//Fnb77YX2Ipfg74pF8NYIws0cxwxLii05A0u+4twvAL4vx3Jm/GT9hfSEsPHMNwyQ Lu3n2MutMqzGB7iEwDtn3OOa3FuyR5dU6yUf9WklA8xWfWEvnPDUL2RjzKPCQipNMGxe F6jA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:to:from:date:dkim-signature; bh=nQ5xe0HKKbq/ErxUGJNXKaGM7XjTWDe6iVd0oA3K8jU=; fh=YUinnDucP6RksN5rZ5Z3Nml9VveP2rq/4rlpSSlLK+A=; b=R61J6A20EJderuQxBnO0WOVNDD5zXyqgtn1RYhuNoDyiZCK/ONjtVzyt3qiu25nJpb 1VW0IyNXONY7ocnzDHzASZosdTfwYRpriKOP8QO5AQwo3M3AlgHcKBtJR1O8g0rEZ6lF EQ5JRuOqZBKV7tAknziEnrz/uY1JBjFfFx6xZY0FOJAi5jdsWMS5aw9+R59uTmeY7N0b 0D/VMLY/UhQZIicpsUdiVjrGC7ndxMQutf6GlDJYIqe4qR3LqjFPA32+mcY3Ohke5D5W CEMsZH9WtZkBDBwY0CfzAZ7D+ipeptMbDVP+utUO9AbVwFPUPWGD+H5I5UHTaFRiDs3H rfeA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lichtman.org header.s=mail header.b=MslBc6fW; arc=pass (i=1 spf=pass spfdomain=lichtman.org dkim=pass dkdomain=lichtman.org dmarc=pass fromdomain=lichtman.org); spf=pass (google.com: domain of linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lichtman.org X-Forwarded-Encrypted: i=1; AJvYcCV9CsPjEk3cp6PbiYhxAfIfA/WG9BpZfWBFuH9BwZOMyjtbpgkjCr91bp4SQVcgbj3ynQUlSJVPIAnbUytgMcJIkeFJFw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a3-20020a0ce903000000b0068c87dfc7edsi3309446qvo.311.2024.02.06.13.44.34 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 13:44:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@lichtman.org header.s=mail header.b=MslBc6fW; arc=pass (i=1 spf=pass spfdomain=lichtman.org dkim=pass dkdomain=lichtman.org dmarc=pass fromdomain=lichtman.org); spf=pass (google.com: domain of linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lichtman.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DECD71C2319B for <ouuuleilei@gmail.com>; Tue, 6 Feb 2024 21:44:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B6FB1BF38; Tue, 6 Feb 2024 21:44:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lichtman.org header.i=@lichtman.org header.b="MslBc6fW" Received: from lichtman.org (lichtman.org [149.28.33.109]) (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 C2CED1BC35 for <linux-kernel@vger.kernel.org>; Tue, 6 Feb 2024 21:44:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=149.28.33.109 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707255861; cv=none; b=QlgysGq+5pa1nPEXTg3JhEGZfBNPSMnQN2dRDOWjQ6UmEcOCLZ03zQ4wXLOjQQ3j0yd02ZA9IHlGejDmNMWWZZXfiFfh2ty6dHQDCA4GWhbN0BGT5gFUnMybnzXfrkRlgeJxEhP+Jw7AEGb4WQwlCz8+pxHamRmZMSx5n7BEXUI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707255861; c=relaxed/simple; bh=lH5sVaiLtqfzbtaHk3feLejvLIsj4MXSS+5uIQz64KA=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=Pc4RbXc1g3frNa2Hw3tCpxQBpWg/m4lBEtXLKnMJkDUExaPaHEhnAp5ygt8ZqlDaQ7VhWZiXIu0Tr3UX7z4JxkvqelF8TkgwgmPele6gMUx0GjuF11f05RGxUYXeSHj7qKGpEU2HkNJolgCqEiXwnDArwmwUtZq5/ROtF9u4AfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lichtman.org; spf=pass smtp.mailfrom=lichtman.org; dkim=pass (2048-bit key) header.d=lichtman.org header.i=@lichtman.org header.b=MslBc6fW; arc=none smtp.client-ip=149.28.33.109 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lichtman.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lichtman.org Received: by lichtman.org (Postfix, from userid 1000) id CEC31176E0F; Tue, 6 Feb 2024 21:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lichtman.org; s=mail; t=1707255542; bh=lH5sVaiLtqfzbtaHk3feLejvLIsj4MXSS+5uIQz64KA=; h=Date:From:To:Subject:From; b=MslBc6fWC1O/HL7WEIkwStU/meOS2aJg/sQ6wGFsrMUfntp/gxPKLMg099WZbT5tE uvtLgQ3gOeV5lnIgeLBze/RzYQTbhvN31VGeLF8Go4kmmV8HkWBIKGK5ulkWJgf95B izBdpYtkVU9ozPzbgaRTpd0MkOJgi011mTUsviZm0khmasvJm/Dq/kybSl/FMU0ItV EkxC2TbxL5a4kNnj04ZT/IbakBdu3uzdNu7U0VCY7YU1rcUOC9KA1ISQrTHPXZHEu2 TSvcjVF+OPH/HU3T58YNTcU/9Y8eqmm4TNGFhSs/g6zmvqnwTjys+g2LdqeYlmtzsa zaD8d5OxKmqdg== Date: Tue, 6 Feb 2024 21:39:02 +0000 From: Nir Lichtman <nir@lichtman.org> To: linux-kernel@vger.kernel.org Subject: [PATCH] kernel: add boot param to disable stack dump on panic Message-ID: <20240206213902.GA1490631@lichtman.org> 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-Type: text/plain; charset=us-ascii Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790187536906961436 X-GMAIL-MSGID: 1790187536906961436 |
Series |
kernel: add boot param to disable stack dump on panic
|
|
Commit Message
Nir Lichtman
Feb. 6, 2024, 9:39 p.m. UTC
From: Nir Lichtman <nir@lichtman.org>
Date: Sat, 3 Feb 2024 10:19:30 +0200
Subject: [PATCH] kernel: add boot param to disable stack dump on panic
---
Documentation/admin-guide/kernel-parameters.txt | 5 +++++
kernel/panic.c | 12 +++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
Comments
On Tue, Feb 06, 2024 at 09:39:02PM +0000, Nir Lichtman wrote: > From: Nir Lichtman <nir@lichtman.org> > Date: Sat, 3 Feb 2024 10:19:30 +0200 > Subject: [PATCH] kernel: add boot param to disable stack dump on panic > Can you describe why this patch is needed (or beneficial)? Confused...
In a lot of cases when there is a kernel panic it obscures on the display the previous problem that caused it and the main reason is that the call stack prints a lot of lines on the display - and there is no way to scroll back up. What led me to make this patch is that I was working on running the kernel on my old computer and when I passed root=/dev/sda to the kernel there was a panic and it could not start init, but since the call stack took almost all the space on the screen, I couldn't see the available partitions the kernel does detects. After this patch, I could just pass in the new boot parameter I added here and then it would not print the call stack, and I saw the line in which the kernel prints the available partitions. On Wed, Feb 07, 2024 at 09:10:22AM +0700, Bagas Sanjaya wrote: > On Tue, Feb 06, 2024 at 09:39:02PM +0000, Nir Lichtman wrote: > > From: Nir Lichtman <nir@lichtman.org> > > Date: Sat, 3 Feb 2024 10:19:30 +0200 > > Subject: [PATCH] kernel: add boot param to disable stack dump on panic > > > > Can you describe why this patch is needed (or beneficial)? > > Confused... > > -- > An old man doll... just what I always wanted! - Clara
On 2/8/24 15:14, Nir Lichtman wrote: > In a lot of cases when there is a kernel panic it obscures on the display the previous problem that caused it and the main > reason is that the call stack prints a lot of lines on the display - and there is no way to scroll back up. > What led me to make this patch is that I was working on running the kernel on my old computer and when I passed root=/dev/sda > to the kernel there was a panic and it could not start init, but since the call stack took almost all the space on the screen, > I couldn't see the available partitions the kernel does detects. > > After this patch, I could just pass in the new boot parameter I added here and then it would not print the call stack, > and I saw the line in which the kernel prints the available partitions. > Please don't top-post; reply inline with appropriate context instead. Thanks for the explanation. Now please send v2 with appropriate maintainers and lists Cc'ed (use scripts/get_maintainer.pl to find ones). Also read Documentation/process/submitting-patches.rst before sending. Ciao!
On Fri, Feb 09, 2024 at 04:22:12PM +0700, Bagas Sanjaya wrote: > On 2/8/24 15:14, Nir Lichtman wrote: > > In a lot of cases when there is a kernel panic it obscures on the display the previous problem that caused it and the main > > reason is that the call stack prints a lot of lines on the display - and there is no way to scroll back up. > > What led me to make this patch is that I was working on running the kernel on my old computer and when I passed root=/dev/sda > > to the kernel there was a panic and it could not start init, but since the call stack took almost all the space on the screen, > > I couldn't see the available partitions the kernel does detects. > > > > After this patch, I could just pass in the new boot parameter I added here and then it would not print the call stack, > > and I saw the line in which the kernel prints the available partitions. > > > > Please don't top-post; reply inline with appropriate context instead. > > Thanks for the explanation. Now please send v2 with appropriate maintainers > and lists Cc'ed (use scripts/get_maintainer.pl to find ones). Also read > Documentation/process/submitting-patches.rst before sending. > > Ciao! > > -- > An old man doll... just what I always wanted! - Clara > Yah I read the docs about submitting patches and ran the get_maintainer script but it didn't find anything for the changes I made (except documentation maintainers), I guess maybe the panic.c file has no main mantainer? Thanks,
On 2/9/24 01:50, Nir Lichtman wrote: > On Fri, Feb 09, 2024 at 04:22:12PM +0700, Bagas Sanjaya wrote: >> On 2/8/24 15:14, Nir Lichtman wrote: >>> In a lot of cases when there is a kernel panic it obscures on the display the previous problem that caused it and the main >>> reason is that the call stack prints a lot of lines on the display - and there is no way to scroll back up. >>> What led me to make this patch is that I was working on running the kernel on my old computer and when I passed root=/dev/sda >>> to the kernel there was a panic and it could not start init, but since the call stack took almost all the space on the screen, >>> I couldn't see the available partitions the kernel does detects. >>> >>> After this patch, I could just pass in the new boot parameter I added here and then it would not print the call stack, >>> and I saw the line in which the kernel prints the available partitions. >>> >> >> Please don't top-post; reply inline with appropriate context instead. >> >> Thanks for the explanation. Now please send v2 with appropriate maintainers >> and lists Cc'ed (use scripts/get_maintainer.pl to find ones). Also read >> Documentation/process/submitting-patches.rst before sending. >> >> Ciao! >> >> -- >> An old man doll... just what I always wanted! - Clara >> > > Yah I read the docs about submitting patches and ran the get_maintainer script but it didn't find anything for the > changes I made (except documentation maintainers), I guess maybe the panic.c file has no main mantainer? True, it doesn't have a primary maintainer. You can use $ git log kernel/panic.c to see who has been merging patches for it. Examples: Andrew Morton Petr Mladek (printk or log buffer related) Ingo Molnar (preemption related) etc. If in doubt, Andrew Morton is usually a good guess.
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 31b3a2568..433e3e5d1 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1127,6 +1127,11 @@ MTRR settings. This parameter disables that behavior, possibly causing your machine to run very slowly. + disable_stack_dump_on_panic + This parameter disables call stack dumping when there + is a panic, which can help obscure less earlier messages + that lead to the panic. + disable_timer_pin_1 [X86] Disable PIN 1 of APIC timer Can be useful to work around chipset bugs. diff --git a/kernel/panic.c b/kernel/panic.c index 2807639aa..a1e1d064e 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -266,6 +266,16 @@ static void panic_other_cpus_shutdown(bool crash_kexec) crash_smp_send_stop(); } +static int disable_stack_dump_on_panic __initdata; + +static int __init disable_stack_dump_on_panic_setup(char *str) +{ + disable_stack_dump_on_panic = 1; + return 0; +} + +early_param("disable_stack_dump_on_panic", disable_stack_dump_on_panic_setup); + /** * panic - halt the system * @fmt: The text string to print @@ -340,7 +350,7 @@ void panic(const char *fmt, ...) /* * Avoid nested stack-dumping if a panic occurs during oops processing */ - if (!test_taint(TAINT_DIE) && oops_in_progress <= 1) + if (!test_taint(TAINT_DIE) && oops_in_progress <= 1 && !disable_stack_dump_on_panic) dump_stack(); #endif