Re: [Lse-tech] Re: [PATCH] cpusets+hotplug+preepmt broken

Dipankar Sarma
2005-05-13T21:10:16Z

On Fri, May 13, 2005 at 03:46:52PM -0500, Nathan Lynch wrote:
> > > In particular, in my view, locks should guard data. What data does
> > > lock_cpu_hotplug() guard? I propose that it guards cpu_online_map.
> > >
> > > I recommend considering a different name for this lock. Perhaps
> > > 'cpu_online_sem', instead of 'cpucontrol'? And perhaps the
> > > lock_cpu_hotplug() should be renamed, to say 'lock_cpu_online'?
> >
> > No. CPU hotplug uses two different locking - see both lock_cpu_hotplug()
> > and __stop_machine_run(). Anyone reading cpu_online_map with
> > preemption disabled is safe from cpu hotplug even without taking
> > any lock.
>
> More precisely (I think), reading cpu_online_map with preemption
> disabled guarantees that none of the cpus in the map will go offline
> -- it does not prevent an online operation in progress (but most code
> only cares about the former case). Also note that __stop_machine_run
> is used only to offline a cpu.
>
> The cpucontrol semaphore does not only protect cpu_online_map and
> cpu_present_map, but also serializes cpu hotplug operations, so that
> only one may be in progress at a time.

Exactly. So, naming it lock_cpu_online() would make no sense.

>
> I've been mulling over submitting a Documentation/cpuhotplug.txt,
> sounds like there's sufficient demand...

That would be very good considering the fact that CPU hotplug
is getting broken often. Another nice thing to see would be
i386 cpu hotplug support. That would allow lot more developers
to test their code with cpu hotplug. Not sure where that one is now.
Perhaps Zwane knows.

Thanks
Dipankar