lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 03 Feb 2012 11:36:27 -0800
From:	Jeremy Fitzhardinge <jeremy@...p.org>
To:	Jan Beulich <JBeulich@...e.com>
CC:	mingo@...e.hu, tglx@...utronix.de, hpa@...or.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: eliminate TICKET_MASK

On 02/03/2012 07:06 AM, Jan Beulich wrote:
> The definition of it being questionable already (unnecessarily
> including a cast), and it being used in a single place that can be
> written shorter without it, remove this #define.
>
> Along the same lines, simplify __ticket_spin_is_locked()'s main
> expression, which was the more convoluted way because of needs that
> went away with the recent type changes by Jeremy.
>
> This is pure cleanup, no functional change intended.

That looks reasonable to me.

> Signed-off-by: Jan Beulich <jbeulich@...e.com>
> Cc: Jeremy Fitzhardinge <jeremy@...p.org>
>
> ---
>  arch/x86/include/asm/spinlock.h       |    4 ++--
>  arch/x86/include/asm/spinlock_types.h |    1 -
>  2 files changed, 2 insertions(+), 3 deletions(-)
>
> --- 3.3-rc2/arch/x86/include/asm/spinlock.h
> +++ 3.3-rc2-x86-ticket-mask/arch/x86/include/asm/spinlock.h
> @@ -88,14 +88,14 @@ static inline int __ticket_spin_is_locke
>  {
>  	struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
>  
> -	return !!(tmp.tail ^ tmp.head);
> +	return tmp.tail != tmp.head;
>  }
>  
>  static inline int __ticket_spin_is_contended(arch_spinlock_t *lock)
>  {
>  	struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
>  
> -	return ((tmp.tail - tmp.head) & TICKET_MASK) > 1;
> +	return (__ticket_t)(tmp.tail - tmp.head) > 1;
>  }

Yes.  I only left these unchanged the first time around because I didn't
want to inadvertently change them, but my intent was to make them more
straightforward like this.

>  
>  #ifndef CONFIG_PARAVIRT_SPINLOCKS
> --- 3.3-rc2/arch/x86/include/asm/spinlock_types.h
> +++ 3.3-rc2-x86-ticket-mask/arch/x86/include/asm/spinlock_types.h
> @@ -16,7 +16,6 @@ typedef u32 __ticketpair_t;
>  #endif
>  
>  #define TICKET_SHIFT	(sizeof(__ticket_t) * 8)
> -#define TICKET_MASK	((__ticket_t)((1 << TICKET_SHIFT) - 1))
>  
>  typedef struct arch_spinlock {
>  	union {
>
>
>

Acked-by: Jeremy Fitzhardinge <jeremy@...p.org>

Thanks,
    J
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