Re: [lttng-dev] Question about lock in synchronize_rcu implementation of URCU

2016-04-27 Thread Paul E. McKenney
Try building without it and see what happens when you run the tests.

Might well be that it is unnecessary, but I will defer to Mathieu
on that point.

Thanx, Paul

On Wed, Apr 27, 2016 at 10:18:04PM -0400, Yuxin Ren wrote:
> As they don't currently perform grace period, why do we use the rcu_gp_lock?
> 
> Thank you.
> Yuxin
> 
> On Wed, Apr 27, 2016 at 10:08 PM, Paul E. McKenney
>  wrote:
> > On Wed, Apr 27, 2016 at 09:34:16PM -0400, Yuxin Ren wrote:
> >> Hi,
> >>
> >> I am learning the URCU code.
> >>
> >> Why do we need rcu_gp_lock in synchronize_rcu?
> >> https://github.com/urcu/userspace-rcu/blob/master/urcu.c#L401
> >>
> >> In the comment, it says this lock ensures mutual exclusion between
> >> threads calling synchronize_rcu().
> >> But only the first thread added to waiter queue can proceed to detect
> >> grace period.
> >> How can multiple threads currently perform the grace thread?
> >
> > They don't concurrently perform grace periods, and it would be wasteful
> > for them to do so.  Instead, the first one performs the grace period,
> > and all that were waiting at the time it started get the benefit of that
> > same grace period.
> >
> > Any that arrived after the first grace period performs the first
> > grace period are served by whichever of them performs the second
> > grace period.
> >
> > Thanx, Paul
> >
> 

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


Re: [lttng-dev] [PATCH 1/3] tests/lib/Makefile.am: Remove test_seek_empty_packet and test_seek_big_trace from SCRIPT_LIST

2016-04-27 Thread Simon Marchi

On 2016-04-27 22:52, Simon Marchi wrote:

Since these files are generated by autoconf, they shouldn't be included
in SCRIPT_LIST, which is the list of scripts to copy from the source
directory to the build directory.  This gets rid of these warnings when
building:

  cp: cannot stat
'/home/simark/src/babeltrace/tests/lib/test_seek_big_trace': No such
file or directory
  cp: cannot stat
'/home/simark/src/babeltrace/tests/lib/test_seek_empty_packet': No
such file or directory

Signed-off-by: Simon Marchi 
---
 tests/lib/Makefile.am | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am
index e23bcc1..a08cbf6 100644
--- a/tests/lib/Makefile.am
+++ b/tests/lib/Makefile.am
@@ -41,9 +41,7 @@ test_bt_values_SOURCES = test_bt_values.c
 test_ctf_ir_ref_SOURCES = test_ctf_ir_ref.c
 test_bt_ctf_field_type_validation_SOURCES = 
test_bt_ctf_field_type_validation.c


-SCRIPT_LIST = test_seek_big_trace \
-   test_seek_empty_packet \
-   test_ctf_writer_complete
+SCRIPT_LIST = test_ctf_writer_complete
 EXTRA_DIST = test_seek_big_trace.in test_seek_empty_packet.in
 CLEANFILES= test_seek_big_trace test_seek_empty_packet


Sorry, forgot to mention that this series is meant for babeltrace.
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH 3/3] tests/lib: Make test_dwarf and test_bin_info tests work out-of-tree

2016-04-27 Thread Simon Marchi
When building out of tree, these tests fail to find the test data.  This
patch makes them (their _complete wrappers, actually) generated by
Autoconf, so the proper path to the test data (which is in the source
directory) can be written.

Signed-off-by: Simon Marchi 
---
 configure.ac|  2 ++
 tests/lib/Makefile.am   | 11 ---
 tests/lib/test_bin_info_complete| 22 --
 tests/lib/test_bin_info_complete.in | 22 ++
 tests/lib/test_dwarf_complete   | 22 --
 tests/lib/test_dwarf_complete.in| 21 +
 6 files changed, 53 insertions(+), 47 deletions(-)
 delete mode 100755 tests/lib/test_bin_info_complete
 create mode 100755 tests/lib/test_bin_info_complete.in
 delete mode 100755 tests/lib/test_dwarf_complete
 create mode 100755 tests/lib/test_dwarf_complete.in

