From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Pau Monne Subject: Re: [PATCH] libxl: make libxl_device_{vkb, vfb}_add take a dummy ao Date: Wed, 9 May 2012 09:46:52 +0100 Message-ID: <4FAA2EFC.3030609@citrix.com> References: <1334592052-7995-1-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1334592052-7995-1-git-send-email-roger.pau@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Roger Pau Monne escribi=F3: > Add a dummy ao parameter to both functions, since they may become slow in= the > future. > > Signed-off-by: Roger Pau Monne This is completely wrong, please don't even review it. > --- > > Requires Ian Jackson's "libxl: Allow AO_GC and EGC_GC even if not used" > > tools/libxl/libxl.c | 20 ++++++++++++-------- > tools/libxl/libxl.h | 6 ++++-- > tools/libxl/libxl_create.c | 6 +++--- > tools/libxl/libxl_dm.c | 4 ++-- > 4 files changed, 21 insertions(+), 15 deletions(-) > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index 44a54cb..3fd8d5b 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -2208,9 +2208,10 @@ static int libxl__device_from_vkb(libxl__gc *gc, u= int32_t domid, > return 0; > } > > -int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vk= b *vkb) > +int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vk= b *vkb, > + const libxl_asyncop_how *ao_how) > { > - GC_INIT(ctx); > + AO_CREATE(ctx, domid, ao_how); > flexarray_t *front; > flexarray_t *back; > libxl__device device; > @@ -2255,8 +2256,9 @@ out_free: > flexarray_free(back); > flexarray_free(front); > out: > - GC_FREE; > - return rc; > + /* Dummy ao */ > + libxl__ao_complete(egc, ao, rc); > + return AO_INPROGRESS; > } > > int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid, > @@ -2339,9 +2341,10 @@ static int libxl__device_from_vfb(libxl__gc *gc, u= int32_t domid, > return 0; > } > > -int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vf= b *vfb) > +int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vf= b *vfb, > + const libxl_asyncop_how *ao_how) > { > - GC_INIT(ctx); > + AO_CREATE(ctx, domid, ao_how); > flexarray_t *front; > flexarray_t *back; > libxl__device device; > @@ -2399,8 +2402,9 @@ out_free: > flexarray_free(front); > flexarray_free(back); > out: > - GC_FREE; > - return rc; > + /* Dummy ao */ > + libxl__ao_complete(egc, ao, rc); > + return AO_INPROGRESS; > } > > int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid, > diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h > index 6da6107..ce89b31 100644 > --- a/tools/libxl/libxl.h > +++ b/tools/libxl/libxl.h > @@ -563,14 +563,16 @@ int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32= _t domid, > libxl_device_nic *nic, libxl_nicinfo *nic= info); > > /* Keyboard */ > -int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vk= b *vkb); > +int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vk= b *vkb, > + const libxl_asyncop_how *ao_how); > int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid, > libxl_device_vkb *vkb, > const libxl_asyncop_how *ao_how); > int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_devi= ce_vkb *vkb); > > /* Framebuffer */ > -int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vf= b *vfb); > +int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vf= b *vfb, > + const libxl_asyncop_how *ao_how); > int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid, > libxl_device_vfb *vfb, > const libxl_asyncop_how *ao_how); > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c > index a1f5731..39e9257 100644 > --- a/tools/libxl/libxl_create.c > +++ b/tools/libxl/libxl_create.c > @@ -628,7 +628,7 @@ static int do_domain_create(libxl__gc *gc, libxl_doma= in_config *d_config, > libxl__device_console_dispose(&console); > > libxl_device_vkb_init(&vkb); > - libxl_device_vkb_add(ctx, domid,&vkb); > + libxl_device_vkb_add(ctx, domid,&vkb, 0); > libxl_device_vkb_dispose(&vkb); > > ret =3D libxl__create_device_model(gc, domid, d_config, > @@ -646,8 +646,8 @@ static int do_domain_create(libxl__gc *gc, libxl_doma= in_config *d_config, > libxl__device_console console; > > for (i =3D 0; i< d_config->num_vfbs; i++) { > - libxl_device_vfb_add(ctx, domid,&d_config->vfbs[i]); > - libxl_device_vkb_add(ctx, domid,&d_config->vkbs[i]); > + libxl_device_vfb_add(ctx, domid,&d_config->vfbs[i], 0); > + libxl_device_vkb_add(ctx, domid,&d_config->vkbs[i], 0); > } > > ret =3D init_console_info(&console, 0); > diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c > index 8dc588d..4a2b5c1 100644 > --- a/tools/libxl/libxl_dm.c > +++ b/tools/libxl/libxl_dm.c > @@ -804,10 +804,10 @@ retry_transaction: > if (ret) > goto out_free; > } > - ret =3D libxl_device_vfb_add(ctx, dm_domid,&dm_config.vfbs[0]); > + ret =3D libxl_device_vfb_add(ctx, dm_domid,&dm_config.vfbs[0], 0); > if (ret) > goto out_free; > - ret =3D libxl_device_vkb_add(ctx, dm_domid,&dm_config.vkbs[0]); > + ret =3D libxl_device_vkb_add(ctx, dm_domid,&dm_config.vkbs[0], 0); > if (ret) > goto out_free; >