Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Dec 2016 11:06:53 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: How to use sem_timedwait?
Message-ID:  <1481911613.1972.74.camel@freebsd.org>
In-Reply-To: <20161215171534.GV94325@kib.kiev.ua>
References:  <20161214074228.zh6q5zya2gszw4g6@hal9000.meka.no-ip.org> <1481748960.1889.398.camel@freebsd.org> <20161215002906.mllorgvvuovbdtze@hal9000.meka.no-ip.org> <1481775511.1889.450.camel@freebsd.org> <1481776532.1889.461.camel@freebsd.org> <20161215112050.GO94325@kib.kiev.ua> <1481817343.1889.467.camel@freebsd.org> <20161215171534.GV94325@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2016-12-15 at 19:15 +0200, Konstantin Belousov wrote:
> On Thu, Dec 15, 2016 at 08:55:43AM -0700, Ian Lepore wrote:
> > 
> > It makes me feel a bit better to hear that it's only this machine,
> > which is pretty old.  I wonder if it has something to do with
> > overclocking the cpu?  I never have any other kind of timing
> > trouble,
> > though.  (Given that I work in the field of precision timing, I'm a
> > bit
> > sensitive to such things.)
> > 
> > revolution > sysctl kern.timecounter kern.eventtimer
> > kern.timecounter.tsc_shift: 1
> > kern.timecounter.smp_tsc_adjust: 0
> > kern.timecounter.smp_tsc: 1
> > kern.timecounter.invariant_tsc: 1
> > kern.timecounter.fast_gettime: 1
> > kern.timecounter.tick: 1
> > kern.timecounter.choice: TSC-low(1000) ACPI-fast(900) HPET(950)
> > i8254(0) dummy(-1000000)
> > kern.timecounter.hardware: TSC-low
> > kern.timecounter.alloweddeviation: 0
> > kern.timecounter.stepwarnings: 0
> > kern.timecounter.tc.TSC-low.quality: 1000
> > kern.timecounter.tc.TSC-low.frequency: 2125044382
> > kern.timecounter.tc.TSC-low.counter: 1611837909
> > kern.timecounter.tc.TSC-low.mask: 4294967295
> > kern.timecounter.tc.ACPI-fast.quality: 900
> > kern.timecounter.tc.ACPI-fast.frequency: 3579545
> > kern.timecounter.tc.ACPI-fast.counter: 6548232
> > kern.timecounter.tc.ACPI-fast.mask: 16777215
> > kern.timecounter.tc.HPET.quality: 950
> > kern.timecounter.tc.HPET.frequency: 14318180
> > kern.timecounter.tc.HPET.counter: 3623382209
> > kern.timecounter.tc.HPET.mask: 4294967295
> > kern.timecounter.tc.i8254.quality: 0
> > kern.timecounter.tc.i8254.frequency: 1193182
> > kern.timecounter.tc.i8254.counter: 18218
> > kern.timecounter.tc.i8254.mask: 65535
> > kern.eventtimer.periodic: 0
> > kern.eventtimer.timer: LAPIC
> > kern.eventtimer.idletick: 0
> > kern.eventtimer.singlemul: 2
> > kern.eventtimer.choice: LAPIC(600) HPET(350) HPET1(340) HPET2(340)
> > HPET3(340) i8254(100) RTC(0)
> > kern.eventtimer.et.HPET3.quality: 340
> > kern.eventtimer.et.HPET3.frequency: 14318180
> > kern.eventtimer.et.HPET3.flags: 3
> > kern.eventtimer.et.HPET2.quality: 340
> > kern.eventtimer.et.HPET2.frequency: 14318180
> > kern.eventtimer.et.HPET2.flags: 3
> > kern.eventtimer.et.HPET1.quality: 340
> > kern.eventtimer.et.HPET1.frequency: 14318180
> > kern.eventtimer.et.HPET1.flags: 3
> > kern.eventtimer.et.HPET.quality: 350
> > kern.eventtimer.et.HPET.frequency: 14318180
> > kern.eventtimer.et.HPET.flags: 3
> > kern.eventtimer.et.RTC.quality: 0
> > kern.eventtimer.et.RTC.frequency: 32768
> > kern.eventtimer.et.RTC.flags: 17
> > kern.eventtimer.et.i8254.quality: 100
> > kern.eventtimer.et.i8254.frequency: 1193182
> > kern.eventtimer.et.i8254.flags: 1
> > kern.eventtimer.et.LAPIC.quality: 600
> > kern.eventtimer.et.LAPIC.frequency: 85001804
> > kern.eventtimer.et.LAPIC.flags: 7
> > 
> > 
> > FreeBSD 10.3-STABLE #5 r308807: Fri Nov 18 09:51:39 MST 2016
> >     ilepore@revolution.hippie.lan:/b/staging/machines/revolution10/
> > obj/b/staging/machines/revolution10/src/sys/REVOLUTION10 amd64
> > FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032)
> > 20140512
> > VT(vga): text 80x25
> > CPU: Intel(R) Xeon(R) CPU           W3680  @ 3.33GHz (4250.09-MHz
> > K8-class CPU)
> >  
> > Origin="GenuineIntel"  Id=0x206c2  Family=0x6  Model=0x2c  Stepping
> > =2
> >  
> > Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTR
> > R,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,
> > TM,PBE>
> >  
> > Features2=0x29ee3ff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM
> > 2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,POPCNT,AESNI>
> >   AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
> >   AMD Features2=0x1<LAHF>
> >   VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
> >   TSC: P-state invariant, performance statistics
> > real memory  = 12884901888 (12288 MB)
> > avail memory = 12425519104 (11849 MB)
> > Event timer "LAPIC" quality 600
> > ACPI APIC Table: <092410 APIC1941>
> > FreeBSD/SMP: Multiprocessor System Detected: 12 CPUs
> > FreeBSD/SMP: 1 package(s) x 6 core(s) x 2 SMT threads
> > 
> It is Westmere machine.  If you switch to the HPET hardware for
> eventtimer,
> does it feel better ?
> 
> Also please show output of sysctl dev.cpu.0.  You are on stable/10,
> there
> were no usage of MWAIT instruction, but still switching to HPET might
> make
> a difference.
> _

