From: James Hogan <james.hogan@imgtec.com>
To: <linux-kernel@vger.kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>, James Hogan <james.hogan@imgtec.com>
Subject: [PATCH 5/5] metag: move irq enable out of irqflags.h on SMP
Date: Wed, 13 Feb 2013 12:03:49 +0000 [thread overview]
Message-ID: <1360757029-28868-6-git-send-email-james.hogan@imgtec.com> (raw)
In-Reply-To: <1360757029-28868-1-git-send-email-james.hogan@imgtec.com>
The SMP version of arch_local_irq_enable() uses preempt_disable(), but
<asm/irqflags.h> doesn't include <linux/preempt.h> causing the following
errors on SMP when pstore/ftrace is enabled (caught by buildbot smp
allyesconfig):
In file included from include/linux/irqflags.h:15,
from fs/pstore/ftrace.c:16:
arch/metag/include/asm/irqflags.h: In function 'arch_local_irq_enable':
arch/metag/include/asm/irqflags.h:84: error: implicit declaration of function 'preempt_disable'
arch/metag/include/asm/irqflags.h:86: error: implicit declaration of function 'preempt_enable_no_resched'
However <linux/preempt.h> cannot be easily included from
<asm/irqflags.h> as it can cause circular include dependencies in the
!SMP case, and potentially in the SMP case in the future. Therefore move
the SMP implementation of arch_local_irq_enable() into traps.c and use
an inline version of get_trigger_mask() which is also defined in traps.c
for SMP.
This adds an extra layer of function call / stack push when
preempt_disable needs to call other functions, however in the
non-preemptive SMP case it should be about as fast, as it was already
calling the get_trigger_mask() function which is now used inline.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/include/asm/irqflags.h | 11 +++++------
arch/metag/kernel/traps.c | 15 ++++++++++++++-
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/arch/metag/include/asm/irqflags.h b/arch/metag/include/asm/irqflags.h
index cba5e13..339b16f 100644
--- a/arch/metag/include/asm/irqflags.h
+++ b/arch/metag/include/asm/irqflags.h
@@ -78,16 +78,15 @@ static inline void arch_local_irq_disable(void)
asm volatile("MOV TXMASKI,%0\n" : : "r" (flags) : "memory");
}
-static inline void arch_local_irq_enable(void)
-{
#ifdef CONFIG_SMP
- preempt_disable();
- arch_local_irq_restore(get_trigger_mask());
- preempt_enable_no_resched();
+/* Avoid circular include dependencies through <linux/preempt.h> */
+void arch_local_irq_enable(void);
#else
+static inline void arch_local_irq_enable(void)
+{
arch_local_irq_restore(get_trigger_mask());
-#endif
}
+#endif
#endif /* (__ASSEMBLY__) */
diff --git a/arch/metag/kernel/traps.c b/arch/metag/kernel/traps.c
index 2808042..3f7764b 100644
--- a/arch/metag/kernel/traps.c
+++ b/arch/metag/kernel/traps.c
@@ -15,6 +15,7 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/interrupt.h>
+#include <linux/preempt.h>
#include <linux/ptrace.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
@@ -776,17 +777,29 @@ int traps_restore_context(void)
#endif
#ifdef CONFIG_SMP
-unsigned int get_trigger_mask(void)
+static inline unsigned int _get_trigger_mask(void)
{
unsigned long cpu = smp_processor_id();
return per_cpu(trigger_mask, cpu);
}
+unsigned int get_trigger_mask(void)
+{
+ return _get_trigger_mask();
+}
+
static void set_trigger_mask(unsigned int mask)
{
unsigned long cpu = smp_processor_id();
per_cpu(trigger_mask, cpu) = mask;
}
+
+void arch_local_irq_enable(void)
+{
+ preempt_disable();
+ arch_local_irq_restore(_get_trigger_mask());
+ preempt_enable_no_resched();
+}
#else
static void set_trigger_mask(unsigned int mask)
{
--
1.7.7.6
prev parent reply other threads:[~2013-02-13 12:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 12:03 [PATCH 0/5] metag: second set of misc patches for v3.9 James Hogan
2013-02-13 12:03 ` [PATCH 1/5] metag: export metag_code_cache_flush_all James Hogan
2013-02-13 12:03 ` [PATCH 2/5] metag: export clear_page and copy_page James Hogan
2013-02-13 12:03 ` [PATCH 3/5] metag: hugetlb: convert to vm_unmapped_area() James Hogan
2013-02-15 8:04 ` Michel Lespinasse
2013-02-15 9:26 ` James Hogan
2013-02-13 12:03 ` [PATCH 4/5] genksyms: fix metag symbol prefix on crc symbols James Hogan
2013-02-13 12:03 ` James Hogan [this message]
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=1360757029-28868-6-git-send-email-james.hogan@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).