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

Re: [Xen-devel] [Patch] xen/spinlock: Improvements to check_lock()



>>> On 23.12.13 at 17:39, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
> --- a/xen/include/xen/spinlock.h
> +++ b/xen/include/xen/spinlock.h
> @@ -6,9 +6,14 @@
>  
>  #ifndef NDEBUG
>  struct lock_debug {
> -    int irq_safe; /* +1: IRQ-safe; 0: not IRQ-safe; -1: don't know yet */
> +    enum lock_state {
> +        /* leave 0 unused to help detect uninitalised spinlocks */

Why don't you give this an explicit name, and then check for that
one state instead of checking multiple other states? That'll also
simplify adding eventual further states, and eliminate the need to
use initializers on the enumerator constants.

Jan

> +        lock_state_unknown = 1,
> +        lock_state_irqsafe = 2,
> +        lock_state_irqunsafe = 3
> +    } state;
>  };
> -#define _LOCK_DEBUG { -1 }
> +#define _LOCK_DEBUG { lock_state_unknown }
>  void spin_debug_enable(void);
>  void spin_debug_disable(void);
>  #else



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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