Skip to contentSkip to conversation

cpufreq: Allow exit latency to exceed target residency

PATCH In review Rafael J. Wysocki 2 participants 3 messages Jun 17 CPU idle time management framework

lore
Share & tools
lore

Rafael J. Wysocki

author maintainer
#0 lore raw

PATCH 1/1 cpufreq: Allow exit latency to exceed target residency

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

Commit 76934e495cdc ("cpuidle: Add sanity check for exit latency and target residency") had added a check to prevent the exit latency of an idle state from exceeding its target residency that later was limited to printing a warning message in that case in commit 4bf944f3fcb6 ("cpuidle:
Warn instead of bailing out if target residency check fails").

However, a thorough code inspection with that in mind leads to the conclusion that actually there are no assumptions in cpuidle regarding the relationship between the exit latency and target residency of a given idle state. It is generally assumed that the idle states table provided by a cpuidle driver will be sorted by both the target residency and exit latency in ascending order, but that's a different matter.

Accordingly, drop the check in question along with the message printed when it triggers and the inaccurate comment preceding it.

Fixes 4bf944f3fcb6 ("cpuidle: Warn instead of bailing out if target residency check fails")
---
 drivers/cpuidle/driver.c           |    8 --------
 drivers/cpuidle/governors/ladder.c |    2 ++
 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/cpuidle/driver.c +0 -8
@@ -195,14 +195,6 @@ static void __cpuidle_driver_init(struct
 			s->exit_latency_ns =  0;
 		else
 			s->exit_latency = div_u64(s->exit_latency_ns, NSEC_PER_USEC);
-
-		/*
-		 * Warn if the exit latency of a CPU idle state exceeds its
-		 * target residency which is assumed to never happen in cpuidle
-		 * in multiple places.
-		 */
-		if (s->exit_latency_ns > s->target_residency_ns)
-			pr_warn("Idle state %d target residency too low\n", i);
 	}
 }
 
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Rafael J. Wysocki

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

Commit 76934e495cdc ("cpuidle: Add sanity check for exit latency and target residency") had added a check to prevent the exit latency of an idle state from exceeding its target residency that later was limited to printing a warning message in that case in commit 4bf944f3fcb6 ("cpuidle:
Warn instead of bailing out if target residency check fails").

However, a thorough code inspection with that in mind leads to the conclusion that actually there are no assumptions in cpuidle regarding the relationship between the exit latency and target residency of a given idle state. It is generally assumed that the idle states table provided by a cpuidle driver will be sorted by both the target residency and exit latency in ascending order, but that's a different matter.

Quoted 8 lines

Accordingly, drop the check in question along with the message printed when it triggers and the inaccurate comment preceding it.

Fixes 4bf944f3fcb6 ("cpuidle: Warn instead of bailing out if target residency check fails")
---
 drivers/cpuidle/driver.c           |    8 --------
 drivers/cpuidle/governors/ladder.c |    2 ++

ladder.c?

Quoted 10 lines
 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/cpuidle/driver.c +0 -1
@@ -195,14 +195,6 @@ static void __cpuidle_driver_init(struct
 			s->exit_latency_ns =  0;
 		else
 			s->exit_latency = div_u64(s->exit_latency_ns, NSEC_PER_USEC);
-

drivers/cpuidle/driver.c static void __cpuidle_driver_init(struct · line 200

Quoted 10 lines
drivers/cpuidle/driver.c +0 -7
-		/*
-		 * Warn if the exit latency of a CPU idle state exceeds its
-		 * target residency which is assumed to never happen in cpuidle
-		 * in multiple places.
-		 */
-		if (s->exit_latency_ns > s->target_residency_ns)
-			pr_warn("Idle state %d target residency too low\n", i);
 	}
 }
 

Fine with me, but the title is cpufreq: instead of cpuidle. If you'll fix it when applying:

author maintainer
#2 lore raw
Quoted 20 lines · Christian Loehle
Quoted 18 lines · Rafael J. Wysocki

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

Commit 76934e495cdc ("cpuidle: Add sanity check for exit latency and target residency") had added a check to prevent the exit latency of an idle state from exceeding its target residency that later was limited to printing a warning message in that case in commit 4bf944f3fcb6 ("cpuidle:
Warn instead of bailing out if target residency check fails").

However, a thorough code inspection with that in mind leads to the conclusion that actually there are no assumptions in cpuidle regarding the relationship between the exit latency and target residency of a given idle state. It is generally assumed that the idle states table provided by a cpuidle driver will be sorted by both the target residency and exit latency in ascending order, but that's a different matter.

Accordingly, drop the check in question along with the message printed when it triggers and the inaccurate comment preceding it.

Quoted 7 lines
Quoted 5 lines
Fixes 4bf944f3fcb6 ("cpuidle: Warn instead of bailing out if target residency check fails")
---
 drivers/cpuidle/driver.c           |    8 --------
 drivers/cpuidle/governors/ladder.c |    2 ++

ladder.c?

It looks like I forgot to refresh the patch.

Quoted 15 lines
Quoted 15 lines
 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/cpuidle/driver.c +0 -7
@@ -195,14 +195,6 @@ static void __cpuidle_driver_init(struct
                      s->exit_latency_ns =  0;
              else
                      s->exit_latency = div_u64(s->exit_latency_ns, NSEC_PER_USEC);
-
-             /*
-              * Warn if the exit latency of a CPU idle state exceeds its
-              * target residency which is assumed to never happen in cpuidle
-              * in multiple places.
-              */
-             if (s->exit_latency_ns > s->target_residency_ns)
Quoted 8 lines

drivers/cpuidle/driver.c static void __cpuidle_driver_init(struct · line 200

Quoted 5 lines
drivers/cpuidle/driver.c +0 -1
-                     pr_warn("Idle state %d target residency too low\n", i);
      }
 }
 

Fine with me, but the title is cpufreq: instead of cpuidle. If you'll fix it when applying:

I will.

Quoted 1 line

Thanks!