Re: OpenBSD on thinkpad x280

2019-05-27 Thread Theo de Raadt
Otto Moerbeek  wrote:

> On Mon, May 27, 2019 at 04:57:48AM -0600, Theo de Raadt wrote:
> 
> > Claudio Jeker  wrote:
> > 
> > > On Sat, May 25, 2019 at 03:53:03PM +0100, Maurice McCarthy wrote:
> > > > On 25/05/2019, Timo Myyrä  wrote:
> > > > > Tristan Pilat  writes:
> > > > >
> > > > >> Hi OpenBSD users and devs!
> > > > >>
> > > > >> I got a new laptop in January, a thinkpad x280. At that time my 
> > > > >> system
> > > > >> running 'current' was very slow and I assumed the video acceleration
> > > > >> wasn't working so I just sadly stuck with Debian for a while. I then
> > > > >> saw that an update of the inteldrm landed in current a month ago or 
> > > > >> so
> > > > >> so I tried yesterday to reinstall current. Unfortunately the system 
> > > > >> is
> > > > >> still barely usable. Could you guys tell me why the video 
> > > > >> acceleration
> > > > >> isn't handled? Isn't Kaby lake compatible for now? I saw this article
> > > > >> (https://jcs.org/2017/05/22/xiaomiair) which says it is.
> > > > >>
> > > > 
> > > > You may have to adjust the aperture
> > > > See /etc/examples/sysctl.conf
> > > > 
> > > > #machdep.allowaperture=2# See xf86(4)
> > > > 
> > > 
> > > Nope. That does not help. I bet the issue is not related to anything
> > > related to inteldrm. It is most probably an interrupt storm happening
> > > because of Thunderbolt 3. At least that seems to be something people
> > > complained about.
> > 
> > Same sort of thing happened with x1rev6, but various folk figured out BIOS
> > options which could prevent it, and newer BIOS replacements also improved
> > the situation.  Please study it and see if you can find some clues.
> 
> I'm up-to-date with the newest BIOS on my X1 6th but I see acpi0
> eating lots of CPU if I connect a displayport device. Playing with
> options does not fix this for me. The workaround I'm using now see
> below) is very unsatisfactory, but I have no clue on where I should be
> looking for a real fix and no one with knowledge in this area has
> surfaced to look into this problem.
> 
>   -Otto
> 
> Index: acpi.c
> ===
> RCS file: /cvs/src/sys/dev/acpi/acpi.c,v
> retrieving revision 1.367
> diff -u -p -r1.367 acpi.c
> --- acpi.c12 May 2019 15:52:52 -  1.367
> +++ acpi.c27 May 2019 11:07:52 -
> @@ -2262,6 +2262,10 @@ acpi_gpe(struct acpi_softc *sc, int gpe,
>   struct aml_node *node = arg;
>   uint8_t mask, en;
>  
> + static unsigned short count111;
> + if (gpe == 111 && count111++ != 0)
> + return 0;
> +
>   dnprintf(10, "handling GPE %.2x\n", gpe);
>   aml_evalnode(sc, node, 0, NULL, NULL);

It is good clue to know what GPE is firing.  Next step is to see what
parts of AML use that GPE.

(I still suspect it is related to Thunderbolt 3 / xhci / etc)



Re: OpenBSD on thinkpad x280

2019-05-27 Thread Otto Moerbeek
On Mon, May 27, 2019 at 04:57:48AM -0600, Theo de Raadt wrote:

> Claudio Jeker  wrote:
> 
> > On Sat, May 25, 2019 at 03:53:03PM +0100, Maurice McCarthy wrote:
> > > On 25/05/2019, Timo Myyrä  wrote:
> > > > Tristan Pilat  writes:
> > > >
> > > >> Hi OpenBSD users and devs!
> > > >>
> > > >> I got a new laptop in January, a thinkpad x280. At that time my system
> > > >> running 'current' was very slow and I assumed the video acceleration
> > > >> wasn't working so I just sadly stuck with Debian for a while. I then
> > > >> saw that an update of the inteldrm landed in current a month ago or so
> > > >> so I tried yesterday to reinstall current. Unfortunately the system is
> > > >> still barely usable. Could you guys tell me why the video acceleration
> > > >> isn't handled? Isn't Kaby lake compatible for now? I saw this article
> > > >> (https://jcs.org/2017/05/22/xiaomiair) which says it is.
> > > >>
> > > 
> > > You may have to adjust the aperture
> > > See /etc/examples/sysctl.conf
> > > 
> > > #machdep.allowaperture=2  # See xf86(4)
> > > 
> > 
> > Nope. That does not help. I bet the issue is not related to anything
> > related to inteldrm. It is most probably an interrupt storm happening
> > because of Thunderbolt 3. At least that seems to be something people
> > complained about.
> 
> Same sort of thing happened with x1rev6, but various folk figured out BIOS
> options which could prevent it, and newer BIOS replacements also improved
> the situation.  Please study it and see if you can find some clues.

I'm up-to-date with the newest BIOS on my X1 6th but I see acpi0
eating lots of CPU if I connect a displayport device. Playing with
options does not fix this for me. The workaround I'm using now see
below) is very unsatisfactory, but I have no clue on where I should be
looking for a real fix and no one with knowledge in this area has
surfaced to look into this problem.

-Otto

Index: acpi.c
===
RCS file: /cvs/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.367
diff -u -p -r1.367 acpi.c
--- acpi.c  12 May 2019 15:52:52 -  1.367
+++ acpi.c  27 May 2019 11:07:52 -
@@ -2262,6 +2262,10 @@ acpi_gpe(struct acpi_softc *sc, int gpe,
struct aml_node *node = arg;
uint8_t mask, en;
 
+   static unsigned short count111;
+   if (gpe == 111 && count111++ != 0)
+   return 0;
+
dnprintf(10, "handling GPE %.2x\n", gpe);
aml_evalnode(sc, node, 0, NULL, NULL);
 




Re: OpenBSD on thinkpad x280

2019-05-27 Thread Theo de Raadt
Claudio Jeker  wrote:

> On Sat, May 25, 2019 at 03:53:03PM +0100, Maurice McCarthy wrote:
> > On 25/05/2019, Timo Myyrä  wrote:
> > > Tristan Pilat  writes:
> > >
> > >> Hi OpenBSD users and devs!
> > >>
> > >> I got a new laptop in January, a thinkpad x280. At that time my system
> > >> running 'current' was very slow and I assumed the video acceleration
> > >> wasn't working so I just sadly stuck with Debian for a while. I then
> > >> saw that an update of the inteldrm landed in current a month ago or so
> > >> so I tried yesterday to reinstall current. Unfortunately the system is
> > >> still barely usable. Could you guys tell me why the video acceleration
> > >> isn't handled? Isn't Kaby lake compatible for now? I saw this article
> > >> (https://jcs.org/2017/05/22/xiaomiair) which says it is.
> > >>
> > 
> > You may have to adjust the aperture
> > See /etc/examples/sysctl.conf
> > 
> > #machdep.allowaperture=2# See xf86(4)
> > 
> 
> Nope. That does not help. I bet the issue is not related to anything
> related to inteldrm. It is most probably an interrupt storm happening
> because of Thunderbolt 3. At least that seems to be something people
> complained about.

Same sort of thing happened with x1rev6, but various folk figured out BIOS
options which could prevent it, and newer BIOS replacements also improved
the situation.  Please study it and see if you can find some clues.



Re: OpenBSD on thinkpad x280

2019-05-26 Thread Tristan Pilat
On 25 May 2019 17:04:54 CEST, Claudio Jeker  wrote:
>On Sat, May 25, 2019 at 03:53:03PM +0100, Maurice McCarthy wrote:
>> On 25/05/2019, Timo Myyrä  wrote:
>> > Tristan Pilat  writes:
>> >
>> >> Hi OpenBSD users and devs!
>> >>
>> >> I got a new laptop in January, a thinkpad x280. At that time my
>system
>> >> running 'current' was very slow and I assumed the video
>acceleration
>> >> wasn't working so I just sadly stuck with Debian for a while. I
>then
>> >> saw that an update of the inteldrm landed in current a month ago
>or so
>> >> so I tried yesterday to reinstall current. Unfortunately the
>system is
>> >> still barely usable. Could you guys tell me why the video
>acceleration
>> >> isn't handled? Isn't Kaby lake compatible for now? I saw this
>article
>> >> (https://jcs.org/2017/05/22/xiaomiair) which says it is.
>> >>
>> 
>> You may have to adjust the aperture
>> See /etc/examples/sysctl.conf
>> 
>> #machdep.allowaperture=2 # See xf86(4)
>> 
>
>Nope. That does not help. I bet the issue is not related to anything
>related to inteldrm. It is most probably an interrupt storm happening
>because of Thunderbolt 3. At least that seems to be something people
>complained about.

Hi!

Thanks to you all, I just sent an email to bugs@ about this issue that seems to 
be related to an ACPI bug.

Cheers
-- 
Tristan Pilat
40 avenue des Chartreux
13004 Marseille
06 95 55 74 71



Re: OpenBSD on thinkpad x280

2019-05-25 Thread Claudio Jeker
On Sat, May 25, 2019 at 03:53:03PM +0100, Maurice McCarthy wrote:
> On 25/05/2019, Timo Myyrä  wrote:
> > Tristan Pilat  writes:
> >
> >> Hi OpenBSD users and devs!
> >>
> >> I got a new laptop in January, a thinkpad x280. At that time my system
> >> running 'current' was very slow and I assumed the video acceleration
> >> wasn't working so I just sadly stuck with Debian for a while. I then
> >> saw that an update of the inteldrm landed in current a month ago or so
> >> so I tried yesterday to reinstall current. Unfortunately the system is
> >> still barely usable. Could you guys tell me why the video acceleration
> >> isn't handled? Isn't Kaby lake compatible for now? I saw this article
> >> (https://jcs.org/2017/05/22/xiaomiair) which says it is.
> >>
> 
> You may have to adjust the aperture
> See /etc/examples/sysctl.conf
> 
> #machdep.allowaperture=2  # See xf86(4)
> 

Nope. That does not help. I bet the issue is not related to anything
related to inteldrm. It is most probably an interrupt storm happening
because of Thunderbolt 3. At least that seems to be something people
complained about.

-- 
:wq Claudio



Re: OpenBSD on thinkpad x280

2019-05-25 Thread Maurice McCarthy
On 25/05/2019, Timo Myyrä  wrote:
> Tristan Pilat  writes:
>
>> Hi OpenBSD users and devs!
>>
>> I got a new laptop in January, a thinkpad x280. At that time my system
>> running 'current' was very slow and I assumed the video acceleration
>> wasn't working so I just sadly stuck with Debian for a while. I then
>> saw that an update of the inteldrm landed in current a month ago or so
>> so I tried yesterday to reinstall current. Unfortunately the system is
>> still barely usable. Could you guys tell me why the video acceleration
>> isn't handled? Isn't Kaby lake compatible for now? I saw this article
>> (https://jcs.org/2017/05/22/xiaomiair) which says it is.
>>

You may have to adjust the aperture
See /etc/examples/sysctl.conf

#machdep.allowaperture=2# See xf86(4)

Good Luck



Re: OpenBSD on thinkpad x280

2019-05-25 Thread Timo Myyrä
Tristan Pilat  writes:

> Hi OpenBSD users and devs!
>
> I got a new laptop in January, a thinkpad x280. At that time my system
> running 'current' was very slow and I assumed the video acceleration
> wasn't working so I just sadly stuck with Debian for a while. I then
> saw that an update of the inteldrm landed in current a month ago or so
> so I tried yesterday to reinstall current. Unfortunately the system is
> still barely usable. Could you guys tell me why the video acceleration
> isn't handled? Isn't Kaby lake compatible for now? I saw this article
> (https://jcs.org/2017/05/22/xiaomiair) which says it is.
>
> The weird thing is that sometimes the computer is usable (not that fast 
> though) and sometimes it's very slow.
>
> Here's the dmesg:
>
>>OpenBSD 6.5-current (GENERIC.MP) #38: Thu May 23 22:22:19 MDT 2019
>>   dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>>real mem = 8322945024 (7937MB)
>>avail mem = 8060583936 (7687MB)
>>mpath0 at root
>>scsibus0 at mpath0: 256 targets
>>mainbus0 at root
>>bios0 at mainbus0: SMBIOS rev. 3.0 @ 0x6f0bb000 (63 entries)
>>bios0: vendor LENOVO version "N20ET36W (1.21 )" date 09/06/2018
>>bios0: LENOVO 20KF001QFR
>>acpi0 at bios0: rev 2
>>acpi0: sleep states S0 S3 S4 S5
>>acpi0: tables DSDT FACP SSDT SSDT TPM2 UEFI SSDT SSDT HPET APIC MCFG
>>ECDT SSDT SSDT BOOT BATB SLIC SSDT SSDT SSDT LPIT WSMT SSDT SSDT SSDT
>>DBGP DBG2 MSDM DMAR ASF! FPDT UEFI BGRT
>>acpi0: wakeup devices GLAN(S4) XHC_(S3) XDCI(S4) HDAS(S4) RP01(S4)
>>PXSX(S4) RP02(S4) PXSX(S4) PXSX(S4) RP04(S4) PXSX(S4) RP05(S4) PXSX(S4)
>>RP06(S4) PXSX(S4) RP07(S4) [...]
>>acpitimer0 at acpi0: 3579545 Hz, 24 bits
>>acpihpet0 at acpi0: 2399 Hz
>>acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
>>cpu0 at mainbus0: apid 0 (boot processor)
>>cpu0: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz, 1496.89 MHz, 06-8e-0a
>>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,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES,MELTDOWN
>>cpu0: 256KB 64b/line 8-way L2 cache
>>cpu0: smt 0, core 0, package 0
>>mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
>>cpu0: apic clock running at 23MHz
>>cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE
>>cpu1 at mainbus0: apid 2 (application processor)
>>cpu1: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz, 1496.51 MHz, 06-8e-0a
>>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,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES,MELTDOWN
>>cpu1: 256KB 64b/line 8-way L2 cache
>>cpu1: smt 0, core 1, package 0
>>cpu2 at mainbus0: apid 4 (application processor)
>>cpu2: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz, 1496.51 MHz, 06-8e-0a
>>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,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES,MELTDOWN
>>cpu2: 256KB 64b/line 8-way L2 cache
>>cpu2: smt 0, core 2, package 0
>>cpu3 at mainbus0: apid 6 (application processor)
>>cpu3: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz, 1496.51 MHz, 06-8e-0a
>>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,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES,MELTDOWN
>>cpu3: 256KB 64b/line 8-way L2 cache
>>cpu3: smt 0, core 3, package 0
>>cpu4 at mainbus0: apid 1 (application processor)
>>cpu4: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz, 1496.51 MHz, 06-8e-0a
>>cpu4: