Skip to contentSkip to conversation

x86/traps: Make nmi_show_execution_state() more useful

PATCH In review Andrew Cooper 2 participants 2 messages Aug 12, 2022 – Aug 15, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/traps: Make nmi_show_execution_state() more useful

* Always emit current. It's critically important.
* Do not render (0000000000000000) for the symbol in guest context. It's just line-noise. Instead, explicitly identify which Xen vs guest context.
* Try to tabulate the data, because there is often lots of it.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/traps.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
xen/arch/x86/traps.c +8 -2
index b713ef7e77ce..95ef59c93bcd 100644
@@ -768,8 +768,14 @@ static int cf_check nmi_show_execution_state(
     if ( opt_show_all )
         show_execution_state(regs);
     else
-        printk(XENLOG_ERR "CPU%d @ %04x:%08lx (%pS)\n", cpu, regs->cs,
-               regs->rip, guest_mode(regs) ? NULL : _p(regs->rip));
+    {
+        if ( guest_mode(regs) )
+            printk(XENLOG_ERR "CPU%d\t%pv\t%04x:%p in guest\n",
+                   cpu, current, regs->cs, _p(regs->rip));
+        else
+            printk(XENLOG_ERR "CPU%d\t%pv\t%04x:%p in Xen: %pS\n",
+                   cpu, current, regs->cs, _p(regs->rip), _p(regs->rip));
+    }
     cpumask_clear_cpu(cpu, &show_state_mask);
 
     return 1;
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Andrew Cooper

* Always emit current. It's critically important.

I agree it may be relevant, yet I'm not convinced of "critically". But anyway.

Quoted 6 lines
xen/arch/x86/traps.c +0 -0
@@ -768,8 +768,14 @@ static int cf_check nmi_show_execution_state(
     if ( opt_show_all )
         show_execution_state(regs);
     else

xen/arch/x86/traps.c static int cf_check nmi_show_execution_state( · line 778

Quoted 10 lines
xen/arch/x86/traps.c +8 -2
-        printk(XENLOG_ERR "CPU%d @ %04x:%08lx (%pS)\n", cpu, regs->cs,
-               regs->rip, guest_mode(regs) ? NULL : _p(regs->rip));
+    {
+        if ( guest_mode(regs) )
+            printk(XENLOG_ERR "CPU%d\t%pv\t%04x:%p in guest\n",
+                   cpu, current, regs->cs, _p(regs->rip));
+        else
+            printk(XENLOG_ERR "CPU%d\t%pv\t%04x:%p in Xen: %pS\n",
+                   cpu, current, regs->cs, _p(regs->rip), _p(regs->rip));
+    }

Could I talk you into avoiding the extra level of indentation, by using "else if" in the middle? Preferably done that way:

Jan