From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony PERARD Subject: Re: [PATCH v2 2/2] libxl: Use QMP cpu-add to hotplug CPU with qemu-xen. Date: Mon, 17 Jun 2013 16:50:43 +0100 Message-ID: <51BF3053.5010701@citrix.com> References: <1371478402-28082-1-git-send-email-anthony.perard@citrix.com> <1371478833-29419-1-git-send-email-anthony.perard@citrix.com> <1371478833-29419-2-git-send-email-anthony.perard@citrix.com> <1371483062.8055.15.camel@dagon.hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1371483062.8055.15.camel@dagon.hellion.org.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Stefano Stabellini , Konrad Rzeszutek Wilk , Ian Jackson , Xen Devel List-Id: xen-devel@lists.xenproject.org On 17/06/13 16:31, Ian Campbell wrote: > On Mon, 2013-06-17 at 15:20 +0100, Anthony PERARD wrote: >> Signed-off-by: Anthony PERARD > > I'm not sure but I think we might want to do both the xenstore and the > qmp thing on qemu-xen for the benefit of PVHVM guests. I've added Konrad > to the CC. ok, that should be not to complicated to do, if necessary. >> --- >> tools/libxl/libxl.c | 41 ++++++++++++++++++++++++++++++++++++++++- >> 1 file changed, 40 insertions(+), 1 deletion(-) >> >> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c >> index ee1fa9c..e31b866 100644 >> --- a/tools/libxl/libxl.c >> +++ b/tools/libxl/libxl.c >> @@ -4237,7 +4237,8 @@ int libxl_domain_get_nodeaffinity(libxl_ctx *ctx, uint32_t domid, >> return 0; >> } >> >> -int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap) >> +static int libxl__set_vcpuonline_xenstore(libxl_ctx *ctx, uint32_t domid, >> + libxl_bitmap *cpumap) > > It's a bit tedious but really you ought to make this take a gc not a ctx > when you internalise it. You can start the function with "libxl__ctx*ctx > = libxl__gc_owner(gc)", or s/ctx/CTX/ in the body. OK, will change this. >> { >> GC_INIT(ctx); >> libxl_dominfo info; >> @@ -4268,6 +4269,44 @@ out: >> return rc; >> } >> >> +static int libxl__set_vcpuonline_qmp(libxl__gc *gc, uint32_t domid, >> + libxl_bitmap *cpumap) >> +{ >> + libxl_dominfo info; >> + int i, rc = 0; >> + >> + if (libxl_domain_info(CTX, &info, domid) < 0) { >> + LIBXL__LOG_ERRNO(CTX, LIBXL__LOG_ERROR, "getting domain info list"); > > The LOG() macros is useful here. will change this. >> + rc = ERROR_FAIL; >> + goto out; >> + } >> + for (i = 0; i <= info.vcpu_max_id; i++) { >> + if (libxl_bitmap_test(cpumap, i)) { >> + rc = libxl__qmp_cpu_add(gc, domid, i); >> + } >> + } >> +out: >> + return rc; >> +} > > -- Anthony PERARD