All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/13] Zacas/Zabha support and qspinlocks
@ 2024-07-31  7:23 ` Alexandre Ghiti
  0 siblings, 0 replies; 95+ messages in thread
From: Alexandre Ghiti @ 2024-07-31  7:23 UTC (permalink / raw)
  To: Jonathan Corbet, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Conor Dooley, Rob Herring, Krzysztof Kozlowski, Andrea Parri,
	Nathan Chancellor, Peter Zijlstra, Ingo Molnar, Will Deacon,
	Waiman Long, Boqun Feng, Arnd Bergmann, Leonardo Bras, Guo Ren,
	linux-doc, devicetree, linux-kernel, linux-riscv, linux-arch
  Cc: Alexandre Ghiti

This implements [cmp]xchgXX() macros using Zacas and Zabha extensions
and finally uses those newly introduced macros to add support for
qspinlocks: note that this implementation of qspinlocks satisfies the
forward progress guarantee.

It also uses Ziccrse to provide the qspinlock implementation.

Thanks to Guo and Leonardo for their work!

v3: https://lore.kernel.org/linux-riscv/20240717061957.140712-1-alexghiti@rivosinc.com/
v2: https://lore.kernel.org/linux-riscv/20240626130347.520750-1-alexghiti@rivosinc.com/
v1: https://lore.kernel.org/linux-riscv/20240528151052.313031-1-alexghiti@rivosinc.com/

Changes in v4:
- rename sc_sfx into sc_cas_sfx in _arch_cmpxchg (Drew)
- cmpxchg() depends on 64BIT (Drew)
- rename xX register into tX (Drew)
- cas operations require the old value in rd, make this assignment more explicit
  as it seems to confuse people (Drew, Andrea)
- Fix ticket/queued configs build errors (Andrea)
- riscv_spinlock_init() is only needed for combo spinlocks but implement it
  anyway to inform of the type of spinlocks used (Andrea)
- Add RB from Guo
- Add NONPORTABLE to RISCV_QUEUED_SPINLOCKS (Samuel)
- Add a link to Guo's qspinlocks results on the sophgo platform
- Reorder ZICCRSE (Samuel)
- Use riscv_has_extention_unlikely() instead of direct asm goto, which is way
  cleaner and fixes the llvm 16 bug
- add dependency on RISCV_ALTERNATIVES in kconfig
- Rebase on top of 6.11, add patches to fix header circular dependency and
  to fix build_bug()

Changes in v3:
- Fix patch 4 to restrict the optimization to fully ordered AMO (Andrea)
- Move RISCV_ISA_EXT_ZABHA definition to patch 4 (Andrea)
- !Zacas at build time => no CAS from Zabha too (Andrea)
- drop patch 7 "riscv: Improve amoswap.X use in xchg()" (Andrea)
- Switch lr/sc and cas order (Guo)
- Combo spinlocks do not depend on Zabha
- Add a Kconfig for ticket/queued/combo (Guo)
- Use Ziccrse (Guo)

Changes in v2:
- Add patch for Zabha dtbinding (Conor)
- Fix cmpxchg128() build warnings missed in v1
- Make arch_cmpxchg128() fully ordered
- Improve Kconfig help texts for both extensions (Conor)
- Fix Makefile dependencies by requiring TOOLCHAIN_HAS_XXX (Nathan)
- Fix compilation errors when the toolchain does not support the
  extensions (Nathan)
- Fix C23 warnings about label at the end of coumpound statements (Nathan)
- Fix Zabha and !Zacas configurations (Andrea)
- Add COMBO spinlocks (Guo)
- Improve amocas fully ordered operations by using .aqrl semantics and
  removing the fence rw, rw (Andrea)
- Rebase on top "riscv: Fix fully ordered LR/SC xchg[8|16]() implementations"
- Add ARCH_WEAK_RELEASE_ACQUIRE (Andrea)
- Remove the extension version in march for LLVM since it is only required
  for experimental extensions (Nathan)
- Fix cmpxchg128() implementation by adding both registers of a pair
  in the list of input/output operands

Alexandre Ghiti (11):
  riscv: Move cpufeature.h macros into their own header
  riscv: Do not fail to build on byte/halfword operations with Zawrs
  riscv: Implement cmpxchg32/64() using Zacas
  dt-bindings: riscv: Add Zabha ISA extension description
  riscv: Implement cmpxchg8/16() using Zabha
  riscv: Improve zacas fully-ordered cmpxchg()
  riscv: Implement arch_cmpxchg128() using Zacas
  riscv: Implement xchg8/16() using Zabha
  riscv: Add ISA extension parsing for Ziccrse
  dt-bindings: riscv: Add Ziccrse ISA extension description
  riscv: Add qspinlock support

Guo Ren (2):
  asm-generic: ticket-lock: Reuse arch_spinlock_t of qspinlock
  asm-generic: ticket-lock: Add separate ticket-lock.h

 .../devicetree/bindings/riscv/extensions.yaml |  12 +
 .../locking/queued-spinlocks/arch-support.txt |   2 +-
 arch/riscv/Kconfig                            |  64 +++++
 arch/riscv/Makefile                           |   6 +
 arch/riscv/include/asm/Kbuild                 |   4 +-
 arch/riscv/include/asm/cmpxchg.h              | 264 ++++++++++++------
 arch/riscv/include/asm/cpufeature-macros.h    |  66 +++++
 arch/riscv/include/asm/cpufeature.h           |  56 +---
 arch/riscv/include/asm/hwcap.h                |   2 +
 arch/riscv/include/asm/spinlock.h             |  43 +++
 arch/riscv/kernel/cpufeature.c                |   2 +
 arch/riscv/kernel/setup.c                     |  38 +++
 include/asm-generic/qspinlock.h               |   2 +
 include/asm-generic/spinlock.h                |  87 +-----
 include/asm-generic/spinlock_types.h          |  12 +-
 include/asm-generic/ticket_spinlock.h         | 105 +++++++
 16 files changed, 533 insertions(+), 232 deletions(-)
 create mode 100644 arch/riscv/include/asm/cpufeature-macros.h
 create mode 100644 arch/riscv/include/asm/spinlock.h
 create mode 100644 include/asm-generic/ticket_spinlock.h

-- 
2.39.2


^ permalink raw reply	[flat|nested] 95+ messages in thread
* Re: [PATCH v4 13/13] riscv: Add qspinlock support
@ 2024-08-03  6:31 kernel test robot
  0 siblings, 0 replies; 95+ messages in thread
From: kernel test robot @ 2024-08-03  6:31 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20240731072405.197046-14-alexghiti@rivosinc.com>
References: <20240731072405.197046-14-alexghiti@rivosinc.com>
TO: Alexandre Ghiti <alexghiti@rivosinc.com>
TO: Jonathan Corbet <corbet@lwn.net>
TO: Paul Walmsley <paul.walmsley@sifive.com>
TO: Palmer Dabbelt <palmer@dabbelt.com>
TO: Albert Ou <aou@eecs.berkeley.edu>
TO: Conor Dooley <conor@kernel.org>
TO: Rob Herring <robh@kernel.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: Andrea Parri <parri.andrea@gmail.com>
TO: Nathan Chancellor <nathan@kernel.org>
TO: Peter Zijlstra <peterz@infradead.org>
TO: Ingo Molnar <mingo@redhat.com>
TO: Will Deacon <will@kernel.org>
TO: Waiman Long <longman@redhat.com>
TO: Boqun Feng <boqun.feng@gmail.com>
TO: Arnd Bergmann <arnd@arndb.de>
TO: Leonardo Bras <leobras@redhat.com>
TO: Guo Ren <guoren@kernel.org>
TO: linux-doc@vger.kernel.org
TO: devicetree@vger.kernel.org
TO: linux-kernel@vger.kernel.org
TO: linux-riscv@lists.infradead.org
TO: linux-arch@vger.kernel.org
CC: Alexandre Ghiti <alexghiti@rivosinc.com>

Hi Alexandre,

kernel test robot noticed the following build warnings:

[auto build test WARNING on arnd-asm-generic/master]
[also build test WARNING on robh/for-next linus/master v6.11-rc1 next-20240802]
[cannot apply to tip/locking/core]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Alexandre-Ghiti/riscv-Move-cpufeature-h-macros-into-their-own-header/20240802-012858
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
patch link:    https://lore.kernel.org/r/20240731072405.197046-14-alexghiti%40rivosinc.com
patch subject: [PATCH v4 13/13] riscv: Add qspinlock support
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202408031335.lQtE1M1j-lkp@intel.com/

includecheck warnings: (new ones prefixed by >>)
   arch/riscv/include/asm/spinlock.h: asm/ticket_spinlock.h is included more than once.
>> arch/riscv/include/asm/spinlock.h: asm/qspinlock.h is included more than once.

vim +11 arch/riscv/include/asm/spinlock.h

     8	
     9	#define __no_arch_spinlock_redefine
    10	#include <asm/ticket_spinlock.h>
  > 11	#include <asm/qspinlock.h>
    12	#include <asm/alternative.h>
    13	
    14	DECLARE_STATIC_KEY_TRUE(qspinlock_key);
    15	
    16	#define SPINLOCK_BASE_DECLARE(op, type, type_lock)			\
    17	static __always_inline type arch_spin_##op(type_lock lock)		\
    18	{									\
    19		if (static_branch_unlikely(&qspinlock_key))			\
    20			return queued_spin_##op(lock);				\
    21		return ticket_spin_##op(lock);					\
    22	}
    23	
    24	SPINLOCK_BASE_DECLARE(lock, void, arch_spinlock_t *)
    25	SPINLOCK_BASE_DECLARE(unlock, void, arch_spinlock_t *)
    26	SPINLOCK_BASE_DECLARE(is_locked, int, arch_spinlock_t *)
    27	SPINLOCK_BASE_DECLARE(is_contended, int, arch_spinlock_t *)
    28	SPINLOCK_BASE_DECLARE(trylock, bool, arch_spinlock_t *)
    29	SPINLOCK_BASE_DECLARE(value_unlocked, int, arch_spinlock_t)
    30	
    31	#elif defined(CONFIG_RISCV_QUEUED_SPINLOCKS)
    32	
  > 33	#include <asm/qspinlock.h>
    34	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-08-27  8:04 UTC | newest]

Thread overview: 95+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31  7:23 [PATCH v4 00/13] Zacas/Zabha support and qspinlocks Alexandre Ghiti
2024-07-31  7:23 ` Alexandre Ghiti
2024-07-31  7:23 ` [PATCH v4 01/13] riscv: Move cpufeature.h macros into their own header Alexandre Ghiti
2024-07-31  7:23   ` Alexandre Ghiti
2024-07-31  9:10   ` Andrew Jones
2024-07-31  9:10     ` Andrew Jones
2024-07-31  7:23 ` [PATCH v4 02/13] riscv: Do not fail to build on byte/halfword operations with Zawrs Alexandre Ghiti
2024-07-31  7:23   ` Alexandre Ghiti
2024-07-31 14:10   ` Andrew Jones
2024-07-31 14:10     ` Andrew Jones
2024-07-31 15:52     ` Alexandre Ghiti
2024-07-31 15:52       ` Alexandre Ghiti
2024-07-31 16:14       ` Andrew Jones
2024-07-31 16:14         ` Andrew Jones
2024-08-01  6:30         ` Alexandre Ghiti
2024-08-01  6:30           ` Alexandre Ghiti
2024-07-31 16:27   ` Waiman Long
2024-07-31 16:27     ` Waiman Long
2024-07-31 21:51     ` Guo Ren
2024-07-31 21:51       ` Guo Ren
2024-07-31  7:23 ` [PATCH v4 03/13] riscv: Implement cmpxchg32/64() using Zacas Alexandre Ghiti
2024-07-31  7:23   ` Alexandre Ghiti
2024-07-31  9:21   ` Andrew Jones
2024-07-31  9:21     ` Andrew Jones
2024-07-31  7:23 ` [PATCH v4 04/13] dt-bindings: riscv: Add Zabha ISA extension description Alexandre Ghiti
2024-07-31  7:23   ` Alexandre Ghiti
2024-08-01 14:53   ` Conor Dooley
2024-08-01 14:53     ` Conor Dooley
2024-07-31  7:23 ` [PATCH v4 05/13] riscv: Implement cmpxchg8/16() using Zabha Alexandre Ghiti
2024-07-31  7:23   ` Alexandre Ghiti
2024-07-31  9:27   ` Andrew Jones
2024-07-31  9:27     ` Andrew Jones
2024-07-31  7:23 ` [PATCH v4 06/13] riscv: Improve zacas fully-ordered cmpxchg() Alexandre Ghiti
2024-07-31  7:23   ` Alexandre Ghiti
2024-07-31  9:59   ` Andrew Jones
2024-07-31  9:59     ` Andrew Jones
2024-07-31 10:33     ` Andrea Parri
2024-07-31 10:33       ` Andrea Parri
2024-08-01  6:15     ` Alexandre Ghiti
2024-08-01  6:15       ` Alexandre Ghiti
2024-07-31  7:23 ` [PATCH v4 07/13] riscv: Implement arch_cmpxchg128() using Zacas Alexandre Ghiti
2024-07-31  7:23   ` Alexandre Ghiti
2024-07-31 15:41   ` Andrew Jones
2024-07-31 15:41     ` Andrew Jones
2024-07-31  7:24 ` [PATCH v4 08/13] riscv: Implement xchg8/16() using Zabha Alexandre Ghiti
2024-07-31  7:24   ` Alexandre Ghiti
2024-07-31 12:20   ` Andrew Jones
2024-07-31 12:20     ` Andrew Jones
2024-07-31  7:24 ` [PATCH v4 09/13] asm-generic: ticket-lock: Reuse arch_spinlock_t of qspinlock Alexandre Ghiti
2024-07-31  7:24   ` Alexandre Ghiti
2024-07-31  7:24 ` [PATCH v4 10/13] asm-generic: ticket-lock: Add separate ticket-lock.h Alexandre Ghiti
2024-07-31  7:24   ` Alexandre Ghiti
2024-07-31  7:24 ` [PATCH v4 11/13] riscv: Add ISA extension parsing for Ziccrse Alexandre Ghiti
2024-07-31  7:24   ` Alexandre Ghiti
2024-07-31  7:24 ` [PATCH v4 12/13] dt-bindings: riscv: Add Ziccrse ISA extension description Alexandre Ghiti
2024-07-31  7:24   ` Alexandre Ghiti
2024-08-01 14:44   ` Conor Dooley
2024-08-01 14:44     ` Conor Dooley
2024-08-02  8:14     ` Alexandre Ghiti
2024-08-02  8:14       ` Alexandre Ghiti
2024-08-02 14:46       ` Conor Dooley
2024-08-02 14:46         ` Conor Dooley
2024-07-31  7:24 ` [PATCH v4 13/13] riscv: Add qspinlock support Alexandre Ghiti
2024-07-31  7:24   ` Alexandre Ghiti
2024-07-31 15:29   ` Andrew Jones
2024-07-31 15:29     ` Andrew Jones
2024-08-01  6:53     ` Alexandre Ghiti
2024-08-01  6:53       ` Alexandre Ghiti
2024-08-01  7:48       ` Andrew Jones
2024-08-01  7:48         ` Andrew Jones
2024-08-02  8:31         ` Alexandre Ghiti
2024-08-02  8:31           ` Alexandre Ghiti
2024-08-15 13:27       ` Alexandre Ghiti
2024-08-15 13:27         ` Alexandre Ghiti
2024-08-15 13:34         ` Andrew Jones
2024-08-15 13:34           ` Andrew Jones
2024-08-17  5:08         ` Guo Ren
2024-08-17  5:08           ` Guo Ren
2024-08-21 12:18           ` Andrew Jones
2024-08-21 12:18             ` Andrew Jones
2024-08-27  8:02             ` Alexandre Ghiti
2024-08-27  8:02               ` Alexandre Ghiti
2024-08-27  8:03           ` Alexandre Ghiti
2024-08-27  8:03             ` Alexandre Ghiti
2024-08-01  8:43     ` Alexandre Ghiti
2024-08-01  8:43       ` Alexandre Ghiti
2024-08-01 10:15       ` Andrew Jones
2024-08-01 10:15         ` Andrew Jones
2024-08-02  8:58         ` Alexandre Ghiti
2024-08-02  8:58           ` Alexandre Ghiti
2024-08-01  9:48     ` Andrea Parri
2024-08-01  9:48       ` Andrea Parri
2024-08-01 14:15 ` [PATCH v4 00/13] Zacas/Zabha support and qspinlocks Peter Zijlstra
2024-08-01 14:15   ` Peter Zijlstra
  -- strict thread matches above, loose matches on Subject: below --
2024-08-03  6:31 [PATCH v4 13/13] riscv: Add qspinlock support kernel test robot

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.