aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/um_arch.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2008-02-05 01:31:08 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:29 -0500
commit0983a88b9f0ceffb2116ce92c7b273ce2aec7b93 (patch)
treecf63f0646f64eecc80e5e3cd8d9c16252a751d8e /arch/um/kernel/um_arch.c
parent8efa3c9d545ab6adc5c5e001cbd7aee60909b3da (diff)
uml: install panic notifier earlier
It turns out that if there's a panic early enough, UML will just sit there in the LED-blinking loop because the panic notifier hadn't been installed yet. This patch installs it earlier. It also fixes the problem which exposed the hang, namely that if you give UML a zero-sized initrd, it will ask alloc_bootmem for zero bytes, and that will cause the panic. While I was in initrd.c, I gave it a style makeover. Prompted by checkpatch, I moved a couple extern declarations of uml_exitcode to kern_util.h. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/kernel/um_arch.c')
-rw-r--r--arch/um/kernel/um_arch.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 9ba39ab5f4bd..cb7eef833bc8 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -223,6 +223,23 @@ static void __init uml_postsetup(void)
223 return; 223 return;
224} 224}
225 225
226static int panic_exit(struct notifier_block *self, unsigned long unused1,
227 void *unused2)
228{
229 bust_spinlocks(1);
230 show_regs(&(current->thread.regs));
231 bust_spinlocks(0);
232 uml_exitcode = 1;
233 os_dump_core();
234 return 0;
235}
236
237static struct notifier_block panic_exit_notifier = {
238 .notifier_call = panic_exit,
239 .next = NULL,
240 .priority = 0
241};
242
226/* Set during early boot */ 243/* Set during early boot */
227unsigned long brk_start; 244unsigned long brk_start;
228unsigned long end_iomem; 245unsigned long end_iomem;
@@ -327,6 +344,9 @@ int __init linux_main(int argc, char **argv)
327 printf("Kernel virtual memory size shrunk to %lu bytes\n", 344 printf("Kernel virtual memory size shrunk to %lu bytes\n",
328 virtmem_size); 345 virtmem_size);
329 346
347 atomic_notifier_chain_register(&panic_notifier_list,
348 &panic_exit_notifier);
349
330 uml_postsetup(); 350 uml_postsetup();
331 351
332 stack_protections((unsigned long) &init_thread_info); 352 stack_protections((unsigned long) &init_thread_info);
@@ -335,29 +355,8 @@ int __init linux_main(int argc, char **argv)
335 return start_uml(); 355 return start_uml();
336} 356}
337 357
338extern int uml_exitcode;
339
340static int panic_exit(struct notifier_block *self, unsigned long unused1,
341 void *unused2)
342{
343 bust_spinlocks(1);
344 show_regs(&(current->thread.regs));
345 bust_spinlocks(0);
346 uml_exitcode = 1;
347 os_dump_core();
348 return 0;
349}
350
351static struct notifier_block panic_exit_notifier = {
352 .notifier_call = panic_exit,
353 .next = NULL,
354 .priority = 0
355};
356
357void __init setup_arch(char **cmdline_p) 358void __init setup_arch(char **cmdline_p)
358{ 359{
359 atomic_notifier_chain_register(&panic_notifier_list,
360 &panic_exit_notifier);
361 paging_init(); 360 paging_init();
362 strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 361 strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
363 *cmdline_p = command_line; 362 *cmdline_p = command_line;