All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 0/6] Switch arm64 over to qrwlock
@ 2017-10-10 15:17 Jan Glauber
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Glauber @ 2017-10-10 15:17 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-kernel, linux-arm-kernel, Jeremy Linton, Peter Zijlstra,
	Ingo Molnar, longman, boqun.feng, paulmck

2017-10-05 14:54 GMT+02:00 Will Deacon <will.deacon@arm.com>:
>
> Hi all,
>
> This patch series reworks bits of the qrwlock code that it can be used
> to replace the asm rwlocks currently implemented for arm64. The structure
> of the series is:
>
>   Patches 1-3   : Work WFE into qrwlock using atomic_cond_read_acquire so
>                   we can avoid busy-waiting.
>
>   Patch 4       : Enable qrwlocks for arm64
>
>   Patch 5-6     : Ensure writer slowpath fairness. This has a potential
>                   performance impact on the writer unlock path, so I've
>                   kept them at the end.
>
> The patches apply on top of my other locking cleanups:
>
>   http://lkml.kernel.org/r/1507055129-12300-1-git-send-email-will.deacon@arm.com
>
> although the conflict with mainline is trivial to resolve without those.
> The full stack is also pushed here:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git qrwlock
>
> All comments (particularly related to testing and performance) welcome!

Hi Will,

run your patches on ThunderX2.

Old RW locks:

insmod ./locktorture.ko nwriters_stress=56 nreaders_stress=224
torture_type="rw_lock_irq" stat_interval=2

[  558.700042] Writes:  Total: 10127  Max/Min: 0/0   Fail: 0
[  558.700054] Reads :  Total: 764714  Max/Min: 0/0   Fail: 0
[  561.797011] Writes:  Total: 11288  Max/Min: 0/0   Fail: 0
[  561.802518] Reads :  Total: 2104452  Max/Min: 0/0   Fail: 0
[  565.844219] Writes:  Total: 11512  Max/Min: 0/0   Fail: 0
[  565.849710] Reads :  Total: 4277492  Max/Min: 0/0   Fail: 0

Queued RW locks:

[  221.491207] Writes:  Total: 57318  Max/Min: 0/0   Fail: 0
[  221.491219] Reads :  Total: 382979  Max/Min: 0/0   Fail: 0
[  223.507065] Writes:  Total: 83490  Max/Min: 0/0   Fail: 0
[  223.512611] Reads :  Total: 684848  Max/Min: 0/0   Fail: 0
[  225.522937] Writes:  Total: 110012  Max/Min: 0/0   Fail: 0
[  225.528511] Reads :  Total: 968826  Max/Min: 0/0   Fail: 0

So readers are still preferred over writers, but results are _way_
better. Also, with the old implementation
above test hung the machine which does not happen with the queued variant.

If you want you can add:
Tested-by: Jan Glauber <jglauber@cavium.com>

--Jan

> Cheers,
>
> Will
>
> --->8
>
> Will Deacon (6):
>   kernel/locking: Use struct qrwlock instead of struct __qrwlock
>   locking/atomic: Add atomic_cond_read_acquire
>   kernel/locking: Use atomic_cond_read_acquire when spinning in qrwlock
>   arm64: locking: Move rwlock implementation over to qrwlocks
>   kernel/locking: Prevent slowpath writers getting held up by fastpath
>   kernel/locking: Remove unused union members from struct qrwlock
>
>  arch/arm64/Kconfig                      |  17 ++++
>  arch/arm64/include/asm/Kbuild           |   1 +
>  arch/arm64/include/asm/spinlock.h       | 164 +-------------------------------
>  arch/arm64/include/asm/spinlock_types.h |   6 +-
>  include/asm-generic/atomic-long.h       |   3 +
>  include/asm-generic/qrwlock.h           |  14 +--
>  include/asm-generic/qrwlock_types.h     |   2 +-
>  include/linux/atomic.h                  |   4 +
>  kernel/locking/qrwlock.c                |  83 +++-------------
>  9 files changed, 43 insertions(+), 251 deletions(-)
>
> --
> 2.1.4
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/6] Switch arm64 over to qrwlock
  2017-10-05 22:12   ` Jeremy Linton
@ 2017-10-06  8:39     ` Will Deacon
  -1 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2017-10-06  8:39 UTC (permalink / raw)
  To: Jeremy Linton
  Cc: linux-kernel, linux-arm-kernel, peterz, mingo, longman,
	boqun.feng, paulmck

