2020-08-28 04:53:35 +00:00
|
|
|
From 709122e50c844dce09298e7854c1481f09354625 Mon Sep 17 00:00:00 2001
|
|
|
|
Message-Id: <709122e50c844dce09298e7854c1481f09354625.1596234183.git.zanussi@kernel.org>
|
|
|
|
In-Reply-To: <378ee68279f6a7631221f2670a9298620148690d.1596234183.git.zanussi@kernel.org>
|
|
|
|
References: <378ee68279f6a7631221f2670a9298620148690d.1596234183.git.zanussi@kernel.org>
|
2019-02-27 18:51:46 +00:00
|
|
|
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
|
|
Date: Tue, 19 Feb 2019 16:59:15 +0100
|
2020-07-15 20:05:29 +00:00
|
|
|
Subject: [PATCH 183/329] hrtimer: Don't lose state in cpu_chill()
|
2020-08-28 04:53:35 +00:00
|
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.135-rt60.tar.xz
|
2019-02-27 18:51:46 +00:00
|
|
|
|
|
|
|
In cpu_chill() the state is set to TASK_UNINTERRUPTIBLE and a timer is
|
|
|
|
programmed. On return the state is always TASK_RUNNING which means we
|
|
|
|
lose the state if it was something other than RUNNING. Also
|
|
|
|
set_current_state() sets ->task_state_change to within cpu_chill() which
|
|
|
|
is not expected.
|
|
|
|
|
|
|
|
Save the task state on entry and restore it on return. Simply set the
|
|
|
|
state in order to avoid updating ->task_state_change.
|
|
|
|
|
|
|
|
Cc: stable-rt@vger.kernel.org
|
|
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
|
|
---
|
2019-04-08 23:49:20 +00:00
|
|
|
kernel/time/hrtimer.c | 5 ++++-
|
2019-02-27 18:51:46 +00:00
|
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
|
2019-04-08 23:49:20 +00:00
|
|
|
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
|
2020-01-19 00:54:59 +00:00
|
|
|
index 98a771065818..21a454557c8a 100644
|
2019-02-27 18:51:46 +00:00
|
|
|
--- a/kernel/time/hrtimer.c
|
|
|
|
+++ b/kernel/time/hrtimer.c
|
2020-01-19 00:54:59 +00:00
|
|
|
@@ -1905,15 +1905,18 @@ void cpu_chill(void)
|
2019-02-27 18:51:46 +00:00
|
|
|
{
|
|
|
|
ktime_t chill_time;
|
|
|
|
unsigned int freeze_flag = current->flags & PF_NOFREEZE;
|
|
|
|
+ long saved_state;
|
|
|
|
|
|
|
|
+ saved_state = current->state;
|
|
|
|
chill_time = ktime_set(0, NSEC_PER_MSEC);
|
|
|
|
- set_current_state(TASK_UNINTERRUPTIBLE);
|
|
|
|
+ __set_current_state_no_track(TASK_UNINTERRUPTIBLE);
|
|
|
|
current->flags |= PF_NOFREEZE;
|
|
|
|
sleeping_lock_inc();
|
|
|
|
schedule_hrtimeout(&chill_time, HRTIMER_MODE_REL_HARD);
|
|
|
|
sleeping_lock_dec();
|
|
|
|
if (!freeze_flag)
|
|
|
|
current->flags &= ~PF_NOFREEZE;
|
|
|
|
+ __set_current_state_no_track(saved_state);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(cpu_chill);
|
|
|
|
#endif
|
2020-01-03 23:36:11 +00:00
|
|
|
--
|
2020-06-22 13:14:16 +00:00
|
|
|
2.17.1
|
2020-01-03 23:36:11 +00:00
|
|
|
|