From: Konrad@dumpdata.com, Rzeszutek@dumpdata.com, Wilk@dumpdata.com
To: stable@kernel.org, linux-kernel@vger.kernel.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH] xen/p2m: Create entries in the P2M_MFN trees's to track 1-1 mappings
Date: Wed, 25 May 2011 17:37:34 -0400 [thread overview]
Message-ID: <1306359456-3627-3-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1306359456-3627-1-git-send-email-konrad.wilk@oracle.com>
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
.. when applicable. We need to track in the p2m_mfn and
p2m_mfn_p the MFNs and pointers, respectivly, for the P2M entries
that are allocated for the identity mappings. Without this,
a PV domain with an E820 that triggers the 1-1 mapping to kick in,
won't be able to be restored as the P2M won't have the identity
mappings.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
arch/x86/xen/p2m.c | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 141eb0d..a01e653 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -522,11 +522,20 @@ static bool __init __early_alloc_p2m(unsigned long pfn)
/* Boundary cross-over for the edges: */
if (idx) {
unsigned long *p2m = extend_brk(PAGE_SIZE, PAGE_SIZE);
+ unsigned long *mid_mfn_p;
p2m_init(p2m);
p2m_top[topidx][mididx] = p2m;
+ /* For save/restore we need to MFN of the P2M saved */
+
+ mid_mfn_p = p2m_top_mfn_p[topidx];
+ WARN(mid_mfn_p[mididx] != virt_to_mfn(p2m_missing),
+ "P2M_TOP_P[%d][%d] != MFN of p2m_missing!\n",
+ topidx, mididx);
+ mid_mfn_p[mididx] = virt_to_mfn(p2m);
+
}
return idx != 0;
}
@@ -549,12 +558,29 @@ unsigned long __init set_phys_range_identity(unsigned long pfn_s,
pfn += P2M_MID_PER_PAGE * P2M_PER_PAGE)
{
unsigned topidx = p2m_top_index(pfn);
- if (p2m_top[topidx] == p2m_mid_missing) {
- unsigned long **mid = extend_brk(PAGE_SIZE, PAGE_SIZE);
+ unsigned long *mid_mfn_p;
+ unsigned long **mid;
+
+ mid = p2m_top[topidx];
+ mid_mfn_p = p2m_top_mfn_p[topidx];
+ if (mid == p2m_mid_missing) {
+ mid = extend_brk(PAGE_SIZE, PAGE_SIZE);
p2m_mid_init(mid);
p2m_top[topidx] = mid;
+
+ BUG_ON(mid_mfn_p != p2m_mid_missing_mfn);
+ }
+ /* And the save/restore P2M tables.. */
+ if (mid_mfn_p == p2m_mid_missing_mfn) {
+ mid_mfn_p = extend_brk(PAGE_SIZE, PAGE_SIZE);
+ p2m_mid_mfn_init(mid_mfn_p);
+
+ p2m_top_mfn_p[topidx] = mid_mfn_p;
+ p2m_top_mfn[topidx] = virt_to_mfn(mid_mfn_p);
+ /* Note: we don't set mid_mfn_p[midix] here,
+ * look in __early_alloc_p2m */
}
}
--
1.7.4.1
next prev parent reply other threads:[~2011-05-25 21:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-25 21:37 [PATCH] Xen bug-fixes for 2.6.39 (already in 2.6.40) Konrad, Rzeszutek, Wilk
2011-05-25 21:37 ` [PATCH] xen mmu: fix a race window causing leave_mm BUG() Konrad, Rzeszutek, Wilk
2011-05-25 21:37 ` Konrad, Rzeszutek, Wilk [this message]
2011-05-25 21:37 ` [PATCH 1/2] xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings Konrad, Rzeszutek, Wilk
2011-05-25 21:37 ` [PATCH 2/2] xen/setup: Fix for incorrect xen_extra_mem_start initialization under 32-bit Konrad, Rzeszutek, Wilk
2011-05-26 7:02 ` [stable] [PATCH] Xen bug-fixes for 2.6.39 (already in 2.6.40) Greg KH
2011-05-26 12:39 ` Konrad Rzeszutek Wilk
2011-05-26 12:44 ` Tian, Kevin
2011-05-26 13:14 ` Daniel Kiper
2011-05-30 9:40 ` Greg KH
2011-05-31 14:26 ` Konrad Rzeszutek Wilk
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=1306359456-3627-3-git-send-email-konrad.wilk@oracle.com \
--to=konrad@dumpdata.com \
--cc=Rzeszutek@dumpdata.com \
--cc=Wilk@dumpdata.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®