From: Masami Hiramatsu <mhiramat@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Francis Deslauriers <francis.deslauriers@efficios.com>,
mathieu.desnoyers@efficios.com, Ingo Molnar <mingo@redhat.com>,
"H . Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Masami Hiramatsu <mhiramat@kernel.org>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
"David S . Miller" <davem@davemloft.net>,
linux-kernel@vger.kernel.org
Subject: [PATCH -tip v5 1/2] irq: Introduce CONFIG_IRQENTRY kconfig
Date: Fri, 28 Jul 2017 01:18:48 +0900 [thread overview]
Message-ID: <150117231747.27132.4997655262896089325.stgit@devbox> (raw)
Introduce CONFIG_IRQENTRY to simplify generating
irqentry and softirqentry text sections.
Currently generating those sections depends on
CONFIG_FUNCTION_GRAPH_TRACER and/or CONFIG_KASAN, in
each source code. This moves those #ifdef dependencies
into Kconfig, instead of the actual code. This makes
it scalable for other user of irqentry section.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
arch/arm/include/asm/traps.h | 2 +-
arch/arm64/include/asm/traps.h | 2 +-
arch/x86/entry/entry_64.S | 2 +-
include/asm-generic/vmlinux.lds.h | 4 ++--
include/linux/interrupt.h | 2 +-
kernel/irq/Kconfig | 4 ++++
kernel/trace/Kconfig | 1 +
lib/Kconfig.kasan | 1 +
8 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h
index f555bb3664dc..6a768d61d15e 100644
--- a/arch/arm/include/asm/traps.h
+++ b/arch/arm/include/asm/traps.h
@@ -18,7 +18,7 @@ struct undef_hook {
void register_undef_hook(struct undef_hook *hook);
void unregister_undef_hook(struct undef_hook *hook);
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+#ifdef CONFIG_IRQENTRY
static inline int __in_irqentry_text(unsigned long ptr)
{
extern char __irqentry_text_start[];
diff --git a/arch/arm64/include/asm/traps.h b/arch/arm64/include/asm/traps.h
index 02e9035b0685..24eafb139902 100644
--- a/arch/arm64/include/asm/traps.h
+++ b/arch/arm64/include/asm/traps.h
@@ -37,7 +37,7 @@ void unregister_undef_hook(struct undef_hook *hook);
void arm64_notify_segfault(struct pt_regs *regs, unsigned long addr);
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+#ifdef CONFIG_IRQENTRY
static inline int __in_irqentry_text(unsigned long ptr)
{
return ptr >= (unsigned long)&__irqentry_text_start &&
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index aa58155187c5..5300372fadc9 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -766,7 +766,7 @@ apicinterrupt3 \num trace(\sym) smp_trace(\sym)
#endif
/* Make sure APIC interrupt handlers end up in the irqentry section: */
-#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
+#ifdef CONFIG_IRQENTRY
# define PUSH_SECTION_IRQENTRY .pushsection .irqentry.text, "ax"
# define POP_SECTION_IRQENTRY .popsection
#else
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index fffc9bdae025..a45712768f97 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -483,7 +483,7 @@
*(.entry.text) \
VMLINUX_SYMBOL(__entry_text_end) = .;
-#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
+#ifdef CONFIG_IRQENTRY
#define IRQENTRY_TEXT \
ALIGN_FUNCTION(); \
VMLINUX_SYMBOL(__irqentry_text_start) = .; \
@@ -493,7 +493,7 @@
#define IRQENTRY_TEXT
#endif
-#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
+#ifdef CONFIG_IRQENTRY
#define SOFTIRQENTRY_TEXT \
ALIGN_FUNCTION(); \
VMLINUX_SYMBOL(__softirqentry_text_start) = .; \
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index a2fddddb0d60..6adad995d8fd 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -726,7 +726,7 @@ extern int early_irq_init(void);
extern int arch_probe_nr_irqs(void);
extern int arch_early_irq_init(void);
-#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
+#ifdef CONFIG_IRQENTRY
/*
* We want to know which function is an entrypoint of a hardirq or a softirq.
*/
diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig
index 27c4e774071c..fd4a69c28700 100644
--- a/kernel/irq/Kconfig
+++ b/kernel/irq/Kconfig
@@ -126,4 +126,8 @@ config GENERIC_IRQ_DEBUGFS
If you don't know what to do here, say N.
+# Generate irqentry and softirqentry text sections
+config IRQENTRY
+ bool
+
endmenu
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 434c840e2d82..2556a7ca8cdc 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -150,6 +150,7 @@ config FUNCTION_GRAPH_TRACER
depends on HAVE_FUNCTION_GRAPH_TRACER
depends on FUNCTION_TRACER
depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE
+ select IRQENTRY
default y
help
Enable the kernel to trace a function at both its return
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index bd38aab05929..09daa0d505e6 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -8,6 +8,7 @@ config KASAN
depends on SLUB || (SLAB && !DEBUG_SLAB)
select CONSTRUCTORS
select STACKDEPOT
+ select IRQENTRY
help
Enables kernel address sanitizer - runtime memory debugger,
designed to find out-of-bounds accesses and use-after-free bugs.
next reply other threads:[~2017-07-27 16:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-27 16:18 Masami Hiramatsu [this message]
2017-07-27 16:19 ` [PATCH -tip v5 2/2] [BUGFIX] kprobes/x86: Do not jump-optimize kprobes on irq entry code Masami Hiramatsu
2017-07-28 6:36 ` [PATCH -tip v5 1/2] irq: Introduce CONFIG_IRQENTRY kconfig Ingo Molnar
2017-07-28 9:07 ` Masami Hiramatsu
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=150117231747.27132.4997655262896089325.stgit@devbox \
--to=mhiramat@kernel.org \
--cc=ananth@in.ibm.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=davem@davemloft.net \
--cc=francis.deslauriers@efficios.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@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
Powered by JetHome