Re: [PATCH 9/9] x86/apic: Use non-atomic operations when possible

From: Thomas Gleixner
Date: Tue Jun 25 2019 - 18:03:13 EST


On Tue, 25 Jun 2019, Dave Hansen wrote:

> > diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
> > index 7685444a106b..609e499387a1 100644
> > --- a/arch/x86/kernel/apic/x2apic_cluster.c
> > +++ b/arch/x86/kernel/apic/x2apic_cluster.c
> > @@ -50,7 +50,7 @@ __x2apic_send_IPI_mask(const struct cpumask *mask, int vector, int apic_dest)
> > cpumask_copy(tmpmsk, mask);
> > /* If IPI should not be sent to self, clear current CPU */
> > if (apic_dest != APIC_DEST_ALLINC)
> > - cpumask_clear_cpu(smp_processor_id(), tmpmsk);
> > + __cpumask_clear_cpu(smp_processor_id(), tmpmsk);
>
> tmpmsk is on-stack, but it's a pointer to a per-cpu variable:
>
> tmpmsk = this_cpu_cpumask_var_ptr(ipi_mask);
>
> So this one doesn't appear as obviously correct as a mask which itself
> is on the stack. The other three look obviously OK, though.

It's still correct. The mask is per cpu and protected because interrupts
are disabled. I noticed and wanted to amend the change log and forgot.

Thanks,

tglx