Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Thomas Gleixner:
"The timer departement delivers:
- a regression fix for the NTP code along with a proper selftest
- prevent a spurious timer interrupt in the NOHZ lowres code
- a fix for user space interfaces returning the remaining time on
architectures with CONFIG_TIME_LOW_RES=y
- a few patches to fix COMPILE_TEST fallout"
* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
tick/nohz: Set the correct expiry when switching to nohz/lowres mode
clocksource: Fix dependencies for archs w/o HAS_IOMEM
clocksource: Select CLKSRC_MMIO where needed
tick/sched: Hide unused oneshot timer code
kselftests: timers: Add adjtimex SETOFFSET validity tests
ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO
itimers: Handle relative timers with CONFIG_TIME_LOW_RES proper
posix-timers: Handle relative timers with CONFIG_TIME_LOW_RES proper
timerfd: Handle relative timers with CONFIG_TIME_LOW_RES proper
hrtimer: Handle remaining time proper for TIME_LOW_RES
clockevents/tcb_clksrc: Prevent disabling an already disabled clock
This commit is contained in:
commit
dc799d0179
11 changed files with 245 additions and 36 deletions
|
|
@ -87,7 +87,8 @@ enum hrtimer_restart {
|
|||
* @function: timer expiry callback function
|
||||
* @base: pointer to the timer base (per cpu and per clock)
|
||||
* @state: state information (See bit values above)
|
||||
* @start_pid: timer statistics field to store the pid of the task which
|
||||
* @is_rel: Set if the timer was armed relative
|
||||
* @start_pid: timer statistics field to store the pid of the task which
|
||||
* started the timer
|
||||
* @start_site: timer statistics field to store the site where the timer
|
||||
* was started
|
||||
|
|
@ -101,7 +102,8 @@ struct hrtimer {
|
|||
ktime_t _softexpires;
|
||||
enum hrtimer_restart (*function)(struct hrtimer *);
|
||||
struct hrtimer_clock_base *base;
|
||||
unsigned long state;
|
||||
u8 state;
|
||||
u8 is_rel;
|
||||
#ifdef CONFIG_TIMER_STATS
|
||||
int start_pid;
|
||||
void *start_site;
|
||||
|
|
@ -321,6 +323,27 @@ static inline void clock_was_set_delayed(void) { }
|
|||
|
||||
#endif
|
||||
|
||||
static inline ktime_t
|
||||
__hrtimer_expires_remaining_adjusted(const struct hrtimer *timer, ktime_t now)
|
||||
{
|
||||
ktime_t rem = ktime_sub(timer->node.expires, now);
|
||||
|
||||
/*
|
||||
* Adjust relative timers for the extra we added in
|
||||
* hrtimer_start_range_ns() to prevent short timeouts.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_TIME_LOW_RES) && timer->is_rel)
|
||||
rem.tv64 -= hrtimer_resolution;
|
||||
return rem;
|
||||
}
|
||||
|
||||
static inline ktime_t
|
||||
hrtimer_expires_remaining_adjusted(const struct hrtimer *timer)
|
||||
{
|
||||
return __hrtimer_expires_remaining_adjusted(timer,
|
||||
timer->base->get_time());
|
||||
}
|
||||
|
||||
extern void clock_was_set(void);
|
||||
#ifdef CONFIG_TIMERFD
|
||||
extern void timerfd_clock_was_set(void);
|
||||
|
|
@ -390,7 +413,12 @@ static inline void hrtimer_restart(struct hrtimer *timer)
|
|||
}
|
||||
|
||||
/* Query timers: */
|
||||
extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer);
|
||||
extern ktime_t __hrtimer_get_remaining(const struct hrtimer *timer, bool adjust);
|
||||
|
||||
static inline ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
|
||||
{
|
||||
return __hrtimer_get_remaining(timer, false);
|
||||
}
|
||||
|
||||
extern u64 hrtimer_get_next_event(void);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue