Skip to contentSkip to conversation

x86/mm for v2.6.37

GIT PULL Ingo Molnar 1 participant 1 message Oct 21, 2010

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest x86-mm-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-mm-for-linus

out-of-topic modifications in x86-mm-for-linus:
-----------------------------------------------
include/asm-generic/pgtable.h # 61c7732: x86, mm: Avoid unnecessary TLB fl
include/asm-generic/vmlinux.lds.h # 2aeb66d: x86-32, percpu: Correct the order
# c957ef2: percpu: Introduce a read-mostly p

include/linux/percpu-defs.h        # c957ef2: percpu: Introduce a read-mostly p
mm/memory.c                        # 61c7732: x86, mm: Avoid unnecessary TLB fl
mm/vmalloc.c                       # 3ee48b6: mm, x86: Saving vmcore with non-l

Thanks,

Ingo

------------------>
Borislav Petkov (1):
x86, mm: Fix incorrect data type in vmalloc_sync_all()

Cliff Wickman (2):
x86, kdump: Change copy_oldmem_page() to use cached addressing mm, x86: Saving vmcore with non-lazy freeing of vmas

FUJITA Tomonori (1):

      x86, mm: Enable ARCH_DMA_ADDR_T_64BIT with X86_64 || HIGHMEM64G

H. Peter Anvin (1):
x86-32, percpu: Correct the ordering of the percpu readmostly section

Haicheng Li (2):
x86, mm: Separate x86_64 vmalloc_sync_all() into separate functions x86-64, mem: Update all PGDs for direct mapping and vmemmap mapping changes

Jeremy Fitzhardinge (3):
x86, mm: Add RESERVE_BRK_ARRAY() helper
x86, mm: Fix bogus whitespace in sync_global_pgds() x86, mm: Hold mm->page_table_lock while doing vmalloc_sync

Julia Lawall (1):
x86, kmemcheck: Remove double test

Namhyung Kim (1):
x86-32: Fix sparse warning for the __PHYSICAL_MASK calculation

Shaohua Li (4):
x86, mm: Avoid unnecessary TLB flush
x86, mm: Make spurious_fault check explicitly check the PRESENT bit
percpu: Introduce a read-mostly percpu API
x86: Spread tlb flush vector between nodes

Wu Fengguang (1):
x86, mm: fix uninitialized addr in kernel_physical_mapping_init()

 arch/x86/Kconfig                  |    3 ++
 arch/x86/include/asm/io.h         |    1 +
 arch/x86/include/asm/page_types.h |    2 +-
 arch/x86/include/asm/pgtable.h    |    4 +++
 arch/x86/include/asm/pgtable_64.h |    2 +
 arch/x86/include/asm/setup.h      |    5 ++++
 arch/x86/kernel/crash_dump_64.c   |    3 +-
 arch/x86/mm/fault.c               |   43 ++++++++++++++-------------------
 arch/x86/mm/init_64.c             |   47 +++++++++++++++++++++++++++++++++++-
 arch/x86/mm/kmemcheck/opcode.c    |    2 +-
 arch/x86/mm/pgtable.c             |   20 +++++++++++++--
 arch/x86/mm/tlb.c                 |   48 ++++++++++++++++++++++++++++++++++++-
 include/asm-generic/pgtable.h     |    4 +++
 include/asm-generic/vmlinux.lds.h |    4 +++
 include/linux/percpu-defs.h       |    9 +++++++
 mm/memory.c                       |    2 +-
 mm/vmalloc.c                      |    9 +++++++
 17 files changed, 174 insertions(+), 34 deletions(-)
arch/x86/Kconfig +3 -0
index cea0cd9..2924f4e 100644
@@ -1148,6 +1148,9 @@ config X86_PAE
 config ARCH_PHYS_ADDR_T_64BIT
 	def_bool X86_64 || X86_PAE
 
+config ARCH_DMA_ADDR_T_64BIT
+	def_bool X86_64 || HIGHMEM64G
+
 config DIRECT_GBPAGES
 	bool "Enable 1GB pages for kernel pagetables" if EMBEDDED
 	default y
arch/x86/include/asm/io.h +1 -0
index 30a3e97..6a45ec4 100644
@@ -206,6 +206,7 @@ static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)
 
 extern void iounmap(volatile void __iomem *addr);
 
+extern void set_iounmap_nonlazy(void);
 
 #ifdef __KERNEL__
 
