On Fri, Mar 11, 2016 at 12:59:30PM +0100, Juergen Gross wrote:
> +int call_sync_on_phys_cpu(unsigned cpu, int (*func)(void *), void *par)
> +{
> +     cpumask_var_t old_mask;
> +     int ret;
> +
> +     if (cpu >= nr_cpu_ids)
> +             return -EINVAL;
> +
> +     if (!alloc_cpumask_var(&old_mask, GFP_KERNEL))
> +             return -ENOMEM;
> +
> +     cpumask_copy(old_mask, &current->cpus_allowed);
> +     ret = set_cpus_allowed_ptr(current, cpumask_of(cpu));
> +     if (ret)
> +             goto out;

So what happens if someone does sched_setaffinity() right about here?

> +
> +     ret = func(par);
> +
> +     set_cpus_allowed_ptr(current, old_mask);
> +
> +out:
> +     free_cpumask_var(old_mask);
> +     return ret;
> +}
> +EXPORT_SYMBOL_GPL(call_sync_on_phys_cpu);

This is disgusting, and you're adding this to !Xen kernels too.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to