Skip to contentSkip to conversation

cobalt: Print symbolic code location upon mode switch

PATCH Applied Richard Weinberger 2 participants 2 messages Mar 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cobalt: Print symbolic code location upon mode switch

These days the raw program counter is close to useless, do it like the rest of the kernel and print fn+offset [module name].

Example log output after this change:
[Xenomai] switching testx to secondary mode after exception #0 in kernel-space at test_ioctl_rt+0x14/0x20 [maptest] (pid 879)

---
 kernel/cobalt/dovetail/kevents.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/cobalt/dovetail/kevents.c +2 -2
index 817aa954dc01..f78abbdc792f 100644
@@ -65,9 +65,9 @@ void handle_oob_trap_entry(unsigned int trapnr, struct pt_regs *regs)
 	if (!user_mode(regs)) {
 		printk(XENO_WARNING
 		       "switching %s to secondary mode after exception #%u in "
-		       "kernel-space at 0x%lx (pid %d)\n", thread->name,
+		       "kernel-space at %pS (pid %d)\n", thread->name,
 		       trapnr,
-		       xnarch_fault_pc(regs),
+		       (void *)xnarch_fault_pc(regs),
 		       xnthread_host_pid(thread));
 	} else if (xnarch_fault_notify(trapnr)) /* Don't report debug traps */
 		printk(XENO_WARNING
Signature · 1 line
2.26.2
Applied
#1 lore raw
Quoted 17 lines · Richard Weinberger

These days the raw program counter is close to useless, do it like the rest of the kernel and print fn+offset [module name].

Example log output after this change:
[Xenomai] switching testx to secondary mode after exception #0 in kernel-space at test_ioctl_rt+0x14/0x20 [maptest] (pid 879)

---
 kernel/cobalt/dovetail/kevents.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/cobalt/dovetail/kevents.c +0 -0
index 817aa954dc01..f78abbdc792f 100644
@@ -65,9 +65,9 @@ void handle_oob_trap_entry(unsigned int trapnr, struct pt_regs *regs)
 	if (!user_mode(regs)) {

kernel/cobalt/dovetail/kevents.c void handle_oob_trap_entry(unsigned int trapnr, struct pt_regs *regs) · line 73

Quoted 10 lines
kernel/cobalt/dovetail/kevents.c +2 -2
 		printk(XENO_WARNING
 		       "switching %s to secondary mode after exception #%u in "
-		       "kernel-space at 0x%lx (pid %d)\n", thread->name,
+		       "kernel-space at %pS (pid %d)\n", thread->name,
 		       trapnr,
-		       xnarch_fault_pc(regs),
+		       (void *)xnarch_fault_pc(regs),
 		       xnthread_host_pid(thread));
 	} else if (xnarch_fault_notify(trapnr)) /* Don't report debug traps */
 		printk(XENO_WARNING

Thanks, applied.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center