All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Li Wang <liwang@redhat.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: ltp@lists.linux.it, linux-kernel@vger.kernel.org,
	linux-s390@vger.kernel.org
Subject: [PATCH 1/3] s390/vdso: fix tod clock steering
Date: Tue, 23 Mar 2021 22:58:17 +0100	[thread overview]
Message-ID: <20210323215819.4161164-2-hca@linux.ibm.com> (raw)
In-Reply-To: <20210323215819.4161164-1-hca@linux.ibm.com>

The s390 specific vdso function __arch_get_hw_counter() is supposed to
consider tod clock steering.

If a tod clock steering event happens and the tod clock is set to a
new value __arch_get_hw_counter() will not return the real tod clock
value but slowly drift it from the old delta until the returned value
finally matches the real tod clock value again.

When converting the assembler code to C it was forgotten to tell user
space in which direction the clock has to be adjusted.

Worst case is now that instead of drifting the clock slowly it will
jump into the opposite direction by a factor of two.

Fix this by simply providing the missing value to user space.

Fixes: 4bff8cb54502 ("s390: convert to GENERIC_VDSO")
Cc: <stable@vger.kernel.org> # 5.10
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 arch/s390/kernel/time.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 165da961f901..e37285a5101b 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -382,6 +382,7 @@ static void clock_sync_global(unsigned long delta)
 		      tod_steering_delta);
 	tod_steering_end = now + (abs(tod_steering_delta) << 15);
 	vdso_data->arch_data.tod_steering_end = tod_steering_end;
+	vdso_data->arch_data.tod_steering_delta = tod_steering_delta;
 
 	/* Update LPAR offset. */
 	if (ptff_query(PTFF_QTO) && ptff(&qto, sizeof(qto), PTFF_QTO) == 0)
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Heiko Carstens <hca@linux.ibm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/3] s390/vdso: fix tod clock steering
Date: Tue, 23 Mar 2021 22:58:17 +0100	[thread overview]
Message-ID: <20210323215819.4161164-2-hca@linux.ibm.com> (raw)
In-Reply-To: <20210323215819.4161164-1-hca@linux.ibm.com>

The s390 specific vdso function __arch_get_hw_counter() is supposed to
consider tod clock steering.

If a tod clock steering event happens and the tod clock is set to a
new value __arch_get_hw_counter() will not return the real tod clock
value but slowly drift it from the old delta until the returned value
finally matches the real tod clock value again.

When converting the assembler code to C it was forgotten to tell user
space in which direction the clock has to be adjusted.

Worst case is now that instead of drifting the clock slowly it will
jump into the opposite direction by a factor of two.

Fix this by simply providing the missing value to user space.

Fixes: 4bff8cb54502 ("s390: convert to GENERIC_VDSO")
Cc: <stable@vger.kernel.org> # 5.10
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 arch/s390/kernel/time.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 165da961f901..e37285a5101b 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -382,6 +382,7 @@ static void clock_sync_global(unsigned long delta)
 		      tod_steering_delta);
 	tod_steering_end = now + (abs(tod_steering_delta) << 15);
 	vdso_data->arch_data.tod_steering_end = tod_steering_end;
+	vdso_data->arch_data.tod_steering_delta = tod_steering_delta;
 
 	/* Update LPAR offset. */
 	if (ptff_query(PTFF_QTO) && ptff(&qto, sizeof(qto), PTFF_QTO) == 0)
-- 
2.25.1


  reply	other threads:[~2021-03-23 21:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  6:21 [LTP] [s390x vDSO Bug?] clock_gettime(CLOCK_MONOTONIC_RAW, ...) gets abnormal ts value Li Wang
2021-03-23  7:11 ` Heiko Carstens
2021-03-23  7:11   ` [LTP] " Heiko Carstens
2021-03-23 13:48   ` Heiko Carstens
2021-03-23 13:48     ` [LTP] " Heiko Carstens
2021-03-23 21:58   ` [PATCH 0/3] s390 vdso fixes Heiko Carstens
2021-03-23 21:58     ` [LTP] " Heiko Carstens
2021-03-23 21:58     ` Heiko Carstens [this message]
2021-03-23 21:58       ` [LTP] [PATCH 1/3] s390/vdso: fix tod clock steering Heiko Carstens
2021-03-24  9:50       ` Heiko Carstens
2021-03-24  9:50         ` [LTP] " Heiko Carstens
2021-03-23 21:58     ` [PATCH 2/3] s390/vdso: fix arch_data access for __arch_get_hw_counter() Heiko Carstens
2021-03-23 21:58       ` [LTP] " Heiko Carstens
2021-03-24  5:53       ` Heiko Carstens
2021-03-24  5:53         ` [LTP] " Heiko Carstens
2021-03-23 21:58     ` [PATCH 3/3] lib/vdso: remove struct arch_vdso_data from vdso data struct Heiko Carstens
2021-03-23 21:58       ` [LTP] " Heiko Carstens
2021-03-25 17:55       ` Thomas Gleixner
2021-03-25 17:55         ` [LTP] " Thomas Gleixner
2021-03-25 17:57         ` Thomas Gleixner
2021-03-25 17:57           ` [LTP] " Thomas Gleixner
2021-03-25  8:56     ` [LTP] [PATCH 0/3] s390 vdso fixes Li Wang
2021-03-25 12:33       ` Heiko Carstens
2021-03-25 12:33         ` [LTP] " Heiko Carstens
2021-03-25 14:11         ` Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210323215819.4161164-2-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    --cc=svens@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.