Re: Having problems sleeping a used computer
On Tue, Apr 10, 2018 at 06:44:33PM +0200, Peter J. Philipp wrote: > I have expanded on the patch a little bit, it can guarantee a resume from > suspend exactly once, after that the box won't suspend anymore, but is > otherwise useable. Here the new patch. After my signature follows a dmesg > with exactly one suspend to ram (S3) and a wake on lan to bring it back. With light prodding someone who was nice enough to reply had me look into this machine. I pulled out most components and replaced cables. It turns out the AHCI issue was caused by the harddrive. I have replaced it with an old SSD and the patch I made is now useless. Sorry for the misleading. However, the sleep/wake problem is still there. By order of elimination it's the graphics card or the mainboard. I have worked around my initial intention for this by turning off the beep upon boot and waking the box from an off state. This does everything I dreamed of, I'll just have to remember to shutdown -hp now on it after my backup scripts are done. Best regards, -peter
Re: Having problems sleeping a used computer
On Mon, Apr 09, 2018 at 11:51:19PM +0200, Peter J. Philipp wrote: > Hi, > > I inherited a computer which I want to make a sleeping backup computer. The > idea is that it sleeps during the day and then I wake it with arp -W and it > receives backups and then it goes back to sleep, but I'm running into > problems. > > First with a snapshot kernel when I wake the box I get this, and the system > is inoperable (due to the ahci not coming ready, 3rd line from top, sorry > about the flash on my camera, I had one shot and I didn't want to repeat the > moment). The screenshot is here: > > http://centroid.eu/private/ahci-problem.jpg > > Then I added a longer timeout on ahci and it at least put the wake state into > a stable state, here is my patch but it's far from perfect: I have expanded on the patch a little bit, it can guarantee a resume from suspend exactly once, after that the box won't suspend anymore, but is otherwise useable. Here the new patch. After my signature follows a dmesg with exactly one suspend to ram (S3) and a wake on lan to bring it back. Index: ic/ahci.c === RCS file: /cvs/src/sys/dev/ic/ahci.c,v retrieving revision 1.32 diff -u -p -u -r1.32 ahci.c --- ic/ahci.c 21 Aug 2017 21:43:46 - 1.32 +++ ic/ahci.c 10 Apr 2018 16:34:06 - @@ -1488,6 +1488,17 @@ ahci_port_portreset_finish(struct ahci_p int rc, s, retries = 0; s = splbio(); + + /* +* if we have a quirky AHCI hardware, reset it immediately +* instead of trying something and having to reset anyhow +*/ + if ((ap->ap_sc->sc_flags & AHCI_F_QUIRKAROUND)) { + ahci_port_comreset(ap); + ahci_port_portreset_wait(ap); + retries = 1; + } + retry: if (ahci_port_portreset_poll(ap)) { rc = ENODEV; @@ -2756,7 +2767,11 @@ ahci_pwait_eq(struct ahci_port *ap, bus_ for (i = 0; i < n * 1000; i++) { if ((ahci_pread(ap, r) & mask) == target) return (0); - delay(1000); + + if ((ap->ap_sc->sc_flags & AHCI_F_QUIRKAROUND)) + delay(5000); + else + delay(1000); } return (1); Index: ic/ahcivar.h === RCS file: /cvs/src/sys/dev/ic/ahcivar.h,v retrieving revision 1.10 diff -u -p -u -r1.10 ahcivar.h --- ic/ahcivar.h21 Aug 2017 21:43:46 - 1.10 +++ ic/ahcivar.h10 Apr 2018 16:34:06 - @@ -124,6 +124,7 @@ struct ahci_softc { #define AHCI_F_IPMS_PROBE (1<<1) /* IPMS on failed PMP probe */ #define AHCI_F_NO_PMP (1<<2) /* ignore PMP capability */ #define AHCI_F_NO_MSI (1<<3) /* disable MSI */ +#define AHCI_F_QUIRKAROUND (1<<4) /* Intel 6 HD for now */ u_int sc_ncmds; Index: pci/ahci_pci.c === RCS file: /cvs/src/sys/dev/pci/ahci_pci.c,v retrieving revision 1.14 diff -u -p -u -r1.14 ahci_pci.c --- pci/ahci_pci.c 3 Jan 2018 20:10:40 - 1.14 +++ pci/ahci_pci.c 10 Apr 2018 16:34:06 - @@ -275,6 +275,9 @@ ahci_intel_attach(struct ahci_softc *sc, { sc->sc_flags |= AHCI_F_NO_PMP; + if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_6SERIES_AHCI_1) + sc->sc_flags |= AHCI_F_QUIRKAROUND; + return (0); } Thanks, maybe you have some ideas how to make this work better? Regards, -peter OpenBSD 6.3-current (GENERIC.MP) #7: Tue Apr 10 18:33:01 CEST 2018 p...@theta.centroid.eu:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 4259340288 (4062MB) avail mem = 4123140096 (3932MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xeafb0 (100 entries) bios0: vendor American Megatrends Inc. version "E7728MLN.208" date 08/15/2011 bios0: MEDIONPC MS-7728 acpi0 at bios0: rev 2 acpi0: sleep states S0 S1 S3 S4 S5 acpi0: tables DSDT FACP APIC SSDT MCFG SLIC HPET acpi0: wakeup devices BR20(S3) EUSB(S3) USBE(S3) PEX0(S4) RTL_(S1) PEX1(S4) PEX2(S4) PEX3(S4) PEX4(S4) PEX5(S4) PEX6(S4) PEX7(S4) P0P1(S4) P0P2(S3) P0P3(S3) P0P4(S3) [...] acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz, 3293.02 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,POPCNT,DEADLINE,XSAVE,AVX,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN cpu0: 256KB 64b/line 8-way L2 cache cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 10 var ranges,
Having problems sleeping a used computer
Hi, I inherited a computer which I want to make a sleeping backup computer. The idea is that it sleeps during the day and then I wake it with arp -W and it receives backups and then it goes back to sleep, but I'm running into problems. First with a snapshot kernel when I wake the box I get this, and the system is inoperable (due to the ahci not coming ready, 3rd line from top, sorry about the flash on my camera, I had one shot and I didn't want to repeat the moment). The screenshot is here: http://centroid.eu/private/ahci-problem.jpg Then I added a longer timeout on ahci and it at least put the wake state into a stable state, here is my patch but it's far from perfect: Index: ahci.c === RCS file: /cvs/src/sys/dev/ic/ahci.c,v retrieving revision 1.32 diff -u -p -u -r1.32 ahci.c --- ahci.c 21 Aug 2017 21:43:46 - 1.32 +++ ahci.c 9 Apr 2018 21:36:47 - @@ -1504,7 +1504,7 @@ retry: /* Wait for device to become ready */ if (ahci_pwait_clr(ap, AHCI_PREG_TFD, AHCI_PREG_TFD_STS_BSY | - AHCI_PREG_TFD_STS_DRQ | AHCI_PREG_TFD_STS_ERR, 3)) { + AHCI_PREG_TFD_STS_DRQ | AHCI_PREG_TFD_STS_ERR, 10)) { /* even if the device doesn't wake up, check if there's * a port multiplier there */ It could be perfect, but there is still a problem. When I put the box back to sleep it goes shortly for a blip second and then it wakes again, almost like there is data in its wake buffer that was never flushed. I'm suspecting it's probably caused by the drm WARNINGS. At last under my signature I'm going to have the dmesg with 2 wake sessions. So I'm wondering if anyone has hints, patches to try, or otherwise? Best Regards, -peter OpenBSD 6.3-current (GENERIC.MP) #0: Mon Apr 9 22:50:34 CEST 2018 p...@theta.centroid.eu:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 4259340288 (4062MB) avail mem = 4123148288 (3932MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xeafb0 (100 entries) bios0: vendor American Megatrends Inc. version "E7728MLN.208" date 08/15/2011 bios0: MEDIONPC MS-7728 acpi0 at bios0: rev 2 acpi0: sleep states S0 S1 S3 S4 S5 acpi0: tables DSDT FACP APIC SSDT MCFG SLIC HPET acpi0: wakeup devices BR20(S3) EUSB(S3) USBE(S3) PEX0(S4) RTL_(S1) PEX1(S4) PEX2(S4) PEX3(S4) PEX4(S4) PEX5(S4) PEX6(S4) PEX7(S4) P0P1(S4) P0P2(S3) P0P3(S3) P0P4(S3) [...] acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz, 3292.97 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,POPCNT,DEADLINE,XSAVE,AVX,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,IBRS,IBPB,STIBP,SENSOR,ARAT,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 99MHz cpu0: mwait min=64, max=64, C-substates=0.2.1.1, IBE cpu1 at mainbus0: apid 2 (application processor) cpu1: Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz, 3292.53 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,POPCNT,DEADLINE,XSAVE,AVX,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN 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) i3-2120 CPU @ 3.30GHz, 3292.53 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,POPCNT,DEADLINE,XSAVE,AVX,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN 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) i3-2120 CPU @ 3.30GHz, 3292.53 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,POPCNT,DEADLINE,XSAVE,AVX,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN cpu3: 256KB 64b/line 8-way L2 cache cpu3: smt 1, core 1, package 0 ioapic0 at mainbus0: apid 0 pa 0xfec0, version 20, 24 pins acpimcfg0 at acpi0 addr 0xe000, bus 0-255 acpihpet0 at acpi0: 14318179 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus 2 (PEX0) acpiprt2 at acpi0: bus -1 (PEX1) acpiprt3 at acpi0: bus -1 (PEX2) acpiprt4