From: "Jan Beulich" Subject: [PATCH] x86: fix frame table initialization when hotplug memory regions were detected Date: Wed, 03 Feb 2010 13:12:03 +0000 Message-ID: <4B698433020000780002D76C@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part0F252033.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. --=__Part0F252033.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline max_idx is not a pdx, and hence needs to be converted to one in all cases where it is being passed to pdx_to_page(). Also, just like for max_pdx, the conversion result of max_idx may point into an address space hole, and hence it must not be used directly as an argument to pdx_to_page(). Note that this doesn't apply to the arguments passed to memset(), as the size argument would be zero in the case of hitting an address space hole. Signed-off-by: Jan Beulich --- 2010-01-27.orig/xen/arch/x86/mm.c 2010-02-03 13:29:46.000000000 = +0100 +++ 2010-01-27/xen/arch/x86/mm.c 2010-02-03 13:39:05.000000000 = +0100 @@ -227,10 +227,11 @@ void __init init_frametable(void) pdx_to_page(max_pdx - 1) + 1); else { - init_frametable_chunk(pdx_to_page(sidx *PDX_GROUP_COUNT), - pdx_to_page(max_idx * PDX_GROUP_COUNT)); - memset(pdx_to_page(max_pdx), -1, (unsigned long)pdx_to_page(max_id= x) - - (unsigned long)(pdx_to_page(max_pdx))); + init_frametable_chunk(pdx_to_page(sidx * PDX_GROUP_COUNT), + pdx_to_page(max_idx * PDX_GROUP_COUNT - 1) = + 1); + memset(pdx_to_page(max_pdx), -1, + (unsigned long)pdx_to_page(max_idx * PDX_GROUP_COUNT) - + (unsigned long)pdx_to_page(max_pdx)); } } =20 --=__Part0F252033.0__= Content-Type: text/plain; name="x86-init-frametable-hotplug.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-init-frametable-hotplug.patch" max_idx is not a pdx, and hence needs to be converted to one in all=0Acases= where it is being passed to pdx_to_page().=0A=0AAlso, just like for = max_pdx, the conversion result of max_idx may=0Apoint into an address = space hole, and hence it must not be used=0Adirectly as an argument to = pdx_to_page(). Note that this doesn't apply=0Ato the arguments passed to = memset(), as the size argument would be=0Azero in the case of hitting an = address space hole.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- 2010-01-27.orig/xen/arch/x86/mm.c 2010-02-03 13:29:46.0000000= 00 +0100=0A+++ 2010-01-27/xen/arch/x86/mm.c 2010-02-03 13:39:05.0000000= 00 +0100=0A@@ -227,10 +227,11 @@ void __init init_frametable(void)=0A = pdx_to_page(max_pdx - 1) + 1);=0A else=0A = {=0A- init_frametable_chunk(pdx_to_page(sidx *PDX_GROUP_COUNT),=0A- = pdx_to_page(max_idx * PDX_GROUP_COUNT));=0A- = memset(pdx_to_page(max_pdx), -1, (unsigned long)pdx_to_page(max_idx) = -=0A- (unsigned long)(pdx_to_page(max_pdx)));=0A+ = init_frametable_chunk(pdx_to_page(sidx * PDX_GROUP_COUNT),=0A+ = pdx_to_page(max_idx * PDX_GROUP_COUNT - 1) + 1);=0A+ = memset(pdx_to_page(max_pdx), -1,=0A+ (unsigned = long)pdx_to_page(max_idx * PDX_GROUP_COUNT) -=0A+ (unsigned = long)pdx_to_page(max_pdx));=0A }=0A }=0A =0A --=__Part0F252033.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 --=__Part0F252033.0__=--