[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1331770181-800-1-git-send-email-daniel.lezcano@linaro.org>
Date: Thu, 15 Mar 2012 01:09:41 +0100
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: sfr@...b.auug.org.au
Cc: akpm@...ux-foundation.org, rob.lee@...aro.org, j-pihet@...com,
khilman@...com, deepthi@...ux.vnet.ibm.com,
dan.carpenter@...cle.com, linux-next@...r.kernel.org,
linux-kernel@...r.kernel.org, hughd@...gle.com,
amit.kucheria@...aro.org
Subject: [PATCH] cpuidle : fix random hangs with intel_idle
The cpuidle consolidation inverts the local_irq_enable for
the poll_idle function with CPU_RELAX.
Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
Reported-by: Hugh Dickins <hughd@...gle.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists