Skip to content

Commit 3d12cce

Browse files
KAGA-KOKOgregkh
authored andcommitted
hrtimer: Ensure timerfd notification for HIGHRES=n
[ Upstream commit 8c3b5e6 ] If high resolution timers are disabled the timerfd notification about a clock was set event is not happening for all cases which use clock_was_set_delayed() because that's a NOP for HIGHRES=n, which is wrong. Make clock_was_set_delayed() unconditially available to fix that. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20210713135158.196661266@linutronix.de Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent aadfa1d commit 3d12cce

3 files changed

Lines changed: 19 additions & 21 deletions

File tree

‎include/linux/hrtimer.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,12 @@ struct clock_event_device;
318318

319319
extern void hrtimer_interrupt(struct clock_event_device *dev);
320320

321-
extern void clock_was_set_delayed(void);
322-
323321
extern unsigned int hrtimer_resolution;
324322

325323
#else
326324

327325
#define hrtimer_resolution (unsigned int)LOW_RES_NSEC
328326

329-
static inline void clock_was_set_delayed(void) { }
330-
331327
#endif
332328

333329
static inline ktime_t
@@ -351,7 +347,6 @@ hrtimer_expires_remaining_adjusted(const struct hrtimer *timer)
351347
timer->base->get_time());
352348
}
353349

354-
extern void clock_was_set(void);
355350
#ifdef CONFIG_TIMERFD
356351
extern void timerfd_clock_was_set(void);
357352
#else

‎kernel/time/hrtimer.c‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -758,22 +758,6 @@ static void hrtimer_switch_to_hres(void)
758758
retrigger_next_event(NULL);
759759
}
760760

761-
static void clock_was_set_work(struct work_struct *work)
762-
{
763-
clock_was_set();
764-
}
765-
766-
static DECLARE_WORK(hrtimer_work, clock_was_set_work);
767-
768-
/*
769-
* Called from timekeeping and resume code to reprogram the hrtimer
770-
* interrupt device on all cpus.
771-
*/
772-
void clock_was_set_delayed(void)
773-
{
774-
schedule_work(&hrtimer_work);
775-
}
776-
777761
#else
778762

779763
static inline int hrtimer_is_hres_enabled(void) { return 0; }
@@ -891,6 +875,22 @@ void clock_was_set(void)
891875
timerfd_clock_was_set();
892876
}
893877

878+
static void clock_was_set_work(struct work_struct *work)
879+
{
880+
clock_was_set();
881+
}
882+
883+
static DECLARE_WORK(hrtimer_work, clock_was_set_work);
884+
885+
/*
886+
* Called from timekeeping and resume code to reprogram the hrtimer
887+
* interrupt device on all cpus and to notify timerfd.
888+
*/
889+
void clock_was_set_delayed(void)
890+
{
891+
schedule_work(&hrtimer_work);
892+
}
893+
894894
/*
895895
* During resume we might have to reprogram the high resolution timer
896896
* interrupt on all online CPUs. However, all other CPUs will be

‎kernel/time/tick-internal.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,6 @@ DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases);
165165

166166
extern u64 get_next_timer_interrupt(unsigned long basej, u64 basem);
167167
void timer_clear_idle(void);
168+
169+
void clock_was_set(void);
170+
void clock_was_set_delayed(void);

0 commit comments

Comments
 (0)