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 09/13] libxl: convert libxl_device_nic_add to an async operation
Date: Tue, 22 May 2012 14:49:42 +0100	[thread overview]
Message-ID: <4FBB9976.9050605@citrix.com> (raw)
In-Reply-To: <20406.31483.341852.193941@mariner.uk.xensource.com>

Ian Jackson wrote:
> Roger Pau Monne writes ("[PATCH 09/13] libxl: convert libxl_device_nic_add to an async operation"):
>> This patch converts libxl_device_nic_add to an ao operation that
>> waits for device backend to reach state XenbusStateInitWait and then
>> marks the operation as completed. This is not really useful now, but
>> will be used by latter patches that will launch hotplug scripts after
>> we reached the desired xenbus state.
>
> Why do you serialise vif and vbd initialisation ?  Would anything go
> wrong if you did them both at once ?

disk needs to be added before Qemu is launched, on the other hand nics 
need to be added after qemu is launched, so we need to add them at 
different moments during the domain creation, it's a PITA.

>> +    /* Plug nic interfaces */
>> +    if (!ret&&  d_config->num_vifs>  0) {
>> +        /* Attach nics */
>> +        GCNEW_ARRAY(dcs->devices, d_config->num_vifs);
>> +        dcs->num_devices = d_config->num_vifs;
>> +        for (i = 0; i<  d_config->num_vifs; i++) {
>> +            libxl__init_ao_device(&dcs->devices[i], ao,&dcs->devices);
>> +            dcs->devices[i].callback = domcreate_nics_connected;
>> +            libxl__device_nic_add(egc, domid,&d_config->vifs[i],
>> +&dcs->devices[i]);
>
> Ah this pattern again....
>
>> -int libxl__device_nic_add(libxl__gc *gc, uint32_t domid, libxl_device_nic *nic)
>> +void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
>> +                           libxl_device_nic *nic, libxl__ao_device *aorm)
>>   {
>> +    STATE_AO_GC(aorm->ao);
>>       flexarray_t *front;
>>       flexarray_t *back;
>> -    libxl__device device;
>> +    libxl__device *device;
>
> You might want to consider a pre-patch which changes this, and
> libxl__device_disk_add's, as follows:
>    -    libxl__device device;
>    +    libxl__device device[1];
>
> That would get rid of the noise from this patch.  Up to you, though;
> because it's separated out textually doesn't make the diff unreadable
> like it is.
>
>> @@ -845,9 +851,11 @@ static void spawn_stub_disk_connected(libxl__egc *egc, libxl__ao_device *aorm)
>>       }
>>
>>       for (i = 0; i<  dm_config->num_vifs; i++) {
>> -        ret = libxl_device_nic_add(ctx, dm_domid,&dm_config->vifs[i]);
>> -        if (ret)
>> -            goto out;
>> +        /* We have to init the nic here, because we still haven't
>> +         * called libxl_device_nic_add at this point, but qemu needs
>> +         * the nic information to be complete.
>> +         */
>> +        libxl__device_nic_setdefault(gc,&dm_config->vifs[i]);
>
> This is really too much repetition now.  Can we not have a common "add
> devices" function which is called once for the main domain and once
> for the stubdom ?

I've added a functions that does the libxl_device_disk_add loop, and 
another one for the nics. Although this line you are quoting is not 
adding a nic, it is just filling the needed values so we can launch Qemu 
correctly.

> In the future we'll need that if we have more service domains, too.
>
> Thanks,
> Ian.

  reply	other threads:[~2012-05-22 13:49 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16 16:11 [PATCH 0/13] execute hotplug scripts from libxl Roger Pau Monne
2012-05-16 16:11 ` [PATCH 01/13] libxl: pass env vars to libxl__exec Roger Pau Monne
2012-05-18 16:02   ` Ian Jackson
2012-05-16 16:11 ` [PATCH 02/13] libxl: fix libxl__xs_directory usage of transaction Roger Pau Monne
2012-05-18 16:03   ` Ian Jackson
2012-05-16 16:11 ` [PATCH 03/13] libxl: add libxl__xs_path_cleanup Roger Pau Monne
2012-05-18 16:06   ` Ian Jackson
2012-05-16 16:11 ` [PATCH 04/13] libxl: move libxl_device_disk_add to libxl_device Roger Pau Monne
2012-05-16 16:11 ` [PATCH 05/13] libxl: move libxl_device_nic_add " Roger Pau Monne
2012-05-16 16:11 ` [PATCH 06/13] libxl: cleanup libxl__device_{disk, nic}_add Roger Pau Monne
2012-05-18 16:07   ` Ian Jackson
2012-05-16 16:11 ` [PATCH 07/13] libxl: convert libxl_domain_destroy to an AO op Roger Pau Monne
2012-05-18 16:19   ` Ian Jackson
2012-05-18 16:24   ` Ian Jackson
2012-05-16 16:11 ` [PATCH 08/13] libxl: convert libxl_device_disk_add to an async operation Roger Pau Monne
2012-05-18 16:33   ` Ian Jackson
2012-05-16 16:11 ` [PATCH 09/13] libxl: convert libxl_device_nic_add " Roger Pau Monne
2012-05-18 16:38   ` Ian Jackson
2012-05-22 13:49     ` Roger Pau Monne [this message]
2012-05-22 14:04       ` Ian Jackson
2012-05-16 16:11 ` [PATCH 10/13] libxl: add option to choose who executes hotplug scripts Roger Pau Monne
2012-05-18 16:40   ` Ian Jackson
2012-05-16 16:11 ` [PATCH 11/13] libxl: set nic type to VIF by default Roger Pau Monne
2012-05-18 16:41   ` Ian Jackson
2012-05-21 16:29     ` Roger Pau Monne
2012-05-29 14:40       ` Ian Jackson
2012-05-29 14:46         ` Ian Campbell
2012-05-29 15:02           ` Ian Jackson
2012-05-29 15:06             ` Ian Campbell
2012-05-30 12:03           ` Roger Pau Monne
2012-06-07 14:30             ` Ian Jackson
2012-06-11 14:05               ` Roger Pau Monne
2012-05-16 16:11 ` [PATCH 12/13] libxl: call hotplug scripts for disk devices from libxl Roger Pau Monne
2012-05-18 16:51   ` Ian Jackson
2012-05-16 16:11 ` [PATCH 13/13] libxl: call hotplug scripts for nic " 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=4FBB9976.9050605@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).