Hi Jeremy,

On Thu, Oct 05, 2017 at 05:12:44PM -0500, Jeremy Linton wrote:
> On 10/05/2017 07:54 AM, Will Deacon wrote:
> >This patch series reworks bits of the qrwlock code that it can be used
> >to replace the asm rwlocks currently implemented for arm64. The structure
> >of the series is:
> >
> >   Patches 1-3	: Work WFE into qrwlock using atomic_cond_read_acquire so
> >		  we can avoid busy-waiting.
> >
> >   Patch 4	: Enable qrwlocks for arm64
> >
> >   Patch 5-6	: Ensure writer slowpath fairness. This has a potential
> >		  performance impact on the writer unlock path, so I've
> >		  kept them at the end.
> >
> >The patches apply on top of my other locking cleanups:
> >
> >   http://lkml.kernel.org/r/1507055129-12300-1-git-send-email-will.deacon@arm.com
> >
> >although the conflict with mainline is trivial to resolve without those.
> >The full stack is also pushed here:
> >
> >   git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git qrwlock
> >
> >All comments (particularly related to testing and performance) welcome!
> 
> I haven't done any perf testing, but the machines continue to boot, and the
> stress-ng test which causes task lock problems with the normal arm64 rwlock
> now appears to run as expected. So, its a good start!

Excellent! Mind if I add your tested-by?

Will

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 0/6] Switch arm64 over to qrwlock
@ 2017-10-06  8:39     ` Will Deacon
  0 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2017-10-06  8:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jeremy,

On Thu, Oct 05, 2017 at 05:12:44PM -0500, Jeremy Linton wrote:
> On 10/05/2017 07:54 AM, Will Deacon wrote:
> >This patch series reworks bits of the qrwlock code that it can be used
> >to replace the asm rwlocks currently implemented for arm64. The structure
> >of the series is:
> >
> >   Patches 1-3	: Work WFE into qrwlock using atomic_cond_read_acquire so
> >		  we can avoid busy-waiting.
> >
> >   Patch 4	: Enable qrwlocks for arm64
> >
> >   Patch 5-6	: Ensure writer slowpath fairness. This has a potential
> >		  performance impact on the writer unlock path, so I've
> >		  kept them at the end.
> >
> >The patches apply on top of my other locking cleanups:
> >
> >   http://lkml.kernel.org/r/1507055129-12300-1-git-send-email-will.deacon at arm.com
> >
> >although the conflict with mainline is trivial to resolve without those.
> >The full stack is also pushed here:
> >
> >   git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git qrwlock
> >
> >All comments (particularly related to testing and performance) welcome!
> 
> I haven't done any perf testing, but the machines continue to boot, and the
> stress-ng test which causes task lock problems with the normal arm64 rwlock
> now appears to run as expected. So, its a good start!

Excellent! Mind if I add your tested-by?

Will

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/6] Switch arm64 over to qrwlock
  2017-10-05 12:54 ` Will Deacon