diff --git a/configure.ac b/configure.ac
index 4578fc0..baeb4a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -353,6 +353,8 @@ AC_CONFIG_FILES([
 
 AC_CONFIG_FILES([tests/lib/test_seek_big_trace], [chmod +x 
tests/lib/test_seek_big_trace])
 AC_CONFIG_FILES([tests/lib/test_seek_empty_packet], [chmod +x 
tests/lib/test_seek_empty_packet])
+AC_CONFIG_FILES([tests/lib/test_dwarf_complete], [chmod +x 
tests/lib/test_dwarf_complete])
+AC_CONFIG_FILES([tests/lib/test_bin_info_complete], [chmod +x 
tests/lib/test_bin_info_complete])
 AC_CONFIG_FILES([tests/bin/test_trace_read], [chmod +x 
tests/bin/test_trace_read])
 AC_CONFIG_FILES([tests/bin/test_intersection], [chmod +x 
tests/bin/test_intersection])
 AC_CONFIG_FILES([tests/bin/test_packet_seq_num], [chmod +x 
tests/bin/test_packet_seq_num])
diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am
index b39bd34..c0088a0 100644
--- a/tests/lib/Makefile.am
+++ b/tests/lib/Makefile.am
@@ -42,8 +42,14 @@ test_ctf_ir_ref_SOURCES = test_ctf_ir_ref.c
 test_bt_ctf_field_type_validation_SOURCES = test_bt_ctf_field_type_validation.c
 
 SCRIPT_LIST = test_ctf_writer_complete
-EXTRA_DIST = test_seek_big_trace.in test_seek_empty_packet.in
-DISTCLEANFILES = test_seek_big_trace test_seek_empty_packet
+EXTRA_DIST = test_seek_big_trace.in \
+test_seek_empty_packet.in \
+test_dwarf_complete.in \
+test_bin_info_complete.in
+DISTCLEANFILES = test_seek_big_trace \
+test_seek_empty_packet \
+test_dwarf_complete \
+test_bin_info_complete
 
 if ENABLE_DEBUGINFO
 test_dwarf_LDFLAGS = -static
@@ -59,7 +65,6 @@ test_bin_info_LDADD = $(LIBTAP) \
 test_bin_info_SOURCES = test_bin_info.c
 
 noinst_PROGRAMS += test_dwarf test_bin_info
-SCRIPT_LIST += test_dwarf_complete test_bin_info_complete
 endif
 
 dist_noinst_SCRIPTS = $(SCRIPT_LIST)
diff --git a/tests/lib/test_bin_info_complete b/tests/lib/test_bin_info_complete
deleted file mode 100755
index 0f93010..000
--- a/tests/lib/test_bin_info_complete
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015 - Antoine Busque 
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-CURDIR=$(dirname $0)/
-ROOTDIR=$CURDIR../..
-
-$CURDIR/test_bin_info $ROOTDIR/tests/debuginfo-data
diff --git a/tests/lib/test_bin_info_complete.in 
b/tests/lib/test_bin_info_complete.in
new file mode 100755
index 000..80c1e90
--- /dev/null
+++ b/tests/lib/test_bin_info_complete.in
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 - Antoine Busque 
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+
+DEBUGINFO_DATA=@abs_top_srcdir@/tests/debuginfo-data
+
+@abs_top_builddir@/tests/lib/test_bin_info $DEBUGINFO_DATA
diff --git a/tests/lib/test_dwarf_complete 

[lttng-dev] [PATCH 2/3] tests/lib/Makefile.am: use DISTCLEANFILES instead of CLEANFILES

2016-04-27 Thread Simon Marchi
Files test_seek_empty_packet and test_seek_big_trace are generated by
configuring, not by making.  Therefore, we do not want a make clean to
remove them.  Otherwise, doing...

  * make
  * make clean
  * make
  * make check

... fails.

We want, however, to delete them when doing make distclean.

Signed-off-by: Simon Marchi 
---
 tests/lib/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am
index a08cbf6..b39bd34 100644
--- a/tests/lib/Makefile.am
+++ b/tests/lib/Makefile.am
@@ -43,7 +43,7 @@ test_bt_ctf_field_type_validation_SOURCES = 
test_bt_ctf_field_type_validation.c
 
 SCRIPT_LIST = test_ctf_writer_complete
 EXTRA_DIST = test_seek_big_trace.in test_seek_empty_packet.in
-CLEANFILES= test_seek_big_trace test_seek_empty_packet
+DISTCLEANFILES = test_seek_big_trace test_seek_empty_packet
 
 if ENABLE_DEBUGINFO
 test_dwarf_LDFLAGS = -static
-- 
2.8.0

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


[lttng-dev] [PATCH 1/3] tests/lib/Makefile.am: Remove test_seek_empty_packet and test_seek_big_trace from SCRIPT_LIST

2016-04-27 Thread Simon Marchi
Since these files are generated by autoconf, they shouldn't be included
in SCRIPT_LIST, which is the list of scripts to copy from the source
directory to the build directory.  This gets rid of these warnings when
building:

  cp: cannot stat '/home/simark/src/babeltrace/tests/lib/test_seek_big_trace': 
No such file or directory
  cp: cannot stat 
'/home/simark/src/babeltrace/tests/lib/test_seek_empty_packet': No such file or 
directory

Signed-off-by: Simon Marchi 
---
 tests/lib/Makefile.am | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am
index e23bcc1..a08cbf6 100644
--- a/tests/lib/Makefile.am
+++ b/tests/lib/Makefile.am
@@ -41,9 +41,7 @@ test_bt_values_SOURCES = test_bt_values.c
 test_ctf_ir_ref_SOURCES = test_ctf_ir_ref.c
 test_bt_ctf_field_type_validation_SOURCES = test_bt_ctf_field_type_validation.c
 
-SCRIPT_LIST = test_seek_big_trace \
-   test_seek_empty_packet \
-   test_ctf_writer_complete
+SCRIPT_LIST = test_ctf_writer_complete
 EXTRA_DIST = test_seek_big_trace.in test_seek_empty_packet.in
 CLEANFILES= test_seek_big_trace test_seek_empty_packet
 
-- 
2.8.0

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


Re: [lttng-dev] Question about lock in synchronize_rcu implementation of URCU

2016-04-27 Thread Yuxin Ren
As they don't currently perform grace period, why do we use the rcu_gp_lock?

Thank you.
Yuxin

On Wed, Apr 27, 2016 at 10:08 PM, Paul E. McKenney
 wrote:
> On Wed, Apr 27, 2016 at 09:34:16PM -0400, Yuxin Ren wrote:
>> Hi,
>>
>> I am learning the URCU code.
>>
>> Why do we need rcu_gp_lock in synchronize_rcu?
>> https://github.com/urcu/userspace-rcu/blob/master/urcu.c#L401
>>
>> In the comment, it says this lock ensures mutual exclusion between
>> threads calling synchronize_rcu().
>> But only the first thread added to waiter queue can proceed to detect
>> grace period.
>> How can multiple threads currently perform the grace thread?
>
> They don't concurrently perform grace periods, and it would be wasteful
> for them to do so.  Instead, the first one performs the grace period,
> and all that were waiting at the time it started get the benefit of that
> same grace period.
>
> Any that arrived after the first grace period performs the first
> grace period are served by whichever of them performs the second
> grace period.
>
> Thanx, Paul
>
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] Question about lock in synchronize_rcu implementation of URCU

2016-04-27 Thread Paul E. McKenney
On Wed, Apr 27, 2016 at 09:34:16PM -0400, Yuxin Ren wrote:
> Hi,
> 
> I am learning the URCU code.
> 
> Why do we need rcu_gp_lock in synchronize_rcu?
> https://github.com/urcu/userspace-rcu/blob/master/urcu.c#L401
> 
> In the comment, it says this lock ensures mutual exclusion between
> threads calling synchronize_rcu().
> But only the first thread added to waiter queue can proceed to detect
> grace period.
> How can multiple threads currently perform the grace thread?

They don't concurrently perform grace periods, and it would be wasteful
for them to do so.  Instead, the first one performs the grace period,
and all that were waiting at the time it started get the benefit of that
same grace period.

Any that arrived after the first grace period performs the first
grace period are served by whichever of them performs the second
grace period.

Thanx, Paul

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


[lttng-dev] Question about lock in synchronize_rcu implementation of URCU

2016-04-27 Thread Yuxin Ren
Hi,

I am learning the URCU code.

Why do we need rcu_gp_lock in synchronize_rcu?
https://github.com/urcu/userspace-rcu/blob/master/urcu.c#L401

In the comment, it says this lock ensures mutual exclusion between
threads calling synchronize_rcu().
But only the first thread added to waiter queue can proceed to detect
grace period.
How can multiple threads currently perform the grace thread?

Thanks a lot!
Yuxin
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-tools stable-2.6] Fix: free ust channel object after grace period in consumer

