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
|