* [PATCH] s390/smp: Move rcu_cpu_starting() earlier
@ 2020-10-28 18:27 Qian Cai
2020-10-28 21:01 ` Paul E. McKenney
2020-10-31 18:37 ` Heiko Carstens
0 siblings, 2 replies; 5+ messages in thread
From: Qian Cai @ 2020-10-28 18:27 UTC (permalink / raw)
To: Paul E. McKenney
Cc: Peter Zijlstra, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, linux-s390, linux-kernel, Qian Cai
The call to rcu_cpu_starting() in smp_init_secondary() is not early
enough in the CPU-hotplug onlining process, which results in lockdep
splats as follows:
WARNING: suspicious RCU usage
-----------------------------
kernel/locking/lockdep.c:3497 RCU-list traversed in non-reader section!!
other info that might help us debug this:
RCU used illegally from offline CPU!
rcu_scheduler_active = 1, debug_locks = 1
no locks held by swapper/1/0.
Call Trace:
show_stack+0x158/0x1f0
dump_stack+0x1f2/0x238
__lock_acquire+0x2640/0x4dd0
lock_acquire+0x3a8/0xd08
_raw_spin_lock_irqsave+0xc0/0xf0
clockevents_register_device+0xa8/0x528
init_cpu_timer+0x33e/0x468
smp_init_secondary+0x11a/0x328
smp_start_secondary+0x82/0x88
This is avoided by moving the call to rcu_cpu_starting up near the
beginning of the smp_init_secondary() function. Note that the
raw_smp_processor_id() is required in order to avoid calling into
lockdep before RCU has declared the CPU to be watched for readers.
Link: https://lore.kernel.org/lkml/160223032121.7002.1269740091547117869.tip-bot2@tip-bot2/
Signed-off-by: Qian Cai <cai@redhat.com>
---
arch/s390/kernel/smp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index ebfe86d097f0..390d97daa2b3 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -855,13 +855,14 @@ void __init smp_detect_cpus(void)
static void smp_init_secondary(void)
{
- int cpu = smp_processor_id();
+ int cpu = raw_smp_processor_id();
S390_lowcore.last_update_clock = get_tod_clock();
restore_access_regs(S390_lowcore.access_regs_save_area);
set_cpu_flag(CIF_ASCE_PRIMARY);
set_cpu_flag(CIF_ASCE_SECONDARY);
cpu_init();
+ rcu_cpu_starting(cpu);
preempt_disable();
init_cpu_timer();
vtime_init();
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/smp: Move rcu_cpu_starting() earlier
2020-10-28 18:27 [PATCH] s390/smp: Move rcu_cpu_starting() earlier Qian Cai
@ 2020-10-28 21:01 ` Paul E. McKenney
2020-10-31 18:37 ` Heiko Carstens
1 sibling, 0 replies; 5+ messages in thread
From: Paul E. McKenney @ 2020-10-28 21:01 UTC (permalink / raw)
To: Qian Cai
Cc: Peter Zijlstra, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, linux-s390, linux-kernel
On Wed, Oct 28, 2020 at 02:27:42PM -0400, Qian Cai wrote:
> The call to rcu_cpu_starting() in smp_init_secondary() is not early
> enough in the CPU-hotplug onlining process, which results in lockdep
> splats as follows:
>
> WARNING: suspicious RCU usage
> -----------------------------
> kernel/locking/lockdep.c:3497 RCU-list traversed in non-reader section!!
>
> other info that might help us debug this:
>
> RCU used illegally from offline CPU!
> rcu_scheduler_active = 1, debug_locks = 1
> no locks held by swapper/1/0.
>
> Call Trace:
> show_stack+0x158/0x1f0
> dump_stack+0x1f2/0x238
> __lock_acquire+0x2640/0x4dd0
> lock_acquire+0x3a8/0xd08
> _raw_spin_lock_irqsave+0xc0/0xf0
> clockevents_register_device+0xa8/0x528
> init_cpu_timer+0x33e/0x468
> smp_init_secondary+0x11a/0x328
> smp_start_secondary+0x82/0x88
>
> This is avoided by moving the call to rcu_cpu_starting up near the
> beginning of the smp_init_secondary() function. Note that the
> raw_smp_processor_id() is required in order to avoid calling into
> lockdep before RCU has declared the CPU to be watched for readers.
>
> Link: https://lore.kernel.org/lkml/160223032121.7002.1269740091547117869.tip-bot2@tip-bot2/
> Signed-off-by: Qian Cai <cai@redhat.com>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
> ---
> arch/s390/kernel/smp.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index ebfe86d097f0..390d97daa2b3 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -855,13 +855,14 @@ void __init smp_detect_cpus(void)
>
> static void smp_init_secondary(void)
> {
> - int cpu = smp_processor_id();
> + int cpu = raw_smp_processor_id();
>
> S390_lowcore.last_update_clock = get_tod_clock();
> restore_access_regs(S390_lowcore.access_regs_save_area);
> set_cpu_flag(CIF_ASCE_PRIMARY);
> set_cpu_flag(CIF_ASCE_SECONDARY);
> cpu_init();
> + rcu_cpu_starting(cpu);
> preempt_disable();
> init_cpu_timer();
> vtime_init();
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/smp: Move rcu_cpu_starting() earlier
2020-10-28 18:27 [PATCH] s390/smp: Move rcu_cpu_starting() earlier Qian Cai
2020-10-28 21:01 ` Paul E. McKenney
@ 2020-10-31 18:37 ` Heiko Carstens
2020-10-31 23:38 ` Qian Cai
1 sibling, 1 reply; 5+ messages in thread
From: Heiko Carstens @ 2020-10-31 18:37 UTC (permalink / raw)
To: Qian Cai
Cc: Paul E. McKenney, Peter Zijlstra, Vasily Gorbik,
Christian Borntraeger, linux-s390, linux-kernel
On Wed, Oct 28, 2020 at 02:27:42PM -0400, Qian Cai wrote:
> The call to rcu_cpu_starting() in smp_init_secondary() is not early
> enough in the CPU-hotplug onlining process, which results in lockdep
> splats as follows:
>
> WARNING: suspicious RCU usage
> -----------------------------
> kernel/locking/lockdep.c:3497 RCU-list traversed in non-reader section!!
>
> other info that might help us debug this:
>
> RCU used illegally from offline CPU!
> rcu_scheduler_active = 1, debug_locks = 1
> no locks held by swapper/1/0.
>
> Call Trace:
> show_stack+0x158/0x1f0
> dump_stack+0x1f2/0x238
> __lock_acquire+0x2640/0x4dd0
> lock_acquire+0x3a8/0xd08
> _raw_spin_lock_irqsave+0xc0/0xf0
> clockevents_register_device+0xa8/0x528
> init_cpu_timer+0x33e/0x468
> smp_init_secondary+0x11a/0x328
> smp_start_secondary+0x82/0x88
>
> This is avoided by moving the call to rcu_cpu_starting up near the
> beginning of the smp_init_secondary() function. Note that the
> raw_smp_processor_id() is required in order to avoid calling into
> lockdep before RCU has declared the CPU to be watched for readers.
>
> Link: https://lore.kernel.org/lkml/160223032121.7002.1269740091547117869.tip-bot2@tip-bot2/
> Signed-off-by: Qian Cai <cai@redhat.com>
> ---
> arch/s390/kernel/smp.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Could you provide the config you used? I'm wondering why I can't
reproduce this even though I have lot's of debug options enabled.
I will apply it anyway after rc2 has been released, just curious.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/smp: Move rcu_cpu_starting() earlier
2020-10-31 18:37 ` Heiko Carstens
@ 2020-10-31 23:38 ` Qian Cai
2020-11-01 16:05 ` Heiko Carstens
0 siblings, 1 reply; 5+ messages in thread
From: Qian Cai @ 2020-10-31 23:38 UTC (permalink / raw)
To: Heiko Carstens
Cc: Paul E. McKenney, Peter Zijlstra, Vasily Gorbik,
Christian Borntraeger, linux-s390, linux-kernel
On Sat, 2020-10-31 at 19:37 +0100, Heiko Carstens wrote:
> On Wed, Oct 28, 2020 at 02:27:42PM -0400, Qian Cai wrote:
> > The call to rcu_cpu_starting() in smp_init_secondary() is not early
> > enough in the CPU-hotplug onlining process, which results in lockdep
> > splats as follows:
> >
> > WARNING: suspicious RCU usage
> > -----------------------------
> > kernel/locking/lockdep.c:3497 RCU-list traversed in non-reader section!!
> >
> > other info that might help us debug this:
> >
> > RCU used illegally from offline CPU!
> > rcu_scheduler_active = 1, debug_locks = 1
> > no locks held by swapper/1/0.
> >
> > Call Trace:
> > show_stack+0x158/0x1f0
> > dump_stack+0x1f2/0x238
> > __lock_acquire+0x2640/0x4dd0
> > lock_acquire+0x3a8/0xd08
> > _raw_spin_lock_irqsave+0xc0/0xf0
> > clockevents_register_device+0xa8/0x528
> > init_cpu_timer+0x33e/0x468
> > smp_init_secondary+0x11a/0x328
> > smp_start_secondary+0x82/0x88
> >
> > This is avoided by moving the call to rcu_cpu_starting up near the
> > beginning of the smp_init_secondary() function. Note that the
> > raw_smp_processor_id() is required in order to avoid calling into
> > lockdep before RCU has declared the CPU to be watched for readers.
> >
> > Link: https://lore.kernel.org/lkml/160223032121.7002.1269740091547117869.tip-bot2@tip-bot2/
> > Signed-off-by: Qian Cai <cai@redhat.com>
> > ---
> > arch/s390/kernel/smp.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
>
> Could you provide the config you used? I'm wondering why I can't
> reproduce this even though I have lot's of debug options enabled.
https://cailca.coding.net/public/linux/mm/git/files/master/s390.config
Essentially, I believe it requires CONFIG_PROVE_RCU_LIST=y. Also, it occurs to
me that this only starts to happen after the commit mentioned in the above link.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/smp: Move rcu_cpu_starting() earlier
2020-10-31 23:38 ` Qian Cai
@ 2020-11-01 16:05 ` Heiko Carstens
0 siblings, 0 replies; 5+ messages in thread
From: Heiko Carstens @ 2020-11-01 16:05 UTC (permalink / raw)
To: Qian Cai
Cc: Paul E. McKenney, Peter Zijlstra, Vasily Gorbik,
Christian Borntraeger, linux-s390, linux-kernel
On Sat, Oct 31, 2020 at 07:38:52PM -0400, Qian Cai wrote:
> > > This is avoided by moving the call to rcu_cpu_starting up near the
> > > beginning of the smp_init_secondary() function. Note that the
> > > raw_smp_processor_id() is required in order to avoid calling into
> > > lockdep before RCU has declared the CPU to be watched for readers.
> > >
> > > Link: https://lore.kernel.org/lkml/160223032121.7002.1269740091547117869.tip-bot2@tip-bot2/
> > > Signed-off-by: Qian Cai <cai@redhat.com>
> > > ---
> > > arch/s390/kernel/smp.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > Could you provide the config you used? I'm wondering why I can't
> > reproduce this even though I have lot's of debug options enabled.
> https://cailca.coding.net/public/linux/mm/git/files/master/s390.config
>
> Essentially, I believe it requires CONFIG_PROVE_RCU_LIST=y. Also, it occurs to
> me that this only starts to happen after the commit mentioned in the above link.
Yes, with that enabled I can reprocuce it. Thanks! It depends on
CONFIG_RCU_EXPERT. I can't image why I didn't had that enabled.. :)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-01 16:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 18:27 [PATCH] s390/smp: Move rcu_cpu_starting() earlier Qian Cai
2020-10-28 21:01 ` Paul E. McKenney
2020-10-31 18:37 ` Heiko Carstens
2020-10-31 23:38 ` Qian Cai
2020-11-01 16:05 ` Heiko Carstens
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.