WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

Re: [Xen-ia64-devel] [PATCH] Xen panics when domvti is destroyed

Hi,

I'm still worried about the confliction between waking up a vcpu and
destroying the domain.

I'm not sure but the following modification seems to be necessary. 
It does the same thing as hvm_bringup_ap() in x86.

LOCK_BIGLOCK might be exaggerated but at least any lock is required. 
If two cpu execute IPI at the same time, vmx_final_setup_guest() can
be called simultaneously and that incurs memory leak.

diff -r 5176c3ea3293 xen/arch/ia64/vmx/mmio.c
--- a/xen/arch/ia64/vmx/mmio.c  Sun Oct 08 18:55:12 2006 -0600
+++ b/xen/arch/ia64/vmx/mmio.c  Thu Oct 12 14:33:59 2006 +0900
@@ -386,7 +386,13 @@ static void write_ipi (VCPU *vcpu, uint6
 
         memset (&c, 0, sizeof (c));
 
+       LOCK_BIGLOCK(d);
+       if (test_bit(_VCPUF_initialised, &targ->vcpu_flags)) {
+           UNLOCK_BIGLOCK(d);
+           goto initialized;
+       }
         if (arch_set_info_guest (targ, &c) != 0) {
+           UNLOCK_BIGLOCK(d);
             printf ("arch_boot_vcpu: failure\n");
             return;
         }
@@ -397,13 +403,18 @@ static void write_ipi (VCPU *vcpu, uint6
 
         if (test_and_clear_bit(_VCPUF_down,&targ->vcpu_flags)) {
             vcpu_wake(targ);
+           UNLOCK_BIGLOCK(d);
             printf ("arch_boot_vcpu: vcpu %d awaken %016lx!\n",
                     targ->vcpu_id, targ_regs->cr_iip);
         }
-        else
+        else {
+           UNLOCK_BIGLOCK(d);
             printf ("arch_boot_vcpu: huu, already awaken!");
-    }
-    else {
+       }
+       return;
+    }
+  initialized:
+    {
         int running = test_bit(_VCPUF_running,&targ->vcpu_flags);
         deliver_ipi (targ, ((ipi_d_t)value).dm, 
                     ((ipi_d_t)value).vector);

Thanks,
Kouya

Keir Fraser writes:
 > 
 > 
 > 
 > On 11/10/06 08:34, "Xu, Anthony" <anthony.xu@xxxxxxxxx> wrote:
 > 
 > > Keir,
 > > 
 > > When free_vcpu_struct() is called, is it guaranteed that this vcpu is 
 > > stopped
 > > completely?
 > 
 > Yes. domain_kill() calls domain_pause() which synchronously stops execution
 > of every VCPU. domain_kill() drops a 'master reference' on the domain, so
 > the destructors cannot run until domain_kill() has run.
 > 
 >  -- Keir
 > 
 > 
 > 
 > _______________________________________________
 > Xen-devel mailing list
 > Xen-devel@xxxxxxxxxxxxxxxxxxx
 > http://lists.xensource.com/xen-devel


_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel