Peter Zijlstra
08beb0d436
x86: Fix CPUIDLE_FLAG_IRQ_ENABLE leaking timer reprogram
...
[ Upstream commit edc8fc01f6 ]
intel_idle_irq() re-enables IRQs very early. As a result, an interrupt
may fire before mwait() is eventually called. If such an interrupt queues
a timer, it may go unnoticed until mwait returns and the idle loop
handles the tick re-evaluation. And monitoring TIF_NEED_RESCHED doesn't
help because a local timer enqueue doesn't set that flag.
The issue is mitigated by the fact that this idle handler is only invoked
for shallow C-states when, presumably, the next tick is supposed to be
close enough. There may still be rare cases though when the next tick
is far away and the selected C-state is shallow, resulting in a timer
getting ignored for a while.
Fix this with using sti_mwait() whose IRQ-reenablement only triggers
upon calling mwait(), dealing with the race while keeping the interrupt
latency within acceptable bounds.
Fixes: c227233ad6 (intel_idle: enable interrupts before C1 on Xeons)
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Signed-off-by: Frederic Weisbecker <frederic@kernel.org >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lkml.kernel.org/r/20231115151325.6262-3-frederic@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org >
2024-01-25 15:35:12 -08:00
..
2023-10-12 11:08:58 -04:00
2023-06-26 16:32:47 -07:00
2023-08-22 10:39:26 +02:00
2023-06-05 21:11:07 +02:00
2023-11-28 17:19:57 +00:00
2023-11-28 17:19:57 +00:00
2023-02-13 22:13:12 +01:00
2023-12-20 17:02:06 +01:00
2022-09-29 12:20:54 +02:00
2023-08-09 12:00:55 -07:00
2023-05-22 14:06:33 +02:00
2023-01-13 13:43:20 +01:00
2023-06-05 09:57:24 +02:00
2023-06-05 09:57:24 +02:00
2023-06-05 09:57:24 +02:00
2023-08-30 10:11:16 +02:00
2022-09-20 15:35:37 +02:00
2023-09-17 09:48:57 +02:00
2023-03-30 12:58:51 -06:00
2023-06-16 10:15:59 +02:00
2022-11-10 13:12:45 +01:00
2022-09-26 10:13:16 -07:00
2023-01-27 11:19:46 +00:00
2022-10-03 14:03:24 -07:00
2023-06-05 09:36:39 +02:00
2023-06-05 09:57:17 +02:00
2023-06-05 09:36:39 +02:00
2023-05-09 12:53:16 +02:00
2022-12-15 10:37:26 -08:00
2023-10-11 14:27:37 +02:00
2023-05-15 20:03:08 +02:00
2023-09-07 13:52:20 -07:00
2022-11-29 20:41:24 +01:00
2023-05-15 13:44:52 +02:00
2022-10-17 16:41:15 +02:00
2023-02-21 14:51:40 -08:00
2023-08-02 15:01:50 -07:00
2023-08-03 12:08:35 +02:00
2023-02-15 12:35:20 +01:00
2023-05-18 11:56:18 -07:00
2023-09-11 06:37:50 +00:00
2022-12-12 18:18:34 -08:00
2023-08-14 11:02:50 +02:00
2023-04-26 15:07:57 +02:00
2023-06-30 10:33:17 -07:00
2023-01-13 10:07:27 +01:00
2022-10-17 16:41:05 +02:00
2022-08-30 10:56:22 +02:00
2023-08-06 14:15:09 +02:00
2022-11-17 13:58:32 +01:00
2023-08-25 00:04:56 +00:00
2023-10-27 20:36:49 +02:00
2023-12-13 18:45:02 +01:00
2023-07-10 09:52:23 +02:00
2023-12-13 18:45:02 +01:00
2023-01-03 18:46:06 +01:00
2023-10-27 10:19:26 -07:00
2023-03-22 11:08:40 -07:00
2023-08-09 11:58:16 -07:00
2023-08-18 10:12:32 -07:00
2022-10-21 10:49:35 +02:00
2022-12-05 22:22:33 +01:00
2022-10-17 16:41:05 +02:00
2023-08-06 14:15:10 +02:00
2023-08-18 10:19:00 -07:00
2022-11-17 15:15:22 +01:00
2023-01-13 11:48:15 +01:00
2022-12-15 10:37:26 -08:00
2023-06-16 17:17:42 +02:00
2023-09-07 13:52:20 -07:00
2022-10-03 14:03:26 -07:00
2022-09-26 13:20:52 -04:00
2023-11-28 17:19:56 +00:00
2023-08-31 14:08:19 -04:00
2023-11-28 17:19:56 +00:00
2023-06-06 17:31:44 -07:00
2023-01-31 15:01:47 +01:00
2023-09-18 19:30:08 +02:00
2023-07-10 09:52:36 +02:00
2023-05-18 11:56:18 -07:00
2023-08-25 13:33:48 +02:00
2022-11-10 13:12:45 +01:00
2023-08-28 17:05:58 -07:00
2023-09-06 23:50:46 +02:00
2023-09-19 09:18:34 -07:00
2023-03-16 13:08:40 -07:00
2023-08-09 11:58:25 -07:00
2023-09-22 18:41:29 +00:00
2022-12-05 22:22:34 +01:00
2023-11-28 17:19:56 +00:00
2023-06-01 15:04:33 +02:00
2024-01-25 15:35:12 -08:00
2023-05-31 10:21:21 +02:00
2023-12-20 17:02:06 +01:00
2023-11-28 17:19:36 +00:00
2023-06-16 17:17:42 +02:00
2023-03-23 23:18:58 +01:00
2023-02-09 16:51:41 -08:00
2023-03-30 12:58:51 -06:00
2023-02-09 16:51:41 -08:00
2022-12-15 10:37:27 -08:00
2023-02-02 22:33:18 -08:00
2023-09-19 07:04:49 +02:00
2023-08-03 16:50:19 +02:00
2022-12-05 22:22:33 +01:00
2023-06-05 09:36:39 +02:00
2023-06-27 14:43:02 -07:00
2022-11-08 17:37:18 -08:00
2023-03-30 12:58:51 -06:00
2023-05-08 15:25:24 +02:00
2022-12-15 10:37:26 -08:00
2023-08-31 12:20:12 -07:00
2023-02-02 22:33:10 -08:00
2022-12-15 10:37:27 -08:00
2023-02-02 22:33:10 -08:00
2023-09-29 17:20:46 -07:00
2022-10-17 16:41:04 +02:00
2023-03-16 13:08:39 -07:00
2023-09-19 10:54:07 +02:00
2023-12-13 18:45:02 +01:00
2023-01-31 15:01:47 +01:00
2023-08-03 17:15:05 +02:00
2023-08-03 16:50:19 +02:00
2023-05-15 13:45:03 +02:00
2023-08-03 15:37:14 -07:00
2023-01-25 12:33:06 +01:00
2023-03-08 11:48:11 -08:00
2023-08-18 10:18:56 -07:00
2023-08-21 13:46:24 -07:00
2023-08-08 09:31:43 +02:00
2022-12-15 10:37:27 -08:00
2023-04-14 17:31:24 +02:00
2023-06-06 18:28:25 +02:00
2023-08-07 21:07:43 +02:00
2022-11-04 15:33:30 -07:00
2023-08-02 15:01:51 -07:00
2023-06-16 10:16:00 +02:00
2022-10-19 09:58:49 +02:00
2022-10-19 09:58:48 +02:00
2023-10-15 12:02:02 -07:00
2023-11-20 11:58:53 +01:00
2022-11-09 12:26:51 -05:00
2023-08-02 15:01:50 -07:00
2022-11-18 02:18:10 +01:00
2023-03-28 16:20:11 -07:00
2023-10-12 11:08:59 -04:00
2023-07-10 09:52:25 +02:00
2024-01-20 11:51:46 +01:00
2023-05-18 11:56:18 -07:00
2023-06-06 18:25:57 +02:00
2023-01-31 15:05:30 +01:00
2023-06-09 17:44:16 -07:00
2023-06-09 17:44:16 -07:00
2023-08-31 12:20:12 -07:00
2023-07-28 09:53:37 +02:00
2023-07-11 14:12:19 -07:00
2023-08-17 17:07:09 +02:00
2023-06-28 10:59:38 -07:00
2023-05-03 10:37:22 -07:00
2023-08-30 09:45:12 -07:00
2023-11-20 11:58:52 +01:00
2023-06-06 18:31:37 +02:00
2023-06-07 10:03:12 -07:00
2023-01-25 12:33:40 +01:00
2023-08-17 11:38:28 -07:00
2023-06-26 16:32:47 -07:00