Re: X crashes after suspend/resume cycle and keyboard becomes unusable

2017-03-20 Thread joshua stein
On Tue, 21 Mar 2017 at 01:55:51 +, Raf Czlonka wrote:
> I've installed -current on this laptop in August and not until some
> weeks or months later had I actually started using xdm(1) - this
> is when I noticed the issue. Before, I've been always using startx
> and got into the habit of quitting X before I suspended the laptop
> - yes, I had forgotten to mention this crucial bit of information
> (it's pretty late here) - suspend works just fine if X isn't running
> so I'm not entirely sure if it is purely kernel-related.
> 
> I've got release CDs going back several years so once I get a hold
> of another disk, I'll try to narrow it down - this may take a while
> as currently it is my main machine.

Actually, this bug is sort of known and not easy to fix.

It is caused by the keyboard and mouse devices (which attach over
USB) detaching at suspend time and reattaching after resume.  Xorg's
keyboard input driver tries to talk to the keyboard device when the
machine resumes but does so before the device has actually attached,
which fails, and prints this error:

(EE) can't switch keyboard to raw mode. Enable support for it in the kernel[..]

Which takes down the X server.  I'm not sure if the device retains
its raw mode setting when it reattaches and causes the keys to input
incorrectly on the console, but they are all related.

Fixing this may require redesigning some Xorg and kernel components.

A work around for this is to switch to the console before
suspending, then just switch back to X once it comes back.



Re: X crashes after suspend/resume cycle and keyboard becomes unusable

2017-03-20 Thread Raf Czlonka
On Tue, Mar 21, 2017 at 01:29:59AM GMT, Mike Larkin wrote:
> On Tue, Mar 21, 2017 at 01:23:07AM +, Raf Czlonka wrote:
> > >Synopsis:  X crashes after suspend/resume cycle and keyboard becomes 
> > >unusable
> > >Category:  system
> > >Environment:
> > System  : OpenBSD 6.1
> > Details : OpenBSD 6.1-beta (GENERIC.MP) #37: Fri Mar 17 07:46:47 
> > MDT 2017
> >  
> > dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> > 
> > Architecture: OpenBSD.amd64
> > Machine     : amd64
> > >Description:
> > After suspend/resume cycle, X crashes and keyboard becomes
> > unusable, producing unusual characters - ones which are not
> > present on current layout, i.e. inverted exclamation mark,
> > yen or cent currency characters, (R), etc. - thus preventing
> > from logging onto the system again.
> > 
> > Afterwards, I'm unable to interact with the system, unless
> > I'm connected to a network on which I have another machine
> > I can SSH from to the laptop.
> > 
> > Xorg.0.log attached.
> > 
> > I found this thread (http://marc.info/?t=14844776961)
> > which sounds pretty much exactly what I'm experiencing but
> > this one didn't go very far.
> > 
> 
> As I mentioned to the original filer of this bug, you'll have to help us
> narrow this down. The previous answer of "some time between october 24 and
> january 15, with some other unrelated issues seen around december 2" doesn't
> help us. If you can point to a commit which broke it by bisecting kernels,
> it will help us immensely.

Hi Mike,

Thanks for a prompt reply.

I've installed -current on this laptop in August and not until some
weeks or months later had I actually started using xdm(1) - this
is when I noticed the issue. Before, I've been always using startx
and got into the habit of quitting X before I suspended the laptop
- yes, I had forgotten to mention this crucial bit of information
(it's pretty late here) - suspend works just fine if X isn't running
so I'm not entirely sure if it is purely kernel-related.

I've got release CDs going back several years so once I get a hold
of another disk, I'll try to narrow it down - this may take a while
as currently it is my main machine.

Ta,

Raf

> > I've been running -current on this laptop since last year
> > and, as far as I can remember, this has never worked.
> > 
> > >How-To-Repeat:
> > Unplug laptop from main power, close the lid, wait a couple
> > of seconds, open the lid - X crashes before ones eyes and
> > the keyboard becomes unusable.
> > 
> > >Fix:
> > No fix other than not using suspend on the laptop - only
> > closing the lid while plugged into mains so that it does
> > *not* suspend.
> > 
> > If I'm connected to a network on which I have another machine
> > (not always available or even possible), I can connect to
> > the laptop via SSH and start xenodm(1) again.
> > 
> > 
> > dmesg:
> > OpenBSD 6.1-beta (GENERIC.MP) #37: Fri Mar 17 07:46:47 MDT 2017
> > dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> > RTC BIOS diagnostic error 1f<memory_size,fixed_disk,invalid_time>
> > real mem = 8473620480 (8081MB)
> > avail mem = 8212135936 (7831MB)
> > mpath0 at root
> > scsibus0 at mpath0: 256 targets
> > mainbus0 at root
> > bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x8ad14000 (63 entries)
> > bios0: vendor Apple Inc. version "MBP91.88Z.00D3.B0D.1602221713" date 
> > 02/22/2016
> > bios0: Apple Inc. MacBookPro9,2
> > acpi0 at bios0: rev 2
> > acpi0: sleep states S0 S3 S4 S5
> > acpi0: tables DSDT FACP HPET APIC SBST ECDT SSDT SSDT SSDT SSDT SSDT SSDT 
> > SSDT SSDT SSDT SSDT SSDT DMAR MCFG
> > acpi0: wakeup devices P0P2(S3) PEG1(S3) EC__(S4) GMUX(S3) HDEF(S3) RP01(S3) 
> > GIGE(S3) SDXC(S3) RP02(S3) ARPT(S3) RP03(S3) EHC1(S3) EHC2(S3) XHC1(S3) 
> > ADP1(S4) LID0(S4)
> > acpitimer0 at acpi0: 3579545 Hz, 24 bits
> > acpihpet0 at acpi0: 14318179 Hz
> > acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> > cpu0 at mainbus0: apid 0 (boot processor)
> > cpu0: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz, 2494.73 MHz
> > cpu0: 
> > FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
>

Re: X crashes after suspend/resume cycle and keyboard becomes unusable

2017-03-20 Thread Mike Larkin
On Tue, Mar 21, 2017 at 01:23:07AM +, Raf Czlonka wrote:
> >Synopsis:X crashes after suspend/resume cycle and keyboard becomes 
> >unusable
> >Category:system
> >Environment:
>   System  : OpenBSD 6.1
>   Details : OpenBSD 6.1-beta (GENERIC.MP) #37: Fri Mar 17 07:46:47 
> MDT 2017
>
> dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> 
>   Architecture: OpenBSD.amd64
>   Machine     : amd64
> >Description:
>   After suspend/resume cycle, X crashes and keyboard becomes
>   unusable, producing unusual characters - ones which are not
>   present on current layout, i.e. inverted exclamation mark,
>   yen or cent currency characters, (R), etc. - thus preventing
>   from logging onto the system again.
> 
>   Afterwards, I'm unable to interact with the system, unless
>   I'm connected to a network on which I have another machine
>   I can SSH from to the laptop.
> 
>   Xorg.0.log attached.
> 
>   I found this thread (http://marc.info/?t=14844776961)
>   which sounds pretty much exactly what I'm experiencing but
>   this one didn't go very far.
> 

As I mentioned to the original filer of this bug, you'll have to help us
narrow this down. The previous answer of "some time between october 24 and
january 15, with some other unrelated issues seen around december 2" doesn't
help us. If you can point to a commit which broke it by bisecting kernels,
it will help us immensely.

-ml

>   I've been running -current on this laptop since last year
>   and, as far as I can remember, this has never worked.
> 
> >How-To-Repeat:
>   Unplug laptop from main power, close the lid, wait a couple
>   of seconds, open the lid - X crashes before ones eyes and
>   the keyboard becomes unusable.
> 
> >Fix:
>   No fix other than not using suspend on the laptop - only
>   closing the lid while plugged into mains so that it does
>   *not* suspend.
> 
>   If I'm connected to a network on which I have another machine
>   (not always available or even possible), I can connect to
>   the laptop via SSH and start xenodm(1) again.
> 
> 
> dmesg:
> OpenBSD 6.1-beta (GENERIC.MP) #37: Fri Mar 17 07:46:47 MDT 2017
> dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> RTC BIOS diagnostic error 1f<memory_size,fixed_disk,invalid_time>
> real mem = 8473620480 (8081MB)
> avail mem = 8212135936 (7831MB)
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x8ad14000 (63 entries)
> bios0: vendor Apple Inc. version "MBP91.88Z.00D3.B0D.1602221713" date 
> 02/22/2016
> bios0: Apple Inc. MacBookPro9,2
> acpi0 at bios0: rev 2
> acpi0: sleep states S0 S3 S4 S5
> acpi0: tables DSDT FACP HPET APIC SBST ECDT SSDT SSDT SSDT SSDT SSDT SSDT 
> SSDT SSDT SSDT SSDT SSDT DMAR MCFG
> acpi0: wakeup devices P0P2(S3) PEG1(S3) EC__(S4) GMUX(S3) HDEF(S3) RP01(S3) 
> GIGE(S3) SDXC(S3) RP02(S3) ARPT(S3) RP03(S3) EHC1(S3) EHC2(S3) XHC1(S3) 
> ADP1(S4) LID0(S4)
> acpitimer0 at acpi0: 3579545 Hz, 24 bits
> acpihpet0 at acpi0: 14318179 Hz
> acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> cpu0 at mainbus0: apid 0 (boot processor)
> cpu0: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz, 2494.73 MHz
> cpu0: 
> FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
> cpu0: 256KB 64b/line 8-way L2 cache
> cpu0: TSC frequency 2494725560 Hz
> cpu0: smt 0, core 0, package 0
> mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
> cpu0: apic clock running at 99MHz
> cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE
> cpu1 at mainbus0: apid 2 (application processor)
> cpu1: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz, 2494.33 MHz
> cpu1: 
> FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
> cpu1: 256KB 64b/line 8-way L2 cache
> cpu1: smt 0, core 1, package 0
> cpu2 at mainbus0: apid 1 (application processor)
> cpu2: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz, 2494.33 MHz
> cpu2: 
> FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS

X crashes after suspend/resume cycle and keyboard becomes unusable

2017-03-20 Thread Raf Czlonka
>Synopsis:      X crashes after suspend/resume cycle and keyboard becomes 
>unusable
>Category:  system
>Environment:
System  : OpenBSD 6.1
Details : OpenBSD 6.1-beta (GENERIC.MP) #37: Fri Mar 17 07:46:47 
MDT 2017
 
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

Architecture: OpenBSD.amd64
Machine : amd64
>Description:
    After suspend/resume cycle, X crashes and keyboard becomes
    unusable, producing unusual characters - ones which are not
present on current layout, i.e. inverted exclamation mark,
yen or cent currency characters, (R), etc. - thus preventing
from logging onto the system again.

Afterwards, I'm unable to interact with the system, unless
I'm connected to a network on which I have another machine
I can SSH from to the laptop.

Xorg.0.log attached.

I found this thread (http://marc.info/?t=14844776961)
which sounds pretty much exactly what I'm experiencing but
this one didn't go very far.

I've been running -current on this laptop since last year
and, as far as I can remember, this has never worked.

>How-To-Repeat:
Unplug laptop from main power, close the lid, wait a couple
of seconds, open the lid - X crashes before ones eyes and
the keyboard becomes unusable.

>Fix:
No fix other than not using suspend on the laptop - only
closing the lid while plugged into mains so that it does
*not* suspend.

If I'm connected to a network on which I have another machine
(not always available or even possible), I can connect to
the laptop via SSH and start xenodm(1) again.


dmesg:
OpenBSD 6.1-beta (GENERIC.MP) #37: Fri Mar 17 07:46:47 MDT 2017
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
RTC BIOS diagnostic error 1f<memory_size,fixed_disk,invalid_time>
real mem = 8473620480 (8081MB)
avail mem = 8212135936 (7831MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x8ad14000 (63 entries)
bios0: vendor Apple Inc. version "MBP91.88Z.00D3.B0D.1602221713" date 02/22/2016
bios0: Apple Inc. MacBookPro9,2
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP HPET APIC SBST ECDT SSDT SSDT SSDT SSDT SSDT SSDT SSDT 
SSDT SSDT SSDT SSDT DMAR MCFG
acpi0: wakeup devices P0P2(S3) PEG1(S3) EC__(S4) GMUX(S3) HDEF(S3) RP01(S3) 
GIGE(S3) SDXC(S3) RP02(S3) ARPT(S3) RP03(S3) EHC1(S3) EHC2(S3) XHC1(S3) 
ADP1(S4) LID0(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz, 2494.73 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: TSC frequency 2494725560 Hz
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz, 2494.33 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 1 (application processor)
cpu2: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz, 2494.33 MHz
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 1, core 0, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz, 2494.33 MHz
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpiec0 at acp