mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 09:31:50 +00:00
237ec6f2e5
Many clocks that are used to provide sched_clock will reset during suspend. If read_sched_clock returns 0 after suspend, sched_clock will appear to jump forward. This patch resets cd.epoch_cyc to the current value of read_sched_clock during resume, which causes sched_clock() just after suspend to return the same value as sched_clock() just before suspend. In addition, during the window where epoch_ns has been updated before suspend, but epoch_cyc has not been updated after suspend, it is unknown whether the clock has reset or not, and sched_clock() could return a bogus value. Add a suspended flag, and return the pre-suspend epoch_ns value during this period. The new behavior is triggered by calling setup_sched_clock_needs_suspend instead of setup_sched_clock. Signed-off-by: Colin Cross <ccross@android.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
17 lines
545 B
C
17 lines
545 B
C
/*
|
|
* sched_clock.h: support for extending counters to full 64-bit ns counter
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#ifndef ASM_SCHED_CLOCK
|
|
#define ASM_SCHED_CLOCK
|
|
|
|
extern void sched_clock_postinit(void);
|
|
extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
|
|
extern void setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,
|
|
unsigned long rate);
|
|
|
|
#endif
|