Re: Large timecounter delta handling

From: Sebastian Huber <sebastian.huber_at_embedded-brains.de>
Date: Mon, 11 Oct 2021 09:43:57 UTC
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()?"  Then it is mostly right, that
>> long intervals between tc_windup() calls would trigger it, and it seems
>> that indeed it is around 0.5 sec.
> 
> Yes, this was the question.
> 
> I think the initialization value should be 50000:
> 
> 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] = {
>       [0] =  {
>          .th_counter = &dummy_timecounter,
>          .th_scale = (uint64_t)-1 / 1000000,
> -       .th_large_delta = 1000000,
> +       .th_large_delta = 500000,
>          .th_offset = { .sec = 1 },
>          .th_generation = 1,
>       },

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

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

which is

th->th_scale = scale * 2;

-- 
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ünchen
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/