Skip to contentSkip to conversation

x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn()

PATCH In review Akinobu Mita 4 participants 18 messages Mar 11, 2009 – Mar 24, 2009

Subsystems (7)
Memory management x86 PowerPC MIPS +3 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn()

kmap_atomic_pfn() and iomap_atomic_prot_pfn() are almost same except pgprot. This patch removes the code duplication for these two functions.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
---
 arch/x86/include/asm/highmem.h |    1 +
 arch/x86/mm/highmem_32.c       |   17 +++++++++++------
 arch/x86/mm/iomap_32.c         |   13 ++-----------
 3 files changed, 14 insertions(+), 17 deletions(-)
arch/x86/include/asm/highmem.h +1 -0
Index: 2.6-mmotm/arch/x86/include/asm/highmem.h
===================================================================
@@ -63,6 +63,7 @@ void *kmap_atomic_prot(struct page *page
 void *kmap_atomic(struct page *page, enum km_type type);
 void kunmap_atomic(void *kvaddr, enum km_type type);
 void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
+void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot);
 struct page *kmap_atomic_to_page(void *ptr);
 
 #ifndef CONFIG_PARAVIRT
arch/x86/mm/highmem_32.c +11 -6
Index: 2.6-mmotm/arch/x86/mm/highmem_32.c
===================================================================
@@ -121,23 +121,28 @@ void kunmap_atomic(void *kvaddr, enum km
 	pagefault_enable();
 }
 
-/* This is the same as kmap_atomic() but can map memory that doesn't
- * have a struct page associated with it.
- */
-void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
+void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
 {
 	enum fixed_addresses idx;
 	unsigned long vaddr;
 
 	pagefault_disable();
 
-	idx = type + KM_TYPE_NR*smp_processor_id();
+	idx = type + KM_TYPE_NR * smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
-	set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
+	set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
 	arch_flush_lazy_mmu_mode();
 
 	return (void*) vaddr;
 }
+
+/* This is the same as kmap_atomic() but can map memory that doesn't
+ * have a struct page associated with it.
+ */
+void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
+{
+	return kmap_atomic_prot_pfn(pfn, type, kmap_prot);
+}
 EXPORT_SYMBOL_GPL(kmap_atomic_pfn); /* temporarily in use by i915 GEM until vmap */
 
 struct page *kmap_atomic_to_page(void *ptr)
arch/x86/mm/iomap_32.c +2 -11
Index: 2.6-mmotm/arch/x86/mm/iomap_32.c
===================================================================
@@ -18,6 +18,7 @@
 
 #include <asm/iomap.h>
 #include <asm/pat.h>
+#include <asm/highmem.h>
 #include <linux/module.h>
 
 int is_io_mapping_possible(resource_size_t base, unsigned long size)
