From: "Jan Beulich" Subject: [PATCH] x86_64: widen bit width usable for struct domain allocation Date: Fri, 12 Feb 2010 08:05:25 +0000 Message-ID: <4B7519D5020000780002F2F7@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part88A2BBD5.0__=" 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 This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part88A2BBD5.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline With it being a PDX (instead of a PFN) that gets stored when a 32-bit quantity is needed, we should also account for the bits removed during PFN-to-PDX conversion when doing the allocation. Signed-off-by: Jan Beulich --- 2010-02-09.orig/xen/arch/x86/domain.c 2010-02-09 00:00:00.0000000= 00 +0100 +++ 2010-02-09/xen/arch/x86/domain.c 2010-02-12 08:44:01.000000000 = +0100 @@ -183,11 +183,15 @@ struct domain *alloc_domain_struct(void) { struct domain *d; /* - * We pack the MFN of the domain structure into a 32-bit field within + * We pack the PDX of the domain structure into a 32-bit field within * the page_info structure. Hence the MEMF_bits() restriction. */ - d =3D alloc_xenheap_pages( - get_order_from_bytes(sizeof(*d)), MEMF_bits(32 + PAGE_SHIFT)); + unsigned int bits =3D 32 + PAGE_SHIFT; + +#ifdef __x86_64__ + bits +=3D pfn_pdx_hole_shift; +#endif + d =3D alloc_xenheap_pages(get_order_from_bytes(sizeof(*d)), MEMF_bits(= bits)); if ( d !=3D NULL ) memset(d, 0, sizeof(*d)); return d; --=__Part88A2BBD5.0__= Content-Type: text/plain; name="x86-widen-domain-struct-bits.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-widen-domain-struct-bits.patch" With it being a PDX (instead of a PFN) that gets stored when a 32-bit=0Aqua= ntity is needed, we should also account for the bits removed during=0APFN-t= o-PDX conversion when doing the allocation.=0A=0ASigned-off-by: Jan = Beulich =0A=0A--- 2010-02-09.orig/xen/arch/x86/domain.= c 2010-02-09 00:00:00.000000000 +0100=0A+++ 2010-02-09/xen/arch/x86/d= omain.c 2010-02-12 08:44:01.000000000 +0100=0A@@ -183,11 +183,15 @@ struct = domain *alloc_domain_struct(void)=0A {=0A struct domain *d;=0A = /*=0A- * We pack the MFN of the domain structure into a 32-bit field = within=0A+ * We pack the PDX of the domain structure into a 32-bit = field within=0A * the page_info structure. Hence the MEMF_bits() = restriction.=0A */=0A- d =3D alloc_xenheap_pages(=0A- = get_order_from_bytes(sizeof(*d)), MEMF_bits(32 + PAGE_SHIFT));=0A+ = unsigned int bits =3D 32 + PAGE_SHIFT;=0A+=0A+#ifdef __x86_64__=0A+ = bits +=3D pfn_pdx_hole_shift;=0A+#endif=0A+ d =3D alloc_xenheap_pages(ge= t_order_from_bytes(sizeof(*d)), MEMF_bits(bits));=0A if ( d !=3D NULL = )=0A memset(d, 0, sizeof(*d));=0A return d;=0A --=__Part88A2BBD5.0__= 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 --=__Part88A2BBD5.0__=--