linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] s2idle fixes for systems without cpuidle
@ 2023-07-11  5:54 Kazuki Hashimoto
  2023-07-11  5:54 ` [PATCH 1/2] cpuidle: Don't pass any values to cpuidle_not_available Kazuki Hashimoto
  2023-07-11  5:54 ` [PATCH 2/2] PM: s2idle: Fully prevent the system from entering s2idle when cpuidle isn't supported Kazuki Hashimoto
  0 siblings, 2 replies; 9+ messages in thread
From: Kazuki Hashimoto @ 2023-07-11  5:54 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Ingo Molnar, Peter Zijlstra,
	Len Brown, Pavel Machek
  Cc: linux-pm, linux-kernel, Rafael J. Wysocki, Hector Martin,
	Kazuki Hashimoto

Changes in V2:
Redo implementation following input from Hector Martin

Changes in V3:
Rewrite commit message following input from Rafael J. Wysocki

---
Kazuki Hashimoto (2):
      cpuidle: Don't pass any values to cpuidle_not_available
      PM: s2idle: Fully prevent the system from entering s2idle when cpuidle isn't supported

 drivers/cpuidle/cpuidle.c |  6 ++++--
 include/linux/cpuidle.h   |  6 ++----
 kernel/power/main.c       | 12 +++++++++---
 kernel/power/suspend.c    |  5 +++++
 kernel/sched/idle.c       |  2 +-
 5 files changed, 21 insertions(+), 10 deletions(-)
---
base-commit: 8fc3b8f082cc2f5faa6eae315b938bc5e79c332e
change-id: 20230709-cpuidle-8c5469788f77

Best regards,
-- 
Kazuki Hashimoto <kazukih0205@gmail.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 1/2] cpuidle: Don't pass any values to cpuidle_not_available
@ 2023-03-16  6:37 Kazuki H
  2023-03-16  7:43 ` Kazuki H
  0 siblings, 1 reply; 9+ messages in thread
From: Kazuki H @ 2023-03-16  6:37 UTC (permalink / raw)
  Cc: Hector Martin, Sven Peter, Kazuki H, Rafael J. Wysocki,
	Daniel Lezcano, Pavel Machek, Len Brown, Ingo Molnar,
	Peter Zijlstra, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Valentin Schneider, linux-pm,
	linux-kernel

There's no reason to pass any values to cpuidle_not_available() as the
function works standalone. Since we're planning to use the function in
other places, make it so to avoid code duplication.

Signed-off-by: Kazuki H <kazukih0205@gmail.com>
---
 drivers/cpuidle/cpuidle.c | 6 ++++--
 include/linux/cpuidle.h   | 6 ++----
 kernel/sched/idle.c       | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 6eceb1988243..cc05acf4d2a8 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -48,9 +48,11 @@ void disable_cpuidle(void)
 	off = 1;
 }
 
-bool cpuidle_not_available(struct cpuidle_driver *drv,
-			   struct cpuidle_device *dev)
+bool cpuidle_not_available(void)
 {
+	struct cpuidle_device *dev = cpuidle_get_device();
+	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
+
 	return off || !initialized || !drv || !dev || !dev->enabled;
 }
 
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index fce476275e16..11de17924910 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -139,8 +139,7 @@ struct cpuidle_driver {
 
 #ifdef CONFIG_CPU_IDLE
 extern void disable_cpuidle(void);
-extern bool cpuidle_not_available(struct cpuidle_driver *drv,
-				  struct cpuidle_device *dev);
+extern bool cpuidle_not_available(void);
 
 extern int cpuidle_select(struct cpuidle_driver *drv,
 			  struct cpuidle_device *dev,
@@ -174,8 +173,7 @@ static inline struct cpuidle_device *cpuidle_get_device(void)
 {return __this_cpu_read(cpuidle_devices); }
 #else
 static inline void disable_cpuidle(void) { }
-static inline bool cpuidle_not_available(struct cpuidle_driver *drv,
-					 struct cpuidle_device *dev)
+static inline bool cpuidle_not_available(void)
 {return true; }
 static inline int cpuidle_select(struct cpuidle_driver *drv,
 				 struct cpuidle_device *dev, bool *stop_tick)
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index dbfc2eb5ccbd..558a5c987597 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -179,7 +179,7 @@ static void cpuidle_idle_call(void)
 		return;
 	}
 
-	if (cpuidle_not_available(drv, dev)) {
+	if (cpuidle_not_available()) {
 		tick_nohz_idle_stop_tick();
 
 		default_idle_call();
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-11 18:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-11  5:54 [PATCH 0/2] s2idle fixes for systems without cpuidle Kazuki Hashimoto
2023-07-11  5:54 ` [PATCH 1/2] cpuidle: Don't pass any values to cpuidle_not_available Kazuki Hashimoto
2023-07-11  7:42   ` Peter Zijlstra
2023-07-11 18:48     ` Kazuki Hashimoto
2023-07-11  5:54 ` [PATCH 2/2] PM: s2idle: Fully prevent the system from entering s2idle when cpuidle isn't supported Kazuki Hashimoto
2023-07-11 17:55   ` Rafael J. Wysocki
2023-07-11 18:38     ` Kazuki H
  -- strict thread matches above, loose matches on Subject: below --
2023-03-16  6:37 [PATCH 1/2] cpuidle: Don't pass any values to cpuidle_not_available Kazuki H
2023-03-16  7:43 ` Kazuki H

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).