linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 04/13] locking/qspinlock: Remove unbounded cmpxchg loop from locking slowpath
Date: Thu, 12 Apr 2018 15:18:27 +0100	[thread overview]
Message-ID: <20180412141827.GC21296@arm.com> (raw)
In-Reply-To: <e48ed216-f524-5b81-9790-33ccb78f7c06@redhat.com>

On Thu, Apr 12, 2018 at 10:16:55AM -0400, Waiman Long wrote:
> On 04/12/2018 10:06 AM, Will Deacon wrote:
> > On Wed, Apr 11, 2018 at 03:53:16PM -0400, Waiman Long wrote:
> >>> diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
> >>> index 396701e8c62d..a8fc402b3f3a 100644
> >>> --- a/kernel/locking/qspinlock.c
> >>> +++ b/kernel/locking/qspinlock.c
> >>> @@ -162,6 +162,17 @@ struct __qspinlock {
> >>>  
> >>>  #if _Q_PENDING_BITS == 8
> >>>  /**
> >>> + * clear_pending - clear the pending bit.
> >>> + * @lock: Pointer to queued spinlock structure
> >>> + *
> >>> + * *,1,* -> *,0,*
> >>> + */
> >>> +static __always_inline void clear_pending(struct qspinlock *lock)
> >>> +{
> >>> +	WRITE_ONCE(lock->pending, 0);
> >>> +}
> >>> +
> >>> +/**
> >>>   * clear_pending_set_locked - take ownership and clear the pending bit.
> >>>   * @lock: Pointer to queued spinlock structure
> >>>   *
> >>> @@ -201,6 +212,17 @@ static __always_inline u32 xchg_tail(struct qspinlock *lock, u32 tail)
> >>>  #else /* _Q_PENDING_BITS == 8 */
> >>>  
> >>>  /**
> >>> + * clear_pending - clear the pending bit.
> >>> + * @lock: Pointer to queued spinlock structure
> >>> + *
> >>> + * *,1,* -> *,0,*
> >>> + */
> >>> +static __always_inline void clear_pending(struct qspinlock *lock)
> >>> +{
> >>> +	atomic_andnot(_Q_PENDING_VAL, &lock->val);
> >>> +}
> >>> +
> >>> +/**
> >>>   * clear_pending_set_locked - take ownership and clear the pending bit.
> >>>   * @lock: Pointer to queued spinlock structure
> >>>   *
> >> BTW, there is a similar clear_pending() function in
> >> qspinlock_paravirt.c. I think you need to remove that with this patch.
> > Thanks, I'll do that. I did build and bisect this series... for arm64, which
> > is completely useless as it doesn't get compiled until the final patch which
> > I haven't posted here.
> >
> > Will
> 
> You certainly need to get a x86 system and compiles with the patches
> applied one-by-one with CONFIG_PARAVIRT_SPINLOCKS enabled.

Yup, doing that now. I just botched my test scripts before, which default to
arm64.

Will

  reply	other threads:[~2018-04-12 14:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11 18:01 [PATCH v2 00/13] kernel/locking: qspinlock improvements Will Deacon
2018-04-11 18:01 ` [PATCH v2 01/13] barriers: Introduce smp_cond_load_relaxed and atomic_cond_read_relaxed Will Deacon
2018-04-11 18:01 ` [PATCH v2 02/13] locking/qspinlock: Bound spinning on pending->locked transition in slowpath Will Deacon
2018-04-11 18:01 ` [PATCH v2 03/13] locking/qspinlock/x86: Increase _Q_PENDING_LOOPS upper bound Will Deacon
2018-04-11 18:01 ` [PATCH v2 04/13] locking/qspinlock: Remove unbounded cmpxchg loop from locking slowpath Will Deacon
2018-04-11 19:34   ` Waiman Long
2018-04-11 20:35     ` Waiman Long
2018-04-11 19:53   ` Waiman Long
2018-04-12 14:06     ` Will Deacon
2018-04-12 14:16       ` Waiman Long
2018-04-12 14:18         ` Will Deacon [this message]
2018-04-11 18:01 ` [PATCH v2 05/13] locking/qspinlock: Kill cmpxchg loop when claiming lock from head of queue Will Deacon
2018-04-11 18:01 ` [PATCH v2 06/13] locking/qspinlock: Use atomic_cond_read_acquire Will Deacon
2018-04-11 18:01 ` [PATCH v2 07/13] locking/mcs: Use smp_cond_load_acquire() in mcs spin loop Will Deacon
2018-04-11 18:01 ` [PATCH v2 08/13] locking/qspinlock: Use smp_cond_load_relaxed to wait for next node Will Deacon
2018-04-11 18:01 ` [PATCH v2 09/13] locking/qspinlock: Merge struct __qspinlock into struct qspinlock Will Deacon
2018-04-11 19:13   ` Waiman Long
2018-04-11 18:01 ` [PATCH v2 10/13] locking/qspinlock: Make queued_spin_unlock use smp_store_release Will Deacon
2018-04-11 18:01 ` [PATCH v2 11/13] locking/qspinlock: Elide back-to-back RELEASE operations with smp_wmb() Will Deacon
2018-04-11 18:01 ` [PATCH v2 12/13] locking/qspinlock: Use try_cmpxchg instead of cmpxchg when locking Will Deacon
2018-04-11 18:01 ` [PATCH v2 13/13] locking/qspinlock: Add stat tracking for pending vs slowpath Will Deacon
2018-04-13  9:24 ` [PATCH v2 00/13] kernel/locking: qspinlock improvements Catalin Marinas

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=20180412141827.GC21296@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).