I tried LAPIC, HPET, and i8254 for eventtimer.hardware, there was no
change with any of them.  I tried turning periodic on, still no change.
  Changing alloweddeviation made no change.  I tried different hardware
choices for timecounter too (not that timecounting is showing any signs
of trouble on this machine), no change.

revolution > sysctl dev.cpu.0
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 303us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/32 C2/2/96 C3/3/128
dev.cpu.0.freq_levels: 3334/143000 3333/130000 3200/117000 3067/105000
2933/94000 2800/85000 2667/76000 2533/68000 2400/61000 2267/54000
2133/48000 2000/43000 1867/39000 1733/35000 1600/32000
dev.cpu.0.freq: 3333
dev.cpu.0.temperature: 69.0C
dev.cpu.0.coretemp.throttle_log: 0
dev.cpu.0.coretemp.tjmax: 101.0C
dev.cpu.0.coretemp.resolution: 1
dev.cpu.0.coretemp.delta: 32
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%location: handle=\_PR_.P001
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU

I also ran the test program on a couple servers at $work runing 10.3-
stable, and they both showed identical behavior, with the result in the
same range as on this machine: nsec = 9315538211 for 1000000 loops of
10000 nsec.

One of those machines is running as a vmware guest:

FreeBSD 10.3-STABLE-20161014 #2 r307350M: Mon Oct 17 18:07:23 MDT 2016
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
CPU: Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz (2197.45-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x206d2  Family=0x6  Model=0x2d  Stepping=2
  Features=0xfa3fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,DTS,MMX,FXSR,SSE,SSE2,SS>
  Features2=0x9fba2203<SSE3,PCLMULQDQ,SSSE3,CX16,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,HV>
  AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  AMD Features2=0x1<LAHF>
  Structured Extended Features=0x2<TSCADJ>
  TSC: P-state invariant
Hypervisor: Origin = "VMwareVMware"
real memory  = 2147483648 (2048 MB)
avail memory = 2050031616 (1955 MB)
Event timer "LAPIC" quality 600

and the other is running on bare metal:

FreeBSD 10.3-STABLE-20161014 #2 r307350M: Mon Oct 17 18:30:37 MDT 2016
CPU: Intel(R) Xeon(R) CPU           X5550  @ 2.67GHz (2660.05-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x106a5  Family=0x6  Model=0x1a  Stepping=5
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x9ce3bd<SSE3,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,SSE4.2,POPCNT>
  AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  AMD Features2=0x1<LAHF>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,VPID
  TSC: P-state invariant, performance statistics
real memory  = 206158430208 (196608 MB)
avail memory = 200380227584 (191097 MB)
Event timer "LAPIC" quality 400

-- Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1481911613.1972.74.camel>