* [PATCH -rt] hrtimer: fix logic for when grabbing softirq_expiry_lock can be elided
@ 2020-04-28 14:40 Rasmus Villemoes
2020-04-28 14:53 ` Steven Rostedt
2020-04-28 15:18 ` Tom Zanussi
0 siblings, 2 replies; 3+ messages in thread
From: Rasmus Villemoes @ 2020-04-28 14:40 UTC (permalink / raw)
To: linux-kernel
Cc: linux-rt-users, Rasmus Villemoes, Steven Rostedt,
Thomas Gleixner, Carsten Emde, Sebastian Andrzej Siewior,
Tom Zanussi, Julien Grall, Daniel Wagner, John Kacur
Commit
hrtimer: Add a missing bracket and hide `migration_base' on !SMP
which is 47b6de0b7f22 in 5.2-rt and 40aae5708e7a in 4.19-rt,
inadvertently changed the logic from base != &migration_base to base
== &migration_base.
On !CONFIG_SMP, the effect was to effectively always elide this
lock/unlock pair (since is_migration_base() is unconditionally false),
which for me consistently causes lockups during reboot, and reportedly
also often causes a hang during boot.
Adding this logical negation (or, what is effectively the same thing
on !CONFIG_SMP, reverting the above commit as well as "hrtimer:
Prevent using hrtimer_grab_expiry_lock() on migration_base") fixes
that lockup.
Fixes: 40aae5708e7a (hrtimer: Add a missing bracket and hide `migration_base' on !SMP) # 4.19-rt
Fixes: 47b6de0b7f22 (hrtimer: Add a missing bracket and hide `migration_base' on !SMP) # 5.2-rt
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
Something like this? I wasn't sure what Fixes: tag(s) to include, if
any. It's quite possible the same fix is needed on earlier -rt
kernels, I didn't check.
kernel/time/hrtimer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index e54a95de8b79..c3966c090246 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -953,7 +953,7 @@ void hrtimer_grab_expiry_lock(const struct hrtimer *timer)
{
struct hrtimer_clock_base *base = READ_ONCE(timer->base);
- if (timer->is_soft && is_migration_base(base)) {
+ if (timer->is_soft && !is_migration_base(base)) {
spin_lock(&base->cpu_base->softirq_expiry_lock);
spin_unlock(&base->cpu_base->softirq_expiry_lock);
}
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -rt] hrtimer: fix logic for when grabbing softirq_expiry_lock can be elided
2020-04-28 14:40 [PATCH -rt] hrtimer: fix logic for when grabbing softirq_expiry_lock can be elided Rasmus Villemoes
@ 2020-04-28 14:53 ` Steven Rostedt
2020-04-28 15:18 ` Tom Zanussi
1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2020-04-28 14:53 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: linux-kernel, linux-rt-users, Thomas Gleixner, Carsten Emde,
Sebastian Andrzej Siewior, Tom Zanussi, Julien Grall,
Daniel Wagner, John Kacur
On Tue, 28 Apr 2020 16:40:26 +0200
Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:
> Commit
>
> hrtimer: Add a missing bracket and hide `migration_base' on !SMP
>
> which is 47b6de0b7f22 in 5.2-rt and 40aae5708e7a in 4.19-rt,
> inadvertently changed the logic from base != &migration_base to base
> == &migration_base.
>
> On !CONFIG_SMP, the effect was to effectively always elide this
> lock/unlock pair (since is_migration_base() is unconditionally false),
> which for me consistently causes lockups during reboot, and reportedly
> also often causes a hang during boot.
>
> Adding this logical negation (or, what is effectively the same thing
> on !CONFIG_SMP, reverting the above commit as well as "hrtimer:
> Prevent using hrtimer_grab_expiry_lock() on migration_base") fixes
> that lockup.
>
> Fixes: 40aae5708e7a (hrtimer: Add a missing bracket and hide `migration_base' on !SMP) # 4.19-rt
> Fixes: 47b6de0b7f22 (hrtimer: Add a missing bracket and hide `migration_base' on !SMP) # 5.2-rt
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
> Something like this? I wasn't sure what Fixes: tag(s) to include, if
> any. It's quite possible the same fix is needed on earlier -rt
> kernels, I didn't check.
>
> kernel/time/hrtimer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
> index e54a95de8b79..c3966c090246 100644
> --- a/kernel/time/hrtimer.c
> +++ b/kernel/time/hrtimer.c
> @@ -953,7 +953,7 @@ void hrtimer_grab_expiry_lock(const struct hrtimer *timer)
> {
> struct hrtimer_clock_base *base = READ_ONCE(timer->base);
>
> - if (timer->is_soft && is_migration_base(base)) {
> + if (timer->is_soft && !is_migration_base(base)) {
That was my sloppiness in not seeing that 5.2-rt had == and 4.19 had !=.
Thanks for tracking this down!
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-- Steve
> spin_lock(&base->cpu_base->softirq_expiry_lock);
> spin_unlock(&base->cpu_base->softirq_expiry_lock);
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -rt] hrtimer: fix logic for when grabbing softirq_expiry_lock can be elided
2020-04-28 14:40 [PATCH -rt] hrtimer: fix logic for when grabbing softirq_expiry_lock can be elided Rasmus Villemoes
2020-04-28 14:53 ` Steven Rostedt
@ 2020-04-28 15:18 ` Tom Zanussi
1 sibling, 0 replies; 3+ messages in thread
From: Tom Zanussi @ 2020-04-28 15:18 UTC (permalink / raw)
To: Rasmus Villemoes, linux-kernel
Cc: linux-rt-users, Steven Rostedt, Thomas Gleixner, Carsten Emde,
Sebastian Andrzej Siewior, Julien Grall, Daniel Wagner,
John Kacur
On Tue, 2020-04-28 at 16:40 +0200, Rasmus Villemoes wrote:
> Commit
>
> hrtimer: Add a missing bracket and hide `migration_base' on !SMP
>
> which is 47b6de0b7f22 in 5.2-rt and 40aae5708e7a in 4.19-rt,
> inadvertently changed the logic from base != &migration_base to base
> == &migration_base.
>
> On !CONFIG_SMP, the effect was to effectively always elide this
> lock/unlock pair (since is_migration_base() is unconditionally
> false),
> which for me consistently causes lockups during reboot, and
> reportedly
> also often causes a hang during boot.
>
> Adding this logical negation (or, what is effectively the same thing
> on !CONFIG_SMP, reverting the above commit as well as "hrtimer:
> Prevent using hrtimer_grab_expiry_lock() on migration_base") fixes
> that lockup.
>
> Fixes: 40aae5708e7a (hrtimer: Add a missing bracket and hide
> `migration_base' on !SMP) # 4.19-rt
> Fixes: 47b6de0b7f22 (hrtimer: Add a missing bracket and hide
> `migration_base' on !SMP) # 5.2-rt
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
> Something like this? I wasn't sure what Fixes: tag(s) to include, if
> any. It's quite possible the same fix is needed on earlier -rt
> kernels, I didn't check.
>
Yeah, looks good, I'll post a new update with this shortly.
Thanks,
Tom
> kernel/time/hrtimer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
> index e54a95de8b79..c3966c090246 100644
> --- a/kernel/time/hrtimer.c
> +++ b/kernel/time/hrtimer.c
> @@ -953,7 +953,7 @@ void hrtimer_grab_expiry_lock(const struct
> hrtimer *timer)
> {
> struct hrtimer_clock_base *base = READ_ONCE(timer->base);
>
> - if (timer->is_soft && is_migration_base(base)) {
> + if (timer->is_soft && !is_migration_base(base)) {
> spin_lock(&base->cpu_base->softirq_expiry_lock);
> spin_unlock(&base->cpu_base->softirq_expiry_lock);
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-28 15:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 14:40 [PATCH -rt] hrtimer: fix logic for when grabbing softirq_expiry_lock can be elided Rasmus Villemoes
2020-04-28 14:53 ` Steven Rostedt
2020-04-28 15:18 ` Tom Zanussi
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).