diff mbox

[v1,4/7] page-alloc: Remove dependency on __LINE__ for release builds

Message ID 1462549688-29263-5-git-send-email-ross.lagerwall@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ross Lagerwall May 6, 2016, 3:48 p.m. UTC
When using xsplice, use of __LINE__ can generate spurious changes in
functions due to embedded line numbers.  For release builds, remove the
use of these line numbers in BOOT_BUG_ON() and print the current text
address instead.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 xen/common/page_alloc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Andrew Cooper May 10, 2016, 2:40 p.m. UTC | #1
On 06/05/16 16:48, Ross Lagerwall wrote:
> When using xsplice, use of __LINE__ can generate spurious changes in
> functions due to embedded line numbers.  For release builds, remove the
> use of these line numbers in BOOT_BUG_ON() and print the current text
> address instead.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>

I would just drop boot_bug() and BOOT_BUG_ON(), and replace them with
straight panic() calls.  It is only 3 uses in total.

The line numbers are really less helpful than a good description of the
reason for a panic.

~Andrew
Jan Beulich May 10, 2016, 2:46 p.m. UTC | #2
>>> On 06.05.16 at 17:48, <ross.lagerwall@citrix.com> wrote:
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -206,11 +206,19 @@ struct scrub_region {
>  static struct scrub_region __initdata region[MAX_NUMNODES];
>  static unsigned long __initdata chunk_size;
>  
> +#ifdef NDEBUG
> +static void __init boot_bug(void *addr)
> +{
> +    panic("Boot BUG at %p", addr);
> +}
> +#define BOOT_BUG_ON(p) if ( p ) boot_bug(current_text_addr());
> +#else
>  static void __init boot_bug(int line)
>  {
>      panic("Boot BUG at %s:%d", __FILE__, line);
>  }
>  #define BOOT_BUG_ON(p) if ( p ) boot_bug(__LINE__);
> +#endif

Along the lines of the comment on the earlier patch, please try
to limit the #ifdef to just the panic invocation. The function can
easily take both parameters and use just one in each variant.
And of course %ps or %pS and a dependency on CONFIG_XSPLICE
again.

Jan
diff mbox

Patch

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 98e30e5..8355894 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -206,11 +206,19 @@  struct scrub_region {
 static struct scrub_region __initdata region[MAX_NUMNODES];
 static unsigned long __initdata chunk_size;
 
+#ifdef NDEBUG
+static void __init boot_bug(void *addr)
+{
+    panic("Boot BUG at %p", addr);
+}
+#define BOOT_BUG_ON(p) if ( p ) boot_bug(current_text_addr());
+#else
 static void __init boot_bug(int line)
 {
     panic("Boot BUG at %s:%d", __FILE__, line);
 }
 #define BOOT_BUG_ON(p) if ( p ) boot_bug(__LINE__);
+#endif
 
 static void __init bootmem_region_add(unsigned long s, unsigned long e)
 {