mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools/libxc: Remove legacy migration implementation
It is no longer used. One complication is that xc_map_m2p() has users in xc_offline_page.c, xen-mfndump and xen-mceinj. Move its implementation into xc_offline_page (for want of a better location) beside it's current user. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> [ ijc -- drop mentions of removed files from MAINTAINERS ]
This commit is contained in:
1 parent
b9041b4eeb
commit
b15bc4345e
6 files changed
+59
-4859
No files matched your search
@@ -272,8 +272,6 @@ M: Shriram Rajagopalan <rshriram@cs.ubc.ca>
|
||||
M: Yang Hongyang <yanghy@cn.fujitsu.com>
|
||||
S: Maintained
|
||||
F: docs/README.remus
|
||||
F: tools/libxc/xc_domain_save.c
|
||||
F: tools/libxc/xc_domain_restore.c
|
||||
F: tools/blktap2/drivers/block-remus.c
|
||||
F: tools/blktap2/drivers/hashtable*
|
||||
F: tools/libxl/libxl_remus_*
|
||||
|
||||
@@ -54,7 +54,6 @@ CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios.c
|
||||
GUEST_SRCS-y :=
|
||||
GUEST_SRCS-y += xg_private.c xc_suspend.c
|
||||
ifeq ($(CONFIG_MIGRATE),y)
|
||||
GUEST_SRCS-y += xc_domain_restore.c xc_domain_save.c
|
||||
GUEST_SRCS-y += xc_sr_common.c
|
||||
GUEST_SRCS-$(CONFIG_X86) += xc_sr_common_x86.c
|
||||
GUEST_SRCS-$(CONFIG_X86) += xc_sr_common_x86_pv.c
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -396,6 +396,65 @@ static int is_page_exchangable(xc_interface *xch, int domid, xen_pfn_t mfn,
|
||||
return 1;
|
||||
}
|
||||
|
||||
xen_pfn_t *xc_map_m2p(xc_interface *xch,
|
||||
unsigned long max_mfn,
|
||||
int prot,
|
||||
unsigned long *mfn0)
|
||||
{
|
||||
privcmd_mmap_entry_t *entries;
|
||||
unsigned long m2p_chunks, m2p_size;
|
||||
xen_pfn_t *m2p;
|
||||
xen_pfn_t *extent_start;
|
||||
int i;
|
||||
|
||||
m2p = NULL;
|
||||
m2p_size = M2P_SIZE(max_mfn);
|
||||
m2p_chunks = M2P_CHUNKS(max_mfn);
|
||||
|
||||
extent_start = calloc(m2p_chunks, sizeof(xen_pfn_t));
|
||||
if ( !extent_start )
|
||||
{
|
||||
ERROR("failed to allocate space for m2p mfns");
|
||||
goto err0;
|
||||
}
|
||||
|
||||
if ( xc_machphys_mfn_list(xch, m2p_chunks, extent_start) )
|
||||
{
|
||||
PERROR("xc_get_m2p_mfns");
|
||||
goto err1;
|
||||
}
|
||||
|
||||
entries = calloc(m2p_chunks, sizeof(privcmd_mmap_entry_t));
|
||||
if (entries == NULL)
|
||||
{
|
||||
ERROR("failed to allocate space for mmap entries");
|
||||
goto err1;
|
||||
}
|
||||
|
||||
for ( i = 0; i < m2p_chunks; i++ )
|
||||
entries[i].mfn = extent_start[i];
|
||||
|
||||
m2p = xc_map_foreign_ranges(xch, DOMID_XEN,
|
||||
m2p_size, prot, M2P_CHUNK_SIZE,
|
||||
entries, m2p_chunks);
|
||||
if (m2p == NULL)
|
||||
{
|
||||
PERROR("xc_mmap_foreign_ranges failed");
|
||||
goto err2;
|
||||
}
|
||||
|
||||
if (mfn0)
|
||||
*mfn0 = entries[0].mfn;
|
||||
|
||||
err2:
|
||||
free(entries);
|
||||
err1:
|
||||
free(extent_start);
|
||||
|
||||
err0:
|
||||
return m2p;
|
||||
}
|
||||
|
||||
/* The domain should be suspended when called here */
|
||||
int xc_exchange_page(xc_interface *xch, int domid, xen_pfn_t mfn)
|
||||
{
|
||||
|
||||
@@ -21,248 +21,6 @@
|
||||
#include <xen/foreign/x86_32.h>
|
||||
#include <xen/foreign/x86_64.h>
|
||||
|
||||
/*
|
||||
* SAVE/RESTORE/MIGRATE PROTOCOL
|
||||
* =============================
|
||||
*
|
||||
* The general form of a stream of chunks is a header followed by a
|
||||
* body consisting of a variable number of chunks (terminated by a
|
||||
* chunk with type 0) followed by a trailer.
|
||||
*
|
||||
* For a rolling/checkpoint (e.g. remus) migration then the body and
|
||||
* trailer phases can be repeated until an external event
|
||||
* (e.g. failure) causes the process to terminate and commit to the
|
||||
* most recent complete checkpoint.
|
||||
*
|
||||
* HEADER
|
||||
* ------
|
||||
*
|
||||
* unsigned long : p2m_size
|
||||
*
|
||||
* extended-info (PV-only, optional):
|
||||
*
|
||||
* If first unsigned long == ~0UL then extended info is present,
|
||||
* otherwise unsigned long is part of p2m. Note that p2m_size above
|
||||
* does not include the length of the extended info.
|
||||
*
|
||||
* extended-info:
|
||||
*
|
||||
* unsigned long : signature == ~0UL
|
||||
* uint32_t : number of bytes remaining in extended-info
|
||||
*
|
||||
* 1 or more extended-info blocks of form:
|
||||
* char[4] : block identifier
|
||||
* uint32_t : block data size
|
||||
* bytes : block data
|
||||
*
|
||||
* defined extended-info blocks:
|
||||
* "vcpu" : VCPU context info containing vcpu_guest_context_t.
|
||||
* The precise variant of the context structure
|
||||
* (e.g. 32 vs 64 bit) is distinguished by
|
||||
* the block size.
|
||||
* "extv" : Presence indicates use of extended VCPU context in
|
||||
* tail, data size is 0.
|
||||
*
|
||||
* p2m (PV-only):
|
||||
*
|
||||
* consists of p2m_size bytes comprising an array of xen_pfn_t sized entries.
|
||||
*
|
||||
* BODY PHASE - Format A (for live migration or Remus without compression)
|
||||
* ----------
|
||||
*
|
||||
* A series of chunks with a common header:
|
||||
* int : chunk type
|
||||
*
|
||||
* If the chunk type is +ve then chunk contains guest memory data, and the
|
||||
* type contains the number of pages in the batch:
|
||||
*
|
||||
* unsigned long[] : PFN array, length == number of pages in batch
|
||||
* Each entry consists of XEN_DOMCTL_PFINFO_*
|
||||
* in bits 31-28 and the PFN number in bits 27-0.
|
||||
* page data : PAGE_SIZE bytes for each page marked present in PFN
|
||||
* array
|
||||
*
|
||||
* If the chunk type is -ve then chunk consists of one of a number of
|
||||
* metadata types. See definitions of XC_SAVE_ID_* below.
|
||||
*
|
||||
* If chunk type is 0 then body phase is complete.
|
||||
*
|
||||
*
|
||||
* BODY PHASE - Format B (for Remus with compression)
|
||||
* ----------
|
||||
*
|
||||
* A series of chunks with a common header:
|
||||
* int : chunk type
|
||||
*
|
||||
* If the chunk type is +ve then chunk contains array of PFNs corresponding
|
||||
* to guest memory and type contains the number of PFNs in the batch:
|
||||
*
|
||||
* unsigned long[] : PFN array, length == number of pages in batch
|
||||
* Each entry consists of XEN_DOMCTL_PFINFO_*
|
||||
* in bits 31-28 and the PFN number in bits 27-0.
|
||||
*
|
||||
* If the chunk type is -ve then chunk consists of one of a number of
|
||||
* metadata types. See definitions of XC_SAVE_ID_* below.
|
||||
*
|
||||
* If the chunk type is -ve and equals XC_SAVE_ID_COMPRESSED_DATA, then the
|
||||
* chunk consists of compressed page data, in the following format:
|
||||
*
|
||||
* unsigned long : Size of the compressed chunk to follow
|
||||
* compressed data : variable length data of size indicated above.
|
||||
* This chunk consists of compressed page data.
|
||||
* The number of pages in one chunk depends on
|
||||
* the amount of space available in the sender's
|
||||
* output buffer.
|
||||
*
|
||||
* Format of compressed data:
|
||||
* compressed_data = <deltas>*
|
||||
* delta = <marker, run*>
|
||||
* marker = (RUNFLAG|SKIPFLAG) bitwise-or RUNLEN [1 byte marker]
|
||||
* RUNFLAG = 0
|
||||
* SKIPFLAG = 1 << 7
|
||||
* RUNLEN = 7-bit unsigned value indicating number of WORDS in the run
|
||||
* run = string of bytes of length sizeof(WORD) * RUNLEN
|
||||
*
|
||||
* If marker contains RUNFLAG, then RUNLEN * sizeof(WORD) bytes of data following
|
||||
* the marker is copied into the target page at the appropriate offset indicated by
|
||||
* the offset_ptr
|
||||
* If marker contains SKIPFLAG, then the offset_ptr is advanced
|
||||
* by RUNLEN * sizeof(WORD).
|
||||
*
|
||||
* If chunk type is 0 then body phase is complete.
|
||||
*
|
||||
* There can be one or more chunks with type XC_SAVE_ID_COMPRESSED_DATA,
|
||||
* containing compressed pages. The compressed chunks are collated to form
|
||||
* one single compressed chunk for the entire iteration. The number of pages
|
||||
* present in this final compressed chunk will be equal to the total number
|
||||
* of valid PFNs specified by the +ve chunks.
|
||||
*
|
||||
* At the sender side, compressed pages are inserted into the output stream
|
||||
* in the same order as they would have been if compression logic was absent.
|
||||
*
|
||||
* Until last iteration, the BODY is sent in Format A, to maintain live
|
||||
* migration compatibility with receivers of older Xen versions.
|
||||
* At the last iteration, if Remus compression was enabled, the sender sends
|
||||
* a trigger, XC_SAVE_ID_ENABLE_COMPRESSION to tell the receiver to parse the
|
||||
* BODY in Format B from the next iteration onwards.
|
||||
*
|
||||
* An example sequence of chunks received in Format B:
|
||||
* +16 +ve chunk
|
||||
* unsigned long[16] PFN array
|
||||
* +100 +ve chunk
|
||||
* unsigned long[100] PFN array
|
||||
* +50 +ve chunk
|
||||
* unsigned long[50] PFN array
|
||||
*
|
||||
* XC_SAVE_ID_COMPRESSED_DATA TAG
|
||||
* N Length of compressed data
|
||||
* N bytes of DATA Decompresses to 166 pages
|
||||
*
|
||||
* XC_SAVE_ID_* other xc save chunks
|
||||
* 0 END BODY TAG
|
||||
*
|
||||
* Corner case with checkpoint compression:
|
||||
* At sender side, after pausing the domain, dirty pages are usually
|
||||
* copied out to a temporary buffer. After the domain is resumed,
|
||||
* compression is done and the compressed chunk(s) are sent, followed by
|
||||
* other XC_SAVE_ID_* chunks.
|
||||
* If the temporary buffer gets full while scanning for dirty pages,
|
||||
* the sender stops buffering of dirty pages, compresses the temporary
|
||||
* buffer and sends the compressed data with XC_SAVE_ID_COMPRESSED_DATA.
|
||||
* The sender then resumes the buffering of dirty pages and continues
|
||||
* scanning for the dirty pages.
|
||||
* For e.g., assume that the temporary buffer can hold 4096 pages and
|
||||
* there are 5000 dirty pages. The following is the sequence of chunks
|
||||
* that the receiver will see:
|
||||
*
|
||||
* +1024 +ve chunk
|
||||
* unsigned long[1024] PFN array
|
||||
* +1024 +ve chunk
|
||||
* unsigned long[1024] PFN array
|
||||
* +1024 +ve chunk
|
||||
* unsigned long[1024] PFN array
|
||||
* +1024 +ve chunk
|
||||
* unsigned long[1024] PFN array
|
||||
*
|
||||
* XC_SAVE_ID_COMPRESSED_DATA TAG
|
||||
* N Length of compressed data
|
||||
* N bytes of DATA Decompresses to 4096 pages
|
||||
*
|
||||
* +4 +ve chunk
|
||||
* unsigned long[4] PFN array
|
||||
*
|
||||
* XC_SAVE_ID_COMPRESSED_DATA TAG
|
||||
* M Length of compressed data
|
||||
* M bytes of DATA Decompresses to 4 pages
|
||||
*
|
||||
* XC_SAVE_ID_* other xc save chunks
|
||||
* 0 END BODY TAG
|
||||
*
|
||||
* In other words, XC_SAVE_ID_COMPRESSED_DATA can be interleaved with
|
||||
* +ve chunks arbitrarily. But at the receiver end, the following condition
|
||||
* always holds true until the end of BODY PHASE:
|
||||
* num(PFN entries +ve chunks) >= num(pages received in compressed form)
|
||||
*
|
||||
* TAIL PHASE
|
||||
* ----------
|
||||
*
|
||||
* Content differs for PV and HVM guests.
|
||||
*
|
||||
* HVM TAIL:
|
||||
*
|
||||
* "Magic" pages:
|
||||
* uint64_t : I/O req PFN
|
||||
* uint64_t : Buffered I/O req PFN
|
||||
* uint64_t : Store PFN
|
||||
* Xen HVM Context:
|
||||
* uint32_t : Length of context in bytes
|
||||
* bytes : Context data
|
||||
* Qemu context:
|
||||
* char[21] : Signature:
|
||||
* "QemuDeviceModelRecord" : Read Qemu save data until EOF
|
||||
* "DeviceModelRecord0002" : uint32_t length field followed by that many
|
||||
* bytes of Qemu save data
|
||||
* "RemusDeviceModelState" : Currently the same as "DeviceModelRecord0002".
|
||||
*
|
||||
* PV TAIL:
|
||||
*
|
||||
* Unmapped PFN list : list of all the PFNs that were not in map at the close
|
||||
* unsigned int : Number of unmapped pages
|
||||
* unsigned long[] : PFNs of unmapped pages
|
||||
*
|
||||
* VCPU context data : A series of VCPU records, one per present VCPU
|
||||
* Maximum and present map supplied in XC_SAVE_ID_VCPUINFO
|
||||
* bytes: : VCPU context structure. Size is determined by size
|
||||
* provided in extended-info header
|
||||
* bytes[128] : Extended VCPU context (present IFF "extv" block
|
||||
* present in extended-info header)
|
||||
*
|
||||
* Shared Info Page : 4096 bytes of shared info page
|
||||
*/
|
||||
|
||||
#define XC_SAVE_ID_ENABLE_VERIFY_MODE -1 /* Switch to validation phase. */
|
||||
#define XC_SAVE_ID_VCPU_INFO -2 /* Additional VCPU info */
|
||||
#define XC_SAVE_ID_HVM_IDENT_PT -3 /* (HVM-only) */
|
||||
#define XC_SAVE_ID_HVM_VM86_TSS -4 /* (HVM-only) */
|
||||
#define XC_SAVE_ID_TMEM -5
|
||||
#define XC_SAVE_ID_TMEM_EXTRA -6
|
||||
#define XC_SAVE_ID_TSC_INFO -7
|
||||
#define XC_SAVE_ID_HVM_CONSOLE_PFN -8 /* (HVM-only) */
|
||||
#define XC_SAVE_ID_LAST_CHECKPOINT -9 /* Commit to restoring after completion of current iteration. */
|
||||
#define XC_SAVE_ID_HVM_ACPI_IOPORTS_LOCATION -10
|
||||
#define XC_SAVE_ID_HVM_VIRIDIAN -11
|
||||
#define XC_SAVE_ID_COMPRESSED_DATA -12 /* Marker to indicate arrival of compressed data */
|
||||
#define XC_SAVE_ID_ENABLE_COMPRESSION -13 /* Marker to enable compression logic at receiver side */
|
||||
#define XC_SAVE_ID_HVM_GENERATION_ID_ADDR -14
|
||||
/* Markers for the pfn's hosting these mem event rings */
|
||||
#define XC_SAVE_ID_HVM_PAGING_RING_PFN -15
|
||||
#define XC_SAVE_ID_HVM_MONITOR_RING_PFN -16
|
||||
#define XC_SAVE_ID_HVM_SHARING_RING_PFN -17
|
||||
#define XC_SAVE_ID_TOOLSTACK -18 /* Optional toolstack specific info */
|
||||
/* These are a pair; it is an error for one to exist without the other */
|
||||
#define XC_SAVE_ID_HVM_IOREQ_SERVER_PFN -19
|
||||
#define XC_SAVE_ID_HVM_NR_IOREQ_SERVER_PAGES -20
|
||||
|
||||
/*
|
||||
** We process save/restore/migrate in batches of pages; the below
|
||||
** determines how many pages we (at maximum) deal with in each batch.
|
||||
@@ -272,11 +30,6 @@
|
||||
/* When pinning page tables at the end of restore, we also use batching. */
|
||||
#define MAX_PIN_BATCH 1024
|
||||
|
||||
/* Maximum #VCPUs currently supported for save/restore. */
|
||||
#define XC_SR_MAX_VCPUS 4096
|
||||
#define vcpumap_sz(max_id) (((max_id)/64+1)*sizeof(uint64_t))
|
||||
|
||||
|
||||
/*
|
||||
** Determine various platform information required for save/restore, in
|
||||
** particular:
|
||||
|
||||