[PATCH v3 20/36] s390/time: Set up vDSO datapage later

Thomas Weißschuh posted 36 patches 2 weeks ago
[PATCH v3 20/36] s390/time: Set up vDSO datapage later
Posted by Thomas Weißschuh 2 weeks ago
Upcoming changes to the generic vDSO library will mean that the vDSO
datapage will not yet be usable during time_early_init().

Move the initialization to time_init() which is called later. This is
valid as the value of tod_clock_base.tod does not change during the
lifetime of the machine and the vDSO datapage is only used much later.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 arch/s390/kernel/time.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 63517b85f4c930b799235c381d9d6b263fff5431..6b948b9e61fe674bbc842a0143dd35a26b91a860 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -78,8 +78,6 @@ void __init time_early_init(void)
 	struct ptff_qto qto;
 	struct ptff_qui qui;
 
-	vdso_k_time_data->arch_data.tod_delta = tod_clock_base.tod;
-
 	if (!test_facility(28))
 		return;
 
@@ -248,6 +246,8 @@ struct clocksource * __init clocksource_default_clock(void)
  */
 void __init time_init(void)
 {
+	vdso_k_time_data->arch_data.tod_delta = tod_clock_base.tod;
+
 	/* Reset time synchronization interfaces. */
 	stp_reset();
 

-- 
2.51.0

Re: [PATCH v3 20/36] s390/time: Set up vDSO datapage later
Posted by Heiko Carstens 2 weeks ago
On Wed, Sep 17, 2025 at 04:00:22PM +0200, Thomas Weißschuh wrote:
> Upcoming changes to the generic vDSO library will mean that the vDSO
> datapage will not yet be usable during time_early_init().
> 
> Move the initialization to time_init() which is called later. This is
> valid as the value of tod_clock_base.tod does not change during the
> lifetime of the machine and the vDSO datapage is only used much later.

This is not true; tod_clock_base is a union and the tod member is changed
implicitly within clock_sync_global():

	tod_clock_base.eitod += delta;

However that happens only in stop_machine() context. Therefore moving the
initialization to time_init() is indeed ok, since it is called very early
when even preemption is still disabled.

I would appreciate if you would change the commit message a bit.

In any case:
Acked-by: Heiko Carstens <hca@linux.ibm.com>