aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/kernel/process.c
diff options
context:
space:
mode:
authorfwu <fwu@marvell.com>2012-09-29 04:14:03 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-10-18 11:06:43 +0100
commit871df85a592396b36d4c40b3860e8d7373626552 (patch)
tree07784f904b4892d1797129cc69314e5e5f85828b /arch/arm/kernel/process.c
parent153cd8e839b5729358d4e5c3371e7509ee5ac96a (diff)
ARM: 7544/1: Add BUG_ON when hlt counter is wrongly used
1. On ARM platform, "nohlt" can be used to prevent core from idle process, returning immediately. 2. There are two interfaces, exported for other modules, named "disable_hlt" and "enable_hlt" are used to enable/disable the cpuidle mechanism by increasing/decreasing "hlt_counter". Disable_hlt and enable_hlt are paired operation, when you first call disable_hlt and then enable_hlt, the semantics are right. 3. There is no obvious constraint to prevent user(driver/module) code to prevent the case that enable_hlt is ahead of disable_hlt, which is a fatal operation on kernel state change from user, and there is no any WARNING or notification if the case happens in current kernel code. This patch aims to report BUG when the case happens, just like what the kernel do when enable_irq is ahead of disable_irq. Link: https://patchwork.kernel.org/patch/1527881/ Signed-off-by: fwu <fwu@marvell.com> Signed-off-by: YiLu Mao <ylmao@marvell.com> Signed-off-by: Ning Jiang <ning.jiang@marvell.com> Acked-by: Nicolas Pitre Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/process.c')
-rw-r--r--arch/arm/kernel/process.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 90084a6de35..45fd05186a3 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -70,6 +70,7 @@ EXPORT_SYMBOL(disable_hlt);
void enable_hlt(void)
{
hlt_counter--;
+ BUG_ON(hlt_counter < 0);
}
EXPORT_SYMBOL(enable_hlt);