xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Bruce Granger <vivagin@yeah.net>, xen-devel@lists.xensource.com
Subject: Re: From which place in source code Xen start to deal with the GuestOS shutdown operation?
Date: Fri, 21 Sep 2012 09:08:31 +0100	[thread overview]
Message-ID: <CC81DF0F.3F4C8%keir.xen@gmail.com> (raw)
In-Reply-To: <1348200397859-5711422.post@n5.nabble.com>

On 21/09/2012 05:06, "Bruce Granger" <vivagin@yeah.net> wrote:

> Hello everyone!
I feel I'm still a new baby though I have been study xen
> source code for
some days!
When I shutdown GuestOS, I want to get to know how
> Xen deal with the
operation? I find the code in xen\arch\x86\hvm\vlapic.c,
> see:
static int vlapic_accept_irq(struct vcpu *v, uint32_t
> icr_low)
{
……
switch ( icr_low & APIC_MODE_MASK )
{
……
    case APIC_DM_INIT:

> /* No work on INIT de-assert for P4-type APIC. */
        if ( (icr_low &
> (APIC_INT_LEVELTRIG | APIC_INT_ASSERT)) ==
             APIC_INT_LEVELTRIG )

> break;
        /* Nothing to do if the VCPU is already reset. */
        if (
> !v->is_initialised )
            break;
        hvm_vcpu_down(v);
        rc =
> vlapic_schedule_init_sipi_tasklet(v, icr_low);
        break;
……
}
……
I think
> that when we input the shutdown command in GuestOS, xen will first
catch the
> APIC_DM_INIT and then call the
‘hvm_vcpu_down(v)’、’domain_shutdown()’ and so
> on , is that right? If not,
where is the code entrance when shutdown operation
> occurs?



--
View this message in context:


Yes that's about right. Some guests will not re-INIT the VCPUs but will
simply leave them HLTed with interrupts disabled. We also pick up that case
in hvm_hlt().

Once all VCPUs are down, hvm_vcpu_down() dows the domain_shutdown() call,
which then triggers machinery in dom0 to kill off the domain fully. I
described that path in my previous email.

 -- Keir

> http://xen.1045712.n5.nabble.com/From-which-place-in-source-code-Xen-start-to-
> deal-with-the-GuestOS-shutdown-operation-tp5711422.html
Sent from the Xen -
> Dev mailing list archive at
> Nabble.com.

_______________________________________________
Xen-devel mailing
> list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

      reply	other threads:[~2012-09-21  8:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21  4:06 From which place in source code Xen start to deal with the GuestOS shutdown operation? Bruce Granger
2012-09-21  8:08 ` Keir Fraser [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CC81DF0F.3F4C8%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=vivagin@yeah.net \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).