Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

hrtimer: Use raw_cpu_ptr() in clock_was_set()

clock_was_set() can be invoked from preemptible context. Use raw_cpu_ptr()
to check whether high resolution mode is active or not. It does not matter
whether the task migrates after acquiring the pointer.

Fixes: e71a4153b7c2 ("hrtimer: Force clock_was_set() handling for the HIGHRES=n, NOHZ=y case")
Reported-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/875ywacsmb.ffs@tglx

+3 -2
+3 -2
kernel/time/hrtimer.c
··· 944 944 */ 945 945 void clock_was_set(unsigned int bases) 946 946 { 947 + struct hrtimer_cpu_base *cpu_base = raw_cpu_ptr(&hrtimer_bases); 947 948 cpumask_var_t mask; 948 949 int cpu; 949 950 950 - if (!hrtimer_hres_active() && !tick_nohz_active) 951 + if (!__hrtimer_hres_active(cpu_base) && !tick_nohz_active) 951 952 goto out_timerfd; 952 953 953 954 if (!zalloc_cpumask_var(&mask, GFP_KERNEL)) { ··· 959 958 /* Avoid interrupting CPUs if possible */ 960 959 cpus_read_lock(); 961 960 for_each_online_cpu(cpu) { 962 - struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); 963 961 unsigned long flags; 964 962 963 + cpu_base = &per_cpu(hrtimer_bases, cpu); 965 964 raw_spin_lock_irqsave(&cpu_base->lock, flags); 966 965 967 966 if (update_needs_ipi(cpu_base, bases))