lkml.org 
[lkml]   [2012]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] cpuidle : fix random hangs with intel_idle
Date
The cpuidle consolidation inverts the local_irq_enable for
the poll_idle function with CPU_RELAX.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
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


\
 
 \ /
  Last update: 2012-03-15 01:11    [W:0.086 / U:3.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site