Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Sep 2015 20:12:46 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Andrew Turner <andrew@fubar.geek.nz>
Cc:        Ian Lepore <ian@freebsd.org>, freebsd-arm@freebsd.org
Subject:   Re: Shared page and related goodies for ARMv7
Message-ID:  <20150929171246.GK11284@kib.kiev.ua>
In-Reply-To: <20150929175422.417baf94@bender.Home>
References:  <20150929132332.GH11284@kib.kiev.ua> <1443539982.1224.433.camel@freebsd.org> <20150929162312.GJ11284@kib.kiev.ua> <20150929175422.417baf94@bender.Home>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 29, 2015 at 05:54:22PM +0100, Andrew Turner wrote:
> On Tue, 29 Sep 2015 19:23:12 +0300
> Konstantin Belousov <kostikbel@gmail.com> wrote:
> 
> > On Tue, Sep 29, 2015 at 09:19:42AM -0600, Ian Lepore wrote:
> > > I just skimmed through the patch quickly and the main thing that
> > > jumps out at me is that what you've done works only on rpi2 and
> > > aarch64, because those are the only platforms that support that
> > > timer hardware. (That means I can't test it, but once I get your
> > > patch in a usable form I can have a shot at implementations for
> > > other timers).
> > Cortex A7/A15 and whole ARMv8 is not too bad set of machines for fast
> > gettimeofday() IMO, at least for the first try.  I am willing to
> > adjust both approach and code it for wider usefulness.
> 
> It's an optional feature on ARMv7, we only build it for Exynos 5,
> Raspberry Pi 2, and QEMU virt.
> 
> How will it work on hardware that lacks the generic timer? Will it
> always try and use this hardware, even if it's missing, or do we need
> to tell userland what to use, with a fallback to a syscall? 
The AT_TIMEKEEP aux vector is provided by kernel. It points to
the struct vdso_timekeep (see sys/vdso.h), which contains tk_ver
and tk_enabled fields. The tk_ver member defines the version for
layout of the struct vdso_timekeep, and tk_enabled is boolean which
indicates should the user-space gettimeofday() mechanism be used.
The tk_enabled member is never set to true for non generic timer
timecounter in the patch. If the hardware is compatible, operator can
still manually control use of the syscall vs. usermode time with sysctl
kern.timecounter.fast_gettime.

The struct vdso_timehands has the th_algo member, which is intended
to communicate the actual algorithm to calculate the time. Idea of
algorithm includes both kind of hardware used and interpretation of the
VDSO_TIMEHANDS_MD members, if required by algorithm. This was intended
to, eg. select between different hardware like RDTSC or HPET on x86.



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