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:	Mon, 6 Jun 2011 14:23:01 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Mike Frysinger <vapier@...too.org>
Cc:	Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org,
	linux-arch@...r.kernel.org,
	uclinux-dist-devel@...ckfin.uclinux.org,
	Nick Piggin <npiggin@...nel.dk>
Subject: Re: [PATCH/RFC] asm-generic/mutex-dec.h: add SMP support

On Sun, 29 May 2011 23:19:28 -0400
Mike Frysinger <vapier@...too.org> wrote:

> To make these guys work on SMP systems, we just need to sprinkle a few
> barriers around.
> 
> Signed-off-by: Mike Frysinger <vapier@...too.org>
> ---
> note: this is what the Blackfin SMP port is using, but it doesn't seem
> like other SMP ports are ... so I wonder if we're just trying too hard
> and these barriers aren't actually necessary ?
> 
>  include/asm-generic/mutex-dec.h |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/include/asm-generic/mutex-dec.h b/include/asm-generic/mutex-dec.h
> index f104af7..e746c3c 100644
> --- a/include/asm-generic/mutex-dec.h
> +++ b/include/asm-generic/mutex-dec.h
> @@ -22,6 +22,8 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
>  {
>  	if (unlikely(atomic_dec_return(count) < 0))
>  		fail_fn(count);
> +	else
> +		smp_mb();
>  }
>  
>  /**
> @@ -39,6 +41,7 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
>  {
>  	if (unlikely(atomic_dec_return(count) < 0))
>  		return fail_fn(count);
> +	smp_mb();
>  	return 0;
>  }
>  
> @@ -58,6 +61,7 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
>  static inline void
>  __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
>  {
> +	smp_mb();
>  	if (unlikely(atomic_inc_return(count) <= 0))
>  		fail_fn(count);
>  }
> @@ -82,8 +86,10 @@ __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
>  static inline int
>  __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
>  {
> -	if (likely(atomic_cmpxchg(count, 1, 0) == 1))
> +	if (likely(atomic_cmpxchg(count, 1, 0) == 1)) {
> +		smp_mb();
>  		return 1;
> +	}
>  	return 0;
>  }

This patch basically reverts Nick's a8ddac7e53e89cb ("mutex: speed up
generic mutex implementations").  What's up with that?

I could try to review this patch but I'm pathetic with barriers.  Help.
--
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