From: Thomas Gleixner <tglx@linutronix.de>
To: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: mingo@elte.hu, hpa@zytor.com, linux-kernel@vger.kernel.org,
venkatesh.pallipadi@intel.com, len.brown@intel.com
Subject: Re: [patch] clockevents_notify() need to be called with irq's enabled
Date: Fri, 14 Aug 2009 08:05:10 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.00.0908140753370.1283@localhost.localdomain> (raw)
In-Reply-To: <1250203681.27006.10842.camel@localhost.localdomain>
On Thu, 13 Aug 2009, Suresh Siddha wrote:
> From: Suresh Siddha <suresh.b.siddha@intel.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
next prev parent reply other threads:[~2009-08-14 6:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-13 22:48 Suresh Siddha
2009-08-14 6:05 ` Thomas Gleixner [this message]
2009-08-14 7:26 ` Suresh Siddha
2009-08-14 8:28 ` Thomas Gleixner
2009-08-14 17:39 ` Suresh Siddha
2009-08-14 20:01 ` Thomas Gleixner
2009-08-17 21:22 ` Suresh Siddha
2009-08-17 21:27 ` Thomas Gleixner
2009-08-17 21:34 ` Suresh Siddha
2009-08-19 16:18 ` [tip:timers/urgent] clockevent: Prevent dead lock on clockevents_lock tip-bot for Suresh Siddha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.00.0908140753370.1283@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=hpa@zytor.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=suresh.b.siddha@intel.com \
--cc=venkatesh.pallipadi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome