<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/lib/vdso/gettimeofday.c, branch v7.1</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-05-14T10:30:53+00:00</updated>
<entry>
<title>vdso/gettimeofday: Reload sequence counter after switch to time page in do_aux()</title>
<updated>2026-05-14T10:30:53+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-04-22T09:42:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=602d60ebae0f10bfbc7ba90eee026fdbd0203df3'/>
<id>urn:sha1:602d60ebae0f10bfbc7ba90eee026fdbd0203df3</id>
<content type='text'>
After switching to the real data pages, the sequence counter needs to be
reloaded from there. The code using vdso_read_begin_timens() assumed
this worked by 'continue' jumping to the *beginning* of the do-while
retry loop. However the 'continue' jumps to the *end* of said loop,
evaluating the exit condition. If the data page has a sequence counter
of '1' it will match the one from the time namespace page and prematurely
exit the retry loop. This would result in garbage returned to the caller.

Reload the sequence counter after switching the pages by using an inner
while loop again, which will loop at most once.

The loop generates slightly better code than an explicit reload through
'seq = vdso_read_begin()'.

Fixes: ed78b7b2c5ae ("vdso/gettimeofday: Add a helper to read the sequence lock of a time namespace aware clock")
Reported-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Reviewed-by: Christophe Leroy (CS GROUP) &lt;chleroy@kernel.org&gt;
Link: https://patch.msgid.link/20260422-vdso-aux-timens-loop-v1-1-e2dd8c7164cc@linutronix.de
Closes: https://lore.kernel.org/lkml/CANiDSCsOy0P1if-gJZqOM5pTJ0RDcwVfru1B7KFbTOEMqjPKJw@mail.gmail.com/
</content>
</entry>
<entry>
<title>vdso/datapage: Remove inclusion of gettimeofday.h</title>
<updated>2026-03-11T14:22:32+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-02-27T06:44:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=750d8cc84901757d9e5fe96207f5aa6b3e2acf92'/>
<id>urn:sha1:750d8cc84901757d9e5fe96207f5aa6b3e2acf92</id>
<content type='text'>
vdso/datapage.h is useful without pulling in the architecture-specific
gettimeofday() helpers.

Move the include to the only users which needs it.

Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Signed-off-by: Borislav Petkov (AMD) &lt;bp@alien8.de&gt;
Link: https://patch.msgid.link/20260227-vdso-header-cleanups-v2-12-35d60acf7410@linutronix.de
</content>
</entry>
<entry>
<title>vdso/gettimeofday: Add explicit includes</title>
<updated>2026-03-11T14:13:00+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-02-27T06:44:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9fc2232e285bbd3d71c251376255d7fb2ae34f73'/>
<id>urn:sha1:9fc2232e285bbd3d71c251376255d7fb2ae34f73</id>
<content type='text'>
Various used symbols are only visible through transitive includes.
These transitive includes are about to go away.

Explicitly include the necessary headers.

Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Signed-off-by: Borislav Petkov (AMD) &lt;bp@alien8.de&gt;
Link: https://patch.msgid.link/20260227-vdso-header-cleanups-v2-10-35d60acf7410@linutronix.de
</content>
</entry>
<entry>
<title>vdso/gettimeofday: Move the unlikely() into vdso_read_retry()</title>
<updated>2026-03-11T14:12:05+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-02-27T06:43:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0c02d6df15d4bf7376a965b66d92ad31b0e458fd'/>
<id>urn:sha1:0c02d6df15d4bf7376a965b66d92ad31b0e458fd</id>
<content type='text'>
All callers of vdso_read_retry() test its return value with unlikely().
Move the unlikely into the helper to make the code easier to read.
This is equivalent to the retry function of non-vDSO seqlocks.

Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Signed-off-by: Borislav Petkov (AMD) &lt;bp@alien8.de&gt;
Link: https://patch.msgid.link/20260227-vdso-cleanups-v1-4-c848b4bc4850@linutronix.de
</content>
</entry>
<entry>
<title>vdso/gettimeofday: Add a helper to test if a clock is namespaced</title>
<updated>2026-03-11T14:09:59+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-02-27T06:43:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a657bebd7f02d0ec1ddb08c1d8c572fe1e187f9c'/>
<id>urn:sha1:a657bebd7f02d0ec1ddb08c1d8c572fe1e187f9c</id>
<content type='text'>
Currently this logic is duplicate multiple times.

