Re: [PATCH v4 04/12] smp: Use task-local IPI cpumask in smp_call_function_many_cond()

From: Sebastian Andrzej Siewior

Date: Wed Apr 01 2026 - 11:52:38 EST


On 2026-03-31 19:30:55 [+0800], Chuyi Zhou wrote:

> --- a/kernel/smp.c
> +++ b/kernel/smp.c
> @@ -802,11 +840,18 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
> int cpu, last_cpu, this_cpu = smp_processor_id();
> struct call_function_data *cfd;
> bool wait = scf_flags & SCF_WAIT;
> + struct cpumask *cpumask, *task_mask;
> + bool preemptible_wait;
> int nr_cpus = 0;
> bool run_remote = false;
>
> lockdep_assert_preemption_disabled();
>
> + task_mask = smp_task_ipi_mask(current);
> + preemptible_wait = task_mask && preemptible();
> + cfd = this_cpu_ptr(&cfd_data);
> + cpumask = preemptible_wait ? task_mask : cfd->cpumask;

I haven't look at this in detail but that
lockdep_assert_preemption_disabled() expects preemption to be disabled
here so the following preemptible() must be always false.

> +
> /*
> * Can deadlock when called with interrupts disabled.
> * We allow cpu's that are not yet online though, as no one else can

Sebastian