Re: [PATCH] hv_utils: return error if host timesysnc update is stale

From: Vineeth Pillai
Date: Thu Aug 20 2020 - 17:39:30 EST



Hi Michael,

> > +const u64 HOST_TIMESYNC_DELAY_THRESH = 600 * NSEC_PER_SEC;
>
> Kernel test robot has already complained that this should be static,
> and about the potential overflow based on the types of the constants in
> the right side expression. I didn't check the details, but I suspect the
> complaint is when building in 32-bit mode. This code does get built in
> 32-bit mode and it's possible for run 32-bit Linux guests on Hyper-V.
>
NSEC_PER_SEC is defined long and it caused the warning with i386 build.
Casting it to u64 would fix the issue. Will fix the static warning as well
in the next iteration.

> > + pr_warn("TIMESYNC IC: Stale time stamp, %llu nsecs old\n",
> > + HOST_TIMESYNC_DELAY_THRESH);
>
> Let's provide the timediff_adj in the message instead of the constant
> threshold value so we know the degree of staleness. :-)
>
> Also, I'm wondering if this should be pr_warn_once(). Presumably
> chronyd or whoever is reading /dev/ptp0 will give up after getting
> this error, but if not, it would be nice to avoid filling up the console
> with these error messages.
>
Makes sense, will fix this also.

Thanks,
Vineeth