[lttng-dev] [PATCH lttng-modules] Fix: kref changes for kernel 4.11

2017-03-07 Thread Francis Deslauriers
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 
---
 wrapper/kref.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/wrapper/kref.h b/wrapper/kref.h
index f30a9ae..8db05b5 100644
--- a/wrapper/kref.h
+++ b/wrapper/kref.h
@@ -34,9 +34,17 @@
  *
  * 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(>refcount, 1, INT_MAX);
 }
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
 
 #endif /* _LTTNG_WRAPPER_KREF_H */
-- 
2.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules] Fix: atomic_add_unless() already returns zero on overflow

2017-03-07 Thread Francis Deslauriers
Signed-off-by: Francis Deslauriers 
---
 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(>refcount, 1, INT_MAX) != INT_MAX) {
-   return 1;
-   } else {
-   return 0;
-   }
+   return atomic_add_unless(>refcount, 1, INT_MAX);
 }
 
 #endif /* _LTTNG_WRAPPER_KREF_H */
-- 
2.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH] lttng-modules: Fixes for ARM and 32-bit systems

2017-03-07 Thread Trent Piepho
On Mon, 2017-03-06 at 17:12 +, Mathieu Desnoyers wrote:
> - On Mar 3, 2017, at 6:43 PM, Trent Piepho tpie...@kymetacorp.com wrote:
> 
> Hi Trent,
> 
> What lttng-modules branch is this for ?

Sorry about this, I meant to send this patch to the *buildroot* list to
fix the bugs in the current version of lttng that's part of buildroot.
It's non-obviously but significantly broken on 32-bit ARM systems and I
wanted to get it fixed before the next version of lttng-modules is
released.  Not sure how I got the address incorrect.  

> > Patch to fix recv() syscall missing in ARM syscall list.
> 
> This was probably missing because the current ARM syscall instrumentation
> was generated from a 3.4.25 kernel that was missing SYSCALL macro
> description of those system calls. The proper route would be to
> regenerate the system call table by running a more recent kernel
> and following instrumentation/syscalls/README from lttng-modules.

My most recent available ARM system uses 3.18.0, if a patch for that
kernel is desirable, I'll submit one.  But it sounded like a newer 4.x
kernel was wanted and I don't have such a system.  

This was meant to be sent to buildroot as a bug fix until a proper fix
was came from upstream lttng.  Usually when a distro does patching to
fix some cross-build issue or something like that, one prefers to fix on
the side of "minimal changes" instead of "best fix".  Less trouble
porting that way.  That's why I didn't add 3.18 and made the smaller
patch to fix the 3.4.25 descriptions. 


> > Patch from lttng mailing list that fixes kernel timestamps being off
> > by about ~2 seconds on 32-bit systems.  Additional patch to fix
> > compilation bug on non-X86 introduced by previous patch.
> 
> Why are you re-posting an old version of own patch which now merged
> into master, stable-2.9 and stable-2.8 branches of lttng-modules ?

I didn't know there was a new version, as I didn't see a followup on the
thread about the original.  I'll send the newer patch from stable-2.9 to
buildroot instead of this one then.

Apologies again for sending this to the wrong list.

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-modules] Fix: timers cputime_t arguments replaced by ull in kernel 4.11

2017-03-07 Thread Mathieu Desnoyers
merged into master and stable-2.9, thanks!

Mathieu

- On Mar 7, 2017, at 11:21 AM, Francis Deslauriers 
francis.deslauri...@efficios.com wrote:

> cputime_t was changed to ull in the kernel commit: 858cf3a
> 
> Signed-off-by: Francis Deslauriers 
> ---
> 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.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-modules] Fix: update scsi instrumentation for kernel 4.11

2017-03-07 Thread Mathieu Desnoyers
merged into master and stable-2.9, thanks!

Mathieu

- On Mar 7, 2017, at 11:16 AM, Francis Deslauriers 
francis.deslauri...@efficios.com wrote:

> Signed-off-by: Francis Deslauriers 
> ---
> 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(
> + 

[lttng-dev] [PATCH lttng-modules] Fix: timers cputime_t arguments replaced by ull in kernel 4.11

2017-03-07 Thread Francis Deslauriers
cputime_t was changed to ull in the kernel commit: 858cf3a

Signed-off-by: Francis Deslauriers 
---
 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.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules] Fix: update scsi instrumentation for kernel 4.11

2017-03-07 Thread Francis Deslauriers
Signed-off-by: Francis Deslauriers 
---
 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)

Re: [lttng-dev] [PATCH lttng-modules v2] Fix: changes to the vm_op fault cb prototype in libringbuffer

2017-03-07 Thread Mathieu Desnoyers
merged into master and stable-2.9, thanks!

Mathieu

- On Mar 7, 2017, at 10:35 AM, Francis Deslauriers 
francis.deslauri...@efficios.com wrote:

> Signed-off-by: Francis Deslauriers 
> ---
> 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.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-modules v2] Fix: update btrfs instrumentation for kernel 4.11

2017-03-07 Thread Mathieu Desnoyers
merged into master and stable-2.9, thanks!

- On Mar 7, 2017, at 10:14 AM, Francis Deslauriers 
francis.deslauri...@efficios.com wrote:

