Re: [PATCH][2.5] smp_call_function_mask

Andrew Morton (akpm@digeo.com)
Thu, 16 Jan 2003 21:44:24 -0800


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?

> Index: linux-2.5.58-cpu_hotplug/arch/i386/kernel/smp.c

ia32 only?

>
> +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.

> +{
> + 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?

-
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/