diff options
| author | Max Filippov <jcmvbkbc@gmail.com> | 2016-11-04 17:45:08 -0400 |
|---|---|---|
| committer | Max Filippov <jcmvbkbc@gmail.com> | 2016-11-07 02:31:46 -0500 |
| commit | d4eccafcaf339de77ec562e96e6b223d447f924a (patch) | |
| tree | 29f1b3e3f397e275fd9d4310fca069a3041fd312 | |
| parent | 712cba5d87a6c0e980ee5fad45734e189c4d7151 (diff) | |
xtensa: clean up printk usage for boot/crash logging
Convert printk(KERN_* to pr_* and printk's without level to pr_cont.
This fixes torn register dumps, stack dumps, stack traces and timestamps
in the middle of 'Calibrating CPU frequency' message.
Also drop unused show_code and drop false comment about show_stack.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
| -rw-r--r-- | arch/xtensa/kernel/time.c | 14 | ||||
| -rw-r--r-- | arch/xtensa/kernel/traps.c | 74 |
2 files changed, 29 insertions, 59 deletions
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index 9a5bcd0381a7..be81e69b25bc 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c | |||
| @@ -172,10 +172,11 @@ void __init time_init(void) | |||
| 172 | { | 172 | { |
| 173 | of_clk_init(NULL); | 173 | of_clk_init(NULL); |
| 174 | #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT | 174 | #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT |
| 175 | printk("Calibrating CPU frequency "); | 175 | pr_info("Calibrating CPU frequency "); |
| 176 | calibrate_ccount(); | 176 | calibrate_ccount(); |
| 177 | printk("%d.%02d MHz\n", (int)ccount_freq/1000000, | 177 | pr_cont("%d.%02d MHz\n", |
| 178 | (int)(ccount_freq/10000)%100); | 178 | (int)ccount_freq / 1000000, |
| 179 | (int)(ccount_freq / 10000) % 100); | ||
| 179 | #else | 180 | #else |
| 180 | ccount_freq = CONFIG_XTENSA_CPU_CLOCK*1000000UL; | 181 | ccount_freq = CONFIG_XTENSA_CPU_CLOCK*1000000UL; |
| 181 | #endif | 182 | #endif |
| @@ -210,9 +211,8 @@ irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
| 210 | void calibrate_delay(void) | 211 | void calibrate_delay(void) |
| 211 | { | 212 | { |
| 212 | loops_per_jiffy = ccount_freq / HZ; | 213 | loops_per_jiffy = ccount_freq / HZ; |
| 213 | printk("Calibrating delay loop (skipped)... " | 214 | pr_info("Calibrating delay loop (skipped)... %lu.%02lu BogoMIPS preset\n", |
| 214 | "%lu.%02lu BogoMIPS preset\n", | 215 | loops_per_jiffy / (1000000 / HZ), |
| 215 | loops_per_jiffy/(1000000/HZ), | 216 | (loops_per_jiffy / (10000 / HZ)) % 100); |
| 216 | (loops_per_jiffy/(10000/HZ)) % 100); | ||
| 217 | } | 217 | } |
| 218 | #endif | 218 | #endif |
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index d02fc304b31c..ce37d5b899fe 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c | |||
| @@ -465,26 +465,25 @@ void show_regs(struct pt_regs * regs) | |||
| 465 | 465 | ||
| 466 | for (i = 0; i < 16; i++) { | 466 | for (i = 0; i < 16; i++) { |
| 467 | if ((i % 8) == 0) | 467 | if ((i % 8) == 0) |
| 468 | printk(KERN_INFO "a%02d:", i); | 468 | pr_info("a%02d:", i); |
| 469 | printk(KERN_CONT " %08lx", regs->areg[i]); | 469 | pr_cont(" %08lx", regs->areg[i]); |
| 470 | } | 470 | } |
| 471 | printk(KERN_CONT "\n"); | 471 | pr_cont("\n"); |
| 472 | 472 | pr_info("pc: %08lx, ps: %08lx, depc: %08lx, excvaddr: %08lx\n", | |
| 473 | printk("pc: %08lx, ps: %08lx, depc: %08lx, excvaddr: %08lx\n", | 473 | regs->pc, regs->ps, regs->depc, regs->excvaddr); |
| 474 | regs->pc, regs->ps, regs->depc, regs->excvaddr); | 474 | pr_info("lbeg: %08lx, lend: %08lx lcount: %08lx, sar: %08lx\n", |
| 475 | printk("lbeg: %08lx, lend: %08lx lcount: %08lx, sar: %08lx\n", | 475 | regs->lbeg, regs->lend, regs->lcount, regs->sar); |
| 476 | regs->lbeg, regs->lend, regs->lcount, regs->sar); | ||
| 477 | if (user_mode(regs)) | 476 | if (user_mode(regs)) |
| 478 | printk("wb: %08lx, ws: %08lx, wmask: %08lx, syscall: %ld\n", | 477 | pr_cont("wb: %08lx, ws: %08lx, wmask: %08lx, syscall: %ld\n", |
| 479 | regs->windowbase, regs->windowstart, regs->wmask, | 478 | regs->windowbase, regs->windowstart, regs->wmask, |
| 480 | regs->syscall); | 479 | regs->syscall); |
| 481 | } | 480 | } |
| 482 | 481 | ||
| 483 | static int show_trace_cb(struct stackframe *frame, void *data) | 482 | static int show_trace_cb(struct stackframe *frame, void *data) |
| 484 | { | 483 | { |
| 485 | if (kernel_text_address(frame->pc)) { | 484 | if (kernel_text_address(frame->pc)) { |
| 486 | printk(" [<%08lx>] ", frame->pc); | 485 | pr_cont(" [<%08lx>]", frame->pc); |
| 487 | print_symbol("%s\n", frame->pc); | 486 | print_symbol(" %s\n", frame->pc); |
| 488 | } | 487 | } |
| 489 | return 0; | 488 | return 0; |
| 490 | } | 489 | } |
| @@ -494,19 +493,13 @@ void show_trace(struct task_struct *task, unsigned long *sp) | |||
| 494 | if (!sp) | 493 | if (!sp) |
| 495 | sp = stack_pointer(task); | 494 | sp = stack_pointer(task); |
| 496 | 495 | ||
| 497 | printk("Call Trace:"); | 496 | pr_info("Call Trace:\n"); |
| 498 | #ifdef CONFIG_KALLSYMS | ||
| 499 | printk("\n"); | ||
| 500 | #endif | ||
| 501 | walk_stackframe(sp, show_trace_cb, NULL); | 497 | walk_stackframe(sp, show_trace_cb, NULL); |
| 502 | printk("\n"); | 498 | #ifndef CONFIG_KALLSYMS |
| 499 | pr_cont("\n"); | ||
| 500 | #endif | ||
| 503 | } | 501 | } |
| 504 | 502 | ||
| 505 | /* | ||
| 506 | * This routine abuses get_user()/put_user() to reference pointers | ||
| 507 | * with at least a bit of error checking ... | ||
| 508 | */ | ||
| 509 | |||
| 510 | static int kstack_depth_to_print = 24; | 503 | static int kstack_depth_to_print = 24; |
| 511 | 504 | ||
| 512 | void show_stack(struct task_struct *task, unsigned long *sp) | 505 | void show_stack(struct task_struct *task, unsigned long *sp) |
| @@ -518,52 +511,29 @@ void show_stack(struct task_struct *task, unsigned long *sp) | |||
| 518 | sp = stack_pointer(task); | 511 | sp = stack_pointer(task); |
| 519 | stack = sp; | 512 | stack = sp; |
| 520 | 513 | ||
| 521 | printk("\nStack: "); | 514 | pr_info("Stack:\n"); |
| 522 | 515 | ||
| 523 | for (i = 0; i < kstack_depth_to_print; i++) { | 516 | for (i = 0; i < kstack_depth_to_print; i++) { |
| 524 | if (kstack_end(sp)) | 517 | if (kstack_end(sp)) |
| 525 | break; | 518 | break; |
| 526 | if (i && ((i % 8) == 0)) | 519 | pr_cont(" %08lx", *sp++); |
| 527 | printk("\n "); | 520 | if (i % 8 == 7) |
| 528 | printk("%08lx ", *sp++); | 521 | pr_cont("\n"); |
| 529 | } | 522 | } |
| 530 | printk("\n"); | ||
| 531 | show_trace(task, stack); | 523 | show_trace(task, stack); |
| 532 | } | 524 | } |
| 533 | 525 | ||
| 534 | void show_code(unsigned int *pc) | ||
| 535 | { | ||
| 536 | long i; | ||
| 537 | |||
| 538 | printk("\nCode:"); | ||
| 539 | |||
| 540 | for(i = -3 ; i < 6 ; i++) { | ||
| 541 | unsigned long insn; | ||
| 542 | if (__get_user(insn, pc + i)) { | ||
| 543 | printk(" (Bad address in pc)\n"); | ||
| 544 | break; | ||
| 545 | } | ||
| 546 | printk("%c%08lx%c",(i?' ':'<'),insn,(i?' ':'>')); | ||
| 547 | } | ||
| 548 | } | ||
| 549 | |||
| 550 | DEFINE_SPINLOCK(die_lock); | 526 | DEFINE_SPINLOCK(die_lock); |
| 551 | 527 | ||
| 552 | void die(const char * str, struct pt_regs * regs, long err) | 528 | void die(const char * str, struct pt_regs * regs, long err) |
| 553 | { | 529 | { |
| 554 | static int die_counter; | 530 | static int die_counter; |
| 555 | int nl = 0; | ||
| 556 | 531 | ||
| 557 | console_verbose(); | 532 | console_verbose(); |
| 558 | spin_lock_irq(&die_lock); | 533 | spin_lock_irq(&die_lock); |
| 559 | 534 | ||
| 560 | printk("%s: sig: %ld [#%d]\n", str, err, ++die_counter); | 535 | pr_info("%s: sig: %ld [#%d]%s\n", str, err, ++die_counter, |
| 561 | #ifdef CONFIG_PREEMPT | 536 | IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : ""); |
| 562 | printk("PREEMPT "); | ||
| 563 | nl = 1; | ||
| 564 | #endif | ||
| 565 | if (nl) | ||
| 566 | printk("\n"); | ||
| 567 | show_regs(regs); | 537 | show_regs(regs); |
| 568 | if (!user_mode(regs)) | 538 | if (!user_mode(regs)) |
| 569 | show_stack(NULL, (unsigned long*)regs->areg[1]); | 539 | show_stack(NULL, (unsigned long*)regs->areg[1]); |
