[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/7] Port WARN_ON_ONCE() from Linux



>>> On 09.02.18 at 04:10, <sameer.goel@xxxxxxxxxx> wrote:
> Port WARN_ON_ONCE macro from Linux.
> 
> Signed-off-by: Sameer Goel <sameer.goel@xxxxxxxxxx>
> Acked-by: Julien Grall <julien.grall@xxxxxxxxxx>
> ---
>  xen/arch/arm/xen.lds.S |  1 +
>  xen/arch/x86/xen.lds.S |  1 +
>  xen/include/xen/lib.h  | 13 +++++++++++++
>  3 files changed, 15 insertions(+)
> 
> diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
> index b0390180b4..4dc7997cf0 100644
> --- a/xen/arch/arm/xen.lds.S
> +++ b/xen/arch/arm/xen.lds.S
> @@ -87,6 +87,7 @@ SECTIONS
>         __end_schedulers_array = .;
>         *(.data.rel)
>         *(.data.rel.*)
> +       *(.data.unlikely)
>         CONSTRUCTORS
>    } :text
>  
> diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
> index 095298048f..353ca148ca 100644
> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -240,6 +240,7 @@ SECTIONS
>         *(.data)
>         *(.data.rel)
>         *(.data.rel.*)
> +       *(.data.unlikely)
>         CONSTRUCTORS
>    } :text
>  
> diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
> index 1d9771340c..697212a061 100644
> --- a/xen/include/xen/lib.h
> +++ b/xen/include/xen/lib.h
> @@ -11,6 +11,19 @@
>  #define BUG_ON(p)  do { if (unlikely(p)) BUG();  } while (0)
>  #define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)
>  
> +#define WARN_ON_ONCE(p)                             \
> +({                                                  \
> +    static bool __section(".data.unlikely") __warned; \
> +    int __ret_warn_once = !!(p);                    \

Please don't introduce new name space violations (read: no
leading underscores here; use trailing one if need be).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.