From: Alex Williamson <alex.williamson@hp.com>
To: xen-devel@lists.xensource.com, Keir Fraser <keir@xensource.com>
Cc: xen-ia64-devel <xen-ia64-devel@lists.xensource.com>
Subject: [PATCH] Re: [Xen-staging] [xen-unstable] Some save/restore cleanups.
Date: Mon, 02 Apr 2007 16:49:24 -0600 [thread overview]
Message-ID: <1175554164.13963.167.camel@bling> (raw)
In-Reply-To: <200704021548.l32FmKha012300@latara.uk.xensource.com>
On Mon, 2007-04-02 at 16:48 +0100, Xen staging patchbot-unstable wrote:
> # HG changeset patch
> # User Steven Hand <steven@xensource.com>
> # Date 1175528812 -3600
> # Node ID d05a3220ea050b13ac02ef109c6d01cf378199cc
> # Parent 9695cc13c48ce29fd25f188eecf331029c381fc4
> Some save/restore cleanups.
Here's the equivalent for ia64. Keir, could you please apply this to
xen-unstable.hg to fix the ia64 build? Thanks,
Alex
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---
diff -r 870133a06f43 tools/libxc/ia64/xc_ia64_linux_restore.c
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c Mon Apr 02 17:34:00 2007 +0100
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c Mon Apr 02 16:40:07 2007 -0600
@@ -14,8 +14,14 @@
#define PFN_TO_KB(_pfn) ((_pfn) << (PAGE_SHIFT - 10))
-/* total number of pages used by the current guest */
-static unsigned long max_pfn;
+/* number of pfns this guest has (i.e. number of entries in the P2M) */
+static unsigned long p2m_size;
+
+/* number of 'in use' pfns in the guest (i.e. #P2M entries with a valid mfn) */
+static unsigned long nr_pfns;
+
+/* largest possible value of nr_pfns (i.e. domain's maximum memory size) */
+static unsigned long max_nr_pfns;
static ssize_t
read_exact(int fd, void *buf, size_t count)
@@ -57,9 +63,9 @@ read_page(int xc_handle, int io_fd, uint
int
xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
- unsigned long nr_pfns, unsigned int store_evtchn,
- unsigned long *store_mfn, unsigned int console_evtchn,
- unsigned long *console_mfn)
+ unsigned long p2msize, unsigned long maxnrpfns,
+ unsigned int store_evtchn, unsigned long *store_mfn,
+ unsigned int console_evtchn, unsigned long *console_mfn)
{
DECLARE_DOMCTL;
int rc = 1, i;
@@ -79,10 +85,13 @@ xc_linux_restore(int xc_handle, int io_f
/* A temporary mapping of the guest's start_info page. */
start_info_t *start_info;
- max_pfn = nr_pfns;
-
- DPRINTF("xc_linux_restore start: max_pfn = %ld\n", max_pfn);
-
+ p2m_size = p2msize;
+ max_nr_pfns = maxnrpfns;
+
+ /* For info only */
+ nr_pfns = 0;
+
+ DPRINTF("xc_linux_restore start: p2m_size = %lx\n", p2m_size);
if (!read_exact(io_fd, &ver, sizeof(unsigned long))) {
ERROR("Error when reading version");
@@ -99,29 +108,29 @@ xc_linux_restore(int xc_handle, int io_f
return 1;
}
- if (xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_pfn)) != 0) {
+ if (xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_nr_pfns)) != 0) {
errno = ENOMEM;
goto out;
}
/* Get pages. */
- page_array = malloc(max_pfn * sizeof(unsigned long));
+ page_array = malloc(p2m_size * sizeof(unsigned long));
if (page_array == NULL) {
ERROR("Could not allocate memory");
goto out;
}
- for ( i = 0; i < max_pfn; i++ )
+ for ( i = 0; i < p2m_size; i++ )
page_array[i] = i;
- if ( xc_domain_memory_populate_physmap(xc_handle, dom, max_pfn,
+ if ( xc_domain_memory_populate_physmap(xc_handle, dom, p2m_size,
0, 0, page_array) )
{
ERROR("Failed to allocate memory for %ld KB to dom %d.\n",
- PFN_TO_KB(max_pfn), dom);
- goto out;
- }
- DPRINTF("Allocated memory by %ld KB\n", PFN_TO_KB(max_pfn));
+ PFN_TO_KB(p2m_size), dom);
+ goto out;
+ }
+ DPRINTF("Allocated memory by %ld KB\n", PFN_TO_KB(p2m_size));
if (!read_exact(io_fd, &domctl.u.arch_setup, sizeof(domctl.u.arch_setup))) {
ERROR("read: domain setup");
@@ -131,9 +140,9 @@ xc_linux_restore(int xc_handle, int io_f
/* Build firmware (will be overwritten). */
domctl.domain = (domid_t)dom;
domctl.u.arch_setup.flags &= ~XEN_DOMAINSETUP_query;
- domctl.u.arch_setup.bp = ((nr_pfns - 3) << PAGE_SHIFT)
+ domctl.u.arch_setup.bp = ((p2m_size - 3) << PAGE_SHIFT)
+ sizeof (start_info_t);
- domctl.u.arch_setup.maxmem = (nr_pfns - 3) << PAGE_SHIFT;
+ domctl.u.arch_setup.maxmem = (p2m_size - 3) << PAGE_SHIFT;
domctl.cmd = XEN_DOMCTL_arch_setup;
if (xc_domctl(xc_handle, &domctl))
@@ -157,8 +166,6 @@ xc_linux_restore(int xc_handle, int io_f
}
if (gmfn == INVALID_MFN)
break;
-
- //DPRINTF("xc_linux_restore: page %lu/%lu at %lx\n", gmfn, max_pfn, pfn);
if (read_page(xc_handle, io_fd, dom, gmfn) < 0)
goto out;
@@ -281,7 +288,7 @@ xc_linux_restore(int xc_handle, int io_f
/* Uncanonicalise the suspend-record frame number and poke resume rec. */
start_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
PROT_READ | PROT_WRITE, gmfn);
- start_info->nr_pages = max_pfn;
+ start_info->nr_pages = p2m_size;
start_info->shared_info = shared_info_frame << PAGE_SHIFT;
start_info->flags = 0;
*store_mfn = start_info->store_mfn;
parent reply other threads:[~2007-04-02 22:49 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <200704021548.l32FmKha012300@latara.uk.xensource.com>]
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=1175554164.13963.167.camel@bling \
--to=alex.williamson@hp.com \
--cc=keir@xensource.com \
--cc=xen-devel@lists.xensource.com \
--cc=xen-ia64-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.