Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1418321 > unrolled thread
| Started by | Vishal Thanki <vishalthanki@gmail.com> |
|---|---|
| First post | 2016-06-09 15:40 +0200 |
| Last post | 2016-06-14 12:30 +0200 |
| Articles | 7 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/2] Fixing the compilation errors for liblockdep Vishal Thanki <vishalthanki@gmail.com> - 2016-06-09 15:40 +0200
[PATCH 2/2] liblockdep: Remove -lpthread compiler option Vishal Thanki <vishalthanki@gmail.com> - 2016-06-09 15:40 +0200
[PATCH 1/2] liblockdep: Fix compile errors Vishal Thanki <vishalthanki@gmail.com> - 2016-06-09 15:40 +0200
Re: [PATCH 1/2] liblockdep: Fix compile errors Sasha Levin <sasha.levin@oracle.com> - 2016-06-11 06:00 +0200
Re: [PATCH 1/2] liblockdep: Fix compile errors Vishal Thanki <vishalthanki@gmail.com> - 2016-06-11 10:40 +0200
Re: [PATCH 1/2] liblockdep: Fix compile errors Sasha Levin <sasha.levin@oracle.com> - 2016-06-13 22:40 +0200
Re: [PATCH 1/2] liblockdep: Fix compile errors Vishal Thanki <vishalthanki@gmail.com> - 2016-06-14 12:30 +0200
| From | Vishal Thanki <vishalthanki@gmail.com> |
|---|---|
| Date | 2016-06-09 15:40 +0200 |
| Subject | [PATCH 0/2] Fixing the compilation errors for liblockdep |
| Message-ID | <rI8lI-6YM-3@gated-at.bofh.it> |
The patch tries to fix the compilation errors in liblockdep which were introduced due to recent changes in kernel. I am not familiar with the internal working of lockdep, so please suggest if I have done anything wrong while fixing liblockdep errors. Vishal Thanki (2): liblockdep: Fix compile errors liblockdep: Remove -lpthread compiler option tools/lib/lockdep/lockdep.c | 2 +- tools/lib/lockdep/run_tests.sh | 4 ++-- tools/lib/lockdep/uinclude/linux/jhash.h | 20 ++++++++++++++++++++ tools/lib/lockdep/uinclude/linux/kernel.h | 1 + tools/lib/lockdep/uinclude/linux/lockdep.h | 2 +- 5 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 tools/lib/lockdep/uinclude/linux/jhash.h -- 2.4.11
[toc] | [next] | [standalone]
| From | Vishal Thanki <vishalthanki@gmail.com> |
|---|---|
| Date | 2016-06-09 15:40 +0200 |
| Subject | [PATCH 2/2] liblockdep: Remove -lpthread compiler option |
| Message-ID | <rI8lI-6YM-15@gated-at.bofh.it> |
| In reply to | #1418321 |
With -lpthread option, the test for ABBA_2threads was failing, and test passed if it was removed. Since -pthread compiler option is sufficient for linking to pthread libraries, this patch removes -lpthread. Signed-off-by: Vishal Thanki <vishalthanki@gmail.com> --- tools/lib/lockdep/run_tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/lockdep/run_tests.sh b/tools/lib/lockdep/run_tests.sh index 1069d96..3fd297b 100755 --- a/tools/lib/lockdep/run_tests.sh +++ b/tools/lib/lockdep/run_tests.sh @@ -4,7 +4,7 @@ make &> /dev/null for i in `ls tests/*.c`; do testname=$(basename "$i" .c) - gcc -o tests/$testname -pthread -lpthread $i liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &> /dev/null + gcc -o tests/$testname -pthread $i liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &> /dev/null echo -ne "$testname... " if [ $(timeout 1 ./tests/$testname | wc -l) -gt 0 ]; then echo "PASSED!" @@ -18,7 +18,7 @@ done for i in `ls tests/*.c`; do testname=$(basename "$i" .c) - gcc -o tests/$testname -pthread -lpthread -Iinclude $i &> /dev/null + gcc -o tests/$testname -pthread -Iinclude $i &> /dev/null echo -ne "(PRELOAD) $testname... " if [ $(timeout 1 ./lockdep ./tests/$testname | wc -l) -gt 0 ]; then echo "PASSED!" -- 2.4.11
[toc] | [prev] | [next] | [standalone]
| From | Vishal Thanki <vishalthanki@gmail.com> |
|---|---|
| Date | 2016-06-09 15:40 +0200 |
| Subject | [PATCH 1/2] liblockdep: Fix compile errors |
| Message-ID | <rI8lJ-6YM-41@gated-at.bofh.it> |
| In reply to | #1418321 |
Following commit caused failures.
dfaaf3fa0: (Use __jhash_mix() for iterate_chain_key())
Fixed by adding jhash.h with minimal stuff required
75dd602a5: (lockdep: Fix lock_chain::base size)
Fixed by adding ARRAY_SIZE macro definition and
changing the MAX_LOCK_DEPTH value to similar defined
in linux/sched.h
Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
---
tools/lib/lockdep/lockdep.c | 2 +-
tools/lib/lockdep/uinclude/linux/jhash.h | 20 ++++++++++++++++++++
tools/lib/lockdep/uinclude/linux/kernel.h | 1 +
tools/lib/lockdep/uinclude/linux/lockdep.h | 2 +-
4 files changed, 23 insertions(+), 2 deletions(-)
create mode 100644 tools/lib/lockdep/uinclude/linux/jhash.h
diff --git a/tools/lib/lockdep/lockdep.c b/tools/lib/lockdep/lockdep.c
index a0a2e3a..1ba6f33 100644
--- a/tools/lib/lockdep/lockdep.c
+++ b/tools/lib/lockdep/lockdep.c
@@ -4,5 +4,5 @@
#define hlist_for_each_entry_rcu hlist_for_each_entry
#define hlist_add_head_rcu hlist_add_head
#define hlist_del_rcu hlist_del
-
+#define prandom_u32 rand
#include "../../../kernel/locking/lockdep.c"
diff --git a/tools/lib/lockdep/uinclude/linux/jhash.h b/tools/lib/lockdep/uinclude/linux/jhash.h
new file mode 100644
index 0000000..5c40bd1
--- /dev/null
+++ b/tools/lib/lockdep/uinclude/linux/jhash.h
@@ -0,0 +1,20 @@
+#ifndef _LINUX_JHASH_H
+#define _LINUX_JHASH_H
+
+static inline __u32 rol32(__u32 word, unsigned int shift)
+{
+ return (word << shift) | (word >> ((-shift) & 31));
+}
+
+/* __jhash_mix -- mix 3 32-bit values reversibly. */
+#define __jhash_mix(a, b, c) \
+{ \
+ a -= c; a ^= rol32(c, 4); c += b; \
+ b -= a; b ^= rol32(a, 6); a += c; \
+ c -= b; c ^= rol32(b, 8); b += a; \
+ a -= c; a ^= rol32(c, 16); c += b; \
+ b -= a; b ^= rol32(a, 19); a += c; \
+ c -= b; c ^= rol32(b, 4); b += a; \
+}
+
+#endif /* _LINUX_JHASH_H */
diff --git a/tools/lib/lockdep/uinclude/linux/kernel.h b/tools/lib/lockdep/uinclude/linux/kernel.h
index 276c7a8..ab204c8 100644
--- a/tools/lib/lockdep/uinclude/linux/kernel.h
+++ b/tools/lib/lockdep/uinclude/linux/kernel.h
@@ -44,4 +44,5 @@
#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
#endif
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif
diff --git a/tools/lib/lockdep/uinclude/linux/lockdep.h b/tools/lib/lockdep/uinclude/linux/lockdep.h
index c808c7d..8f6e725 100644
--- a/tools/lib/lockdep/uinclude/linux/lockdep.h
+++ b/tools/lib/lockdep/uinclude/linux/lockdep.h
@@ -8,7 +8,7 @@
#include <linux/utsname.h>
#include <linux/compiler.h>
-#define MAX_LOCK_DEPTH 2000UL
+#define MAX_LOCK_DEPTH 48UL
#define asmlinkage
#define __visible
--
2.4.11
[toc] | [prev] | [next] | [standalone]
| From | Sasha Levin <sasha.levin@oracle.com> |
|---|---|
| Date | 2016-06-11 06:00 +0200 |
| Subject | Re: [PATCH 1/2] liblockdep: Fix compile errors |
| Message-ID | <rIIfv-6jL-5@gated-at.bofh.it> |
| In reply to | #1418329 |
On 06/09/2016 09:34 AM, Vishal Thanki wrote: > dfaaf3fa0: (Use __jhash_mix() for iterate_chain_key()) > Fixed by adding jhash.h with minimal stuff required Can we, instead of copying it over, include jhash.h directly (just like we do for hash.h)? Thanks, Sasha
[toc] | [prev] | [next] | [standalone]
| From | Vishal Thanki <vishalthanki@gmail.com> |
|---|---|
| Date | 2016-06-11 10:40 +0200 |
| Subject | Re: [PATCH 1/2] liblockdep: Fix compile errors |
| Message-ID | <rIMCu-KC-3@gated-at.bofh.it> |
| In reply to | #1419902 |
On Sat, Jun 11, 2016 at 5:53 AM, Sasha Levin <sasha.levin@oracle.com> wrote: > On 06/09/2016 09:34 AM, Vishal Thanki wrote: >> dfaaf3fa0: (Use __jhash_mix() for iterate_chain_key()) >> Fixed by adding jhash.h with minimal stuff required > > Can we, instead of copying it over, include jhash.h directly > (just like we do for hash.h)? > > That was the first thing I tried, but then it caused more compilation errors due to nested header dependencies and I ended up taking the only required stuff. Better ideas are welcome. Thanks, Vishal > Thanks, > Sasha
[toc] | [prev] | [next] | [standalone]
| From | Sasha Levin <sasha.levin@oracle.com> |
|---|---|
| Date | 2016-06-13 22:40 +0200 |
| Subject | Re: [PATCH 1/2] liblockdep: Fix compile errors |
| Message-ID | <rJGOl-2R5-11@gated-at.bofh.it> |
| In reply to | #1419950 |
On 06/11/2016 04:36 AM, Vishal Thanki wrote: > On Sat, Jun 11, 2016 at 5:53 AM, Sasha Levin <sasha.levin@oracle.com> wrote: >> On 06/09/2016 09:34 AM, Vishal Thanki wrote: >>> dfaaf3fa0: (Use __jhash_mix() for iterate_chain_key()) >>> Fixed by adding jhash.h with minimal stuff required >> >> Can we, instead of copying it over, include jhash.h directly >> (just like we do for hash.h)? >> >> > That was the first thing I tried, but then it caused more compilation > errors due to nested header dependencies and I ended up taking the > only required stuff. Better ideas are welcome. I just gave it a quick go and didn't see anything beyond needing to take in linux/unaligned/packed_struct.h as well. What sort of errors did you hit? Thanks, Sasha
[toc] | [prev] | [next] | [standalone]
| From | Vishal Thanki <vishalthanki@gmail.com> |
|---|---|
| Date | 2016-06-14 12:30 +0200 |
| Subject | Re: [PATCH 1/2] liblockdep: Fix compile errors |
| Message-ID | <rJTLz-3z3-5@gated-at.bofh.it> |
| In reply to | #1421292 |
On Mon, Jun 13, 2016 at 04:38:01PM -0400, Sasha Levin wrote:
> On 06/11/2016 04:36 AM, Vishal Thanki wrote:
> > On Sat, Jun 11, 2016 at 5:53 AM, Sasha Levin <sasha.levin@oracle.com> wrote:
> >> On 06/09/2016 09:34 AM, Vishal Thanki wrote:
> >>> dfaaf3fa0: (Use __jhash_mix() for iterate_chain_key())
> >>> Fixed by adding jhash.h with minimal stuff required
> >>
> >> Can we, instead of copying it over, include jhash.h directly
> >> (just like we do for hash.h)?
> >>
> >>
> > That was the first thing I tried, but then it caused more compilation
> > errors due to nested header dependencies and I ended up taking the
> > only required stuff. Better ideas are welcome.
>
> I just gave it a quick go and didn't see anything beyond needing to take
> in linux/unaligned/packed_struct.h as well. What sort of errors did you
> hit?
>
Yes, you are right about just adding the linux/unaligned/packed_struct.h should
work. However I hit the following errors when I did that:
CC lockdep.o
In file included from ./uinclude/linux/jhash.h:27:0,
from ../../../kernel/locking/lockdep.c:49,
from lockdep.c:8:
./uinclude/linux/unaligned/packed_struct.h:7:29: error: conflicting types for
‘__packed’
struct __una_u32 { u32 x; } __packed;
^
./uinclude/linux/unaligned/packed_struct.h:6:29: note: previous declaration of
‘__packed’ was here
struct __una_u16 { u16 x; } __packed;
^
./uinclude/linux/unaligned/packed_struct.h:8:29: error: conflicting types for
‘__packed’
struct __una_u64 { u64 x; } __packed;
^
./uinclude/linux/unaligned/packed_struct.h:6:29: note: previous declaration of
‘__packed’ was here
struct __una_u16 { u16 x; } __packed;
^
which I overlooked and had nothing to do with header dependencies, pardon my
ignorance.
I think gcc on my machine (version 5.3.1 on Fedora 22) throws the above error
which I think can be fixed by adding a define in uinclude/linux/compile.h like
following:
#define __packed __attribute__((__packed__))
After fixing, I hit following warning:
In file included from ../../../kernel/locking/lockdep.c:49:0,
from lockdep.c:8:
./uinclude/linux/jhash.h: In function ‘jhash’:
./uinclude/linux/jhash.h:37:16: warning: implicit declaration of function
‘rol32’ [-Wimplicit-function-declaration]
a -= c; a ^= rol32(c, 4); c += b; \
which can be fixed by adding the inline definition of rol32 from kernel's
biopts.h file to uinclude/linux/bitops.h file (which is empty as of now).
I will rework the patch with the fixes and send again.
Thanks,
Vishal
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web