xen/libxc-sr-restore-types.patch
Charles Arnold 508747f303 - Update to Xen 4.20.0 pre-release (jsc#PED-8907)
xen-4.20.0-testing-src.tar.bz2
- New Features
  * On Arm:
    - Experimental support for Armv8-R.
    - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
    - Basic handling for SCMI requests over SMC using Shared Memory, by allowing
      forwarding the calls to EL3 FW if coming from hwdom.
    - Support for LLC (Last Level Cache) coloring.
  * On x86:
    - xl suspend/resume subcommands.
- Changed Features
  * Fixed blkif protocol specification for sector sizes different than 512b.
  * The dombuilder in libxenguest no longer un-gzips secondary modules, instead
    leaving this to the guest kernel to do in guest context.
  * On x86:
    - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
    - Switched the xAPIC flat driver to use physical destination mode for external
      interrupts instead of logical destination mode.
- Removed Features
  * On x86:
    - Support for running on Xeon Phi processors.
    - Removed the `ucode=allow-same` command line option.
    - Removed x2APIC Cluster Mode for external interrupts.  x2APIC Physical and
      Mixed Modes are still available.
- Dropped patches
  xsa466.patch

- Move /etc/bash_completion.d/xl back to %_datadir/bash-completion/completions

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=863
2025-01-02 17:22:02 +00:00

94 lines
2.8 KiB
Diff

From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 23 Oct 2020 14:39:31 +0200
Subject: libxc sr restore types
tools: restore: preallocate types array
Remove repeated allocation from migration loop. There will never be
more than MAX_BATCH_SIZE pages to process in an incoming batch.
Allocate the space once.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/libs/guest/xg_sr_common.h | 1 +
tools/libs/guest/xg_sr_restore.c | 22 +++++++---------------
2 files changed, 8 insertions(+), 15 deletions(-)
--- a/tools/libs/guest/xg_sr_common.h
+++ b/tools/libs/guest/xg_sr_common.h
@@ -257,6 +257,7 @@ struct xc_sr_context
struct xc_sr_restore_ops ops;
struct restore_callbacks *callbacks;
xen_pfn_t *pfns;
+ uint32_t *types;
int send_back_fd;
unsigned long p2m_size;
--- a/tools/libs/guest/xg_sr_restore.c
+++ b/tools/libs/guest/xg_sr_restore.c
@@ -315,7 +315,7 @@ static int handle_page_data(struct xc_sr
int rc = -1;
xen_pfn_t pfn;
- uint32_t *types = NULL, type;
+ uint32_t type;
/*
* v2 compatibility only exists for x86 streams. This is a bit of a
@@ -362,14 +362,6 @@ static int handle_page_data(struct xc_sr
goto err;
}
- types = malloc(pages->count * sizeof(*types));
- if ( !types )
- {
- ERROR("Unable to allocate enough memory for %u pfns",
- pages->count);
- goto err;
- }
-
for ( i = 0; i < pages->count; ++i )
{
pfn = pages->pfn[i] & PAGE_DATA_PFN_MASK;
@@ -393,7 +385,7 @@ static int handle_page_data(struct xc_sr
pages_of_data++;
ctx->restore.pfns[i] = pfn;
- types[i] = type;
+ ctx->restore.types[i] = type;
}
if ( rec->length != (sizeof(*pages) +
@@ -406,11 +398,9 @@ static int handle_page_data(struct xc_sr
goto err;
}
- rc = process_page_data(ctx, pages->count, ctx->restore.pfns, types,
- &pages->pfn[pages->count]);
+ rc = process_page_data(ctx, pages->count, ctx->restore.pfns,
+ ctx->restore.types, &pages->pfn[pages->count]);
err:
- free(types);
-
return rc;
}
@@ -714,7 +704,8 @@ static int setup(struct xc_sr_context *c
}
ctx->restore.pfns = malloc(MAX_BATCH_SIZE * sizeof(*ctx->restore.pfns));
- if ( !ctx->restore.pfns )
+ ctx->restore.types = malloc(MAX_BATCH_SIZE * sizeof(*ctx->restore.types));
+ if ( !ctx->restore.pfns || !ctx->restore.types )
{
ERROR("Unable to allocate memory");
rc = -1;
@@ -751,6 +742,7 @@ static void cleanup(struct xc_sr_context
free(ctx->restore.buffered_records);
free(ctx->restore.populated_pfns);
+ free(ctx->restore.types);
free(ctx->restore.pfns);
if ( ctx->restore.ops.cleanup(ctx) )