linux-um archives
 help / color / mirror / Atom feed
From: "D. Bahi" <dbahi@enterasys.com>
To: Gerd Knorr <kraxel@bytesex.org>
Cc: Jeff Dike <jdike@addtoit.com>,
	uml devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: Re: [uml-devel] Re: [ann] kraxel's 2.6.8 uml patch kit
Date: Mon, 30 Aug 2004 20:25:33 -0400	[thread overview]
Message-ID: <4133C57D.6060201@enterasys.com> (raw)
In-Reply-To: <20040822111745.GA10736@bytesex>


[-- Attachment #1.1: Type: text/plain, Size: 445 bytes --]

Gerd Knorr wrote:

> On Fri, Aug 20, 2004 at 03:01:40PM -0400, Jeff Dike wrote:
> 
>>kraxel@bytesex.org said:
>>
>>>uml-core-on-panic
>>>	Make the uml kernel dump core on kernel panics for later analysis.
>>>	Default: off, there is a kernel cmd line arg to enable that. 
>>
>>I like this, but I think it would be better done in a panic_notifier.
> 
> 
> I'll have a look.
> 

I liked this too. Here's a pass at it if you like (attached).
-- 
db

[-- Attachment #1.2: core_on_panic.patch --]
[-- Type: text/x-diff, Size: 2464 bytes --]

diff -Naur linux.old/arch/um/kernel/reboot.c linux/arch/um/kernel/reboot.c
--- linux.old/arch/um/kernel/reboot.c	2004-08-30 16:38:37.000000000 -0400
+++ linux/arch/um/kernel/reboot.c	2004-08-30 16:38:51.000000000 -0400
@@ -38,21 +38,19 @@
 
 void uml_cleanup(void)
 {
-	kill_off_processes();
 	do_uml_exitcalls();
+	kill_off_processes();
 }
 
 void machine_restart(char * __unused)
 {
-	do_uml_exitcalls();
-	kill_off_processes();
+	uml_cleanup();
 	CHOOSE_MODE(reboot_tt(), reboot_skas());
 }
 
 void machine_power_off(void)
 {
-	do_uml_exitcalls();
-	kill_off_processes();
+	uml_cleanup();
 	CHOOSE_MODE(halt_tt(), halt_skas());
 }
 
@@ -69,5 +67,7 @@
  * ---------------------------------------------------------------------------
  * Local variables:
  * c-file-style: "linux"
+ * indent-tabs-mode: t
+ * tab-width: 8
  * End:
  */
diff -Naur linux.old/arch/um/kernel/um_arch.c linux/arch/um/kernel/um_arch.c
--- linux.old/arch/um/kernel/um_arch.c	2004-08-30 16:28:55.000000000 -0400
+++ linux/arch/um/kernel/um_arch.c	2004-08-30 18:20:53.000000000 -0400
@@ -412,9 +412,43 @@
 	.priority 		= 0
 };
 
+static int uml_coreonpanic = 0;
+
+static int coreonpanic_setup(char *str) {
+	printf("coreonpanic : Kernel will core on panic.\n");
+	uml_coreonpanic = 1;
+	return(0);
+}
+
+__setup("coreonpanic", coreonpanic_setup);
+__uml_help(coreonpanic_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"
+);
+
+static int panic_coreonpanic(struct notifier_block *self, unsigned long unused1,
+			     void *unused2)
+{
+	if(uml_coreonpanic){
+		uml_cleanup();
+		block_signals();
+		abort();
+	}
+	return(0);		/* never get here */
+}
+
+static struct notifier_block panic_coreonpanic_notifier = {
+	.notifier_call 		= panic_coreonpanic,
+	.next 			= NULL,
+	.priority 		= 1
+};
+
 void __init setup_arch(char **cmdline_p)
 {
 	notifier_chain_register(&panic_notifier_list, &panic_exit_notifier);
+	notifier_chain_register(&panic_notifier_list, &panic_coreonpanic_notifier);
 	paging_init();
  	strcpy(command_line, saved_command_line);
  	*cmdline_p = command_line;
@@ -436,5 +470,7 @@
  * ---------------------------------------------------------------------------
  * Local variables:
  * c-file-style: "linux"
+ * indent-tabs-mode: t
+ * tab-width: 8
  * End:
  */

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 187 bytes --]

  reply	other threads:[~2004-08-31  0:26 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 [this message]
2004-09-14 12:36       ` Gerd Knorr
2004-09-15 20:59         ` D. Bahi
2004-09-16 10:29           ` [uml-devel] [patch] core-on-panic next take ;) Gerd Knorr

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=4133C57D.6060201@enterasys.com \
    --to=dbahi@enterasys.com \
    --cc=jdike@addtoit.com \
    --cc=kraxel@bytesex.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox