Skip to contentSkip to conversation

xen/panic: Tweak string formatting

PATCH In review Andrew Cooper 3 participants 3 messages Mar 19, 2013 – Mar 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/panic: Tweak string formatting

A few calls to panic() miss a newline in the format string, causing the lower line of *******'s to start immediately instead of on the next line.

xen/arch/x86/cpu/mcheck/mce.c +1 -1
diff -r 7babbd46586b -r a20f79411a5f xen/arch/x86/cpu/mcheck/mce.c
@@ -1536,7 +1536,7 @@ void mc_panic(char *s)
            "   The processor has reported a hardware error which cannot\n"
            "   be recovered from.  Xen will now reboot the machine.\n");
     mc_panic_dump();
-    panic("HARDWARE ERROR");
+    panic("HARDWARE ERROR\n");
 }
 
 /* Machine Check owner judge algorithm:
xen/arch/x86/io_apic.c +2 -2
diff -r 7babbd46586b -r a20f79411a5f xen/arch/x86/io_apic.c
@@ -122,7 +122,7 @@ static void add_pin_to_irq(unsigned int 
 
     if (entry->pin != -1) {
         if (irq_2_pin_free_entry >= PIN_MAP_SIZE)
-            panic("io_apic.c: whoops");
+            panic("io_apic.c: whoops\n");
         entry->next = irq_2_pin_free_entry;
         entry = irq_2_pin + entry->next;
         irq_2_pin_free_entry = entry->next;
@@ -1959,7 +1959,7 @@ static void __init check_timer(void)
     }
     printk(" failed :(.\n");
     panic("IO-APIC + timer doesn't work!  Boot with apic_verbosity=debug "
-          "and send a report.  Then try booting with the 'noapic' option");
+          "and send a report.  Then try booting with the 'noapic' option\n");
 }
 
 /*
xen/arch/x86/mm.c +1 -1
diff -r 7babbd46586b -r a20f79411a5f xen/arch/x86/mm.c
@@ -204,7 +204,7 @@ static void __init init_frametable_chunk
             mfn = alloc_boot_pages(step, step);
         } while ( !mfn && (step >>= PAGETABLE_ORDER) );
         if ( !mfn )
-            panic("Not enough memory for frame table");
+            panic("Not enough memory for frame table\n");
         map_pages_to_xen(s, mfn, step, PAGE_HYPERVISOR);
     }
#1 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper

A few calls to panic() miss a newline in the format string, causing the lower line of *******'s to start immediately instead of on the next line.

I would find it more sensible for the format string passed to panic() to never include a newline, with the panic() logic itself appending one. After all we know that the message must be a complete one - other than with printk(), there obviously is no chance of issuing a continuation message subsequently.

Jan

Quoted 48 lines

diff -r 7babbd46586b -r a20f79411a5f xen/arch/x86/cpu/mcheck/mce.c

xen/arch/x86/cpu/mcheck/mce.c +1 -1
@@ -1536,7 +1536,7 @@ void mc_panic(char *s)
            "   The processor has reported a hardware error which cannot\n"
            "   be recovered from.  Xen will now reboot the machine.\n");
     mc_panic_dump();
-    panic("HARDWARE ERROR");
+    panic("HARDWARE ERROR\n");
 }
 
 /* Machine Check owner judge algorithm:

diff -r 7babbd46586b -r a20f79411a5f xen/arch/x86/io_apic.c

xen/arch/x86/io_apic.c +2 -2
@@ -122,7 +122,7 @@ static void add_pin_to_irq(unsigned int 
 
     if (entry->pin != -1) {
         if (irq_2_pin_free_entry >= PIN_MAP_SIZE)
-            panic("io_apic.c: whoops");
+            panic("io_apic.c: whoops\n");
         entry->next = irq_2_pin_free_entry;
         entry = irq_2_pin + entry->next;
         irq_2_pin_free_entry = entry->next;
@@ -1959,7 +1959,7 @@ static void __init check_timer(void)
     }
     printk(" failed :(.\n");
     panic("IO-APIC + timer doesn't work!  Boot with apic_verbosity=debug "
-          "and send a report.  Then try booting with the 'noapic' option");
+          "and send a report.  Then try booting with the 'noapic' 
 option\n");
 }
 

/*
diff -r 7babbd46586b -r a20f79411a5f xen/arch/x86/mm.c

xen/arch/x86/mm.c +1 -1
@@ -204,7 +204,7 @@ static void __init init_frametable_chunk
             mfn = alloc_boot_pages(step, step);
         } while ( !mfn && (step >>= PAGETABLE_ORDER) );
         if ( !mfn )
-            panic("Not enough memory for frame table");
+            panic("Not enough memory for frame table\n");
         map_pages_to_xen(s, mfn, step, PAGE_HYPERVISOR);
     }
 
#2 lore raw
Quoted 9 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper

A few calls to panic() miss a newline in the format string, causing the lower line of *******'s to start immediately instead of on the next line.

I would find it more sensible for the format string passed to panic() to never include a newline, with the panic() logic itself appending one. After all we know that the message must be a complete one - other than with printk(), there obviously is no chance of issuing a continuation message subsequently.

This would be fine with me.

-- Keir

Quoted 53 lines

Jan

Quoted 48 lines

diff -r 7babbd46586b -r a20f79411a5f xen/arch/x86/cpu/mcheck/mce.c

xen/arch/x86/cpu/mcheck/mce.c +1 -1
@@ -1536,7 +1536,7 @@ void mc_panic(char *s)
            "   The processor has reported a hardware error which cannot\n"
            "   be recovered from.  Xen will now reboot the machine.\n");
     mc_panic_dump();
-    panic("HARDWARE ERROR");
+    panic("HARDWARE ERROR\n");
 }
 
 /* Machine Check owner judge algorithm:

diff -r 7babbd46586b -r a20f79411a5f xen/arch/x86/io_apic.c

xen/arch/x86/io_apic.c +2 -2
@@ -122,7 +122,7 @@ static void add_pin_to_irq(unsigned int
 
     if (entry->pin != -1) {
         if (irq_2_pin_free_entry >= PIN_MAP_SIZE)
-            panic("io_apic.c: whoops");
+            panic("io_apic.c: whoops\n");
         entry->next = irq_2_pin_free_entry;
         entry = irq_2_pin + entry->next;
         irq_2_pin_free_entry = entry->next;
@@ -1959,7 +1959,7 @@ static void __init check_timer(void)
     }
     printk(" failed :(.\n");
     panic("IO-APIC + timer doesn't work!  Boot with apic_verbosity=debug "
-          "and send a report.  Then try booting with the 'noapic' option");
+          "and send a report.  Then try booting with the 'noapic'
 option\n");
 }
 

/*
diff -r 7babbd46586b -r a20f79411a5f xen/arch/x86/mm.c

xen/arch/x86/mm.c +1 -1
@@ -204,7 +204,7 @@ static void __init init_frametable_chunk
             mfn = alloc_boot_pages(step, step);
         } while ( !mfn && (step >>= PAGETABLE_ORDER) );
         if ( !mfn )
-            panic("Not enough memory for frame table");
+            panic("Not enough memory for frame table\n");
         map_pages_to_xen(s, mfn, step, PAGE_HYPERVISOR);
     }