Re: [PATCH] trace: Add special x86 irq entry/exit tracepoints

From: Thomas Gleixner
Date: Thu Apr 28 2011 - 20:14:46 EST


On Fri, 22 Apr 2011, Vaibhav Nagarnaik wrote:
> #include <asm/perf_event.h>
> #include <asm/x86_init.h>
> @@ -857,7 +858,9 @@ void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
> */
> exit_idle();
> irq_enter();
> + trace_special_irq_entry(LOCAL_TIMER_VECTOR);

Gah. trace_special_irq is the worst name you could come up with. It's
tracing a vector which is nothing special and nothing x86 specific.

> #include <asm/vsyscall.h>
> #include <asm/x86_init.h>
> @@ -26,6 +27,8 @@
> volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES;
> #endif
>
> +static struct irqaction *irq0_action;
> +

Ouch! You need an extra pointer for that ? Moving the stupid irq0
struct up a few lines would do the trick as well, right ?

> --- a/include/trace/events/irq.h
> +++ b/include/trace/events/irq.h
> @@ -139,6 +139,74 @@ DEFINE_EVENT(softirq, softirq_raise,
> TP_ARGS(vec_nr)
> );
>
> +#ifdef CONFIG_X86
> +#include <asm/irq_vectors.h>
> +#define special_irq_name(sirq) { sirq, #sirq }
> +#define show_special_irq_name(val) \
> + __print_symbolic(val, \
> + special_irq_name(NMI_VECTOR), \
> + special_irq_name(LOCAL_TIMER_VECTOR), \
> + special_irq_name(ERROR_APIC_VECTOR), \
> + special_irq_name(RESCHEDULE_VECTOR), \
> + special_irq_name(CALL_FUNCTION_VECTOR), \
> + special_irq_name(CALL_FUNCTION_SINGLE_VECTOR), \
> + special_irq_name(THERMAL_APIC_VECTOR), \
> + special_irq_name(THRESHOLD_APIC_VECTOR), \
> + special_irq_name(REBOOT_VECTOR), \
> + special_irq_name(SPURIOUS_APIC_VECTOR), \
> + special_irq_name(IRQ_WORK_VECTOR), \
> + special_irq_name(X86_PLATFORM_IPI_VECTOR) \
> + )
> +
> +#define IS_INVALIDATE_TLB_VECTOR(__irq) (\
> + __irq >= INVALIDATE_TLB_VECTOR_START && \
> + __irq <= INVALIDATE_TLB_VECTOR_END)

No way, really.

Interrupt vectors are not x86 specific and they do no need any
architecture specific handling at all.

The symbolic printout is a nice to have extra, but it can be solved by
providing an arch specific lookup table which does not require any of
that #ifdef X86 mess. If the table does not exist, then you simply can
print the vector number and be done with it.

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/