Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Oct 2019 08:48:33 +0200
From:      Sebastian Huber <sebastian.huber@embedded-brains.de>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        FreeBSD <freebsd-hackers@freebsd.org>
Subject:   Re: Make timehands count selectable at boottime?
Message-ID:  <c705f37c-a7d5-e656-f8af-e91de7f743d5@embedded-brains.de>
In-Reply-To: <20191001143718.GU44691@kib.kiev.ua>
References:  <0d534569-504f-52c2-f09c-b977fe80843d@embedded-brains.de> <20191001143718.GU44691@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On 01/10/2019 16:37, Konstantin Belousov wrote:
> On Tue, Oct 01, 2019 at 12:48:46PM +0200, Sebastian Huber wrote:
>> Hello,
>>
>> a recent commit made the timehands count selectable at boottime:
>>
>> https://reviews.freebsd.org/D21563
>>
>> What was the reason for this change?
>=20
> See the followup thread on the svn-src@ list for this revision.

Thanks for the hint. So, this change is related to the PPS handling and=20
the things which happen between a pps_capture() and pps_event().

What I don't understand is why more timehands are a problem for the=20
consumer side. For example:

void
binuptime(struct bintime *bt)
{
	struct timehands *th;
	u_int gen;

	do {
		th =3D timehands;
		gen =3D atomic_load_acq_int(&th->th_generation);
		*bt =3D th->th_offset;
		bintime_addx(bt, th->th_scale * tc_delta(th));
		atomic_thread_fence_acq();
	} while (gen =3D=3D 0 || gen !=3D th->th_generation);
}

With more timehands the time frame in which th->th_generation remains=20
constant is longer the more timehands you have. So, it is less likely=20
that you have to execute the loop body twice. The count of timehands is=20
limited by the timecounter frequency and mask, and the hz configuration.

--=20
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine gesch=C3=A4ftliche Mitteilung im Sinne des EHUG=
.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c705f37c-a7d5-e656-f8af-e91de7f743d5>