From: "Jan Beulich" Subject: [PATCH] x86-64: enforce memory limits imposed by virtual memory layout Date: Tue, 16 Sep 2008 15:53:46 +0100 Message-ID: <48CFE49A.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org ... which currently means: - The 1:1 map cannot deal with more than 1Tb. - The m2p table can handle at most 8Tb. - The page_info array can cover up to e.g. 1.6Gb (<=3D 64 CPUs) or 1Tb (193-256 CPUs). Signed-off-by: Jan Beulich Index: 2008-09-01/xen/arch/x86/e820.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 2008-09-01.orig/xen/arch/x86/e820.c 2008-09-05 16:14:11.000000000 = +0200 +++ 2008-09-01/xen/arch/x86/e820.c 2008-09-16 16:47:24.000000000 = +0200 @@ -4,6 +4,7 @@ #include #include #include +#include #include =20 /* opt_mem: Limit of physical RAM. Any RAM beyond this point is ignored. = */ @@ -327,7 +328,7 @@ static void __init clip_to_limit(uint64_ continue; if ( warnmsg ) { - snprintf(_warnmsg, sizeof(_warnmsg), warnmsg, (int)(limit>>30)= ); + snprintf(_warnmsg, sizeof(_warnmsg), warnmsg, (long)(limit>>30= )); printk("WARNING: %s\n", _warnmsg); } printk("Truncating memory map to %lukB\n", @@ -366,8 +367,25 @@ static void __init machine_specific_memo =20 #ifdef __i386__ clip_to_limit((1ULL << 30) * MACHPHYS_MBYTES, - "Only the first %u GB of the physical memory map " + "Only the first %lu GB of the physical memory map " "can be accessed by Xen in 32-bit mode."); +#else + { + unsigned long limit, mpt_limit, pft_limit; + + limit =3D DIRECTMAP_VIRT_END - DIRECTMAP_VIRT_START; + mpt_limit =3D ((RDWR_MPT_VIRT_END - RDWR_MPT_VIRT_START) + / sizeof(unsigned long)) << PAGE_SHIFT; + pft_limit =3D ((FRAMETABLE_VIRT_END - FRAMETABLE_VIRT_START) + / sizeof(struct page_info)) << PAGE_SHIFT; + if ( limit > mpt_limit ) + limit =3D mpt_limit; + if ( limit > pft_limit ) + limit =3D pft_limit; + clip_to_limit(limit, + "Only the first %lu GB of the physical " + "memory map can be accessed by Xen."); + } #endif =20 reserve_dmi_region();