[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87frf9ru9v.ffs@tglx>
Date: Sun, 06 Jul 2025 21:31:08 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
Andy Lutomirski
<luto@...nel.org>, Vincenzo Frascino <vincenzo.frascino@....com>, Shuah
Khan <shuah@...nel.org>, Anna-Maria Behnsen <anna-maria@...utronix.de>,
Frederic Weisbecker <frederic@...nel.org>, John Stultz
<jstultz@...gle.com>, Stephen Boyd <sboyd@...nel.org>, Catalin Marinas
<catalin.marinas@....com>, Will Deacon <will@...nel.org>, Arnd Bergmann
<arnd@...db.de>
Cc: linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-arch@...r.kernel.org, Richard
Cochran <richardcochran@...il.com>, Christopher Hall
<christopher.s.hall@...el.com>, Frederic Weisbecker <frederic@...nel.org>,
Anna-Maria Behnsen <anna-maria@...utronix.de>, Miroslav Lichvar
<mlichvar@...hat.com>, Werner Abt <werner.abt@...nberg-usa.com>, David
Woodhouse <dwmw2@...radead.org>, Stephen Boyd <sboyd@...nel.org>, Kurt
Kanzenbach <kurt@...utronix.de>, Nam Cao <namcao@...utronix.de>, Antoine
Tenart <atenart@...nel.org>, Thomas Weißschuh
<thomas.weissschuh@...utronix.de>
Subject: Re: [PATCH 12/14] vdso/gettimeofday: Add support for auxiliary clocks
On Tue, Jul 01 2025 at 10:58, Thomas Weißschuh wrote:
> +static __always_inline
> +bool do_aux(const struct vdso_time_data *vd, clockid_t clock, struct __kernel_timespec *ts)
> +{
> + const struct vdso_clock *vc;
> + u64 sec, ns;
> + u32 seq;
> + u8 idx;
> +
> + if (!IS_ENABLED(CONFIG_POSIX_AUX_CLOCKS))
> + return false;
> +
> + idx = clock - CLOCK_AUX;
> + vc = &vd->aux_clock_data[idx];
> +
> + do {
> + /*
> + * Open coded function vdso_read_begin() to handle
> + * VDSO_CLOCK_TIMENS. See comment in do_hres().
> + */
> + while ((seq = READ_ONCE(vc->seq)) & 1) {
> + if (IS_ENABLED(CONFIG_TIME_NS) && vc->clock_mode == VDSO_CLOCKMODE_TIMENS) {
> + vd = __arch_get_vdso_u_timens_data(vd);
> + vc = &vd->aux_clock_data[idx];
> + break;
This actually wants to be a continue because otherwise @seq contains the
stale value from the initial read of the TIMENS page, which is
0x1. That's a pointless extra round through the below.
With continue it re-reads, but this time the actual value from the time
data page and also takes an eventual odd value into account properly.
I fixed it up locally already.
Thanks,
tglx
Powered by blists - more mailing lists