[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: "Kouya SHIMURA" <kouya@xxxxxxxxxxxxxx>
  • From: "Xu, Anthony" <anthony.xu@xxxxxxxxx>
  • Date: Thu, 12 Oct 2006 17:28:48 +0800
  • Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 12 Oct 2006 02:29:32 -0700
  • List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
  • Thread-index: Acbt2GBWhyQRr2HTQZej3RQTi2XhPgABffTA
  • Thread-topic: [Xen-ia64-devel] [PATCH] Xen panics when domvti is destroyed

Hi Kouya,
As keir pointed out, all the vcpus are stoping completely before calling
free_vcpu_struct(),
That means all the vcpus are not running, and will not run. So the vcpus
either are setup completely, or are not create completely.
When a domain is destroyed, domain_kill is called,
1. domain_pause is called in domain_kill, this function will stop all
vcpus synchronously,that means if this function is returned, all the
vcpus are stopped completely.
2. after that put_domain is called, this function release all the
resource belonging to this domain.
Seems there is no race condition here.


See my comments

Anthony


>
>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.
Vmx_final_setup_guest can be called simultaneously, only if argument is
different vcpu.



>
>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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.