Skip to contentSkip to conversation

New: Averatec 3156X laptop doesn't reboot with kernels > 2.6.13.5 (responsible commit found)

Bugme-new Andrew Morton 5 participants 10 messages Apr 27, 2007 – Nov 1, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 25 lines · On Fri, 27 Apr 2007 10:42:25 -0700 [email protected] wrote:

http://bugzilla.kernel.org/show_bug.cgi?id=8378

           Summary: Averatec 3156X laptop doesn't reboot with kernels >
                    2.6.13.5 (responsible commit found)
    Kernel Version: 2.6.14 till 2.6.21
            Status: NEW
          Severity: normal
             Owner: [email protected]
         Submitter: [email protected]

Most recent kernel where this bug did *NOT* occur: 2.6.13.5

Distribution: Debian
Hardware Environment: Averatec 3156X (seemingly identical to the american model 3150P)
Software Environment:?
Problem Description:
I noticed that with recent kernels my laptop would reboot when I do an 'init 6', but hang at the end of the init run. The last working vanilla kernel is 2.6.13.5. With some trying and a bit of guessing I found a change to include/asm-i386/mach-default/mach_reboot.h in 2.6.14 to be the culprit. It can be found at:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.14.y.git;a=commitdiff;h=59f4e7d572980a521b7bdba74ab71b21f5995538

Quoted 7 lines

On a 2.6.21 source tree I can revert this patch, and then rebooting works.

Steps to reproduce:
1) On a Averatec 3156X (or 3150p?) boot to your default runlevel.
2) as root, type "init 6".
3) instead of rebooting, the system will hang at the end with a blank screen.

Oh dear. We have an ugly i386 snafu here. Thanks for doing the bisection
- it helps enormously.

Could some brave person please pick it up and see if we can get both Truxton and Lee's machines working?

#2 lore raw

Andrew Morton wrote (at Fri, 27 Apr 2007 14:44:34 -0700) :

Quoted 38 lines
Quoted 25 lines · On Fri, 27 Apr 2007 10:42:25 -0700 [email protected] wrote:

http://bugzilla.kernel.org/show_bug.cgi?id=8378

           Summary: Averatec 3156X laptop doesn't reboot with kernels >
                    2.6.13.5 (responsible commit found)
    Kernel Version: 2.6.14 till 2.6.21
            Status: NEW
          Severity: normal
             Owner: [email protected]
         Submitter: [email protected]

Most recent kernel where this bug did *NOT* occur: 2.6.13.5

Distribution: Debian
Hardware Environment: Averatec 3156X (seemingly identical to the american model 3150P)
Software Environment:?
Problem Description:
I noticed that with recent kernels my laptop would reboot when I do an 'init 6', but hang at the end of the init run. The last working vanilla kernel is 2.6.13.5. With some trying and a bit of guessing I found a change to include/asm-i386/mach-default/mach_reboot.h in 2.6.14 to be the culprit. It can be found at:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.14.y.git;a=commitdiff;h=59f4e7d572980a521b7bdba74ab71b21f5995538

Quoted 7 lines

On a 2.6.21 source tree I can revert this patch, and then rebooting works.

Steps to reproduce:
1) On a Averatec 3156X (or 3150p?) boot to your default runlevel.
2) as root, type "init 6".
3) instead of rebooting, the system will hang at the end with a blank screen.

Quoted 5 lines

Oh dear. We have an ugly i386 snafu here. Thanks for doing the bisection
- it helps enormously.

Could some brave person please pick it up and see if we can get both Truxton and Lee's machines working?

Hi,