arch/x86/include/asm/page_types.h +1 -1
index a667f24..1df6621 100644
@@ -8,7 +8,7 @@
 #define PAGE_SIZE	(_AC(1,UL) << PAGE_SHIFT)
 #define PAGE_MASK	(~(PAGE_SIZE-1))
 
-#define __PHYSICAL_MASK		((phys_addr_t)(1ULL << __PHYSICAL_MASK_SHIFT) - 1)
+#define __PHYSICAL_MASK		((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1))
 #define __VIRTUAL_MASK		((1UL << __VIRTUAL_MASK_SHIFT) - 1)
 
 /* Cast PAGE_MASK to a signed type so that it is sign-extended if
arch/x86/include/asm/pgtable.h +4 -0
index a34c785..ada823a 100644
@@ -28,6 +28,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
 extern spinlock_t pgd_lock;
 extern struct list_head pgd_list;
 
+extern struct mm_struct *pgd_page_get_mm(struct page *page);
+
 #ifdef CONFIG_PARAVIRT
 #include <asm/paravirt.h>
 #else  /* !CONFIG_PARAVIRT */
@@ -603,6 +605,8 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm,
 	pte_update(mm, addr, ptep);
 }
 
+#define flush_tlb_fix_spurious_fault(vma, address)
+
 /*
  * clone_pgd_range(pgd_t *dst, pgd_t *src, int count);
  *
arch/x86/include/asm/pgtable_64.h +2 -0
index 076052c..f96ac9b 100644
@@ -102,6 +102,8 @@ static inline void native_pgd_clear(pgd_t *pgd)
 	native_set_pgd(pgd, native_make_pgd(0));
 }
 
+extern void sync_global_pgds(unsigned long start, unsigned long end);
+
 /*
  * Conversion functions: convert a page and protection to a page entry,
  * and a page entry and page directory to the page they refer to.
arch/x86/include/asm/setup.h +5 -0
index ef292c7..d6763b1 100644
@@ -93,6 +93,11 @@ void *extend_brk(size_t size, size_t align);
 			: : "i" (sz));					\
 	}
 
+/* Helper for reserving space for arrays of things */
+#define RESERVE_BRK_ARRAY(type, name, entries)		\
+	type *name;					\
+	RESERVE_BRK(name, sizeof(type) * entries)
+
 #ifdef __i386__
 
 void __init i386_start_kernel(void);
arch/x86/kernel/crash_dump_64.c +2 -1
index 045b36c..9948288 100644
@@ -34,7 +34,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 	if (!csize)
 		return 0;
 
-	vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+	vaddr = ioremap_cache(pfn << PAGE_SHIFT, PAGE_SIZE);
 	if (!vaddr)
 		return -ENOMEM;
 
@@ -46,6 +46,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 	} else
 		memcpy(buf, vaddr + offset, csize);
 
+	set_iounmap_nonlazy();
 	iounmap(vaddr);
 	return csize;
 }
arch/x86/mm/fault.c +18 -25

62 lines not on this page · raw message

arch/x86/mm/init_64.c +46 -1

76 lines not on this page · raw message

arch/x86/mm/kmemcheck/opcode.c +1 -1
index 63c19e2..324aa3f 100644
@@ -9,7 +9,7 @@ static bool opcode_is_prefix(uint8_t b)
 		b == 0xf0 || b == 0xf2 || b == 0xf3
 		/* Group 2 */
 		|| b == 0x2e || b == 0x36 || b == 0x3e || b == 0x26
-		|| b == 0x64 || b == 0x65 || b == 0x2e || b == 0x3e
+		|| b == 0x64 || b == 0x65
 		/* Group 3 */
 		|| b == 0x66
 		/* Group 4 */
arch/x86/mm/pgtable.c +17 -3
index 5c4ee42..c70e57d 100644
@@ -87,7 +87,19 @@ static inline void pgd_list_del(pgd_t *pgd)
 #define UNSHARED_PTRS_PER_PGD				\
 	(SHARED_KERNEL_PMD ? KERNEL_PGD_BOUNDARY : PTRS_PER_PGD)
 
