Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: tracing: Avoid tracepoint duplication with DECLARE_EVENT_CLASS

irq_entry, irq_exit, timer_interrupt_entry and timer_interrupt_exit
all do the same thing so use DECLARE_EVENT_CLASS to avoid duplicating
everything 4 times.

This saves quite a lot of space in both instruction text and data:

text data bss dec hex filename
9265 19622 16 28903 70e7 arch/powerpc/kernel/irq.o
6817 19019 16 25852 64fc arch/powerpc/kernel/irq.o

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Anton Blanchard and committed by
Benjamin Herrenschmidt
d136e273 641bd53a

+11 -34
+11 -34
arch/powerpc/include/asm/trace.h
··· 8 8 9 9 struct pt_regs; 10 10 11 - TRACE_EVENT(irq_entry, 11 + DECLARE_EVENT_CLASS(ppc64_interrupt_class, 12 12 13 13 TP_PROTO(struct pt_regs *regs), 14 14 ··· 25 25 TP_printk("pt_regs=%p", __entry->regs) 26 26 ); 27 27 28 - TRACE_EVENT(irq_exit, 28 + DEFINE_EVENT(ppc64_interrupt_class, irq_entry, 29 29 30 30 TP_PROTO(struct pt_regs *regs), 31 31 32 - TP_ARGS(regs), 33 - 34 - TP_STRUCT__entry( 35 - __field(struct pt_regs *, regs) 36 - ), 37 - 38 - TP_fast_assign( 39 - __entry->regs = regs; 40 - ), 41 - 42 - TP_printk("pt_regs=%p", __entry->regs) 32 + TP_ARGS(regs) 43 33 ); 44 34 45 - TRACE_EVENT(timer_interrupt_entry, 35 + DEFINE_EVENT(ppc64_interrupt_class, irq_exit, 46 36 47 37 TP_PROTO(struct pt_regs *regs), 48 38 49 - TP_ARGS(regs), 50 - 51 - TP_STRUCT__entry( 52 - __field(struct pt_regs *, regs) 53 - ), 54 - 55 - TP_fast_assign( 56 - __entry->regs = regs; 57 - ), 58 - 59 - TP_printk("pt_regs=%p", __entry->regs) 39 + TP_ARGS(regs) 60 40 ); 61 41 62 - TRACE_EVENT(timer_interrupt_exit, 42 + DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_entry, 63 43 64 44 TP_PROTO(struct pt_regs *regs), 65 45 66 - TP_ARGS(regs), 46 + TP_ARGS(regs) 47 + ); 67 48 68 - TP_STRUCT__entry( 69 - __field(struct pt_regs *, regs) 70 - ), 49 + DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_exit, 71 50 72 - TP_fast_assign( 73 - __entry->regs = regs; 74 - ), 51 + TP_PROTO(struct pt_regs *regs), 75 52 76 - TP_printk("pt_regs=%p", __entry->regs) 53 + TP_ARGS(regs) 77 54 ); 78 55 79 56 #ifdef CONFIG_PPC_PSERIES