xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v11 01/17] libxl: fix stubdom console destruction
Date: Tue, 24 Jul 2012 11:54:59 +0100	[thread overview]
Message-ID: <500E7F03.2050903@citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1207241113060.26163@kaball.uk.xensource.com>

Stefano Stabellini wrote:
> On Tue, 24 Jul 2012, Roger Pau Monne wrote:
>> Ian Campbell wrote:
>>> On Mon, 2012-07-23 at 18:27 +0100, Roger Pau Monne wrote:
>>>> Stubdoms have several consoles attached, and they don't follow the
>>>> xenstore protocol for devices, since they are always in state 1. We
>>>> have to add an exception to libxl__initiate_device_remove, so libxl
>>>> doesn't wait for them to reach state 6 (Closed).
>>>>
>>>> Report: http://markmail.org/message/yqgppcsdip6tnmh6
>>>>
>>>> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
>>>> Reported-by: Ian Campbell <ian.campbell@eu.citrix.com>
>>>> Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
>>>> ---
>>>>  tools/libxl/libxl_device.c |    6 ++++--
>>>>  1 files changed, 4 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
>>>> index a94beab..c4392fa 100644
>>>> --- a/tools/libxl/libxl_device.c
>>>> +++ b/tools/libxl/libxl_device.c
>>>> @@ -592,8 +592,10 @@ void libxl__initiate_device_remove(libxl__egc *egc,
>>>>          LOG(ERROR, "unable to get info for domain %d", domid);
>>>>          goto out;
>>>>      }
>>>> -    if (QEMU_BACKEND(aodev->dev) &&
>>>> -        (info.paused || info.dying || info.shutdown)) {
>>>> +    if ((QEMU_BACKEND(aodev->dev) &&
>>>> +        (info.paused || info.dying || info.shutdown)) ||
>>>> +        (libxl_is_stubdom(CTX, aodev->dev->domid, NULL) &&
>>>> +        (aodev->dev->backend_kind == LIBXL__DEVICE_KIND_CONSOLE))) {
>>> Is this actually specific to stubdom consoles or is that just where
>>> we've noticed it?
>> It's just that I've noticed it with stubdoms, which AFAIK are the only
>> domains that can have more than one console.
> 
> Linux can handle multiple PV consoles

But there's no way to create a domain from xl with multiple consoles, or
at least I haven't been able to find any.

> 
>>> Does it apply to LIBXL__CONSOLE_BACKEND_IOEMU as well
>>> as ..._XENCONSOLED? I took a look through tools/console and I cannot
>>> find any handling of a state node in xenstore at all, so the XENCONSOLED
>>> case seems clear. I notice that xen_console.c registers the device with
>>> DEVOPS_FLAG_IGNORE_STATE but that only seems to affect startup not
>>> teardown. I don't see a qemu_chr_close (or anything similar) anywhere in
>>> hw/xen_console.c
>> So it should apply to any console device? This means I don't have to
>> wait for any device of type LIBXL__DEVICE_KIND_CONSOLE, and there's no
>> need to check for the specific console type or Qemu.
> 
> xen_console registers a disconnect handler, con_disconnect, that should
> be able to unbind the evtchn and unmap the ring.
> "disconnect" is called by xen_backend, if the backend and frontend
> states are 5 or 6.

Yes, but I don't see that con_disconnect sets the state to 6 after doing
the cleanup, neither xenconsoled does so. I think con_disconnect should
set xendev->be_state = 6, so the parent function xen_be_disconnect would
notice the state change and write it to xenstore.

Also, this only happens when a domain has multiple consoles, since the
first console is a special case and is processed separately, but the
rest of consoles are processed using the "normal" unplug mechanism
(libxl__initiate_device_remove). Maybe we should treat all consoles in
the same way, and unplug them using the same method that we use for the
first console?

There's a comment before destroying the first console that states:

/* Currently console devices can be destroyed synchronously by just
 * removing xenstore entries, this is what libxl__device_destroy does.
 */
libxl__device_destroy(gc, dev);

It makes me think if the appropriate solution would be to call
libxl__device_destroy for all console devices, not only for the first one.

  reply	other threads:[~2012-07-24 10:54 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23 17:27 [PATCH v11 0/17] execute hotplug scripts from libxl Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 01/17] libxl: fix stubdom console destruction Roger Pau Monne
2012-07-24  7:50   ` Ian Campbell
2012-07-24  8:39     ` Roger Pau Monne
2012-07-24 10:16       ` Stefano Stabellini
2012-07-24 10:54         ` Roger Pau Monne [this message]
2012-07-24 10:57           ` Ian Campbell
2012-07-24 11:01             ` Roger Pau Monne
2012-07-24 11:58               ` Stefano Stabellini
2012-07-24 12:14                 ` Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 02/17] libxl: refactor disk addition to take a helper Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 03/17] libxl: convert libxl__device_disk_local_attach to an async op Roger Pau Monne
2012-07-24 15:19   ` Ian Jackson
2012-07-24 16:09     ` Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 04/17] libxl: rename vifs to nics Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 05/17] libxl: convert libxl_device_disk_add to an async op Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 06/17] libxl: convert libxl_device_nic_add to an async operation Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 07/17] libxl: add option to choose who executes hotplug scripts Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 08/17] libxl: rename _IOEMU nic type to VIF_IOEMU Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 09/17] libxl: set nic type of stub to PV instead of copying from the parent Roger Pau Monne
2012-07-24 15:27   ` Ian Jackson
2012-07-24 15:32     ` Ian Campbell
2012-07-24 16:05       ` Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 10/17] libxl: set correct nic type depending on the guest Roger Pau Monne
2012-07-24 15:28   ` Ian Jackson
2012-07-24 16:02     ` Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 11/17] libxl: use libxl__xs_path_cleanup on device_destroy Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 12/17] libxl: call hotplug scripts for disk devices from libxl Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 13/17] libxl: call hotplug scripts for nic " Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 14/17] libxl: convert libxl_device_vkb_add to an async operation Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 15/17] libxl: convert libxl_device_vfb_add " Roger Pau Monne
2012-07-24 15:20   ` Ian Jackson
2012-07-25 11:00     ` Roger Pau Monne
2012-07-26 14:26       ` Ian Jackson
2012-07-23 17:27 ` [PATCH v11 16/17] xl: main_blockdetach don't call destroy if remove succeeds Roger Pau Monne
2012-07-24 15:29   ` Ian Jackson
2012-07-23 17:27 ` [PATCH v11 17/17] libxl: libxl__xs_path_cleanup don't print error if ENOENT Roger Pau Monne

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=500E7F03.2050903@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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).