* [PATCH] common/page_alloc: Drop BOOT_BUG_ON()
@ 2017-08-08 17:28 Andrew Cooper
2017-08-09 9:14 ` Jan Beulich
2017-08-09 9:32 ` Julien Grall
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Cooper @ 2017-08-08 17:28 UTC (permalink / raw)
To: Xen-devel; +Cc: Andrew Cooper, Julien Grall, Stefano Stabellini, Jan Beulich
Regular BUG_ON()'s work fine by this point on all architectures, so drop the
custom infrastructure. Substitute BUG_ON(1) for BUG().
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
---
xen/common/page_alloc.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 8bcef6a..64fe951 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -203,12 +203,6 @@ struct scrub_region {
static struct scrub_region __initdata region[MAX_NUMNODES];
static unsigned long __initdata chunk_size;
-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__);
-
static void __init bootmem_region_add(unsigned long s, unsigned long e)
{
unsigned int i;
@@ -223,9 +217,8 @@ static void __init bootmem_region_add(unsigned long s, unsigned long e)
if ( s < bootmem_region_list[i].e )
break;
- BOOT_BUG_ON((i < nr_bootmem_regions) && (e > bootmem_region_list[i].s));
- BOOT_BUG_ON(nr_bootmem_regions ==
- (PAGE_SIZE / sizeof(struct bootmem_region)));
+ BUG_ON((i < nr_bootmem_regions) && (e > bootmem_region_list[i].s));
+ BUG_ON(nr_bootmem_regions == (PAGE_SIZE / sizeof(struct bootmem_region)));
memmove(&bootmem_region_list[i+1], &bootmem_region_list[i],
(nr_bootmem_regions - i) * sizeof(*bootmem_region_list));
@@ -328,7 +321,7 @@ unsigned long __init alloc_boot_pages(
unsigned long pg, _e;
unsigned int i = nr_bootmem_regions;
- BOOT_BUG_ON(!nr_bootmem_regions);
+ BUG_ON(!nr_bootmem_regions);
while ( i-- )
{
@@ -362,8 +355,7 @@ unsigned long __init alloc_boot_pages(
return pg;
}
- BOOT_BUG_ON(1);
- return 0;
+ BUG();
}
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] common/page_alloc: Drop BOOT_BUG_ON()
2017-08-08 17:28 [PATCH] common/page_alloc: Drop BOOT_BUG_ON() Andrew Cooper
@ 2017-08-09 9:14 ` Jan Beulich
2017-08-09 9:21 ` Andrew Cooper
2017-08-09 9:32 ` Julien Grall
1 sibling, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2017-08-09 9:14 UTC (permalink / raw)
To: Andrew Cooper; +Cc: JulienGrall, Stefano Stabellini, Xen-devel
>>> On 08.08.17 at 19:28, <andrew.cooper3@citrix.com> wrote:
> Regular BUG_ON()'s work fine by this point on all architectures, so drop the
> custom infrastructure. Substitute BUG_ON(1) for BUG().
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
with one question:
> @@ -362,8 +355,7 @@ unsigned long __init alloc_boot_pages(
> return pg;
> }
>
> - BOOT_BUG_ON(1);
> - return 0;
> + BUG();
> }
Are all versions of gcc we formally support happy with the dropped
return?
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] common/page_alloc: Drop BOOT_BUG_ON()
2017-08-09 9:14 ` Jan Beulich
@ 2017-08-09 9:21 ` Andrew Cooper
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2017-08-09 9:21 UTC (permalink / raw)
To: Jan Beulich; +Cc: JulienGrall, Stefano Stabellini, Xen-devel
On 09/08/17 10:14, Jan Beulich wrote:
>>>> On 08.08.17 at 19:28, <andrew.cooper3@citrix.com> wrote:
>> Regular BUG_ON()'s work fine by this point on all architectures, so drop the
>> custom infrastructure. Substitute BUG_ON(1) for BUG().
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>
> with one question:
>
>> @@ -362,8 +355,7 @@ unsigned long __init alloc_boot_pages(
>> return pg;
>> }
>>
>> - BOOT_BUG_ON(1);
>> - return 0;
>> + BUG();
>> }
> Are all versions of gcc we formally support happy with the dropped
> return?
BUG() has an unreachable() at the end of it, which is do {} while (1)
for older compilers.
We already have constructs like this sporadically over the code,
oos_snapshot_lookup() as an example.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] common/page_alloc: Drop BOOT_BUG_ON()
2017-08-08 17:28 [PATCH] common/page_alloc: Drop BOOT_BUG_ON() Andrew Cooper
2017-08-09 9:14 ` Jan Beulich
@ 2017-08-09 9:32 ` Julien Grall
1 sibling, 0 replies; 4+ messages in thread
From: Julien Grall @ 2017-08-09 9:32 UTC (permalink / raw)
To: Andrew Cooper, Xen-devel; +Cc: Stefano Stabellini, Jan Beulich
Hi Andrew,
On 08/08/17 18:28, Andrew Cooper wrote:
> Regular BUG_ON()'s work fine by this point on all architectures, so drop the
> custom infrastructure. Substitute BUG_ON(1) for BUG().
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
FWIW:
Acked-by: Julien Grall <julien.grall@arm.com>
Cheers,
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien.grall@arm.com>
> ---
> xen/common/page_alloc.c | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
> index 8bcef6a..64fe951 100644
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -203,12 +203,6 @@ struct scrub_region {
> static struct scrub_region __initdata region[MAX_NUMNODES];
> static unsigned long __initdata chunk_size;
>
> -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__);
> -
> static void __init bootmem_region_add(unsigned long s, unsigned long e)
> {
> unsigned int i;
> @@ -223,9 +217,8 @@ static void __init bootmem_region_add(unsigned long s, unsigned long e)
> if ( s < bootmem_region_list[i].e )
> break;
>
> - BOOT_BUG_ON((i < nr_bootmem_regions) && (e > bootmem_region_list[i].s));
> - BOOT_BUG_ON(nr_bootmem_regions ==
> - (PAGE_SIZE / sizeof(struct bootmem_region)));
> + BUG_ON((i < nr_bootmem_regions) && (e > bootmem_region_list[i].s));
> + BUG_ON(nr_bootmem_regions == (PAGE_SIZE / sizeof(struct bootmem_region)));
>
> memmove(&bootmem_region_list[i+1], &bootmem_region_list[i],
> (nr_bootmem_regions - i) * sizeof(*bootmem_region_list));
> @@ -328,7 +321,7 @@ unsigned long __init alloc_boot_pages(
> unsigned long pg, _e;
> unsigned int i = nr_bootmem_regions;
>
> - BOOT_BUG_ON(!nr_bootmem_regions);
> + BUG_ON(!nr_bootmem_regions);
>
> while ( i-- )
> {
> @@ -362,8 +355,7 @@ unsigned long __init alloc_boot_pages(
> return pg;
> }
>
> - BOOT_BUG_ON(1);
> - return 0;
> + BUG();
> }
>
>
>
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-09 9:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-08 17:28 [PATCH] common/page_alloc: Drop BOOT_BUG_ON() Andrew Cooper
2017-08-09 9:14 ` Jan Beulich
2017-08-09 9:21 ` Andrew Cooper
2017-08-09 9:32 ` Julien Grall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).