Re: [git head] X86_PAT & mprotect

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Venki Pallipadi
Date: Friday, May 9, 2008 - 1:05 pm

On Fri, May 09, 2008 at 12:08:18PM +0200, Ingo Molnar wrote:

Ingo,

Split up the patch into two parts as the pci part was unrelated to mprotect
problem in a sense.

Here is the first patch.

Thanks,
Venki


Some versions of X used the mprotect workaround to change caching type from
UC to WB, so that it can then use mtrr to program WC for that region [1].
Change the mmap of pci space through /sys or /proc interfaces from UC to
UC_MINUS. With this change, X will not need to use mprotect
workaround to get WC type.
Also the bug with mprotect which lets caller to change PAT bits is fixed in
the follow on patch. So, this X workaround will stop working as well.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

---
 arch/x86/pci/i386.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Index: linux-2.6/arch/x86/pci/i386.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/i386.c	2008-05-06 15:45:47.000000000 -0700
+++ linux-2.6/arch/x86/pci/i386.c	2008-05-09 10:05:45.000000000 -0700
@@ -301,15 +301,13 @@ int pci_mmap_page_range(struct pci_dev *
 	prot = pgprot_val(vma->vm_page_prot);
 	if (pat_wc_enabled && write_combine)
 		prot |= _PAGE_CACHE_WC;
-	else if (pat_wc_enabled)
+	else if (pat_wc_enabled || boot_cpu_data.x86 > 3)
 		/*
 		 * ioremap() and ioremap_nocache() defaults to UC MINUS for now.
 		 * To avoid attribute conflicts, request UC MINUS here
 		 * aswell.
 		 */
 		prot |= _PAGE_CACHE_UC_MINUS;
-	else if (boot_cpu_data.x86 > 3)
-		prot |= _PAGE_CACHE_UC;
 
 	vma->vm_page_prot = __pgprot(prot);
 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[git head] Should X86_PAT really default to yes?, Frans Pop, (Fri May 2, 12:22 pm)
RE: [git head] Should X86_PAT really default to yes?, Pallipadi, Venkatesh, (Fri May 2, 12:37 pm)
Re: [git head] Should X86_PAT really default to yes?, Jesse Barnes, (Fri May 2, 1:40 pm)
RE: [git head] Should X86_PAT really default to yes?, Pallipadi, Venkatesh, (Fri May 2, 2:55 pm)
Re: [git head] Should X86_PAT really default to yes?, Jesse Barnes, (Fri May 2, 3:07 pm)
Re: [git head] Should X86_PAT really default to yes?, Ingo Molnar, (Sun May 4, 2:04 am)
Re: [git head] Should X86_PAT really default to yes?, Jesse Barnes, (Mon May 5, 8:57 am)
RE: [git head] Should X86_PAT really default to yes?, Pallipadi, Venkatesh, (Mon May 5, 10:00 am)
Re: [git head] Should X86_PAT really default to yes?, Yinghai Lu, (Mon May 5, 10:42 am)
Re: [git head] Should X86_PAT really default to yes?, Jesse Barnes, (Mon May 5, 10:45 am)
RE: [git head] Should X86_PAT really default to yes?, Pallipadi, Venkatesh, (Mon May 5, 10:59 am)
Re: fb layer &amp; ioremap_wc, Jesse Barnes, (Mon May 5, 12:04 pm)
Re: [git head] Should X86_PAT really default to yes?, Venki Pallipadi, (Tue May 6, 3:42 pm)
Re: [git head] X86_PAT &amp; mprotect, Ingo Molnar, (Wed May 7, 12:02 am)
Re: [git head] X86_PAT &amp; mprotect, Hugh Dickins, (Wed May 7, 12:18 pm)
Re: [git head] X86_PAT &amp; mprotect, Venki Pallipadi, (Wed May 7, 3:36 pm)
Re: [git head] X86_PAT &amp; mprotect, Venki Pallipadi, (Wed May 7, 4:23 pm)
Re: [git head] X86_PAT &amp; mprotect, Ingo Molnar, (Fri May 9, 3:08 am)
Re: [git head] X86_PAT & mprotect, Venki Pallipadi, (Fri May 9, 1:05 pm)
Re: [git head] X86_PAT &amp; mprotect, Venki Pallipadi, (Fri May 9, 1:09 pm)
Re: [git head] X86_PAT &amp; mprotect, Hugh Dickins, (Fri May 9, 1:48 pm)
Re: [git head] X86_PAT &amp; mprotect, Dave Airlie, (Fri May 9, 3:11 pm)
RE: [git head] X86_PAT &amp; mprotect, Pallipadi, Venkatesh, (Fri May 9, 3:20 pm)
Re: [git head] X86_PAT &amp; mprotect, Keith Packard, (Fri May 9, 10:45 pm)
Re: [git head] X86_PAT &amp; mprotect, Dave Airlie, (Fri May 9, 11:19 pm)
Re: [git head] X86_PAT &amp; mprotect, Keith Packard, (Fri May 9, 11:29 pm)
Re: fb layer &amp; ioremap_wc, Frans Pop, (Fri Jun 13, 9:42 am)