All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	xen-devel@lists.xensource.com,
	"Wei Liu (Intern)" <wei.liu2@citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	dslutz@verizon.com
Subject: Re: [PATCH v2 for-4.6] libxl_set_memory_target: retain the same maxmem offset on top of the current target
Date: Tue, 02 Dec 2014 08:17:57 -0500	[thread overview]
Message-ID: <547DBC05.9070904@terremark.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1412021152080.14135@kaball.uk.xensource.com>

On 12/02/14 06:53, Stefano Stabellini wrote:
> In libxl_set_memory_target when setting the new maxmem, retain the same
> offset on top of the current target. The offset includes memory
> allocated by QEMU for rom files.
>
> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com>
>
> ---
>
> Changes in v2:
> - call libxl_domain_info instead of libxl_dominfo_init;
> - call libxl_domain_info before retry_transaction.
>
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index de23fec..569a32a 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -4694,6 +4694,9 @@ int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid,
>       char *uuid;
>       xs_transaction_t t;
>   
> +    if (libxl_domain_info(ctx, &ptr, domid) < 0)
> +        goto out_no_transaction;
> +
>   retry_transaction:
>       t = xs_transaction_start(ctx->xsh);
>   
> @@ -4767,10 +4770,9 @@ retry_transaction:
>                   "%s/memory/videoram", dompath));
>       videoram = videoram_s ? atoi(videoram_s) : 0;
>   
> -    if (enforce) {
> -        memorykb = new_target_memkb;
> -        rc = xc_domain_setmaxmem(ctx->xch, domid, memorykb +
> -                LIBXL_MAXMEM_CONSTANT);
> +    if (enforce && new_target_memkb > 0) {
> +        memorykb = ptr.max_memkb - current_target_memkb + new_target_memkb;
> +        rc = xc_domain_setmaxmem(ctx->xch, domid, memorykb);
>           if (rc != 0) {
>               LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
>                       "xc_domain_setmaxmem domid=%d memkb=%d failed "

You need to remove LIBXL_MAXMEM_CONSTANT here also.

    -Don Slutz


> @@ -4800,8 +4802,6 @@ retry_transaction:
>           goto out;
>       }
>   
> -    libxl_dominfo_init(&ptr);
> -    xcinfo2xlinfo(ctx, &info, &ptr);
>       uuid = libxl__uuid2string(gc, ptr.uuid);
>       libxl__xs_write(gc, t, libxl__sprintf(gc, "/vm/%s/memory", uuid),
>               "%"PRIu32, new_target_memkb / 1024);

  reply	other threads:[~2014-12-02 13:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 11:53 [PATCH v2 for-4.6] libxl_set_memory_target: retain the same maxmem offset on top of the current target Stefano Stabellini
2014-12-02 13:17 ` Don Slutz [this message]
2014-12-02 14:26   ` Stefano Stabellini
2014-12-02 14:59     ` Don Slutz
2014-12-02 15:04       ` Stefano Stabellini
2014-12-02 15:27       ` Don Slutz
2014-12-03 17:31         ` Stefano Stabellini
2014-12-03 18:07           ` Don Slutz
2014-12-03 18:18             ` Stefano Stabellini

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=547DBC05.9070904@terremark.com \
    --to=dslutz@verizon.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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.