Skip to content

Commit 8c3b5e6

Browse files
committed
hrtimer: Ensure timerfd notification for HIGHRES=n
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b14bca9 commit 8c3b5e6

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

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
@@ -777,22 +777,6 @@ static void hrtimer_switch_to_hres(void)
777777
retrigger_next_event(NULL);
778778
}
779779

780-
static void clock_was_set_work(struct work_struct *work)
781-
{
782-
clock_was_set();
783-
}
784-
785-
static DECLARE_WORK(hrtimer_work, clock_was_set_work);
786-
787-
/*
788-
* Called from timekeeping and resume code to reprogram the hrtimer
789-
* interrupt device on all cpus.
790-
*/
791-
void clock_was_set_delayed(void)
792-
{
793-
schedule_work(&hrtimer_work);
794-
}
795-
796780
#else
797781

798782
static inline int hrtimer_is_hres_enabled(void) { return 0; }
@@ -877,6 +861,22 @@ void clock_was_set(void)
877861
timerfd_clock_was_set();
878862
}
879863

864+
static void clock_was_set_work(struct work_struct *work)
865+
{
866+
clock_was_set();
867+
}
868+
869+
static DECLARE_WORK(hrtimer_work, clock_was_set_work);
870+
871+
/*
872+
* Called from timekeeping and resume code to reprogram the hrtimer
873+
* interrupt device on all cpus and to notify timerfd.
874+
*/
875+
void clock_was_set_delayed(void)
876+
{
877+
schedule_work(&hrtimer_work);
878+
}
879+
880880
/*
881881
* During resume we might have to reprogram the high resolution timer
882882
* 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)