Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98291
b: refs/heads/master
c: df17b1d
h: refs/heads/master
i:
  98289: da8f5ce
  98287: 46b891d
v: v3
  • Loading branch information
Mikael Pettersson authored and Ingo Molnar committed Jun 19, 2008
1 parent 713876a commit 851cef0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 75118a82e21cafb4a82b53bb85d1c7689787e046
refs/heads/master: df17b1d990fc214f033c5588e58216ec941591e0
18 changes: 8 additions & 10 deletions trunk/arch/x86/kernel/tsc_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

#include "mach_timer.h"

static int tsc_disabled;
/* native_sched_clock() is called before tsc_init(), so
we must start with the TSC soft disabled to prevent
erroneous rdtsc usage on !cpu_has_tsc processors */
static int tsc_disabled = -1;

/*
* On some systems the TSC frequency does not
Expand Down Expand Up @@ -402,25 +405,20 @@ void __init tsc_init(void)
{
int cpu;

if (!cpu_has_tsc || tsc_disabled) {
/* Disable the TSC in case of !cpu_has_tsc */
tsc_disabled = 1;
if (!cpu_has_tsc || tsc_disabled > 0)
return;
}

cpu_khz = calculate_cpu_khz();
tsc_khz = cpu_khz;

if (!cpu_khz) {
mark_tsc_unstable("could not calculate TSC khz");
/*
* We need to disable the TSC completely in this case
* to prevent sched_clock() from using it.
*/
tsc_disabled = 1;
return;
}

/* now allow native_sched_clock() to use rdtsc */
tsc_disabled = 0;

printk("Detected %lu.%03lu MHz processor.\n",
(unsigned long)cpu_khz / 1000,
(unsigned long)cpu_khz % 1000);
Expand Down

0 comments on commit 851cef0

Please sign in to comment.