From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751898AbdG0QTl (ORCPT ); Thu, 27 Jul 2017 12:19:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:57394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751784AbdG0QTi (ORCPT ); Thu, 27 Jul 2017 12:19:38 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1761F21448 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: Ingo Molnar , Thomas Gleixner Cc: Francis Deslauriers , mathieu.desnoyers@efficios.com, Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, Masami Hiramatsu , Ananth N Mavinakayanahalli , Anil S Keshavamurthy , "David S . Miller" , 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 Message-Id: <150117231747.27132.4997655262896089325.stgit@devbox> X-Mailer: git-send-email 2.13.3 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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.