LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* tsc breaks atkbd suspend
@ 2008-02-18 13:38 Pavel Machek
  2008-02-18 14:26 ` Thomas Gleixner
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2008-02-18 13:38 UTC (permalink / raw)
  To: kernel list, jikos, Thomas Gleixner, Ingo Molnar
  Cc: Rafael J. Wysocki, Andrew Morton

Hi!

I'm trying to use the "sleepy test" here, unfortunately it locks for
10-or-so seconds.

Problem is in wait_event_timeout: timeouts take about 100x as long as
they should. Code in drivers/input/serio/libps2.c:

+       printk("ps2_command waiting event: %d\n", timeout);
        timeout = wait_event_timeout(ps2dev->wait,
                                     !(ps2dev->flags & PS2_FLAG_CMD1),timeout);

        if (ps2dev->cmdcnt && timeout > 0) {
+               printk("wait_event returned: %d\n", timeout);

                timeout = ps2_adjust_timeout(ps2dev, command, timeout);
+
+               printk("ps2_command adjust timeout: %d\n", timeout);
                wait_event_timeout(ps2dev->wait,
                                   !(ps2dev->flags & PS2_FLAG_CMD), timeout);
        }

+       printk("ps2_command receiving\n");


...and I get hang after "ps2_command adjust timeout" for 10 seconds,
while it should  wait 10msec or so.

I even tried adding:

+       printk("ps2: testing timeouts\n");
+       timeout = wait_event_timeout(ps2dev->wait, 0, 10);
+       printk("ps2: testing timeouts\n");
+       timeout = wait_event_timeout(ps2dev->wait, 0, 10);
+       printk("ps2: testing timeouts\n");
+       timeout = wait_event_timeout(ps2dev->wait, 0, 10);
+       printk("ps2: testing timeouts\n");
+       timeout = wait_event_timeout(ps2dev->wait, 0, 10);
+       printk("ps2: testing timeouts\n");
+       timeout = wait_event_timeout(ps2dev->wait, 0, 10);
+       printk("ps2: timeouts ok?\n");

before that, and yes, those wait too long, too... (but only during
suspend, they work ok during boot).

nohz=off fixes that.

notsc fixes that, too... On my system (thinkpad x60 in UP mode) tsc is
normally marked unstable very shortly after boot, so only sleepy test
can trigger this.

I believe it is very bad idea to use tsc, it does not work on 90%+ of
machines. Yes, we do detect it is broken during runtime, but that's
too late.

I believe fix is very simple:

Signed-off-by: Pavel Machek <pavel@suse.cz>
									Pavel

diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
index 43517e3..fafd9dc 100644
--- a/arch/x86/kernel/tsc_32.c
+++ b/arch/x86/kernel/tsc_32.c
@@ -298,7 +298,7 @@ static cycle_t read_tsc(void)
 
 static struct clocksource clocksource_tsc = {
 	.name			= "tsc",
-	.rating			= 300,
+	.rating			= 0,
 	.read			= read_tsc,
 	.mask			= CLOCKSOURCE_MASK(64),
 	.mult			= 0, /* to be set */
diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
index 947554d..b0148d3 100644
--- a/arch/x86/kernel/tsc_64.c
+++ b/arch/x86/kernel/tsc_64.c
@@ -306,7 +306,7 @@ static cycle_t __vsyscall_fn vread_tsc(v
 
 static struct clocksource clocksource_tsc = {
 	.name			= "tsc",
-	.rating			= 300,
+	.rating			= 0,
 	.read			= read_tsc,
 	.mask			= CLOCKSOURCE_MASK(64),
 	.shift			= 22,

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

end of thread, other threads:[~2008-02-20  6:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-18 13:38 tsc breaks atkbd suspend Pavel Machek
2008-02-18 14:26 ` Thomas Gleixner
2008-02-18 14:37   ` Pavel Machek
2008-02-18 15:12     ` Thomas Gleixner
2008-02-19  9:20       ` Pavel Machek
2008-02-19  9:37       ` Pavel Machek
2008-02-19 10:00       ` Pavel Machek
2008-02-19 14:05         ` Ingo Molnar
2008-02-19 16:51           ` Thomas Gleixner
2008-02-20  0:17             ` Len Brown
2008-02-20  6:51               ` Thomas Gleixner
2008-02-19 10:02       ` notsc is ignored on common configurations Pavel Machek
2008-02-19 11:26         ` Ingo Molnar
2008-02-19 11:29           ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).