Skip to content

Commit 2a32f2d

Browse files
committed
Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: resource: Fix broken indentation resource: Fix generic page_is_ram() for partial RAM pages x86, paravirt: Remove kmap_atomic_pte paravirt op. x86, vmi: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y
2 parents feaf77d + f414966 commit 2a32f2d

File tree

9 files changed

+21
-76
lines changed

9 files changed

+21
-76
lines changed

arch/x86/include/asm/highmem.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
6666
void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot);
6767
struct page *kmap_atomic_to_page(void *ptr);
6868

69-
#ifndef CONFIG_PARAVIRT
70-
#define kmap_atomic_pte(page, type) kmap_atomic(page, type)
71-
#endif
72-
7369
#define flush_cache_kmaps() do { } while (0)
7470

7571
extern void add_highpages_with_active_regions(int nid, unsigned long start_pfn,

arch/x86/include/asm/paravirt.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,6 @@ static inline void paravirt_release_pud(unsigned long pfn)
435435
PVOP_VCALL1(pv_mmu_ops.release_pud, pfn);
436436
}
437437

438-
#ifdef CONFIG_HIGHPTE
439-
static inline void *kmap_atomic_pte(struct page *page, enum km_type type)
440-
{
441-
unsigned long ret;
442-
ret = PVOP_CALL2(unsigned long, pv_mmu_ops.kmap_atomic_pte, page, type);
443-
return (void *)ret;
444-
}
445-
#endif
446-
447438
static inline void pte_update(struct mm_struct *mm, unsigned long addr,
448439
pte_t *ptep)
449440
{

arch/x86/include/asm/paravirt_types.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,6 @@ struct pv_mmu_ops {
304304
#endif /* PAGETABLE_LEVELS == 4 */
305305
#endif /* PAGETABLE_LEVELS >= 3 */
306306

307-
#ifdef CONFIG_HIGHPTE
308-
void *(*kmap_atomic_pte)(struct page *page, enum km_type type);
309-
#endif
310-
311307
struct pv_lazy_ops lazy_mode;
312308

313309
/* dom0 ops */

arch/x86/include/asm/pgtable_32.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t);
5454
in_irq() ? KM_IRQ_PTE : \
5555
KM_PTE0)
5656
#define pte_offset_map(dir, address) \
57-
((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), __KM_PTE) + \
57+
((pte_t *)kmap_atomic(pmd_page(*(dir)), __KM_PTE) + \
5858
pte_index((address)))
5959
#define pte_offset_map_nested(dir, address) \
60-
((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE1) + \
60+
((pte_t *)kmap_atomic(pmd_page(*(dir)), KM_PTE1) + \
6161
pte_index((address)))
6262
#define pte_unmap(pte) kunmap_atomic((pte), __KM_PTE)
6363
#define pte_unmap_nested(pte) kunmap_atomic((pte), KM_PTE1)

arch/x86/kernel/paravirt.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,6 @@ struct pv_mmu_ops pv_mmu_ops = {
428428
.ptep_modify_prot_start = __ptep_modify_prot_start,
429429
.ptep_modify_prot_commit = __ptep_modify_prot_commit,
430430

431-
#ifdef CONFIG_HIGHPTE
432-
.kmap_atomic_pte = kmap_atomic,
433-
#endif
434-
435431
#if PAGETABLE_LEVELS >= 3
436432
#ifdef CONFIG_X86_PAE
437433
.set_pte_atomic = native_set_pte_atomic,

arch/x86/kernel/vmi_32.c

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <asm/fixmap.h>
3434
#include <asm/apicdef.h>
3535
#include <asm/apic.h>
36+
#include <asm/pgalloc.h>
3637
#include <asm/processor.h>
3738
#include <asm/timer.h>
3839
#include <asm/vmi_time.h>
@@ -266,30 +267,6 @@ static void vmi_nop(void)
266267
{
267268
}
268269

269-
#ifdef CONFIG_HIGHPTE
270-
static void *vmi_kmap_atomic_pte(struct page *page, enum km_type type)
271-
{
272-
void *va = kmap_atomic(page, type);
273-
274-
/*
275-
* Internally, the VMI ROM must map virtual addresses to physical
276-
* addresses for processing MMU updates. By the time MMU updates
277-
* are issued, this information is typically already lost.
278-
* Fortunately, the VMI provides a cache of mapping slots for active
279-
* page tables.
280-
*
281-
* We use slot zero for the linear mapping of physical memory, and
282-
* in HIGHPTE kernels, slot 1 and 2 for KM_PTE0 and KM_PTE1.
283-
*
284-
* args: SLOT VA COUNT PFN
285-
*/
286-
BUG_ON(type != KM_PTE0 && type != KM_PTE1);
287-
vmi_ops.set_linear_mapping((type - KM_PTE0)+1, va, 1, page_to_pfn(page));
288-
289-
return va;
290-
}
291-
#endif
292-
293270
static void vmi_allocate_pte(struct mm_struct *mm, unsigned long pfn)
294271
{
295272
vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0);
@@ -640,6 +617,12 @@ static inline int __init activate_vmi(void)
640617
u64 reloc;
641618
const struct vmi_relocation_info *rel = (struct vmi_relocation_info *)&reloc;
642619

620+
/*
621+
* Prevent page tables from being allocated in highmem, even if
622+
* CONFIG_HIGHPTE is enabled.
623+
*/
624+
__userpte_alloc_gfp &= ~__GFP_HIGHMEM;
625+
643626
if (call_vrom_func(vmi_rom, vmi_init) != 0) {
644627
printk(KERN_ERR "VMI ROM failed to initialize!");
645628
return 0;
@@ -778,10 +761,6 @@ static inline int __init activate_vmi(void)
778761

779762
/* Set linear is needed in all cases */
780763
vmi_ops.set_linear_mapping = vmi_get_function(VMI_CALL_SetLinearMapping);
781-
#ifdef CONFIG_HIGHPTE
782-
if (vmi_ops.set_linear_mapping)
783-
pv_mmu_ops.kmap_atomic_pte = vmi_kmap_atomic_pte;
784-
#endif
785764

786765
/*
787766
* These MUST always be patched. Don't support indirect jumps

arch/x86/xen/enlighten.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include <asm/traps.h>
5151
#include <asm/setup.h>
5252
#include <asm/desc.h>
53+
#include <asm/pgalloc.h>
5354
#include <asm/pgtable.h>
5455
#include <asm/tlbflush.h>
5556
#include <asm/reboot.h>
@@ -1094,6 +1095,12 @@ asmlinkage void __init xen_start_kernel(void)
10941095

10951096
__supported_pte_mask |= _PAGE_IOMAP;
10961097

1098+
/*
1099+
* Prevent page tables from being allocated in highmem, even
1100+
* if CONFIG_HIGHPTE is enabled.
1101+
*/
1102+
__userpte_alloc_gfp &= ~__GFP_HIGHMEM;
1103+
10971104
/* Work out if we support NX */
10981105
x86_configure_nx();
10991106

arch/x86/xen/mmu.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,23 +1427,6 @@ static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd)
14271427
#endif
14281428
}
14291429

1430-
#ifdef CONFIG_HIGHPTE
1431-
static void *xen_kmap_atomic_pte(struct page *page, enum km_type type)
1432-
{
1433-
pgprot_t prot = PAGE_KERNEL;
1434-
1435-
if (PagePinned(page))
1436-
prot = PAGE_KERNEL_RO;
1437-
1438-
if (0 && PageHighMem(page))
1439-
printk("mapping highpte %lx type %d prot %s\n",
1440-
page_to_pfn(page), type,
1441-
(unsigned long)pgprot_val(prot) & _PAGE_RW ? "WRITE" : "READ");
1442-
1443-
return kmap_atomic_prot(page, type, prot);
1444-
}
1445-
#endif
1446-
14471430
#ifdef CONFIG_X86_32
14481431
static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte)
14491432
{
@@ -1902,10 +1885,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
19021885
.alloc_pmd_clone = paravirt_nop,
19031886
.release_pmd = xen_release_pmd_init,
19041887

1905-
#ifdef CONFIG_HIGHPTE
1906-
.kmap_atomic_pte = xen_kmap_atomic_pte,
1907-
#endif
1908-
19091888
#ifdef CONFIG_X86_64
19101889
.set_pte = xen_set_pte,
19111890
#else

kernel/resource.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
304304
void *arg, int (*func)(unsigned long, unsigned long, void *))
305305
{
306306
struct resource res;
307-
unsigned long pfn, len;
307+
unsigned long pfn, end_pfn;
308308
u64 orig_end;
309309
int ret = -1;
310310

@@ -314,9 +314,10 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
314314
orig_end = res.end;
315315
while ((res.start < res.end) &&
316316
(find_next_system_ram(&res, "System RAM") >= 0)) {
317-
pfn = (unsigned long)(res.start >> PAGE_SHIFT);
318-
len = (unsigned long)((res.end + 1 - res.start) >> PAGE_SHIFT);
319-
ret = (*func)(pfn, len, arg);
317+
pfn = (res.start + PAGE_SIZE - 1) >> PAGE_SHIFT;
318+
end_pfn = (res.end + 1) >> PAGE_SHIFT;
319+
if (end_pfn > pfn)
320+
ret = (*func)(pfn, end_pfn - pfn, arg);
320321
if (ret)
321322
break;
322323
res.start = res.end + 1;

0 commit comments

Comments
 (0)