* [paulmckrcu:dev] [srcu] 26cb612c43: BUG:using__this_cpu_read()in_preemptible
@ 2024-09-23 4:38 kernel test robot
2024-09-25 8:57 ` Paul E. McKenney
0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2024-09-23 4:38 UTC (permalink / raw)
To: Paul E. McKenney
Cc: oe-lkp, lkp, kernel test robot, Alexei Starovoitov,
Andrii Nakryiko, Peter Zijlstra, Kent Overstreet, rcu
Hello,
kernel test robot noticed "BUG:using__this_cpu_read()in_preemptible" on:
commit: 26cb612c431de5093ae6a3a67ecaa0363f5b8829 ("srcu: Add srcu_read_lock_lite() and srcu_read_unlock_lite()")
https://github.com/paulmckrcu/linux dev
in testcase: rcutorture
version:
with following parameters:
runtime: 300s
test: cpuhotplug
torture_type: srcud
compiler: gcc-12
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
(please refer to attached dmesg/kmsg for entire log/backtrace)
in our tests, this issue doesn't always happen, but with a not small rate.
daf812f27d6bbe4c 26cb612c431de5093ae6a3a67ec
---------------- ---------------------------
fail:runs %reproduction fail:runs
| | |
:50 66% 33:50 dmesg.BUG:using__this_cpu_read()in_preemptible
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202409231124.358fed11-lkp@intel.com
[ 169.560380][ T76] BUG: using __this_cpu_read() in preemptible [00000000] code: kworker/1:2/76
[ 169.561229][ T76] caller is try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
[ 169.561657][ T76] CPU: 0 UID: 0 PID: 76 Comm: kworker/1:2 Not tainted 6.11.0-rc1-00125-g26cb612c431d #1
[ 169.562369][ T76] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 169.563120][ T76] Workqueue: rcu_gp process_srcu
[ 169.563518][ T76] Call Trace:
[ 169.563789][ T76] <TASK>
[ 169.564031][ T76] dump_stack_lvl (lib/dump_stack.c:122)
[ 169.564418][ T76] check_preemption_disabled (lib/smp_processor_id.c:52)
[ 169.564842][ T76] ? try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
[ 169.565219][ T76] ? process_one_work (kernel/workqueue.c:3206)
[ 169.565592][ T76] ? srcu_advance_state (kernel/rcu/srcutree.c:1784)
[ 169.565994][ T76] ? process_srcu (kernel/rcu/srcutree.c:1893)
[ 169.566373][ T76] ? process_one_work (kernel/workqueue.c:3236)
[ 169.566790][ T76] ? __pfx_process_one_work (kernel/workqueue.c:3133)
[ 169.567199][ T76] ? __list_add (include/linux/list.h:83 include/linux/list.h:150)
[ 169.567559][ T76] ? process_scheduled_works (kernel/workqueue.c:3312)
[ 169.567990][ T76] ? worker_thread (include/linux/list.h:373 kernel/workqueue.c:948 kernel/workqueue.c:3391)
[ 169.568361][ T76] ? __kthread_parkme (arch/x86/include/asm/current.h:49 kernel/kthread.c:293)
[ 169.568761][ T76] ? __pfx_worker_thread (kernel/workqueue.c:3339)
[ 169.569156][ T76] ? kthread (kernel/kthread.c:389)
[ 169.569474][ T76] ? __pfx_kthread (kernel/kthread.c:342)
[ 169.569848][ T76] ? ret_from_fork (arch/x86/kernel/process.c:153)
[ 169.570212][ T76] ? __pfx_kthread (kernel/kthread.c:342)
[ 169.570563][ T76] ? ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
[ 169.570954][ T76] </TASK>
[ 169.652036][ T76] BUG: using __this_cpu_read() in preemptible [00000000] code: kworker/1:2/76
[ 169.652785][ T76] caller is try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
[ 169.653204][ T76] CPU: 0 UID: 0 PID: 76 Comm: kworker/1:2 Not tainted 6.11.0-rc1-00125-g26cb612c431d #1
[ 169.653945][ T76] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 169.654710][ T76] Workqueue: rcu_gp process_srcu
[ 169.655095][ T76] Call Trace:
[ 169.655357][ T76] <TASK>
[ 169.655591][ T76] dump_stack_lvl (lib/dump_stack.c:122)
[ 169.655958][ T76] check_preemption_disabled (lib/smp_processor_id.c:52)
[ 169.656392][ T76] ? try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
[ 169.656771][ T76] ? process_one_work (kernel/workqueue.c:3206)
[ 169.657162][ T76] ? srcu_advance_state (kernel/rcu/srcutree.c:1765)
[ 169.657559][ T76] ? process_srcu (kernel/rcu/srcutree.c:1893)
[ 169.657909][ T76] ? process_one_work (kernel/workqueue.c:3236)
[ 169.658263][ T76] ? __pfx_process_one_work (kernel/workqueue.c:3133)
[ 169.658623][ T76] ? __list_add (include/linux/list.h:83 include/linux/list.h:150)
[ 169.658911][ T76] ? process_scheduled_works (kernel/workqueue.c:3312)
[ 169.659254][ T76] ? worker_thread (include/linux/list.h:373 kernel/workqueue.c:948 kernel/workqueue.c:3391)
[ 169.659554][ T76] ? __kthread_parkme (arch/x86/include/asm/current.h:49 kernel/kthread.c:293)
[ 169.659885][ T76] ? __pfx_worker_thread (kernel/workqueue.c:3339)
[ 169.660211][ T76] ? kthread (kernel/kthread.c:389)
[ 169.660480][ T76] ? __pfx_kthread (kernel/kthread.c:342)
[ 169.660773][ T76] ? ret_from_fork (arch/x86/kernel/process.c:153)
[ 169.661069][ T76] ? __pfx_kthread (kernel/kthread.c:342)
[ 169.661363][ T76] ? ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
[ 169.661693][ T76] </TASK>
[ 169.662140][ T76] BUG: using __this_cpu_read() in preemptible [00000000] code: kworker/1:2/76
[ 169.662810][ T76] caller is try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
[ 169.663222][ T76] CPU: 0 UID: 0 PID: 76 Comm: kworker/1:2 Not tainted 6.11.0-rc1-00125-g26cb612c431d #1
[ 169.663934][ T76] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 169.664696][ T76] Workqueue: rcu_gp process_srcu
[ 169.665091][ T76] Call Trace:
[ 169.665353][ T76] <TASK>
[ 169.665586][ T76] dump_stack_lvl (lib/dump_stack.c:122)
[ 169.665959][ T76] check_preemption_disabled (lib/smp_processor_id.c:52)
[ 169.666369][ T76] ? try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
[ 169.666727][ T76] ? preempt_count_sub (kernel/sched/core.c:5685)
[ 169.667127][ T76] ? process_one_work (kernel/workqueue.c:3206)
[ 169.667519][ T76] ? srcu_advance_state (kernel/rcu/srcutree.c:1784)
[ 169.667938][ T76] ? process_srcu (kernel/rcu/srcutree.c:1893)
[ 169.668310][ T76] ? process_one_work (kernel/workqueue.c:3236)
[ 169.668719][ T76] ? __pfx_process_one_work (kernel/workqueue.c:3133)
[ 169.669150][ T76] ? __list_add (include/linux/list.h:83 include/linux/list.h:150)
[ 169.669517][ T76] ? process_scheduled_works (kernel/workqueue.c:3312)
[ 169.669954][ T76] ? worker_thread (include/linux/list.h:373 kernel/workqueue.c:948 kernel/workqueue.c:3391)
[ 169.670303][ T76] ? __kthread_parkme (arch/x86/include/asm/current.h:49 kernel/kthread.c:293)
[ 169.670692][ T76] ? __pfx_worker_thread (kernel/workqueue.c:3339)
[ 169.671077][ T76] ? kthread (kernel/kthread.c:389)
[ 169.671412][ T76] ? __pfx_kthread (kernel/kthread.c:342)
[ 169.671761][ T76] ? ret_from_fork (arch/x86/kernel/process.c:153)
[ 169.672114][ T76] ? __pfx_kthread (kernel/kthread.c:342)
[ 169.672463][ T76] ? ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
[ 169.672861][ T76] </TASK>
[ 169.690595][ T75] smpboot: CPU 1 is now offline
The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240923/202409231124.358fed11-lkp@intel.com
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [paulmckrcu:dev] [srcu] 26cb612c43: BUG:using__this_cpu_read()in_preemptible
2024-09-23 4:38 [paulmckrcu:dev] [srcu] 26cb612c43: BUG:using__this_cpu_read()in_preemptible kernel test robot
@ 2024-09-25 8:57 ` Paul E. McKenney
2024-09-26 2:31 ` Oliver Sang
0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2024-09-25 8:57 UTC (permalink / raw)
To: kernel test robot
Cc: oe-lkp, lkp, Alexei Starovoitov, Andrii Nakryiko, Peter Zijlstra,
Kent Overstreet, rcu
On Mon, Sep 23, 2024 at 12:38:31PM +0800, kernel test robot wrote:
>
>
> Hello,
>
> kernel test robot noticed "BUG:using__this_cpu_read()in_preemptible" on:
>
> commit: 26cb612c431de5093ae6a3a67ecaa0363f5b8829 ("srcu: Add srcu_read_lock_lite() and srcu_read_unlock_lite()")
> https://github.com/paulmckrcu/linux dev
>
> in testcase: rcutorture
> version:
> with following parameters:
>
> runtime: 300s
> test: cpuhotplug
> torture_type: srcud
>
>
>
> compiler: gcc-12
> test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
>
> (please refer to attached dmesg/kmsg for entire log/backtrace)
>
>
> in our tests, this issue doesn't always happen, but with a not small rate.
>
> daf812f27d6bbe4c 26cb612c431de5093ae6a3a67ec
> ---------------- ---------------------------
> fail:runs %reproduction fail:runs
> | | |
> :50 66% 33:50 dmesg.BUG:using__this_cpu_read()in_preemptible
>
>
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <oliver.sang@intel.com>
> | Closes: https://lore.kernel.org/oe-lkp/202409231124.358fed11-lkp@intel.com
>
>
> [ 169.560380][ T76] BUG: using __this_cpu_read() in preemptible [00000000] code: kworker/1:2/76
> [ 169.561229][ T76] caller is try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
Does this diff fix things for you? Here the per-CPU access is a
heuristic that reduces overhead once the bulk of the CPUs have done
srcu_read_lock_lite(). So it is OK to get migrated just after the check.
Thanx, Paul
------------------------------------------------------------------------
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index f3db4d42e70ab..07147efcb64d3 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -482,7 +482,7 @@ static unsigned long srcu_readers_unlock_idx(struct srcu_struct *ssp, int idx)
*/
static bool srcu_readers_active_idx_check(struct srcu_struct *ssp, int idx)
{
- bool did_gp = !!(__this_cpu_read(ssp->sda->srcu_reader_flavor) & SRCU_READ_FLAVOR_LITE);
+ bool did_gp = !!(raw_cpu_read(ssp->sda->srcu_reader_flavor) & SRCU_READ_FLAVOR_LITE);
unsigned long unlocks;
unlocks = srcu_readers_unlock_idx(ssp, idx);
------------------------------------------------------------------------
> [ 169.561657][ T76] CPU: 0 UID: 0 PID: 76 Comm: kworker/1:2 Not tainted 6.11.0-rc1-00125-g26cb612c431d #1
> [ 169.562369][ T76] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
> [ 169.563120][ T76] Workqueue: rcu_gp process_srcu
> [ 169.563518][ T76] Call Trace:
> [ 169.563789][ T76] <TASK>
> [ 169.564031][ T76] dump_stack_lvl (lib/dump_stack.c:122)
> [ 169.564418][ T76] check_preemption_disabled (lib/smp_processor_id.c:52)
> [ 169.564842][ T76] ? try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
> [ 169.565219][ T76] ? process_one_work (kernel/workqueue.c:3206)
> [ 169.565592][ T76] ? srcu_advance_state (kernel/rcu/srcutree.c:1784)
> [ 169.565994][ T76] ? process_srcu (kernel/rcu/srcutree.c:1893)
> [ 169.566373][ T76] ? process_one_work (kernel/workqueue.c:3236)
> [ 169.566790][ T76] ? __pfx_process_one_work (kernel/workqueue.c:3133)
> [ 169.567199][ T76] ? __list_add (include/linux/list.h:83 include/linux/list.h:150)
> [ 169.567559][ T76] ? process_scheduled_works (kernel/workqueue.c:3312)
> [ 169.567990][ T76] ? worker_thread (include/linux/list.h:373 kernel/workqueue.c:948 kernel/workqueue.c:3391)
> [ 169.568361][ T76] ? __kthread_parkme (arch/x86/include/asm/current.h:49 kernel/kthread.c:293)
> [ 169.568761][ T76] ? __pfx_worker_thread (kernel/workqueue.c:3339)
> [ 169.569156][ T76] ? kthread (kernel/kthread.c:389)
> [ 169.569474][ T76] ? __pfx_kthread (kernel/kthread.c:342)
> [ 169.569848][ T76] ? ret_from_fork (arch/x86/kernel/process.c:153)
> [ 169.570212][ T76] ? __pfx_kthread (kernel/kthread.c:342)
> [ 169.570563][ T76] ? ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
> [ 169.570954][ T76] </TASK>
> [ 169.652036][ T76] BUG: using __this_cpu_read() in preemptible [00000000] code: kworker/1:2/76
> [ 169.652785][ T76] caller is try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
> [ 169.653204][ T76] CPU: 0 UID: 0 PID: 76 Comm: kworker/1:2 Not tainted 6.11.0-rc1-00125-g26cb612c431d #1
> [ 169.653945][ T76] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
> [ 169.654710][ T76] Workqueue: rcu_gp process_srcu
> [ 169.655095][ T76] Call Trace:
> [ 169.655357][ T76] <TASK>
> [ 169.655591][ T76] dump_stack_lvl (lib/dump_stack.c:122)
> [ 169.655958][ T76] check_preemption_disabled (lib/smp_processor_id.c:52)
> [ 169.656392][ T76] ? try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
> [ 169.656771][ T76] ? process_one_work (kernel/workqueue.c:3206)
> [ 169.657162][ T76] ? srcu_advance_state (kernel/rcu/srcutree.c:1765)
> [ 169.657559][ T76] ? process_srcu (kernel/rcu/srcutree.c:1893)
> [ 169.657909][ T76] ? process_one_work (kernel/workqueue.c:3236)
> [ 169.658263][ T76] ? __pfx_process_one_work (kernel/workqueue.c:3133)
> [ 169.658623][ T76] ? __list_add (include/linux/list.h:83 include/linux/list.h:150)
> [ 169.658911][ T76] ? process_scheduled_works (kernel/workqueue.c:3312)
> [ 169.659254][ T76] ? worker_thread (include/linux/list.h:373 kernel/workqueue.c:948 kernel/workqueue.c:3391)
> [ 169.659554][ T76] ? __kthread_parkme (arch/x86/include/asm/current.h:49 kernel/kthread.c:293)
> [ 169.659885][ T76] ? __pfx_worker_thread (kernel/workqueue.c:3339)
> [ 169.660211][ T76] ? kthread (kernel/kthread.c:389)
> [ 169.660480][ T76] ? __pfx_kthread (kernel/kthread.c:342)
> [ 169.660773][ T76] ? ret_from_fork (arch/x86/kernel/process.c:153)
> [ 169.661069][ T76] ? __pfx_kthread (kernel/kthread.c:342)
> [ 169.661363][ T76] ? ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
> [ 169.661693][ T76] </TASK>
> [ 169.662140][ T76] BUG: using __this_cpu_read() in preemptible [00000000] code: kworker/1:2/76
> [ 169.662810][ T76] caller is try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
> [ 169.663222][ T76] CPU: 0 UID: 0 PID: 76 Comm: kworker/1:2 Not tainted 6.11.0-rc1-00125-g26cb612c431d #1
> [ 169.663934][ T76] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
> [ 169.664696][ T76] Workqueue: rcu_gp process_srcu
> [ 169.665091][ T76] Call Trace:
> [ 169.665353][ T76] <TASK>
> [ 169.665586][ T76] dump_stack_lvl (lib/dump_stack.c:122)
> [ 169.665959][ T76] check_preemption_disabled (lib/smp_processor_id.c:52)
> [ 169.666369][ T76] ? try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
> [ 169.666727][ T76] ? preempt_count_sub (kernel/sched/core.c:5685)
> [ 169.667127][ T76] ? process_one_work (kernel/workqueue.c:3206)
> [ 169.667519][ T76] ? srcu_advance_state (kernel/rcu/srcutree.c:1784)
> [ 169.667938][ T76] ? process_srcu (kernel/rcu/srcutree.c:1893)
> [ 169.668310][ T76] ? process_one_work (kernel/workqueue.c:3236)
> [ 169.668719][ T76] ? __pfx_process_one_work (kernel/workqueue.c:3133)
> [ 169.669150][ T76] ? __list_add (include/linux/list.h:83 include/linux/list.h:150)
> [ 169.669517][ T76] ? process_scheduled_works (kernel/workqueue.c:3312)
> [ 169.669954][ T76] ? worker_thread (include/linux/list.h:373 kernel/workqueue.c:948 kernel/workqueue.c:3391)
> [ 169.670303][ T76] ? __kthread_parkme (arch/x86/include/asm/current.h:49 kernel/kthread.c:293)
> [ 169.670692][ T76] ? __pfx_worker_thread (kernel/workqueue.c:3339)
> [ 169.671077][ T76] ? kthread (kernel/kthread.c:389)
> [ 169.671412][ T76] ? __pfx_kthread (kernel/kthread.c:342)
> [ 169.671761][ T76] ? ret_from_fork (arch/x86/kernel/process.c:153)
> [ 169.672114][ T76] ? __pfx_kthread (kernel/kthread.c:342)
> [ 169.672463][ T76] ? ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
> [ 169.672861][ T76] </TASK>
> [ 169.690595][ T75] smpboot: CPU 1 is now offline
>
>
>
> The kernel config and materials to reproduce are available at:
> https://download.01.org/0day-ci/archive/20240923/202409231124.358fed11-lkp@intel.com
>
>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [paulmckrcu:dev] [srcu] 26cb612c43: BUG:using__this_cpu_read()in_preemptible
2024-09-25 8:57 ` Paul E. McKenney
@ 2024-09-26 2:31 ` Oliver Sang
2024-09-26 11:19 ` Paul E. McKenney
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Sang @ 2024-09-26 2:31 UTC (permalink / raw)
To: Paul E. McKenney
Cc: oe-lkp, lkp, Alexei Starovoitov, Andrii Nakryiko, Peter Zijlstra,
Kent Overstreet, rcu, oliver.sang
hi, Paul,
On Wed, Sep 25, 2024 at 01:57:45AM -0700, Paul E. McKenney wrote:
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <oliver.sang@intel.com>
> > | Closes: https://lore.kernel.org/oe-lkp/202409231124.358fed11-lkp@intel.com
> >
> >
> > [ 169.560380][ T76] BUG: using __this_cpu_read() in preemptible [00000000] code: kworker/1:2/76
> > [ 169.561229][ T76] caller is try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
>
> Does this diff fix things for you? Here the per-CPU access is a
> heuristic that reduces overhead once the bulk of the CPUs have done
> srcu_read_lock_lite(). So it is OK to get migrated just after the check.
yes, this patch fixed the random failures in our tests.
Tested-by: kernel test robot <oliver.sang@intel.com>
we applied patch upon 26cb612c43 and run the same tests up to 200 times,
didn't observe the issue. thanks!
=========================================================================================
compiler/kconfig/rootfs/runtime/tbox_group/test/testcase/torture_type:
gcc-12/x86_64-randconfig-006-20240921/debian-12-x86_64-20240206.cgz/300s/vm-snb/cpuhotplug/rcutorture/srcud
commit:
daf812f27d6bb ("srcu: Standardize srcu_data pointers to "sdp" and similar")
26cb612c431de ("srcu: Add srcu_read_lock_lite() and srcu_read_unlock_lite()")
f2f1565029268 <--- your patch
daf812f27d6bbe4c 26cb612c431de5093ae6a3a67ec f2f1565029268e27760307bc82b
---------------- --------------------------- ---------------------------
fail:runs %reproduction fail:runs %reproduction fail:runs
| | | | |
:50 66% 33:50 0% :200 dmesg.BUG:using__this_cpu_read()in_preemptible
>
> Thanx, Paul
>
> ------------------------------------------------------------------------
>
> diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> index f3db4d42e70ab..07147efcb64d3 100644
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -482,7 +482,7 @@ static unsigned long srcu_readers_unlock_idx(struct srcu_struct *ssp, int idx)
> */
> static bool srcu_readers_active_idx_check(struct srcu_struct *ssp, int idx)
> {
> - bool did_gp = !!(__this_cpu_read(ssp->sda->srcu_reader_flavor) & SRCU_READ_FLAVOR_LITE);
> + bool did_gp = !!(raw_cpu_read(ssp->sda->srcu_reader_flavor) & SRCU_READ_FLAVOR_LITE);
> unsigned long unlocks;
>
> unlocks = srcu_readers_unlock_idx(ssp, idx);
>
> ------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [paulmckrcu:dev] [srcu] 26cb612c43: BUG:using__this_cpu_read()in_preemptible
2024-09-26 2:31 ` Oliver Sang
@ 2024-09-26 11:19 ` Paul E. McKenney
0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2024-09-26 11:19 UTC (permalink / raw)
To: Oliver Sang
Cc: oe-lkp, lkp, Alexei Starovoitov, Andrii Nakryiko, Peter Zijlstra,
Kent Overstreet, rcu
On Thu, Sep 26, 2024 at 10:31:50AM +0800, Oliver Sang wrote:
> hi, Paul,
>
> On Wed, Sep 25, 2024 at 01:57:45AM -0700, Paul E. McKenney wrote:
> > >
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <oliver.sang@intel.com>
> > > | Closes: https://lore.kernel.org/oe-lkp/202409231124.358fed11-lkp@intel.com
> > >
> > >
> > > [ 169.560380][ T76] BUG: using __this_cpu_read() in preemptible [00000000] code: kworker/1:2/76
> > > [ 169.561229][ T76] caller is try_check_zero (kernel/rcu/srcutree.c:485 kernel/rcu/srcutree.c:1149)
> >
> > Does this diff fix things for you? Here the per-CPU access is a
> > heuristic that reduces overhead once the bulk of the CPUs have done
> > srcu_read_lock_lite(). So it is OK to get migrated just after the check.
>
> yes, this patch fixed the random failures in our tests.
> Tested-by: kernel test robot <oliver.sang@intel.com>
>
> we applied patch upon 26cb612c43 and run the same tests up to 200 times,
> didn't observe the issue. thanks!
Very good, and I will add your Tested-by on my next rebase. Thank you
for all your testing efforts!
Thanx, Paul
> =========================================================================================
> compiler/kconfig/rootfs/runtime/tbox_group/test/testcase/torture_type:
> gcc-12/x86_64-randconfig-006-20240921/debian-12-x86_64-20240206.cgz/300s/vm-snb/cpuhotplug/rcutorture/srcud
>
> commit:
> daf812f27d6bb ("srcu: Standardize srcu_data pointers to "sdp" and similar")
> 26cb612c431de ("srcu: Add srcu_read_lock_lite() and srcu_read_unlock_lite()")
> f2f1565029268 <--- your patch
>
> daf812f27d6bbe4c 26cb612c431de5093ae6a3a67ec f2f1565029268e27760307bc82b
> ---------------- --------------------------- ---------------------------
> fail:runs %reproduction fail:runs %reproduction fail:runs
> | | | | |
> :50 66% 33:50 0% :200 dmesg.BUG:using__this_cpu_read()in_preemptible
>
>
> >
> > Thanx, Paul
> >
> > ------------------------------------------------------------------------
> >
> > diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> > index f3db4d42e70ab..07147efcb64d3 100644
> > --- a/kernel/rcu/srcutree.c
> > +++ b/kernel/rcu/srcutree.c
> > @@ -482,7 +482,7 @@ static unsigned long srcu_readers_unlock_idx(struct srcu_struct *ssp, int idx)
> > */
> > static bool srcu_readers_active_idx_check(struct srcu_struct *ssp, int idx)
> > {
> > - bool did_gp = !!(__this_cpu_read(ssp->sda->srcu_reader_flavor) & SRCU_READ_FLAVOR_LITE);
> > + bool did_gp = !!(raw_cpu_read(ssp->sda->srcu_reader_flavor) & SRCU_READ_FLAVOR_LITE);
> > unsigned long unlocks;
> >
> > unlocks = srcu_readers_unlock_idx(ssp, idx);
> >
> > ------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-26 11:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 4:38 [paulmckrcu:dev] [srcu] 26cb612c43: BUG:using__this_cpu_read()in_preemptible kernel test robot
2024-09-25 8:57 ` Paul E. McKenney
2024-09-26 2:31 ` Oliver Sang
2024-09-26 11:19 ` Paul E. McKenney
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.