Hi Mike, Thanks for the patch; it appears to fix the clock:
acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat System time is advancing at the expected rate :-) Full dmesg: OpenBSD 6.2-current (GENERIC.MP) #0: Mon Oct 16 11:58:30 EDT 2017 brickf...@atom.irascible.net:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 4192968704 (3998MB) avail mem = 4059033600 (3870MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xedcb0 (49 entries) bios0: vendor Intel Corp. version "PYBSWCEL.86A.0058.2016.1102.1842" date 11/02/2016 bios0: Intel Corporation NUC5CPYB acpi0 at bios0: rev 2 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP APIC FPDT FIDT MCFG SSDT SSDT SSDT UEFI LPIT TPM2 CSRT SSDT acpi0: wakeup devices BRCM(S0) XHC1(S4) HDEF(S4) PXSX(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) 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) Celeron(R) CPU N3050 @ 1.60GHz, 1680.45 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,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT cpu0: 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 4 (application processor) cpu1: Intel(R) Celeron(R) CPU N3050 @ 1.60GHz, 1600.00 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,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT cpu1: 1MB 64b/line 16-way L2 cache cpu1: smt 0, core 2, package 0 ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 115 pins acpimcfg0 at acpi0 addr 0xe0000000, bus 0-255 acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus 1 (RP01) acpiprt2 at acpi0: bus 2 (RP02) acpiprt3 at acpi0: bus 3 (RP03) acpiprt4 at acpi0: bus -1 (RP04) acpiec0 at acpi0: not present acpicpu0 at acpi0 C2: state 6: substate 8 >= num 3 C3: state 7: substate 4 >= num 3: C1(1000@1 mwait.1), PSS acpicpu1 at acpi0 C2: state 6: substate 8 >= num 3 C3: state 7: substate 4 >= num 3: C1(1000@1 mwait.1), PSS acpipwrres0 at acpi0: ID3C, resource for ISP3 acpipwrres1 at acpi0: CLK0, resource for CAMD acpipwrres2 at acpi0: CLK0 acpipwrres3 at acpi0: CLK1, resource for CAM3 acpipwrres4 at acpi0: USBC, resource for XHC1 acpipwrres5 at acpi0: FN00, resource for FAN0 acpitz0 at acpi0: critical temperature is 115 degC chvgpio0 at acpi0: GPO1 uid 2 addr 0xfed88000/0x8000 irq 48, 59 pins "ITE8713" at acpi0 not configured "BCM43241" at acpi0 not configured sdhc0 at acpi0: SDHC addr 0x81429000/0x1000 irq 47 sdhc0: SDHC 3.0, 200 MHz base clock sdmmc0 at sdhc0: 4-bit, sd high-speed, mmc high-speed, dma "INTL9C60" at acpi0 not configured "INTL9C60" at acpi0 not configured "8086228A" at acpi0 not configured "8086228A" at acpi0 not configured dwiic0 at acpi0: I2C6 addr 0x81425000/0x1000 irq 37 iic0 at dwiic0 dwiic1 at acpi0: I2C7 addr 0x81423000/0x1000 irq 38 iic1 at dwiic1 acpibtn0 at acpi0: LID0 acpibtn1 at acpi0: SLPB 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 "MSFT0101" at acpi0 not configured "INT3398" at acpi0 not configured "PNP0C0B" at acpi0 not configured acpivideo0 at acpi0: GFX0 cpu0: Enhanced SpeedStep 1680 MHz: speeds: 1601, 1600, 1520, 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 0x21 inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics" rev 0x21 drm0 at inteldrm0 inteldrm0: msi inteldrm0: 1920x1080, 32bpp wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation) wsdisplay0: screen 1-5 added (std, vt100 emulation) ahci0 at pci0 dev 19 function 0 "Intel Braswell AHCI" rev 0x21: msi, AHCI 1.3.1 ahci0: port 0: 3.0Gb/s ahci0: PHY offline on port 1 scsibus1 at ahci0: 32 targets sd0 at scsibus1 targ 0 lun 0: <ATA, ST9640320AS, 0001> SCSI3 0/direct fixed naa.5000c50024852fc6 sd0: 610480MB, 512 bytes/sector, 1250263728 sectors xhci0 at pci0 dev 20 function 0 "Intel Braswell xHCI" rev 0x21: msi 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 0x21 at pci0 dev 26 function 0 not configured azalia0 at pci0 dev 27 function 0 "Intel Braswell HD Audio" rev 0x21: msi azalia0: codecs: Realtek/0x0283, Intel/0x2883, using Realtek/0x0283 audio0 at azalia0 ppb0 at pci0 dev 28 function 0 "Intel Braswell PCIE" rev 0x21: msi pci1 at ppb0 bus 1 ppb1 at pci0 dev 28 function 1 "Intel Braswell PCIE" rev 0x21: msi pci2 at ppb1 bus 2 iwm0 at pci2 dev 0 function 0 "Intel Dual Band Wireless AC 3165" rev 0x81, msi ppb2 at pci0 dev 28 function 2 "Intel Braswell PCIE" rev 0x21: msi pci3 at ppb2 bus 3 re0 at pci3 dev 0 function 0 "Realtek 8168" rev 0x15: RTL8168H/8111H (0x5400), msi, address f4:4d:30:66:6c:71 rgephy0 at re0 phy 7: RTL8251 PHY, rev. 0 pcib0 at pci0 dev 31 function 0 "Intel Braswell PCU LPC" rev 0x21 ichiic0 at pci0 dev 31 function 3 "Intel Braswell SMBus" rev 0x21: apic 1 int 18 iic2 at ichiic0 spdmem0 at iic2 addr 0x50: 4GB DDR3 SDRAM PC3-12800 SO-DIMM isa0 at pcib0 isadma0 at isa0 pckbc0 at isa0 port 0x60/5 irq 1 irq 12 pckbd0 at pckbc0 (kbd slot) wskbd0 at pckbd0: console keyboard, using wsdisplay0 pcppi0 at isa0 port 0x61 spkr0 at pcppi0 vmm0 at mainbus0: VMX/EPT sdmmc0: can't enable card uhub1 at uhub0 port 1 configuration 1 interface 0 "Logitech Logitech BT Mini-Receiver" rev 2.00/2.00 addr 2 uhidev0 at uhub1 port 2 configuration 1 interface 0 "Logitech Logitech BT Mini-Receiver" rev 2.00/2.00 addr 3 uhidev0: iclass 3/1 ukbd0 at uhidev0: 8 variable keys, 6 key codes wskbd1 at ukbd0 mux 1 wskbd1: connecting to wsdisplay0 uhidev1 at uhub1 port 3 configuration 1 interface 0 "Logitech Logitech BT Mini-Receiver" rev 2.00/2.00 addr 4 uhidev1: iclass 3/1, 18 report ids ums0 at uhidev1 reportid 2: 12 buttons, Z and W dir wsmouse0 at ums0 mux 0 uhid0 at uhidev1 reportid 3: input=4, output=0, feature=0 uhid1 at uhidev1 reportid 4: input=1, output=0, feature=0 ums1 at uhidev1 reportid 5: 8 buttons, Z and W dir wsmouse1 at ums1 mux 0 uhid2 at uhidev1 reportid 8: input=1, output=0, feature=0 uhid3 at uhidev1 reportid 16: input=6, output=6, feature=0 uhid4 at uhidev1 reportid 17: input=19, output=19, feature=0 uhid5 at uhidev1 reportid 18: input=45, output=45, feature=0 uhidev2 at uhub0 port 2 configuration 1 interface 0 "RDing TEMPERHUM1V1.2" rev 2.00/0.01 addr 5 uhidev2: iclass 3/1, 1 report id ukbd1 at uhidev2 reportid 1: 8 variable keys, 5 key codes wskbd2 at ukbd1 mux 1 wskbd2: connecting to wsdisplay0 uhidev3 at uhub0 port 2 configuration 1 interface 1 "RDing TEMPERHUM1V1.2" rev 2.00/0.01 addr 5 uhidev3: iclass 3/1 ugold0 at uhidev3 uhub2 at uhub0 port 5 configuration 1 interface 0 "Genesys Logic USB2.0 Hub" rev 2.00/32.98 addr 6 ugen0 at uhub2 port 1 "Intel Bluetooth" rev 2.00/0.01 addr 7 vscsi0 at root scsibus2 at vscsi0: 256 targets softraid0 at root scsibus3 at softraid0: 256 targets root on sd0a (de339e3c63ba70d0.a) swap on sd0b dump on sd0b iwm0: hw rev 0x210, fw ver 16.242414.0, address 84:ef:18:5d:99:fe ugold0: 2 sensors type si7006 (temperature and humidity) > On Sun, Oct 15, 2017 at 16:38 +0000, Joe Gidi wrote: >> >Synopsis: Recent TSC changes seem to result in frozen clock on Intel >> NUC >> >Category: kernel >> >Environment: >> System : OpenBSD 6.2 >> Details : OpenBSD 6.2-current (GENERIC.MP) #148: Fri Oct 13 >> 16:30:01 >> MDT 2017 >> >> dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP >> >> Architecture: OpenBSD.amd64 >> Machine : amd64 >> >Description: >> After upgrading to a recent snapshot, I noticed the following line in >> dmesg and a frozen clock once the system was up: >> acpitimer0: recalibrated TSC frequency -1 Hz >> I believe this is due to the recent TSC timecounter changes committed >> by >> mikeb. >> >How-To-Repeat: >> Happens all the time with current snapshot. >> >Fix: >> Disabling acpitimer in UKC is enough to bring the system up with a >> functional clock. >> > > Hi, > > Thanks for the report. > > Please try the patch below and show the resulting dmesg. > > diff --git sys/arch/amd64/amd64/tsc.c sys/arch/amd64/amd64/tsc.c > index ce91d5b95df..9ef891dab02 100644 > --- sys/arch/amd64/amd64/tsc.c > +++ sys/arch/amd64/amd64/tsc.c > @@ -121,20 +121,21 @@ calculate_tc_delay(struct timecounter *tc, uint64_t > count1, uint64_t count2) > uint64_t > measure_tsc_freq(struct timecounter *tc) > { > uint64_t count1, count2, frequency, min_freq, tsc1, tsc2; > u_long ef; > - int delay_usec, i, err1, err2, usec; > + int delay_usec, i, err1, err2, err3, usec; > > /* warmup the timers */ > for (i = 0; i < 3; i++) { > (void)tc->tc_get_timecount(tc); > (void)rdtsc(); > } > > min_freq = ULLONG_MAX; > > + err3 = 0; > delay_usec = 100000; > for (i = 0; i < 3; i++) { > ef = read_rflags(); > disable_intr(); > > @@ -148,18 +149,24 @@ measure_tsc_freq(struct timecounter *tc) > continue; > > usec = calculate_tc_delay(tc, count1, count2); > > if ((usec < (delay_usec - RECALIBRATE_DELAY_THRESHOLD)) || > - (usec > (delay_usec + RECALIBRATE_DELAY_THRESHOLD))) > + (usec > (delay_usec + RECALIBRATE_DELAY_THRESHOLD))) { > + err3++; > continue; > + } > > frequency = calculate_tsc_freq(tsc1, tsc2, usec); > > min_freq = MIN(min_freq, frequency); > } > > + min_freq = 0; > + if (err1 || err2) > + printf("Recalibration err1 %d err2 %d err3 %d\n", > + err1, err2, err3); > return (min_freq); > } > > void > calibrate_tsc_freq(void) > -- Joe Gidi j...@entropicblur.com "You cannot buy skill." -- Ross Seyfried