Skip to contentSkip to conversation

cpuidle: driver: Update microsecond values of state parameters as needed

PATCH In review Rafael J. Wysocki 2 participants 2 messages Feb 7, 2023 – Feb 9, 2023 CPU idle time management framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuidle: driver: Update microsecond values of state parameters as needed

From: Rafael J. Wysocki <[email protected]>

If the cpuidle driver provides the target residency and exit latency in nanoseconds, the corresponding values in microseconds need to be set to reflect the provided numbers in order for the sysfs interface to show them correctly, so make __cpuidle_driver_init() do that.

---
 drivers/cpuidle/driver.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/cpuidle/driver.c +4 -0
Index: linux-pm/drivers/cpuidle/driver.c
===================================================================
@@ -183,11 +183,15 @@ static void __cpuidle_driver_init(struct
 			s->target_residency_ns = s->target_residency * NSEC_PER_USEC;
 		else if (s->target_residency_ns < 0)
 			s->target_residency_ns = 0;
+		else
+			s->target_residency = s->target_residency_ns / NSEC_PER_USEC;
 
 		if (s->exit_latency > 0)
 			s->exit_latency_ns = s->exit_latency * NSEC_PER_USEC;
 		else if (s->exit_latency_ns < 0)
 			s->exit_latency_ns =  0;
+		else
+			s->exit_latency = s->exit_latency_ns / NSEC_PER_USEC;
 	}
 }
 
Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

If the cpuidle driver provides the target residency and exit latency in nanoseconds, the corresponding values in microseconds need to be set to reflect the provided numbers in order for the sysfs interface to show them correctly, so make __cpuidle_driver_init() do that.

Thanks!