From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH] x86: put_superpage() must also work for !opt_allow_superpage Date: Tue, 15 Jun 2010 13:05:12 +0100 Message-ID: <4C17889802000078000067B0@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part371A6168.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 Cc: Dave McCracken 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. --=__Part371A6168.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This is because the P2M table, when placed at a kernel specified location, gets populated with large pages, which the domain must have a way to unmap/recycle. Additionally when allowing Dom0 to use superpages, they ought to be tracked accordingly in the superpage frame table. Signed-off-by: Jan Beulich --- 2010-06-15.orig/xen/arch/x86/domain_build.c 2010-06-15 12:22:11.0000000= 00 +0200 +++ 2010-06-15/xen/arch/x86/domain_build.c 2010-06-15 11:30:19.0000000= 00 +0200 @@ -913,6 +913,8 @@ int __init construct_dom0( { *l2tab =3D l2e_from_page(page, L1_PROT|_PAGE_DIRTY|_PAGE_PSE);= + if ( opt_allow_superpage ) + get_superpage(page_to_mfn(page), d); va +=3D 1UL << L2_PAGETABLE_SHIFT; continue; } --- 2010-06-15.orig/xen/arch/x86/mm.c 2010-06-15 12:22:11.000000000 = +0200 +++ 2010-06-15/xen/arch/x86/mm.c 2010-06-15 11:31:24.000000000 = +0200 @@ -154,7 +154,9 @@ unsigned long __read_mostly pdx_group_va int opt_allow_superpage; boolean_param("allowsuperpage", opt_allow_superpage); =20 +#ifdef __i386__ static int get_superpage(unsigned long mfn, struct domain *d); +#endif static void put_superpage(unsigned long mfn); =20 #define l1_disallow_mask(d) \ @@ -2567,7 +2569,7 @@ void clear_superpage_mark(struct page_in =20 } =20 -static int get_superpage(unsigned long mfn, struct domain *d) +int get_superpage(unsigned long mfn, struct domain *d) { struct spage_info *spage; unsigned long x, nx, y; @@ -2610,7 +2612,11 @@ static void put_superpage(unsigned long=20 unsigned long x, nx, y; unsigned long do_pages =3D 0; =20 - ASSERT(opt_allow_superpage); + if ( !opt_allow_superpage ) + { + put_spage_pages(mfn_to_page(mfn)); + return; + } =20 spage =3D mfn_to_spage(mfn); y =3D spage->type_info; --- 2010-06-15.orig/xen/include/asm-x86/mm.h 2010-06-15 12:22:11.0000000= 00 +0200 +++ 2010-06-15/xen/include/asm-x86/mm.h 2010-06-15 11:28:58.000000000 = +0200 @@ -281,6 +281,7 @@ extern void share_xen_page_with_privileg #define frame_table ((struct page_info *)FRAMETABLE_VIRT_START) #ifdef __x86_64__ #define spage_table ((struct spage_info *)SPAGETABLE_VIRT_START) +int get_superpage(unsigned long mfn, struct domain *d); #endif extern unsigned long max_page; extern unsigned long total_pages; --=__Part371A6168.0__= Content-Type: text/plain; name="x86-put-superpage.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-put-superpage.patch" This is because the P2M table, when placed at a kernel specified=0Alocation= , gets populated with large pages, which the domain must have=0Aa way to = unmap/recycle.=0A=0AAdditionally when allowing Dom0 to use superpages, = they ought to be=0Atracked accordingly in the superpage frame table.=0A=0AS= igned-off-by: Jan Beulich =0A=0A--- 2010-06-15.orig/xe= n/arch/x86/domain_build.c 2010-06-15 12:22:11.000000000 +0200=0A+++ = 2010-06-15/xen/arch/x86/domain_build.c 2010-06-15 11:30:19.000000000 = +0200=0A@@ -913,6 +913,8 @@ int __init construct_dom0(=0A = {=0A *l2tab =3D l2e_from_page(page,=0A = L1_PROT|_PAGE_DIRTY|_PAGE_PSE);=0A+ = if ( opt_allow_superpage )=0A+ get_superpage(= page_to_mfn(page), d);=0A va +=3D 1UL << L2_PAGETABLE_S= HIFT;=0A continue;=0A }=0A--- = 2010-06-15.orig/xen/arch/x86/mm.c 2010-06-15 12:22:11.000000000 = +0200=0A+++ 2010-06-15/xen/arch/x86/mm.c 2010-06-15 11:31:24.0000000= 00 +0200=0A@@ -154,7 +154,9 @@ unsigned long __read_mostly pdx_group_va=0A = int opt_allow_superpage;=0A boolean_param("allowsuperpage", opt_allow_super= page);=0A =0A+#ifdef __i386__=0A static int get_superpage(unsigned long = mfn, struct domain *d);=0A+#endif=0A static void put_superpage(unsigned = long mfn);=0A =0A #define l1_disallow_mask(d) = \=0A@@ -2567,7 +2569,7 @@ void clear_superpage_mark(struct = page_in=0A =0A }=0A =0A-static int get_superpage(unsigned long mfn, struct = domain *d)=0A+int get_superpage(unsigned long mfn, struct domain *d)=0A = {=0A struct spage_info *spage;=0A unsigned long x, nx, y;=0A@@ = -2610,7 +2612,11 @@ static void put_superpage(unsigned long =0A = unsigned long x, nx, y;=0A unsigned long do_pages =3D 0;=0A =0A- = ASSERT(opt_allow_superpage);=0A+ if ( !opt_allow_superpage )=0A+ = {=0A+ put_spage_pages(mfn_to_page(mfn));=0A+ return;=0A+ = }=0A =0A spage =3D mfn_to_spage(mfn);=0A y =3D spage->type_info;=0A= --- 2010-06-15.orig/xen/include/asm-x86/mm.h 2010-06-15 12:22:11.0000000= 00 +0200=0A+++ 2010-06-15/xen/include/asm-x86/mm.h 2010-06-15 = 11:28:58.000000000 +0200=0A@@ -281,6 +281,7 @@ extern void share_xen_page_w= ith_privileg=0A #define frame_table ((struct page_info *)FRAMETABLE_VIRT_ST= ART)=0A #ifdef __x86_64__=0A #define spage_table ((struct spage_info = *)SPAGETABLE_VIRT_START)=0A+int get_superpage(unsigned long mfn, struct = domain *d);=0A #endif=0A extern unsigned long max_page;=0A extern unsigned = long total_pages;=0A --=__Part371A6168.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 --=__Part371A6168.0__=--