[Patch] TSC was Re: LINUX Jobs for 2.4 update

From: Christopher Thompson (chris@hypocrite.org)
Date: Wed May 24 2000 - 20:37:11 EST


On Wed, 24 May 2000, you wrote:
> To Do But Non Showstopper
> -------------------------
> Fix boards with different TSC per CPU and kill TSC use on them

Please consider the following patch which was made against -pre8 but works
cleanly with at least -pre9. You can also download this patch from
http://hypocrite.org/linux/tsc.patch.new.tar.gz.

The patch is very simple. Nobody who has tried it out has reported any
problems with this patch though possibly problems do still exist. It has
proven stable on an SMP machine with different speed CPUs for several days now.

If this patch is rejected, please follow up with me and let me know how I can
improve it so that a future patch will not be rejected.

-->cut here<--

diff -urb linux.clean/Documentation/Configure.help linux/Documentation/Configure.help
--- linux.clean/Documentation/Configure.help Fri May 12 12:43:26 2000
+++ linux/Documentation/Configure.help Sat May 20 13:13:26 2000
@@ -130,6 +130,22 @@
   If you have system with several CPU's, you do not need to say Y
   here: APIC will be used automatically.
 
+Allow CPU to use TSC
+CONFIG_X86_SMP_TSC_ENABLE
+ The TSC (Time Stamp Counter) provides a very fine-grained way to
+ keep track of time and keep multiple CPUs synchronised. Some
+ motherboards, such as the ABit BP6, allow you to use CPUs with
+ different multipliers together in an SMP configuration. Intel
+ never intended this and, when it works, it causes problems
+ keeping the CPUs synchronised.
+
+ If you have a system with CPUs running at different speeds, say
+ N here to disable use of the TSC. If your system has strange
+ timing problems (ping gives weird results, windows do not fade
+ out properly, etc.), try saying N as it is safe.
+
+ Almost everyone can say Y here.
+
 Kernel math emulation
 CONFIG_MATH_EMULATION
   Linux can emulate a math coprocessor (used for floating point
diff -urb linux.clean/arch/i386/config.in linux/arch/i386/config.in
--- linux.clean/arch/i386/config.in Thu Apr 27 16:55:14 2000
+++ linux/arch/i386/config.in Sat May 20 14:22:02 2000
@@ -98,6 +98,13 @@
        define_bool CONFIG_X86_IO_APIC y
        define_bool CONFIG_X86_LOCAL_APIC y
     fi
+else
+ if [ "$CONFIG_M586TSC" = "y" -o \
+ "$CONFIG_M686" = "y" -o \
+ "$CONFIG_MK6" = "y" -o \
+ "$CONFIG_MK7" = "y" ]; then
+ bool 'Allow CPU to use TSC' CONFIG_X86_SMP_TSC_ENABLE
+ fi
 fi
 endmenu
 
diff -urb linux.clean/arch/i386/defconfig linux/arch/i386/defconfig
--- linux.clean/arch/i386/defconfig Fri May 12 13:15:20 2000
+++ linux/arch/i386/defconfig Sat May 20 13:15:37 2000
@@ -28,6 +28,7 @@
 CONFIG_X86_POPAD_OK=y
 CONFIG_X86_L1_CACHE_BYTES=32
 CONFIG_X86_TSC=y
+CONFIG_X86_SMP_TSC_ENABLE=y
 CONFIG_X86_GOOD_APIC=y
 CONFIG_X86_PGE=y
 CONFIG_X86_USE_PPRO_CHECKSUM=y
diff -urb linux.clean/arch/i386/kernel/time.c linux/arch/i386/kernel/time.c
--- linux.clean/arch/i386/kernel/time.c Wed Mar 15 18:00:03 2000
+++ linux/arch/i386/kernel/time.c Sat May 20 14:21:44 2000
@@ -114,7 +114,7 @@
 
 #define TICK_SIZE tick
 
-#ifndef CONFIG_X86_TSC
+#if (!defined(CONFIG_X86_TSC)) || (!defined(CONFIG_X86_SMP_TSC_ENABLE))
 
 spinlock_t i8253_lock = SPIN_LOCK_UNLOCKED;
 
@@ -677,7 +677,7 @@
                          * and just enable this for the next intel chips ?
                          */
                         x86_udelay_tsc = 1;
-#ifndef do_gettimeoffset
+#if (!defined(do_gettimeoffset)) && (defined(CONFIG_X86_SMP_TSC_ENABLE))
                         do_gettimeoffset = do_fast_gettimeoffset;
 #endif
                         do_get_fast_time = do_gettimeofday;
-->cut here<--

-- 
Christopher Thompson  http://hypocrite.org/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:13 EST