From: Francesco Lavra <francescolavra.fl@gmail.com>
To: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
a.p.zijlstra@chello.nl, x86@kernel.org,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
robclark@gmail.com, tglx@linutronix.de, mingo@elte.hu,
linux-media@vger.kernel.org
Subject: Re: [Linaro-mm-sig] [PATCH v2 1/3] arch: make __mutex_fastpath_lock_retval return whether fastpath succeeded or not.
Date: Sat, 09 Mar 2013 13:06:20 +0100 [thread overview]
Message-ID: <513B25BC.3010609@gmail.com> (raw)
In-Reply-To: <20130228102452.15191.22673.stgit@patser>
On 02/28/2013 11:24 AM, Maarten Lankhorst wrote:
> This will allow me to call functions that have multiple arguments if fastpath fails.
> This is required to support ticket mutexes, because they need to be able to pass an
> extra argument to the fail function.
>
> Originally I duplicated the functions, by adding __mutex_fastpath_lock_retval_arg.
> This ended up being just a duplication of the existing function, so a way to test
> if fastpath was called ended up being better.
>
> This also cleaned up the reservation mutex patch some by being able to call an
> atomic_set instead of atomic_xchg, and making it easier to detect if the wrong
> unlock function was previously used.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
> ---
> arch/ia64/include/asm/mutex.h | 10 ++++------
> arch/powerpc/include/asm/mutex.h | 10 ++++------
> arch/sh/include/asm/mutex-llsc.h | 4 ++--
> arch/x86/include/asm/mutex_32.h | 11 ++++-------
> arch/x86/include/asm/mutex_64.h | 11 ++++-------
> include/asm-generic/mutex-dec.h | 10 ++++------
> include/asm-generic/mutex-null.h | 2 +-
> include/asm-generic/mutex-xchg.h | 10 ++++------
> kernel/mutex.c | 32 ++++++++++++++------------------
> 9 files changed, 41 insertions(+), 59 deletions(-)
[...]
> diff --git a/arch/x86/include/asm/mutex_32.h b/arch/x86/include/asm/mutex_32.h
> index 03f90c8..b7f6b34 100644
> --- a/arch/x86/include/asm/mutex_32.h
> +++ b/arch/x86/include/asm/mutex_32.h
> @@ -42,17 +42,14 @@ do { \
> * __mutex_fastpath_lock_retval - try to take the lock by moving the count
> * from 1 to a 0 value
> * @count: pointer of type atomic_t
> - * @fail_fn: function to call if the original value was not 1
> *
> - * Change the count from 1 to a value lower than 1, and call <fail_fn> if it
> - * wasn't 1 originally. This function returns 0 if the fastpath succeeds,
> - * or anything the slow path function returns
> + * Change the count from 1 to a value lower than 1. This function returns 0
> + * if the fastpath succeeds, or 1 otherwise.
The minus sign is missing, the return value should be -1.
[...]
> diff --git a/include/asm-generic/mutex-null.h b/include/asm-generic/mutex-null.h
> index e1bbbc7..efd6206 100644
> --- a/include/asm-generic/mutex-null.h
> +++ b/include/asm-generic/mutex-null.h
> @@ -11,7 +11,7 @@
> #define _ASM_GENERIC_MUTEX_NULL_H
>
> #define __mutex_fastpath_lock(count, fail_fn) fail_fn(count)
> -#define __mutex_fastpath_lock_retval(count, fail_fn) fail_fn(count)
> +#define __mutex_fastpath_lock_retval(count, fail_fn) (-1)
The fail_fn parameter should be dropped here as well.
Regards,
Francesco
prev parent reply other threads:[~2013-03-09 12:04 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-28 10:24 [PATCH v2 1/3] arch: make __mutex_fastpath_lock_retval return whether fastpath succeeded or not Maarten Lankhorst
2013-02-28 10:25 ` [PATCH v2 2/3] mutex: add support for reservation style locks, v2 Maarten Lankhorst
2013-04-02 10:56 ` Peter Zijlstra
2013-04-02 10:57 ` Peter Zijlstra
2013-04-02 11:00 ` Peter Zijlstra
2013-04-02 14:57 ` Maarten Lankhorst
2013-04-02 16:59 ` Peter Zijlstra
2013-04-02 17:23 ` Daniel Vetter
2013-04-02 17:30 ` Daniel Vetter
2013-04-04 12:01 ` Peter Zijlstra
2013-04-04 13:31 ` Daniel Vetter
2013-04-04 16:33 ` Peter Zijlstra
2013-04-04 16:38 ` Peter Zijlstra
2013-04-04 16:59 ` Daniel Vetter
2013-04-09 22:27 ` Steven Rostedt
2013-04-10 8:27 ` Daniel Vetter
2013-04-04 16:39 ` Peter Zijlstra
2013-04-04 16:41 ` Peter Zijlstra
2013-04-09 22:28 ` Steven Rostedt
2013-04-10 9:33 ` Daniel Vetter
2013-04-17 19:08 ` Daniel Vetter
2013-04-18 17:37 ` Ville Syrjälä
2013-04-04 16:43 ` Peter Zijlstra
2013-04-04 16:46 ` Peter Zijlstra
2013-04-04 16:49 ` Peter Zijlstra
2013-04-04 20:44 ` Daniel Vetter
2013-04-04 16:54 ` Peter Zijlstra
2013-04-04 16:56 ` Daniel Vetter
2013-04-08 10:39 ` Peter Zijlstra
2013-04-08 11:50 ` Daniel Vetter
2013-04-10 10:34 ` Daniel Vetter
2013-04-09 22:42 ` Steven Rostedt
2013-04-10 7:34 ` Peter Zijlstra
2013-04-09 22:18 ` Steven Rostedt
2013-04-02 15:56 ` Daniel Vetter
2013-04-02 11:04 ` Peter Zijlstra
2013-02-28 10:25 ` [PATCH v2 3/3] reservation: Add tests to lib/locking-selftest.c. v2 Maarten Lankhorst
2013-03-09 12:06 ` Francesco Lavra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=513B25BC.3010609@gmail.com \
--to=francescolavra.fl@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=maarten.lankhorst@canonical.com \
--cc=mingo@elte.hu \
--cc=robclark@gmail.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.