Commit 226f69a4 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'please-pull-tangchen' of...

Merge tag 'please-pull-tangchen' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras

 into x86/urgent

Pull MCE fix from Tony Luck:

   "Fix problem in CMCI rediscovery code that was illegally
    migrating worker threads to other cpus."

Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 2bbf0a14 85b97637
Loading
Loading
Loading
Loading
+18 −13
Original line number Original line Diff line number Diff line
@@ -285,34 +285,39 @@ void cmci_clear(void)
	raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
	raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
}
}


static long cmci_rediscover_work_func(void *arg)
{
	int banks;

	/* Recheck banks in case CPUs don't all have the same */
	if (cmci_supported(&banks))
		cmci_discover(banks);

	return 0;
}

/*
/*
 * After a CPU went down cycle through all the others and rediscover
 * After a CPU went down cycle through all the others and rediscover
 * Must run in process context.
 * Must run in process context.
 */
 */
void cmci_rediscover(int dying)
void cmci_rediscover(int dying)
{
{
	int banks;
	int cpu, banks;
	int cpu;
	cpumask_var_t old;


	if (!cmci_supported(&banks))
	if (!cmci_supported(&banks))
		return;
		return;
	if (!alloc_cpumask_var(&old, GFP_KERNEL))
		return;
	cpumask_copy(old, &current->cpus_allowed);


	for_each_online_cpu(cpu) {
	for_each_online_cpu(cpu) {
		if (cpu == dying)
		if (cpu == dying)
			continue;
			continue;
		if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))

		if (cpu == smp_processor_id()) {
			cmci_rediscover_work_func(NULL);
			continue;
			continue;
		/* Recheck banks in case CPUs don't all have the same */
		if (cmci_supported(&banks))
			cmci_discover(banks);
		}
		}


	set_cpus_allowed_ptr(current, old);
		work_on_cpu(cpu, cmci_rediscover_work_func, NULL);
	free_cpumask_var(old);
	}
}
}


/*
/*