Hi Alex,
On 2019/9/6 22:25, Alex Kogan wrote:
> The new macro should accept the value to be stored into the lock argument
> as another argument. This allows using the same macro in cases where the
> value to be stored when passing the lock is different from 1.
>
> Signed-off-by: Alex Kogan <[email protected]>
> Reviewed-by: Steve Sistare <[email protected]>
> ---
> arch/arm/include/asm/mcs_spinlock.h | 4 ++--
> kernel/locking/mcs_spinlock.h | 6 +++---
> kernel/locking/qspinlock.c | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/include/asm/mcs_spinlock.h
> b/arch/arm/include/asm/mcs_spinlock.h
> index 529d2cf4d06f..f3f9efdcd2ca 100644
> --- a/arch/arm/include/asm/mcs_spinlock.h
> +++ b/arch/arm/include/asm/mcs_spinlock.h
> @@ -14,9 +14,9 @@ do {
> \
> wfe(); \
> } while (0) \
>
> -#define arch_mcs_spin_unlock_contended(lock) \
> +#define arch_mcs_pass_lock(lock, val)
> \
arch_mcs_spin_unlock_contended() has a matching function
arch_mcs_spin_lock_contended(),
please see include/asm-generic/mcs_spinlock.h, so if we update this function
name,
should we update the matching one as well? and update the relevant comments as
well?
> do { \
> - smp_store_release(lock, 1); \
> + smp_store_release((lock), (val)); \
> dsb_sev(); \
> } while (0)
>
> diff --git a/kernel/locking/mcs_spinlock.h b/kernel/locking/mcs_spinlock.h
> index 5e10153b4d3c..84327ca21650 100644
> --- a/kernel/locking/mcs_spinlock.h
> +++ b/kernel/locking/mcs_spinlock.h
> @@ -41,8 +41,8 @@ do {
> \
> * operations in the critical section has been completed before
> * unlocking.
> */
> -#define arch_mcs_spin_unlock_contended(l) \
Before this line of the code, there is:
#ifndef arch_mcs_spin_lock_contended
...
#define arch_mcs_spin_lock_contended(l) \
So #ifndef should be updated too.
Thanks
Hanjun