Skip to contentSkip to conversation

common/kexec: Identify which cpu the kexec image is being executed on.

PATCH Superseded Andrew Cooper 3 participants 4 messages Jan 6, 2014 – Jan 8, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/kexec: Identify which cpu the kexec image is being executed on.

A patch to this effect has been in XenServer for a little while, and has proved to be a useful debugging point for servers which have different behaviours depending when crashing on the non-bootstrap processor.

Moving the printk() from kexec_panic() to one_cpu_only() means that it will not be printed multiple times in the case of multiple cpus racing on the kexec path.

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC David Vrabel <[email protected]>

---

I would like this to be considered for 4.4, given that it is a quite trivial change, yet very useful information in the case of a crash.

---
 xen/common/kexec.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/common/kexec.c +2 -2
index 481b0c2..5dcd487 100644
@@ -265,6 +265,8 @@ static int noinline one_cpu_only(void)
     }
 
     set_bit(KEXEC_FLAG_IN_PROGRESS, &kexec_flags);
+    printk("Executing crash image on cpu%u\n", cpu);
+
     return 0;
 }
 
@@ -340,8 +342,6 @@ void kexec_crash(void)
     if ( !test_bit(KEXEC_IMAGE_CRASH_BASE + pos, &kexec_flags) )
         return;
 
-    printk("Executing crash image\n");
-
     kexecing = TRUE;
 
     if ( kexec_common_shutdown() != 0 )
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andrew Cooper

A patch to this effect has been in XenServer for a little while, and has proved to be a useful debugging point for servers which have different behaviours depending when crashing on the non-bootstrap processor.

Quoted 8 lines

Moving the printk() from kexec_panic() to one_cpu_only() means that it will not be printed multiple times in the case of multiple cpus racing on the kexec path.

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC David Vrabel <[email protected]>

One for 4.5 I think.

David

#2 lore raw
In reply to Andrew Cooper

xen/common/kexec.c static int noinline one_cpu_only(void) · line 272

Quoted 12 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
xen/common/kexec.c +2 -0
@@ -265,6 +265,8 @@ static int noinline one_cpu_only(void)
     }
 
     set_bit(KEXEC_FLAG_IN_PROGRESS, &kexec_flags);
+    printk("Executing crash image on cpu%u\n", cpu);
+
     return 0;
 }
 

With the calling function also being used from kexec_reboot(), printing "crash image" here isn't really correct afaict.

Jan

Quoted 11 lines
xen/common/kexec.c +0 -2
@@ -340,8 +342,6 @@ void kexec_crash(void)
     if ( !test_bit(KEXEC_IMAGE_CRASH_BASE + pos, &kexec_flags) )
         return;
 
-    printk("Executing crash image\n");
-
     kexecing = TRUE;
 
     if ( kexec_common_shutdown() != 0 )
Signature · 1 line
1.7.10.4
#3 lore raw
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
xen/common/kexec.c +0 -0
@@ -265,6 +265,8 @@ static int noinline one_cpu_only(void)
     }
 
Quoted 9 lines

xen/common/kexec.c static int noinline one_cpu_only(void) · line 272

Quoted 6 lines
xen/common/kexec.c +2 -0
     set_bit(KEXEC_FLAG_IN_PROGRESS, &kexec_flags);
+    printk("Executing crash image on cpu%u\n", cpu);
+
     return 0;
 }
 

With the calling function also being used from kexec_reboot(), printing "crash image" here isn't really correct afaict.

Good point.

David