@ 2017-10-05 22:12   ` Jeremy Linton
  -1 siblings, 0 replies; 7+ messages in thread
From: Jeremy Linton @ 2017-10-05 22:12 UTC (permalink / raw)
  To: Will Deacon, linux-kernel
  Cc: linux-arm-kernel, peterz, mingo, longman, boqun.feng, paulmck

Hi,


On 10/05/2017 07:54 AM, Will Deacon wrote:
> Hi all,
> 
> This patch series reworks bits of the qrwlock code that it can be used
> to replace the asm rwlocks currently implemented for arm64. The structure
> of the series is:
> 
>    Patches 1-3	: Work WFE into qrwlock using atomic_cond_read_acquire so
> 		  we can avoid busy-waiting.
> 
>    Patch 4	: Enable qrwlocks for arm64
> 
>    Patch 5-6	: Ensure writer slowpath fairness. This has a potential
> 		  performance impact on the writer unlock path, so I've
> 		  kept them at the end.
> 
> The patches apply on top of my other locking cleanups:
> 
>    http://lkml.kernel.org/r/1507055129-12300-1-git-send-email-will.deacon@arm.com
> 
> although the conflict with mainline is trivial to resolve without those.
> The full stack is also pushed here:
> 
>    git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git qrwlock
> 
> All comments (particularly related to testing and performance) welcome!

I haven't done any perf testing, but the machines continue to boot, and 
the stress-ng test which causes task lock problems with the normal arm64 
rwlock now appears to run as expected. So, its a good start!



> 
> Cheers,
> 
> Will
> 
> --->8
> 
> Will Deacon (6):
>    kernel/locking: Use struct qrwlock instead of struct __qrwlock
>    locking/atomic: Add atomic_cond_read_acquire
>    kernel/locking: Use atomic_cond_read_acquire when spinning in qrwlock
>    arm64: locking: Move rwlock implementation over to qrwlocks
>    kernel/locking: Prevent slowpath writers getting held up by fastpath
>    kernel/locking: Remove unused union members from struct qrwlock
> 
>   arch/arm64/Kconfig                      |  17 ++++
>   arch/arm64/include/asm/Kbuild           |   1 +
>   arch/arm64/include/asm/spinlock.h       | 164 +-------------------------------
>   arch/arm64/include/asm/spinlock_types.h |   6 +-
>   include/asm-generic/atomic-long.h       |   3 +
>   include/asm-generic/qrwlock.h           |  14 +--
>   include/asm-generic/qrwlock_types.h     |   2 +-
>   include/linux/atomic.h                  |   4 +
>   kernel/locking/qrwlock.c                |  83 +++-------------
>   9 files changed, 43 insertions(+), 251 deletions(-)
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 0/6] Switch arm64 over to qrwlock
@ 2017-10-05 22:12   ` Jeremy Linton
  0 siblings, 0 replies; 7+ messages in thread
From: Jeremy Linton @ 2017-10-05 22:12 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,


On 10/05/2017 07:54 AM, Will Deacon wrote:
> Hi all,
> 
> This patch series reworks bits of the qrwlock code that it can be used
> to replace the asm rwlocks currently implemented for arm64. The structure
> of the series is:
> 
>    Patches 1-3	: Work WFE into qrwlock using atomic_cond_read_acquire so
> 		  we can avoid busy-waiting.
> 
>    Patch 4	: Enable qrwlocks for arm64
> 
>    Patch 5-6	: Ensure writer slowpath fairness. This has a potential
> 		  performance impact on the writer unlock path, so I've
> 		  kept them at the end.
> 
> The patches apply on top of my other locking cleanups:
> 
>    http://lkml.kernel.org/r/1507055129-12300-1-git-send-email-will.deacon at arm.com
> 
> although the conflict with mainline is trivial to resolve without those.
> The full stack is also pushed here:
> 
>    git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git qrwlock
> 
> All comments (particularly related to testing and performance) welcome!

I haven't done any perf testing, but the machines continue to boot, and 
the stress-ng test which causes task lock problems with the normal arm64 
rwlock now appears to run as expected. So, its a good start!



