* [PATCH] libxl: add all pci devices to xenstore at once (during VM create)
@ 2011-06-09 23:19 Marek Marczykowski
2011-06-10 10:50 ` Stefano Stabellini
0 siblings, 1 reply; 8+ messages in thread
From: Marek Marczykowski @ 2011-06-09 23:19 UTC (permalink / raw)
To: xen-devel; +Cc: marmarek
# HG changeset patch
# User Marek Marczykowski <marmarek@mimuw.edu.pl>
# Date 1307661438 -7200
# Node ID 4b392511ae0840fba66c40aa2788dc1ff402b6e8
# Parent b2b8fef3732c10f012fc209d2850e80d95471582
libxl: add all pci devices to xenstore at once (during VM create)
When adding pci devices one by one, pciback notice only the first one. For
every next, "state" is left as is (usualy "4" in that time), so backend will
not rescan xenstore. So when VM is starting all devices should be added at once
and then backend can initialize it.
This applies only to pci, because only pci backend have one xenstore dir for
multiple devices.
Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -521,6 +521,12 @@ static int do_domain_create(libxl__gc *g
for (i = 0; i < d_config->num_pcidevs; i++)
libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
+ ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs, d_config->num_pcidevs);
+ if (ret < 0) {
+ fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: libxl_create_pci_backend\n",
+ __FILE__,__LINE__, ret);
+ goto error_out;
+ }
if ( cb && (d_config->c_info.hvm || d_config->b_info.u.pv.bootloader )) {
if ( (*cb)(ctx, domid, priv) )
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -224,6 +224,7 @@ _hidden int libxl__wait_for_backend(libx
/* from libxl_pci */
_hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int starting);
+_hidden int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num);
/* xl_exec */
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -221,7 +221,7 @@ static void libxl_create_pci_backend_dev
flexarray_append_pair(back, libxl__sprintf(gc, "state-%d", num), libxl__sprintf(gc, "%d", 1));
}
-static int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num)
+int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
flexarray_t *front = NULL;
@@ -705,7 +705,10 @@ out:
}
}
- rc = libxl__device_pci_add_xenstore(gc, domid, pcidev, starting);
+ if (!starting)
+ rc = libxl__device_pci_add_xenstore(gc, domid, pcidev, starting);
+ else
+ rc = 0;
return rc;
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] libxl: add all pci devices to xenstore at once (during VM create)
2011-06-09 23:19 [PATCH] libxl: add all pci devices to xenstore at once (during VM create) Marek Marczykowski
@ 2011-06-10 10:50 ` Stefano Stabellini
2011-06-10 10:59 ` [PATCH RESENT] " Marek Marczykowski
2011-06-10 11:02 ` [PATCH RESENTv2] " Marek Marczykowski
0 siblings, 2 replies; 8+ messages in thread
From: Stefano Stabellini @ 2011-06-10 10:50 UTC (permalink / raw)
To: Marek Marczykowski; +Cc: xen-devel@lists.xensource.com
On Fri, 10 Jun 2011, Marek Marczykowski wrote:
> # HG changeset patch
> # User Marek Marczykowski <marmarek@mimuw.edu.pl>
> # Date 1307661438 -7200
> # Node ID 4b392511ae0840fba66c40aa2788dc1ff402b6e8
> # Parent b2b8fef3732c10f012fc209d2850e80d95471582
> libxl: add all pci devices to xenstore at once (during VM create)
>
> When adding pci devices one by one, pciback notice only the first one. For
> every next, "state" is left as is (usualy "4" in that time), so backend will
> not rescan xenstore. So when VM is starting all devices should be added at once
> and then backend can initialize it.
>
> This applies only to pci, because only pci backend have one xenstore dir for
> multiple devices.
>
> Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
>
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -521,6 +521,12 @@ static int do_domain_create(libxl__gc *g
>
> for (i = 0; i < d_config->num_pcidevs; i++)
> libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
> + ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs, d_config->num_pcidevs);
> + if (ret < 0) {
> + fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: libxl_create_pci_backend\n",
> + __FILE__,__LINE__, ret);
> + goto error_out;
> + }
>
> if ( cb && (d_config->c_info.hvm || d_config->b_info.u.pv.bootloader )) {
> if ( (*cb)(ctx, domid, priv) )
Please use LIBXL__LOG rather than fprintf.
The rest of the patch is fine, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH RESENT] libxl: add all pci devices to xenstore at once (during VM create)
2011-06-10 10:50 ` Stefano Stabellini
@ 2011-06-10 10:59 ` Marek Marczykowski
2011-06-10 11:10 ` Stefano Stabellini
2011-06-17 17:49 ` Ian Jackson
2011-06-10 11:02 ` [PATCH RESENTv2] " Marek Marczykowski
1 sibling, 2 replies; 8+ messages in thread
From: Marek Marczykowski @ 2011-06-10 10:59 UTC (permalink / raw)
To: xen-devel; +Cc: marmarek
# HG changeset patch
# User Marek Marczykowski <marmarek@mimuw.edu.pl>
# Date 1307661438 -7200
# Node ID dde7bd609f9b2e795e9c530e8422ae42a86f9b6b
# Parent b2b8fef3732c10f012fc209d2850e80d95471582
libxl: add all pci devices to xenstore at once (during VM create)
When adding pci devices one by one, pciback notice only the first one. For
every next, "state" is left as is (usualy "4" in that time), so backend will
not rescan xenstore. So when VM is starting all devices should be added at once
and then backend can initialize it.
This applies only to pci, because only pci backend have one xenstore dir for
multiple devices.
Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -521,6 +521,11 @@ static int do_domain_create(libxl__gc *g
for (i = 0; i < d_config->num_pcidevs; i++)
libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
+ ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs, d_config->num_pcidevs);
+ if (ret < 0) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_create_pci_backend failed: %d", ret);
+ goto error_out;
+ }
if ( cb && (d_config->c_info.hvm || d_config->b_info.u.pv.bootloader )) {
if ( (*cb)(ctx, domid, priv) )
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -224,6 +224,7 @@ _hidden int libxl__wait_for_backend(libx
/* from libxl_pci */
_hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int starting);
+_hidden int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num);
/* xl_exec */
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -221,7 +221,7 @@ static void libxl_create_pci_backend_dev
flexarray_append_pair(back, libxl__sprintf(gc, "state-%d", num), libxl__sprintf(gc, "%d", 1));
}
-static int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num)
+int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
flexarray_t *front = NULL;
@@ -705,7 +705,10 @@ out:
}
}
- rc = libxl__device_pci_add_xenstore(gc, domid, pcidev, starting);
+ if (!starting)
+ rc = libxl__device_pci_add_xenstore(gc, domid, pcidev, starting);
+ else
+ rc = 0;
return rc;
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH RESENTv2] libxl: add all pci devices to xenstore at once (during VM create)
2011-06-10 10:50 ` Stefano Stabellini
2011-06-10 10:59 ` [PATCH RESENT] " Marek Marczykowski
@ 2011-06-10 11:02 ` Marek Marczykowski
2011-06-21 16:38 ` Ian Jackson
1 sibling, 1 reply; 8+ messages in thread
From: Marek Marczykowski @ 2011-06-10 11:02 UTC (permalink / raw)
To: xen-devel; +Cc: marmarek
# HG changeset patch
# User Marek Marczykowski <marmarek@mimuw.edu.pl>
# Date 1307661438 -7200
# Node ID ab51f4a066155b5da552dce78b0f3e19aa7cfd58
# Parent b2b8fef3732c10f012fc209d2850e80d95471582
libxl: add all pci devices to xenstore at once (during VM create)
When adding pci devices one by one, pciback notice only the first one. For
every next, "state" is left as is (usualy "4" in that time), so backend will
not rescan xenstore. So when VM is starting all devices should be added at once
and then backend can initialize it.
This applies only to pci, because only pci backend have one xenstore dir for
multiple devices.
Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -521,6 +521,11 @@ static int do_domain_create(libxl__gc *g
for (i = 0; i < d_config->num_pcidevs; i++)
libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
+ ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs, d_config->num_pcidevs);
+ if (ret < 0) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_create_pci_backend failed: %d", ret);
+ goto error_out;
+ }
if ( cb && (d_config->c_info.hvm || d_config->b_info.u.pv.bootloader )) {
if ( (*cb)(ctx, domid, priv) )
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -224,6 +224,7 @@ _hidden int libxl__wait_for_backend(libx
/* from libxl_pci */
_hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int starting);
+_hidden int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num);
/* xl_exec */
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -221,7 +221,7 @@ static void libxl_create_pci_backend_dev
flexarray_append_pair(back, libxl__sprintf(gc, "state-%d", num), libxl__sprintf(gc, "%d", 1));
}
-static int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num)
+int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
flexarray_t *front = NULL;
@@ -705,7 +705,10 @@ out:
}
}
- rc = libxl__device_pci_add_xenstore(gc, domid, pcidev, starting);
+ if (!starting)
+ rc = libxl__device_pci_add_xenstore(gc, domid, pcidev, starting);
+ else
+ rc = 0;
return rc;
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RESENT] libxl: add all pci devices to xenstore at once (during VM create)
2011-06-10 10:59 ` [PATCH RESENT] " Marek Marczykowski
@ 2011-06-10 11:10 ` Stefano Stabellini
2011-06-17 17:49 ` Ian Jackson
1 sibling, 0 replies; 8+ messages in thread
From: Stefano Stabellini @ 2011-06-10 11:10 UTC (permalink / raw)
To: Marek Marczykowski; +Cc: xen-devel@lists.xensource.com
On Fri, 10 Jun 2011, Marek Marczykowski wrote:
> # HG changeset patch
> # User Marek Marczykowski <marmarek@mimuw.edu.pl>
> # Date 1307661438 -7200
> # Node ID dde7bd609f9b2e795e9c530e8422ae42a86f9b6b
> # Parent b2b8fef3732c10f012fc209d2850e80d95471582
> libxl: add all pci devices to xenstore at once (during VM create)
>
> When adding pci devices one by one, pciback notice only the first one. For
> every next, "state" is left as is (usualy "4" in that time), so backend will
> not rescan xenstore. So when VM is starting all devices should be added at once
> and then backend can initialize it.
>
> This applies only to pci, because only pci backend have one xenstore dir for
> multiple devices.
>
> Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RESENT] libxl: add all pci devices to xenstore at once (during VM create)
2011-06-10 10:59 ` [PATCH RESENT] " Marek Marczykowski
2011-06-10 11:10 ` Stefano Stabellini
@ 2011-06-17 17:49 ` Ian Jackson
1 sibling, 0 replies; 8+ messages in thread
From: Ian Jackson @ 2011-06-17 17:49 UTC (permalink / raw)
To: Marek Marczykowski; +Cc: xen-devel
Marek Marczykowski writes ("[Xen-devel] [PATCH RESENT] libxl: add all pci devices to xenstore at once (during VM create)"):
> + ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs, d_config->num_pcidevs);
> + if (ret < 0) {
> + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_create_pci_backend failed: %d", ret);
> + goto error_out;
> + }
This is a good patch but can you please keep your lines to 75
characters or so ? I know libxl already has areas full of long lines,
but we'd rather not introduce any more.
Thanks,
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RESENTv2] libxl: add all pci devices to xenstore at once (during VM create)
2011-06-10 11:02 ` [PATCH RESENTv2] " Marek Marczykowski
@ 2011-06-21 16:38 ` Ian Jackson
2011-06-21 16:46 ` Ian Jackson
0 siblings, 1 reply; 8+ messages in thread
From: Ian Jackson @ 2011-06-21 16:38 UTC (permalink / raw)
To: Marek Marczykowski; +Cc: xen-devel
Marek Marczykowski writes ("[Xen-devel] [PATCH RESENTv2] libxl: add all pci devices to xenstore at once (during VM create)"):
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -521,6 +521,11 @@ static int do_domain_create(libxl__gc *g
>
> for (i = 0; i < d_config->num_pcidevs; i++)
> libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
> + ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs, d_config->num_pcidevs);
> + if (ret < 0) {
> + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_create_pci_backend failed: %d", ret);
> + goto error_out;
> + }
There is an indenting error here.
Also your lines are still >75 characters. Please wrap them
appropriately, including splitting strings if necessary.
Thanks,
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RESENTv2] libxl: add all pci devices to xenstore at once (during VM create)
2011-06-21 16:38 ` Ian Jackson
@ 2011-06-21 16:46 ` Ian Jackson
0 siblings, 0 replies; 8+ messages in thread
From: Ian Jackson @ 2011-06-21 16:46 UTC (permalink / raw)
To: Marek Marczykowski, xen-devel
iwj writes ("Re: [Xen-devel] [PATCH RESENTv2] libxl: add all pci devices to xenstore at once (during VM create)"):
> Marek Marczykowski writes ("[Xen-devel] [PATCH RESENTv2] libxl: add all pci devices to xenstore at once (during VM create)"):
> > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> > --- a/tools/libxl/libxl_create.c
> > +++ b/tools/libxl/libxl_create.c
> > @@ -521,6 +521,11 @@ static int do_domain_create(libxl__gc *g
> >
> > for (i = 0; i < d_config->num_pcidevs; i++)
> > libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
> > + ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs, d_confi
g->num_pcidevs);
> > + if (ret < 0) {
> > + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_create_pci_backend faile
d: %d", ret);
> > + goto error_out;
> > + }
>
> There is an indenting error here.
Oh wait, no there isn't. I blame being distracted by the wrap damage.
> Also your lines are still >75 characters. Please wrap them
> appropriately, including splitting strings if necessary.
I will fix up the formatting and apply the patch.
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-06-21 16:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-09 23:19 [PATCH] libxl: add all pci devices to xenstore at once (during VM create) Marek Marczykowski
2011-06-10 10:50 ` Stefano Stabellini
2011-06-10 10:59 ` [PATCH RESENT] " Marek Marczykowski
2011-06-10 11:10 ` Stefano Stabellini
2011-06-17 17:49 ` Ian Jackson
2011-06-10 11:02 ` [PATCH RESENTv2] " Marek Marczykowski
2011-06-21 16:38 ` Ian Jackson
2011-06-21 16:46 ` Ian Jackson
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).