diff options
| author | Sven Schnelle <svens@linux.ibm.com> | 2025-07-10 09:42:29 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-08-28 16:24:20 +0200 |
| commit | 5e18232d72a184896880dd070de2085cc96f5775 (patch) | |
| tree | e68afad915f50ec6c24c45d51d7862cdec1b8334 /arch | |
| parent | 39968a6d1b7f9c3bc3e1001b9f6964507f3c0d3f (diff) | |
| download | linux-5e18232d72a184896880dd070de2085cc96f5775.tar.gz linux-5e18232d72a184896880dd070de2085cc96f5775.tar.bz2 linux-5e18232d72a184896880dd070de2085cc96f5775.zip | |
s390/time: Use monotonic clock in get_cycles()
[ 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>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/s390/include/asm/timex.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h index bc50ee0e91ff..a046a4d13816 100644 --- a/arch/s390/include/asm/timex.h +++ b/arch/s390/include/asm/timex.h @@ -196,13 +196,6 @@ static inline unsigned 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); @@ -225,6 +218,12 @@ static inline unsigned 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 |