> 
> Cheers,
> 
> Will
> 
> --->8
> 
> Will Deacon (6):
>    kernel/locking: Use struct qrwlock instead of struct __qrwlock
>    locking/atomic: Add atomic_cond_read_acquire
>    kernel/locking: Use atomic_cond_read_acquire when spinning in qrwlock
>    arm64: locking: Move rwlock implementation over to qrwlocks
>    kernel/locking: Prevent slowpath writers getting held up by fastpath
>    kernel/locking: Remove unused union members from struct qrwlock
> 
>   arch/arm64/Kconfig                      |  17 ++++
>   arch/arm64/include/asm/Kbuild           |   1 +
>   arch/arm64/include/asm/spinlock.h       | 164 +-------------------------------
>   arch/arm64/include/asm/spinlock_types.h |   6 +-
>   include/asm-generic/atomic-long.h       |   3 +
>   include/asm-generic/qrwlock.h           |  14 +--
>   include/asm-generic/qrwlock_types.h     |   2 +-
>   include/linux/atomic.h                  |   4 +
>   kernel/locking/qrwlock.c                |  83 +++-------------
>   9 files changed, 43 insertions(+), 251 deletions(-)
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 0/6] Switch arm64 over to qrwlock
@ 2017-10-05 12:54 ` Will Deacon
  0 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2017-10-05 12:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, Jeremy.Linton, peterz, mingo, longman,
	boqun.feng, paulmck, Will Deacon

Hi all,

This patch series reworks bits of the qrwlock code that it can be used
to replace the asm rwlocks currently implemented for arm64. The structure
of the series is:

  Patches 1-3	: Work WFE into qrwlock using atomic_cond_read_acquire so
		  we can avoid busy-waiting.

  Patch 4	: Enable qrwlocks for arm64

  Patch 5-6	: Ensure writer slowpath fairness. This has a potential
		  performance impact on the writer unlock path, so I've
		  kept them at the end.

The patches apply on top of my other locking cleanups:

  http://lkml.kernel.org/r/1507055129-12300-1-git-send-email-will.deacon@arm.com

although the conflict with mainline is trivial to resolve without those.
The full stack is also pushed here:

  git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git qrwlock

All comments (particularly related to testing and performance) welcome!

Cheers,

Will

--->8

Will Deacon (6):
  kernel/locking: Use struct qrwlock instead of struct __qrwlock
  locking/atomic: Add atomic_cond_read_acquire
  kernel/locking: Use atomic_cond_read_acquire when spinning in qrwlock
  arm64: locking: Move rwlock implementation over to qrwlocks
  kernel/locking: Prevent slowpath writers getting held up by fastpath
  kernel/locking: Remove unused union members from struct qrwlock

 arch/arm64/Kconfig                      |  17 ++++
 arch/arm64/include/asm/Kbuild           |   1 +
 arch/arm64/include/asm/spinlock.h       | 164 +-------------------------------
 arch/arm64/include/asm/spinlock_types.h |   6 +-
 include/asm-generic/atomic-long.h       |   3 +
 include/asm-generic/qrwlock.h           |  14 +--
 include/asm-generic/qrwlock_types.h     |   2 +-
 include/linux/atomic.h                  |   4 +
 kernel/locking/qrwlock.c                |  83 +++-------------
 9 files changed, 43 insertions(+), 251 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 0/6] Switch arm64 over to qrwlock
@ 2017-10-05 12:54 ` Will Deacon
  0 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2017-10-05 12:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

This patch series reworks bits of the qrwlock code that it can be used
to replace the asm rwlocks currently implemented for arm64. The structure
of the series is:

  Patches 1-3	: Work WFE into qrwlock using atomic_cond_read_acquire so
		  we can avoid busy-waiting.

  Patch 4	: Enable qrwlocks for arm64

  Patch 5-6	: Ensure writer slowpath fairness. This has a potential
		  performance impact on the writer unlock path, so I've
		  kept them at the end.

The patches apply on top of my other locking cleanups:

  http://lkml.kernel.org/r/1507055129-12300-1-git-send-email-will.deacon at arm.com

although the conflict with mainline is trivial to resolve without those.
The full stack is also pushed here:

  git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git qrwlock

All comments (particularly related to testing and performance) welcome!

Cheers,

Will

--->8

Will Deacon (6):
  kernel/locking: Use struct qrwlock instead of struct __qrwlock
  locking/atomic: Add atomic_cond_read_acquire
  kernel/locking: Use atomic_cond_read_acquire when spinning in qrwlock
  arm64: locking: Move rwlock implementation over to qrwlocks
  kernel/locking: Prevent slowpath writers getting held up by fastpath
  kernel/locking: Remove unused union members from struct qrwlock

 arch/arm64/Kconfig                      |  17 ++++
 arch/arm64/include/asm/Kbuild           |   1 +
 arch/arm64/include/asm/spinlock.h       | 164 +-------------------------------
 arch/arm64/include/asm/spinlock_types.h |   6 +-
 include/asm-generic/atomic-long.h       |   3 +
 include/asm-generic/qrwlock.h           |  14 +--
 include/asm-generic/qrwlock_types.h     |   2 +-
 include/linux/atomic.h                  |   4 +
 kernel/locking/qrwlock.c                |  83 +++-------------
 9 files changed, 43 insertions(+), 251 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-10-10 15:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10 15:17 [PATCH 0/6] Switch arm64 over to qrwlock Jan Glauber
  -- strict thread matches above, loose matches on Subject: below --
2017-10-05 12:54 Will Deacon
2017-10-05 12:54 ` Will Deacon
2017-10-05 22:12 ` Jeremy Linton
2017-10-05 22:12   ` Jeremy Linton
2017-10-06  8:39   ` Will Deacon
2017-10-06  8:39     ` Will Deacon

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.