Re: [PATCH v3 4/7] arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections

From: Steven Rostedt
Date: Fri Feb 26 2016 - 12:45:40 EST


On Fri, 26 Feb 2016 14:30:43 +0100
Alexander Potapenko <glider@xxxxxxxxxx> wrote:

> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index c2b340e..4da848d 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -799,16 +799,6 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
> */
> #define __notrace_funcgraph notrace
>
> -/*
> - * We want to which function is an entrypoint of a hardirq.
> - * That will help us to put a signal on output.
> - */
> -#define __irq_entry __attribute__((__section__(".irqentry.text")))
> -
> -/* Limits of hardirq entrypoints */
> -extern char __irqentry_text_start[];
> -extern char __irqentry_text_end[];
> -
> #define FTRACE_NOTRACE_DEPTH 65536
> #define FTRACE_RETFUNC_DEPTH 50
> #define FTRACE_RETSTACK_ALLOC_SIZE 32
> @@ -845,7 +835,6 @@ static inline void unpause_graph_tracing(void)
> #else /* !CONFIG_FUNCTION_GRAPH_TRACER */
>
> #define __notrace_funcgraph
> -#define __irq_entry
> #define INIT_FTRACE_GRAPH
>
> static inline void ftrace_graph_init_task(struct task_struct *t) { }
> diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
> index 0e95fcc..1dcecaf 100644
> --- a/include/linux/interrupt.h
> +++ b/include/linux/interrupt.h
> @@ -673,4 +673,24 @@ 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)
> +/*
> + * We want to know which function is an entrypoint of a hardirq or a softirq.
> + */
> +#define __irq_entry __attribute__((__section__(".irqentry.text")))
> +#define __softirq_entry \
> + __attribute__((__section__(".softirqentry.text")))
> +
> +/* Limits of hardirq entrypoints */
> +extern char __irqentry_text_start[];
> +extern char __irqentry_text_end[];
> +/* Limits of softirq entrypoints */
> +extern char __softirqentry_text_start[];
> +extern char __softirqentry_text_end[];
> +
> +#else
> +#define __irq_entry
> +#define __softirq_entry
> +#endif
> +
> #endif
> diff --git a/kernel/softirq.c b/kernel/softirq.c

Acked-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

-- Steve