From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: adeos-main <adeos-main@gna.org>
Subject: [Adeos-main] [PATCH] ipipe: x86: Harden TSC calibration
Date: Mon, 07 Mar 2011 18:03:08 +0100 [thread overview]
Message-ID: <4D750FCC.1080302@domain.hid> (raw)
When I-pipe is active, local_irq_save will still allow hardware
interrupts to occur, potentially disturbing the sensitive TSC
calibration.
Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
---
The kernel applies some sanity checks on the results, but they allow up
to 10% jitter. And this variation of the TSC frequency has been seen
in the field, causing problems when synchronizing with external clocks.
arch/x86/kernel/tsc.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 23f74eb..42c6c8a 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -409,9 +409,9 @@ unsigned long native_calibrate_tsc(void)
unsigned long flags, latch, ms, fast_calibrate;
int hpet = is_hpet_enabled(), i, loopmin;
- local_irq_save(flags);
+ local_irq_save_hw(flags);
fast_calibrate = quick_pit_calibrate();
- local_irq_restore(flags);
+ local_irq_restore_hw(flags);
if (fast_calibrate)
return fast_calibrate;
@@ -454,11 +454,11 @@ unsigned long native_calibrate_tsc(void)
* calibration, which will take at least 50ms, and
* read the end value.
*/
- local_irq_save(flags);
+ local_irq_save_hw(flags);
tsc1 = tsc_read_refs(&ref1, hpet);
tsc_pit_khz = pit_calibrate_tsc(latch, ms, loopmin);
tsc2 = tsc_read_refs(&ref2, hpet);
- local_irq_restore(flags);
+ local_irq_restore_hw(flags);
/* Pick the lowest PIT TSC calibration so far */
tsc_pit_min = min(tsc_pit_min, tsc_pit_khz);
--
1.7.1
reply other threads:[~2011-03-07 17:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4D750FCC.1080302@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=adeos-main@gna.org \
--cc=rpm@xenomai.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.