]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/time: Use monotonic clock in get_cycles()
authorSven Schnelle <svens@linux.ibm.com>
Thu, 10 Jul 2025 07:42:29 +0000 (09:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:22:42 +0000 (16:22 +0200)
[ Upstream commit 09e7e29d2b49ba84bcefb3dc1657726d2de5bb24 ]

Otherwise the code might not work correctly when the clock
is changed.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/include/asm/timex.h

index 588aa0f2c842c3667db06b66722e952afa77e994..d0260a1ec298bfc7d1f93d8ee5cc05d035c15b1c 100644 (file)
@@ -167,13 +167,6 @@ static inline unsigned long long get_tod_clock_fast(void)
        return get_tod_clock();
 #endif
 }
-
-static inline cycles_t get_cycles(void)
-{
-       return (cycles_t) get_tod_clock() >> 2;
-}
-#define get_cycles get_cycles
-
 int get_phys_clock(unsigned long *clock);
 void init_cpu_timer(void);
 
@@ -196,6 +189,12 @@ static inline unsigned long long get_tod_clock_monotonic(void)
        return tod;
 }
 
+static inline cycles_t get_cycles(void)
+{
+       return (cycles_t)get_tod_clock_monotonic() >> 2;
+}
+#define get_cycles get_cycles
+
 /**
  * tod_to_ns - convert a TOD format value to nanoseconds
  * @todval: to be converted TOD format value