All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Knorr <kraxel@bytesex.org>
To: "D. Bahi" <dbahi@enterasys.com>
Cc: Jeff Dike <jdike@addtoit.com>,
	uml devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [uml-devel] [patch] core-on-panic next take ;)
Date: Thu, 16 Sep 2004 12:29:32 +0200	[thread overview]
Message-ID: <20040916102932.GB12111@bytesex> (raw)
In-Reply-To: <4148AD24.1040408@enterasys.com>

On Wed, Sep 15, 2004 at 04:59:16PM -0400, D. Bahi wrote:
> actually it's worse than that in my current implementation:

Thanks for the comments, merged that into my current version.  Attached
below.

I've also moved it all into a single source file, so it is nicely
separated and also can be trivialy made a compile time option if
someone wants this.

  Gerd

Index: uml-2.6.9-rc2/arch/um/kernel/Makefile
===================================================================
--- uml-2.6.9-rc2.orig/arch/um/kernel/Makefile	2004-09-15 08:36:20.000000000 +0200
+++ uml-2.6.9-rc2/arch/um/kernel/Makefile	2004-09-15 08:36:20.000000000 +0200
@@ -11,7 +11,7 @@ obj-y = checksum.o config.o exec_kern.o 
 	sigio_user.o sigio_kern.o signal_kern.o signal_user.o smp.o \
 	syscall_kern.o syscall_user.o sysrq.o sys_call_table.o tempfile.o \
 	time.o time_kern.o tlb.o trap_kern.o trap_user.o uaccess_user.o \
-	um_arch.o umid.o user_util.o
+	um_arch.o umid.o user_util.o core-on-panic.o
 
 obj-$(CONFIG_BLK_DEV_INITRD) += initrd_kern.o initrd_user.o
 obj-$(CONFIG_GPROF)	+= gprof_syms.o
Index: uml-2.6.9-rc2/arch/um/kernel/core-on-panic.c
===================================================================
--- uml-2.6.9-rc2.orig/arch/um/kernel/core-on-panic.c	2004-04-06 15:27:52.000000000 +0200
+++ uml-2.6.9-rc2/arch/um/kernel/core-on-panic.c	2004-09-16 12:19:08.303422237 +0200
@@ -0,0 +1,63 @@
+/*
+ * allow user mode linux kernels dump core on kernel panics,
+ * for later analysis of the crash.
+ *
+ * (c) 2004 Gerd Knorr + D. Bahi
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/notifier.h>
+
+#include "init.h"
+#include "os.h"
+
+static int core_on_panic_func(struct notifier_block *self, unsigned long unused1,
+		              void *unused2)
+{
+	static int recurse = 0;
+
+        /* cleanup so we have less to cleanup [linux] on the host */
+	/* could panic in uml_cleanup though so we need a check */
+        if (0 == recurse++)
+		uml_cleanup();
+
+	/* to prevent keyboard from causing terminal to spew during dump */
+	block_signals();
+
+	/* actually dump ... */
+	abort();
+
+	/* not reached */
+	return 0;
+}
+
+static struct notifier_block core_on_panic_notifier = {
+	.notifier_call 		= core_on_panic_func,
+	.priority 		= 1,
+};
+
+static int core_on_panic = 0;
+
+static int __init core_on_panic_setup(char *str)
+{
+	core_on_panic = 1;
+	return 0;
+}
+
+static int __init core_on_panic_init(void)
+{
+	if (core_on_panic)
+		notifier_chain_register(&panic_notifier_list, &core_on_panic_notifier);
+	return 0;
+}
+
+__initcall(core_on_panic_init);
+__setup("coreonpanic", core_on_panic_setup);
+__uml_help(core_on_panic_setup,
+	"coreonpanic\n"
+	"    This flag make it so that UML will dump core on a kernel panic or segfault.\n"
+	"    Shell environment restrictions on cores (limit or ulimit) still apply.\n"
+	"\n"
+	"    Beware that your UML will not reboot with this flag.\n"
+);
+


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

      reply	other threads:[~2004-09-16 10:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-20 12:24 [uml-devel] [ann] kraxel's 2.6.8 uml patch kit Gerd Knorr
2004-08-20 13:14 ` Geert Uytterhoeven
2004-08-20 16:52   ` Gerd Knorr
2004-08-20 19:01 ` [uml-devel] " Jeff Dike
2004-08-20 21:05   ` Geert Uytterhoeven
2004-08-21 19:28     ` Gerd Knorr
2004-08-22 13:22       ` Werner Almesberger
2004-08-23 11:06         ` Gerd Knorr
2004-08-22 11:17   ` Gerd Knorr
2004-08-31  0:25     ` D. Bahi
2004-09-14 12:36       ` Gerd Knorr
2004-09-15 20:59         ` D. Bahi
2004-09-16 10:29           ` Gerd Knorr [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040916102932.GB12111@bytesex \
    --to=kraxel@bytesex.org \
    --cc=dbahi@enterasys.com \
    --cc=jdike@addtoit.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.