On Mon, Dec 08, 2014 at 08:30:18PM +0100, David Hildenbrand wrote:
> > > active_writer is cleared while holding cpuhp_lock, so this should be safe,
> > > right?
> > 
> > You lost me on that one.  Don't we get to that piece of code precisely
> > because we don't hold any of the CPU-hotplug locks?  If so, the
> > writer might well hold all the locks it needs, and might well change
> > cpu_hotplug.active_writer out from under us.
> > 
> > What am I missing here?
> > 
> >                                                     Thanx, Paul
> 
> I was missing that cpuhp_lock_* are simply lockdep anotations ... it's
> getting late :)
> 
> So you're right, we need to verify that we don't get a 0 on the second access.

All you should need to do is to do something like this:

        awp = ACCESS_ONCE(cpu_hotplug.active_writer);
        if (awp)
                wake_up_process(cpu_hotplug.active_writer);

That way you only have one access, and the check and wake_up_process()
are guaranteed to be consistent.

> Will send an updated version soon.

Sounds good!

                                                        Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to