> Signed-off-by: Francis Deslauriers 
> ---
> instrumentation/events/lttng-module/btrfs.h | 25 -
> 1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/instrumentation/events/lttng-module/btrfs.h
> b/instrumentation/events/lttng-module/btrfs.h
> index cc7ba50..ecaf382 100644
> --- a/instrumentation/events/lttng-module/btrfs.h
> +++ b/instrumentation/events/lttng-module/btrfs.h
> @@ -83,7 +83,30 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode,
> btrfs_inode_evict,
>   TP_ARGS(inode)
> )
> 
> -#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(>refs))
> + ctf_integer(unsigned int, compress_type, map->compress_type)
> + )
> +)
> +
> +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
> 
> LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
> 
> --
> 2.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules v2] Fix: changes to the vm_op fault cb prototype in libringbuffer

2017-03-07 Thread Francis Deslauriers
Signed-off-by: Francis Deslauriers 
---
 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.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-modules] Fix: changes to the vm_op fault cb prototype in libringbuffer

2017-03-07 Thread Mathieu Desnoyers


- On Mar 7, 2017, at 9:59 AM, Francis Deslauriers 
francis.deslauri...@efficios.com wrote:

> Signed-off-by: Francis Deslauriers 
> ---
> lib/ringbuffer/ring_buffer_mmap.c | 6 ++
> 1 file changed, 6 insertions(+)
> 
> diff --git a/lib/ringbuffer/ring_buffer_mmap.c
> b/lib/ringbuffer/ring_buffer_mmap.c
> index 35d30e7..1ca45a7 100644
> --- a/lib/ringbuffer/ring_buffer_mmap.c
> +++ b/lib/ringbuffer/ring_buffer_mmap.c
> @@ -32,8 +32,14 @@
> /*
>  * fault() vm_op implementation for ring buffer file mapping.
>  */
> +#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;
> +#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)
> {
> +#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */

Same here, ifdefs should contain entire functions.

Thanks,

Mathieu

>   struct lib_ring_buffer *buf = vma->vm_private_data;
>   struct channel *chan = buf->backend.chan;
>   const struct lib_ring_buffer_config *config = >backend.config;
> --
> 2.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules] Fix: changes to the vm_op fault cb prototype in libringbuffer

2017-03-07 Thread Francis Deslauriers
Signed-off-by: Francis Deslauriers 
---
 lib/ringbuffer/ring_buffer_mmap.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/lib/ringbuffer/ring_buffer_mmap.c 
b/lib/ringbuffer/ring_buffer_mmap.c
index 35d30e7..1ca45a7 100644
--- a/lib/ringbuffer/ring_buffer_mmap.c
+++ b/lib/ringbuffer/ring_buffer_mmap.c
@@ -32,8 +32,14 @@
 /*
  * fault() vm_op implementation for ring buffer file mapping.
  */
+#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;
+#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)
 {
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
struct lib_ring_buffer *buf = vma->vm_private_data;
struct channel *chan = buf->backend.chan;
const struct lib_ring_buffer_config *config = >backend.config;
-- 
2.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules] Fix: update btrfs instrumentation for kernel 4.11

2017-03-07 Thread Francis Deslauriers
Signed-off-by: Francis Deslauriers 
---
 instrumentation/events/lttng-module/btrfs.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/instrumentation/events/lttng-module/btrfs.h 
b/instrumentation/events/lttng-module/btrfs.h
index cc7ba50..2955e28 100644
--- a/instrumentation/events/lttng-module/btrfs.h
+++ b/instrumentation/events/lttng-module/btrfs.h
@@ -87,9 +87,18 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, 
btrfs_inode_evict,
 
 LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
+
+   TP_PROTO(struct btrfs_root *root, struct btrfs_inode *inode,
+   struct extent_map *map),
+
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
+
TP_PROTO(struct btrfs_root *root, struct inode *inode,
struct extent_map *map),
 
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
+
TP_ARGS(root, inode, map),
 
TP_FIELDS(
-- 
2.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules] Fix: update mm_vmscan instrumentation for kernel 4.11

2017-03-07 Thread Francis Deslauriers
Signed-off-by: Francis Deslauriers 
---
 instrumentation/events/lttng-module/mm_vmscan.h | 62 -
 1 file changed, 60 insertions(+), 2 deletions(-)

diff --git a/instrumentation/events/lttng-module/mm_vmscan.h 
b/instrumentation/events/lttng-module/mm_vmscan.h
index 36ebd5c..5def917 100644
--- a/instrumentation/events/lttng-module/mm_vmscan.h
+++ b/instrumentation/events/lttng-module/mm_vmscan.h
@@ -281,8 +281,36 @@ 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,
@@ -485,7 +513,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.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-modules] Fix: section mismatch warning caused by __exit annotation

2017-03-07 Thread Mathieu Desnoyers
merged into master and stable-2.9, thanks!

Mathieu

- On Mar 7, 2017, at 9:12 AM, Francis Deslauriers 
francis.deslauri...@efficios.com wrote:

> lttng_logger_exit is used in a non-exit function so it can not be
> annotated with `__exit`
> 
> Signed-off-by: Francis Deslauriers 
> ---
> 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.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules] Fix: section mismatch warning caused by __exit annotation

2017-03-07 Thread Francis Deslauriers
lttng_logger_exit is used in a non-exit function so it can not be
annotated with `__exit`

Signed-off-by: Francis Deslauriers 
---
 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.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev