public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH][2.5] notsc option needs some attention/TLC
@ 2002-11-09 12:00 Mikael Pettersson
  2002-11-09 13:05 ` Alan Cox
  0 siblings, 1 reply; 16+ messages in thread
From: Mikael Pettersson @ 2002-11-09 12:00 UTC (permalink / raw)
  To: linux-kernel, zwane; +Cc: torvalds

Zwane Mwaikambo writes:
 > notsc doesn't work on a box with a TSC, when we need need the option the 
 > most...
 > 
 > Index: linux-2.5.46-bochs/arch/i386/kernel/cpu/common.c
 > ===================================================================
 > RCS file: /build/cvsroot/linux-2.5.46/arch/i386/kernel/cpu/common.c,v
 > retrieving revision 1.1.1.1
 > diff -u -r1.1.1.1 common.c
 > --- linux-2.5.46-bochs/arch/i386/kernel/cpu/common.c	5 Nov 2002 01:47:31 -0000	1.1.1.1
 > +++ linux-2.5.46-bochs/arch/i386/kernel/cpu/common.c	9 Nov 2002 03:10:45 -0000
 > @@ -12,6 +12,11 @@
 >  
 >  static int cachesize_override __initdata = -1;
 >  static int disable_x86_fxsr __initdata = 0;
 > +#ifdef CONFIG_X86_TSC
 > +static int tsc_disable __initdata = 0;
 > +#else
 > +#define tsc_disable	1
 > +#endif

CONFIG_X86_TSC means "I have a TSC, period" not "I may have a TSC".
It's an optimisation option, not a "try this" option.

If we configure for "I have a TSC, period" you add the option
to disable it, which nullifies any benefit of the config option
in the first place since we can't assume TSC presence any more.
If we don't configure for TSC, you force tsc_disable, which means
that a generic kernel _can't_ use the TSC.

People with broken TSCs need to run non-TSC-assuming kernels.

/Mikael

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [PATCH][2.5] notsc option needs some attention/TLC
@ 2002-11-09 17:52 J.E.J. Bottomley
  2002-11-10  5:32 ` Zwane Mwaikambo
  0 siblings, 1 reply; 16+ messages in thread
From: J.E.J. Bottomley @ 2002-11-09 17:52 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: linux-kernel, James.Bottomley

> having this config option ass-backwards is mind-bogglingly confusing,
> and there seems no real reason for it. John had a plan to just put  in
> CONFIG_X86_PIT instead as the inverse of this, and delete
> CONFIG_X86_TSC. He seems to have gone off this idea for some reason I
> can't understand ... I think it solves a lot of these issues ...

Actually, this is partly my fault.  When the subarch code went in, the meaning 
of CONFIG_X86_TSC got altered to mean, 'If not y, don't use tsc at all' (so I 
could disable the TSC entirely for Voyager). Then, when code moved to 
kernel/timers we got some code with the old meaning and some with the new, 
hence the confusion.

The CONFIG_X86_PIT was something I added to try to clarify.  There are three 
cases with this:

PIT y, TSC n: Never use TSC, always use PIT
PIT y, TSC y: Try TSC at first, if it doesn't work, fall back to PIT
PIT n, TSC y: TSC always works, use it without testing.

Obviously PIT n, TSC n is bogus.

There are also two distinct usages of TSC:

1. do_fast_gettimeofday (now in timers) which *requires* the TSCs to be 
synchronised across all CPUs
2. more accurate udelay (which already has the mechanisms in place to cope 
with TSCs running at different rates).

1. is usually the reason why numa like machines want to disable the TSC 
entirely.

Linus isn't very happy with the global TSC disable patch (see 
http://marc.theaimsgroup.com/?t=103652952900006&r=1&w=2).  And wants a better 
solution.  (Then, of course, there are the additional timer options, like the 
cyclone).

James






^ permalink raw reply	[flat|nested] 16+ messages in thread
* [PATCH][2.5] notsc option needs some attention/TLC
@ 2002-11-09  4:52 Zwane Mwaikambo
  0 siblings, 0 replies; 16+ messages in thread
From: Zwane Mwaikambo @ 2002-11-09  4:52 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Linus Torvalds

notsc doesn't work on a box with a TSC, when we need need the option the 
most...

Index: linux-2.5.46-bochs/arch/i386/kernel/cpu/common.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.46/arch/i386/kernel/cpu/common.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 common.c
--- linux-2.5.46-bochs/arch/i386/kernel/cpu/common.c	5 Nov 2002 01:47:31 -0000	1.1.1.1
+++ linux-2.5.46-bochs/arch/i386/kernel/cpu/common.c	9 Nov 2002 03:10:45 -0000
@@ -12,6 +12,11 @@
 
 static int cachesize_override __initdata = -1;
 static int disable_x86_fxsr __initdata = 0;
+#ifdef CONFIG_X86_TSC
+static int tsc_disable __initdata = 0;
+#else
+#define tsc_disable	1
+#endif
 
 struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {};
 
@@ -42,24 +47,14 @@
 }
 __setup("cachesize=", cachesize_setup);
 
-#ifndef CONFIG_X86_TSC
-static int tsc_disable __initdata = 0;
-
+#ifdef CONFIG_X86_TSC
 static int __init tsc_setup(char *str)
 {
 	tsc_disable = 1;
 	return 1;
 }
-#else
-#define tsc_disable 0
-
-static int __init tsc_setup(char *str)
-{
-	printk("notsc: Kernel compiled with CONFIG_X86_TSC, cannot disable TSC.\n");
-	return 1;
-}
-#endif
 __setup("notsc", tsc_setup);
+#endif
 
 int __init get_model_name(struct cpuinfo_x86 *c)
 {

-- 
function.linuxpower.ca


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2002-11-12 11:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-09 12:00 [PATCH][2.5] notsc option needs some attention/TLC Mikael Pettersson
2002-11-09 13:05 ` Alan Cox
2002-11-09 16:34   ` Martin J. Bligh
2002-11-09 18:09   ` Zwane Mwaikambo
2002-11-09 18:51     ` Linus Torvalds
2002-11-10 19:03       ` Henning P. Schmiedehausen
2002-11-12 11:29         ` Maciej W. Rozycki
2002-11-11  1:21       ` William Lee Irwin III
2002-11-11  1:51         ` Linus Torvalds
2002-11-11  8:15           ` William Lee Irwin III
2002-11-11 13:24           ` Alan Cox
2002-11-09 19:10     ` Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2002-11-09 17:52 J.E.J. Bottomley
2002-11-10  5:32 ` Zwane Mwaikambo
2002-11-10 14:25   ` J.E.J. Bottomley
2002-11-09  4:52 Zwane Mwaikambo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox