mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems
@ 2003-03-18 19:05 Jerry Cooperstein
  2003-03-18 20:32 ` Stephen Hemminger
  0 siblings, 1 reply; 10+ messages in thread
From: Jerry Cooperstein @ 2003-03-18 19:05 UTC (permalink / raw)
  To: linux-kernel

Since 2.5.60 my thinkpad keyboard repeat rate has been erratic when
started up on battery power; plugging into AC after startup only makes
it worse.  Starting up on AC is fine.  Compiling without apm in any
form is fine.

I posted on this a month ago and noone had solutions although I got
several emails from folks with similarly afflicted machines.

Since then I've noticed that I also get a bad time skew, with the
system clock jumping forward.

I'm pretty sure the problem arose with the introduction of the
seqlock/unlock interface to protect xtime_lock instead of a regular rw
lock.  Short of trying to back the whole thing out, does any one have
similar observations, suggestions, solutions?

======================================================================
 Jerry Cooperstein,  Senior Consultant,  <coop@axian.com>
 Axian, Inc., Software Consulting and Training
 4800 SW Griffith Dr., Ste. 202,  Beaverton, OR  97005 USA
 http://www.axian.com/               
======================================================================

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

* Re: seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems
  2003-03-18 19:05 seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems Jerry Cooperstein
@ 2003-03-18 20:32 ` Stephen Hemminger
  2003-03-18 20:59   ` Jerry Cooperstein
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2003-03-18 20:32 UTC (permalink / raw)
  To: Jerry Cooperstein; +Cc: Linux Kernel Mailing List

On Tue, 2003-03-18 at 11:05, Jerry Cooperstein wrote:
> Since 2.5.60 my thinkpad keyboard repeat rate has been erratic when
> started up on battery power; plugging into AC after startup only makes
> it worse.  Starting up on AC is fine.  Compiling without apm in any
> form is fine.
> 
> I posted on this a month ago and noone had solutions although I got
> several emails from folks with similarly afflicted machines.
> 
> Since then I've noticed that I also get a bad time skew, with the
> system clock jumping forward.
> 
> I'm pretty sure the problem arose with the introduction of the
> seqlock/unlock interface to protect xtime_lock instead of a regular rw
> lock.  Short of trying to back the whole thing out, does any one have
> similar observations, suggestions, solutions?

Does this notebook vary the clock rate? If so then using TSC for 
time of day clock is probably a problem.  Try booting with notsc.


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

* Re: seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems
  2003-03-18 20:32 ` Stephen Hemminger
@ 2003-03-18 20:59   ` Jerry Cooperstein
  2003-03-18 23:34     ` john stultz
                       ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jerry Cooperstein @ 2003-03-18 20:59 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Linux Kernel Mailing List

On Tue, Mar 18, 2003 at 12:32:24PM -0800, Stephen Hemminger wrote:
> On Tue, 2003-03-18 at 11:05, Jerry Cooperstein wrote:
> > Since 2.5.60 my thinkpad keyboard repeat rate has been erratic when
....

> 
> Does this notebook vary the clock rate? If so then using TSC for 
> time of day clock is probably a problem.  Try booting with notsc.

Yes the notebook varies the clock rate -- its about 150MHZ with
batter power, 500 MHZ on AC.

I tried booting with notsc, the results were:

for kernels through 2.5.63:  kernel panic on boot, message saying pentium+
requires tsc

for 2.5.64, 2.5.65:  no failure, but no help.

Merci

coop

======================================================================
 Jerry Cooperstein,  Senior Consultant,  <coop@axian.com>
 Axian, Inc., Software Consulting and Training
 4800 SW Griffith Dr., Ste. 202,  Beaverton, OR  97005 USA
 http://www.axian.com/               
======================================================================


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

* Re: seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems
  2003-03-18 20:59   ` Jerry Cooperstein
@ 2003-03-18 23:34     ` john stultz
  2003-03-19  0:21       ` Jerry Cooperstein
  2003-03-18 23:57     ` seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems Stephen Hemminger
       [not found]     ` <1048022686.6291.6.camel@dell_ss3.pdx.osdl.net>
  2 siblings, 1 reply; 10+ messages in thread
From: john stultz @ 2003-03-18 23:34 UTC (permalink / raw)
  To: Jerry Cooperstein, linux-kernel

Jerry Cooperstein wrote:

>> Does this notebook vary the clock rate? If so then using TSC for
>> time of day clock is probably a problem.  Try booting with notsc.
> 
> I tried booting with notsc, the results were:
> 
> for kernels through 2.5.63:  kernel panic on boot, message saying pentium+
> requires tsc
> 
> for 2.5.64, 2.5.65:  no failure, but no help.

Check the boot msgs. You're kernel is compiled w/ CONFIG_X86_TSC, so it
should print a warning as such stating it is ignoring the notsc option.

Try compiling the kernel for i386 and the kernel then boot w/ notsc. Do be
warned, if you're running w/ an i686 compiled glibc your box will hang
after the "Freeing unused kernel memory: " msg. 

Another thing to check is if the lost-tick compensation code is biting you.
Try commenting out the "detect_lost_tick()" call from timer_interrupt() in
arch/i386/kernel/time.c

Let me know if that changes anything.

thanks
-john



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

* Re: seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems
  2003-03-18 20:59   ` Jerry Cooperstein
  2003-03-18 23:34     ` john stultz
@ 2003-03-18 23:57     ` Stephen Hemminger
       [not found]     ` <1048022686.6291.6.camel@dell_ss3.pdx.osdl.net>
  2 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2003-03-18 23:57 UTC (permalink / raw)
  To: Jerry Cooperstein; +Cc: Linux Kernel Mailing List

On Tue, 2003-03-18 at 12:59, Jerry Cooperstein wrote:
> On Tue, Mar 18, 2003 at 12:32:24PM -0800, Stephen Hemminger wrote:
> > On Tue, 2003-03-18 at 11:05, Jerry Cooperstein wrote:
> > > Since 2.5.60 my thinkpad keyboard repeat rate has been erratic when
> ....
> 
> > 
> > Does this notebook vary the clock rate? If so then using TSC for 
> > time of day clock is probably a problem.  Try booting with notsc.
> 
> Yes the notebook varies the clock rate -- its about 150MHZ with
> batter power, 500 MHZ on AC.

Part of the problem may be that the clock rate can change but the
cpu frequency code can't support the Intel SpeedStep.  

Maybe, someone with more direct experience with laptop's can help.


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

* Re: seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems
  2003-03-18 23:34     ` john stultz
@ 2003-03-19  0:21       ` Jerry Cooperstein
  2003-03-19  0:38         ` [PATCH] boot time parameter to turn of TSC usage Stephen Hemminger
  0 siblings, 1 reply; 10+ messages in thread
From: Jerry Cooperstein @ 2003-03-19  0:21 UTC (permalink / raw)
  To: john stultz; +Cc: linux-kernel, hemminger

On Tue, Mar 18, 2003 at 03:34:32PM -0800, john stultz wrote:
... 
> Check the boot msgs. You're kernel is compiled w/ CONFIG_X86_TSC, so it
> should print a warning as such stating it is ignoring the notsc option.

yep, I missed it, the experiment was never performed.

> 
> Try compiling the kernel for i386 and the kernel then boot w/ notsc. Do be
> warned, if you're running w/ an i686 compiled glibc your box will hang
> after the "Freeing unused kernel memory: " msg. 

I compiled for no TSC using Stephen Hemminger's patch -- that worked.

> 
> Another thing to check is if the lost-tick compensation code is biting you.
> Try commenting out the "detect_lost_tick()" call from timer_interrupt() in
> arch/i386/kernel/time.c

I will try that out too, even though problem now seems 'solved.'

> 
> Let me know if that changes anything.
> 
> thanks
> -john

thanks

coop



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

* Re: seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems
       [not found]                 ` <1048030151.6297.71.camel@dell_ss3.pdx.osdl.net>
@ 2003-03-19  0:27                   ` Jerry Cooperstein
  0 siblings, 0 replies; 10+ messages in thread
From: Jerry Cooperstein @ 2003-03-19  0:27 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: linux-kernel, coop

On Tue, Mar 18, 2003 at 03:29:11PM -0800, Stephen Hemminger wrote:
.....
> On Tue, 2003-03-18 at 14:58, Jerry Cooperstein wrote:
> > I tried turning on SpeedStep (which I didn't think I had...) and
> > I got:
> > 
> > cpufreq: Intel(R) SpeedStep(TM) for this chipset not (yet) available.
> 
> Unfortunately, Intel SpeedStep is proprietary and they won't tell Linux
> how to manage it.  The best thing might be to figure out how to force kernel
> not to use TSC on this beast.
> 
> Can you take CONFIG_X86_TSC out of your config.  Then the kernel shouldn't
> use TSC.

Well if you remove CONFIG_X86_TSC out of your .config file, the kernel
build always puts it back in (i guess it believes it knows best).  So
i just used your patch below, and indeed it does work; clock speed is
now normal as is keyboard repeat rate. Immediate problem solved 
--but case not closed. 

I have to go back and clean out the earlier patches which didn't help
on their own, but I doubt they make a difference.  I'll leave it to you
to submit this as patch to the kernel, as I'm not sure it is solving
or hiding the problem.  But it works for me:>

At any rate, there is something in the seqlock stuff that broke this
stuff.  I'll keep trying to figure out exactly what.  

Thanks for all your hard work.  I appreciate it.

======================================================================
 Jerry Cooperstein,  Senior Consultant,  <coop@axian.com>
 Axian, Inc., Software Consulting and Training
 4800 SW Griffith Dr., Ste. 202,  Beaverton, OR  97005 USA
 http://www.axian.com/               
======================================================================


> 
> Or try this patch and boot with "notsclock"
> 
> 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	Tue Mar 18 15:28:10 2003
> +++ b/arch/i386/kernel/timers/timer_tsc.c	Tue Mar 18 15:28:10 2003
> @@ -15,6 +15,7 @@
>  #include <asm/processor.h>
>  
>  int tsc_disable __initdata = 0;
> +static int tsc_clock_disable __initdata = 0;
>  
>  extern spinlock_t i8253_lock;
>  
> @@ -241,6 +242,13 @@
>  };
>  #endif
>  
> +/* Don't use TSC for time of day clock */
> +static int __init tsc_noclock_setup(char *str)
> +{
> +	tsc_clock_disable = 1;
> +	return 1;
> +}
> +__setup("notsclock", tsc_noclock_setup);
>  
>  static int init_tsc(void)
>  {
> @@ -273,7 +281,7 @@
>  	cpufreq_register_notifier(&time_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
>  #endif
>  
> -	if (cpu_has_tsc) {
> +	if (cpu_has_tsc && !tsc_clock_disable) {
>  		unsigned long tsc_quotient = calibrate_tsc();
>  		if (tsc_quotient) {
>  			fast_gettimeoffset_quotient = tsc_quotient;
> 

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

* [PATCH] boot time parameter to turn of TSC usage
  2003-03-19  0:21       ` Jerry Cooperstein
@ 2003-03-19  0:38         ` Stephen Hemminger
  2003-03-19  0:39           ` Andrew Morton
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2003-03-19  0:38 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: john stultz, Linux Kernel Mailing List, Jerry Cooperstein

For machines that don't want to cooperate and have bad TSC counter and/or
change CPU frequency without change support.

This fixes the problem on Jerry Cooperstein's PIII laptop.
Could be useful for other people and tech support situations.

Please consider applying.
Thanks
Steve


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	Tue Mar 18 15:28:10 2003
+++ b/arch/i386/kernel/timers/timer_tsc.c	Tue Mar 18 15:28:10 2003
@@ -15,6 +15,7 @@
 #include <asm/processor.h>
 
 int tsc_disable __initdata = 0;
+static int tsc_clock_disable __initdata = 0;
 
 extern spinlock_t i8253_lock;
 
@@ -241,6 +242,13 @@
 };
 #endif
 
+/* Don't use TSC for time of day clock */
+static int __init tsc_noclock_setup(char *str)
+{
+	tsc_clock_disable = 1;
+	return 1;
+}
+__setup("notsclock", tsc_noclock_setup);
 
 static int init_tsc(void)
 {
@@ -273,7 +281,7 @@
 	cpufreq_register_notifier(&time_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
 #endif
 
-	if (cpu_has_tsc) {
+	if (cpu_has_tsc && !tsc_clock_disable) {
 		unsigned long tsc_quotient = calibrate_tsc();
 		if (tsc_quotient) {
 			fast_gettimeoffset_quotient = tsc_quotient;




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

* Re: [PATCH] boot time parameter to turn of TSC usage
  2003-03-19  0:38         ` [PATCH] boot time parameter to turn of TSC usage Stephen Hemminger
@ 2003-03-19  0:39           ` Andrew Morton
  2003-03-19  1:03             ` Stephen Hemminger
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Morton @ 2003-03-19  0:39 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: torvalds, johnstul, linux-kernel, coop

Stephen Hemminger <shemminger@osdl.org> wrote:
>
> For machines that don't want to cooperate and have bad TSC counter and/or
> change CPU frequency without change support.
> 
> This fixes the problem on Jerry Cooperstein's PIII laptop.
> Could be useful for other people and tech support situations.

Is there no way in which this can be auto-detected?

> +__setup("notsclock", tsc_noclock_setup);

People have recently worked to make Documentation/kernel-parameters.txt
relatively up-to-date.  Please try to remember to keep it in sync...



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

* Re: [PATCH] boot time parameter to turn of TSC usage
  2003-03-19  0:39           ` Andrew Morton
@ 2003-03-19  1:03             ` Stephen Hemminger
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2003-03-19  1:03 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linus Torvalds, johnstul, Linux Kernel Mailing List, Jerry Cooperstein

On Tue, 2003-03-18 at 16:39, Andrew Morton wrote:
> Stephen Hemminger <shemminger@osdl.org> wrote:
> >
> > For machines that don't want to cooperate and have bad TSC counter and/or
> > change CPU frequency without change support.
> > 
> > This fixes the problem on Jerry Cooperstein's PIII laptop.
> > Could be useful for other people and tech support situations.
> 
> Is there no way in which this can be auto-detected?

Will leave that for someone with more direct knowledge access to
the chipset info.

> 
> > +__setup("notsclock", tsc_noclock_setup);
> 
> People have recently worked to make Documentation/kernel-parameters.txt
> relatively up-to-date.  Please try to remember to keep it in sync...
> 

--- kernel-parameters.txt.orig	2003-03-18 08:36:39.000000000 -0800
+++ kernel-parameters.txt.new	2003-03-18 17:01:32.000000000 -0800
@@ -627,7 +627,12 @@
 
 	nosync		[HW,M68K] Disables sync negotiation for all devices.
 
-	notsc		[BUGS=IA-32] Disable Time Stamp Counter
+	notsc		[BUGS=IA-32] Disable Time Stamp Counter.
+			Turns off TSC in processor. Kernel must
+			be compiled without TSC support.
+	
+	notsclock	[BUGS=IA-32] Tells kernel not to use 
+			Time Stamp Counter for gettimeofday. 
 
 	nousb		[USB] Disable the USB subsystem
 




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

end of thread, other threads:[~2003-03-19  0:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-18 19:05 seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems Jerry Cooperstein
2003-03-18 20:32 ` Stephen Hemminger
2003-03-18 20:59   ` Jerry Cooperstein
2003-03-18 23:34     ` john stultz
2003-03-19  0:21       ` Jerry Cooperstein
2003-03-19  0:38         ` [PATCH] boot time parameter to turn of TSC usage Stephen Hemminger
2003-03-19  0:39           ` Andrew Morton
2003-03-19  1:03             ` Stephen Hemminger
2003-03-18 23:57     ` seqlock/unlock(&xtime_lock) problems cause keyboard, time skew problems Stephen Hemminger
     [not found]     ` <1048022686.6291.6.camel@dell_ss3.pdx.osdl.net>
     [not found]       ` <20030318214101.GA4527@p3.attbi.com>
     [not found]         ` <1048025052.6294.16.camel@dell_ss3.pdx.osdl.net>
     [not found]           ` <20030318222313.GA4831@p3.attbi.com>
     [not found]             ` <1048027027.6297.33.camel@dell_ss3.pdx.osdl.net>
     [not found]               ` <20030318225801.GC4831@p3.attbi.com>
     [not found]                 ` <1048030151.6297.71.camel@dell_ss3.pdx.osdl.net>
2003-03-19  0:27                   ` Jerry Cooperstein

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

all inboxes | Powered by JetHome®