From: Keir Fraser Subject: Re: Cpu pools discussion Date: Wed, 29 Jul 2009 10:35:43 +0100 Message-ID: References: <4A700DB3.9010700@ts.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4A700DB3.9010700@ts.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Juergen Gross Cc: Tim Deegan , George Dunlap , Zhigang Wang , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 29/07/2009 09:52, "Juergen Gross" wrote: >>> I can add an explicit check not to unassign borrowed cpus, if you like. >> >> Your new interface ought to be responsible for its own synchronisation >> needs. And if it's not you should implement the appropriate assertions >> regarding e.g., spin_is_locked(), plus a code comment. It's simple >> negligence to do neither. > > You are right. > I will add a check to ensure borrowed cpus are not allowed to change the pool. A couple more comments. It is not safe to domain_pause() while you hold locks. It can deadlock, as domain_pause() waits for the domain to be descheduled, but it could be spinning on a lock you hold. Also it looks like a domain can be moved away from a pool while the pool is paused, and then you would leak a pause refcount. Secondly, I think that the cpupool_borrow/return calls should be embedded within vcpu_{lock,unlock,locked_change}_affinity(); also I see no need to have cpupool_return_cpu() return anything as you should be able to make a decision to move onto another CPU on the next scheduling round anyway (which can always be forced by setting SCHEDULE_SOFTIRQ). Really I dislike this patch greatly, as you can tell. ;-) The patchset as a whole is *ginormous*, the Xen patch by itself is pretty big and complicated and I believe full of races and deadlocks. I've just picked up on a few obvious ones from a very brief read. -- Keir