I verified on my IDEQ210M that performing the old reboot sequence followed by the new reboot sequence works for me, and I suspect that it will work for Lee also. Like this :

	/* old method, works on most machines */
        for (i = 0; i < 100; i++) {
                kb_wait();
                udelay(50);
                outb(0xfe, 0x64);         /* pulse reset low */
                udelay(50);
        }

	/* new method, sets the "System flag" which when set,
	   indicates successful completion of the keyboard controller
	   self-test (Basic Assurance Test, BAT).  This is needed
	   for some machines with no keyboard plugged in */
        for (i = 0; i < 100; i++) {
                kb_wait();
                udelay(50);
                outb(0x60, 0x64);         /* write Controller Command Byte */
                udelay(50);
                kb_wait();
                udelay(50);
                outb(0x14, 0x60);         /* set "System flag" */
                udelay(50);
                kb_wait();
                udelay(50);
                outb(0xfe, 0x64);         /* pulse reset low */
                udelay(50);
        }

Thanks,

-Truxton

#3 lore raw
Quoted 33 lines · Truxton Fulton

Hi,

I verified on my IDEQ210M that performing the old reboot sequence followed by the new reboot sequence works for me, and I suspect that it will work for Lee also. Like this :

	/* old method, works on most machines */
        for (i = 0; i < 100; i++) {
                kb_wait();
                udelay(50);
                outb(0xfe, 0x64);         /* pulse reset low */
                udelay(50);
        }

	/* new method, sets the "System flag" which when set,
	   indicates successful completion of the keyboard controller
	   self-test (Basic Assurance Test, BAT).  This is needed
	   for some machines with no keyboard plugged in */
        for (i = 0; i < 100; i++) {
                kb_wait();
                udelay(50);
                outb(0x60, 0x64);         /* write Controller Command Byte */
                udelay(50);
                kb_wait();
                udelay(50);
                outb(0x14, 0x60);         /* set "System flag" */
                udelay(50);
                kb_wait();
                udelay(50);
                outb(0xfe, 0x64);         /* pulse reset low */
                udelay(50);
        }
Quoted 3 lines

Thanks,

-Truxton

Hello everyone,

I compiled a 2.6.21.1 kernel with Truxton's suggestion mentioned above. My laptop reboots normally with it. For convenience I've diffed a patch, which is appended to this mail.

Regards,
Lee

include/asm-i386/mach-default/mach_reboot.h +26 -14
@@ -19,20 +19,32 @@
 static inline void mach_reboot(void)
 {
 	int i;
-	for (i = 0; i < 10; i++) {
-		kb_wait();
-		udelay(50);
-		outb(0x60, 0x64);	/* write Controller Command Byte */
-		udelay(50);
-		kb_wait();
-		udelay(50);
-		outb(0x14, 0x60);	/* set "System flag" */
-		udelay(50);
-		kb_wait();
-		udelay(50);
-		outb(0xfe, 0x64);	/* pulse reset low */
-		udelay(50);
-	}
+	/* old method, works on most machines */
+        for (i = 0; i < 100; i++) {
+                kb_wait();
+                udelay(50);
+                outb(0xfe, 0x64);         /* pulse reset low */
+                udelay(50);
+        }
+
+	/* new method, sets the "System flag" which when set,
+	   indicates successful completion of the keyboard controller
+	   self-test (Basic Assurance Test, BAT).  This is needed
+	   for some machines with no keyboard plugged in */
+        for (i = 0; i < 100; i++) {
+                kb_wait();
+                udelay(50);
+                outb(0x60, 0x64);         /* write Controller Command Byte */
+                udelay(50);
+                kb_wait();
+                udelay(50);
+                outb(0x14, 0x60);         /* set "System flag" */
+                udelay(50);
+                kb_wait();
+                udelay(50);
+                outb(0xfe, 0x64);         /* pulse reset low */
+                udelay(50);
+        }
 }
 
 #endif /* !_MACH_REBOOT_H */
#4 lore raw
Quoted 36 lines · On Sat, 12 May 2007 21:35:58 +0200 Lee Garrett <[email protected]> wrote:
Quoted 35 lines · Truxton Fulton

Hi,

I verified on my IDEQ210M that performing the old reboot sequence followed by the new reboot sequence works for me, and I suspect that it will work for Lee also. Like this :

	/* old method, works on most machines */
        for (i = 0; i < 100; i++) {
                kb_wait();
                udelay(50);
                outb(0xfe, 0x64);         /* pulse reset low */
                udelay(50);
        }

	/* new method, sets the "System flag" which when set,
	   indicates successful completion of the keyboard controller
	   self-test (Basic Assurance Test, BAT).  This is needed
	   for some machines with no keyboard plugged in */
        for (i = 0; i < 100; i++) {
                kb_wait();
                udelay(50);
                outb(0x60, 0x64);         /* write Controller Command Byte */
                udelay(50);
                kb_wait();
                udelay(50);
                outb(0x14, 0x60);         /* set "System flag" */
                udelay(50);
                kb_wait();
                udelay(50);
                outb(0xfe, 0x64);         /* pulse reset low */
                udelay(50);
        }

Thanks,

Quoted 8 lines
Quoted 1 line

-Truxton

Hello everyone,

I compiled a 2.6.21.1 kernel with Truxton's suggestion mentioned above. My laptop reboots normally with it. For convenience I've diffed a patch, which is appended to this mail.

OK, thanks.

So that are we doing here? We try the pre-Truxton code and if that didn't work we try the post-Truxton code? Hard to see how that could go wrong.

Truxton, can you please test it for us?

#5 lore raw

Andrew Morton wrote (at Sat, 12 May 2007 18:02:40 -0700) :

Quoted 49 lines · On Sat, 12 May 2007 21:35:58 +0200 Lee Garrett <[email protected]> wrote:
Quoted 37 lines
Quoted 35 lines · Truxton Fulton

Hi,

I verified on my IDEQ210M that performing the old reboot sequence followed by the new reboot sequence works for me, and I suspect that it will work for Lee also. Like this :

	/* old method, works on most machines */
        for (i = 0; i < 100; i++) {
                kb_wait();
                udelay(50);
                outb(0xfe, 0x64);         /* pulse reset low */
                udelay(50);
        }

	/* new method, sets the "System flag" which when set,
	   indicates successful completion of the keyboard controller
	   self-test (Basic Assurance Test, BAT).  This is needed
	   for some machines with no keyboard plugged in */
        for (i = 0; i < 100; i++) {
                kb_wait();
                udelay(50);
                outb(0x60, 0x64);         /* write Controller Command Byte */
                udelay(50);
                kb_wait();
                udelay(50);
                outb(0x14, 0x60);         /* set "System flag" */
                udelay(50);
                kb_wait();
                udelay(50);
                outb(0xfe, 0x64);         /* pulse reset low */
                udelay(50);
        }

Thanks,

Quoted 8 lines
Quoted 1 line

-Truxton

Hello everyone,

I compiled a 2.6.21.1 kernel with Truxton's suggestion mentioned above. My laptop reboots normally with it. For convenience I've diffed a patch, which is appended to this mail.

Quoted 6 lines

OK, thanks.

So that are we doing here? We try the pre-Truxton code and if that didn't work we try the post-Truxton code? Hard to see how that could go wrong.

Truxton, can you please test it for us?

Hi,

Segher suggested a better implementation that did a read-modify-write sequence. I tested a few different combinations of these rebooting approaches, and found that each one individually correctly rebooted my headless machine (Biostar iDEQ 210M with VIA PM800 + VT8237 chipset).

A = original "pulse reset low"
B = my patch that sets the system flag (with possibly bad assumptions about other flags) C = Segher's read-modify-write to set only the system flag.

So, the bad news is that I no longer have a baseline test (because A works for me now). I updated the bios a while ago, and this is a different physical machine than the others I was testing last year (which are now in production and I cannot use to test), although the model is the same.

So, if you want to revert my patch all together, that's fine. I think a foolproof reboot sequence would be A followed by C.

