Re: [PATCH v4 2/6] srcu: Add srcu_read_lock_fast_notrace() and srcu_read_unlock_fast_notrace()

2025-07-23 Thread Boqun Feng
On Wed, Jul 23, 2025 at 01:27:56PM -0700, Paul E. McKenney wrote: > This commit adds no-trace variants of the srcu_read_lock_fast() and > srcu_read_unlock_fast() functions for tracing use. > > [ paulmck: Apply notrace feedback from Joel Fernandes, Steven Rostedt, and > Mathieu Desnoyers. ] > > L

Re: [PATCH 8/8] locking/lockdep: Use shazptr to protect the key hashlist

2025-07-10 Thread Boqun Feng
On Thu, Jul 10, 2025 at 07:06:09AM -0700, Breno Leitao wrote: > Hello Boqun, > > On Tue, Jun 24, 2025 at 08:11:01PM -0700, Boqun Feng wrote: > > Erik Lundgren and Breno Leitao reported [1] a case where > > lockdep_unregister_key() can be called from time critical code pathe

Re: [RFC PATCH 4/8] shazptr: Avoid synchronize_shaptr() busy waiting

2025-07-10 Thread Boqun Feng
On Thu, Jul 10, 2025 at 05:56:00PM -0700, Paul E. McKenney wrote: > On Sun, Apr 13, 2025 at 11:00:51PM -0700, Boqun Feng wrote: > > For a general purpose hazard pointers implemenation, always busy waiting > > is not an option. It may benefit some special workload, but overall i

Re: [PATCH v15 1/7] rust: sync: add `SetOnce`

