]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Feb 2024 16:18:24 +0000 (17:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Feb 2024 16:18:24 +0000 (17:18 +0100)
added patches:
hrtimer-report-offline-hrtimer-enqueue.patch

queue-4.19/hrtimer-report-offline-hrtimer-enqueue.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/hrtimer-report-offline-hrtimer-enqueue.patch b/queue-4.19/hrtimer-report-offline-hrtimer-enqueue.patch
new file mode 100644 (file)
index 0000000..aa52649
--- /dev/null
@@ -0,0 +1,78 @@
+From dad6a09f3148257ac1773cd90934d721d68ab595 Mon Sep 17 00:00:00 2001
+From: Frederic Weisbecker <frederic@kernel.org>
+Date: Mon, 29 Jan 2024 15:56:36 -0800
+Subject: hrtimer: Report offline hrtimer enqueue
+
+From: Frederic Weisbecker <frederic@kernel.org>
+
+commit dad6a09f3148257ac1773cd90934d721d68ab595 upstream.
+
+The hrtimers migration on CPU-down hotplug process has been moved
+earlier, before the CPU actually goes to die. This leaves a small window
+of opportunity to queue an hrtimer in a blind spot, leaving it ignored.
+
+For example a practical case has been reported with RCU waking up a
+SCHED_FIFO task right before the CPUHP_AP_IDLE_DEAD stage, queuing that
+way a sched/rt timer to the local offline CPU.
+
+Make sure such situations never go unnoticed and warn when that happens.
+
+Fixes: 5c0930ccaad5 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")
+Reported-by: Paul E. McKenney <paulmck@kernel.org>
+Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
+Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240129235646.3171983-4-boqun.feng@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/hrtimer.h |    4 +++-
+ kernel/time/hrtimer.c   |    3 +++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+--- a/include/linux/hrtimer.h
++++ b/include/linux/hrtimer.h
+@@ -182,6 +182,7 @@ enum  hrtimer_base_type {
+  * @hang_detected:    The last hrtimer interrupt detected a hang
+  * @softirq_activated:        displays, if the softirq is raised - update of softirq
+  *                    related settings is not required then.
++ * @online:           CPU is online from an hrtimers point of view
+  * @nr_events:                Total number of hrtimer interrupt events
+  * @nr_retries:               Total number of hrtimer interrupt retries
+  * @nr_hangs:         Total number of hrtimer interrupt hangs
+@@ -206,7 +207,8 @@ struct hrtimer_cpu_base {
+       unsigned int                    hres_active             : 1,
+                                       in_hrtirq               : 1,
+                                       hang_detected           : 1,
+-                                      softirq_activated       : 1;
++                                      softirq_activated       : 1,
++                                      online                  : 1;
+ #ifdef CONFIG_HIGH_RES_TIMERS
+       unsigned int                    nr_events;
+       unsigned short                  nr_retries;
+--- a/kernel/time/hrtimer.c
++++ b/kernel/time/hrtimer.c
+@@ -970,6 +970,7 @@ static int enqueue_hrtimer(struct hrtime
+                          enum hrtimer_mode mode)
+ {
+       debug_activate(timer, mode);
++      WARN_ON_ONCE(!base->cpu_base->online);
+       base->cpu_base->active_bases |= 1 << base->index;
+@@ -1887,6 +1888,7 @@ int hrtimers_prepare_cpu(unsigned int cp
+       cpu_base->softirq_next_timer = NULL;
+       cpu_base->expires_next = KTIME_MAX;
+       cpu_base->softirq_expires_next = KTIME_MAX;
++      cpu_base->online = 1;
+       return 0;
+ }
+@@ -1953,6 +1955,7 @@ int hrtimers_cpu_dying(unsigned int dyin
+       smp_call_function_single(ncpu, retrigger_next_event, NULL, 0);
+       raw_spin_unlock(&new_base->lock);
++      old_base->online = 0;
+       raw_spin_unlock(&old_base->lock);
+       return 0;
index 4811a5319678c658e33112f13445524badff7720..2f7a1e0cabb87b03bf1c66e2d70e93e8781627ab 100644 (file)
@@ -161,3 +161,4 @@ usb-serial-option-add-fibocom-fm101-gl-variant.patch
 usb-serial-cp210x-add-id-for-imst-im871a-usb.patch
 input-atkbd-skip-atkbd_cmd_setleds-when-skipping-atkbd_cmd_getid.patch
 vhost-use-kzalloc-instead-of-kmalloc-followed-by-memset.patch
+hrtimer-report-offline-hrtimer-enqueue.patch