Skip to contentSkip to conversation

xen: Append a newline character to panic() where missing

PATCH In review Michal Orzel 6 participants 10 messages Jun 14, 2023 – Jun 15, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: Append a newline character to panic() where missing

Missing newline is inconsistent with the rest of the callers, since panic() expects it.

---
 xen/arch/arm/bootfdt.c            | 2 +-
 xen/arch/arm/domain_build.c       | 6 +++---
 xen/arch/x86/cpu/microcode/core.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
xen/arch/arm/bootfdt.c +1 -1
index b6f92a174f5f..2673ad17a1e1 100644
@@ -225,7 +225,7 @@ static int __init process_reserved_memory_node(const void *fdt, int node,
                                  size_cells, data);
 
     if ( rc == -ENOSPC )
-        panic("Max number of supported reserved-memory regions reached.");
+        panic("Max number of supported reserved-memory regions reached.\n");
     else if ( rc != -ENOENT )
         return rc;
     return 0;
xen/arch/arm/domain_build.c +3 -3
index 579bc8194fed..d0d6be922db1 100644
@@ -74,7 +74,7 @@ int __init parse_arch_dom0_param(const char *s, const char *e)
 
         return 0;
 #else
-        panic("'sve' property found, but CONFIG_ARM64_SVE not selected");
+        panic("'sve' property found, but CONFIG_ARM64_SVE not selected\n");
 #endif
     }
 
@@ -697,7 +697,7 @@ static void __init allocate_static_memory(struct domain *d,
     return;
 
  fail:
-    panic("Failed to allocate requested static memory for domain %pd.", d);
+    panic("Failed to allocate requested static memory for domain %pd.\n", d);
 }
 
 /*
@@ -769,7 +769,7 @@ static void __init assign_static_memory_11(struct domain *d,
     return;
 
  fail:
-    panic("Failed to assign requested static memory for direct-map domain %pd.",
+    panic("Failed to assign requested static memory for direct-map domain %pd.\n",
           d);
 }
 
xen/arch/x86/cpu/microcode/core.c +1 -1
index e65af4b82ea3..c3fee629063e 100644
@@ -524,7 +524,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
          */
         if ( wait_for_condition(wait_cpu_callout, (done + 1),
                                 MICROCODE_UPDATE_TIMEOUT_US) )
-            panic("Timeout when finished updating microcode (finished %u/%u)",
+            panic("Timeout when finished updating microcode (finished %u/%u)\n",
                   done, nr_cores);
 
         /* Print warning message once if long time is spent here */

base-commit: 2f69ef96801f0d2b9646abf6396e60f99c56e3a0

Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Michal Orzel

Missing newline is inconsistent with the rest of the callers, since panic() expects it.

Quoted 24 lines

---

xen/arch/arm/bootfdt.c            | 2 +-
xen/arch/arm/domain_build.c       | 6 +++---
xen/arch/x86/cpu/microcode/core.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
xen/arch/arm/bootfdt.c +1 -1
index b6f92a174f5f..2673ad17a1e1 100644
@@ -225,7 +225,7 @@ static int __init process_reserved_memory_node(const void *fdt, int node,
                                 size_cells, data);
 
    if ( rc == -ENOSPC )
-        panic("Max number of supported reserved-memory regions reached.");
+        panic("Max number of supported reserved-memory regions reached.\n");
    else if ( rc != -ENOENT )
        return rc;
    return 0;
xen/arch/arm/domain_build.c +0 -0
index 579bc8194fed..d0d6be922db1 100644

xen/arch/arm/domain_build.c int __init parse_arch_dom0_param(const char *s, const char *e) · line 77

Quoted 5 lines
xen/arch/arm/domain_build.c +1 -1
@@ -74,7 +74,7 @@ int __init parse_arch_dom0_param(const char *s, const char *e)
 
        return 0;
 #else
-        panic("'sve' property found, but CONFIG_ARM64_SVE not selected");
+        panic("'sve' property found, but CONFIG_ARM64_SVE not selected\n");

Sorry about that! I’ve missed it

Quoted 40 lines
xen/arch/arm/domain_build.c +2 -2
 #endif
    }
 