2025-07-09 Thread Boqun Feng
On Wed, Jul 09, 2025 at 10:22:04PM +0200, Benno Lossin wrote: [...] > >> > > +impl Drop for SetOnce { > >> > > +fn drop(&mut self) { > >> > > +if self.init.load(Acquire) == 2 { > >> > > +// SAFETY: By the type invariants of `Self`, > >> > > `self.init ==

Re: [PATCH v15 1/7] rust: sync: add `SetOnce`

2025-07-09 Thread Boqun Feng
On Wed, Jul 09, 2025 at 08:22:16PM +0200, Benno Lossin wrote: > On Wed Jul 9, 2025 at 12:34 PM CEST, Andreas Hindborg wrote: > > "Benno Lossin" writes: > >> On Tue Jul 8, 2025 at 10:54 AM CEST, Andreas Hindborg wrote: > >>> "Boqun Feng" write

Re: [PATCH v15 1/7] rust: sync: add `SetOnce`

2025-07-07 Thread Boqun Feng
On Mon, Jul 07, 2025 at 03:38:58PM +0200, Alice Ryhl wrote: > On Mon, Jul 7, 2025 at 3:32 PM Andreas Hindborg wrote: > > > > Introduce the `SetOnce` type, a container that can only be written once. > > The container uses an internal atomic to synchronize writes to the internal > > value. > > > > S

Re: [PATCH 0/8] Introduce simple hazard pointers for lockdep

2025-06-26 Thread Boqun Feng
On Thu, Jun 26, 2025 at 03:16:49AM -0700, Christoph Hellwig wrote: > On Wed, Jun 25, 2025 at 07:08:57AM -0700, Boqun Feng wrote: > > Sure, I will put one for the future version, here is the gist: > > Thanks a lot! > > > The updater's wait can finish immediately i

Re: [PATCH 0/8] Introduce simple hazard pointers for lockdep

2025-06-25 Thread Boqun Feng
On Wed, Jun 25, 2025 at 08:25:52AM -0400, Mathieu Desnoyers wrote: > On 2025-06-24 23:10, Boqun Feng wrote: > > Hi, > > > > This is the official first version of simple hazard pointers following > > the RFC: > > > > > > https://lore.ke

Re: [PATCH 4/8] shazptr: Avoid synchronize_shaptr() busy waiting

2025-06-25 Thread Boqun Feng
On Wed, Jun 25, 2025 at 03:56:05PM +0200, Frederic Weisbecker wrote: > Le Tue, Jun 24, 2025 at 08:10:57PM -0700, Boqun Feng a écrit : > > +static void synchronize_shazptr_normal(void *ptr) > > +{ > > + int cpu; > > + unsigned long blocking_grp_mask = 0; > > +

Re: [PATCH 0/8] Introduce simple hazard pointers for lockdep

2025-06-25 Thread Boqun Feng
On Wed, Jun 25, 2025 at 05:05:11AM -0700, Christoph Hellwig wrote: > On Tue, Jun 24, 2025 at 08:10:53PM -0700, Boqun Feng wrote: > > Hi, > > > > This is the official first version of simple hazard pointers following > > the RFC: > > Can you please put an explan

Re: [PATCH 1/8] Introduce simple hazard pointers

2025-06-25 Thread Boqun Feng
On Wed, Jun 25, 2025 at 11:52:04AM -0400, Waiman Long wrote: [...] > > +/* > > + * Acquire a hazptr slot and begin the hazard pointer critical section. > > + * > > + * Must be called with preemption disabled, and preemption must remain > > disabled > > + * until shazptr_clear(). > > + */ > > +stat

Re: [PATCH 1/8] Introduce simple hazard pointers

2025-06-25 Thread Boqun Feng
On Wed, Jun 25, 2025 at 10:25:23AM -0400, Mathieu Desnoyers wrote: > On 2025-06-24 23:10, Boqun Feng wrote: > [...] > > + > > +static inline void shazptr_clear(struct shazptr_guard guard) > > +{ > > + /* Only clear the slot when the outermost guard is

Re: [PATCH 8/8] locking/lockdep: Use shazptr to protect the key hashlist

2025-06-25 Thread Boqun Feng
On Wed, Jun 25, 2025 at 01:59:29PM +0200, Peter Zijlstra wrote: > On Tue, Jun 24, 2025 at 08:11:01PM -0700, Boqun Feng wrote: > > > + /* Need preemption disable for using shazptr. */ > > + guard(preempt)(); > > + > > + /* Protect the list search with sha

[PATCH 2/8] shazptr: Add refscale test

2025-06-24 Thread Boqun Feng
Add the refscale test for shazptr to measure the reader side performance. Signed-off-by: Boqun Feng --- kernel/rcu/refscale.c | 39 +++ 1 file changed, 39 insertions(+) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index f11a7c2af778

[PATCH 6/8] rcuscale: Allow rcu_scale_ops::get_gp_seq to be NULL

2025-06-24 Thread Boqun Feng
For synchronization mechanisms similar to RCU, there could be no "grace period" concept (e.g. hazard pointers), therefore allow rcu_scale_ops::get_gp_seq to be a NULL pointer for these cases, and simply treat started and finished grace period as 0. Signed-off-by: Boqun Feng ---

[PATCH 8/8] locking/lockdep: Use shazptr to protect the key hashlist

2025-06-24 Thread Boqun Feng
shazptr here can achieve the same/better synchronization time without the need to send IPI. Hence use shazptr here. Reported-by: Erik Lundgren Reported-by: Breno Leitao Link: https://lore.kernel.org/all/20250321-lockdep-v1-1-78b732d19...@debian.org/ [1] Signed-off-by: Boqun Feng --- kernel

[PATCH 7/8] rcuscale: Add tests for simple hazard pointers

2025-06-24 Thread Boqun Feng
Add two rcu_scale_ops to include tests from simple hazard pointers (shazptr). One is with evenly distributed readers, and the other is with all WILDCARD readers. This could show the best and worst case scenarios for the synchronization time of simple hazard pointers. Signed-off-by: Boqun Feng

[PATCH 5/8] shazptr: Allow skip self scan in synchronize_shaptr()

2025-06-24 Thread Boqun Feng
synchronize_shaptr(). Signed-off-by: Boqun Feng --- kernel/locking/shazptr.c | 28 +--- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/kernel/locking/shazptr.c b/kernel/locking/shazptr.c index a8559cb559f8..b3f7e8390eb2 100644 --- a/kernel/locking/shazptr.c

[PATCH 4/8] shazptr: Avoid synchronize_shaptr() busy waiting

2025-06-24 Thread Boqun Feng
gned-off-by: Boqun Feng --- kernel/locking/shazptr.c | 277 ++- 1 file changed, 276 insertions(+), 1 deletion(-) diff --git a/kernel/locking/shazptr.c b/kernel/locking/shazptr.c index 991fd1a05cfd..a8559cb559f8 100644 --- a/kernel/locking/shazptr.c +++ b/kernel

[PATCH 3/8] shazptr: Add refscale test for wildcard

2025-06-24 Thread Boqun Feng
Add the refscale test for shazptr, which starts another shazptr critical section inside an existing one to measure the reader side performance when wildcard logic is triggered. Signed-off-by: Boqun Feng --- kernel/rcu/refscale.c | 40 +++- 1 file changed, 39

[PATCH 1/8] Introduce simple hazard pointers

2025-06-24 Thread Boqun Feng
p. 491-504, June 2004 Link: https://lore.kernel.org/lkml/20240917143402.930114-1-boqun.f...@gmail.com/ [2] Signed-off-by: Boqun Feng --- include/linux/shazptr.h | 73 kernel/locking/Makefile | 2 +- kernel/locking/shazptr.c | 29 3

[PATCH 0/8] Introduce simple hazard pointers for lockdep

2025-06-24 Thread Boqun Feng
od duration: 600.214 Maximum grace-period duration: 4126.94 Boqun Feng (8): Introduce simple hazard pointers shazptr: Add refscale test shazptr: Add refscale test for wildcard shazptr: Avoid synchronize_shaptr() busy waiting shazptr: Allow skip self scan in synchronize_shaptr

Re: [PATCH 1/3] rcu: Return early if callback is not specified

2025-06-12 Thread Boqun Feng
On Thu, Jun 12, 2025 at 07:46:12PM +0200, Uladzislau Rezki wrote: > On Thu, Jun 12, 2025 at 10:30:38AM -0700, Boqun Feng wrote: > > > > > > On Tue, Jun 10, 2025, at 12:33 PM, Joel Fernandes wrote: > > > On 6/10/2025 1:34 PM, Uladzislau Rezki (Sony) wrote: > >

Re: [PATCH 1/3] rcu: Return early if callback is not specified

2025-06-12 Thread Boqun Feng
On Thu, Jun 12, 2025, at 10:30 AM, Boqun Feng wrote: > On Tue, Jun 10, 2025, at 12:33 PM, Joel Fernandes wrote: >> On 6/10/2025 1:34 PM, Uladzislau Rezki (Sony) wrote: >>> Currently the call_rcu() API does not check whether a callback >>> pointer is NULL. If NULL is

Re: [PATCH 1/3] rcu: Return early if callback is not specified

2025-06-12 Thread Boqun Feng
inter dereference and a kernel crash. >> >> To prevent this and improve debuggability, this patch adds a check >> for NULL and emits a kernel stack trace to help identify a faulty >> caller. >> >> Signed-off-by: Uladzislau Rezki (Sony) > > Reviewed-by:

Re: [PATCH 2/2] rcu: Fix lockup when RCU reader used while IRQ exiting

2025-06-11 Thread Boqun Feng
On Wed, Jun 11, 2025 at 09:16:05AM -0700, Paul E. McKenney wrote: > On Wed, Jun 11, 2025 at 09:05:06AM -0700, Boqun Feng wrote: > > On Mon, Jun 09, 2025 at 02:01:24PM -0400, Joel Fernandes wrote: > > > During rcu_read_unlock_special(), if this happens during irq_exit(), we >

Re: [PATCH 2/2] rcu: Fix lockup when RCU reader used while IRQ exiting

2025-06-11 Thread Boqun Feng
On Mon, Jun 09, 2025 at 02:01:24PM -0400, Joel Fernandes wrote: > During rcu_read_unlock_special(), if this happens during irq_exit(), we > can lockup if an IPI is issued. This is because the IPI itself triggers > the irq_exit() path causing a recursive lock up. > > This is precisely what Xiongfen

Re: [PATCH 2/2] rcu: Fix lockup when RCU reader used while IRQ exiting

2025-06-09 Thread Boqun Feng
On Tue, Jun 10, 2025 at 01:26:46AM +0200, Frederic Weisbecker wrote: > Le Mon, Jun 09, 2025 at 12:49:06PM -0700, Boqun Feng a écrit : > > Hi Joel, > > > > On Mon, Jun 09, 2025 at 02:01:24PM -0400, Joel Fernandes wrote: > > > During rcu_read_unlock_special(), if this

Re: [PATCH 2/2] rcu: Fix lockup when RCU reader used while IRQ exiting

2025-06-09 Thread Boqun Feng
Hi Joel, On Mon, Jun 09, 2025 at 02:01:24PM -0400, Joel Fernandes wrote: > During rcu_read_unlock_special(), if this happens during irq_exit(), we > can lockup if an IPI is issued. This is because the IPI itself triggers > the irq_exit() path causing a recursive lock up. > > This is precisely wha

Re: [PATCH 2/7] rust: kunit: support checked `-> Result`s in KUnit `#[test]`s

2025-05-05 Thread Boqun Feng
On Mon, May 05, 2025 at 02:02:09PM +0800, David Gow wrote: > On Sat, 3 May 2025 at 05:51, Miguel Ojeda wrote: > > > > Currently, return values of KUnit `#[test]` functions are ignored. > > > > Thus introduce support for `-> Result` functions by checking their > > returned values. > > > > At the sa

[RFC v3 11/12] rust: sync: Add memory barriers

2025-04-21 Thread Boqun Feng
e asm therefore the compiler barrier should be implemented in inline asm as well. Signed-off-by: Boqun Feng --- rust/helpers/barrier.c | 18 ++ rust/helpers/helpers.c | 1 + rust/kernel/sync.rs | 1 + rust/kernel/sync/barrier.rs | 67 +++

[RFC v3 12/12] rust: sync: rcu: Add RCU protected pointer

2025-04-21 Thread Boqun Feng
] Link: https://github.com/nbdd0121/field-projection [3] Link: https://kangrejos.com/2023 [4] Signed-off-by: Boqun Feng --- rust/kernel/sync/rcu.rs | 275 +++- 1 file changed, 274 insertions(+), 1 deletion(-) diff --git a/rust/kernel/sync/rcu.rs b/rust/ke

[RFC v3 09/12] rust: sync: atomic: Add Atomic<*mut T>

2025-04-21 Thread Boqun Feng
the `AllowAtomic` trait to include a customized `Send` semantics, that is: `impl AllowAtomic` has to be safe to be transferred across thread boundaries. Suggested-by: Alice Ryhl Signed-off-by: Boqun Feng --- rust/kernel/sync/atomic.rs | 24 rust/kernel/sync/atomi

[RFC v3 10/12] rust: sync: atomic: Add arithmetic ops for Atomic<*mut T>

2025-04-21 Thread Boqun Feng
ue. We can either take the approach in the current patch and add byte_add() later on if needed, or start with ptr_add() and byte_add() naming. Signed-off-by: Boqun Feng --- rust/kernel/sync/atomic.rs | 29 + 1 file changed, 29 insertions(+) diff --git a/rust/kerne

[RFC v3 08/12] rust: sync: atomic: Add Atomic<{usize,isize}>

2025-04-21 Thread Boqun Feng
if inline helpers are not available. Signed-off-by: Boqun Feng --- rust/kernel/sync/atomic.rs | 71 ++ 1 file changed, 71 insertions(+) diff --git a/rust/kernel/sync/atomic.rs b/rust/kernel/sync/atomic.rs index d197b476e3bc..6008d65594a2 100644 --- a/rust

[RFC v3 07/12] rust: sync: atomic: Add Atomic

2025-04-21 Thread Boqun Feng
Add generic atomic support for basic unsigned types that have an `AtomicImpl` with the same size and alignment. Signed-off-by: Boqun Feng --- rust/kernel/sync/atomic.rs | 80 ++ 1 file changed, 80 insertions(+) diff --git a/rust/kernel/sync/atomic.rs b/rust

[RFC v3 06/12] rust: sync: atomic: Add the framework of arithmetic operations

2025-04-21 Thread Boqun Feng
Signed-off-by: Boqun Feng --- rust/kernel/sync/atomic/generic.rs | 102 + 1 file changed, 102 insertions(+) diff --git a/rust/kernel/sync/atomic/generic.rs b/rust/kernel/sync/atomic/generic.rs index 73aacfac381b..2de4cdbce58e 100644 --- a/rust/kernel/sync/atomic/generic.

[RFC v3 05/12] rust: sync: atomic: Add atomic {cmp,}xchg operations

2025-04-21 Thread Boqun Feng
ich must be exclusive to the function, therefore it's unsafe to use some shared pointer. But maybe I'm missing something? Signed-off-by: Boqun Feng --- rust/kernel/sync/atomic/generic.rs | 122 + 1 file changed, 122 insertions(+) diff --git a/rust/kernel/syn

[RFC v3 04/12] rust: sync: atomic: Add generic atomics

2025-04-21 Thread Boqun Feng
mature enough (unless the implementer is a `#[repr(transparent)]` new type). `AtomicImpl` types are automatically `AllowAtomic`, and so far only basic operations load() and store() are introduced. Signed-off-by: Boqun Feng --- rust/kernel/sync/atomic.rs | 2 + rust/kernel/sync/atomic

[RFC v3 03/12] rust: sync: atomic: Add ordering annotation types

2025-04-21 Thread Boqun Feng
variants an operation has, and it also make it easier to unify the implementation of all ordering variants in one method via generic. The `IS_RELAXED` and `ORDER` associate consts are for generic function to pick up the particular implementation specified by an ordering annotation. Signed-off-by

[RFC v3 01/12] rust: Introduce atomic API helpers

2025-04-21 Thread Boqun Feng
: Boqun Feng --- rust/helpers/atomic.c | 1038 + rust/helpers/helpers.c|1 + scripts/atomic/gen-atomics.sh |1 + scripts/atomic/gen-rust-atomic-helpers.sh | 65 ++ 4 files changed, 1105 insertions(+) create mode

[RFC v3 02/12] rust: sync: Add basic atomic operation mapping framework

2025-04-21 Thread Boqun Feng
models and data races. Also bump my role to the maintainer of ATOMIC INFRASTRUCTURE to reflect my responsiblity on the Rust atomic mod. Signed-off-by: Boqun Feng --- MAINTAINERS| 4 +- rust/kernel/sync.rs| 1 + rust/kernel/sync/atomic.rs | 19 rust/kernel

[RFC v3 00/12] LKMM generic atomics in Rust

2025-04-21 Thread Boqun Feng
from Alice Ryhl. I'm hoping to at least get the first 8 patches (atomic operations on normal integer) in a good shape so that we can have them in v6.16. Thanks! Regards, Boqun Boqun Feng (12): rust: Introduce atomic API helpers rust: sync: Add basic atomic operation mapping framework rus

Re: [RFC v2 00/13] LKMM *generic* atomics in Rust

2025-04-21 Thread Boqun Feng
On Sat, Nov 02, 2024 at 03:35:36PM +0800, David Gow wrote: > On Fri, 1 Nov 2024 at 14:04, Boqun Feng wrote: > > > > Hi, > > > > This is another RFC version of LKMM atomics in Rust, you can find the > > previous versions: > > > > v1

[RFC PATCH 1/8] Introduce simple hazard pointers

2025-04-14 Thread Boqun Feng
p. 491-504, June 2004 Link: https://lore.kernel.org/lkml/20240917143402.930114-1-boqun.f...@gmail.com/ [2] Signed-off-by: Boqun Feng --- include/linux/shazptr.h | 73 kernel/locking/Makefile | 2 +- kernel/locking/shazptr.c | 29 3

[RFC PATCH 7/8] rcuscale: Add tests for simple hazard pointers

2025-04-13 Thread Boqun Feng
Add two rcu_scale_ops to include tests from simple hazard pointers (shazptr). One is with evenly distributed readers, and the other is with all WILDCARD readers. This could show the best and worst case scenarios for the synchronization time of simple hazard pointers. Signed-off-by: Boqun Feng

[RFC PATCH 8/8] locking/lockdep: Use shazptr to protect the key hashlist

2025-04-13 Thread Boqun Feng
shazptr here can achieve the same/better synchronization time without the need to send IPI. Hence use shazptr here. Reported-by: Erik Lundgren Reported-by: Breno Leitao Link: https://lore.kernel.org/lkml/20250321-lockdep-v1-1-78b732d19...@debian.org/ Signed-off-by: Boqun Feng --- kernel/locking

[RFC PATCH 6/8] rcuscale: Allow rcu_scale_ops::get_gp_seq to be NULL

2025-04-13 Thread Boqun Feng
For synchronization mechanisms similar to RCU, there could be no "grace period" concept (e.g. hazard pointers), therefore allow rcu_scale_ops::get_gp_seq to be a NULL pointer for these cases, and simply treat started and finished grace period as 0. Signed-off-by: Boqun Feng ---

[RFC PATCH 3/8] shazptr: Add refscale test for wildcard

2025-04-13 Thread Boqun Feng
Add the refscale test for shazptr, which starts another shazptr critical section inside an existing one to measure the reader side performance when wildcard logic is triggered. Signed-off-by: Boqun Feng --- kernel/rcu/refscale.c | 40 +++- 1 file changed, 39

[RFC PATCH 5/8] shazptr: Allow skip self scan in synchronize_shaptr()

2025-04-13 Thread Boqun Feng
synchronize_shaptr(). Signed-off-by: Boqun Feng --- kernel/locking/shazptr.c | 28 +--- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/kernel/locking/shazptr.c b/kernel/locking/shazptr.c index a8559cb559f8..b3f7e8390eb2 100644 --- a/kernel/locking/shazptr.c

[RFC PATCH 2/8] shazptr: Add refscale test

2025-04-13 Thread Boqun Feng
Add the refscale test for shazptr to measure the reader side performance. Signed-off-by: Boqun Feng --- kernel/rcu/refscale.c | 39 +++ 1 file changed, 39 insertions(+) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index f11a7c2af778

[RFC PATCH 4/8] shazptr: Avoid synchronize_shaptr() busy waiting

2025-04-13 Thread Boqun Feng
gned-off-by: Boqun Feng --- kernel/locking/shazptr.c | 277 ++- 1 file changed, 276 insertions(+), 1 deletion(-) diff --git a/kernel/locking/shazptr.c b/kernel/locking/shazptr.c index 991fd1a05cfd..a8559cb559f8 100644 --- a/kernel/locking/shazptr.c +++ b/kernel

[RFC PATCH 0/8] Introduce simple hazard pointers for lockdep

2025-04-13 Thread Boqun Feng
faster, so please take a look in case I'm missing something ;-) Thanks! The patchset is based on v6.15-rc1. Boqun Feng (8): Introduce simple hazard pointers shazptr: Add refscale test shazptr: Add refscale test for wildcard shazptr: Avoid synchronize_shaptr() busy waiting shazptr: Allow

[GIT PULL] RCU fixes for v6.15

2025-04-01 Thread Boqun Feng
Hi Linus, Please pull the following RCU fixes: The following changes since commit 467c890f2d1ad6de9fd1dbd196fdc8f3ee63190a: Merge branches 'docs.2025.02.04a', 'lazypreempt.2025.03.04a', 'misc.2025.03.04a', 'srcu.2025.02.05a' and 'torture.2025.02.05a' (2025-03-04 18:47:32 -0800) are availabl

Re: [PATCH v4 08/16] rust: kunit: refactor to use `&raw [const|mut]`

2025-03-26 Thread Boqun Feng
On Fri, Mar 21, 2025 at 10:28:06AM +0800, David Gow wrote: [...] > > Anyway, KUnit `#[test]`s are in -- I was not planning to merge this > > now anyway, it should be reviewed a bit more. > I agree this whole series should wait a bit, but do we want to merge patch #1 as early as possible (maybe ri

[GIT PULL] RCU changes for v6.15

2025-03-22 Thread Boqun Feng
cu: handle unstable rdp in rcu_read_unlock_strict() rcu: handle quiescent states for PREEMPT_RCU=n, PREEMPT_COUNT=y osnoise: provide quiescent states rcu: limit PREEMPT_RCU configurations Boqun Feng (2): rcutorture: Update ->extendables check for lazy preemption

Re: [PATCH v2 -rcu] srcu: Use rcu_seq_done_exact() for polling API

2025-03-05 Thread Boqun Feng
On Wed, Feb 19, 2025 at 07:43:08AM -0500, Joel Fernandes wrote: > poll_state_synchronize_srcu() uses rcu_seq_done() unlike > poll_state_synchronize_rcu() which uses rcu_seq_done_exact(). > > The rcu_seq_done_exact() makes more sense for polling API, as with > this API, there is a higher chance th

Re: [PATCH v3] rcu/cpu_stall_cputime: fix the hardirq count for x86 architecture

2025-03-05 Thread Boqun Feng
On Sun, Feb 16, 2025 at 06:29:54PM -0800, Boqun Feng wrote: > Hi Yongliang, > > On Sun, Feb 16, 2025 at 04:41:09PM +0800, Yongliang Gao wrote: > > From: Yongliang Gao > > > > When counting the number of hardirqs in the x86 architecture, > > it is essential t

[PATCH rcu 10/10] rcu: Use _full() API to debug synchronize_rcu()

2025-03-04 Thread Boqun Feng
ot;) Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Paul E. McKenney Link: https://lore.kernel.org/r/20250227131613.52683-3-ure...@gmail.com Signed-off-by: Boqun Feng --- include/linux/rcupdate_wait.h | 3 +++ kernel/rcu/tree.c | 8 +++- 2 files changed, 6 insertions(+), 5 dele

[PATCH rcu 09/10] rcu: Update TREE05.boot to test normal synchronize_rcu()

2025-03-04 Thread Boqun Feng
y Signed-off-by: Uladzislau Rezki (Sony) Link: https://lore.kernel.org/r/20250227131613.52683-2-ure...@gmail.com Signed-off-by: Boqun Feng --- tools/testing/selftests/rcutorture/configs/rcu/TREE05.boot | 6 ++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/rcutorture/

[PATCH rcu 08/10] rcutorture: Allow a negative value for nfakewriters

2025-03-04 Thread Boqun Feng
egative it will be adjusted to num_online_cpus() during torture initialization. Reviewed-by: Paul E. McKenney Signed-off-by: Uladzislau Rezki (Sony) Link: https://lore.kernel.org/r/20250227131613.52683-1-ure...@gmail.com Signed-off-by: Boqun Feng --- kernel/rcu/rcutorture.c | 22 --

[PATCH rcu 07/10] Flush console log from kernel_power_off()

2025-03-04 Thread Boqun Feng
-4f19-bdda-cf50b9314832@paulmck-laptop Signed-off-by: Boqun Feng --- include/linux/printk.h | 6 ++ kernel/printk/printk.c | 4 +--- kernel/reboot.c| 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index 42

[PATCH rcu 06/10] context_tracking: Make RCU watch ct_kernel_exit_state() warning

2025-03-04 Thread Boqun Feng
nk: https://lore.kernel.org/r/bd911cd9-1fe9-447c-85e0-ea811a1dc896@paulmck-laptop Signed-off-by: Boqun Feng --- kernel/context_tracking.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index 938c48952d26..fb5be6e9b

[PATCH rcu 05/10] rcu/nocb: Print segment lengths in show_rcu_nocb_gp_state()

2025-03-04 Thread Boqun Feng
t for the next grace period to start) both have parenthesized grace-period sequence numbers. Signed-off-by: Paul E. McKenney Signed-off-by: Boqun Feng --- kernel/rcu/tree_nocb.h | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/kernel/rcu/tree_nocb.

[PATCH rcu 03/10] rcu: Fix get_state_synchronize_rcu_full() GP-start detection

2025-03-04 Thread Boqun Feng
b9b-8a69-95336e74e8f4@paulmck-laptop/ [1] Link: https://lore.kernel.org/rcu/20250303001507.GA3994772@joelnvbox/ [2] Link: https://lore.kernel.org/rcu/Z8bcUsZ9IpRi1QoP@pc636/ [3] Reviewed-by: Joel Fernandes Signed-off-by: Boqun Feng --- kernel/rcu/rcu.h | 2 +- kernel/rcu/tree.c | 15 +++-

[PATCH rcu 02/10] rcu: Remove READ_ONCE() for rdp->gpwrap access in __note_gp_changes()

2025-03-04 Thread Boqun Feng
: Zilin Guan Signed-off-by: Paul E. McKenney Signed-off-by: Boqun Feng --- kernel/rcu/tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 475f31deed14..e4c0ce600b2b 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.

[PATCH rcu 00/10] Miscellaneous RCU changes for v6.15

2025-03-04 Thread Boqun Feng
Hi, Please find the upcoming miscellaneous RCU changes. The changes can also be found at: git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git misc.2025.03.04a Regards, Boqun Paul E. McKenney (6): rcu: Split rcu_report_exp_cpu_mult() mask parameter and use for tracing rc

[PATCH rcu 01/10] rcu: Split rcu_report_exp_cpu_mult() mask parameter and use for tracing

2025-03-04 Thread Boqun Feng
From: "Paul E. McKenney" This commit renames the rcu_report_exp_cpu_mult() function from "mask" to "mask_in" and introduced a "mask" local variable to better support upcoming event-tracing additions. Signed-off-by: Paul E. McKenney Cc: Freder

Re: [PATCH v4 3/3] rcu: Use _full() API to debug synchronize_rcu()

2025-03-04 Thread Boqun Feng
On Tue, Mar 04, 2025 at 11:56:18AM +0100, Uladzislau Rezki wrote: > On Tue, Mar 04, 2025 at 11:52:26AM +0100, Uladzislau Rezki wrote: > > > > Did I get that right? > > > > > > > > > > Other than I'm unable to follow what do you mean "WH has not been > > > injected, so nothing to wait on", maybe b

Re: [PATCH v4 3/3] rcu: Use _full() API to debug synchronize_rcu()

2025-03-03 Thread Boqun Feng
On Sun, Mar 02, 2025 at 07:15:07PM -0500, Joel Fernandes wrote: > On Fri, Feb 28, 2025 at 05:08:49PM -0800, Paul E. McKenney wrote: > > On Fri, Feb 28, 2025 at 11:59:55AM -0800, Paul E. McKenney wrote: > > > On Fri, Feb 28, 2025 at 08:12:51PM +0100, Uladzislau Rezki wrote: > > > > Hello, Paul! > >

Re: [PATCH v4 3/3] rcu: Use _full() API to debug synchronize_rcu()

2025-03-03 Thread Boqun Feng
On Mon, Mar 03, 2025 at 12:00:40PM -0500, Joel Fernandes wrote: [...] > > I see the original patch "rcu: Fix get_state_synchronize_rcu_full() GP-start > detection" is not yet on -next. Once we are convinced about the fix, do we > want to squash the fix into this patch and have Boqun take it? > W

Re: [PATCH v4 3/3] rcu: Use _full() API to debug synchronize_rcu()

2025-03-02 Thread Boqun Feng
or kernels built with CONFIG_PROVE_RCU=y, which use the polled grace-period APIs, which can and do complain bitterly when this sequence of events occurs. Not only that, there might be some future RCU grace-period mechanism that pulls this sequence of events from theory into practice. This commit

Re: [PATCH v4 3/3] rcu: Use _full() API to debug synchronize_rcu()

2025-02-27 Thread Boqun Feng
On Thu, Feb 27, 2025 at 09:26:40AM -0800, Paul E. McKenney wrote: > On Thu, Feb 27, 2025 at 09:12:39AM -0800, Boqun Feng wrote: > > Hi Ulad, > > > > I put these three patches into next (and misc.2025.02.27a) for some > > testing, hopefully it all goes well and they ca

Re: [PATCH v4 3/3] rcu: Use _full() API to debug synchronize_rcu()

2025-02-27 Thread Boqun Feng
Hi Ulad, I put these three patches into next (and misc.2025.02.27a) for some testing, hopefully it all goes well and they can make it v6.15. A few tag changed below: On Thu, Feb 27, 2025 at 02:16:13PM +0100, Uladzislau Rezki (Sony) wrote: > Switch for using of get_state_synchronize_rcu_full() an

Re: [PATCH v3 3/3] rcu: Use _full() API to debug synchronize_rcu()

2025-02-26 Thread Boqun Feng
On Wed, Feb 26, 2025 at 09:48:52PM +0100, Uladzislau Rezki wrote: > Hello, Boqun. > > > Hi Ulad, > > > > On Tue, Feb 25, 2025 at 12:00:20PM +0100, Uladzislau Rezki (Sony) wrote: > > > Switch for using of get_state_synchronize_rcu_full() and > > > poll_state_synchronize_rcu_full() pair for debug a

Re: [PATCH v3 3/3] rcu: Use _full() API to debug synchronize_rcu()

2025-02-26 Thread Boqun Feng
Hi Ulad, On Tue, Feb 25, 2025 at 12:00:20PM +0100, Uladzislau Rezki (Sony) wrote: > Switch for using of get_state_synchronize_rcu_full() and > poll_state_synchronize_rcu_full() pair for debug a normal > synchronize_rcu() call. > > Just using "not" full APIs to identify if a grace period > is pass

[PATCH rcu 20/20] srcu: Make SRCU-fast also be NMI-safe

2025-02-23 Thread Boqun Feng
this trick to fold srcu_read_lock_nmisafe() into srcu_read_lock(), but this would need careful thought, review, and performance analysis. Though those smp_mb() calls might well make performance a non-issue. Reported-by: Alexei Starovoitov Signed-off-by: Paul E. McKenney Signed-off-by:

[PATCH rcu 18/20] srcu: Document that srcu_{read_lock,down_read}() can share srcu_struct

2025-02-23 Thread Boqun Feng
tov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/srcu.h b/include/linux/srcu.h index a0df80baaccf..317eab82a5f0 100644 --- a/include/lin

[PATCH rcu 19/20] srcu: Add srcu_down_read_fast() and srcu_up_read_fast()

2025-02-23 Thread Boqun Feng
by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcu.h | 34 ++ 1 file changed, 34 insertions(+) diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 317eab82a5f0..900b0d5c0

[PATCH rcu 12/20] srcu: Move SRCU Tree/Tiny definitions from srcu.h

2025-02-23 Thread Boqun Feng
igned-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcu.h | 10 +- include/linux/srcutiny.h | 3 +++ include/linux/srcutree.h | 1 + 3 files changed, 5 insertions(+),

[PATCH rcu 17/20] srcu: Fix srcu_read_unlock_{lite,nmisafe}() kernel-doc

2025-02-23 Thread Boqun Feng
pdates the srcu_read_unlock_lite() kernel-doc header to say that its idx parameter must be obtained from srcu_read_lock_lite() and the srcu_read_unlock_nmisafe() kernel-doc header to say that its idx parameter must be obtained from srcu_read_lock_nmisafe(). Signed-off-by: Paul E. McKenney Signed-off

[PATCH rcu 13/20] srcu: Add SRCU-fast readers

2025-02-23 Thread Boqun Feng
. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcu.h | 47 ++-- include/linux/srcutiny.h | 22 +++ include/linux/srcut

[PATCH rcu 16/20] rcutorture: Make scenario SRCU-P use srcu_read_lock_fast()

2025-02-23 Thread Boqun Feng
as an RCU acceptance test. Signed-off-by: Paul E. McKenney Signed-off-by: Boqun Feng --- tools/testing/selftests/rcutorture/configs/rcu/SRCU-P.boot | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-P.boot b/tools/testing/selftests/rcutorture/c

[PATCH rcu 15/20] refscale: Add srcu_read_lock_fast() support using "srcu-fast"

2025-02-23 Thread Boqun Feng
Overstreet Cc: Signed-off-by: Boqun Feng --- kernel/rcu/refscale.c | 32 +++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index 1b47376acdc4..f11a7c2af778 100644 --- a/kernel/rcu/refscale.c +++ b/

[PATCH rcu 14/20] rcutorture: Add ability to test srcu_read_{,un}lock_fast()

2025-02-23 Thread Boqun Feng
street Cc: Signed-off-by: Boqun Feng --- kernel/rcu/rcutorture.c | 9 + 1 file changed, 9 insertions(+) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 1d2de50fb5d6..1bd3eaa0b8e7 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -677,6 +677,7 @@ s

[PATCH rcu 10/20] srcu: Pull pointer-to-integer conversion into __srcu_ptr_to_ctr()

2025-02-23 Thread Boqun Feng
Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcutree.h | 9 - kernel/rcu/srcutree.c| 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/linux/srcutree.h b/include/linux/

[PATCH rcu 11/20] srcu: Pull integer-to-pointer conversion into __srcu_ctr_to_ptr()

2025-02-23 Thread Boqun Feng
[ paulmck: Apply kernel test robot feedback. ] Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcutree.h | 9 - kernel/rcu/srcutree.c| 6 ++ 2 files c

[PATCH rcu 07/20] srcu: Force synchronization for srcu_get_delay()

2025-02-23 Thread Boqun Feng
assert_held() to srcu_get_delay() itself. Reported-by: syzbot+16a19b06125a2963e...@syzkaller.appspotmail.com Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- kernel/rcu/srcutree.c | 11 ++- 1

[PATCH rcu 06/20] srcu: Make Tree SRCU updates independent of ->srcu_idx

2025-02-23 Thread Boqun Feng
From: "Paul E. McKenney" This commit makes Tree SRCU updates independent of ->srcu_idx, then drop ->srcu_idx. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux

[PATCH rcu 09/20] srcu: Add SRCU_READ_FLAVOR_SLOWGP to flag need for synchronize_rcu()

2025-02-23 Thread Boqun Feng
e addition of the _fast() flavor of SRCU will change that. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcu.h | 3 +++ kernel/rcu/srcutree.c | 6 +++--- 2 files changed, 6

[PATCH rcu 08/20] srcu: Rename srcu_check_read_flavor_lite() to srcu_check_read_flavor_force()

2025-02-23 Thread Boqun Feng
ned-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcu.h | 2 +- include/linux/srcutiny.h | 2 +- include/linux/srcutree.h | 10 ++ 3 files changed, 8 insertions(+), 6

[PATCH rcu 05/20] srcu: Make SRCU readers use ->srcu_ctrs for counter selection

2025-02-23 Thread Boqun Feng
Z qiang Signed-off-by: Paul E. McKenney Tested-by: kernel test robot Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcutree.h | 9 + kernel/rcu/srcutree.c| 23 +-- 2 f

[PATCH rcu 04/20] srcu: Pull ->srcu_{un,}lock_count into a new srcu_ctr structure

2025-02-23 Thread Boqun Feng
nney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcutree.h | 13 +++-- kernel/rcu/srcutree.c| 115 +++ 2 files changed, 66 insertions(+), 62 deletions(-) diff --git

[PATCH rcu 03/20] srcu: Use ->srcu_gp_seq for rcutorture reader batch

2025-02-23 Thread Boqun Feng
by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- kernel/rcu/rcutorture.c | 2 ++ kernel/rcu/srcutree.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/rcutorture.c b

[PATCH rcu 02/20] srcu: Define SRCU_READ_FLAVOR_ALL in terms of symbols

2025-02-23 Thread Boqun Feng
Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- include/linux/srcu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/srcu.h b/include/linux/srcu.h index d7ba46e74f58..f6f779b9d9ff 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h @@ -47,7 +4

[PATCH rcu 01/20] srcu: Make Tiny SRCU able to operate in preemptible kernels

2025-02-23 Thread Boqun Feng
mptibility, primarily surrounding its interaction with rcutorture and early boot. Signed-off-by: Paul E. McKenney Cc: Ankur Arora Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: Signed-off-by: Boqun Feng --- kernel/rcu/rcu.h | 9 ++--- kernel/rcu/

[PATCH rcu 00/20] SRCU changes for v6.15

2025-02-23 Thread Boqun Feng
Hi, Please find the upcoming changes in SRCU for v6.15. The changes can also be found at: git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git srcu.2025.02.05a Regards, Boqun Paul E. McKenney (20): srcu: Make Tiny SRCU able to operate in preemptible kernels srcu: Define SRCU

Re: [PATCH] MAINTAINERS: Update Joel's email address

2025-02-19 Thread Boqun Feng
> R: Daniel Lustig > > -R: Joel Fernandes > > +R: Joel Fernandes > > L: linux-kernel@vger.kernel.org > > L: linux-a...@vger.kernel.org > > L: l...@lists.linux.dev > > @@ -19671,7 +19671,7 @@ READ-COPY UPDATE (RCU) > > M: "Paul E. McKenney" > > M: Frederic Weisbecker (kernel/rcu/tree_nocb.h) > > M: Neeraj Upadhyay (kernel/rcu/tasks.h) > > -M: Joel Fernandes > > +M: Joel Fernandes > > M: Josh Triplett > > M: Boqun Feng > > M: Uladzislau Rezki > > -- > > 2.34.1 > >

Re: [PATCH v3] rcu/cpu_stall_cputime: fix the hardirq count for x86 architecture

2025-02-16 Thread Boqun Feng
Hi Yongliang, On Sun, Feb 16, 2025 at 04:41:09PM +0800, Yongliang Gao wrote: > From: Yongliang Gao > > When counting the number of hardirqs in the x86 architecture, > it is essential to add arch_irq_stat_cpu to ensure accuracy. > > For example, a CPU loop within the rcu_read_lock function. > >

Re: [PATCH] ww_mutex: convert self-test to KUnit

2025-02-11 Thread Boqun Feng
Hi Tamir, On Mon, Feb 10, 2025 at 10:59:12AM -0500, Tamir Duberstein wrote: > Convert this unit test to a KUnit test. > I would like to know the pros and cons between kunit tests and kselftests, maybe someone Cced can answer that? It'll be good to put these in the commit log as well. Regards, B

  1   2   3   4   5   6   7   8   9   10   >