From: Wei Liu <wei.liu2@citrix.com>
To: Anthony PERARD <anthony.perard@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: Re: [PATCH 3/3] libxl: update vcpus bitmap in retrieved guest config
Date: Tue, 7 Jun 2016 17:03:07 +0100 [thread overview]
Message-ID: <20160607160307.GN25922@citrix.com> (raw)
In-Reply-To: <20160607144529.GL1184@perard.uk.xensource.com>
On Tue, Jun 07, 2016 at 03:45:29PM +0100, Anthony PERARD wrote:
> On Tue, Jun 07, 2016 at 12:24:02PM +0100, Wei Liu wrote:
> > ... because the available vcpu bitmap can change during domain life time
> > due to cpu hotplug and unplug.
> >
> > For QEMU upstream, we interrogate QEMU for the number of vcpus. For
> > others, we look directly into xenstore for information.
> >
> > Reported-by: Jan Beulich <jbeulich@suse.com>
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > ---
> > tools/libxl/libxl.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 91 insertions(+)
> >
> > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> > index 006b83f..4f8b663 100644
> > --- a/tools/libxl/libxl.c
> > +++ b/tools/libxl/libxl.c
> > @@ -7222,6 +7222,57 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src)
> > (*dst)[i] = (*src)[i];
> > }
> >
> > +static int libxl__update_avail_vcpus_qmp(libxl__gc *gc, uint32_t domid,
> > + unsigned int max_vcpus,
> > + libxl_bitmap *map)
> > +{
> > + unsigned int count, i;
> > + int rc;
> > +
> > + /* For QEMU upstream we always need to return the number
> > + * of cpus present to QEMU whether they are online or not;
> > + * otherwise QEMU won't accept the saved state.
> > + */
> > + rc = libxl__qmp_query_cpus(gc, domid, &count);
> > + if (rc) {
> > + LOG(ERROR, "fail to get number of cpus for domain %d", domid);
> > + goto out;
> > + }
> > +
> > + for (i = 0; i < count; i++)
> > + libxl_bitmap_set(map, i);
>
> What if I have cpu 1, 7 and 42 online, but all the other offline?
>
I have more or less the same question when I wrote this patch. At that
time I thought the avail_vcpus was only used for generating -smp option
to QEMU.
In your example, you will have -smp 3,maxvcpus=$Y. I think the migration
should still succeed. Furthermore, the cpu-add operation doesn't care,
so it probably won't have visible effect.
I agree it would be good to set the exact bits though -- if you can tell
me which field to test.
-> { "execute": "query-cpus" }
<- {
"return":[
{
"CPU":0,
"current":true,
"halted":false,
"qom_path":"/machine/unattached/device[0]",
"arch":"x86",
"pc":3227107138,
"thread_id":3134
},
{
"CPU":1,
"current":false,
"halted":true,
"qom_path":"/machine/unattached/device[2]",
"arch":"x86",
"pc":7108165,
"thread_id":3135
}
]
}
EQMP
Wei.
> --
> Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-07 16:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-07 11:23 [PATCH 0/3] libxl: update available vcpus map in retrieve configuration function Wei Liu
2016-06-07 11:24 ` [PATCH 1/3] libxl: introduce libxl__json_array_count Wei Liu
2016-06-07 11:24 ` [PATCH 2/3] libxl: introduce libxl__qmp_query_cpus Wei Liu
2016-06-07 11:24 ` [PATCH 3/3] libxl: update vcpus bitmap in retrieved guest config Wei Liu
2016-06-07 14:45 ` Anthony PERARD
2016-06-07 16:03 ` Wei Liu [this message]
2016-06-07 16:22 ` Dario Faggioli
2016-06-07 16:46 ` Wei Liu
2016-06-07 17:05 ` Dario Faggioli
2016-06-07 16:36 ` Anthony PERARD
2016-06-07 16:39 ` Wei Liu
2016-06-14 16:31 ` Ian Jackson
2016-06-14 16:39 ` Wei Liu
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=20160607160307.GN25922@citrix.com \
--to=wei.liu2@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=anthony.perard@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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 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.