From: Ian Campbell Subject: Re: [PATCH 5/5] libxl: Make 'xl vcpu-set' work properly on overcommited hosts with an override. Date: Mon, 13 May 2013 11:25:54 +0100 Message-ID: <1368440754.537.44.camel@zakaz.uk.xensource.com> References: <1368219645-5375-1-git-send-email-konrad.wilk@oracle.com> <1368219645-5375-6-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1368219645-5375-6-git-send-email-konrad.wilk@oracle.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: Konrad Rzeszutek Wilk Cc: George Dunlap , "dgdegra@tycho.nsa.gov" , "xen-devel@lists.xensource.com" , Ian Jackson List-Id: xen-devel@lists.xenproject.org On Fri, 2013-05-10 at 22:00 +0100, Konrad Rzeszutek Wilk wrote: > The libxl_cpu_bitmap_alloc(..) function, if provided with a zero > value for max CPUs will call xc_get_max_cpus() which will retrieve > the number of physical CPUs the host has. This is usually > OK if the guest's maxvcpus <= host pcpus. But if the value > is different, then the bitmap for VCPUs is limited by the > number of CPUs the host has. > > This is incorrect as what we want is to hotplug in the guest > the amount of CPUs that the user specified on the command line > and not be limited by the amount of physical CPUs. > > This means that a guest config like this: > > vcpus=8 > maxvcpus=32 > > and on a 4 PCPU machine doing > > xl vcpu-set 16 > > won't work. This is b/c the the size of the bitmap is one byte > so it can only hold up to 8 VCPUs. Hence anything above that > is going to be ignored. > > Note that this patch also fixes the bitmap setting - as it > would set all of the bits allowed. Meaning if the user had a 4PCPU > host we would still allow the user to set 8VCPUs. This second > iteration of the patch fixes this. > > Note that all of the libxl_cpu_bitmap_[test|set] silently ignore > any test or sets above its size: > > if (bit >= bitmap->size * 8) > return 0; > > so we were never notified off this bug. > > This patch warns the user if they are trying to do this. If the > user really wants to do this they have to provide the --ignore-host > parameter to bypass this check. > > [v1: Add --ignore-host and also fix the bitmap being updated to > the full word instead of to the count of physical CPUs] > Signed-off-by: Konrad Rzeszutek Wilk This looks good to me, thanks: Acked-by: Ian Campbell