Skip to contentSkip to conversation

xen/setup: Don't relocate p2m over existing one

PATCH In review Ross Lagerwall 2 participants 3 messages Dec 12, 2016 – Dec 22, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen/setup: Don't relocate p2m over existing one

When relocating the p2m, take special care not to relocate it so that is overlaps with the current location of the p2m/initrd. This is needed since the full extent of the current location is not marked as a reserved region in the e820.

This was seen to happen to a dom0 with a large initial p2m and a small reserved region in the middle of the initial p2m.

---
 arch/x86/xen/setup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/xen/setup.c +3 -3
index f8960fc..9f21b0c 100644
@@ -713,10 +713,9 @@ static void __init xen_reserve_xen_mfnlist(void)
 		size = PFN_PHYS(xen_start_info->nr_p2m_frames);
 	}
 
-	if (!xen_is_e820_reserved(start, size)) {
-		memblock_reserve(start, size);
+	memblock_reserve(start, size);
+	if (!xen_is_e820_reserved(start, size))
 		return;
-	}
 
 #ifdef CONFIG_X86_32
 	/*
@@ -727,6 +726,7 @@ static void __init xen_reserve_xen_mfnlist(void)
 	BUG();
 #else
 	xen_relocate_p2m();
+	memblock_free(start, size);
 #endif
 }
 
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Ross Lagerwall

When relocating the p2m, take special care not to relocate it so that is overlaps with the current location of the p2m/initrd. This is needed since the full extent of the current location is not marked as a reserved region in the e820.

This was seen to happen to a dom0 with a large initial p2m and a small reserved region in the middle of the initial p2m.

Juergen

Quoted 23 lines
---
 arch/x86/xen/setup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/xen/setup.c +2 -3
index f8960fc..9f21b0c 100644
@@ -713,10 +713,9 @@ static void __init xen_reserve_xen_mfnlist(void)
 		size = PFN_PHYS(xen_start_info->nr_p2m_frames);
 	}
 
-	if (!xen_is_e820_reserved(start, size)) {
-		memblock_reserve(start, size);
+	memblock_reserve(start, size);
+	if (!xen_is_e820_reserved(start, size))
 		return;
-	}
 
 #ifdef CONFIG_X86_32
 	/*

arch/x86/xen/setup.c static void __init xen_reserve_xen_mfnlist(void) · line 732

Quoted 7 lines
arch/x86/xen/setup.c +1 -0
@@ -727,6 +726,7 @@ static void __init xen_reserve_xen_mfnlist(void)
 	BUG();
 #else
 	xen_relocate_p2m();
+	memblock_free(start, size);
 #endif
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

maintainer
#2 lore raw
In reply to Ross Lagerwall
Quoted 9 lines · Ross Lagerwall

When relocating the p2m, take special care not to relocate it so that is overlaps with the current location of the p2m/initrd. This is needed since the full extent of the current location is not marked as a reserved region in the e820.

This was seen to happen to a dom0 with a large initial p2m and a small reserved region in the middle of the initial p2m.

Committed to xen/tip.git for-linus-4.10

Juergen

Quoted 23 lines
---
 arch/x86/xen/setup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/xen/setup.c +2 -3
index f8960fc..9f21b0c 100644
@@ -713,10 +713,9 @@ static void __init xen_reserve_xen_mfnlist(void)
 		size = PFN_PHYS(xen_start_info->nr_p2m_frames);
 	}
 
-	if (!xen_is_e820_reserved(start, size)) {
-		memblock_reserve(start, size);
+	memblock_reserve(start, size);
+	if (!xen_is_e820_reserved(start, size))
 		return;
-	}
 
 #ifdef CONFIG_X86_32
 	/*

arch/x86/xen/setup.c static void __init xen_reserve_xen_mfnlist(void) · line 732

Quoted 7 lines
arch/x86/xen/setup.c +1 -0
@@ -727,6 +726,7 @@ static void __init xen_reserve_xen_mfnlist(void)
 	BUG();
 #else
 	xen_relocate_p2m();
+	memblock_free(start, size);
 #endif
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel