Skip to content

Commit 09e7e29

Browse files
svens-s390Alexander Gordeev
authored andcommitted
s390/time: Use monotonic clock in get_cycles()
Otherwise the code might not work correctly when the clock is changed. Signed-off-by: Sven Schnelle <[email protected]> Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 4eda260 commit 09e7e29

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

arch/s390/include/asm/timex.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,6 @@ static inline unsigned long get_tod_clock_fast(void)
196196
asm volatile("stckf %0" : "=Q" (clk) : : "cc");
197197
return clk;
198198
}
199-
200-
static inline cycles_t get_cycles(void)
201-
{
202-
return (cycles_t) get_tod_clock() >> 2;
203-
}
204-
#define get_cycles get_cycles
205-
206199
int get_phys_clock(unsigned long *clock);
207200
void init_cpu_timer(void);
208201

@@ -230,6 +223,12 @@ static inline unsigned long get_tod_clock_monotonic(void)
230223
return tod;
231224
}
232225

226+
static inline cycles_t get_cycles(void)
227+
{
228+
return (cycles_t)get_tod_clock_monotonic() >> 2;
229+
}
230+
#define get_cycles get_cycles
231+
233232
/**
234233
* tod_to_ns - convert a TOD format value to nanoseconds
235234
* @todval: to be converted TOD format value

0 commit comments

Comments
 (0)