> Date: Sun, 26 Feb 2023 18:13:18 +1000 > From: David Gwynne <da...@gwynne.id.au> > > i picked a couple of Dell Wyse 3040 boxes, which are very cute, i > like them a lot. however, i have to disable acpitz to be able to > use them because the driver gets stuck during attach. > > during apcitz_attach does a read of all the temperatures. the read > of _TMP ends up talking to tipmic(4) via tipmic_thermal_opreg_handler(). > tipmic_thermal_opreg_handler has a loop on line 335 waiting for > sc->sc_stat_adc to change, but that value is only set from tipmic_intr. > acpitz_attach is running while the kernel is code, and it appears that > the interrupt handler never runs, so that value never changes, and > acpitz blocks. also because it's cold, the timeout on the tsleep doesn't > do anything. thanks to patrick for helping me on the acpi side of things > so we could figure this out.
A better approach might be to make sure that while we're cold, tipmic_thermal_opreg_handler() polls for completion. Something like: while (sc->sc_stat_adc == 0) { if (cold) { delay(1000); tpmic_intr(); } else { if (tsleep(&sc->sc_stat_adc, PRIBIO, "tipmic", SEC_TO_NSEC(1))) { ... } } } > i tried deferring basically all of acpitz_attach to when kthreads are > running, and that works well enough to get to userland. > > is that reasonable? The problem is that you can't really know whether AML accesses the opregion while cold. > also, shortly after dwiic complains about short reads and the kernel > locks up again. i'll have to plug it in and transcribe the exact > errors. i think that's a separate problem though. Yes, dwiic(4) has always been somewhat problematic. Transactions seem to fail randomly on some platforms like the atom system you're looking at but also on my Ampere eMAG system. > OpenBSD 7.2-current (GENERIC.MP) #1071: Wed Feb 22 17:34:56 MST 2023 > dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP > real mem = 2018418688 (1924MB) > avail mem = 1937928192 (1848MB) > random: good seed from bootblocks > mpath0 at root > scsibus0 at mpath0: 256 targets > mainbus0 at root > bios0 at mainbus0: SMBIOS rev. 3.0 @ 0x7a9f4000 (50 entries) > bios0: vendor Dell Inc. version "1.2.5" date 08/20/2018 > bios0: Dell Inc. Wyse 3040 Thin Client > efi0 at bios0: UEFI 2.4 > efi0: American Megatrends rev 0x5000b > acpi0 at bios0: ACPI 5.0 > acpi0: sleep states S0 S4 S5 > acpi0: tables DSDT FACP APIC FPDT FIDT MCFG SSDT SSDT SSDT UEFI SSDT HPET > SSDT SSDT SSDT LPIT BCFG PRAM CSRT WDAT > acpi0: wakeup devices > acpitimer0 at acpi0: 3579545 Hz, 24 bits > acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat > cpu0 at mainbus0: apid 0 (boot processor) > cpu0: Intel(R) Atom(TM) x5-Z8350 CPU @ 1.44GHz, 480.02 MHz, 06-4c-04 > 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,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,TSC_ADJUST,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN > cpu0: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 1MB 64b/line > 16-way L2 cache > cpu0: smt 0, core 0, package 0 > mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges > cpu0: apic clock running at 79MHz > cpu0: mwait min=64, max=64, C-substates=0.2.0.0.0.0.3.3, IBE > cpu1 at mainbus0: apid 2 (application processor) > cpu1: Intel(R) Atom(TM) x5-Z8350 CPU @ 1.44GHz, 480.03 MHz, 06-4c-04 > 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,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,TSC_ADJUST,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN > cpu1: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 1MB 64b/line > 16-way L2 cache > cpu1: smt 0, core 1, package 0 > cpu2 at mainbus0: apid 4 (application processor) > cpu2: Intel(R) Atom(TM) x5-Z8350 CPU @ 1.44GHz, 480.04 MHz, 06-4c-04 > 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,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,TSC_ADJUST,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN > cpu2: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 1MB 64b/line > 16-way L2 cache > cpu2: smt 0, core 2, package 0 > cpu3 at mainbus0: apid 6 (application processor) > cpu3: Intel(R) Atom(TM) x5-Z8350 CPU @ 1.44GHz, 480.07 MHz, 06-4c-04 > 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,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,TSC_ADJUST,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN > cpu3: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 1MB 64b/line > 16-way L2 cache > cpu3: smt 0, core 3, package 0 > ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 115 pins > acpimcfg0 at acpi0 > acpimcfg0: addr 0xe0000000, bus 0-255 > acpihpet0 at acpi0: 14318179 Hz > acpiprt0 at acpi0: bus 0 (PCI0) > acpiprt1 at acpi0: bus 1 (RP01) > acpiprt2 at acpi0: bus -1 (RP02) > acpiprt3 at acpi0: bus -1 (RP03) > acpiprt4 at acpi0: bus -1 (RP04) > "INT33A4" at acpi0 not configured > dwiic0 at acpi0 I2C7 addr 0x9151e000/0x1000 irq 38 > iic0 at dwiic0 > chvgpio0 at acpi0 GPO1 uid 2 addr 0xfed88000/0x8000 irq 48, 59 pins > tipmic0 at iic0 addr 0x5e gpio 15 > acpipci0 at acpi0 PCI0: 0x00000000 0x00000011 0x00000001 > com0 at acpi0 IURT addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo > com0: probed fifo depth: 0 bytes > sdhc0 at acpi0 SDHA addr 0x9152b000/0x1000 irq 45 > sdhc0: SDHC 3.0, 200 MHz base clock > sdmmc0 at sdhc0: 8-bit, sd high-speed, mmc high-speed, ddr52, dma > "INTL9C60" at acpi0 not configured > "INTL9C60" at acpi0 not configured > "8086228A" at acpi0 not configured > dwiic1 at acpi0 I2C1 addr 0x91526000/0x1000 irq 32 > iic1 at dwiic1 > dwiic2 at acpi0 I2C2 addr 0x91524000/0x1000 irq 33 > iic2 at dwiic2 > "10EC5672" at iic2 addr 0x1c not configured > dwiic3 at acpi0 I2C3 addr 0x91522000/0x1000 irq 34 > iic3 at dwiic3 > dwiic4 at acpi0 I2C6 addr 0x91520000/0x1000 irq 37 > iic4 at dwiic4 > "808622A8" at acpi0 not configured > acpicmos0 at acpi0 > acpibtn0 at acpi0: PWRB > chvgpio1 at acpi0 GPO0 uid 1 addr 0xfed80000/0x8000 irq 49, 56 pins > chvgpio2 at acpi0 GPO2 uid 3 addr 0xfed90000/0x8000 irq 50, 24 pins > chvgpio3 at acpi0 GPO3 uid 4 addr 0xfed98000/0x8000 irq 91, 55 pins > chvgpio4 at acpi0 GPO4 uid 5 > "INT33BD" at acpi0 not configured > "ACPI000C" at acpi0 not configured > acpiac0 at acpi0: AC unit online > "PNP0C14" at acpi0 not configured > "INT3400" at acpi0 not configured > "INT3403" at acpi0 not configured > "INT3406" at acpi0 not configured > "INT3403" at acpi0 not configured > acpicpu0 at acpi0: C3(10@1000 mwait.1@0x64), C2(10@500 mwait.1@0x58), > C1(1000@1 mwait.1), PSS > acpicpu1 at acpi0: C3(10@1000 mwait.1@0x64), C2(10@500 mwait.1@0x58), > C1(1000@1 mwait.1), PSS > acpicpu2 at acpi0: C3(10@1000 mwait.1@0x64), C2(10@500 mwait.1@0x58), > C1(1000@1 mwait.1), PSS > acpicpu3 at acpi0: C3(10@1000 mwait.1@0x64), C2(10@500 mwait.1@0x58), > C1(1000@1 mwait.1), PSS > acpipwrres0 at acpi0: ID3C, resource for ISP3 > acpipwrres1 at acpi0: WWPR, resource for SSC1, MDM3 > acpipwrres2 at acpi0: WWPR, resource for SSCW, MDM3 > acpipwrres3 at acpi0: WWPR, resource for HSC1, MDM2 > acpipwrres4 at acpi0: WWPR, resource for HSC3, MDM4 > acpipwrres5 at acpi0: CLK3 > acpipwrres6 at acpi0: CLK4 > acpipwrres7 at acpi0: CLK2, resource for NFC2 > acpipwrres8 at acpi0: CLK1 > acpipwrres9 at acpi0: CLK0 > acpipwrres10 at acpi0: CLK1 > acpipwrres11 at acpi0: USBC, resource for XHC1, OTG1 > acpipwrres12 at acpi0: P28X > acpipwrres13 at acpi0: P18X > acpipwrres14 at acpi0: P12X > acpipwrres15 at acpi0: P28P > acpipwrres16 at acpi0: P18P > acpipwrres17 at acpi0: P19X > acpipwrres18 at acpi0: P06X > acpipwrres19 at acpi0: P12A > acpipwrres20 at acpi0: P28T > acpipwrres21 at acpi0: P18D > acpipwrres22 at acpi0: P18T > acpipwrres23 at acpi0: P3P3 > acpipwrres24 at acpi0: P12T > acpipwrres25 at acpi0: P28W > acpipwrres26 at acpi0: P18W > acpipwrres27 at acpi0: P12W > acpipwrres28 at acpi0: P33W > acpipwrres29 at acpi0: P33X > acpipwrres30 at acpi0: P4BW > acpitz at acpi0 not configured > acpivideo0 at acpi0: GFX0 > cpu0: using VERW MDS workaround > cpu0: Enhanced SpeedStep 480 MHz: speeds: 1441, 1440, 1360, 1280, 1200, 1120, > 1040, 960, 880, 800, 720, 640, 560, 480 MHz > pci0 at mainbus0 bus 0 > pchb0 at pci0 dev 0 function 0 "Intel Braswell Host" rev 0x36 > inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics" rev 0x36 > drm0 at inteldrm0 > inteldrm0: msi, CHERRYVIEW, gen 8 > "Intel Braswell Power" rev 0x36 at pci0 dev 11 function 0 not configured > sdhc1 at pci0 dev 17 function 0 vendor "Intel", unknown product 0x2295 rev > 0x36: apic 1 int 17 > sdhc1: SDHC 3.0, 200 MHz base clock > sdmmc1 at sdhc1: 4-bit, sd high-speed, mmc high-speed, ddr52, dma > xhci0 at pci0 dev 20 function 0 "Intel Braswell xHCI" rev 0x36: msi, xHCI 1.0 > usb0 at xhci0: USB revision 3.0 > uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 > addr 1 > "Intel Braswell TXE" rev 0x36 at pci0 dev 26 function 0 not configured > ppb0 at pci0 dev 28 function 0 "Intel Braswell PCIE" rev 0x36: msi > pci1 at ppb0 bus 1 > re0 at pci1 dev 0 function 0 "Realtek 8168" rev 0x15: RTL8168H/8111H > (0x5400), msi, address 6c:2b:59:34:cc:5c > rgephy0 at re0 phy 7: RTL8251 PHY, rev. 0 > pcib0 at pci0 dev 31 function 0 "Intel Braswell PCU LPC" rev 0x36 > isa0 at pcib0 > isadma0 at isa0 > com1 at isa0 port 0x2f8/8 irq 3: ns8250, no fifo > com2 at isa0 port 0x3e8/8 irq 5: ns8250, no fifo > kbc selftest: ffffffff > pcppi0 at isa0 port 0x61 > spkr0 at pcppi0 > vmm0 at mainbus0: VMX/EPT (using slow L1TF mitigation) > efifb at mainbus0 not configured > scsibus1 at sdmmc0: 2 targets, initiator 0 > sd0 at scsibus1 targ 1 lun 0: <SD/MMC, H8G4a\\222, 0000> removable > sd0: 7456MB, 512 bytes/sector, 15269888 sectors > "Marvell, Wireless Device ID: 40, " manufacturer 0x02df, product 0x912c at > sdmmc1 function 1 not configured > "Marvell, Wireless Device ID: 40, " manufacturer 0x02df, product 0x912c at > sdmmc1 function 2 not configured > "Marvell, Wireless Device ID: 40, " manufacturer 0x02df, product 0x912c at > sdmmc1 function 3 not configured > vscsi0 at root > scsibus2 at vscsi0: 256 targets > softraid0 at root > scsibus3 at softraid0: 256 targets > root on sd0a (46e41697410011a2.a) swap on sd0b dump on sd0b > inteldrm0: 1024x768, 32bpp > wsdisplay0 at inteldrm0 mux 1 > wsdisplay0: screen 0-5 added (std, vt100 emulation) > > Index: acpitz.c > =================================================================== > RCS file: /cvs/src/sys/dev/acpi/acpitz.c,v > retrieving revision 1.59 > diff -u -p -r1.59 acpitz.c > --- acpitz.c 10 Aug 2022 16:58:16 -0000 1.59 > +++ acpitz.c 26 Feb 2023 08:11:01 -0000 > @@ -77,6 +77,7 @@ struct cfdriver acpitz_cd = { > }; > > void acpitz_init_perf(void *); > +void acpitz_attach_thread(void *); > void acpitz_setperf(int); > void acpitz_monitor(struct acpitz_softc *); > void acpitz_refresh(void *); > @@ -187,12 +188,24 @@ acpitz_attach(struct device *parent, str > { > struct acpitz_softc *sc = (struct acpitz_softc *)self; > struct acpi_attach_args *aa = aux; > - int i; > - char name[5]; > > sc->sc_acpi = (struct acpi_softc *)parent; > sc->sc_devnode = aa->aaa_node; > > + printf("\n"); > + > + kthread_create_deferred(acpitz_attach_thread, sc); > +} > + > +void > +acpitz_attach_thread(void *arg) > +{ > + struct acpitz_softc *sc = arg; > + int i; > + char name[5]; > + > + printf("%s", sc->sc_dev.dv_xname); > + > TAILQ_INIT(&sc->sc_psl); > for (i = 0; i < ACPITZ_MAX_AC; i++) > TAILQ_INIT(&sc->sc_alx[i]); > @@ -249,7 +262,7 @@ acpitz_attach(struct device *parent, str > * piece of code that touches this pointer after all CPUs have been > * fully attached > */ > - kthread_create_deferred(acpitz_init_perf, sc); > + acpitz_init_perf(sc); > } > > int > >