diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-10-23 01:01:49 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-10-23 01:01:49 -0400 |
commit | 3dd41424090a0ca3a660218d06afe6ff4441bad3 (patch) | |
tree | 511ef1bb1799027fc5aad574adce49120ecadd87 /kernel/printk.c | |
parent | 5c5456402d467969b217d7fdd6670f8c8600f5a8 (diff) | |
parent | f6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff) |
Merge commit 'v2.6.36' into wip-merge-2.6.36
Conflicts:
Makefile
arch/x86/include/asm/unistd_32.h
arch/x86/kernel/syscall_table_32.S
kernel/sched.c
kernel/time/tick-sched.c
Relevant API and functions changes (solved in this commit):
- (API) .enqueue_task() (enqueue_task_litmus),
dequeue_task() (dequeue_task_litmus),
[litmus/sched_litmus.c]
- (API) .select_task_rq() (select_task_rq_litmus)
[litmus/sched_litmus.c]
- (API) sysrq_dump_trace_buffer() and sysrq_handle_kill_rt_tasks()
[litmus/sched_trace.c]
- struct kfifo internal buffer name changed (buffer -> buf)
[litmus/sched_trace.c]
- add_wait_queue_exclusive_locked -> __add_wait_queue_tail_exclusive
[litmus/fmlp.c]
- syscall numbers for both x86_32 and x86_64
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 68 |
1 files changed, 61 insertions, 7 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index ee54355cfdf1..9dc8ea140426 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -33,9 +33,12 @@ | |||
33 | #include <linux/bootmem.h> | 33 | #include <linux/bootmem.h> |
34 | #include <linux/syscalls.h> | 34 | #include <linux/syscalls.h> |
35 | #include <linux/kexec.h> | 35 | #include <linux/kexec.h> |
36 | #include <linux/kdb.h> | ||
36 | #include <linux/ratelimit.h> | 37 | #include <linux/ratelimit.h> |
37 | #include <linux/kmsg_dump.h> | 38 | #include <linux/kmsg_dump.h> |
38 | #include <linux/syslog.h> | 39 | #include <linux/syslog.h> |
40 | #include <linux/cpu.h> | ||
41 | #include <linux/notifier.h> | ||
39 | 42 | ||
40 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
41 | 44 | ||
@@ -420,6 +423,22 @@ SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) | |||
420 | return do_syslog(type, buf, len, SYSLOG_FROM_CALL); | 423 | return do_syslog(type, buf, len, SYSLOG_FROM_CALL); |
421 | } | 424 | } |
422 | 425 | ||
426 | #ifdef CONFIG_KGDB_KDB | ||
427 | /* kdb dmesg command needs access to the syslog buffer. do_syslog() | ||
428 | * uses locks so it cannot be used during debugging. Just tell kdb | ||
429 | * where the start and end of the physical and logical logs are. This | ||
430 | * is equivalent to do_syslog(3). | ||
431 | */ | ||
432 | void kdb_syslog_data(char *syslog_data[4]) | ||
433 | { | ||
434 | syslog_data[0] = log_buf; | ||
435 | syslog_data[1] = log_buf + log_buf_len; | ||
436 | syslog_data[2] = log_buf + log_end - | ||
437 | (logged_chars < log_buf_len ? logged_chars : log_buf_len); | ||
438 | syslog_data[3] = log_buf + log_end; | ||
439 | } | ||
440 | #endif /* CONFIG_KGDB_KDB */ | ||
441 | |||
423 | /* | 442 | /* |
424 | * Call the console drivers on a range of log_buf | 443 | * Call the console drivers on a range of log_buf |
425 | */ | 444 | */ |
@@ -593,6 +612,14 @@ asmlinkage int printk(const char *fmt, ...) | |||
593 | va_list args; | 612 | va_list args; |
594 | int r; | 613 | int r; |
595 | 614 | ||
615 | #ifdef CONFIG_KGDB_KDB | ||
616 | if (unlikely(kdb_trap_printk)) { | ||
617 | va_start(args, fmt); | ||
618 | r = vkdb_printf(fmt, args); | ||
619 | va_end(args); | ||
620 | return r; | ||
621 | } | ||
622 | #endif | ||
596 | va_start(args, fmt); | 623 | va_start(args, fmt); |
597 | r = vprintk(fmt, args); | 624 | r = vprintk(fmt, args); |
598 | va_end(args); | 625 | va_end(args); |
@@ -970,6 +997,32 @@ void resume_console(void) | |||
970 | } | 997 | } |
971 | 998 | ||
972 | /** | 999 | /** |
1000 | * console_cpu_notify - print deferred console messages after CPU hotplug | ||
1001 | * @self: notifier struct | ||
1002 | * @action: CPU hotplug event | ||
1003 | * @hcpu: unused | ||
1004 | * | ||
1005 | * If printk() is called from a CPU that is not online yet, the messages | ||
1006 | * will be spooled but will not show up on the console. This function is | ||
1007 | * called when a new CPU comes online (or fails to come up), and ensures | ||
1008 | * that any such output gets printed. | ||
1009 | */ | ||
1010 | static int __cpuinit console_cpu_notify(struct notifier_block *self, | ||
1011 | unsigned long action, void *hcpu) | ||
1012 | { | ||
1013 | switch (action) { | ||
1014 | case CPU_ONLINE: | ||
1015 | case CPU_DEAD: | ||
1016 | case CPU_DYING: | ||
1017 | case CPU_DOWN_FAILED: | ||
1018 | case CPU_UP_CANCELED: | ||
1019 | acquire_console_sem(); | ||
1020 | release_console_sem(); | ||
1021 | } | ||
1022 | return NOTIFY_OK; | ||
1023 | } | ||
1024 | |||
1025 | /** | ||
973 | * acquire_console_sem - lock the console system for exclusive use. | 1026 | * acquire_console_sem - lock the console system for exclusive use. |
974 | * | 1027 | * |
975 | * Acquires a semaphore which guarantees that the caller has | 1028 | * Acquires a semaphore which guarantees that the caller has |
@@ -1356,7 +1409,7 @@ int unregister_console(struct console *console) | |||
1356 | } | 1409 | } |
1357 | EXPORT_SYMBOL(unregister_console); | 1410 | EXPORT_SYMBOL(unregister_console); |
1358 | 1411 | ||
1359 | static int __init disable_boot_consoles(void) | 1412 | static int __init printk_late_init(void) |
1360 | { | 1413 | { |
1361 | struct console *con; | 1414 | struct console *con; |
1362 | 1415 | ||
@@ -1367,9 +1420,10 @@ static int __init disable_boot_consoles(void) | |||
1367 | unregister_console(con); | 1420 | unregister_console(con); |
1368 | } | 1421 | } |
1369 | } | 1422 | } |
1423 | hotcpu_notifier(console_cpu_notify, 0); | ||
1370 | return 0; | 1424 | return 0; |
1371 | } | 1425 | } |
1372 | late_initcall(disable_boot_consoles); | 1426 | late_initcall(printk_late_init); |
1373 | 1427 | ||
1374 | #if defined CONFIG_PRINTK | 1428 | #if defined CONFIG_PRINTK |
1375 | 1429 | ||
@@ -1505,9 +1559,9 @@ void kmsg_dump(enum kmsg_dump_reason reason) | |||
1505 | chars = logged_chars; | 1559 | chars = logged_chars; |
1506 | spin_unlock_irqrestore(&logbuf_lock, flags); | 1560 | spin_unlock_irqrestore(&logbuf_lock, flags); |
1507 | 1561 | ||
1508 | if (logged_chars > end) { | 1562 | if (chars > end) { |
1509 | s1 = log_buf + log_buf_len - logged_chars + end; | 1563 | s1 = log_buf + log_buf_len - chars + end; |
1510 | l1 = logged_chars - end; | 1564 | l1 = chars - end; |
1511 | 1565 | ||
1512 | s2 = log_buf; | 1566 | s2 = log_buf; |
1513 | l2 = end; | 1567 | l2 = end; |
@@ -1515,8 +1569,8 @@ void kmsg_dump(enum kmsg_dump_reason reason) | |||
1515 | s1 = ""; | 1569 | s1 = ""; |
1516 | l1 = 0; | 1570 | l1 = 0; |
1517 | 1571 | ||
1518 | s2 = log_buf + end - logged_chars; | 1572 | s2 = log_buf + end - chars; |
1519 | l2 = logged_chars; | 1573 | l2 = chars; |
1520 | } | 1574 | } |
1521 | 1575 | ||
1522 | if (!spin_trylock_irqsave(&dump_list_lock, flags)) { | 1576 | if (!spin_trylock_irqsave(&dump_list_lock, flags)) { |