Commit 3a0562d7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'timers-urgent-2025-02-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Ingo Molnar:
 "Fix a PREEMPT_RT bug in the clocksource verification code that caused
  false positive warnings.

  Also fix a timer migration setup bug when new CPUs are added"

* tag 'timers-urgent-2025-02-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  timers/migration: Fix off-by-one root mis-connection
  clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context
parents c7b92e89 868c9037
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -373,10 +373,10 @@ void clocksource_verify_percpu(struct clocksource *cs)
	cpumask_clear(&cpus_ahead);
	cpumask_clear(&cpus_behind);
	cpus_read_lock();
	preempt_disable();
	migrate_disable();
	clocksource_verify_choose_cpus();
	if (cpumask_empty(&cpus_chosen)) {
		preempt_enable();
		migrate_enable();
		cpus_read_unlock();
		pr_warn("Not enough CPUs to check clocksource '%s'.\n", cs->name);
		return;
@@ -384,6 +384,7 @@ void clocksource_verify_percpu(struct clocksource *cs)
	testcpu = smp_processor_id();
	pr_info("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n",
		cs->name, testcpu, cpumask_pr_args(&cpus_chosen));
	preempt_disable();
	for_each_cpu(cpu, &cpus_chosen) {
		if (cpu == testcpu)
			continue;
@@ -403,6 +404,7 @@ void clocksource_verify_percpu(struct clocksource *cs)
			cs_nsec_min = cs_nsec;
	}
	preempt_enable();
	migrate_enable();
	cpus_read_unlock();
	if (!cpumask_empty(&cpus_ahead))
		pr_warn("        CPUs %*pbl ahead of CPU %d for clocksource %s.\n",
+9 −1
Original line number Diff line number Diff line
@@ -1675,6 +1675,9 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)

	} while (i < tmigr_hierarchy_levels);

	/* Assert single root */
	WARN_ON_ONCE(!err && !group->parent && !list_is_singular(&tmigr_level_list[top]));

	while (i > 0) {
		group = stack[--i];

@@ -1716,7 +1719,12 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)
		WARN_ON_ONCE(top == 0);

		lvllist = &tmigr_level_list[top];
		if (group->num_children == 1 && list_is_singular(lvllist)) {

		/*
		 * Newly created root level should have accounted the upcoming
		 * CPU's child group and pre-accounted the old root.
		 */
		if (group->num_children == 2 && list_is_singular(lvllist)) {
			/*
			 * The target CPU must never do the prepare work, except
			 * on early boot when the boot CPU is the target. Otherwise