Linus, all
In my exuberance to remove #ifdef CONFIG_X86_TSC, I accidentally yanked
one that is needed as long as the symbol itself exists. I've actually
been sitting on this patch for a while, thinking I would get around to
killing off the remaining uses of _X86_TSC, but I've just been too
swamped to get around to it.
This patch ensures that the "notsc" boot parameter is ignored (with a
warning) if the option is passed to a kernel that has been compiled with
CONFIG_X86_TSC. Currently the code will unreasonably panic when this
occurs.
And since this patch does add an #ifdef _X86_TSC, as a show of goodwill,
I'll follow this patch with another that removes one instance of
_X86_TSC.
Please apply,
thanks
-john
PS: If anyone is looking for a little project, the usage in pkt_sched.h
and profile.h (include/net) could use some attention :)
diff -Nru a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
--- a/arch/i386/kernel/timers/timer_tsc.c Mon Feb 24 20:57:33 2003
+++ b/arch/i386/kernel/timers/timer_tsc.c Mon Feb 24 20:57:33 2003
@@ -299,6 +299,7 @@
return -ENODEV;
}
+#ifndef CONFIG_X86_TSC
/* disable flag for tsc. Takes effect by clearing the TSC cpu flag
* in cpu/common.c */
static int __init tsc_setup(char *str)
@@ -306,7 +307,14 @@
tsc_disable = 1;
return 1;
}
-
+#else
+static int __init tsc_setup(char *str)
+{
+ printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, "
+ "cannot disable TSC.\n");
+ return 1;
+}
+#endif
__setup("notsc", tsc_setup);
Linus, All,
As promised, here is a minor cleanup that removes the usage of
CONFIG_X86_TSC in get_cycles(), replacing it with a runtime conditional
of if(cpu_has_tsc).
Andi: I've already posted this a few times without complaint, but since
you didn't like my playing with get_cycles() last time, let me know if
have any issues with this.
thanks
-john
diff -Nru a/include/asm-i386/timex.h b/include/asm-i386/timex.h
--- a/include/asm-i386/timex.h Mon Feb 24 21:09:32 2003
+++ b/include/asm-i386/timex.h Mon Feb 24 21:09:32 2003
@@ -40,14 +40,10 @@
static inline cycles_t get_cycles (void)
{
-#ifndef CONFIG_X86_TSC
- return 0;
-#else
- unsigned long long ret;
-
- rdtscll(ret);
+ unsigned long long ret = 0;
+ if(cpu_has_tsc)
+ rdtscll(ret);
return ret;
-#endif
}
extern unsigned long cpu_khz;