diff -Nru lttng-modules-2.8.0/debian/changelog lttng-modules-2.8.0/debian/changelog --- lttng-modules-2.8.0/debian/changelog 2017-03-29 13:05:08.000000000 +0000 +++ lttng-modules-2.8.0/debian/changelog 2017-10-26 17:00:02.000000000 +0000 @@ -1,3 +1,28 @@ +lttng-modules (2.8.0-1ubuntu1~16.04.3) xenial; urgency=medium + + * Fix builds on HWE 4.13 kernel (LP: #1727251) + Apply the following upstream commits: + 0015-Fix-update-mm_vmscan-instrumentation-for-kernel-4.11.patch + 0016-Fix-update-btrfs-instrumentation-for-kernel-4.11.patch + 0017-Fix-changes-to-the-vm_op-fault-cb-prototype-in-libri.patch + 0018-Fix-update-scsi-instrumentation-for-kernel-4.11.patch + 0019-Fix-timers-cputime_t-arguments-replaced-by-ull-in-ke.patch + 0020-Fix-atomic_add_unless-returns-true-false-rather-than.patch + 0021-Fix-kref-changes-for-kernel-4.11.patch + 0022-Fix-update-sched-instrumentation-for-kernel-4.12.patch + 0023-Fix-update-ringbuffer-for-kernel-4.12.patch + 0024-Fix-update-block-instrumentation-for-kernel-4.12.patch + 0025-Fix-update-ftrace-probe-for-kernel-4.12.patch + 0026-Fix-Build-ftrace-probe-on-kernels-prior-to-4.12.patch + 0027-Fix-handle-missing-ftrace-header-on-v4.12.patch + 0028-Fix-section-mismatch-warning-caused-by-__exit-annota.patch + 0029-Fix-missing-ftrace-header-on-v4.11.patch + * Don't build ftrace lttng module for 4.11 upwards as this currently + requires the full kernel source and not just the headers anymore, + add kernel version check in lttng-modules-dkms.dkms.in + + -- Colin Ian King Thu, 26 Oct 2017 18:00:02 +0100 + lttng-modules (2.8.0-1ubuntu1~16.04.2) xenial; urgency=medium * Fix builds on HWE 4.10 kernel (LP: #1677126) diff -Nru lttng-modules-2.8.0/debian/lttng-modules-dkms.dkms.in lttng-modules-2.8.0/debian/lttng-modules-dkms.dkms.in --- lttng-modules-2.8.0/debian/lttng-modules-dkms.dkms.in 2016-05-25 01:38:38.000000000 +0000 +++ lttng-modules-2.8.0/debian/lttng-modules-dkms.dkms.in 2017-10-26 17:00:02.000000000 +0000 @@ -246,7 +246,9 @@ i=$((i+1)) fi -if [ "$KCONFIG" = "true" ] && [ -n "$CONFIG_DYNAMIC_FTRACE" ]; then +if [ "$KCONFIG" = "true" ] && [ -n "$CONFIG_DYNAMIC_FTRACE" ] && \ + ( [ "$VERSION" -lt 4 ] || \ + [ "$VERSION" -eq 4 -a "$PATCHLEVEL" -lt 11 ] ); then BUILT_MODULE_NAME[$i]="lttng-ftrace" BUILT_MODULE_LOCATION[$i]="probes/" DEST_MODULE_LOCATION[$i]="/extra/probes" diff -Nru lttng-modules-2.8.0/debian/patches/0015-Fix-update-mm_vmscan-instrumentation-for-kernel-4.11.patch lttng-modules-2.8.0/debian/patches/0015-Fix-update-mm_vmscan-instrumentation-for-kernel-4.11.patch --- lttng-modules-2.8.0/debian/patches/0015-Fix-update-mm_vmscan-instrumentation-for-kernel-4.11.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0015-Fix-update-mm_vmscan-instrumentation-for-kernel-4.11.patch 2017-10-26 15:58:55.000000000 +0000 @@ -0,0 +1,112 @@ +From 75833a88af5de44e7112af3ac7beb9a56f8e3037 Mon Sep 17 00:00:00 2001 +From: Francis Deslauriers +Date: Tue, 7 Mar 2017 09:48:08 -0500 +Subject: [PATCH] Fix: update mm_vmscan instrumentation for kernel 4.11 + +Signed-off-by: Francis Deslauriers +Signed-off-by: Mathieu Desnoyers +--- + instrumentation/events/lttng-module/mm_vmscan.h | 64 +++++++++++++++++++++++-- + 1 file changed, 59 insertions(+), 5 deletions(-) + +diff --git a/instrumentation/events/lttng-module/mm_vmscan.h b/instrumentation/events/lttng-module/mm_vmscan.h +index 36ebd5c..9845635 100644 +--- a/instrumentation/events/lttng-module/mm_vmscan.h ++++ b/instrumentation/events/lttng-module/mm_vmscan.h +@@ -281,8 +281,35 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end, + #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ + #endif + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_isolate, ++ ++ TP_PROTO(int classzone_idx, ++ int order, ++ unsigned long nr_requested, ++ unsigned long nr_scanned, ++ unsigned long nr_skipped, ++ unsigned long nr_taken, ++ isolate_mode_t isolate_mode, ++ int lru ++ ), ++ ++ TP_ARGS(classzone_idx, order, nr_requested, nr_scanned, nr_skipped, ++ nr_taken, isolate_mode, lru ++ ), + ++ TP_FIELDS( ++ ctf_integer(int, classzone_idx, classzone_idx) ++ 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_skipped, nr_skipped) ++ ctf_integer(unsigned long, nr_taken, nr_taken) ++ ctf_integer(isolate_mode_t, isolate_mode, isolate_mode) ++ ctf_integer(int, lru, lru) ++ ) ++) ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)) + LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_lru_isolate_template, + + TP_PROTO(int classzone_idx, +@@ -342,9 +369,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_ + isolate_mode, file + ) + ) +- + #else +- + LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_lru_isolate_template, + + TP_PROTO(int order, +@@ -455,7 +480,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_ + #endif + ) + ) +- + #endif + + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) +@@ -485,7 +509,37 @@ LTTNG_TRACEPOINT_EVENT(mm_vmscan_writepage, + ) + #endif + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive, ++ ++ TP_PROTO(int nid, ++ unsigned long nr_scanned, unsigned long nr_reclaimed, ++ unsigned long nr_dirty, unsigned long nr_writeback, ++ unsigned long nr_congested, unsigned long nr_immediate, ++ unsigned long nr_activate, unsigned long nr_ref_keep, ++ unsigned long nr_unmap_fail, ++ int priority, int file), ++ ++ TP_ARGS(nid, nr_scanned, nr_reclaimed, nr_dirty, nr_writeback, ++ nr_congested, nr_immediate, nr_activate, nr_ref_keep, ++ nr_unmap_fail, priority, file), ++ ++ TP_FIELDS( ++ ctf_integer(int, nid, nid) ++ ctf_integer(unsigned long, nr_scanned, nr_scanned) ++ ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) ++ ctf_integer(unsigned long, nr_dirty, nr_dirty) ++ ctf_integer(unsigned long, nr_writeback, nr_writeback) ++ ctf_integer(unsigned long, nr_congested, nr_congested) ++ ctf_integer(unsigned long, nr_immediate, nr_immediate) ++ ctf_integer(unsigned long, nr_activate, nr_activate) ++ ctf_integer(unsigned long, nr_ref_keep, nr_ref_keep) ++ ctf_integer(unsigned long, nr_unmap_fail, nr_unmap_fail) ++ ctf_integer(int, priority, priority) ++ ctf_integer(int, reclaim_flags, trace_shrink_flags(file)) ++ ) ++) ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)) + LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive, + + TP_PROTO(int nid, +-- +2.11.0 + diff -Nru lttng-modules-2.8.0/debian/patches/0016-Fix-update-btrfs-instrumentation-for-kernel-4.11.patch lttng-modules-2.8.0/debian/patches/0016-Fix-update-btrfs-instrumentation-for-kernel-4.11.patch --- lttng-modules-2.8.0/debian/patches/0016-Fix-update-btrfs-instrumentation-for-kernel-4.11.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0016-Fix-update-btrfs-instrumentation-for-kernel-4.11.patch 2017-10-26 16:02:56.000000000 +0000 @@ -0,0 +1,47 @@ +From e52717eabd3659a6d17ea977d253e437c047d83b Mon Sep 17 00:00:00 2001 +From: Francis Deslauriers +Date: Tue, 7 Mar 2017 10:14:19 -0500 +Subject: [PATCH] Fix: update btrfs instrumentation for kernel 4.11 + +Signed-off-by: Francis Deslauriers +Signed-off-by: Mathieu Desnoyers +--- + instrumentation/events/lttng-module/btrfs.h | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +Index: lttng-modules-2.8.0/instrumentation/events/lttng-module/btrfs.h +=================================================================== +--- lttng-modules-2.8.0.orig/instrumentation/events/lttng-module/btrfs.h ++++ lttng-modules-2.8.0/instrumentation/events/lttng-module/btrfs.h +@@ -368,7 +368,30 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref + ) + #endif + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++ ++LTTNG_TRACEPOINT_EVENT(btrfs_get_extent, ++ ++ TP_PROTO(struct btrfs_root *root, struct btrfs_inode *inode, ++ struct extent_map *map), ++ ++ TP_ARGS(root, inode, map), ++ ++ TP_FIELDS( ++ ctf_integer(u64, root_objectid, root->root_key.objectid) ++ ctf_integer(u64, ino, btrfs_ino(inode)) ++ 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) ++ ) ++) ++ ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) + + LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk, + diff -Nru lttng-modules-2.8.0/debian/patches/0017-Fix-changes-to-the-vm_op-fault-cb-prototype-in-libri.patch lttng-modules-2.8.0/debian/patches/0017-Fix-changes-to-the-vm_op-fault-cb-prototype-in-libri.patch --- lttng-modules-2.8.0/debian/patches/0017-Fix-changes-to-the-vm_op-fault-cb-prototype-in-libri.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0017-Fix-changes-to-the-vm_op-fault-cb-prototype-in-libri.patch 2017-10-26 15:59:41.000000000 +0000 @@ -0,0 +1,47 @@ +From 52a391bdd89e233e99cc3fbe1fdd7bbef694b876 Mon Sep 17 00:00:00 2001 +From: Francis Deslauriers +Date: Tue, 7 Mar 2017 10:35:21 -0500 +Subject: [PATCH] Fix: changes to the vm_op fault cb prototype in libringbuffer + +Signed-off-by: Francis Deslauriers +Signed-off-by: Mathieu Desnoyers +--- + lib/ringbuffer/ring_buffer_mmap.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/lib/ringbuffer/ring_buffer_mmap.c b/lib/ringbuffer/ring_buffer_mmap.c +index 35d30e7..4b1b7b3 100644 +--- a/lib/ringbuffer/ring_buffer_mmap.c ++++ b/lib/ringbuffer/ring_buffer_mmap.c +@@ -32,7 +32,7 @@ + /* + * fault() vm_op implementation for ring buffer file mapping. + */ +-static int lib_ring_buffer_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ++static int lib_ring_buffer_fault_compat(struct vm_area_struct *vma, struct vm_fault *vmf) + { + struct lib_ring_buffer *buf = vma->vm_private_data; + struct channel *chan = buf->backend.chan; +@@ -65,6 +65,19 @@ static int lib_ring_buffer_fault(struct vm_area_struct *vma, struct vm_fault *vm + return 0; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++static int lib_ring_buffer_fault(struct vm_fault *vmf) ++{ ++ struct vm_area_struct *vma = vmf->vma; ++ return lib_ring_buffer_fault_compat(vma, vmf); ++} ++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ ++static int lib_ring_buffer_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ++{ ++ return lib_ring_buffer_fault_compat(vma, vmf); ++} ++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ ++ + /* + * vm_ops for ring buffer file mappings. + */ +-- +2.11.0 + diff -Nru lttng-modules-2.8.0/debian/patches/0018-Fix-update-scsi-instrumentation-for-kernel-4.11.patch lttng-modules-2.8.0/debian/patches/0018-Fix-update-scsi-instrumentation-for-kernel-4.11.patch --- lttng-modules-2.8.0/debian/patches/0018-Fix-update-scsi-instrumentation-for-kernel-4.11.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0018-Fix-update-scsi-instrumentation-for-kernel-4.11.patch 2017-10-26 16:00:06.000000000 +0000 @@ -0,0 +1,228 @@ +From 8a9f549f255dc4bd546618d6c259c190802df10c Mon Sep 17 00:00:00 2001 +From: Francis Deslauriers +Date: Tue, 7 Mar 2017 11:16:47 -0500 +Subject: [PATCH] Fix: update scsi instrumentation for kernel 4.11 + +Signed-off-by: Francis Deslauriers +Signed-off-by: Mathieu Desnoyers +--- + instrumentation/events/lttng-module/block.h | 154 ++++++++++++++++++++++++++-- + 1 file changed, 146 insertions(+), 8 deletions(-) + +diff --git a/instrumentation/events/lttng-module/block.h b/instrumentation/events/lttng-module/block.h +index 4373edf..152609c 100644 +--- a/instrumentation/events/lttng-module/block.h ++++ b/instrumentation/events/lttng-module/block.h +@@ -10,6 +10,10 @@ + #include + #include + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++#include ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ ++ + #ifndef _TRACE_BLOCK_DEF_ + #define _TRACE_BLOCK_DEF_ + +@@ -164,6 +168,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_dirty_buffer, + ) + #endif + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) + LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, + + TP_PROTO(struct request_queue *q, struct request *rq), +@@ -178,6 +183,50 @@ LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, + ), + + TP_code_pre( ++ if (blk_rq_is_scsi(rq)) { ++ struct scsi_request *scsi_rq = scsi_req(rq); ++ tp_locvar->sector = 0; ++ tp_locvar->nr_sector = 0; ++ tp_locvar->cmd = scsi_rq->cmd; ++ tp_locvar->cmd_len = scsi_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_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, ++ lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) ++ ctf_sequence_hex(unsigned char, cmd, ++ tp_locvar->cmd, size_t, tp_locvar->cmd_len) ++ ), ++ ++ TP_code_post() ++) ++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ ++LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, ++ ++ TP_PROTO(struct request_queue *q, struct request *rq), ++ ++ TP_ARGS(q, rq), ++ ++ TP_locvar( ++ sector_t sector; ++ unsigned int nr_sector; ++ unsigned char *cmd; ++ size_t cmd_len; ++ ), ++ ++ TP_code_pre( ++ + if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { + tp_locvar->sector = 0; + tp_locvar->nr_sector = 0; +@@ -205,6 +254,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, + + TP_code_post() + ) ++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ + + /** + * block_rq_abort - abort block operation request +@@ -239,14 +289,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_requeue, + TP_ARGS(q, rq) + ) + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \ +- || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \ +- || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \ +- || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \ +- || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \ +- || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \ +- || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0)) +- + /** + * block_rq_complete - block IO operation completed by device driver + * @q: queue containing the block operation request +@@ -259,6 +301,52 @@ 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. + */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++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_locvar( ++ unsigned char *cmd; ++ size_t cmd_len; ++ ), ++ ++ TP_code_pre( ++ if (blk_rq_is_scsi(rq)) { ++ struct scsi_request *scsi_rq = scsi_req(rq); ++ tp_locvar->cmd = scsi_rq->cmd; ++ tp_locvar->cmd_len = scsi_rq->cmd_len; ++ } else { ++ tp_locvar->cmd = NULL; ++ tp_locvar->cmd_len = 0; ++ } ++ ), ++ ++ 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, ++ lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) ++ ctf_sequence_hex(unsigned char, cmd, ++ tp_locvar->cmd, size_t, tp_locvar->cmd_len) ++ ), ++ ++ TP_code_post() ++) ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \ ++ || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \ ++ || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \ ++ || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \ ++ || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \ ++ || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \ ++ || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0)) ++ + LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, + + TP_PROTO(struct request_queue *q, struct request *rq, +@@ -318,6 +406,55 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_complete, + + #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, ++ ++ TP_PROTO(struct request_queue *q, struct request *rq), ++ ++ TP_ARGS(q, rq), ++ ++ TP_locvar( ++ sector_t sector; ++ unsigned int nr_sector; ++ unsigned int bytes; ++ unsigned char *cmd; ++ size_t cmd_len; ++ ), ++ ++ TP_code_pre( ++ if (blk_rq_is_scsi(rq)) { ++ struct scsi_request *scsi_rq = scsi_req(rq); ++ tp_locvar->sector = 0; ++ tp_locvar->nr_sector = 0; ++ tp_locvar->bytes = scsi_rq->resid_len; ++ tp_locvar->cmd = scsi_rq->cmd; ++ tp_locvar->cmd_len = scsi_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_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, ++ lttng_req_op(rq), lttng_req_rw(rq), 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) ++ ), ++ ++ TP_code_post() ++) ++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ + LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, + + TP_PROTO(struct request_queue *q, struct request *rq), +@@ -364,6 +501,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, + + TP_code_post() + ) ++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ + + /** + * block_rq_insert - insert block operation request into queue +-- +2.11.0 + diff -Nru lttng-modules-2.8.0/debian/patches/0019-Fix-timers-cputime_t-arguments-replaced-by-ull-in-ke.patch lttng-modules-2.8.0/debian/patches/0019-Fix-timers-cputime_t-arguments-replaced-by-ull-in-ke.patch --- lttng-modules-2.8.0/debian/patches/0019-Fix-timers-cputime_t-arguments-replaced-by-ull-in-ke.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0019-Fix-timers-cputime_t-arguments-replaced-by-ull-in-ke.patch 2017-10-26 16:05:26.000000000 +0000 @@ -0,0 +1,87 @@ +From 678dd1c8d1f38ee5fdefafb8451fc544eb743f00 Mon Sep 17 00:00:00 2001 +From: Francis Deslauriers +Date: Tue, 7 Mar 2017 11:21:59 -0500 +Subject: [PATCH] Fix: timers cputime_t arguments replaced by ull in kernel + 4.11 + +cputime_t was changed to ull in the kernel commit: 858cf3a + +Signed-off-by: Francis Deslauriers +Signed-off-by: Mathieu Desnoyers +--- + instrumentation/events/lttng-module/timer.h | 38 +++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/instrumentation/events/lttng-module/timer.h b/instrumentation/events/lttng-module/timer.h +index 9c02c96..d62fd25 100644 +--- a/instrumentation/events/lttng-module/timer.h ++++ b/instrumentation/events/lttng-module/timer.h +@@ -248,6 +248,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(timer_hrtimer_class, hrtimer_cancel, + * zero, otherwise it is started + * @expires: the itimers expiry time + */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++LTTNG_TRACEPOINT_EVENT_MAP(itimer_state, ++ ++ timer_itimer_state, ++ ++ TP_PROTO(int which, const struct itimerval *const value, ++ unsigned long long expires), ++ ++ TP_ARGS(which, value, expires), ++ ++ TP_FIELDS( ++ ctf_integer(int, which, which) ++ ctf_integer(unsigned long long, 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) ++ ) ++) ++#else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ + LTTNG_TRACEPOINT_EVENT_MAP(itimer_state, + + timer_itimer_state, +@@ -266,6 +286,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(itimer_state, + ctf_integer(long, interval_usec, value->it_interval.tv_usec) + ) + ) ++#endif /* #else (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ + + /** + * itimer_expire - called when itimer expires +@@ -273,6 +294,22 @@ LTTNG_TRACEPOINT_EVENT_MAP(itimer_state, + * @pid: pid of the process which owns the timer + * @now: current time, used to calculate the latency of itimer + */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++LTTNG_TRACEPOINT_EVENT_MAP(itimer_expire, ++ ++ timer_itimer_expire, ++ ++ TP_PROTO(int which, struct pid *pid, unsigned long long now), ++ ++ TP_ARGS(which, pid, now), ++ ++ TP_FIELDS( ++ ctf_integer(int , which, which) ++ ctf_integer(pid_t, pid, pid_nr(pid)) ++ ctf_integer(unsigned long long, now, now) ++ ) ++) ++#else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ + LTTNG_TRACEPOINT_EVENT_MAP(itimer_expire, + + timer_itimer_expire, +@@ -287,6 +324,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(itimer_expire, + ctf_integer(cputime_t, now, now) + ) + ) ++#endif /* #else (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ + + #endif /* LTTNG_TRACE_TIMER_H */ + +-- +2.11.0 + diff -Nru lttng-modules-2.8.0/debian/patches/0020-Fix-atomic_add_unless-returns-true-false-rather-than.patch lttng-modules-2.8.0/debian/patches/0020-Fix-atomic_add_unless-returns-true-false-rather-than.patch --- lttng-modules-2.8.0/debian/patches/0020-Fix-atomic_add_unless-returns-true-false-rather-than.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0020-Fix-atomic_add_unless-returns-true-false-rather-than.patch 2017-10-26 16:05:48.000000000 +0000 @@ -0,0 +1,42 @@ +From 4c4d77dacf277775cb395190cf827c7f0c226a99 Mon Sep 17 00:00:00 2001 +From: Francis Deslauriers +Date: Wed, 8 Mar 2017 11:50:38 -0500 +Subject: [PATCH] Fix: atomic_add_unless() returns true/false rather than prior + value + +The previous implementation assumed that `atomic_add_unless` returned +the prior value of the atomic counter when in fact it returned if the +addition was performed (true) or not performed (false). +Since `atomic_add_unless` can not return INT_MAX, the `lttng_kref_get` +always returned that the call was successful. + +This issue had a low likelihood of being triggered since the two refcounts +of the counters used with this call are both bounded by the maximum +number of file descriptors on the system. + +Signed-off-by: Francis Deslauriers +Signed-off-by: Mathieu Desnoyers +--- + wrapper/kref.h | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/wrapper/kref.h b/wrapper/kref.h +index eedefbf..f30a9ae 100644 +--- a/wrapper/kref.h ++++ b/wrapper/kref.h +@@ -36,11 +36,7 @@ + */ + static inline int lttng_kref_get(struct kref *kref) + { +- if (atomic_add_unless(&kref->refcount, 1, INT_MAX) != INT_MAX) { +- return 1; +- } else { +- return 0; +- } ++ return atomic_add_unless(&kref->refcount, 1, INT_MAX); + } + + #endif /* _LTTNG_WRAPPER_KREF_H */ +-- +2.11.0 + diff -Nru lttng-modules-2.8.0/debian/patches/0021-Fix-kref-changes-for-kernel-4.11.patch lttng-modules-2.8.0/debian/patches/0021-Fix-kref-changes-for-kernel-4.11.patch --- lttng-modules-2.8.0/debian/patches/0021-Fix-kref-changes-for-kernel-4.11.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0021-Fix-kref-changes-for-kernel-4.11.patch 2017-10-26 16:06:28.000000000 +0000 @@ -0,0 +1,48 @@ +From 77932315cd23b50c88462872a3b86ad5997e5b47 Mon Sep 17 00:00:00 2001 +From: Francis Deslauriers +Date: Tue, 7 Mar 2017 23:37:30 -0500 +Subject: [PATCH] Fix: kref changes for kernel 4.11 + +The underlying type of `struct kref` changed in kernel 4.11 from an +atomic_t to a refcount_t. This change was introduced in kernel +commit:10383ae. This commit also added a builtin overflow checks to +`kref_get()` so we use it. + +Signed-off-by: Francis Deslauriers +Signed-off-by: Mathieu Desnoyers +--- + wrapper/kref.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/wrapper/kref.h b/wrapper/kref.h +index f30a9ae..3f3be7a 100644 +--- a/wrapper/kref.h ++++ b/wrapper/kref.h +@@ -28,15 +28,24 @@ + + #include + #include ++#include + + /* + * lttng_kref_get: get reference count, checking for overflow. + * + * Return 1 if reference is taken, 0 otherwise (overflow). + */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++static inline int lttng_kref_get(struct kref *kref) ++{ ++ kref_get(kref); ++ return 1; ++} ++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ + static inline int lttng_kref_get(struct kref *kref) + { + return atomic_add_unless(&kref->refcount, 1, INT_MAX); + } ++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ + + #endif /* _LTTNG_WRAPPER_KREF_H */ +-- +2.11.0 + diff -Nru lttng-modules-2.8.0/debian/patches/0022-Fix-update-sched-instrumentation-for-kernel-4.12.patch lttng-modules-2.8.0/debian/patches/0022-Fix-update-sched-instrumentation-for-kernel-4.12.patch --- lttng-modules-2.8.0/debian/patches/0022-Fix-update-sched-instrumentation-for-kernel-4.12.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0022-Fix-update-sched-instrumentation-for-kernel-4.12.patch 2017-10-26 16:06:50.000000000 +0000 @@ -0,0 +1,47 @@ +From 673e9a0300912e68d516cf06e0553c11b28cddbf Mon Sep 17 00:00:00 2001 +From: Michael Jeanson +Date: Tue, 23 May 2017 15:45:18 -0400 +Subject: [PATCH] Fix: update sched instrumentation for kernel 4.12 + +See upstream commit b91473ff6e979c0028f02f90e40c844959c736d8 + +Signed-off-by: Michael Jeanson +Signed-off-by: Mathieu Desnoyers +--- + instrumentation/events/lttng-module/sched.h | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/instrumentation/events/lttng-module/sched.h b/instrumentation/events/lttng-module/sched.h +index e5066af..c68dd27 100644 +--- a/instrumentation/events/lttng-module/sched.h ++++ b/instrumentation/events/lttng-module/sched.h +@@ -540,7 +540,25 @@ LTTNG_TRACEPOINT_EVENT(sched_stat_runtime, + ) + #endif + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) ++/* ++ * Tracepoint for showing priority inheritance modifying a tasks ++ * priority. ++ */ ++LTTNG_TRACEPOINT_EVENT(sched_pi_setprio, ++ ++ TP_PROTO(struct task_struct *tsk, struct task_struct *pi_task), ++ ++ TP_ARGS(tsk, pi_task), ++ ++ 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, pi_task ? pi_task->prio - MAX_RT_PRIO : tsk->prio - MAX_RT_PRIO) ++ ) ++) ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + /* + * Tracepoint for showing priority inheritance modifying a tasks + * priority. +-- +2.11.0 + diff -Nru lttng-modules-2.8.0/debian/patches/0023-Fix-update-ringbuffer-for-kernel-4.12.patch lttng-modules-2.8.0/debian/patches/0023-Fix-update-ringbuffer-for-kernel-4.12.patch --- lttng-modules-2.8.0/debian/patches/0023-Fix-update-ringbuffer-for-kernel-4.12.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0023-Fix-update-ringbuffer-for-kernel-4.12.patch 2017-10-26 16:07:08.000000000 +0000 @@ -0,0 +1,32 @@ +From e2833beda7a9a0eeacb16ef564021a5a43e08189 Mon Sep 17 00:00:00 2001 +From: Michael Jeanson +Date: Tue, 23 May 2017 15:45:47 -0400 +Subject: [PATCH] Fix: update ringbuffer for kernel 4.12 + +flags removed from splice_pipe_desc in 4.12. + +See upstream commit f81dc7d7d5a2528f98f26a0b9406e822d0b35011 + +Signed-off-by: Michael Jeanson +Signed-off-by: Mathieu Desnoyers +--- + lib/ringbuffer/ring_buffer_splice.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/ringbuffer/ring_buffer_splice.c b/lib/ringbuffer/ring_buffer_splice.c +index 0610caa..8d14666 100644 +--- a/lib/ringbuffer/ring_buffer_splice.c ++++ b/lib/ringbuffer/ring_buffer_splice.c +@@ -95,7 +95,9 @@ static int subbuf_splice_actor(struct file *in, + .pages = pages, + .nr_pages = 0, + .partial = partial, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)) + .flags = flags, ++#endif + .ops = &ring_buffer_pipe_buf_ops, + .spd_release = lib_ring_buffer_page_release, + }; +-- +2.11.0 + diff -Nru lttng-modules-2.8.0/debian/patches/0024-Fix-update-block-instrumentation-for-kernel-4.12.patch lttng-modules-2.8.0/debian/patches/0024-Fix-update-block-instrumentation-for-kernel-4.12.patch --- lttng-modules-2.8.0/debian/patches/0024-Fix-update-block-instrumentation-for-kernel-4.12.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0024-Fix-update-block-instrumentation-for-kernel-4.12.patch 2017-10-26 16:15:52.000000000 +0000 @@ -0,0 +1,135 @@ +From d2457078da4294d38d7d5fb7140a062eeb1e1def Mon Sep 17 00:00:00 2001 +From: Michael Jeanson +Date: Thu, 25 May 2017 16:56:51 -0400 +Subject: [PATCH] Fix: update block instrumentation for kernel 4.12 + +Follow changes introduced by Linux upstream commits: + 48b77ad6084481ef9330a5d2bee289966da0975b + cee4b7ce3f9161c88f7255a3d73c1c4d5bbabea7 + caf7df12272118e0274c8353bcfeaf60c7743a47 + +Signed-off-by: Michael Jeanson +Signed-off-by: Mathieu Desnoyers +--- + instrumentation/events/lttng-module/block.h | 64 +++++++++++++++++++++++++++-- + 1 file changed, 61 insertions(+), 3 deletions(-) + +diff --git a/instrumentation/events/lttng-module/block.h b/instrumentation/events/lttng-module/block.h +index 152609c..c43d747 100644 +--- a/instrumentation/events/lttng-module/block.h ++++ b/instrumentation/events/lttng-module/block.h +@@ -168,7 +168,9 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_dirty_buffer, + ) + #endif + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) ++/* block_rq_with_error event class removed in kernel 4.12 */ ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) + LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, + + TP_PROTO(struct request_queue *q, struct request *rq), +@@ -256,6 +258,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, + ) + #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)) + /** + * block_rq_abort - abort block operation request + * @q: queue containing the block operation request +@@ -272,6 +275,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_abort, + + TP_ARGS(q, rq) + ) ++#endif + + /** + * block_rq_requeue - place block IO request back on a queue +@@ -282,12 +286,30 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_abort, + * @q. For some reason the request was not completed and needs to be + * put back in the queue. + */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) ++LTTNG_TRACEPOINT_EVENT(block_rq_requeue, ++ ++ TP_PROTO(struct request_queue *q, struct request *rq), ++ ++ TP_ARGS(q, rq), ++ ++ TP_FIELDS( ++ ctf_integer(dev_t, dev, ++ rq->rq_disk ? disk_devt(rq->rq_disk) : 0) ++ ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) ++ ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) ++ blk_rwbs_ctf_integer(unsigned int, rwbs, ++ lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) ++ ) ++) ++#else + LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_requeue, + + TP_PROTO(struct request_queue *q, struct request *rq), + + TP_ARGS(q, rq) + ) ++#endif + + /** + * block_rq_complete - block IO operation completed by device driver +@@ -301,7 +323,24 @@ 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. + */ +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) ++LTTNG_TRACEPOINT_EVENT(block_rq_complete, ++ ++ TP_PROTO(struct request *rq, int error, unsigned int nr_bytes), ++ ++ TP_ARGS(rq, error, nr_bytes), ++ ++ 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, error, error) ++ blk_rwbs_ctf_integer(unsigned int, rwbs, ++ lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) ++ ) ++) ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) + LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, + + TP_PROTO(struct request_queue *q, struct request *rq, +@@ -406,7 +445,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_complete, + + #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) ++LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, ++ ++ TP_PROTO(struct request_queue *q, struct request *rq), ++ ++ TP_ARGS(q, rq), ++ ++ TP_FIELDS( ++ ctf_integer(dev_t, dev, ++ rq->rq_disk ? disk_devt(rq->rq_disk) : 0) ++ ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) ++ ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) ++ ctf_integer(unsigned int, bytes, blk_rq_bytes(rq)) ++ ctf_integer(pid_t, tid, current->pid) ++ blk_rwbs_ctf_integer(unsigned int, rwbs, ++ lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) ++ ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) ++ ) ++) ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) + LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, + + TP_PROTO(struct request_queue *q, struct request *rq), +-- +2.11.0 + diff -Nru lttng-modules-2.8.0/debian/patches/0025-Fix-update-ftrace-probe-for-kernel-4.12.patch lttng-modules-2.8.0/debian/patches/0025-Fix-update-ftrace-probe-for-kernel-4.12.patch --- lttng-modules-2.8.0/debian/patches/0025-Fix-update-ftrace-probe-for-kernel-4.12.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0025-Fix-update-ftrace-probe-for-kernel-4.12.patch 2017-10-26 16:16:22.000000000 +0000 @@ -0,0 +1,119 @@ +From 5d8496675c9e8ccf169871f4f72022df9677624a Mon Sep 17 00:00:00 2001 +From: Michael Jeanson +Date: Thu, 25 May 2017 16:56:52 -0400 +Subject: [PATCH] Fix: update ftrace probe for kernel 4.12 + +Follow changes introduced by Linux upstream commits: + ec19b85913486993d7d6f747beed1a711afd47d8 + bca6c8d0480a8aa5c86f8f416db96c71f6b79e29 + b5f081b563a6cdcb85a543df8c851951a8978275 + 6e4443199e5354255e8a4c1e8e5cfc8ef064c3ce + +Signed-off-by: Michael Jeanson +Signed-off-by: Mathieu Desnoyers +--- + probes/Kbuild | 16 +++++++++++++++- + probes/lttng-ftrace.c | 40 ++++++++++++++++++++++++++++++++++++++++ + wrapper/ftrace.h | 4 ++++ + 3 files changed, 59 insertions(+), 1 deletion(-) + +Index: lttng-modules-2.9.0/probes/Kbuild +=================================================================== +--- lttng-modules-2.9.0.orig/probes/Kbuild ++++ lttng-modules-2.9.0/probes/Kbuild +@@ -263,7 +263,21 @@ ifneq ($(CONFIG_KRETPROBES),) + endif # CONFIG_KRETPROBES + + ifneq ($(CONFIG_DYNAMIC_FTRACE),) +- obj-$(CONFIG_LTTNG) += lttng-ftrace.o ++ ftrace_dep = $(srctree)/kernel/trace/trace.h ++ ftrace_dep_check = $(wildcard $(ftrace_dep)) ++ ftrace = $(shell \ ++ if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \ ++ if [ -z "$(ftrace_dep_check)" ] ; then \ ++ echo "warn" ; \ ++ exit ; \ ++ fi; \ ++ echo "lttng-ftrace.o" ; \ ++ fi;) ++ ifeq ($(ftrace),warn) ++ $(warning Files $(ftrace_dep) not found. Probe "ftrace" is disabled. Use full kernel source tree to enable it.) ++ ftrace = ++ endif # $(ftrace),warn ++ obj-$(CONFIG_LTTNG) += $(ftrace) + endif # CONFIG_DYNAMIC_FTRACE + + # vim:syntax=make +Index: lttng-modules-2.9.0/probes/lttng-ftrace.c +=================================================================== +--- lttng-modules-2.9.0.orig/probes/lttng-ftrace.c ++++ lttng-modules-2.9.0/probes/lttng-ftrace.c +@@ -39,6 +39,45 @@ + #include + #include + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) ++static ++void lttng_ftrace_handler(unsigned long ip, unsigned long parent_ip, ++ struct trace_array *tr, struct ftrace_probe_ops *ops, ++ void *data) ++{ ++ struct lttng_event *event = data; ++ struct lttng_probe_ctx lttng_probe_ctx = { ++ .event = event, ++ .interruptible = !irqs_disabled(), ++ }; ++ struct lttng_channel *chan = event->chan; ++ struct lib_ring_buffer_ctx ctx; ++ struct { ++ unsigned long ip; ++ unsigned long parent_ip; ++ } payload; ++ int ret; ++ ++ if (unlikely(!ACCESS_ONCE(chan->session->active))) ++ return; ++ if (unlikely(!ACCESS_ONCE(chan->enabled))) ++ return; ++ if (unlikely(!ACCESS_ONCE(event->enabled))) ++ return; ++ ++ lib_ring_buffer_ctx_init(&ctx, chan->chan, <tng_probe_ctx, ++ sizeof(payload), lttng_alignof(payload), -1); ++ ret = chan->ops->event_reserve(&ctx, event->id); ++ if (ret < 0) ++ return; ++ payload.ip = ip; ++ payload.parent_ip = parent_ip; ++ lib_ring_buffer_align_ctx(&ctx, lttng_alignof(payload)); ++ chan->ops->event_write(&ctx, &payload, sizeof(payload)); ++ chan->ops->event_commit(&ctx); ++ return; ++} ++#else + static + void lttng_ftrace_handler(unsigned long ip, unsigned long parent_ip, void **data) + { +@@ -74,6 +113,7 @@ void lttng_ftrace_handler(unsigned long + chan->ops->event_commit(&ctx); + return; + } ++#endif + + /* + * Create event description +Index: lttng-modules-2.9.0/wrapper/ftrace.h +=================================================================== +--- lttng-modules-2.9.0.orig/wrapper/ftrace.h ++++ lttng-modules-2.9.0/wrapper/ftrace.h +@@ -26,6 +26,10 @@ + */ + + #include ++#include ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) ++#include <../kernel/trace/trace.h> ++#endif + + #ifdef CONFIG_KALLSYMS + diff -Nru lttng-modules-2.8.0/debian/patches/0026-Fix-Build-ftrace-probe-on-kernels-prior-to-4.12.patch lttng-modules-2.8.0/debian/patches/0026-Fix-Build-ftrace-probe-on-kernels-prior-to-4.12.patch --- lttng-modules-2.8.0/debian/patches/0026-Fix-Build-ftrace-probe-on-kernels-prior-to-4.12.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0026-Fix-Build-ftrace-probe-on-kernels-prior-to-4.12.patch 2017-10-26 16:16:45.000000000 +0000 @@ -0,0 +1,27 @@ +From bc1fb1b8c9fe9170a540ef5e8e4ba4e10fd02019 Mon Sep 17 00:00:00 2001 +From: Francis Deslauriers +Date: Tue, 30 May 2017 09:36:31 -0400 +Subject: [PATCH] Fix: Build ftrace probe on kernels prior to 4.12 + +Signed-off-by: Francis Deslauriers +Signed-off-by: Mathieu Desnoyers +--- + probes/Kbuild | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +Index: lttng-modules-2.9.0/probes/Kbuild +=================================================================== +--- lttng-modules-2.9.0.orig/probes/Kbuild ++++ lttng-modules-2.9.0/probes/Kbuild +@@ -271,8 +271,9 @@ ifneq ($(CONFIG_DYNAMIC_FTRACE),) + echo "warn" ; \ + exit ; \ + fi; \ +- echo "lttng-ftrace.o" ; \ +- fi;) ++ fi; \ ++ echo "lttng-ftrace.o" ; \ ++ ) + ifeq ($(ftrace),warn) + $(warning Files $(ftrace_dep) not found. Probe "ftrace" is disabled. Use full kernel source tree to enable it.) + ftrace = diff -Nru lttng-modules-2.8.0/debian/patches/0027-Fix-handle-missing-ftrace-header-on-v4.12.patch lttng-modules-2.8.0/debian/patches/0027-Fix-handle-missing-ftrace-header-on-v4.12.patch --- lttng-modules-2.8.0/debian/patches/0027-Fix-handle-missing-ftrace-header-on-v4.12.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0027-Fix-handle-missing-ftrace-header-on-v4.12.patch 2017-10-26 16:25:06.000000000 +0000 @@ -0,0 +1,86 @@ +Subject: Fix: handle missing ftrace header on v4.12 + +Properly handle the case where we build against the distro headers of a +kernel >= 4.12 and ftrace is enabled but the private header is +unavailable. + +Signed-off-by: Michael Jeanson +--- + Makefile.ABI.workarounds | 21 +++++++++++++++++++++ + lttng-events.h | 2 +- + probes/Kbuild | 19 ++++--------------- + 3 files changed, 26 insertions(+), 16 deletions(-) + +Index: lttng-modules-2.9.0/Makefile.ABI.workarounds +=================================================================== +--- lttng-modules-2.9.0.orig/Makefile.ABI.workarounds ++++ lttng-modules-2.9.0/Makefile.ABI.workarounds +@@ -21,3 +21,24 @@ RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MO + ifneq ($(RT_PATCH_VERSION), 0) + ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION) + endif ++ ++# Starting with kernel 4.12, the ftrace header was moved to private headers ++# and as such is not available when building against distro headers instead ++# of the full kernel sources. In the situation, define LTTNG_FTRACE_MISSING_HEADER ++# so we can enable the compat code even if CONFIG_DYNAMIC_FTRACE is enabled. ++ifneq ($(CONFIG_DYNAMIC_FTRACE),) ++ ftrace_dep = $(srctree)/kernel/trace/trace.h ++ ftrace_dep_check = $(wildcard $(ftrace_dep)) ++ have_ftrace_header = $(shell \ ++ if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \ ++ if [ -z "$(ftrace_dep_check)" ] ; then \ ++ echo "no" ; \ ++ exit ; \ ++ fi; \ ++ fi; \ ++ echo "yes" ; \ ++ ) ++ ifeq ($(have_ftrace_header), no) ++ ccflags-y += -DLTTNG_FTRACE_MISSING_HEADER ++ endif ++endif +Index: lttng-modules-2.9.0/lttng-events.h +=================================================================== +--- lttng-modules-2.9.0.orig/lttng-events.h ++++ lttng-modules-2.9.0/lttng-events.h +@@ -810,7 +810,7 @@ int lttng_kretprobes_event_enable_state( + } + #endif + +-#ifdef CONFIG_DYNAMIC_FTRACE ++#if defined(CONFIG_DYNAMIC_FTRACE) && !defined(LTTNG_FTRACE_MISSING_HEADER) + int lttng_ftrace_register(const char *name, + const char *symbol_name, + struct lttng_event *event); +Index: lttng-modules-2.9.0/probes/Kbuild +=================================================================== +--- lttng-modules-2.9.0.orig/probes/Kbuild ++++ lttng-modules-2.9.0/probes/Kbuild +@@ -263,22 +263,11 @@ ifneq ($(CONFIG_KRETPROBES),) + endif # CONFIG_KRETPROBES + + ifneq ($(CONFIG_DYNAMIC_FTRACE),) +- ftrace_dep = $(srctree)/kernel/trace/trace.h +- ftrace_dep_check = $(wildcard $(ftrace_dep)) +- ftrace = $(shell \ +- if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \ +- if [ -z "$(ftrace_dep_check)" ] ; then \ +- echo "warn" ; \ +- exit ; \ +- fi; \ +- fi; \ +- echo "lttng-ftrace.o" ; \ +- ) +- ifeq ($(ftrace),warn) ++ ifeq ($(have_ftrace_header),yes) ++ obj-$(CONFIG_LTTNG) += lttng-ftrace.o ++ else + $(warning Files $(ftrace_dep) not found. Probe "ftrace" is disabled. Use full kernel source tree to enable it.) +- ftrace = +- endif # $(ftrace),warn +- obj-$(CONFIG_LTTNG) += $(ftrace) ++ endif + endif # CONFIG_DYNAMIC_FTRACE + + # vim:syntax=make diff -Nru lttng-modules-2.8.0/debian/patches/0028-Fix-section-mismatch-warning-caused-by-__exit-annota.patch lttng-modules-2.8.0/debian/patches/0028-Fix-section-mismatch-warning-caused-by-__exit-annota.patch --- lttng-modules-2.8.0/debian/patches/0028-Fix-section-mismatch-warning-caused-by-__exit-annota.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0028-Fix-section-mismatch-warning-caused-by-__exit-annota.patch 2017-10-26 16:25:27.000000000 +0000 @@ -0,0 +1,32 @@ +From 32fe46fb8640cf2e50103ba2f2efd1ef5c245eaf Mon Sep 17 00:00:00 2001 +From: Francis Deslauriers +Date: Tue, 7 Mar 2017 09:12:31 -0500 +Subject: [PATCH] Fix: section mismatch warning caused by __exit annotation +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +lttng_logger_exit is used in a non-exit function so it should not be +annotated with `__exit`. + +Signed-off-by: Francis Deslauriers +Signed-off-by: Mathieu Desnoyers +--- + probes/lttng.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/probes/lttng.c b/probes/lttng.c +index 58aa515..8810fa2 100644 +--- a/probes/lttng.c ++++ b/probes/lttng.c +@@ -129,7 +129,7 @@ error: + return ret; + } + +-void __exit lttng_logger_exit(void) ++void lttng_logger_exit(void) + { + __lttng_events_exit__lttng(); + if (lttng_logger_dentry) +-- +2.11.0 + diff -Nru lttng-modules-2.8.0/debian/patches/0029-Fix-missing-ftrace-header-on-v4.11.patch lttng-modules-2.8.0/debian/patches/0029-Fix-missing-ftrace-header-on-v4.11.patch --- lttng-modules-2.8.0/debian/patches/0029-Fix-missing-ftrace-header-on-v4.11.patch 1970-01-01 00:00:00.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/0029-Fix-missing-ftrace-header-on-v4.11.patch 2017-10-26 16:25:49.000000000 +0000 @@ -0,0 +1,30 @@ +Subject: Fix: handle missing ftrace header on v4.11 + +Properly handle the case where we build against the distro headers of a +kernel >= 4.11 and ftrace is enabled but the private header is +unavailable. + +Signed-off-by: Colin Ian King + +Index: lttng-modules-2.9.0/Makefile.ABI.workarounds +=================================================================== +--- lttng-modules-2.9.0.orig/Makefile.ABI.workarounds ++++ lttng-modules-2.9.0/Makefile.ABI.workarounds +@@ -22,7 +22,7 @@ ifneq ($(RT_PATCH_VERSION), 0) + ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION) + endif + +-# Starting with kernel 4.12, the ftrace header was moved to private headers ++# Starting with kernel 4.11, the ftrace header was moved to private headers + # and as such is not available when building against distro headers instead + # of the full kernel sources. In the situation, define LTTNG_FTRACE_MISSING_HEADER + # so we can enable the compat code even if CONFIG_DYNAMIC_FTRACE is enabled. +@@ -30,7 +30,7 @@ ifneq ($(CONFIG_DYNAMIC_FTRACE),) + ftrace_dep = $(srctree)/kernel/trace/trace.h + ftrace_dep_check = $(wildcard $(ftrace_dep)) + have_ftrace_header = $(shell \ +- if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \ ++ if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 11 \) ] ; then \ + if [ -z "$(ftrace_dep_check)" ] ; then \ + echo "no" ; \ + exit ; \ diff -Nru lttng-modules-2.8.0/debian/patches/series lttng-modules-2.8.0/debian/patches/series --- lttng-modules-2.8.0/debian/patches/series 2017-03-29 13:05:08.000000000 +0000 +++ lttng-modules-2.8.0/debian/patches/series 2017-10-26 16:25:52.000000000 +0000 @@ -12,3 +12,18 @@ 0012-Adapt-lttng-modules-to-Linux-4.10-cpu-hotplug-state-.patch 0013-Fix-only-include-linux-cpuhotplug.h-for-kernels-4.10.patch 0014-Fix-4.10-hotplug-adaptation-backward-compat.patch +0015-Fix-update-mm_vmscan-instrumentation-for-kernel-4.11.patch +0016-Fix-update-btrfs-instrumentation-for-kernel-4.11.patch +0017-Fix-changes-to-the-vm_op-fault-cb-prototype-in-libri.patch +0018-Fix-update-scsi-instrumentation-for-kernel-4.11.patch +0019-Fix-timers-cputime_t-arguments-replaced-by-ull-in-ke.patch +0020-Fix-atomic_add_unless-returns-true-false-rather-than.patch +0021-Fix-kref-changes-for-kernel-4.11.patch +0022-Fix-update-sched-instrumentation-for-kernel-4.12.patch +0023-Fix-update-ringbuffer-for-kernel-4.12.patch +0024-Fix-update-block-instrumentation-for-kernel-4.12.patch +0025-Fix-update-ftrace-probe-for-kernel-4.12.patch +0026-Fix-Build-ftrace-probe-on-kernels-prior-to-4.12.patch +0027-Fix-handle-missing-ftrace-header-on-v4.12.patch +0028-Fix-section-mismatch-warning-caused-by-__exit-annota.patch +0029-Fix-missing-ftrace-header-on-v4.11.patch