x86 fixes
Subsystems (4)
Linus,
Please pull the latest x86 fixes git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-fixes-for-linus
Thanks,
Ingo
------------------>
Jan Kratochvil (1):
x86: fix crash due to missing debugctlmsr on AMD K6-3
Jeremy Fitzhardinge (2):
x86: rename PTE_MASK to PTE_PFN_MASK
x86: add PTE_FLAGS_MASK
Rusty Russell (1):
x86: fix pte_flags() to only return flags, fix lguest (updated)
Thomas Gleixner (1):
x86: move the last Dprintk instance to pr_debug()
Yinghai Lu (1):
x86: use setup_clear_cpu_cap with disable_apic, fix
arch/x86/Kconfig.cpu | 2 +- arch/x86/kernel/paravirt.c | 2 +- arch/x86/kernel/setup.c | 2 +- arch/x86/mach-es7000/es7000plat.c | 8 ++++---- arch/x86/mm/dump_pagetables.c | 10 +++++----- arch/x86/xen/enlighten.c | 2 +- arch/x86/xen/mmu.c | 8 ++++---- include/asm-x86/page.h | 14 +++++++++++--- include/asm-x86/paravirt.h | 3 +++ include/asm-x86/pgtable-3level.h | 8 ++++---- include/asm-x86/pgtable.h | 4 ++-- include/asm-x86/pgtable_32.h | 4 ++-- include/asm-x86/pgtable_64.h | 10 +++++----- include/asm-x86/xen/page.h | 2 +- 14 files changed, 45 insertions(+), 34 deletions(-)
arch/x86/Kconfig.cpu +1 -1
@@ -414,4 +414,4 @@ config X86_MINIMUM_CPU_FAMILY config X86_DEBUGCTLMSR def_bool y - depends on !(M586MMX || M586TSC || M586 || M486 || M386) + depends on !(MK6 || MWINCHIPC6 || MWINCHIP2 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386)
arch/x86/kernel/paravirt.c +1 -1
@@ -443,7 +443,7 @@ struct pv_mmu_ops pv_mmu_ops = {#endif /* PAGETABLE_LEVELS >= 3 */ .pte_val = native_pte_val, - .pte_flags = native_pte_val, + .pte_flags = native_pte_flags, .pgd_val = native_pgd_val, .make_pte = native_make_pte,
arch/x86/kernel/setup.c +1 -1
@@ -680,7 +680,7 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_X86_LOCAL_APIC disable_apic =1 ;#endif -clear_cpu_cap (&boot_cpu_data,X86_FEATURE_APIC ); +setup_clear_cpu_cap (X86_FEATURE_APIC ); }#ifdef CONFIG_PCI
arch/x86/mach-es7000/es7000plat.c +4 -4
@@ -130,10 +130,10 @@ parse_unisys_oem (char *oemptr) mip_addr = val; mip = (struct mip_reg *)val; mip_reg =__va (mip); -Dprintk ("es7000_mipcfg: host_reg = 0x%lx \n" , - (unsigned long )host_reg); -Dprintk ("es7000_mipcfg: mip_reg = 0x%lx \n" , - (unsigned long )mip_reg); +pr_debug ("es7000_mipcfg: host_reg = 0x%lx \n" , + (unsigned long )host_reg); +pr_debug ("es7000_mipcfg: mip_reg = 0x%lx \n" , + (unsigned long )mip_reg); success++;break ;case MIP_PSAI_REG :
arch/x86/mm/dump_pagetables.c +5 -5
@@ -148,8 +148,8 @@ static void note_page(struct seq_file *m, struct pg_state *st,* we have now. "break" is either changing perms, levels or * address space marker. */ - prot =pgprot_val (new_prot) & ~(PTE_MASK ); - cur =pgprot_val (st->current_prot) & ~(PTE_MASK ); + prot =pgprot_val (new_prot) & ~(PTE_PFN_MASK ); + cur =pgprot_val (st->current_prot) & ~(PTE_PFN_MASK );if (!st->level) {/* First entry */
@@ -221,7 +221,7 @@ static void walk_pmd_level(struct seq_file *m, struct pg_state *st, pud_t addr,for (i =0 ; i <PTRS_PER_PMD ; i++) { st->current_address =normalize_addr (P + i *PMD_LEVEL_MULT );if (!pmd_none (*start)) { -pgprotval_t prot =pmd_val (*start) & ~PTE_MASK ; +pgprotval_t prot =pmd_val (*start) &PTE_FLAGS_MASK ;if (pmd_large (*start) || !pmd_present (*start))note_page (m, st,__pgprot (prot),3 );
@@ -253,7 +253,7 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st, pgd_t addr,for (i =0 ; i <PTRS_PER_PUD ; i++) { st->current_address =normalize_addr (P + i *PUD_LEVEL_MULT );if (!pud_none (*start)) { -pgprotval_t prot =pud_val (*start) & ~PTE_MASK ; +pgprotval_t prot =pud_val (*start) &PTE_FLAGS_MASK ;if (pud_large (*start) || !pud_present (*start))note_page (m, st,__pgprot (prot),2 );
@@ -288,7 +288,7 @@ static void walk_pgd_level(struct seq_file *m)for (i =0 ; i <PTRS_PER_PGD ; i++) { st.current_address =normalize_addr (i *PGD_LEVEL_MULT );if (!pgd_none (*start)) { -pgprotval_t prot =pgd_val (*start) & ~PTE_MASK ; +pgprotval_t prot =pgd_val (*start) &PTE_FLAGS_MASK ;if (pgd_large (*start) || !pgd_present (*start))note_page (m, &st,__pgprot (prot),1 );
arch/x86/xen/enlighten.c +1 -1
@@ -1435,7 +1435,7 @@ static unsigned long m2p(phys_addr_t maddr) {phys_addr_t paddr; - maddr &=PTE_MASK ; + maddr &=PTE_PFN_MASK ; paddr =mfn_to_pfn (maddr >>PAGE_SHIFT ) <<PAGE_SHIFT ;return paddr;
arch/x86/xen/mmu.c +4 -4
@@ -343,8 +343,8 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,static pteval_t pte_mfn_to_pfn (pteval_t val) {if (val & _PAGE_PRESENT) { -unsigned long mfn = (val &PTE_MASK ) >>PAGE_SHIFT ; -pteval_t flags = val & ~PTE_MASK ; +unsigned long mfn = (val &PTE_PFN_MASK ) >>PAGE_SHIFT ; +pteval_t flags = val &PTE_FLAGS_MASK ; val = ((pteval_t )mfn_to_pfn (mfn) <<PAGE_SHIFT ) | flags; }
@@ -354,8 +354,8 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)static pteval_t pte_pfn_to_mfn (pteval_t val) {if (val & _PAGE_PRESENT) { -unsigned long pfn = (val &PTE_MASK ) >>PAGE_SHIFT ; -pteval_t flags = val & ~PTE_MASK ; +unsigned long pfn = (val &PTE_PFN_MASK ) >>PAGE_SHIFT ; +pteval_t flags = val &PTE_FLAGS_MASK ; val = ((pteval_t )pfn_to_mfn (pfn) <<PAGE_SHIFT ) | flags; }
include/asm-x86/page.h +11 -3
@@ -18,8 +18,11 @@(ie, 32-bit PAE). */ #define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK) -/* PTE_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */ -#define PTE_MASK ((pteval_t)PHYSICAL_PAGE_MASK) +/* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */ +#define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK) + +/* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */ +#define PTE_FLAGS_MASK (~PTE_PFN_MASK)#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
@@ -144,6 +147,11 @@ static inline pteval_t native_pte_val(pte_t pte)return pte.pte; } +static inline pteval_t native_pte_flags (pte_t pte) +{ +return native_pte_val (pte) &PTE_FLAGS_MASK ; +} +#define pgprot_val (x) ((x).pgprot)#define __pgprot (x) ((pgprot_t) { (x) } )
@@ -165,7 +173,7 @@ static inline pteval_t native_pte_val(pte_t pte)#endif #define pte_val (x) native_pte_val(x) -#define pte_flags (x) native_pte_val(x) +#define pte_flags (x) native_pte_flags(x)#define __pte (x) native_make_pte(x)#endif /* CONFIG_PARAVIRT */
include/asm-x86/paravirt.h +3 -0
@@ -1088,6 +1088,9 @@ static inline pteval_t pte_flags(pte_t pte) ret =PVOP_CALL1 (pteval_t, pv_mmu_ops.pte_flags, pte.pte); +#ifdef CONFIG_PARAVIRT_DEBUG +BUG_ON (ret &PTE_PFN_MASK ); +#endif return ret; }
include/asm-x86/pgtable-3level.h +4 -4
@@ -25,7 +25,7 @@ static inline int pud_none(pud_t pud)static inline int pud_bad (pud_t pud) { -return (pud_val (pud) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER)) !=0 ; +return (pud_val (pud) & ~(PTE_PFN_MASK | _KERNPG_TABLE | _PAGE_USER)) !=0 ; }static inline int pud_present (pud_t pud)
@@ -120,9 +120,9 @@ static inline void pud_clear(pud_t *pudp)write_cr3 (pgd); } -#define pud_page (pud) ((struct page *) __va(pud_val(pud) & PTE_MASK)) +#define pud_page (pud) ((struct page *) __va(pud_val(pud) & PTE_PFN_MASK)) -#define pud_page_vaddr (pud) ((unsigned long) __va(pud_val(pud) & PTE_MASK)) +#define pud_page_vaddr (pud) ((unsigned long) __va(pud_val(pud) & PTE_PFN_MASK))/* Find an entry in the second-level page table.. */
@@ -160,7 +160,7 @@ static inline int pte_none(pte_t pte)static inline unsigned long pte_pfn (pte_t pte) { -return (pte_val (pte) &PTE_MASK ) >>PAGE_SHIFT ; +return (pte_val (pte) &PTE_PFN_MASK ) >>PAGE_SHIFT ; }/*
include/asm-x86/pgtable.h +2 -2
@@ -53,7 +53,7 @@ _PAGE_DIRTY)/* Set of bits not changed in pte_modify */ -#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_PCD | _PAGE_PWT | \ +#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ _PAGE_ACCESSED | _PAGE_DIRTY)#define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT)
@@ -286,7 +286,7 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)return __pgprot (preservebits | addbits); } -#define pte_pgprot (x) __pgprot(pte_flags(x) & ~PTE_MASK) +#define pte_pgprot (x) __pgprot(pte_flags(x) & PTE_FLAGS_MASK)#define canon_pgprot (p) __pgprot(pgprot_val(p) & __supported_pte_mask)
include/asm-x86/pgtable_32.h +2 -2
@@ -88,7 +88,7 @@ extern unsigned long pg0[];/* To avoid harmful races, pmd_none(x) should check only the lower when PAE */ #define pmd_none (x) (!(unsigned long)pmd_val((x)))#define pmd_present (x) (pmd_val((x)) & _PAGE_PRESENT) -#define pmd_bad (x) ((pmd_val(x) & (~PTE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) +#define pmd_bad (x) ((pmd_val(x) & (PTE_FLAGS_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)#define pages_to_mb (x) ((x) >> (20-PAGE_SHIFT))
@@ -139,7 +139,7 @@ static inline int pud_large(pud_t pud) { return 0; }#define pmd_page (pmd) (pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT))#define pmd_page_vaddr (pmd) \ - ((unsigned long)__va(pmd_val((pmd)) & PTE_MASK)) + ((unsigned long)__va(pmd_val((pmd)) & PTE_PFN_MASK))#if defined(CONFIG_HIGHPTE )#define pte_offset_map (dir, address) \
include/asm-x86/pgtable_64.h +5 -5
@@ -158,17 +158,17 @@ static inline void native_pgd_clear(pgd_t *pgd)static inline int pgd_bad (pgd_t pgd) { -return (pgd_val (pgd) & ~(PTE_MASK | _PAGE_USER)) != _KERNPG_TABLE; +return (pgd_val (pgd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE; }static inline int pud_bad (pud_t pud) { -return (pud_val (pud) & ~(PTE_MASK | _PAGE_USER)) != _KERNPG_TABLE; +return (pud_val (pud) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE; }static inline int pmd_bad (pmd_t pmd) { -return (pmd_val (pmd) & ~(PTE_MASK | _PAGE_USER)) != _KERNPG_TABLE; +return (pmd_val (pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE; }#define pte_none (x) (!pte_val((x)))
@@ -193,7 +193,7 @@ static inline int pmd_bad(pmd_t pmd)* Level 4 access. */ #define pgd_page_vaddr (pgd) \ - ((unsigned long)__va((unsigned long)pgd_val((pgd)) & PTE_MASK)) + ((unsigned long)__va((unsigned long)pgd_val((pgd)) & PTE_PFN_MASK))#define pgd_page (pgd) (pfn_to_page(pgd_val((pgd)) >> PAGE_SHIFT))#define pgd_present (pgd) (pgd_val(pgd) & _PAGE_PRESENT)static inline int pgd_large (pgd_t pgd) {return 0 ; }
@@ -216,7 +216,7 @@ static inline int pud_large(pud_t pte) }/* PMD - Level 2 access */ -#define pmd_page_vaddr (pmd) ((unsigned long) __va(pmd_val((pmd)) & PTE_MASK)) +#define pmd_page_vaddr (pmd) ((unsigned long) __va(pmd_val((pmd)) & PTE_PFN_MASK))#define pmd_page (pmd) (pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT))#define pmd_index (address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
include/asm-x86/xen/page.h +1 -1
@@ -124,7 +124,7 @@ static inline unsigned long mfn_to_local_pfn(unsigned long mfn)static inline unsigned long pte_mfn (pte_t pte) { -return (pte.pte &PTE_MASK ) >>PAGE_SHIFT ; +return (pte.pte &PTE_PFN_MASK ) >>PAGE_SHIFT ; }static inline pte_t mfn_pte (unsigned long page_nr,pgprot_t pgprot)
Hi,
Quoted 10 lines · Ingo Molnar
Linus,
Please pull the latest x86 fixes git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-fixes-for-linusThanks,
Ingo
Quoted 7 lines
------------------>
Jan Kratochvil (1):
x86: fix crash due to missing debugctlmsr on AMD K6-3Jeremy Fitzhardinge (2):
x86: renamePTE_MASKtoPTE_PFN_MASK
x86: addPTE_FLAGS_MASK
Are you serious? It goes _this_ fast? The patch came into my mbox at 8:00am this morning and you push it to Linus at 4:00pm already?
What about the inconsistency it introduces? When I look at PAGE_MASK for example, it masks out the PAGE offset. PTE_MASK masks out PTE specifca from a value.
Now, I assume PTE_PFN_MASK masks out the PFN. Oh, wait, it masks the protection bits.
Why not wait a bit longer before pushing things into mainline?
Hannes
Quoted 27 lines · Johannes Weiner
Hi,
Quoted 10 lines · Ingo Molnar
Linus,
Please pull the latest x86 fixes git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-fixes-for-linusThanks,
Ingo
Quoted 8 lines
------------------>
Jan Kratochvil (1):
x86: fix crash due to missing debugctlmsr on AMD K6-3Jeremy Fitzhardinge (2):
x86: renamePTE_MASKtoPTE_PFN_MASK
x86: addPTE_FLAGS_MASKAre you serious? It goes _this_ fast? The patch came into my mbox at 8:00am this morning and you push it to Linus at 4:00pm already?
Quoted 6 lines
What about the inconsistency it introduces? When I look at
PAGE_MASKfor example, it masks out the PAGE offset.PTE_MASKmasks out PTE specifca from a value.Now, I assume
PTE_PFN_MASKmasks out the PFN. Oh, wait, it masks the protection bits.
PAGE_MASK turns an address into its page address.
PTE_PFN_MASK takes a pte value and returns the pte's pfn portion (which is shifted so it's actually a page address).
In both cases, the X_MASK terminology means that X is extracted, not excluded. Which makes sense; if you have a packed bitfield containing multiple values, you wouldn't expect X to be the list of things *not* extracted.
(I would be happy to have a PAGE_OFFSET_MASK for all the places where you want to extract the offset.)
J
Hi,
Quoted 32 lines · Jeremy Fitzhardinge
Quoted 31 lines · Johannes Weiner
Hi,
Quoted 10 lines · Ingo Molnar
Linus,
Please pull the latest x86 fixes git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-fixes-for-linusThanks,
Ingo
Quoted 8 lines
------------------>
Jan Kratochvil (1):
x86: fix crash due to missing debugctlmsr on AMD K6-3Jeremy Fitzhardinge (2):
x86: renamePTE_MASKtoPTE_PFN_MASK
x86: addPTE_FLAGS_MASKAre you serious? It goes _this_ fast? The patch came into my mbox at 8:00am this morning and you push it to Linus at 4:00pm already?
What about the inconsistency it introduces? When I look at
PAGE_MASKfor example, it masks out the PAGE offset.PTE_MASKmasks out PTE specifca from a value.
Quoted 7 lines
Quoted 2 lines
Now, I assume
PTE_PFN_MASKmasks out the PFN. Oh, wait, it masks the protection bits.
PAGE_MASKturns an address into its page address.
PTE_PFN_MASKtakes a pte value and returns the pte's pfn portion (which is shifted so it's actually a page address).
Okay, now it makes sense.
I just always thought of PAGE_MASK as `mask out sub-page granularity'.
Quoted 4 lines
In both cases, the
X_MASKterminology means that X is extracted, not excluded. Which makes sense; if you have a packed bitfield containing multiple values, you wouldn't expect X to be the list of things *not* extracted.
Agreed.
Hannes