]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.7/powerpc-powernv-idle-round-up-latency-and-residency-values.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.14.7 / powerpc-powernv-idle-round-up-latency-and-residency-values.patch
CommitLineData
ca5aa89b
GKH
1From foo@baz Tue Dec 12 10:32:42 CET 2017
2From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
3Date: Thu, 24 Aug 2017 00:28:41 +0530
4Subject: powerpc/powernv/idle: Round up latency and residency values
5
6From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
7
8
9[ Upstream commit 8d4e10e9ed9450e18fbbf6a8872be0eac9fd4999 ]
10
11On PowerNV platforms, firmware provides exit latency and
12target residency for each of the idle states in nano
13seconds. Cpuidle framework expects the values in micro
14seconds. Round up to nearest micro seconds to avoid errors
15in cases where the values are defined as fractional micro
16seconds.
17
18Default idle state of 'snooze' has exit latency of zero. If
19other states have fractional micro second exit latency, they
20would get rounded down to zero micro second and make cpuidle
21framework choose deeper idle state when snooze loop is the
22right choice.
23
24Reported-by: Anton Blanchard <anton@samba.org>
25Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
26Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
27Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
28Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
29Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30---
31 drivers/cpuidle/cpuidle-powernv.c | 4 ++--
32 1 file changed, 2 insertions(+), 2 deletions(-)
33
34--- a/drivers/cpuidle/cpuidle-powernv.c
35+++ b/drivers/cpuidle/cpuidle-powernv.c
36@@ -384,9 +384,9 @@ static int powernv_add_idle_states(void)
37 * Firmware passes residency and latency values in ns.
38 * cpuidle expects it in us.
39 */
40- exit_latency = latency_ns[i] / 1000;
41+ exit_latency = DIV_ROUND_UP(latency_ns[i], 1000);
42 if (!rc)
43- target_residency = residency_ns[i] / 1000;
44+ target_residency = DIV_ROUND_UP(residency_ns[i], 1000);
45 else
46 target_residency = 0;
47