lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 20 Apr 2017 15:44:47 +0300
From:   ville.syrjala@...ux.intel.com
To:     linux-pm@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Peter Zijlstra <peterz@...radead.org>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Ville Syrjälä 
        <ville.syrjala@...ux.intel.com>
Subject: [PATCH] Revert "cpuidle: Replace ktime_get() with local_clock()"

From: Ville Syrjälä <ville.syrjala@...ux.intel.com>

This reverts commit e93e59ce5b85e6c2b444f09fd1f707274ec066dc.

The TSC stops in deeper C states, so using local_clock() in cpuidle
to track the C state residency seems like a bad idea. With local_clock()
powertop is reporting mostly 0% residency for C states here. Presumably
the core is still spending most of its time in some deep C-state since
the totals typically add up to only 5% or so, so perhaps the governor
isn't getting totally confused by these bogus numbers. But let's go
back to using ktime_get() as that at least works correctly across the
board.

Note that the code has changed somewhat since the regression happened,
so this isn't a 1:1 revert of the offending commit.

Cc: stable@...r.kernel.org
Cc: Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@...ux.intel.com>
---
 drivers/cpuidle/cpuidle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 548b90be7685..24a52805527f 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -213,13 +213,13 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
 	sched_idle_set_state(target_state);
 
 	trace_cpu_idle_rcuidle(index, dev->cpu);
-	time_start = ns_to_ktime(local_clock());
+	time_start = ktime_get();
 
 	stop_critical_timings();
 	entered_state = target_state->enter(dev, drv, index);
 	start_critical_timings();
 
-	time_end = ns_to_ktime(local_clock());
+	time_end = ktime_get();
 	trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
 
 	/* The cpu is no longer idle or about to enter idle. */
-- 
2.10.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