[lttng-dev] Build and test LTTng on Travis CI
Zifei Tong
soariez at gmail.com
Wed Nov 27 08:52:06 EST 2013
Hi David,
I am glad that the travis configuration got merged so quickly and it
does help :)
Here is something I found for the clang issue #697.
tl;dr, following is a *SILLY* patch for the issue:
diff --git a/src/common/hashtable/rculfhash.h b/src/common/hashtable/rculfhash.h
index 17cf6db..601ad98 100644
--- a/src/common/hashtable/rculfhash.h
+++ b/src/common/hashtable/rculfhash.h
@@ -458,7 +458,7 @@ void cds_lfht_resize(struct cds_lfht *ht, unsigned
long new_size);
for (cds_lfht_first(ht, iter), \
pos = caa_container_of(cds_lfht_iter_get_node(iter), \
__typeof__(*(pos)), member); \
- &(pos)->member != NULL; \
+ &(pos)->member == 42; \
cds_lfht_next(ht, iter), \
pos = caa_container_of(cds_lfht_iter_get_node(iter), \
__typeof__(*(pos)), member))
With that patch, all unit tests passed even compiled with clang -O2.
I seems that clang will optimize out the "&(pos)->member != NULL" check.
Asm code with `clang -O2`
0000000000413c00 <snapshot_destroy>:
413c00: 41 57 push %r15
413c02: 41 56 push %r14
413c04: 41 54 push %r12
413c06: 53 push %rbx
413c07: 48 83 ec 18 sub $0x18,%rsp
413c0b: 49 89 ff mov %rdi,%r15
413c0e: 4d 85 ff test %r15,%r15
413c11: 74 64 je 413c77 <snapshot_destroy+0x77>
413c13: e8 f8 05 ff ff callq 404210 <rcu_read_lock_memb at plt>
413c18: 49 8b 47 18 mov 0x18(%r15),%rax
413c1c: 48 8b 38 mov (%rax),%rdi
413c1f: 4c 8d 74 24 08 lea 0x8(%rsp),%r14
413c24: 4c 89 f6 mov %r14,%rsi
413c27: e8 c4 05 ff ff callq 4041f0 <lttng_cds_lfht_first at plt>
413c2c: eb 19 jmp 413c47 <snapshot_destroy+0x47>
413c2e: 66 90 xchg %ax,%ax
413c30: 4c 89 e7 mov %r12,%rdi
413c33: e8 d8 04 ff ff callq 404110 <free at plt>
413c38: 49 8b 47 18 mov 0x18(%r15),%rax
413c3c: 48 8b 38 mov (%rax),%rdi
413c3f: 4c 89 f6 mov %r14,%rsi
413c42: e8 b9 05 ff ff callq 404200 <lttng_cds_lfht_next at plt>
413c47: 48 8b 5c 24 08 mov 0x8(%rsp),%rbx
413c4c: 4c 8d a3 c0 fe ff ff lea -0x140(%rbx),%r12
413c53: 4c 89 ff mov %r15,%rdi
413c56: 4c 89 e6 mov %r12,%rsi
413c59: e8 12 fc ff ff callq 413870 <snapshot_delete_output>
413c5e: 48 8b 7b d8 mov -0x28(%rbx),%rdi
413c62: 48 85 ff test %rdi,%rdi
413c65: 74 c9 je 413c30 <snapshot_destroy+0x30>
413c67: e8 a4 6b ff ff callq 40a810
<consumer_output_send_destroy_relayd>
413c6c: 48 8b 7b d8 mov -0x28(%rbx),%rdi
413c70: e8 2b 72 ff ff callq 40aea0 <consumer_destroy_output>
413c75: eb b9 jmp 413c30 <snapshot_destroy+0x30>
413c77: bf 55 86 43 00 mov $0x438655,%edi
413c7c: be 03 d4 43 00 mov $0x43d403,%esi
413c81: ba 3b 01 00 00 mov $0x13b,%edx
413c86: b9 22 d6 43 00 mov $0x43d622,%ecx
413c8b: e8 50 04 ff ff callq 4040e0 <__assert_fail at plt>
Asm code with `gcc -O2`:
00000000004179e0 <snapshot_destroy>:
4179e0: 55 push %rbp
4179e1: 48 89 fd mov %rdi,%rbp
4179e4: 53 push %rbx
4179e5: 48 83 ec 18 sub $0x18,%rsp
4179e9: 48 85 ff test %rdi,%rdi
4179ec: 74 68 je 417a56 <snapshot_destroy+0x76>
4179ee: e8 0d c6 fe ff callq 404000 <rcu_read_lock_memb at plt>
4179f3: 48 8b 45 18 mov 0x18(%rbp),%rax
4179f7: 48 89 e6 mov %rsp,%rsi
4179fa: 48 8b 38 mov (%rax),%rdi
4179fd: e8 ae c8 fe ff callq 4042b0 <lttng_cds_lfht_first at plt>
417a02: 48 8b 04 24 mov (%rsp),%rax
417a06: 48 85 c0 test %rax,%rax
<------------------ null pointer check here
417a09: 48 8d 98 c0 fe ff ff lea -0x140(%rax),%rbx
417a10: 74 38 je 417a4a <snapshot_destroy+0x6a>
417a12: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
417a18: 48 89 de mov %rbx,%rsi
417a1b: 48 89 ef mov %rbp,%rdi
417a1e: e8 2d fc ff ff callq 417650 <snapshot_delete_output>
417a23: 48 89 df mov %rbx,%rdi
417a26: e8 75 fd ff ff callq 4177a0 <snapshot_output_destroy>
417a2b: 48 8b 45 18 mov 0x18(%rbp),%rax
417a2f: 48 89 e6 mov %rsp,%rsi
417a32: 48 8b 38 mov (%rax),%rdi
417a35: e8 26 c3 fe ff callq 403d60 <lttng_cds_lfht_next at plt>
417a3a: 48 8b 04 24 mov (%rsp),%rax
417a3e: 48 85 c0 test %rax,%rax
417a41: 48 8d 98 c0 fe ff ff lea -0x140(%rax),%rbx
417a48: 75 ce jne 417a18 <snapshot_destroy+0x38>
417a4a: e8 61 ca fe ff callq 4044b0 <rcu_read_unlock_memb at plt>
417a4f: 48 83 c4 18 add $0x18,%rsp
417a53: 5b pop %rbx
417a54: 5d pop %rbp
417a55: c3 retq
417a56: b9 a0 02 44 00 mov $0x4402a0,%ecx
417a5b: ba 3b 01 00 00 mov $0x13b,%edx
417a60: be 12 02 44 00 mov $0x440212,%esi
417a65: bf 39 64 44 00 mov $0x446439,%edi
417a6a: e8 31 c5 fe ff callq 403fa0 <__assert_fail at plt>
417a6f: 90 nop
I did not see any null pointer check in clang's code.
There is a '-fno-delete-null-pointer-checks' flag in gcc, however
clang does not support it, see
http://llvm.org/bugs/show_bug.cgi?id=9251 .
Hope my rough analysis helps.
Thanks!
--
Best Regards,
仝子飞 (Zifei Tong)
On Tue, Nov 26, 2013 at 11:52 PM, David Goulet <dgoulet at efficios.com> wrote:
> Hi Zifei,
>
> On 25 Nov (23:21:30), Zifei Tong wrote:
>> Hi,
>>
>> I just made a travis script [1] to build and test LTTng on Travis CI.
>> I think this might be useful in case you work on your own lttng fork
>> and want to have a CI system to check your commits.
>>
>> The lttng test suite runs good with gcc on Travis CI [2], with minor
>> changes [4] with respect to bug #666 [5] and the 50 minutes build time
>> limit of Travis CI.
>>
>> However for clang build [3], the unit tests won't pass. And I can
>> confirm this failure on my own machine. I've created #697 [6] on bug
>> tracker with full backtraces.
>
> I've pushed a travis file upstream in lttng-tools based on your version
> [1] and I'm currently using it quite a bit with my development branch so
> big thanks for that!
>
> I've fixed most of the clang compiler issues, just need to investiguate
> #697 [6] for the travis' test to succeed.
>
> Bug 666 [5] is also fixed now so you don't need a custom patch for
> travis-ci.org. A fast and a long UST snapshot tests were added where the
> "make check" runs the fast one (only 10 snapshots in the loop version
> the 1000 for the long).
>
> Again, thank you! Cheers!
> David
>
>>
>> Thanks !
>>
>> [1] https://raw.github.com/5kg/lttng-tools/travis-ci/.travis.yml
>> [2] https://travis-ci.org/5kg/lttng-tools/jobs/14490911
>> [3] https://travis-ci.org/5kg/lttng-tools/jobs/14490912
>> [4] https://github.com/5kg/lttng-tools/commit/afad46a2e7497e7dd5101f170df278f8ded3a1f7
>> [5] https://bugs.lttng.org/issues/666
>> [6] https://bugs.lttng.org/issues/697
>> --
>> Best Regards,
>> 仝子飞 (Zifei Tong)
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev at lists.lttng.org
>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
On 11/26/13, David Goulet <dgoulet at efficios.com> wrote:
> Hi Zifei,
>
> On 25 Nov (23:21:30), Zifei Tong wrote:
>> Hi,
>>
>> I just made a travis script [1] to build and test LTTng on Travis CI.
>> I think this might be useful in case you work on your own lttng fork
>> and want to have a CI system to check your commits.
>>
>> The lttng test suite runs good with gcc on Travis CI [2], with minor
>> changes [4] with respect to bug #666 [5] and the 50 minutes build time
>> limit of Travis CI.
>>
>> However for clang build [3], the unit tests won't pass. And I can
>> confirm this failure on my own machine. I've created #697 [6] on bug
>> tracker with full backtraces.
>
> I've pushed a travis file upstream in lttng-tools based on your version
> [1] and I'm currently using it quite a bit with my development branch so
> big thanks for that!
>
> I've fixed most of the clang compiler issues, just need to investiguate
> #697 [6] for the travis' test to succeed.
>
> Bug 666 [5] is also fixed now so you don't need a custom patch for
> travis-ci.org. A fast and a long UST snapshot tests were added where the
> "make check" runs the fast one (only 10 snapshots in the loop version
> the 1000 for the long).
>
> Again, thank you! Cheers!
> David
>
>>
>> Thanks !
>>
>> [1] https://raw.github.com/5kg/lttng-tools/travis-ci/.travis.yml
>> [2] https://travis-ci.org/5kg/lttng-tools/jobs/14490911
>> [3] https://travis-ci.org/5kg/lttng-tools/jobs/14490912
>> [4]
>> https://github.com/5kg/lttng-tools/commit/afad46a2e7497e7dd5101f170df278f8ded3a1f7
>> [5] https://bugs.lttng.org/issues/666
>> [6] https://bugs.lttng.org/issues/697
>> --
>> Best Regards,
>> 仝子飞 (Zifei Tong)
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev at lists.lttng.org
>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
--
--
Best Regards,
仝子飞 (Zifei Tong)
College of Computer Science and Technology, Zhejiang University
soariez at gmail.com / tongzifei at zju.edu.cn
More information about the lttng-dev
mailing list