@@ -36,11 +37,6 @@ EXPORT_SYMBOL_GPL(is_io_mapping_possible
 void *
 iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
 {
-	enum fixed_addresses idx;
-	unsigned long vaddr;
-
-	pagefault_disable();
-
 	/*
 	 * For non-PAT systems, promote PAGE_KERNEL_WC to PAGE_KERNEL_UC_MINUS.
 	 * PAGE_KERNEL_WC maps to PWT, which translates to uncached if the
@@ -50,12 +46,7 @@ iomap_atomic_prot_pfn(unsigned long pfn,
 	if (!pat_enabled && pgprot_val(prot) == pgprot_val(PAGE_KERNEL_WC))
 		prot = PAGE_KERNEL_UC_MINUS;
 
-	idx = type + KM_TYPE_NR*smp_processor_id();
-	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
-	set_pte(kmap_pte-idx, pfn_pte(pfn, prot));
-	arch_flush_lazy_mmu_mode();
-
-	return (void*) vaddr;
+	return kmap_atomic_prot_pfn(pfn, type, prot);
 }
 EXPORT_SYMBOL_GPL(iomap_atomic_prot_pfn);
 
#1 lore raw

PATCH 2/2 x86: debug check for kmap_atomic_pfn and iomap_atomic_prot_pfn()

It may be useful for kmap_atomic_pfn() and iomap_atomic_prot_pfn() to check invalid kmap usage as well as kmap_atomic.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
---
 arch/x86/mm/highmem_32.c |    2 ++
 1 file changed, 2 insertions(+)
arch/x86/mm/highmem_32.c +2 -0
Index: 2.6-mmotm/arch/x86/mm/highmem_32.c
===================================================================
@@ -128,6 +128,8 @@ void *kmap_atomic_prot_pfn(unsigned long
 
 	pagefault_disable();
 
+	debug_kmap_atomic_prot(type);
+
 	idx = type + KM_TYPE_NR * smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
 	set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
#3 lore raw
In reply to Akinobu Mita
Quoted 2 lines · Akinobu Mita

kmap_atomic_pfn() and iomap_atomic_prot_pfn() are almost same except pgprot. This patch removes the code duplication for these two functions.

How exaclty does this compile with CONFIG_HIGHMEM=n ?

Thanks,

tglx

#4 lore raw

2009/3/12 Thomas Gleixner <[email protected]>:

Quoted 6 lines · Akinobu Mita
Quoted 2 lines

kmap_atomic_pfn() and iomap_atomic_prot_pfn() are almost same except pgprot. This patch removes the code duplication for these two functions.

How exaclty does this compile with CONFIG_HIGHMEM=n ?

Oh, I didn't try without CONFIG_HIGHMEM.

#5 lore raw
Quoted 9 lines · Akinobu Mita

2009/3/12 Thomas Gleixner <[email protected]>:

Quoted 6 lines · Akinobu Mita
Quoted 2 lines

kmap_atomic_pfn() and iomap_atomic_prot_pfn() are almost same except pgprot. This patch removes the code duplication for these two functions.

How exaclty does this compile with CONFIG_HIGHMEM=n ?

Oh, I didn't try without CONFIG_HIGHMEM.

i had it applied in testing locally and didnt see problems so far. Let me know if you can see any problems.

Ingo

#9 lore raw
In reply to Akinobu Mita
Commit-ID:  bb6d59ca927d855ffac567b35c0a790c67016103
Gitweb:     http://git.kernel.org/tip/bb6d59ca927d855ffac567b35c0a790c67016103
Author:     "Akinobu Mita" <[email protected]>
AuthorDate: Wed, 11 Mar 2009 23:33:18 +0900
Commit:     Ingo Molnar <[email protected]>
CommitDate: Wed, 11 Mar 2009 15:47:46 +0100

x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn()

kmap_atomic_pfn() and iomap_atomic_prot_pfn() are almost same except pgprot. This patch removes the code duplication for these two functions.

LKML-Reference: <[email protected]>

---
 arch/x86/include/asm/highmem.h |    1 +
 arch/x86/mm/highmem_32.c       |   17 +++++++++++------
 arch/x86/mm/iomap_32.c         |   13 ++-----------
 3 files changed, 14 insertions(+), 17 deletions(-)
arch/x86/include/asm/highmem.h +1 -0
index bf9276b..014c2b8 100644
@@ -63,6 +63,7 @@ void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot);
 void *kmap_atomic(struct page *page, enum km_type type);
 void kunmap_atomic(void *kvaddr, enum km_type type);
 void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
+void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot);
 struct page *kmap_atomic_to_page(void *ptr);
 
 #ifndef CONFIG_PARAVIRT
arch/x86/mm/highmem_32.c +11 -6
index d117453..ae4c8da 100644
@@ -121,23 +121,28 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
 	pagefault_enable();
 }
 
-/* This is the same as kmap_atomic() but can map memory that doesn't
- * have a struct page associated with it.
- */
-void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
+void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
 {
 	enum fixed_addresses idx;
 	unsigned long vaddr;
 
 	pagefault_disable();
 
-	idx = type + KM_TYPE_NR*smp_processor_id();
+	idx = type + KM_TYPE_NR * smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
-	set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
+	set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
 	arch_flush_lazy_mmu_mode();
 
 	return (void*) vaddr;
 }
+
+/* This is the same as kmap_atomic() but can map memory that doesn't
+ * have a struct page associated with it.
+ */
+void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
+{
+	return kmap_atomic_prot_pfn(pfn, type, kmap_prot);
+}
 EXPORT_SYMBOL_GPL(kmap_atomic_pfn); /* temporarily in use by i915 GEM until vmap */
 
 struct page *kmap_atomic_to_page(void *ptr)
arch/x86/mm/iomap_32.c +2 -11
index 04102d4..592984e 100644
@@ -18,6 +18,7 @@
 
 #include <asm/iomap.h>
 #include <asm/pat.h>
+#include <asm/highmem.h>
 #include <linux/module.h>
 
 int is_io_mapping_possible(resource_size_t base, unsigned long size)
@@ -36,11 +37,6 @@ EXPORT_SYMBOL_GPL(is_io_mapping_possible);
 void *
 iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
 {
-	enum fixed_addresses idx;
-	unsigned long vaddr;
-
-	pagefault_disable();
-
 	/*
 	 * For non-PAT systems, promote PAGE_KERNEL_WC to PAGE_KERNEL_UC_MINUS.
 	 * PAGE_KERNEL_WC maps to PWT, which translates to uncached if the
@@ -50,12 +46,7 @@ iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
 	if (!pat_enabled && pgprot_val(prot) == pgprot_val(PAGE_KERNEL_WC))
 		prot = PAGE_KERNEL_UC_MINUS;
 
-	idx = type + KM_TYPE_NR*smp_processor_id();
-	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
-	set_pte(kmap_pte-idx, pfn_pte(pfn, prot));
-	arch_flush_lazy_mmu_mode();
-
-	return (void*) vaddr;
+	return kmap_atomic_prot_pfn(pfn, type, prot);
 }
 EXPORT_SYMBOL_GPL(iomap_atomic_prot_pfn);
 
#2 lore raw

[tip:x86/mm] x86: debug check for kmap_atomic_pfn and iomap_atomic_prot_pfn()

In reply to Akinobu Mita
Commit-ID:  12074fa1073013dd11f1cff41db018d5cff4ecd9
Gitweb:     http://git.kernel.org/tip/12074fa1073013dd11f1cff41db018d5cff4ecd9
Author:     "Akinobu Mita" <[email protected]>
AuthorDate: Wed, 11 Mar 2009 23:34:50 +0900
Commit:     Ingo Molnar <[email protected]>
CommitDate: Wed, 11 Mar 2009 15:47:46 +0100

x86: debug check for kmap_atomic_pfn and iomap_atomic_prot_pfn()

It may be useful for kmap_atomic_pfn() and iomap_atomic_prot_pfn() to check invalid kmap usage as well as kmap_atomic.

LKML-Reference: <[email protected]>

---
 arch/x86/mm/highmem_32.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/mm/highmem_32.c +2 -0
index ae4c8da..f256e73 100644
@@ -128,6 +128,8 @@ void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
 
 	pagefault_disable();
 
+	debug_kmap_atomic_prot(type);
+
 	idx = type + KM_TYPE_NR * smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
 	set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
#6 lore raw
In reply to Ingo Molnar

2009/3/12 Ingo Molnar <[email protected]>:

Quoted 8 lines · Akinobu Mita
Quoted 6 lines

2009/3/12 Thomas Gleixner <[email protected]>:

Quoted 4 lines · Akinobu Mita
Quoted 2 lines

kmap_atomic_pfn() and iomap_atomic_prot_pfn() are almost same except pgprot. This patch removes the code duplication for these two functions.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

How exaclty does this compile with CONFIG_HIGHMEM=n ?

Oh, I didn't try without CONFIG_HIGHMEM.

i had it applied in testing locally and didnt see problems so far. Let me know if you can see any problems.

It actually didn't compile with CONFIG_HIGHMEM=n as Thomas pointed out.

arch/x86/mm/iomap_32.c:49: undefined reference to `kmap_atomic_prot_pfn'

So please revert 1/2 and 2/2. However, I still think 2/2 is usefull and I'll submit it in other form.

#7 lore raw
Quoted 14 lines · Akinobu Mita

2009/3/12 Ingo Molnar <[email protected]>:

Quoted 13 lines · Akinobu Mita
Quoted 10 lines

2009/3/12 Thomas Gleixner <[email protected]>:

Quoted 6 lines · Akinobu Mita
Quoted 2 lines

kmap_atomic_pfn() and iomap_atomic_prot_pfn() are almost same except pgprot. This patch removes the code duplication for these two functions.

How exaclty does this compile with CONFIG_HIGHMEM=n ?

Oh, I didn't try without CONFIG_HIGHMEM.

Quoted 8 lines
Quoted 2 lines

i had it applied in testing locally and didnt see problems so far. Let me know if you can see any problems.

It actually didn't compile with CONFIG_HIGHMEM=n as Thomas pointed out.

arch/x86/mm/iomap_32.c:49: undefined reference to
`kmap_atomic_prot_pfn'

hm, i didnt see any build failures myself. Could you please send the .config that triggers it?

Ingo

#8 lore raw
Quoted 8 lines · Ingo Molnar
Quoted 5 lines

It actually didn't compile with CONFIG_HIGHMEM=n as Thomas pointed out.

arch/x86/mm/iomap_32.c:49: undefined reference to
`kmap_atomic_prot_pfn'

hm, i didnt see any build failures myself. Could you please send the .config that triggers it?

got it now. Somehow randconfig does not find that combo.

Ingo

#10 lore raw

[tip:x86/mm] x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn(), fix

In reply to Akinobu Mita
Commit-ID:  dd63fdcc63f0f853b116b52e56200a0e0227cf5f
Gitweb:     http://git.kernel.org/tip/dd63fdcc63f0f853b116b52e56200a0e0227cf5f
Author:     Ingo Molnar <[email protected]>
AuthorDate: Fri, 13 Mar 2009 03:20:49 +0100
Commit:     Ingo Molnar <[email protected]>
CommitDate: Fri, 13 Mar 2009 03:24:53 +0100

x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn(), fix

Impact: build fix

Move kmap_atomic_prot_pfn() to iomap_32.c. It is used on all 32-bit kernels, while highmem_32.c is only built on highmem kernels.

( Note: the debug_kmap_atomic_prot() check is removed for now, that
problem is handled via another patch. )

LKML-Reference: <[email protected]>

---
 arch/x86/mm/highmem_32.c |   20 ++------------------
 arch/x86/mm/iomap_32.c   |   18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 19 deletions(-)
arch/x86/mm/highmem_32.c +2 -18
index f256e73..522db5e 100644
@@ -121,24 +121,8 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
 	pagefault_enable();
 }
 
-void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
-{
-	enum fixed_addresses idx;
-	unsigned long vaddr;
-
-	pagefault_disable();
-
-	debug_kmap_atomic_prot(type);
-
-	idx = type + KM_TYPE_NR * smp_processor_id();
-	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
-	set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
-	arch_flush_lazy_mmu_mode();
-
-	return (void*) vaddr;
-}
-
-/* This is the same as kmap_atomic() but can map memory that doesn't
+/*
+ * This is the same as kmap_atomic() but can map memory that doesn't
  * have a struct page associated with it.
  */
 void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
arch/x86/mm/iomap_32.c +17 -1
index 592984e..6e60ba6 100644
@@ -32,7 +32,23 @@ int is_io_mapping_possible(resource_size_t base, unsigned long size)
 }
 EXPORT_SYMBOL_GPL(is_io_mapping_possible);
 
-/* Map 'pfn' using fixed map 'type' and protections 'prot'
+void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
+{
+	enum fixed_addresses idx;
+	unsigned long vaddr;
+
+	pagefault_disable();
+
+	idx = type + KM_TYPE_NR * smp_processor_id();
+	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
+	set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
+	arch_flush_lazy_mmu_mode();
+
+	return (void *)vaddr;
+}
+
+/*
+ * Map 'pfn' using fixed map 'type' and protections 'prot'
  */
 void *
 iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
#11 lore raw

PATCH 1/2 mm: introduce debug_kmap_atomic

Quoted 6 lines · Ingo Molnar

x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn(), fix

Impact: build fix

Move kmap_atomic_prot_pfn() to iomap_32.c. It is used on all 32-bit kernels, while highmem_32.c is only built on highmem kernels.

Thanks for fixing that.

Quoted 2 lines

( Note: the debug_kmap_atomic_prot() check is removed for now, that
problem is handled via another patch. )

The patches are now sitting in -mmotm now. For -tip, here are the rebased patches for the debug_kmap_atomic_prot() check.

Subject: mm: introduce debug_kmap_atomic
From: Akinobu Mita <[email protected]>

x86 has debug_kmap_atomic_prot() which is error checking function for kmap_atomic. It is usefull for the other architectures, although it needs CONFIG_TRACE_IRQFLAGS_SUPPORT.

This patch exposes it to the other architectures.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
---
 arch/x86/mm/highmem_32.c |   45 +--------------------------------------------
 include/linux/highmem.h  |   12 ++++++++++++
 mm/highmem.c             |   45 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 44 deletions(-)
arch/x86/mm/highmem_32.c +1 -44
Index: linux-2.6-tip/arch/x86/mm/highmem_32.c
===================================================================
@@ -19,49 +19,6 @@ void kunmap(struct page *page)
 	kunmap_high(page);
 }
 
-static void debug_kmap_atomic_prot(enum km_type type)
-{
-#ifdef CONFIG_DEBUG_HIGHMEM
-	static unsigned warn_count = 10;
-
-	if (unlikely(warn_count == 0))
-		return;
-
-	if (unlikely(in_interrupt())) {
-		if (in_irq()) {
-			if (type != KM_IRQ0 && type != KM_IRQ1 &&
-			    type != KM_BIO_SRC_IRQ && type != KM_BIO_DST_IRQ &&
-			    type != KM_BOUNCE_READ) {
-				WARN_ON(1);
-				warn_count--;
-			}
-		} else if (!irqs_disabled()) {	/* softirq */
-			if (type != KM_IRQ0 && type != KM_IRQ1 &&
-			    type != KM_SOFTIRQ0 && type != KM_SOFTIRQ1 &&
-			    type != KM_SKB_SUNRPC_DATA &&
-			    type != KM_SKB_DATA_SOFTIRQ &&
-			    type != KM_BOUNCE_READ) {
-				WARN_ON(1);
-				warn_count--;
-			}
-		}
-	}
-
-	if (type == KM_IRQ0 || type == KM_IRQ1 || type == KM_BOUNCE_READ ||
-			type == KM_BIO_SRC_IRQ || type == KM_BIO_DST_IRQ) {
-		if (!irqs_disabled()) {
-			WARN_ON(1);
-			warn_count--;
-		}
-	} else if (type == KM_SOFTIRQ0 || type == KM_SOFTIRQ1) {
-		if (irq_count() == 0 && !irqs_disabled()) {
-			WARN_ON(1);
-			warn_count--;
-		}
-	}
-#endif
-}
-
 /*
  * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
  * no global lock is needed and because the kmap code must perform a global TLB
@@ -81,7 +38,7 @@ void *kmap_atomic_prot(struct page *page
 	if (!PageHighMem(page))
 		return page_address(page);
 
-	debug_kmap_atomic_prot(type);
+	debug_kmap_atomic(type);
 
 	idx = type + KM_TYPE_NR*smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
include/linux/highmem.h +12 -0
Index: linux-2.6-tip/include/linux/highmem.h
===================================================================
@@ -187,4 +187,16 @@ static inline void copy_highpage(struct 
 	kunmap_atomic(vto, KM_USER1);
 }
 
+#if defined(CONFIG_DEBUG_HIGHMEM) && defined(CONFIG_TRACE_IRQFLAGS_SUPPORT)
+
+void debug_kmap_atomic(enum km_type type);
+
+#else
+
+static inline void debug_kmap_atomic(enum km_type type)
+{
+}
+
+#endif
+
 #endif /* _LINUX_HIGHMEM_H */
mm/highmem.c +45 -0

48 lines not on this page · raw message

#12 lore raw

PATCH 2/2 mm: use debug_kmap_atomic

Subject: mm: use debug_kmap_atomic
From: Akinobu Mita <[email protected]>

Use debug_kmap_atomic in kmap_atomic, kmap_atomic_pfn, kmap_atomic_prot and iomap_atomic_prot_pfn.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
---
 arch/mips/mm/highmem.c             |    2 ++
 arch/powerpc/include/asm/highmem.h |    2 ++
 arch/sparc/mm/highmem.c            |    1 +
 arch/x86/mm/iomap_32.c             |    3 ++-
 include/asm-frv/highmem.h          |    2 ++
 include/asm-mn10300/highmem.h      |    2 ++
 6 files changed, 11 insertions(+), 1 deletion(-)
arch/mips/mm/highmem.c +2 -0
Index: linux-2.6-tip/arch/mips/mm/highmem.c
===================================================================
@@ -43,6 +43,7 @@ void *__kmap_atomic(struct page *page, e
 	if (!PageHighMem(page))
 		return page_address(page);
 
+	debug_kmap_atomic(type);
 	idx = type + KM_TYPE_NR*smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
 #ifdef CONFIG_DEBUG_HIGHMEM
@@ -91,6 +92,7 @@ void *kmap_atomic_pfn(unsigned long pfn,
 
 	pagefault_disable();
 
+	debug_kmap_atomic(type);
 	idx = type + KM_TYPE_NR*smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
 	set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
arch/powerpc/include/asm/highmem.h +2 -0
Index: linux-2.6-tip/arch/powerpc/include/asm/highmem.h
===================================================================
@@ -24,6 +24,7 @@
 
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/highmem.h>
 #include <asm/kmap_types.h>
 #include <asm/tlbflush.h>
 #include <asm/page.h>
@@ -94,6 +95,7 @@ static inline void *kmap_atomic_prot(str
 	if (!PageHighMem(page))
 		return page_address(page);
 
+	debug_kmap_atomic(type);
 	idx = type + KM_TYPE_NR*smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
 #ifdef CONFIG_DEBUG_HIGHMEM
arch/sparc/mm/highmem.c +1 -0
Index: linux-2.6-tip/arch/sparc/mm/highmem.c
===================================================================
@@ -39,6 +39,7 @@ void *kmap_atomic(struct page *page, enu
 	if (!PageHighMem(page))
 		return page_address(page);
 
+	debug_kmap_atomic(type);
 	idx = type + KM_TYPE_NR*smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
 
arch/x86/mm/iomap_32.c +2 -1
Index: linux-2.6-tip/arch/x86/mm/iomap_32.c
===================================================================
@@ -18,8 +18,8 @@
 
 #include <asm/iomap.h>
 #include <asm/pat.h>
-#include <asm/highmem.h>
 #include <linux/module.h>
+#include <linux/highmem.h>
 
 int is_io_mapping_possible(resource_size_t base, unsigned long size)
 {
@@ -39,6 +39,7 @@ void *kmap_atomic_prot_pfn(unsigned long
 
 	pagefault_disable();
 
+	debug_kmap_atomic(type);
 	idx = type + KM_TYPE_NR * smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
 	set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
include/asm-frv/highmem.h +2 -0
Index: linux-2.6-tip/include/asm-frv/highmem.h
===================================================================
@@ -18,6 +18,7 @@
 #ifdef __KERNEL__
 
 #include <linux/init.h>
+#include <linux/highmem.h>
 #include <asm/mem-layout.h>
 #include <asm/spr-regs.h>
 #include <asm/mb-regs.h>
@@ -116,6 +117,7 @@ static inline void *kmap_atomic(struct p
 	unsigned long paddr;
 
 	pagefault_disable();
+	debug_kmap_atomic(type);
 	paddr = page_to_phys(page);
 
 	switch (type) {
include/asm-mn10300/highmem.h +2 -0
Index: linux-2.6-tip/include/asm-mn10300/highmem.h
===================================================================
@@ -16,6 +16,7 @@
 
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/highmem.h>
 #include <asm/kmap_types.h>
 #include <asm/pgtable.h>
 
@@ -77,6 +78,7 @@ static inline unsigned long kmap_atomic(
 	if (page < highmem_start_page)
 		return page_address(page);
 
+	debug_kmap_atomic(type);
 	idx = type + KM_TYPE_NR * smp_processor_id();
 	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
 #if HIGHMEM_DEBUG
#13 lore raw

Re: [PATCH -tip 1/2] mm: introduce debug_kmap_atomic

In reply to Akinobu Mita
Quoted 8 lines · Akinobu Mita
Quoted 6 lines · Ingo Molnar

x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn(), fix

Impact: build fix

Move kmap_atomic_prot_pfn() to iomap_32.c. It is used on all 32-bit kernels, while highmem_32.c is only built on highmem kernels.

Quoted 7 lines

Thanks for fixing that.

Quoted 2 lines

( Note: the debug_kmap_atomic_prot() check is removed for now, that
problem is handled via another patch. )

The patches are now sitting in -mmotm now. For -tip, here are the rebased patches for the debug_kmap_atomic_prot() check.

Due to the other-arch changes it's better to keep them in -mm i guess. Once the current batch goes out to linux-next (in the next few days) Andrew could pick up the two -tip patches you posted here.

Ingo

#14 lore raw

Re: [PATCH -tip 1/2] mm: introduce debug_kmap_atomic

Quoted 7 lines · Ingo Molnar
Quoted 2 lines

The patches are now sitting in -mmotm now. For -tip, here are the rebased patches for the debug_kmap_atomic_prot() check.

Due to the other-arch changes it's better to keep them in -mm i guess. Once the current batch goes out to linux-next (in the next few days) Andrew could pick up the two -tip patches you posted here.

OK, then please consider to apply this patch for now.

From: Akinobu Mita <[email protected]>
Subject: remove unnecessary include in iomap_32.c

asm/highmem.h inclusion is added to use kmap_atomic_prot_pfn() by commit bb6d59ca927d855ffac567b35c0a790c67016103

Now kmap_atomic_prot_pfn is moved to iomap_32.c by commit dd63fdcc63f0f853b116b52e56200a0e0227cf5f

So the asm/highmem.h inclusion in iomap_32.c is unnecessary now.

---
 arch/x86/mm/iomap_32.c |    1 -
 1 file changed, 1 deletion(-)
arch/x86/mm/iomap_32.c +0 -1
Index: linux.tree.git/arch/x86/mm/iomap_32.c
===================================================================
@@ -18,7 +18,6 @@
 
 #include <asm/iomap.h>
 #include <asm/pat.h>
-#include <asm/highmem.h>
 #include <linux/module.h>
 
 int is_io_mapping_possible(resource_size_t base, unsigned long size)
#15 lore raw

[tip:x86/mm] x86, mm: remove unnecessary include file from iomap_32.c

Commit-ID:  0920dce7d5889634faa336f65833ee44f3b7651e
Gitweb:     http://git.kernel.org/tip/0920dce7d5889634faa336f65833ee44f3b7651e
Author:     Akinobu Mita <[email protected]>
AuthorDate: Mon, 16 Mar 2009 00:15:18 +0900
Commit:     Ingo Molnar <[email protected]>
CommitDate: Sun, 15 Mar 2009 20:05:08 +0100

x86, mm: remove unnecessary include file from iomap_32.c

asm/highmem.h inclusion is added to use kmap_atomic_prot_pfn() by commit bb6d59ca927d855ffac567b35c0a790c67016103

Now kmap_atomic_prot_pfn is moved to iomap_32.c by commit dd63fdcc63f0f853b116b52e56200a0e0227cf5f

So the asm/highmem.h inclusion in iomap_32.c is unnecessary now.

LKML-Reference: <[email protected]>

---
 arch/x86/mm/iomap_32.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
arch/x86/mm/iomap_32.c +0 -1
index 6e60ba6..699c9b2 100644
@@ -18,7 +18,6 @@
 
 #include <asm/iomap.h>
 #include <asm/pat.h>
-#include <asm/highmem.h>
 #include <linux/module.h>
 
 int is_io_mapping_possible(resource_size_t base, unsigned long size)
maintainer
#16 lore raw

Re: [PATCH -tip 1/2] mm: introduce debug_kmap_atomic

In reply to Ingo Molnar
Quoted 16 lines · On Sat, 14 Mar 2009 14:15:55 +0100 Ingo Molnar <[email protected]> wrote:
Quoted 13 lines · Akinobu Mita
Quoted 6 lines · Ingo Molnar

x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn(), fix

Impact: build fix

Move kmap_atomic_prot_pfn() to iomap_32.c. It is used on all 32-bit kernels, while highmem_32.c is only built on highmem kernels.

Thanks for fixing that.

Quoted 2 lines

( Note: the debug_kmap_atomic_prot() check is removed for now, that
problem is handled via another patch. )

Quoted 7 lines
Quoted 2 lines

The patches are now sitting in -mmotm now. For -tip, here are the rebased patches for the debug_kmap_atomic_prot() check.

Due to the other-arch changes it's better to keep them in -mm i guess. Once the current batch goes out to linux-next (in the next few days) Andrew could pick up the two -tip patches you posted here.

I really don't know what's going on here.

#17 lore raw

Re: [PATCH -tip 1/2] mm: introduce debug_kmap_atomic

Quoted 1 line · Andrew Morton

I really don't know what's going on here.

Theare are two patches from me in -tip:
http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-tip.git;a=commitdiff;h=bb6d59ca927d855ffac567b35c0a790c67016103
http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-tip.git;a=commitdiff;h=dd63fdcc63f0f853b116b52e56200a0e0227cf5f

which may break -mmotm patches from me:
introduce-debug_kmap_atomic.patch
use-debug_kmap_atomic.patch

So please feel free to drop them if they cannot be applied. I'll resubmit them in that case.