]>
Commit | Line | Data |
---|---|---|
ca5aa89b GKH |
1 | From foo@baz Tue Dec 12 10:32:42 CET 2017 |
2 | From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> | |
3 | Date: Thu, 24 Aug 2017 00:28:41 +0530 | |
4 | Subject: powerpc/powernv/idle: Round up latency and residency values | |
5 | ||
6 | From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> | |
7 | ||
8 | ||
9 | [ Upstream commit 8d4e10e9ed9450e18fbbf6a8872be0eac9fd4999 ] | |
10 | ||
11 | On PowerNV platforms, firmware provides exit latency and | |
12 | target residency for each of the idle states in nano | |
13 | seconds. Cpuidle framework expects the values in micro | |
14 | seconds. Round up to nearest micro seconds to avoid errors | |
15 | in cases where the values are defined as fractional micro | |
16 | seconds. | |
17 | ||
18 | Default idle state of 'snooze' has exit latency of zero. If | |
19 | other states have fractional micro second exit latency, they | |
20 | would get rounded down to zero micro second and make cpuidle | |
21 | framework choose deeper idle state when snooze loop is the | |
22 | right choice. | |
23 | ||
24 | Reported-by: Anton Blanchard <anton@samba.org> | |
25 | Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> | |
26 | Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com> | |
27 | Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> | |
28 | Signed-off-by: Sasha Levin <alexander.levin@verizon.com> | |
29 | Signed-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 |