From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
To: "Paul E . McKenney" <paulmck@kernel.org>
Cc: RCU <rcu@vger.kernel.org>,
Neeraj upadhyay <Neeraj.Upadhyay@amd.com>,
Boqun Feng <boqun.feng@gmail.com>,
Hillf Danton <hdanton@sina.com>,
Joel Fernandes <joel@joelfernandes.org>,
LKML <linux-kernel@vger.kernel.org>,
Uladzislau Rezki <urezki@gmail.com>,
Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>,
Frederic Weisbecker <frederic@kernel.org>,
Zqiang <qiang.zhang1211@gmail.com>
Subject: [PATCH 46/48] rcutorture: Fix invalid context warning when enable srcu barrier testing
Date: Tue, 7 May 2024 11:35:28 +0200 [thread overview]
Message-ID: <20240507093530.3043-47-urezki@gmail.com> (raw)
In-Reply-To: <20240507093530.3043-1-urezki@gmail.com>
From: Zqiang <qiang.zhang1211@gmail.com>
When the torture_type is set srcu or srcud and cb_barrier is
non-zero, running the rcutorture test will trigger the
following warning:
[ 163.910989][ C1] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
[ 163.910994][ C1] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1
[ 163.910999][ C1] preempt_count: 10001, expected: 0
[ 163.911002][ C1] RCU nest depth: 0, expected: 0
[ 163.911005][ C1] INFO: lockdep is turned off.
[ 163.911007][ C1] irq event stamp: 30964
[ 163.911010][ C1] hardirqs last enabled at (30963): [<ffffffffabc7df52>] do_idle+0x362/0x500
[ 163.911018][ C1] hardirqs last disabled at (30964): [<ffffffffae616eff>] sysvec_call_function_single+0xf/0xd0
[ 163.911025][ C1] softirqs last enabled at (0): [<ffffffffabb6475f>] copy_process+0x16ff/0x6580
[ 163.911033][ C1] softirqs last disabled at (0): [<0000000000000000>] 0x0
[ 163.911038][ C1] Preemption disabled at:
[ 163.911039][ C1] [<ffffffffacf1964b>] stack_depot_save_flags+0x24b/0x6c0
[ 163.911063][ C1] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G W 6.8.0-rc4-rt4-yocto-preempt-rt+ #3 1e39aa9a737dd024a3275c4f835a872f673a7d3a
[ 163.911071][ C1] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014
[ 163.911075][ C1] Call Trace:
[ 163.911078][ C1] <IRQ>
[ 163.911080][ C1] dump_stack_lvl+0x88/0xd0
[ 163.911089][ C1] dump_stack+0x10/0x20
[ 163.911095][ C1] __might_resched+0x36f/0x530
[ 163.911105][ C1] rt_spin_lock+0x82/0x1c0
[ 163.911112][ C1] spin_lock_irqsave_ssp_contention+0xb8/0x100
[ 163.911121][ C1] srcu_gp_start_if_needed+0x782/0xf00
[ 163.911128][ C1] ? _raw_spin_unlock_irqrestore+0x46/0x70
[ 163.911136][ C1] ? debug_object_active_state+0x336/0x470
[ 163.911148][ C1] ? __pfx_srcu_gp_start_if_needed+0x10/0x10
[ 163.911156][ C1] ? __pfx_lock_release+0x10/0x10
[ 163.911165][ C1] ? __pfx_rcu_torture_barrier_cbf+0x10/0x10
[ 163.911188][ C1] __call_srcu+0x9f/0xe0
[ 163.911196][ C1] call_srcu+0x13/0x20
[ 163.911201][ C1] srcu_torture_call+0x1b/0x30
[ 163.911224][ C1] rcu_torture_barrier1cb+0x4a/0x60
[ 163.911247][ C1] __flush_smp_call_function_queue+0x267/0xca0
[ 163.911256][ C1] ? __pfx_rcu_torture_barrier1cb+0x10/0x10
[ 163.911281][ C1] generic_smp_call_function_single_interrupt+0x13/0x20
[ 163.911288][ C1] __sysvec_call_function_single+0x7d/0x280
[ 163.911295][ C1] sysvec_call_function_single+0x93/0xd0
[ 163.911302][ C1] </IRQ>
[ 163.911304][ C1] <TASK>
[ 163.911308][ C1] asm_sysvec_call_function_single+0x1b/0x20
[ 163.911313][ C1] RIP: 0010:default_idle+0x17/0x20
[ 163.911326][ C1] RSP: 0018:ffff888001997dc8 EFLAGS: 00000246
[ 163.911333][ C1] RAX: 0000000000000000 RBX: dffffc0000000000 RCX: ffffffffae618b51
[ 163.911337][ C1] RDX: 0000000000000000 RSI: ffffffffaea80920 RDI: ffffffffaec2de80
[ 163.911342][ C1] RBP: ffff888001997dc8 R08: 0000000000000001 R09: ffffed100d740cad
[ 163.911346][ C1] R10: ffffed100d740cac R11: ffff88806ba06563 R12: 0000000000000001
[ 163.911350][ C1] R13: ffffffffafe460c0 R14: ffffffffafe460c0 R15: 0000000000000000
[ 163.911358][ C1] ? ct_kernel_exit.constprop.3+0x121/0x160
[ 163.911369][ C1] ? lockdep_hardirqs_on+0xc4/0x150
[ 163.911376][ C1] arch_cpu_idle+0x9/0x10
[ 163.911383][ C1] default_idle_call+0x7a/0xb0
[ 163.911390][ C1] do_idle+0x362/0x500
[ 163.911398][ C1] ? __pfx_do_idle+0x10/0x10
[ 163.911404][ C1] ? complete_with_flags+0x8b/0xb0
[ 163.911416][ C1] cpu_startup_entry+0x58/0x70
[ 163.911423][ C1] start_secondary+0x221/0x280
[ 163.911430][ C1] ? __pfx_start_secondary+0x10/0x10
[ 163.911440][ C1] secondary_startup_64_no_verify+0x17f/0x18b
[ 163.911455][ C1] </TASK>
This commit therefore use smp_call_on_cpu() instead of
smp_call_function_single(), make rcu_torture_barrier1cb() invoked
happens on task-context.
Signed-off-by: Zqiang <qiang.zhang1211@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
kernel/rcu/rcutorture.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 456185d9e6c0..8654e99bd4a3 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -3044,11 +3044,12 @@ static void rcu_torture_barrier_cbf(struct rcu_head *rcu)
}
/* IPI handler to get callback posted on desired CPU, if online. */
-static void rcu_torture_barrier1cb(void *rcu_void)
+static int rcu_torture_barrier1cb(void *rcu_void)
{
struct rcu_head *rhp = rcu_void;
cur_ops->call(rhp, rcu_torture_barrier_cbf);
+ return 0;
}
/* kthread function to register callbacks used to test RCU barriers. */
@@ -3074,11 +3075,9 @@ static int rcu_torture_barrier_cbs(void *arg)
* The above smp_load_acquire() ensures barrier_phase load
* is ordered before the following ->call().
*/
- if (smp_call_function_single(myid, rcu_torture_barrier1cb,
- &rcu, 1)) {
- // IPI failed, so use direct call from current CPU.
+ if (smp_call_on_cpu(myid, rcu_torture_barrier1cb, &rcu, 1))
cur_ops->call(&rcu, rcu_torture_barrier_cbf);
- }
+
if (atomic_dec_and_test(&barrier_cbs_count))
wake_up(&barrier_wq);
} while (!torture_must_stop());
--
2.39.2
next prev parent reply other threads:[~2024-05-07 9:36 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 9:34 [PATCH 00/48] RCU changes for v6.10 Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 01/48] scftorture: Increase memory provided to guest OS Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 02/48] rcutorture: Disable tracing to permit Tasks Rude RCU testing Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 03/48] rcu: Add lockdep checks and kernel-doc header to rcu_softirq_qs() Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 04/48] rcutorture: Enable RCU priority boosting for TREE09 Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 05/48] rcutorture: Dump # online CPUs on insufficient cb-flood laundering Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 06/48] rcutorture: Dump GP kthread state " Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 07/48] rcutorture: ASSERT_EXCLUSIVE_WRITER() for ->rtort_pipe_count updates Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 08/48] rcu-tasks: Make Tasks RCU wait idly for grace-period delays Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 09/48] doc: Remove references to arrayRCU.rst Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 10/48] MAINTAINERS: Update Neeraj's email address Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 11/48] bpf: Select new NEED_TASKS_RCU Kconfig option Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 12/48] arch: " Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 13/48] rcu: Add data structures for synchronize_rcu() Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 14/48] tracing: Select new NEED_TASKS_RCU Kconfig option Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 15/48] bpf: Choose RCU Tasks based on TASKS_RCU rather than PREEMPTION Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 16/48] ftrace: " Uladzislau Rezki (Sony)
2024-05-07 9:34 ` [PATCH 17/48] rcu: Update lockdep while in RCU read-side critical section Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 18/48] rcu: Make TINY_RCU depend on !PREEMPT_RCU rather than !PREEMPTION Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 19/48] srcu: Make Tiny SRCU explicitly disable preemption Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 20/48] rcu: Create NEED_TASKS_RCU to factor out enablement logic Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 21/48] rcu: Remove redundant BH disabling in TINY_RCU Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 22/48] rcu: Make Tiny RCU explicitly disable preemption Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 23/48] rcu: Remove redundant READ_ONCE() of rcu_state.gp_flags in tree.c Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 24/48] rcu: Bring diagnostic read of rcu_state.gp_flags into alignment Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 25/48] rcu: Mark writes to rcu_sync ->gp_count field Uladzislau Rezki (Sony)
2024-05-07 14:54 ` Oleg Nesterov
2024-05-07 17:44 ` Paul E. McKenney
2024-05-09 15:13 ` Oleg Nesterov
2024-05-10 3:59 ` Paul E. McKenney
2024-05-10 11:31 ` Oleg Nesterov
2024-05-10 14:00 ` Alan Huang
2024-05-10 14:04 ` Paul E. McKenney
2024-05-12 10:53 ` Oleg Nesterov
2024-05-12 14:57 ` Paul E. McKenney
2024-05-10 13:18 ` Oleg Nesterov
2024-05-10 13:50 ` Oleg Nesterov
2024-05-10 14:11 ` Paul E. McKenney
2024-05-12 10:41 ` Oleg Nesterov
2024-05-13 14:13 ` Marco Elver
2024-05-14 16:54 ` Paul E. McKenney
2024-05-10 13:58 ` Paul E. McKenney
2024-05-12 11:19 ` [PATCH] rcu/sync: don't read rcu_sync->gp_count lockless Oleg Nesterov
2024-05-12 15:10 ` Paul E. McKenney
2024-05-12 16:55 ` Oleg Nesterov
2024-05-12 17:11 ` Paul E. McKenney
2024-05-12 18:06 ` Oleg Nesterov
2024-05-07 9:35 ` [PATCH 26/48] rcu: Mark loads from rcu_state.n_online_cpus Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 27/48] rcu: Make hotplug operations track GP state, not flags Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 28/48] rcu: Inform KCSAN of one-byte cmpxchg() in rcu_trc_cmpxchg_need_qs() Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 29/48] rcu: Remove redundant CONFIG_PROVE_RCU #if condition Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 30/48] rcu-tasks: Replace exit_tasks_rcu_start() initialization with WARN_ON_ONCE() Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 31/48] rcu-tasks: Fix the comments for tasks_rcu_exit_srcu_stall_timer Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 32/48] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 33/48] rcu: Mollify sparse with RCU guard Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 34/48] rcu: Fix buffer overflow in print_cpu_stall_info() Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 35/48] rcu: Reduce synchronize_rcu() latency Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 36/48] rcu: Add a trace event for synchronize_rcu_normal() Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 37/48] rcu: Support direct wake-up of synchronize_rcu() users Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 38/48] rcu: Allocate WQ with WQ_MEM_RECLAIM bit set Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 39/48] rcutorture: Remove extraneous rcu_torture_pipe_update_one() READ_ONCE() Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 40/48] rcutorture: Fix rcu_torture_one_read() pipe_count overflow comment Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 41/48] rcutorture: Re-use value stored to ->rtort_pipe_count instead of re-reading Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 42/48] rcutorture: Use the gp_kthread_dbg operation specified by cur_ops Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 43/48] rcutorture: Make rcutorture support print rcu-tasks gp state Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 44/48] rcutorture: Removing redundant function pointer initialization Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 45/48] rcutorture: Make stall-tasks directly exit when rcutorture tests end Uladzislau Rezki (Sony)
2024-05-07 9:35 ` Uladzislau Rezki (Sony) [this message]
2024-05-07 9:35 ` [PATCH 47/48] torture: Scale --do-kvfree test time Uladzislau Rezki (Sony)
2024-05-07 9:35 ` [PATCH 48/48] rcutorture: Use rcu_gp_slow_register/unregister() only for rcutype test Uladzislau Rezki (Sony)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240507093530.3043-47-urezki@gmail.com \
--to=urezki@gmail.com \
--cc=Neeraj.Upadhyay@amd.com \
--cc=boqun.feng@gmail.com \
--cc=frederic@kernel.org \
--cc=hdanton@sina.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleksiy.avramchenko@sony.com \
--cc=paulmck@kernel.org \
--cc=qiang.zhang1211@gmail.com \
--cc=rcu@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).