From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: xen-devel@lists.xenproject.org, Ian Campbell <ian.campbell@citrix.com>
Subject: Re: [PATCH v2 05/10] libxl: remove the Qemu bodge for driver domain devices
Date: Mon, 18 Nov 2013 11:07:25 +0100 [thread overview]
Message-ID: <5289E6DD.2030503@citrix.com> (raw)
In-Reply-To: <21126.21836.730000.83441@mariner.uk.xensource.com>
On 15/11/13 18:09, Ian Jackson wrote:
> Roger Pau Monne writes ("[PATCH v2 05/10] libxl: remove the Qemu bodge for driver domain devices"):
>> When Qemu is launched from a driver domain to act as a PV disk
>> backend we can make sure that Qemu is running before detaching
>> devices, so there's no need for the bodge there.
>
> I'm confused. I don't see why this change is safe.
>
> You say "we can make sure", but how ? Do we actually make sure ?
> What part of the code is "we" ?
What I was trying to say here, is that on a normal domain destruction on
Dom0, libxl first signals Qemu to exit and then removes the devices, so
when libxl starts device removal we cannot be sure if Qemu is still
running or not (that's why the bodge is there, to give Qemu enough time
to finish it's pending work and exit).
On the other hand, when running Qemu (Qdisk) on a driver domain, libxl
removes the devices first, and then signals Qemu to exit, so Qemu is (or
should) always be running during the device removal phase.
>
>> @@ -879,17 +886,43 @@ static void device_qemu_timeout(libxl__egc *egc, libxl__ev_time *ev,
> ...
>
> And I don't understand how this next change relates to the above:
>
>> - rc = libxl__xs_write_checked(gc, XBT_NULL, state_path, "6");
>> - if (rc) goto out;
>> + for (;;) {
>> + rc = libxl__xs_transaction_start(gc, &t);
>> + if (rc) {
>> + LOG(ERROR, "unable to start transaction");
>> + goto out;
>> + }
>> +
>> + /*
>> + * Check that the state path exists and is actually different than
>> + * 6 before unconditionally setting it. If Qemu runs on a driver
>> + * domain it is possible that the driver domain has already cleaned
>> + * the backend path if the device has reached state 6.
>> + */
>> + rc = libxl__xs_read_checked(gc, XBT_NULL, state_path, &xs_state);
>> + if (rc) goto out;
>
> This is on the "we hope qemu is dying and that this 2.0s wait is
> enough" path from the diagram in libxl_internal.h (near line 1989) ?
Yes.
>
> By "the driver domain" you mean "the driver domain's libxl device
> backend daemon" ?
Yes.
> So AFAICT this is an unrelated bugfix, relating to the fact that if
> the state is set to 6 the backend daemon will remove the backend path,
> and setting it back to 6 is wrong.
Yes, but this was not possible before this series, and libxl could set
the backend path state to 6 unconditionally, because Qemu doesn't remove
the backend path on exit, so it's arguably that this was a bug before
this series.
This is not true any more, because we have the libxl driver backend
daemon that cleans the backend path on device removal, so setting state
to 6 from Dom0 after the libxl driver domain daemon has already removed
it is wrong.
> And in this case we aren't going to run the hotplug script because
> this only happens in the toolstack domain's code when there is a
> driver domain ? Perhaps a more explicit check would be clearer.
No, libxl on Dom0 is not going to run the hotplug scripts, because this
backend is handled by another domain.
next prev parent reply other threads:[~2013-11-18 10:07 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-11 12:10 [PATCH v2 00/10] libxl: add driver domain backend daemon Roger Pau Monne
2013-11-11 12:10 ` [PATCH v2 01/10] libxl: Introduce nested async operations (nested ao) Roger Pau Monne
2013-11-11 12:10 ` [PATCH v2 02/10] libxl: create a local xenstore libxl and device-model dir for guests Roger Pau Monne
2013-11-11 15:24 ` Ian Jackson
2013-11-11 16:36 ` Roger Pau Monné
2013-11-12 15:03 ` Ian Jackson
2013-11-11 12:10 ` [PATCH v2 03/10] libxl: don't remove device frontend path from driver domains Roger Pau Monne
2013-11-11 12:10 ` [PATCH v2 04/10] libxl: synchronize device removal when using " Roger Pau Monne
2013-11-11 17:02 ` Ian Jackson
2013-11-14 10:37 ` Roger Pau Monné
2013-11-14 12:42 ` Ian Jackson
2013-11-11 12:10 ` [PATCH v2 05/10] libxl: remove the Qemu bodge for driver domain devices Roger Pau Monne
2013-11-15 17:09 ` Ian Jackson
2013-11-18 10:07 ` Roger Pau Monné [this message]
2013-11-18 11:26 ` Ian Jackson
2013-11-11 12:10 ` [PATCH v2 06/10] libxl: don't launch Qemu on Dom0 for Qdisk devices on driver domains Roger Pau Monne
2013-11-15 17:11 ` Ian Jackson
2013-11-11 12:10 ` [PATCH v2 07/10] libxl: add Qdisk backend launch helper Roger Pau Monne
2013-11-15 17:34 ` Ian Jackson
2013-11-11 12:10 ` [PATCH v2 08/10] xl: put daemonize code in it's own function Roger Pau Monne
2013-11-15 17:36 ` Ian Jackson
2013-11-11 12:10 ` [PATCH v2 09/10] libxl: revert 326a7b74 Roger Pau Monne
2013-11-15 17:37 ` Ian Jackson
2013-11-15 18:16 ` Ian Jackson
2013-11-15 18:22 ` Andrew Cooper
2013-11-11 12:10 ` [PATCH v2 10/10] libxl: add device backend listener in order to launch backends Roger Pau Monne
2013-11-15 17:54 ` Ian Jackson
2013-11-18 11:47 ` Roger Pau Monné
2013-11-18 14:22 ` Ian Jackson
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=5289E6DD.2030503@citrix.com \
--to=roger.pau@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=ian.campbell@citrix.com \
--cc=xen-devel@lists.xenproject.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).