Commit 59d3391e authored by Guilherme G. Piccoli's avatar Guilherme G. Piccoli Committed by Michael Ellerman

powerpc/xmon: Add option to show uptime information

It might be useful to quickly get the uptime of a running system on
xmon, without needing to grab data from memory and doing math on
struct addresses.

For example, it'd be useful to check for how long after a crash a
system is on xmon shell or if some test was started after the first
test crashed (and this 2nd test crashed too into xmon).

This small patch adds the 'U' command, to accomplish this.
Suggested-by: default avatarMurilo Fossa Vicentini <muvic@linux.vnet.ibm.com>
Signed-off-by: default avatarGuilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
[mpe: Display units (seconds), add sync()/__delay() sequence]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent c6baa077
...@@ -278,6 +278,7 @@ Commands:\n\ ...@@ -278,6 +278,7 @@ Commands:\n\
#elif defined(CONFIG_44x) || defined(CONFIG_PPC_BOOK3E) #elif defined(CONFIG_44x) || defined(CONFIG_PPC_BOOK3E)
" u dump TLB\n" " u dump TLB\n"
#endif #endif
" U show uptime information\n"
" ? help\n" " ? help\n"
" # n limit output to n lines per page (for dp, dpa, dl)\n" " # n limit output to n lines per page (for dp, dpa, dl)\n"
" zr reboot\n\ " zr reboot\n\
...@@ -905,6 +906,26 @@ static void remove_cpu_bpts(void) ...@@ -905,6 +906,26 @@ static void remove_cpu_bpts(void)
write_ciabr(0); write_ciabr(0);
} }
/* Based on uptime_proc_show(). */
static void
show_uptime(void)
{
struct timespec uptime;
if (setjmp(bus_error_jmp) == 0) {
catch_memory_errors = 1;
sync();
get_monotonic_boottime(&uptime);
printf("Uptime: %lu.%.2lu seconds\n", (unsigned long)uptime.tv_sec,
((unsigned long)uptime.tv_nsec / (NSEC_PER_SEC/100)));
sync();
__delay(200); \
}
catch_memory_errors = 0;
}
static void set_lpp_cmd(void) static void set_lpp_cmd(void)
{ {
unsigned long lpp; unsigned long lpp;
...@@ -1040,6 +1061,9 @@ cmds(struct pt_regs *excp) ...@@ -1040,6 +1061,9 @@ cmds(struct pt_regs *excp)
dump_tlb_book3e(); dump_tlb_book3e();
break; break;
#endif #endif
case 'U':
show_uptime();
break;
default: default:
printf("Unrecognized command: "); printf("Unrecognized command: ");
do { do {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment