* [PATCH] powerpc/xmon: Add option to show uptime information
@ 2017-09-18 14:16 Guilherme G. Piccoli
2017-10-08 8:43 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Guilherme G. Piccoli @ 2017-09-18 14:16 UTC (permalink / raw)
To: linuxppc-dev; +Cc: gpiccoli, muvic, benh, mpe, paulus
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: Murilo Fossa Vicentini <muvic@linux.vnet.ibm.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
---
Patch written against mpe's powerpc/next branch.
arch/powerpc/xmon/xmon.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 33351c6704b1..a12f89f4916b 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -278,6 +278,7 @@ Commands:\n\
#elif defined(CONFIG_44x) || defined(CONFIG_PPC_BOOK3E)
" u dump TLB\n"
#endif
+" U show uptime information\n"
" ? help\n"
" # n limit output to n lines per page (for dp, dpa, dl)\n"
" zr reboot\n\
@@ -896,6 +897,24 @@ static void remove_cpu_bpts(void)
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\n", (unsigned long) uptime.tv_sec,
+ ((unsigned long) uptime.tv_nsec / (NSEC_PER_SEC/100)));
+
+ }
+ catch_memory_errors = 0;
+}
+
static void set_lpp_cmd(void)
{
unsigned long lpp;
@@ -1031,6 +1050,9 @@ cmds(struct pt_regs *excp)
dump_tlb_book3e();
break;
#endif
+ case 'U':
+ show_uptime();
+ break;
default:
printf("Unrecognized command: ");
do {
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: powerpc/xmon: Add option to show uptime information
2017-09-18 14:16 [PATCH] powerpc/xmon: Add option to show uptime information Guilherme G. Piccoli
@ 2017-10-08 8:43 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2017-10-08 8:43 UTC (permalink / raw)
To: Guilherme G. Piccoli, linuxppc-dev; +Cc: muvic, paulus, gpiccoli
On Mon, 2017-09-18 at 14:16:58 UTC, "Guilherme G. Piccoli" wrote:
> 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: Murilo Fossa Vicentini <muvic@linux.vnet.ibm.com>
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/59d3391e8cf274097c42369866070c
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-08 8:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18 14:16 [PATCH] powerpc/xmon: Add option to show uptime information Guilherme G. Piccoli
2017-10-08 8:43 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).