FAILED: patch "[PATCH] hrtimers: Force migrate away hrtimers queued after" failed to apply to 6.1-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 53dac345395c0d2493cbc2f4c85fe38aef5b63f5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025021053-unranked-silt-0282@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 53dac345395c0d2493cbc2f4c85fe38aef5b63f5 Mon Sep 17 00:00:00 2001
From: Frederic Weisbecker <[email protected]>
Date: Sat, 18 Jan 2025 00:24:33 +0100
Subject: [PATCH] hrtimers: Force migrate away hrtimers queued after
CPUHP_AP_HRTIMERS_DYING
hrtimers are migrated away from the dying CPU to any online target at the CPUHP_AP_HRTIMERS_DYING stage in order not to delay bandwidth timers handling tasks involved in the CPU hotplug forward progress.
However wakeups can still be performed by the outgoing CPU after CPUHP_AP_HRTIMERS_DYING. Those can result again in bandwidth timers being armed. Depending on several considerations (crystal ball power management based election, earliest timer already enqueued, timer migration enabled or not), the target may eventually be the current CPU even if offline. If that happens, the timer is eventually ignored.
The most notable example is RCU which had to deal with each and every of those wake-ups by deferring them to an online CPU, along with related workarounds:
_ e787644caf76 (rcu: Defer RCU kthreads wakeup when CPU is dying) _ 9139f93209d1 (rcu/nocb: Fix RT throttling hrtimer armed from offline CPU) _ f7345ccc62a4 (rcu/nocb: Fix rcuog wake-up from offline softirq)
The problem isn't confined to RCU though as the stop machine kthread (which runs CPUHP_AP_HRTIMERS_DYING) reports its completion at the end of its work through cpu_stop_signal_done() and performs a wake up that eventually arms the deadline server timer:
WARNING: CPU: 94 PID: 588 at kernel/time/hrtimer.c:1086 hrtimer_start_range_ns+0x289/0x2d0
CPU: 94 UID: 0 PID: 588 Comm: migration/94 Not tainted
Stopper: multi_cpu_stop+0x0/0x120 <- stop_machine_cpuslocked+0x66/0xc0
RIP: 0010:hrtimer_start_range_ns+0x289/0x2d0
Call Trace:
<TASK>
start_dl_timer
enqueue_dl_entity
dl_server_start
enqueue_task_fair
enqueue_task
ttwu_do_activate
try_to_wake_up
complete
cpu_stopper_threadInstead of providing yet another bandaid to work around the situation, fix it in the hrtimers infrastructure instead: always migrate away a timer to an online target whenever it is enqueued from an offline CPU.
This will also allow to revert all the above RCU disgraceful hacks.
include/linux/hrtimer_defs.h +1 -0
@@ -125,6 +125,7 @@ struct hrtimer_cpu_base {ktime_t softirq_expires_next;struct hrtimer *softirq_next_timer;struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES ]; +call_single_data_t csd; }____cacheline_aligned ;
kernel/time/hrtimer.c +82 -21
175 lines not on this page · raw message
PATCH 1/1 hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
From: Frederic Weisbecker <[email protected]>
[ Upstream commit 53dac345395c0d2493cbc2f4c85fe38aef5b63f5 ]
hrtimers are migrated away from the dying CPU to any online target at the CPUHP_AP_HRTIMERS_DYING stage in order not to delay bandwidth timers handling tasks involved in the CPU hotplug forward progress.
However wakeups can still be performed by the outgoing CPU after CPUHP_AP_HRTIMERS_DYING. Those can result again in bandwidth timers being armed. Depending on several considerations (crystal ball power management based election, earliest timer already enqueued, timer migration enabled or not), the target may eventually be the current CPU even if offline. If that happens, the timer is eventually ignored.
The most notable example is RCU which had to deal with each and every of those wake-ups by deferring them to an online CPU, along with related workarounds:
_ e787644caf76 (rcu: Defer RCU kthreads wakeup when CPU is dying) _ 9139f93209d1 (rcu/nocb: Fix RT throttling hrtimer armed from offline CPU) _ f7345ccc62a4 (rcu/nocb: Fix rcuog wake-up from offline softirq)
The problem isn't confined to RCU though as the stop machine kthread (which runs CPUHP_AP_HRTIMERS_DYING) reports its completion at the end of its work through cpu_stop_signal_done() and performs a wake up that eventually arms the deadline server timer:
WARNING: CPU: 94 PID: 588 at kernel/time/hrtimer.c:1086 hrtimer_start_range_ns+0x289/0x2d0
CPU: 94 UID: 0 PID: 588 Comm: migration/94 Not tainted
Stopper: multi_cpu_stop+0x0/0x120 <- stop_machine_cpuslocked+0x66/0xc0
RIP: 0010:hrtimer_start_range_ns+0x289/0x2d0
Call Trace:
<TASK>
start_dl_timer
enqueue_dl_entity
dl_server_start
enqueue_task_fair
enqueue_task
ttwu_do_activate
try_to_wake_up
complete
cpu_stopper_threadInstead of providing yet another bandaid to work around the situation, fix it in the hrtimers infrastructure instead: always migrate away a timer to an online target whenever it is enqueued from an offline CPU.
This will also allow to revert all the above RCU disgraceful hacks.
--- include/linux/hrtimer.h | 1 + kernel/time/hrtimer.c | 103 ++++++++++++++++++++++++++++++++-------- 2 files changed, 83 insertions(+), 21 deletions(-)
include/linux/hrtimer.h +1 -0
@@ -237,6 +237,7 @@ struct hrtimer_cpu_base {ktime_t softirq_expires_next;struct hrtimer *softirq_next_timer;struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES ]; +call_single_data_t csd; }____cacheline_aligned ;static inline void hrtimer_set_expires (struct hrtimer *timer,ktime_t time)
kernel/time/hrtimer.c +82 -21
175 lines not on this page · raw message
Signature · 1 line
2.25.1
Sasha Levin
maintainerRe: [PATCH 6.1.y] hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 53dac345395c0d2493cbc2f4c85fe38aef5b63f5
WARNING: Author mismatch between patch and upstream commit:
Backport author: Zhaoyang Li<[email protected]> Commit author: Frederic Weisbecker<[email protected]>
Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.12.y | Present (different SHA1: e456a88bddae) 6.6.y | Not found
Note: The patch differs from the upstream commit:
---
1: 53dac345395c0 ! 1: 80e6b55d26f94 hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
@@ Metadata
## Commit message ##
hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
+ [ Upstream commit 53dac345395c0d2493cbc2f4c85fe38aef5b63f5 ]
+
hrtimers are migrated away from the dying CPU to any online target at
the CPUHP_AP_HRTIMERS_DYING stage in order not to delay bandwidth timers
handling tasks involved in the CPU hotplug forward progress.
@@ Commit message
Link: https://lore.kernel.org/all/[email protected]
Closes: [email protected]
- ## include/linux/hrtimer_defs.h ##
-@@ include/linux/hrtimer_defs.h: struct hrtimer_cpu_base {
+ Signed-off-by: Zhaoyang Li <[email protected]>
+
+ ## include/linux/hrtimer.h ##
+@@ include/linux/hrtimer.h: struct hrtimer_cpu_base {
ktime_t softirq_expires_next;
struct hrtimer *softirq_next_timer;
struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
+ call_single_data_t csd;
} ____cacheline_aligned;
-
+ static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
## kernel/time/hrtimer.c ##
@@---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.1.y | Success | Success |
Greg KH
maintainerRe: [PATCH 6.1.y] hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
In reply to Zhaoyang LiQuoted 61 lines · Zhaoyang Li
From: Frederic Weisbecker <[email protected]>
[ Upstream commit
53dac345395c0d2493cbc2f4c85fe38aef5b63f5]hrtimers are migrated away from the dying CPU to any online target at the
CPUHP_AP_HRTIMERS_DYINGstage in order not to delay bandwidth timers handling tasks involved in the CPU hotplug forward progress.However wakeups can still be performed by the outgoing CPU after
CPUHP_AP_HRTIMERS_DYING. Those can result again in bandwidth timers being armed. Depending on several considerations (crystal ball power management based election, earliest timer already enqueued, timer migration enabled or not), the target may eventually be the current CPU even if offline. If that happens, the timer is eventually ignored.The most notable example is RCU which had to deal with each and every of those wake-ups by deferring them to an online CPU, along with related workarounds:
_
e787644caf76(rcu: Defer RCU kthreads wakeup when CPU is dying) _9139f93209d1(rcu/nocb: Fix RT throttling hrtimer armed from offline CPU) _f7345ccc62a4(rcu/nocb: Fix rcuog wake-up from offline softirq)The problem isn't confined to RCU though as the stop machine kthread (which runs
CPUHP_AP_HRTIMERS_DYING) reports its completion at the end of its work throughcpu_stop_signal_done()and performs a wake up that eventually arms the deadline server timer:WARNING: CPU: 94 PID: 588 at kernel/time/hrtimer.c:1086 hrtimer_start_range_ns+0x289/0x2d0 CPU: 94 UID: 0 PID: 588 Comm: migration/94 Not tainted Stopper: multi_cpu_stop+0x0/0x120 <- stop_machine_cpuslocked+0x66/0xc0 RIP: 0010:hrtimer_start_range_ns+0x289/0x2d0 Call Trace: <TASK> start_dl_timer enqueue_dl_entity dl_server_start enqueue_task_fair enqueue_task ttwu_do_activate try_to_wake_up complete cpu_stopper_threadInstead of providing yet another bandaid to work around the situation, fix it in the hrtimers infrastructure instead: always migrate away a timer to an online target whenever it is enqueued from an offline CPU.
This will also allow to revert all the above RCU disgraceful hacks.
Fixes 5c0930ccaad5 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")Reported-by Vlad Poenaru <[email protected]>Reported-by Usama Arif <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>Tested-by Paul E. McKenney <[email protected]>Closes [email protected]
Quoted 2 lines
Signed-off-by Zhaoyang Li <[email protected]>---
You forgot to send a 6.6.y version as well :(
Now dropped from my queue, please resend both.
thanks,
greg k-h
Re: Re: [PATCH 6.1.y] hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
Quoted 68 lines
Subject: Re: [PATCH 6.1.y] hrtimers: Force migrate away hrtimers queued after
CPUHP_AP_HRTIMERS_DYINGQuoted 61 lines · Zhaoyang Li
From: Frederic Weisbecker <[email protected]>
[ Upstream commit
53dac345395c0d2493cbc2f4c85fe38aef5b63f5]hrtimers are migrated away from the dying CPU to any online target at the
CPUHP_AP_HRTIMERS_DYINGstage in order not to delay bandwidth timers handling tasks involved in the CPU hotplug forward progress.However wakeups can still be performed by the outgoing CPU after
CPUHP_AP_HRTIMERS_DYING. Those can result again in bandwidth timers being armed. Depending on several considerations (crystal ball power management based election, earliest timer already enqueued, timer migration enabled or not), the target may eventually be the current CPU even if offline. If that happens, the timer is eventually ignored.The most notable example is RCU which had to deal with each and every of those wake-ups by deferring them to an online CPU, along with related workarounds:
_
e787644caf76(rcu: Defer RCU kthreads wakeup when CPU is dying) _9139f93209d1(rcu/nocb: Fix RT throttling hrtimer armed from offline CPU) _f7345ccc62a4(rcu/nocb: Fix rcuog wake-up from offline softirq)The problem isn't confined to RCU though as the stop machine kthread (which runs
CPUHP_AP_HRTIMERS_DYING) reports its completion at the end of its work throughcpu_stop_signal_done()and performs a wake up that eventually arms the deadline server timer:WARNING: CPU: 94 PID: 588 at kernel/time/hrtimer.c:1086 hrtimer_start_range_ns+0x289/0x2d0 CPU: 94 UID: 0 PID: 588 Comm: migration/94 Not tainted Stopper: multi_cpu_stop+0x0/0x120 <- stop_machine_cpuslocked+0x66/0xc0 RIP: 0010:hrtimer_start_range_ns+0x289/0x2d0 Call Trace: <TASK> start_dl_timer enqueue_dl_entity dl_server_start enqueue_task_fair enqueue_task ttwu_do_activate try_to_wake_up complete cpu_stopper_threadInstead of providing yet another bandaid to work around the situation, fix it in the hrtimers infrastructure instead: always migrate away a timer to an online target whenever it is enqueued from an offline CPU.
This will also allow to revert all the above RCU disgraceful hacks.
Fixes 5c0930ccaad5 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")Reported-by Vlad Poenaru <[email protected]>Reported-by Usama Arif <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>Tested-by Paul E. McKenney <[email protected]>Closes [email protected]Quoted 2 lines
Signed-off-by Zhaoyang Li <[email protected]>---
Quoted 7 lines
You forgot to send a 6.6.y version as well :(
Now dropped from my queue, please resend both.
thanks,
greg k-h
Thank you for the reminder. I will try to port it to 6.6.y and then resend the two patches. --
Best regards,
Zhaoyang Li
PATCH 1/1 hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
In reply to [email protected]From: Frederic Weisbecker <[email protected]>
[ Upstream commit 53dac345395c0d2493cbc2f4c85fe38aef5b63f5 ]
hrtimers are migrated away from the dying CPU to any online target at the CPUHP_AP_HRTIMERS_DYING stage in order not to delay bandwidth timers handling tasks involved in the CPU hotplug forward progress.
However wakeups can still be performed by the outgoing CPU after CPUHP_AP_HRTIMERS_DYING. Those can result again in bandwidth timers being armed. Depending on several considerations (crystal ball power management based election, earliest timer already enqueued, timer migration enabled or not), the target may eventually be the current CPU even if offline. If that happens, the timer is eventually ignored.
The most notable example is RCU which had to deal with each and every of those wake-ups by deferring them to an online CPU, along with related workarounds:
_ e787644caf76 (rcu: Defer RCU kthreads wakeup when CPU is dying) _ 9139f93209d1 (rcu/nocb: Fix RT throttling hrtimer armed from offline CPU) _ f7345ccc62a4 (rcu/nocb: Fix rcuog wake-up from offline softirq)
The problem isn't confined to RCU though as the stop machine kthread (which runs CPUHP_AP_HRTIMERS_DYING) reports its completion at the end of its work through cpu_stop_signal_done() and performs a wake up that eventually arms the deadline server timer:
WARNING: CPU: 94 PID: 588 at kernel/time/hrtimer.c:1086 hrtimer_start_range_ns+0x289/0x2d0
CPU: 94 UID: 0 PID: 588 Comm: migration/94 Not tainted
Stopper: multi_cpu_stop+0x0/0x120 <- stop_machine_cpuslocked+0x66/0xc0
RIP: 0010:hrtimer_start_range_ns+0x289/0x2d0
Call Trace:
<TASK>
start_dl_timer
enqueue_dl_entity
dl_server_start
enqueue_task_fair
enqueue_task
ttwu_do_activate
try_to_wake_up
complete
cpu_stopper_threadInstead of providing yet another bandaid to work around the situation, fix it in the hrtimers infrastructure instead: always migrate away a timer to an online target whenever it is enqueued from an offline CPU.
This will also allow to revert all the above RCU disgraceful hacks.
--- include/linux/hrtimer.h | 1 + kernel/time/hrtimer.c | 103 ++++++++++++++++++++++++++++++++-------- 2 files changed, 83 insertions(+), 21 deletions(-)
include/linux/hrtimer.h +1 -0
@@ -237,6 +237,7 @@ struct hrtimer_cpu_base {ktime_t softirq_expires_next;struct hrtimer *softirq_next_timer;struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES ]; +call_single_data_t csd; }____cacheline_aligned ;static inline void hrtimer_set_expires (struct hrtimer *timer,ktime_t time)
kernel/time/hrtimer.c +82 -21
175 lines not on this page · raw message
Signature · 1 line
2.25.1
Sasha Levin
maintainerRe: [PATCH 6.1.y] hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 53dac345395c0d2493cbc2f4c85fe38aef5b63f5
WARNING: Author mismatch between patch and upstream commit:
Backport author: Zhaoyang Li<[email protected]> Commit author: Frederic Weisbecker<[email protected]>
Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.12.y | Present (different SHA1: e456a88bddae) 6.6.y | Not found
Note: The patch differs from the upstream commit:
---
1: 53dac345395c0 ! 1: d4b970537740a hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
@@ Metadata
## Commit message ##
hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
+ [ Upstream commit 53dac345395c0d2493cbc2f4c85fe38aef5b63f5 ]
+
hrtimers are migrated away from the dying CPU to any online target at
the CPUHP_AP_HRTIMERS_DYING stage in order not to delay bandwidth timers
handling tasks involved in the CPU hotplug forward progress.
@@ Commit message
Link: https://lore.kernel.org/all/[email protected]
Closes: [email protected]
- ## include/linux/hrtimer_defs.h ##
-@@ include/linux/hrtimer_defs.h: struct hrtimer_cpu_base {
+ Signed-off-by: Zhaoyang Li <[email protected]>
+
+ ## include/linux/hrtimer.h ##
+@@ include/linux/hrtimer.h: struct hrtimer_cpu_base {
ktime_t softirq_expires_next;
struct hrtimer *softirq_next_timer;
struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
+ call_single_data_t csd;
} ____cacheline_aligned;
-
+ static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
## kernel/time/hrtimer.c ##
@@---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.1.y | Success | Success |