Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 2021 11:43:57 +0200
From:      Sebastian Huber <sebastian.huber@embedded-brains.de>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Large timecounter delta handling
Message-ID:  <302debc8-2888-228a-b009-1bade543fb9a@embedded-brains.de>
In-Reply-To: <994a76c2-4ea6-bfdc-bbe5-0795cf8fd4ee@embedded-brains.de>
References:  <5318327d-d247-bb73-81d9-967c4ae18d32@embedded-brains.de> <YWP8sNfY0i4VNunS@kib.kiev.ua> <994a76c2-4ea6-bfdc-bbe5-0795cf8fd4ee@embedded-brains.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/10/2021 11:31, Sebastian Huber wrote:
>> Your question is more like "under which conditions we switch to use
>> tc_large_delta path in bintime_off()?"=C2=A0 Then it is mostly right, =
that
>> long intervals between tc_windup() calls would trigger it, and it seem=
s
>> that indeed it is around 0.5 sec.
>=20
> Yes, this was the question.
>=20
> I think the initialization value should be 50000:
>=20
> diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
> index 81d373b3b1d0..a4792e31abd4 100644
> --- a/sys/kern/kern_tc.c
> +++ b/sys/kern/kern_tc.c
> @@ -87,7 +87,7 @@ static struct timehands ths[16] =3D {
>  =C2=A0=C2=A0=C2=A0=C2=A0 [0] =3D=C2=A0 {
>  =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .th_counter =3D &dummy_time=
counter,
>  =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .th_scale =3D (uint64_t)-1 =
/ 1000000,
> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .th_large_delta =3D 1000000,
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .th_large_delta =3D 500000,
>  =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .th_offset =3D { .sec =3D 1=
 },
>  =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .th_generation =3D 1,
>  =C2=A0=C2=A0=C2=A0=C2=A0 },

No, sorry. The existing code is correct. I miscalculated the large delta=20
by using th->th_scale for "scale" in

th->th_large_delta =3D MIN(((uint64_t)1 << 63) / scale, UINT_MAX);

which is

th->th_scale =3D scale * 2;

--=20
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht M=C3=BCnchen
Registernummer: HRB 157899
Vertretungsberechtigte Gesch=C3=A4ftsf=C3=BChrer: Peter Rasmussen, Thomas=
 D=C3=B6rfler
Unsere Datenschutzerkl=C3=A4rung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?302debc8-2888-228a-b009-1bade543fb9a>