xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v6 06/13] libxl: convert libxl_device_disk_add to an async op
Date: Wed, 27 Jun 2012 18:35:15 +0100	[thread overview]
Message-ID: <4FEB4453.1080307@citrix.com> (raw)
In-Reply-To: <20457.61221.744769.779520@mariner.uk.xensource.com>

Ian Jackson wrote:
>>>> +void libxl__initiate_device_connection(libxl__egc *egc, libxl__ao_device *aodev)
>>>> +{
>>>> +    STATE_AO_GC(aodev->ao);
>>>> +    char *be_path = libxl__device_backend_path(gc, aodev->dev);
>>>> +    char *state_path = libxl__sprintf(gc, "%s/state", be_path);
>>>> +    int rc = 0;
>>> ...
>>>> +out_fail:
>>>> +    assert(rc);
>>>> +    aodev->rc = rc;
>>>> +    device_xsentries_remove(egc, aodev);
>>>> +    return;
>>>> +}
>>> Firstly, I'm not convinced it's really proper for
>>> libxl__initiate_device_connection to call device_xsentries_remove.
>>> After all device_xsentries_remove is part of the implementation of
>>> libxl__initiate_device_remove.
>> This is part of both flows, both device connection and disconnection.
>
> Well then it should have a proper description and a better name,
> perhaps ?

This functions is latter renamed to "device_hotplug_done", which is the 
point where the callback is done. Since this name is only going to be 
there for like two commits, can we leave it like that?

> As it is it looks like you're doing what amounts to "goto"
> from one "function" to another - only we don't notice it like that
> because it's split into multiple ao callbacks.

Yes, that's mainly one of the consequences of having the same exit point 
for all the possible scenarios. Almost every iteration of this series 
has been adding more of this stuff.

>>> And, secondly, does device_xsentries_remove really do what you want ?
>>> It has a test in it which makes it only do its work if action is
>>> DISCONNECT.
>> Yes, that's because it's called by both flows.
>
> If it is called in the connect flow, won't it be a no-op then ?
> Perhaps I'm being excessively dense here.

It is a no-op here, but in latter patches it becomes the exit point for 
the device addition/removal flow, once it is renamed to device_hotplug_done.

>
>>> Isn't the effect of this that if the xs transaction gets a conflict,
>>> we'll rerun the hotplug scripts, etc. ?  I think I may be confused
>>> here, but I don't understand how this transaction loop is supposed to
>>> work and how it is supposed to relate to the interaction with other
>>> domains, scripts, etc.
>> Yes I see your point. We should disconnect the device (execute hotplug
>> scripts) but since the xenstore entries are already gone (because the
>> transaction is not committed successfully) I don't see anyway to do it,
>> we cannot execute those scripts if the backend entries have been lost.
>>
>>> Indeed it seems to me like your arrangements in libxl__device_disk_add
>>> couldn't work if a non-null t was supplied.  libxl__device_disk_add
>>> would do all the writes in the transaction, but not commit it, so that
>>> none of them are visible to anyone, and then wait for the deivde state
>>> to change, which will never happen.
>> I'm not so sure, is it possible to add a watch to a xenstore path that
>> is inside of a not yet committed transaction? If so this will work fine,
>> the transaction will be finished correctly, and the path will be updated
>> to the correct state (2).
>
> AIUI you can add a watch for any path that you like - the path you ask
> to watch doesn't have to exist.  But you won't (necessarily) see
> events for uncommitted transactions.

Yes, but then we will hit a timeout if the transaction is not actually 
committed.

>> If the transaction is not committed successfully, we will get a timeout
>> from the devstate event and exit.
>
> I think that the only way all this could work is if you firstly, in
> one transaction, create enough of the backend for the hotplug scripts
> to run, and then in a second transaction create the rest of the
> backend plus the frontend.

The hotplug scripts require the backend to be in state 2 (it requires 
that the kernel has initialized the device) so it needs to have a full 
backend set up.

>>> I think this code is a symptom of a problem elsewhere.  When adding a
>>> disk to a domain, it should not be necessary to explicitly ask to add
>>> it to the stubdom too.  But this is not your fault, or your problem
>>> right now.
>> So I assume we can leave this for later.
>
> Yes.
>
> Thanks,
> Ian.

  reply	other threads:[~2012-06-27 17:35 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 12:21 [PATCH v6 00/13] execute hotplug scripts from libxl Roger Pau Monne
2012-06-14 12:21 ` [PATCH v6 01/13] libxl: change ao_device_remove to ao_device Roger Pau Monne
2012-06-15 16:45   ` Ian Jackson
2012-06-18  8:58     ` Roger Pau Monne
2012-06-14 12:21 ` [PATCH v6 02/13] libxl: move device model creation prototypes Roger Pau Monne
2012-06-14 12:21 ` [PATCH v6 03/13] libxl: convert libxl_domain_destroy to an async op Roger Pau Monne
2012-06-21 17:34   ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 04/13] libxl: move bootloader data strucutres and prototypes Roger Pau Monne
2012-06-21 17:35   ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 05/13] libxl: convert libxl__device_disk_local_attach to an async op Roger Pau Monne
2012-06-21 17:58   ` Ian Jackson
2012-06-26 10:27     ` Roger Pau Monne
2012-07-03 15:14   ` Ian Campbell
2012-06-14 12:21 ` [PATCH v6 06/13] libxl: convert libxl_device_disk_add " Roger Pau Monne
2012-06-22 11:33   ` Ian Jackson
2012-06-26 15:04     ` Roger Pau Monne
2012-06-26 15:14       ` Roger Pau Monne
2012-06-26 17:19       ` Ian Jackson
2012-06-27 17:35         ` Roger Pau Monne [this message]
2012-06-14 12:21 ` [PATCH v6 07/13] libxl: convert libxl_device_nic_add to an async operation Roger Pau Monne
2012-06-22 11:37   ` Ian Jackson
2012-06-22 12:01     ` Ian Campbell
2012-06-26 16:17     ` Roger Pau Monne
2012-06-26 17:22       ` Ian Jackson
2012-06-28  9:53         ` Roger Pau Monne
2012-06-28  9:56           ` Ian Campbell
2012-06-28 13:30             ` Roger Pau Monne
2012-06-14 12:21 ` [PATCH v6 08/13] libxl: add option to choose who executes hotplug scripts Roger Pau Monne
2012-07-03  8:33   ` Ian Campbell
2012-06-14 12:21 ` [PATCH v6 09/13] libxl: rename _IOEMU nic type to VIF_IOEMU Roger Pau Monne
2012-06-22 11:39   ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 10/13] libxl: set nic type to VIF by default Roger Pau Monne
2012-06-22 11:40   ` Ian Jackson
2012-06-26 16:20     ` Roger Pau Monne
2012-06-26 16:58       ` Pasi Kärkkäinen
2012-06-27  8:50         ` Ian Campbell
2012-06-28  9:22           ` Roger Pau Monne
2012-06-28  9:26             ` Ian Campbell
2012-06-28  9:41               ` Roger Pau Monne
2012-06-28  9:54                 ` Ian Campbell
2012-06-28 10:07                   ` Roger Pau Monne
2012-06-28 10:10                     ` Ian Campbell
2012-06-28 13:29                       ` Roger Pau Monne
2012-06-28  9:28             ` Roger Pau Monne
2012-06-26 17:22       ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 11/13] libxl: use libxl__xs_path_cleanup on device_destroy Roger Pau Monne
2012-06-14 12:21 ` [PATCH v6 12/13] libxl: call hotplug scripts for disk devices from libxl Roger Pau Monne
2012-06-22 11:43   ` Ian Jackson
2012-06-14 12:21 ` [PATCH v6 13/13] libxl: call hotplug scripts for nic " Roger Pau Monne
2012-05-30 13:07   ` [PATCH v5 01/10] execute hotplug scripts " Roger Pau Monne
2012-05-30 13:07     ` [PATCH v5 01/10] libxl: change libxl__ao_device_remove to libxl__ao_device Roger Pau Monne
2012-06-07 10:53       ` Ian Jackson
2012-06-11 10:09         ` Roger Pau Monne
2012-05-30 13:07     ` [PATCH v5 02/10] libxl: move device model creation prototypes Roger Pau Monne
2012-05-30 13:07     ` [PATCH v5 03/10] libxl: convert libxl_domain_destroy to an async op Roger Pau Monne
2012-05-30 13:07     ` [PATCH v5 04/10] libxl: convert libxl_device_disk_add to an asyn op Roger Pau Monne
2012-06-07 11:38       ` Ian Jackson
2012-06-11 12:33         ` Roger Pau Monne
2012-06-07 14:20       ` Ian Jackson
2012-06-07 16:42         ` Roger Pau Monne
2012-06-07 16:47           ` Ian Jackson
2012-06-07 14:25       ` Ian Jackson
2012-06-07 16:55         ` Roger Pau Monne
2012-06-07 17:05           ` Ian Jackson
2012-06-07 17:07             ` Roger Pau Monne
2012-06-07 17:11               ` Ian Jackson
2012-05-30 13:07     ` [PATCH v5 05/10] libxl: convert libxl_device_nic_add to an async operation Roger Pau Monne
2012-06-07 14:26       ` Ian Jackson
2012-05-30 13:07     ` [PATCH v5 06/10] libxl: add option to choose who executes hotplug scripts Roger Pau Monne
2012-05-30 13:07     ` [PATCH v5 07/10] libxl: set nic type to VIF by default Roger Pau Monne
2012-05-30 13:07     ` [PATCH v5 08/10] libxl: call hotplug scripts for disk devices from libxl Roger Pau Monne
2012-06-07 14:40       ` Ian Jackson
2012-05-30 13:07     ` [PATCH v5 09/10] libxl: call hotplug scripts for nic " Roger Pau Monne
2012-06-07 14:48       ` Ian Jackson
2012-06-11 14:34         ` Roger Pau Monne
2012-06-22 11:47         ` [PATCH v5 09/10] libxl: call hotplug scripts for nic devices from libxl [and 1 more messages] Ian Jackson
2012-06-26  8:57           ` Roger Pau Monne
2012-05-30 13:07     ` [PATCH v5 10/10] libxl: use libxl__xs_path_cleanup on device_destroy Roger Pau Monne
2012-06-07 14:50       ` Ian Jackson
2012-07-03  8:27 ` [PATCH v6 00/13] execute hotplug scripts from libxl Ian Campbell
2012-07-03  9:19 ` Ian Campbell
2012-07-03  9:26   ` Ian Campbell
2012-07-03 12:54   ` Ian Jackson
2012-07-03 13:04     ` Ian Campbell

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=4FEB4453.1080307@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=Ian.Jackson@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).