2016-04-27 Thread Mathieu Desnoyers
[ Backport from master branch
commit b83e03c499 "Fix: free metadata cache after grace period in consumer" ]

Signed-off-by: Mathieu Desnoyers 
---
 src/common/consumer.c  | 11 +++
 src/common/ust-consumer/ust-consumer.c |  8 
 src/common/ust-consumer/ust-consumer.h |  6 ++
 3 files changed, 25 insertions(+)

diff --git a/src/common/consumer.c b/src/common/consumer.c
index 2dd31ff..9a3bf86 100644
--- a/src/common/consumer.c
+++ b/src/common/consumer.c
@@ -285,6 +285,17 @@ static void free_channel_rcu(struct rcu_head *head)
struct lttng_consumer_channel *channel =
caa_container_of(node, struct lttng_consumer_channel, node);
 
+   switch (consumer_data.type) {
+   case LTTNG_CONSUMER_KERNEL:
+   break;
+   case LTTNG_CONSUMER32_UST:
+   case LTTNG_CONSUMER64_UST:
+   lttng_ustconsumer_free_channel(channel);
+   break;
+   default:
+   ERR("Unknown consumer_data type");
+   abort();
+   }
free(channel);
 }
 
diff --git a/src/common/ust-consumer/ust-consumer.c 
b/src/common/ust-consumer/ust-consumer.c
index 28b7f10..152455c 100644
--- a/src/common/ust-consumer/ust-consumer.c
+++ b/src/common/ust-consumer/ust-consumer.c
@@ -79,6 +79,7 @@ static void destroy_channel(struct lttng_consumer_channel 
*channel)
 */
