From: Alex Shi <alex.shi@intel.com>
To: tglx@linutronix.de, hpa@linux.intel.com, tim.c.chen@linux.intel.com
Cc: linux-kernel@vger.kernel.org, andi.kleen@intel.com,
a.p.zijlstra@chello.nl, mingo@elte.hu
Subject: [PATCH 3/3] clocksource: fix can not set tsc as clocksource bug
Date: Thu, 4 Jul 2013 13:34:16 +0800 [thread overview]
Message-ID: <1372916056-24301-4-git-send-email-alex.shi@intel.com> (raw)
In-Reply-To: <1372916056-24301-1-git-send-email-alex.shi@intel.com>
commit 5d33b883aed81c6fbcd09c6f7c3619eee850a7e2
clocksource: Always verify highres capability
This commit will reject a clock to be system clocksource if it has no
CLOCK_SOURCE_VALID_FOR_HRES flags. Then the tsc to be rejected as
clocksource, because this flag for tsc is set in clocksource_watchdog
which run after the tsc register.
TSC registered in tsc_refine_calibration_work() and started the watchdog
at that time.
This patch re-select the clocksource after we make sure the tsc has this
flag. Fixed this bug.
Signed-off-by: Alex Shi <alex.shi@intel.com>
---
kernel/time/clocksource.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 9d6c333..3ad9f29 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -308,6 +308,8 @@ static void clocksource_watchdog(unsigned long data)
* transition into high-res mode:
*/
tick_clock_notify();
+ if (finished_booting)
+ schedule_work(&watchdog_work);
}
}
@@ -404,6 +406,7 @@ static void clocksource_dequeue_watchdog(struct clocksource *cs)
spin_unlock_irqrestore(&watchdog_lock, flags);
}
+static void clocksource_select(void);
static int clocksource_watchdog_kthread(void *data)
{
struct clocksource *cs, *tmp;
@@ -412,11 +415,14 @@ static int clocksource_watchdog_kthread(void *data)
mutex_lock(&clocksource_mutex);
spin_lock_irqsave(&watchdog_lock, flags);
- list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list)
+ list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list) {
if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
list_del_init(&cs->wd_list);
list_add(&cs->wd_list, &unstable);
}
+ if (cs->flags & CLOCK_SOURCE_VALID_FOR_HRES)
+ clocksource_select();
+ }
/* Check if the watchdog timer needs to be stopped. */
clocksource_stop_watchdog();
spin_unlock_irqrestore(&watchdog_lock, flags);
--
1.7.12
next prev parent reply other threads:[~2013-07-04 5:36 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-04 5:34 [URGENT rfc patch 0/3] tsc clocksource bug fix Alex Shi
2013-07-04 5:34 ` [PATCH 1/3] clocksource: clean up clocksource_select Alex Shi
2013-07-04 9:57 ` Thomas Gleixner
2013-07-04 10:21 ` Alex Shi
2013-07-04 10:27 ` Thomas Gleixner
2013-07-05 1:22 ` Alex Shi
2013-07-04 5:34 ` [PATCH 2/3] clockesource: set override clocksource Alex Shi
2013-07-04 10:23 ` Thomas Gleixner
2013-07-04 5:34 ` Alex Shi [this message]
2013-07-04 10:55 ` [PATCH 3/3] clocksource: fix can not set tsc as clocksource bug Thomas Gleixner
2013-07-04 13:04 ` Thomas Gleixner
2013-07-04 20:46 ` [PATCH] clocksource: Reselect clocksource when watchdog validated Thomas Gleixner
2013-07-05 1:38 ` Alex Shi
2013-07-05 9:13 ` [tip:timers/core] clocksource: Reselect clocksource when watchdog validated high-res capability tip-bot for Thomas Gleixner
2013-07-05 2:48 ` [PATCH 3/3] clocksource: fix can not set tsc as clocksource bug Alex Shi
2013-07-05 5:41 ` Thomas Gleixner
2013-07-05 6:44 ` Alex Shi
2013-07-04 7:58 ` [URGENT rfc patch 0/3] tsc clocksource bug fix Peter Zijlstra
2013-07-04 8:13 ` Alex Shi
2013-07-05 14:23 ` Frederic Weisbecker
2013-07-05 14:38 ` Peter Zijlstra
2013-07-05 15:24 ` Thomas Gleixner
2013-07-05 21:22 ` Peter Zijlstra
2013-07-05 21:50 ` Thomas Gleixner
2013-07-05 21:58 ` Borislav Petkov
2013-07-05 22:17 ` Thomas Gleixner
2013-07-06 8:37 ` Borislav Petkov
2013-07-06 10:50 ` Peter Zijlstra
2013-07-04 11:00 ` Thomas Gleixner
2013-07-04 18:11 ` Davidlohr Bueso
2013-07-04 20:27 ` Thomas Gleixner
2013-07-05 1:12 ` Alex Shi
2013-07-05 5:58 ` Thomas Gleixner
2013-07-05 6:28 ` Alex Shi
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=1372916056-24301-4-git-send-email-alex.shi@intel.com \
--to=alex.shi@intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=andi.kleen@intel.com \
--cc=hpa@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.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
all inboxes | Powered by JetHome®