From: Ryan Harper Subject: [PATCH] workaround for bug#197 Date: Mon, 12 Sep 2005 16:27:40 -0500 Message-ID: <20050912212740.GB8009@us.ibm.com> References: <20050909220719.GP8187@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20050909220719.GP8187@us.ibm.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: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org I don't think this is the right fix, but it does highlight the issue. While killing a domain, the vcpus are descheduled, but every now and then, one of the cpus is still running one of the vcpus, which means d->cpumask is not empty. This triggers the BUG_ON() in xen/arch/x86/domain.c:domain_relinquish_resources(). The patch puts in some printks and a cpu_relax() loop till the cpumask is empty before calling domain_relinquish_resources(). With this patch, I've gone through several thousand iterations of create/destroy without crashing. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com diffstat output: domain.c | 8 ++++++++ 1 files changed, 8 insertions(+) Signed-off-by: Ryan Harper --- diff -r 413c911e5780 xen/common/domain.c --- a/xen/common/domain.c Mon Sep 12 12:48:33 2005 +++ b/xen/common/domain.c Mon Sep 12 13:25:07 2005 @@ -112,6 +112,14 @@ { for_each_vcpu(d, v) sched_rem_domain(v); + if(!cpus_empty(d->cpumask)) { + printk("ACK! DOM%d still running, waiting before dying\n", + d->domain_id); + while(!cpus_empty(d->cpumask)) + cpu_relax(); + printk("DOM%d cpumask clear, relinquishing resources\n", + d->domain_id); + } domain_relinquish_resources(d); put_domain(d);