diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..7839355a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +.gitattributes export-ignore +.gitignore export-ignore +.gitreview export-ignore diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h index e5470400..cdf0609f 100644 --- a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h +++ b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h @@ -163,7 +163,25 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_prepare_zap_page, TP_ARGS(sp) ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) + +LTTNG_TRACEPOINT_EVENT_MAP( + mark_mmio_spte, + + kvm_mmu_mark_mmio_spte, + + TP_PROTO(u64 *sptep, gfn_t gfn, u64 spte), + TP_ARGS(sptep, gfn, spte), + + TP_FIELDS( + ctf_integer_hex(void *, sptep, sptep) + ctf_integer(gfn_t, gfn, gfn) + ctf_integer(unsigned, access, spte & ACC_ALL) + ctf_integer(unsigned int, gen, get_mmio_spte_generation(spte)) + ) +) + +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) LTTNG_TRACEPOINT_EVENT_MAP( mark_mmio_spte, @@ -215,7 +233,27 @@ LTTNG_TRACEPOINT_EVENT_MAP( ) ) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) || \ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) +LTTNG_TRACEPOINT_EVENT_MAP( + fast_page_fault, + + kvm_mmu_fast_page_fault, + + TP_PROTO(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, u32 error_code, + u64 *sptep, u64 old_spte, int ret), + TP_ARGS(vcpu, cr2_or_gpa, error_code, sptep, old_spte, ret), + + TP_FIELDS( + ctf_integer(int, vcpu_id, vcpu->vcpu_id) + ctf_integer(gpa_t, cr2_or_gpa, cr2_or_gpa) + ctf_integer(u32, error_code, error_code) + ctf_integer_hex(u64 *, sptep, sptep) + ctf_integer(u64, old_spte, old_spte) + ctf_integer(u64, new_spte, *sptep) + ctf_integer(int, ret, ret) + ) +) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) || \ LTTNG_KERNEL_RANGE(4,19,103, 4,20,0) || \ LTTNG_KERNEL_RANGE(5,4,19, 5,5,0) || \ LTTNG_KERNEL_RANGE(5,5,3, 5,6,0) || \ diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/trace.h b/instrumentation/events/lttng-module/arch/x86/kvm/trace.h index 4416ae02..0917b51f 100644 --- a/instrumentation/events/lttng-module/arch/x86/kvm/trace.h +++ b/instrumentation/events/lttng-module/arch/x86/kvm/trace.h @@ -115,6 +115,37 @@ LTTNG_TRACEPOINT_EVENT_MAP(kvm_apic, kvm_x86_apic, /* * Tracepoint for kvm guest exit: */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) +LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit, + TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa), + TP_ARGS(exit_reason, vcpu, isa), + + TP_locvar( + u64 info1, info2; + u32 intr_info, error_code; + ), + + TP_code_pre( + kvm_x86_ops.get_exit_info(vcpu, &tp_locvar->info1, + &tp_locvar->info2, + &tp_locvar->intr_info, + &tp_locvar->error_code); + ), + + 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) + ctf_integer(u32, intr_info, tp_locvar->intr_info) + ctf_integer(u32, error_code, tp_locvar->error_code) + ctf_integer(unsigned int, vcpu_id, vcpu->vcpu_id) + ), + + TP_code_post() +) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit, TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa), TP_ARGS(exit_reason, vcpu, isa), @@ -124,13 +155,32 @@ LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit, ), TP_code_pre( -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) kvm_x86_ops.get_exit_info(vcpu, &tp_locvar->info1, &tp_locvar->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) + ), + + TP_code_post() +) #else +LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_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_code_pre( kvm_x86_ops->get_exit_info(vcpu, &tp_locvar->info1, &tp_locvar->info2); -#endif ), TP_FIELDS( @@ -143,6 +193,7 @@ LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit, TP_code_post() ) +#endif /* * Tracepoint for kvm interrupt injection: diff --git a/instrumentation/events/lttng-module/btrfs.h b/instrumentation/events/lttng-module/btrfs.h index 7b290085..efe7af96 100644 --- a/instrumentation/events/lttng-module/btrfs.h +++ b/instrumentation/events/lttng-module/btrfs.h @@ -346,7 +346,29 @@ LTTNG_TRACEPOINT_EVENT(btrfs_handle_em_exist, ) #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) +LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent, + + TP_PROTO(const struct btrfs_inode *inode, + const struct btrfs_ordered_extent *ordered), + + TP_ARGS(inode, ordered), + + TP_FIELDS( + ctf_array(u8, fsid, inode->root->lttng_fs_info_fsid, BTRFS_UUID_SIZE) + ctf_integer(ino_t, ino, btrfs_ino(inode)) + ctf_integer(u64, file_offset, ordered->file_offset) + ctf_integer(u64, start, ordered->disk_bytenr) + ctf_integer(u64, len, ordered->num_bytes) + ctf_integer(u64, disk_len, ordered->disk_num_bytes) + 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, refcount_read(&ordered->refs)) + ctf_integer(u64, root_objectid, inode->root->root_key.objectid) + ) +) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent, TP_PROTO(const struct inode *inode, @@ -458,7 +480,39 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent, ) #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add, + + TP_PROTO(const struct btrfs_inode *inode, + const struct btrfs_ordered_extent *ordered), + + TP_ARGS(inode, ordered) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove, + + TP_PROTO(const struct btrfs_inode *inode, + const struct btrfs_ordered_extent *ordered), + + TP_ARGS(inode, ordered) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start, + + TP_PROTO(const struct btrfs_inode *inode, + const struct btrfs_ordered_extent *ordered), + + TP_ARGS(inode, ordered) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put, + + TP_PROTO(const struct btrfs_inode *inode, + const struct btrfs_ordered_extent *ordered), + + TP_ARGS(inode, ordered) +) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \ LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \ LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \ LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \ @@ -494,7 +548,41 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put, TP_ARGS(inode, ordered) ) +#else +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add, + + TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), + + TP_ARGS(inode, ordered) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove, + + TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), + TP_ARGS(inode, ordered) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start, + + TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), + + TP_ARGS(inode, ordered) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put, + + TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), + + TP_ARGS(inode, ordered) +) +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \ + LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \ + LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \ + LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \ + LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0)) LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__writepage, TP_PROTO(const struct page *page, const struct inode *inode, @@ -563,34 +651,6 @@ LTTNG_TRACEPOINT_EVENT(btrfs_sync_file, ) ) #else -LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add, - - TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), - - TP_ARGS(inode, ordered) -) - -LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove, - - TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), - - TP_ARGS(inode, ordered) -) - -LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start, - - TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), - - TP_ARGS(inode, ordered) -) - -LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put, - - TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), - - TP_ARGS(inode, ordered) -) - LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__writepage, TP_PROTO(struct page *page, struct inode *inode, @@ -1856,7 +1916,48 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent, btrfs_reserved_extent_f #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0) || \ + LTTNG_KERNEL_RANGE(5,9,5, 5,10,0) || \ + LTTNG_KERNEL_RANGE(5,4,78, 5,5,0)) +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, + + btrfs_find_free_extent, + + TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size, + u64 data), + + TP_ARGS(root, num_bytes, empty_size, data), + + TP_FIELDS( + ctf_array(u8, fsid, root->lttng_fs_info_fsid, BTRFS_UUID_SIZE) + 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) + ) +) + +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)) + +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, + + btrfs_find_free_extent, + + TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, + u64 data), + + TP_ARGS(fs_info, num_bytes, empty_size, data), + + TP_FIELDS( + ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE) + ctf_integer(u64, num_bytes, num_bytes) + ctf_integer(u64, empty_size, empty_size) + ctf_integer(u64, data, data) + ) +) + +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0)) + LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, btrfs_find_free_extent, @@ -1874,6 +1975,86 @@ LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, ) ) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) + +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, + + btrfs_find_free_extent, + + TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, + u64 data), + + TP_ARGS(fs_info, num_bytes, empty_size, data), + + TP_FIELDS( + ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE) + ctf_integer(u64, num_bytes, num_bytes) + ctf_integer(u64, empty_size, empty_size) + ctf_integer(u64, data, data) + ) +) + +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) + +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, + + btrfs_find_free_extent, + + TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, + u64 data), + + TP_ARGS(fs_info, num_bytes, empty_size, data), + + TP_FIELDS( + ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE) + ctf_integer(u64, num_bytes, num_bytes) + ctf_integer(u64, empty_size, empty_size) + ctf_integer(u64, data, data) + ) +) + +#elif (LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \ + LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \ + LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \ + LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0)) + +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, + + btrfs_find_free_extent, + + TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size, + u64 data), + + TP_ARGS(root, num_bytes, empty_size, data), + + 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) + ) +) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) + +LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, + + btrfs_find_free_extent, + + TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size, + u64 data), + + TP_ARGS(root, num_bytes, empty_size, data), + + 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) + ) +) +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)) LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent, TP_PROTO(const struct btrfs_block_group *block_group, u64 start, @@ -1907,22 +2088,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus ) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0)) -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, - - btrfs_find_free_extent, - - TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, - u64 data), - - TP_ARGS(fs_info, num_bytes, empty_size, data), - - TP_FIELDS( - ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE) - 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, @@ -1957,22 +2122,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus ) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, - - btrfs_find_free_extent, - - TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, - u64 data), - - TP_ARGS(fs_info, num_bytes, empty_size, data), - - TP_FIELDS( - ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE) - 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, @@ -2011,23 +2160,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, - - btrfs_find_free_extent, - - TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, - u64 data), - - TP_ARGS(fs_info, num_bytes, empty_size, data), - - TP_FIELDS( - ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE) - 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, TP_PROTO(struct btrfs_fs_info *fs_info, @@ -2066,23 +2198,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \ LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0)) -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, - - btrfs_find_free_extent, - - TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size, - u64 data), - - TP_ARGS(root, num_bytes, empty_size, data), - - 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, TP_PROTO(const struct btrfs_root *root, @@ -2120,23 +2235,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) -LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent, - - btrfs_find_free_extent, - - TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size, - u64 data), - - TP_ARGS(root, num_bytes, empty_size, data), - - 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, TP_PROTO(struct btrfs_root *root, diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h index b172c8d9..6e74abad 100644 --- a/instrumentation/events/lttng-module/ext4.h +++ b/instrumentation/events/lttng-module/ext4.h @@ -1274,6 +1274,18 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_load_extent, ) ) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) +LTTNG_TRACEPOINT_EVENT(ext4_load_inode, + TP_PROTO(struct super_block *sb, unsigned long ino), + + TP_ARGS(sb, ino), + + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(ino_t, ino, ino) + ) +) +#else LTTNG_TRACEPOINT_EVENT(ext4_load_inode, TP_PROTO(struct inode *inode), @@ -1284,6 +1296,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_load_inode, ctf_integer(ino_t, ino, inode->i_ino) ) ) +#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)) @@ -1895,6 +1908,34 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_shrink_exit, #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) +LTTNG_TRACEPOINT_EVENT(ext4_fc_replay_scan, + TP_PROTO(struct super_block *sb, int error, int off), + + TP_ARGS(sb, error, off), + + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(int, error, error) + ctf_integer(int, off, off) + ) +) + +LTTNG_TRACEPOINT_EVENT(ext4_fc_replay, + TP_PROTO(struct super_block *sb, int tag, int ino, int priv1, int priv2), + + TP_ARGS(sb, tag, ino, priv1, priv2), + + TP_FIELDS( + ctf_integer(dev_t, dev, sb->s_dev) + ctf_integer(int, tag, tag) + ctf_integer(int, ino, ino) + ctf_integer(int, priv1, priv1) + ctf_integer(int, priv2, priv2) + ) +) +#endif + #endif /* LTTNG_TRACE_EXT4_H */ /* This part must be outside protection */ diff --git a/lttng-events.h b/lttng-events.h index d4d99766..e47c1478 100644 --- a/lttng-events.h +++ b/lttng-events.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/lttng-filter-interpreter.c b/lttng-filter-interpreter.c index 21169f01..5d572437 100644 --- a/lttng-filter-interpreter.c +++ b/lttng-filter-interpreter.c @@ -8,7 +8,7 @@ */ #include -#include +#include #include #include diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c index a6fa71a5..cf803a73 100644 --- a/lttng-statedump-impl.c +++ b/lttng-statedump-impl.c @@ -55,26 +55,94 @@ #define LTTNG_INSTRUMENTATION #include -DEFINE_TRACE(lttng_statedump_block_device); -DEFINE_TRACE(lttng_statedump_end); -DEFINE_TRACE(lttng_statedump_interrupt); -DEFINE_TRACE(lttng_statedump_file_descriptor); -DEFINE_TRACE(lttng_statedump_start); -DEFINE_TRACE(lttng_statedump_process_state); -DEFINE_TRACE(lttng_statedump_process_pid_ns); +LTTNG_DEFINE_TRACE(lttng_statedump_block_device, + TP_PROTO(struct lttng_session *session, + dev_t dev, const char *diskname), + TP_ARGS(session, dev, diskname)); + +LTTNG_DEFINE_TRACE(lttng_statedump_end, + TP_PROTO(struct lttng_session *session), + TP_ARGS(session)); + +LTTNG_DEFINE_TRACE(lttng_statedump_interrupt, + TP_PROTO(struct lttng_session *session, + unsigned int irq, const char *chip_name, + struct irqaction *action), + TP_ARGS(session, irq, chip_name, action)); + +LTTNG_DEFINE_TRACE(lttng_statedump_file_descriptor, + TP_PROTO(struct lttng_session *session, + struct files_struct *files, + int fd, const char *filename, + unsigned int flags, fmode_t fmode), + TP_ARGS(session, files, fd, filename, flags, fmode)); + +LTTNG_DEFINE_TRACE(lttng_statedump_start, + TP_PROTO(struct lttng_session *session), + TP_ARGS(session)); + +LTTNG_DEFINE_TRACE(lttng_statedump_process_state, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + int type, int mode, int submode, int status, + struct files_struct *files), + TP_ARGS(session, p, type, mode, submode, status, files)); + +LTTNG_DEFINE_TRACE(lttng_statedump_process_pid_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct pid_namespace *pid_ns), + TP_ARGS(session, p, pid_ns)); + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)) -DEFINE_TRACE(lttng_statedump_process_cgroup_ns); +LTTNG_DEFINE_TRACE(lttng_statedump_process_cgroup_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct cgroup_namespace *cgroup_ns), + TP_ARGS(session, p, cgroup_ns)); #endif -DEFINE_TRACE(lttng_statedump_process_ipc_ns); + +LTTNG_DEFINE_TRACE(lttng_statedump_process_ipc_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct ipc_namespace *ipc_ns), + TP_ARGS(session, p, ipc_ns)); + #ifndef LTTNG_MNT_NS_MISSING_HEADER -DEFINE_TRACE(lttng_statedump_process_mnt_ns); +LTTNG_DEFINE_TRACE(lttng_statedump_process_mnt_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct mnt_namespace *mnt_ns), + TP_ARGS(session, p, mnt_ns)); #endif -DEFINE_TRACE(lttng_statedump_process_net_ns); -DEFINE_TRACE(lttng_statedump_process_user_ns); -DEFINE_TRACE(lttng_statedump_process_uts_ns); -DEFINE_TRACE(lttng_statedump_network_interface); + +LTTNG_DEFINE_TRACE(lttng_statedump_process_net_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct net *net_ns), + TP_ARGS(session, p, net_ns)); + +LTTNG_DEFINE_TRACE(lttng_statedump_process_user_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct user_namespace *user_ns), + TP_ARGS(session, p, user_ns)); + +LTTNG_DEFINE_TRACE(lttng_statedump_process_uts_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct uts_namespace *uts_ns), + TP_ARGS(session, p, uts_ns)); + +LTTNG_DEFINE_TRACE(lttng_statedump_network_interface, + TP_PROTO(struct lttng_session *session, + struct net_device *dev, struct in_ifaddr *ifa), + TP_ARGS(session, dev, ifa)); + #ifdef LTTNG_HAVE_STATEDUMP_CPU_TOPOLOGY -DEFINE_TRACE(lttng_statedump_cpu_topology); +LTTNG_DEFINE_TRACE(lttng_statedump_cpu_topology, + TP_PROTO(struct lttng_session *session, struct cpuinfo_x86 *c), + TP_ARGS(session, c)); #endif struct lttng_fd_ctx { diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 49c0d81b..b43dd570 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -719,7 +719,7 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len, ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT; break; } - strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN); + strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN - 1); ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; ev.instrumentation = LTTNG_KERNEL_SYSCALL; chan_table[i] = _lttng_event_create(chan, &ev, filter, diff --git a/lttng-tracker-id.c b/lttng-tracker-id.c index 9a4b98b2..327ae346 100644 --- a/lttng-tracker-id.c +++ b/lttng-tracker-id.c @@ -75,6 +75,7 @@ int lttng_id_tracker_add(struct lttng_id_tracker *lf, int id) struct lttng_id_tracker_rcu *p = lf->p; uint32_t hash = hash_32(id, 32); bool allocated = false; + int ret; if (!p) { p = lttng_id_tracker_rcu_create(); @@ -84,18 +85,28 @@ int lttng_id_tracker_add(struct lttng_id_tracker *lf, int id) } head = &p->id_hash[hash & (LTTNG_ID_TABLE_SIZE - 1)]; lttng_hlist_for_each_entry(e, head, hlist) { - if (id == e->id) - return -EEXIST; + if (id == e->id) { + ret = -EEXIST; + goto error; + } } e = kmalloc(sizeof(struct lttng_id_hash_node), GFP_KERNEL); - if (!e) - return -ENOMEM; + if (!e) { + ret = -ENOMEM; + goto error; + } e->id = id; hlist_add_head_rcu(&e->hlist, head); if (allocated) { rcu_assign_pointer(lf->p, p); } return 0; + +error: + if (allocated) { + kfree(p); + } + return ret; } static diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c index 8f981865..5043c776 100644 --- a/probes/lttng-probe-kvm-x86-mmu.c +++ b/probes/lttng-probe-kvm-x86-mmu.c @@ -31,6 +31,11 @@ #include <../../arch/x86/kvm/mmutrace.h> #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) +#include <../arch/x86/kvm/mmu.h> +#include <../arch/x86/kvm/mmu/spte.h> +#endif + #undef TRACE_INCLUDE_PATH #undef TRACE_INCLUDE_FILE diff --git a/probes/lttng.c b/probes/lttng.c index 05bc1388..7ddaa69f 100644 --- a/probes/lttng.c +++ b/probes/lttng.c @@ -8,7 +8,7 @@ */ #include -#include +#include #include #include #include @@ -32,7 +32,10 @@ #define LTTNG_LOGGER_COUNT_MAX 1024 #define LTTNG_LOGGER_FILE "lttng-logger" -DEFINE_TRACE(lttng_logger); +LTTNG_DEFINE_TRACE(lttng_logger, + PARAMS(const char __user *text, size_t len), + PARAMS(text, len) +); static struct proc_dir_entry *lttng_logger_dentry; diff --git a/scripts/maintainer/do-release.sh b/scripts/maintainer/do-release.sh new file mode 100755 index 00000000..5e94e136 --- /dev/null +++ b/scripts/maintainer/do-release.sh @@ -0,0 +1,110 @@ +#!/bin/bash + +set -eu +set -o pipefail + +# invoke with do-release 2.N.M, or 2.N.M-rcXX + +# Default maintainer values +SRCDIR="${HOME}/git/lttng-modules" +# The output files are created in ${HOME}/stable/ +OUTPUTDIR="${HOME}/stable" +SIGN="yes" +VERBOSE="" + +usage() { + echo "Usage: do-release.sh [OPTION]... RELEASE" + echo + echo "Mandatory arguments to long options are mandatory for short options too." + echo " -s, --srcdir DIR source directory" + echo " -o, --outputdir DIR output directory, must exist" + echo " -n, --no-sign don't GPG sign the output archive" + echo " -v, --verbose verbose command output" +} + +POS_ARGS=() +while [[ $# -gt 0 ]] +do + arg="$1" + + case $arg in + -n|--no-sign) + SIGN="no" + shift 1 + ;; + + -s|--srcdir) + SRCDIR="$2" + shift 2 + ;; + + -o|--outputdir) + OUTPUTDIR="$2" + shift 2 + ;; + + -v|--verbose) + VERBOSE="-v" + shift 1 + ;; + + # Catch unknown arguments + -*) + usage + exit 1 + ;; + + *) + POS_ARGS+=("$1") + shift + ;; + esac +done +set -- "${POS_ARGS[@]}" + +REL=${1:-} + +if [ x"${REL}" = x"" ]; then + usage + exit 1; +fi + +echo "Doing LTTng modules release ${REL}" +echo " Source dir: ${SRCDIR}" +echo " Output dir: ${OUTPUTDIR}" +echo " GPG sign: ${SIGN}" + +# Make sure the output directory exists +if [ ! -d "${OUTPUTDIR}" ]; then + echo "Output directory '${OUTPUTDIR}' doesn't exist." + exit 1 +fi + +# Make sure the source directory is a git repository +if [ ! -r "${SRCDIR}/.git/config" ]; then + echo "Source directory '${SRCDIR}' isn't a git repository." + exit 1 +fi + +# Set the git repo directory for all further git commands +export GIT_DIR="${SRCDIR}/.git/" + +# Check if the release tag exists +if ! git rev-parse "refs/tags/v${REL}" >/dev/null 2>&1; then + echo "Release tag 'v${REL}' doesn't exist." + exit 1 +fi + +# Generate the compressed tar archive, the git attributes from the tag will be used. +git archive $VERBOSE --format=tar --prefix="lttng-modules-${REL}/" "v${REL}" | bzip2 > "${OUTPUTDIR}/lttng-modules-${REL}.tar.bz2" + +pushd "${OUTPUTDIR}" >/dev/null +# Generate the hashes +md5sum "lttng-modules-${REL}.tar.bz2" > "lttng-modules-${REL}.tar.bz2.md5" +sha256sum "lttng-modules-${REL}.tar.bz2" > "lttng-modules-${REL}.tar.bz2.sha256" + +if [ "x${SIGN}" = "xyes" ]; then + # Sign with the default key + gpg --armor -b "lttng-modules-${REL}.tar.bz2" +fi +popd >/dev/null diff --git a/tests/probes/lttng-test.c b/tests/probes/lttng-test.c index b450e7d7..a4fa0645 100644 --- a/tests/probes/lttng-test.c +++ b/tests/probes/lttng-test.c @@ -25,7 +25,12 @@ #define LTTNG_INSTRUMENTATION #include -DEFINE_TRACE(lttng_test_filter_event); +LTTNG_DEFINE_TRACE(lttng_test_filter_event, + PARAMS(int anint, int netint, long *values, + char *text, size_t textlen, + char *etext, uint32_t * net_values), + PARAMS(anint, netint, values, text, textlen, etext, net_values) +); #define LTTNG_TEST_FILTER_EVENT_FILE "lttng-test-filter-event" diff --git a/wrapper/frame.h b/wrapper/objtool.h similarity index 50% rename from wrapper/frame.h rename to wrapper/objtool.h index 6e6dc811..3b997cae 100644 --- a/wrapper/frame.h +++ b/wrapper/objtool.h @@ -1,18 +1,23 @@ -/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) * - * wrapper/frame.h + * wrapper/objtool.h * * Copyright (C) 2016 Mathieu Desnoyers */ -#ifndef _LTTNG_WRAPPER_FRAME_H -#define _LTTNG_WRAPPER_FRAME_H +#ifndef _LTTNG_WRAPPER_OBJTOOL_H +#define _LTTNG_WRAPPER_OBJTOOL_H #include -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)) - +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) +#include +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)) #include +#endif + + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)) #define LTTNG_STACK_FRAME_NON_STANDARD(func) \ STACK_FRAME_NON_STANDARD(func) @@ -23,4 +28,4 @@ #endif -#endif /* _LTTNG_WRAPPER_FRAME_H */ +#endif /* _LTTNG_WRAPPER_OBJTOOL_H */ diff --git a/wrapper/tracepoint.h b/wrapper/tracepoint.h index c4ba0123..bc19d8c1 100644 --- a/wrapper/tracepoint.h +++ b/wrapper/tracepoint.h @@ -14,6 +14,14 @@ #include #include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)) +#define LTTNG_DEFINE_TRACE(name, proto, args) \ + DEFINE_TRACE(name, PARAMS(proto), PARAMS(args)) +#else +#define LTTNG_DEFINE_TRACE(name, proto, args) \ + DEFINE_TRACE(name) +#endif + #ifndef HAVE_KABI_2635_TRACEPOINT #define kabi_2635_tracepoint_probe_register tracepoint_probe_register