-static void pgd_ctor(pgd_t *pgd)
+
+static void pgd_set_mm(pgd_t *pgd, struct mm_struct *mm)
+{
+	BUILD_BUG_ON(sizeof(virt_to_page(pgd)->index) < sizeof(mm));
+	virt_to_page(pgd)->index = (pgoff_t)mm;
+}
+
+struct mm_struct *pgd_page_get_mm(struct page *page)
+{
+	return (struct mm_struct *)page->index;
+}
+
+static void pgd_ctor(struct mm_struct *mm, pgd_t *pgd)
 {
 	/* If the pgd points to a shared pagetable level (either the
 	   ptes in non-PAE, or shared PMD in PAE), then just copy the
@@ -105,8 +117,10 @@ static void pgd_ctor(pgd_t *pgd)
 	}
 
 	/* list required to sync kernel mapping updates */
-	if (!SHARED_KERNEL_PMD)
+	if (!SHARED_KERNEL_PMD) {
+		pgd_set_mm(pgd, mm);
 		pgd_list_add(pgd);
+	}
 }
 
 static void pgd_dtor(pgd_t *pgd)
@@ -272,7 +286,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
 	 */
 	spin_lock_irqsave(&pgd_lock, flags);
 
-	pgd_ctor(pgd);
+	pgd_ctor(mm, pgd);
 	pgd_prepopulate_pmd(mm, pgd, pmds);
 
 	spin_unlock_irqrestore(&pgd_lock, flags);
arch/x86/mm/tlb.c +47 -1

78 lines not on this page · raw message

include/asm-generic/pgtable.h +4 -0
index e2bd73e..f4d4120 100644
@@ -129,6 +129,10 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
 #define move_pte(pte, prot, old_addr, new_addr)	(pte)
 #endif
 
+#ifndef flush_tlb_fix_spurious_fault
+#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
+#endif
+
 #ifndef pgprot_noncached
 #define pgprot_noncached(prot)	(prot)
 #endif
include/asm-generic/vmlinux.lds.h +4 -0
index 8a92a17..1457b81 100644
@@ -677,7 +677,9 @@
 				- LOAD_OFFSET) {			\
 		VMLINUX_SYMBOL(__per_cpu_start) = .;			\
 		*(.data..percpu..first)					\
+		. = ALIGN(PAGE_SIZE);					\
 		*(.data..percpu..page_aligned)				\
+		*(.data..percpu..readmostly)				\
 		*(.data..percpu)					\
 		*(.data..percpu..shared_aligned)			\
 		VMLINUX_SYMBOL(__per_cpu_end) = .;			\
@@ -703,7 +705,9 @@
 		VMLINUX_SYMBOL(__per_cpu_load) = .;			\
 		VMLINUX_SYMBOL(__per_cpu_start) = .;			\
 		*(.data..percpu..first)					\
+		. = ALIGN(PAGE_SIZE);					\
 		*(.data..percpu..page_aligned)				\
+		*(.data..percpu..readmostly)				\
 		*(.data..percpu)					\
 		*(.data..percpu..shared_aligned)			\
 		VMLINUX_SYMBOL(__per_cpu_end) = .;			\
include/linux/percpu-defs.h +9 -0
index ce2dc65..27ef6b1 100644
@@ -139,6 +139,15 @@
 	__aligned(PAGE_SIZE)
 
 /*
+ * Declaration/definition used for per-CPU variables that must be read mostly.
+ */
+#define DECLARE_PER_CPU_READ_MOSTLY(type, name)			\
+	DECLARE_PER_CPU_SECTION(type, name, "..readmostly")
+
+#define DEFINE_PER_CPU_READ_MOSTLY(type, name)				\
+	DEFINE_PER_CPU_SECTION(type, name, "..readmostly")
+
+/*
  * Intermodule exports for per-CPU variables.  sparse forgets about
  * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to
  * noop if __CHECKER__.
mm/memory.c +1 -1
index 2ed2267..a40da69 100644
@@ -3147,7 +3147,7 @@ static inline int handle_pte_fault(struct mm_struct *mm,
 		 * with threads.
 		 */
 		if (flags & FAULT_FLAG_WRITE)
-			flush_tlb_page(vma, address);
+			flush_tlb_fix_spurious_fault(vma, address);
 	}
 unlock:
 	pte_unmap_unlock(pte, ptl);
mm/vmalloc.c +9 -0
index 6b8889d..d8087f0 100644
@@ -517,6 +517,15 @@ static atomic_t vmap_lazy_nr = ATOMIC_INIT(0);
 static void purge_fragmented_blocks_allcpus(void);
 
 /*
+ * called before a call to iounmap() if the caller wants vm_area_struct's
+ * immediately freed.
+ */
+void set_iounmap_nonlazy(void)
+{
+	atomic_set(&vmap_lazy_nr, lazy_max_pages()+1);
+}
+
+/*
  * Purges all lazily-freed vmap areas.
  *
  * If sync is 0 then don't purge if there is already a purge in progress.