[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 4/6] libs/guest: move batch_pfns into a separate structure


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Frediano Ziglio <freddy77@xxxxxxxxx>
  • Date: Thu, 9 Jul 2026 11:10:27 +0100
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xOOevMuPe35Bv8U5POk91gB2d1Rxc6jExsFDjGRND5M=; fh=hPm/vFa1sRt5uhzQFrp765rgrhqr4j+AMaChATfJNPw=; b=RrVUQNoDWs4nbF8XciOgPl0jbLVeB7G+kB/qZpu+rwBrbOK7a+Q9uOCmxCnwSpl6vx BwA3XXDnyNX16sxbOKeG8F9ZAWz3lShkiYXoInmX/TF9cMr+gwOcdLsJj5akQP25fz4l NaWtJrREbzyvYRfet+iFdLax0aPjeDnpfzN9Tnx/u0bWGIqyg/7QhNjjtP2eexss5Tu2 IEXA7zCoNJwSCWQiC7ZUITyJL7a+g6gMS649tSfsinqnWmoWJ+cyoieHWQB8pteD/pt9 ns+I62+lempJ4TMvXjlIA+GONIHTvUn9QLiLP3t1QW33yuAvP9OyaLNP+Qhtjexle+HI X+oA==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1783591840; cv=none; d=google.com; s=arc-20260327; b=NLb2+Bvqm1uUiQDaQr8na6ZEv6cR3OpCSoQx1PAPWEhK0oZF+SEd7rW/EwMP/0eA96 RbhQzTqWECdLKyU/eOJWfZJKlBQwN16HIt7D4rperLI2u52E+H2qu8AENUOYUtBGEiQv Bn30GySHrBkZeFUxEOoM6PF9fM+mYpxD1h6Bg2RV2eaK2ysRiiX2UxMZIsIFpTjeJm3f filAwpsWcsqSnZ2adi29Xqy+Dcx63UrDnKbqyhl/EON+V0A7B9ShmpXZJgzDcCbSNlR0 Bt9Ho739Ax1DPg2DcjWp9dO96q7F7cYYiGmiXFMn7hzdJUWSYJXsP5HCixrfdLofjjQl IP8A==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: Edwin Török <edwin.torok@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
  • Delivery-date: Thu, 09 Jul 2026 10:10:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, 9 Jul 2026 at 08:44, Frediano Ziglio <freddy77@xxxxxxxxx> wrote:
>
> From: Edwin Török <edwin.torok@xxxxxxxxxx>
>
> Prepare for following change.
>
> Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
> ---
> Changes since v6:
> - split from "libs/guest: allocate various migration arrays just once".
> ---
>  tools/libs/guest/xg_sr_common.h |  5 ++++-
>  tools/libs/guest/xg_sr_save.c   | 31 +++++++++++++++++--------------
>  2 files changed, 21 insertions(+), 15 deletions(-)
>
> diff --git a/tools/libs/guest/xg_sr_common.h b/tools/libs/guest/xg_sr_common.h
> index f1573aefcb..7574c9f5b6 100644
> --- a/tools/libs/guest/xg_sr_common.h
> +++ b/tools/libs/guest/xg_sr_common.h
> @@ -239,11 +239,14 @@ struct xc_sr_context
>
>              struct precopy_stats stats;
>
> -            xen_pfn_t *batch_pfns;
>              unsigned int nr_batch_pfns;
>              unsigned long *deferred_pages;
>              unsigned long nr_deferred_pages;
>              xc_hypercall_buffer_t dirty_bitmap_hbuf;
> +            struct xc_sr_context_save_buffers
> +            {
> +                xen_pfn_t batch_pfns[MAX_BATCH_SIZE];
> +            } *buffers;
>          } save;
>
>          struct /* Restore data. */
> diff --git a/tools/libs/guest/xg_sr_save.c b/tools/libs/guest/xg_sr_save.c
> index 84fdbe4140..8956f4260d 100644
> --- a/tools/libs/guest/xg_sr_save.c
> +++ b/tools/libs/guest/xg_sr_save.c
> @@ -75,7 +75,7 @@ static int write_checkpoint_record(struct xc_sr_context 
> *ctx)
>
>  /*
>   * Writes a batch of memory as a PAGE_DATA record into the stream.  The batch
> - * is constructed in ctx->save.batch_pfns.
> + * is constructed in ctx->save.buffers->batch_pfns.
>   *
>   * This function:
>   * - gets the types for each pfn in the batch.
> @@ -95,6 +95,7 @@ static int write_batch(struct xc_sr_context *ctx)
>      void *page, *orig_page;
>      uint64_t *rec_pfns = NULL;
>      struct iovec *iov = NULL; int iovcnt = 0;
> +    xen_pfn_t *batch_pfns;

What about a direct

    xen_pfn_t *const batch_pfns = ctx->save.buffers->batch_pfns;

here ?

>      struct {
>          struct xc_sr_rhdr rec;
>          struct xc_sr_rec_page_data_header page_data;
> @@ -110,6 +111,10 @@ static int write_batch(struct xc_sr_context *ctx)
>      };
>
>      assert(nr_pfns != 0);
> +    assert(nr_pfns <= MAX_BATCH_SIZE);
> +    assert(ctx->save.buffers);
> +
> +    batch_pfns = ctx->save.buffers->batch_pfns;
>
>      /* Mfns of the batch pfns. */
>      mfns = malloc(nr_pfns * sizeof(*mfns));
> @@ -141,13 +146,12 @@ static int write_batch(struct xc_sr_context *ctx)

...

Frediano



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.