From nobody Sat Jul 25 16:49:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 638DB23D2A4; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161422; cv=none; b=RQQ6IDUqWSiyWdD1N2CEN2C2wmNE9atMXwWb23/ho9RHyYT9SU1XpaLWZFz21tGezPReFB5BOF+qYqKQf/TtoF02uP7APZ+dlWeGjICErWN+9+4HWVJZ0XDJVMk4zW3Bi0ghCH9t+o+vs3+mvKSMzh0T79rn6Dh1oYioPkXiCXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161422; c=relaxed/simple; bh=YOgIfjZ9Hv3w6fqRg4OHpHpWDtOkOacsGc+bursHpzc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rkz7rN8AyT4RD4XChtEQeYATCndM36oz/ZkJDwhBeIDeeYj3LWAINnEtEavTPaeYlz1RCWCH1RyxSlIfE1ZiSciZqaMfqEfvkGTcCkrbhdepDMSzeodVOTZPiscDh952ZuuOSBJukotEJ9YvGpqV6qclAUizIhlqkw1nJZAbHV4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QQZ6FKeJ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QQZ6FKeJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11F531F000E9; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784161421; bh=D0YSEH/Doqmop/Dz/KZ0B/3nd5tyCJxHYawhjRSN0dM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QQZ6FKeJFmLtnEonruCWuuT4cNO65EWsTDshzBOaTKvjxvu2PXcpjrz7ha8pUUOhE QP24aTOYcbLy0tbMq0bxyc7tt3XHKq4D7yKk03rXngHwkULlkjLkzxv6hVQGCky/HR u/x9GcRRW/H40qxy57MppyaNk1QWOmtm8xKEUSvnfzEzmO6Iu09YGA10kcvTDPw68U S05bITcvoMyvfLqpDhliWTLaqM/X+KbYhq0KosiwbEA10LVTNAsDvnMcVSV3h6M70/ vyWcK3UXDCiCUqdnz5n7qmRXL97dZMO3Y63bHTCr4EiUJ+3KwbjweUdEENnuyK1Guk 7mE1+e2o0U1Cw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E7B69CE0569; Wed, 15 Jul 2026 17:23:40 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 01/10] rcu-tasks: TASKS_TRACE_RCU doesn't need IRQ_WORK Date: Wed, 15 Jul 2026 17:23:30 -0700 Message-Id: <20260716002339.11717-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that Tasks Trace RCU is implemented in terms of SRCU, it no longer has any particular need for the IRQ_WORK Kconfig option. This commit therefore removes the "select IRQ_WORK" from the TASKS_TRACE_RCU Kconfig option. Signed-off-by: Paul E. McKenney --- kernel/rcu/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig index 762299291e09ba..332df7a7a6347c 100644 --- a/kernel/rcu/Kconfig +++ b/kernel/rcu/Kconfig @@ -140,7 +140,6 @@ config FORCE_TASKS_TRACE_RCU config TASKS_TRACE_RCU bool default n - select IRQ_WORK =20 config TASKS_TRACE_RCU_NO_MB bool "Override RCU Tasks Trace inclusion of read-side memory barriers" --=20 2.40.1 From nobody Sat Jul 25 16:49:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6361D1FF7C5; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161422; cv=none; b=EOXCQrMBgxgzuYyn3RLyYN3LxesjaTw1bIJ4U38XAEgs7uWRTe0QtL521RlThLytl21EQqchBfjzLo9Wu4q/ZWr0XCt6BtucTsN7/XkzKeIw2NhR25Fe7cK6yW5+nSNuwt0OCkM14JMXcKq67/fMEC3EaQwk9gVMrdnhwBPvf3k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161422; c=relaxed/simple; bh=TJZl+inXya+bKzsV0ZvGX1qSGLWmt0PKu81BCP+l2Vs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gsKbbefhufktFbqzGWRu8LtBoJwMkv0LUUgNylGHNjyEOjZiGJCHFYw2Swira+Oa63vob4l4nuhMlxgsLQsDw/RRdPcKv+CErki1HeTdLO+5PpepHiVaB5jcca2Q9dVgDrQtAR3DogZAQPx2+YC7zRwcQ8fiM+Jz5z2I9rVHNnk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BdK9b+22; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BdK9b+22" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FB691F00A3A; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784161421; bh=s2pp7xMhQIRb1HuLwmqNhcY2hIgp6WI9Kbpk3dFfE+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BdK9b+228NLxwTucAr+bDewC7s5RGoBfNYkEGRwAXlTXc/JH2qA/lrNDGi4oal+KN i0a5eqXb45L1CvNb3BMZI9MvoqOfUsSQ6eFSq0LP3nI8uTdqMOzA/PglDVrfl8dvO9 D4aqwUs10MXFiggjvoM3reYaLHGFi000P8DNP20nk8R3H5VtaeOyKHcqY1yTDO36KX 0yu05UgyJuBPVCE3B9mni28AGtNxg7M1cKDHjvSfMpFyvFTIviFdw8EYT2csBDyLkk FWixAVD4WpT377Ncu0GrRv3KXkQH8o5Rqew6xNslcTINsFrzHOkfmzRwmvw2D/cq+9 S2ZVrJbCb62Ug== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id EAC2ACE0B87; Wed, 15 Jul 2026 17:23:40 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Kunwu Chan , Zqiang , Wang Lian , "Paul E . McKenney" Subject: [PATCH 02/10] rcu: Use task_state_to_char() in stall-warning prints Date: Wed, 15 Jul 2026 17:23:31 -0700 Message-Id: <20260716002339.11717-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kunwu Chan RCU stall warnings currently print task states as raw hexadecimal values, requiring developers to manually decode them. Use task_state_to_char() so that stall warnings show the same symbolic task-state representation used elsewhere in the kernel. For example: ->state=3D0x402 becomes ->state=3DI ->state=3D0x0 becomes ->state=3DR ->state=3D0x2 becomes ->state=3DD This improves readability while preserving the underlying diagnostic information. Suggested-by: Zqiang Co-developed-by: Wang Lian Signed-off-by: Wang Lian Signed-off-by: Kunwu Chan Signed-off-by: Paul E. McKenney --- kernel/rcu/tree_stall.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h index cf7ae51cba4033..45b9856ccd2b23 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -573,13 +573,13 @@ static void rcu_check_gp_kthread_starvation(void) =20 if (rcu_is_gp_kthread_starving(&j)) { cpu =3D gpk ? task_cpu(gpk) : -1; - pr_err("%s kthread starved for %ld jiffies! g%ld f%#x %s(%d) ->state=3D%= #x ->cpu=3D%d\n", + pr_err("%s kthread starved for %ld jiffies! g%ld f%#x %s(%d) ->state=3D%= c ->cpu=3D%d\n", rcu_state.name, j, (long)rcu_seq_current(&rcu_state.gp_seq), data_race(READ_ONCE(rcu_state.gp_flags)), gp_state_getname(rcu_state.gp_state), data_race(READ_ONCE(rcu_state.gp_state)), - gpk ? data_race(READ_ONCE(gpk->__state)) : ~0, cpu); + gpk ? task_state_to_char(gpk) : '?', cpu); if (gpk) { struct rcu_data *rdp =3D per_cpu_ptr(&rcu_data, cpu); =20 @@ -616,12 +616,12 @@ static void rcu_check_gp_kthread_expired_fqs_timer(vo= id) time_after(jiffies, jiffies_fqs + RCU_STALL_MIGHT_MIN) && gpk && !READ_ONCE(gpk->on_rq)) { cpu =3D task_cpu(gpk); - pr_err("%s kthread timer wakeup didn't happen for %ld jiffies! g%ld f%#x= %s(%d) ->state=3D%#x\n", + pr_err("%s kthread timer wakeup didn't happen for %ld jiffies! g%ld f%#x= %s(%d) ->state=3D%c\n", rcu_state.name, (jiffies - jiffies_fqs), (long)rcu_seq_current(&rcu_state.gp_seq), data_race(READ_ONCE(rcu_state.gp_flags)), // Diagnostic read gp_state_getname(RCU_GP_WAIT_FQS), RCU_GP_WAIT_FQS, - data_race(READ_ONCE(gpk->__state))); + task_state_to_char(gpk)); pr_err("\tPossible timer handling issue on cpu=3D%d timer-softirq=3D%u\n= ", cpu, kstat_softirqs_cpu(TIMER_SOFTIRQ, cpu)); } @@ -948,10 +948,10 @@ void show_rcu_gp_kthreads(void) jr =3D j - data_race(READ_ONCE(rcu_state.gp_req_activity)); js =3D j - data_race(READ_ONCE(rcu_state.gp_start)); jw =3D j - data_race(READ_ONCE(rcu_state.gp_wake_time)); - pr_info("%s: wait state: %s(%d) ->state: %#x ->rt_priority %u delta ->gp_= start %lu ->gp_activity %lu ->gp_req_activity %lu ->gp_wake_time %lu ->gp_w= ake_seq %ld ->gp_seq %ld ->gp_seq_needed %ld ->gp_max %lu ->gp_flags %#x\n", + pr_info("%s: wait state: %s(%d) ->state: %c ->rt_priority %u delta ->gp_s= tart %lu ->gp_activity %lu ->gp_req_activity %lu ->gp_wake_time %lu ->gp_wa= ke_seq %ld ->gp_seq %ld ->gp_seq_needed %ld ->gp_max %lu ->gp_flags %#x\n", rcu_state.name, gp_state_getname(rcu_state.gp_state), data_race(READ_ONCE(rcu_state.gp_state)), - t ? data_race(READ_ONCE(t->__state)) : 0x1ffff, t ? t->rt_priority : 0xf= fU, + t ? task_state_to_char(t) : '?', t ? t->rt_priority : 0xffU, js, ja, jr, jw, (long)data_race(READ_ONCE(rcu_state.gp_wake_seq)), (long)data_race(READ_ONCE(rcu_state.gp_seq)), (long)data_race(READ_ONCE(rcu_get_root()->gp_seq_needed)), --=20 2.40.1 From nobody Sat Jul 25 16:49:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6375723C4F2; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161422; cv=none; b=guityBnMk/KbxcUQyOYbI5oKNkxO/FsAi6cmFy8YyvdAj7trm/Tr5jn/XurE99Wktb81SHaeW0TT2hQnnP6PT/VV5rNkM/S7YhqHZqo4abfDJ+RjlyPG4QrqqeITFY0pP9R8XYsyzvOnry1ATVm80GGAP5YbHaYojxvw7+FF44s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161422; c=relaxed/simple; bh=Yl88lflJiv8h6fgZKJ4Y2kkrLo395TLzV3PY6LBaolk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eg73Sbib3Uj1fVb50IEAJp5tlxDN/Ozj/gSBqUDtTTVfPU+YyMVRYN+qgNCGYXKA+IAjdloiprtOchB+MIBLyBEC91eUQsw/urlKRxnB9e+rJs7FpLZWaTPqFdlLDK1oGpGEEX9W6CIEcdEyLdld7vpPQQ0WlqS2TCSRnagaS+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bozm1C6R; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bozm1C6R" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28EB51F00A3D; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784161421; bh=GwXWaesWDGtEGGBh/9BmcgoD/ocnRp5Yoj+6V8USxfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bozm1C6RZexKjGCQNXxwvyywWXrn2qyUmGY8fsTqNAKXha/bzbfTxR5Dj0exjpt2L uNjIOjIQtVTNoCasT0uTBDjRB6Ux1yhHTInZ7yoVm3rB0nGhnFRZE+f2yBWSNLHiwu f8gEAERTEF/pSqHXYqN4A9SfQG+XAobGrOji/95WKyxpucEoXXzvKKLaczIJ8VTMAR Gy74+xA2IE4nbgXf8L55uzDsWnB97BRw9SuRzIeO68wolwaeP9eVRf2JHkJW6gji5C SLf+zlB+7QPpyzu6Zm0WgzMqoodMRnuC2cq58rhahZT5llcXYj7XYdzj0TltEOLe9E hey5rT8GcJaQw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id ED778CE0B8B; Wed, 15 Jul 2026 17:23:40 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" , Christoph Hellwig , Marco Elver , Nilay Shroff Subject: [PATCH 03/10] rcu: Mark __rcu_access_pointer() as context_unsafe() Date: Wed, 15 Jul 2026 17:23:32 -0700 Message-Id: <20260716002339.11717-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A simple comparison of a pointer returned by rcu_access_pointer() results in a context-analysis warning for lockless inspection of the RCU-protected (also known as __rcu-protected) pointer. This can be suppressed by placing context_unsafe() calls around calls rcu_access_pointer(), but this is messy and distracting. This commit therefore wraps the underlying __rcu_access_pointer() macro with a call to context_unsafe(), thereby informing the context-analysis code that rcu_access_pointer() may safely be invoked outside of an RCU read-side critical section. Reported-by: Christoph Hellwig Suggested-by: Marco Elver Signed-off-by: Paul E. McKenney Tested-by: Nilay Shroff Reviewed-by: Marco Elver --- include/linux/rcupdate.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 5e95acc33989b6..e40dc2e20c5b1f 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -490,12 +490,12 @@ context_unsafe( \ */ #define unrcu_pointer(p) __unrcu_pointer(p, __UNIQUE_ID(rcu)) =20 -#define __rcu_access_pointer(p, local, space) \ +#define __rcu_access_pointer(p, local, space) context_unsafe( \ ({ \ typeof(*p) *local =3D (typeof(*p) *__force)READ_ONCE(p); \ rcu_check_sparse(p, space); \ ((typeof(*p) __force __kernel *)(local)); \ -}) +}) ) #define __rcu_dereference_check(p, local, c, space) \ ({ \ /* Dependency order vs. p above. */ \ --=20 2.40.1 From nobody Sat Jul 25 16:49:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 636BF21767D; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161422; cv=none; b=mweeAwIZ1sJN5tXy6NriOmaP0I6o5bjqXDeeVt7jwnoT0g3Nx9xSxf1Aj7aU4VC8bbSyRqXZw0zeycCvL4GfsrEfrHo9GmZLg7UB70EJn021lyPrXuceT9VUhDOiJCJFQtlERWzTBuc7QROJEjmv3rZAXyfJLdkhfAr4kN55JRM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161422; c=relaxed/simple; bh=EkZRF18fal3/zfiMFfCdfrq65vTfzdrDabPLzL+E9kg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=K3baDU5ojQZkZimP+7/ZlucYBeYIHRPsnJCJodN3r+5gM01TFZJv92RBJ+fiNy/kwCfuPCV+vm4lgUJen8wrdGCQuYVCR0FFd4VLrJmzyI3F5yBeixe+LF7UN86EUy8zT5NjxLkKoytbJjupuitSnJZg7pJL/FmguX2M2XjinlI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O3yphnNP; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O3yphnNP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 332591F00A3F; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784161421; bh=6v74Vr+JDl4aQFyesJLzqi6KC90vCW4EqJ5C7/ir9F0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=O3yphnNPk5vVSejsKG7PnhRH+hm/IEKlZiDuFcYjjUARwXdUjJFjdsPY9Um++vYCA dWMzdGOMTpOHFHotfj6ada33jcsJIBw5ia29TR1qCA18VSjPVqlKI88uhDPOxXBL0P FyfzTm/kayegbognFeC1sSlVEgjyEcZ1I6U61CJ22bPCHJPXvDJgvOqkaORXl9iOfD RZL4upHw92zNJF43LacUc1S9iOqFsi7oGyXT068g6F6saO5DKjJ1dGQLP3n58+ERYg LaT2tRw3NsRRH1Iw8S4ONv6L7RcDcdlLytRkexfxq7j4mtHPnMl6JMElyzevwJXXcH bxPu4TSCM7TcQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id EFDBACE0C44; Wed, 15 Jul 2026 17:23:40 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Manuel Ebner , "Paul E . McKenney" Subject: [PATCH 04/10] doc: RCU: Adopt new coding style of type-aware kmalloc-family - part 2/2 Date: Wed, 15 Jul 2026 17:23:33 -0700 Message-Id: <20260716002339.11717-4-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Manuel Ebner Update Documentation/RCU/* to suggest using the new type-aware kmalloc_obj() per commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj() and family") p =3D kmalloc(...); -> p =3D kmalloc_obj(...); Signed-off-by: Manuel Ebner Signed-off-by: Paul E. McKenney --- Documentation/RCU/rcu_dereference.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/RCU/rcu_dereference.rst b/Documentation/RCU/rcu_= dereference.rst index 2524dcdadde2b8..5bc3785ebfc2ae 100644 --- a/Documentation/RCU/rcu_dereference.rst +++ b/Documentation/RCU/rcu_dereference.rst @@ -236,7 +236,7 @@ precautions. To see this, consider the following code = fragment:: { struct foo *p; =20 - p =3D kmalloc(...); + p =3D kmalloc_obj(*p); if (p =3D=3D NULL) deal_with_it(); p->a =3D 42; /* Each field in its own cache line. */ @@ -293,7 +293,7 @@ Then one approach is to use locking, for example, as fo= llows:: { struct foo *p; =20 - p =3D kmalloc(...); + p =3D kmalloc_obj(*p); if (p =3D=3D NULL) deal_with_it(); spin_lock(&p->lock); --=20 2.40.1 From nobody Sat Jul 25 16:49:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A48BA22576E; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161423; cv=none; b=gbrdCpnEbDjlujIDVuDg77NZAQLnvypaNkxu1BDUeGKduqACXx+Vw+IsGX709YiHLuC0GQuPFhMKGrq4UsUOMphwPNifRJa/6n0M1TODmopLcOmXDr3+uvdDTYZtZVL0WE4tMKUR3nMwIrAhYzLrc2BRh0F+gpT9efsDE+YdCvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161423; c=relaxed/simple; bh=x1v3NISCPTvmugF4LUUhLDczxEsZx2rv5fgRjpex4OE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=raOcTgjXxOfJrdFvUgmqAgDvcaTgmJ9PiF13ADIOljnjF1zrxZV/nbZ/din9ZfMMnezK1xd6wlXUCj1jJLSYKoXr2N4pD02xRis8MglptcrtWgL9D2efWJFlOtNl/p2B4VLot6Lx8zZflCOcuU/7AFAXvGD436q8gPlJz9OqYds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hnsbSawu; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hnsbSawu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D6CD1F00ACA; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784161421; bh=5awFt3rVsUFRv61tL7C01iSjH3iLbouNiQclS/ingoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hnsbSawu9F0heo1ZthYiVUryFLXv/RTBRT1qdz3IzFlMoKs2n7PVEeHFFEMLA96jN orVT+gevjPJGpbyUSPh3l1tB0tT+Jt5TT8mGkgVRMqFs6cQ2sOPXQImFqzEelY29wA i5DBr9alyhEafeE+24z7ed04QYj+BAvq1nS/lWbHeDOPWWxQMgwssKFSEfgJyxbbjf G7eR4DFZX5ys7C0Gzxt6XvEbP6KkWnpLNPJVQ9AY4rT6V69JhLRL498sl17RTr3bjp 822JMjfBQKSpmb+h+criO89l2iKIJIeapzem61J0MXc6soPJTHyVJ8FjEz56Djc8M+ pVDYBXBlGx+Lg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id F22F0CE0C57; Wed, 15 Jul 2026 17:23:40 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Zqiang , "Paul E . McKenney" Subject: [PATCH 05/10] rcu-tasks: Remove unused struct rcu_tasks's->n_ipis_fails variables Date: Wed, 15 Jul 2026 17:23:34 -0700 Message-Id: <20260716002339.11717-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zqiang The RCU tasks trace has been reimplemented by 'commit c27cea4416a3 ("rcu: Re-implement RCU Tasks Trace in terms of SRCU-fast")', the rcu_tasks structure's->n_ipis_fails is no longer used, this commit therefore remove it. Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney --- kernel/rcu/tasks.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index f4da5fad70f516..7f7d1e6362178a 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -67,7 +67,6 @@ struct rcu_tasks_percpu { * @gp_start: Most recent grace-period start in jiffies. * @tasks_gp_seq: Number of grace periods completed since boot in upper bi= ts. * @n_ipis: Number of IPIs sent to encourage grace periods to end. - * @n_ipis_fails: Number of IPI-send failures. * @kthread_ptr: This flavor's grace-period/callback-invocation kthread. * @lazy_jiffies: Number of jiffies to allow callbacks to be lazy. * @pregp_func: This flavor's pre-grace-period function (optional). @@ -102,7 +101,6 @@ struct rcu_tasks { unsigned long gp_start; unsigned long tasks_gp_seq; unsigned long n_ipis; - unsigned long n_ipis_fails; struct task_struct *kthread_ptr; unsigned long lazy_jiffies; rcu_tasks_gp_func_t gp_func; @@ -735,12 +733,12 @@ static void show_rcu_tasks_generic_gp_kthread(struct = rcu_tasks *rtp, char *s) if (havecbs && haveurgent && haveurgentcbs) break; } - pr_info("%s: %s(%d) since %lu g:%lu i:%lu/%lu %c%c%c%c l:%lu %s\n", + pr_info("%s: %s(%d) since %lu g:%lu i:%lu %c%c%c%c l:%lu %s\n", rtp->kname, tasks_gp_state_getname(rtp), data_race(rtp->gp_state), jiffies - data_race(rtp->gp_jiffies), data_race(rcu_seq_current(&rtp->tasks_gp_seq)), - data_race(rtp->n_ipis_fails), data_race(rtp->n_ipis), + data_race(rtp->n_ipis), ".k"[!!data_race(rtp->kthread_ptr)], ".C"[havecbs], ".u"[haveurgent], --=20 2.40.1 From nobody Sat Jul 25 16:49:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B34A526B95B; Thu, 16 Jul 2026 00:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161424; cv=none; b=OdDh6gDBOKhoirgAyhZUArCTjLBQeoixY/ruadgLL+qLESAPBrC+qd9e2jcbAB+d6rCegKvp6P5/G9xQCFrwOba4Q+mqxHVEsI0dSOL9FhWWJqZLBh2MKahaKwK2NItKT4LWHiSzI+OwYIouA4un2ET/xy5+iMC0dOcom5iJCcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161424; c=relaxed/simple; bh=jlKsbYmNXw2mKKfpRSL8s+FINdKeIGc0OWQxAvSpyOo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OTF7hl4us4eJKk/ICKD4X8OjaMtAnzwT/0B2/nnjSl8gsrCT06cfnNXprJ1ltdB3qva+9nQr5TxOcJhuU8CQzXiMHCO+EFgGeeZuDlWYQYYgoghVV0VokNzvpjDz92yi6UziR9AxrdPfRFqYyUS0dMDvG77834gCFY5j1Sv8O7I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S/NS7PEN; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="S/NS7PEN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 531DD1F00ADE; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784161421; bh=j4QeWZr5VIw92nE193Im+u0gBQiE/2LIDQgcCKVG+x0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=S/NS7PENvio8o8EmejgAvS+iPj2Q2POmylwpSETI7xtYx+rZfEyg8XWhN/Ac5LxhW 5rGmQyUYEKYHsWOsn1LfsDaLOj0gtgNGtlMM4ekn/abUUCxLV44+3aZP3mIGDiTcX5 02auIvprNYx+/qi0st0tRrUAQqbcl2adGHyIg0LgdpNJSY281i/EX2RWhk0QGIRgD/ iFk/7D6fuz7kFmhaPkRIPaJeZ7rUc7h/GE0eNUFXxsSKi9mleXjRXl6ikoUw7AkYGH idLasDRCOyxsqa085V5QS5f3rCYygBf5aNuMqGcvGj52dfVy+pvFX+F9YRzNhYn6Ts 7UoUB9rywOTIw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 006BDCE0D3B; Wed, 15 Jul 2026 17:23:40 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Zqiang , "Paul E . McKenney" Subject: [PATCH 06/10] rcu-tasks: Dump rcu tasks status when the boot-test failed Date: Wed, 15 Jul 2026 17:23:35 -0700 Message-Id: <20260716002339.11717-6-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zqiang This commit adds a dump RCU task status function to rcu tasks tests, used to obtain more information to help debug when the RCU tasks boot-time tests failed. Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney --- kernel/rcu/tasks.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 7f7d1e6362178a..d9e1e53f4ccf31 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -1453,6 +1453,7 @@ struct rcu_tasks_test_desc { const char *name; bool notrun; unsigned long runstart; + void (*gp_dbg)(void); }; =20 static struct rcu_tasks_test_desc tests[] =3D { @@ -1460,6 +1461,8 @@ static struct rcu_tasks_test_desc tests[] =3D { .name =3D "call_rcu_tasks()", /* If not defined, the test is skipped. */ .notrun =3D IS_ENABLED(CONFIG_TASKS_RCU), + /* Dump rcu tasks status, if test failed. */ + .gp_dbg =3D show_rcu_tasks_classic_gp_kthread }, { .name =3D "call_rcu_tasks_trace()", @@ -1519,6 +1522,8 @@ static int rcu_tasks_verify_self_tests(void) while (tests[i].notrun) { // still hanging. if (time_after(jiffies, tests[i].runstart + bst)) { pr_err("%s has failed boot-time tests.\n", tests[i].name); + if (tests[i].gp_dbg) + tests[i].gp_dbg(); ret =3D -1; break; } --=20 2.40.1 From nobody Sat Jul 25 16:49:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBFBC27EC7C; Thu, 16 Jul 2026 00:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161424; cv=none; b=IfXEWk51yoEj1JzvpxTc0fEnQ5lhVIvxTOpHynHnokaPmF2+4yN9lqKkTGWUZ134nAGLANMN/6J7ZHKoxKYKFZRPbcaG8oc0KtoReBfANO6RBUYx4SgpEWzKVyOXjGBglSF3dQaEQ9l3F3mv/XY9r2QRkyBwZ7REEr8Oj5pMA0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161424; c=relaxed/simple; bh=mc9NEZIorPJjdaORA+vKGv+Y4mGP0Y2nM4Pw5HrxZAw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cN4OBhYa8QbMxu2M1VjeWtHaKHSs0QSCxfvO3wdjB8futOdW7rXjEijoRQcONowUOwpbYO4g6jioXt5wTMw4bDCNQbMDOIZphUyT0uwsnyIXK6M+dR7gwimZgaGU8Fe391G+PQLj4wP3f04MKLawSjzqTi1B7XxIGcYIrkj2yKI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gMDe9A7j; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gMDe9A7j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63E701F01559; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784161421; bh=eKklVX3VgDMz+JyKSn/kR/vQ4ctDUmrdEUdbFfrwoac=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gMDe9A7junBBekONoYSm4po6AJVmGDAsQorEmMpmRVd3kE3BWRvEMmXiFwUA4WsBS n1qgVCqb4FrE8rnsG+AtA/ktufbZxrhexurEh1rMrUITqRG2WAlZBSfhOZPhUf/TyJ +ecdHvTiQZ30goBlq3z7/X/qINJHNDf50ex6UJm+XfIaoawxm0esTncQ02mVf4IyYR EvZsFXjRnqrVlJG23/4QnoQR41zvUrGX7IoTuS4vUUVsmm5qZ8UqaFoP03+DKwxTOs oRWp5qJlzsGgVOD/0wOBK6yqElsZyghGsYtqSQjNJ4sR75WPquk5b0OyGsOw0ypoi6 so1kTLTlh+7DQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 02E00CE0E0B; Wed, 15 Jul 2026 17:23:41 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Manuel Ebner , "Paul E . McKenney" Subject: [PATCH 07/10] doc: RCU: Fix brackets Date: Wed, 15 Jul 2026 17:23:36 -0700 Message-Id: <20260716002339.11717-7-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Manuel Ebner Remove needless brackets and add missing brackets. Signed-off-by: Manuel Ebner Signed-off-by: Paul E. McKenney --- .../Design/Expedited-Grace-Periods/Expedited-Grace-Periods.rst | 2 +- Documentation/RCU/Design/Memory-Ordering/TreeRCU-gp.svg | 2 +- Documentation/RCU/Design/Memory-Ordering/TreeRCU-qs.svg | 2 +- Documentation/RCU/Design/Requirements/Requirements.rst | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/RCU/Design/Expedited-Grace-Periods/Expedited-Gra= ce-Periods.rst b/Documentation/RCU/Design/Expedited-Grace-Periods/Expedited= -Grace-Periods.rst index 414f8a2012d684..cf0f9cdca7e8cb 100644 --- a/Documentation/RCU/Design/Expedited-Grace-Periods/Expedited-Grace-Peri= ods.rst +++ b/Documentation/RCU/Design/Expedited-Grace-Periods/Expedited-Grace-Peri= ods.rst @@ -410,7 +410,7 @@ workqueues (see Documentation/core-api/workqueue.rst). =20 The requesting task still does counter snapshotting and funnel-lock processing, but the task reaching the top of the funnel lock does a -``schedule_work()`` (from ``_synchronize_rcu_expedited()`` so that a +``schedule_work()`` (from ``_synchronize_rcu_expedited()``) so that a workqueue kthread does the actual grace-period processing. Because workqueue kthreads do not accept POSIX signals, grace-period-wait processing need not allow for POSIX signals. In addition, this approach diff --git a/Documentation/RCU/Design/Memory-Ordering/TreeRCU-gp.svg b/Docu= mentation/RCU/Design/Memory-Ordering/TreeRCU-gp.svg index d05bc7b27edb7a..95a66de40ca5a2 100644 --- a/Documentation/RCU/Design/Memory-Ordering/TreeRCU-gp.svg +++ b/Documentation/RCU/Design/Memory-Ordering/TreeRCU-gp.svg @@ -3933,7 +3933,7 @@ font-style=3D"normal" y=3D"-3914.085" x=3D"3745.7725" - xml:space=3D"preserve">rcu__report_qs_rdp()) + xml:space=3D"preserve">rcu__report_qs_rdp() rcu__report_qs_rdp()) + xml:space=3D"preserve">rcu__report_qs_rdp() To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 08/10] rcu-tasks: Apply READ_ONCE() and WRITE_ONCE() to fix data race Date: Wed, 15 Jul 2026 17:23:37 -0700 Message-Id: <20260716002339.11717-8-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that rcutorture tests readers from interrupt handlers, KCSAN spotted an additional data race. This commit therefore fixes it by applying READ_ONCE() and WRITE_ONCE(). Signed-off-by: Paul E. McKenney --- include/linux/rcupdate_trace.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/linux/rcupdate_trace.h b/include/linux/rcupdate_trace.h index cee89e51e45cbb..fd3ddeb6aa3bd2 100644 --- a/include/linux/rcupdate_trace.h +++ b/include/linux/rcupdate_trace.h @@ -95,10 +95,13 @@ static inline void rcu_read_unlock_tasks_trace(struct s= rcu_ctr __percpu *scp) */ static inline void rcu_read_lock_trace(void) { + int n; struct task_struct *t =3D current; =20 rcu_try_lock_acquire(&rcu_tasks_trace_srcu_struct.dep_map); - if (t->trc_reader_nesting++) { + n =3D READ_ONCE(t->trc_reader_nesting); + WRITE_ONCE(t->trc_reader_nesting, n + 1); + if (n) { // In case we interrupted a Tasks Trace RCU reader. return; } @@ -119,12 +122,15 @@ static inline void rcu_read_lock_trace(void) */ static inline void rcu_read_unlock_trace(void) { + int n; struct srcu_ctr __percpu *scp; struct task_struct *t =3D current; =20 scp =3D t->trc_reader_scp; barrier(); // scp before nesting to protect against interrupt handler. - if (!--t->trc_reader_nesting) { + n =3D READ_ONCE(t->trc_reader_nesting) - 1; + WRITE_ONCE(t->trc_reader_nesting, n); + if (!n) { if (!IS_ENABLED(CONFIG_TASKS_TRACE_RCU_NO_MB)) smp_mb(); // Placeholder for more selective ordering __srcu_read_unlock_fast(&rcu_tasks_trace_srcu_struct, scp); --=20 2.40.1 From nobody Sat Jul 25 16:49:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F38427F728; Thu, 16 Jul 2026 00:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161424; cv=none; b=Vxva6vp/7bFz7ev4OL9a0vghO/jdc3lp0RXvPQy/zt+Rj4ktXwx6rfh/nHkYNa0X5ObDnQMQj8xFxuU7g5BuRvx+K3XNdfggdCkQlpfQKQTrz7kHfSuj130pNedV8Jz3d9buEuxwgkxo1PV/dHF5Tp0QzszrjEJq9oyT3Ju3eAk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161424; c=relaxed/simple; bh=ZdbNuEABPiqhXUjhSEu/l/SloewUpM1gGXhfPQFiQ2w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Zhw7CQ5Ffp3OIIucX11eHrzhMrc8xsC8N6supFkURBLpzPDKR/SWXhuex5F5XXylX7CNf+DdDRZ0Av7UoLb+EFZbhMuk5MZX/tzloDEYROh8DML6DBL09jFZhPXU2JLWVypyHiuXiwGT6R0d7AKdAvlAG+/WyaQx009VpCuibD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L32ER26/; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L32ER26/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74C181F0155B; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784161421; bh=jEzo+0grXdACzkBeM9iuM6LYnhbcPZWJqxHYXca3fo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=L32ER26/nA+0fKc9NJJB/PpqGx4dmzCuHO2HBY57YOcCI+bfZ0iW43P65PcFkKf55 MV+iXgsaHAw3W4Di8ByRjGbxC/EkTTu0/EQL6SITREY/SkJmygx8Dnaoof3tvCINJ/ YfAPvoHVK63zmlrkNNMyLgeb5GHrd1pD+iCTlEI0rDGGnFy07ia4NvnSPHqJvuYhtE RBGYx9cDdEUdYYY7pNEhjPH3VL9v4yrbDR7vYc1vVQupWQJ60JH7qAqVN2VyDU3vFO wQ3VUyEmhIe+TVrMp+WY2aFJBSWAXWMJ8UyjBznPQIWYuUYUxubed7VAbyxXnCEDV/ 9a/gITwsLmhyg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 07D26CE0E5D; Wed, 15 Jul 2026 17:23:41 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Zqiang , "Paul E . McKenney" Subject: [PATCH 09/10] rcu-tasks: Remove smp_mb() in rcu_spawn_tasks_kthread_generic() Date: Wed, 15 Jul 2026 17:23:38 -0700 Message-Id: <20260716002339.11717-9-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zqiang For the smp_mb() after kthread_run() in rcu_spawn_tasks_kthread_generic() from these commits: 'commit eacd6f04a133 ("rcu-tasks: Move Tasks RCU to its own file")' 'commit 84a8f446ffd7 ("rcu: Defer rcu_tasks_kthread() creation till first call_rcu_tasks()")' the memory order pairing as follows: rcu_spawn_tasks_kthread() ->t =3D kthread_run(rcu_tasks_kthread, ...); ->smp_mb(); /* Ensure others see full kthread. */ ->WRITE_ONCE(rcu_tasks_kthread_ptr, t); call_rcu_tasks() ->if (READ_ONCE(rcu_tasks_kthread_ptr)) ->wake_up(&rcu_tasks_cbs_wq) ->try_to_wake_up() lock pi_lock ->smp_mb__after_spinlock() //see full kthread Because the 'commit d119357d0743 ("rcu-tasks: Treat only synchronous grace periods urgently")' moved the kthread_ptr assignment into the rcu_tasks_kthread() function, the following memory order pairings are sufficient: The runq's raw_spinlock/unlock(or smp_mb__after_spinlock()) from wake_up_process() in kthread_run() and __schedule() provides memory order barrier when the kthread is first scheduled, this ensures the kthread's func observes all of the kthread's initialization. The kthread's smp_store_release(&rtp->kthread_ptr, ...) in rcu_tasks_kthread() and smp_load_acquire(&rtp->kthread_ptr) in call_rcu_tasks_generic() compose release/acquire pairing, the cumulativity of smp_store_release() propagates visibility of the kthread's initialization through the scheduler chain. This commit therefore remove smp_mb() in rcu_spawn_tasks_kthread_generic(). Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney --- kernel/rcu/tasks.h | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index d9e1e53f4ccf31..79aa5d51388c45 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -681,7 +681,6 @@ static void __init rcu_spawn_tasks_kthread_generic(stru= ct rcu_tasks *rtp) t =3D kthread_run(rcu_tasks_kthread, rtp, "%s_kthread", rtp->kname); if (WARN_ONCE(IS_ERR(t), "%s: Could not start %s grace-period kthread, OO= M is now expected behavior\n", __func__, rtp->name)) return; - smp_mb(); /* Ensure others see full kthread. */ } =20 #ifndef CONFIG_TINY_RCU --=20 2.40.1 From nobody Sat Jul 25 16:49:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D50BD279907; Thu, 16 Jul 2026 00:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161424; cv=none; b=Xs/xHJdba+uZH+U4Q0UpfIUDJmkKeVQwMJsFs8Jp+3qZgZbyK043Y/qUfcDoIWG33A3vB9s8FMsjvChOQw/flnnIvq+2LHUoSYq7pfU1i4TfdRh/ez2Y/7oBYC8NHYjgQVbNC/M90qQXPXkJvpWlRd2NtxjYtvCpDnvi1N+byiU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784161424; c=relaxed/simple; bh=iqoAIdCEzAX3DUvsRDNwHLgSBngO/mWbr4fCwZWRC5U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mYIWAyKeV2NGM8seG9M0CVGL9UfNUf0fFSs+sTSpLQrMVfqBmIRA7oKD/GryWA/z3cAxEOe6fOcmD0SYPc9Q6TciSIKaDCWuGfZ8H3qD2/jmV7RUWfWk64Ost0pqVXYT5qmUSam9L0CARowaCZGX0M3sovsSI8ednQI9J3zHccE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X48oci3F; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X48oci3F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7207A1F00ADB; Thu, 16 Jul 2026 00:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784161421; bh=KfUyhiM9EnLCPMvsieJRQ8z3kIir57yeVPER9WvBHqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=X48oci3FjFS0kCVxrF/eZrSe3bxN2/q+WqHz219oggBu/R6HZSUgqdiGQ4CxuCtau qzLn1HbB8B/WyF0ZHNSuf+hmJHw37/wQZedn7pOHZIPwdNAwOzSdauJ2FzWf9iH1/x FJMB7qyGFhjDlpsJ6x1XVE/7AZrJm3h0zNg2YTBGfN2IuzPME3e/MZJqmqjWeuZlqH 1AXyN+bHnYp7ChfOpfL4DlzHc/H7ZBt53z4C1lapHymwLAQlRI2k/NLrsE9XidUavx GJNTBOC7AuNqwDFWha2fIab0M7QuVpBFicAzsW5k8OL2Y/aFe9cff46P0++j+Azp4A vJehGwvDMehrg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 0A777CE0E86; Wed, 15 Jul 2026 17:23:41 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Zqiang , "Paul E . McKenney" Subject: [PATCH 10/10] rcu-tasks: Update comments in call_rcu_tasks_generic() Date: Wed, 15 Jul 2026 17:23:39 -0700 Message-Id: <20260716002339.11717-10-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zqiang This commit updates the comment "We can't create the thread unless interrupts are enabled." from 'commit 4929c913bda5 ("rcu: Make call_rcu_tasks() tolerate first call with irqs disabled")' to be more clear and also to cover deferred wakeup and to take into account the fact that kthread creation has been move to core_initcall() time by 'commit c63eb17ff06d ("rcu: Create call_rcu_tasks() kthread at boot time")'. Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney --- kernel/rcu/tasks.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 79aa5d51388c45..8456b132950278 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -395,7 +395,11 @@ static void call_rcu_tasks_generic(struct rcu_head *rh= p, rcu_callback_t func, raw_spin_unlock_irqrestore(&rtp->cbs_gbl_lock, flags); } rcu_read_unlock(); - /* We can't create the thread unless interrupts are enabled. */ + // We can't create the kthread with interrupts disabled because a + // scheduler spinlock might be held, so kthread creation is deferred + // until core_initcall() time. Similarly, wakeups are deferred using + // irq_work in order to to avoid potential scheduler-lock-deadlock + // lockdep splats. if (needwake && READ_ONCE(rtp->kthread_ptr)) irq_work_queue(&rtpcp->rtp_irq_work); } --=20 2.40.1