> Zwane Mwaikambo <zwane@holomorphy.com> wrote:
> >
> > This patch adds a smp_call_function which also accepts a cpu mask which is
> > needed for targetting specific or groups of cpus.
>
> What is it needed for?
I need to interrupt a specific cpu to initiate a cpu offline process.
> > Index: linux-2.5.58-cpu_hotplug/arch/i386/kernel/smp.c
>
> ia32 only?
I'll try my best with the other archs. I can hack and rediff.
> > +int smp_call_function_mask (void (*func) (void *info), void *info, int nonatomic,
> > + int wait, unsigned long mask)
> > +/*
> > + * [SUMMARY] Run a function on specific CPUs, save self.
> > + * <func> The function to run. This must be fast and non-blocking.
> > + * <info> An arbitrary pointer to pass to the function.
> > + * <nonatomic> currently unused.
> > + * <wait> If true, wait (atomically) until function has completed on other CPUs.
> > + * <mask> The bitmask of CPUs to call the function
> > + * [RETURNS] 0 on success, else a negative status code. Does not return until
> > + * remote CPUs are nearly ready to execute <<func>> or are or have executed.
> > + *
> > + * You must not call this function with disabled interrupts or from a
> > + * hardware interrupt handler or from a bottom half handler.
> > + */
>
> Please don't invent new coding styles. The comment block goes outside the
> function. Nice comment block though.
No credit to me, ripped from smp_call_function, i'll switch to docbook
version.
> > +{
> > + struct call_data_struct data;
> > + int num_cpus = hweight32(mask);
> > +
> > + if (num_cpus == 0)
> > + return -EINVAL;
> > +
> > + if ((1UL << smp_processor_id()) & mask)
> > + return -EINVAL;
>
> Preempt safety?
Good point, i think a get_cpu and put_cpu_no_resched should suffice.
Zwane
-- function.linuxpower.ca- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/