From: "Jan Beulich" Subject: [PATCH] linux: more users of __pte_val/__p[mug]d_val Date: Thu, 25 Oct 2007 10:35:37 +0100 Message-ID: <47207F89.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline 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 Use __pXX_val() instead of pXX_val() when only flags are accessed or the frame number is only compared against zero As usual, written and tested against 2.6.23 and made apply against 2.6.18 without further testing. Signed-off-by: Jan Beulich Index: head-2007-10-23/arch/i386/mm/fault-xen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-10-23.orig/arch/i386/mm/fault-xen.c 2007-10-24 = 14:22:50.000000000 +0200 +++ head-2007-10-23/arch/i386/mm/fault-xen.c 2007-10-23 11:10:03.0000000= 00 +0200 @@ -311,7 +311,7 @@ static int spurious_fault(struct pt_regs if ((error_code & 0x02) && !pte_write(*pte)) return 0; #ifdef CONFIG_X86_PAE - if ((error_code & 0x10) && (pte_val(*pte) & _PAGE_NX)) + if ((error_code & 0x10) && (__pte_val(*pte) & _PAGE_NX)) return 0; #endif =20 Index: head-2007-10-23/arch/x86_64/mm/fault-xen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-10-23.orig/arch/x86_64/mm/fault-xen.c 2007-10-24 = 14:22:50.000000000 +0200 +++ head-2007-10-23/arch/x86_64/mm/fault-xen.c 2007-10-23 11:10:03.0000000= 00 +0200 @@ -345,7 +345,7 @@ static int spurious_fault(struct pt_regs return 0; if ((error_code & PF_WRITE) && !pte_write(*pte)) return 0; - if ((error_code & PF_INSTR) && (pte_val(*pte) & _PAGE_NX)) + if ((error_code & PF_INSTR) && (__pte_val(*pte) & _PAGE_NX)) return 0; =20 return 1; Index: head-2007-10-23/arch/x86_64/mm/init-xen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-10-23.orig/arch/x86_64/mm/init-xen.c 2007-10-24 = 14:22:50.000000000 +0200 +++ head-2007-10-23/arch/x86_64/mm/init-xen.c 2007-10-24 14:22:57.0000000= 00 +0200 @@ -287,7 +287,7 @@ static __init void set_pte_phys(unsigned =20 pte =3D pte_offset_kernel(pmd, vaddr); if (!pte_none(*pte) && - pte_val(*pte) !=3D (pte_val(new_pte) & __supported_pte_mask)) + __pte_val(*pte) !=3D (__pte_val(new_pte) & __supported_pte_mask= )) pte_ERROR(*pte); set_pte(pte, new_pte); =20 @@ -850,7 +850,7 @@ void __init clear_kernel_mapping(unsigne pmd =3D pmd_offset(pud, address); if (!pmd || pmd_none(*pmd)) continue;=20 - if (0 =3D=3D (pmd_val(*pmd) & _PAGE_PSE)) {=20 + if (0 =3D=3D (__pmd_val(*pmd) & _PAGE_PSE)) { /* Could handle this, but it should not happen = currently. */ printk(KERN_ERR=20 "clear_kernel_mapping: mapping has been split. will leak = memory\n");=20 Index: head-2007-10-23/arch/x86_64/mm/pageattr-xen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-10-23.orig/arch/x86_64/mm/pageattr-xen.c 2007-10-24 = 14:22:50.000000000 +0200 +++ head-2007-10-23/arch/x86_64/mm/pageattr-xen.c 2007-10-23 = 11:10:03.000000000 +0200 @@ -378,7 +378,7 @@ static void revert_page(unsigned long ad pud =3D pud_offset(pgd,address); BUG_ON(pud_none(*pud)); pmd =3D pmd_offset(pud, address); - BUG_ON(pmd_val(*pmd) & _PAGE_PSE); + BUG_ON(__pmd_val(*pmd) & _PAGE_PSE); pgprot_val(ref_prot) |=3D _PAGE_PSE; large_pte =3D mk_pte_phys(__pa(address) & LARGE_PAGE_MASK, = ref_prot); set_pte((pte_t *)pmd, large_pte); Index: head-2007-10-23/include/asm-x86_64/mach-xen/asm/pgtable.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-10-23.orig/include/asm-x86_64/mach-xen/asm/pgtable.h = 2007-10-24 14:22:50.000000000 +0200 +++ head-2007-10-23/include/asm-x86_64/mach-xen/asm/pgtable.h 2007-10-24 = 14:22:04.000000000 +0200 @@ -499,7 +499,7 @@ static inline pte_t pte_modify(pte_t pte #define __swp_type(x) (((x).val >> 1) & 0x3f) #define __swp_offset(x) ((x).val >> 8) #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | = ((offset) << 8) }) -#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pt= e) }) +#define __pte_to_swp_entry(pte) ((swp_entry_t) { __pte_val(= pte) }) #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) =20 extern spinlock_t pgd_lock;