[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0908140753370.1283@localhost.localdomain>
Date: Fri, 14 Aug 2009 08:05:10 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Suresh Siddha <suresh.b.siddha@...el.com>
cc: mingo@...e.hu, hpa@...or.com, linux-kernel@...r.kernel.org,
venkatesh.pallipadi@...el.com, len.brown@...el.com
Subject: Re: [patch] clockevents_notify() need to be called with irq's
enabled
On Thu, 13 Aug 2009, Suresh Siddha wrote:
> From: Suresh Siddha <suresh.b.siddha@...el.com>
> Subject: clockevents_notify() need to be called with irq's enabled
>
> Currently clockevents_notify() is called with interrupts enabled at some
> places and interrupts disabled at some other places.
The only place I can see which calls clockevents_notify with
interrupts enabled is the hrtimer cpu hotplug code.
I'm a bit wary to enable interrupts all over the place in sensitive
corners like ACPI idle code ...
Why don't we just do the obvious and take clockevents_lock irqsave ?
Thanks,
tglx
---
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index a6dcd67..e43c4b6 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -137,11 +137,12 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,
*/
int clockevents_register_notifier(struct notifier_block *nb)
{
+ unsigned long flags;
int ret;
- spin_lock(&clockevents_lock);
+ spin_lock_irqsave(&clockevents_lock, flags);
ret = raw_notifier_chain_register(&clockevents_chain, nb);
- spin_unlock(&clockevents_lock);
+ spin_unlock_irqrestore(&clockevents_lock, flags);
return ret;
}
@@ -181,13 +182,13 @@ void clockevents_register_device(struct clock_event_device *dev)
BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
BUG_ON(!dev->cpumask);
- spin_lock(&clockevents_lock);
+ spin_lock_irqsave(&clockevents_lock, flags);
list_add(&dev->list, &clockevent_devices);
clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
clockevents_notify_released();
- spin_unlock(&clockevents_lock);
+ spin_lock_irqrestore(&clockevents_lock, flags);
}
EXPORT_SYMBOL_GPL(clockevents_register_device);
@@ -235,8 +236,9 @@ void clockevents_exchange_device(struct clock_event_device *old,
void clockevents_notify(unsigned long reason, void *arg)
{
struct list_head *node, *tmp;
+ unsigned long flags;
- spin_lock(&clockevents_lock);
+ spin_lock_irqsave(&clockevents_lock, flags);
clockevents_do_notify(reason, arg);
switch (reason) {
@@ -251,7 +253,7 @@ void clockevents_notify(unsigned long reason, void *arg)
default:
break;
}
- spin_unlock(&clockevents_lock);
+ spin_unlock_irqrestore(&clockevents_lock, flags);
}
EXPORT_SYMBOL_GPL(clockevents_notify);
#endif
--
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