On Sat, 20 May 2000, Christopher Thompson wrote:

> I have now completed and tested my second TSC patch.  It is available at:
> http://hypocrite.org/linux/tsc.patch.new.tar.gz
> 
> This works with 2.3.99-pre8 at least, probably most others.  This one disables
> use of the TSC by an option in the configuration (i.e. make config, make
> menuconfig, whatever) and therefore has NO performance impact on TSC-enabled
> kernels.  The disadvantage is that this is another option to set in your
> configuration.

 Hmm, a while ago I prepared a patch to disable TSC via a "notsc" kernel
command line option.  I needed it to test SMP support for TSC-less
systems.  While it makes the kernel larger by a few instructions, all of
them are located in the init section and are discarded after a bootup.
There is no runtime impact on the patch. 

 I believe this one might be useful for someone.  It applies cleanly to
2.3.99-pre8.

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [EMAIL PROTECTED], PGP key available        +

diff -u --recursive --new-file linux-2.3.99-pre6-2.macro/arch/i386/kernel/setup.c 
linux-2.3.99-pre6-2/arch/i386/kernel/setup.c
--- linux-2.3.99-pre6-2.macro/arch/i386/kernel/setup.c  Fri Apr 14 19:40:25 2000
+++ linux-2.3.99-pre6-2/arch/i386/kernel/setup.c        Tue Apr 18 22:10:16 2000
@@ -1535,6 +1535,18 @@
        return p - buffer;
 }
 
+#ifndef CONFIG_X86_TSC
+static int tsc_disable = 0;
+
+static int __init tsc_setup(char *str)
+{
+       tsc_disable = 1;
+       return 1;
+}
+
+__setup("notsc", tsc_setup);
+#endif
+
 int cpus_initialized = 0;
 unsigned long cpu_initialized = 0;
 
@@ -1558,6 +1570,13 @@
 
        if (cpu_has_vme || cpu_has_tsc || cpu_has_de)
                clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
+#ifndef CONFIG_X86_TSC
+       if (tsc_disable && cpu_has_tsc) {
+               printk("Disabling TSC...\n");
+               boot_cpu_data.x86_capability &= ~X86_FEATURE_TSC;
+               set_in_cr4(X86_CR4_TSD);
+       }
+#endif
 
        __asm__ __volatile__("lgdt %0": "=m" (gdt_descr));
        __asm__ __volatile__("lidt %0": "=m" (idt_descr));
diff -u --recursive --new-file linux-2.3.99-pre6-2.macro/init/main.c 
linux-2.3.99-pre6-2/init/main.c
--- linux-2.3.99-pre6-2.macro/init/main.c       Fri Apr 14 19:40:33 2000
+++ linux-2.3.99-pre6-2/init/main.c     Tue Apr 18 09:01:58 2000
@@ -481,12 +481,12 @@
        lock_kernel();
        printk(linux_banner);
        setup_arch(&command_line);
+       parse_options(command_line);
        trap_init();
        init_IRQ();
        sched_init();
        time_init();
        softirq_init();
-       parse_options(command_line);
 
        /*
         * HACK ALERT! This is early. We're enabling the console before

-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/dmentre/smp-howto/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]

Reply via email to