Re: [RFC PATCH 0/4] Refcount Based Cpu-Hotplug Revisit.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Tuesday, October 16, 2007 - 10:20 am

On Tue, 16 Oct 2007, Gautham R Shenoy wrote:

Well, afaik, the patch series is fairly clean, and I'm obviously perfectly 
happy with the approach, so I have no objections. 

But it looks buggy. This:

	+static void cpu_hotplug_begin(void)
	+{
	+       mutex_lock(&cpu_hotplug.lock);
	+       cpu_hotplug.active_writer = current;
	+       while (cpu_hotplug.refcount) {
	+               mutex_unlock(&cpu_hotplug.lock);
	+               wait_for_completion(&cpu_hotplug.readers_done);
	+               mutex_lock(&cpu_hotplug.lock);
	+       }
	+
	+}

drops the cpu_hotplug.lock, which - as far as I can see - means that 
another process can come in and do the same, and mess up the 
"active_writer" thing. The oerson that actually *gets* the lock may not be 
the same one that has "active_writer" set to itself. No? Am I missing 
something.

So I think this needs (a) more people looking at it (I think I found a 
bug, who knows if there are more subtle ones lurking) and (b) lots of 
testing. 

			Linus
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC PATCH 0/4] Refcount Based Cpu-Hotplug Revisit., Gautham R Shenoy, (Tue Oct 16, 3:33 am)
[RFC PATCH 1/4] Refcount Based Cpu-Hotplug Implementation, Gautham R Shenoy, (Tue Oct 16, 3:34 am)
[RFC PATCH 2/4] Rename lock_cpu_hotplug to get_online_cpus, Gautham R Shenoy, (Tue Oct 16, 3:35 am)
[RFC PATCH 4/4] Remove CPU_DEAD/CPU_UP_CANCELLED handling ..., Gautham R Shenoy, (Tue Oct 16, 3:37 am)
Re: [RFC PATCH 0/4] Refcount Based Cpu-Hotplug Revisit., Linus Torvalds, (Tue Oct 16, 10:20 am)
Re: [RFC PATCH 0/4] Refcount Based Cpu-Hotplug Revisit., Dipankar Sarma, (Tue Oct 16, 7:11 pm)
Re: [RFC PATCH 0/4] Refcount Based Cpu-Hotplug Revisit., Linus Torvalds, (Tue Oct 16, 7:23 pm)
Re: [RFC PATCH 0/4] Refcount Based Cpu-Hotplug Revisit., Gautham R Shenoy, (Tue Oct 16, 9:17 pm)
Re: [RFC PATCH 1/4] Refcount Based Cpu-Hotplug Implementation, Gautham R Shenoy, (Tue Oct 16, 10:37 pm)
Re: [RFC PATCH 1/4] Refcount Based Cpu-Hotplug Implementation, Gautham R Shenoy, (Wed Oct 17, 4:50 am)
Re: [RFC PATCH 1/4] Refcount Based Cpu-Hotplug Implementation, Gautham R Shenoy, (Wed Oct 17, 11:29 pm)
Re: [RFC PATCH 2/4] Rename lock_cpu_hotplug to get_online_cpus, Gautham R Shenoy, (Thu Oct 18, 12:57 am)
Re: [RFC PATCH 2/4] Rename lock_cpu_hotplug to get_online_cpus, Gautham R Shenoy, (Thu Oct 18, 10:04 pm)