@@ -697,7 +697,7 @@ static void __init allocate_static_memory(struct domain *d,
    return;
 
 fail:
-    panic("Failed to allocate requested static memory for domain %pd.", d);
+    panic("Failed to allocate requested static memory for domain %pd.\n", d);
 }
 
 /*
@@ -769,7 +769,7 @@ static void __init assign_static_memory_11(struct domain *d,
    return;
 
 fail:
-    panic("Failed to assign requested static memory for direct-map domain %pd.",
+    panic("Failed to assign requested static memory for direct-map domain %pd.\n",
          d);
 }
 
xen/arch/x86/cpu/microcode/core.c +1 -1
index e65af4b82ea3..c3fee629063e 100644
@@ -524,7 +524,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
         */
        if ( wait_for_condition(wait_cpu_callout, (done + 1),
                                MICROCODE_UPDATE_TIMEOUT_US) )
-            panic("Timeout when finished updating microcode (finished %u/%u)",
+            panic("Timeout when finished updating microcode (finished %u/%u)\n",
                  done, nr_cores);
 
        /* Print warning message once if long time is spent here */

base-commit: 2f69ef96801f0d2b9646abf6396e60f99c56e3a0

Signature · 1 line
2.25.1
Acked-by on v1 1/1
#3 lore raw
In reply to Michal Orzel
Quoted 4 lines · Michal Orzel

Missing newline is inconsistent with the rest of the callers, since panic() expects it.

although...

Quoted 11 lines
---
 xen/arch/arm/bootfdt.c            | 2 +-
 xen/arch/arm/domain_build.c       | 6 +++---
 xen/arch/x86/cpu/microcode/core.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
xen/arch/arm/bootfdt.c +0 -0
index b6f92a174f5f..2673ad17a1e1 100644

xen/arch/arm/bootfdt.c static int __init process_reserved_memory_node(const void *fdt, int node, · line 228

Quoted 5 lines
xen/arch/arm/bootfdt.c +1 -1
@@ -225,7 +225,7 @@ static int __init process_reserved_memory_node(const void *fdt, int node,
                                  size_cells, data);
 
     if ( rc == -ENOSPC )
-        panic("Max number of supported reserved-memory regions reached.");
+        panic("Max number of supported reserved-memory regions reached.\n");

Trailing punctuation like . or ! is useless.  Most messages don't have them, and it just takes up space in .rodata, the console ring, and time on the UART.

I'd recommend dropping the ones you modify, and/or cleaning it up more widely.

~Andrew

#4 lore raw
Quoted 33 lines · Andrew Cooper
Quoted 4 lines · Michal Orzel

Missing newline is inconsistent with the rest of the callers, since panic() expects it.

although...

Quoted 11 lines
---
 xen/arch/arm/bootfdt.c            | 2 +-
 xen/arch/arm/domain_build.c       | 6 +++---
 xen/arch/x86/cpu/microcode/core.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
xen/arch/arm/bootfdt.c +0 -0
index b6f92a174f5f..2673ad17a1e1 100644

xen/arch/arm/bootfdt.c static int __init process_reserved_memory_node(const void *fdt, int node, · line 228

Quoted 5 lines
xen/arch/arm/bootfdt.c +1 -1
@@ -225,7 +225,7 @@ static int __init process_reserved_memory_node(const void *fdt, int node,
                                  size_cells, data);
 
     if ( rc == -ENOSPC )
-        panic("Max number of supported reserved-memory regions reached.");
+        panic("Max number of supported reserved-memory regions reached.\n");

Trailing punctuation like . or ! is useless. Most messages don't have them, and it just takes up space in .rodata, the console ring, and time on the UART.

Quoted 2 lines

I'd recommend dropping the ones you modify, and/or cleaning it up more widely.

I will keep in mind to do that in global scope in the next patch. We also have quite a lot of printk() with trailing punctuation.

~Michal

#5 lore raw
Quoted 36 lines · Michal Orzel
Quoted 33 lines · Andrew Cooper
Quoted 4 lines · Michal Orzel

Missing newline is inconsistent with the rest of the callers, since panic() expects it.

although...

Quoted 11 lines
---
  xen/arch/arm/bootfdt.c            | 2 +-
  xen/arch/arm/domain_build.c       | 6 +++---
  xen/arch/x86/cpu/microcode/core.c | 2 +-
  3 files changed, 5 insertions(+), 5 deletions(-)
xen/arch/arm/bootfdt.c +0 -0
index b6f92a174f5f..2673ad17a1e1 100644

xen/arch/arm/bootfdt.c static int __init process_reserved_memory_node(const void *fdt, int node, · line 228

Quoted 5 lines
xen/arch/arm/bootfdt.c +1 -1
@@ -225,7 +225,7 @@ static int __init process_reserved_memory_node(const void *fdt, int node,
                                   size_cells, data);
 
      if ( rc == -ENOSPC )
-        panic("Max number of supported reserved-memory regions reached.");
+        panic("Max number of supported reserved-memory regions reached.\n");

Trailing punctuation like . or ! is useless. Most messages don't have them, and it just takes up space in .rodata, the console ring, and time on the UART.

Quoted 4 lines
Quoted 2 lines

I'd recommend dropping the ones you modify, and/or cleaning it up more widely.

I will keep in mind to do that in global scope in the next patch. We also have quite a lot of printk() with trailing punctuation.

This is quite a bit of churn and I am unconvinced this is necessary. Also, if the others want such style, then this should be agreed on in the CODING_STYLE first. Otherwise, I am afraid this is not something I will enforce because I see limited value.

Cheers,

Signature · 1 line
Julien Grall
#6 lore raw
Quoted 41 lines · Julien Grall
Quoted 38 lines · Michal Orzel
Quoted 35 lines · Andrew Cooper
Quoted 4 lines · Michal Orzel

Missing newline is inconsistent with the rest of the callers, since panic() expects it.

although...

Quoted 11 lines
---
  xen/arch/arm/bootfdt.c            | 2 +-
  xen/arch/arm/domain_build.c       | 6 +++---
  xen/arch/x86/cpu/microcode/core.c | 2 +-
  3 files changed, 5 insertions(+), 5 deletions(-)
xen/arch/arm/bootfdt.c +0 -0
index b6f92a174f5f..2673ad17a1e1 100644

xen/arch/arm/bootfdt.c static int __init process_reserved_memory_node(const void *fdt, int node, · line 228

Quoted 5 lines
xen/arch/arm/bootfdt.c +1 -1
@@ -225,7 +225,7 @@ static int __init process_reserved_memory_node(const void *fdt, int node,
                                   size_cells, data);
 
      if ( rc == -ENOSPC )
-        panic("Max number of supported reserved-memory regions reached.");
+        panic("Max number of supported reserved-memory regions reached.\n");

Trailing punctuation like . or ! is useless. Most messages don't have them, and it just takes up space in .rodata, the console ring, and time on the UART.

I'd recommend dropping the ones you modify, and/or cleaning it up more widely.

Quoted 8 lines
Quoted 2 lines

I will keep in mind to do that in global scope in the next patch. We also have quite a lot of printk() with trailing punctuation.

This is quite a bit of churn and I am unconvinced this is necessary. Also, if the others want such style, then this should be agreed on in the CODING_STYLE first. Otherwise, I am afraid this is not something I will enforce because I see limited value.

I then suggest to take this patch as is if you are also happy with it like others.

~Michal

#7 lore raw
Quoted 47 lines · Michal Orzel
Quoted 44 lines · Julien Grall
Quoted 40 lines · Michal Orzel
Quoted 33 lines · Andrew Cooper
Quoted 4 lines · Michal Orzel

Missing newline is inconsistent with the rest of the callers, since panic() expects it.

although...

Quoted 11 lines
---
   xen/arch/arm/bootfdt.c            | 2 +-
   xen/arch/arm/domain_build.c       | 6 +++---
   xen/arch/x86/cpu/microcode/core.c | 2 +-
   3 files changed, 5 insertions(+), 5 deletions(-)
xen/arch/arm/bootfdt.c +0 -0
index b6f92a174f5f..2673ad17a1e1 100644

xen/arch/arm/bootfdt.c static int __init process_reserved_memory_node(const void *fdt, int node, · line 228

Quoted 5 lines
xen/arch/arm/bootfdt.c +1 -1
@@ -225,7 +225,7 @@ static int __init process_reserved_memory_node(const void *fdt, int node,
                                    size_cells, data);
 
       if ( rc == -ENOSPC )
-        panic("Max number of supported reserved-memory regions reached.");
+        panic("Max number of supported reserved-memory regions reached.\n");

Trailing punctuation like . or ! is useless. Most messages don't have them, and it just takes up space in .rodata, the console ring, and time on the UART.

Quoted 2 lines

I'd recommend dropping the ones you modify, and/or cleaning it up more widely.

I will keep in mind to do that in global scope in the next patch. We also have quite a lot of printk() with trailing punctuation.

Quoted 6 lines
Quoted 5 lines

This is quite a bit of churn and I am unconvinced this is necessary. Also, if the others want such style, then this should be agreed on in the CODING_STYLE first. Otherwise, I am afraid this is not something I will enforce because I see limited value.

I then suggest to take this patch as is if you are also happy with it like others.

The patch looks fine. I will commit it a bit later just to give a chance to Bertrand/Stefano to object.

Cheers,

Signature · 1 line
Julien Grall
#8 lore raw

Hi,

Quoted 1 line · Julien Grall

The patch looks fine. I will commit it a bit later just to give a chance to Bertrand/Stefano to object.

And committed.

Cheers,

Signature · 1 line
Julien Grall
Reviewed-by on v1 1/1
#9 lore raw
In reply to Michal Orzel

Hi Michal,

Quoted 6 lines · Michal Orzel

Missing newline is inconsistent with the rest of the callers, since panic() expects it.

And I agree with Julien: trailing punctuation is not an issue and I would definitely not require you to fix it.

Cheers
Bertrand

Quoted 68 lines

---

xen/arch/arm/bootfdt.c            | 2 +-
xen/arch/arm/domain_build.c       | 6 +++---
xen/arch/x86/cpu/microcode/core.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
xen/arch/arm/bootfdt.c +1 -1
index b6f92a174f5f..2673ad17a1e1 100644
@@ -225,7 +225,7 @@ static int __init process_reserved_memory_node(const void *fdt, int node,
                                 size_cells, data);
 
    if ( rc == -ENOSPC )
-        panic("Max number of supported reserved-memory regions reached.");
+        panic("Max number of supported reserved-memory regions reached.\n");
    else if ( rc != -ENOENT )
        return rc;
    return 0;
xen/arch/arm/domain_build.c +3 -3
index 579bc8194fed..d0d6be922db1 100644
@@ -74,7 +74,7 @@ int __init parse_arch_dom0_param(const char *s, const char *e)
 
        return 0;
 #else
-        panic("'sve' property found, but CONFIG_ARM64_SVE not selected");
+        panic("'sve' property found, but CONFIG_ARM64_SVE not selected\n");
 #endif
    }
 
@@ -697,7 +697,7 @@ static void __init allocate_static_memory(struct domain *d,
    return;
 
 fail:
-    panic("Failed to allocate requested static memory for domain %pd.", d);
+    panic("Failed to allocate requested static memory for domain %pd.\n", d);
 }
 
 /*
@@ -769,7 +769,7 @@ static void __init assign_static_memory_11(struct domain *d,
    return;
 
 fail:
-    panic("Failed to assign requested static memory for direct-map domain %pd.",
+    panic("Failed to assign requested static memory for direct-map domain %pd.\n",
          d);
 }
 
xen/arch/x86/cpu/microcode/core.c +1 -1
index e65af4b82ea3..c3fee629063e 100644
@@ -524,7 +524,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
         */
        if ( wait_for_condition(wait_cpu_callout, (done + 1),
                                MICROCODE_UPDATE_TIMEOUT_US) )
-            panic("Timeout when finished updating microcode (finished %u/%u)",
+            panic("Timeout when finished updating microcode (finished %u/%u)\n",
                  done, nr_cores);
 
        /* Print warning message once if long time is spent here */

base-commit: 2f69ef96801f0d2b9646abf6396e60f99c56e3a0

Signature · 1 line
2.25.1