The cpuidle consolidation inverts the local_irq_enable for
the poll_idle function with CPU_RELAX.
Signed-off-by: Daniel Lezcano <redacted>
Reported-by: Hugh Dickins <hughd@google.com>
---
drivers/cpuidle/cpuidle.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 56de5f7..4869b55 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -213,20 +213,25 @@ int cpuidle_wrap_enter(struct cpuidle_device *dev,
}
#ifdef CONFIG_ARCH_HAS_CPU_RELAX
-static inline int __poll_idle(struct cpuidle_device *dev,
+static int poll_idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{
+ ktime_t t1, t2;
+ s64 diff;
+
+ t1 = ktime_get();
+ local_irq_enable();
while (!need_resched())
cpu_relax();
- return index;
-}
+ t2 = ktime_get();
+ diff = ktime_to_us(ktime_sub(t2, t1));
+ if (diff > INT_MAX)
+ diff = INT_MAX;
-static int poll_idle(struct cpuidle_device *dev,
- struct cpuidle_driver *drv, int index)
-{
- return cpuidle_wrap_enter(dev, drv, index,
- __poll_idle);
+ dev->last_residency = (int) diff;
+
+ return index;
}
static void poll_idle_init(struct cpuidle_driver *drv)--
1.7.5.4