[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAErSpo49VvgpoRpS2+KHJe=zWhzR6sXdcrGdYQ5MGemi3m_Xuw@mail.gmail.com>
Date: Thu, 5 Dec 2013 14:43:03 -0700
From: Bjorn Helgaas <bhelgaas@...gle.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Tony Luck <tony.luck@...el.com>,
Robert Richter <rric@...nel.org>,
Aaro Koskinen <aaro.koskinen@....fi>,
David Daney <david.daney@...ium.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: smp_call_function_single with wait=0 considered harmful
On Wed, Dec 4, 2013 at 9:46 AM, Christoph Hellwig <hch@...radead.org> wrote:
> While doing my recent work on the generic smp function calls I noticed
> that smp_call_function_single without the wait flag can't work, as
> it allocates struct call_single_data on stack, and without the wait
> flag will happily return before the IPI has been executed.
I don't understand the problem yet. With wait==0,
smp_call_function_single() sets "csd = &__get_cpu_var(csd_data)", so
it's not using a struct on the stack. We'll queue up "func" and
likely will return before it is executed, but that should be fine
because nobody will overwrite csd_data until it *is* executed and
csd_unlock() has been called.
> This affects the following callers:
>
> arch/ia64/kernel/mca.c:mca_cpu_callback()
> arch/ia64/kernel/smpboot.c:ia64_sync_itc()
> arch/x86/kernel/kvm.c:kvm_cpu_notify()
> arch/x86/oprofile/nmi_int.c:oprofile_cpu_notifier()
> arch/x86/pci/amd_bus.c:amd_cpu_notify()
I don't see any reason why amd_cpu_notify() needs to use wait==0.
> drivers/staging/octeon/ethernet-rx.c:cvm_oct_enable_one_cpu()
> kernel/stop_machine.c:stop_two_cpus()
>
> It would be good to get these fixed so that we could remove the
> parameter. Either convert them to wait, or use a preallocated
> call_single_data and __smp_call_function_single.
>
> After that I'd like to remove the wait argument to prevent further
> abuses.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists