* [v2 PATCH] rcutree/rcu_bh_qs: disable irq while calling rcu_preempt_qs()
@ 2013-12-18 9:51 Tiejun Chen
2013-12-20 13:30 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 2+ messages in thread
From: Tiejun Chen @ 2013-12-18 9:51 UTC (permalink / raw)
To: bigeasy, tglx; +Cc: linux-rt-users
Any callers to the function rcu_preempt_qs() must disable irqs in
order to protect the assignment to ->rcu_read_unlock_special. In
RT case, rcu_bh_qs() as the wrapper of rcu_preempt_qs() is called
in some scenarios where irq is enabled, like this path,
do_single_softirq()
|
+ local_irq_enable();
+ handle_softirq()
| |
| + rcu_bh_qs()
| |
| + rcu_preempt_qs()
|
+ local_irq_disable()
So here we'd better disable irq directly inside of rcu_bh_qs() to
fix this, otherwise the kernel may be freezable sometimes as
observed. And especially this way is also kind and safe for the
potential rcu_bh_qs() usage elsewhere in the future.
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Signed-off-by: Bin Jiang <bin.jiang@windriver.com>
---
kernel/rcutree.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 7ec834d..6f6d133 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -186,7 +186,12 @@ static void rcu_preempt_qs(int cpu);
void rcu_bh_qs(int cpu)
{
+ unsigned long flags;
+
+ /* Callers to this function, rcu_preempt_qs(), must disable irqs. */
+ local_irq_save(flags);
rcu_preempt_qs(cpu);
+ local_irq_restore(flags);
}
#else
void rcu_bh_qs(int cpu)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [v2 PATCH] rcutree/rcu_bh_qs: disable irq while calling rcu_preempt_qs()
2013-12-18 9:51 [v2 PATCH] rcutree/rcu_bh_qs: disable irq while calling rcu_preempt_qs() Tiejun Chen
@ 2013-12-20 13:30 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-12-20 13:30 UTC (permalink / raw)
To: Tiejun Chen; +Cc: tglx, linux-rt-users
* Tiejun Chen | 2013-12-18 17:51:49 [+0800]:
>Any callers to the function rcu_preempt_qs() must disable irqs in
>order to protect the assignment to ->rcu_read_unlock_special. In
>RT case, rcu_bh_qs() as the wrapper of rcu_preempt_qs() is called
>in some scenarios where irq is enabled, like this path,
>
>do_single_softirq()
> |
> + local_irq_enable();
> + handle_softirq()
> | |
> | + rcu_bh_qs()
> | |
> | + rcu_preempt_qs()
> |
> + local_irq_disable()
>
>So here we'd better disable irq directly inside of rcu_bh_qs() to
>fix this, otherwise the kernel may be freezable sometimes as
>observed. And especially this way is also kind and safe for the
>potential rcu_bh_qs() usage elsewhere in the future.
>
>Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
>Signed-off-by: Bin Jiang <bin.jiang@windriver.com>
Applied.
Sebastian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-20 13:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-18 9:51 [v2 PATCH] rcutree/rcu_bh_qs: disable irq while calling rcu_preempt_qs() Tiejun Chen
2013-12-20 13:30 ` Sebastian Andrzej Siewior
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 NNTP newsgroup(s).