So here is my recommendation, which I have verified works on my current machine :

Thanks,

-Truxton

mach_reboot.h 2007-05-13 05:01:02.000000000 -0700 renamed from mach_reboot.h.orig 2007-05-13 05:04:43.000000000 -0700 +36 -14
@@ -19,20 +19,42 @@
 static inline void mach_reboot(void)
 {
        int i;
-       for (i = 0; i < 100; i++) {
-               kb_wait();
-               udelay(50);
-               outb(0x60, 0x64);       /* write Controller Command Byte */
-               udelay(50);
-               kb_wait();
-               udelay(50);
-               outb(0x14, 0x60);       /* set "System flag" */
-               udelay(50);
-               kb_wait();
-               udelay(50);
-               outb(0xfe, 0x64);       /* pulse reset low */
-               udelay(50);
-       }
+       u8 cmd ;
+
+
+       /* old method, works on most machines */
+        for (i = 0; i < 100; i++) {
+         kb_wait();
+         udelay(50);
+         outb(0xfe, 0x64);         /* pulse reset low */
+         udelay(50);
+        }
+
+       /* new method, sets the "System flag" which when set,
+          indicates successful completion of the keyboard controller
+          self-test (Basic Assurance Test, BAT).  This is needed
+          for some machines with no keyboard plugged in.
+          This read-modify-write sequence sets only the system flag. */
+        for (i = 0; i < 100; i++) {
+         outb(0x20, 0x64);       /* read Controller Command Byte */
+         udelay(50);
+         kb_wait();
+         udelay(50);
+         cmd = inb(0x60);
+         udelay(50);
+         kb_wait();
+         udelay(50);
+         outb(0x60, 0x64);       /* write Controller Command Byte */
+         udelay(50);
+         kb_wait();
+         udelay(50);
+         outb(cmd | 0x04, 0x60); /* set "System flag" */
+         udelay(50);
+         kb_wait();
+         udelay(50);
+         outb(0xfe, 0x64);         /* pulse reset low */
+         udelay(50);
+        }
 }
 
 #endif /* !_MACH_REBOOT_H */
#6 lore raw
In reply to Andrew Morton

Andrew Morton wrote (at Sat, 12 May 2007 18:02:40 -0700) :

Quoted 7 lines

OK, thanks.

So that are we doing here? We try the pre-Truxton code and if that didn't work we try the post-Truxton code? Hard to see how that could go wrong.

Truxton, can you please test it for us?

Hi,

Hiroto Shibuya wrote to tell me that he has a VIA EPIA-EK10000 which suffers from the reboot problem when no keyboard is attached. My first patch works for him :

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=59f4e7d572980a521b7bdba74ab71b21f5995538

But the latest patch does not work for him :

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8b93789808756bcc1e5c90c99f1b1ef52f839a51

We found that it was necessary to also set the "disable keyboard" flag in the command byte, as the first patch was doing. The second patch tries to minimally modify the command byte, but it is not enough.

Please consider this simple one-line patch to help people with low end VIA motherboards reboot when no keyboard is attached. Hiroto Shibuya has verified that this works for him (as I no longer have an afflicted machine) :

This patch is against linux-2.6.23-rc9/include/asm-i386/mach-default/mach_reboot.h

mach_reboot.h.new Tue Oct 2 19:22:13 2007 renamed from mach_reboot.h Mon Oct 1 20:24:52 2007 +1 -1
@@ -49,7 +49,7 @@
                udelay(50);
                kb_wait();
                udelay(50);
-               outb(cmd | 0x04, 0x60); /* set "System flag" */
+               outb(cmd | 0x14, 0x60); /* set "System flag" and "Keyboard Disabled" */
                udelay(50);
                kb_wait();
                udelay(50);

Thanks,

-Truxton

#7 lore raw

Hi Andrew,

Quoted 34 lines
Quoted 6 lines

OK, thanks.

