From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Slutz Subject: Re: [PATCH for-4.5] libxl_set_memory_target: only remove videoram from absolute targets Date: Wed, 03 Dec 2014 16:46:59 -0500 Message-ID: <547F84D3.3090501@terremark.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini , xen-devel@lists.xensource.com Cc: Anthony Perard , Wei Liu , dslutz@verizon.com List-Id: xen-devel@lists.xenproject.org On 12/03/14 13:20, Stefano Stabellini wrote: > If the new target is relative to the current target, do not remove > videoram again: it has already been removed from the current target. > > Signed-off-by: Stefano Stabellini > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index de23fec..2aa83bd 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -4741,13 +4741,17 @@ retry_transaction: > goto out; > } > > + videoram_s = libxl__xs_read(gc, t, libxl__sprintf(gc, > + "%s/memory/videoram", dompath)); > + videoram = videoram_s ? atoi(videoram_s) : 0; > + > if (relative) { > if (target_memkb < 0 && abs(target_memkb) > current_target_memkb) > new_target_memkb = 0; > else > new_target_memkb = current_target_memkb + target_memkb; > } else > - new_target_memkb = target_memkb; > + new_target_memkb = target_memkb - videoram; > if (new_target_memkb > memorykb) { > LIBXL__LOG(ctx, LIBXL__LOG_ERROR, > "memory_dynamic_max must be less than or equal to" > @@ -4763,9 +4767,6 @@ retry_transaction: > abort_transaction = 1; > goto out; > } > - videoram_s = libxl__xs_read(gc, t, libxl__sprintf(gc, > - "%s/memory/videoram", dompath)); > - videoram = videoram_s ? atoi(videoram_s) : 0; > > if (enforce) { > memorykb = new_target_memkb; Since new_target_memkb is now adjusted before this line, you need to change this to: memorykb = new_target_memkb + videoram; -Don Slutz > @@ -4780,7 +4781,6 @@ retry_transaction: > } > } > > - new_target_memkb -= videoram; > rc = xc_domain_set_pod_target(ctx->xch, domid, > new_target_memkb / 4, NULL, NULL, NULL); > if (rc != 0) {