[RTEMS Project] #3175: Merge FreeBSD timecounter changes from 2015-01-20 to now

RTEMS trac trac at rtems.org
Thu Oct 12 05:09:33 UTC 2017


#3175: Merge FreeBSD timecounter changes from 2015-01-20 to now
-----------------------------+------------------------------
 Reporter:  Sebastian Huber  |       Owner:  Sebastian Huber
     Type:  enhancement      |      Status:  assigned
 Priority:  normal           |   Milestone:  4.12.0
Component:  score            |     Version:  4.12
 Severity:  normal           |  Resolution:
 Keywords:                   |
-----------------------------+------------------------------

Comment (by Konstantin Belousov <kib@…>):

 In [changeset:"748871578c3dd0077e1f1de246993c80424ab63b/rtems"
 7488715/rtems]:
 {{{
 #!CommitTicketReference repository="rtems"
 revision="748871578c3dd0077e1f1de246993c80424ab63b"
 timecounter: Merge FreeBSD change r304285

 Implement userspace gettimeofday(2) with HPET timecounter.

 Right now, userspace (fast) gettimeofday(2) on x86 only works for
 RDTSC.  For older machines, like Core2, where RDTSC is not C2/C3
 invariant, and which fall to HPET hardware, this means that the call
 has both the penalty of the syscall and of the uncached hw behind the
 QPI or PCIe connection to the sought bridge.  Nothing can me done
 against the access latency, but the syscall overhead can be removed.
 System already provides mappable /dev/hpetX devices, which gives
 straight access to the HPET registers page.

 Add yet another algorithm to the x86 'vdso' timehands. Libc is updated
 to handle both RDTSC and HPET.  For HPET, the index of the hpet device
 to mmap is passed from kernel to userspace, index might be changed and
 libc invalidates its mapping as needed.

 Remove cpu_fill_vdso_timehands() KPI, instead require that
 timecounters which can be used from userspace, to provide
 tc_fill_vdso_timehands{,32}() methods.  Merge i386 and amd64
 libc/<arch>/sys/__vdso_gettc.c into one source file in the new
 libc/x86/sys location.  __vdso_gettc() internal interface is changed
 to move timecounter algorithm detection into the MD code.

 Measurements show that RDTSC even with the syscall overhead is faster
 than userspace HPET access.  But still, userspace HPET is three-four
 times faster than syscall HPET on several Core2 and SandyBridge
 machines.

 Tested by:      Howard Su <howard0su at gmail.com>
 Sponsored by:   The FreeBSD Foundation
 MFC after:      1 month
 Differential revision:  https://reviews.freebsd.org/D7473

 Update #3175.
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/3175#comment:19>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list