linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-arch@vger.kernel.org, Christoph Hellwig <hch@infradead.org>
Subject: [PATCH] mm,x86: fix kmap_atomic_push vs ioremap_32.c
Date: Wed, 27 Oct 2010 12:33:58 +0200	[thread overview]
Message-ID: <1288175638.15336.1538.camel@twins> (raw)
In-Reply-To: <849307$a582r7@azsmga001.ch.intel.com>

On Wed, 2010-10-27 at 11:27 +0100, Chris Wilson wrote:
> On Sat, 18 Sep 2010 17:53:26 +0200, Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> > Next version of the kmap_atomic rework using Andrew's fancy CPP trickery to
> > avoid having to convert the whole tree at once.
> > 
> > This is compile tested for i386-allmodconfig, frv, mips-sb1250-swarm,
> > powerpc-ppc6xx_defconfig, sparc32_defconfig, arm-omap3 (all with
> > HIGHEM=y).
> 
> This break on x86, HIGHMEM=n:
> 
> arch/x86/mm/iomap_32.c: In function a??kmap_atomic_prot_pfna??:
> arch/x86/mm/iomap_32.c:64: error: implicit declaration of function
> a??kmap_atomic_idx_pusha??
> arch/x86/mm/iomap_32.c: In function a??iounmap_atomica??:
> arch/x86/mm/iomap_32.c:101: error: implicit declaration of function
> a??kmap_atomic_idx_popa??

Christoph just complained about the same on IRC, the below seems to cure
things for i386-defconfig with CONFIG_HIGHMEM=n

---
Subject: mm,x86: fix kmap_atomic_push vs ioremap_32.c

It appears i386 uses kmap_atomic infrastructure regardless of
CONFIG_HIGHMEM which results in a compile error when highmem is
disabled.

Cure this by providing the needed few bits for both CONFIG_HIGHMEM and
CONFIG_X86_32.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 include/linux/highmem.h |   46 +++++++++++++++++++++++++---------------------
 mm/highmem.c            |    6 +++++-
 2 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 8a85ec1..102f76b 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -37,27 +37,6 @@ extern unsigned long totalhigh_pages;
 
 void kmap_flush_unused(void);
 
-DECLARE_PER_CPU(int, __kmap_atomic_idx);
-
-static inline int kmap_atomic_idx_push(void)
-{
-	int idx = __get_cpu_var(__kmap_atomic_idx)++;
-#ifdef CONFIG_DEBUG_HIGHMEM
-	WARN_ON_ONCE(in_irq() && !irqs_disabled());
-	BUG_ON(idx > KM_TYPE_NR);
-#endif
-	return idx;
-}
-
-static inline int kmap_atomic_idx_pop(void)
-{
-	int idx = --__get_cpu_var(__kmap_atomic_idx);
-#ifdef CONFIG_DEBUG_HIGHMEM
-	BUG_ON(idx < 0);
-#endif
-	return idx;
-}
-
 #else /* CONFIG_HIGHMEM */
 
 static inline unsigned int nr_free_highpages(void) { return 0; }
@@ -95,6 +74,31 @@ static inline void __kunmap_atomic(void *addr)
 
 #endif /* CONFIG_HIGHMEM */
 
+#if defined(CONFIG_HIGHMEM) || defined(CONFIG_X86_32)
+
+DECLARE_PER_CPU(int, __kmap_atomic_idx);
+
+static inline int kmap_atomic_idx_push(void)
+{
+	int idx = __get_cpu_var(__kmap_atomic_idx)++;
+#ifdef CONFIG_DEBUG_HIGHMEM
+	WARN_ON_ONCE(in_irq() && !irqs_disabled());
+	BUG_ON(idx > KM_TYPE_NR);
+#endif
+	return idx;
+}
+
+static inline int kmap_atomic_idx_pop(void)
+{
+	int idx = --__get_cpu_var(__kmap_atomic_idx);
+#ifdef CONFIG_DEBUG_HIGHMEM
+	BUG_ON(idx < 0);
+#endif
+	return idx;
+}
+
+#endif
+
 /*
  * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work.
  */
diff --git a/mm/highmem.c b/mm/highmem.c
index 781e754..693394d 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -29,6 +29,11 @@
 #include <linux/kgdb.h>
 #include <asm/tlbflush.h>
 
+
+#if defined(CONFIG_HIGHMEM) || defined(CONFIG_X86_32)
+DEFINE_PER_CPU(int, __kmap_atomic_idx);
+#endif
+
 /*
  * Virtual_count is not a pure "count".
  *  0 means that it is not mapped, and has not been mapped
@@ -43,7 +48,6 @@ unsigned long totalhigh_pages __read_mostly;
 EXPORT_SYMBOL(totalhigh_pages);
 
 
-DEFINE_PER_CPU(int, __kmap_atomic_idx);
 EXPORT_PER_CPU_SYMBOL(__kmap_atomic_idx);
 
 unsigned int nr_free_highpages (void)


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-10-27 10:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-18 15:53 [PATCH 0/5] mm, highmem: kmap_atomic rework -v3 Peter Zijlstra
2010-09-18 15:53 ` [PATCH 1/5] mm: strictly nested kmap_atomic Peter Zijlstra
2010-09-18 15:53 ` [PATCH 2/5] mm: stack based kmap_atomic Peter Zijlstra
2010-09-19 17:01   ` Linus Torvalds
2010-09-20  9:31     ` Peter Zijlstra
2010-09-18 15:53 ` [PATCH 3/5] mm: Remove pte_*map_nested() Peter Zijlstra
2010-09-18 15:53 ` [PATCH 4/5] perf, x86: Fix up kmap_atomic type Peter Zijlstra
2010-09-18 15:53 ` [PATCH 5/5] mm: highmem documentation Peter Zijlstra
2010-10-27 10:27 ` [PATCH 0/5] mm, highmem: kmap_atomic rework -v3 Chris Wilson
2010-10-27 10:33   ` Peter Zijlstra [this message]
2010-10-27 11:15     ` [PATCH] mm,x86: fix kmap_atomic_push vs ioremap_32.c Chris Wilson

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=1288175638.15336.1538.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=hch@infradead.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox