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.

Merge tag 'timers-urgent-2024-06-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fix from Ingo Molnar:
"Fix boot-time warning in tick_setup_device()"

* tag 'timers-urgent-2024-06-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
tick/nohz_full: Don't abuse smp_call_function_single() in tick_setup_device()

+14 -28
+14 -28
kernel/time/tick-common.c
··· 178 178 } 179 179 } 180 180 181 - #ifdef CONFIG_NO_HZ_FULL 182 - static void giveup_do_timer(void *info) 183 - { 184 - int cpu = *(unsigned int *)info; 185 - 186 - WARN_ON(tick_do_timer_cpu != smp_processor_id()); 187 - 188 - tick_do_timer_cpu = cpu; 189 - } 190 - 191 - static void tick_take_do_timer_from_boot(void) 192 - { 193 - int cpu = smp_processor_id(); 194 - int from = tick_do_timer_boot_cpu; 195 - 196 - if (from >= 0 && from != cpu) 197 - smp_call_function_single(from, giveup_do_timer, &cpu, 1); 198 - } 199 - #endif 200 - 201 181 /* 202 182 * Setup the tick device 203 183 */ ··· 201 221 tick_next_period = ktime_get(); 202 222 #ifdef CONFIG_NO_HZ_FULL 203 223 /* 204 - * The boot CPU may be nohz_full, in which case set 205 - * tick_do_timer_boot_cpu so the first housekeeping 206 - * secondary that comes up will take do_timer from 207 - * us. 224 + * The boot CPU may be nohz_full, in which case the 225 + * first housekeeping secondary will take do_timer() 226 + * from it. 208 227 */ 209 228 if (tick_nohz_full_cpu(cpu)) 210 229 tick_do_timer_boot_cpu = cpu; 211 230 212 - } else if (tick_do_timer_boot_cpu != -1 && 213 - !tick_nohz_full_cpu(cpu)) { 214 - tick_take_do_timer_from_boot(); 231 + } else if (tick_do_timer_boot_cpu != -1 && !tick_nohz_full_cpu(cpu)) { 215 232 tick_do_timer_boot_cpu = -1; 216 - WARN_ON(READ_ONCE(tick_do_timer_cpu) != cpu); 233 + /* 234 + * The boot CPU will stay in periodic (NOHZ disabled) 235 + * mode until clocksource_done_booting() called after 236 + * smp_init() selects a high resolution clocksource and 237 + * timekeeping_notify() kicks the NOHZ stuff alive. 238 + * 239 + * So this WRITE_ONCE can only race with the READ_ONCE 240 + * check in tick_periodic() but this race is harmless. 241 + */ 242 + WRITE_ONCE(tick_do_timer_cpu, cpu); 217 243 #endif 218 244 } 219 245