From: Xiaotian Feng <dfeng@redhat.com>
To: tglx@linutronix.de, damm@igel.co.jp,
hsweeten@visionengravers.com, akpm@linux-foundation.org,
venkatesh.pallipadi@intel.com
Cc: linux-kernel@vger.kernel.org, Xiaotian Feng <dfeng@redhat.com>
Subject: [PATCH 3/4] clockevents: add device to clockevent_devices list if notify ADD success
Date: Thu, 10 Dec 2009 21:07:38 +0800 [thread overview]
Message-ID: <1260450459-18072-4-git-send-email-dfeng@redhat.com> (raw)
In-Reply-To: <1260450459-18072-3-git-send-email-dfeng@redhat.com>
When we register new clock_event_device, CLOCK_EVT_NOTIFY_ADD was notified,
but tick_check_new_device may fail to use new device, we should only add
device to clockevent_devices list when tick_check_new_device success.
Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Magnus Damm <damm@igel.co.jp>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
---
kernel/time/clockevents.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 980c2c0..69d6c58 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -164,11 +164,14 @@ static int clockevents_do_notify(unsigned long reason, void *dev)
static void clockevents_notify_released(void)
{
struct clock_event_device *dev, *tmp;
+ int ret;
list_for_each_entry_safe(dev, tmp, &clockevents_released, list) {
- list_del(&dev->list);
- list_add(&dev->list, &clockevent_devices);
- clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
+ ret = clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
+ if (ret == NOTIFY_STOP) {
+ list_del(&dev->list);
+ list_add(&dev->list, &clockevent_devices);
+ }
}
}
@@ -179,15 +182,19 @@ static void clockevents_notify_released(void)
void clockevents_register_device(struct clock_event_device *dev)
{
unsigned long flags;
+ int ret;
BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
BUG_ON(!dev->cpumask);
spin_lock_irqsave(&clockevents_lock, flags);
- list_add(&dev->list, &clockevent_devices);
- clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
- clockevents_notify_released();
+ ret = clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
+ if (ret == NOTIFY_STOP) {
+ list_add(&dev->list, &clockevent_devices);
+ clockevents_notify_released();
+ } else
+ list_add(&dev->list, &clockevents_released);
spin_unlock_irqrestore(&clockevents_lock, flags);
}
next prev parent reply other threads:[~2009-12-10 13:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-10 13:07 [RFC PATCH 0/4] clockevents: fix clockevent_devices list corruption after cpu hotplug Xiaotian Feng
2009-12-10 13:07 ` [PATCH 1/4] clockevents: use list_for_each_entry_safe Xiaotian Feng
2009-12-10 13:07 ` [PATCH 2/4] clockevents: convert clockevents_do_notify to int Xiaotian Feng
2009-12-10 13:07 ` Xiaotian Feng [this message]
2009-12-10 13:07 ` [PATCH 4/4] clockevents: remove related device from clockevents_released list when cpu is DEAD Xiaotian Feng
2009-12-10 14:35 ` [RFC PATCH 0/4] clockevents: fix clockevent_devices list corruption after cpu hotplug Thomas Gleixner
2009-12-11 2:29 ` Xiaotian Feng
2010-01-17 9:28 ` Ozan Çağlayan
2010-01-18 2:30 ` Xiaotian Feng
2010-01-18 13:51 ` Thomas Gleixner
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=1260450459-18072-4-git-send-email-dfeng@redhat.com \
--to=dfeng@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=damm@igel.co.jp \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--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