[kernel] r16971 - in dists/squeeze/linux-2.6/debian: . patches/features/all/xen patches/series

Maximilian Attems maks at alioth.debian.org
Wed Mar 2 23:58:48 UTC 2011


Author: maks
Date: Wed Mar  2 23:58:45 2011
New Revision: 16971

Log:
[xen] do not release any memory under 1M in domain 0.

Reported-by: Kari Pahula <kaol at debian.org>
Signed-off-by: maximilian attems <max at stro.at>

Added:
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-do-not-release-any-memory-under-1M-in-domain-0.patch
Modified:
   dists/squeeze/linux-2.6/debian/changelog
   dists/squeeze/linux-2.6/debian/patches/series/31-extra

Modified: dists/squeeze/linux-2.6/debian/changelog
==============================================================================
--- dists/squeeze/linux-2.6/debian/changelog	Wed Mar  2 23:43:14 2011	(r16970)
+++ dists/squeeze/linux-2.6/debian/changelog	Wed Mar  2 23:58:45 2011	(r16971)
@@ -75,6 +75,7 @@
     - xhci: Fix an error in count_sg_trbs_needed()
     - x25: Do not reference freed memory
   * netxen: fix set mac addr. (closes: #616058)
+  * [xen] do not release any memory under 1M in domain 0. (closes: #613823)
 
   [ Aurelien Jarno ]
   * init: fix race between init and kthreadd, fixes a kernel panic on 

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-do-not-release-any-memory-under-1M-in-domain-0.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-do-not-release-any-memory-under-1M-in-domain-0.patch	Wed Mar  2 23:58:45 2011	(r16971)
@@ -0,0 +1,75 @@
+From: Ian Campbell <ian.campbell at citrix.com>
+Date: Thu, 28 Oct 2010 11:32:29 -0700
+Subject: [PATCH] xen: do not release any memory under 1M in domain 0
+
+commit 9ec23a7f6d2537faf14368e066e307c06812c4ca upstream.
+
+We already deliberately setup a 1-1 P2M for the region up to 1M in
+order to allow code which assumes this region is already mapped to
+work without having to convert everything to ioremap.
+
+Domain 0 should not return any apparently unused memory regions
+(reserved or otherwise) in this region to Xen since the e820 may not
+accurately reflect what the BIOS has stashed in this region.
+
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+---
+ arch/x86/xen/setup.c |   18 +++++++++++-------
+ 1 files changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
+index b1dbdaa..769c4b0 100644
+--- a/arch/x86/xen/setup.c
++++ b/arch/x86/xen/setup.c
+@@ -118,16 +118,18 @@ static unsigned long __init xen_return_unused_memory(unsigned long max_pfn,
+ 						     const struct e820map *e820)
+ {
+ 	phys_addr_t max_addr = PFN_PHYS(max_pfn);
+-	phys_addr_t last_end = 0;
++	phys_addr_t last_end = ISA_END_ADDRESS;
+ 	unsigned long released = 0;
+ 	int i;
+ 
++	/* Free any unused memory above the low 1Mbyte. */
+ 	for (i = 0; i < e820->nr_map && last_end < max_addr; i++) {
+ 		phys_addr_t end = e820->map[i].addr;
+ 		end = min(max_addr, end);
+ 
+-		released += xen_release_chunk(last_end, end);
+-		last_end = e820->map[i].addr + e820->map[i].size;
++		if (last_end < end)
++			released += xen_release_chunk(last_end, end);
++		last_end = max(last_end, e820->map[i].addr + e820->map[i].size);
+ 	}
+ 
+ 	if (last_end < max_addr)
+@@ -164,6 +166,7 @@ char * __init xen_memory_setup(void)
+ 		XENMEM_memory_map;
+ 	rc = HYPERVISOR_memory_op(op, &memmap);
+ 	if (rc == -ENOSYS) {
++		BUG_ON(xen_initial_domain());
+ 		memmap.nr_entries = 1;
+ 		map[0].addr = 0ULL;
+ 		map[0].size = mem_end;
+@@ -201,12 +204,13 @@ char * __init xen_memory_setup(void)
+ 	}
+ 
+ 	/*
+-	 * Even though this is normal, usable memory under Xen, reserve
+-	 * ISA memory anyway because too many things think they can poke
++	 * In domU, the ISA region is normal, usable memory, but we
++	 * reserve ISA memory anyway because too many things poke
+ 	 * about in there.
+ 	 *
+-	 * In a dom0 kernel, this region is identity mapped with the
+-	 * hardware ISA area, so it really is out of bounds.
++	 * In Dom0, the host E820 information can leave gaps in the
++	 * ISA range, which would cause us to release those pages.  To
++	 * avoid this, we unconditionally reserve them here.
+ 	 */
+ 	e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
+ 			E820_RESERVED);
+-- 
+1.7.2.3
+

Modified: dists/squeeze/linux-2.6/debian/patches/series/31-extra
==============================================================================
--- dists/squeeze/linux-2.6/debian/patches/series/31-extra	Wed Mar  2 23:43:14 2011	(r16970)
+++ dists/squeeze/linux-2.6/debian/patches/series/31-extra	Wed Mar  2 23:58:45 2011	(r16971)
@@ -27,3 +27,4 @@
 + features/all/xen/radeon-PCIe-Use-the-correct-index-field.patch featureset=xen
 + features/all/xen/xen-netback-Drop-GSO-SKBs-which-do-not-have-csum_b.patch featureset=xen
 + features/all/xen/xen-blkback-CVE-2010-3699.patch featureset=xen
++ features/all/xen/xen-do-not-release-any-memory-under-1M-in-domain-0.patch featureset=xen



More information about the Kernel-svn-changes mailing list