From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Christoph Egger" Subject: [PATCH][XEN] construct_dom0: Initialize variable before use Date: Thu, 29 Nov 2007 14:02:13 +0100 Message-ID: <200711291402.14214.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_WhrTH6YzlIrL/wl" Return-path: 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 --Boundary-00=_WhrTH6YzlIrL/wl Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi! Attached patch initializes d->arch.physaddr_bitsize properly for a 64bit Dom0/64bit hypervisor. This bug has been found when booting a NetBSD/Xen Dom0 with more than 4GB RAM. Without this fix, d->arch.physaddr_bitsize is 0 in=20 domain_clamp_alloc_bitsize(). This causes all attempts to=20 XENMEM_increase_reservation with bits > 0 to fail. More precisely, __alloc_domheap_pages() returns NULL. This impacts Xen heap allocation in general. Question: How did that work on Linux Dom0? I think, initializing physaddr_bitsize to 64 unconditionally is ok because = in construct_dom0() it is overridden with the proper value when you boot 64bit hypervisor with a 32bit Dom0. If the hypervisor is not 64bit, physaddr_bitsize isn't used at all anyway. Signed-off-by: Christoph Egger =2D-=20 AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Gesch=E4ftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplement=E4r: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Gesch=E4ftsf=FChrer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy --Boundary-00=_WhrTH6YzlIrL/wl Content-Type: text/plain; charset=us-ascii; name=xen_dom0.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=xen_dom0.diff diff -r 6fd17d0dcbcd xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c Tue Nov 27 12:49:16 2007 +0000 +++ b/xen/arch/x86/domain_build.c Wed Nov 28 17:37:53 2007 +0100 @@ -353,6 +353,11 @@ int __init construct_dom0( if ( parms.pae == PAEKERN_extended_cr3 ) set_bit(VMASST_TYPE_pae_extended_cr3, &d->vm_assist); + /* Unconditionally initialize this member here for 64bit Dom0s. + * In the below if (), this is overridden for 32bit Dom0s. + */ + d->arch.physaddr_bitsize = 64; + if ( UNSET_ADDR != parms.virt_hv_start_low && elf_32bit(&elf) ) { #if CONFIG_PAGING_LEVELS < 4 --Boundary-00=_WhrTH6YzlIrL/wl Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_WhrTH6YzlIrL/wl--