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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <13679187.uLZWGnKmhe@rjwysocki.net>
Date: Fri, 10 Jan 2025 13:53:57 +0100
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Linux PM <linux-pm@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
 Daniel Lezcano <daniel.lezcano@...aro.org>,
 Christian Loehle <christian.loehle@....com>,
 Artem Bityutskiy <artem.bityutskiy@...ux.intel.com>
Subject:
 [PATCH v1 1/4] cpuidle: teo: Add polling flag check to early return path

From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

After commit 6da8f9ba5a87 ("cpuidle: teo: Skip tick_nohz_get_sleep_length()
call in some cases") the teo governor behaves a bit differently on
systems where idle state 0 is a "polling" state (that is, it is not
really an idle state, but a loop continuously executed by the CPU).
Namely, on such systems it skips the tick_nohz_get_sleep_length() call
if the target residency of the current candidate idle state is small
enough.

However, if state 0 itself was to be returned, it would be returned
right away without calling tick_nohz_get_sleep_length() even on systems
where it was not a "polling" state until commit 4b20b07ce72f ("cpuidle:
teo: Don't count non-existent intercepts") that attempted to fix this
problem.

Unfortunately, commit 4b20b07ce72f has made the governor always call
tick_nohz_get_sleep_length() when about to return state 0 early, even
if that state is a "polling" one, which is inconsistent and defeats
the purpose of commit 6da8f9ba5a87 in that case.

Address this by adding a CPUIDLE_FLAG_POLLING check to the path where
state 0 is returned early to prevent tick_nohz_get_sleep_length() from
being called if it is a "polling" state.

Fixes: 4b20b07ce72f ("cpuidle: teo: Don't count non-existent intercepts")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
 drivers/cpuidle/governors/teo.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -422,7 +422,8 @@
 			first_suitable_idx = i;
 		}
 	}
-	if (!idx && prev_intercept_idx) {
+	if (!idx && prev_intercept_idx &&
+	    !(drv->states[0].flags & CPUIDLE_FLAG_POLLING)) {
 		/*
 		 * We have to query the sleep length here otherwise we don't
 		 * know after wakeup if our guess was correct.




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