Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755547Ab0KHUdn (ORCPT ); Mon, 8 Nov 2010 15:33:43 -0500 Received: from smtp-out.google.com ([74.125.121.35]:3644 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755533Ab0KHUdk (ORCPT ); Mon, 8 Nov 2010 15:33:40 -0500 DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=subject:to:from:cc:date:message-id:in-reply-to:references: user-agent:mime-version:content-type: content-transfer-encoding:x-system-of-record; b=bm2bRxbDt31nixmCWz9yIdFFf7BDcyrDswMq8AkJcRtSDCbMufMjJ8NKq2d+eSv/a nvesAacksNltMPO00F/Ow== Subject: [PATCH v2 16/23] kmsg_dumper: Pass pt_regs along to dumpers. To: simon.kagstrom@netinsight.net, davem@davemloft.net, nhorman@tuxdriver.com, Matt Mackall From: Mike Waychison Cc: adurbin@google.com, linux-kernel@vger.kernel.org, chavey@google.com, Greg KH , =?utf-8?q?Am=C3=A9rico?= Wang , akpm@linux-foundation.org, linux-api@vger.kernel.org Date: Mon, 08 Nov 2010 12:33:11 -0800 Message-ID: <20101108203310.22479.2496.stgit@crlf.mtv.corp.google.com> In-Reply-To: <20101108203120.22479.19708.stgit@crlf.mtv.corp.google.com> References: <20101108203120.22479.19708.stgit@crlf.mtv.corp.google.com> User-Agent: StGit/0.15 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-System-Of-Record: true Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4666 Lines: 150 A subsequent commit adding netoops functionality would like access to the pt_regs to have them recorded in the dump. Pass the register values along if available. Signed-off-by: Mike Waychison --- drivers/char/ramoops.c | 4 +++- drivers/mtd/mtdoops.c | 4 +++- include/linux/kmsg_dump.h | 8 ++++++-- kernel/kexec.c | 5 +++-- kernel/panic.c | 4 ++-- kernel/printk.c | 4 ++-- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c index 73dcb0e..9d79492 100644 --- a/drivers/char/ramoops.c +++ b/drivers/char/ramoops.c @@ -58,7 +58,9 @@ static struct ramoops_context { } oops_cxt; static void ramoops_do_dump(struct kmsg_dumper *dumper, - enum kmsg_dump_reason reason, const char *s1, unsigned long l1, + enum kmsg_dump_reason reason, + struct pt_regs *pt_regs, + const char *s1, unsigned long l1, const char *s2, unsigned long l2) { struct ramoops_context *cxt = container_of(dumper, diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index 1ee72f3..cf07cf5 100644 --- a/drivers/mtd/mtdoops.c +++ b/drivers/mtd/mtdoops.c @@ -298,7 +298,9 @@ static void find_next_position(struct mtdoops_context *cxt) } static void mtdoops_do_dump(struct kmsg_dumper *dumper, - enum kmsg_dump_reason reason, const char *s1, unsigned long l1, + enum kmsg_dump_reason reason, + struct pt_regs *pt_regs, + const char *s1, unsigned long l1, const char *s2, unsigned long l2) { struct mtdoops_context *cxt = container_of(dumper, diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h index 24b4414..a229acc 100644 --- a/include/linux/kmsg_dump.h +++ b/include/linux/kmsg_dump.h @@ -14,6 +14,8 @@ #include +struct pt_regs; + enum kmsg_dump_reason { KMSG_DUMP_OOPS, KMSG_DUMP_PANIC, @@ -30,6 +32,7 @@ enum kmsg_dump_reason { */ struct kmsg_dumper { void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason, + struct pt_regs *pt_regs, const char *s1, unsigned long l1, const char *s2, unsigned long l2); struct list_head list; @@ -37,13 +40,14 @@ struct kmsg_dumper { }; #ifdef CONFIG_PRINTK -void kmsg_dump(enum kmsg_dump_reason reason); +void kmsg_dump(enum kmsg_dump_reason reason, struct pt_regs *pt_regs); int kmsg_dump_register(struct kmsg_dumper *dumper); int kmsg_dump_unregister(struct kmsg_dumper *dumper); #else -static inline void kmsg_dump(enum kmsg_dump_reason reason) +static inline void kmsg_dump(enum kmsg_dump_reason reason, + struct pt_regs *pt_regs) { } diff --git a/kernel/kexec.c b/kernel/kexec.c index b55045b..840af0c 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -1078,10 +1078,11 @@ void crash_kexec(struct pt_regs *regs) if (kexec_crash_image) { struct pt_regs fixed_regs; - kmsg_dump(KMSG_DUMP_KEXEC); - crash_setup_regs(&fixed_regs, regs); crash_save_vmcoreinfo(); + + kmsg_dump(KMSG_DUMP_KEXEC, &fixed_regs); + machine_crash_shutdown(&fixed_regs); machine_kexec(kexec_crash_image); } diff --git a/kernel/panic.c b/kernel/panic.c index c3f39cd..b3a4440 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -87,7 +87,7 @@ NORET_TYPE void panic(const char * fmt, ...) */ crash_kexec(NULL); - kmsg_dump(KMSG_DUMP_PANIC); + kmsg_dump(KMSG_DUMP_PANIC, NULL); /* * Note smp_send_stop is the usual smp shutdown function, which @@ -353,7 +353,7 @@ void oops_exit(struct pt_regs *regs) { do_oops_enter_exit(); print_oops_end_marker(); - kmsg_dump(KMSG_DUMP_OOPS); + kmsg_dump(KMSG_DUMP_OOPS, regs); } #ifdef WANT_WARN_ON_SLOWPATH diff --git a/kernel/printk.c b/kernel/printk.c index b2ebaee..159b4d6 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -1533,7 +1533,7 @@ static const char *kmsg_to_str(enum kmsg_dump_reason reason) * Iterate through each of the dump devices and call the oops/panic * callbacks with the log buffer. */ -void kmsg_dump(enum kmsg_dump_reason reason) +void kmsg_dump(enum kmsg_dump_reason reason, struct pt_regs *pt_regs) { unsigned long end; unsigned chars; @@ -1570,7 +1570,7 @@ void kmsg_dump(enum kmsg_dump_reason reason) return; } list_for_each_entry(dumper, &dump_list, list) - dumper->dump(dumper, reason, s1, l1, s2, l2); + dumper->dump(dumper, reason, pt_regs, s1, l1, s2, l2); spin_unlock_irqrestore(&dump_list_lock, flags); } #endif -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/