[PATCH 06/14] vdso/gettimeofday: Return bool from clock_gettime() helpers
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Wed Jul 9 00:34:25 PDT 2025
Hi Marek,
On Tue, Jul 08, 2025 at 05:49:18PM +0200, Marek Szyprowski wrote:
> On 08.07.2025 17:17, Marek Szyprowski wrote:
> > On 01.07.2025 10:58, Thomas Weißschuh wrote:
> >> The internal helpers are effectively using boolean results,
> >> while pretending to use error numbers.
> >>
> >> Switch the return type to bool for more clarity.
> >>
> >> Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
> >> ---
> >> lib/vdso/gettimeofday.c | 58
> >> +++++++++++++++++++++++++------------------------
> >> 1 file changed, 30 insertions(+), 28 deletions(-)
> >
> > This patch landed in today's linux-next as commit fcc8e46f768f
> > ("vdso/gettimeofday: Return bool from clock_gettime() helpers"). In my
> > tests I found that it causes serious problem with hwclock operation on
> > some of my ARM 32bit test boards. I observe that calling "hwclock -w
> > -f /dev/rtc0" never ends on those boards. Disabling vdso support (by
> > removing ARM architected timer) fixes this issue.
>
> I spent some time analyzing the code refactored in this patch and it
> looks that the following change is missing:
Thanks for the report and investigation!
> diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
> index c5266532a097..7e79b02839b0 100644
> --- a/lib/vdso/gettimeofday.c
> +++ b/lib/vdso/gettimeofday.c
> @@ -344,7 +344,7 @@ __cvdso_gettimeofday_data(const struct
> vdso_time_data *vd,
> if (likely(tv != NULL)) {
> struct __kernel_timespec ts;
>
> - if (do_hres(vd, &vc[CS_HRES_COARSE], CLOCK_REALTIME, &ts))
> + if (!do_hres(vd, &vc[CS_HRES_COARSE], CLOCK_REALTIME, &ts))
> return gettimeofday_fallback(tv, tz);
>
> tv->tv_sec = ts.tv_sec;
>
>
> In my tests this fixed the hwclock issue on the mentioned boards.
This fix looks correct to me.
tglx:
Are you going to fold the fix into the commit or do you want a proper patch?
Marek:
If a new patch is required, do you want to send it? You found and fixed the
issue after all. If not, I'll take care of it.
Thomas
More information about the linux-arm-kernel
mailing list