Add a helper for it to make the code more readable.

  [ bp: Add a missing clocksource.h include, see
    https://lore.kernel.org/r/20260311113435-f72f81d8-33a6-4a0f-bd80-4997aad068cc@linutronix.de ]

Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Signed-off-by: Borislav Petkov (AMD) &lt;bp@alien8.de&gt;
Link: https://patch.msgid.link/20260227-vdso-cleanups-v1-3-c848b4bc4850@linutronix.de
</content>
</entry>
<entry>
<title>vdso/gettimeofday: Add a helper to read the sequence lock of a time namespace aware clock</title>
<updated>2026-03-11T09:27:35+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-02-27T06:43:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ed78b7b2c5ae679960469c0f679539c427e051ab'/>
<id>urn:sha1:ed78b7b2c5ae679960469c0f679539c427e051ab</id>
<content type='text'>
Currently there are three different open-coded variants of a time
namespace aware variant of vdso_read_begin(). They make the code hard to
read and introduce an inconsistency, as only the first copy uses
unlikely().

Split the code into a shared helper function.
Move that next to the definition of the regular vdso_read_begin(), so
that any future changes can be kept in sync easily.

Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Link: https://patch.msgid.link/20260227-vdso-cleanups-v1-2-c848b4bc4850@linutronix.de
</content>
</entry>
<entry>
<title>vdso/gettimeofday: Drop a few usages of __maybe_unused</title>
<updated>2026-03-11T09:27:35+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-02-27T06:43:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=08cd5e1de815842089ca3938c3ad7ac511097d70'/>
<id>urn:sha1:08cd5e1de815842089ca3938c3ad7ac511097d70</id>
<content type='text'>
These functions are used from the very same file,
so this annotation is unnecessary.

Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Link: https://patch.msgid.link/20260227-vdso-cleanups-v1-1-c848b4bc4850@linutronix.de
</content>
</entry>
<entry>
<title>vdso/gettimeofday: Force inlining of __cvdso_clock_getres_common()</title>
<updated>2026-01-26T21:27:07+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-01-23T07:35:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=546e9289c74f606423ef72075b34cc38eda3bb49'/>
<id>urn:sha1:546e9289c74f606423ef72075b34cc38eda3bb49</id>
<content type='text'>
With CONFIG_CC_OPTIMIZE_FOR_SIZE=y, GCC may decide not to inline
__cvdso_clock_getres_common(). This introduces spurious internal
function calls in the vDSO fastpath.

Furthermore, with automatic stack variable initialization
(CONFIG_INIT_STACK_ALL_ZERO or CONFIG_INIT_STACK_ALL_PATTERN) GCC can emit
a call to memset() which is not valid in the vDSO.

Mark __cvdso_clock_getres_common() as __always_inline to avoid both issues.

Paradoxically the inlining even reduces the size of the code:

$ ./scripts/bloat-o-meter arch/powerpc/kernel/vdso/vgettimeofday-32.o.before arch/powerpc/kernel/vdso/vgettimeofday-32.o.after
add/remove: 0/1 grow/shrink: 1/1 up/down: 52/-148 (-96)
Function                                     old     new   delta
__c_kernel_clock_getres_time64                92     144     +52
__c_kernel_clock_getres                      136     132      -4
__cvdso_clock_getres_common                  144       -    -144
Total: Before=2788, After=2692, chg -3.44%

With CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y the functions are always inlined
and therefore the behaviour stays the same.

See also the equivalent change for clock_gettime() in commit b91c8c42ffdd
("lib/vdso: Force inlining of __cvdso_clock_gettime_common()").

Fixes: 21bbfd74044f ("x86/vdso: Provide clock_getres_time64() for x86-32")
Fixes: 1149dcdfc9ef ("ARM: VDSO: Provide clock_getres_time64()")
Fixes: f10c2e72b5de ("arm64: vdso32: Provide clock_getres_time64()")
Fixes: bec06cd6a140 ("MIPS: vdso: Provide getres_time64() for 32-bit ABIs")
Fixes: 759a1f97373f ("powerpc/vdso: Provide clock_getres_time64()")
Reported-by: Sverdlin, Alexander &lt;alexander.sverdlin@siemens.com&gt;
Suggested-by: Christophe Leroy (CS GROUP) &lt;chleroy@kernel.org&gt;
Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Link: https://lore.kernel.org/lkml/230c749f-ebd6-4829-93ee-601d88000a45@kernel.org/
Link: https://patch.msgid.link/20260123-vdso-clock_getres-inline-v1-1-4d6203b90cd3@linutronix.de
Closes: https://lore.kernel.org/lkml/f45316f65a46da638b3c6aa69effd8980e6677b9.camel@siemens.com/
</content>
</entry>
<entry>
<title>vdso: Drop Kconfig GENERIC_VDSO_DATA_STORE</title>
<updated>2025-09-04T09:23:50+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2025-08-26T06:17:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7b338f6d4e3d6baa057e3505592a86f6410d68ed'/>
<id>urn:sha1:7b338f6d4e3d6baa057e3505592a86f6410d68ed</id>
<content type='text'>
All users of the generic vDSO library also use the generic vDSO datastore.

Remove the now unnecessary Kconfig symbol.

Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Link: https://lore.kernel.org/all/20250826-vdso-cleanups-v1-9-d9b65750e49f@linutronix.de

</content>
</entry>
<entry>
<title>vdso/gettimeofday: Remove !CONFIG_TIME_NS stubs</title>
<updated>2025-09-04T09:23:49+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2025-08-26T06:17:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f145d6bf8d590954672a4d0581c92e1799e9c8da'/>
<id>urn:sha1:f145d6bf8d590954672a4d0581c92e1799e9c8da</id>
<content type='text'>
All calls of these functions are already gated behind CONFIG_TIME_NS. The
compiler will already optimize them away if time namespaces are disabled.

Drop the unnecessary stubs.

Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/all/20250826-vdso-cleanups-v1-4-d9b65750e49f@linutronix.de

</content>
</entry>
</feed>