if (channel->uchan) {
lttng_ustconsumer_del_channel(channel);
+   lttng_ustconsumer_free_channel(channel);
}
free(channel);
 }
@@ -1687,6 +1688,13 @@ void lttng_ustconsumer_del_channel(struct 
lttng_consumer_channel *chan)
if (chan->switch_timer_enabled == 1) {
consumer_timer_switch_stop(chan);
}
+}
+
+void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
+{
+   assert(chan);
+   assert(chan->uchan);
+
consumer_metadata_cache_destroy(chan);
ustctl_destroy_channel(chan->uchan);
 }
diff --git a/src/common/ust-consumer/ust-consumer.h 
b/src/common/ust-consumer/ust-consumer.h
index 4357380..08f1fa8 100644
--- a/src/common/ust-consumer/ust-consumer.h
+++ b/src/common/ust-consumer/ust-consumer.h
@@ -38,6 +38,7 @@ int lttng_ustconsumer_recv_cmd(struct 
lttng_consumer_local_data *ctx,
 
 extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel 
*chan);
 extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
+extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel 
*chan);
 extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream);
 extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
 
@@ -120,6 +121,11 @@ void lttng_ustconsumer_del_channel(struct 
lttng_consumer_channel *chan)
 }
 
 static inline
+void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
+{
+}
+
+static inline
 int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream)
 {
return -ENOSYS;
-- 
2.1.4

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


[lttng-dev] lttng-modules 2.6.x: important fix for kernel compatibility check

2016-04-27 Thread Mathieu Desnoyers
Hi,

Everyone using lttng-modules from 2.6.1 to 2.6.5 and using moderately
recent Linux kernels should consider upgrading to stable-2.7, or at
least picking up this commit from the stable-2.6 branch:

commit c782f1f3e8c799b7ba531ba940209014b66d4564
Author: Mathieu Desnoyers 
Date:   Wed Apr 27 15:18:42 2016 -0400

Fix: missing Tracepoint prototype checking due to bogus merge

Without this fix, lttng-modules 2.6.x happily builds against more
recent Linux kernels that have incompatible tracepoint prototypes.
The end result is a lttng-modules that builds fine against a kernel,
but which OOPS the kernel when kernel tracing is used.

Thanks,

Mathieu

-- 
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