From f127e61ee231d002fb9a7803643a157e06f6d2e2 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 11 Nov 2014 14:54:12 -0500 Subject: [PATCH] Migrate tracepoint instrumentation to TP_FIELDS At this stage syscall instrumentation is disabled. Will come in a following commit. Signed-off-by: Mathieu Desnoyers --- Makefile | 9 +- filter-bytecode.h | 4 + .../lttng-module/arch/x86/kvm/mmutrace.h | 207 +- .../events/lttng-module/arch/x86/kvm/trace.h | 735 ++--- instrumentation/events/lttng-module/asoc.h | 250 +- instrumentation/events/lttng-module/block.h | 629 ++-- instrumentation/events/lttng-module/btrfs.h | 954 ++---- .../events/lttng-module/compaction.h | 106 +- instrumentation/events/lttng-module/ext3.h | 761 ++--- instrumentation/events/lttng-module/ext4.h | 2652 ++++------------- instrumentation/events/lttng-module/gpio.h | 38 +- instrumentation/events/lttng-module/irq.h | 71 +- instrumentation/events/lttng-module/jbd.h | 181 +- instrumentation/events/lttng-module/jbd2.h | 198 +- instrumentation/events/lttng-module/kmem.h | 239 +- instrumentation/events/lttng-module/kvm.h | 271 +- instrumentation/events/lttng-module/lock.h | 118 +- .../events/lttng-module/lttng-statedump.h | 145 +- instrumentation/events/lttng-module/lttng.h | 10 +- .../events/lttng-module/mm_vmscan.h | 407 +-- instrumentation/events/lttng-module/module.h | 69 +- instrumentation/events/lttng-module/napi.h | 16 +- instrumentation/events/lttng-module/net.h | 52 +- instrumentation/events/lttng-module/power.h | 130 +- instrumentation/events/lttng-module/printk.h | 51 +- instrumentation/events/lttng-module/random.h | 84 +- instrumentation/events/lttng-module/rcu.h | 441 +-- instrumentation/events/lttng-module/regmap.h | 75 +- .../events/lttng-module/regulator.h | 48 +- instrumentation/events/lttng-module/rpc.h | 108 +- instrumentation/events/lttng-module/rpm.h | 64 +- instrumentation/events/lttng-module/sched.h | 318 +- instrumentation/events/lttng-module/scsi.h | 190 +- instrumentation/events/lttng-module/signal.h | 107 +- instrumentation/events/lttng-module/skb.h | 46 +- instrumentation/events/lttng-module/sock.h | 51 +- instrumentation/events/lttng-module/timer.h | 181 +- instrumentation/events/lttng-module/udp.h | 15 +- instrumentation/events/lttng-module/v4l2.h | 161 +- .../events/lttng-module/workqueue.h | 100 +- .../events/lttng-module/writeback.h | 551 +--- lib/ringbuffer/backend.h | 2 +- lttng-abi.c | 45 + lttng-abi.h | 2 +- lttng-context-hostname.c | 23 + lttng-context-nice.c | 8 + lttng-context-pid.c | 8 + lttng-context-ppid.c | 22 +- lttng-context-prio.c | 8 + lttng-context-procname.c | 8 + lttng-context-tid.c | 11 + lttng-context-vppid.c | 31 + lttng-context-vtid.c | 17 + lttng-context.c | 27 +- lttng-events.c | 10 +- lttng-events.h | 16 +- lttng-filter-interpreter.c | 193 +- lttng-filter-specialize.c | 2 + lttng-filter-validator.c | 6 + lttng-filter.c | 19 +- lttng-filter.h | 2 + probes/define_trace.h | 57 +- probes/lttng-events-reset.h | 195 +- probes/lttng-events.h | 1046 +++---- probes/lttng-probe-user.c | 5 + probes/lttng-tracepoint-event.h | 30 +- 66 files changed, 3694 insertions(+), 8942 deletions(-) diff --git a/Makefile b/Makefile index 1234519a..35d765e0 100644 --- a/Makefile +++ b/Makefile @@ -39,15 +39,16 @@ lttng-tracer-objs := lttng-events.o lttng-abi.o \ lttng-tracker-pid.o \ lttng-filter.o lttng-filter-interpreter.o \ lttng-filter-specialize.o \ - lttng-filter-validator.o + lttng-filter-validator.o \ + probes/lttng-probe-user.o obj-m += lttng-statedump.o lttng-statedump-objs := lttng-statedump-impl.o wrapper/irqdesc.o \ wrapper/fdtable.o -ifneq ($(CONFIG_HAVE_SYSCALL_TRACEPOINTS),) -lttng-tracer-objs += lttng-syscalls.o probes/lttng-probe-user.o -endif # CONFIG_HAVE_SYSCALL_TRACEPOINTS +#ifneq ($(CONFIG_HAVE_SYSCALL_TRACEPOINTS),) +#lttng-tracer-objs += lttng-syscalls.o +#endif # CONFIG_HAVE_SYSCALL_TRACEPOINTS ifneq ($(CONFIG_PERF_EVENTS),) lttng-tracer-objs += $(shell \ diff --git a/filter-bytecode.h b/filter-bytecode.h index eb0d549c..05bd0dca 100644 --- a/filter-bytecode.h +++ b/filter-bytecode.h @@ -145,6 +145,10 @@ enum filter_op { FILTER_OP_GET_CONTEXT_REF_S64, FILTER_OP_GET_CONTEXT_REF_DOUBLE, + /* load userspace field ref */ + FILTER_OP_LOAD_FIELD_REF_USER_STRING, + FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE, + NR_FILTER_OPS, }; diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h index a76f059c..a71b2a1a 100644 --- a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h +++ b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h @@ -7,47 +7,11 @@ #undef TRACE_SYSTEM #define TRACE_SYSTEM kvm_mmu -#define KVM_MMU_PAGE_FIELDS \ - __field(__u64, gfn) \ - __field(__u32, role) \ - __field(__u32, root_count) \ - __field(bool, unsync) - -#define KVM_MMU_PAGE_ASSIGN(sp) \ - tp_assign(gfn, sp->gfn) \ - tp_assign(role, sp->role.word) \ - tp_assign(root_count, sp->root_count) \ - tp_assign(unsync, sp->unsync) - -#define KVM_MMU_PAGE_PRINTK() ({ \ - const char *ret = p->buffer + p->len; \ - static const char *access_str[] = { \ - "---", "--x", "w--", "w-x", "-u-", "-ux", "wu-", "wux" \ - }; \ - union kvm_mmu_page_role role; \ - \ - role.word = __entry->role; \ - \ - trace_seq_printf(p, "sp gfn %llx %u%s q%u%s %s%s" \ - " %snxe root %u %s%c", \ - __entry->gfn, role.level, \ - role.cr4_pae ? " pae" : "", \ - role.quadrant, \ - role.direct ? " direct" : "", \ - access_str[role.access], \ - role.invalid ? " invalid" : "", \ - role.nxe ? "" : "!", \ - __entry->root_count, \ - __entry->unsync ? "unsync" : "sync", 0); \ - ret; \ - }) - -#define kvm_mmu_trace_pferr_flags \ - { PFERR_PRESENT_MASK, "P" }, \ - { PFERR_WRITE_MASK, "W" }, \ - { PFERR_USER_MASK, "U" }, \ - { PFERR_RSVD_MASK, "RSVD" }, \ - { PFERR_FETCH_MASK, "F" } +#define LTTNG_KVM_MMU_PAGE_FIELDS \ + ctf_integer(__u64, gfn, (sp)->gfn) \ + ctf_integer(__u32, role, (sp)->role.word) \ + ctf_integer(__u32, root_count, (sp)->root_count) \ + ctf_integer(bool, unsync, (sp)->unsync) /* * A pagetable walk has started @@ -57,18 +21,10 @@ LTTNG_TRACEPOINT_EVENT( TP_PROTO(u64 addr, u32 pferr), TP_ARGS(addr, pferr), - TP_STRUCT__entry( - __field(__u64, addr) - __field(__u32, pferr) - ), - - TP_fast_assign( - tp_assign(addr, addr) - tp_assign(pferr, pferr) - ), - - TP_printk("addr %llx pferr %x %s", __entry->addr, __entry->pferr, - __print_flags(__entry->pferr, "|", kvm_mmu_trace_pferr_flags)) + TP_FIELDS( + ctf_integer(__u64, addr, addr) + ctf_integer(__u32, pferr, pferr) + ) ) @@ -78,17 +34,10 @@ LTTNG_TRACEPOINT_EVENT( TP_PROTO(u64 pte, int level), TP_ARGS(pte, level), - TP_STRUCT__entry( - __field(__u64, pte) - __field(__u32, level) - ), - - TP_fast_assign( - tp_assign(pte, pte) - tp_assign(level, level) - ), - - TP_printk("pte %llx level %u", __entry->pte, __entry->level) + TP_FIELDS( + ctf_integer(__u64, pte, pte) + ctf_integer(__u32, level, level) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(kvm_mmu_set_bit_class, @@ -97,16 +46,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kvm_mmu_set_bit_class, TP_ARGS(table_gfn, index, size), - TP_STRUCT__entry( - __field(__u64, gpa) - ), - - TP_fast_assign( - tp_assign(gpa, ((u64)table_gfn << PAGE_SHIFT) - + index * size) - ), - - TP_printk("gpa %llx", __entry->gpa) + TP_FIELDS( + ctf_integer(__u64, gpa, + ((u64)table_gfn << PAGE_SHIFT) + index * size) + ) ) /* We set a pte accessed bit */ @@ -130,16 +73,9 @@ LTTNG_TRACEPOINT_EVENT( TP_PROTO(u32 pferr), TP_ARGS(pferr), - TP_STRUCT__entry( - __field(__u32, pferr) - ), - - TP_fast_assign( - tp_assign(pferr, pferr) - ), - - TP_printk("pferr %x %s", __entry->pferr, - __print_flags(__entry->pferr, "|", kvm_mmu_trace_pferr_flags)) + TP_FIELDS( + ctf_integer(__u32, pferr, pferr) + ) ) LTTNG_TRACEPOINT_EVENT( @@ -147,18 +83,10 @@ LTTNG_TRACEPOINT_EVENT( TP_PROTO(struct kvm_mmu_page *sp, bool created), TP_ARGS(sp, created), - TP_STRUCT__entry( - KVM_MMU_PAGE_FIELDS - __field(bool, created) - ), - - TP_fast_assign( - KVM_MMU_PAGE_ASSIGN(sp) - tp_assign(created, created) - ), - - TP_printk("%s %s", KVM_MMU_PAGE_PRINTK(), - __entry->created ? "new" : "existing") + TP_FIELDS( + LTTNG_KVM_MMU_PAGE_FIELDS + ctf_integer(bool, created, created) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(kvm_mmu_page_class, @@ -166,15 +94,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kvm_mmu_page_class, TP_PROTO(struct kvm_mmu_page *sp), TP_ARGS(sp), - TP_STRUCT__entry( - KVM_MMU_PAGE_FIELDS - ), - - TP_fast_assign( - KVM_MMU_PAGE_ASSIGN(sp) - ), - - TP_printk("%s", KVM_MMU_PAGE_PRINTK()) + TP_FIELDS( + LTTNG_KVM_MMU_PAGE_FIELDS + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_sync_page, @@ -203,20 +125,11 @@ LTTNG_TRACEPOINT_EVENT_MAP( TP_PROTO(u64 *sptep, gfn_t gfn, unsigned access), TP_ARGS(sptep, gfn, access), - TP_STRUCT__entry( - __field(void *, sptep) - __field(gfn_t, gfn) - __field(unsigned, access) - ), - - TP_fast_assign( - tp_assign(sptep, sptep) - tp_assign(gfn, gfn) - tp_assign(access, access) - ), - - TP_printk("sptep:%p gfn %llx access %x", __entry->sptep, __entry->gfn, - __entry->access) + TP_FIELDS( + ctf_integer(void *, sptep, sptep) + ctf_integer(gfn_t, gfn, gfn) + ctf_integer(unsigned, access, access) + ) ) LTTNG_TRACEPOINT_EVENT_MAP( @@ -227,25 +140,13 @@ LTTNG_TRACEPOINT_EVENT_MAP( TP_PROTO(u64 addr, gfn_t gfn, unsigned access), TP_ARGS(addr, gfn, access), - TP_STRUCT__entry( - __field(u64, addr) - __field(gfn_t, gfn) - __field(unsigned, access) - ), - - TP_fast_assign( - tp_assign(addr, addr) - tp_assign(gfn, gfn) - tp_assign(access, access) - ), - - TP_printk("addr:%llx gfn %llx access %x", __entry->addr, __entry->gfn, - __entry->access) + TP_FIELDS( + ctf_integer(u64, addr, addr) + ctf_integer(gfn_t, gfn, gfn) + ctf_integer(unsigned, access, access) + ) ) -#define __spte_satisfied(__spte) \ - (__entry->retry && is_writable_pte(__entry->__spte)) - LTTNG_TRACEPOINT_EVENT_MAP( fast_page_fault, @@ -255,32 +156,14 @@ LTTNG_TRACEPOINT_EVENT_MAP( u64 *sptep, u64 old_spte, bool retry), TP_ARGS(vcpu, gva, error_code, sptep, old_spte, retry), - TP_STRUCT__entry( - __field(int, vcpu_id) - __field(gva_t, gva) - __field(u32, error_code) - __field(u64 *, sptep) - __field(u64, old_spte) - __field(u64, new_spte) - __field(bool, retry) - ), - - TP_fast_assign( - tp_assign(vcpu_id, vcpu->vcpu_id) - tp_assign(gva, gva) - tp_assign(error_code, error_code) - tp_assign(sptep, sptep) - tp_assign(old_spte, old_spte) - tp_assign(new_spte, *sptep) - tp_assign(retry, retry) - ), - - TP_printk("vcpu %d gva %lx error_code %s sptep %p old %#llx" - " new %llx spurious %d fixed %d", __entry->vcpu_id, - __entry->gva, __print_flags(__entry->error_code, "|", - kvm_mmu_trace_pferr_flags), __entry->sptep, - __entry->old_spte, __entry->new_spte, - __spte_satisfied(old_spte), __spte_satisfied(new_spte) + TP_FIELDS( + ctf_integer(int, vcpu_id, vcpu->vcpu_id) + ctf_integer(gva_t, gva, gva) + ctf_integer(u32, error_code, error_code) + ctf_integer(u64 *, sptep, sptep) + ctf_integer(u64, old_spte, old_spte) + ctf_integer(u64, new_spte, *sptep) + ctf_integer(bool, retry, retry) ) ) #endif /* LTTNG_TRACE_KVM_MMU_H */ diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/trace.h b/instrumentation/events/lttng-module/arch/x86/kvm/trace.h index 56b2e093..32c4743e 100644 --- a/instrumentation/events/lttng-module/arch/x86/kvm/trace.h +++ b/instrumentation/events/lttng-module/arch/x86/kvm/trace.h @@ -21,15 +21,9 @@ LTTNG_TRACEPOINT_EVENT(kvm_entry, TP_PROTO(unsigned int vcpu_id), TP_ARGS(vcpu_id), - TP_STRUCT__entry( - __field( unsigned int, vcpu_id ) - ), - - TP_fast_assign( - tp_assign(vcpu_id, vcpu_id) - ), - - TP_printk("vcpu %u", __entry->vcpu_id) + TP_FIELDS( + ctf_integer(unsigned int, vcpu_id, vcpu_id) + ) ) /* @@ -40,25 +34,13 @@ LTTNG_TRACEPOINT_EVENT(kvm_hypercall, unsigned long a2, unsigned long a3), TP_ARGS(nr, a0, a1, a2, a3), - TP_STRUCT__entry( - __field( unsigned long, nr ) - __field( unsigned long, a0 ) - __field( unsigned long, a1 ) - __field( unsigned long, a2 ) - __field( unsigned long, a3 ) - ), - - TP_fast_assign( - tp_assign(nr, nr) - tp_assign(a0, a0) - tp_assign(a1, a1) - tp_assign(a2, a2) - tp_assign(a3, a3) - ), - - TP_printk("nr 0x%lx a0 0x%lx a1 0x%lx a2 0x%lx a3 0x%lx", - __entry->nr, __entry->a0, __entry->a1, __entry->a2, - __entry->a3) + TP_FIELDS( + ctf_integer(unsigned long, nr, nr) + ctf_integer(unsigned long, a0, a0) + ctf_integer(unsigned long, a1, a1) + ctf_integer(unsigned long, a2, a2) + ctf_integer(unsigned long, a3, a3) + ) ) /* @@ -69,28 +51,14 @@ LTTNG_TRACEPOINT_EVENT(kvm_hv_hypercall, __u64 ingpa, __u64 outgpa), TP_ARGS(code, fast, rep_cnt, rep_idx, ingpa, outgpa), - TP_STRUCT__entry( - __field( __u16, rep_cnt ) - __field( __u16, rep_idx ) - __field( __u64, ingpa ) - __field( __u64, outgpa ) - __field( __u16, code ) - __field( bool, fast ) - ), - - TP_fast_assign( - tp_assign(rep_cnt, rep_cnt) - tp_assign(rep_idx, rep_idx) - tp_assign(ingpa, ingpa) - tp_assign(outgpa, outgpa) - tp_assign(code, code) - tp_assign(fast, fast) - ), - - TP_printk("code 0x%x %s cnt 0x%x idx 0x%x in 0x%llx out 0x%llx", - __entry->code, __entry->fast ? "fast" : "slow", - __entry->rep_cnt, __entry->rep_idx, __entry->ingpa, - __entry->outgpa) + TP_FIELDS( + ctf_integer(__u16, rep_cnt, rep_cnt) + ctf_integer(__u16, rep_idx, rep_idx) + ctf_integer(__u64, ingpa, ingpa) + ctf_integer(__u64, outgpa, outgpa) + ctf_integer(__u16, code, code) + ctf_integer(bool, fast, fast) + ) ) /* @@ -101,23 +69,12 @@ LTTNG_TRACEPOINT_EVENT(kvm_pio, unsigned int count), TP_ARGS(rw, port, size, count), - TP_STRUCT__entry( - __field( unsigned int, rw ) - __field( unsigned int, port ) - __field( unsigned int, size ) - __field( unsigned int, count ) - ), - - TP_fast_assign( - tp_assign(rw, rw) - tp_assign(port, port) - tp_assign(size, size) - tp_assign(count, count) - ), - - TP_printk("pio_%s at 0x%x size %d count %d", - __entry->rw ? "write" : "read", - __entry->port, __entry->size, __entry->count) + TP_FIELDS( + ctf_integer(unsigned int, rw, rw) + ctf_integer(unsigned int, port, port) + ctf_integer(unsigned int, size, size) + ctf_integer(unsigned int, count, count) + ) ) /* @@ -128,36 +85,15 @@ LTTNG_TRACEPOINT_EVENT(kvm_cpuid, unsigned long rcx, unsigned long rdx), TP_ARGS(function, rax, rbx, rcx, rdx), - TP_STRUCT__entry( - __field( unsigned int, function ) - __field( unsigned long, rax ) - __field( unsigned long, rbx ) - __field( unsigned long, rcx ) - __field( unsigned long, rdx ) - ), - - TP_fast_assign( - tp_assign(function, function) - tp_assign(rax, rax) - tp_assign(rbx, rbx) - tp_assign(rcx, rcx) - tp_assign(rdx, rdx) - ), - - TP_printk("func %x rax %lx rbx %lx rcx %lx rdx %lx", - __entry->function, __entry->rax, - __entry->rbx, __entry->rcx, __entry->rdx) + TP_FIELDS( + ctf_integer(unsigned int, function, function) + ctf_integer(unsigned long, rax, rax) + ctf_integer(unsigned long, rbx, rbx) + ctf_integer(unsigned long, rcx, rcx) + ctf_integer(unsigned long, rdx, rdx) + ) ) -#define AREG(x) { APIC_##x, "APIC_" #x } - -#define kvm_trace_symbol_apic \ - AREG(ID), AREG(LVR), AREG(TASKPRI), AREG(ARBPRI), AREG(PROCPRI), \ - AREG(EOI), AREG(RRR), AREG(LDR), AREG(DFR), AREG(SPIV), AREG(ISR), \ - AREG(TMR), AREG(IRR), AREG(ESR), AREG(ICR), AREG(ICR2), AREG(LVTT), \ - AREG(LVTTHMR), AREG(LVTPC), AREG(LVT0), AREG(LVT1), AREG(LVTERR), \ - AREG(TMICT), AREG(TMCCT), AREG(TDCR), AREG(SELF_IPI), AREG(EFEAT), \ - AREG(ECTRL) /* * Tracepoint for apic access. */ @@ -165,60 +101,39 @@ LTTNG_TRACEPOINT_EVENT(kvm_apic, TP_PROTO(unsigned int rw, unsigned int reg, unsigned int val), TP_ARGS(rw, reg, val), - TP_STRUCT__entry( - __field( unsigned int, rw ) - __field( unsigned int, reg ) - __field( unsigned int, val ) - ), - - TP_fast_assign( - tp_assign(rw, rw) - tp_assign(reg, reg) - tp_assign(val, val) - ), - - TP_printk("apic_%s %s = 0x%x", - __entry->rw ? "write" : "read", - __print_symbolic(__entry->reg, kvm_trace_symbol_apic), - __entry->val) + TP_FIELDS( + ctf_integer(unsigned int, rw, rw) + ctf_integer(unsigned int, reg, reg) + ctf_integer(unsigned int, val, val) + ) ) #define trace_kvm_apic_read(reg, val) trace_kvm_apic(0, reg, val) #define trace_kvm_apic_write(reg, val) trace_kvm_apic(1, reg, val) -#define KVM_ISA_VMX 1 -#define KVM_ISA_SVM 2 - /* * Tracepoint for kvm guest exit: */ -LTTNG_TRACEPOINT_EVENT(kvm_exit, - TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa, u64 info1, u64 info2), - TP_ARGS(exit_reason, vcpu, isa, info1, info2), - - TP_STRUCT__entry( - __field( unsigned int, exit_reason ) - __field( unsigned long, guest_rip ) - __field( u32, isa ) - __field( u64, info1 ) - __field( u64, info2 ) +LTTNG_TRACEPOINT_EVENT_CODE(kvm_exit, + TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa), + TP_ARGS(exit_reason, vcpu, isa), + + TP_locvar( + u64 info1, info2; ), - TP_fast_assign( - tp_assign(exit_reason, exit_reason) - tp_assign(guest_rip, kvm_rip_read(vcpu)) - tp_assign(isa, isa) - kvm_x86_ops->get_exit_info(vcpu, &info1, - &info2); - tp_assign(info1, info1) - tp_assign(info2, info2) + TP_code( + kvm_x86_ops->get_exit_info(vcpu, &tp_locvar->info1, + &tp_locvar->info2); ), - TP_printk("reason %s rip info %llx %llx", - (__entry->isa == KVM_ISA_VMX) ? - __print_symbolic(__entry->exit_reason, VMX_EXIT_REASONS) : - __print_symbolic(__entry->exit_reason, SVM_EXIT_REASONS), - /* __entry->guest_rip,*/ __entry->info1, __entry->info2) + TP_FIELDS( + ctf_integer(unsigned int, exit_reason, exit_reason) + ctf_integer(unsigned long, guest_rip, kvm_rip_read(vcpu)) + ctf_integer(u32, isa, isa) + ctf_integer(u64, info1, tp_locvar->info1) + ctf_integer(u64, info2, tp_locvar->info2) + ) ) /* @@ -228,24 +143,11 @@ LTTNG_TRACEPOINT_EVENT(kvm_inj_virq, TP_PROTO(unsigned int irq), TP_ARGS(irq), - TP_STRUCT__entry( - __field( unsigned int, irq ) - ), - - TP_fast_assign( - tp_assign(irq, irq) - ), - - TP_printk("irq %u", __entry->irq) + TP_FIELDS( + ctf_integer(unsigned int, irq, irq) + ) ) -#define EXS(x) { x##_VECTOR, "#" #x } - -#define kvm_trace_sym_exc \ - EXS(DE), EXS(DB), EXS(BP), EXS(OF), EXS(BR), EXS(UD), EXS(NM), \ - EXS(DF), EXS(TS), EXS(NP), EXS(SS), EXS(GP), EXS(PF), \ - EXS(MF), EXS(MC) - /* * Tracepoint for kvm interrupt injection: */ @@ -253,22 +155,11 @@ LTTNG_TRACEPOINT_EVENT(kvm_inj_exception, TP_PROTO(unsigned exception, bool has_error, unsigned error_code), TP_ARGS(exception, has_error, error_code), - TP_STRUCT__entry( - __field( u8, exception ) - __field( u8, has_error ) - __field( u32, error_code ) - ), - - TP_fast_assign( - tp_assign(exception, exception) - tp_assign(has_error, has_error) - tp_assign(error_code, error_code) - ), - - TP_printk("%s (0x%x)", - __print_symbolic(__entry->exception, kvm_trace_sym_exc), - /* FIXME: don't print error_code if not present */ - __entry->has_error ? __entry->error_code : 0) + TP_FIELDS( + ctf_integer(u8, exception, exception) + ctf_integer(u8, has_error, has_error) + ctf_integer(u32, error_code, error_code) + ) ) /* @@ -278,18 +169,10 @@ LTTNG_TRACEPOINT_EVENT(kvm_page_fault, TP_PROTO(unsigned long fault_address, unsigned int error_code), TP_ARGS(fault_address, error_code), - TP_STRUCT__entry( - __field( unsigned long, fault_address ) - __field( unsigned int, error_code ) - ), - - TP_fast_assign( - tp_assign(fault_address, fault_address) - tp_assign(error_code, error_code) - ), - - TP_printk("address %lx error_code %x", - __entry->fault_address, __entry->error_code) + TP_FIELDS( + ctf_integer(unsigned long, fault_address, fault_address) + ctf_integer(unsigned int, error_code, error_code) + ) ) /* @@ -299,24 +182,12 @@ LTTNG_TRACEPOINT_EVENT(kvm_msr, TP_PROTO(unsigned write, u32 ecx, u64 data, bool exception), TP_ARGS(write, ecx, data, exception), - TP_STRUCT__entry( - __field( unsigned, write ) - __field( u32, ecx ) - __field( u64, data ) - __field( u8, exception ) - ), - - TP_fast_assign( - tp_assign(write, write) - tp_assign(ecx, ecx) - tp_assign(data, data) - tp_assign(exception, exception) - ), - - TP_printk("msr_%s %x = 0x%llx%s", - __entry->write ? "write" : "read", - __entry->ecx, __entry->data, - __entry->exception ? " (#GP)" : "") + TP_FIELDS( + ctf_integer(unsigned, write, write) + ctf_integer(u32, ecx, ecx) + ctf_integer(u64, data, data) + ctf_integer(u8, exception, exception) + ) ) #define trace_kvm_msr_read(ecx, data) trace_kvm_msr(0, ecx, data, false) @@ -331,21 +202,11 @@ LTTNG_TRACEPOINT_EVENT(kvm_cr, TP_PROTO(unsigned int rw, unsigned int cr, unsigned long val), TP_ARGS(rw, cr, val), - TP_STRUCT__entry( - __field( unsigned int, rw ) - __field( unsigned int, cr ) - __field( unsigned long, val ) - ), - - TP_fast_assign( - tp_assign(rw, rw) - tp_assign(cr, cr) - tp_assign(val, val) - ), - - TP_printk("cr_%s %x = 0x%lx", - __entry->rw ? "write" : "read", - __entry->cr, __entry->val) + TP_FIELDS( + ctf_integer(unsigned int, rw, rw) + ctf_integer(unsigned int, cr, cr) + ctf_integer(unsigned long, val, val) + ) ) #define trace_kvm_cr_read(cr, val) trace_kvm_cr(0, cr, val) @@ -355,119 +216,56 @@ LTTNG_TRACEPOINT_EVENT(kvm_pic_set_irq, TP_PROTO(__u8 chip, __u8 pin, __u8 elcr, __u8 imr, bool coalesced), TP_ARGS(chip, pin, elcr, imr, coalesced), - TP_STRUCT__entry( - __field( __u8, chip ) - __field( __u8, pin ) - __field( __u8, elcr ) - __field( __u8, imr ) - __field( bool, coalesced ) - ), - - TP_fast_assign( - tp_assign(chip, chip) - tp_assign(pin, pin) - tp_assign(elcr, elcr) - tp_assign(imr, imr) - tp_assign(coalesced, coalesced) - ), - - TP_printk("chip %u pin %u (%s%s)%s", - __entry->chip, __entry->pin, - (__entry->elcr & (1 << __entry->pin)) ? "level":"edge", - (__entry->imr & (1 << __entry->pin)) ? "|masked":"", - __entry->coalesced ? " (coalesced)" : "") + TP_FIELDS( + ctf_integer(__u8, chip, chip) + ctf_integer(__u8, pin, pin) + ctf_integer(__u8, elcr, elcr) + ctf_integer(__u8, imr, imr) + ctf_integer(bool, coalesced, coalesced) + ) ) -#define kvm_apic_dst_shorthand \ - {0x0, "dst"}, \ - {0x1, "self"}, \ - {0x2, "all"}, \ - {0x3, "all-but-self"} - LTTNG_TRACEPOINT_EVENT(kvm_apic_ipi, TP_PROTO(__u32 icr_low, __u32 dest_id), TP_ARGS(icr_low, dest_id), - TP_STRUCT__entry( - __field( __u32, icr_low ) - __field( __u32, dest_id ) - ), - - TP_fast_assign( - tp_assign(icr_low, icr_low) - tp_assign(dest_id, dest_id) - ), - - TP_printk("dst %x vec %u (%s|%s|%s|%s|%s)", - __entry->dest_id, (u8)__entry->icr_low, - __print_symbolic((__entry->icr_low >> 8 & 0x7), - kvm_deliver_mode), - (__entry->icr_low & (1<<11)) ? "logical" : "physical", - (__entry->icr_low & (1<<14)) ? "assert" : "de-assert", - (__entry->icr_low & (1<<15)) ? "level" : "edge", - __print_symbolic((__entry->icr_low >> 18 & 0x3), - kvm_apic_dst_shorthand)) + TP_FIELDS( + ctf_integer(__u32, icr_low, icr_low) + ctf_integer(__u32, dest_id, dest_id) + ) ) LTTNG_TRACEPOINT_EVENT(kvm_apic_accept_irq, TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec, bool coalesced), TP_ARGS(apicid, dm, tm, vec, coalesced), - TP_STRUCT__entry( - __field( __u32, apicid ) - __field( __u16, dm ) - __field( __u8, tm ) - __field( __u8, vec ) - __field( bool, coalesced ) - ), - - TP_fast_assign( - tp_assign(apicid, apicid) - tp_assign(dm, dm) - tp_assign(tm, tm) - tp_assign(vec, vec) - tp_assign(coalesced, coalesced) - ), - - TP_printk("apicid %x vec %u (%s|%s)%s", - __entry->apicid, __entry->vec, - __print_symbolic((__entry->dm >> 8 & 0x7), kvm_deliver_mode), - __entry->tm ? "level" : "edge", - __entry->coalesced ? " (coalesced)" : "") + TP_FIELDS( + ctf_integer(__u32, apicid, apicid) + ctf_integer(__u16, dm, dm) + ctf_integer(__u8, tm, tm) + ctf_integer(__u8, vec, vec) + ctf_integer(bool, coalesced, coalesced) + ) ) LTTNG_TRACEPOINT_EVENT(kvm_eoi, TP_PROTO(struct kvm_lapic *apic, int vector), TP_ARGS(apic, vector), - TP_STRUCT__entry( - __field( __u32, apicid ) - __field( int, vector ) - ), - - TP_fast_assign( - tp_assign(apicid, apic->vcpu->vcpu_id) - tp_assign(vector, vector) - ), - - TP_printk("apicid %x vector %d", __entry->apicid, __entry->vector) + TP_FIELDS( + ctf_integer(__u32, apicid, apic->vcpu->vcpu_id) + ctf_integer(int, vector, vector) + ) ) LTTNG_TRACEPOINT_EVENT(kvm_pv_eoi, TP_PROTO(struct kvm_lapic *apic, int vector), TP_ARGS(apic, vector), - TP_STRUCT__entry( - __field( __u32, apicid ) - __field( int, vector ) - ), - - TP_fast_assign( - tp_assign(apicid, apic->vcpu->vcpu_id) - tp_assign(vector, vector) - ), - - TP_printk("apicid %x vector %d", __entry->apicid, __entry->vector) + TP_FIELDS( + ctf_integer(__u32, apicid, apic->vcpu->vcpu_id) + ctf_integer(int, vector, vector) + ) ) /* @@ -478,52 +276,26 @@ LTTNG_TRACEPOINT_EVENT(kvm_nested_vmrun, __u32 event_inj, bool npt), TP_ARGS(rip, vmcb, nested_rip, int_ctl, event_inj, npt), - TP_STRUCT__entry( - __field( __u64, rip ) - __field( __u64, vmcb ) - __field( __u64, nested_rip ) - __field( __u32, int_ctl ) - __field( __u32, event_inj ) - __field( bool, npt ) - ), - - TP_fast_assign( - tp_assign(rip, rip) - tp_assign(vmcb, vmcb) - tp_assign(nested_rip, nested_rip) - tp_assign(int_ctl, int_ctl) - tp_assign(event_inj, event_inj) - tp_assign(npt, npt) - ), - - TP_printk("rip: 0x%016llx vmcb: 0x%016llx nrip: 0x%016llx int_ctl: 0x%08x " - "event_inj: 0x%08x npt: %s", - __entry->rip, __entry->vmcb, __entry->nested_rip, - __entry->int_ctl, __entry->event_inj, - __entry->npt ? "on" : "off") + TP_FIELDS( + ctf_integer(__u64, rip, rip) + ctf_integer(__u64, vmcb, vmcb) + ctf_integer(__u64, nested_rip, nested_rip) + ctf_integer(__u32, int_ctl, int_ctl) + ctf_integer(__u32, event_inj, event_inj) + ctf_integer(bool, npt, npt) + ) ) LTTNG_TRACEPOINT_EVENT(kvm_nested_intercepts, TP_PROTO(__u16 cr_read, __u16 cr_write, __u32 exceptions, __u64 intercept), TP_ARGS(cr_read, cr_write, exceptions, intercept), - TP_STRUCT__entry( - __field( __u16, cr_read ) - __field( __u16, cr_write ) - __field( __u32, exceptions ) - __field( __u64, intercept ) - ), - - TP_fast_assign( - tp_assign(cr_read, cr_read) - tp_assign(cr_write, cr_write) - tp_assign(exceptions, exceptions) - tp_assign(intercept, intercept) - ), - - TP_printk("cr_read: %04x cr_write: %04x excp: %08x intercept: %016llx", - __entry->cr_read, __entry->cr_write, __entry->exceptions, - __entry->intercept) + TP_FIELDS( + ctf_integer(__u16, cr_read, cr_read) + ctf_integer(__u16, cr_write, cr_write) + ctf_integer(__u32, exceptions, exceptions) + ctf_integer(__u64, intercept, intercept) + ) ) /* * Tracepoint for #VMEXIT while nested @@ -535,33 +307,15 @@ LTTNG_TRACEPOINT_EVENT(kvm_nested_vmexit, TP_ARGS(rip, exit_code, exit_info1, exit_info2, exit_int_info, exit_int_info_err, isa), - TP_STRUCT__entry( - __field( __u64, rip ) - __field( __u32, exit_code ) - __field( __u64, exit_info1 ) - __field( __u64, exit_info2 ) - __field( __u32, exit_int_info ) - __field( __u32, exit_int_info_err ) - __field( __u32, isa ) - ), - - TP_fast_assign( - tp_assign(rip, rip) - tp_assign(exit_code, exit_code) - tp_assign(exit_info1, exit_info1) - tp_assign(exit_info2, exit_info2) - tp_assign(exit_int_info, exit_int_info) - tp_assign(exit_int_info_err, exit_int_info_err) - tp_assign(isa, isa) - ), - TP_printk("rip: 0x%016llx reason: %s ext_inf1: 0x%016llx " - "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x", - __entry->rip, - (__entry->isa == KVM_ISA_VMX) ? - __print_symbolic(__entry->exit_code, VMX_EXIT_REASONS) : - __print_symbolic(__entry->exit_code, SVM_EXIT_REASONS), - __entry->exit_info1, __entry->exit_info2, - __entry->exit_int_info, __entry->exit_int_info_err) + TP_FIELDS( + ctf_integer(__u64, rip, rip) + ctf_integer(__u32, exit_code, exit_code) + ctf_integer(__u64, exit_info1, exit_info1) + ctf_integer(__u64, exit_info2, exit_info2) + ctf_integer(__u32, exit_int_info, exit_int_info) + ctf_integer(__u32, exit_int_info_err, exit_int_info_err) + ctf_integer(__u32, isa, isa) + ) ) /* @@ -574,31 +328,14 @@ LTTNG_TRACEPOINT_EVENT(kvm_nested_vmexit_inject, TP_ARGS(exit_code, exit_info1, exit_info2, exit_int_info, exit_int_info_err, isa), - TP_STRUCT__entry( - __field( __u32, exit_code ) - __field( __u64, exit_info1 ) - __field( __u64, exit_info2 ) - __field( __u32, exit_int_info ) - __field( __u32, exit_int_info_err ) - __field( __u32, isa ) - ), - - TP_fast_assign( - tp_assign(exit_code, exit_code) - tp_assign(exit_info1, exit_info1) - tp_assign(exit_info2, exit_info2) - tp_assign(exit_int_info, exit_int_info) - tp_assign(exit_int_info_err, exit_int_info_err) - tp_assign(isa, isa) - ), - - TP_printk("reason: %s ext_inf1: 0x%016llx " - "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x", - (__entry->isa == KVM_ISA_VMX) ? - __print_symbolic(__entry->exit_code, VMX_EXIT_REASONS) : - __print_symbolic(__entry->exit_code, SVM_EXIT_REASONS), - __entry->exit_info1, __entry->exit_info2, - __entry->exit_int_info, __entry->exit_int_info_err) + TP_FIELDS( + ctf_integer(__u32, exit_code, exit_code) + ctf_integer(__u64, exit_info1, exit_info1) + ctf_integer(__u64, exit_info2, exit_info2) + ctf_integer(__u32, exit_int_info, exit_int_info) + ctf_integer(__u32, exit_int_info_err, exit_int_info_err) + ctf_integer(__u32, isa, isa) + ) ) /* @@ -608,15 +345,9 @@ LTTNG_TRACEPOINT_EVENT(kvm_nested_intr_vmexit, TP_PROTO(__u64 rip), TP_ARGS(rip), - TP_STRUCT__entry( - __field( __u64, rip ) - ), - - TP_fast_assign( - tp_assign(rip, rip) - ), - - TP_printk("rip: 0x%016llx", __entry->rip) + TP_FIELDS( + ctf_integer(__u64, rip, rip) + ) ) /* @@ -626,20 +357,11 @@ LTTNG_TRACEPOINT_EVENT(kvm_invlpga, TP_PROTO(__u64 rip, int asid, u64 address), TP_ARGS(rip, asid, address), - TP_STRUCT__entry( - __field( __u64, rip ) - __field( int, asid ) - __field( __u64, address ) - ), - - TP_fast_assign( - tp_assign(rip, rip) - tp_assign(asid, asid) - tp_assign(address, address) - ), - - TP_printk("rip: 0x%016llx asid: %d address: 0x%016llx", - __entry->rip, __entry->asid, __entry->address) + TP_FIELDS( + ctf_integer(__u64, rip, rip) + ctf_integer(int, asid, asid) + ctf_integer(__u64, address, address) + ) ) /* @@ -649,18 +371,10 @@ LTTNG_TRACEPOINT_EVENT(kvm_skinit, TP_PROTO(__u64 rip, __u32 slb), TP_ARGS(rip, slb), - TP_STRUCT__entry( - __field( __u64, rip ) - __field( __u32, slb ) - ), - - TP_fast_assign( - tp_assign(rip, rip) - tp_assign(slb, slb) - ), - - TP_printk("rip: 0x%016llx slb: 0x%08x", - __entry->rip, __entry->slb) + TP_FIELDS( + ctf_integer(__u64, rip, rip) + ctf_integer(__u32, slb, slb) + ) ) #define KVM_EMUL_INSN_F_CR0_PE (1 << 0) @@ -706,55 +420,32 @@ LTTNG_TRACEPOINT_EVENT(kvm_emulate_insn, TP_PROTO(struct kvm_vcpu *vcpu, __u8 failed), TP_ARGS(vcpu, failed), - TP_STRUCT__entry( - __field( __u64, rip ) - __field( __u32, csbase ) - __field( __u8, len ) - __array( __u8, insn, 15 ) - __field( __u8, flags ) - __field( __u8, failed ) - ), - - TP_fast_assign( + TP_FIELDS( #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - tp_assign(rip, vcpu->arch.emulate_ctxt.decode.fetch.start) - tp_assign(csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS)) - tp_assign(len, vcpu->arch.emulate_ctxt.decode.eip - - vcpu->arch.emulate_ctxt.decode.fetch.start) - tp_memcpy(insn, - vcpu->arch.emulate_ctxt.decode.fetch.data, - 15) + ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt.decode.fetch.start) + ctf_integer(__u32, csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS)) + ctf_integer(__u8, len, vcpu->arch.emulate_ctxt.decode.eip + - vcpu->arch.emulate_ctxt.decode.fetch.start) + ctf_array(__u8, insn, vcpu->arch.emulate_ctxt.decode.fetch.data, 15) #elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)) - tp_assign(rip, vcpu->arch.emulate_ctxt.fetch.start) - tp_assign(csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS)) - tp_assign(len, vcpu->arch.emulate_ctxt._eip - - vcpu->arch.emulate_ctxt.fetch.start) - tp_memcpy(insn, - vcpu->arch.emulate_ctxt.fetch.data, - 15) + ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt.fetch.start) + ctf_integer(__u32, csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS)) + ctf_integer(__u8, len, vcpu->arch.emulate_ctxt._eip + - vcpu->arch.emulate_ctxt.fetch.start) + ctf_array(__u8, insn, vcpu->arch.emulate_ctxt.fetch.data, 15) #else - tp_assign(rip, vcpu->arch.emulate_ctxt._eip - - (vcpu->arch.emulate_ctxt.fetch.ptr - - vcpu->arch.emulate_ctxt.fetch.data)) - tp_assign(csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS)) - tp_assign(len, vcpu->arch.emulate_ctxt.fetch.ptr - - vcpu->arch.emulate_ctxt.fetch.data) - tp_memcpy(insn, - vcpu->arch.emulate_ctxt.fetch.data, - 15) + ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt._eip - + (vcpu->arch.emulate_ctxt.fetch.ptr - + vcpu->arch.emulate_ctxt.fetch.data)) + ctf_integer(__u32, csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS)) + ctf_integer(__u8, len, vcpu->arch.emulate_ctxt.fetch.ptr - + vcpu->arch.emulate_ctxt.fetch.data) + ctf_array(__u8, insn, vcpu->arch.emulate_ctxt.fetch.data, 15) #endif - tp_assign(flags, kei_decode_mode(vcpu->arch.emulate_ctxt.mode)) - tp_assign(failed, failed) - ), - - TP_printk("%x:%llx:%s (%s)%s", - __entry->csbase, __entry->rip, - __print_hex(__entry->insn, __entry->len), - __print_symbolic(__entry->flags, - kvm_trace_symbol_emul_flags), - __entry->failed ? " failed" : "" - ) + ctf_integer(__u8, flags, kei_decode_mode(vcpu->arch.emulate_ctxt.mode)) + ctf_integer(__u8, failed, failed) ) +) #define trace_kvm_emulate_insn_start(vcpu) trace_kvm_emulate_insn(vcpu, 0) #define trace_kvm_emulate_insn_failed(vcpu) trace_kvm_emulate_insn(vcpu, 1) @@ -764,23 +455,12 @@ LTTNG_TRACEPOINT_EVENT( TP_PROTO(gva_t gva, gpa_t gpa, bool write, bool gpa_match), TP_ARGS(gva, gpa, write, gpa_match), - TP_STRUCT__entry( - __field(gva_t, gva) - __field(gpa_t, gpa) - __field(bool, write) - __field(bool, gpa_match) - ), - - TP_fast_assign( - tp_assign(gva, gva) - tp_assign(gpa, gpa) - tp_assign(write, write) - tp_assign(gpa_match, gpa_match) - ), - - TP_printk("gva %#lx gpa %#llx %s %s", __entry->gva, __entry->gpa, - __entry->write ? "Write" : "Read", - __entry->gpa_match ? "GPA" : "GVA") + TP_FIELDS( + ctf_integer(gva_t, gva, gva) + ctf_integer(gpa_t, gpa, gpa) + ctf_integer(bool, write, write) + ctf_integer(bool, gpa_match, gpa_match) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) @@ -789,51 +469,26 @@ LTTNG_TRACEPOINT_EVENT(kvm_write_tsc_offset, __u64 next_tsc_offset), TP_ARGS(vcpu_id, previous_tsc_offset, next_tsc_offset), - TP_STRUCT__entry( - __field( unsigned int, vcpu_id ) - __field( __u64, previous_tsc_offset ) - __field( __u64, next_tsc_offset ) - ), - - TP_fast_assign( - tp_assign(vcpu_id, vcpu_id) - tp_assign(previous_tsc_offset, previous_tsc_offset) - tp_assign(next_tsc_offset, next_tsc_offset) - ), - - TP_printk("vcpu=%u prev=%llu next=%llu", __entry->vcpu_id, - __entry->previous_tsc_offset, __entry->next_tsc_offset) + TP_FIELDS( + ctf_integer(unsigned int, vcpu_id, vcpu_id) + ctf_integer(__u64, previous_tsc_offset, previous_tsc_offset) + ctf_integer(__u64, next_tsc_offset, next_tsc_offset) + ) ) #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) #ifdef CONFIG_X86_64 -#define host_clocks \ - {VCLOCK_NONE, "none"}, \ - {VCLOCK_TSC, "tsc"}, \ - {VCLOCK_HPET, "hpet"} \ - LTTNG_TRACEPOINT_EVENT(kvm_update_master_clock, TP_PROTO(bool use_master_clock, unsigned int host_clock, bool offset_matched), TP_ARGS(use_master_clock, host_clock, offset_matched), - TP_STRUCT__entry( - __field( bool, use_master_clock ) - __field( unsigned int, host_clock ) - __field( bool, offset_matched ) - ), - - TP_fast_assign( - tp_assign(use_master_clock, use_master_clock) - tp_assign(host_clock, host_clock) - tp_assign(offset_matched, offset_matched) - ), - - TP_printk("masterclock %d hostclock %s offsetmatched %u", - __entry->use_master_clock, - __print_symbolic(__entry->host_clock, host_clocks), - __entry->offset_matched) + TP_FIELDS( + ctf_integer(bool, use_master_clock, use_master_clock) + ctf_integer(unsigned int, host_clock, host_clock) + ctf_integer(bool, offset_matched, offset_matched) + ) ) LTTNG_TRACEPOINT_EVENT(kvm_track_tsc, @@ -843,27 +498,13 @@ LTTNG_TRACEPOINT_EVENT(kvm_track_tsc, TP_ARGS(vcpu_id, nr_matched, online_vcpus, use_master_clock, host_clock), - TP_STRUCT__entry( - __field( unsigned int, vcpu_id ) - __field( unsigned int, nr_vcpus_matched_tsc ) - __field( unsigned int, online_vcpus ) - __field( bool, use_master_clock ) - __field( unsigned int, host_clock ) - ), - - TP_fast_assign( - tp_assign(vcpu_id, vcpu_id) - tp_assign(nr_vcpus_matched_tsc, nr_matched) - tp_assign(online_vcpus, online_vcpus) - tp_assign(use_master_clock, use_master_clock) - tp_assign(host_clock, host_clock) - ), - - TP_printk("vcpu_id %u masterclock %u offsetmatched %u nr_online %u" - " hostclock %s", - __entry->vcpu_id, __entry->use_master_clock, - __entry->nr_vcpus_matched_tsc, __entry->online_vcpus, - __print_symbolic(__entry->host_clock, host_clocks)) + TP_FIELDS( + ctf_integer(unsigned int, vcpu_id, vcpu_id) + ctf_integer(unsigned int, nr_vcpus_matched_tsc, nr_matched) + ctf_integer(unsigned int, online_vcpus, online_vcpus) + ctf_integer(bool, use_master_clock, use_master_clock) + ctf_integer(unsigned int, host_clock, host_clock) + ) ) #endif /* CONFIG_X86_64 */ diff --git a/instrumentation/events/lttng-module/asoc.h b/instrumentation/events/lttng-module/asoc.h index 4aca115c..acbb1a12 100644 --- a/instrumentation/events/lttng-module/asoc.h +++ b/instrumentation/events/lttng-module/asoc.h @@ -39,23 +39,12 @@ LTTNG_TRACEPOINT_EVENT_CLASS(snd_soc_reg, TP_ARGS(codec, reg, val), - TP_STRUCT__entry( - __string( name, codec->CODEC_NAME_FIELD ) - __field( int, id ) - __field( unsigned int, reg ) - __field( unsigned int, val ) - ), - - TP_fast_assign( - tp_strcpy(name, codec->CODEC_NAME_FIELD) - tp_assign(id, codec->CODEC_ID_FIELD) - tp_assign(reg, reg) - tp_assign(val, val) - ), - - TP_printk("codec=%s.%d reg=%x val=%x", __get_str(name), - (int)__entry->id, (unsigned int)__entry->reg, - (unsigned int)__entry->val) + TP_FIELDS( + ctf_string(name, codec->CODEC_NAME_FIELD) + ctf_integer(int, id, codec->CODEC_ID_FIELD) + ctf_integer(unsigned int, reg, reg) + ctf_integer(unsigned int, val, val) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(snd_soc_reg, snd_soc_reg_write, @@ -84,23 +73,12 @@ LTTNG_TRACEPOINT_EVENT_CLASS(snd_soc_preg, TP_ARGS(platform, reg, val), - TP_STRUCT__entry( - __string( name, platform->CODEC_NAME_FIELD ) - __field( int, id ) - __field( unsigned int, reg ) - __field( unsigned int, val ) - ), - - TP_fast_assign( - tp_strcpy(name, platform->CODEC_NAME_FIELD) - tp_assign(id, platform->CODEC_ID_FIELD) - tp_assign(reg, reg) - tp_assign(val, val) - ), - - TP_printk("platform=%s.%d reg=%x val=%x", __get_str(name), - (int)__entry->id, (unsigned int)__entry->reg, - (unsigned int)__entry->val) + TP_FIELDS( + ctf_string(name, platform->CODEC_NAME_FIELD) + ctf_integer(int, id, platform->CODEC_ID_FIELD) + ctf_integer(unsigned int, reg, reg) + ctf_integer(unsigned int, val, val) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(snd_soc_preg, snd_soc_preg_write, @@ -128,17 +106,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(snd_soc_card, TP_ARGS(card, val), - TP_STRUCT__entry( - __string( name, card->name ) - __field( int, val ) - ), - - TP_fast_assign( - tp_strcpy(name, card->name) - tp_assign(val, val) - ), - - TP_printk("card=%s val=%d", __get_str(name), (int)__entry->val) + TP_FIELDS( + ctf_string(name, card->name) + ctf_integer(int, val, val) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(snd_soc_card, snd_soc_bias_level_start, @@ -163,15 +134,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(snd_soc_dapm_basic, TP_ARGS(card), - TP_STRUCT__entry( - __string( name, card->name ) - ), - - TP_fast_assign( - tp_strcpy(name, card->name) - ), - - TP_printk("card=%s", __get_str(name)) + TP_FIELDS( + ctf_string(name, card->name) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(snd_soc_dapm_basic, snd_soc_dapm_start, @@ -196,18 +161,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(snd_soc_dapm_widget, TP_ARGS(w, val), - TP_STRUCT__entry( - __string( name, w->name ) - __field( int, val ) - ), - - TP_fast_assign( - tp_strcpy(name, w->name) - tp_assign(val, val) - ), - - TP_printk("widget=%s val=%d", __get_str(name), - (int)__entry->val) + TP_FIELDS( + ctf_string(name, w->name) + ctf_integer(int, val, val) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(snd_soc_dapm_widget, snd_soc_dapm_widget_power, @@ -241,23 +198,12 @@ LTTNG_TRACEPOINT_EVENT(snd_soc_dapm_walk_done, TP_ARGS(card), - TP_STRUCT__entry( - __string( name, card->name ) - __field( int, power_checks ) - __field( int, path_checks ) - __field( int, neighbour_checks ) - ), - - TP_fast_assign( - tp_strcpy(name, card->name) - tp_assign(power_checks, card->dapm_stats.power_checks) - tp_assign(path_checks, card->dapm_stats.path_checks) - tp_assign(neighbour_checks, card->dapm_stats.neighbour_checks) - ), - - TP_printk("%s: checks %d power, %d path, %d neighbour", - __get_str(name), (int)__entry->power_checks, - (int)__entry->path_checks, (int)__entry->neighbour_checks) + TP_FIELDS( + ctf_string(name, card->name) + ctf_integer(int, power_checks, card->dapm_stats.power_checks) + ctf_integer(int, path_checks, card->dapm_stats.path_checks) + ctf_integer(int, neighbour_checks, card->dapm_stats.neighbour_checks) + ) ) #endif @@ -269,26 +215,13 @@ LTTNG_TRACEPOINT_EVENT(snd_soc_dapm_output_path, TP_ARGS(widget, path), - TP_STRUCT__entry( - __string( wname, widget->name ) - __string( pname, path->name ? path->name : DAPM_DIRECT) - __string( psname, path->sink->name ) - __field( int, path_sink ) - __field( int, path_connect ) - ), - - TP_fast_assign( - tp_strcpy(wname, widget->name) - tp_strcpy(pname, path->name ? path->name : DAPM_DIRECT) - tp_strcpy(psname, path->sink->name) - tp_assign(path_connect, path->connect) - tp_assign(path_sink, (long)path->sink) - ), - - TP_printk("%c%s -> %s -> %s\n", - (int) __entry->path_sink && - (int) __entry->path_connect ? '*' : ' ', - __get_str(wname), __get_str(pname), __get_str(psname)) + TP_FIELDS( + ctf_string(wname, widget->name) + ctf_string(pname, path->name ? path->name : DAPM_DIRECT) + ctf_string(psname, path->sink->name) + ctf_integer(int, path_sink, (long) path->sink) + ctf_integer(int, path_connect, path->connect) + ) ) LTTNG_TRACEPOINT_EVENT(snd_soc_dapm_input_path, @@ -298,26 +231,13 @@ LTTNG_TRACEPOINT_EVENT(snd_soc_dapm_input_path, TP_ARGS(widget, path), - TP_STRUCT__entry( - __string( wname, widget->name ) - __string( pname, path->name ? path->name : DAPM_DIRECT) - __string( psname, path->source->name ) - __field( int, path_source ) - __field( int, path_connect ) - ), - - TP_fast_assign( - tp_strcpy(wname, widget->name) - tp_strcpy(pname, path->name ? path->name : DAPM_DIRECT) - tp_strcpy(psname, path->source->name) - tp_assign(path_connect, path->connect) - tp_assign(path_source, (long)path->source) - ), - - TP_printk("%c%s <- %s <- %s\n", - (int) __entry->path_source && - (int) __entry->path_connect ? '*' : ' ', - __get_str(wname), __get_str(pname), __get_str(psname)) + TP_FIELDS( + ctf_string(wname, widget->name) + ctf_string(pname,path->name ? path->name : DAPM_DIRECT) + ctf_string(psname, path->source->name) + ctf_integer(int, path_source, (long) path->source) + ctf_integer(int, path_connect, path->connect) + ) ) LTTNG_TRACEPOINT_EVENT(snd_soc_dapm_connected, @@ -326,18 +246,10 @@ LTTNG_TRACEPOINT_EVENT(snd_soc_dapm_connected, TP_ARGS(paths, stream), - TP_STRUCT__entry( - __field( int, paths ) - __field( int, stream ) - ), - - TP_fast_assign( - tp_assign(paths, paths) - tp_assign(stream, stream) - ), - - TP_printk("%s: found %d paths\n", - __entry->stream ? "capture" : "playback", __entry->paths) + TP_FIELDS( + ctf_integer(int, paths, paths) + ctf_integer(int, stream, stream) + ) ) #endif @@ -347,15 +259,9 @@ LTTNG_TRACEPOINT_EVENT(snd_soc_jack_irq, TP_ARGS(name), - TP_STRUCT__entry( - __string( name, name ) - ), - - TP_fast_assign( - tp_strcpy(name, name) - ), - - TP_printk("%s", __get_str(name)) + TP_FIELDS( + ctf_string(name, name) + ) ) LTTNG_TRACEPOINT_EVENT(snd_soc_jack_report, @@ -364,20 +270,11 @@ LTTNG_TRACEPOINT_EVENT(snd_soc_jack_report, TP_ARGS(jack, mask, val), - TP_STRUCT__entry( - __string( name, jack->jack->name ) - __field( int, mask ) - __field( int, val ) - ), - - TP_fast_assign( - tp_strcpy(name, jack->jack->name) - tp_assign(mask, mask) - tp_assign(val, val) - ), - - TP_printk("jack=%s %x/%x", __get_str(name), (int)__entry->val, - (int)__entry->mask) + TP_FIELDS( + ctf_string(name, jack->jack->name) + ctf_integer(int, mask, mask) + ctf_integer(int, val, val) + ) ) LTTNG_TRACEPOINT_EVENT(snd_soc_jack_notify, @@ -386,17 +283,10 @@ LTTNG_TRACEPOINT_EVENT(snd_soc_jack_notify, TP_ARGS(jack, val), - TP_STRUCT__entry( - __string( name, jack->jack->name ) - __field( int, val ) - ), - - TP_fast_assign( - tp_strcpy(name, jack->jack->name) - tp_assign(val, val) - ), - - TP_printk("jack=%s %x", __get_str(name), (int)__entry->val) + TP_FIELDS( + ctf_string(name, jack->jack->name) + ctf_integer(int, val, val) + ) ) LTTNG_TRACEPOINT_EVENT(snd_soc_cache_sync, @@ -406,22 +296,12 @@ LTTNG_TRACEPOINT_EVENT(snd_soc_cache_sync, TP_ARGS(codec, type, status), - TP_STRUCT__entry( - __string( name, codec->CODEC_NAME_FIELD ) - __string( status, status ) - __string( type, type ) - __field( int, id ) - ), - - TP_fast_assign( - tp_strcpy(name, codec->CODEC_NAME_FIELD) - tp_strcpy(status, status) - tp_strcpy(type, type) - tp_assign(id, codec->CODEC_ID_FIELD) - ), - - TP_printk("codec=%s.%d type=%s status=%s", __get_str(name), - (int)__entry->id, __get_str(type), __get_str(status)) + TP_FIELDS( + ctf_string(name, codec->CODEC_NAME_FIELD) + ctf_string(status, status) + ctf_string(type, type) + ctf_integer(int, id, codec->CODEC_ID_FIELD) + ) ) #endif /* LTTNG_TRACE_ASOC_H */ diff --git a/instrumentation/events/lttng-module/block.h b/instrumentation/events/lttng-module/block.h index 0aff5469..445406e0 100644 --- a/instrumentation/events/lttng-module/block.h +++ b/instrumentation/events/lttng-module/block.h @@ -10,13 +10,9 @@ #include #include -#define RWBS_LEN 8 - #ifndef _TRACE_BLOCK_DEF_ #define _TRACE_BLOCK_DEF_ -#define __blk_dump_cmd(cmd, len) "" - enum { RWBS_FLAG_WRITE = (1 << 0), RWBS_FLAG_DISCARD = (1 << 1), @@ -32,23 +28,10 @@ enum { #endif /* _TRACE_BLOCK_DEF_ */ -#define __print_rwbs_flags(rwbs) \ - __print_flags(rwbs, "", \ - { RWBS_FLAG_FLUSH, "F" }, \ - { RWBS_FLAG_WRITE, "W" }, \ - { RWBS_FLAG_DISCARD, "D" }, \ - { RWBS_FLAG_READ, "R" }, \ - { RWBS_FLAG_FUA, "F" }, \ - { RWBS_FLAG_RAHEAD, "A" }, \ - { RWBS_FLAG_BARRIER, "B" }, \ - { RWBS_FLAG_SYNC, "S" }, \ - { RWBS_FLAG_META, "M" }, \ - { RWBS_FLAG_SECURE, "E" }) - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) -#define blk_fill_rwbs(rwbs, rw, bytes) \ - tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ +#define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \ + ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ ( (bytes) ? RWBS_FLAG_READ : \ ( 0 )))) \ @@ -61,8 +44,8 @@ enum { #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) -#define blk_fill_rwbs(rwbs, rw, bytes) \ - tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ +#define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \ + ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ ( (bytes) ? RWBS_FLAG_READ : \ ( 0 )))) \ @@ -73,8 +56,8 @@ enum { #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) -#define blk_fill_rwbs(rwbs, rw, bytes) \ - tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ +#define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \ + ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ ( (bytes) ? RWBS_FLAG_READ : \ ( 0 )))) \ @@ -86,8 +69,8 @@ enum { #else -#define blk_fill_rwbs(rwbs, rw, bytes) \ - tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ +#define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \ + ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \ ( (bytes) ? RWBS_FLAG_READ : \ ( 0 )))) \ @@ -105,21 +88,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer, TP_ARGS(bh), - TP_STRUCT__entry ( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( size_t, size ) - ), - - TP_fast_assign( - tp_assign(dev, bh->b_bdev->bd_dev) - tp_assign(sector, bh->b_blocknr) - tp_assign(size, bh->b_size) - ), - - TP_printk("%d,%d sector=%llu size=%zu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long long)__entry->sector, __entry->size + TP_FIELDS ( + ctf_integer(dev_t, dev, bh->b_bdev->bd_dev) + ctf_integer(sector_t, sector, bh->b_blocknr) + ctf_integer(size_t, size, bh->b_size) ) ) @@ -150,42 +122,44 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_dirty_buffer, ) #endif -LTTNG_TRACEPOINT_EVENT_CLASS(block_rq_with_error, +LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, TP_PROTO(struct request_queue *q, struct request *rq), TP_ARGS(q, rq), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned int, nr_sector ) - __field( int, errors ) - __field( unsigned int, rwbs ) - __dynamic_array_hex( unsigned char, cmd, - (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - rq->cmd_len : 0) + TP_locvar( + sector_t sector; + unsigned int nr_sector; + unsigned char *cmd; + size_t cmd_len; ), - TP_fast_assign( - tp_assign(dev, rq->rq_disk ? disk_devt(rq->rq_disk) : 0) - tp_assign(sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - 0 : blk_rq_pos(rq)) - tp_assign(nr_sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - 0 : blk_rq_sectors(rq)) - tp_assign(errors, rq->errors) - blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) - tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - rq->cmd : NULL) + TP_code( + if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { + tp_locvar->sector = 0; + tp_locvar->nr_sector = 0; + tp_locvar->cmd = rq->cmd; + tp_locvar->cmd_len = rq->cmd_len; + } else { + tp_locvar->sector = blk_rq_pos(rq); + tp_locvar->nr_sector = blk_rq_sectors(rq); + tp_locvar->cmd = NULL; + tp_locvar->cmd_len = 0; + } ), - TP_printk("%d,%d %s (%s) %llu + %u [%d]", - MAJOR(__entry->dev), MINOR(__entry->dev), - __print_rwbs_flags(__entry->rwbs), - __blk_dump_cmd(__get_dynamic_array(cmd), - __get_dynamic_array_len(cmd)), - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->errors) + TP_FIELDS( + ctf_integer(dev_t, dev, + rq->rq_disk ? disk_devt(rq->rq_disk) : 0) + ctf_integer(sector_t, sector, tp_locvar->sector) + ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) + ctf_integer(int, errors, rq->errors) + blk_rwbs_ctf_integer(unsigned int, rwbs, + rq->cmd_flags, blk_rq_bytes(rq)) + ctf_sequence_hex(unsigned char, cmd, + tp_locvar->cmd, size_t, tp_locvar->cmd_len) + ) ) /** @@ -240,39 +214,39 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_requeue, * do for the request. If @rq->bio is non-NULL then there is * additional work required to complete the request. */ -LTTNG_TRACEPOINT_EVENT(block_rq_complete, +LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, TP_PROTO(struct request_queue *q, struct request *rq, unsigned int nr_bytes), TP_ARGS(q, rq, nr_bytes), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned int, nr_sector ) - __field( int, errors ) - __field( unsigned int, rwbs ) - __dynamic_array_hex( unsigned char, cmd, - (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - rq->cmd_len : 0) + TP_locvar( + unsigned char *cmd; + size_t cmd_len; ), - TP_fast_assign( - tp_assign(dev, rq->rq_disk ? disk_devt(rq->rq_disk) : 0) - tp_assign(sector, blk_rq_pos(rq)) - tp_assign(nr_sector, nr_bytes >> 9) - tp_assign(errors, rq->errors) - blk_fill_rwbs(rwbs, rq->cmd_flags, nr_bytes) - tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - rq->cmd : NULL) + TP_code( + if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { + tp_locvar->cmd = rq->cmd; + tp_locvar->cmd_len = rq->cmd_len; + } else { + tp_locvar->cmd = NULL; + tp_locvar->cmd_len = 0; + } ), - TP_printk("%d,%d %s (%s) %llu + %u [%d]", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->rwbs, __get_str(cmd), - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->errors) + TP_FIELDS( + ctf_integer(dev_t, dev, + rq->rq_disk ? disk_devt(rq->rq_disk) : 0) + ctf_integer(sector_t, sector, blk_rq_pos(rq)) + ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) + ctf_integer(int, errors, rq->errors) + blk_rwbs_ctf_integer(unsigned int, rwbs, + rq->cmd_flags, nr_bytes) + ctf_sequence_hex(unsigned char, cmd, + tp_locvar->cmd, size_t, tp_locvar->cmd_len) + ) ) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ @@ -297,48 +271,49 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_complete, #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ -LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, +LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, TP_PROTO(struct request_queue *q, struct request *rq), TP_ARGS(q, rq), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned int, nr_sector ) - __field( unsigned int, bytes ) - __field( unsigned int, rwbs ) - __field( pid_t, tid ) - __array_text( char, comm, TASK_COMM_LEN ) - __dynamic_array_hex( unsigned char, cmd, - (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - rq->cmd_len : 0) + TP_locvar( + sector_t sector; + unsigned int nr_sector; + unsigned int bytes; + unsigned char *cmd; + size_t cmd_len; ), - TP_fast_assign( - tp_assign(dev, rq->rq_disk ? disk_devt(rq->rq_disk) : 0) - tp_assign(sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - 0 : blk_rq_pos(rq)) - tp_assign(nr_sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - 0 : blk_rq_sectors(rq)) - tp_assign(bytes, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - blk_rq_bytes(rq) : 0) - blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) - tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? - rq->cmd : NULL) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + TP_code( + if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { + tp_locvar->sector = 0; + tp_locvar->nr_sector = 0; + tp_locvar->bytes = blk_rq_bytes(rq); + tp_locvar->cmd = rq->cmd; + tp_locvar->cmd_len = rq->cmd_len; + } else { + tp_locvar->sector = blk_rq_pos(rq); + tp_locvar->nr_sector = blk_rq_sectors(rq); + tp_locvar->bytes = 0; + tp_locvar->cmd = NULL; + tp_locvar->cmd_len = 0; + } ), - TP_printk("%d,%d %s %u (%s) %llu + %u [%s] %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __print_rwbs_flags(__entry->rwbs), - __entry->bytes, - __blk_dump_cmd(__get_dynamic_array(cmd), - __get_dynamic_array_len(cmd)), - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm, __entry->tid) + TP_FIELDS( + ctf_integer(dev_t, dev, + rq->rq_disk ? disk_devt(rq->rq_disk) : 0) + ctf_integer(sector_t, sector, tp_locvar->sector) + ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) + ctf_integer(unsigned int, bytes, tp_locvar->bytes) + ctf_integer(pid_t, tid, current->pid) + blk_rwbs_ctf_integer(unsigned int, rwbs, + rq->cmd_flags, blk_rq_bytes(rq)) + ctf_sequence_hex(unsigned char, cmd, + tp_locvar->cmd, size_t, tp_locvar->cmd_len) + ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) + ) ) /** @@ -390,40 +365,22 @@ LTTNG_TRACEPOINT_EVENT(block_bio_bounce, TP_ARGS(q, bio), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned int, nr_sector ) - __field( unsigned int, rwbs ) - __field( pid_t, tid ) - __array_text( char, comm, TASK_COMM_LEN ) - ), - - TP_fast_assign( + TP_FIELDS( + ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) - tp_assign(dev, bio->bi_bdev ? - bio->bi_bdev->bd_dev : 0) - tp_assign(sector, bio->bi_iter.bi_sector) - tp_assign(nr_sector, bio_sectors(bio)) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) + ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_iter.bi_size) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - tp_assign(dev, bio->bi_bdev ? - bio->bi_bdev->bd_dev : 0) - tp_assign(sector, bio->bi_sector) - tp_assign(nr_sector, bio->bi_size >> 9) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + ctf_integer(sector_t, sector, bio->bi_sector) + ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_size) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - ), - - TP_printk("%d,%d %s %llu + %u [%s] %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __print_rwbs_flags(__entry->rwbs), - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm, __entry->tid) + ctf_integer(pid_t, tid, current->pid) + ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) + ) ) /** @@ -447,39 +404,26 @@ LTTNG_TRACEPOINT_EVENT(block_bio_complete, TP_ARGS(q, bio), #endif - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned, nr_sector ) - __field( int, error ) - __field( unsigned int, rwbs ) - ), - - TP_fast_assign( + TP_FIELDS( + ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) - tp_assign(dev, bio->bi_bdev->bd_dev) - tp_assign(sector, bio->bi_iter.bi_sector) - tp_assign(nr_sector, bio_sectors(bio)) - tp_assign(error, error) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) + ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) + ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) + ctf_integer(int, error, error) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_iter.bi_size) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - tp_assign(dev, bio->bi_bdev->bd_dev) - tp_assign(sector, bio->bi_sector) - tp_assign(nr_sector, bio->bi_size >> 9) + ctf_integer(sector_t, sector, bio->bi_sector) + ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) - tp_assign(error, error) + ctf_integer(int, error, error) #else - tp_assign(error, 0) + ctf_integer(int, error, 0) #endif - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_size) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - ), - - TP_printk("%d,%d %s %llu + %u [%d]", - MAJOR(__entry->dev), MINOR(__entry->dev), - __print_rwbs_flags(__entry->rwbs), - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->error) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) @@ -489,38 +433,22 @@ LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, TP_ARGS(q, rq, bio), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned int, nr_sector ) - __field( unsigned int, rwbs ) - __field( pid_t, tid ) - __array_text( char, comm, TASK_COMM_LEN ) - ), - - TP_fast_assign( + TP_FIELDS( + ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) - tp_assign(dev, bio->bi_bdev->bd_dev) - tp_assign(sector, bio->bi_iter.bi_sector) - tp_assign(nr_sector, bio_sectors(bio)) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) + ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_iter.bi_size) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - tp_assign(dev, bio->bi_bdev->bd_dev) - tp_assign(sector, bio->bi_sector) - tp_assign(nr_sector, bio->bi_size >> 9) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + ctf_integer(sector_t, sector, bio->bi_sector) + ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_size) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - ), - - TP_printk("%d,%d %s %llu + %u [%s] %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __print_rwbs_flags(__entry->rwbs), - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm, __entry->tid) + ctf_integer(pid_t, tid, current->pid) + ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) + ) ) /** @@ -566,68 +494,39 @@ LTTNG_TRACEPOINT_EVENT(block_bio_queue, TP_ARGS(q, bio), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned int, nr_sector ) - __field( unsigned int, rwbs ) - __field( pid_t, tid ) - __array_text( char, comm, TASK_COMM_LEN ) - ), - - TP_fast_assign( + TP_FIELDS( + ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) - tp_assign(dev, bio->bi_bdev->bd_dev) - tp_assign(sector, bio->bi_iter.bi_sector) - tp_assign(nr_sector, bio_sectors(bio)) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) + ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_iter.bi_size) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - tp_assign(dev, bio->bi_bdev->bd_dev) - tp_assign(sector, bio->bi_sector) - tp_assign(nr_sector, bio->bi_size >> 9) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + ctf_integer(sector_t, sector, bio->bi_sector) + ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_size) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - ), - - TP_printk("%d,%d %s %llu + %u [%s] %d", - MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm, __entry->tid) + ctf_integer(pid_t, tid, current->pid) + ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) + ) ) -#else +#else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */ LTTNG_TRACEPOINT_EVENT_CLASS(block_bio, TP_PROTO(struct request_queue *q, struct bio *bio), TP_ARGS(q, bio), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned int, nr_sector ) - __field( unsigned int, rwbs ) - __field( pid_t, tid ) - __array_text( char, comm, TASK_COMM_LEN ) - ), - - TP_fast_assign( - tp_assign(dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) - tp_assign(sector, bio->bi_sector) - tp_assign(nr_sector, bio->bi_size >> 9) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) - ), - - TP_printk("%d,%d %s %llu + %u [%s] %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __print_rwbs_flags(__entry->rwbs), - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm, __entry->tid) + TP_FIELDS( + ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) + ctf_integer(sector_t, sector, bio->bi_sector) + ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_size) + ctf_integer(pid_t, tid, current->pid) + ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) + ) ) /** @@ -673,7 +572,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue, TP_ARGS(q, bio) ) -#endif +#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */ LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq, @@ -681,40 +580,26 @@ LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq, TP_ARGS(q, bio, rw), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned int, nr_sector ) - __field( unsigned int, rwbs ) - __field( pid_t, tid ) - __array_text( char, comm, TASK_COMM_LEN ) - ), - - TP_fast_assign( + TP_FIELDS( + ctf_integer(dev_t, dev, bio ? bio->bi_bdev->bd_dev : 0) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) - tp_assign(dev, bio ? bio->bi_bdev->bd_dev : 0) - tp_assign(sector, bio ? bio->bi_iter.bi_sector : 0) - tp_assign(nr_sector, bio ? bio_sectors(bio) : 0) - blk_fill_rwbs(rwbs, bio ? bio->bi_rw : 0, - bio ? bio_sectors(bio) : 0) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + ctf_integer(sector_t, sector, bio ? bio->bi_iter.bi_sector : 0) + ctf_integer(unsigned int, nr_sector, + bio ? bio_sectors(bio) : 0) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio ? bio->bi_rw : 0, + bio ? bio->bi_iter.bi_size : 0) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - tp_assign(dev, bio ? bio->bi_bdev->bd_dev : 0) - tp_assign(sector, bio ? bio->bi_sector : 0) - tp_assign(nr_sector, bio ? bio->bi_size >> 9 : 0) - blk_fill_rwbs(rwbs, bio ? bio->bi_rw : 0, - bio ? bio->bi_size >> 9 : 0) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + ctf_integer(sector_t, sector, bio ? bio->bi_sector : 0) + ctf_integer(unsigned int, nr_sector, + bio ? bio->bi_size >> 9 : 0) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio ? bio->bi_rw : 0, + bio ? bio->bi_size : 0) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - ), - - TP_printk("%d,%d %s %llu + %u [%s] %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __print_rwbs_flags(__entry->rwbs), - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm, __entry->tid) + ctf_integer(pid_t, tid, current->pid) + ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) + ) ) /** @@ -765,17 +650,10 @@ LTTNG_TRACEPOINT_EVENT(block_plug, TP_ARGS(q), - TP_STRUCT__entry( - __field( pid_t, tid ) - __array_text( char, comm, TASK_COMM_LEN ) - ), - - TP_fast_assign( - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) - ), - - TP_printk("[%s] %d", __entry->comm, __entry->tid) + TP_FIELDS( + ctf_integer(pid_t, tid, current->pid) + ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug, @@ -790,24 +668,15 @@ LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug, TP_ARGS(q), #endif - TP_STRUCT__entry( - __field( int, nr_rq ) - __field( pid_t, tid ) - __array_text( char, comm, TASK_COMM_LEN ) - ), - - TP_fast_assign( + TP_FIELDS( #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - tp_assign(nr_rq, depth) + ctf_integer(int, nr_rq, depth) #else - tp_assign(nr_rq, q->rq.count[READ] + q->rq.count[WRITE]) + ctf_integer(int, nr_rq, q->rq.count[READ] + q->rq.count[WRITE]) #endif - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) - ), - - TP_printk("[%s] %d %d", __entry->comm, , __entry->tid, - __entry->nr_rq) + ctf_integer(pid_t, tid, current->pid) + ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) + ) ) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) @@ -870,39 +739,21 @@ LTTNG_TRACEPOINT_EVENT(block_split, TP_ARGS(q, bio, new_sector), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( sector_t, new_sector ) - __field( unsigned int, rwbs ) - __field( pid_t, tid ) - __array_text( char, comm, TASK_COMM_LEN ) - ), - - TP_fast_assign( + TP_FIELDS( + ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) - tp_assign(dev, bio->bi_bdev->bd_dev) - tp_assign(sector, bio->bi_iter.bi_sector) - tp_assign(new_sector, new_sector) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_iter.bi_size) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - tp_assign(dev, bio->bi_bdev->bd_dev) - tp_assign(sector, bio->bi_sector) - tp_assign(new_sector, new_sector) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, current->pid) + ctf_integer(sector_t, sector, bio->bi_sector) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_size) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - ), - - TP_printk("%d,%d %s %llu / %llu [%s] %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __print_rwbs_flags(__entry->rwbs), - (unsigned long long)__entry->sector, - (unsigned long long)__entry->new_sector, - __entry->comm, __entry->tid) + ctf_integer(sector_t, new_sector, new_sector) + ctf_integer(pid_t, tid, current->pid) + ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) + ) ) /** @@ -926,40 +777,22 @@ LTTNG_TRACEPOINT_EVENT(block_remap, TP_ARGS(q, bio, dev, from), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned int, nr_sector ) - __field( dev_t, old_dev ) - __field( sector_t, old_sector ) - __field( unsigned int, rwbs ) - ), - - TP_fast_assign( + TP_FIELDS( + ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) - tp_assign(dev, bio->bi_bdev->bd_dev) - tp_assign(sector, bio->bi_iter.bi_sector) - tp_assign(nr_sector, bio_sectors(bio)) - tp_assign(old_dev, dev) - tp_assign(old_sector, from) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) + ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) + ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_iter.bi_size) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - tp_assign(dev, bio->bi_bdev->bd_dev) - tp_assign(sector, bio->bi_sector) - tp_assign(nr_sector, bio->bi_size >> 9) - tp_assign(old_dev, dev) - tp_assign(old_sector, from) - blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) + ctf_integer(sector_t, sector, bio->bi_sector) + ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) + blk_rwbs_ctf_integer(unsigned int, rwbs, + bio->bi_rw, bio->bi_size) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ - ), - - TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - __print_rwbs_flags(__entry->rwbs), - (unsigned long long)__entry->sector, - __entry->nr_sector, - MAJOR(__entry->old_dev), MINOR(__entry->old_dev), - (unsigned long long)__entry->old_sector) + ctf_integer(dev_t, old_dev, dev) + ctf_integer(sector_t, old_sector, from) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) @@ -981,31 +814,15 @@ LTTNG_TRACEPOINT_EVENT(block_rq_remap, TP_ARGS(q, rq, dev, from), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( sector_t, sector ) - __field( unsigned int, nr_sector ) - __field( dev_t, old_dev ) - __field( sector_t, old_sector ) - __field( unsigned int, rwbs ) - ), - - TP_fast_assign( - tp_assign(dev, disk_devt(rq->rq_disk)) - tp_assign(sector, blk_rq_pos(rq)) - tp_assign(nr_sector, blk_rq_sectors(rq)) - tp_assign(old_dev, dev) - tp_assign(old_sector, from) - blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) - ), - - TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - __print_rwbs_flags(__entry->rwbs), - (unsigned long long)__entry->sector, - __entry->nr_sector, - MAJOR(__entry->old_dev), MINOR(__entry->old_dev), - (unsigned long long)__entry->old_sector) + TP_FIELDS( + ctf_integer(dev_t, dev, disk_devt(rq->rq_disk)) + ctf_integer(sector_t, sector, blk_rq_pos(rq)) + ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) + ctf_integer(dev_t, old_dev, dev) + ctf_integer(sector_t, old_sector, from) + blk_rwbs_ctf_integer(unsigned int, rwbs, + rq->cmd_flags, blk_rq_bytes(rq)) + ) ) #endif diff --git a/instrumentation/events/lttng-module/btrfs.h b/instrumentation/events/lttng-module/btrfs.h index 3aee30be..11b501a2 100644 --- a/instrumentation/events/lttng-module/btrfs.h +++ b/instrumentation/events/lttng-module/btrfs.h @@ -31,135 +31,18 @@ struct extent_state; #endif #endif -#define show_ref_type(type) \ - __print_symbolic(type, \ - { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ - { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ - { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ - { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ - { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) - - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) -#define __show_root_type(obj) \ - __print_symbolic_u64(obj, \ - { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ - { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ - { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ - { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ - { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ - { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ - { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ - { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ - { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ - { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ - { BTRFS_UUID_TREE_OBJECTID, "UUID_RELOC" }, \ - { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) -#define __show_root_type(obj) \ - __print_symbolic_u64(obj, \ - { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ - { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ - { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ - { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ - { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ - { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ - { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ - { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ - { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ - { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ - { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40)) -#define __show_root_type(obj) \ - __print_symbolic_u64(obj, \ - { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ - { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ - { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ - { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ - { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ - { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ - { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ - { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ - { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ - { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) -#else -#define __show_root_type(obj) \ - __print_symbolic(obj, \ - { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ - { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ - { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ - { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ - { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ - { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ - { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ - { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ - { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ - { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) -#define show_root_type(obj) \ - obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ - (obj >= BTRFS_ROOT_TREE_OBJECTID && \ - obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) -#define show_root_type(obj) \ - obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ - (obj >= BTRFS_ROOT_TREE_OBJECTID && \ - obj <= BTRFS_CSUM_TREE_OBJECTID)) ? __show_root_type(obj) : "-" -#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */ -#define show_root_type(obj) \ - obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ - (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-" -#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) - -#define BTRFS_GROUP_FLAGS \ - { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ - { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ - { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ - { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ - { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ - { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ - { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ - { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ - { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} - -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - -#define BTRFS_GROUP_FLAGS \ - { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ - { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ - { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ - { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ - { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ - { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ - { BTRFS_BLOCK_GROUP_RAID10, "RAID10"} - #define BTRFS_UUID_SIZE 16 -#endif - LTTNG_TRACEPOINT_EVENT(btrfs_transaction_commit, TP_PROTO(struct btrfs_root *root), TP_ARGS(root), - TP_STRUCT__entry( - __field( u64, generation ) - __field( u64, root_objectid ) - ), - - TP_fast_assign( - tp_assign(generation, root->fs_info->generation) - tp_assign(root_objectid, root->root_key.objectid) - ), - - TP_printk("root = %llu(%s), gen = %llu", - show_root_type(__entry->root_objectid), - (unsigned long long)__entry->generation) + TP_FIELDS( + ctf_integer(u64, generation, root->fs_info->generation) + ctf_integer(u64, root_objectid, root->root_key.objectid) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__inode, @@ -168,36 +51,16 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__inode, TP_ARGS(inode), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( blkcnt_t, blocks ) - __field( u64, disk_i_size ) - __field( u64, generation ) - __field( u64, last_trans ) - __field( u64, logged_trans ) - __field( u64, root_objectid ) - ), - - TP_fast_assign( - tp_assign(ino, inode->i_ino) - tp_assign(blocks, inode->i_blocks) - tp_assign(disk_i_size, BTRFS_I(inode)->disk_i_size) - tp_assign(generation, BTRFS_I(inode)->generation) - tp_assign(last_trans, BTRFS_I(inode)->last_trans) - tp_assign(logged_trans, BTRFS_I(inode)->logged_trans) - tp_assign(root_objectid, + TP_FIELDS( + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(blkcnt_t, blocks, inode->i_blocks) + ctf_integer(u64, disk_i_size, BTRFS_I(inode)->disk_i_size) + ctf_integer(u64, generation, BTRFS_I(inode)->generation) + ctf_integer(u64, last_trans, BTRFS_I(inode)->last_trans) + ctf_integer(u64, logged_trans, BTRFS_I(inode)->logged_trans) + ctf_integer(u64, root_objectid, BTRFS_I(inode)->root->root_key.objectid) - ), - - TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, " - "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu", - show_root_type(__entry->root_objectid), - (unsigned long long)__entry->generation, - (unsigned long)__entry->ino, - (unsigned long long)__entry->blocks, - (unsigned long long)__entry->disk_i_size, - (unsigned long long)__entry->last_trans, - (unsigned long long)__entry->logged_trans) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_new, @@ -221,191 +84,44 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_evict, TP_ARGS(inode) ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40)) -#define __show_map_type(type) \ - __print_symbolic_u64(type, \ - { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ - { EXTENT_MAP_HOLE, "HOLE" }, \ - { EXTENT_MAP_INLINE, "INLINE" }, \ - { EXTENT_MAP_DELALLOC, "DELALLOC" }) -#else -#define __show_map_type(type) \ - __print_symbolic(type, \ - { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ - { EXTENT_MAP_HOLE, "HOLE" }, \ - { EXTENT_MAP_INLINE, "INLINE" }, \ - { EXTENT_MAP_DELALLOC, "DELALLOC" }) -#endif - -#define show_map_type(type) \ - type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) - -#define show_map_flags(flag) \ - __print_flags(flag, "|", \ - { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ - { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ - { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\ - { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ - { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ - { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ - { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) - -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) - -#define show_map_flags(flag) \ - __print_flags(flag, "|", \ - { EXTENT_FLAG_PINNED, "PINNED" }, \ - { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \ - { EXTENT_FLAG_VACANCY, "VACANCY" }, \ - { EXTENT_FLAG_PREALLOC, "PREALLOC" }, \ - { EXTENT_FLAG_LOGGING, "LOGGING" }, \ - { EXTENT_FLAG_FILLING, "FILLING" }) - -#else - -#define show_map_flags(flag) \ - __print_flags(flag, "|", \ - { EXTENT_FLAG_PINNED, "PINNED" }, \ - { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \ - { EXTENT_FLAG_VACANCY, "VACANCY" }, \ - { EXTENT_FLAG_PREALLOC, "PREALLOC" }) - -#endif - LTTNG_TRACEPOINT_EVENT(btrfs_get_extent, TP_PROTO(struct btrfs_root *root, struct extent_map *map), TP_ARGS(root, map), - TP_STRUCT__entry( - __field( u64, root_objectid ) - __field( u64, start ) - __field( u64, len ) - __field( u64, orig_start ) - __field( u64, block_start ) - __field( u64, block_len ) - __field( unsigned long, flags ) - __field( int, refs ) - __field( unsigned int, compress_type ) - ), - - TP_fast_assign( - tp_assign(root_objectid, root->root_key.objectid) - tp_assign(start, map->start) - tp_assign(len, map->len) - tp_assign(orig_start, map->orig_start) - tp_assign(block_start, map->block_start) - tp_assign(block_len, map->block_len) - tp_assign(flags, map->flags) - tp_assign(refs, atomic_read(&map->refs)) - tp_assign(compress_type, map->compress_type) - ), - - TP_printk("root = %llu(%s), start = %llu, len = %llu, " - "orig_start = %llu, block_start = %llu(%s), " - "block_len = %llu, flags = %s, refs = %u, " - "compress_type = %u", - show_root_type(__entry->root_objectid), - (unsigned long long)__entry->start, - (unsigned long long)__entry->len, - (unsigned long long)__entry->orig_start, - show_map_type(__entry->block_start), - (unsigned long long)__entry->block_len, - show_map_flags(__entry->flags), - __entry->refs, __entry->compress_type) + TP_FIELDS( + ctf_integer(u64, root_objectid, root->root_key.objectid) + ctf_integer(u64, start, map->start) + ctf_integer(u64, len, map->len) + ctf_integer(u64, orig_start, map->orig_start) + ctf_integer(u64, block_start, map->block_start) + ctf_integer(u64, block_len, map->block_len) + ctf_integer(unsigned long, flags, map->flags) + ctf_integer(int, refs, atomic_read(&map->refs)) + ctf_integer(unsigned int, compress_type, map->compress_type) + ) ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) - -#define show_ordered_flags(flags) \ - __print_flags(flags, "|", \ - { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ - { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ - { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ - { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ - { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ - { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ - { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ - { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \ - { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \ - { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) - -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) - -#define show_ordered_flags(flags) \ - __print_symbolic(flags, \ - { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \ - { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \ - { BTRFS_ORDERED_NOCOW, "NOCOW" }, \ - { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \ - { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \ - { BTRFS_ORDERED_DIRECT, "DIRECT" }, \ - { BTRFS_ORDERED_IOERR, "IOERR" }, \ - { BTRFS_ORDERED_UPDATED_ISIZE, "UPDATED_ISIZE" }, \ - { BTRFS_ORDERED_LOGGED_CSUM, "LOGGED_CSUM" }) - -#else - -#define show_ordered_flags(flags) \ - __print_symbolic(flags, \ - { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \ - { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \ - { BTRFS_ORDERED_NOCOW, "NOCOW" }, \ - { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \ - { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \ - { BTRFS_ORDERED_DIRECT, "DIRECT" }) - -#endif - LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent, TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), TP_ARGS(inode, ordered), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( u64, file_offset ) - __field( u64, start ) - __field( u64, len ) - __field( u64, disk_len ) - __field( u64, bytes_left ) - __field( unsigned long, flags ) - __field( int, compress_type ) - __field( int, refs ) - __field( u64, root_objectid ) - ), - - TP_fast_assign( - tp_assign(ino, inode->i_ino) - tp_assign(file_offset, ordered->file_offset) - tp_assign(start, ordered->start) - tp_assign(len, ordered->len) - tp_assign(disk_len, ordered->disk_len) - tp_assign(bytes_left, ordered->bytes_left) - tp_assign(flags, ordered->flags) - tp_assign(compress_type, ordered->compress_type) - tp_assign(refs, atomic_read(&ordered->refs)) - tp_assign(root_objectid, + TP_FIELDS( + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(u64, file_offset, ordered->file_offset) + ctf_integer(u64, start, ordered->start) + ctf_integer(u64, len, ordered->len) + ctf_integer(u64, disk_len, ordered->disk_len) + ctf_integer(u64, bytes_left, ordered->bytes_left) + ctf_integer(unsigned long, flags, ordered->flags) + ctf_integer(int, compress_type, ordered->compress_type) + ctf_integer(int, refs, atomic_read(&ordered->refs)) + ctf_integer(u64, root_objectid, BTRFS_I(inode)->root->root_key.objectid) - ), - - TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, " - "start = %llu, len = %llu, disk_len = %llu, " - "bytes_left = %llu, flags = %s, compress_type = %d, " - "refs = %d", - show_root_type(__entry->root_objectid), - (unsigned long long)__entry->ino, - (unsigned long long)__entry->file_offset, - (unsigned long long)__entry->start, - (unsigned long long)__entry->len, - (unsigned long long)__entry->disk_len, - (unsigned long long)__entry->bytes_left, - show_ordered_flags(__entry->flags), - __entry->compress_type, __entry->refs) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add, @@ -443,66 +159,24 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__writepage, TP_ARGS(page, inode, wbc), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( pgoff_t, index ) - __field( long, nr_to_write ) - __field( long, pages_skipped ) - __field( loff_t, range_start ) - __field( loff_t, range_end ) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - __field( char, nonblocking ) -#endif - __field( char, for_kupdate ) - __field( char, for_reclaim ) - __field( char, range_cyclic ) - __field( pgoff_t, writeback_index ) - __field( u64, root_objectid ) - ), - - TP_fast_assign( - tp_assign(ino, inode->i_ino) - tp_assign(index, page->index) - tp_assign(nr_to_write, wbc->nr_to_write) - tp_assign(pages_skipped, wbc->pages_skipped) - tp_assign(range_start, wbc->range_start) - tp_assign(range_end, wbc->range_end) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - tp_assign(nonblocking, wbc->nonblocking) -#endif - tp_assign(for_kupdate, wbc->for_kupdate) - tp_assign(for_reclaim, wbc->for_reclaim) - tp_assign(range_cyclic, wbc->range_cyclic) - tp_assign(writeback_index, inode->i_mapping->writeback_index) - tp_assign(root_objectid, - BTRFS_I(inode)->root->root_key.objectid) - ), - + TP_FIELDS( + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(pgoff_t, index, page->index) + ctf_integer(long, nr_to_write, wbc->nr_to_write) + ctf_integer(long, pages_skipped, wbc->pages_skipped) + ctf_integer(loff_t, range_start, wbc->range_start) + ctf_integer(loff_t, range_end, wbc->range_end) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " - "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " - "range_end = %llu, nonblocking = %d, for_kupdate = %d, " - "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", - show_root_type(__entry->root_objectid), - (unsigned long)__entry->ino, __entry->index, - __entry->nr_to_write, __entry->pages_skipped, - __entry->range_start, __entry->range_end, - __entry->nonblocking, __entry->for_kupdate, - __entry->for_reclaim, __entry->range_cyclic, - (unsigned long)__entry->writeback_index) -#else - TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " - "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " - "range_end = %llu, for_kupdate = %d, " - "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", - show_root_type(__entry->root_objectid), - (unsigned long)__entry->ino, __entry->index, - __entry->nr_to_write, __entry->pages_skipped, - __entry->range_start, __entry->range_end, - __entry->for_kupdate, - __entry->for_reclaim, __entry->range_cyclic, - (unsigned long)__entry->writeback_index) + ctf_integer(char, nonblocking, wbc->nonblocking) #endif + ctf_integer(char, for_kupdate, wbc->for_kupdate) + ctf_integer(char, for_reclaim, wbc->for_reclaim) + ctf_integer(char, range_cyclic, wbc->range_cyclic) + ctf_integer(pgoff_t, writeback_index, + inode->i_mapping->writeback_index) + ctf_integer(u64, root_objectid, + BTRFS_I(inode)->root->root_key.objectid) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs__writepage, @@ -523,31 +197,15 @@ LTTNG_TRACEPOINT_EVENT(btrfs_writepage_end_io_hook, TP_ARGS(page, start, end, uptodate), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( pgoff_t, index ) - __field( u64, start ) - __field( u64, end ) - __field( int, uptodate ) - __field( u64, root_objectid ) - ), - - TP_fast_assign( - tp_assign(ino, page->mapping->host->i_ino) - tp_assign(index, page->index) - tp_assign(start, start) - tp_assign(end, end) - tp_assign(uptodate, uptodate) - tp_assign(root_objectid, - BTRFS_I(page->mapping->host)->root->root_key.objectid) - ), - - TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, " - "end = %llu, uptodate = %d", - show_root_type(__entry->root_objectid), - (unsigned long)__entry->ino, (unsigned long)__entry->index, - (unsigned long long)__entry->start, - (unsigned long long)__entry->end, __entry->uptodate) + TP_FIELDS( + ctf_integer(ino_t, ino, page->mapping->host->i_ino) + ctf_integer(pgoff_t, index, page->index) + ctf_integer(u64, start, start) + ctf_integer(u64, end, end) + ctf_integer(int, uptodate, uptodate) + ctf_integer(u64, root_objectid, + BTRFS_I(page->mapping->host)->root->root_key.objectid) + ) ) LTTNG_TRACEPOINT_EVENT(btrfs_sync_file, @@ -556,25 +214,13 @@ LTTNG_TRACEPOINT_EVENT(btrfs_sync_file, TP_ARGS(file, datasync), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( ino_t, parent ) - __field( int, datasync ) - __field( u64, root_objectid ) - ), - - TP_fast_assign( - tp_assign(ino, file->f_path.dentry->d_inode->i_ino) - tp_assign(parent, file->f_path.dentry->d_parent->d_inode->i_ino) - tp_assign(datasync, datasync) - tp_assign(root_objectid, + TP_FIELDS( + ctf_integer(ino_t, ino, file->f_path.dentry->d_inode->i_ino) + ctf_integer(ino_t, parent, file->f_path.dentry->d_parent->d_inode->i_ino) + ctf_integer(int, datasync, datasync) + ctf_integer(u64, root_objectid, BTRFS_I(file->f_path.dentry->d_inode)->root->root_key.objectid) - ), - - TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d", - show_root_type(__entry->root_objectid), - (unsigned long)__entry->ino, (unsigned long)__entry->parent, - __entry->datasync) + ) ) LTTNG_TRACEPOINT_EVENT(btrfs_sync_fs, @@ -583,25 +229,11 @@ LTTNG_TRACEPOINT_EVENT(btrfs_sync_fs, TP_ARGS(wait), - TP_STRUCT__entry( - __field( int, wait ) - ), - - TP_fast_assign( - tp_assign(wait, wait) - ), - - TP_printk("wait = %d", __entry->wait) + TP_FIELDS( + ctf_integer(int, wait, wait) + ) ) -#define show_ref_action(action) \ - __print_symbolic(action, \ - { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ - { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ - { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ - { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) - - LTTNG_TRACEPOINT_EVENT(btrfs_delayed_tree_ref, TP_PROTO(struct btrfs_delayed_ref_node *ref, @@ -610,52 +242,18 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_tree_ref, TP_ARGS(ref, full_ref, action), - TP_STRUCT__entry( - __field( u64, bytenr ) - __field( u64, num_bytes ) - __field( int, action ) - __field( u64, parent ) - __field( u64, ref_root ) - __field( int, level ) - __field( int, type ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) - __field( u64, seq ) -#endif - ), - - TP_fast_assign( - tp_assign(bytenr, ref->bytenr) - tp_assign(num_bytes, ref->num_bytes) - tp_assign(action, action) - tp_assign(parent, full_ref->parent) - tp_assign(ref_root, full_ref->root) - tp_assign(level, full_ref->level) - tp_assign(type, ref->type) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) - tp_assign(seq, ref->seq) -#endif - ), - + TP_FIELDS( + ctf_integer(u64, bytenr, ref->bytenr) + ctf_integer(u64, num_bytes, ref->num_bytes) + ctf_integer(int, action, action) + ctf_integer(u64, parent, full_ref->parent) + ctf_integer(u64, ref_root, full_ref->root) + ctf_integer(int, level, full_ref->level) + ctf_integer(int, type, ref->type) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) - TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " - "parent = %llu(%s), ref_root = %llu(%s), level = %d, " - "type = %s, seq = %llu", -#else - TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " - "parent = %llu(%s), ref_root = %llu(%s), level = %d, " - "type = %s", -#endif - (unsigned long long)__entry->bytenr, - (unsigned long long)__entry->num_bytes, - show_ref_action(__entry->action), - show_root_type(__entry->parent), - show_root_type(__entry->ref_root), -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) - __entry->level, show_ref_type(__entry->type), - (unsigned long long)__entry->seq) -#else - __entry->level, show_ref_type(__entry->type)) + ctf_integer(u64, seq, ref->seq) #endif + ) ) LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref, @@ -666,56 +264,19 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref, TP_ARGS(ref, full_ref, action), - TP_STRUCT__entry( - __field( u64, bytenr ) - __field( u64, num_bytes ) - __field( int, action ) - __field( u64, parent ) - __field( u64, ref_root ) - __field( u64, owner ) - __field( u64, offset ) - __field( int, type ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) - __field( u64, seq ) -#endif - ), - - TP_fast_assign( - tp_assign(bytenr, ref->bytenr) - tp_assign(num_bytes, ref->num_bytes) - tp_assign(action, action) - tp_assign(parent, full_ref->parent) - tp_assign(ref_root, full_ref->root) - tp_assign(owner, full_ref->objectid) - tp_assign(offset, full_ref->offset) - tp_assign(type, ref->type) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) - tp_assign(seq, ref->seq) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) - TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " - "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " - "offset = %llu, type = %s, seq = %llu", -#else - TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " - "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " - "offset = %llu, type = %s", -#endif - (unsigned long long)__entry->bytenr, - (unsigned long long)__entry->num_bytes, - show_ref_action(__entry->action), - show_root_type(__entry->parent), - show_root_type(__entry->ref_root), - (unsigned long long)__entry->owner, - (unsigned long long)__entry->offset, + TP_FIELDS( + ctf_integer(u64, bytenr, ref->bytenr) + ctf_integer(u64, num_bytes, ref->num_bytes) + ctf_integer(int, action, action) + ctf_integer(u64, parent, full_ref->parent) + ctf_integer(u64, ref_root, full_ref->root) + ctf_integer(u64, owner, full_ref->objectid) + ctf_integer(u64, offset, full_ref->offset) + ctf_integer(int, type, ref->type) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) - show_ref_type(__entry->type), - (unsigned long long)__entry->seq) -#else - show_ref_type(__entry->type)) + ctf_integer(u64, seq, ref->seq) #endif + ) ) LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head, @@ -726,55 +287,14 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head, TP_ARGS(ref, head_ref, action), - TP_STRUCT__entry( - __field( u64, bytenr ) - __field( u64, num_bytes ) - __field( int, action ) - __field( int, is_data ) - ), - - TP_fast_assign( - tp_assign(bytenr, ref->bytenr) - tp_assign(num_bytes, ref->num_bytes) - tp_assign(action, action) - tp_assign(is_data, head_ref->is_data) - ), - - TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d", - (unsigned long long)__entry->bytenr, - (unsigned long long)__entry->num_bytes, - show_ref_action(__entry->action), - __entry->is_data) + TP_FIELDS( + ctf_integer(u64, bytenr, ref->bytenr) + ctf_integer(u64, num_bytes, ref->num_bytes) + ctf_integer(int, action, action) + ctf_integer(int, is_data, head_ref->is_data) + ) ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) - -#define show_chunk_type(type) \ - __print_flags(type, "|", \ - { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ - { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ - { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ - { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ - { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ - { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ - { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ - { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ - { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) - -#else - -#define show_chunk_type(type) \ - __print_flags(type, "|", \ - { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ - { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ - { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ - { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ - { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ - { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ - { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}) - -#endif - LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk, TP_PROTO(struct btrfs_root *root, struct map_lookup *map, @@ -782,31 +302,14 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk, TP_ARGS(root, map, offset, size), - TP_STRUCT__entry( - __field( int, num_stripes ) - __field( u64, type ) - __field( int, sub_stripes ) - __field( u64, offset ) - __field( u64, size ) - __field( u64, root_objectid ) - ), - - TP_fast_assign( - tp_assign(num_stripes, map->num_stripes) - tp_assign(type, map->type) - tp_assign(sub_stripes, map->sub_stripes) - tp_assign(offset, offset) - tp_assign(size, size) - tp_assign(root_objectid, root->root_key.objectid) - ), - - TP_printk("root = %llu(%s), offset = %llu, size = %llu, " - "num_stripes = %d, sub_stripes = %d, type = %s", - show_root_type(__entry->root_objectid), - (unsigned long long)__entry->offset, - (unsigned long long)__entry->size, - __entry->num_stripes, __entry->sub_stripes, - show_chunk_type(__entry->type)) + TP_FIELDS( + ctf_integer(int, num_stripes, map->num_stripes) + ctf_integer(u64, type, map->type) + ctf_integer(int, sub_stripes, map->sub_stripes) + ctf_integer(u64, offset, offset) + ctf_integer(u64, size, size) + ctf_integer(u64, root_objectid, root->root_key.objectid) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk, btrfs_chunk_alloc, @@ -832,32 +335,14 @@ LTTNG_TRACEPOINT_EVENT(btrfs_cow_block, TP_ARGS(root, buf, cow), - TP_STRUCT__entry( - __field( u64, root_objectid ) - __field( u64, buf_start ) - __field( int, refs ) - __field( u64, cow_start ) - __field( int, buf_level ) - __field( int, cow_level ) - ), - - TP_fast_assign( - tp_assign(root_objectid, root->root_key.objectid) - tp_assign(buf_start, buf->start) - tp_assign(refs, atomic_read(&buf->refs)) - tp_assign(cow_start, cow->start) - tp_assign(buf_level, btrfs_header_level(buf)) - tp_assign(cow_level, btrfs_header_level(cow)) - ), - - TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu " - "(orig_level = %d), cow_buf = %llu (cow_level = %d)", - show_root_type(__entry->root_objectid), - __entry->refs, - (unsigned long long)__entry->buf_start, - __entry->buf_level, - (unsigned long long)__entry->cow_start, - __entry->cow_level) + TP_FIELDS( + ctf_integer(u64, root_objectid, root->root_key.objectid) + ctf_integer(u64, buf_start, buf->start) + ctf_integer(int, refs, atomic_read(&buf->refs)) + ctf_integer(u64, cow_start, cow->start) + ctf_integer(int, buf_level, btrfs_header_level(buf)) + ctf_integer(int, cow_level, btrfs_header_level(cow)) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) @@ -868,25 +353,13 @@ LTTNG_TRACEPOINT_EVENT(btrfs_space_reservation, TP_ARGS(fs_info, type, val, bytes, reserve), - TP_STRUCT__entry( - __array( u8, fsid, BTRFS_UUID_SIZE ) - __string( type, type ) - __field( u64, val ) - __field( u64, bytes ) - __field( int, reserve ) - ), - - TP_fast_assign( - tp_memcpy(fsid, fs_info->fsid, BTRFS_UUID_SIZE) - tp_strcpy(type, type) - tp_assign(val, val) - tp_assign(bytes, bytes) - tp_assign(reserve, reserve) - ), - - TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type), - __entry->val, __entry->reserve ? "reserve" : "release", - __entry->bytes) + TP_FIELDS( + ctf_array(u8, fsid, fs_info->fsid, BTRFS_UUID_SIZE) + ctf_string(type, type) + ctf_integer(u64, val, val) + ctf_integer(u64, bytes, bytes) + ctf_integer(int, reserve, reserve) + ) ) #endif @@ -896,22 +369,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserved_extent, TP_ARGS(root, start, len), - TP_STRUCT__entry( - __field( u64, root_objectid ) - __field( u64, start ) - __field( u64, len ) - ), - - TP_fast_assign( - tp_assign(root_objectid, root->root_key.objectid) - tp_assign(start, start) - tp_assign(len, len) - ), - - TP_printk("root = %llu(%s), start = %llu, len = %llu", - show_root_type(__entry->root_objectid), - (unsigned long long)__entry->start, - (unsigned long long)__entry->len) + TP_FIELDS( + ctf_integer(u64, root_objectid, root->root_key.objectid) + ctf_integer(u64, start, start) + ctf_integer(u64, len, len) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent, btrfs_reserved_extent_alloc, @@ -938,25 +400,12 @@ LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, TP_ARGS(root, num_bytes, empty_size, data), - TP_STRUCT__entry( - __field( u64, root_objectid ) - __field( u64, num_bytes ) - __field( u64, empty_size ) - __field( u64, data ) - ), - - TP_fast_assign( - tp_assign(root_objectid, root->root_key.objectid) - tp_assign(num_bytes, num_bytes) - tp_assign(empty_size, empty_size) - tp_assign(data, data) - ), - - TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, " - "flags = %Lu(%s)", show_root_type(__entry->root_objectid), - __entry->num_bytes, __entry->empty_size, __entry->data, - __print_flags((unsigned long)__entry->data, "|", - BTRFS_GROUP_FLAGS)) + TP_FIELDS( + ctf_integer(u64, root_objectid, root->root_key.objectid) + ctf_integer(u64, num_bytes, num_bytes) + ctf_integer(u64, empty_size, empty_size) + ctf_integer(u64, data, data) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent, @@ -967,28 +416,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent, TP_ARGS(root, block_group, start, len), - TP_STRUCT__entry( - __field( u64, root_objectid ) - __field( u64, bg_objectid ) - __field( u64, flags ) - __field( u64, start ) - __field( u64, len ) - ), - - TP_fast_assign( - tp_assign(root_objectid, root->root_key.objectid) - tp_assign(bg_objectid, block_group->key.objectid) - tp_assign(flags, block_group->flags) - tp_assign(start, start) - tp_assign(len, len) - ), - - TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), " - "start = %Lu, len = %Lu", - show_root_type(__entry->root_objectid), __entry->bg_objectid, - __entry->flags, __print_flags((unsigned long)__entry->flags, - "|", BTRFS_GROUP_FLAGS), - __entry->start, __entry->len) + TP_FIELDS( + ctf_integer(u64, root_objectid, root->root_key.objectid) + ctf_integer(u64, bg_objectid, block_group->key.objectid) + ctf_integer(u64, flags, block_group->flags) + ctf_integer(u64, start, start) + ctf_integer(u64, len, len) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent, @@ -1016,30 +450,14 @@ LTTNG_TRACEPOINT_EVENT(btrfs_find_cluster, TP_ARGS(block_group, start, bytes, empty_size, min_bytes), - TP_STRUCT__entry( - __field( u64, bg_objectid ) - __field( u64, flags ) - __field( u64, start ) - __field( u64, bytes ) - __field( u64, empty_size ) - __field( u64, min_bytes ) - ), - - TP_fast_assign( - tp_assign(bg_objectid, block_group->key.objectid) - tp_assign(flags, block_group->flags) - tp_assign(start, start) - tp_assign(bytes, bytes) - tp_assign(empty_size, empty_size) - tp_assign(min_bytes, min_bytes) - ), - - TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu," - " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid, - __entry->flags, - __print_flags((unsigned long)__entry->flags, "|", - BTRFS_GROUP_FLAGS), __entry->start, - __entry->bytes, __entry->empty_size, __entry->min_bytes) + TP_FIELDS( + ctf_integer(u64, bg_objectid, block_group->key.objectid) + ctf_integer(u64, flags, block_group->flags) + ctf_integer(u64, start, start) + ctf_integer(u64, bytes, bytes) + ctf_integer(u64, empty_size, empty_size) + ctf_integer(u64, min_bytes, min_bytes) + ) ) LTTNG_TRACEPOINT_EVENT(btrfs_failed_cluster_setup, @@ -1048,15 +466,9 @@ LTTNG_TRACEPOINT_EVENT(btrfs_failed_cluster_setup, TP_ARGS(block_group), - TP_STRUCT__entry( - __field( u64, bg_objectid ) - ), - - TP_fast_assign( - tp_assign(bg_objectid, block_group->key.objectid) - ), - - TP_printk("block_group = %Lu", __entry->bg_objectid) + TP_FIELDS( + ctf_integer(u64, bg_objectid, block_group->key.objectid) + ) ) LTTNG_TRACEPOINT_EVENT(btrfs_setup_cluster, @@ -1066,31 +478,14 @@ LTTNG_TRACEPOINT_EVENT(btrfs_setup_cluster, TP_ARGS(block_group, cluster, size, bitmap), - TP_STRUCT__entry( - __field( u64, bg_objectid ) - __field( u64, flags ) - __field( u64, start ) - __field( u64, max_size ) - __field( u64, size ) - __field( int, bitmap ) - ), - - TP_fast_assign( - tp_assign(bg_objectid, block_group->key.objectid) - tp_assign(flags, block_group->flags) - tp_assign(start, cluster->window_start) - tp_assign(max_size, cluster->max_size) - tp_assign(size, size) - tp_assign(bitmap, bitmap) - ), - - TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, " - "size = %Lu, max_size = %Lu, bitmap = %d", - __entry->bg_objectid, - __entry->flags, - __print_flags((unsigned long)__entry->flags, "|", - BTRFS_GROUP_FLAGS), __entry->start, - __entry->size, __entry->max_size, __entry->bitmap) + TP_FIELDS( + ctf_integer(u64, bg_objectid, block_group->key.objectid) + ctf_integer(u64, flags, block_group->flags) + ctf_integer(u64, start, cluster->window_start) + ctf_integer(u64, max_size, cluster->max_size) + ctf_integer(u64, size, size) + ctf_integer(int, bitmap, bitmap) + ) ) #endif @@ -1103,20 +498,11 @@ LTTNG_TRACEPOINT_EVENT_MAP(alloc_extent_state, TP_ARGS(state, mask, IP), - TP_STRUCT__entry( - __field(struct extent_state *, state) - __field(gfp_t, mask) - __field(unsigned long, ip) - ), - - TP_fast_assign( - tp_assign(state, state) - tp_assign(mask, mask) - tp_assign(ip, IP) - ), - - TP_printk("state=%p; mask = %s; caller = %pF", __entry->state, - show_gfp_flags(__entry->mask), (void *)__entry->ip) + TP_FIELDS( + ctf_integer(struct extent_state *, state, state) + ctf_integer(gfp_t, mask, mask) + ctf_integer(unsigned long, ip, IP) + ) ) LTTNG_TRACEPOINT_EVENT_MAP(free_extent_state, @@ -1127,18 +513,10 @@ LTTNG_TRACEPOINT_EVENT_MAP(free_extent_state, TP_ARGS(state, IP), - TP_STRUCT__entry( - __field(struct extent_state *, state) - __field(unsigned long, ip) - ), - - TP_fast_assign( - tp_assign(state, state) - tp_assign(ip, IP) - ), - - TP_printk(" state=%p; caller = %pF", __entry->state, - (void *)__entry->ip) + TP_FIELDS( + ctf_integer(struct extent_state *, state, state) + ctf_integer(unsigned long, ip, IP) + ) ) #endif diff --git a/instrumentation/events/lttng-module/compaction.h b/instrumentation/events/lttng-module/compaction.h index 992b5be5..10edec41 100644 --- a/instrumentation/events/lttng-module/compaction.h +++ b/instrumentation/events/lttng-module/compaction.h @@ -20,25 +20,12 @@ LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template, TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken), - TP_STRUCT__entry( - __field(unsigned long, start_pfn) - __field(unsigned long, end_pfn) - __field(unsigned long, nr_scanned) - __field(unsigned long, nr_taken) - ), - - TP_fast_assign( - tp_assign(start_pfn, start_pfn) - tp_assign(end_pfn, end_pfn) - tp_assign(nr_scanned, nr_scanned) - tp_assign(nr_taken, nr_taken) - ), - - TP_printk("range=(0x%lx ~ 0x%lx) nr_scanned=%lu nr_taken=%lu", - __entry->start_pfn, - __entry->end_pfn, - __entry->nr_scanned, - __entry->nr_taken) + TP_FIELDS( + ctf_integer(unsigned long, start_pfn, start_pfn) + ctf_integer(unsigned long, end_pfn, end_pfn) + ctf_integer(unsigned long, nr_scanned, nr_scanned) + ctf_integer(unsigned long, nr_taken, nr_taken) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(compaction_isolate_template, mm_compaction_isolate_migratepages, @@ -70,19 +57,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template, TP_ARGS(nr_scanned, nr_taken), - TP_STRUCT__entry( - __field(unsigned long, nr_scanned) - __field(unsigned long, nr_taken) - ), - - TP_fast_assign( - tp_assign(nr_scanned, nr_scanned) - tp_assign(nr_taken, nr_taken) - ), - - TP_printk("nr_scanned=%lu nr_taken=%lu", - __entry->nr_scanned, - __entry->nr_taken) + TP_FIELDS( + ctf_integer(unsigned long, nr_scanned, nr_scanned) + ctf_integer(unsigned long, nr_taken, nr_taken) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, @@ -114,7 +92,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, #if LTTNG_KERNEL_RANGE(3,12,30, 3,13,0) || \ LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \ (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) -LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, +LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages, compaction_migratepages, @@ -124,37 +102,28 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, TP_ARGS(nr_all, migrate_rc, migratepages), - TP_STRUCT__entry( - __field(unsigned long, nr_migrated) - __field(unsigned long, nr_failed) + TP_locvar( + unsigned long nr_failed; ), - TP_fast_assign( - tp_assign(nr_migrated, - nr_all - - (migrate_rc >= 0 ? migrate_rc : - ({ - unsigned long nr_failed = 0; - struct list_head *page_lru; - - list_for_each(page_lru, migratepages) - nr_failed++; - nr_failed; - }))) - tp_assign(nr_failed, - ({ - unsigned long nr_failed = 0; - struct list_head *page_lru; - - list_for_each(page_lru, migratepages) - nr_failed++; - nr_failed; - })) + TP_code( + tp_locvar->nr_failed = 0; + + { + struct list_head *page_lru; + + if (migrate_rc >= 0) + tp_locvar->nr_failed = migrate_rc; + else + list_for_each(page_lru, migratepages) + tp_locvar->nr_failed++; + } ), - TP_printk("nr_migrated=%lu nr_failed=%lu", - __entry->nr_migrated, - __entry->nr_failed) + TP_FIELDS( + ctf_integer(unsigned long, nr_migrated, nr_all - tp_locvar->nr_failed) + ctf_integer(unsigned long, nr_failed, tp_locvar->nr_failed) + ) ) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, @@ -166,19 +135,10 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, TP_ARGS(nr_migrated, nr_failed), - TP_STRUCT__entry( - __field(unsigned long, nr_migrated) - __field(unsigned long, nr_failed) - ), - - TP_fast_assign( - tp_assign(nr_migrated, nr_migrated) - tp_assign(nr_failed, nr_failed) - ), - - TP_printk("nr_migrated=%lu nr_failed=%lu", - __entry->nr_migrated, - __entry->nr_failed) + TP_FIELDS( + ctf_integer(unsigned long, nr_migrated, nr_migrated) + ctf_integer(unsigned long, nr_failed, nr_failed) + ) ) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ diff --git a/instrumentation/events/lttng-module/ext3.h b/instrumentation/events/lttng-module/ext3.h index 0c6cc98d..9c7813ee 100644 --- a/instrumentation/events/lttng-module/ext3.h +++ b/instrumentation/events/lttng-module/ext3.h @@ -12,34 +12,19 @@ LTTNG_TRACEPOINT_EVENT(ext3_free_inode, TP_ARGS(inode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( umode_t, mode ) - __field( uid_t, uid ) - __field( gid_t, gid ) - __field( blkcnt_t, blocks ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(mode, inode->i_mode) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(umode_t, mode, inode->i_mode) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) - tp_assign(uid, i_uid_read(inode)) - tp_assign(gid, i_gid_read(inode)) + ctf_integer(uid_t, uid, i_uid_read(inode)) + ctf_integer(gid_t, gid, i_gid_read(inode)) #else - tp_assign(uid, inode->i_uid) - tp_assign(gid, inode->i_gid) + ctf_integer(uid_t, uid, inode->i_uid) + ctf_integer(gid_t, gid, inode->i_gid) #endif - tp_assign(blocks, inode->i_blocks) - ), - - TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->mode, __entry->uid, __entry->gid, - (unsigned long) __entry->blocks) + ctf_integer(blkcnt_t, blocks, inode->i_blocks) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_request_inode, @@ -47,21 +32,11 @@ LTTNG_TRACEPOINT_EVENT(ext3_request_inode, TP_ARGS(dir, mode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, dir ) - __field( umode_t, mode ) - ), - - TP_fast_assign( - tp_assign(dev, dir->i_sb->s_dev) - tp_assign(dir, dir->i_ino) - tp_assign(mode, mode) - ), - - TP_printk("dev %d,%d dir %lu mode 0%o", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->dir, __entry->mode) + TP_FIELDS( + ctf_integer(dev_t, dev, dir->i_sb->s_dev) + ctf_integer(ino_t, dir, dir->i_ino) + ctf_integer(umode_t, mode, mode) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_allocate_inode, @@ -69,24 +44,12 @@ LTTNG_TRACEPOINT_EVENT(ext3_allocate_inode, TP_ARGS(inode, dir, mode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ino_t, dir ) - __field( umode_t, mode ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(dir, dir->i_ino) - tp_assign(mode, mode) - ), - - TP_printk("dev %d,%d ino %lu dir %lu mode 0%o", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long) __entry->dir, __entry->mode) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ino_t, dir, dir->i_ino) + ctf_integer(umode_t, mode, mode) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_evict_inode, @@ -94,21 +57,11 @@ LTTNG_TRACEPOINT_EVENT(ext3_evict_inode, TP_ARGS(inode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( int, nlink ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(nlink, inode->i_nlink) - ), - - TP_printk("dev %d,%d ino %lu nlink %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->nlink) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(int, nlink, inode->i_nlink) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_drop_inode, @@ -116,21 +69,11 @@ LTTNG_TRACEPOINT_EVENT(ext3_drop_inode, TP_ARGS(inode, drop), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( int, drop ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(drop, drop) - ), - - TP_printk("dev %d,%d ino %lu drop %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->drop) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(int, drop, drop) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_mark_inode_dirty, @@ -138,21 +81,11 @@ LTTNG_TRACEPOINT_EVENT(ext3_mark_inode_dirty, TP_ARGS(inode, IP), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field(unsigned long, ip ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(ip, IP) - ), - - TP_printk("dev %d,%d ino %lu caller %pF", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, (void *)__entry->ip) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(unsigned long, ip, IP) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_write_begin, @@ -161,27 +94,13 @@ LTTNG_TRACEPOINT_EVENT(ext3_write_begin, TP_ARGS(inode, pos, len, flags), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, pos ) - __field( unsigned int, len ) - __field( unsigned int, flags ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pos, pos) - tp_assign(len, len) - tp_assign(flags, flags) - ), - - TP_printk("dev %d,%d ino %lu pos %llu len %u flags %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long long) __entry->pos, __entry->len, - __entry->flags) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, pos) + ctf_integer(unsigned int, len, len) + ctf_integer(unsigned int, flags, flags) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(ext3__write_end, @@ -190,27 +109,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext3__write_end, TP_ARGS(inode, pos, len, copied), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, pos ) - __field( unsigned int, len ) - __field( unsigned int, copied ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pos, pos) - tp_assign(len, len) - tp_assign(copied, copied) - ), - - TP_printk("dev %d,%d ino %lu pos %llu len %u copied %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long long) __entry->pos, __entry->len, - __entry->copied) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, pos) + ctf_integer(unsigned int, len, len) + ctf_integer(unsigned int, copied, copied) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext3__write_end, ext3_ordered_write_end, @@ -242,22 +147,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext3__page_op, TP_ARGS(page), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( pgoff_t, index ) - - ), - - TP_fast_assign( - tp_assign(index, page->index) - tp_assign(ino, page->mapping->host->i_ino) - tp_assign(dev, page->mapping->host->i_sb->s_dev) - ), - - TP_printk("dev %d,%d ino %lu page_index %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->index) + TP_FIELDS( + ctf_integer(dev_t, dev, page->mapping->host->i_sb->s_dev) + ctf_integer(ino_t, ino, page->mapping->host->i_ino) + ctf_integer(pgoff_t, index, page->index) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext3__page_op, ext3_ordered_writepage, @@ -302,27 +196,13 @@ LTTNG_TRACEPOINT_EVENT(ext3_invalidatepage, TP_ARGS(page, offset, length), - TP_STRUCT__entry( - __field( pgoff_t, index ) - __field( unsigned int, offset ) - __field( unsigned int, length ) - __field( ino_t, ino ) - __field( dev_t, dev ) - - ), - - TP_fast_assign( - tp_assign(index, page->index) - tp_assign(offset, offset) - tp_assign(length, length) - tp_assign(ino, page->mapping->host->i_ino) - tp_assign(dev, page->mapping->host->i_sb->s_dev) - ), - - TP_printk("dev %d,%d ino %lu page_index %lu offset %u length %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->index, __entry->offset, __entry->length) + TP_FIELDS( + ctf_integer(pgoff_t, index, page->index) + ctf_integer(unsigned int, offset, offset) + ctf_integer(unsigned int, length, length) + ctf_integer(ino_t, ino, page->mapping->host->i_ino) + ctf_integer(dev_t, dev, page->mapping->host->i_sb->s_dev) + ) ) #else @@ -332,25 +212,12 @@ LTTNG_TRACEPOINT_EVENT(ext3_invalidatepage, TP_ARGS(page, offset), - TP_STRUCT__entry( - __field( pgoff_t, index ) - __field( unsigned long, offset ) - __field( ino_t, ino ) - __field( dev_t, dev ) - - ), - - TP_fast_assign( - tp_assign(index, page->index) - tp_assign(offset, offset) - tp_assign(ino, page->mapping->host->i_ino) - tp_assign(dev, page->mapping->host->i_sb->s_dev) - ), - - TP_printk("dev %d,%d ino %lu page_index %lu offset %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->index, __entry->offset) + TP_FIELDS( + ctf_integer(pgoff_t, index, page->index) + ctf_integer(unsigned long, offset, offset) + ctf_integer(ino_t, ino, page->mapping->host->i_ino) + ctf_integer(dev_t, dev, page->mapping->host->i_sb->s_dev) + ) ) #endif @@ -361,22 +228,11 @@ LTTNG_TRACEPOINT_EVENT(ext3_discard_blocks, TP_ARGS(sb, blk, count), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( unsigned long, blk ) - __field( unsigned long, count ) - - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(blk, blk) - tp_assign(count, count) - ), - - TP_printk("dev %d,%d blk %lu count %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->blk, __entry->count) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(unsigned long, blk, blk) + ctf_integer(unsigned long, count, count) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_request_blocks, @@ -385,24 +241,12 @@ LTTNG_TRACEPOINT_EVENT(ext3_request_blocks, TP_ARGS(inode, goal, count), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( unsigned long, count ) - __field( unsigned long, goal ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(count, count) - tp_assign(goal, goal) - ), - - TP_printk("dev %d,%d ino %lu count %lu goal %lu ", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->count, __entry->goal) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(unsigned long, count, count) + ctf_integer(unsigned long, goal, goal) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_allocate_blocks, @@ -411,27 +255,13 @@ LTTNG_TRACEPOINT_EVENT(ext3_allocate_blocks, TP_ARGS(inode, goal, count, block), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( unsigned long, block ) - __field( unsigned long, count ) - __field( unsigned long, goal ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(block, block) - tp_assign(count, count) - tp_assign(goal, goal) - ), - - TP_printk("dev %d,%d ino %lu count %lu block %lu goal %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->count, __entry->block, - __entry->goal) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(unsigned long, block, block) + ctf_integer(unsigned long, count, count) + ctf_integer(unsigned long, goal, goal) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_free_blocks, @@ -440,26 +270,13 @@ LTTNG_TRACEPOINT_EVENT(ext3_free_blocks, TP_ARGS(inode, block, count), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( umode_t, mode ) - __field( unsigned long, block ) - __field( unsigned long, count ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(mode, inode->i_mode) - tp_assign(block, block) - tp_assign(count, count) - ), - - TP_printk("dev %d,%d ino %lu mode 0%o block %lu count %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->mode, __entry->block, __entry->count) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(umode_t, mode, inode->i_mode) + ctf_integer(unsigned long, block, block) + ctf_integer(unsigned long, count, count) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_sync_file_enter, @@ -467,24 +284,12 @@ LTTNG_TRACEPOINT_EVENT(ext3_sync_file_enter, TP_ARGS(file, datasync), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ino_t, parent ) - __field( int, datasync ) - ), - - TP_fast_assign( - tp_assign(dev, file->f_path.dentry->d_inode->i_sb->s_dev) - tp_assign(ino, file->f_path.dentry->d_inode->i_ino) - tp_assign(datasync, datasync) - tp_assign(parent, file->f_path.dentry->d_parent->d_inode->i_ino) - ), - - TP_printk("dev %d,%d ino %lu parent %ld datasync %d ", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long) __entry->parent, __entry->datasync) + TP_FIELDS( + ctf_integer(dev_t, dev, file->f_path.dentry->d_inode->i_sb->s_dev) + ctf_integer(ino_t, ino, file->f_path.dentry->d_inode->i_ino) + ctf_integer(ino_t, parent, file->f_path.dentry->d_parent->d_inode->i_ino) + ctf_integer(int, datasync, datasync) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_sync_file_exit, @@ -492,22 +297,11 @@ LTTNG_TRACEPOINT_EVENT(ext3_sync_file_exit, TP_ARGS(inode, ret), - TP_STRUCT__entry( - __field( int, ret ) - __field( ino_t, ino ) - __field( dev_t, dev ) - ), - - TP_fast_assign( - tp_assign(ret, ret) - tp_assign(ino, inode->i_ino) - tp_assign(dev, inode->i_sb->s_dev) - ), - - TP_printk("dev %d,%d ino %lu ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_sync_fs, @@ -515,20 +309,10 @@ LTTNG_TRACEPOINT_EVENT(ext3_sync_fs, TP_ARGS(sb, wait), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( int, wait ) - - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(wait, wait) - ), - - TP_printk("dev %d,%d wait %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->wait) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(int, wait, wait) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_rsv_window_add, @@ -537,21 +321,11 @@ LTTNG_TRACEPOINT_EVENT(ext3_rsv_window_add, TP_ARGS(sb, rsv_node), - TP_STRUCT__entry( - __field( unsigned long, start ) - __field( unsigned long, end ) - __field( dev_t, dev ) - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(start, rsv_node->rsv_window._rsv_start) - tp_assign(end, rsv_node->rsv_window._rsv_end) - ), - - TP_printk("dev %d,%d start %lu end %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->start, __entry->end) + TP_FIELDS( + ctf_integer(unsigned long, start, rsv_node->rsv_window._rsv_start) + ctf_integer(unsigned long, end, rsv_node->rsv_window._rsv_end) + ctf_integer(dev_t, dev, sb->s_dev) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_discard_reservation, @@ -560,24 +334,12 @@ LTTNG_TRACEPOINT_EVENT(ext3_discard_reservation, TP_ARGS(inode, rsv_node), - TP_STRUCT__entry( - __field( unsigned long, start ) - __field( unsigned long, end ) - __field( ino_t, ino ) - __field( dev_t, dev ) - ), - - TP_fast_assign( - tp_assign(start, rsv_node->rsv_window._rsv_start) - tp_assign(end, rsv_node->rsv_window._rsv_end) - tp_assign(ino, inode->i_ino) - tp_assign(dev, inode->i_sb->s_dev) - ), - - TP_printk("dev %d,%d ino %lu start %lu end %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long)__entry->ino, __entry->start, - __entry->end) + TP_FIELDS( + ctf_integer(unsigned long, start, rsv_node->rsv_window._rsv_start) + ctf_integer(unsigned long, end, rsv_node->rsv_window._rsv_end) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_alloc_new_reservation, @@ -585,19 +347,10 @@ LTTNG_TRACEPOINT_EVENT(ext3_alloc_new_reservation, TP_ARGS(sb, goal), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( unsigned long, goal ) - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(goal, goal) - ), - - TP_printk("dev %d,%d goal %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->goal) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(unsigned long, goal, goal) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_reserved, @@ -606,23 +359,12 @@ LTTNG_TRACEPOINT_EVENT(ext3_reserved, TP_ARGS(sb, block, rsv_node), - TP_STRUCT__entry( - __field( unsigned long, block ) - __field( unsigned long, start ) - __field( unsigned long, end ) - __field( dev_t, dev ) - ), - - TP_fast_assign( - tp_assign(block, block) - tp_assign(start, rsv_node->rsv_window._rsv_start) - tp_assign(end, rsv_node->rsv_window._rsv_end) - tp_assign(dev, sb->s_dev) - ), - - TP_printk("dev %d,%d block %lu, start %lu end %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->block, __entry->start, __entry->end) + TP_FIELDS( + ctf_integer(unsigned long, block, block) + ctf_integer(unsigned long, start, rsv_node->rsv_window._rsv_start) + ctf_integer(unsigned long, end, rsv_node->rsv_window._rsv_end) + ctf_integer(dev_t, dev, sb->s_dev) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_forget, @@ -630,26 +372,13 @@ LTTNG_TRACEPOINT_EVENT(ext3_forget, TP_ARGS(inode, is_metadata, block), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( umode_t, mode ) - __field( int, is_metadata ) - __field( unsigned long, block ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(mode, inode->i_mode) - tp_assign(is_metadata, is_metadata) - tp_assign(block, block) - ), - - TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->mode, __entry->is_metadata, __entry->block) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(umode_t, mode, inode->i_mode) + ctf_integer(int, is_metadata, is_metadata) + ctf_integer(unsigned long, block, block) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_read_block_bitmap, @@ -657,20 +386,10 @@ LTTNG_TRACEPOINT_EVENT(ext3_read_block_bitmap, TP_ARGS(sb, group), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( __u32, group ) - - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(group, group) - ), - - TP_printk("dev %d,%d group %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->group) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(__u32, group, group) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_direct_IO_enter, @@ -678,27 +397,13 @@ LTTNG_TRACEPOINT_EVENT(ext3_direct_IO_enter, TP_ARGS(inode, offset, len, rw), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( dev_t, dev ) - __field( loff_t, pos ) - __field( unsigned long, len ) - __field( int, rw ) - ), - - TP_fast_assign( - tp_assign(ino, inode->i_ino) - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(pos, offset) - tp_assign(len, len) - tp_assign(rw, rw) - ), - - TP_printk("dev %d,%d ino %lu pos %llu len %lu rw %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long long) __entry->pos, __entry->len, - __entry->rw) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, offset) + ctf_integer(unsigned long, len, len) + ctf_integer(int, rw, rw) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_direct_IO_exit, @@ -707,29 +412,14 @@ LTTNG_TRACEPOINT_EVENT(ext3_direct_IO_exit, TP_ARGS(inode, offset, len, rw, ret), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( dev_t, dev ) - __field( loff_t, pos ) - __field( unsigned long, len ) - __field( int, rw ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(ino, inode->i_ino) - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(pos, offset) - tp_assign(len, len) - tp_assign(rw, rw) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu pos %llu len %lu rw %d ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long long) __entry->pos, __entry->len, - __entry->rw, __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, offset) + ctf_integer(unsigned long, len, len) + ctf_integer(int, rw, rw) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_unlink_enter, @@ -737,25 +427,12 @@ LTTNG_TRACEPOINT_EVENT(ext3_unlink_enter, TP_ARGS(parent, dentry), - TP_STRUCT__entry( - __field( ino_t, parent ) - __field( ino_t, ino ) - __field( loff_t, size ) - __field( dev_t, dev ) - ), - - TP_fast_assign( - tp_assign(parent, parent->i_ino) - tp_assign(ino, dentry->d_inode->i_ino) - tp_assign(size, dentry->d_inode->i_size) - tp_assign(dev, dentry->d_inode->i_sb->s_dev) - ), - - TP_printk("dev %d,%d ino %lu size %lld parent %ld", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long long)__entry->size, - (unsigned long) __entry->parent) + TP_FIELDS( + ctf_integer(ino_t, parent, parent->i_ino) + ctf_integer(ino_t, ino, dentry->d_inode->i_ino) + ctf_integer(loff_t, size, dentry->d_inode->i_size) + ctf_integer(dev_t, dev, dentry->d_inode->i_sb->s_dev) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_unlink_exit, @@ -763,22 +440,11 @@ LTTNG_TRACEPOINT_EVENT(ext3_unlink_exit, TP_ARGS(dentry, ret), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( dev_t, dev ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(ino, dentry->d_inode->i_ino) - tp_assign(dev, dentry->d_inode->i_sb->s_dev) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, dentry->d_inode->i_sb->s_dev) + ctf_integer(ino_t, ino, dentry->d_inode->i_ino) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(ext3__truncate, @@ -786,21 +452,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext3__truncate, TP_ARGS(inode), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( dev_t, dev ) - __field( blkcnt_t, blocks ) - ), - - TP_fast_assign( - tp_assign(ino, inode->i_ino) - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(blocks, inode->i_blocks) - ), - - TP_printk("dev %d,%d ino %lu blocks %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, (unsigned long) __entry->blocks) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(blkcnt_t, blocks, inode->i_blocks) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext3__truncate, ext3_truncate_enter, @@ -823,26 +479,13 @@ LTTNG_TRACEPOINT_EVENT(ext3_get_blocks_enter, TP_ARGS(inode, lblk, len, create), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( dev_t, dev ) - __field( unsigned long, lblk ) - __field( unsigned long, len ) - __field( int, create ) - ), - - TP_fast_assign( - tp_assign(ino, inode->i_ino) - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(lblk, lblk) - tp_assign(len, len) - tp_assign(create, create) - ), - - TP_printk("dev %d,%d ino %lu lblk %lu len %lu create %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->lblk, __entry->len, __entry->create) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(unsigned long, lblk, lblk) + ctf_integer(unsigned long, len, len) + ctf_integer(int, create, create) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_get_blocks_exit, @@ -851,29 +494,14 @@ LTTNG_TRACEPOINT_EVENT(ext3_get_blocks_exit, TP_ARGS(inode, lblk, pblk, len, ret), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( dev_t, dev ) - __field( unsigned long, lblk ) - __field( unsigned long, pblk ) - __field( unsigned long, len ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(ino, inode->i_ino) - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(lblk, lblk) - tp_assign(pblk, pblk) - tp_assign(len, len) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu lblk %lu pblk %lu len %lu ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->lblk, __entry->pblk, - __entry->len, __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(unsigned long, lblk, lblk) + ctf_integer(unsigned long, pblk, pblk) + ctf_integer(unsigned long, len, len) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT(ext3_load_inode, @@ -881,19 +509,10 @@ LTTNG_TRACEPOINT_EVENT(ext3_load_inode, TP_ARGS(inode), - TP_STRUCT__entry( - __field( ino_t, ino ) - __field( dev_t, dev ) - ), - - TP_fast_assign( - tp_assign(ino, inode->i_ino) - tp_assign(dev, inode->i_sb->s_dev) - ), - - TP_printk("dev %d,%d ino %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ) ) #endif /* LTTNG_TRACE_EXT3_H */ diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h index 6169fefc..41c89fd3 100644 --- a/instrumentation/events/lttng-module/ext4.h +++ b/instrumentation/events/lttng-module/ext4.h @@ -33,33 +33,19 @@ LTTNG_TRACEPOINT_EVENT(ext4_free_inode, TP_ARGS(inode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( uid_t, uid ) - __field( gid_t, gid ) - __field( __u64, blocks ) - __field( TP_MODE_T, mode ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) - tp_assign(uid, i_uid_read(inode)) - tp_assign(gid, i_gid_read(inode)) + ctf_integer(uid_t, uid, i_uid_read(inode)) + ctf_integer(gid_t, gid, i_gid_read(inode)) #else - tp_assign(uid, inode->i_uid) - tp_assign(gid, inode->i_gid) + ctf_integer(uid_t, uid, inode->i_uid) + ctf_integer(gid_t, gid, inode->i_gid) #endif - tp_assign(blocks, inode->i_blocks) - tp_assign(mode, inode->i_mode) - ), - - TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->mode, - __entry->uid, __entry->gid, __entry->blocks) + ctf_integer(__u64, blocks, inode->i_blocks) + ctf_integer(TP_MODE_T, mode, inode->i_mode) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_request_inode, @@ -67,21 +53,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_request_inode, TP_ARGS(dir, mode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, dir ) - __field( TP_MODE_T, mode ) - ), - - TP_fast_assign( - tp_assign(dev, dir->i_sb->s_dev) - tp_assign(dir, dir->i_ino) - tp_assign(mode, mode) - ), - - TP_printk("dev %d,%d dir %lu mode 0%o", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->dir, __entry->mode) + TP_FIELDS( + ctf_integer(dev_t, dev, dir->i_sb->s_dev) + ctf_integer(ino_t, dir, dir->i_ino) + ctf_integer(TP_MODE_T, mode, mode) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_allocate_inode, @@ -89,24 +65,12 @@ LTTNG_TRACEPOINT_EVENT(ext4_allocate_inode, TP_ARGS(inode, dir, mode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ino_t, dir ) - __field( TP_MODE_T, mode ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(dir, dir->i_ino) - tp_assign(mode, mode) - ), - - TP_printk("dev %d,%d ino %lu dir %lu mode 0%o", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long) __entry->dir, __entry->mode) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ino_t, dir, dir->i_ino) + ctf_integer(TP_MODE_T, mode, mode) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) @@ -115,21 +79,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_evict_inode, TP_ARGS(inode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( int, nlink ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(nlink, inode->i_nlink) - ), - - TP_printk("dev %d,%d ino %lu nlink %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->nlink) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(int, nlink, inode->i_nlink) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_drop_inode, @@ -137,21 +91,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_drop_inode, TP_ARGS(inode, drop), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( int, drop ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(drop, drop) - ), - - TP_printk("dev %d,%d ino %lu drop %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->drop) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(int, drop, drop) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_mark_inode_dirty, @@ -159,21 +103,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_mark_inode_dirty, TP_ARGS(inode, IP), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field(unsigned long, ip ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(ip, IP) - ), - - TP_printk("dev %d,%d ino %lu caller %pF", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, (void *)__entry->ip) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(unsigned long, ip, IP) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_begin_ordered_truncate, @@ -181,22 +115,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_begin_ordered_truncate, TP_ARGS(inode, new_size), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, new_size ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(new_size, new_size) - ), - - TP_printk("dev %d,%d ino %lu new_size %lld", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->new_size) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, new_size, new_size) + ) ) #endif @@ -207,26 +130,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__write_begin, TP_ARGS(inode, pos, len, flags), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, pos ) - __field( unsigned int, len ) - __field( unsigned int, flags ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pos, pos) - tp_assign(len, len) - tp_assign(flags, flags) - ), - - TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->pos, __entry->len, __entry->flags) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, pos) + ctf_integer(unsigned int, len, len) + ctf_integer(unsigned int, flags, flags) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__write_begin, ext4_write_begin, @@ -251,26 +161,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__write_end, TP_ARGS(inode, pos, len, copied), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, pos ) - __field( unsigned int, len ) - __field( unsigned int, copied ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pos, pos) - tp_assign(len, len) - tp_assign(copied, copied) - ), - - TP_printk("dev %d,%d ino %lu pos %lld len %u copied %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->pos, __entry->len, __entry->copied) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, pos) + ctf_integer(unsigned int, len, len) + ctf_integer(unsigned int, copied, copied) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__write_end, ext4_ordered_write_end, @@ -311,22 +208,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_writepage, TP_ARGS(inode, page), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( pgoff_t, index ) - - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(index, page->index) - ), - - TP_printk("dev %d,%d ino %lu page_index %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->index) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(pgoff_t, index, page->index) + ) ) #endif @@ -335,79 +221,26 @@ LTTNG_TRACEPOINT_EVENT(ext4_da_writepages, TP_ARGS(inode, wbc), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( long, nr_to_write ) - __field( long, pages_skipped ) - __field( loff_t, range_start ) - __field( loff_t, range_end ) - __field( pgoff_t, writeback_index ) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(long, nr_to_write, wbc->nr_to_write) + ctf_integer(long, pages_skipped, wbc->pages_skipped) + ctf_integer(loff_t, range_start, wbc->range_start) + ctf_integer(loff_t, range_end, wbc->range_end) + ctf_integer(pgoff_t, writeback_index, inode->i_mapping->writeback_index) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - __field( int, sync_mode ) + ctf_integer(int, sync_mode, wbc->sync_mode) #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) - __field( char, nonblocking ) + ctf_integer(char, nonblocking, wbc->nonblocking) #endif - __field( char, for_kupdate ) + ctf_integer(char, for_kupdate, wbc->for_kupdate) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) - __field( char, for_reclaim ) -#endif - __field( char, range_cyclic ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(nr_to_write, wbc->nr_to_write) - tp_assign(pages_skipped, wbc->pages_skipped) - tp_assign(range_start, wbc->range_start) - tp_assign(range_end, wbc->range_end) - tp_assign(writeback_index, inode->i_mapping->writeback_index) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - tp_assign(sync_mode, wbc->sync_mode) + ctf_integer(char, for_reclaim, wbc->for_reclaim) #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) - tp_assign(nonblocking, wbc->nonblocking) -#endif - tp_assign(for_kupdate, wbc->for_kupdate) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) - tp_assign(for_reclaim, wbc->for_reclaim) -#endif - tp_assign(range_cyclic, wbc->range_cyclic) - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld " - "range_start %lld range_end %lld sync_mode %d " - "for_kupdate %d range_cyclic %d writeback_index %lu", -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld " - "range_start %llu range_end %llu " - "for_kupdate %d for_reclaim %d " - "range_cyclic %d writeback_index %lu", -#else - TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld " - "range_start %llu range_end %llu " - "nonblocking %d for_kupdate %d for_reclaim %d " - "range_cyclic %d writeback_index %lu", -#endif - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->nr_to_write, - __entry->pages_skipped, __entry->range_start, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - __entry->range_end, __entry->sync_mode, - __entry->for_kupdate, __entry->range_cyclic, -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - __entry->range_end, - __entry->for_kupdate, __entry->for_reclaim, - __entry->range_cyclic, -#else - __entry->range_end, __entry->nonblocking, - __entry->for_kupdate, __entry->for_reclaim, - __entry->range_cyclic, -#endif - (unsigned long) __entry->writeback_index) + ctf_integer(char, range_cyclic, wbc->range_cyclic) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) @@ -418,27 +251,13 @@ LTTNG_TRACEPOINT_EVENT(ext4_da_write_pages, TP_ARGS(inode, first_page, wbc), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( pgoff_t, first_page ) - __field( long, nr_to_write ) - __field( int, sync_mode ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(first_page, first_page) - tp_assign(nr_to_write, wbc->nr_to_write) - tp_assign(sync_mode, wbc->sync_mode) - ), - - TP_printk("dev %d,%d ino %lu first_page %lu nr_to_write %ld " - "sync_mode %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->first_page, - __entry->nr_to_write, __entry->sync_mode) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(pgoff_t, first_page, first_page) + ctf_integer(long, nr_to_write, wbc->nr_to_write) + ctf_integer(int, sync_mode, wbc->sync_mode) + ) ) #else @@ -448,52 +267,19 @@ LTTNG_TRACEPOINT_EVENT(ext4_da_write_pages, TP_ARGS(inode, mpd), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, b_blocknr ) - __field( __u32, b_size ) - __field( __u32, b_state ) - __field( unsigned long, first_page ) - __field( int, io_done ) - __field( int, pages_written ) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(__u64, b_blocknr, mpd->b_blocknr) + ctf_integer(__u32, b_size, mpd->b_size) + ctf_integer(__u32, b_state, mpd->b_state) + ctf_integer(unsigned long, first_page, mpd->first_page) + ctf_integer(int, io_done, mpd->io_done) + ctf_integer(int, pages_written, mpd->pages_written) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - __field( int, sync_mode ) + ctf_integer(int, sync_mode, mpd->sync_mode) #endif - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(b_blocknr, mpd->b_blocknr) - tp_assign(b_size, mpd->b_size) - tp_assign(b_state, mpd->b_state) - tp_assign(first_page, mpd->first_page) - tp_assign(io_done, mpd->io_done) - tp_assign(pages_written, mpd->pages_written) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - tp_assign(sync_mode, mpd->wbc->sync_mode) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - TP_printk("dev %d,%d ino %lu b_blocknr %llu b_size %u b_state 0x%04x " - "first_page %lu io_done %d pages_written %d sync_mode %d", -#else - TP_printk("dev %d,%d ino %lu b_blocknr %llu b_size %u b_state 0x%04x " - "first_page %lu io_done %d pages_written %d", -#endif - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->b_blocknr, __entry->b_size, - __entry->b_state, __entry->first_page, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - __entry->io_done, __entry->pages_written, - __entry->sync_mode -#else - __entry->io_done, __entry->pages_written -#endif - ) + ) ) #endif @@ -505,26 +291,13 @@ LTTNG_TRACEPOINT_EVENT(ext4_da_write_pages_extent, TP_ARGS(inode, map), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, lblk ) - __field( __u32, len ) - __field( __u32, flags ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, map->m_lblk) - tp_assign(len, map->m_len) - tp_assign(flags, map->m_flags) - ), - - TP_printk("dev %d,%d ino %lu lblk %llu len %u flags %s", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->lblk, __entry->len, - show_mflags(__entry->flags)) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(__u64, lblk, map->m_lblk) + ctf_integer(__u32, len, map->m_len) + ctf_integer(__u32, flags, map->m_flags) + ) ) #endif @@ -535,91 +308,26 @@ LTTNG_TRACEPOINT_EVENT(ext4_da_writepages_result, TP_ARGS(inode, wbc, ret, pages_written), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( int, ret ) - __field( int, pages_written ) - __field( long, pages_skipped ) - __field( pgoff_t, writeback_index ) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(int, ret, ret) + ctf_integer(int, pages_written, pages_written) + ctf_integer(long, pages_skipped, wbc->pages_skipped) + ctf_integer(pgoff_t, writeback_index, inode->i_mapping->writeback_index) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - __field( int, sync_mode ) + ctf_integer(int, sync_mode, wbc->sync_mode) #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) - __field( char, encountered_congestion ) + ctf_integer(char, encountered_congestion, wbc->encountered_congestion) #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - __field( char, more_io ) + ctf_integer(char, more_io, wbc->more_io) #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) - __field( char, no_nrwrite_index_update ) -#endif - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(ret, ret) - tp_assign(pages_written, pages_written) - tp_assign(pages_skipped, wbc->pages_skipped) - tp_assign(writeback_index, inode->i_mapping->writeback_index) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - tp_assign(sync_mode, wbc->sync_mode) -#endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) - tp_assign(encountered_congestion, wbc->encountered_congestion) -#endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - tp_assign(more_io, wbc->more_io) -#endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) - tp_assign(no_nrwrite_index_update, wbc->no_nrwrite_index_update) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) - TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld " - "sync_mode %d writeback_index %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->ret, - __entry->pages_written, __entry->pages_skipped, - __entry->sync_mode, - (unsigned long) __entry->writeback_index) -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld " - " more_io %d sync_mode %d writeback_index %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->ret, - __entry->pages_written, __entry->pages_skipped, - __entry->more_io, __entry->sync_mode, - (unsigned long) __entry->writeback_index) -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld " - " more_io %d writeback_index %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->ret, - __entry->pages_written, __entry->pages_skipped, - __entry->more_io, - (unsigned long) __entry->writeback_index) -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) - TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld " - " more_io %d no_nrwrite_index_update %d writeback_index %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->ret, - __entry->pages_written, __entry->pages_skipped, - __entry->more_io, __entry->no_nrwrite_index_update, - (unsigned long) __entry->writeback_index) -#else - TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld " - " congestion %d" - " more_io %d no_nrwrite_index_update %d writeback_index %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->ret, - __entry->pages_written, __entry->pages_skipped, - __entry->encountered_congestion, - __entry->more_io, __entry->no_nrwrite_index_update, - (unsigned long) __entry->writeback_index) + ctf_integer(char, no_nrwrite_index_update, wbc->no_nrwrite_index_update) #endif + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) @@ -628,23 +336,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__page_op, TP_ARGS(page), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( pgoff_t, index ) - - ), - - TP_fast_assign( - tp_assign(dev, page->mapping->host->i_sb->s_dev) - tp_assign(ino, page->mapping->host->i_ino) - tp_assign(index, page->index) - ), - - TP_printk("dev %d,%d ino %lu page_index %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long) __entry->index) + TP_FIELDS( + ctf_integer(dev_t, dev, page->mapping->host->i_sb->s_dev) + ctf_integer(ino_t, ino, page->mapping->host->i_ino) + ctf_integer(pgoff_t, index, page->index) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40)) @@ -677,27 +373,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4_invalidatepage_op, TP_ARGS(page, offset, length), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( pgoff_t, index ) - __field( unsigned int, offset ) - __field( unsigned int, length ) - ), - - TP_fast_assign( - tp_assign(dev, page->mapping->host->i_sb->s_dev) - tp_assign(ino, page->mapping->host->i_ino) - tp_assign(index, page->index) - tp_assign(offset, offset) - tp_assign(length, length) - ), - - TP_printk("dev %d,%d ino %lu page_index %lu offset %u length %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long) __entry->index, - __entry->offset, __entry->length) + TP_FIELDS( + ctf_integer(dev_t, dev, page->mapping->host->i_sb->s_dev) + ctf_integer(ino_t, ino, page->mapping->host->i_ino) + ctf_integer(pgoff_t, index, page->index) + ctf_integer(unsigned int, offset, offset) + ctf_integer(unsigned int, length, length) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4_invalidatepage_op, ext4_invalidatepage, @@ -719,25 +401,13 @@ LTTNG_TRACEPOINT_EVENT(ext4_invalidatepage, TP_ARGS(page, offset), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( pgoff_t, index ) - __field( unsigned long, offset ) - - ), + TP_FIELDS( + ctf_integer(dev_t, dev, page->mapping->host->i_sb->s_dev) + ctf_integer(ino_t, ino, page->mapping->host->i_ino) + ctf_integer(pgoff_t, index, page->index) + ctf_integer(unsigned long, offset, offset) - TP_fast_assign( - tp_assign(dev, page->mapping->host->i_sb->s_dev) - tp_assign(ino, page->mapping->host->i_ino) - tp_assign(index, page->index) - tp_assign(offset, offset) - ), - - TP_printk("dev %d,%d ino %lu page_index %lu offset %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long) __entry->index, __entry->offset) + ) ) #endif @@ -750,22 +420,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_blocks, TP_ARGS(sb, blk, count), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( __u64, blk ) - __field( __u64, count ) - - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(blk, blk) - tp_assign(count, count) - ), - - TP_printk("dev %d,%d blk %llu count %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->blk, __entry->count) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(__u64, blk, blk) + ctf_integer(__u64, count, count) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(ext4__mb_new_pa, @@ -774,27 +433,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__mb_new_pa, TP_ARGS(ac, pa), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, pa_pstart ) - __field( __u64, pa_lstart ) - __field( __u32, pa_len ) - - ), - - TP_fast_assign( - tp_assign(dev, ac->ac_sb->s_dev) - tp_assign(ino, ac->ac_inode->i_ino) - tp_assign(pa_pstart, pa->pa_pstart) - tp_assign(pa_lstart, pa->pa_lstart) - tp_assign(pa_len, pa->pa_len) - ), - - TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart) + TP_FIELDS( + ctf_integer(dev_t, dev, ac->ac_sb->s_dev) + ctf_integer(ino_t, ino, ac->ac_inode->i_ino) + ctf_integer(__u64, pa_pstart, pa->pa_pstart) + ctf_integer(__u64, pa_lstart, pa->pa_lstart) + ctf_integer(__u32, pa_len, pa->pa_len) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__mb_new_pa, ext4_mb_new_inode_pa, @@ -839,38 +484,26 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_inode_pa, TP_ARGS(ac, pa, block, count), #endif - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, block ) - __field( __u32, count ) - - ), - - TP_fast_assign( + TP_FIELDS( #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40)) - tp_assign(dev, pa->pa_inode->i_sb->s_dev) - tp_assign(ino, pa->pa_inode->i_ino) + ctf_integer(dev_t, dev, pa->pa_inode->i_sb->s_dev) + ctf_integer(ino_t, ino, pa->pa_inode->i_ino) #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) - tp_assign(dev, sb->s_dev) + ctf_integer(dev_t, dev, sb->s_dev) #else - tp_assign(dev, ac->ac_sb->s_dev) + ctf_integer(dev_t, dev, ac->ac_sb->s_dev) #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - tp_assign(ino, inode->i_ino) + ctf_integer(ino_t, ino, inode->i_ino) #else - tp_assign(ino, (ac && ac->ac_inode) ? ac->ac_inode->i_ino : 0) + ctf_integer(ino_t, ino, + (ac && ac->ac_inode) ? ac->ac_inode->i_ino : 0) #endif #endif - tp_assign(block, block) - tp_assign(count, count) - ), - - TP_printk("dev %d,%d ino %lu block %llu count %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->block, __entry->count) + ctf_integer(__u64, block, block) + ctf_integer(__u32, count, count) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa, @@ -896,34 +529,21 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa, TP_ARGS(ac, pa), #endif - TP_STRUCT__entry( - __field( dev_t, dev ) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) - __field( ino_t, ino ) -#endif - __field( __u64, pa_pstart ) - __field( __u32, pa_len ) - - ), - - TP_fast_assign( + TP_FIELDS( #if (LTTNG_KERNEL_RANGE(2,6,40, 3,3,0)) - tp_assign(dev, pa->pa_inode->i_sb->s_dev) + ctf_integer(dev_t, dev, pa->pa_inode->i_sb->s_dev) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) - tp_assign(dev, sb->s_dev) + ctf_integer(dev_t, dev, sb->s_dev) #else - tp_assign(dev, ac->ac_sb->s_dev) + ctf_integer(dev_t, dev, ac->ac_sb->s_dev) #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) - tp_assign(ino, (ac && ac->ac_inode) ? ac->ac_inode->i_ino : 0) + ctf_integer(ino_t, ino, + (ac && ac->ac_inode) ? ac->ac_inode->i_ino : 0) #endif - tp_assign(pa_pstart, pa->pa_pstart) - tp_assign(pa_len, pa->pa_len) - ), - - TP_printk("dev %d,%d pstart %llu len %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->pa_pstart, __entry->pa_len) + ctf_integer(__u64, pa_pstart, pa->pa_pstart) + ctf_integer(__u32, pa_len, pa->pa_len) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations, @@ -931,20 +551,10 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations, TP_ARGS(inode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - ), - - TP_printk("dev %d,%d ino %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations, @@ -952,20 +562,10 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations, TP_ARGS(sb, needed), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( int, needed ) - - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(needed, needed) - ), - - TP_printk("dev %d,%d needed %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->needed) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(int, needed, needed) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_request_blocks, @@ -973,39 +573,18 @@ LTTNG_TRACEPOINT_EVENT(ext4_request_blocks, TP_ARGS(ar), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( unsigned int, len ) - __field( __u32, logical ) - __field( __u32, lleft ) - __field( __u32, lright ) - __field( __u64, goal ) - __field( __u64, pleft ) - __field( __u64, pright ) - __field( unsigned int, flags ) - ), - - TP_fast_assign( - tp_assign(dev, ar->inode->i_sb->s_dev) - tp_assign(ino, ar->inode->i_ino) - tp_assign(len, ar->len) - tp_assign(logical, ar->logical) - tp_assign(goal, ar->goal) - tp_assign(lleft, ar->lleft) - tp_assign(lright, ar->lright) - tp_assign(pleft, ar->pleft) - tp_assign(pright, ar->pright) - tp_assign(flags, ar->flags) - ), - - TP_printk("dev %d,%d ino %lu flags %u len %u lblk %u goal %llu " - "lleft %u lright %u pleft %llu pright %llu ", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->flags, - __entry->len, __entry->logical, __entry->goal, - __entry->lleft, __entry->lright, __entry->pleft, - __entry->pright) + TP_FIELDS( + ctf_integer(dev_t, dev, ar->inode->i_sb->s_dev) + ctf_integer(ino_t, ino, ar->inode->i_ino) + ctf_integer(unsigned int, len, ar->len) + ctf_integer(__u32, logical, ar->logical) + ctf_integer(__u32, lleft, ar->lleft) + ctf_integer(__u32, lright, ar->lright) + ctf_integer(__u64, goal, ar->goal) + ctf_integer(__u64, pleft, ar->pleft) + ctf_integer(__u64, pright, ar->pright) + ctf_integer(unsigned int, flags, ar->flags) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_allocate_blocks, @@ -1013,41 +592,19 @@ LTTNG_TRACEPOINT_EVENT(ext4_allocate_blocks, TP_ARGS(ar, block), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, block ) - __field( unsigned int, len ) - __field( __u32, logical ) - __field( __u32, lleft ) - __field( __u32, lright ) - __field( __u64, goal ) - __field( __u64, pleft ) - __field( __u64, pright ) - __field( unsigned int, flags ) - ), - - TP_fast_assign( - tp_assign(dev, ar->inode->i_sb->s_dev) - tp_assign(ino, ar->inode->i_ino) - tp_assign(block, block) - tp_assign(len, ar->len) - tp_assign(logical, ar->logical) - tp_assign(goal, ar->goal) - tp_assign(lleft, ar->lleft) - tp_assign(lright, ar->lright) - tp_assign(pleft, ar->pleft) - tp_assign(pright, ar->pright) - tp_assign(flags, ar->flags) - ), - - TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %u " - "goal %llu lleft %u lright %u pleft %llu pright %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->flags, - __entry->len, __entry->block, __entry->logical, - __entry->goal, __entry->lleft, __entry->lright, - __entry->pleft, __entry->pright) + TP_FIELDS( + ctf_integer(dev_t, dev, ar->inode->i_sb->s_dev) + ctf_integer(ino_t, ino, ar->inode->i_ino) + ctf_integer(__u64, block, block) + ctf_integer(unsigned int, len, ar->len) + ctf_integer(__u32, logical, ar->logical) + ctf_integer(__u32, lleft, ar->lleft) + ctf_integer(__u32, lright, ar->lright) + ctf_integer(__u64, goal, ar->goal) + ctf_integer(__u64, pleft, ar->pleft) + ctf_integer(__u64, pright, ar->pright) + ctf_integer(unsigned int, flags, ar->flags) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_free_blocks, @@ -1063,45 +620,18 @@ LTTNG_TRACEPOINT_EVENT(ext4_free_blocks, TP_ARGS(inode, block, count, metadata), #endif - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, block ) - __field( unsigned long, count ) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(__u64, block, block) + ctf_integer(unsigned long, count, count) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) - __field( int, flags ) - __field( TP_MODE_T, mode ) + ctf_integer(int, flags, flags) + ctf_integer(TP_MODE_T, mode, inode->i_mode) #else - __field( int, metadata ) -#endif - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(block, block) - tp_assign(count, count) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) - tp_assign(flags, flags) - tp_assign(mode, inode->i_mode) -#else - tp_assign(metadata, metadata) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) - TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d", -#else - TP_printk("dev %d,%d ino %lu block %llu count %lu metadata %d", -#endif - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) - __entry->mode, __entry->block, __entry->count, - __entry->flags) -#else - __entry->block, __entry->count, __entry->metadata) + ctf_integer(int, metadata, metadata) #endif + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) @@ -1119,31 +649,18 @@ LTTNG_TRACEPOINT_EVENT(ext4_sync_file, TP_ARGS(file, dentry, datasync), #endif - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ino_t, parent ) - __field( int, datasync ) - ), - - TP_fast_assign( + TP_FIELDS( #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - tp_assign(dev, file->f_path.dentry->d_inode->i_sb->s_dev) - tp_assign(ino, file->f_path.dentry->d_inode->i_ino) - tp_assign(datasync, datasync) - tp_assign(parent, file->f_path.dentry->d_parent->d_inode->i_ino) + ctf_integer(dev_t, dev, file->f_path.dentry->d_inode->i_sb->s_dev) + ctf_integer(ino_t, ino, file->f_path.dentry->d_inode->i_ino) + ctf_integer(ino_t, parent, file->f_path.dentry->d_parent->d_inode->i_ino) #else - tp_assign(dev, dentry->d_inode->i_sb->s_dev) - tp_assign(ino, dentry->d_inode->i_ino) - tp_assign(datasync, datasync) - tp_assign(parent, dentry->d_parent->d_inode->i_ino) + ctf_integer(dev_t, dev, dentry->d_inode->i_sb->s_dev) + ctf_integer(ino_t, ino, dentry->d_inode->i_ino) + ctf_integer(ino_t, parent, dentry->d_parent->d_inode->i_ino) #endif - ), - - TP_printk("dev %d,%d ino %lu parent %lu datasync %d ", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long) __entry->parent, __entry->datasync) + ctf_integer(int, datasync, datasync) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) @@ -1152,22 +669,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_sync_file_exit, TP_ARGS(inode, ret), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(int, ret, ret) + ) ) #endif @@ -1176,20 +682,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_sync_fs, TP_ARGS(sb, wait), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( int, wait ) - - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(wait, wait) - ), + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(int, wait, wait) - TP_printk("dev %d,%d wait %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->wait) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_alloc_da_blocks, @@ -1197,24 +694,12 @@ LTTNG_TRACEPOINT_EVENT(ext4_alloc_da_blocks, TP_ARGS(inode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( unsigned int, data_blocks ) - __field( unsigned int, meta_blocks ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(data_blocks, EXT4_I(inode)->i_reserved_data_blocks) - tp_assign(meta_blocks, EXT4_I(inode)->i_reserved_meta_blocks) - ), - - TP_printk("dev %d,%d ino %lu data_blocks %u meta_blocks %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->data_blocks, __entry->meta_blocks) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(unsigned int, data_blocks, EXT4_I(inode)->i_reserved_data_blocks) + ctf_integer(unsigned int, meta_blocks, EXT4_I(inode)->i_reserved_meta_blocks) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_mballoc_alloc, @@ -1222,66 +707,28 @@ LTTNG_TRACEPOINT_EVENT(ext4_mballoc_alloc, TP_ARGS(ac), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u32, orig_logical ) - __field( int, orig_start ) - __field( __u32, orig_group ) - __field( int, orig_len ) - __field( __u32, goal_logical ) - __field( int, goal_start ) - __field( __u32, goal_group ) - __field( int, goal_len ) - __field( __u32, result_logical ) - __field( int, result_start ) - __field( __u32, result_group ) - __field( int, result_len ) - __field( __u16, found ) - __field( __u16, groups ) - __field( __u16, buddy ) - __field( __u16, flags ) - __field( __u16, tail ) - __field( __u8, cr ) - ), - - TP_fast_assign( - tp_assign(dev, ac->ac_inode->i_sb->s_dev) - tp_assign(ino, ac->ac_inode->i_ino) - tp_assign(orig_logical, ac->ac_o_ex.fe_logical) - tp_assign(orig_start, ac->ac_o_ex.fe_start) - tp_assign(orig_group, ac->ac_o_ex.fe_group) - tp_assign(orig_len, ac->ac_o_ex.fe_len) - tp_assign(goal_logical, ac->ac_g_ex.fe_logical) - tp_assign(goal_start, ac->ac_g_ex.fe_start) - tp_assign(goal_group, ac->ac_g_ex.fe_group) - tp_assign(goal_len, ac->ac_g_ex.fe_len) - tp_assign(result_logical, ac->ac_f_ex.fe_logical) - tp_assign(result_start, ac->ac_f_ex.fe_start) - tp_assign(result_group, ac->ac_f_ex.fe_group) - tp_assign(result_len, ac->ac_f_ex.fe_len) - tp_assign(found, ac->ac_found) - tp_assign(flags, ac->ac_flags) - tp_assign(groups, ac->ac_groups_scanned) - tp_assign(buddy, ac->ac_buddy) - tp_assign(tail, ac->ac_tail) - tp_assign(cr, ac->ac_criteria) - ), - - TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u " - "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x " - "tail %u broken %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->orig_group, __entry->orig_start, - __entry->orig_len, __entry->orig_logical, - __entry->goal_group, __entry->goal_start, - __entry->goal_len, __entry->goal_logical, - __entry->result_group, __entry->result_start, - __entry->result_len, __entry->result_logical, - __entry->found, __entry->groups, __entry->cr, - __entry->flags, __entry->tail, - __entry->buddy ? 1 << __entry->buddy : 0) + TP_FIELDS( + ctf_integer(dev_t, dev, ac->ac_inode->i_sb->s_dev) + ctf_integer(ino_t, ino, ac->ac_inode->i_ino) + ctf_integer(__u32, orig_logical, ac->ac_o_ex.fe_logical) + ctf_integer(int, orig_start, ac->ac_o_ex.fe_start) + ctf_integer(__u32, orig_group, ac->ac_o_ex.fe_group) + ctf_integer(int, orig_len, ac->ac_o_ex.fe_len) + ctf_integer(__u32, goal_logical, ac->ac_g_ex.fe_logical) + ctf_integer(int, goal_start, ac->ac_g_ex.fe_start) + ctf_integer(__u32, goal_group, ac->ac_g_ex.fe_group) + ctf_integer(int, goal_len, ac->ac_g_ex.fe_len) + ctf_integer(__u32, result_logical, ac->ac_f_ex.fe_logical) + ctf_integer(int, result_start, ac->ac_f_ex.fe_start) + ctf_integer(__u32, result_group, ac->ac_f_ex.fe_group) + ctf_integer(int, result_len, ac->ac_f_ex.fe_len) + ctf_integer(__u16, found, ac->ac_found) + ctf_integer(__u16, groups, ac->ac_groups_scanned) + ctf_integer(__u16, buddy, ac->ac_buddy) + ctf_integer(__u16, flags, ac->ac_flags) + ctf_integer(__u16, tail, ac->ac_tail) + ctf_integer(__u8, cr, ac->ac_criteria) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_mballoc_prealloc, @@ -1289,39 +736,18 @@ LTTNG_TRACEPOINT_EVENT(ext4_mballoc_prealloc, TP_ARGS(ac), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u32, orig_logical ) - __field( int, orig_start ) - __field( __u32, orig_group ) - __field( int, orig_len ) - __field( __u32, result_logical ) - __field( int, result_start ) - __field( __u32, result_group ) - __field( int, result_len ) - ), - - TP_fast_assign( - tp_assign(dev, ac->ac_inode->i_sb->s_dev) - tp_assign(ino, ac->ac_inode->i_ino) - tp_assign(orig_logical, ac->ac_o_ex.fe_logical) - tp_assign(orig_start, ac->ac_o_ex.fe_start) - tp_assign(orig_group, ac->ac_o_ex.fe_group) - tp_assign(orig_len, ac->ac_o_ex.fe_len) - tp_assign(result_logical, ac->ac_b_ex.fe_logical) - tp_assign(result_start, ac->ac_b_ex.fe_start) - tp_assign(result_group, ac->ac_b_ex.fe_group) - tp_assign(result_len, ac->ac_b_ex.fe_len) - ), - - TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->orig_group, __entry->orig_start, - __entry->orig_len, __entry->orig_logical, - __entry->result_group, __entry->result_start, - __entry->result_len, __entry->result_logical) + TP_FIELDS( + ctf_integer(dev_t, dev, ac->ac_inode->i_sb->s_dev) + ctf_integer(ino_t, ino, ac->ac_inode->i_ino) + ctf_integer(__u32, orig_logical, ac->ac_o_ex.fe_logical) + ctf_integer(int, orig_start, ac->ac_o_ex.fe_start) + ctf_integer(__u32, orig_group, ac->ac_o_ex.fe_group) + ctf_integer(int, orig_len, ac->ac_o_ex.fe_len) + ctf_integer(__u32, result_logical, ac->ac_b_ex.fe_logical) + ctf_integer(int, result_start, ac->ac_b_ex.fe_start) + ctf_integer(__u32, result_group, ac->ac_b_ex.fe_group) + ctf_integer(int, result_len, ac->ac_b_ex.fe_len) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(ext4__mballoc, @@ -1339,46 +765,20 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__mballoc, TP_ARGS(ac), #endif - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) - __field( __u32, result_logical ) -#endif - __field( int, result_start ) - __field( __u32, result_group ) - __field( int, result_len ) - ), - - TP_fast_assign( + TP_FIELDS( #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - tp_assign(dev, sb->s_dev) - tp_assign(ino, inode ? inode->i_ino : 0) - tp_assign(result_start, start) - tp_assign(result_group, group) - tp_assign(result_len, len) + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(ino_t, ino, inode ? inode->i_ino : 0) + ctf_integer(int, result_start, start) + ctf_integer(__u32, result_group, group) + ctf_integer(int, result_len, len) #else - tp_assign(dev, ac->ac_sb->s_dev) - tp_assign(ino, ac->ac_inode ? ac->ac_inode->i_ino : 0) - tp_assign(result_logical, ac->ac_b_ex.fe_logical) - tp_assign(result_start, ac->ac_b_ex.fe_start) - tp_assign(result_group, ac->ac_b_ex.fe_group) - tp_assign(result_len, ac->ac_b_ex.fe_len) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - TP_printk("dev %d,%d inode %lu extent %u/%d/%d ", -#else - TP_printk("dev %d,%d inode %lu extent %u/%d/%u@%u ", -#endif - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->result_group, __entry->result_start, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - __entry->result_len -#else - __entry->result_len, __entry->result_logical + ctf_integer(dev_t, dev, ac->ac_sb->s_dev) + ctf_integer(ino_t, ino, ac->ac_inode ? ac->ac_inode->i_ino : 0) + ctf_integer(__u32, result_logical, ac->ac_b_ex.fe_logical) + ctf_integer(int, result_start, ac->ac_b_ex.fe_start) + ctf_integer(__u32, result_group, ac->ac_b_ex.fe_group) + ctf_integer(int, result_len, ac->ac_b_ex.fe_len) #endif ) ) @@ -1423,26 +823,13 @@ LTTNG_TRACEPOINT_EVENT(ext4_forget, TP_ARGS(inode, is_metadata, block), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, block ) - __field( int, is_metadata ) - __field( TP_MODE_T, mode ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(block, block) - tp_assign(is_metadata, is_metadata) - tp_assign(mode, inode->i_mode) - ), - - TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->mode, __entry->is_metadata, __entry->block) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(__u64, block, block) + ctf_integer(int, is_metadata, is_metadata) + ctf_integer(TP_MODE_T, mode, inode->i_mode) + ) ) #endif @@ -1458,57 +845,22 @@ LTTNG_TRACEPOINT_EVENT(ext4_da_update_reserve_space, TP_ARGS(inode, used_blocks), #endif - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, i_blocks ) - __field( int, used_blocks ) - __field( int, reserved_data_blocks ) - __field( int, reserved_meta_blocks ) - __field( int, allocated_meta_blocks ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - __field( int, quota_claim ) -#endif - __field( TP_MODE_T, mode ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(i_blocks, inode->i_blocks) - tp_assign(used_blocks, used_blocks) - tp_assign(reserved_data_blocks, + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(__u64, i_blocks, inode->i_blocks) + ctf_integer(int, used_blocks, used_blocks) + ctf_integer(int, reserved_data_blocks, EXT4_I(inode)->i_reserved_data_blocks) - tp_assign(reserved_meta_blocks, + ctf_integer(int, reserved_meta_blocks, EXT4_I(inode)->i_reserved_meta_blocks) - tp_assign(allocated_meta_blocks, + ctf_integer(int, allocated_meta_blocks, EXT4_I(inode)->i_allocated_meta_blocks) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - tp_assign(quota_claim, quota_claim) -#endif - tp_assign(mode, inode->i_mode) - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d " - "reserved_data_blocks %d reserved_meta_blocks %d " - "allocated_meta_blocks %d quota_claim %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->mode, __entry->i_blocks, - __entry->used_blocks, __entry->reserved_data_blocks, - __entry->reserved_meta_blocks, __entry->allocated_meta_blocks, - __entry->quota_claim) -#else - TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d " - "reserved_data_blocks %d reserved_meta_blocks %d " - "allocated_meta_blocks %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->mode, __entry->i_blocks, - __entry->used_blocks, __entry->reserved_data_blocks, - __entry->reserved_meta_blocks, __entry->allocated_meta_blocks) + ctf_integer(int, quota_claim, quota_claim) #endif + ctf_integer(TP_MODE_T, mode, inode->i_mode) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_da_reserve_space, @@ -1516,35 +868,17 @@ LTTNG_TRACEPOINT_EVENT(ext4_da_reserve_space, TP_ARGS(inode, md_needed), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, i_blocks ) - __field( int, md_needed ) - __field( int, reserved_data_blocks ) - __field( int, reserved_meta_blocks ) - __field( TP_MODE_T, mode ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(i_blocks, inode->i_blocks) - tp_assign(md_needed, md_needed) - tp_assign(reserved_data_blocks, + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(__u64, i_blocks, inode->i_blocks) + ctf_integer(int, md_needed, md_needed) + ctf_integer(int, reserved_data_blocks, EXT4_I(inode)->i_reserved_data_blocks) - tp_assign(reserved_meta_blocks, + ctf_integer(int, reserved_meta_blocks, EXT4_I(inode)->i_reserved_meta_blocks) - tp_assign(mode, inode->i_mode) - ), - - TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d " - "reserved_data_blocks %d reserved_meta_blocks %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->mode, __entry->i_blocks, - __entry->md_needed, __entry->reserved_data_blocks, - __entry->reserved_meta_blocks) + ctf_integer(TP_MODE_T, mode, inode->i_mode) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_da_release_space, @@ -1552,39 +886,19 @@ LTTNG_TRACEPOINT_EVENT(ext4_da_release_space, TP_ARGS(inode, freed_blocks), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, i_blocks ) - __field( int, freed_blocks ) - __field( int, reserved_data_blocks ) - __field( int, reserved_meta_blocks ) - __field( int, allocated_meta_blocks ) - __field( TP_MODE_T, mode ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(i_blocks, inode->i_blocks) - tp_assign(freed_blocks, freed_blocks) - tp_assign(reserved_data_blocks, + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(__u64, i_blocks, inode->i_blocks) + ctf_integer(int, freed_blocks, freed_blocks) + ctf_integer(int, reserved_data_blocks, EXT4_I(inode)->i_reserved_data_blocks) - tp_assign(reserved_meta_blocks, + ctf_integer(int, reserved_meta_blocks, EXT4_I(inode)->i_reserved_meta_blocks) - tp_assign(allocated_meta_blocks, + ctf_integer(int, allocated_meta_blocks, EXT4_I(inode)->i_allocated_meta_blocks) - tp_assign(mode, inode->i_mode) - ), - - TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d " - "reserved_data_blocks %d reserved_meta_blocks %d " - "allocated_meta_blocks %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->mode, __entry->i_blocks, - __entry->freed_blocks, __entry->reserved_data_blocks, - __entry->reserved_meta_blocks, __entry->allocated_meta_blocks) + ctf_integer(TP_MODE_T, mode, inode->i_mode) + ) ) #endif @@ -1594,20 +908,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__bitmap_load, TP_ARGS(sb, group), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( __u32, group ) - - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(group, group) - ), - - TP_printk("dev %d,%d group %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->group) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(__u32, group, group) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_bitmap_load, @@ -1645,26 +949,13 @@ LTTNG_TRACEPOINT_EVENT(ext4_direct_IO_enter, TP_ARGS(inode, offset, len, rw), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, pos ) - __field( unsigned long, len ) - __field( int, rw ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pos, offset) - tp_assign(len, len) - tp_assign(rw, rw) - ), - - TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->pos, __entry->len, __entry->rw) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, offset) + ctf_integer(unsigned long, len, len) + ctf_integer(int, rw, rw) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_direct_IO_exit, @@ -1673,29 +964,14 @@ LTTNG_TRACEPOINT_EVENT(ext4_direct_IO_exit, TP_ARGS(inode, offset, len, rw, ret), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, pos ) - __field( unsigned long, len ) - __field( int, rw ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pos, offset) - tp_assign(len, len) - tp_assign(rw, rw) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->pos, __entry->len, - __entry->rw, __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, offset) + ctf_integer(unsigned long, len, len) + ctf_integer(int, rw, rw) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_fallocate_exit, @@ -1704,27 +980,13 @@ LTTNG_TRACEPOINT_EVENT(ext4_fallocate_exit, TP_ARGS(inode, offset, max_blocks, ret), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, pos ) - __field( unsigned int, blocks ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pos, offset) - tp_assign(blocks, max_blocks) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->pos, __entry->blocks, - __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, offset) + ctf_integer(unsigned int, blocks, max_blocks) + ctf_integer(int, ret, ret) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) @@ -1734,27 +996,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__fallocate_mode, TP_ARGS(inode, offset, len, mode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, offset ) - __field( loff_t, len ) - __field( int, mode ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(offset, offset) - tp_assign(len, len) - tp_assign(mode, mode) - ), - - TP_printk("dev %d,%d ino %lu offset %lld len %lld mode %s", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->offset, __entry->len, - show_falloc_mode(__entry->mode)) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, offset) + ctf_integer(loff_t, len, len) + ctf_integer(int, mode, mode) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__fallocate_mode, ext4_fallocate_enter, @@ -1785,26 +1033,13 @@ LTTNG_TRACEPOINT_EVENT(ext4_fallocate_enter, TP_ARGS(inode, offset, len, mode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, pos ) - __field( loff_t, len ) - __field( int, mode ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pos, offset) - tp_assign(len, len) - tp_assign(mode, mode) - ), - - TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->pos, - __entry->len, __entry->mode) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, offset) + ctf_integer(loff_t, len, len) + ctf_integer(int, mode, mode) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) @@ -1814,24 +1049,12 @@ LTTNG_TRACEPOINT_EVENT(ext4_punch_hole, TP_ARGS(inode, offset, len), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, offset ) - __field( loff_t, len ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(offset, offset) - tp_assign(len, len) - ), - - TP_printk("dev %d,%d ino %lu offset %lld len %lld", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->offset, __entry->len) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, pos, offset) + ctf_integer(loff_t, len, len) + ) ) #endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) */ @@ -1843,24 +1066,12 @@ LTTNG_TRACEPOINT_EVENT(ext4_unlink_enter, TP_ARGS(parent, dentry), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ino_t, parent ) - __field( loff_t, size ) - ), - - TP_fast_assign( - tp_assign(dev, dentry->d_inode->i_sb->s_dev) - tp_assign(ino, dentry->d_inode->i_ino) - tp_assign(parent, parent->i_ino) - tp_assign(size, dentry->d_inode->i_size) - ), - - TP_printk("dev %d,%d ino %lu size %lld parent %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->size, - (unsigned long) __entry->parent) + TP_FIELDS( + ctf_integer(dev_t, dev, dentry->d_inode->i_sb->s_dev) + ctf_integer(ino_t, ino, dentry->d_inode->i_ino) + ctf_integer(ino_t, parent, parent->i_ino) + ctf_integer(loff_t, size, dentry->d_inode->i_size) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_unlink_exit, @@ -1868,22 +1079,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_unlink_exit, TP_ARGS(dentry, ret), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(dev, dentry->d_inode->i_sb->s_dev) - tp_assign(ino, dentry->d_inode->i_ino) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, dentry->d_inode->i_sb->s_dev) + ctf_integer(ino_t, ino, dentry->d_inode->i_ino) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(ext4__truncate, @@ -1891,21 +1091,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__truncate, TP_ARGS(inode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( __u64, blocks ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(blocks, inode->i_blocks) - ), - - TP_printk("dev %d,%d ino %lu blocks %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->blocks) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(unsigned int, blocks, inode->i_blocks) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__truncate, ext4_truncate_enter, @@ -1930,32 +1120,15 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_convert_to_initialized_enter, TP_ARGS(inode, map, ux), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, m_lblk ) - __field( unsigned, m_len ) - __field( ext4_lblk_t, u_lblk ) - __field( unsigned, u_len ) - __field( ext4_fsblk_t, u_pblk ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(m_lblk, map->m_lblk) - tp_assign(m_len, map->m_len) - tp_assign(u_lblk, le32_to_cpu(ux->ee_block)) - tp_assign(u_len, ext4_ext_get_actual_len(ux)) - tp_assign(u_pblk, ext4_ext_pblock(ux)) - ), - - TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u u_lblk %u u_len %u " - "u_pblk %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->m_lblk, __entry->m_len, - __entry->u_lblk, __entry->u_len, __entry->u_pblk) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, m_lblk, map->m_lblk) + ctf_integer(unsigned, m_len, map->m_len) + ctf_integer(ext4_lblk_t, u_lblk, le32_to_cpu(ux->ee_block)) + ctf_integer(unsigned, u_len, ext4_ext_get_actual_len(ux)) + ctf_integer(ext4_fsblk_t, u_pblk, ext4_ext_pblock(ux)) + ) ) /* @@ -1968,40 +1141,18 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_convert_to_initialized_fastpath, TP_ARGS(inode, map, ux, ix), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, m_lblk ) - __field( unsigned, m_len ) - __field( ext4_lblk_t, u_lblk ) - __field( unsigned, u_len ) - __field( ext4_fsblk_t, u_pblk ) - __field( ext4_lblk_t, i_lblk ) - __field( unsigned, i_len ) - __field( ext4_fsblk_t, i_pblk ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(m_lblk, map->m_lblk) - tp_assign(m_len, map->m_len) - tp_assign(u_lblk, le32_to_cpu(ux->ee_block)) - tp_assign(u_len, ext4_ext_get_actual_len(ux)) - tp_assign(u_pblk, ext4_ext_pblock(ux)) - tp_assign(i_lblk, le32_to_cpu(ix->ee_block)) - tp_assign(i_len, ext4_ext_get_actual_len(ix)) - tp_assign(i_pblk, ext4_ext_pblock(ix)) - ), - - TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u " - "u_lblk %u u_len %u u_pblk %llu " - "i_lblk %u i_len %u i_pblk %llu ", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->m_lblk, __entry->m_len, - __entry->u_lblk, __entry->u_len, __entry->u_pblk, - __entry->i_lblk, __entry->i_len, __entry->i_pblk) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, m_lblk, map->m_lblk) + ctf_integer(unsigned, m_len, map->m_len) + ctf_integer(ext4_lblk_t, u_lblk, le32_to_cpu(ux->ee_block)) + ctf_integer(unsigned, u_len, ext4_ext_get_actual_len(ux)) + ctf_integer(ext4_fsblk_t, u_pblk, ext4_ext_pblock(ux)) + ctf_integer(ext4_lblk_t, i_lblk, le32_to_cpu(ix->ee_block)) + ctf_integer(unsigned, i_len, ext4_ext_get_actual_len(ix)) + ctf_integer(ext4_fsblk_t, i_pblk, ext4_ext_pblock(ix)) + ) ) #endif @@ -2011,26 +1162,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__map_blocks_enter, TP_ARGS(inode, lblk, len, flags), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, lblk ) - __field( unsigned int, len ) - __field( unsigned int, flags ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, lblk) - tp_assign(len, len) - tp_assign(flags, flags) - ), - - TP_printk("dev %d,%d ino %lu lblk %u len %u flags %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->lblk, __entry->len, __entry->flags) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, lblk, lblk) + ctf_integer(unsigned int, len, len) + ctf_integer(unsigned int, flags, flags) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__map_blocks_enter, ext4_ext_map_blocks_enter, @@ -2055,34 +1193,16 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__map_blocks_exit, TP_ARGS(inode, flags, map, ret), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( unsigned int, flags ) - __field( ext4_fsblk_t, pblk ) - __field( ext4_lblk_t, lblk ) - __field( unsigned int, len ) - __field( unsigned int, mflags ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(flags, flags) - tp_assign(pblk, map->m_pblk) - tp_assign(lblk, map->m_lblk) - tp_assign(len, map->m_len) - tp_assign(mflags, map->m_flags) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu flags %s lblk %u pblk %llu len %u " - "mflags %s ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - show_map_flags(__entry->flags), __entry->lblk, __entry->pblk, - __entry->len, show_mflags(__entry->mflags), __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(unsigned int, flags, flags) + ctf_integer(ext4_fsblk_t, pblk, map->m_pblk) + ctf_integer(ext4_lblk_t, lblk, map->m_lblk) + ctf_integer(unsigned int, len, map->m_len) + ctf_integer(unsigned int, mflags, map->m_flags) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__map_blocks_exit, ext4_ext_map_blocks_exit, @@ -2106,31 +1226,16 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__map_blocks_exit, TP_ARGS(inode, map, ret), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_fsblk_t, pblk ) - __field( ext4_lblk_t, lblk ) - __field( unsigned int, len ) - __field( unsigned int, flags ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pblk, map->m_pblk) - tp_assign(lblk, map->m_lblk) - tp_assign(len, map->m_len) - tp_assign(flags, map->m_flags) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u flags %x ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->lblk, __entry->pblk, - __entry->len, __entry->flags, __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(unsigned int, flags, flags) + ctf_integer(ext4_fsblk_t, pblk, map->m_pblk) + ctf_integer(ext4_lblk_t, lblk, map->m_lblk) + ctf_integer(unsigned int, len, map->m_len) + ctf_integer(unsigned int, mflags, map->m_flags) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__map_blocks_exit, ext4_ext_map_blocks_exit, @@ -2153,29 +1258,14 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__map_blocks_exit, TP_ARGS(inode, lblk, pblk, len, ret), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_fsblk_t, pblk ) - __field( ext4_lblk_t, lblk ) - __field( unsigned int, len ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pblk, pblk) - tp_assign(lblk, lblk) - tp_assign(len, len) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->lblk, __entry->pblk, - __entry->len, __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_fsblk_t, pblk, pblk) + ctf_integer(ext4_lblk_t, lblk, lblk) + ctf_integer(unsigned int, len, len) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__map_blocks_exit, ext4_ext_map_blocks_exit, @@ -2199,24 +1289,12 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_load_extent, TP_ARGS(inode, lblk, pblk), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_fsblk_t, pblk ) - __field( ext4_lblk_t, lblk ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pblk, pblk) - tp_assign(lblk, lblk) - ), - - TP_printk("dev %d,%d ino %lu lblk %u pblk %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->lblk, __entry->pblk) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_fsblk_t, pblk, pblk) + ctf_integer(ext4_lblk_t, lblk, lblk) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_load_inode, @@ -2224,19 +1302,10 @@ LTTNG_TRACEPOINT_EVENT(ext4_load_inode, TP_ARGS(inode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - ), - - TP_printk("dev %d,%d ino %ld", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ) ) #endif @@ -2248,23 +1317,12 @@ LTTNG_TRACEPOINT_EVENT(ext4_journal_start, TP_ARGS(sb, blocks, rsv_blocks, IP), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field(unsigned long, ip ) - __field( int, blocks ) - __field( int, rsv_blocks ) - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(ip, IP) - tp_assign(blocks, blocks) - tp_assign(rsv_blocks, rsv_blocks) - ), - - TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pF", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->blocks, __entry->rsv_blocks, (void *)__entry->ip) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(unsigned long, ip, IP) + ctf_integer(int, blocks, blocks) + ctf_integer(int, rsv_blocks, rsv_blocks) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_journal_start_reserved, @@ -2272,21 +1330,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_journal_start_reserved, TP_ARGS(sb, blocks, IP), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field(unsigned long, ip ) - __field( int, blocks ) - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(ip, IP) - tp_assign(blocks, blocks) - ), - - TP_printk("dev %d,%d blocks, %d caller %pF", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->blocks, (void *)__entry->ip) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(unsigned long, ip, IP) + ctf_integer(int, blocks, blocks) + ) ) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) @@ -2296,21 +1344,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_journal_start, TP_ARGS(sb, nblocks, IP), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field(unsigned long, ip ) - __field( int, nblocks ) - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(ip, IP) - tp_assign(nblocks, nblocks) - ), - - TP_printk("dev %d,%d nblocks %d caller %pF", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->nblocks, (void *)__entry->ip) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(unsigned long, ip, IP) + ctf_integer(int, nblocks, nblocks) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(ext4__trim, @@ -2321,25 +1359,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__trim, TP_ARGS(sb, group, start, len), - TP_STRUCT__entry( - __field( int, dev_major ) - __field( int, dev_minor ) - __field( __u32, group ) - __field( int, start ) - __field( int, len ) - ), - - TP_fast_assign( - tp_assign(dev_major, MAJOR(sb->s_dev)) - tp_assign(dev_minor, MINOR(sb->s_dev)) - tp_assign(group, group) - tp_assign(start, start) - tp_assign(len, len) - ), - - TP_printk("dev %d,%d group %u, start %d, len %d", - __entry->dev_major, __entry->dev_minor, - __entry->group, __entry->start, __entry->len) + TP_FIELDS( + ctf_integer(int, dev_major, MAJOR(sb->s_dev)) + ctf_integer(int, dev_minor, MINOR(sb->s_dev)) + ctf_integer(__u32, group, group) + ctf_integer(int, start, start) + ctf_integer(int, len, len) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__trim, ext4_trim_extent, @@ -2378,40 +1404,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_handle_uninitialized_extents, TP_ARGS(inode, map, allocated, newblock), #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */ - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( int, flags ) - __field( ext4_lblk_t, lblk ) - __field( ext4_fsblk_t, pblk ) - __field( unsigned int, len ) - __field( unsigned int, allocated ) - __field( ext4_fsblk_t, newblk ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) - tp_assign(flags, flags) + ctf_integer(int, flags, flags) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */ - tp_assign(flags, map->m_flags) + ctf_integer(int, flags, map->m_flags) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */ - tp_assign(lblk, map->m_lblk) - tp_assign(pblk, map->m_pblk) - tp_assign(len, map->m_len) - tp_assign(allocated, allocated) - tp_assign(newblk, newblock) - ), - - TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %d" - "allocated %d newblock %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->lblk, (unsigned long long) __entry->pblk, - __entry->len, __entry->flags, - (unsigned int) __entry->allocated, - (unsigned long long) __entry->newblk) + ctf_integer(ext4_lblk_t, lblk, map->m_lblk) + ctf_integer(ext4_fsblk_t, pblk, map->m_pblk) + ctf_integer(unsigned int, len, map->m_len) + ctf_integer(unsigned int, allocated, allocated) + ctf_integer(ext4_fsblk_t, newblk, newblock) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_get_implied_cluster_alloc_exit, @@ -2419,28 +1425,14 @@ LTTNG_TRACEPOINT_EVENT(ext4_get_implied_cluster_alloc_exit, TP_ARGS(sb, map, ret), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( unsigned int, flags ) - __field( ext4_lblk_t, lblk ) - __field( ext4_fsblk_t, pblk ) - __field( unsigned int, len ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(flags, map->m_flags) - tp_assign(lblk, map->m_lblk) - tp_assign(pblk, map->m_pblk) - tp_assign(len, map->m_len) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %u ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->lblk, (unsigned long long) __entry->pblk, - __entry->len, __entry->flags, __entry->ret) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(unsigned int, flags, map->m_flags) + ctf_integer(ext4_lblk_t, lblk, map->m_lblk) + ctf_integer(ext4_fsblk_t, pblk, map->m_pblk) + ctf_integer(unsigned int, len, map->m_len) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_ext_put_in_cache, @@ -2449,28 +1441,13 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_put_in_cache, TP_ARGS(inode, lblk, len, start), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, lblk ) - __field( unsigned int, len ) - __field( ext4_fsblk_t, start ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, lblk) - tp_assign(len, len) - tp_assign(start, start) - ), - - TP_printk("dev %d,%d ino %lu lblk %u len %u start %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->lblk, - __entry->len, - (unsigned long long) __entry->start) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, lblk, lblk) + ctf_integer(unsigned int, len, len) + ctf_integer(ext4_fsblk_t, start, start) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_ext_in_cache, @@ -2478,26 +1455,12 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_in_cache, TP_ARGS(inode, lblk, ret), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, lblk ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, lblk) - tp_assign(ret, ret) - ), - - TP_printk("dev %d,%d ino %lu lblk %u ret %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->lblk, - __entry->ret) - + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, lblk, lblk) + ctf_integer(int, ret, ret) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_find_delalloc_range, @@ -2506,33 +1469,15 @@ LTTNG_TRACEPOINT_EVENT(ext4_find_delalloc_range, TP_ARGS(inode, from, to, reverse, found, found_blk), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, from ) - __field( ext4_lblk_t, to ) - __field( int, reverse ) - __field( int, found ) - __field( ext4_lblk_t, found_blk ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(from, from) - tp_assign(to, to) - tp_assign(reverse, reverse) - tp_assign(found, found) - tp_assign(found_blk, found_blk) - ), - - TP_printk("dev %d,%d ino %lu from %u to %u reverse %d found %d " - "(blk = %u)", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->from, (unsigned) __entry->to, - __entry->reverse, __entry->found, - (unsigned) __entry->found_blk) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, from, from) + ctf_integer(ext4_lblk_t, to, to) + ctf_integer(int, reverse, reverse) + ctf_integer(int, found, found) + ctf_integer(ext4_lblk_t, found_blk, found_blk) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_get_reserved_cluster_alloc, @@ -2540,25 +1485,12 @@ LTTNG_TRACEPOINT_EVENT(ext4_get_reserved_cluster_alloc, TP_ARGS(inode, lblk, len), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, lblk ) - __field( unsigned int, len ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, lblk) - tp_assign(len, len) - ), - - TP_printk("dev %d,%d ino %lu lblk %u len %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->lblk, - __entry->len) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, lblk, lblk) + ctf_integer(unsigned int, len, len) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_ext_show_extent, @@ -2567,28 +1499,13 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_show_extent, TP_ARGS(inode, lblk, pblk, len), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_fsblk_t, pblk ) - __field( ext4_lblk_t, lblk ) - __field( unsigned short, len ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pblk, pblk) - tp_assign(lblk, lblk) - tp_assign(len, len) - ), - - TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->lblk, - (unsigned long long) __entry->pblk, - (unsigned short) __entry->len) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_fsblk_t, pblk, pblk) + ctf_integer(ext4_lblk_t, lblk, lblk) + ctf_integer(unsigned short, len, len) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) @@ -2600,38 +1517,16 @@ LTTNG_TRACEPOINT_EVENT(ext4_remove_blocks, TP_ARGS(inode, ex, from, to, partial_cluster), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, from ) - __field( ext4_lblk_t, to ) - __field( long long, partial ) - __field( ext4_fsblk_t, ee_pblk ) - __field( ext4_lblk_t, ee_lblk ) - __field( unsigned short, ee_len ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(from, from) - tp_assign(to, to) - tp_assign(partial, partial_cluster) - tp_assign(ee_pblk, ext4_ext_pblock(ex)) - tp_assign(ee_lblk, le32_to_cpu(ex->ee_block)) - tp_assign(ee_len, ext4_ext_get_actual_len(ex)) - ), - - TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]" - "from %u to %u partial_cluster %lld", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->ee_lblk, - (unsigned long long) __entry->ee_pblk, - (unsigned short) __entry->ee_len, - (unsigned) __entry->from, - (unsigned) __entry->to, - (long long) __entry->partial) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, from, from) + ctf_integer(ext4_lblk_t, to, to) + ctf_integer(long long, partial, partial_cluster) + ctf_integer(ext4_fsblk_t, ee_pblk, ext4_ext_pblock(ex)) + ctf_integer(ext4_lblk_t, ee_lblk, le32_to_cpu(ex->ee_block)) + ctf_integer(unsigned short, ee_len, ext4_ext_get_actual_len(ex)) + ) ) #else @@ -2643,38 +1538,16 @@ LTTNG_TRACEPOINT_EVENT(ext4_remove_blocks, TP_ARGS(inode, ex, from, to, partial_cluster), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, from ) - __field( ext4_lblk_t, to ) - __field( ext4_fsblk_t, partial ) - __field( ext4_fsblk_t, ee_pblk ) - __field( ext4_lblk_t, ee_lblk ) - __field( unsigned short, ee_len ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(from, from) - tp_assign(to, to) - tp_assign(partial, partial_cluster) - tp_assign(ee_pblk, ext4_ext_pblock(ex)) - tp_assign(ee_lblk, cpu_to_le32(ex->ee_block)) - tp_assign(ee_len, ext4_ext_get_actual_len(ex)) - ), - - TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]" - "from %u to %u partial_cluster %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->ee_lblk, - (unsigned long long) __entry->ee_pblk, - (unsigned short) __entry->ee_len, - (unsigned) __entry->from, - (unsigned) __entry->to, - (unsigned) __entry->partial) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, from, from) + ctf_integer(ext4_lblk_t, to, to) + ctf_integer(ext4_fsblk_t, partial, partial_cluster) + ctf_integer(ext4_fsblk_t, ee_pblk, ext4_ext_pblock(ex)) + ctf_integer(ext4_lblk_t, ee_lblk, le32_to_cpu(ex->ee_block)) + ctf_integer(unsigned short, ee_len, ext4_ext_get_actual_len(ex)) + ) ) #endif @@ -2688,35 +1561,15 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_rm_leaf, TP_ARGS(inode, start, ex, partial_cluster), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( long long, partial ) - __field( ext4_lblk_t, start ) - __field( ext4_lblk_t, ee_lblk ) - __field( ext4_fsblk_t, ee_pblk ) - __field( short, ee_len ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(partial, partial_cluster) - tp_assign(start, start) - tp_assign(ee_lblk, le32_to_cpu(ex->ee_block)) - tp_assign(ee_pblk, ext4_ext_pblock(ex)) - tp_assign(ee_len, ext4_ext_get_actual_len(ex)) - ), - - TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]" - "partial_cluster %lld", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->start, - (unsigned) __entry->ee_lblk, - (unsigned long long) __entry->ee_pblk, - (unsigned short) __entry->ee_len, - (long long) __entry->partial) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(long long, partial, partial_cluster) + ctf_integer(ext4_lblk_t, start, start) + ctf_integer(ext4_lblk_t, ee_lblk, le32_to_cpu(ex->ee_block)) + ctf_integer(ext4_fsblk_t, ee_pblk, ext4_ext_pblock(ex)) + ctf_integer(short, ee_len, ext4_ext_get_actual_len(ex)) + ) ) #else @@ -2727,35 +1580,15 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_rm_leaf, TP_ARGS(inode, start, ex, partial_cluster), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_fsblk_t, partial ) - __field( ext4_lblk_t, start ) - __field( ext4_lblk_t, ee_lblk ) - __field( ext4_fsblk_t, ee_pblk ) - __field( short, ee_len ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(partial, partial_cluster) - tp_assign(start, start) - tp_assign(ee_lblk, le32_to_cpu(ex->ee_block)) - tp_assign(ee_pblk, ext4_ext_pblock(ex)) - tp_assign(ee_len, ext4_ext_get_actual_len(ex)) - ), - - TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]" - "partial_cluster %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->start, - (unsigned) __entry->ee_lblk, - (unsigned long long) __entry->ee_pblk, - (unsigned short) __entry->ee_len, - (unsigned) __entry->partial) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(long long, partial, partial_cluster) + ctf_integer(ext4_lblk_t, start, start) + ctf_integer(ext4_lblk_t, ee_lblk, le32_to_cpu(ex->ee_block)) + ctf_integer(ext4_fsblk_t, ee_pblk, ext4_ext_pblock(ex)) + ctf_integer(short, ee_len, ext4_ext_get_actual_len(ex)) + ) ) #endif @@ -2765,22 +1598,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_rm_idx, TP_ARGS(inode, pblk), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_fsblk_t, pblk ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(pblk, pblk) - ), - - TP_printk("dev %d,%d ino %lu index_pblk %llu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned long long) __entry->pblk) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_fsblk_t, pblk, pblk) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) @@ -2791,28 +1613,13 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_remove_space, TP_ARGS(inode, start, end, depth), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, start ) - __field( ext4_lblk_t, end ) - __field( int, depth ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(start, start) - tp_assign(end, end) - tp_assign(depth, depth) - ), - - TP_printk("dev %d,%d ino %lu since %u end %u depth %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->start, - (unsigned) __entry->end, - __entry->depth) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, start, start) + ctf_integer(ext4_lblk_t, end, end) + ctf_integer(int, depth, depth) + ) ) #else @@ -2822,25 +1629,12 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_remove_space, TP_ARGS(inode, start, depth), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, start ) - __field( int, depth ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(start, start) - tp_assign(depth, depth) - ), - - TP_printk("dev %d,%d ino %lu since %u depth %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->start, - __entry->depth) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, start, start) + ctf_integer(int, depth, depth) + ) ) #endif @@ -2853,35 +1647,15 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_remove_space_done, TP_ARGS(inode, start, end, depth, partial, eh_entries), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, start ) - __field( ext4_lblk_t, end ) - __field( int, depth ) - __field( long long, partial ) - __field( unsigned short, eh_entries ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(start, start) - tp_assign(end, end) - tp_assign(depth, depth) - tp_assign(partial, partial) - tp_assign(eh_entries, le16_to_cpu(eh_entries)) - ), - - TP_printk("dev %d,%d ino %lu since %u end %u depth %d partial %lld " - "remaining_entries %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->start, - (unsigned) __entry->end, - __entry->depth, - (long long) __entry->partial, - (unsigned short) __entry->eh_entries) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, start, start) + ctf_integer(ext4_lblk_t, end, end) + ctf_integer(int, depth, depth) + ctf_integer(long long, partial, partial) + ctf_integer(unsigned short, eh_entries, le16_to_cpu(eh_entries)) + ) ) #else @@ -2892,32 +1666,14 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_remove_space_done, TP_ARGS(inode, start, depth, partial, eh_entries), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, start ) - __field( int, depth ) - __field( ext4_lblk_t, partial ) - __field( unsigned short, eh_entries ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(start, start) - tp_assign(depth, depth) - tp_assign(partial, partial) - tp_assign(eh_entries, eh_entries) - ), - - TP_printk("dev %d,%d ino %lu since %u depth %d partial %u " - "remaining_entries %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - (unsigned) __entry->start, - __entry->depth, - (unsigned) __entry->partial, - (unsigned short) __entry->eh_entries) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, start, start) + ctf_integer(int, depth, depth) + ctf_integer(ext4_lblk_t, partial, partial) + ctf_integer(unsigned short, eh_entries, eh_entries) + ) ) #endif @@ -2931,29 +1687,14 @@ LTTNG_TRACEPOINT_EVENT_CLASS(ext4__es_extent, TP_ARGS(inode, es), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, lblk ) - __field( ext4_lblk_t, len ) - __field( ext4_fsblk_t, pblk ) - __field( char, status ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, es->es_lblk) - tp_assign(len, es->es_len) - tp_assign(pblk, ext4_es_pblock(es)) - tp_assign(status, ext4_es_status(es)) - ), - - TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->lblk, __entry->len, - __entry->pblk, show_extent_status(__entry->status)) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, lblk, es->es_lblk) + ctf_integer(ext4_lblk_t, len, es->es_len) + ctf_integer(ext4_fsblk_t, pblk, ext4_es_pblock(es)) + ctf_integer(char, status, ext4_es_status(es)) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__es_extent, ext4_es_insert_extent, @@ -2975,29 +1716,14 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_insert_extent, TP_ARGS(inode, es), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, lblk ) - __field( ext4_lblk_t, len ) - __field( ext4_fsblk_t, pblk ) - __field( char, status ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, es->es_lblk) - tp_assign(len, es->es_len) - tp_assign(pblk, ext4_es_pblock(es)) - tp_assign(status, ext4_es_status(es) >> 60) - ), - - TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->lblk, __entry->len, - __entry->pblk, show_extent_status(__entry->status)) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, lblk, es->es_lblk) + ctf_integer(ext4_lblk_t, len, es->es_len) + ctf_integer(ext4_fsblk_t, pblk, ext4_es_pblock(es)) + ctf_integer(char, status, ext4_es_status(es) >> 60) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_es_remove_extent, @@ -3005,24 +1731,12 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_remove_extent, TP_ARGS(inode, lblk, len), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( loff_t, lblk ) - __field( loff_t, len ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, lblk) - tp_assign(len, len) - ), - - TP_printk("dev %d,%d ino %lu es [%lld/%lld)", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->lblk, __entry->len) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(loff_t, lblk, lblk) + ctf_integer(loff_t, len, len) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_es_find_delayed_extent_range_enter, @@ -3030,21 +1744,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_find_delayed_extent_range_enter, TP_ARGS(inode, lblk), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, lblk ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, lblk) - ), - - TP_printk("dev %d,%d ino %lu lblk %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->lblk) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, lblk, lblk) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_es_find_delayed_extent_range_exit, @@ -3052,29 +1756,14 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_find_delayed_extent_range_exit, TP_ARGS(inode, es), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, lblk ) - __field( ext4_lblk_t, len ) - __field( ext4_fsblk_t, pblk ) - __field( char, status ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, es->es_lblk) - tp_assign(len, es->es_len) - tp_assign(pblk, ext4_es_pblock(es)) - tp_assign(status, ext4_es_status(es) >> 60) - ), - - TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, - __entry->lblk, __entry->len, - __entry->pblk, show_extent_status(__entry->status)) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, lblk, es->es_lblk) + ctf_integer(ext4_lblk_t, len, es->es_len) + ctf_integer(ext4_fsblk_t, pblk, ext4_es_pblock(es)) + ctf_integer(char, status, ext4_es_status(es) >> 60) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_es_lookup_extent_enter, @@ -3082,21 +1771,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_lookup_extent_enter, TP_ARGS(inode, lblk), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, lblk ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, lblk) - ), - - TP_printk("dev %d,%d ino %lu lblk %u", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->lblk) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, lblk, lblk) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_es_lookup_extent_exit, @@ -3105,32 +1784,15 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_lookup_extent_exit, TP_ARGS(inode, es, found), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - __field( ext4_lblk_t, lblk ) - __field( ext4_lblk_t, len ) - __field( ext4_fsblk_t, pblk ) - __field( char, status ) - __field( int, found ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - tp_assign(lblk, es->es_lblk) - tp_assign(len, es->es_len) - tp_assign(pblk, ext4_es_pblock(es)) - tp_assign(status, ext4_es_status(es) >> 60) - tp_assign(found, found) - ), - - TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino, __entry->found, - __entry->lblk, __entry->len, - __entry->found ? __entry->pblk : 0, - show_extent_status(__entry->found ? __entry->status : 0)) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ctf_integer(ext4_lblk_t, lblk, es->es_lblk) + ctf_integer(ext4_lblk_t, len, es->es_len) + ctf_integer(ext4_fsblk_t, pblk, ext4_es_pblock(es)) + ctf_integer(char, status, ext4_es_status(es) >> 60) + ctf_integer(int, found, found) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_es_shrink_enter, @@ -3138,21 +1800,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_shrink_enter, TP_ARGS(sb, nr_to_scan, cache_cnt), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( int, nr_to_scan ) - __field( int, cache_cnt ) - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(nr_to_scan, nr_to_scan) - tp_assign(cache_cnt, cache_cnt) - ), - - TP_printk("dev %d,%d nr_to_scan %d cache_cnt %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->nr_to_scan, __entry->cache_cnt) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(int, nr_to_scan, nr_to_scan) + ctf_integer(int, cache_cnt, cache_cnt) + ) ) LTTNG_TRACEPOINT_EVENT(ext4_es_shrink_exit, @@ -3160,21 +1812,11 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_shrink_exit, TP_ARGS(sb, shrunk_nr, cache_cnt), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( int, shrunk_nr ) - __field( int, cache_cnt ) - ), - - TP_fast_assign( - tp_assign(dev, sb->s_dev) - tp_assign(shrunk_nr, shrunk_nr) - tp_assign(cache_cnt, cache_cnt) - ), - - TP_printk("dev %d,%d shrunk_nr %d cache_cnt %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->shrunk_nr, __entry->cache_cnt) + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(int, shrunk_nr, shrunk_nr) + ctf_integer(int, cache_cnt, cache_cnt) + ) ) #endif diff --git a/instrumentation/events/lttng-module/gpio.h b/instrumentation/events/lttng-module/gpio.h index 6d93d4fe..6e328d4a 100644 --- a/instrumentation/events/lttng-module/gpio.h +++ b/instrumentation/events/lttng-module/gpio.h @@ -12,20 +12,11 @@ LTTNG_TRACEPOINT_EVENT(gpio_direction, TP_ARGS(gpio, in, err), - TP_STRUCT__entry( - __field(unsigned, gpio) - __field(int, in) - __field(int, err) - ), - - TP_fast_assign( - tp_assign(gpio, gpio) - tp_assign(in, in) - tp_assign(err, err) - ), - - TP_printk("%u %3s (%d)", __entry->gpio, - __entry->in ? "in" : "out", __entry->err) + TP_FIELDS( + ctf_integer(unsigned, gpio, gpio) + ctf_integer(int, in, in) + ctf_integer(int, err, err) + ) ) LTTNG_TRACEPOINT_EVENT(gpio_value, @@ -34,20 +25,11 @@ LTTNG_TRACEPOINT_EVENT(gpio_value, TP_ARGS(gpio, get, value), - TP_STRUCT__entry( - __field(unsigned, gpio) - __field(int, get) - __field(int, value) - ), - - TP_fast_assign( - tp_assign(gpio, gpio) - tp_assign(get, get) - tp_assign(value, value) - ), - - TP_printk("%u %3s %d", __entry->gpio, - __entry->get ? "get" : "set", __entry->value) + TP_FIELDS( + ctf_integer(unsigned, gpio, gpio) + ctf_integer(int, get, get) + ctf_integer(int, value, value) + ) ) #endif /* if !defined(LTTNG_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ) */ diff --git a/instrumentation/events/lttng-module/irq.h b/instrumentation/events/lttng-module/irq.h index 3b3a8ce7..e20e91fd 100644 --- a/instrumentation/events/lttng-module/irq.h +++ b/instrumentation/events/lttng-module/irq.h @@ -12,20 +12,6 @@ struct irqaction; struct softirq_action; -#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq } -#define show_softirq_name(val) \ - __print_symbolic(val, \ - softirq_name(HI), \ - softirq_name(TIMER), \ - softirq_name(NET_TX), \ - softirq_name(NET_RX), \ - softirq_name(BLOCK), \ - softirq_name(BLOCK_IOPOLL), \ - softirq_name(TASKLET), \ - softirq_name(SCHED), \ - softirq_name(HRTIMER), \ - softirq_name(RCU)) - #endif /* _TRACE_IRQ_DEF_ */ /** @@ -45,17 +31,10 @@ LTTNG_TRACEPOINT_EVENT(irq_handler_entry, TP_ARGS(irq, action), - TP_STRUCT__entry( - __field( int, irq ) - __string( name, action->name ) - ), - - TP_fast_assign( - tp_assign(irq, irq) - tp_strcpy(name, action->name) - ), - - TP_printk("irq=%d name=%s", __entry->irq, __get_str(name)) + TP_FIELDS( + ctf_integer(int, irq, irq) + ctf_string(name, action->name) + ) ) /** @@ -75,18 +54,10 @@ LTTNG_TRACEPOINT_EVENT(irq_handler_exit, TP_ARGS(irq, action, ret), - TP_STRUCT__entry( - __field( int, irq ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(irq, irq) - tp_assign(ret, ret) - ), - - TP_printk("irq=%d ret=%s", - __entry->irq, __entry->ret ? "handled" : "unhandled") + TP_FIELDS( + ctf_integer(int, irq, irq) + ctf_integer(int, ret, ret) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) @@ -96,16 +67,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(irq_softirq, TP_ARGS(vec_nr), - TP_STRUCT__entry( - __field( unsigned int, vec ) - ), - - TP_fast_assign( - tp_assign(vec, vec_nr) - ), - - TP_printk("vec=%u [action=%s]", __entry->vec, - show_softirq_name(__entry->vec)) + TP_FIELDS( + ctf_integer(unsigned int, vec, vec_nr) + ) ) /** @@ -162,16 +126,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(irq_softirq, TP_ARGS(h, vec), - TP_STRUCT__entry( - __field( unsigned int, vec ) - ), - - TP_fast_assign( - tp_assign(vec, (int)(h - vec)) - ), - - TP_printk("vec=%u [action=%s]", __entry->vec, - show_softirq_name(__entry->vec)) + TP_FIELDS( + ctf_integer(unsigned int, vec, (int)(h - vec)) + ) ) /** diff --git a/instrumentation/events/lttng-module/jbd.h b/instrumentation/events/lttng-module/jbd.h index d1da49a0..335be5cb 100644 --- a/instrumentation/events/lttng-module/jbd.h +++ b/instrumentation/events/lttng-module/jbd.h @@ -14,19 +14,10 @@ LTTNG_TRACEPOINT_EVENT(jbd_checkpoint, TP_ARGS(journal, result), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( int, result ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) - tp_assign(result, result) - ), - - TP_printk("dev %d,%d result %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->result) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) + ctf_integer(int, result, result) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(jbd_commit, @@ -35,31 +26,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(jbd_commit, TP_ARGS(journal, commit_transaction), - TP_STRUCT__entry( - __field( dev_t, dev ) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - __field( char, sync_commit ) -#endif - __field( int, transaction ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - tp_assign(sync_commit, commit_transaction->t_synchronous_commit) -#endif - tp_assign(transaction, commit_transaction->t_tid) - ), - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - TP_printk("dev %d,%d transaction %d sync %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->transaction, __entry->sync_commit) -#else - TP_printk("dev %d,%d transaction %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->transaction) + ctf_integer(char, sync_commit, commit_transaction->t_synchronous_commit) #endif + ctf_integer(int, transaction, commit_transaction->t_tid) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(jbd_commit, jbd_start_commit, @@ -96,31 +69,13 @@ LTTNG_TRACEPOINT_EVENT(jbd_drop_transaction, TP_ARGS(journal, commit_transaction), - TP_STRUCT__entry( - __field( dev_t, dev ) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - __field( char, sync_commit ) -#endif - __field( int, transaction ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - tp_assign(sync_commit, commit_transaction->t_synchronous_commit) -#endif - tp_assign(transaction, commit_transaction->t_tid) - ), - + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - TP_printk("dev %d,%d transaction %d sync %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->transaction, __entry->sync_commit) -#else - TP_printk("dev %d,%d transaction %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->transaction) + ctf_integer(char, sync_commit, commit_transaction->t_synchronous_commit) #endif + ctf_integer(int, transaction, commit_transaction->t_tid) + ) ) LTTNG_TRACEPOINT_EVENT(jbd_end_commit, @@ -128,33 +83,14 @@ LTTNG_TRACEPOINT_EVENT(jbd_end_commit, TP_ARGS(journal, commit_transaction), - TP_STRUCT__entry( - __field( dev_t, dev ) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - __field( char, sync_commit ) -#endif - __field( int, transaction ) - __field( int, head ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - tp_assign(sync_commit, commit_transaction->t_synchronous_commit) -#endif - tp_assign(transaction, commit_transaction->t_tid) - tp_assign(head, journal->j_tail_sequence) - ), - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - TP_printk("dev %d,%d transaction %d sync %d head %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->transaction, __entry->sync_commit, __entry->head) -#else - TP_printk("dev %d,%d transaction %d head %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->transaction, __entry->head) + ctf_integer(char, sync_commit, commit_transaction->t_synchronous_commit) #endif + ctf_integer(int, transaction, commit_transaction->t_tid) + ctf_integer(int, head, journal->j_tail_sequence) + ) ) LTTNG_TRACEPOINT_EVENT(jbd_do_submit_data, @@ -162,31 +98,13 @@ LTTNG_TRACEPOINT_EVENT(jbd_do_submit_data, TP_ARGS(journal, commit_transaction), - TP_STRUCT__entry( - __field( dev_t, dev ) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - __field( char, sync_commit ) -#endif - __field( int, transaction ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - tp_assign(sync_commit, commit_transaction->t_synchronous_commit) -#endif - tp_assign(transaction, commit_transaction->t_tid) - ), - + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - TP_printk("dev %d,%d transaction %d sync %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->transaction, __entry->sync_commit) -#else - TP_printk("dev %d,%d transaction %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->transaction) + ctf_integer(char, sync_commit, commit_transaction->t_synchronous_commit) #endif + ctf_integer(int, transaction, commit_transaction->t_tid) + ) ) LTTNG_TRACEPOINT_EVENT(jbd_cleanup_journal_tail, @@ -196,26 +114,13 @@ LTTNG_TRACEPOINT_EVENT(jbd_cleanup_journal_tail, TP_ARGS(journal, first_tid, block_nr, freed), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( tid_t, tail_sequence ) - __field( tid_t, first_tid ) - __field(unsigned long, block_nr ) - __field(unsigned long, freed ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) - tp_assign(tail_sequence, journal->j_tail_sequence) - tp_assign(first_tid, first_tid) - tp_assign(block_nr, block_nr) - tp_assign(freed, freed) - ), - - TP_printk("dev %d,%d from %u to %u offset %lu freed %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->tail_sequence, __entry->first_tid, - __entry->block_nr, __entry->freed) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) + ctf_integer(tid_t, tail_sequence, journal->j_tail_sequence) + ctf_integer(tid_t, first_tid, first_tid) + ctf_integer(unsigned long, block_nr, block_nr) + ctf_integer(unsigned long, freed, freed) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) @@ -227,18 +132,10 @@ LTTNG_TRACEPOINT_EVENT_MAP(journal_write_superblock, TP_ARGS(journal, write_op), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( int, write_op ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) - tp_assign(write_op, write_op) - ), - - TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev), - MINOR(__entry->dev), __entry->write_op) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) + ctf_integer(int, write_op, write_op) + ) ) #else LTTNG_TRACEPOINT_EVENT(jbd_update_superblock_end, @@ -246,9 +143,9 @@ LTTNG_TRACEPOINT_EVENT(jbd_update_superblock_end, TP_ARGS(journal, wait), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( int, wait ) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) + ctf_integer(int, wait, wait) ), TP_fast_assign( diff --git a/instrumentation/events/lttng-module/jbd2.h b/instrumentation/events/lttng-module/jbd2.h index 491a15a9..2aa0a006 100644 --- a/instrumentation/events/lttng-module/jbd2.h +++ b/instrumentation/events/lttng-module/jbd2.h @@ -22,18 +22,10 @@ LTTNG_TRACEPOINT_EVENT(jbd2_checkpoint, TP_ARGS(journal, result), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( int, result ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) - tp_assign(result, result) - ), - - TP_printk("dev %d,%d result %d", - MAJOR(__entry->dev), MINOR(__entry->dev), __entry->result) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) + ctf_integer(int, result, result) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(jbd2_commit, @@ -42,21 +34,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(jbd2_commit, TP_ARGS(journal, commit_transaction), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( char, sync_commit ) - __field( int, transaction ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) - tp_assign(sync_commit, commit_transaction->t_synchronous_commit) - tp_assign(transaction, commit_transaction->t_tid) - ), - - TP_printk("dev %d,%d transaction %d sync %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->transaction, __entry->sync_commit) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) + ctf_integer(char, sync_commit, commit_transaction->t_synchronous_commit) + ctf_integer(int, transaction, commit_transaction->t_tid) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(jbd2_commit, jbd2_start_commit, @@ -101,23 +83,12 @@ LTTNG_TRACEPOINT_EVENT(jbd2_end_commit, TP_ARGS(journal, commit_transaction), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( char, sync_commit ) - __field( int, transaction ) - __field( int, head ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) - tp_assign(sync_commit, commit_transaction->t_synchronous_commit) - tp_assign(transaction, commit_transaction->t_tid) - tp_assign(head, journal->j_tail_sequence) - ), - - TP_printk("dev %d,%d transaction %d sync %d head %d", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->transaction, __entry->sync_commit, __entry->head) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) + ctf_integer(char, sync_commit, commit_transaction->t_synchronous_commit) + ctf_integer(int, transaction, commit_transaction->t_tid) + ctf_integer(int, head, journal->j_tail_sequence) + ) ) LTTNG_TRACEPOINT_EVENT(jbd2_submit_inode_data, @@ -125,19 +96,10 @@ LTTNG_TRACEPOINT_EVENT(jbd2_submit_inode_data, TP_ARGS(inode), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( ino_t, ino ) - ), - - TP_fast_assign( - tp_assign(dev, inode->i_sb->s_dev) - tp_assign(ino, inode->i_ino) - ), - - TP_printk("dev %d,%d ino %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - (unsigned long) __entry->ino) + TP_FIELDS( + ctf_integer(dev_t, dev, inode->i_sb->s_dev) + ctf_integer(ino_t, ino, inode->i_ino) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) @@ -147,42 +109,18 @@ LTTNG_TRACEPOINT_EVENT(jbd2_run_stats, TP_ARGS(dev, tid, stats), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( unsigned long, tid ) - __field( unsigned long, wait ) - __field( unsigned long, running ) - __field( unsigned long, locked ) - __field( unsigned long, flushing ) - __field( unsigned long, logging ) - __field( __u32, handle_count ) - __field( __u32, blocks ) - __field( __u32, blocks_logged ) - ), - - TP_fast_assign( - tp_assign(dev, dev) - tp_assign(tid, tid) - tp_assign(wait, stats->rs_wait) - tp_assign(running, stats->rs_running) - tp_assign(locked, stats->rs_locked) - tp_assign(flushing, stats->rs_flushing) - tp_assign(logging, stats->rs_logging) - tp_assign(handle_count, stats->rs_handle_count) - tp_assign(blocks, stats->rs_blocks) - tp_assign(blocks_logged, stats->rs_blocks_logged) - ), - - TP_printk("dev %d,%d tid %lu wait %u running %u locked %u flushing %u " - "logging %u handle_count %u blocks %u blocks_logged %u", - MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid, - jiffies_to_msecs(__entry->wait), - jiffies_to_msecs(__entry->running), - jiffies_to_msecs(__entry->locked), - jiffies_to_msecs(__entry->flushing), - jiffies_to_msecs(__entry->logging), - __entry->handle_count, __entry->blocks, - __entry->blocks_logged) + TP_FIELDS( + ctf_integer(dev_t, dev, dev) + ctf_integer(unsigned long, tid, tid) + ctf_integer(unsigned long, wait, stats->rs_wait) + ctf_integer(unsigned long, running, stats->rs_running) + ctf_integer(unsigned long, locked, stats->rs_locked) + ctf_integer(unsigned long, flushing, stats->rs_flushing) + ctf_integer(unsigned long, logging, stats->rs_logging) + ctf_integer(__u32, handle_count, stats->rs_handle_count) + ctf_integer(__u32, blocks, stats->rs_blocks) + ctf_integer(__u32, blocks_logged, stats->rs_blocks_logged) + ) ) LTTNG_TRACEPOINT_EVENT(jbd2_checkpoint_stats, @@ -191,29 +129,14 @@ LTTNG_TRACEPOINT_EVENT(jbd2_checkpoint_stats, TP_ARGS(dev, tid, stats), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( unsigned long, tid ) - __field( unsigned long, chp_time ) - __field( __u32, forced_to_close ) - __field( __u32, written ) - __field( __u32, dropped ) - ), - - TP_fast_assign( - tp_assign(dev, dev) - tp_assign(tid, tid) - tp_assign(chp_time, stats->cs_chp_time) - tp_assign(forced_to_close, stats->cs_forced_to_close) - tp_assign(written, stats->cs_written) - tp_assign(dropped, stats->cs_dropped) - ), - - TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u " - "written %u dropped %u", - MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid, - jiffies_to_msecs(__entry->chp_time), - __entry->forced_to_close, __entry->written, __entry->dropped) + TP_FIELDS( + ctf_integer(dev_t, dev, dev) + ctf_integer(unsigned long, tid, tid) + ctf_integer(unsigned long, chp_time, stats->cs_chp_time) + ctf_integer(__u32, forced_to_close, stats->cs_forced_to_close) + ctf_integer(__u32, written, stats->cs_written) + ctf_integer(__u32, dropped, stats->cs_dropped) + ) ) #endif @@ -229,26 +152,13 @@ LTTNG_TRACEPOINT_EVENT(jbd2_cleanup_journal_tail, TP_ARGS(journal, first_tid, block_nr, freed), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( tid_t, tail_sequence ) - __field( tid_t, first_tid ) - __field(unsigned long, block_nr ) - __field(unsigned long, freed ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) - tp_assign(tail_sequence, journal->j_tail_sequence) - tp_assign(first_tid, first_tid) - tp_assign(block_nr, block_nr) - tp_assign(freed, freed) - ), - - TP_printk("dev %d,%d from %u to %u offset %lu freed %lu", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->tail_sequence, __entry->first_tid, - __entry->block_nr, __entry->freed) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) + ctf_integer(tid_t, tail_sequence, journal->j_tail_sequence) + ctf_integer(tid_t, first_tid, first_tid) + ctf_integer(unsigned long, block_nr, block_nr) + ctf_integer(unsigned long, freed, freed) + ) ) #endif @@ -259,18 +169,10 @@ LTTNG_TRACEPOINT_EVENT(jbd2_write_superblock, TP_ARGS(journal, write_op), - TP_STRUCT__entry( - __field( dev_t, dev ) - __field( int, write_op ) - ), - - TP_fast_assign( - tp_assign(dev, journal->j_fs_dev->bd_dev) - tp_assign(write_op, write_op) - ), - - TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev), - MINOR(__entry->dev), __entry->write_op) + TP_FIELDS( + ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev) + ctf_integer(int, write_op, write_op) + ) ) #endif diff --git a/instrumentation/events/lttng-module/kmem.h b/instrumentation/events/lttng-module/kmem.h index c7869f12..c94f8af9 100644 --- a/instrumentation/events/lttng-module/kmem.h +++ b/instrumentation/events/lttng-module/kmem.h @@ -21,28 +21,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc, TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags), - TP_STRUCT__entry( - __field_hex( unsigned long, call_site ) - __field_hex( const void *, ptr ) - __field( size_t, bytes_req ) - __field( size_t, bytes_alloc ) - __field( gfp_t, gfp_flags ) - ), - - TP_fast_assign( - tp_assign(call_site, call_site) - tp_assign(ptr, ptr) - tp_assign(bytes_req, bytes_req) - tp_assign(bytes_alloc, bytes_alloc) - tp_assign(gfp_flags, gfp_flags) - ), - - TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s", - __entry->call_site, - __entry->ptr, - __entry->bytes_req, - __entry->bytes_alloc, - show_gfp_flags(__entry->gfp_flags)) + TP_FIELDS( + ctf_integer_hex(unsigned long, call_site, call_site) + ctf_integer_hex(const void *, ptr, ptr) + ctf_integer(size_t, bytes_req, bytes_req) + ctf_integer(size_t, bytes_alloc, bytes_alloc) + ctf_integer(gfp_t, gfp_flags, gfp_flags) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc, kmalloc, @@ -74,31 +59,14 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node, TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node), - TP_STRUCT__entry( - __field_hex( unsigned long, call_site ) - __field_hex( const void *, ptr ) - __field( size_t, bytes_req ) - __field( size_t, bytes_alloc ) - __field( gfp_t, gfp_flags ) - __field( int, node ) - ), - - TP_fast_assign( - tp_assign(call_site, call_site) - tp_assign(ptr, ptr) - tp_assign(bytes_req, bytes_req) - tp_assign(bytes_alloc, bytes_alloc) - tp_assign(gfp_flags, gfp_flags) - tp_assign(node, node) - ), - - TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d", - __entry->call_site, - __entry->ptr, - __entry->bytes_req, - __entry->bytes_alloc, - show_gfp_flags(__entry->gfp_flags), - __entry->node) + TP_FIELDS( + ctf_integer_hex(unsigned long, call_site, call_site) + ctf_integer_hex(const void *, ptr, ptr) + ctf_integer(size_t, bytes_req, bytes_req) + ctf_integer(size_t, bytes_alloc, bytes_alloc) + ctf_integer(gfp_t, gfp_flags, gfp_flags) + ctf_integer(int, node, node) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node, kmalloc_node, @@ -127,17 +95,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free, TP_ARGS(call_site, ptr), - TP_STRUCT__entry( - __field_hex( unsigned long, call_site ) - __field_hex( const void *, ptr ) - ), - - TP_fast_assign( - tp_assign(call_site, call_site) - tp_assign(ptr, ptr) - ), - - TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr) + TP_FIELDS( + ctf_integer_hex(unsigned long, call_site, call_site) + ctf_integer_hex(const void *, ptr, ptr) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_free, kfree, @@ -167,20 +128,10 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_direct, kmem_mm_page_free_direct, TP_ARGS(page, order), - TP_STRUCT__entry( - __field_hex( struct page *, page ) - __field( unsigned int, order ) - ), - - TP_fast_assign( - tp_assign(page, page) - tp_assign(order, order) - ), - - TP_printk("page=%p pfn=%lu order=%d", - __entry->page, - page_to_pfn(__entry->page), - __entry->order) + TP_FIELDS( + ctf_integer_hex(struct page *, page, page) + ctf_integer(unsigned int, order, order) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) @@ -193,20 +144,10 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free, kmem_pagevec_free, TP_ARGS(page, cold), - TP_STRUCT__entry( - __field_hex( struct page *, page ) - __field( int, cold ) - ), - - TP_fast_assign( - tp_assign(page, page) - tp_assign(cold, cold) - ), - - TP_printk("page=%p pfn=%lu order=0 cold=%d", - __entry->page, - page_to_pfn(__entry->page), - __entry->cold) + TP_FIELDS( + ctf_integer_hex(struct page *, page, page) + ctf_integer(int, cold, cold) + ) ) LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc, kmem_mm_page_alloc, @@ -216,26 +157,12 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc, kmem_mm_page_alloc, TP_ARGS(page, order, gfp_flags, migratetype), - TP_STRUCT__entry( - __field_hex( struct page *, page ) - __field( unsigned int, order ) - __field( gfp_t, gfp_flags ) - __field( int, migratetype ) - ), - - TP_fast_assign( - tp_assign(page, page) - tp_assign(order, order) - tp_assign(gfp_flags, gfp_flags) - tp_assign(migratetype, migratetype) - ), - - TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s", - __entry->page, - __entry->page ? page_to_pfn(__entry->page) : 0, - __entry->order, - __entry->migratetype, - show_gfp_flags(__entry->gfp_flags)) + TP_FIELDS( + ctf_integer_hex(struct page *, page, page) + ctf_integer(unsigned int, order, order) + ctf_integer(gfp_t, gfp_flags, gfp_flags) + ctf_integer(int, migratetype, migratetype) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page, @@ -244,24 +171,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page, TP_ARGS(page, order, migratetype), - TP_STRUCT__entry( - __field_hex( struct page *, page ) - __field( unsigned int, order ) - __field( int, migratetype ) - ), - - TP_fast_assign( - tp_assign(page, page) - tp_assign(order, order) - tp_assign(migratetype, migratetype) - ), - - TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d", - __entry->page, - __entry->page ? page_to_pfn(__entry->page) : 0, - __entry->order, - __entry->migratetype, - __entry->order == 0) + TP_FIELDS( + ctf_integer_hex(struct page *, page, page) + ctf_integer(unsigned int, order, order) + ctf_integer(int, migratetype, migratetype) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_alloc_zone_locked, @@ -273,7 +187,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_alloc_zone_locked, TP_ARGS(page, order, migratetype) ) -LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP(kmem_mm_page, mm_page_pcpu_drain, +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_pcpu_drain, kmem_mm_page_pcpu_drain, @@ -283,11 +197,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP(kmem_mm_page, mm_page_pcpu_drain, TP_PROTO(struct page *page, int order, int migratetype), #endif - TP_ARGS(page, order, migratetype), - - TP_printk("page=%p pfn=%lu order=%d migratetype=%d", - __entry->page, page_to_pfn(__entry->page), - __entry->order, __entry->migratetype) + TP_ARGS(page, order, migratetype) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \ @@ -392,34 +302,14 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag, alloc_migratetype, fallback_migratetype, change_ownership), - TP_STRUCT__entry( - __field_hex( struct page *, page ) - __field( int, alloc_order ) - __field( int, fallback_order ) - __field( int, alloc_migratetype ) - __field( int, fallback_migratetype ) - __field( int, change_ownership ) - ), - - TP_fast_assign( - tp_assign(page, page) - tp_assign(alloc_order, alloc_order) - tp_assign(fallback_order, fallback_order) - tp_assign(alloc_migratetype, alloc_migratetype) - tp_assign(fallback_migratetype, fallback_migratetype) - tp_assign(change_ownership, change_ownership) - ), - - TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d", - __entry->page, - page_to_pfn(__entry->page), - __entry->alloc_order, - __entry->fallback_order, - pageblock_order, - __entry->alloc_migratetype, - __entry->fallback_migratetype, - __entry->fallback_order < pageblock_order, - __entry->change_ownership) + TP_FIELDS( + ctf_integer_hex(struct page *, page, page) + ctf_integer(int, alloc_order, alloc_order) + ctf_integer(int, fallback_order, fallback_order) + ctf_integer(int, alloc_migratetype, alloc_migratetype) + ctf_integer(int, fallback_migratetype, fallback_migratetype) + ctf_integer(int, change_ownership, change_ownership) + ) ) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ @@ -436,32 +326,13 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag, alloc_order, fallback_order, alloc_migratetype, fallback_migratetype), - TP_STRUCT__entry( - __field_hex( struct page *, page ) - __field( int, alloc_order ) - __field( int, fallback_order ) - __field( int, alloc_migratetype ) - __field( int, fallback_migratetype ) - ), - - TP_fast_assign( - tp_assign(page, page) - tp_assign(alloc_order, alloc_order) - tp_assign(fallback_order, fallback_order) - tp_assign(alloc_migratetype, alloc_migratetype) - tp_assign(fallback_migratetype, fallback_migratetype) - ), - - TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d", - __entry->page, - page_to_pfn(__entry->page), - __entry->alloc_order, - __entry->fallback_order, - pageblock_order, - __entry->alloc_migratetype, - __entry->fallback_migratetype, - __entry->fallback_order < pageblock_order, - __entry->alloc_migratetype == __entry->fallback_migratetype) + TP_FIELDS( + ctf_integer_hex(struct page *, page, page) + ctf_integer(int, alloc_order, alloc_order) + ctf_integer(int, fallback_order, fallback_order) + ctf_integer(int, alloc_migratetype, alloc_migratetype) + ctf_integer(int, fallback_migratetype, fallback_migratetype) + ) ) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ diff --git a/instrumentation/events/lttng-module/kvm.h b/instrumentation/events/lttng-module/kvm.h index 4f950958..3a6585fb 100755 --- a/instrumentation/events/lttng-module/kvm.h +++ b/instrumentation/events/lttng-module/kvm.h @@ -9,58 +9,14 @@ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) -#define ERSN(x) { KVM_EXIT_##x, "KVM_EXIT_" #x } - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) - -#define kvm_trace_exit_reason \ - ERSN(UNKNOWN), ERSN(EXCEPTION), ERSN(IO), ERSN(HYPERCALL), \ - ERSN(DEBUG), ERSN(HLT), ERSN(MMIO), ERSN(IRQ_WINDOW_OPEN), \ - ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR), \ - ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\ - ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI), ERSN(PAPR_HCALL), \ - ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH) - -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) - -#define kvm_trace_exit_reason \ - ERSN(UNKNOWN), ERSN(EXCEPTION), ERSN(IO), ERSN(HYPERCALL), \ - ERSN(DEBUG), ERSN(HLT), ERSN(MMIO), ERSN(IRQ_WINDOW_OPEN), \ - ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR), \ - ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\ - ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI), ERSN(PAPR_HCALL), \ - ERSN(S390_UCONTROL) - -#else - -#define kvm_trace_exit_reason \ - ERSN(UNKNOWN), ERSN(EXCEPTION), ERSN(IO), ERSN(HYPERCALL), \ - ERSN(DEBUG), ERSN(HLT), ERSN(MMIO), ERSN(IRQ_WINDOW_OPEN), \ - ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR), \ - ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\ - ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI) - -#endif - LTTNG_TRACEPOINT_EVENT(kvm_userspace_exit, TP_PROTO(__u32 reason, int errno), TP_ARGS(reason, errno), - TP_STRUCT__entry( - __field( __u32, reason ) - __field( int, errno ) - ), - - TP_fast_assign( - tp_assign(reason, reason) - tp_assign(errno, errno) - ), - - TP_printk("reason %s (%d)", - __entry->errno < 0 ? - (__entry->errno == -EINTR ? "restart" : "error") : - __print_symbolic(__entry->reason, kvm_trace_exit_reason), - __entry->errno < 0 ? -__entry->errno : __entry->reason) + TP_FIELDS( + ctf_integer(__u32, reason, reason) + ctf_integer(int, errno, errno) + ) ) #endif @@ -76,107 +32,47 @@ LTTNG_TRACEPOINT_EVENT(kvm_set_irq, TP_PROTO(unsigned int gsi, int level, int irq_source_id), TP_ARGS(gsi, level, irq_source_id), - TP_STRUCT__entry( - __field( unsigned int, gsi ) - __field( int, level ) - __field( int, irq_source_id ) - ), - - TP_fast_assign( - tp_assign(gsi, gsi) - tp_assign(level, level) - tp_assign(irq_source_id, irq_source_id) - ), - - TP_printk("gsi %u level %d source %d", - __entry->gsi, __entry->level, __entry->irq_source_id) + TP_FIELDS( + ctf_integer(unsigned int, gsi, gsi) + ctf_integer(int, level, level) + ctf_integer(int, irq_source_id, irq_source_id) + ) ) #endif #if defined(__KVM_HAVE_IOAPIC) -#define kvm_deliver_mode \ - {0x0, "Fixed"}, \ - {0x1, "LowPrio"}, \ - {0x2, "SMI"}, \ - {0x3, "Res3"}, \ - {0x4, "NMI"}, \ - {0x5, "INIT"}, \ - {0x6, "SIPI"}, \ - {0x7, "ExtINT"} LTTNG_TRACEPOINT_EVENT(kvm_ioapic_set_irq, TP_PROTO(__u64 e, int pin, bool coalesced), TP_ARGS(e, pin, coalesced), - TP_STRUCT__entry( - __field( __u64, e ) - __field( int, pin ) - __field( bool, coalesced ) - ), - - TP_fast_assign( - tp_assign(e, e) - tp_assign(pin, pin) - tp_assign(coalesced, coalesced) - ), - - TP_printk("pin %u dst %x vec=%u (%s|%s|%s%s)%s", - __entry->pin, (u8)(__entry->e >> 56), (u8)__entry->e, - __print_symbolic((__entry->e >> 8 & 0x7), kvm_deliver_mode), - (__entry->e & (1<<11)) ? "logical" : "physical", - (__entry->e & (1<<15)) ? "level" : "edge", - (__entry->e & (1<<16)) ? "|masked" : "", - __entry->coalesced ? " (coalesced)" : "") + TP_FIELDS( + ctf_integer(__u64, e, e) + ctf_integer(int, pin, pin) + ctf_integer(bool, coalesced, coalesced) + ) ) LTTNG_TRACEPOINT_EVENT(kvm_msi_set_irq, TP_PROTO(__u64 address, __u64 data), TP_ARGS(address, data), - TP_STRUCT__entry( - __field( __u64, address ) - __field( __u64, data ) - ), - - TP_fast_assign( - tp_assign(address, address) - tp_assign(data, data) - ), - - TP_printk("dst %u vec %x (%s|%s|%s%s)", - (u8)(__entry->address >> 12), (u8)__entry->data, - __print_symbolic((__entry->data >> 8 & 0x7), kvm_deliver_mode), - (__entry->address & (1<<2)) ? "logical" : "physical", - (__entry->data & (1<<15)) ? "level" : "edge", - (__entry->address & (1<<3)) ? "|rh" : "") + TP_FIELDS( + ctf_integer(__u64, address, address) + ctf_integer(__u64, data, data) + ) ) -#define kvm_irqchips \ - {KVM_IRQCHIP_PIC_MASTER, "PIC master"}, \ - {KVM_IRQCHIP_PIC_SLAVE, "PIC slave"}, \ - {KVM_IRQCHIP_IOAPIC, "IOAPIC"} - LTTNG_TRACEPOINT_EVENT(kvm_ack_irq, TP_PROTO(unsigned int irqchip, unsigned int pin), TP_ARGS(irqchip, pin), - TP_STRUCT__entry( - __field( unsigned int, irqchip ) - __field( unsigned int, pin ) - ), - - TP_fast_assign( - tp_assign(irqchip, irqchip) - tp_assign(pin, pin) - ), - - TP_printk("irqchip %s pin %u", - __print_symbolic(__entry->irqchip, kvm_irqchips), - __entry->pin) + TP_FIELDS( + ctf_integer(unsigned int, irqchip, irqchip) + ctf_integer(unsigned int, pin, pin) + ) ) - - #endif /* defined(__KVM_HAVE_IOAPIC) */ #define KVM_TRACE_MMIO_READ_UNSATISFIED 0 @@ -192,23 +88,12 @@ LTTNG_TRACEPOINT_EVENT(kvm_mmio, TP_PROTO(int type, int len, u64 gpa, u64 val), TP_ARGS(type, len, gpa, val), - TP_STRUCT__entry( - __field( u32, type ) - __field( u32, len ) - __field( u64, gpa ) - __field( u64, val ) - ), - - TP_fast_assign( - tp_assign(type, type) - tp_assign(len, len) - tp_assign(gpa, gpa) - tp_assign(val, val) - ), - - TP_printk("mmio %s len %u gpa 0x%llx val 0x%llx", - __print_symbolic(__entry->type, kvm_trace_symbol_mmio), - __entry->len, __entry->gpa, __entry->val) + TP_FIELDS( + ctf_integer(u32, type, type) + ctf_integer(u32, len, len) + ctf_integer(u64, gpa, gpa) + ctf_integer(u64, val, val) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) @@ -221,15 +106,9 @@ LTTNG_TRACEPOINT_EVENT(kvm_fpu, TP_PROTO(int load), TP_ARGS(load), - TP_STRUCT__entry( - __field( u32, load ) - ), - - TP_fast_assign( - tp_assign(load, load) - ), - - TP_printk("%s", __print_symbolic(__entry->load, kvm_fpu_load_symbol)) + TP_FIELDS( + ctf_integer(u32, load, load) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) @@ -264,22 +143,12 @@ LTTNG_TRACEPOINT_EVENT(kvm_age_page, TP_PROTO(ulong hva, struct kvm_memory_slot *slot, int ref), TP_ARGS(hva, slot, ref), - TP_STRUCT__entry( - __field( u64, hva ) - __field( u64, gfn ) - __field( u8, referenced ) - ), - - TP_fast_assign( - tp_assign(hva, hva) - tp_assign(gfn, - slot->base_gfn + ((hva - slot->userspace_addr) >> PAGE_SHIFT)) - tp_assign(referenced, ref) - ), - - TP_printk("hva %llx gfn %llx %s", - __entry->hva, __entry->gfn, - __entry->referenced ? "YOUNG" : "OLD") + TP_FIELDS( + ctf_integer(u64, hva, hva) + ctf_integer(u64, gfn, + slot->base_gfn + ((hva - slot->userspace_addr) >> PAGE_SHIFT)) + ctf_integer(u8, referenced, ref) + ) ) #endif #endif @@ -293,17 +162,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kvm_async_get_page_class, TP_ARGS(gva, gfn), - TP_STRUCT__entry( - __field(__u64, gva) - __field(u64, gfn) - ), - - TP_fast_assign( - tp_assign(gva, gva) - tp_assign(gfn, gfn) - ), - - TP_printk("gva = %#llx, gfn = %#llx", __entry->gva, __entry->gfn) + TP_FIELDS( + ctf_integer(__u64, gva, gva) + ctf_integer(u64, gfn, gfn) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_get_page_class, kvm_try_async_get_page, @@ -326,18 +188,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kvm_async_pf_nopresent_ready, TP_ARGS(token, gva), - TP_STRUCT__entry( - __field(__u64, token) - __field(__u64, gva) - ), - - TP_fast_assign( - tp_assign(token, token) - tp_assign(gva, gva) - ), - - TP_printk("token %#llx gva %#llx", __entry->token, __entry->gva) - + TP_FIELDS( + ctf_integer(__u64, token, token) + ctf_integer(__u64, gva, gva) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_pf_nopresent_ready, kvm_async_pf_not_present, @@ -361,18 +215,10 @@ LTTNG_TRACEPOINT_EVENT( TP_PROTO(unsigned long address, u64 gva), TP_ARGS(address, gva), - TP_STRUCT__entry( - __field(unsigned long, address) - __field(u64, gva) - ), - - TP_fast_assign( - tp_assign(address, address) - tp_assign(gva, gva) - ), - - TP_printk("gva %#llx address %#lx", __entry->gva, - __entry->address) + TP_FIELDS( + ctf_integer(unsigned long, address, address) + ctf_integer(u64, gva, gva) + ) ) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) */ @@ -382,20 +228,11 @@ LTTNG_TRACEPOINT_EVENT( TP_PROTO(unsigned long address, struct page *page, u64 gva), TP_ARGS(address, page, gva), - TP_STRUCT__entry( - __field(unsigned long, address) - __field(pfn_t, pfn) - __field(u64, gva) - ), - - TP_fast_assign( - tp_assign(address, address) - tp_assign(pfn, page ? page_to_pfn(page) : 0) - tp_assign(gva, gva) - ), - - TP_printk("gva %#llx address %#lx pfn %#llx", __entry->gva, - __entry->address, __entry->pfn) + TP_FIELDS( + ctf_integer(unsigned long, address, address) + ctf_integer(pfn_t, pfn, page ? page_to_pfn(page) : 0) + ctf_integer(u64, gva, gva) + ) ) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) */ diff --git a/instrumentation/events/lttng-module/lock.h b/instrumentation/events/lttng-module/lock.h index a77e9a8d..3e5d68a5 100644 --- a/instrumentation/events/lttng-module/lock.h +++ b/instrumentation/events/lttng-module/lock.h @@ -27,30 +27,13 @@ LTTNG_TRACEPOINT_EVENT(lock_acquire, TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip), - TP_STRUCT__entry( - __field(unsigned int, flags) - __string(name, lock->name) + TP_FIELDS( + ctf_integer(unsigned int, flags, (trylock ? 1 : 0) | (read ? 2 : 0)) + ctf_string(name, lock->name) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - __field(void *, lockdep_addr) + ctf_integer(void *, lockdep_addr, lock) #endif - ), - - TP_fast_assign( - tp_assign(flags, (trylock ? 1 : 0) | (read ? 2 : 0)) - tp_strcpy(name, lock->name) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - tp_assign(lockdep_addr, lock) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - TP_printk("%p %s%s%s", __entry->lockdep_addr, -#else - TP_printk("%s%s%s", -#endif - (__entry->flags & 1) ? "try " : "", - (__entry->flags & 2) ? "read " : "", - __get_str(name)) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) @@ -61,17 +44,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(lock, TP_ARGS(lock, ip), - TP_STRUCT__entry( - __string( name, lock->name ) - __field( void *, lockdep_addr ) - ), - - TP_fast_assign( - tp_strcpy(name, lock->name) - tp_assign(lockdep_addr, lock) - ), - - TP_printk("%p %s", __entry->lockdep_addr, __get_str(name)) + TP_FIELDS( + ctf_string(name, lock->name) + ctf_integer(void *, lockdep_addr, lock) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(lock, lock_release, @@ -107,25 +83,12 @@ LTTNG_TRACEPOINT_EVENT(lock_release, TP_ARGS(lock, nested, ip), - TP_STRUCT__entry( - __string( name, lock->name ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - __field( void *, lockdep_addr ) -#endif - ), - - TP_fast_assign( - tp_strcpy(name, lock->name) + TP_FIELDS( + ctf_string(name, lock->name) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - tp_assign(lockdep_addr, lock) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - TP_printk("%p %s", __entry->lockdep_addr, __get_str(name)) -#else - TP_printk("%s", __get_str(name)) + ctf_integer(void *, lockdep_addr, lock) #endif + ) ) #ifdef CONFIG_LOCK_STAT @@ -136,25 +99,12 @@ LTTNG_TRACEPOINT_EVENT(lock_contended, TP_ARGS(lock, ip), - TP_STRUCT__entry( - __string( name, lock->name ) + TP_FIELDS( + ctf_string(name, lock->name) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - __field( void *, lockdep_addr ) -#endif - ), - - TP_fast_assign( - tp_strcpy(name, lock->name) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - tp_assign(lockdep_addr, lock) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - TP_printk("%p %s", __entry->lockdep_addr, __get_str(name)) -#else - TP_printk("%s", __get_str(name)) + ctf_integer(void *, lockdep_addr, lock) #endif + ) ) LTTNG_TRACEPOINT_EVENT(lock_acquired, @@ -163,36 +113,16 @@ LTTNG_TRACEPOINT_EVENT(lock_acquired, TP_ARGS(lock, ip, waittime), - TP_STRUCT__entry( - __string( name, lock->name ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - __field( s64, wait_nsec ) - __field( void *, lockdep_addr ) -#else - __field(unsigned long, wait_usec) - __field(unsigned long, wait_nsec_rem) -#endif - ), - - TP_fast_assign( - tp_strcpy(name, lock->name) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - tp_assign(wait_nsec, waittime) - tp_assign(lockdep_addr, lock) -#else - tp_assign(wait_usec, (unsigned long)waittime) - tp_assign(wait_nsec_rem, do_div(waittime, NSEC_PER_USEC)) -#endif - ), - + TP_FIELDS( + ctf_string(name, lock->name) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - TP_printk("%p %s (%llu ns)", __entry->lockdep_addr, - __get_str(name), __entry->wait_nsec) + ctf_integer(s64, wait_nsec, wait_nsec) + ctf_integer(void *, lockdep_addr, lock) #else - TP_printk("%s (%lu.%03lu us)", - __get_str(name), - __entry->wait_usec, __entry->wait_nsec_rem) + ctf_integer(unsigned long, wait_usec, (unsigned long) waittime) + ctf_integer(unsigned long, wait_nsec_rem, do_div(waittime, NSEC_PER_USEC)) #endif + ) ) #endif diff --git a/instrumentation/events/lttng-module/lttng-statedump.h b/instrumentation/events/lttng-module/lttng-statedump.h index 985b71cf..23690370 100644 --- a/instrumentation/events/lttng-module/lttng-statedump.h +++ b/instrumentation/events/lttng-module/lttng-statedump.h @@ -12,21 +12,13 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_start, TP_PROTO(struct lttng_session *session), TP_ARGS(session), - TP_STRUCT__entry( - ), - TP_fast_assign( - ), - TP_printk("") + TP_FIELDS() ) LTTNG_TRACEPOINT_EVENT(lttng_statedump_end, TP_PROTO(struct lttng_session *session), TP_ARGS(session), - TP_STRUCT__entry( - ), - TP_fast_assign( - ), - TP_printk("") + TP_FIELDS() ) LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state, @@ -35,26 +27,12 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state, int type, int mode, int submode, int status, struct pid_namespace *pid_ns), TP_ARGS(session, p, type, mode, submode, status, pid_ns), - TP_STRUCT__entry( - __field(pid_t, tid) - __field(pid_t, vtid) - __field(pid_t, pid) - __field(pid_t, vpid) - __field(pid_t, ppid) - __field(pid_t, vppid) - __array_text(char, name, TASK_COMM_LEN) - __field(int, type) - __field(int, mode) - __field(int, submode) - __field(int, status) - __field(int, ns_level) - ), - TP_fast_assign( - tp_assign(tid, p->pid) - tp_assign(vtid, pid_ns ? task_pid_nr_ns(p, pid_ns) : 0) - tp_assign(pid, p->tgid) - tp_assign(vpid, pid_ns ? task_tgid_nr_ns(p, pid_ns) : 0) - tp_assign(ppid, + TP_FIELDS( + ctf_integer(pid_t, tid, p->pid) + ctf_integer(pid_t, vtid, pid_ns ? task_pid_nr_ns(p, pid_ns) : 0) + ctf_integer(pid_t, pid, p->tgid) + ctf_integer(pid_t, vpid, pid_ns ? task_tgid_nr_ns(p, pid_ns) : 0) + ctf_integer(pid_t, ppid, ({ pid_t ret; @@ -63,7 +41,7 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state, rcu_read_unlock(); ret; })) - tp_assign(vppid, + ctf_integer(pid_t, vppid, ({ struct task_struct *parent; pid_t ret = 0; @@ -76,14 +54,13 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state, } ret; })) - tp_memcpy(name, p->comm, TASK_COMM_LEN) - tp_assign(type, type) - tp_assign(mode, mode) - tp_assign(submode, submode) - tp_assign(status, status) - tp_assign(ns_level, pid_ns ? pid_ns->level : 0) - ), - TP_printk("") + ctf_array_text(char, name, p->comm, TASK_COMM_LEN) + ctf_integer(int, type, type) + ctf_integer(int, mode, mode) + ctf_integer(int, submode, submode) + ctf_integer(int, status, status) + ctf_integer(int, ns_level, pid_ns ? pid_ns->level : 0) + ) ) LTTNG_TRACEPOINT_EVENT(lttng_statedump_file_descriptor, @@ -91,21 +68,13 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_file_descriptor, struct task_struct *p, int fd, const char *filename, unsigned int flags, fmode_t fmode), TP_ARGS(session, p, fd, filename, flags, fmode), - TP_STRUCT__entry( - __field(pid_t, pid) - __field(int, fd) - __field_oct(unsigned int, flags) - __field_hex(fmode_t, fmode) - __string(filename, filename) - ), - TP_fast_assign( - tp_assign(pid, p->tgid) - tp_assign(fd, fd) - tp_assign(flags, flags) - tp_assign(fmode, fmode) - tp_strcpy(filename, filename) - ), - TP_printk("") + TP_FIELDS( + ctf_integer(pid_t, pid, p->tgid) + ctf_integer(int, fd, fd) + ctf_integer_oct(unsigned int, flags, flags) + ctf_integer_hex(fmode_t, fmode, fmode) + ctf_string(filename, filename) + ) ) LTTNG_TRACEPOINT_EVENT(lttng_statedump_vm_map, @@ -113,53 +82,35 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_vm_map, struct task_struct *p, struct vm_area_struct *map, unsigned long inode), TP_ARGS(session, p, map, inode), - TP_STRUCT__entry( - __field(pid_t, pid) - __field_hex(unsigned long, start) - __field_hex(unsigned long, end) - __field_hex(unsigned long, flags) - __field(unsigned long, inode) - __field(unsigned long, pgoff) - ), - TP_fast_assign( - tp_assign(pid, p->tgid) - tp_assign(start, map->vm_start) - tp_assign(end, map->vm_end) - tp_assign(flags, map->vm_flags) - tp_assign(inode, inode) - tp_assign(pgoff, map->vm_pgoff << PAGE_SHIFT) - ), - TP_printk("") + TP_FIELDS( + ctf_integer(pid_t, pid, p->tgid) + ctf_integer_hex(unsigned long, start, map->vm_start) + ctf_integer_hex(unsigned long, end, map->vm_end) + ctf_integer_hex(unsigned long, flags, map->vm_flags) + ctf_integer(unsigned long, inode, inode) + ctf_integer(unsigned long, pgoff, map->vm_pgoff << PAGE_SHIFT) + ) ) LTTNG_TRACEPOINT_EVENT(lttng_statedump_network_interface, TP_PROTO(struct lttng_session *session, struct net_device *dev, struct in_ifaddr *ifa), TP_ARGS(session, dev, ifa), - TP_STRUCT__entry( - __string(name, dev->name) - __field_network_hex(uint32_t, address_ipv4) - ), - TP_fast_assign( - tp_strcpy(name, dev->name) - tp_assign(address_ipv4, ifa ? ifa->ifa_address : 0U) - ), - TP_printk("") + TP_FIELDS( + ctf_string(name, dev->name) + ctf_integer_network_hex(uint32_t, address_ipv4, + ifa ? ifa->ifa_address : 0U) + ) ) LTTNG_TRACEPOINT_EVENT(lttng_statedump_block_device, TP_PROTO(struct lttng_session *session, dev_t dev, const char *diskname), TP_ARGS(session, dev, diskname), - TP_STRUCT__entry( - __field(dev_t, dev) - __string(diskname, diskname) - ), - TP_fast_assign( - tp_assign(dev, dev) - tp_strcpy(diskname, diskname) - ), - TP_printk("") + TP_FIELDS( + ctf_integer(dev_t, dev, dev) + ctf_string(diskname, diskname) + ) ) /* Called with desc->lock held */ @@ -168,17 +119,11 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_interrupt, unsigned int irq, const char *chip_name, struct irqaction *action), TP_ARGS(session, irq, chip_name, action), - TP_STRUCT__entry( - __field(unsigned int, irq) - __string(name, chip_name) - __string(action, action->name ? : "") - ), - TP_fast_assign( - tp_assign(irq, irq) - tp_strcpy(name, chip_name) - tp_strcpy(action, action->name ? : "") - ), - TP_printk("") + TP_FIELDS( + ctf_integer(unsigned int, irq, irq) + ctf_string(name, chip_name) + ctf_string(action, action->name ? : "") + ) ) #endif /* LTTNG_TRACE_LTTNG_STATEDUMP_H */ diff --git a/instrumentation/events/lttng-module/lttng.h b/instrumentation/events/lttng-module/lttng.h index cd766d29..d2f20a06 100644 --- a/instrumentation/events/lttng-module/lttng.h +++ b/instrumentation/events/lttng-module/lttng.h @@ -9,13 +9,9 @@ LTTNG_TRACEPOINT_EVENT(lttng_logger, TP_PROTO(const char __user *text, size_t len), TP_ARGS(text, len), - TP_STRUCT__entry( - __dynamic_array_text(char, msg, len) - ), - TP_fast_assign( - tp_memcpy_dyn_from_user(msg, text) - ), - TP_printk("") + TP_FIELDS( + ctf_user_sequence_text(char, msg, text, size_t, len) + ) ) #endif /* LTTNG_TRACE_LTTNG_H */ diff --git a/instrumentation/events/lttng-module/mm_vmscan.h b/instrumentation/events/lttng-module/mm_vmscan.h index 870c0264..a6d7fbf2 100644 --- a/instrumentation/events/lttng-module/mm_vmscan.h +++ b/instrumentation/events/lttng-module/mm_vmscan.h @@ -19,25 +19,6 @@ #define RECLAIM_WB_SYNC 0x0004u /* Unused, all reclaim async */ #define RECLAIM_WB_ASYNC 0x0008u -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) -#define show_reclaim_flags(flags) \ - (flags) ? __print_flags(flags, "|", \ - {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \ - {RECLAIM_WB_FILE, "RECLAIM_WB_FILE"}, \ - {RECLAIM_WB_MIXED, "RECLAIM_WB_MIXED"}, \ - {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \ - {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \ - ) : "RECLAIM_WB_NONE" -#else -#define show_reclaim_flags(flags) \ - (flags) ? __print_flags(flags, "|", \ - {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \ - {RECLAIM_WB_FILE, "RECLAIM_WB_FILE"}, \ - {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \ - {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \ - ) : "RECLAIM_WB_NONE" -#endif - #if ((LINUX_VERSION_CODE <= KERNEL_VERSION(3,0,38)) || \ LTTNG_KERNEL_RANGE(3,1,0, 3,2,0)) typedef int isolate_mode_t; @@ -51,15 +32,9 @@ LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_sleep, TP_ARGS(nid), - TP_STRUCT__entry( - __field( int, nid ) - ), - - TP_fast_assign( - tp_assign(nid, nid) - ), - - TP_printk("nid=%d", __entry->nid) + TP_FIELDS( + ctf_integer(int, nid, nid) + ) ) LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_wake, @@ -68,17 +43,10 @@ LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_wake, TP_ARGS(nid, order), - TP_STRUCT__entry( - __field( int, nid ) - __field( int, order ) - ), - - TP_fast_assign( - tp_assign(nid, nid) - tp_assign(order, order) - ), - - TP_printk("nid=%d order=%d", __entry->nid, __entry->order) + TP_FIELDS( + ctf_integer(int, nid, nid) + ctf_integer(int, order, order) + ) ) LTTNG_TRACEPOINT_EVENT(mm_vmscan_wakeup_kswapd, @@ -87,22 +55,11 @@ LTTNG_TRACEPOINT_EVENT(mm_vmscan_wakeup_kswapd, TP_ARGS(nid, zid, order), - TP_STRUCT__entry( - __field( int, nid ) - __field( int, zid ) - __field( int, order ) - ), - - TP_fast_assign( - tp_assign(nid, nid) - tp_assign(zid, zid) - tp_assign(order, order) - ), - - TP_printk("nid=%d zid=%d order=%d", - __entry->nid, - __entry->zid, - __entry->order) + TP_FIELDS( + ctf_integer(int, nid, nid) + ctf_integer(int, zid, zid) + ctf_integer(int, order, order) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template, @@ -111,22 +68,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template, TP_ARGS(order, may_writepage, gfp_flags), - TP_STRUCT__entry( - __field( int, order ) - __field( int, may_writepage ) - __field( gfp_t, gfp_flags ) - ), - - TP_fast_assign( - tp_assign(order, order) - tp_assign(may_writepage, may_writepage) - tp_assign(gfp_flags, gfp_flags) - ), - - TP_printk("order=%d may_writepage=%d gfp_flags=%s", - __entry->order, - __entry->may_writepage, - show_gfp_flags(__entry->gfp_flags)) + TP_FIELDS( + ctf_integer(int, order, order) + ctf_integer(int, may_writepage, may_writepage) + ctf_integer(gfp_t, gfp_flags, gfp_flags) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin, @@ -156,15 +102,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template, TP_ARGS(nr_reclaimed), - TP_STRUCT__entry( - __field( unsigned long, nr_reclaimed ) - ), - - TP_fast_assign( - tp_assign(nr_reclaimed, nr_reclaimed) - ), - - TP_printk("nr_reclaimed=%lu", __entry->nr_reclaimed) + TP_FIELDS( + ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end, @@ -201,44 +141,21 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_start, TP_ARGS(shr, sc, nr_objects_to_shrink, pgs_scanned, lru_pgs, cache_items, delta, total_scan), - TP_STRUCT__entry( - __field(struct shrinker *, shr) - __field(void *, shrink) - __field(long, nr_objects_to_shrink) - __field(gfp_t, gfp_flags) - __field(unsigned long, pgs_scanned) - __field(unsigned long, lru_pgs) - __field(unsigned long, cache_items) - __field(unsigned long long, delta) - __field(unsigned long, total_scan) - ), - - TP_fast_assign( - tp_assign(shr,shr) + TP_FIELDS( + ctf_integer(struct shrinker *, shr, shr) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) - tp_assign(shrink, shr->scan_objects) + ctf_integer(void *, shrink, shr->scan_objects) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ - tp_assign(shrink, shr->shrink) + ctf_integer(void *, shrink, shr->shrink) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ - tp_assign(nr_objects_to_shrink, nr_objects_to_shrink) - tp_assign(gfp_flags, sc->gfp_mask) - tp_assign(pgs_scanned, pgs_scanned) - tp_assign(lru_pgs, lru_pgs) - tp_assign(cache_items, cache_items) - tp_assign(delta, delta) - tp_assign(total_scan, total_scan) - ), - - TP_printk("%pF %p: objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld", - __entry->shrink, - __entry->shr, - __entry->nr_objects_to_shrink, - show_gfp_flags(__entry->gfp_flags), - __entry->pgs_scanned, - __entry->lru_pgs, - __entry->cache_items, - __entry->delta, - __entry->total_scan) + ctf_integer(long, nr_objects_to_shrink, nr_objects_to_shrink) + ctf_integer(gfp_t, gfp_flags, sc->gfp_mask) + ctf_integer(unsigned long, pgs_scanned, pgs_scanned) + ctf_integer(unsigned long, lru_pgs, lru_pgs) + ctf_integer(unsigned long, cache_items, cache_items) + ctf_integer(unsigned long long, delta, delta) + ctf_integer(unsigned long, total_scan, total_scan) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) @@ -252,34 +169,15 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end, TP_ARGS(shr, nid, shrinker_retval, unused_scan_cnt, new_scan_cnt, total_scan), - TP_STRUCT__entry( - __field(struct shrinker *, shr) - __field(int, nid) - __field(void *, shrink) - __field(long, unused_scan) - __field(long, new_scan) - __field(int, retval) - __field(long, total_scan) - ), - - TP_fast_assign( - tp_assign(shr, shr) - tp_assign(nid, nid) - tp_assign(shrink, shr->scan_objects) - tp_assign(unused_scan, unused_scan_cnt) - tp_assign(new_scan, new_scan_cnt) - tp_assign(retval, shrinker_retval) - tp_assign(total_scan, total_scan) - ), - - TP_printk("%pF %p: nid %d unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d", - __entry->shrink, - __entry->shr, - __entry->nid, - __entry->unused_scan, - __entry->new_scan, - __entry->total_scan, - __entry->retval) + TP_FIELDS( + ctf_integer(struct shrinker *, shr, shr) + ctf_integer(int, nid, nid) + ctf_integer(void *, shrink, shr->scan_objects) + ctf_integer(long, unused_scan, unused_scan_cnt) + ctf_integer(long, new_scan, new_scan_cnt) + ctf_integer(int, retval, shrinker_retval) + ctf_integer(long, total_scan, total_scan) + ) ) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end, @@ -291,35 +189,18 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end, TP_ARGS(shr, shrinker_retval, unused_scan_cnt, new_scan_cnt), - TP_STRUCT__entry( - __field(struct shrinker *, shr) - __field(void *, shrink) - __field(long, unused_scan) - __field(long, new_scan) - __field(int, retval) - __field(long, total_scan) - ), - - TP_fast_assign( - tp_assign(shr, shr) + TP_FIELDS( + ctf_integer(struct shrinker *, shr, shr) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) - tp_assign(shrink, shr->scan_objects) + ctf_integer(void *, shrink, shr->scan_objects) #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ - tp_assign(shrink, shr->shrink) + ctf_integer(void *, shrink, shr->shrink) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ - tp_assign(unused_scan, unused_scan_cnt) - tp_assign(new_scan, new_scan_cnt) - tp_assign(retval, shrinker_retval) - tp_assign(total_scan, new_scan_cnt - unused_scan_cnt) - ), - - TP_printk("%pF %p: unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d", - __entry->shrink, - __entry->shr, - __entry->unused_scan, - __entry->new_scan, - __entry->total_scan, - __entry->retval) + ctf_integer(long, unused_scan, unused_scan_cnt) + ctf_integer(long, new_scan, new_scan_cnt) + ctf_integer(int, retval, shrinker_retval) + ctf_integer(long, total_scan, new_scan_cnt - unused_scan_cnt) + ) ) #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ #endif @@ -355,68 +236,21 @@ LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_lru_isolate_template, ), - TP_STRUCT__entry( - __field(int, order) - __field(unsigned long, nr_requested) - __field(unsigned long, nr_scanned) - __field(unsigned long, nr_taken) + TP_FIELDS( + ctf_integer(int, order, order) + ctf_integer(unsigned long, nr_requested, nr_requested) + ctf_integer(unsigned long, nr_scanned, nr_scanned) + ctf_integer(unsigned long, nr_taken, nr_taken) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - __field(unsigned long, nr_lumpy_taken) - __field(unsigned long, nr_lumpy_dirty) - __field(unsigned long, nr_lumpy_failed) + ctf_integer(unsigned long, nr_lumpy_taken, nr_lumpy_taken) + ctf_integer(unsigned long, nr_lumpy_dirty, nr_lumpy_dirty) + ctf_integer(unsigned long, nr_lumpy_failed, nr_lumpy_failed) #endif - __field(isolate_mode_t, isolate_mode) + ctf_integer(isolate_mode_t, isolate_mode, isolate_mode) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - __field(int, file) -#endif - ), - - TP_fast_assign( - tp_assign(order, order) - tp_assign(nr_requested, nr_requested) - tp_assign(nr_scanned, nr_scanned) - tp_assign(nr_taken, nr_taken) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - tp_assign(nr_lumpy_taken, nr_lumpy_taken) - tp_assign(nr_lumpy_dirty, nr_lumpy_dirty) - tp_assign(nr_lumpy_failed, nr_lumpy_failed) -#endif - tp_assign(isolate_mode, isolate_mode) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - tp_assign(file, file) -#endif - ), - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) - TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu", - __entry->isolate_mode, - __entry->order, - __entry->nr_requested, - __entry->nr_scanned, - __entry->nr_taken, - __entry->nr_lumpy_taken, - __entry->nr_lumpy_dirty, - __entry->nr_lumpy_failed) -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu file=%d", - __entry->isolate_mode, - __entry->order, - __entry->nr_requested, - __entry->nr_scanned, - __entry->nr_taken, - __entry->nr_lumpy_taken, - __entry->nr_lumpy_dirty, - __entry->nr_lumpy_failed, - __entry->file) -#else - TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu file=%d", - __entry->isolate_mode, - __entry->order, - __entry->nr_requested, - __entry->nr_scanned, - __entry->nr_taken, - __entry->file) + ctf_integer(int, file, file) #endif + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate, @@ -489,20 +323,10 @@ LTTNG_TRACEPOINT_EVENT(mm_vmscan_writepage, TP_ARGS(page, reclaim_flags), - TP_STRUCT__entry( - __field(struct page *, page) - __field(int, reclaim_flags) - ), - - TP_fast_assign( - tp_assign(page, page) - tp_assign(reclaim_flags, reclaim_flags) - ), - - TP_printk("page=%p pfn=%lu flags=%s", - __entry->page, - page_to_pfn(__entry->page), - show_reclaim_flags(__entry->reclaim_flags)) + TP_FIELDS( + ctf_integer(struct page *, page, page) + ctf_integer(int, reclaim_flags, reclaim_flags) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) @@ -514,29 +338,14 @@ LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive, TP_ARGS(nid, zid, nr_scanned, nr_reclaimed, priority, reclaim_flags), - TP_STRUCT__entry( - __field(int, nid) - __field(int, zid) - __field(unsigned long, nr_scanned) - __field(unsigned long, nr_reclaimed) - __field(int, priority) - __field(int, reclaim_flags) - ), - - TP_fast_assign( - tp_assign(nid, nid) - tp_assign(zid, zid) - tp_assign(nr_scanned, nr_scanned) - tp_assign(nr_reclaimed, nr_reclaimed) - tp_assign(priority, priority) - tp_assign(reclaim_flags, reclaim_flags) - ), - - TP_printk("nid=%d zid=%d nr_scanned=%ld nr_reclaimed=%ld priority=%d flags=%s", - __entry->nid, __entry->zid, - __entry->nr_scanned, __entry->nr_reclaimed, - __entry->priority, - show_reclaim_flags(__entry->reclaim_flags)) + TP_FIELDS( + ctf_integer(int, nid, nid) + ctf_integer(int, zid, zid) + ctf_integer(unsigned long, nr_scanned, nr_scanned) + ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) + ctf_integer(int, priority, priority) + ctf_integer(int, reclaim_flags, reclaim_flags) + ) ) #endif @@ -550,23 +359,12 @@ LTTNG_TRACEPOINT_EVENT_MAP(replace_swap_token, TP_ARGS(old_mm, new_mm), - TP_STRUCT__entry( - __field(struct mm_struct*, old_mm) - __field(unsigned int, old_prio) - __field(struct mm_struct*, new_mm) - __field(unsigned int, new_prio) - ), - - TP_fast_assign( - tp_assign(old_mm, old_mm) - tp_assign(old_prio, old_mm ? old_mm->token_priority : 0) - tp_assign(new_mm, new_mm) - tp_assign(new_prio, new_mm->token_priority) - ), - - TP_printk("old_token_mm=%p old_prio=%u new_token_mm=%p new_prio=%u", - __entry->old_mm, __entry->old_prio, - __entry->new_mm, __entry->new_prio) + TP_FIELDS( + ctf_integer(struct mm_struct *, old_mm, old_mm) + ctf_integer(unsigned int, old_prio, old_mm ? old_mm->token_priority : 0) + ctf_integer(struct mm_struct *, new_mm, new_mm) + ctf_integer(unsigned int, new_prio, new_mm->token_priority) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_put_swap_token_template, @@ -574,15 +372,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_put_swap_token_template, TP_ARGS(swap_token_mm), - TP_STRUCT__entry( - __field(struct mm_struct*, swap_token_mm) - ), - - TP_fast_assign( - tp_assign(swap_token_mm, swap_token_mm) - ), - - TP_printk("token_mm=%p", __entry->swap_token_mm) + TP_FIELDS( + ctf_integer(struct mm_struct*, swap_token_mm, swap_token_mm) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template, put_swap_token, @@ -593,16 +385,15 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template, put_swap_ TP_ARGS(swap_token_mm) ) -LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION_MAP(mm_vmscan_put_swap_token_template, disable_swap_token, +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template, disable_swap_token, mm_vmscan_disable_swap_token, TP_PROTO(struct mm_struct *swap_token_mm), - TP_ARGS(swap_token_mm), - TP_CONDITION(swap_token_mm != NULL) + TP_ARGS(swap_token_mm) ) -LTTNG_TRACEPOINT_EVENT_CONDITION_MAP(update_swap_token_priority, +LTTNG_TRACEPOINT_EVENT_MAP(update_swap_token_priority, mm_vmscan_update_swap_token_priority, @@ -612,27 +403,13 @@ LTTNG_TRACEPOINT_EVENT_CONDITION_MAP(update_swap_token_priority, TP_ARGS(mm, old_prio, swap_token_mm), - TP_CONDITION(mm->token_priority != old_prio), - - TP_STRUCT__entry( - __field(struct mm_struct*, mm) - __field(unsigned int, old_prio) - __field(unsigned int, new_prio) - __field(struct mm_struct*, swap_token_mm) - __field(unsigned int, swap_token_prio) - ), - - TP_fast_assign( - tp_assign(mm, mm) - tp_assign(old_prio, old_prio) - tp_assign(new_prio, mm->token_priority) - tp_assign(swap_token_mm, swap_token_mm) - tp_assign(swap_token_prio, swap_token_mm ? swap_token_mm->token_priority : 0) - ), - - TP_printk("mm=%p old_prio=%u new_prio=%u swap_token_mm=%p token_prio=%u", - __entry->mm, __entry->old_prio, __entry->new_prio, - __entry->swap_token_mm, __entry->swap_token_prio) + TP_FIELDS( + ctf_integer(struct mm_struct*, mm, mm) + ctf_integer(unsigned int, old_prio, old_prio) + ctf_integer(unsigned int, new_prio, mm->token_priority) + ctf_integer(struct mm_struct*, swap_token_mm, swap_token_mm) + ctf_integer(unsigned int, swap_token_prio, swap_token_mm ? swap_token_mm->token_priority : 0) + ) ) #endif diff --git a/instrumentation/events/lttng-module/module.h b/instrumentation/events/lttng-module/module.h index bc9493ad..3bb75594 100644 --- a/instrumentation/events/lttng-module/module.h +++ b/instrumentation/events/lttng-module/module.h @@ -31,17 +31,10 @@ LTTNG_TRACEPOINT_EVENT(module_load, TP_ARGS(mod), - TP_STRUCT__entry( - __field( unsigned int, taints ) - __string( name, mod->name ) - ), - - TP_fast_assign( - tp_assign(taints, mod->taints) - tp_strcpy(name, mod->name) - ), - - TP_printk("%s %s", __get_str(name), show_module_flags(__entry->taints)) + TP_FIELDS( + ctf_integer(unsigned int, taints, mod->taints) + ctf_string(name, mod->name) + ) ) LTTNG_TRACEPOINT_EVENT(module_free, @@ -50,15 +43,9 @@ LTTNG_TRACEPOINT_EVENT(module_free, TP_ARGS(mod), - TP_STRUCT__entry( - __string( name, mod->name ) - ), - - TP_fast_assign( - tp_strcpy(name, mod->name) - ), - - TP_printk("%s", __get_str(name)) + TP_FIELDS( + ctf_string(name, mod->name) + ) ) #ifdef CONFIG_MODULE_UNLOAD @@ -76,26 +63,17 @@ LTTNG_TRACEPOINT_EVENT_CLASS(module_refcnt, TP_ARGS(mod, ip, refcnt), #endif - TP_STRUCT__entry( - __field( unsigned long, ip ) - __field( int, refcnt ) - __string( name, mod->name ) - ), - - TP_fast_assign( - tp_assign(ip, ip) + TP_FIELDS( + ctf_integer(unsigned long, ip, ip) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)) - tp_assign(refcnt, atomic_read(&mod->refcnt)) + ctf_integer(int, refcnt, atomic_read(&mod->refcnt)) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - tp_assign(refcnt, __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs)) + ctf_integer(int, refcnt, __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs)) #else - tp_assign(refcnt, refcnt) + ctf_integer(int, refcnt, refcnt) #endif - tp_strcpy(name, mod->name) - ), - - TP_printk("%s call_site=%pf refcnt=%d", - __get_str(name), (void *)__entry->ip, __entry->refcnt) + ctf_string(name, mod->name) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt, module_get, @@ -131,20 +109,11 @@ LTTNG_TRACEPOINT_EVENT(module_request, TP_ARGS(name, wait, ip), - TP_STRUCT__entry( - __field( unsigned long, ip ) - __field( bool, wait ) - __string( name, name ) - ), - - TP_fast_assign( - tp_assign(ip, ip) - tp_assign(wait, wait) - tp_strcpy(name, name) - ), - - TP_printk("%s wait=%d call_site=%pf", - __get_str(name), (int)__entry->wait, (void *)__entry->ip) + TP_FIELDS( + ctf_integer(unsigned long, ip, ip) + ctf_integer(bool, wait, wait) + ctf_string(name, name) + ) ) #endif /* CONFIG_MODULES */ diff --git a/instrumentation/events/lttng-module/napi.h b/instrumentation/events/lttng-module/napi.h index d6df1817..20e0d61d 100644 --- a/instrumentation/events/lttng-module/napi.h +++ b/instrumentation/events/lttng-module/napi.h @@ -16,18 +16,10 @@ LTTNG_TRACEPOINT_EVENT(napi_poll, TP_ARGS(napi), - TP_STRUCT__entry( - __field( struct napi_struct *, napi) - __string( dev_name, napi->dev ? napi->dev->name : NO_DEV) - ), - - TP_fast_assign( - tp_assign(napi, napi) - tp_strcpy(dev_name, napi->dev ? napi->dev->name : NO_DEV) - ), - - TP_printk("napi poll on napi struct %p for device %s", - __entry->napi, __get_str(dev_name)) + TP_FIELDS( + ctf_integer(struct napi_struct *, napi, napi) + ctf_string(dev_name, napi->dev ? napi->dev->name : NO_DEV) + ) ) #undef NO_DEV diff --git a/instrumentation/events/lttng-module/net.h b/instrumentation/events/lttng-module/net.h index a6bcecdf..f4a0d97e 100644 --- a/instrumentation/events/lttng-module/net.h +++ b/instrumentation/events/lttng-module/net.h @@ -26,35 +26,16 @@ LTTNG_TRACEPOINT_EVENT(net_dev_xmit, TP_ARGS(skb, rc), #endif - TP_STRUCT__entry( - __field( void *, skbaddr ) - __field( unsigned int, len ) - __field( int, rc ) + TP_FIELDS( + ctf_integer(void *, skbaddr, skb) + ctf_integer(unsigned int, len, skb_len) + ctf_integer(int, rc, rc) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40)) - __string( name, dev->name ) + ctf_string(name, dev->name) #else - __string( name, skb->dev->name ) + ctf_string(name, skb->dev->name) #endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40)) - TP_fast_assign( - tp_assign(skbaddr, skb) - tp_assign(len, skb_len) - tp_assign(rc, rc) - tp_strcpy(name, dev->name) - ), -#else - TP_fast_assign( - tp_assign(skbaddr, skb) - tp_assign(len, skb->len) - tp_assign(rc, rc) - tp_strcpy(name, skb->dev->name) - ), -#endif - - TP_printk("dev=%s skbaddr=%p len=%u rc=%d", - __get_str(name), __entry->skbaddr, __entry->len, __entry->rc) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(net_dev_template, @@ -63,20 +44,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(net_dev_template, TP_ARGS(skb), - TP_STRUCT__entry( - __field( void *, skbaddr ) - __field( unsigned int, len ) - __string( name, skb->dev->name ) - ), - - TP_fast_assign( - tp_assign(skbaddr, skb) - tp_assign(len, skb->len) - tp_strcpy(name, skb->dev->name) - ), - - TP_printk("dev=%s skbaddr=%p len=%u", - __get_str(name), __entry->skbaddr, __entry->len) + TP_FIELDS( + ctf_integer(void *, skbaddr, skb) + ctf_integer(unsigned int, len, skb->len) + ctf_string(name, skb->dev->name) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(net_dev_template, net_dev_queue, diff --git a/instrumentation/events/lttng-module/power.h b/instrumentation/events/lttng-module/power.h index 02a803cd..c934b475 100644 --- a/instrumentation/events/lttng-module/power.h +++ b/instrumentation/events/lttng-module/power.h @@ -15,18 +15,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(power_cpu, TP_ARGS(state, cpu_id), - TP_STRUCT__entry( - __field( u32, state ) - __field( u32, cpu_id ) - ), - - TP_fast_assign( - tp_assign(state, state) - tp_assign(cpu_id, cpu_id) - ), - - TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state, - (unsigned long)__entry->cpu_id) + TP_FIELDS( + ctf_integer(u32, state, state) + ctf_integer(u32, cpu_id, cpu_id) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_cpu, cpu_idle, @@ -62,15 +54,9 @@ LTTNG_TRACEPOINT_EVENT_MAP(machine_suspend, TP_ARGS(state), - TP_STRUCT__entry( - __field( u32, state ) - ), - - TP_fast_assign( - tp_assign(state, state) - ), - - TP_printk("state=%lu", (unsigned long)__entry->state) + TP_FIELDS( + ctf_integer(u32, state, state) + ) ) #endif @@ -81,18 +67,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(power_wakeup_source, TP_ARGS(name, state), - TP_STRUCT__entry( - __string( name, name ) - __field( u64, state ) - ), - - TP_fast_assign( - tp_strcpy(name, name) - tp_assign(state, state) - ), - - TP_printk("%s state=0x%lx", __get_str(name), - (unsigned long)__entry->state) + TP_FIELDS( + ctf_string(name, name) + ctf_integer(u64, state, state) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source, wakeup_source_activate, @@ -138,29 +116,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(power, TP_ARGS(type, state), #endif - TP_STRUCT__entry( - __field( u64, type ) - __field( u64, state ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) - __field( u64, cpu_id ) -#endif - ), - - TP_fast_assign( - tp_assign(type, type) - tp_assign(state, state) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) - tp_assign(cpu_id, cpu_id) -#endif - ), - + TP_FIELDS( + ctf_integer(u64, type, type) + ctf_integer(u64, state, state) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) - TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type, - (unsigned long)__entry->state, (unsigned long)__entry->cpu_id) -#else - TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, - (unsigned long)__entry->state) + ctf_integer(u64, cpu_id, cpu_id) #endif + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(power, power_start, @@ -201,27 +163,13 @@ LTTNG_TRACEPOINT_EVENT(power_end, TP_ARGS(dummy), #endif - TP_STRUCT__entry( + TP_FIELDS( #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) - __field( u64, cpu_id ) + ctf_integer(u64, cpu_id, cpu_id) #else - __field( u64, dummy ) -#endif - ), - - TP_fast_assign( -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) - tp_assign(cpu_id, cpu_id) -#else - tp_assign(dummy, 0xffff) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) - TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id) -#else - TP_printk("dummy=%lu", (unsigned long)__entry->dummy) + ctf_integer(u64, dummy, 0xffff) #endif + ) ) /* Deprecated dummy functions must be protected against multi-declartion */ @@ -269,20 +217,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(power_clock, TP_ARGS(name, state, cpu_id), - TP_STRUCT__entry( - __string( name, name ) - __field( u64, state ) - __field( u64, cpu_id ) - ), - - TP_fast_assign( - tp_strcpy(name, name) - tp_assign(state, state) - tp_assign(cpu_id, cpu_id) - ), - - TP_printk("%s state=%lu cpu_id=%lu", __get_str(name), - (unsigned long)__entry->state, (unsigned long)__entry->cpu_id) + TP_FIELDS( + ctf_string(name, name) + ctf_integer(u64, state, state) + ctf_integer(u64, cpu_id, cpu_id) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock, clock_enable, @@ -321,20 +260,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(power_domain, TP_ARGS(name, state, cpu_id), - TP_STRUCT__entry( - __string( name, name ) - __field( u64, state ) - __field( u64, cpu_id ) - ), - - TP_fast_assign( - tp_strcpy(name, name) - tp_assign(state, state) - tp_assign(cpu_id, cpu_id) -), - - TP_printk("%s state=%lu cpu_id=%lu", __get_str(name), - (unsigned long)__entry->state, (unsigned long)__entry->cpu_id) + TP_FIELDS( + ctf_string(name, name) + ctf_integer(u64, state, state) + ctf_integer(u64, cpu_id, cpu_id) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(power_domain, power_domain_target, diff --git a/instrumentation/events/lttng-module/printk.h b/instrumentation/events/lttng-module/printk.h index fd7cccc3..77fe081b 100644 --- a/instrumentation/events/lttng-module/printk.h +++ b/instrumentation/events/lttng-module/printk.h @@ -17,15 +17,9 @@ LTTNG_TRACEPOINT_EVENT_MAP(console, TP_ARGS(text, len), - TP_STRUCT__entry( - __dynamic_array_text(char, msg, len) - ), - - TP_fast_assign( - tp_memcpy_dyn(msg, text) - ), - - TP_printk("%s", __get_str(msg)) + TP_FIELDS( + ctf_sequence_text(char, msg, text, size_t, len) + ) ) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) @@ -41,15 +35,10 @@ LTTNG_TRACEPOINT_EVENT_CONDITION_MAP(console, TP_CONDITION(start != end), - TP_STRUCT__entry( - __dynamic_array_text(char, msg, end - start) - ), - - TP_fast_assign( - tp_memcpy_dyn(msg, log_buf + start) - ), - - TP_printk("%s", __get_str(msg)) + TP_FIELDS( + ctf_sequence_text(char, msg, log_buf + start, + size_t, end - start) + ) ) #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */ @@ -65,23 +54,21 @@ LTTNG_TRACEPOINT_EVENT_CONDITION_MAP(console, TP_CONDITION(start != end), - TP_STRUCT__entry( - __dynamic_array_text_2(char, msg, - (start & (log_buf_len - 1)) > (end & (log_buf_len - 1)) + TP_FIELDS( + /* + * printk buffer is gathered from two segments on older kernels. + */ + ctf_sequence_text(char, msg1, + log_buf + (start & (log_buf_len - 1)), + size_t, (start & (log_buf_len - 1)) > (end & (log_buf_len - 1)) ? log_buf_len - (start & (log_buf_len - 1)) - : end - start, - (start & (log_buf_len - 1)) > (end & (log_buf_len - 1)) + : end - start) + ctf_sequence_text(char, msg2, + log_buf, + size_t, (start & (log_buf_len - 1)) > (end & (log_buf_len - 1)) ? end & (log_buf_len - 1) : 0) - ), - - TP_fast_assign( - tp_memcpy_dyn_2(msg, - log_buf + (start & (log_buf_len - 1)), - log_buf) - ), - - TP_printk("%s", __get_str(msg)) + ) ) #endif diff --git a/instrumentation/events/lttng-module/random.h b/instrumentation/events/lttng-module/random.h index 910ea914..32737291 100644 --- a/instrumentation/events/lttng-module/random.h +++ b/instrumentation/events/lttng-module/random.h @@ -12,20 +12,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(random__mix_pool_bytes, TP_ARGS(pool_name, bytes, IP), - TP_STRUCT__entry( - __string( pool_name, pool_name ) - __field( int, bytes ) - __field(unsigned long, IP ) - ), - - TP_fast_assign( - tp_strcpy(pool_name, pool_name) - tp_assign(bytes, bytes) - tp_assign(IP, IP) - ), - - TP_printk("%s pool: bytes %d caller %pF", - __get_str(pool_name), __entry->bytes, (void *)__entry->IP) + TP_FIELDS( + ctf_string(pool_name, pool_name) + ctf_integer(int, bytes, bytes) + ctf_integer(unsigned long, IP, IP) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__mix_pool_bytes, mix_pool_bytes, @@ -55,26 +46,13 @@ LTTNG_TRACEPOINT_EVENT_MAP(credit_entropy_bits, TP_ARGS(pool_name, bits, entropy_count, entropy_total, IP), - TP_STRUCT__entry( - __string( pool_name, pool_name ) - __field( int, bits ) - __field( int, entropy_count ) - __field( int, entropy_total ) - __field(unsigned long, IP ) - ), - - TP_fast_assign( - tp_strcpy(pool_name, pool_name) - tp_assign(bits, bits) - tp_assign(entropy_count, entropy_count) - tp_assign(entropy_total, entropy_total) - tp_assign(IP, IP) - ), - - TP_printk("%s pool: bits %d entropy_count %d entropy_total %d " - "caller %pF", __get_str(pool_name), __entry->bits, - __entry->entropy_count, __entry->entropy_total, - (void *)__entry->IP) + TP_FIELDS( + ctf_string(pool_name, pool_name) + ctf_integer(int, bits, bits) + ctf_integer(int, entropy_count, entropy_count) + ctf_integer(int, entropy_total, entropy_total) + ctf_integer(unsigned long, IP, IP) + ) ) LTTNG_TRACEPOINT_EVENT_MAP(get_random_bytes, @@ -85,17 +63,10 @@ LTTNG_TRACEPOINT_EVENT_MAP(get_random_bytes, TP_ARGS(nbytes, IP), - TP_STRUCT__entry( - __field( int, nbytes ) - __field(unsigned long, IP ) - ), - - TP_fast_assign( - tp_assign(nbytes, nbytes) - tp_assign(IP, IP) - ), - - TP_printk("nbytes %d caller %pF", __entry->nbytes, (void *)__entry->IP) + TP_FIELDS( + ctf_integer(int, nbytes, nbytes) + ctf_integer(unsigned long, IP, IP) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(random__extract_entropy, @@ -104,23 +75,12 @@ LTTNG_TRACEPOINT_EVENT_CLASS(random__extract_entropy, TP_ARGS(pool_name, nbytes, entropy_count, IP), - TP_STRUCT__entry( - __string( pool_name, pool_name ) - __field( int, nbytes ) - __field( int, entropy_count ) - __field(unsigned long, IP ) - ), - - TP_fast_assign( - tp_strcpy(pool_name, pool_name) - tp_assign(nbytes, nbytes) - tp_assign(entropy_count, entropy_count) - tp_assign(IP, IP) - ), - - TP_printk("%s pool: nbytes %d entropy_count %d caller %pF", - __get_str(pool_name), __entry->nbytes, __entry->entropy_count, - (void *)__entry->IP) + TP_FIELDS( + ctf_string(pool_name, pool_name) + ctf_integer(int, nbytes, nbytes) + ctf_integer(int, entropy_count, entropy_count) + ctf_integer(unsigned long, IP, IP) + ) ) diff --git a/instrumentation/events/lttng-module/rcu.h b/instrumentation/events/lttng-module/rcu.h index 16993aa3..062dd14b 100644 --- a/instrumentation/events/lttng-module/rcu.h +++ b/instrumentation/events/lttng-module/rcu.h @@ -28,15 +28,9 @@ LTTNG_TRACEPOINT_EVENT(rcu_utilization, TP_ARGS(s), - TP_STRUCT__entry( - __string(s, s) - ), - - TP_fast_assign( - tp_strcpy(s, s) - ), - - TP_printk("%s", __get_str(s)) + TP_FIELDS( + ctf_string(s, s) + ) ) #ifdef CONFIG_RCU_TRACE @@ -65,20 +59,11 @@ LTTNG_TRACEPOINT_EVENT(rcu_grace_period, TP_ARGS(rcuname, gpnum, gpevent), - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(unsigned long, gpnum) - __string(gpevent, gpevent) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(gpnum, gpnum) - tp_strcpy(gpevent, gpevent) - ), - - TP_printk("%s %lu %s", - __get_str(rcuname), __entry->gpnum, __get_str(gpevent)) + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_integer(unsigned long, gpnum, gpnum) + ctf_string(gpevent, gpevent) + ) ) /* @@ -100,27 +85,14 @@ LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init, TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask), - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(unsigned long, gpnum) - __field(u8, level) - __field(int, grplo) - __field(int, grphi) - __field(unsigned long, qsmask) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(gpnum, gpnum) - tp_assign(level, level) - tp_assign(grplo, grplo) - tp_assign(grphi, grphi) - tp_assign(qsmask, qsmask) - ), - - TP_printk("%s %lu %u %d %d %lx", - __get_str(rcuname), __entry->gpnum, __entry->level, - __entry->grplo, __entry->grphi, __entry->qsmask) + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_integer(unsigned long, gpnum, gpnum) + ctf_integer(u8, level, level) + ctf_integer(int, grplo, grplo) + ctf_integer(int, grphi, grphi) + ctf_integer(unsigned long, qsmask, qsmask) + ) ) /* @@ -139,20 +111,11 @@ LTTNG_TRACEPOINT_EVENT(rcu_preempt_task, TP_ARGS(rcuname, pid, gpnum), - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(unsigned long, gpnum) - __field(int, pid) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(gpnum, gpnum) - tp_assign(pid, pid) - ), - - TP_printk("%s %lu %d", - __get_str(rcuname), __entry->gpnum, __entry->pid) + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_integer(unsigned long, gpnum, gpnum) + ctf_integer(int, pid, pid) + ) ) /* @@ -170,19 +133,11 @@ LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task, TP_ARGS(rcuname, gpnum, pid), - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(unsigned long, gpnum) - __field(int, pid) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(gpnum, gpnum) - tp_assign(pid, pid) - ), - - TP_printk("%s %lu %d", __get_str(rcuname), __entry->gpnum, __entry->pid) + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_integer(unsigned long, gpnum, gpnum) + ctf_integer(int, pid, pid) + ) ) /* @@ -207,32 +162,16 @@ LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report, TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks), - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(unsigned long, gpnum) - __field(unsigned long, mask) - __field(unsigned long, qsmask) - __field(u8, level) - __field(int, grplo) - __field(int, grphi) - __field(u8, gp_tasks) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(gpnum, gpnum) - tp_assign(mask, mask) - tp_assign(qsmask, qsmask) - tp_assign(level, level) - tp_assign(grplo, grplo) - tp_assign(grphi, grphi) - tp_assign(gp_tasks, gp_tasks) - ), - - TP_printk("%s %lu %lx>%lx %u %d %d %u", - __get_str(rcuname), __entry->gpnum, - __entry->mask, __entry->qsmask, __entry->level, - __entry->grplo, __entry->grphi, __entry->gp_tasks) + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_integer(unsigned long, gpnum, gpnum) + ctf_integer(unsigned long, mask, mask) + ctf_integer(unsigned long, qsmask, qsmask) + ctf_integer(u8, level, level) + ctf_integer(int, grplo, grplo) + ctf_integer(int, grphi, grphi) + ctf_integer(u8, gp_tasks, gp_tasks) + ) ) /* @@ -253,23 +192,12 @@ LTTNG_TRACEPOINT_EVENT(rcu_fqs, TP_ARGS(rcuname, gpnum, cpu, qsevent), - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(unsigned long, gpnum) - __field(int, cpu) - __string(qsevent, qsevent) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(gpnum, gpnum) - tp_assign(cpu, cpu) - tp_strcpy(qsevent, qsevent) - ), - - TP_printk("%s %lu %d %s", - __get_str(rcuname), __entry->gpnum, - __entry->cpu, __get_str(qsevent)) + TP_FIELDS( + ctf_integer(unsigned long, gpnum, gpnum) + ctf_integer(int, cpu, cpu) + ctf_string(rcuname, rcuname) + ctf_string(qsevent, qsevent) + ) ) #endif /* @@ -309,28 +237,13 @@ LTTNG_TRACEPOINT_EVENT(rcu_dyntick, TP_ARGS(polarity), #endif - TP_STRUCT__entry( - __string(polarity, polarity) + TP_FIELDS( + ctf_string(polarity, polarity) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - __field(long long, oldnesting) - __field(long long, newnesting) -#endif - ), - - TP_fast_assign( - tp_strcpy(polarity, polarity) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - tp_assign(oldnesting, oldnesting) - tp_assign(newnesting, newnesting) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - TP_printk("%s %llx %llx", __get_str(polarity), - __entry->oldnesting, __entry->newnesting) -#else - TP_printk("%s", __get_str(polarity)) + ctf_integer(long long, oldnesting, oldnesting) + ctf_integer(long long, newnesting, newnesting) #endif + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) @@ -366,15 +279,9 @@ LTTNG_TRACEPOINT_EVENT(rcu_prep_idle, TP_ARGS(reason), - TP_STRUCT__entry( - __string(reason, reason) - ), - - TP_fast_assign( - tp_strcpy(reason, reason) - ), - - TP_printk("%s", __get_str(reason)) + TP_FIELDS( + ctf_string(reason, reason) + ) ) #endif @@ -403,35 +310,15 @@ LTTNG_TRACEPOINT_EVENT(rcu_callback, TP_ARGS(rcuname, rhp, qlen), #endif - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(void *, rhp) - __field(void *, func) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) - __field(long, qlen_lazy) -#endif - __field(long, qlen) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(rhp, rhp) - tp_assign(func, rhp->func) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) - tp_assign(qlen_lazy, qlen_lazy) -#endif - tp_assign(qlen, qlen) - ), - + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_integer(void *, rhp, rhp) + ctf_integer(void *, func, rhp->func) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) - TP_printk("%s rhp=%p func=%pf %ld/%ld", - __get_str(rcuname), __entry->rhp, __entry->func, - __entry->qlen_lazy, __entry->qlen) -#else - TP_printk("%s rhp=%p func=%pf %ld", - __get_str(rcuname), __entry->rhp, __entry->func, - __entry->qlen) + ctf_integer(long, qlen_lazy, qlen_lazy) #endif + ctf_integer(long, qlen, qlen) + ) ) /* @@ -462,35 +349,15 @@ LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback, TP_ARGS(rcuname, rhp, offset, qlen), #endif - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(void *, rhp) - __field(unsigned long, offset) + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_integer(void *, rhp, rhp) + ctf_integer(unsigned long, offset, offset) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) - __field(long, qlen_lazy) -#endif - __field(long, qlen) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(rhp, rhp) - tp_assign(offset, offset) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) - tp_assign(qlen_lazy, qlen_lazy) -#endif - tp_assign(qlen, qlen) - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) - TP_printk("%s rhp=%p func=%ld %ld/%ld", - __get_str(rcuname), __entry->rhp, __entry->offset, - __entry->qlen_lazy, __entry->qlen) -#else - TP_printk("%s rhp=%p func=%ld %ld", - __get_str(rcuname), __entry->rhp, __entry->offset, - __entry->qlen) + ctf_integer(long, qlen_lazy, qlen_lazy) #endif + ctf_integer(long, qlen, qlen) + ) ) /* @@ -520,40 +387,18 @@ LTTNG_TRACEPOINT_EVENT(rcu_batch_start, TP_ARGS(rcuname, qlen, blimit), #endif - TP_STRUCT__entry( - __string(rcuname, rcuname) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) - __field(long, qlen_lazy) -#endif - __field(long, qlen) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) - __field(long, blimit) -#else - __field(int, blimit) -#endif - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) + TP_FIELDS( + ctf_string(rcuname, rcuname) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) - tp_assign(qlen_lazy, qlen_lazy) + ctf_integer(long, qlen_lazy, qlen_lazy) #endif - tp_assign(qlen, qlen) - tp_assign(blimit, blimit) - ), - + ctf_integer(long, qlen, qlen) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) - TP_printk("%s CBs=%ld/%ld bl=%ld", - __get_str(rcuname), __entry->qlen_lazy, __entry->qlen, - __entry->blimit) -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) - TP_printk("%s CBs=%ld/%ld bl=%d", - __get_str(rcuname), __entry->qlen_lazy, __entry->qlen, - __entry->blimit) + ctf_integer(long, blimit, blimit) #else - TP_printk("%s CBs=%ld bl=%d", - __get_str(rcuname), __entry->qlen, __entry->blimit) + ctf_integer(int, blimit, blimit) #endif + ) ) /* @@ -571,20 +416,11 @@ LTTNG_TRACEPOINT_EVENT(rcu_invoke_callback, TP_ARGS(rcuname, rhp), - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(void *, rhp) - __field(void *, func) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(rhp, rhp) - tp_assign(func, rhp->func) - ), - - TP_printk("%s rhp=%p func=%pf", - __get_str(rcuname), __entry->rhp, __entry->func) + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_integer(void *, rhp, rhp) + ctf_integer(void *, func, rhp->func) + ) ) /* @@ -604,20 +440,11 @@ LTTNG_TRACEPOINT_EVENT(rcu_invoke_kfree_callback, TP_ARGS(rcuname, rhp, offset), - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(void *, rhp) - __field(unsigned long, offset) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(rhp, rhp) - tp_assign(offset, offset) - ), - - TP_printk("%s rhp=%p func=%ld", - __get_str(rcuname), __entry->rhp, __entry->offset) + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_integer(void *, rhp, rhp) + ctf_integer(unsigned long, offset, offset) + ) ) /* @@ -654,44 +481,21 @@ LTTNG_TRACEPOINT_EVENT(rcu_batch_end, TP_ARGS(rcuname, callbacks_invoked), #endif - TP_STRUCT__entry( - __string(rcuname, rcuname) - __field(int, callbacks_invoked) + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_integer(int, callbacks_invoked, callbacks_invoked) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) - __field(char, cb) - __field(char, nr) - __field(char, iit) - __field(char, risk) + ctf_integer(char, cb, cb) + ctf_integer(char, nr, nr) + ctf_integer(char, iit, iit) + ctf_integer(char, risk, risk) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - __field(bool, cb) - __field(bool, nr) - __field(bool, iit) - __field(bool, risk) -#endif - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_assign(callbacks_invoked, callbacks_invoked) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - tp_assign(cb, cb) - tp_assign(nr, nr) - tp_assign(iit, iit) - tp_assign(risk, risk) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - TP_printk("%s CBs-invoked=%d idle=%c%c%c%c", - __get_str(rcuname), __entry->callbacks_invoked, - __entry->cb ? 'C' : '.', - __entry->nr ? 'S' : '.', - __entry->iit ? 'I' : '.', - __entry->risk ? 'R' : '.') -#else - TP_printk("%s CBs-invoked=%d", - __get_str(rcuname), __entry->callbacks_invoked) + ctf_integer(bool, cb, cb) + ctf_integer(bool, nr, nr) + ctf_integer(bool, iit, iit) + ctf_integer(bool, risk, risk) #endif + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) @@ -718,34 +522,15 @@ LTTNG_TRACEPOINT_EVENT(rcu_torture_read, TP_ARGS(rcutorturename, rhp), #endif - TP_STRUCT__entry( - __string(rcutorturename, rcutorturename) - __field(struct rcu_head *, rhp) + TP_FIELDS( + ctf_string(rcutorturename, rcutorturename) + ctf_integer(struct rcu_head *, rhp, rhp) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) - __field(unsigned long, secs) - __field(unsigned long, c_old) - __field(unsigned long, c) -#endif - ), - - TP_fast_assign( - tp_strcpy(rcutorturename, rcutorturename) - tp_assign(rhp, rhp) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) - tp_assign(secs, secs) - tp_assign(c_old, c_old) - tp_assign(c, c) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) - TP_printk("%s torture read %p %luus c: %lu %lu", - __entry->rcutorturename, __entry->rhp, - __entry->secs, __entry->c_old, __entry->c) -#else - TP_printk("%s torture read %p", - __get_str(rcutorturename), __entry->rhp) + ctf_integer(unsigned long, secs, secs) + ctf_integer(unsigned long, c_old, c_old) + ctf_integer(unsigned long, c, c) #endif + ) ) #endif @@ -777,25 +562,13 @@ LTTNG_TRACEPOINT_EVENT(rcu_barrier, TP_ARGS(rcuname, s, cpu, cnt, done), - TP_STRUCT__entry( - __string(rcuname, rcuname) - __string(s, s) - __field(int, cpu) - __field(int, cnt) - __field(unsigned long, done) - ), - - TP_fast_assign( - tp_strcpy(rcuname, rcuname) - tp_strcpy(s, s) - tp_assign(cpu, cpu) - tp_assign(cnt, cnt) - tp_assign(done, done) - ), - - TP_printk("%s %s cpu %d remaining %d # %lu", - __get_str(rcuname), __get_str(s), __entry->cpu, __entry->cnt, - __entry->done) + TP_FIELDS( + ctf_string(rcuname, rcuname) + ctf_string(s, s) + ctf_integer(int, cpu, cpu) + ctf_integer(int, cnt, cnt) + ctf_integer(unsigned long, done, done) + ) ) #endif diff --git a/instrumentation/events/lttng-module/regmap.h b/instrumentation/events/lttng-module/regmap.h index 69e42161..eef3c6cd 100644 --- a/instrumentation/events/lttng-module/regmap.h +++ b/instrumentation/events/lttng-module/regmap.h @@ -24,21 +24,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(regmap_reg, TP_ARGS(dev, reg, val), - TP_STRUCT__entry( - __string( name, dev_name(dev) ) - __field( unsigned int, reg ) - __field( unsigned int, val ) - ), - - TP_fast_assign( - tp_strcpy(name, dev_name(dev)) - tp_assign(reg, reg) - tp_assign(val, val) - ), - - TP_printk("%s reg=%x val=%x", __get_str(name), - (unsigned int)__entry->reg, - (unsigned int)__entry->val) + TP_FIELDS( + ctf_string(name, dev_name(dev)) + ctf_integer(unsigned int, reg, reg) + ctf_integer(unsigned int, val, val) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_reg, regmap_reg_write, @@ -76,21 +66,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(regmap_block, TP_ARGS(dev, reg, count), - TP_STRUCT__entry( - __string( name, dev_name(dev) ) - __field( unsigned int, reg ) - __field( int, count ) - ), - - TP_fast_assign( - tp_strcpy(name, dev_name(dev)) - tp_assign(reg, reg) - tp_assign(count, count) - ), - - TP_printk("%s reg=%x count=%d", __get_str(name), - (unsigned int)__entry->reg, - (int)__entry->count) + TP_FIELDS( + ctf_string(name, dev_name(dev)) + ctf_integer(unsigned int, reg, reg) + ctf_integer(int, count, count) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_block, regmap_hw_read_start, @@ -130,20 +110,11 @@ LTTNG_TRACEPOINT_EVENT_MAP(regcache_sync, TP_ARGS(dev, type, status), - TP_STRUCT__entry( - __string( name, dev_name(dev) ) - __string( status, status ) - __string( type, type ) - ), - - TP_fast_assign( - tp_strcpy(name, dev_name(dev)) - tp_strcpy(status, status) - tp_strcpy(type, type) - ), - - TP_printk("%s type=%s status=%s", __get_str(name), - __get_str(type), __get_str(status)) + TP_FIELDS( + ctf_string(name, dev_name(dev)) + ctf_string(status, status) + ctf_string(type, type) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) @@ -153,18 +124,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(regmap_bool, TP_ARGS(dev, flag), - TP_STRUCT__entry( - __string( name, dev_name(dev) ) - __field( int, flag ) - ), - - TP_fast_assign( - tp_strcpy(name, dev_name(dev)) - tp_assign(flag, flag) - ), - - TP_printk("%s flag=%d", __get_str(name), - (int)__entry->flag) + TP_FIELDS( + ctf_string(name, dev_name(dev)) + ctf_integer(int, flag, flag) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_bool, regmap_cache_only, diff --git a/instrumentation/events/lttng-module/regulator.h b/instrumentation/events/lttng-module/regulator.h index a84c24ce..b2edf5ae 100644 --- a/instrumentation/events/lttng-module/regulator.h +++ b/instrumentation/events/lttng-module/regulator.h @@ -17,16 +17,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(regulator_basic, TP_ARGS(name), - TP_STRUCT__entry( - __string( name, name ) - ), - - TP_fast_assign( - tp_strcpy(name, name) - ), - - TP_printk("name=%s", __get_str(name)) - + TP_FIELDS( + ctf_string(name, name) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(regulator_basic, regulator_enable, @@ -79,20 +72,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(regulator_range, TP_ARGS(name, min, max), - TP_STRUCT__entry( - __string( name, name ) - __field( int, min ) - __field( int, max ) - ), - - TP_fast_assign( - tp_strcpy(name, name) - tp_assign(min, min) - tp_assign(max, max) - ), - - TP_printk("name=%s (%d-%d)", __get_str(name), - (int)__entry->min, (int)__entry->max) + TP_FIELDS( + ctf_string(name, name) + ctf_integer(int, min, min) + ctf_integer(int, max, max) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(regulator_range, regulator_set_voltage, @@ -113,18 +97,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(regulator_value, TP_ARGS(name, val), - TP_STRUCT__entry( - __string( name, name ) - __field( unsigned int, val ) - ), - - TP_fast_assign( - tp_strcpy(name, name) - tp_assign(val, val) - ), - - TP_printk("name=%s, val=%u", __get_str(name), - (int)__entry->val) + TP_FIELDS( + ctf_string(name, name) + ctf_integer(unsigned int, val, val) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(regulator_value, regulator_set_voltage_complete, diff --git a/instrumentation/events/lttng-module/rpc.h b/instrumentation/events/lttng-module/rpc.h index bcaafbc1..a208b5af 100644 --- a/instrumentation/events/lttng-module/rpc.h +++ b/instrumentation/events/lttng-module/rpc.h @@ -14,19 +14,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status, TP_ARGS(task), - TP_STRUCT__entry( - __field(const struct rpc_task *, task) - __field(const struct rpc_clnt *, clnt) - __field(int, status) - ), - - TP_fast_assign( - tp_assign(task, task) - tp_assign(clnt, task->tk_client) - tp_assign(status, task->tk_status) - ), - - TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status) + TP_FIELDS( + ctf_integer(const struct rpc_task *, task, task) + ctf_integer(const struct rpc_clnt *, clnt, task->tk_client) + ctf_integer(int, status, task->tk_status) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status, @@ -46,19 +38,11 @@ LTTNG_TRACEPOINT_EVENT(rpc_connect_status, TP_ARGS(task, status), - TP_STRUCT__entry( - __field(const struct rpc_task *, task) - __field(const struct rpc_clnt *, clnt) - __field(int, status) - ), - - TP_fast_assign( - tp_assign(task, task) - tp_assign(clnt, task->tk_client) - tp_assign(status, status) - ), - - TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status) + TP_FIELDS( + ctf_integer(const struct rpc_task *, task, task) + ctf_integer(const struct rpc_clnt *, clnt, task->tk_client) + ctf_integer(int, status, status) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running, @@ -67,32 +51,14 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running, TP_ARGS(clnt, task, action), - TP_STRUCT__entry( - __field(const struct rpc_clnt *, clnt) - __field(const struct rpc_task *, task) - __field(const void *, action) - __field(unsigned long, runstate) - __field(int, status) - __field(unsigned short, flags) - ), - - TP_fast_assign( - tp_assign(clnt, clnt) - tp_assign(task, task) - tp_assign(action, action) - tp_assign(runstate, task->tk_runstate) - tp_assign(status, task->tk_status) - tp_assign(flags, task->tk_flags) - ), - - TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d action=%pf", - __entry->task, - __entry->clnt, - __entry->flags, - __entry->runstate, - __entry->status, - __entry->action - ) + TP_FIELDS( + ctf_integer(const struct rpc_clnt *, clnt, clnt) + ctf_integer(const struct rpc_task *, task, task) + ctf_integer(const void *, action, action) + ctf_integer(unsigned long, runstate, task->tk_runstate) + ctf_integer(int, status, task->tk_status) + ctf_integer(unsigned short, flags, task->tk_flags) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin, @@ -125,35 +91,15 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued, TP_ARGS(clnt, task, q), - TP_STRUCT__entry( - __field(const struct rpc_clnt *, clnt) - __field(const struct rpc_task *, task) - __field(unsigned long, timeout) - __field(unsigned long, runstate) - __field(int, status) - __field(unsigned short, flags) - __string(q_name, rpc_qname(q)) - ), - - TP_fast_assign( - tp_assign(clnt, clnt) - tp_assign(task, task) - tp_assign(timeout, task->tk_timeout) - tp_assign(runstate, task->tk_runstate) - tp_assign(status, task->tk_status) - tp_assign(flags, task->tk_flags) - tp_strcpy(q_name, rpc_qname(q)) - ), - - TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s", - __entry->task, - __entry->clnt, - __entry->flags, - __entry->runstate, - __entry->status, - __entry->timeout, - __get_str(q_name) - ) + TP_FIELDS( + ctf_integer(const struct rpc_clnt *, clnt, clnt) + ctf_integer(const struct rpc_task *, task, task) + ctf_integer(unsigned long, timeout, task->tk_timeout) + ctf_integer(unsigned long, runstate, task->tk_runstate) + ctf_integer(int, status, task->tk_status) + ctf_integer(unsigned short, flags, task->tk_flags) + ctf_string(q_name, rpc_qname(q)) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep, diff --git a/instrumentation/events/lttng-module/rpm.h b/instrumentation/events/lttng-module/rpm.h index 2baebc87..11558232 100644 --- a/instrumentation/events/lttng-module/rpm.h +++ b/instrumentation/events/lttng-module/rpm.h @@ -23,51 +23,32 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpm_internal, TP_ARGS(dev, flags), - TP_STRUCT__entry( - __string( name, dev_name(dev) ) - __field( int, flags ) - __field( int , usage_count ) - __field( int , disable_depth ) - __field( int , runtime_auto ) - __field( int , request_pending ) - __field( int , irq_safe ) - __field( int , child_count ) - ), - - TP_fast_assign( - tp_strcpy(name, dev_name(dev)) - tp_assign(flags, flags) - tp_assign(usage_count, atomic_read(&dev->power.usage_count)) - tp_assign(disable_depth, dev->power.disable_depth) - tp_assign(runtime_auto, dev->power.runtime_auto) - tp_assign(request_pending, dev->power.request_pending) - tp_assign(irq_safe, dev->power.irq_safe) - tp_assign(child_count, atomic_read(&dev->power.child_count)) - ), - - TP_printk("%s flags-%x cnt-%-2d dep-%-2d auto-%-1d p-%-1d" - " irq-%-1d child-%d", - __get_str(name), __entry->flags, - __entry->usage_count, - __entry->disable_depth, - __entry->runtime_auto, - __entry->request_pending, - __entry->irq_safe, - __entry->child_count - ) + TP_FIELDS( + ctf_string(name, dev_name(dev)) + ctf_integer(int, flags, flags) + ctf_integer(int, usage_count, atomic_read(&dev->power.usage_count)) + ctf_integer(int, disable_depth, dev->power.disable_depth) + ctf_integer(int, runtime_auto, dev->power.runtime_auto) + ctf_integer(int, request_pending, dev->power.request_pending) + ctf_integer(int, irq_safe, dev->power.irq_safe) + ctf_integer(int, child_count, atomic_read(&dev->power.child_count)) + ) ) + LTTNG_TRACEPOINT_EVENT_INSTANCE(rpm_internal, rpm_suspend, TP_PROTO(struct device *dev, int flags), TP_ARGS(dev, flags) ) + LTTNG_TRACEPOINT_EVENT_INSTANCE(rpm_internal, rpm_resume, TP_PROTO(struct device *dev, int flags), TP_ARGS(dev, flags) ) + LTTNG_TRACEPOINT_EVENT_INSTANCE(rpm_internal, rpm_idle, TP_PROTO(struct device *dev, int flags), @@ -79,20 +60,11 @@ LTTNG_TRACEPOINT_EVENT(rpm_return_int, TP_PROTO(struct device *dev, unsigned long ip, int ret), TP_ARGS(dev, ip, ret), - TP_STRUCT__entry( - __string( name, dev_name(dev)) - __field( unsigned long, ip ) - __field( int, ret ) - ), - - TP_fast_assign( - tp_strcpy(name, dev_name(dev)) - tp_assign(ip, ip) - tp_assign(ret, ret) - ), - - TP_printk("%pS:%s ret=%d", (void *)__entry->ip, __get_str(name), - __entry->ret) + TP_FIELDS( + ctf_string(name, dev_name(dev)) + ctf_integer(unsigned long, ip, ip) + ctf_integer(int, ret, ret) + ) ) #endif /* LTTNG_TRACE_RUNTIME_POWER_H */ diff --git a/instrumentation/events/lttng-module/sched.h b/instrumentation/events/lttng-module/sched.h index 1bea3261..ac61bcef 100644 --- a/instrumentation/events/lttng-module/sched.h +++ b/instrumentation/events/lttng-module/sched.h @@ -99,17 +99,10 @@ LTTNG_TRACEPOINT_EVENT(sched_kthread_stop, TP_ARGS(t), - TP_STRUCT__entry( - __array_text( char, comm, TASK_COMM_LEN ) - __field( pid_t, tid ) - ), - - TP_fast_assign( - tp_memcpy(comm, t->comm, TASK_COMM_LEN) - tp_assign(tid, t->pid) - ), - - TP_printk("comm=%s tid=%d", __entry->comm, __entry->tid) + TP_FIELDS( + ctf_array_text(char, comm, t->comm, TASK_COMM_LEN) + ctf_integer(pid_t, tid, t->pid) + ) ) /* @@ -121,15 +114,9 @@ LTTNG_TRACEPOINT_EVENT(sched_kthread_stop_ret, TP_ARGS(ret), - TP_STRUCT__entry( - __field( int, ret ) - ), - - TP_fast_assign( - tp_assign(ret, ret) - ), - - TP_printk("ret=%d", __entry->ret) + TP_FIELDS( + ctf_integer(int, ret, ret) + ) ) /* @@ -147,40 +134,15 @@ LTTNG_TRACEPOINT_EVENT_CLASS(sched_wakeup_template, TP_ARGS(rq, p, success), #endif - TP_STRUCT__entry( - __array_text( char, comm, TASK_COMM_LEN ) - __field( pid_t, tid ) - __field( int, prio ) - __field( int, success ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) - __field( int, target_cpu ) -#endif - ), - - TP_fast_assign( - tp_memcpy(comm, p->comm, TASK_COMM_LEN) - tp_assign(tid, p->pid) - tp_assign(prio, p->prio) - tp_assign(success, success) + TP_FIELDS( + ctf_array_text(char, comm, p->comm, TASK_COMM_LEN) + ctf_integer(pid_t, tid, p->pid) + ctf_integer(int, prio, p->prio) + ctf_integer(int, success, success) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) - tp_assign(target_cpu, task_cpu(p)) + ctf_integer(int, target_cpu, task_cpu(p)) #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) ) - TP_perf_assign( - __perf_task(p) -#endif - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) - TP_printk("comm=%s tid=%d prio=%d success=%d target_cpu=%03d", - __entry->comm, __entry->tid, __entry->prio, - __entry->success, __entry->target_cpu) -#else - TP_printk("comm=%s tid=%d prio=%d success=%d", - __entry->comm, __entry->tid, __entry->prio, - __entry->success) -#endif ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) @@ -228,50 +190,19 @@ LTTNG_TRACEPOINT_EVENT(sched_switch, TP_ARGS(rq, prev, next), #endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */ - TP_STRUCT__entry( - __array_text( char, prev_comm, TASK_COMM_LEN ) - __field( pid_t, prev_tid ) - __field( int, prev_prio ) - __field( long, prev_state ) - __array_text( char, next_comm, TASK_COMM_LEN ) - __field( pid_t, next_tid ) - __field( int, next_prio ) - ), - - TP_fast_assign( - tp_memcpy(next_comm, next->comm, TASK_COMM_LEN) - tp_assign(prev_tid, prev->pid) - tp_assign(prev_prio, prev->prio - MAX_RT_PRIO) + TP_FIELDS( + ctf_array_text(char, prev_comm, prev->comm, TASK_COMM_LEN) + ctf_integer(pid_t, prev_tid, prev->pid) + ctf_integer(int, prev_prio, prev->prio - MAX_RT_PRIO) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - tp_assign(prev_state, __trace_sched_switch_state(prev)) + ctf_integer(long, prev_state, __trace_sched_switch_state(prev)) #else - tp_assign(prev_state, prev->state) -#endif - tp_memcpy(prev_comm, prev->comm, TASK_COMM_LEN) - tp_assign(next_tid, next->pid) - tp_assign(next_prio, next->prio - MAX_RT_PRIO) - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - TP_printk("prev_comm=%s prev_tid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_tid=%d next_prio=%d", - __entry->prev_comm, __entry->prev_tid, __entry->prev_prio, - __entry->prev_state & (TASK_STATE_MAX-1) ? - __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|", - { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, - { 16, "Z" }, { 32, "X" }, { 64, "x" }, - { 128, "W" }) : "R", - __entry->prev_state & TASK_STATE_MAX ? "+" : "", - __entry->next_comm, __entry->next_tid, __entry->next_prio) -#else - TP_printk("prev_comm=%s prev_tid=%d prev_prio=%d prev_state=%s ==> next_comm=%s next_tid=%d next_prio=%d", - __entry->prev_comm, __entry->prev_tid, __entry->prev_prio, - __entry->prev_state ? - __print_flags(__entry->prev_state, "|", - { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, - { 16, "Z" }, { 32, "X" }, { 64, "x" }, - { 128, "W" }) : "R", - __entry->next_comm, __entry->next_tid, __entry->next_prio) + ctf_integer(long, prev_state, prev->state) #endif + ctf_array_text(char, next_comm, next->comm, TASK_COMM_LEN) + ctf_integer(pid_t, next_tid, next->pid) + ctf_integer(int, next_prio, next->prio - MAX_RT_PRIO) + ) ) /* @@ -283,25 +214,13 @@ LTTNG_TRACEPOINT_EVENT(sched_migrate_task, TP_ARGS(p, dest_cpu), - TP_STRUCT__entry( - __array_text( char, comm, TASK_COMM_LEN ) - __field( pid_t, tid ) - __field( int, prio ) - __field( int, orig_cpu ) - __field( int, dest_cpu ) - ), - - TP_fast_assign( - tp_memcpy(comm, p->comm, TASK_COMM_LEN) - tp_assign(tid, p->pid) - tp_assign(prio, p->prio - MAX_RT_PRIO) - tp_assign(orig_cpu, task_cpu(p)) - tp_assign(dest_cpu, dest_cpu) - ), - - TP_printk("comm=%s tid=%d prio=%d orig_cpu=%d dest_cpu=%d", - __entry->comm, __entry->tid, __entry->prio, - __entry->orig_cpu, __entry->dest_cpu) + TP_FIELDS( + ctf_array_text(char, comm, p->comm, TASK_COMM_LEN) + ctf_integer(pid_t, tid, p->pid) + ctf_integer(int, prio, p->prio - MAX_RT_PRIO) + ctf_integer(int, orig_cpu, task_cpu(p)) + ctf_integer(int, dest_cpu, dest_cpu) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(sched_process_template, @@ -310,20 +229,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(sched_process_template, TP_ARGS(p), - TP_STRUCT__entry( - __array_text( char, comm, TASK_COMM_LEN ) - __field( pid_t, tid ) - __field( int, prio ) - ), - - TP_fast_assign( - tp_memcpy(comm, p->comm, TASK_COMM_LEN) - tp_assign(tid, p->pid) - tp_assign(prio, p->prio - MAX_RT_PRIO) - ), - - TP_printk("comm=%s tid=%d prio=%d", - __entry->comm, __entry->tid, __entry->prio) + TP_FIELDS( + ctf_array_text(char, comm, p->comm, TASK_COMM_LEN) + ctf_integer(pid_t, tid, p->pid) + ctf_integer(int, prio, p->prio - MAX_RT_PRIO) + ) ) /* @@ -363,20 +273,11 @@ LTTNG_TRACEPOINT_EVENT(sched_process_wait, TP_ARGS(pid), - TP_STRUCT__entry( - __array_text( char, comm, TASK_COMM_LEN ) - __field( pid_t, tid ) - __field( int, prio ) - ), - - TP_fast_assign( - tp_memcpy(comm, current->comm, TASK_COMM_LEN) - tp_assign(tid, pid_nr(pid)) - tp_assign(prio, current->prio - MAX_RT_PRIO) - ), - - TP_printk("comm=%s tid=%d prio=%d", - __entry->comm, __entry->tid, __entry->prio) + TP_FIELDS( + ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) + ctf_integer(pid_t, tid, pid_nr(pid)) + ctf_integer(int, prio, current->prio - MAX_RT_PRIO) + ) ) /* @@ -393,27 +294,14 @@ LTTNG_TRACEPOINT_EVENT(sched_process_fork, TP_ARGS(parent, child), - TP_STRUCT__entry( - __array_text( char, parent_comm, TASK_COMM_LEN ) - __field( pid_t, parent_tid ) - __field( pid_t, parent_pid ) - __array_text( char, child_comm, TASK_COMM_LEN ) - __field( pid_t, child_tid ) - __field( pid_t, child_pid ) - ), - - TP_fast_assign( - tp_memcpy(parent_comm, parent->comm, TASK_COMM_LEN) - tp_assign(parent_tid, parent->pid) - tp_assign(parent_pid, parent->tgid) - tp_memcpy(child_comm, child->comm, TASK_COMM_LEN) - tp_assign(child_tid, child->pid) - tp_assign(child_pid, child->tgid) - ), - - TP_printk("comm=%s tid=%d child_comm=%s child_tid=%d", - __entry->parent_comm, __entry->parent_tid, - __entry->child_comm, __entry->child_tid) + TP_FIELDS( + ctf_array_text(char, parent_comm, parent->comm, TASK_COMM_LEN) + ctf_integer(pid_t, parent_tid, parent->pid) + ctf_integer(pid_t, parent_pid, parent->tgid) + ctf_array_text(char, child_comm, child->comm, TASK_COMM_LEN) + ctf_integer(pid_t, child_tid, child->pid) + ctf_integer(pid_t, child_pid, child->tgid) + ) ) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) @@ -426,20 +314,11 @@ LTTNG_TRACEPOINT_EVENT(sched_signal_send, TP_ARGS(sig, p), - TP_STRUCT__entry( - __field( int, sig ) - __array( char, comm, TASK_COMM_LEN ) - __field( pid_t, pid ) - ), - - TP_fast_assign( - tp_memcpy(comm, p->comm, TASK_COMM_LEN) - tp_assign(pid, p->pid) - tp_assign(sig, sig) - ), - - TP_printk("sig=%d comm=%s pid=%d", - __entry->sig, __entry->comm, __entry->pid) + TP_FIELDS( + ctf_integer(int, sig, sig) + ctf_array_text(char, comm, p->comm, TASK_COMM_LEN) + ctf_integer(pid_t, tid, p->pid) + ) ) #endif @@ -454,20 +333,11 @@ LTTNG_TRACEPOINT_EVENT(sched_process_exec, TP_ARGS(p, old_pid, bprm), - TP_STRUCT__entry( - __string( filename, bprm->filename ) - __field( pid_t, tid ) - __field( pid_t, old_tid ) - ), - - TP_fast_assign( - tp_strcpy(filename, bprm->filename) - tp_assign(tid, p->pid) - tp_assign(old_tid, old_pid) - ), - - TP_printk("filename=%s tid=%d old_tid=%d", __get_str(filename), - __entry->tid, __entry->old_tid) + TP_FIELDS( + ctf_string(filename, bprm->filename) + ctf_integer(pid_t, tid, p->pid) + ctf_integer(pid_t, old_tid, old_pid) + ) ) #endif @@ -482,24 +352,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(sched_stat_template, TP_ARGS(tsk, delay), - TP_STRUCT__entry( - __array_text( char, comm, TASK_COMM_LEN ) - __field( pid_t, tid ) - __field( u64, delay ) - ), - - TP_fast_assign( - tp_memcpy(comm, tsk->comm, TASK_COMM_LEN) - tp_assign(tid, tsk->pid) - tp_assign(delay, delay) + TP_FIELDS( + ctf_array_text(char, comm, tsk->comm, TASK_COMM_LEN) + ctf_integer(pid_t, tid, tsk->pid) + ctf_integer(u64, delay, delay) ) - TP_perf_assign( - __perf_count(delay) - ), - - TP_printk("comm=%s tid=%d delay=%Lu [ns]", - __entry->comm, __entry->tid, - (unsigned long long)__entry->delay) ) @@ -546,30 +403,12 @@ LTTNG_TRACEPOINT_EVENT(sched_stat_runtime, TP_ARGS(tsk, runtime, vruntime), - TP_STRUCT__entry( - __array_text( char, comm, TASK_COMM_LEN ) - __field( pid_t, tid ) - __field( u64, runtime ) - __field( u64, vruntime ) - ), - - TP_fast_assign( - tp_memcpy(comm, tsk->comm, TASK_COMM_LEN) - tp_assign(tid, tsk->pid) - tp_assign(runtime, runtime) - tp_assign(vruntime, vruntime) + TP_FIELDS( + ctf_array_text(char, comm, tsk->comm, TASK_COMM_LEN) + ctf_integer(pid_t, tid, tsk->pid) + ctf_integer(u64, runtime, runtime) + ctf_integer(u64, vruntime, vruntime) ) - TP_perf_assign( - __perf_count(runtime) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) - __perf_task(tsk) -#endif - ), - - TP_printk("comm=%s tid=%d runtime=%Lu [ns] vruntime=%Lu [ns]", - __entry->comm, __entry->tid, - (unsigned long long)__entry->runtime, - (unsigned long long)__entry->vruntime) ) #endif @@ -584,23 +423,12 @@ LTTNG_TRACEPOINT_EVENT(sched_pi_setprio, TP_ARGS(tsk, newprio), - TP_STRUCT__entry( - __array_text( char, comm, TASK_COMM_LEN ) - __field( pid_t, tid ) - __field( int, oldprio ) - __field( int, newprio ) - ), - - TP_fast_assign( - tp_memcpy(comm, tsk->comm, TASK_COMM_LEN) - tp_assign(tid, tsk->pid) - tp_assign(oldprio, tsk->prio - MAX_RT_PRIO) - tp_assign(newprio, newprio - MAX_RT_PRIO) - ), - - TP_printk("comm=%s tid=%d oldprio=%d newprio=%d", - __entry->comm, __entry->tid, - __entry->oldprio, __entry->newprio) + TP_FIELDS( + ctf_array_text(char, comm, tsk->comm, TASK_COMM_LEN) + ctf_integer(pid_t, tid, tsk->pid) + ctf_integer(int, oldprio, tsk->prio - MAX_RT_PRIO) + ctf_integer(int, newprio, newprio - MAX_RT_PRIO) + ) ) #endif diff --git a/instrumentation/events/lttng-module/scsi.h b/instrumentation/events/lttng-module/scsi.h index 05991e79..c23c4f2d 100644 --- a/instrumentation/events/lttng-module/scsi.h +++ b/instrumentation/events/lttng-module/scsi.h @@ -313,51 +313,20 @@ LTTNG_TRACEPOINT_EVENT(scsi_dispatch_cmd_start, TP_ARGS(cmd), - TP_STRUCT__entry( - __field( unsigned int, host_no ) - __field( unsigned int, channel ) - __field( unsigned int, id ) - __field( unsigned int, lun ) - __field( unsigned int, opcode ) - __field( unsigned int, cmd_len ) - __field( unsigned int, data_sglen ) - __field( unsigned int, prot_sglen ) + TP_FIELDS( + ctf_integer(unsigned int, host_no, cmd->device->host->host_no) + ctf_integer(unsigned int, channel, cmd->device->channel) + ctf_integer(unsigned int, id, cmd->device->id) + ctf_integer(unsigned int, lun, cmd->device->lun) + ctf_integer(unsigned int, opcode, cmd->cmnd[0]) + ctf_integer(unsigned int, cmd_len, cmd->cmd_len) + ctf_integer(unsigned int, data_sglen, scsi_sg_count(cmd)) + ctf_integer(unsigned int, prot_sglen, scsi_prot_sg_count(cmd)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - __field( unsigned char, prot_op ) + ctf_integer(unsigned char, prot_op, scsi_get_prot_op(cmd)) #endif - __dynamic_array_hex(unsigned char, cmnd, cmd->cmd_len) - ), - - TP_fast_assign( - tp_assign(host_no, cmd->device->host->host_no) - tp_assign(channel, cmd->device->channel) - tp_assign(id, cmd->device->id) - tp_assign(lun, cmd->device->lun) - tp_assign(opcode, cmd->cmnd[0]) - tp_assign(cmd_len, cmd->cmd_len) - tp_assign(data_sglen, scsi_sg_count(cmd)) - tp_assign(prot_sglen, scsi_prot_sg_count(cmd)) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - tp_assign(prot_op, scsi_get_prot_op(cmd)) -#endif - tp_memcpy_dyn(cmnd, cmd->cmnd) - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \ - " prot_op=%s cmnd=(%s %s raw=%s)", -#else - TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \ - " cmnd=(%s %s raw=%s)", -#endif - __entry->host_no, __entry->channel, __entry->id, - __entry->lun, __entry->data_sglen, __entry->prot_sglen, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - show_prot_op_name(__entry->prot_op), -#endif - show_opcode_name(__entry->opcode), - __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), - __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len)) + ctf_sequence_hex(unsigned char, cmnd, cmd->cmnd, u32, cmd->cmd_len) + ) ) LTTNG_TRACEPOINT_EVENT(scsi_dispatch_cmd_error, @@ -366,54 +335,21 @@ LTTNG_TRACEPOINT_EVENT(scsi_dispatch_cmd_error, TP_ARGS(cmd, rtn), - TP_STRUCT__entry( - __field( unsigned int, host_no ) - __field( unsigned int, channel ) - __field( unsigned int, id ) - __field( unsigned int, lun ) - __field( int, rtn ) - __field( unsigned int, opcode ) - __field( unsigned int, cmd_len ) - __field( unsigned int, data_sglen ) - __field( unsigned int, prot_sglen ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - __field( unsigned char, prot_op ) -#endif - __dynamic_array_hex(unsigned char, cmnd, cmd->cmd_len) - ), - - TP_fast_assign( - tp_assign(host_no, cmd->device->host->host_no) - tp_assign(channel, cmd->device->channel) - tp_assign(id, cmd->device->id) - tp_assign(lun, cmd->device->lun) - tp_assign(rtn, rtn) - tp_assign(opcode, cmd->cmnd[0]) - tp_assign(cmd_len, cmd->cmd_len) - tp_assign(data_sglen, scsi_sg_count(cmd)) - tp_assign(prot_sglen, scsi_prot_sg_count(cmd)) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - tp_assign(prot_op, scsi_get_prot_op(cmd)) -#endif - tp_memcpy_dyn(cmnd, cmd->cmnd) - ), - + TP_FIELDS( + ctf_integer(unsigned int, host_no, cmd->device->host->host_no) + ctf_integer(unsigned int, channel, cmd->device->channel) + ctf_integer(unsigned int, id, cmd->device->id) + ctf_integer(unsigned int, lun, cmd->device->lun) + ctf_integer(int, rtn, rtn) + ctf_integer(unsigned int, opcode, cmd->cmnd[0]) + ctf_integer(unsigned int, cmd_len, cmd->cmd_len) + ctf_integer(unsigned int, data_sglen, scsi_sg_count(cmd)) + ctf_integer(unsigned int, prot_sglen, scsi_prot_sg_count(cmd)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \ - " prot_op=%s cmnd=(%s %s raw=%s) rtn=%d", -#else - TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \ - " cmnd=(%s %s raw=%s) rtn=%d", + ctf_integer(unsigned char, prot_op, scsi_get_prot_op(cmd)) #endif - __entry->host_no, __entry->channel, __entry->id, - __entry->lun, __entry->data_sglen, __entry->prot_sglen, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - show_prot_op_name(__entry->prot_op), -#endif - show_opcode_name(__entry->opcode), - __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), - __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len), - __entry->rtn) + ctf_sequence_hex(unsigned char, cmnd, cmd->cmnd, u32, cmd->cmd_len) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(scsi_cmd_done_timeout_template, @@ -422,59 +358,21 @@ LTTNG_TRACEPOINT_EVENT_CLASS(scsi_cmd_done_timeout_template, TP_ARGS(cmd), - TP_STRUCT__entry( - __field( unsigned int, host_no ) - __field( unsigned int, channel ) - __field( unsigned int, id ) - __field( unsigned int, lun ) - __field( int, result ) - __field( unsigned int, opcode ) - __field( unsigned int, cmd_len ) - __field( unsigned int, data_sglen ) - __field( unsigned int, prot_sglen ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - __field( unsigned char, prot_op ) -#endif - __dynamic_array_hex(unsigned char, cmnd, cmd->cmd_len) - ), - - TP_fast_assign( - tp_assign(host_no, cmd->device->host->host_no) - tp_assign(channel, cmd->device->channel) - tp_assign(id, cmd->device->id) - tp_assign(lun, cmd->device->lun) - tp_assign(result, cmd->result) - tp_assign(opcode, cmd->cmnd[0]) - tp_assign(cmd_len, cmd->cmd_len) - tp_assign(data_sglen, scsi_sg_count(cmd)) - tp_assign(prot_sglen, scsi_prot_sg_count(cmd)) + TP_FIELDS( + ctf_integer(unsigned int, host_no, cmd->device->host->host_no) + ctf_integer(unsigned int, channel, cmd->device->channel) + ctf_integer(unsigned int, id, cmd->device->id) + ctf_integer(unsigned int, lun, cmd->device->lun) + ctf_integer(int, result, cmd->result) + ctf_integer(unsigned int, opcode, cmd->cmnd[0]) + ctf_integer(unsigned int, cmd_len, cmd->cmd_len) + ctf_integer(unsigned int, data_sglen, scsi_sg_count(cmd)) + ctf_integer(unsigned int, prot_sglen, scsi_prot_sg_count(cmd)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - tp_assign(prot_op, scsi_get_prot_op(cmd)) + ctf_integer(unsigned char, prot_op, scsi_get_prot_op(cmd)) #endif - tp_memcpy_dyn(cmnd, cmd->cmnd) - ), - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u " \ - "prot_sgl=%u prot_op=%s cmnd=(%s %s raw=%s) result=(driver=" \ - "%s host=%s message=%s status=%s)", -#else - TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u " \ - "prot_sgl=%u cmnd=(%s %s raw=%s) result=(driver=%s host=%s " \ - "message=%s status=%s)", -#endif - __entry->host_no, __entry->channel, __entry->id, - __entry->lun, __entry->data_sglen, __entry->prot_sglen, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - show_prot_op_name(__entry->prot_op), -#endif - show_opcode_name(__entry->opcode), - __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), - __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len), - show_driverbyte_name(((__entry->result) >> 24) & 0xff), - show_hostbyte_name(((__entry->result) >> 16) & 0xff), - show_msgbyte_name(((__entry->result) >> 8) & 0xff), - show_statusbyte_name(__entry->result & 0xff)) + ctf_sequence_hex(unsigned char, cmnd, cmd->cmnd, u32, cmd->cmd_len) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_done, @@ -491,15 +389,9 @@ LTTNG_TRACEPOINT_EVENT(scsi_eh_wakeup, TP_ARGS(shost), - TP_STRUCT__entry( - __field( unsigned int, host_no ) - ), - - TP_fast_assign( - tp_assign(host_no, shost->host_no) - ), - - TP_printk("host_no=%u", __entry->host_no) + TP_FIELDS( + ctf_integer(unsigned int, host_no, shost->host_no) + ) ) #endif /* LTTNG_TRACE_SCSI_H */ diff --git a/instrumentation/events/lttng-module/signal.h b/instrumentation/events/lttng-module/signal.h index d6aabd9a..2c12fab5 100644 --- a/instrumentation/events/lttng-module/signal.h +++ b/instrumentation/events/lttng-module/signal.h @@ -11,13 +11,13 @@ #define _TRACE_SIGNAL_DEF #include #include -#undef TP_STORE_SIGINFO -#define TP_STORE_SIGINFO(info) \ - tp_assign(errno, \ +#undef LTTNG_FIELDS_SIGINFO +#define LTTNG_FIELDS_SIGINFO(info) \ + ctf_integer(int, errno, \ (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED || info == SEND_SIG_PRIV) ? \ 0 : \ info->si_errno) \ - tp_assign(code, \ + ctf_integer(int, code, \ (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED) ? \ SI_USER : \ ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code)) @@ -42,24 +42,12 @@ LTTNG_TRACEPOINT_EVENT(signal_generate, TP_ARGS(sig, info, task), - TP_STRUCT__entry( - __field( int, sig ) - __field( int, errno ) - __field( int, code ) - __array_text( char, comm, TASK_COMM_LEN ) - __field( pid_t, pid ) - ), - - TP_fast_assign( - tp_assign(sig, sig) - TP_STORE_SIGINFO(info) - tp_memcpy(comm, task->comm, TASK_COMM_LEN) - tp_assign(pid, task->pid) - ), - - TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d", - __entry->sig, __entry->errno, __entry->code, - __entry->comm, __entry->pid) + TP_FIELDS( + ctf_integer(int, sig, sig) + LTTNG_FIELDS_SIGINFO(info) + ctf_array_text(char, comm, task->comm, TASK_COMM_LEN) + ctf_integer(pid_t, pid, task->pid) + ) ) #else LTTNG_TRACEPOINT_EVENT(signal_generate, @@ -69,29 +57,14 @@ LTTNG_TRACEPOINT_EVENT(signal_generate, TP_ARGS(sig, info, task, group, result), - TP_STRUCT__entry( - __field( int, sig ) - __field( int, errno ) - __field( int, code ) - __array_text( char, comm, TASK_COMM_LEN ) - __field( pid_t, pid ) - __field( int, group ) - __field( int, result ) - ), - - TP_fast_assign( - tp_assign(sig, sig) - TP_STORE_SIGINFO(info) - tp_memcpy(comm, task->comm, TASK_COMM_LEN) - tp_assign(pid, task->pid) - tp_assign(group, group) - tp_assign(result, result) - ), - - TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d grp=%d res=%d", - __entry->sig, __entry->errno, __entry->code, - __entry->comm, __entry->pid, __entry->group, - __entry->result) + TP_FIELDS( + ctf_integer(int, sig, sig) + LTTNG_FIELDS_SIGINFO(info) + ctf_array_text(char, comm, task->comm, TASK_COMM_LEN) + ctf_integer(pid_t, pid, task->pid) + ctf_integer(int, group, group) + ctf_integer(int, result, result) + ) ) #endif @@ -115,24 +88,12 @@ LTTNG_TRACEPOINT_EVENT(signal_deliver, TP_ARGS(sig, info, ka), - TP_STRUCT__entry( - __field( int, sig ) - __field( int, errno ) - __field( int, code ) - __field( unsigned long, sa_handler ) - __field( unsigned long, sa_flags ) - ), - - TP_fast_assign( - tp_assign(sig, sig) - TP_STORE_SIGINFO(info) - tp_assign(sa_handler, (unsigned long)ka->sa.sa_handler) - tp_assign(sa_flags, ka->sa.sa_flags) - ), - - TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx", - __entry->sig, __entry->errno, __entry->code, - __entry->sa_handler, __entry->sa_flags) + TP_FIELDS( + ctf_integer(int, sig, sig) + LTTNG_FIELDS_SIGINFO(info) + ctf_integer(unsigned long, sa_handler, (unsigned long) ka->sa.sa_handler) + ctf_integer(unsigned long, sa_flags, ka->sa.sa_flags) + ) ) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) @@ -142,21 +103,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(signal_queue_overflow, TP_ARGS(sig, group, info), - TP_STRUCT__entry( - __field( int, sig ) - __field( int, group ) - __field( int, errno ) - __field( int, code ) - ), - - TP_fast_assign( - tp_assign(sig, sig) - tp_assign(group, group) - TP_STORE_SIGINFO(info) - ), - - TP_printk("sig=%d group=%d errno=%d code=%d", - __entry->sig, __entry->group, __entry->errno, __entry->code) + TP_FIELDS( + ctf_integer(int, sig, sig) + ctf_integer(int, group, group) + LTTNG_FIELDS_SIGINFO(info) + ) ) /** diff --git a/instrumentation/events/lttng-module/skb.h b/instrumentation/events/lttng-module/skb.h index 106478bd..2079580a 100644 --- a/instrumentation/events/lttng-module/skb.h +++ b/instrumentation/events/lttng-module/skb.h @@ -20,20 +20,11 @@ LTTNG_TRACEPOINT_EVENT_MAP(kfree_skb, TP_ARGS(skb, location), - TP_STRUCT__entry( - __field( void *, skbaddr ) - __field( void *, location ) - __field( unsigned short, protocol ) - ), - - TP_fast_assign( - tp_assign(skbaddr, skb) - tp_assign(location, location) - tp_assign(protocol, ntohs(skb->protocol)) - ), - - TP_printk("skbaddr=%p protocol=%u location=%p", - __entry->skbaddr, __entry->protocol, __entry->location) + TP_FIELDS( + ctf_integer(void *, skbaddr, skb) + ctf_integer(void *, location, location) + ctf_integer_network(unsigned short, protocol, skb->protocol) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) @@ -45,15 +36,9 @@ LTTNG_TRACEPOINT_EVENT_MAP(consume_skb, TP_ARGS(skb), - TP_STRUCT__entry( - __field( void *, skbaddr ) - ), - - TP_fast_assign( - tp_assign(skbaddr, skb) - ), - - TP_printk("skbaddr=%p", __entry->skbaddr) + TP_FIELDS( + ctf_integer(void *, skbaddr, skb) + ) ) #endif @@ -64,17 +49,10 @@ LTTNG_TRACEPOINT_EVENT(skb_copy_datagram_iovec, TP_ARGS(skb, len), - TP_STRUCT__entry( - __field( const void *, skbaddr ) - __field( int, len ) - ), - - TP_fast_assign( - tp_assign(skbaddr, skb) - tp_assign(len, len) - ), - - TP_printk("skbaddr=%p len=%d", __entry->skbaddr, __entry->len) + TP_FIELDS( + ctf_integer(const void *, skbaddr, skb) + ctf_integer(int, len, len) + ) ) #endif diff --git a/instrumentation/events/lttng-module/sock.h b/instrumentation/events/lttng-module/sock.h index 3f48fa36..c9bf4bf7 100644 --- a/instrumentation/events/lttng-module/sock.h +++ b/instrumentation/events/lttng-module/sock.h @@ -13,20 +13,11 @@ LTTNG_TRACEPOINT_EVENT(sock_rcvqueue_full, TP_ARGS(sk, skb), - TP_STRUCT__entry( - __field(int, rmem_alloc) - __field(unsigned int, truesize) - __field(int, sk_rcvbuf) - ), - - TP_fast_assign( - tp_assign(rmem_alloc, atomic_read(&sk->sk_rmem_alloc)) - tp_assign(truesize, skb->truesize) - tp_assign(sk_rcvbuf, sk->sk_rcvbuf) - ), - - TP_printk("rmem_alloc=%d truesize=%u sk_rcvbuf=%d", - __entry->rmem_alloc, __entry->truesize, __entry->sk_rcvbuf) + TP_FIELDS( + ctf_integer(int, rmem_alloc, atomic_read(&sk->sk_rmem_alloc)) + ctf_integer(unsigned int, truesize, skb->truesize) + ctf_integer(int, sk_rcvbuf, sk->sk_rcvbuf) + ) ) LTTNG_TRACEPOINT_EVENT(sock_exceed_buf_limit, @@ -35,31 +26,13 @@ LTTNG_TRACEPOINT_EVENT(sock_exceed_buf_limit, TP_ARGS(sk, prot, allocated), - TP_STRUCT__entry( - __string(name, prot->name) - __array(long, sysctl_mem, 3) - __field(long, allocated) - __field(int, sysctl_rmem) - __field(int, rmem_alloc) - ), - - TP_fast_assign( - tp_strcpy(name, prot->name) - tp_memcpy(sysctl_mem, prot->sysctl_mem, 3 * sizeof(long)) - tp_assign(allocated, allocated) - tp_assign(sysctl_rmem, prot->sysctl_rmem[0]) - tp_assign(rmem_alloc, atomic_read(&sk->sk_rmem_alloc)) - ), - - TP_printk("proto:%s sysctl_mem=%ld,%ld,%ld allocated=%ld " - "sysctl_rmem=%d rmem_alloc=%d", - __entry->name, - __entry->sysctl_mem[0], - __entry->sysctl_mem[1], - __entry->sysctl_mem[2], - __entry->allocated, - __entry->sysctl_rmem, - __entry->rmem_alloc) + TP_FIELDS( + ctf_string(name, prot->name) + ctf_array(long, sysctl_mem, prot->sysctl_mem, 3) + ctf_integer(long, allocated, allocated) + ctf_integer(int, sysctl_rmem, prot->sysctl_rmem[0]) + ctf_integer(int, rmem_alloc, atomic_read(&sk->sk_rmem_alloc)) + ) ) #endif /* LTTNG_TRACE_SOCK_H */ diff --git a/instrumentation/events/lttng-module/timer.h b/instrumentation/events/lttng-module/timer.h index 5e409a0b..d0050737 100644 --- a/instrumentation/events/lttng-module/timer.h +++ b/instrumentation/events/lttng-module/timer.h @@ -21,15 +21,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(timer_class, TP_ARGS(timer), - TP_STRUCT__entry( - __field( void *, timer ) - ), - - TP_fast_assign( - tp_assign(timer, timer) - ), - - TP_printk("timer=%p", __entry->timer) + TP_FIELDS( + ctf_integer(void *, timer, timer) + ) ) /** @@ -54,23 +48,12 @@ LTTNG_TRACEPOINT_EVENT(timer_start, TP_ARGS(timer, expires), - TP_STRUCT__entry( - __field( void *, timer ) - __field( void *, function ) - __field( unsigned long, expires ) - __field( unsigned long, now ) - ), - - TP_fast_assign( - tp_assign(timer, timer) - tp_assign(function, timer->function) - tp_assign(expires, expires) - tp_assign(now, jiffies) - ), - - TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]", - __entry->timer, __entry->function, __entry->expires, - (long)__entry->expires - __entry->now) + TP_FIELDS( + ctf_integer(void *, timer, timer) + ctf_integer(void *, function, timer->function) + ctf_integer(unsigned long, expires, expires) + ctf_integer(unsigned long, now, jiffies) + ) ) /** @@ -85,19 +68,11 @@ LTTNG_TRACEPOINT_EVENT(timer_expire_entry, TP_ARGS(timer), - TP_STRUCT__entry( - __field( void *, timer ) - __field( unsigned long, now ) - __field( void *, function) - ), - - TP_fast_assign( - tp_assign(timer, timer) - tp_assign(now, jiffies) - tp_assign(function, timer->function) - ), - - TP_printk("timer=%p function=%pf now=%lu", __entry->timer, __entry->function,__entry->now) + TP_FIELDS( + ctf_integer(void *, timer, timer) + ctf_integer(unsigned long, now, jiffies) + ctf_integer(void *, function, timer->function) + ) ) /** @@ -143,23 +118,11 @@ LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_init, TP_ARGS(hrtimer, clockid, mode), - TP_STRUCT__entry( - __field( void *, hrtimer ) - __field( clockid_t, clockid ) - __field( enum hrtimer_mode, mode ) - ), - - TP_fast_assign( - tp_assign(hrtimer, hrtimer) - tp_assign(clockid, clockid) - tp_assign(mode, mode) - ), - - TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer, - __entry->clockid == CLOCK_REALTIME ? - "CLOCK_REALTIME" : "CLOCK_MONOTONIC", - __entry->mode == HRTIMER_MODE_ABS ? - "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL") + TP_FIELDS( + ctf_integer(void *, hrtimer, hrtimer) + ctf_integer(clockid_t, clockid, clockid) + ctf_integer(enum hrtimer_mode, mode, mode) + ) ) /** @@ -174,26 +137,12 @@ LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_start, TP_ARGS(hrtimer), - TP_STRUCT__entry( - __field( void *, hrtimer ) - __field( void *, function ) - __field( s64, expires ) - __field( s64, softexpires ) - ), - - TP_fast_assign( - tp_assign(hrtimer, hrtimer) - tp_assign(function, hrtimer->function) - tp_assign(expires, hrtimer_get_expires(hrtimer).tv64) - tp_assign(softexpires, hrtimer_get_softexpires(hrtimer).tv64) - ), - - TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu", - __entry->hrtimer, __entry->function, - (unsigned long long)ktime_to_ns((ktime_t) { - .tv64 = __entry->expires }), - (unsigned long long)ktime_to_ns((ktime_t) { - .tv64 = __entry->softexpires })) + TP_FIELDS( + ctf_integer(void *, hrtimer, hrtimer) + ctf_integer(void *, function, hrtimer->function) + ctf_integer(s64, expires, hrtimer_get_expires(hrtimer).tv64) + ctf_integer(s64, softexpires, hrtimer_get_softexpires(hrtimer).tv64) + ) ) /** @@ -212,20 +161,11 @@ LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_expire_entry, TP_ARGS(hrtimer, now), - TP_STRUCT__entry( - __field( void *, hrtimer ) - __field( s64, now ) - __field( void *, function) - ), - - TP_fast_assign( - tp_assign(hrtimer, hrtimer) - tp_assign(now, now->tv64) - tp_assign(function, hrtimer->function) - ), - - TP_printk("hrtimer=%p function=%pf now=%llu", __entry->hrtimer, __entry->function, - (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now })) + TP_FIELDS( + ctf_integer(void *, hrtimer, hrtimer) + ctf_integer(s64, now, now->tv64) + ctf_integer(void *, function, hrtimer->function) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(timer_hrtimer_class, @@ -234,15 +174,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(timer_hrtimer_class, TP_ARGS(hrtimer), - TP_STRUCT__entry( - __field( void *, hrtimer ) - ), - - TP_fast_assign( - tp_assign(hrtimer, hrtimer) - ), - - TP_printk("hrtimer=%p", __entry->hrtimer) + TP_FIELDS( + ctf_integer(void *, hrtimer, hrtimer) + ) ) /** @@ -290,28 +224,14 @@ LTTNG_TRACEPOINT_EVENT_MAP(itimer_state, TP_ARGS(which, value, expires), - TP_STRUCT__entry( - __field( int, which ) - __field( cputime_t, expires ) - __field( long, value_sec ) - __field( long, value_usec ) - __field( long, interval_sec ) - __field( long, interval_usec ) - ), - - TP_fast_assign( - tp_assign(which, which) - tp_assign(expires, expires) - tp_assign(value_sec, value->it_value.tv_sec) - tp_assign(value_usec, value->it_value.tv_usec) - tp_assign(interval_sec, value->it_interval.tv_sec) - tp_assign(interval_usec, value->it_interval.tv_usec) - ), - - TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld", - __entry->which, (unsigned long long)__entry->expires, - __entry->value_sec, __entry->value_usec, - __entry->interval_sec, __entry->interval_usec) + TP_FIELDS( + ctf_integer(int, which, which) + ctf_integer(cputime_t, expires, expires) + ctf_integer(long, value_sec, value->it_value.tv_sec) + ctf_integer(long, value_usec, value->it_value.tv_usec) + ctf_integer(long, interval_sec, value->it_interval.tv_sec) + ctf_integer(long, interval_usec, value->it_interval.tv_usec) + ) ) /** @@ -328,20 +248,11 @@ LTTNG_TRACEPOINT_EVENT_MAP(itimer_expire, TP_ARGS(which, pid, now), - TP_STRUCT__entry( - __field( int , which ) - __field( pid_t, pid ) - __field( cputime_t, now ) - ), - - TP_fast_assign( - tp_assign(which, which) - tp_assign(now, now) - tp_assign(pid, pid_nr(pid)) - ), - - TP_printk("which=%d pid=%d now=%llu", __entry->which, - (int) __entry->pid, (unsigned long long)__entry->now) + TP_FIELDS( + ctf_integer(int , which, which) + ctf_integer(pid_t, pid, pid_nr(pid)) + ctf_integer(cputime_t, now, now) + ) ) #endif /* LTTNG_TRACE_TIMER_H */ diff --git a/instrumentation/events/lttng-module/udp.h b/instrumentation/events/lttng-module/udp.h index bcb44d87..fddc3e47 100644 --- a/instrumentation/events/lttng-module/udp.h +++ b/instrumentation/events/lttng-module/udp.h @@ -13,17 +13,10 @@ LTTNG_TRACEPOINT_EVENT(udp_fail_queue_rcv_skb, TP_ARGS(rc, sk), - TP_STRUCT__entry( - __field(int, rc) - __field(__u16, lport) - ), - - TP_fast_assign( - tp_assign(rc, rc) - tp_assign(lport, inet_sk(sk)->inet_num) - ), - - TP_printk("rc=%d port=%hu", __entry->rc, __entry->lport) + TP_FIELDS( + ctf_integer(int, rc, rc) + ctf_integer(__u16, lport, inet_sk(sk)->inet_num) + ) ) #endif /* LTTNG_TRACE_UDP_H */ diff --git a/instrumentation/events/lttng-module/v4l2.h b/instrumentation/events/lttng-module/v4l2.h index 03ab58a7..696f226f 100644 --- a/instrumentation/events/lttng-module/v4l2.h +++ b/instrumentation/events/lttng-module/v4l2.h @@ -6,136 +6,47 @@ #include "../../../probes/lttng-tracepoint-event.h" -#define show_field(field) \ - __print_symbolic(field, \ - { V4L2_FIELD_ANY, "ANY" }, \ - { V4L2_FIELD_NONE, "NONE" }, \ - { V4L2_FIELD_TOP, "TOP" }, \ - { V4L2_FIELD_BOTTOM, "BOTTOM" }, \ - { V4L2_FIELD_INTERLACED, "INTERLACED" }, \ - { V4L2_FIELD_SEQ_TB, "SEQ_TB" }, \ - { V4L2_FIELD_SEQ_BT, "SEQ_BT" }, \ - { V4L2_FIELD_ALTERNATE, "ALTERNATE" }, \ - { V4L2_FIELD_INTERLACED_TB, "INTERLACED_TB" }, \ - { V4L2_FIELD_INTERLACED_BT, "INTERLACED_BT" }) +LTTNG_TRACEPOINT_EVENT_CLASS(v4l2_class, + + TP_PROTO(int minor, struct v4l2_buffer *buf), + + TP_ARGS(minor, buf), + + TP_FIELDS( + ctf_integer(int, minor, minor) + ctf_integer(u32, index, buf->index) + ctf_integer(u32, type, buf->type) + ctf_integer(u32, bytesused, buf->bytesused) + ctf_integer(u32, flags, buf->flags) + ctf_integer(u32, field, buf->field) + ctf_integer(s64, timestamp, timeval_to_ns(&buf->timestamp)) + ctf_integer(u32, timecode_type, buf->timecode.type) + ctf_integer(u32, timecode_flags, buf->timecode.flags) + ctf_integer(u8, timecode_frames, buf->timecode.frames) + ctf_integer(u8, timecode_seconds, buf->timecode.seconds) + ctf_integer(u8, timecode_minutes, buf->timecode.minutes) + ctf_integer(u8, timecode_hours, buf->timecode.hours) + ctf_array(u8, timecode_userbits, buf->timecode.userbits, 4) + ctf_integer(u32, sequence, buf->sequence) + ) +) -#define show_timecode_type(type) \ - __print_symbolic(type, \ - { V4L2_TC_TYPE_24FPS, "24FPS" }, \ - { V4L2_TC_TYPE_25FPS, "25FPS" }, \ - { V4L2_TC_TYPE_30FPS, "30FPS" }, \ - { V4L2_TC_TYPE_50FPS, "50FPS" }, \ - { V4L2_TC_TYPE_60FPS, "60FPS" }) +LTTNG_TRACEPOINT_EVENT_INSTANCE(v4l2_class, + v4l2_dqbuf, -#define show_flags(flags) \ - __print_flags(flags, "|", \ - { V4L2_BUF_FLAG_MAPPED, "MAPPED" }, \ - { V4L2_BUF_FLAG_QUEUED, "QUEUED" }, \ - { V4L2_BUF_FLAG_DONE, "DONE" }, \ - { V4L2_BUF_FLAG_KEYFRAME, "KEYFRAME" }, \ - { V4L2_BUF_FLAG_PFRAME, "PFRAME" }, \ - { V4L2_BUF_FLAG_BFRAME, "BFRAME" }, \ - { V4L2_BUF_FLAG_ERROR, "ERROR" }, \ - { V4L2_BUF_FLAG_TIMECODE, "TIMECODE" }, \ - { V4L2_BUF_FLAG_PREPARED, "PREPARED" }, \ - { V4L2_BUF_FLAG_NO_CACHE_INVALIDATE, "NO_CACHE_INVALIDATE" }, \ - { V4L2_BUF_FLAG_NO_CACHE_CLEAN, "NO_CACHE_CLEAN" }, \ - { V4L2_BUF_FLAG_TIMESTAMP_MASK, "TIMESTAMP_MASK" }, \ - { V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN, "TIMESTAMP_UNKNOWN" }, \ - { V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, "TIMESTAMP_MONOTONIC" }, \ - { V4L2_BUF_FLAG_TIMESTAMP_COPY, "TIMESTAMP_COPY" }) + TP_PROTO(int minor, struct v4l2_buffer *buf), -#define show_timecode_flags(flags) \ - __print_flags(flags, "|", \ - { V4L2_TC_FLAG_DROPFRAME, "DROPFRAME" }, \ - { V4L2_TC_FLAG_COLORFRAME, "COLORFRAME" }, \ - { V4L2_TC_USERBITS_USERDEFINED, "USERBITS_USERDEFINED" }, \ - { V4L2_TC_USERBITS_8BITCHARS, "USERBITS_8BITCHARS" }) + TP_ARGS(minor, buf) +) -#define LTTNG_TRACEPOINT_EVENT_V4L2(event_name) \ - LTTNG_TRACEPOINT_EVENT(event_name, \ - TP_PROTO(int minor, struct v4l2_buffer *buf), \ - \ - TP_ARGS(minor, buf), \ - \ - TP_STRUCT__entry( \ - __field(int, minor) \ - __field(u32, index) \ - __field(u32, type) \ - __field(u32, bytesused) \ - __field(u32, flags) \ - __field(u32, field) \ - __field(s64, timestamp) \ - __field(u32, timecode_type) \ - __field(u32, timecode_flags) \ - __field(u8, timecode_frames) \ - __field(u8, timecode_seconds) \ - __field(u8, timecode_minutes) \ - __field(u8, timecode_hours) \ - __field(u8, timecode_userbits0) \ - __field(u8, timecode_userbits1) \ - __field(u8, timecode_userbits2) \ - __field(u8, timecode_userbits3) \ - __field(u32, sequence) \ - ), \ - \ - TP_fast_assign( \ - tp_assign(minor, minor); \ - tp_assign(index, buf->index); \ - tp_assign(type, buf->type); \ - tp_assign(bytesused, buf->bytesused); \ - tp_assign(flags, buf->flags); \ - tp_assign(field, buf->field); \ - tp_assign(timestamp, \ - timeval_to_ns(&buf->timestamp)); \ - tp_assign(timecode_type, buf->timecode.type); \ - tp_assign(timecode_flags, buf->timecode.flags); \ - tp_assign(timecode_frames, \ - buf->timecode.frames); \ - tp_assign(timecode_seconds, \ - buf->timecode.seconds); \ - tp_assign(timecode_minutes, \ - buf->timecode.minutes); \ - tp_assign(timecode_hours, buf->timecode.hours); \ - tp_assign(timecode_userbits0, \ - buf->timecode.userbits[0]); \ - tp_assign(timecode_userbits1, \ - buf->timecode.userbits[1]); \ - tp_assign(timecode_userbits2, \ - buf->timecode.userbits[2]); \ - tp_assign(timecode_userbits3, \ - buf->timecode.userbits[3]); \ - tp_assign(sequence, buf->sequence); \ - ), \ - \ - TP_printk("minor = %d, index = %u, type = %s, " \ - "bytesused = %u, flags = %s, " \ - "field = %s, timestamp = %llu, timecode = { " \ - "type = %s, flags = %s, frames = %u, " \ - "seconds = %u, minutes = %u, hours = %u, " \ - "userbits = { %u %u %u %u } }, " \ - "sequence = %u", __entry->minor, \ - __entry->index, show_type(__entry->type), \ - __entry->bytesused, \ - show_flags(__entry->flags), \ - show_field(__entry->field), \ - __entry->timestamp, \ - show_timecode_type(__entry->timecode_type), \ - show_timecode_flags(__entry->timecode_flags), \ - __entry->timecode_frames, \ - __entry->timecode_seconds, \ - __entry->timecode_minutes, \ - __entry->timecode_hours, \ - __entry->timecode_userbits0, \ - __entry->timecode_userbits1, \ - __entry->timecode_userbits2, \ - __entry->timecode_userbits3, \ - __entry->sequence \ - ) \ - ) +LTTNG_TRACEPOINT_EVENT_INSTANCE(v4l2_class, + + v4l2_qbuf, + + TP_PROTO(int minor, struct v4l2_buffer *buf), -LTTNG_TRACEPOINT_EVENT_V4L2(v4l2_dqbuf) -LTTNG_TRACEPOINT_EVENT_V4L2(v4l2_qbuf) + TP_ARGS(minor, buf) +) #endif /* if !defined(LTTNG_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ) */ diff --git a/instrumentation/events/lttng-module/workqueue.h b/instrumentation/events/lttng-module/workqueue.h index 8393a331..3cdc7f9b 100644 --- a/instrumentation/events/lttng-module/workqueue.h +++ b/instrumentation/events/lttng-module/workqueue.h @@ -24,15 +24,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work, TP_ARGS(work), - TP_STRUCT__entry( - __field( void *, work ) - ), - - TP_fast_assign( - tp_assign(work, work) - ), - - TP_printk("work struct %p", __entry->work) + TP_FIELDS( + ctf_integer(void *, work, work) + ) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) @@ -60,21 +54,11 @@ LTTNG_TRACEPOINT_EVENT(workqueue_queue_work, TP_ARGS(req_cpu, cwq, work), #endif - TP_STRUCT__entry( - __field( void *, work ) - __field( void *, function) - __field( unsigned int, req_cpu ) - ), - - TP_fast_assign( - tp_assign(work, work) - tp_assign(function, work->func) - tp_assign(req_cpu, req_cpu) - ), - - TP_printk("work struct=%p function=%pf req_cpu=%u", - __entry->work, __entry->function, - __entry->req_cpu) + TP_FIELDS( + ctf_integer(void *, work, work) + ctf_integer(void *, function, work->func) + ctf_integer(unsigned int, req_cpu, req_cpu) + ) ) /** @@ -105,17 +89,10 @@ LTTNG_TRACEPOINT_EVENT(workqueue_execute_start, TP_ARGS(work), - TP_STRUCT__entry( - __field( void *, work ) - __field( void *, function) - ), - - TP_fast_assign( - tp_assign(work, work) - tp_assign(function, work->func) - ), - - TP_printk("work struct %p: function %pf", __entry->work, __entry->function) + TP_FIELDS( + ctf_integer(void *, work, work) + ctf_integer(void *, function, work->func) + ) ) /** @@ -139,20 +116,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(workqueue, TP_ARGS(wq_thread, work), - TP_STRUCT__entry( - __array(char, thread_comm, TASK_COMM_LEN) - __field(pid_t, thread_pid) - __field(work_func_t, func) - ), - - TP_fast_assign( - tp_memcpy(thread_comm, wq_thread->comm, TASK_COMM_LEN) - tp_assign(thread_pid, wq_thread->pid) - tp_assign(func, work->func) - ), - - TP_printk("thread=%s:%d func=%pf", __entry->thread_comm, - __entry->thread_pid, __entry->func) + TP_FIELDS( + ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN) + ctf_integer(pid_t, thread_pid, wq_thread->pid) + ctf_integer(work_func_t, func, work->func) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue, workqueue_insertion, @@ -176,20 +144,11 @@ LTTNG_TRACEPOINT_EVENT(workqueue_creation, TP_ARGS(wq_thread, cpu), - TP_STRUCT__entry( - __array(char, thread_comm, TASK_COMM_LEN) - __field(pid_t, thread_pid) - __field(int, cpu) - ), - - TP_fast_assign( - tp_memcpy(thread_comm, wq_thread->comm, TASK_COMM_LEN) - tp_assign(thread_pid, wq_thread->pid) - tp_assign(cpu, cpu) - ), - - TP_printk("thread=%s:%d cpu=%d", __entry->thread_comm, - __entry->thread_pid, __entry->cpu) + TP_FIELDS( + ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN) + ctf_integer(pid_t, thread_pid, wq_thread->pid) + ctf_integer(int, cpu, cpu) + ) ) LTTNG_TRACEPOINT_EVENT(workqueue_destruction, @@ -198,17 +157,10 @@ LTTNG_TRACEPOINT_EVENT(workqueue_destruction, TP_ARGS(wq_thread), - TP_STRUCT__entry( - __array(char, thread_comm, TASK_COMM_LEN) - __field(pid_t, thread_pid) - ), - - TP_fast_assign( - tp_memcpy(thread_comm, wq_thread->comm, TASK_COMM_LEN) - tp_assign(thread_pid, wq_thread->pid) - ), - - TP_printk("thread=%s:%d", __entry->thread_comm, __entry->thread_pid) + TP_FIELDS( + ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN) + ctf_integer(pid_t, thread_pid, wq_thread->pid) + ) ) #endif diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h index 79f84b76..b2148d86 100644 --- a/instrumentation/events/lttng-module/writeback.h +++ b/instrumentation/events/lttng-module/writeback.h @@ -74,46 +74,25 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) LTTNG_TRACEPOINT_EVENT(writeback_dirty_page, TP_PROTO(struct page *page, struct address_space *mapping), TP_ARGS(page, mapping), - TP_STRUCT__entry ( - __array_text(char, name, 32) - __field(unsigned long, ino) - __field(pgoff_t, index) - ), - TP_fast_assign( - tp_memcpy(name, + TP_FIELDS( + ctf_array_text(char, name, mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32) - tp_assign(ino, mapping ? mapping->host->i_ino : 0) - tp_assign(index, page->index) - ), - TP_printk("bdi %s: ino=%lu index=%lu", - __entry->name, - __entry->ino, - __entry->index + ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0) + ctf_integer(pgoff_t, index, page->index) ) ) LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template, TP_PROTO(struct inode *inode, int flags), TP_ARGS(inode, flags), - TP_STRUCT__entry ( - __array_text(char, name, 32) - __field(unsigned long, ino) - __field(unsigned long, state) - __field(unsigned long, flags) - ), - TP_fast_assign( + TP_FIELDS( /* may be called for files on pseudo FSes w/ unregistered bdi */ - tp_memcpy(name, + ctf_array_text(char, name, inode_to_bdi(inode)->dev ? dev_name(inode_to_bdi(inode)->dev) : "(unknown)", 32) - tp_assign(ino, inode->i_ino) - tp_assign(state, inode->i_state) - tp_assign(flags, flags) - ), - TP_printk("bdi %s: ino=%lu flags=%s", - __entry->name, - __entry->ino, - show_inode_state(__entry->flags) + ctf_integer(unsigned long, ino, inode->i_ino) + ctf_integer(unsigned long, state, inode->i_state) + ctf_integer(unsigned long, flags, flags) ) ) #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \ @@ -127,21 +106,11 @@ LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_mark_inode_dirty LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template, TP_PROTO(struct inode *inode, struct writeback_control *wbc), TP_ARGS(inode, wbc), - TP_STRUCT__entry ( - __array_text(char, name, 32) - __field(unsigned long, ino) - __field(int, sync_mode) - ), - TP_fast_assign( - tp_memcpy(name, + TP_FIELDS( + ctf_array_text(char, name, dev_name(inode_to_bdi(inode)->dev), 32) - tp_assign(ino, inode->i_ino) - tp_assign(sync_mode, wbc->sync_mode) - ), - TP_printk("bdi %s: ino=%lu sync_mode=%d", - __entry->name, - __entry->ino, - __entry->sync_mode + ctf_integer(unsigned long, ino, inode->i_ino) + ctf_integer(int, sync_mode, wbc->sync_mode) ) ) @@ -157,44 +126,25 @@ LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode) LTTNG_TRACEPOINT_EVENT(writeback_dirty_page, TP_PROTO(struct page *page, struct address_space *mapping), TP_ARGS(page, mapping), - TP_STRUCT__entry ( - __array_text(char, name, 32) - __field(unsigned long, ino) - __field(pgoff_t, index) - ), - TP_fast_assign( - tp_memcpy(name, + TP_FIELDS( + ctf_array_text(char, name, mapping ? dev_name(mapping->backing_dev_info->dev) : "(unknown)", 32) - tp_assign(ino, mapping ? mapping->host->i_ino : 0) - tp_assign(index, page->index) - ), - TP_printk("bdi %s: ino=%lu index=%lu", - __entry->name, - __entry->ino, - __entry->index + ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0) + ctf_integer(pgoff_t, index, page->index) ) ) LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template, TP_PROTO(struct inode *inode, int flags), TP_ARGS(inode, flags), - TP_STRUCT__entry ( - __array_text(char, name, 32) - __field(unsigned long, ino) - __field(unsigned long, flags) - ), - TP_fast_assign( + TP_FIELDS( /* may be called for files on pseudo FSes w/ unregistered bdi */ - tp_memcpy(name, + ctf_array_text(char, name, inode->i_mapping->backing_dev_info->dev ? - dev_name(inode->i_mapping->backing_dev_info->dev) : "(unknown)", 32) - tp_assign(ino, inode->i_ino) - tp_assign(flags, flags) - ), - TP_printk("bdi %s: ino=%lu flags=%s", - __entry->name, - __entry->ino, - show_inode_state(__entry->flags) + dev_name(inode->i_mapping->backing_dev_info->dev) + : "(unknown)", 32) + ctf_integer(unsigned long, ino, inode->i_ino) + ctf_integer(unsigned long, flags, flags) ) ) #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \ @@ -207,21 +157,11 @@ LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode) LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template, TP_PROTO(struct inode *inode, struct writeback_control *wbc), TP_ARGS(inode, wbc), - TP_STRUCT__entry ( - __array_text(char, name, 32) - __field(unsigned long, ino) - __field(int, sync_mode) - ), - TP_fast_assign( - tp_memcpy(name, + TP_FIELDS( + ctf_array_text(char, name, dev_name(inode->i_mapping->backing_dev_info->dev), 32) - tp_assign(ino, inode->i_ino) - tp_assign(sync_mode, wbc->sync_mode) - ), - TP_printk("bdi %s: ino=%lu sync_mode=%d", - __entry->name, - __entry->ino, - __entry->sync_mode + ctf_integer(unsigned long, ino, inode->i_ino) + ctf_integer(int, sync_mode, wbc->sync_mode) ) ) @@ -239,15 +179,9 @@ LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode) LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class, TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), TP_ARGS(bdi, work), - TP_STRUCT__entry( - __array_text(char, name, 32) - ), - TP_fast_assign( - tp_memcpy(name, bdi->dev ? dev_name(bdi->dev) : + TP_FIELDS( + ctf_array_text(char, name, bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32) - ), - TP_printk("bdi %s", - __entry->name ) ) @@ -256,15 +190,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class, LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class, TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), TP_ARGS(bdi, work), - TP_STRUCT__entry( - __array_text(char, name, 32) - ), - TP_fast_assign( - tp_memcpy(name, dev_name(bdi->dev ? bdi->dev : + TP_FIELDS( + ctf_array_text(char, name, + dev_name(bdi->dev ? bdi->dev : default_backing_dev_info.dev), 32) - ), - TP_printk("bdi %s", - __entry->name ) ) @@ -286,26 +215,17 @@ LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_wait) LTTNG_TRACEPOINT_EVENT(writeback_pages_written, TP_PROTO(long pages_written), TP_ARGS(pages_written), - TP_STRUCT__entry( - __field(long, pages) - ), - TP_fast_assign( - tp_assign(pages, pages_written) - ), - TP_printk("%ld", __entry->pages) + TP_FIELDS( + ctf_integer(long, pages, pages_written) + ) ) LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class, TP_PROTO(struct backing_dev_info *bdi), TP_ARGS(bdi), - TP_STRUCT__entry( - __array_text(char, name, 32) - ), - TP_fast_assign( - tp_memcpy(name, dev_name(bdi->dev), 32) - ), - TP_printk("bdi %s", - __entry->name + TP_FIELDS( + ctf_array_text(char, name, + dev_name(bdi->dev), 32) ) ) #undef DEFINE_WRITEBACK_EVENT @@ -341,19 +261,9 @@ LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written, TP_ARGS(bdi, written), - TP_STRUCT__entry( - __array(char, name, 32) - __field(int, written) - ), - - TP_fast_assign( - tp_memcpy(name, dev_name(bdi->dev), 32) - tp_assign(written, written) - ), - - TP_printk("bdi %s written %d", - __entry->name, - __entry->written + TP_FIELDS( + ctf_array_text(char, name, dev_name(bdi->dev), 32) + ctf_integer(int, written, written) ) ) #endif @@ -361,62 +271,23 @@ LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written, LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class, TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), TP_ARGS(wbc, bdi), - TP_STRUCT__entry( - __array_text(char, name, 32) - __field(long, nr_to_write) - __field(long, pages_skipped) - __field(int, sync_mode) - __field(int, for_kupdate) - __field(int, for_background) - __field(int, for_reclaim) - __field(int, range_cyclic) + TP_FIELDS( + ctf_array_text(char, name, dev_name(bdi->dev), 32) + ctf_integer(long, nr_to_write, wbc->nr_to_write) + ctf_integer(long, pages_skipped, wbc->pages_skipped) + ctf_integer(int, sync_mode, wbc->sync_mode) + ctf_integer(int, for_kupdate, wbc->for_kupdate) + ctf_integer(int, for_background, wbc->for_background) + ctf_integer(int, for_reclaim, wbc->for_reclaim) + ctf_integer(int, range_cyclic, wbc->range_cyclic) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - __field(int, more_io) - __field(unsigned long, older_than_this) + ctf_integer(int, more_io, wbc->more_io) + ctf_integer(unsigned long, older_than_this, + wbc->older_than_this ? *wbc->older_than_this : 0) #endif - __field(long, range_start) - __field(long, range_end) - ), - - TP_fast_assign( - tp_memcpy(name, dev_name(bdi->dev), 32) - tp_assign(nr_to_write, wbc->nr_to_write) - tp_assign(pages_skipped, wbc->pages_skipped) - tp_assign(sync_mode, wbc->sync_mode) - tp_assign(for_kupdate, wbc->for_kupdate) - tp_assign(for_background, wbc->for_background) - tp_assign(for_reclaim, wbc->for_reclaim) - tp_assign(range_cyclic, wbc->range_cyclic) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - tp_assign(more_io, wbc->more_io) - tp_assign(older_than_this, wbc->older_than_this ? - *wbc->older_than_this : 0) -#endif - tp_assign(range_start, (long)wbc->range_start) - tp_assign(range_end, (long)wbc->range_end) - ), - - TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - "bgrd=%d reclm=%d cyclic=%d more=%d older=0x%lx " -#else - "bgrd=%d reclm=%d cyclic=%d " -#endif - "start=0x%lx end=0x%lx", - __entry->name, - __entry->nr_to_write, - __entry->pages_skipped, - __entry->sync_mode, - __entry->for_kupdate, - __entry->for_background, - __entry->for_reclaim, - __entry->range_cyclic, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - __entry->more_io, - __entry->older_than_this, -#endif - __entry->range_start, - __entry->range_end) + ctf_integer(long, range_start, (long) wbc->range_start) + ctf_integer(long, range_end, (long) wbc->range_end) + ) ) #undef DEFINE_WBC_EVENT @@ -448,38 +319,19 @@ LTTNG_TRACEPOINT_EVENT(writeback_queue_io, #else TP_ARGS(wb, older_than_this, moved), #endif - TP_STRUCT__entry( - __array(char, name, 32) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) -#else - __field(unsigned long, older) - __field(long, age) -#endif - __field(int, moved) - ), - TP_fast_assign( - tp_memcpy(name, dev_name(wb->bdi->dev), 32) + TP_FIELDS( + ctf_array_text(char, name, dev_name(wb->bdi->dev), 32) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) #else - tp_assign(older, older_than_this ? *older_than_this : 0) - tp_assign(age, older_than_this ? - (jiffies - *older_than_this) * 1000 / HZ : -1) + ctf_integer(unsigned long, older, + older_than_this ? *older_than_this : 0) + ctf_integer(long, age, + older_than_this ? + (jiffies - *older_than_this) * 1000 / HZ + : -1) #endif - tp_assign(moved, moved) - ), -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - TP_printk("bdi %s: enqueue=%d", - __entry->name, - __entry->moved, - ) -#else - TP_printk("bdi %s: older=%lu age=%ld enqueue=%d", - __entry->name, - __entry->older, /* older_than_this in jiffies */ - __entry->age, /* older_than_this in relative milliseconds */ - __entry->moved + ctf_integer(int, moved, moved) ) -#endif ) LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, @@ -494,39 +346,15 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, dirty_thresh ), - TP_STRUCT__entry( - __field(unsigned long, nr_dirty) - __field(unsigned long, nr_writeback) - __field(unsigned long, nr_unstable) - __field(unsigned long, background_thresh) - __field(unsigned long, dirty_thresh) - __field(unsigned long, dirty_limit) - __field(unsigned long, nr_dirtied) - __field(unsigned long, nr_written) - ), - - TP_fast_assign( - tp_assign(nr_dirty, global_page_state(NR_FILE_DIRTY)) - tp_assign(nr_writeback, global_page_state(NR_WRITEBACK)) - tp_assign(nr_unstable, global_page_state(NR_UNSTABLE_NFS)) - tp_assign(nr_dirtied, global_page_state(NR_DIRTIED)) - tp_assign(nr_written, global_page_state(NR_WRITTEN)) - tp_assign(background_thresh, background_thresh) - tp_assign(dirty_thresh, dirty_thresh) - tp_assign(dirty_limit, global_dirty_limit) - ), - - TP_printk("dirty=%lu writeback=%lu unstable=%lu " - "bg_thresh=%lu thresh=%lu limit=%lu " - "dirtied=%lu written=%lu", - __entry->nr_dirty, - __entry->nr_writeback, - __entry->nr_unstable, - __entry->background_thresh, - __entry->dirty_thresh, - __entry->dirty_limit, - __entry->nr_dirtied, - __entry->nr_written + TP_FIELDS( + ctf_integer(unsigned long, nr_dirty, global_page_state(NR_FILE_DIRTY)) + ctf_integer(unsigned long, nr_writeback, global_page_state(NR_WRITEBACK)) + ctf_integer(unsigned long, nr_unstable, global_page_state(NR_UNSTABLE_NFS)) + ctf_integer(unsigned long, nr_dirtied, global_page_state(NR_DIRTIED)) + ctf_integer(unsigned long, nr_written, global_page_state(NR_WRITTEN)) + ctf_integer(unsigned long, background_thresh, background_thresh) + ctf_integer(unsigned long, dirty_thresh, dirty_thresh) + ctf_integer(unsigned long, dirty_limit, global_dirty_limit) ) ) #endif @@ -545,38 +373,15 @@ LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit, TP_ARGS(bdi, dirty_rate, task_ratelimit), - TP_STRUCT__entry( - __array(char, bdi, 32) - __field(unsigned long, write_bw) - __field(unsigned long, avg_write_bw) - __field(unsigned long, dirty_rate) - __field(unsigned long, dirty_ratelimit) - __field(unsigned long, task_ratelimit) - __field(unsigned long, balanced_dirty_ratelimit) - ), - - TP_fast_assign( - tp_memcpy(bdi, dev_name(bdi->dev), 32) - tp_assign(write_bw, KBps(bdi->write_bandwidth)) - tp_assign(avg_write_bw, KBps(bdi->avg_write_bandwidth)) - tp_assign(dirty_rate, KBps(dirty_rate)) - tp_assign(dirty_ratelimit, KBps(bdi->dirty_ratelimit)) - tp_assign(task_ratelimit, KBps(task_ratelimit)) - tp_assign(balanced_dirty_ratelimit, + TP_FIELDS( + ctf_array_text(char, bdi, dev_name(bdi->dev), 32) + ctf_integer(unsigned long, write_bw, KBps(bdi->write_bandwidth)) + ctf_integer(unsigned long, avg_write_bw, KBps(bdi->avg_write_bandwidth)) + ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate)) + ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->dirty_ratelimit)) + ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit)) + ctf_integer(unsigned long, balanced_dirty_ratelimit, KBps(bdi->balanced_dirty_ratelimit)) - ), - - TP_printk("bdi %s: " - "write_bw=%lu awrite_bw=%lu dirty_rate=%lu " - "dirty_ratelimit=%lu task_ratelimit=%lu " - "balanced_dirty_ratelimit=%lu", - __entry->bdi, - __entry->write_bw, /* write bandwidth */ - __entry->avg_write_bw, /* avg write bandwidth */ - __entry->dirty_rate, /* bdi dirty rate */ - __entry->dirty_ratelimit, /* base ratelimit */ - __entry->task_ratelimit, /* ratelimit with position control */ - __entry->balanced_dirty_ratelimit /* the balanced ratelimit */ ) ) @@ -602,96 +407,40 @@ LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages, TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, dirty_ratelimit, task_ratelimit, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - dirtied, period, pause, start_time), + dirtied, period, pause, start_time #else - dirtied, pause, start_time), -#endif - TP_STRUCT__entry( - __array( char, bdi, 32) - __field(unsigned long, limit) - __field(unsigned long, setpoint) - __field(unsigned long, dirty) - __field(unsigned long, bdi_setpoint) - __field(unsigned long, bdi_dirty) - __field(unsigned long, dirty_ratelimit) - __field(unsigned long, task_ratelimit) - __field(unsigned int, dirtied) - __field(unsigned int, dirtied_pause) - __field(unsigned long, paused) - __field( long, pause) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - __field(unsigned long, period) - __field( long, think) + dirtied, pause, start_time #endif ), - TP_fast_assign( - tp_memcpy(bdi, dev_name(bdi->dev), 32) - tp_assign(limit, global_dirty_limit) - tp_assign(setpoint, + TP_FIELDS( + ctf_array_text(char, bdi, dev_name(bdi->dev), 32) + ctf_integer(unsigned long, limit, global_dirty_limit) + ctf_integer(unsigned long, setpoint, (global_dirty_limit + (thresh + bg_thresh) / 2) / 2) - tp_assign(dirty, dirty) - tp_assign(bdi_setpoint, + ctf_integer(unsigned long, dirty, dirty) + ctf_integer(unsigned long, bdi_setpoint, ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) * - bdi_thresh / (thresh + 1)) - tp_assign(bdi_dirty, bdi_dirty) - tp_assign(dirty_ratelimit, KBps(dirty_ratelimit)) - tp_assign(task_ratelimit, KBps(task_ratelimit)) - tp_assign(dirtied, dirtied) - tp_assign(dirtied_pause, current->nr_dirtied_pause) + bdi_thresh / (thresh + 1)) + ctf_integer(unsigned long, bdi_dirty, bdi_dirty) + ctf_integer(unsigned long, dirty_ratelimit, + KBps(dirty_ratelimit)) + ctf_integer(unsigned long, task_ratelimit, + KBps(task_ratelimit)) + ctf_integer(unsigned int, dirtied, dirtied) + ctf_integer(unsigned int, dirtied_pause, + current->nr_dirtied_pause) + ctf_integer(unsigned long, paused, + (jiffies - start_time) * 1000 / HZ) + ctf_integer(long, pause, pause * 1000 / HZ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - tp_assign(think, current->dirty_paused_when == 0 ? 0 : - (long)(jiffies - current->dirty_paused_when) * 1000/HZ) - tp_assign(period, period * 1000 / HZ) -#endif - tp_assign(pause, pause * 1000 / HZ) - tp_assign(paused, (jiffies - start_time) * 1000 / HZ) - ), - - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - TP_printk("bdi %s: " - "limit=%lu setpoint=%lu dirty=%lu " - "bdi_setpoint=%lu bdi_dirty=%lu " - "dirty_ratelimit=%lu task_ratelimit=%lu " - "dirtied=%u dirtied_pause=%u " - "paused=%lu pause=%ld period=%lu think=%ld", - __entry->bdi, - __entry->limit, - __entry->setpoint, - __entry->dirty, - __entry->bdi_setpoint, - __entry->bdi_dirty, - __entry->dirty_ratelimit, - __entry->task_ratelimit, - __entry->dirtied, - __entry->dirtied_pause, - __entry->paused, /* ms */ - __entry->pause, /* ms */ - __entry->period, /* ms */ - __entry->think /* ms */ - ) -#else - TP_printk("bdi %s: " - "limit=%lu setpoint=%lu dirty=%lu " - "bdi_setpoint=%lu bdi_dirty=%lu " - "dirty_ratelimit=%lu task_ratelimit=%lu " - "dirtied=%u dirtied_pause=%u " - "paused=%lu pause=%ld", - __entry->bdi, - __entry->limit, - __entry->setpoint, - __entry->dirty, - __entry->bdi_setpoint, - __entry->bdi_dirty, - __entry->dirty_ratelimit, - __entry->task_ratelimit, - __entry->dirtied, - __entry->dirtied_pause, - __entry->paused, /* ms */ - __entry->pause /* ms */ - ) + ctf_integer(unsigned long, period, + period * 1000 / HZ) + ctf_integer(long, think, + current->dirty_paused_when == 0 ? 0 : + (long)(jiffies - current->dirty_paused_when) * 1000/HZ) #endif + ) ) #endif @@ -701,26 +450,12 @@ LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue, TP_PROTO(struct inode *inode), TP_ARGS(inode), - TP_STRUCT__entry( - __array_text(char, name, 32) - __field(unsigned long, ino) - __field(unsigned long, state) - __field(unsigned long, dirtied_when) - ), - - TP_fast_assign( - tp_memcpy(name, dev_name(inode_to_bdi(inode)->dev), 32) - tp_assign(ino, inode->i_ino) - tp_assign(state, inode->i_state) - tp_assign(dirtied_when, inode->dirtied_when) - ), - - TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu", - __entry->name, - __entry->ino, - show_inode_state(__entry->state), - __entry->dirtied_when, - (jiffies - __entry->dirtied_when) / HZ + TP_FIELDS( + ctf_array_text(char, name, + dev_name(inode_to_bdi(inode)->dev), 32) + ctf_integer(unsigned long, ino, inode->i_ino) + ctf_integer(unsigned long, state, inode->i_state) + ctf_integer(unsigned long, dirtied_when, inode->dirtied_when) ) ) #endif @@ -732,19 +467,10 @@ LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template, TP_ARGS(usec_timeout, usec_delayed), - TP_STRUCT__entry( - __field( unsigned int, usec_timeout ) - __field( unsigned int, usec_delayed ) - ), - - TP_fast_assign( - tp_assign(usec_timeout, usec_timeout) - tp_assign(usec_delayed, usec_delayed) - ), - - TP_printk("usec_timeout=%u usec_delayed=%u", - __entry->usec_timeout, - __entry->usec_delayed) + TP_FIELDS( + ctf_integer(unsigned int, usec_timeout, usec_timeout) + ctf_integer(unsigned int, usec_delayed, usec_delayed) + ) ) LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait, @@ -772,36 +498,17 @@ LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template, TP_ARGS(inode, wbc, nr_to_write), - TP_STRUCT__entry( - __array_text(char, name, 32) - __field(unsigned long, ino) - __field(unsigned long, state) - __field(unsigned long, dirtied_when) - __field(unsigned long, writeback_index) - __field(long, nr_to_write) - __field(unsigned long, wrote) - ), - - TP_fast_assign( - tp_memcpy(name, dev_name(inode_to_bdi(inode)->dev), 32) - tp_assign(ino, inode->i_ino) - tp_assign(state, inode->i_state) - tp_assign(dirtied_when, inode->dirtied_when) - tp_assign(writeback_index, inode->i_mapping->writeback_index) - tp_assign(nr_to_write, nr_to_write) - tp_assign(wrote, nr_to_write - wbc->nr_to_write) - ), - - TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu " - "index=%lu to_write=%ld wrote=%lu", - __entry->name, - __entry->ino, - show_inode_state(__entry->state), - __entry->dirtied_when, - (jiffies - __entry->dirtied_when) / HZ, - __entry->writeback_index, - __entry->nr_to_write, - __entry->wrote + TP_FIELDS( + ctf_array_text(char, name, + dev_name(inode_to_bdi(inode)->dev), 32) + ctf_integer(unsigned long, ino, inode->i_ino) + ctf_integer(unsigned long, state, inode->i_state) + ctf_integer(unsigned long, dirtied_when, inode->dirtied_when) + ctf_integer(unsigned long, writeback_index, + inode->i_mapping->writeback_index) + ctf_integer(long, nr_to_write, nr_to_write) + ctf_integer(unsigned long, wrote, + nr_to_write - wbc->nr_to_write) ) ) diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h index aadc9c37..e3a0a81a 100644 --- a/lib/ringbuffer/backend.h +++ b/lib/ringbuffer/backend.h @@ -209,7 +209,7 @@ size_t lib_ring_buffer_do_strcpy_from_user_inatomic(const struct lib_ring_buffer int ret; char c; - ret = __get_user(c, &src[count]); + ret = __copy_from_user_inatomic(&c, src + count, 1); if (ret || !c) break; lib_ring_buffer_do_copy(config, &dest[count], &c, 1); diff --git a/lttng-abi.c b/lttng-abi.c index beaad907..d4c5ea0f 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -144,6 +144,51 @@ fd_error: return ret; } +#ifndef CONFIG_HAVE_SYSCALL_TRACEPOINTS +static inline +int lttng_abi_syscall_list(void) +{ + return -ENOSYS; +} +#else +static +int lttng_abi_syscall_list(void) +{ + struct file *syscall_list_file; + int file_fd, ret; + + file_fd = lttng_get_unused_fd(); + if (file_fd < 0) { + ret = file_fd; + goto fd_error; + } + + syscall_list_file = anon_inode_getfile("[lttng_syscall_list]", + <tng_syscall_list_fops, + NULL, O_RDWR); + if (IS_ERR(syscall_list_file)) { + ret = PTR_ERR(syscall_list_file); + goto file_error; + } + ret = lttng_syscall_list_fops.open(NULL, syscall_list_file); + if (ret < 0) + goto open_error; + fd_install(file_fd, syscall_list_file); + if (file_fd < 0) { + ret = file_fd; + goto fd_error; + } + return file_fd; + +open_error: + fput(syscall_list_file); +file_error: + put_unused_fd(file_fd); +fd_error: + return ret; +} +#endif + static void lttng_abi_tracer_version(struct lttng_kernel_tracer_version *v) { diff --git a/lttng-abi.h b/lttng-abi.h index e029bc70..06eae785 100644 --- a/lttng-abi.h +++ b/lttng-abi.h @@ -161,7 +161,7 @@ struct lttng_kernel_context { } u; } __attribute__((packed)); -#define FILTER_BYTECODE_MAX_LEN 65536 +#define LTTNG_KERNEL_FILTER_BYTECODE_MAX_LEN 65536 struct lttng_kernel_filter_bytecode { uint32_t len; uint32_t reloc_offset; diff --git a/lttng-context-hostname.c b/lttng-context-hostname.c index 15aabe63..28881d05 100644 --- a/lttng-context-hostname.c +++ b/lttng-context-hostname.c @@ -65,6 +65,28 @@ void hostname_record(struct lttng_ctx_field *field, } } +static +void hostname_get_value(struct lttng_ctx_field *field, + union lttng_ctx_value *value) +{ + struct nsproxy *nsproxy; + struct uts_namespace *ns; + char *hostname; + + /* + * No need to take the RCU read-side lock to read current + * nsproxy. (documented in nsproxy.h) + */ + nsproxy = current->nsproxy; + if (nsproxy) { + ns = nsproxy->uts_ns; + hostname = ns->name.nodename; + } else { + hostname = ""; + } + value->str = hostname; +} + int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; @@ -89,6 +111,7 @@ int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx) field->get_size = hostname_get_size; field->record = hostname_record; + field->get_value = hostname_get_value; lttng_context_update(*ctx); wrapper_vmalloc_sync_all(); return 0; diff --git a/lttng-context-nice.c b/lttng-context-nice.c index 65117f8b..412dd93a 100644 --- a/lttng-context-nice.c +++ b/lttng-context-nice.c @@ -50,6 +50,13 @@ void nice_record(struct lttng_ctx_field *field, chan->ops->event_write(ctx, &nice, sizeof(nice)); } +static +void nice_get_value(struct lttng_ctx_field *field, + union lttng_ctx_value *value) +{ + value->s64 = task_nice(current); +} + int lttng_add_nice_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; @@ -71,6 +78,7 @@ int lttng_add_nice_to_ctx(struct lttng_ctx **ctx) field->event_field.type.u.basic.integer.encoding = lttng_encode_none; field->get_size = nice_get_size; field->record = nice_record; + field->get_value = nice_get_value; lttng_context_update(*ctx); wrapper_vmalloc_sync_all(); return 0; diff --git a/lttng-context-pid.c b/lttng-context-pid.c index 25cbcbb2..3211819d 100644 --- a/lttng-context-pid.c +++ b/lttng-context-pid.c @@ -50,6 +50,13 @@ void pid_record(struct lttng_ctx_field *field, chan->ops->event_write(ctx, &pid, sizeof(pid)); } +static +void pid_get_value(struct lttng_ctx_field *field, + union lttng_ctx_value *value) +{ + value->s64 = task_tgid_nr(current); +} + int lttng_add_pid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; @@ -71,6 +78,7 @@ int lttng_add_pid_to_ctx(struct lttng_ctx **ctx) field->event_field.type.u.basic.integer.encoding = lttng_encode_none; field->get_size = pid_get_size; field->record = pid_record; + field->get_value = pid_get_value; lttng_context_update(*ctx); wrapper_vmalloc_sync_all(); return 0; diff --git a/lttng-context-ppid.c b/lttng-context-ppid.c index a22c9d83..33ea1a79 100644 --- a/lttng-context-ppid.c +++ b/lttng-context-ppid.c @@ -46,7 +46,6 @@ void ppid_record(struct lttng_ctx_field *field, { pid_t ppid; - /* * TODO: when we eventually add RCU subsystem instrumentation, * taking the rcu read lock here will trigger RCU tracing @@ -54,7 +53,6 @@ void ppid_record(struct lttng_ctx_field *field, * it synchronizes both for RCU and RCU sched, and rely on * rcu_read_lock_sched_notrace. */ - rcu_read_lock(); ppid = task_tgid_nr(current->real_parent); rcu_read_unlock(); @@ -62,6 +60,25 @@ void ppid_record(struct lttng_ctx_field *field, chan->ops->event_write(ctx, &ppid, sizeof(ppid)); } +static +void ppid_get_value(struct lttng_ctx_field *field, + union lttng_ctx_value *value) +{ + pid_t ppid; + + /* + * TODO: when we eventually add RCU subsystem instrumentation, + * taking the rcu read lock here will trigger RCU tracing + * recursively. We should modify the kernel synchronization so + * it synchronizes both for RCU and RCU sched, and rely on + * rcu_read_lock_sched_notrace. + */ + rcu_read_lock(); + ppid = task_tgid_nr(current->real_parent); + rcu_read_unlock(); + value->s64 = ppid; +} + int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; @@ -83,6 +100,7 @@ int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx) field->event_field.type.u.basic.integer.encoding = lttng_encode_none; field->get_size = ppid_get_size; field->record = ppid_record; + field->get_value = ppid_get_value; lttng_context_update(*ctx); wrapper_vmalloc_sync_all(); return 0; diff --git a/lttng-context-prio.c b/lttng-context-prio.c index 891a315d..d9fb6f31 100644 --- a/lttng-context-prio.c +++ b/lttng-context-prio.c @@ -64,6 +64,13 @@ void prio_record(struct lttng_ctx_field *field, chan->ops->event_write(ctx, &prio, sizeof(prio)); } +static +void prio_get_value(struct lttng_ctx_field *field, + union lttng_ctx_value *value) +{ + value->s64 = wrapper_task_prio_sym(current); +} + int lttng_add_prio_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; @@ -92,6 +99,7 @@ int lttng_add_prio_to_ctx(struct lttng_ctx **ctx) field->event_field.type.u.basic.integer.encoding = lttng_encode_none; field->get_size = prio_get_size; field->record = prio_record; + field->get_value = prio_get_value; lttng_context_update(*ctx); wrapper_vmalloc_sync_all(); return 0; diff --git a/lttng-context-procname.c b/lttng-context-procname.c index 5913ee6a..5c1cd3a6 100644 --- a/lttng-context-procname.c +++ b/lttng-context-procname.c @@ -51,6 +51,13 @@ void procname_record(struct lttng_ctx_field *field, chan->ops->event_write(ctx, current->comm, sizeof(current->comm)); } +static +void procname_get_value(struct lttng_ctx_field *field, + union lttng_ctx_value *value) +{ + value->str = current->comm; +} + int lttng_add_procname_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; @@ -75,6 +82,7 @@ int lttng_add_procname_to_ctx(struct lttng_ctx **ctx) field->get_size = procname_get_size; field->record = procname_record; + field->get_value = procname_get_value; lttng_context_update(*ctx); wrapper_vmalloc_sync_all(); return 0; diff --git a/lttng-context-tid.c b/lttng-context-tid.c index 5ddc43c5..7b8e04be 100644 --- a/lttng-context-tid.c +++ b/lttng-context-tid.c @@ -50,6 +50,16 @@ void tid_record(struct lttng_ctx_field *field, chan->ops->event_write(ctx, &tid, sizeof(tid)); } +static +void tid_get_value(struct lttng_ctx_field *field, + union lttng_ctx_value *value) +{ + pid_t tid; + + tid = task_pid_nr(current); + value->s64 = tid; +} + int lttng_add_tid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; @@ -71,6 +81,7 @@ int lttng_add_tid_to_ctx(struct lttng_ctx **ctx) field->event_field.type.u.basic.integer.encoding = lttng_encode_none; field->get_size = tid_get_size; field->record = tid_record; + field->get_value = tid_get_value; lttng_context_update(*ctx); wrapper_vmalloc_sync_all(); return 0; diff --git a/lttng-context-vppid.c b/lttng-context-vppid.c index c18c5531..9f36375d 100644 --- a/lttng-context-vppid.c +++ b/lttng-context-vppid.c @@ -71,6 +71,36 @@ void vppid_record(struct lttng_ctx_field *field, chan->ops->event_write(ctx, &vppid, sizeof(vppid)); } +static +void vppid_get_value(struct lttng_ctx_field *field, + union lttng_ctx_value *value) +{ + struct task_struct *parent; + pid_t vppid; + + /* + * current nsproxy can be NULL when scheduled out of exit. pid_vnr uses + * the current thread nsproxy to perform the lookup. + */ + + /* + * TODO: when we eventually add RCU subsystem instrumentation, + * taking the rcu read lock here will trigger RCU tracing + * recursively. We should modify the kernel synchronization so + * it synchronizes both for RCU and RCU sched, and rely on + * rcu_read_lock_sched_notrace. + */ + + rcu_read_lock(); + parent = rcu_dereference(current->real_parent); + if (!current->nsproxy) + vppid = 0; + else + vppid = task_tgid_vnr(parent); + rcu_read_unlock(); + value->s64 = vppid; +} + int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; @@ -92,6 +122,7 @@ int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx) field->event_field.type.u.basic.integer.encoding = lttng_encode_none; field->get_size = vppid_get_size; field->record = vppid_record; + field->get_value = vppid_get_value; lttng_context_update(*ctx); wrapper_vmalloc_sync_all(); return 0; diff --git a/lttng-context-vtid.c b/lttng-context-vtid.c index 8abba82b..a264424f 100644 --- a/lttng-context-vtid.c +++ b/lttng-context-vtid.c @@ -56,6 +56,22 @@ void vtid_record(struct lttng_ctx_field *field, chan->ops->event_write(ctx, &vtid, sizeof(vtid)); } +static +void vtid_get_value(struct lttng_ctx_field *field, + union lttng_ctx_value *value) +{ + pid_t vtid; + + /* + * nsproxy can be NULL when scheduled out of exit. + */ + if (!current->nsproxy) + vtid = 0; + else + vtid = task_pid_vnr(current); + value->s64 = vtid; +} + int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; @@ -77,6 +93,7 @@ int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx) field->event_field.type.u.basic.integer.encoding = lttng_encode_none; field->get_size = vtid_get_size; field->record = vtid_record; + field->get_value = vtid_get_value; lttng_context_update(*ctx); wrapper_vmalloc_sync_all(); return 0; diff --git a/lttng-context.c b/lttng-context.c index b625f439..c2ce68d7 100644 --- a/lttng-context.c +++ b/lttng-context.c @@ -224,48 +224,47 @@ int lttng_context_init(void) { int ret; - ret = lttng_add_vpid_to_ctx(<tng_static_ctx); + ret = lttng_add_hostname_to_ctx(<tng_static_ctx); + if (ret) { + printk(KERN_WARNING "Cannot add context lttng_add_procname_to_ctx"); + } + ret = lttng_add_nice_to_ctx(<tng_static_ctx); if (ret) { printk(KERN_WARNING "Cannot add context lttng_add_procname_to_ctx"); } -#if 0 //TODO ret = lttng_add_pid_to_ctx(<tng_static_ctx); if (ret) { printk(KERN_WARNING "Cannot add context lttng_add_pthread_id_to_ctx"); } - ret = lttng_add_procname_to_ctx(<tng_static_ctx); + ret = lttng_add_ppid_to_ctx(<tng_static_ctx); if (ret) { - printk(KERN_WARNING "Cannot add context lttng_add_vtid_to_ctx"); + printk(KERN_WARNING "Cannot add context lttng_add_procname_to_ctx"); } ret = lttng_add_prio_to_ctx(<tng_static_ctx); if (ret) { printk(KERN_WARNING "Cannot add context lttng_add_vpid_to_ctx"); } - ret = lttng_add_nice_to_ctx(<tng_static_ctx); + ret = lttng_add_procname_to_ctx(<tng_static_ctx); if (ret) { - printk(KERN_WARNING "Cannot add context lttng_add_procname_to_ctx"); + printk(KERN_WARNING "Cannot add context lttng_add_vtid_to_ctx"); } ret = lttng_add_tid_to_ctx(<tng_static_ctx); if (ret) { printk(KERN_WARNING "Cannot add context lttng_add_procname_to_ctx"); } - ret = lttng_add_vtid_to_ctx(<tng_static_ctx); - if (ret) { - printk(KERN_WARNING "Cannot add context lttng_add_procname_to_ctx"); - } - ret = lttng_add_ppid_to_ctx(<tng_static_ctx); + ret = lttng_add_vppid_to_ctx(<tng_static_ctx); if (ret) { printk(KERN_WARNING "Cannot add context lttng_add_procname_to_ctx"); } - ret = lttng_add_vppid_to_ctx(<tng_static_ctx); + ret = lttng_add_vtid_to_ctx(<tng_static_ctx); if (ret) { printk(KERN_WARNING "Cannot add context lttng_add_procname_to_ctx"); } - ret = lttng_add_hostname_to_ctx(<tng_static_ctx); + ret = lttng_add_vpid_to_ctx(<tng_static_ctx); if (ret) { printk(KERN_WARNING "Cannot add context lttng_add_procname_to_ctx"); } -#endif + /* TODO: perf counters for filtering */ return 0; } diff --git a/lttng-events.c b/lttng-events.c index c103c6ed..ea22a35c 100644 --- a/lttng-events.c +++ b/lttng-events.c @@ -671,7 +671,7 @@ static void register_event(struct lttng_event *event) { const struct lttng_event_desc *desc; - int ret; + int ret = -EINVAL; if (event->registered) return; @@ -1218,6 +1218,11 @@ int lttng_enabler_ref_events(struct lttng_enabler *enabler) &event->enablers_ref_head); } + /* + * Link filter bytecodes if not linked yet. + */ + lttng_enabler_event_link_bytecode(event, enabler); + /* TODO: merge event context. */ } return 0; @@ -1404,9 +1409,8 @@ void lttng_session_sync_enablers(struct lttng_session *session) /* Enable filters */ list_for_each_entry(runtime, - &event->bytecode_runtime_head, node) { + &event->bytecode_runtime_head, node) lttng_filter_sync_state(runtime); - } } } diff --git a/lttng-events.h b/lttng-events.h index d9fdd0cf..a420dee2 100644 --- a/lttng-events.h +++ b/lttng-events.h @@ -31,6 +31,9 @@ #include "lttng-abi.h" #include "lttng-abi-old.h" +/* FIXME test */ +#undef CONFIG_HAVE_SYSCALL_TRACEPOINTS + #define lttng_is_signed_type(type) (((type)(-1)) < 0) struct lttng_channel; @@ -138,6 +141,8 @@ struct lttng_enum { struct lttng_event_field { const char *name; struct lttng_type type; + unsigned int nowrite:1, /* do not write into trace */ + user:1; /* fetch from user-space */ }; union lttng_ctx_value { @@ -567,22 +572,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan) return 0; } -static inline -int lttng_syscall_filter_enable(struct lttng_channel *chan, +static inline int lttng_syscall_filter_enable(struct lttng_channel *chan, const char *name) { return -ENOSYS; } -static inline -int lttng_syscall_filter_disable(struct lttng_channel *chan, +static inline int lttng_syscall_filter_disable(struct lttng_channel *chan, const char *name) { return -ENOSYS; } -static inline -long lttng_channel_syscall_mask(struct lttng_channel *channel, +static inline long lttng_channel_syscall_mask(struct lttng_channel *channel, struct lttng_kernel_syscall_mask __user *usyscall_mask) { return -ENOSYS; @@ -598,6 +600,8 @@ int lttng_abi_syscall_list(void) void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime); int lttng_enabler_attach_bytecode(struct lttng_enabler *enabler, struct lttng_kernel_filter_bytecode __user *bytecode); +void lttng_enabler_event_link_bytecode(struct lttng_event *event, + struct lttng_enabler *enabler); extern struct lttng_ctx *lttng_static_ctx; diff --git a/lttng-filter-interpreter.c b/lttng-filter-interpreter.c index 4018264d..ffce2150 100644 --- a/lttng-filter-interpreter.c +++ b/lttng-filter-interpreter.c @@ -20,21 +20,51 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "lttng-filter.h" +/* + * get_char should be called with page fault handler disabled if it is expected + * to handle user-space read. + */ +static +char get_char(struct estack_entry *reg, size_t offset) +{ + if (unlikely(offset >= reg->u.s.seq_len)) + return '\0'; + if (reg->u.s.user) { + char c; + + /* Handle invalid access as end of string. */ + if (unlikely(!access_ok(VERIFY_READ, + reg->u.s.user_str + offset, + sizeof(c)))) + return '\0'; + /* Handle fault (nonzero return value) as end of string. */ + if (unlikely(__copy_from_user_inatomic(&c, + reg->u.s.user_str + offset, + sizeof(c)))) + return '\0'; + return c; + } else { + return reg->u.s.str[offset]; + } +} + /* * -1: wildcard found. * -2: unknown escape char. * 0: normal char. */ - static -int parse_char(const char **p) +int parse_char(struct estack_entry *reg, char *c, size_t *offset) { - switch (**p) { + switch (*c) { case '\\': - (*p)++; - switch (**p) { + (*offset)++; + *c = get_char(reg, *offset); + switch (*c) { case '\\': case '*': return 0; @@ -51,66 +81,103 @@ int parse_char(const char **p) static int stack_strcmp(struct estack *stack, int top, const char *cmp_type) { - const char *p = estack_bx(stack, top)->u.s.str, *q = estack_ax(stack, top)->u.s.str; - int ret; - int diff; + size_t offset_bx = 0, offset_ax = 0; + int diff, has_user = 0; + mm_segment_t old_fs; + + if (estack_bx(stack, top)->u.s.user + || estack_ax(stack, top)->u.s.user) { + has_user = 1; + old_fs = get_fs(); + set_fs(KERNEL_DS); + pagefault_disable(); + } for (;;) { + int ret; int escaped_r0 = 0; + char char_bx, char_ax; - if (unlikely(p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0')) { - if (q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0') { - return 0; + char_bx = get_char(estack_bx(stack, top), offset_bx); + char_ax = get_char(estack_ax(stack, top), offset_ax); + + if (unlikely(char_bx == '\0')) { + if (char_ax == '\0') { + diff = 0; + break; } else { if (estack_ax(stack, top)->u.s.literal) { - ret = parse_char(&q); - if (ret == -1) - return 0; + ret = parse_char(estack_ax(stack, top), + &char_ax, &offset_ax); + if (ret == -1) { + diff = 0; + break; + } } - return -1; + diff = -1; + break; } } - if (unlikely(q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0')) { - if (p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0') { - return 0; + if (unlikely(char_ax == '\0')) { + if (char_bx == '\0') { + diff = 0; + break; } else { if (estack_bx(stack, top)->u.s.literal) { - ret = parse_char(&p); - if (ret == -1) - return 0; + ret = parse_char(estack_bx(stack, top), + &char_bx, &offset_bx); + if (ret == -1) { + diff = 0; + break; + } } - return 1; + diff = 1; + break; } } if (estack_bx(stack, top)->u.s.literal) { - ret = parse_char(&p); + ret = parse_char(estack_bx(stack, top), + &char_bx, &offset_bx); if (ret == -1) { - return 0; + diff = 0; + break; } else if (ret == -2) { escaped_r0 = 1; } /* else compare both char */ } if (estack_ax(stack, top)->u.s.literal) { - ret = parse_char(&q); + ret = parse_char(estack_ax(stack, top), + &char_ax, &offset_ax); if (ret == -1) { - return 0; + diff = 0; + break; } else if (ret == -2) { - if (!escaped_r0) - return -1; + if (!escaped_r0) { + diff = -1; + break; + } } else { - if (escaped_r0) - return 1; + if (escaped_r0) { + diff = 1; + break; + } } } else { - if (escaped_r0) - return 1; + if (escaped_r0) { + diff = 1; + break; + } } - diff = *p - *q; + diff = char_bx - char_ax; if (diff != 0) break; - p++; - q++; + offset_bx++; + offset_ax++; + } + if (has_user) { + pagefault_enable(); + set_fs(old_fs); } return diff; } @@ -285,6 +352,10 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, [ FILTER_OP_GET_CONTEXT_REF_STRING ] = &&LABEL_FILTER_OP_GET_CONTEXT_REF_STRING, [ FILTER_OP_GET_CONTEXT_REF_S64 ] = &&LABEL_FILTER_OP_GET_CONTEXT_REF_S64, [ FILTER_OP_GET_CONTEXT_REF_DOUBLE ] = &&LABEL_FILTER_OP_GET_CONTEXT_REF_DOUBLE, + + /* load userspace field ref */ + [ FILTER_OP_LOAD_FIELD_REF_USER_STRING ] = &&LABEL_FILTER_OP_LOAD_FIELD_REF_USER_STRING, + [ FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE ] = &&LABEL_FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE, }; #endif /* #ifndef INTERPRETER_USE_SWITCH */ @@ -579,6 +650,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, } estack_ax(stack, top)->u.s.seq_len = UINT_MAX; estack_ax(stack, top)->u.s.literal = 0; + estack_ax(stack, top)->u.s.user = 0; dbg_printk("ref load string %s\n", estack_ax(stack, top)->u.s.str); next_pc += sizeof(struct load_op) + sizeof(struct field_ref); PO; @@ -603,6 +675,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, goto end; } estack_ax(stack, top)->u.s.literal = 0; + estack_ax(stack, top)->u.s.user = 0; next_pc += sizeof(struct load_op) + sizeof(struct field_ref); PO; } @@ -639,6 +712,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, estack_ax(stack, top)->u.s.str = insn->data; estack_ax(stack, top)->u.s.seq_len = UINT_MAX; estack_ax(stack, top)->u.s.literal = 1; + estack_ax(stack, top)->u.s.user = 0; next_pc += sizeof(struct load_op) + strlen(insn->data) + 1; PO; } @@ -702,6 +776,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, } estack_ax(stack, top)->u.s.seq_len = UINT_MAX; estack_ax(stack, top)->u.s.literal = 0; + estack_ax(stack, top)->u.s.user = 0; dbg_printk("ref get context string %s\n", estack_ax(stack, top)->u.s.str); next_pc += sizeof(struct load_op) + sizeof(struct field_ref); PO; @@ -732,6 +807,54 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, PO; } + /* load userspace field ref */ + OP(FILTER_OP_LOAD_FIELD_REF_USER_STRING): + { + struct load_op *insn = (struct load_op *) pc; + struct field_ref *ref = (struct field_ref *) insn->data; + + dbg_printk("load field ref offset %u type user string\n", + ref->offset); + estack_push(stack, top, ax, bx); + estack_ax(stack, top)->u.s.str = + *(const char * const *) &filter_stack_data[ref->offset]; + if (unlikely(!estack_ax(stack, top)->u.s.str)) { + dbg_printk("Filter warning: loading a NULL string.\n"); + ret = -EINVAL; + goto end; + } + estack_ax(stack, top)->u.s.seq_len = UINT_MAX; + estack_ax(stack, top)->u.s.literal = 0; + estack_ax(stack, top)->u.s.user = 1; + dbg_printk("ref load string %s\n", estack_ax(stack, top)->u.s.str); + next_pc += sizeof(struct load_op) + sizeof(struct field_ref); + PO; + } + + OP(FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE): + { + struct load_op *insn = (struct load_op *) pc; + struct field_ref *ref = (struct field_ref *) insn->data; + + dbg_printk("load field ref offset %u type user sequence\n", + ref->offset); + estack_push(stack, top, ax, bx); + estack_ax(stack, top)->u.s.seq_len = + *(unsigned long *) &filter_stack_data[ref->offset]; + estack_ax(stack, top)->u.s.str = + *(const char **) (&filter_stack_data[ref->offset + + sizeof(unsigned long)]); + if (unlikely(!estack_ax(stack, top)->u.s.str)) { + dbg_printk("Filter warning: loading a NULL sequence.\n"); + ret = -EINVAL; + goto end; + } + estack_ax(stack, top)->u.s.literal = 0; + estack_ax(stack, top)->u.s.user = 1; + next_pc += sizeof(struct load_op) + sizeof(struct field_ref); + PO; + } + END_OP end: /* return 0 (discard) on error */ diff --git a/lttng-filter-specialize.c b/lttng-filter-specialize.c index 0c1d3954..b82497d2 100644 --- a/lttng-filter-specialize.c +++ b/lttng-filter-specialize.c @@ -423,6 +423,8 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode) case FILTER_OP_LOAD_FIELD_REF_STRING: case FILTER_OP_LOAD_FIELD_REF_SEQUENCE: case FILTER_OP_GET_CONTEXT_REF_STRING: + case FILTER_OP_LOAD_FIELD_REF_USER_STRING: + case FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE: { if (vstack_push(stack)) { ret = -EINVAL; diff --git a/lttng-filter-validator.c b/lttng-filter-validator.c index 71e9a740..e785799a 100644 --- a/lttng-filter-validator.c +++ b/lttng-filter-validator.c @@ -299,6 +299,8 @@ int bytecode_validate_overflow(struct bytecode_runtime *bytecode, } case FILTER_OP_LOAD_FIELD_REF_STRING: case FILTER_OP_LOAD_FIELD_REF_SEQUENCE: + case FILTER_OP_LOAD_FIELD_REF_USER_STRING: + case FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE: case FILTER_OP_LOAD_FIELD_REF_S64: case FILTER_OP_GET_CONTEXT_REF_STRING: case FILTER_OP_GET_CONTEXT_REF_S64: @@ -612,6 +614,8 @@ int validate_instruction_context(struct bytecode_runtime *bytecode, } case FILTER_OP_LOAD_FIELD_REF_STRING: case FILTER_OP_LOAD_FIELD_REF_SEQUENCE: + case FILTER_OP_LOAD_FIELD_REF_USER_STRING: + case FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE: { struct load_op *insn = (struct load_op *) pc; struct field_ref *ref = (struct field_ref *) insn->data; @@ -932,6 +936,8 @@ int exec_insn(struct bytecode_runtime *bytecode, case FILTER_OP_LOAD_FIELD_REF_STRING: case FILTER_OP_LOAD_FIELD_REF_SEQUENCE: case FILTER_OP_GET_CONTEXT_REF_STRING: + case FILTER_OP_LOAD_FIELD_REF_USER_STRING: + case FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE: { if (vstack_push(stack)) { ret = -EINVAL; diff --git a/lttng-filter.c b/lttng-filter.c index 6cd750cd..e9f549ca 100644 --- a/lttng-filter.c +++ b/lttng-filter.c @@ -126,6 +126,10 @@ static const char *opnames[] = { [ FILTER_OP_GET_CONTEXT_REF_STRING ] = "GET_CONTEXT_REF_STRING", [ FILTER_OP_GET_CONTEXT_REF_S64 ] = "GET_CONTEXT_REF_S64", [ FILTER_OP_GET_CONTEXT_REF_DOUBLE ] = "GET_CONTEXT_REF_DOUBLE", + + /* load userspace field ref */ + [ FILTER_OP_LOAD_FIELD_REF_USER_STRING ] = "LOAD_FIELD_REF_USER_STRING", + [ FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE ] = "LOAD_FIELD_REF_USER_SEQUENCE", }; const char *lttng_filter_print_op(enum filter_op op) @@ -187,7 +191,7 @@ int apply_field_reloc(struct lttng_event *event, return -EINVAL; /* Check if field offset is too large for 16-bit offset */ - if (field_offset > FILTER_BYTECODE_MAX_LEN - 1) + if (field_offset > LTTNG_KERNEL_FILTER_BYTECODE_MAX_LEN - 1) return -EINVAL; /* set type */ @@ -200,10 +204,16 @@ int apply_field_reloc(struct lttng_event *event, break; case atype_array: case atype_sequence: - op->op = FILTER_OP_LOAD_FIELD_REF_SEQUENCE; + if (field->user) + op->op = FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE; + else + op->op = FILTER_OP_LOAD_FIELD_REF_SEQUENCE; break; case atype_string: - op->op = FILTER_OP_LOAD_FIELD_REF_STRING; + if (field->user) + op->op = FILTER_OP_LOAD_FIELD_REF_USER_STRING; + else + op->op = FILTER_OP_LOAD_FIELD_REF_STRING; break; default: return -EINVAL; @@ -233,7 +243,7 @@ int apply_context_reloc(struct lttng_event *event, return -ENOENT; /* Check if idx is too large for 16-bit offset */ - if (idx > FILTER_BYTECODE_MAX_LEN - 1) + if (idx > LTTNG_KERNEL_FILTER_BYTECODE_MAX_LEN - 1) return -EINVAL; /* Get context return type */ @@ -249,6 +259,7 @@ int apply_context_reloc(struct lttng_event *event, case atype_string: case atype_array: case atype_sequence: + BUG_ON(ctx_field->event_field.user); op->op = FILTER_OP_GET_CONTEXT_REF_STRING; break; default: diff --git a/lttng-filter.h b/lttng-filter.h index 98b97c20..7eea1487 100644 --- a/lttng-filter.h +++ b/lttng-filter.h @@ -121,8 +121,10 @@ struct estack_entry { struct { const char *str; + const char __user *user_str; size_t seq_len; int literal; /* is string literal ? */ + int user; /* is string from userspace ? */ } s; } u; }; diff --git a/probes/define_trace.h b/probes/define_trace.h index 28125edd..4b67f5f8 100644 --- a/probes/define_trace.h +++ b/probes/define_trace.h @@ -44,51 +44,22 @@ #include #undef LTTNG_TRACEPOINT_EVENT_MAP -#define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, tstruct, assign, print) +#define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, fields) #undef LTTNG_TRACEPOINT_EVENT_MAP_NOARGS -#define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, tstruct, assign, print) - -#undef LTTNG_TRACEPOINT_EVENT_CONDITION_MAP -#define LTTNG_TRACEPOINT_EVENT_CONDITION_MAP(name, map, proto, args, cond, tstruct, assign, print) \ - LTTNG_TRACEPOINT_EVENT(name, \ - PARAMS(proto), \ - PARAMS(args), \ - PARAMS(tstruct), \ - PARAMS(assign), \ - PARAMS(print)) - -#undef LTTNG_TRACEPOINT_EVENT_FN_MAP -#define LTTNG_TRACEPOINT_EVENT_FN_MAP(name, map, proto, args, tstruct, \ - assign, print, reg, unreg) +#define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, fields) #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(template, name, map, proto, args) -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP(template, name, map, proto, args, print) - -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION_MAP -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION_MAP(template, name, map, proto, args, cond) - #undef LTTNG_TRACEPOINT_EVENT -#define LTTNG_TRACEPOINT_EVENT(name, proto, args, tstruct, assign, print) - -#undef LTTNG_TRACEPOINT_EVENT_CONDITION -#define LTTNG_TRACEPOINT_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \ - LTTNG_TRACEPOINT_EVENT(name, \ - PARAMS(proto), \ - PARAMS(args), \ - PARAMS(tstruct), \ - PARAMS(assign), \ - PARAMS(print)) +#define LTTNG_TRACEPOINT_EVENT(name, proto, args, fields) #undef LTTNG_TRACEPOINT_EVENT_CODE -#define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code, tstruct, assign, print) +#define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code, fields) -#undef LTTNG_TRACEPOINT_EVENT_FN -#define LTTNG_TRACEPOINT_EVENT_FN(name, proto, args, tstruct, \ - assign, print, reg, unreg) +#undef LTTNG_TRACEPOINT_EVENT_CODE_MAP +#define LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, map, proto, args, _locvar, _code, fields) #undef LTTNG_TRACEPOINT_EVENT_INSTANCE #define LTTNG_TRACEPOINT_EVENT_INSTANCE(template, name, proto, args) @@ -99,13 +70,6 @@ #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(template, name, map) -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT(template, name, proto, args, print) - -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION(template, name, proto, args, cond) \ - LTTNG_TRACEPOINT_EVENT_INSTANCE(template, name, PARAMS(proto), PARAMS(args)) - #undef TRACE_INCLUDE #undef __TRACE_INCLUDE @@ -137,18 +101,11 @@ #endif #undef LTTNG_TRACEPOINT_EVENT -#undef LTTNG_TRACEPOINT_EVENT_FN -#undef LTTNG_TRACEPOINT_EVENT_CONDITION #undef LTTNG_TRACEPOINT_EVENT_INSTANCE -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION #undef LTTNG_TRACEPOINT_EVENT_MAP -#undef LTTNG_TRACEPOINT_EVENT_FN_MAP -#undef LTTNG_TRACEPOINT_EVENT_CONDITION_MAP #undef LTTNG_TRACEPOINT_EVENT_CLASS #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION_MAP +#undef LTTNG_TRACEPOINT_EVENT_CODE_MAP #undef LTTNG_TRACEPOINT_EVENT_CODE #undef LTTNG_TRACEPOINT_EVENT_MAP_NOARGS #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS diff --git a/probes/lttng-events-reset.h b/probes/lttng-events-reset.h index 085b61cd..2c20f79e 100644 --- a/probes/lttng-events-reset.h +++ b/probes/lttng-events-reset.h @@ -18,85 +18,170 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/* Reset macros used within TRACE_EVENT to "nothing" */ +/* Reset macros used within LTTNG_TRACEPOINT_EVENT to "nothing" */ -#undef __field_full -#define __field_full(_type, _item, _order, _base) +#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _fields) -#undef __array_enc_ext -#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding) +#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _fields) -#undef __dynamic_array_enc_ext -#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding) +#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP +#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) -#undef __dynamic_array_enc_ext_2 -#define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding) +#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS +#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) -#undef __dynamic_array_len -#define __dynamic_array_len(_type, _item, _length) +#undef TP_PROTO +#define TP_PROTO(args...) -#undef __string -#define __string(_item, _src) +#undef TP_ARGS +#define TP_ARGS(args...) -#undef tp_assign -#define tp_assign(dest, src) +#undef TP_locvar +#define TP_locvar(...) -#undef tp_memcpy -#define tp_memcpy(dest, src, len) +#undef TP_code +#define TP_code(...) -#undef tp_memcpy_dyn -#define tp_memcpy_dyn(dest, src, len) +#undef TP_FIELDS +#define TP_FIELDS(args...) -#undef tp_strcpy -#define tp_strcpy(dest, src) +#undef _ctf_integer_ext +#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, \ + _user, _nowrite) -#undef __get_str -#define __get_str(field) +#undef _ctf_integer_ext_isuser0 +#define _ctf_integer_ext_isuser0(_type, _item, _src, _byte_order, _base, \ + _nowrite) -#undef __get_dynamic_array -#define __get_dynamic_array(field) +#undef _ctf_integer_ext_isuser1 +#define _ctf_integer_ext_isuser1(_type, _item, _src, _byte_order, _base, \ + _nowrite) -#undef __get_dynamic_array_len -#define __get_dynamic_array_len(field) +#undef _ctf_integer_ext_fetched +#define _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, \ + _nowrite) -#undef TP_PROTO -#define TP_PROTO(args...) +#undef _ctf_array_encoded +#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, \ + _user, _nowrite) -#undef TP_ARGS -#define TP_ARGS(args...) +#undef _ctf_sequence_encoded +#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \ + _src_length, _encoding, _base, _user, _nowrite) -#undef TP_locvar -#define TP_locvar(...) +#undef _ctf_string +#define _ctf_string(_item, _src, _user, _nowrite) -#undef TP_code -#define TP_code(...) +/* "write" */ +#undef ctf_integer +#define ctf_integer(_type, _item, _src) -#undef TP_STRUCT__entry -#define TP_STRUCT__entry(args...) +#undef ctf_integer_hex +#define ctf_integer_hex(_type, _item, _src) -#undef TP_fast_assign -#define TP_fast_assign(args...) +#undef ctf_integer_oct +#define ctf_integer_oct(_type, _item, _src) -#undef __perf_count -#define __perf_count(args...) +#undef ctf_integer_network +#define ctf_integer_network(_type, _item, _src) -#undef __perf_addr -#define __perf_addr(args...) +#undef ctf_integer_network_hex +#define ctf_integer_network_hex(_type, _item, _src) -#undef TP_perf_assign -#define TP_perf_assign(args...) +#undef ctf_float +#define ctf_float(_type, _item, _src) -#undef TP_printk -#define TP_printk(args...) +#undef ctf_array +#define ctf_array(_type, _item, _src, _length) -#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _tstruct, _assign, _print) +#undef ctf_array_text +#define ctf_array_text(_type, _item, _src, _length) -#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _tstruct, _assign, _print) +#undef ctf_sequence +#define ctf_sequence(_type, _item, _src, _length_type, _src_length) -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) +#undef ctf_sequence_hex +#define ctf_sequence_hex(_type, _item, _src, _length_type, _src_length) -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) +#undef ctf_sequence_text +#define ctf_sequence_text(_type, _item, _src, _length_type, _src_length) + +#undef ctf_string +#define ctf_string(_item, _src) + +/* "nowrite" */ +#undef ctf_integer_nowrite +#define ctf_integer_nowrite(_type, _item, _src) + +#undef ctf_float_nowrite +#define ctf_float_nowrite(_type, _item, _src) + +#undef ctf_array_nowrite +#define ctf_array_nowrite(_type, _item, _src, _length) + +#undef ctf_array_text_nowrite +#define ctf_array_text_nowrite(_type, _item, _src, _length) + +#undef ctf_sequence_nowrite +#define ctf_sequence_nowrite(_type, _item, _src, _length_type, _src_length) + +#undef ctf_sequence_text_nowrite +#define ctf_sequence_text_nowrite(_type, _item, _src, _length_type, _src_length) + +#undef ctf_string_nowrite +#define ctf_string_nowrite(_item, _src) + +/* "user" - "write" */ +#undef ctf_user_integer +#define ctf_user_integer(_type, _item, _user_src) + +#undef ctf_user_integer_hex +#define ctf_user_integer_hex(_type, _item, _user_src) + +#undef ctf_user_integer_network +#define ctf_user_integer_network(_type, _item, _user_src) + +#undef ctf_user_integer_network_hex +#define ctf_user_integer_network_hex(_type, _item, _user_src) + +#undef ctf_user_float +#define ctf_user_float(_type, _item, _user_src) + +#undef ctf_user_array +#define ctf_user_array(_type, _item, _user_src, _length) + +#undef ctf_user_array_text +#define ctf_user_array_text(_type, _item, _user_src, _length) + +#undef ctf_user_sequence +#define ctf_user_sequence(_type, _item, _user_src, _length_type, _user_src_length) + +#undef ctf_user_sequence_text +#define ctf_user_sequence_text(_type, _item, _user_src, _length_type, _user_src_length) + +#undef ctf_user_string +#define ctf_user_string(_item, _user_src) + +/* "user" - "nowrite" */ +#undef ctf_user_integer_nowrite +#define ctf_user_integer_nowrite(_type, _item, _user_src) + +#undef ctf_user_float_nowrite +#define ctf_user_float_nowrite(_type, _item, _user_src) + +#undef ctf_user_array_nowrite +#define ctf_user_array_nowrite(_type, _item, _user_src, _length) + +#undef ctf_user_array_text_nowrite +#define ctf_user_array_text_nowrite(_type, _item, _user_src, _length) + +#undef ctf_user_sequence_nowrite +#define ctf_user_sequence_nowrite(_type, _item, _user_src, _length_type, _user_src_length) + +#undef ctf_user_sequence_text_nowrite +#define ctf_user_sequence_text_nowrite(_type, _item, _user_src, _length_type, _user_src_length) + +#undef ctf_user_string_nowrite +#define ctf_user_string_nowrite(_item, _user_src) diff --git a/probes/lttng-events.h b/probes/lttng-events.h index 5fc4d9f3..1b7df762 100644 --- a/probes/lttng-events.h +++ b/probes/lttng-events.h @@ -2,7 +2,7 @@ * lttng-events.h * * Copyright (C) 2009 Steven Rostedt - * Copyright (C) 2009-2012 Mathieu Desnoyers + * Copyright (C) 2009-2014 Mathieu Desnoyers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,8 +18,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + #include #include +#include #include "lttng.h" #include "lttng-types.h" #include "lttng-probe-user.h" @@ -37,59 +39,37 @@ * enforce name-spacing. */ #undef LTTNG_TRACEPOINT_EVENT_MAP -#define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, tstruct, assign, print) \ +#define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, fields) \ LTTNG_TRACEPOINT_EVENT_CLASS(map, \ PARAMS(proto), \ PARAMS(args), \ - PARAMS(tstruct), \ - PARAMS(assign), \ - PARAMS(print)) \ + PARAMS(fields)) \ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(map, name, map, PARAMS(proto), PARAMS(args)) #undef LTTNG_TRACEPOINT_EVENT_MAP_NOARGS -#define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, tstruct, assign, print) \ +#define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, fields) \ LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(map, \ - PARAMS(tstruct), \ - PARAMS(assign), \ - PARAMS(print)) \ + PARAMS(fields)) \ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(map, name, map) +#undef LTTNG_TRACEPOINT_EVENT_CODE_MAP +#define LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, map, proto, args, _locvar, _code, fields) \ + LTTNG_TRACEPOINT_EVENT_CLASS_CODE(map, \ + PARAMS(proto), \ + PARAMS(args), \ + PARAMS(_locvar), \ + PARAMS(_code), \ + PARAMS(fields)) \ + LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(map, name, map, PARAMS(proto), PARAMS(args)) + #undef LTTNG_TRACEPOINT_EVENT_CODE -#define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code, tstruct, assign, print) \ - LTTNG_TRACEPOINT_EVENT_CLASS_CODE(name, \ +#define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code, fields) \ + LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, name, \ PARAMS(proto), \ PARAMS(args), \ PARAMS(_locvar), \ PARAMS(_code), \ - PARAMS(tstruct), \ - PARAMS(assign), \ - PARAMS(print)) \ - LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(name, name, name, PARAMS(proto), PARAMS(args)) - - -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP(template, name, map, proto, args, print) \ - LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(template, name, map, PARAMS(proto), PARAMS(args)) - -/* Callbacks are meaningless to LTTng. */ -#undef LTTNG_TRACEPOINT_EVENT_FN_MAP -#define LTTNG_TRACEPOINT_EVENT_FN_MAP(name, map, proto, args, tstruct, \ - assign, print, reg, unreg) \ - LTTNG_TRACEPOINT_EVENT_MAP(name, map, PARAMS(proto), PARAMS(args), \ - PARAMS(tstruct), PARAMS(assign), PARAMS(print)) - -#undef LTTNG_TRACEPOINT_EVENT_CONDITION_MAP -#define LTTNG_TRACEPOINT_EVENT_CONDITION_MAP(name, map, proto, args, cond, tstruct, assign, print) \ - LTTNG_TRACEPOINT_EVENT_MAP(name, map, \ - PARAMS(proto), \ - PARAMS(args), \ - PARAMS(tstruct), \ - PARAMS(assign), \ - PARAMS(print)) - -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION_MAP -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION_MAP(template, name, map, proto, args, cond) \ - LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(template, name, map, PARAMS(proto), PARAMS(args)) + PARAMS(fields)) /* * LTTNG_TRACEPOINT_EVENT_CLASS can be used to add a generic function @@ -103,32 +83,15 @@ */ #undef LTTNG_TRACEPOINT_EVENT -#define LTTNG_TRACEPOINT_EVENT(name, proto, args, tstruct, assign, print) \ +#define LTTNG_TRACEPOINT_EVENT(name, proto, args, fields) \ LTTNG_TRACEPOINT_EVENT_MAP(name, name, \ PARAMS(proto), \ PARAMS(args), \ - PARAMS(tstruct), \ - PARAMS(assign), \ - PARAMS(print)) + PARAMS(fields)) #undef LTTNG_TRACEPOINT_EVENT_NOARGS -#define LTTNG_TRACEPOINT_EVENT_NOARGS(name, tstruct, assign, print) \ - LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, name, \ - PARAMS(tstruct), \ - PARAMS(assign), \ - PARAMS(print)) - -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT(template, name, proto, args, print) \ - LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP(template, name, name, \ - PARAMS(proto), PARAMS(args), PARAMS(print_)) - -#undef LTTNG_TRACEPOINT_EVENT_FN -#define LTTNG_TRACEPOINT_EVENT_FN(name, proto, args, tstruct, \ - assign, print, reg, unreg) \ - LTTNG_TRACEPOINT_EVENT_FN_MAP(name, name, PARAMS(proto), PARAMS(args), \ - PARAMS(tstruct), PARAMS(assign), PARAMS(print), \ - PARAMS(reg), PARAMS(unreg)) \ +#define LTTNG_TRACEPOINT_EVENT_NOARGS(name, fields) \ + LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, name, PARAMS(fields)) #undef LTTNG_TRACEPOINT_EVENT_INSTANCE #define LTTNG_TRACEPOINT_EVENT_INSTANCE(template, name, proto, args) \ @@ -138,25 +101,14 @@ #define LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(template, name) \ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(template, name, name) -#undef LTTNG_TRACEPOINT_EVENT_CONDITION -#define LTTNG_TRACEPOINT_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \ - LTTNG_TRACEPOINT_EVENT_CONDITION_MAP(name, name, \ - PARAMS(proto), \ - PARAMS(args), \ - PARAMS(cond), \ - PARAMS(tstruct), \ - PARAMS(assign), \ - PARAMS(print)) - #undef LTTNG_TRACEPOINT_EVENT_CLASS -#define LTTNG_TRACEPOINT_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \ +#define LTTNG_TRACEPOINT_EVENT_CLASS(_name, _proto, _args, _fields) \ LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, PARAMS(_proto), PARAMS(_args), , , \ - PARAMS(_tstruct), PARAMS(_assign), PARAMS(_print)) + PARAMS(_fields)) #undef LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS -#define LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \ - LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, , , PARAMS(_tstruct), \ - PARAMS(_assign), PARAMS(_print)) +#define LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) \ + LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, , , PARAMS(_fields)) /* @@ -167,13 +119,14 @@ * out by the compiler. */ -#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ +/* Reset all macros within TRACEPOINT_EVENT */ +#include "lttng-events-reset.h" #undef TP_PROTO -#define TP_PROTO(args...) args +#define TP_PROTO(...) __VA_ARGS__ #undef TP_ARGS -#define TP_ARGS(args...) args +#define TP_ARGS(...) __VA_ARGS__ #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \ @@ -192,139 +145,90 @@ void trace_##_name(void *__data); * Each event produce an array of fields. */ -#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ +/* Reset all macros within TRACEPOINT_EVENT */ +#include "lttng-events-reset.h" +#include "lttng-events-write.h" +#include "lttng-events-nowrite.h" -/* Named field types must be defined in lttng-types.h */ - -#undef __field_full -#define __field_full(_type, _item, _order, _base) \ +#undef _ctf_integer_ext +#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \ { \ .name = #_item, \ - .type = __type_integer(_type, _order, _base, none), \ + .type = __type_integer(_type, _byte_order, _base, none),\ + .nowrite = _nowrite, \ + .user = _user, \ }, -#undef __field -#define __field(_type, _item) \ - __field_full(_type, _item, __BYTE_ORDER, 10) - -#undef __field_ext -#define __field_ext(_type, _item, _filter_type) \ - __field(_type, _item) - -#undef __field_hex -#define __field_hex(_type, _item) \ - __field_full(_type, _item, __BYTE_ORDER, 16) - -#undef __field_oct -#define __field_oct(_type, _item) \ - __field_full(_type, _item, __BYTE_ORDER, 8) - -#undef __field_network -#define __field_network(_type, _item) \ - __field_full(_type, _item, __BIG_ENDIAN, 10) - -#undef __field_network_hex -#define __field_network_hex(_type, _item) \ - __field_full(_type, _item, __BIG_ENDIAN, 16) - -#undef __array_enc_ext -#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ +#undef _ctf_array_encoded +#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \ { \ .name = #_item, \ .type = \ { \ .atype = atype_array, \ - .u.array = \ + .u = \ { \ - .length = _length, \ - .elem_type = __type_integer(_type, _order, _base, _encoding), \ - }, \ + .array = \ + { \ + .elem_type = __type_integer(_type, __BYTE_ORDER, 10, _encoding), \ + .length = _length, \ + } \ + } \ }, \ + .nowrite = _nowrite, \ + .user = _user, \ }, -#undef __array -#define __array(_type, _item, _length) \ - __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, none) - -#undef __array_text -#define __array_text(_type, _item, _length) \ - __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, UTF8) - -#undef __array_hex -#define __array_hex(_type, _item, _length) \ - __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 16, none) - -#undef __dynamic_array_enc_ext -#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding) \ +#undef _ctf_sequence_encoded +#define _ctf_sequence_encoded(_type, _item, _src, \ + _length_type, _src_length, _encoding, \ + _base, _user, _nowrite) \ { \ .name = #_item, \ .type = \ { \ .atype = atype_sequence, \ - .u.sequence = \ + .u = \ { \ - .length_type = __type_integer(u32, __BYTE_ORDER, 10, none), \ - .elem_type = __type_integer(_type, _order, _base, _encoding), \ + .sequence = \ + { \ + .length_type = __type_integer(_length_type, __BYTE_ORDER, 10, none), \ + .elem_type = __type_integer(_type, __BYTE_ORDER, _base, _encoding), \ + }, \ }, \ }, \ + .nowrite = _nowrite, \ + .user = _user, \ }, -#undef __dynamic_array_enc_ext_2 -#define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding) \ - __dynamic_array_enc_ext(_type, _item, _length1 + _length2, _order, _base, _encoding) - -#undef __dynamic_array -#define __dynamic_array(_type, _item, _length) \ - __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, none) - -#undef __dynamic_array_text -#define __dynamic_array_text(_type, _item, _length) \ - __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, UTF8) - -#undef __dynamic_array_hex -#define __dynamic_array_hex(_type, _item, _length) \ - __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 16, none) - -#undef __dynamic_array_network_hex -#define __dynamic_array_network_hex(_type, _item, _length) \ - __dynamic_array_enc_ext(_type, _item, _length, __BIG_ENDIAN, 16, none) - -#undef __dynamic_array_network -#define __dynamic_array_network(_type, _item, _length) \ - __dynamic_array_enc_ext(_type, _item, _length, __BIG_ENDIAN, 10, none) - -#undef __dynamic_array_text_2 -#define __dynamic_array_text_2(_type, _item, _length1, _length2) \ - __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, __BYTE_ORDER, 10, UTF8) - -#undef __string -#define __string(_item, _src) \ +#undef _ctf_string +#define _ctf_string(_item, _src, _user, _nowrite) \ { \ .name = #_item, \ .type = \ { \ .atype = atype_string, \ - .u.basic.string.encoding = lttng_encode_UTF8, \ + .u = \ + { \ + .basic = { .string = { .encoding = lttng_encode_UTF8 } } \ + }, \ }, \ + .nowrite = _nowrite, \ + .user = _user, \ }, -#undef __string_from_user -#define __string_from_user(_item, _src) \ - __string(_item, _src) - -#undef TP_STRUCT__entry -#define TP_STRUCT__entry(args...) args /* Only one used in this phase */ +#undef TP_FIELDS +#define TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */ #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _tstruct, _assign, _print) \ +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _fields) \ static const struct lttng_event_field __event_fields___##_name[] = { \ - _tstruct \ + _fields \ }; #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _tstruct, _assign, _print) \ - LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, PARAMS(_tstruct), PARAMS(_assign), \ - PARAMS(_print)) +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _fields) \ + LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, PARAMS(_fields)) #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) @@ -334,169 +238,76 @@ void trace_##_name(void *__data); * Create probe callback prototypes. */ -#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ +/* Reset all macros within TRACEPOINT_EVENT */ +#include "lttng-events-reset.h" #undef TP_PROTO -#define TP_PROTO(args...) args +#define TP_PROTO(...) __VA_ARGS__ #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _tstruct, _assign, _print) \ +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _fields) \ static void __event_probe__##_name(void *__data, _proto); #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _tstruct, _assign, _print) \ +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _fields) \ static void __event_probe__##_name(void *__data); #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) -/* - * Stage 3.9 of the trace events. - * - * Create event descriptions. - */ - -/* Named field types must be defined in lttng-types.h */ - -#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ - -#ifndef TP_PROBE_CB -#define TP_PROBE_CB(_template) &__event_probe__##_template -#endif - -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \ -static const struct lttng_event_desc __event_desc___##_map = { \ - .fields = __event_fields___##_template, \ - .name = #_map, \ - .kname = #_name, \ - .probe_callback = (void *) TP_PROBE_CB(_template), \ - .nr_fields = ARRAY_SIZE(__event_fields___##_template), \ - .owner = THIS_MODULE, \ -}; - -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \ - LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) - -#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) - - /* * Stage 4 of the trace events. * - * Create an array of event description pointers. - */ - -/* Named field types must be defined in lttng-types.h */ - -#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ - -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \ - &__event_desc___##_map, - -#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \ - LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) - -#define TP_ID1(_token, _system) _token##_system -#define TP_ID(_token, _system) TP_ID1(_token, _system) - -static const struct lttng_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = { -#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) -}; - -#undef TP_ID1 -#undef TP_ID - - -/* - * Stage 5 of the trace events. - * - * Create a toplevel descriptor for the whole probe. - */ - -#define TP_ID1(_token, _system) _token##_system -#define TP_ID(_token, _system) TP_ID1(_token, _system) - -/* non-const because list head will be modified when registered. */ -static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = { - .provider = __stringify(TRACE_SYSTEM), - .event_desc = TP_ID(__event_desc___, TRACE_SYSTEM), - .nr_events = ARRAY_SIZE(TP_ID(__event_desc___, TRACE_SYSTEM)), - .head = { NULL, NULL }, - .lazy_init_head = { NULL, NULL }, - .lazy = 0, -}; - -#undef TP_ID1 -#undef TP_ID - -/* - * Stage 6 of the trace events. - * * Create static inline function that calculates event size. */ -#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ - -/* Named field types must be defined in lttng-types.h */ +/* Reset all macros within TRACEPOINT_EVENT */ +#include "lttng-events-reset.h" +#include "lttng-events-write.h" -#undef __field_full -#define __field_full(_type, _item, _order, _base) \ +#undef _ctf_integer_ext +#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \ __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ __event_len += sizeof(_type); -#undef __array_enc_ext -#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding) \ +#undef _ctf_array_encoded +#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \ __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ __event_len += sizeof(_type) * (_length); -#undef __dynamic_array_enc_ext -#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ - __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(u32)); \ - __event_len += sizeof(u32); \ +#undef _ctf_sequence_encoded +#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \ + _src_length, _encoding, _base, _user, _nowrite) \ + __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \ + __event_len += sizeof(_length_type); \ __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ - __dynamic_len[__dynamic_len_idx] = (_length); \ + __dynamic_len[__dynamic_len_idx] = (_src_length); \ __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \ __dynamic_len_idx++; -#undef __dynamic_array_enc_ext_2 -#define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding)\ - __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(u32)); \ - __event_len += sizeof(u32); \ - __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ - __dynamic_len[__dynamic_len_idx] = (_length1); \ - __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \ - __dynamic_len_idx++; \ - __dynamic_len[__dynamic_len_idx] = (_length2); \ - __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \ - __dynamic_len_idx++; - -#undef __string -#define __string(_item, _src) \ - __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1; - /* - * strlen_user includes \0. If returns 0, it faulted, so we set size to + * ctf_user_string includes \0. If returns 0, it faulted, so we set size to * 1 (\0 only). */ -#undef __string_from_user -#define __string_from_user(_item, _src) \ - __event_len += __dynamic_len[__dynamic_len_idx++] = \ - max_t(size_t, lttng_strlen_user_inatomic(_src), 1); +#undef _ctf_string +#define _ctf_string(_item, _src, _user, _nowrite) \ + if (_user) \ + __event_len += __dynamic_len[__dynamic_len_idx++] = \ + strlen(_src) + 1; \ + else \ + __event_len += __dynamic_len[__dynamic_len_idx++] = \ + max_t(size_t, lttng_strlen_user_inatomic(_src), 1); #undef TP_PROTO -#define TP_PROTO(args...) args +#define TP_PROTO(...) __VA_ARGS__ -#undef TP_STRUCT__entry -#define TP_STRUCT__entry(args...) args +#undef TP_FIELDS +#define TP_FIELDS(...) __VA_ARGS__ #undef TP_locvar #define TP_locvar(...) __VA_ARGS__ #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _tstruct, _assign, _print) \ +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _fields) \ static inline size_t __event_get_size__##_name(size_t *__dynamic_len, \ void *__tp_locvar, _proto) \ { \ @@ -504,12 +315,12 @@ static inline size_t __event_get_size__##_name(size_t *__dynamic_len, \ unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \ struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \ \ - _tstruct \ + _fields \ return __event_len; \ } #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _tstruct, _assign, _print) \ +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _fields) \ static inline size_t __event_get_size__##_name(size_t *__dynamic_len, \ void *__tp_locvar) \ { \ @@ -517,300 +328,318 @@ static inline size_t __event_get_size__##_name(size_t *__dynamic_len, \ unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \ struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \ \ - _tstruct \ + _fields \ return __event_len; \ } #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) + /* - * Stage 7 of the trace events. + * Stage 4.1 of tracepoint event generation. * - * Create static inline function that calculates event payload alignment. + * Create static inline function that layout the filter stack data. + * We make both write and nowrite data available to the filter. */ -#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ - -/* Named field types must be defined in lttng-types.h */ - -#undef __field_full -#define __field_full(_type, _item, _order, _base) \ - __event_align = max_t(size_t, __event_align, lttng_alignof(_type)); - -#undef __array_enc_ext -#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding) \ - __event_align = max_t(size_t, __event_align, lttng_alignof(_type)); - -#undef __dynamic_array_enc_ext -#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ - __event_align = max_t(size_t, __event_align, lttng_alignof(u32)); \ - __event_align = max_t(size_t, __event_align, lttng_alignof(_type)); - -#undef __dynamic_array_enc_ext_2 -#define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding)\ - __dynamic_array_enc_ext(_type, _item, _length1 + _length2, _order, _base, _encoding) - -#undef __string -#define __string(_item, _src) +/* Reset all macros within TRACEPOINT_EVENT */ +#include "lttng-events-reset.h" +#include "lttng-events-write.h" +#include "lttng-events-nowrite.h" + +#undef _ctf_integer_ext_fetched +#define _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \ + if (lttng_is_signed_type(_type)) { \ + int64_t __ctf_tmp_int64; \ + switch (sizeof(_type)) { \ + case 1: \ + { \ + union { _type t; int8_t v; } __tmp = { (_type) (_src) }; \ + __ctf_tmp_int64 = (int64_t) __tmp.v; \ + break; \ + } \ + case 2: \ + { \ + union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \ + __ctf_tmp_int64 = (int64_t) __tmp.v; \ + break; \ + } \ + case 4: \ + { \ + union { _type t; int32_t v; } __tmp = { (_type) (_src) }; \ + __ctf_tmp_int64 = (int64_t) __tmp.v; \ + break; \ + } \ + case 8: \ + { \ + union { _type t; int64_t v; } __tmp = { (_type) (_src) }; \ + __ctf_tmp_int64 = (int64_t) __tmp.v; \ + break; \ + } \ + default: \ + BUG_ON(1); \ + }; \ + memcpy(__stack_data, &__ctf_tmp_int64, sizeof(int64_t)); \ + } else { \ + uint64_t __ctf_tmp_uint64; \ + switch (sizeof(_type)) { \ + case 1: \ + { \ + union { _type t; uint8_t v; } __tmp = { (_type) (_src) }; \ + __ctf_tmp_uint64 = (uint64_t) __tmp.v; \ + break; \ + } \ + case 2: \ + { \ + union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \ + __ctf_tmp_uint64 = (uint64_t) __tmp.v; \ + break; \ + } \ + case 4: \ + { \ + union { _type t; uint32_t v; } __tmp = { (_type) (_src) }; \ + __ctf_tmp_uint64 = (uint64_t) __tmp.v; \ + break; \ + } \ + case 8: \ + { \ + union { _type t; uint64_t v; } __tmp = { (_type) (_src) }; \ + __ctf_tmp_uint64 = (uint64_t) __tmp.v; \ + break; \ + } \ + default: \ + BUG_ON(1); \ + }; \ + memcpy(__stack_data, &__ctf_tmp_uint64, sizeof(uint64_t)); \ + } \ + __stack_data += sizeof(int64_t); + +#undef _ctf_integer_ext_isuser0 +#define _ctf_integer_ext_isuser0(_type, _item, _src, _byte_order, _base, _nowrite) \ + _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) + +#undef _ctf_integer_ext_isuser1 +#define _ctf_integer_ext_isuser1(_type, _item, _user_src, _byte_order, _base, _nowrite) \ +{ \ + __typeof__(_user_src) _src; \ + if (get_user(_src, &(_user_src))) \ + _src = 0; \ + _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \ +} -#undef __string_from_user -#define __string_from_user(_item, _src) +#undef _ctf_integer_ext +#define _ctf_integer_ext(_type, _item, _user_src, _byte_order, _base, _user, _nowrite) \ + _ctf_integer_ext_isuser##_user(_type, _item, _user_src, _byte_order, _base, _nowrite) + +#undef _ctf_array_encoded +#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \ + { \ + unsigned long __ctf_tmp_ulong = (unsigned long) (_length); \ + const void *__ctf_tmp_ptr = (_src); \ + memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \ + __stack_data += sizeof(unsigned long); \ + memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void **)); \ + __stack_data += sizeof(void **); \ + } + +#undef _ctf_sequence_encoded +#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \ + _src_length, _encoding, _base, _user, _nowrite) \ + { \ + unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \ + const void *__ctf_tmp_ptr = (_src); \ + memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \ + __stack_data += sizeof(unsigned long); \ + memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void **)); \ + __stack_data += sizeof(void **); \ + } + +#undef _ctf_string +#define _ctf_string(_item, _src, _user, _nowrite) \ + { \ + const void *__ctf_tmp_ptr = (_src); \ + memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void **)); \ + __stack_data += sizeof(void **); \ + } #undef TP_PROTO -#define TP_PROTO(args...) args +#define TP_PROTO(...) __VA_ARGS__ -#undef TP_STRUCT__entry -#define TP_STRUCT__entry(args...) args +#undef TP_FIELDS +#define TP_FIELDS(...) __VA_ARGS__ #undef TP_locvar #define TP_locvar(...) __VA_ARGS__ -#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _tstruct, _assign, _print) \ -static inline size_t __event_get_align__##_name(void *__tp_locvar, _proto) \ +#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _fields) \ +static inline \ +void __event_prepare_filter_stack__##_name(char *__stack_data, \ + void *__tp_locvar) \ { \ - size_t __event_align = 1; \ struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \ \ - _tstruct \ - return __event_align; \ + _fields \ } -#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _tstruct, _assign, _print) \ -static inline size_t __event_get_align__##_name(void *__tp_locvar) \ +#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _fields) \ +static inline \ +void __event_prepare_filter_stack__##_name(char *__stack_data, \ + void *__tp_locvar, _proto) \ { \ - size_t __event_align = 1; \ struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \ \ - _tstruct \ - return __event_align; \ + _fields \ } #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) /* - * Stage 8 of the trace events. + * Stage 5 of the trace events. * - * Create structure declaration that allows the "assign" macros to access the - * field types. + * Create static inline function that calculates event payload alignment. */ -#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ +/* Reset all macros within TRACEPOINT_EVENT */ +#include "lttng-events-reset.h" +#include "lttng-events-write.h" -/* Named field types must be defined in lttng-types.h */ +#undef _ctf_integer_ext +#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \ + __event_align = max_t(size_t, __event_align, lttng_alignof(_type)); -#undef __field_full -#define __field_full(_type, _item, _order, _base) _type _item; +#undef _ctf_array_encoded +#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \ + __event_align = max_t(size_t, __event_align, lttng_alignof(_type)); -#undef __array_enc_ext -#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding) \ - _type _item; +#undef _ctf_sequence_encoded +#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \ + _src_length, _encoding, _base, _user, _nowrite) \ + __event_align = max_t(size_t, __event_align, lttng_alignof(_length_type)); \ + __event_align = max_t(size_t, __event_align, lttng_alignof(_type)); -#undef __dynamic_array_enc_ext -#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ - _type _item; +#undef _ctf_string +#define _ctf_string(_item, _src, _user, _nowrite) -#undef __dynamic_array_enc_ext_2 -#define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding)\ - __dynamic_array_enc_ext(_type, _item, _length1 + _length2, _order, _base, _encoding) +#undef TP_PROTO +#define TP_PROTO(...) __VA_ARGS__ -#undef __string -#define __string(_item, _src) char _item; +#undef TP_FIELDS +#define TP_FIELDS(...) __VA_ARGS__ -#undef __string_from_user -#define __string_from_user(_item, _src) \ - __string(_item, _src) +#undef TP_locvar +#define TP_locvar(...) __VA_ARGS__ -#undef TP_STRUCT__entry -#define TP_STRUCT__entry(args...) args +#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _fields) \ +static inline size_t __event_get_align__##_name(void *__tp_locvar, _proto) \ +{ \ + size_t __event_align = 1; \ + struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \ + \ + _fields \ + return __event_align; \ +} #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _tstruct, _assign, _print) \ -struct __event_typemap__##_name { \ - _tstruct \ -}; - -#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _tstruct, _assign, _print) \ - LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _tstruct, _assign, _print) +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _fields) \ +static inline size_t __event_get_align__##_name(void *__tp_locvar) \ +{ \ + size_t __event_align = 1; \ + struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \ + \ + _fields \ + return __event_align; \ +} #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) - /* - * Stage 9 of the trace events. - * - * Create the probe function : call even size calculation and write event data - * into the buffer. + * Stage 6 of tracepoint event generation. * - * We use both the field and assignment macros to write the fields in the order - * defined in the field declaration. The field declarations control the - * execution order, jumping to the appropriate assignment block. + * Create the probe function. This function calls event size calculation + * and writes event data into the buffer. */ -#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ - -#undef __field_full -#define __field_full(_type, _item, _order, _base) \ - goto __assign_##_item; \ -__end_field_##_item: - -#undef __array_enc_ext -#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ - goto __assign_##_item; \ -__end_field_##_item: - -#undef __dynamic_array_enc_ext -#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ - goto __assign_##_item##_1; \ -__end_field_##_item##_1: \ - goto __assign_##_item##_2; \ -__end_field_##_item##_2: - -#undef __dynamic_array_enc_ext_2 -#define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding)\ - goto __assign_##_item##_1; \ -__end_field_##_item##_1: \ - goto __assign_##_item##_2; \ -__end_field_##_item##_2: \ - goto __assign_##_item##_3; \ -__end_field_##_item##_3: - -#undef __string -#define __string(_item, _src) \ - goto __assign_##_item; \ -__end_field_##_item: - -#undef __string_from_user -#define __string_from_user(_item, _src) \ - __string(_item, _src) +/* Reset all macros within TRACEPOINT_EVENT */ +#include "lttng-events-reset.h" +#include "lttng-events-write.h" -/* - * Macros mapping tp_assign() to "=", tp_memcpy() to memcpy() and tp_strcpy() to - * strcpy(). - */ -#undef tp_assign -#define tp_assign(dest, src) \ -__assign_##dest: \ +#undef _ctf_integer_ext_fetched +#define _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \ { \ - __typeof__(__typemap.dest) __tmp = (src); \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp)); \ + _type __tmp = _src; \ + lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\ __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\ - } \ - goto __end_field_##dest; - -/* fixed length array memcpy */ -#undef tp_memcpy_gen -#define tp_memcpy_gen(write_ops, dest, src, len) \ -__assign_##dest: \ - if (0) \ - (void) __typemap.dest; \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ - __chan->ops->write_ops(&__ctx, src, len); \ - goto __end_field_##dest; - -#undef tp_memcpy -#define tp_memcpy(dest, src, len) \ - tp_memcpy_gen(event_write, dest, src, len) - -#undef tp_memcpy_from_user -#define tp_memcpy_from_user(dest, src, len) \ - tp_memcpy_gen(event_write_from_user, dest, src, len) - -/* variable length sequence memcpy */ -#undef tp_memcpy_dyn_gen -#define tp_memcpy_dyn_gen(write_ops, dest, src) \ -__assign_##dest##_1: \ - { \ - u32 __tmpl = __dynamic_len[__dynamic_len_idx]; \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(u32)); \ - __chan->ops->event_write(&__ctx, &__tmpl, sizeof(u32)); \ - } \ - goto __end_field_##dest##_1; \ -__assign_##dest##_2: \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ - __chan->ops->write_ops(&__ctx, src, \ - sizeof(__typemap.dest) * __get_dynamic_array_len(dest));\ - goto __end_field_##dest##_2; - -#undef tp_memcpy_dyn_gen_2 -#define tp_memcpy_dyn_gen_2(write_ops, dest, src1, src2) \ -__assign_##dest##_1: \ + } + +#undef _ctf_integer_ext_isuser0 +#define _ctf_integer_ext_isuser0(_type, _item, _src, _byte_order, _base, _nowrite) \ + _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) + +#undef _ctf_integer_ext_isuser1 +#define _ctf_integer_ext_isuser1(_type, _item, _user_src, _byte_order, _base, _nowrite) \ +{ \ + __typeof__(_user_src) _src; \ + if (get_user(_src, &(_user_src))) \ + _src = 0; \ + _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \ +} + +#undef _ctf_integer_ext +#define _ctf_integer_ext(_type, _item, _user_src, _byte_order, _base, _user, _nowrite) \ + _ctf_integer_ext_isuser##_user(_type, _item, _user_src, _byte_order, _base, _nowrite) + +#undef _ctf_array_encoded +#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \ + lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \ + if (_user) { \ + __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length)); \ + } else { \ + __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \ + } + +#undef _ctf_sequence_encoded +#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \ + _src_length, _encoding, _base, _user, _nowrite) \ { \ - u32 __tmpl = __dynamic_len[__dynamic_len_idx] \ - + __dynamic_len[__dynamic_len_idx + 1]; \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(u32)); \ - __chan->ops->event_write(&__ctx, &__tmpl, sizeof(u32)); \ + _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \ + lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\ + __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\ } \ - goto __end_field_##dest##_1; \ -__assign_##dest##_2: \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ - __chan->ops->write_ops(&__ctx, src1, \ - sizeof(__typemap.dest) * __get_dynamic_array_len(dest));\ - goto __end_field_##dest##_2; \ -__assign_##dest##_3: \ - __chan->ops->write_ops(&__ctx, src2, \ - sizeof(__typemap.dest) * __get_dynamic_array_len(dest));\ - goto __end_field_##dest##_3; - -#undef tp_memcpy_dyn -#define tp_memcpy_dyn(dest, src) \ - tp_memcpy_dyn_gen(event_write, dest, src) - -#undef tp_memcpy_dyn_2 -#define tp_memcpy_dyn_2(dest, src1, src2) \ - tp_memcpy_dyn_gen_2(event_write, dest, src1, src2) - -#undef tp_memcpy_dyn_from_user -#define tp_memcpy_dyn_from_user(dest, src) \ - tp_memcpy_dyn_gen(event_write_from_user, dest, src) - -/* - * The string length including the final \0. - */ -#undef tp_copy_string_from_user -#define tp_copy_string_from_user(dest, src) \ -__assign_##dest: \ - if (0) \ - (void) __typemap.dest; \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ - __chan->ops->event_strcpy_from_user(&__ctx, src, \ - __get_dynamic_array_len(dest)); \ - goto __end_field_##dest; - -#undef tp_strcpy -#define tp_strcpy(dest, src) \ -__assign_##dest: \ - if (0) \ - (void) __typemap.dest; \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ - __chan->ops->event_strcpy(&__ctx, src, __get_dynamic_array_len(dest)); \ - goto __end_field_##dest; - -/* Named field types must be defined in lttng-types.h */ - -#undef __get_str -#define __get_str(field) field - -#undef __get_dynamic_array -#define __get_dynamic_array(field) field + lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \ + if (_user) { \ + __chan->ops->event_write_from_user(&__ctx, _src, \ + sizeof(_type) * __get_dynamic_len(dest)); \ + } else { \ + __chan->ops->event_write(&__ctx, _src, \ + sizeof(_type) * __get_dynamic_len(dest)); \ + } + +#undef _ctf_string +#define _ctf_string(_item, _src, _user, _nowrite) \ + lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \ + if (_user) { \ + __chan->ops->event_strcpy_from_user(&__ctx, _src, \ + __get_dynamic_len(dest)); \ + } else { \ + __chan->ops->event_strcpy(&__ctx, _src, \ + __get_dynamic_len(dest)); \ + } /* Beware: this get len actually consumes the len value */ -#undef __get_dynamic_array_len -#define __get_dynamic_array_len(field) __dynamic_len[__dynamic_len_idx++] +#undef __get_dynamic_len +#define __get_dynamic_len(field) __stackvar.__dynamic_len[__dynamic_len_idx++] #undef TP_PROTO -#define TP_PROTO(args...) args +#define TP_PROTO(...) __VA_ARGS__ #undef TP_ARGS -#define TP_ARGS(args...) args +#define TP_ARGS(...) __VA_ARGS__ -#undef TP_STRUCT__entry -#define TP_STRUCT__entry(args...) args - -#undef TP_fast_assign -#define TP_fast_assign(args...) args +#undef TP_FIELDS +#define TP_FIELDS(...) __VA_ARGS__ #undef TP_locvar #define TP_locvar(...) __VA_ARGS__ @@ -830,12 +659,14 @@ __assign_##dest: \ #endif /* TP_SESSION_CHECK */ /* - * __dynamic_len array length is twice the number of fields due to - * __dynamic_array_enc_ext_2() and tp_memcpy_dyn_2(), which are the - * worse case, needing 2 entries per field. + * Using twice size for filter stack data to hold size and pointer for + * each field (worse case). For integers, max size required is 64-bit. + * Same for double-precision floats. Those fit within + * 2*sizeof(unsigned long) for all supported architectures. + * Perform UNION (||) of filter runtime list. */ #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _tstruct, _assign, _print) \ +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _fields) \ static void __event_probe__##_name(void *__data, _proto) \ { \ struct probe_local_vars { _locvar }; \ @@ -845,8 +676,10 @@ static void __event_probe__##_name(void *__data, _proto) \ struct lib_ring_buffer_ctx __ctx; \ size_t __event_len, __event_align; \ size_t __dynamic_len_idx __attribute__((unused)) = 0; \ - size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)] __attribute__((unused)); \ - struct __event_typemap__##_name __typemap __attribute__((unused)); \ + union { \ + size_t __dynamic_len[ARRAY_SIZE(__event_fields___##_name)]; \ + char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \ + } __stackvar; \ int __ret; \ struct probe_local_vars __tp_locvar; \ struct probe_local_vars *tp_locvar __attribute__((unused)) = \ @@ -865,24 +698,34 @@ static void __event_probe__##_name(void *__data, _proto) \ if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->pid))) \ return; \ _code \ - __event_len = __event_get_size__##_name(__dynamic_len, tp_locvar, \ - _args); \ + if (unlikely(!list_empty(&__event->bytecode_runtime_head))) { \ + struct lttng_bytecode_runtime *bc_runtime; \ + int __filter_record = __event->has_enablers_without_bytecode; \ + \ + __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \ + tp_locvar, _args); \ + list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \ + if (unlikely(bc_runtime->filter(bc_runtime, \ + __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \ + __filter_record = 1; \ + } \ + if (likely(!__filter_record)) \ + return; \ + } \ + __event_len = __event_get_size__##_name(__stackvar.__dynamic_len, \ + tp_locvar, _args); \ __event_align = __event_get_align__##_name(tp_locvar, _args); \ lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \ __event_align, -1); \ __ret = __chan->ops->event_reserve(&__ctx, __event->id); \ if (__ret < 0) \ return; \ - /* Control code (field ordering) */ \ - _tstruct \ + _fields \ __chan->ops->event_commit(&__ctx); \ - return; \ - /* Copy code, steered by control code */ \ - _assign \ } #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _tstruct, _assign, _print) \ +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _fields) \ static void __event_probe__##_name(void *__data) \ { \ struct probe_local_vars { _locvar }; \ @@ -892,8 +735,10 @@ static void __event_probe__##_name(void *__data) \ struct lib_ring_buffer_ctx __ctx; \ size_t __event_len, __event_align; \ size_t __dynamic_len_idx __attribute__((unused)) = 0; \ - size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)] __attribute__((unused)); \ - struct __event_typemap__##_name __typemap __attribute__((unused)); \ + union { \ + size_t __dynamic_len[ARRAY_SIZE(__event_fields___##_name)]; \ + char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \ + } __stackvar; \ int __ret; \ struct probe_local_vars __tp_locvar; \ struct probe_local_vars *tp_locvar __attribute__((unused)) = \ @@ -912,30 +757,121 @@ static void __event_probe__##_name(void *__data) \ if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->pid))) \ return; \ _code \ - __event_len = __event_get_size__##_name(__dynamic_len, tp_locvar); \ + if (unlikely(!list_empty(&__event->bytecode_runtime_head))) { \ + struct lttng_bytecode_runtime *bc_runtime; \ + int __filter_record = __event->has_enablers_without_bytecode; \ + \ + __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \ + tp_locvar); \ + list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \ + if (unlikely(bc_runtime->filter(bc_runtime, \ + __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \ + __filter_record = 1; \ + } \ + if (likely(!__filter_record)) \ + return; \ + } \ + __event_len = __event_get_size__##_name(__stackvar.__dynamic_len, tp_locvar); \ __event_align = __event_get_align__##_name(tp_locvar); \ lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \ __event_align, -1); \ __ret = __chan->ops->event_reserve(&__ctx, __event->id); \ if (__ret < 0) \ return; \ - /* Control code (field ordering) */ \ - _tstruct \ + _fields \ __chan->ops->event_commit(&__ctx); \ - return; \ - /* Copy code, steered by control code */ \ - _assign \ } #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) +#undef __get_dynamic_len + +/* + * Stage 7 of the trace events. + * + * Create event descriptions. + */ + +/* Named field types must be defined in lttng-types.h */ + +#include "lttng-events-reset.h" /* Reset all macros within LTTNG_TRACEPOINT_EVENT */ + +#ifndef TP_PROBE_CB +#define TP_PROBE_CB(_template) &__event_probe__##_template +#endif + +#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS +#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \ +static const struct lttng_event_desc __event_desc___##_map = { \ + .fields = __event_fields___##_template, \ + .name = #_map, \ + .kname = #_name, \ + .probe_callback = (void *) TP_PROBE_CB(_template), \ + .nr_fields = ARRAY_SIZE(__event_fields___##_template), \ + .owner = THIS_MODULE, \ +}; + +#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP +#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \ + LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) + +#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) + +/* + * Stage 8 of the trace events. + * + * Create an array of event description pointers. + */ + +#include "lttng-events-reset.h" /* Reset all macros within LTTNG_TRACEPOINT_EVENT */ + +#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS +#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \ + &__event_desc___##_map, + +#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP +#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \ + LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) + +#define TP_ID1(_token, _system) _token##_system +#define TP_ID(_token, _system) TP_ID1(_token, _system) + +static const struct lttng_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = { +#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) +}; + +#undef TP_ID1 +#undef TP_ID + +/* + * Stage 9 of the trace events. + * + * Create a toplevel descriptor for the whole probe. + */ + +#define TP_ID1(_token, _system) _token##_system +#define TP_ID(_token, _system) TP_ID1(_token, _system) + +/* non-const because list head will be modified when registered. */ +static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = { + .provider = __stringify(TRACE_SYSTEM), + .event_desc = TP_ID(__event_desc___, TRACE_SYSTEM), + .nr_events = ARRAY_SIZE(TP_ID(__event_desc___, TRACE_SYSTEM)), + .head = { NULL, NULL }, + .lazy_init_head = { NULL, NULL }, + .lazy = 0, +}; + +#undef TP_ID1 +#undef TP_ID + /* * Stage 10 of the trace events. * * Register/unregister probes at module load/unload. */ -#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ +#include "lttng-events-reset.h" /* Reset all macros within LTTNG_TRACEPOINT_EVENT */ #define TP_ID1(_token, _system) _token##_system #define TP_ID(_token, _system) TP_ID1(_token, _system) diff --git a/probes/lttng-probe-user.c b/probes/lttng-probe-user.c index d0b5cf29..dc6cca1b 100644 --- a/probes/lttng-probe-user.c +++ b/probes/lttng-probe-user.c @@ -38,6 +38,10 @@ long lttng_strlen_user_inatomic(const char *addr) char v; unsigned long ret; + if (unlikely(!access_ok(VERIFY_READ, + (__force const char __user *) addr, + sizeof(v)))) + break; ret = __copy_from_user_inatomic(&v, (__force const char __user *)(addr), sizeof(v)); @@ -52,3 +56,4 @@ long lttng_strlen_user_inatomic(const char *addr) set_fs(old_fs); return count; } +EXPORT_SYMBOL_GPL(lttng_strlen_user_inatomic); diff --git a/probes/lttng-tracepoint-event.h b/probes/lttng-tracepoint-event.h index c7b70ac8..39c0f371 100644 --- a/probes/lttng-tracepoint-event.h +++ b/probes/lttng-tracepoint-event.h @@ -35,39 +35,25 @@ #define _LTTNG_INSTRUMENTATION(...) #endif -#define LTTNG_TRACEPOINT_EVENT(name, proto, args, struct, assign, print) \ +#define LTTNG_TRACEPOINT_EVENT(name, proto, args, fields) \ _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) -#define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code, tstruct, assign, print) \ +#define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code, fields) \ _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) -#define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, tstruct, assign, print) \ +#define LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, map, proto, args, _locvar, _code, fields) \ _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) -#define LTTNG_TRACEPOINT_EVENT_FN(name, proto, args, struct, assign, print, reg, unreg) \ +#define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, fields) \ _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) -#define LTTNG_TRACEPOINT_EVENT_FN_MAP(name, map, proto, args, tstruct, assign, print, reg, unreg) \ - _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) -#define LTTNG_TRACEPOINT_EVENT_CONDITION(name, proto, args, cond, struct, assign, print) \ - _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) -#define LTTNG_TRACEPOINT_EVENT_CONDITION_MAP(name, map, proto, args, cond, struct, assign, print) \ - _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) -#define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, struct, assign, print) \ +#define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, fields) \ _LTTNG_INSTRUMENTATION(DECLARE_TRACE_NOARGS(name)) -#define LTTNG_TRACEPOINT_EVENT_CLASS(name, proto, args, tstruct, assign, print) -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _tstruct, _assign, _print) -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _tstruct, _assign, _print) +#define LTTNG_TRACEPOINT_EVENT_CLASS(name, proto, args, fields) +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _fields) +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _fields) #define LTTNG_TRACEPOINT_EVENT_INSTANCE(template, name, proto, args) \ _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) #define LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(template, name) \ _LTTNG_INSTRUMENTATION(DECLARE_TRACE_NOARGS(name)) -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT(template, name, proto, args, print) \ - _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP(template, name, map, proto, args, print) \ - _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION(template, name, proto, args, cond) \ - _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) -#define LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION_MAP(template, name, map, proto, args, cond) \ - _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \ _LTTNG_INSTRUMENTATION(DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))) #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \ -- 2.34.1