From patchwork Fri Oct 16 02:50:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11840801 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D8DA14B4 for ; Fri, 16 Oct 2020 02:50:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4E92520897 for ; Fri, 16 Oct 2020 02:50:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="fOiSUgSk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E92520897 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 52EFD94007A; Thu, 15 Oct 2020 22:50:21 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4DE2394006D; Thu, 15 Oct 2020 22:50:21 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41B9F94007A; Thu, 15 Oct 2020 22:50:21 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id 138ED94006D for ; Thu, 15 Oct 2020 22:50:21 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B01B7180AD811 for ; Fri, 16 Oct 2020 02:50:20 +0000 (UTC) X-FDA: 77376259800.08.son71_191785c27219 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 8E4651819E76C for ; Fri, 16 Oct 2020 02:50:20 +0000 (UTC) X-Spam-Summary: 1,0,0,ec9e3b44d37bb242,d41d8cd98f00b204,akpm@linux-foundation.org,,RULES_HIT:41:355:379:800:960:967:973:988:989:1260:1345:1359:1381:1431:1437:1534:1541:1711:1730:1747:1777:1792:2393:2525:2553:2559:2563:2682:2685:2693:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3503:3504:3865:3866:3868:3870:3872:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:6261:6653:6737:7514:7576:7875:9025:9207:9545:9592:10004:11026:11658:11914:12043:12048:12297:12438:12517:12519:12555:12679:12986:13069:13311:13357:13846:13972:14181:14384:14721:14915:21080:21451:21627:21939:30054:30090,0,RBL:198.145.29.99:@linux-foundation.org:.lbl8.mailshell.net-62.2.0.100 64.100.201.201;04yfhtcmx7ok8rjysk3d54qy6zstfypjyz6sk7k7ghrqnfxdznesdy9g35fqpcc.a4g4h7wcwfy8b73a58n97ccyw5n5dwjzw7cwutkmsa8uer5a59mhmazouiwxam6.6-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Cus tom_rule X-HE-Tag: son71_191785c27219 X-Filterd-Recvd-Size: 3052 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Fri, 16 Oct 2020 02:50:20 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C4E1321556; Fri, 16 Oct 2020 02:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602816619; bh=A0ChrCDCJhPaDEnC2n0JcMIBX/9RljacmUDs2z2DTAA=; h=Date:From:To:Subject:In-Reply-To:From; b=fOiSUgSkEkAek9c2x2JvqoL/hTRrNfxBkioqu93oDr/Tzqa1lvtJTicV5VL9KT8V3 cC1x0uKFlDSA//LyIhtxH0Qy2dx1mSnnFpOPN5w57z7dzp519tiKLNxhwSBaZiZ8Wz joJ5IqYivdq9Ghrdir/dJpIqzzPx0EtnZ+tKuH3s= Date: Thu, 15 Oct 2020 19:50:18 -0700 From: Andrew Morton To: aik@ozlabs.ru, akpm@linux-foundation.org, aquini@redhat.com, dianders@chromium.org, keescook@chromium.org, linux-mm@kvack.org, mingo@kernel.org, mm-commits@vger.kernel.org, npiggin@gmail.com, tglx@linutronix.de, torvalds@linux-foundation.org, will@kernel.org Subject: [patch 148/156] panic: dump registers on panic_on_warn Message-ID: <20201016025018.o2XSfGQXU%akpm@linux-foundation.org> In-Reply-To: <20201015192732.f448da14e9854c7cb7299956@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Alexey Kardashevskiy Subject: panic: dump registers on panic_on_warn Currently we print stack and registers for ordinary warnings but we do not for panic_on_warn which looks as oversight - panic() will reboot the machine but won't print registers. This moves printing of registers and modules earlier. This does not move the stack dumping as panic() dumps it. Link: https://lkml.kernel.org/r/20200804095054.68724-1-aik@ozlabs.ru Signed-off-by: Alexey Kardashevskiy Reviewed-by: Kees Cook Cc: Douglas Anderson Cc: Ingo Molnar Cc: Kees Cook Cc: Rafael Aquini Cc: Thomas Gleixner Cc: Will Deacon Cc: Nicholas Piggin Signed-off-by: Andrew Morton --- kernel/panic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/kernel/panic.c~panic-dump-registers-on-panic_on_warn +++ a/kernel/panic.c @@ -589,6 +589,11 @@ void __warn(const char *file, int line, if (args) vprintk(args->fmt, args->args); + print_modules(); + + if (regs) + show_regs(regs); + if (panic_on_warn) { /* * This thread may hit another WARN() in the panic path. @@ -600,12 +605,7 @@ void __warn(const char *file, int line, panic("panic_on_warn set ...\n"); } - print_modules(); - - if (regs) - show_regs(regs); - else - dump_stack(); + dump_stack(); print_irqtrace_events(current);