* [PATCH] Fixes for P2M for save/restore functionality with 1-1 mapping for 2.6.40
@ 2011-04-14 15:37 Konrad Rzeszutek Wilk
2011-04-14 15:37 ` [PATCH 1/2] xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings Konrad Rzeszutek Wilk
2011-04-14 15:37 ` [PATCH 2/2] xen:p2m: Create entries in the P2M_MFN trees's to track " Konrad Rzeszutek Wilk
0 siblings, 2 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-04-14 15:37 UTC (permalink / raw)
To: xen-devel, linux-kernel
These two patches are proposed for 2.6.40.
During the testing of the 1-1 mapping with PV guests (so PCI passthrough with
"Patches for PCI passthrough with modified E820:
http://lists.xensource.com/archives/html/xen-devel/2011-04/msg00574.html)
I discovered some bugs in the way the E820 setup code works and as well when
we create the P2M parallel data structures to contain the MFNs of the P2M pages
(so p2m_top_mfn_p and p2m_top_mfn).
The patches are located in git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git devel/p2m-e820-pci.v2
The diffstat:
arch/x86/xen/p2m.c | 30 ++++++++++++++++++++++++++++--
arch/x86/xen/setup.c | 2 +-
2 files changed, 29 insertions(+), 3 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings.
2011-04-14 15:37 [PATCH] Fixes for P2M for save/restore functionality with 1-1 mapping for 2.6.40 Konrad Rzeszutek Wilk
@ 2011-04-14 15:37 ` Konrad Rzeszutek Wilk
2011-04-14 15:37 ` [PATCH 2/2] xen:p2m: Create entries in the P2M_MFN trees's to track " Konrad Rzeszutek Wilk
1 sibling, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-04-14 15:37 UTC (permalink / raw)
To: xen-devel, linux-kernel; +Cc: Konrad Rzeszutek Wilk
When we parse the raw E820, the Xen hypervisor can set "E820_RAM"
to "E820_UNUSABLE" if the mem=X argument is used. As such we
should _not_ consider the E820_UNUSABLE as an 1-1 identity
mapping, but instead use the same case as for E820_RAM.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
arch/x86/xen/setup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index fa0269a..5840af1 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -166,7 +166,7 @@ static unsigned long __init xen_set_identity(const struct e820entry *list,
if (last > end)
continue;
- if (entry->type == E820_RAM) {
+ if ((entry->type == E820_RAM) || (entry->type == E820_UNUSABLE)) {
if (start > start_pci)
identity += set_phys_range_identity(
PFN_UP(start_pci), PFN_DOWN(start));
--
1.7.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] xen:p2m: Create entries in the P2M_MFN trees's to track 1-1 mappings
2011-04-14 15:37 [PATCH] Fixes for P2M for save/restore functionality with 1-1 mapping for 2.6.40 Konrad Rzeszutek Wilk
2011-04-14 15:37 ` [PATCH 1/2] xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings Konrad Rzeszutek Wilk
@ 2011-04-14 15:37 ` Konrad Rzeszutek Wilk
1 sibling, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-04-14 15:37 UTC (permalink / raw)
To: xen-devel, linux-kernel; +Cc: Konrad Rzeszutek Wilk
. 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.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Xen bug-fixes for 2.6.39 (already in 2.6.40)
@ 2011-05-25 21:37 Konrad, Rzeszutek, Wilk
2011-05-25 21:37 ` [PATCH 1/2] xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings Konrad, Rzeszutek, Wilk
0 siblings, 1 reply; 4+ messages in thread
From: Konrad, Rzeszutek, Wilk @ 2011-05-25 21:37 UTC (permalink / raw)
To: stable, linux-kernel
Hey stable-tree maintainer(s).
The follow four patches are in the 2.6.40 tree and should be back-ported to 2.6.39 (only).
I forgot to CC:stable on them, so manually doing it here.
The four patches in question have the following git commits:
8c5950881c3b5e6e350e4b0438a8ccc513d90df9
xen/p2m: Create entries in the P2M_MFN trees's to track 1-1 mappings
0f16d0dfcdb5aab97d9e368f008b070b5b3ec6d3
xen/setup: Fix for incorrect xen_extra_mem_start initialization under 32-bit
15bfc094517db2ddf38ca7ed47f3a1c0ad24f7c4
xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings.
7899891c7d161752f29abcc9bc0a9c6c3a3af26c
xen mmu: fix a race window causing leave_mm BUG()
And are part of this email chain. Please apply them to 2.6.39.1 tree.
Thank you.
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/2] xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings.
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 ` Konrad, Rzeszutek, Wilk
0 siblings, 0 replies; 4+ messages in thread
From: Konrad, Rzeszutek, Wilk @ 2011-05-25 21:37 UTC (permalink / raw)
To: stable, linux-kernel; +Cc: Konrad Rzeszutek Wilk
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
When we parse the raw E820, the Xen hypervisor can set "E820_RAM"
to "E820_UNUSABLE" if the mem=X argument is used. As such we
should _not_ consider the E820_UNUSABLE as an 1-1 identity
mapping, but instead use the same case as for E820_RAM.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
arch/x86/xen/setup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 90bac0a..fba4a6c 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -166,7 +166,7 @@ static unsigned long __init xen_set_identity(const struct e820entry *list,
if (last > end)
continue;
- if (entry->type == E820_RAM) {
+ if ((entry->type == E820_RAM) || (entry->type == E820_UNUSABLE)) {
if (start > start_pci)
identity += set_phys_range_identity(
PFN_UP(start_pci), PFN_DOWN(start));
--
1.7.4.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-25 21:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-14 15:37 [PATCH] Fixes for P2M for save/restore functionality with 1-1 mapping for 2.6.40 Konrad Rzeszutek Wilk
2011-04-14 15:37 ` [PATCH 1/2] xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings Konrad Rzeszutek Wilk
2011-04-14 15:37 ` [PATCH 2/2] xen:p2m: Create entries in the P2M_MFN trees's to track " Konrad Rzeszutek Wilk
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 1/2] xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings Konrad, Rzeszutek, Wilk
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®