* [PATCH] libxl: remove the xl list limit of 1024 domains
@ 2015-12-18 14:34 Juergen Gross
2015-12-18 14:47 ` Andrew Cooper
2016-01-04 14:35 ` Juergen Gross
0 siblings, 2 replies; 4+ messages in thread
From: Juergen Gross @ 2015-12-18 14:34 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
xl list is currently limited to 1024 domains. Remove the limit.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/libxl/libxl.c | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 9207621..83e37a9 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -649,31 +649,30 @@ static void xcinfo2xlinfo(libxl_ctx *ctx,
libxl_dominfo * libxl_list_domain(libxl_ctx *ctx, int *nb_domain_out)
{
- libxl_dominfo *ptr;
+ libxl_dominfo *ptr = NULL;
int i, ret;
xc_domaininfo_t info[1024];
- int size = 1024;
+ int size = 0;
+ uint32_t domid = 0;
GC_INIT(ctx);
- ptr = calloc(size, sizeof(libxl_dominfo));
- if (!ptr) {
- LOGE(ERROR, "allocating domain info");
- GC_FREE;
- return NULL;
- }
-
- ret = xc_domain_getinfolist(ctx->xch, 0, 1024, info);
- if (ret<0) {
- LOGE(ERROR, "getting domain info list");
- free(ptr);
- GC_FREE;
- return NULL;
+ for (ret = 1; ret;) {
+ ret = xc_domain_getinfolist(ctx->xch, domid, 1024, info);
+ if (ret < 0) {
+ LOGE(ERROR, "getting domain info list");
+ free(ptr);
+ GC_FREE;
+ return NULL;
+ }
+ ptr = libxl__realloc(NOGC, ptr, (size + ret) * sizeof(libxl_dominfo));
+ for (i = 0; i < ret; i++) {
+ xcinfo2xlinfo(ctx, &info[i], &ptr[size + i]);
+ }
+ domid = info[ret - 1].domain + 1;
+ size += ret;
}
- for (i = 0; i < ret; i++) {
- xcinfo2xlinfo(ctx, &info[i], &ptr[i]);
- }
- *nb_domain_out = ret;
+ *nb_domain_out = size;
GC_FREE;
return ptr;
}
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] libxl: remove the xl list limit of 1024 domains
2015-12-18 14:34 [PATCH] libxl: remove the xl list limit of 1024 domains Juergen Gross
@ 2015-12-18 14:47 ` Andrew Cooper
2015-12-18 15:07 ` Juergen Gross
2016-01-04 14:35 ` Juergen Gross
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2015-12-18 14:47 UTC (permalink / raw)
To: Juergen Gross, xen-devel, Ian.Campbell, ian.jackson,
stefano.stabellini, wei.liu2
On 18/12/15 14:34, Juergen Gross wrote:
> xl list is currently limited to 1024 domains. Remove the limit.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
libxl_list_vm() needs similar treatment. In fact, it looks as if it
should be implemented in terms of libxl_list_domain(), rather than
opencoding similar same logic.
~Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libxl: remove the xl list limit of 1024 domains
2015-12-18 14:47 ` Andrew Cooper
@ 2015-12-18 15:07 ` Juergen Gross
0 siblings, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2015-12-18 15:07 UTC (permalink / raw)
To: Andrew Cooper, xen-devel, Ian.Campbell, ian.jackson,
stefano.stabellini, wei.liu2
On 18/12/15 15:47, Andrew Cooper wrote:
> On 18/12/15 14:34, Juergen Gross wrote:
>> xl list is currently limited to 1024 domains. Remove the limit.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>
> libxl_list_vm() needs similar treatment. In fact, it looks as if it
> should be implemented in terms of libxl_list_domain(), rather than
> opencoding similar same logic.
Yeah, and get_domain_ids() in tools/xenstat/libxenstat/src/xenstat_qmp.c
has the same problem.
I won't be able to the patches today and I'll be back from holidays only
next year. I'll do the patches in case no one else is stepping up.
Juergen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libxl: remove the xl list limit of 1024 domains
2015-12-18 14:34 [PATCH] libxl: remove the xl list limit of 1024 domains Juergen Gross
2015-12-18 14:47 ` Andrew Cooper
@ 2016-01-04 14:35 ` Juergen Gross
1 sibling, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2016-01-04 14:35 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
On 18/12/15 15:34, Juergen Gross wrote:
> xl list is currently limited to 1024 domains. Remove the limit.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Found a bug, will send V2 soon (together with two other patches
addressing a similar limitation in xl vm-list and tools/xenstat.
Juergen
> ---
> tools/libxl/libxl.c | 37 ++++++++++++++++++-------------------
> 1 file changed, 18 insertions(+), 19 deletions(-)
>
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 9207621..83e37a9 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -649,31 +649,30 @@ static void xcinfo2xlinfo(libxl_ctx *ctx,
>
> libxl_dominfo * libxl_list_domain(libxl_ctx *ctx, int *nb_domain_out)
> {
> - libxl_dominfo *ptr;
> + libxl_dominfo *ptr = NULL;
> int i, ret;
> xc_domaininfo_t info[1024];
> - int size = 1024;
> + int size = 0;
> + uint32_t domid = 0;
> GC_INIT(ctx);
>
> - ptr = calloc(size, sizeof(libxl_dominfo));
> - if (!ptr) {
> - LOGE(ERROR, "allocating domain info");
> - GC_FREE;
> - return NULL;
> - }
> -
> - ret = xc_domain_getinfolist(ctx->xch, 0, 1024, info);
> - if (ret<0) {
> - LOGE(ERROR, "getting domain info list");
> - free(ptr);
> - GC_FREE;
> - return NULL;
> + for (ret = 1; ret;) {
> + ret = xc_domain_getinfolist(ctx->xch, domid, 1024, info);
> + if (ret < 0) {
> + LOGE(ERROR, "getting domain info list");
> + free(ptr);
> + GC_FREE;
> + return NULL;
> + }
> + ptr = libxl__realloc(NOGC, ptr, (size + ret) * sizeof(libxl_dominfo));
> + for (i = 0; i < ret; i++) {
> + xcinfo2xlinfo(ctx, &info[i], &ptr[size + i]);
> + }
> + domid = info[ret - 1].domain + 1;
> + size += ret;
> }
>
> - for (i = 0; i < ret; i++) {
> - xcinfo2xlinfo(ctx, &info[i], &ptr[i]);
> - }
> - *nb_domain_out = ret;
> + *nb_domain_out = size;
> GC_FREE;
> return ptr;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-04 14:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-18 14:34 [PATCH] libxl: remove the xl list limit of 1024 domains Juergen Gross
2015-12-18 14:47 ` Andrew Cooper
2015-12-18 15:07 ` Juergen Gross
2016-01-04 14:35 ` Juergen Gross
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.