All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, mingo@elte.hu
Cc: linux-tip-commits@vger.kernel.org
Subject: [PATCH -tip 1/2] mm: introduce debug_kmap_atomic
Date: Sat, 14 Mar 2009 13:19:49 +0900	[thread overview]
Message-ID: <20090314041948.GA3697@localhost.localdomain> (raw)
In-Reply-To: <tip-dd63fdcc63f0f853b116b52e56200a0e0227cf5f@git.kernel.org>

On Fri, Mar 13, 2009 at 01:39:31AM +0000, Ingo Molnar wrote:
> 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.

> ( 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 <akinobu.mita@gmail.com>

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.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
 arch/x86/mm/highmem_32.c |   45 +--------------------------------------------
 include/linux/highmem.h  |   12 ++++++++++++
 mm/highmem.c             |   45 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 44 deletions(-)

Index: linux-2.6-tip/arch/x86/mm/highmem_32.c
===================================================================
--- linux-2.6-tip.orig/arch/x86/mm/highmem_32.c
+++ 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);
Index: linux-2.6-tip/include/linux/highmem.h
===================================================================
--- linux-2.6-tip.orig/include/linux/highmem.h
+++ 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 */
Index: linux-2.6-tip/mm/highmem.c
===================================================================
--- linux-2.6-tip.orig/mm/highmem.c
+++ linux-2.6-tip/mm/highmem.c
@@ -373,3 +373,48 @@ void __init page_address_init(void)
 }
 
 #endif	/* defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) */
+
+#if defined(CONFIG_DEBUG_HIGHMEM) && defined(CONFIG_TRACE_IRQFLAGS_SUPPORT)
+
+void debug_kmap_atomic(enum km_type type)
+{
+	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

  reply	other threads:[~2009-03-14  4:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11 14:33 [PATCH 1/2] x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn() Akinobu Mita
2009-03-11 14:34 ` [PATCH 2/2] x86: debug check for kmap_atomic_pfn " Akinobu Mita
2009-03-11 16:54   ` [tip:x86/mm] " Akinobu Mita
2009-03-11 15:08 ` [PATCH 1/2] x86: unify kmap_atomic_pfn() " Thomas Gleixner
2009-03-11 15:25   ` Akinobu Mita
2009-03-11 16:52     ` Ingo Molnar
2009-03-12  0:28       ` Akinobu Mita
2009-03-12 12:24         ` Ingo Molnar
2009-03-12 12:27           ` Ingo Molnar
2009-03-11 16:54 ` [tip:x86/mm] " Akinobu Mita
2009-03-13  1:39 ` [tip:x86/mm] x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn(), fix Ingo Molnar
2009-03-14  4:19   ` Akinobu Mita [this message]
2009-03-14  4:20     ` [PATCH -tip 2/2] mm: use debug_kmap_atomic Akinobu Mita
2009-03-14 13:15     ` [PATCH -tip 1/2] mm: introduce debug_kmap_atomic Ingo Molnar
2009-03-15 15:15       ` Akinobu Mita
2009-03-15 20:45         ` [tip:x86/mm] x86, mm: remove unnecessary include file from iomap_32.c Akinobu Mita
2009-03-23  0:23       ` [PATCH -tip 1/2] mm: introduce debug_kmap_atomic Andrew Morton
2009-03-24  6:21         ` Akinobu Mita

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090314041948.GA3697@localhost.localdomain \
    --to=akinobu.mita@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.