So that are we doing here? We try the pre-Truxton code and if that didn't work we try the post-Truxton code? Hard to see how that could go wrong.

Truxton, can you please test it for us?

Hiroto Shibuya wrote to tell me that he has a VIA EPIA-EK10000 which suffers from the reboot problem when no keyboard is attached. My first patch works for him :

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=59f4e7d572980a521b7bdba74ab71b21f5995538

But the latest patch does not work for him :

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8b93789808756bcc1e5c90c99f1b1ef52f839a51

We found that it was necessary to also set the "disable keyboard" flag in the command byte, as the first patch was doing. The second patch tries to minimally modify the command byte, but it is not enough.

Please consider this simple one-line patch to help people with low end VIA motherboards reboot when no keyboard is attached. Hiroto Shibuya has verified that this works for him (as I no longer have an afflicted machine) :

This patch is against linux-2.6.23-rc9/include/asm-i386/mach-default/mach_reboot.h

mach_reboot.h.new Tue Oct 2 19:22:13 2007 line 55

Quoted 8 lines
mach_reboot.h.new Tue Oct 2 19:22:13 2007 renamed from mach_reboot.h Mon Oct 1 20:24:52 2007 +1 -1
@@ -49,7 +49,7 @@
                udelay(50);
                kb_wait();
                udelay(50);
-               outb(cmd | 0x04, 0x60); /* set "System flag" */
+               outb(cmd | 0x14, 0x60); /* set "System flag" and "Keyboard Disabled" */
                udelay(50);
                kb_wait();
                udelay(50);

any chance to get this into next -mm?

Signature · 1 line
Aristeu
#8 lore raw
Quoted 6 lines · On Thu, 1 Nov 2007 11:50:31 -0400 Aristeu Rozanski <[email protected]> wrote:
Quoted 6 lines
mach_reboot.h.new Tue Oct 2 19:22:13 2007 renamed from mach_reboot.h Mon Oct 1 20:24:52 2007 +0 -0
@@ -49,7 +49,7 @@
                udelay(50);
                kb_wait();
                udelay(50);
Quoted 8 lines

mach_reboot.h.new Tue Oct 2 19:22:13 2007 line 55

Quoted 7 lines
mach_reboot.h.new Tue Oct 2 19:22:13 2007 renamed from mach_reboot.h Mon Oct 1 20:24:52 2007 +1 -1
-               outb(cmd | 0x04, 0x60); /* set "System flag" */
+               outb(cmd | 0x14, 0x60); /* set "System flag" and "Keyboard Disabled" */
                udelay(50);
                kb_wait();
                udelay(50);

any chance to get this into next -mm?

Is is, as i386-fix-reboot-with-no-keyboard-attached.patch

#9 lore raw
Quoted 3 lines
Quoted 1 line

any chance to get this into next -mm?

Is is, as i386-fix-reboot-with-no-keyboard-attached.patch

Thanks!

Signature · 1 line
Aristeu
#10 lore raw
In reply to Andrew Morton

That patch says

Review

Quoted 6 lines

+ outb(0x60, 0x64); /* write Controller Command
Byte */

(quoted diff) +4 -0
+               udelay(50);
+               kb_wait();
+               udelay(50);
+               outb(0x14, 0x60);       /* set "System flag" */

so the comment doesn't agree with the code: it sets all flags in the command byte, not just the system flag. Perhaps importantly, it disables the keyboard clock. Why not do a read-modify-write sequence instead? Something like

               outb(0x20, 0x64);       /* read Controller Command Byte 
*/
               udelay(50);
               kb_wait();
               udelay(50);
               u8 cmd = inb(0x60);
               udelay(50);
               kb_wait();
               udelay(50);
               outb(0x60, 0x64);       /* write Controller Command Byte 
*/
               udelay(50);
               kb_wait();
               udelay(50);
               outb(cmd | 0x04, 0x60); /* set "System flag" */

Segher