From patchwork Mon Feb 26 13:53:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10242389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B2A9A60208 for ; Mon, 26 Feb 2018 13:53:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2BF82A03E for ; Mon, 26 Feb 2018 13:53:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94C312A045; Mon, 26 Feb 2018 13:53:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F1C172A04B for ; Mon, 26 Feb 2018 13:53:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E5DB06E49E; Mon, 26 Feb 2018 13:53:45 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id CE56B6E49E for ; Mon, 26 Feb 2018 13:53:44 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 10818574-1500050 for multiple; Mon, 26 Feb 2018 13:53:25 +0000 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Mon, 26 Feb 2018 13:53:28 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Mon, 26 Feb 2018 13:53:26 +0000 Message-Id: <20180226135326.6279-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.16.2 X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Subject: [Intel-gfx] [RFC] kernel/panic: Repeat the line and caller information at the end of the OOPS X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP For large oops dump, for example if ftrace is included, we can easily exceed the storage buffer and lose the most important bit of information: where the OOPS occurred. So repeat the location information just before the end marker. Signed-off-by: Chris Wilson Cc: Marta Lofstedt --- kernel/panic.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/kernel/panic.c b/kernel/panic.c index 2cfef408fec9..51914dcd1ab8 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -517,14 +517,9 @@ struct warn_args { va_list args; }; -void __warn(const char *file, int line, void *caller, unsigned taint, - struct pt_regs *regs, struct warn_args *args) +static void print_location(const char *file, int line, void *caller, + struct warn_args *args) { - disable_trace_on_warning(); - - if (args) - pr_warn(CUT_HERE); - if (file) pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n", raw_smp_processor_id(), current->pid, file, line, @@ -535,6 +530,17 @@ void __warn(const char *file, int line, void *caller, unsigned taint, if (args) vprintk(args->fmt, args->args); +} + +void __warn(const char *file, int line, void *caller, unsigned taint, + struct pt_regs *regs, struct warn_args *args) +{ + disable_trace_on_warning(); + + if (args) + pr_warn(CUT_HERE); + + show_location(file, line, caller, args); if (panic_on_warn) { /* @@ -554,6 +560,8 @@ void __warn(const char *file, int line, void *caller, unsigned taint, else dump_stack(); + show_location(file, line, caller, args); + print_oops_end_marker(); /* Just a warning, don't kill lockdep. */