From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 552E3C433E7 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 C14092074D for ; Fri, 16 Oct 2020 02:50:21 +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 C14092074D 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) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DE2394006D; Thu, 15 Oct 2020 22:50:21 -0400 (EDT) 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-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-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); _