[PATCH v4 30/30] locking/lockdep: Add more lockdep selftest cases

2019-08-29 Thread Yuyang Du
for impact! Signed-off-by: Yuyang Du --- lib/locking-selftest.c | 1077 1 file changed, 1077 insertions(+) diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c index 7d14d87..4fb6ab6 100644 --- a/lib/locking-selftest.c +++ b/lib/locking

[PATCH v4 26/30] locking/lockdep: Add nest lock type

2019-08-29 Thread Yuyang Du
Add a macro LOCK_TYPE_NEST for nest lock type and mark the nested lock in check_deadlock_current(). Unlike the other LOCK_TYPE_* enums, this lock type is used only in lockdep. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 7 +-- kernel/locking

[PATCH v4 27/30] locking/lockdep: Add lock exclusiveness table

2019-08-29 Thread Yuyang Du
Lock exclusiveness table gathers the information about whether two lock acquisitions for the same lock instance can be granted concurrently. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/kernel/locking

[PATCH v4 23/30] locking/lockdep: Adjust BFS algorithm to support multiple matches

2019-08-29 Thread Yuyang Du
. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 51 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index d13b6b7..3ad97bc 100644 --- a/kernel/locking/lockdep.c +++ b/kernel

[PATCH v4 28/30] locking/lockdep: Support read-write lock's deadlock detection

2019-08-29 Thread Yuyang Du
g checks if the dependency is redundant, the chain lookup hits are significantly more, the cyclic checks are halved, and the find-mask forwards checks are only as many as a quarter, which can be translated into better performance after this patch series. Reference: [1]: Recursive read deadlocks and Where to

[PATCH v4 29/30] locking/lockdep: Adjust selftest case for recursive read lock

2019-08-29 Thread Yuyang Du
n deadlock checks, the SUCCESS's of _rlock cases are only because the dependencies having recursive-read locks (rlock) are not included in the graph. Signed-off-by: Yuyang Du --- lib/locking-selftest.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff -

[PATCH v4 20/30] locking/lockdep: Update direct dependency's read-write type if it exists

2019-08-29 Thread Yuyang Du
When adding a dependency, if the dependency exists the dependency's read-write type will be "upgraded" if the new dependency has more exclusive lock types. The order toward more exclusiveness is: recursive read -> read -> write. Signed-off-by: Yuyang Du --- kernel/lockin

[PATCH v4 19/30] locking/lockdep: Add helper functions to operate on the searched path

2019-08-29 Thread Yuyang Du
- find_lock_in_path() tries to find whether a lock class is in the path. - find_next_dep_in_path() returns the next dependency after a given dependency in the path. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 31 +++ 1 file changed, 31 insertions

[PATCH v4 21/30] locking/lockdep: Introduce chain_hlocks_type for held lock's read-write type

2019-08-29 Thread Yuyang Du
Lock chain needs to include information about the read-write lock type. To that end, introduce: chain_hlocks_type[MAX_LOCKDEP_CHAIN_HLOCKS] in tandem with: chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS] Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 10 ++ 1 file

[PATCH v4 25/30] locking/lockdep: Introduce mark_lock_unaccessed()

2019-08-29 Thread Yuyang Du
Since in the graph search, multiple matches may be needed, a matched lock needs to rejoin the search for another match, thereby introduce mark_lock_unaccessed(). Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 9 + 1 file changed, 9 insertions(+) diff --git a/kernel/locking

[PATCH v4 24/30] locking/lockdep: Define the two task model for lockdep checks formally

2019-08-29 Thread Yuyang Du
aph traversing algorithm (__bfs()) to stop when two neighboring direct dependencies are not in the same lock chain and the middle lock is a recursive-read lock (rwlock). Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 68 1 file changed, 68 insertions

[PATCH v4 22/30] locking/lockdep: Hash held lock's read-write type into chain key

2019-08-29 Thread Yuyang Du
type (higher 16 bits) as opposed to just class index before: held lock type (16 bits) : lock class index (16 bits) Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 1 + kernel/locking/lockdep.c | 55 ++-- 2 files changed, 40 insertions

[PATCH v4 11/30] locking/lockdep: Remove irq-safe to irq-unsafe read check

2019-08-29 Thread Yuyang Du
| -> | unsafe | read unsafe | |--| | safe | F B | - | |--| | read safe | F B | - | -- Signed-off-by: Yuyang Du --- kernel/

[PATCH v4 06/30] locking/lockdep: Update comments in struct lock_list and held_lock

2019-08-29 Thread Yuyang Du
The comments regarding initial chain key and BFS are outdated, so update them. Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index d7bec61..0246a70

[PATCH v4 12/30] locking/lockdep: Specify the depth of current lock stack in lookup_chain_cache_add()

2019-08-29 Thread Yuyang Du
When looking up and adding a chain (i.e., in lookup_chain_cache_add() and only in it), explicitly specify the depth of the held lock stack as the chain. The depth now only equals curr->lockdep_depth. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c |

[PATCH v4 18/30] ocking/lockdep: Add read-write type for a lock dependency

2019-08-29 Thread Yuyang Du
ues are one of the lock_type enums. Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 15 ++- kernel/locking/lockdep.c | 25 +++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 2335447..eab8

[PATCH v4 17/30] locking/lockdep: Use lock type enum to explicitly specify read or write locks

2019-08-29 Thread Yuyang Du
Add an enum to formally quantify lock types. No functional change. Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 27 --- include/linux/rcupdate.h | 2 +- kernel/locking/lockdep.c | 19 +++ 3 files changed, 32 insertions(+), 16 deletions

[PATCH v4 08/30] locking/lockdep: Skip checks if direct dependency is already present

2019-08-29 Thread Yuyang Du
actually is not a small number. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 34 +++--- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 4838c99..de088da 100644 --- a/kernel/locking/lockde

[PATCH v4 16/30] locking/lockdep: Add lock chains to direct lock dependency graph

2019-08-29 Thread Yuyang Du
... L1 -> L2 | . Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 85 +--- 1 file changed, 81 insertions(+), 4 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 33f8187..754a718 100644 --- a/kernel/lo

[PATCH v4 10/30] locking/lockdep: Remove useless lock type assignment

2019-08-29 Thread Yuyang Du
The next lock to acquire has its lock type set already, so there is no need to reassign it regardless of whether it is recursive read. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/kernel/locking/lockdep.c

[PATCH v4 15/30] locking/lockdep: Consolidate forward and backward lock_lists into one

2019-08-29 Thread Yuyang Du
is change the rule to use which class[] or entry[] element is simple: whenever forward graph search is performed use class[1] and entry[1], and whenever backward graph search is performed use class[0] and entry[0]. Actually, should be no functional change. Signed-off-by: Yuyang Du --- include/linux/

[PATCH v4 14/30] locking/lockdep: Combine lock_lists in struct lock_class into an array

2019-08-29 Thread Yuyang Du
We are going to combine forward dependency lock_lists and backward dependency lock_lists. To prepare for that, we combine locks_before and locks_after lists, which makes the codes a bit clearer after all. No functional change. Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 6

[PATCH v4 07/30] locking/lockdep: Remove indirect dependency redundancy check

2019-08-29 Thread Yuyang Du
complicated to implement. Lets remove it for good. This inevitably increases the number of dependencies, but after combining forward and backward dependencies, the increase will be offset. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 41

[PATCH v4 13/30] locking/lockdep: Treat every lock dependency as in a new lock chain

2019-08-29 Thread Yuyang Du
is guarantteed that each dependency has at least a lock chain associated with it. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 223 +++ 1 file changed, 108 insertions(+), 115 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/

[PATCH v4 09/30] locking/lockdep: Remove chain_head argument in validate_chain()

2019-08-29 Thread Yuyang Du
This argument says whether the chain is a head, meaning having just one lock, which can actually be tested by lock_chain->depth. So there is no need to explicitly make this argument, so remove it. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c |

[PATCH v4 01/30] locking/lockdep: Rename deadlock check functions

2019-08-29 Thread Yuyang Du
a dependency circle in lock graph is not sufficient condition for lock inversion deadlocks anymore, so check_noncircular() is not entirely accurate. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions

[PATCH v4 05/30] locking/lockdep: Add lock chain list_head field in struct lock_list and lock_chain

2019-08-29 Thread Yuyang Du
A direct lock dependency, such as L1 -> L2, can be in different lock chains having that lock dependency. In order for us to associate lock chains to lock dependencies, we add some new fields in struct lock_list and lock_chain. No functional change. Signed-off-by: Yuyang Du --- include/li

[PATCH v4 03/30] locking/lockdep: Change return type of lookup_chain_cache_add()

2019-08-29 Thread Yuyang Du
Like the previous change, the function lookup_chain_cache_add() returns the pointer of the lock chain if the chain is new. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git

[PATCH v4 02/30] locking/lockdep: Change return type of add_chain_cache()

2019-08-29 Thread Yuyang Du
or NULL otherwise for later use. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 3c89a50..9c9b408 100644 --- a/kernel

[PATCH v4 04/30] locking/lockdep: Pass lock chain from validate_chain() to check_prev_add()

2019-08-29 Thread Yuyang Du
The pointer of lock chains is passed all the way from validate_chain() to check_prev_add(). This is aimed for the later effort to associate lock chains to lock dependencies. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 12 +++- 1 file changed, 7

[PATCH v4 00/30] Support recursive-read lock deadlock detection

2019-08-29 Thread Yuyang Du
validation. - Compose lock chains for those with trylocks or separated by trylocks. - Map lock dependencies to lock chains. - Consolidate forward and backward lock_lists. - Clearly and formally define two-task model for lockdep. -- Yuyang Du (30): locking/lockdep: Rename deadlock check functions

Re: [PATCH] locking/lockdep: hide unused 'class' variable

2019-07-16 Thread Yuyang Du
Whoops. Thanks. On Mon, 15 Jul 2019 at 17:28, Arnd Bergmann wrote: > > The usage is now hidden in an #ifdef, so we need to move > the variable itself in there as well to avoid this warning: > > kernel/locking/lockdep_proc.c:203:21: error: unused variable 'class' >

[tip:locking/urgent] locking/lockdep: Fix lock used or unused stats error

2019-07-13 Thread tip-bot for Yuyang Du
Commit-ID: 68d41d8c94a31dfb8233ab90b9baf41a2ed2da68 Gitweb: https://git.kernel.org/tip/68d41d8c94a31dfb8233ab90b9baf41a2ed2da68 Author: Yuyang Du AuthorDate: Tue, 9 Jul 2019 18:15:22 +0800 Committer: Ingo Molnar CommitDate: Sat, 13 Jul 2019 11:24:53 +0200 locking/lockdep: Fix lock

Re: [PATCH v3 17/30] locking/lockdep: Add read-write type for a lock dependency

2019-07-10 Thread Yuyang Du
Thanks for review. On Wed, 10 Jul 2019 at 13:18, Boqun Feng wrote: > > On Fri, Jun 28, 2019 at 05:15:15PM +0800, Yuyang Du wrote: > > Direct dependencies need to keep track of their read-write lock types. > > Two bit fields, which share the distance field, are added to lock_

Re: [PATCH v3 30/30] locking/lockdep: Remove irq-safe to irq-unsafe read check

2019-07-10 Thread Yuyang Du
Thanks for review. On Wed, 10 Jul 2019 at 13:30, Boqun Feng wrote: > > On Fri, Jun 28, 2019 at 05:15:28PM +0800, Yuyang Du wrote: > > We have a lockdep warning: > > > > > > WARNING: possible irq lock

Re: [PATCH v3 00/30] Support recursive-read lock deadlock detection

2019-07-09 Thread Yuyang Du
Ping. Thanks. On Fri, 28 Jun 2019 at 17:15, Yuyang Du wrote: > > Hi Peter and Ingo, > > Historically, the recursive-read lock is not well supported in lockdep. > This patchset attempts to solve this problem sound and complete. > > The bulk of the algorithm is in patch #27. N

[PATCH] locking/lockdep: Fix lock used or unused stats error

2019-07-09 Thread Yuyang Du
eported-by: Qian Cai Signed-off-by: Yuyang Du --- kernel/locking/lockdep_proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c index 9c49ec6..65b6a16 100644 --- a/kernel/locking/lockdep_proc.c +++ b/k

Re: [PATCH] locking/lockdep: Fix lock IRQ usage initialization bug

2019-07-08 Thread Yuyang Du
Linus for 5.3 [1] includes the offensive > commit "locking/lockdep: Consolidate lock usage bit initialization" but did > not > include this patch. > > [1] https://lore.kernel.org/lkml/20190708093516.ga57...@gmail.com/ > > On Mon, 2019-06-10 at

[PATCH v3 25/30] locking/lockdep: Add nest lock type

2019-06-28 Thread Yuyang Du
Add a macro LOCK_TYPE_NEST for nest lock type and mark the nested lock in check_deadlock_current(). Unlike the other LOCK_TYPE_* enums, this lock type is used only in lockdep. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 7 +-- kernel/locking

[PATCH v3 28/30] locking/lockdep: Adjust selftest case for recursive read lock

2019-06-28 Thread Yuyang Du
n deadlock checks, the SUCCESS's of _rlock cases are only because the dependencies having recursive-read locks (rlock) are not included in the graph. Signed-off-by: Yuyang Du --- lib/locking-selftest.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff -

[PATCH v3 30/30] locking/lockdep: Remove irq-safe to irq-unsafe read check

2019-06-28 Thread Yuyang Du
| -> | unsafe | read unsafe | |--| | safe | F B | - | |--| | read safe | F B | - | -- Signed-off-by: Yuyang Du --- kernel/

[PATCH v3 29/30] locking/lockdep: Add more lockdep selftest cases

2019-06-28 Thread Yuyang Du
for impact! Signed-off-by: Yuyang Du --- lib/locking-selftest.c | 1077 1 file changed, 1077 insertions(+) diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c index 7d14d87..4fb6ab6 100644 --- a/lib/locking-selftest.c +++ b/lib/locking

[PATCH v3 27/30] locking/lockdep: Support read-write lock's deadlock detection

2019-06-28 Thread Yuyang Du
, which can be translated into better performance after this patch series. Reference: [1]: Recursive read deadlocks and Where to find them by Boqun Feng at Linux Linux Plumbers Conference 2018. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 227 +++

[PATCH v3 26/30] locking/lockdep: Add lock exclusiveness table

2019-06-28 Thread Yuyang Du
Lock exclusiveness table gathers the information about whether two lock acquisitions for the same lock instance can be granted concurrently. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/kernel/locking

[PATCH v3 24/30] locking/lockdep: Introduce mark_lock_unaccessed()

2019-06-28 Thread Yuyang Du
Since in graph search, multiple matches may be needed, a matched lock needs to rejoin the search for another match, thereby introduce mark_lock_unaccessed(). Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 9 + 1 file changed, 9 insertions(+) diff --git a/kernel/locking

[PATCH v3 13/30] locking/lockdep: Combine lock_lists in struct lock_class into an array

2019-06-28 Thread Yuyang Du
We are going to combine forward dependency lock_lists and backward dependency lock_lists. Combing locks_before and locks_after lists, this patch makes the code after all this a bit clearer. No functional change. Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 6 ++--- kernel

[PATCH v3 21/30] locking/lockdep: Hash held lock's read-write type into chain key

2019-06-28 Thread Yuyang Du
: held lock type (16 bits) : lock class index (16 bits) Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 1 + kernel/locking/lockdep.c | 55 ++-- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/include/linux/lockdep.h b/include

[PATCH v3 19/30] locking/lockdep: Update direct dependency's read-write type if it exists

2019-06-28 Thread Yuyang Du
When adding a dependency, if the dependency exists the dependency's read-write type will be "upgraded" if the new dependency has more exclusive lock types. The order toward more exclusiveness: recursive read -> read -> write. Signed-off-by: Yuyang Du --- kernel/lockin

[PATCH v3 12/30] locking/lockdep: Treat every lock dependency as in a new lock chain

2019-06-28 Thread Yuyang Du
eating each such depdnency as if it is from a new lock chain. If the chain already exists, then this is a chain hit and the check is actually not needed. After this, it is guarantteed that each dependency has at least a lock chain associated with it. Signed-off-by: Yuyang Du --- kernel/l

[PATCH v3 14/30] locking/lockdep: Consolidate forward and backward lock_lists into one

2019-06-28 Thread Yuyang Du
ep_list[1] With this change the rule to use which class[] or entry[] element is easy: whenever forward graph search is performed use class[1] and entry[1], and whenever backward graph search is performed use class[0] and entry[0]. Actually, should be no functional change. Signed-off-by:

[PATCH v3 20/30] locking/lockdep: Introduce chain_hlocks_type for held lock's read-write type

2019-06-28 Thread Yuyang Du
Lock chain needs to include information about the read-write lock type. To that end, introduce: chain_hlocks_type[MAX_LOCKDEP_CHAIN_HLOCKS] in addition to: chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS] Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 10 ++ 1 file

[PATCH v3 22/30] locking/lockdep: Adjust BFS algorithm to support multiple matches

2019-06-28 Thread Yuyang Du
. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 51 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 10df8eb..7d02b94 100644 --- a/kernel/locking/lockdep.c +++ b/kernel

[PATCH v3 18/30] locking/lockdep: Add helper functions to operate on the searched path

2019-06-28 Thread Yuyang Du
- find_lock_in_path() tries to find whether a lock class is in the path. - find_next_dep_in_path() returns the next dependency after a given dependency in the path. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 31 +++ 1 file changed, 31 insertions

[PATCH v3 23/30] locking/lockdep: Define the two task model for lockdep checks formally

2019-06-28 Thread Yuyang Du
ypes into dependencies. This patch finally modifies the graph traversing algorithm (__bfs()) to stop when two neighboring direct dependencies are not in the same lock chain and the middle lock is a recursive-read lock (rwlock). Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 68 +

[PATCH v3 15/30] locking/lockdep: Add lock chains to direct lock dependency graph

2019-06-28 Thread Yuyang Du
chain 2: L1 -> L2 | ..... Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 79 +--- 1 file changed, 75 insertions(+), 4 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 36d55d3..3b655fd 100644 --- a/kernel/locki

[PATCH v3 16/30] locking/lockdep: Use lock type enum to explicitly specify read or write locks

2019-06-28 Thread Yuyang Du
Add an enum to formally quantify lock types. No functional change. Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 27 --- include/linux/rcupdate.h | 2 +- kernel/locking/lockdep.c | 19 +++ 3 files changed, 32 insertions(+), 16 deletions

[PATCH v3 10/30] locking/lockdep: Remove useless lock type assignment

2019-06-28 Thread Yuyang Du
The next lock to acquire has its lock type set already, so there is no need to reassign it regardless of whether it is recursive read. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/kernel/locking/lockdep.c

[PATCH v3 11/30] locking/lockdep: Specify the depth of current lock stack in lookup_chain_cache_add()

2019-06-28 Thread Yuyang Du
When looking up and adding a chain (i.e., in lookup_chain_cache_add() and only in it), explicitly specify the depth of the held lock stack. This is now only curr->lockdep_depth. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c |

[PATCH v3 17/30] locking/lockdep: Add read-write type for a lock dependency

2019-06-28 Thread Yuyang Du
ere the values are one of the lock_type enums. Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 15 ++- kernel/locking/lockdep.c | 25 +++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h in

[PATCH v3 09/30] locking/lockdep: Remove chain_head argument in validate_chain()

2019-06-28 Thread Yuyang Du
This argument says whether the chain is a head, meaning having just one lock, which can actually be tested by lock_chain->depth. So there is no need to explicitly make this argument, so remove it. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c |

[PATCH v3 03/30] locking/lockdep: Change return type of lookup_chain_cache_add()

2019-06-28 Thread Yuyang Du
Like the previous change, the function lookup_chain_cache_add() returns the pointer of the lock chain if the chain is new. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git

[PATCH v3 04/30] locking/lockdep: Pass lock chain from validate_chain() to check_prev_add()

2019-06-28 Thread Yuyang Du
The pointer of lock chains is passed all the way from validate_chain() to check_prev_add(). This is aimed for a later effort to associate lock chains to lock dependencies. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 13 - 1 file changed, 8

[PATCH v3 08/30] locking/lockdep: Skip checks if direct dependency is already present

2019-06-28 Thread Yuyang Du
igned-off-by: Yuyang Du --- kernel/locking/lockdep.c | 34 +++--- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index c61fdef..4ffb4df 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/

[PATCH v3 00/30] Support recursive-read lock deadlock detection

2019-06-28 Thread Yuyang Du
and backward lock_lists. - Clearly and formally define two-task model for lockdep. Have a good weekend ;) Thanks, Yuyang -- Yuyang Du (30): locking/lockdep: Rename deadlock check functions locking/lockdep: Change return type of add_chain_cache() locking/lockdep: Change return type

[PATCH v3 02/30] locking/lockdep: Change return type of add_chain_cache()

2019-06-28 Thread Yuyang Du
or NULL if otherwise. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index e30e9e4..3546894 100644 --- a/kernel/locking

[PATCH v3 05/30] locking/lockdep: Add lock chain list_head field in struct lock_list and lock_chain

2019-06-28 Thread Yuyang Du
A direct lock dependency, such as L1 -> L2, may be in many lock chains. These newly added fields in struct lock_list and lock_chain will be used to associate lock chains to lock dependencies. No functional change. Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 3 +++ 1 file changed

[PATCH v3 07/30] locking/lockdep: Remove indirect dependency redundancy check

2019-06-28 Thread Yuyang Du
complicated if not impossible to be correctly done. Lets remove it for good. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 41 -- kernel/locking/lockdep_internals.h | 1 - kernel/locking/lockdep_proc.c | 2 -- 3 files changed, 44

[PATCH v3 06/30] locking/lockdep: Update comments in struct lock_list and held_lock

2019-06-28 Thread Yuyang Du
The comments regarding initial chain key and BFS are outdated so update them. Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 3c6fb63..5e0a1a9

[PATCH v3 01/30] locking/lockdep: Rename deadlock check functions

2019-06-28 Thread Yuyang Du
is not a sufficient condition for lock inversion deadlocks anymore, so check_noncircular() is not entirely accurate. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kernel/locking

Re: [PATCH] locking/lockdep: Fix lock IRQ usage initialization bug

2019-06-11 Thread Yuyang Du
Great, thanks. On Mon, 10 Jun 2019 at 23:35, Qian Cai wrote: > > On Mon, 2019-06-10 at 13:52 +0800, Yuyang Du wrote: > > The commit: > > > > 091806515124b20 ("locking/lockdep: Consolidate lock usage bit > > initialization") > > > > misses mar

[PATCH] locking/lockdep: Fix lock IRQ usage initialization bug

2019-06-09 Thread Yuyang Du
The commit: 091806515124b20 ("locking/lockdep: Consolidate lock usage bit initialization") misses marking LOCK_USED flag at IRQ usage initialization when CONFIG_TRACE_IRQFLAGS or CONFIG_PROVE_LOCKING is not defined. Fix it. Reported-by: Qian Cai Signed-off-by: Yuyang Du --- kern

Re: "locking/lockdep: Consolidate lock usage bit initialization" is buggy

2019-06-09 Thread Yuyang Du
Thanks for the further validation. On Fri, 7 Jun 2019 at 22:14, Qian Cai wrote: > Reverted the commit on the top of linux-next fixed the issue. > > With the commit (triggering the warning > DEBUG_LOCKS_WARN_ON(debug_atomic_read(nr_unused_locks) != nr_unused)), > > # cat /proc/lockdep_stats >

Re: "locking/lockdep: Consolidate lock usage bit initialization" is buggy

2019-06-06 Thread Yuyang Du
Thanks for the report, but On Fri, 7 Jun 2019 at 05:14, Qian Cai wrote: > > The linux-next commit "locking/lockdep: Consolidate lock usage bit > initialization" [1] will always generate a warning below. I never had such warning. > Looking through the > commit that when mark_irqflags() returns

Re: [PATCH v8 07/19] locking/rwsem: Implement lock handoff to prevent lock starvation

2019-06-05 Thread Yuyang Du
Hi Waiman, On Wed, 5 Jun 2019 at 00:00, Waiman Long wrote: > With my patchset applied, the reader-writer ordering is still supposed > to be preserved. Of course, there can be exceptions depending on the > exact timing, but we can't rely on that to prevent deadlock. This is exactly what I want

Re: [PATCH v8 07/19] locking/rwsem: Implement lock handoff to prevent lock starvation

2019-06-03 Thread Yuyang Du
On Tue, 4 Jun 2019 at 11:03, Yuyang Du wrote: > > Hi Waiman, > > On Tue, 21 May 2019 at 05:01, Waiman Long wrote: > > > > Because of writer lock stealing, it is possible that a constant > > stream of incoming writers will cause a waiting writer or reader to > &g

Re: [PATCH v8 07/19] locking/rwsem: Implement lock handoff to prevent lock starvation

2019-06-03 Thread Yuyang Du
Hi Waiman, On Tue, 21 May 2019 at 05:01, Waiman Long wrote: > > Because of writer lock stealing, it is possible that a constant > stream of incoming writers will cause a waiting writer or reader to > wait indefinitely leading to lock starvation. > > This patch implements a lock handoff mechanism

[tip:locking/core] locking/lockdep: Remove !dir in lock irq usage check

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: bf998b98f5bce4ebc97b3980016f54fabb7a4958 Gitweb: https://git.kernel.org/tip/bf998b98f5bce4ebc97b3980016f54fabb7a4958 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:39 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:53 +0200 locking/lockdep: Remove !dir

[tip:locking/core] locking/lockdep: Adjust new bit cases in mark_lock

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 4d56330df22dd9dd9a24f147014f60ee4c914fb8 Gitweb: https://git.kernel.org/tip/4d56330df22dd9dd9a24f147014f60ee4c914fb8 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:38 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:52 +0200 locking/lockdep: Adjust new

[tip:locking/core] locking/lockdep: Consolidate lock usage bit initialization

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 091806515124b20f8cff7927b4b7ff399483b109 Gitweb: https://git.kernel.org/tip/091806515124b20f8cff7927b4b7ff399483b109 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:37 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:51 +0200 locking/lockdep: Consolidate

[tip:locking/core] locking/lockdep: Check redundant dependency only when CONFIG_LOCKDEP_SMALL

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 68e9dc29f8f42c79d2a3755223ed910ce36b4ae2 Gitweb: https://git.kernel.org/tip/68e9dc29f8f42c79d2a3755223ed910ce36b4ae2 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:36 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:50 +0200 locking/lockdep: Check

[tip:locking/core] locking/lockdep: Refactorize check_noncircular and check_redundant

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 8c2c2b449aa50463ba4cc1f33cdfc98750ed03ab Gitweb: https://git.kernel.org/tip/8c2c2b449aa50463ba4cc1f33cdfc98750ed03ab Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:35 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:50 +0200 locking/lockdep: Refactorize

[tip:locking/core] locking/lockdep: Remove unused argument in __lock_release

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: b4adfe8e05f15d7e73309c93c2c337df7eb5278f Gitweb: https://git.kernel.org/tip/b4adfe8e05f15d7e73309c93c2c337df7eb5278f Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:34 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:49 +0200 locking/lockdep: Remove unused

[tip:locking/core] locking/lockdep: Remove redundant argument in check_deadlock

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 4609c4f963f353613812f999bb027aac795bcde8 Gitweb: https://git.kernel.org/tip/4609c4f963f353613812f999bb027aac795bcde8 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:33 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:49 +0200 locking/lockdep: Remove

[tip:locking/core] locking/lockdep: Add explanation to lock usage rules in lockdep design doc

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 1ac4ba5ed0114bcc146d5743d97df414af25c524 Gitweb: https://git.kernel.org/tip/1ac4ba5ed0114bcc146d5743d97df414af25c524 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:32 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:48 +0200 locking/lockdep: Add

[tip:locking/core] locking/lockdep: Update comments on dependency search

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 154f185e9c0f6c50ac8e901630e14aa5b36f9414 Gitweb: https://git.kernel.org/tip/154f185e9c0f6c50ac8e901630e14aa5b36f9414 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:31 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:47 +0200 locking/lockdep: Update

[tip:locking/core] locking/lockdep: Avoid constant checks in __bfs by using offset reference

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 77a806922cfdebcf3ae89d31a8b592a7f7fbe537 Gitweb: https://git.kernel.org/tip/77a806922cfdebcf3ae89d31a8b592a7f7fbe537 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:30 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:46 +0200 locking/lockdep: Avoid

[tip:locking/core] locking/lockdep: Change the return type of __cq_dequeue()

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: c1661325597f68bc9e632c4fa9c86983d56fba4f Gitweb: https://git.kernel.org/tip/c1661325597f68bc9e632c4fa9c86983d56fba4f Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:29 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:46 +0200 locking/lockdep: Change

[tip:locking/core] locking/lockdep: Change type of the element field in circular_queue

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: aa4807719e076bfb2dee9c96adf2c648e47d472f Gitweb: https://git.kernel.org/tip/aa4807719e076bfb2dee9c96adf2c648e47d472f Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:28 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:45 +0200 locking/lockdep: Change type

[tip:locking/core] locking/lockdep: Update comment

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 31a490e5c54f5499aa744f8524611e2a4b19f8ba Gitweb: https://git.kernel.org/tip/31a490e5c54f5499aa744f8524611e2a4b19f8ba Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:27 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:44 +0200 locking/lockdep: Update

[tip:locking/core] locking/lockdep: Remove unused argument in validate_chain() and check_deadlock()

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 0b9fc8ecfa3c8900da7adbbef23438de9ec0 Gitweb: https://git.kernel.org/tip/0b9fc8ecfa3c8900da7adbbef23438de9ec0 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:26 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:44 +0200 locking/lockdep: Remove unused

[tip:locking/core] locking/lockdep: Change the range of class_idx in held_lock struct

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 01bb6f0af992a1e6b7797d92fd31a7864872e347 Gitweb: https://git.kernel.org/tip/01bb6f0af992a1e6b7797d92fd31a7864872e347 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:25 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:43 +0200 locking/lockdep: Change

[tip:locking/core] locking/lockdep: Define INITIAL_CHAIN_KEY for chain keys to start with

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: f6ec8829ac9d59b637366c13038f15d6f6156fe1 Gitweb: https://git.kernel.org/tip/f6ec8829ac9d59b637366c13038f15d6f6156fe1 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:24 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:43 +0200 locking/lockdep: Define

[tip:locking/core] locking/lockdep: Use lockdep_init_task for task initiation consistently

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: e196e479a3b844da6e6e71e0d2a8694040cb4e52 Gitweb: https://git.kernel.org/tip/e196e479a3b844da6e6e71e0d2a8694040cb4e52 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:23 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:42 +0200 locking/lockdep: Use

[tip:locking/core] locking/lockdep: Update obsolete struct field description

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: d16dbd1b8a29bb9f8aca2c2f3bd1a0d2b7621126 Gitweb: https://git.kernel.org/tip/d16dbd1b8a29bb9f8aca2c2f3bd1a0d2b7621126 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:22 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:41 +0200 locking/lockdep: Update

[tip:locking/core] locking/lockdep: Print the right depth for chain key collision

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: 834494b28024b39d45aea6bcc642b0fe94fe2503 Gitweb: https://git.kernel.org/tip/834494b28024b39d45aea6bcc642b0fe94fe2503 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:21 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:36 +0200 locking/lockdep: Print

[tip:locking/core] locking/lockdep: Remove useless conditional macro

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: e7a38f63ba50dc95426dd50c43383dfecaa35d7f Gitweb: https://git.kernel.org/tip/e7a38f63ba50dc95426dd50c43383dfecaa35d7f Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:20 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:35 +0200 locking/lockdep: Remove

[tip:locking/core] locking/lockdep: Adjust lock usage bit character checks

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: c52478f4f38ace598475413a08dba9b9fd827eaf Gitweb: https://git.kernel.org/tip/c52478f4f38ace598475413a08dba9b9fd827eaf Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:19 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:35 +0200 locking/lockdep: Adjust lock

[tip:locking/core] locking/lockdep: Add description and explanation in lockdep design doc

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: c01fbbc83f42748b3ed094497933601e6c9e0a03 Gitweb: https://git.kernel.org/tip/c01fbbc83f42748b3ed094497933601e6c9e0a03 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:18 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:34 +0200 locking/lockdep: Add

[tip:locking/core] locking/lockdep: Change all print_*() return type to void

2019-06-03 Thread tip-bot for Yuyang Du
Commit-ID: f7c1c6b36a3874d3a7987fb3af829d5b0d75bda7 Gitweb: https://git.kernel.org/tip/f7c1c6b36a3874d3a7987fb3af829d5b0d75bda7 Author: Yuyang Du AuthorDate: Mon, 6 May 2019 16:19:17 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:55:32 +0200 locking/lockdep: Change all

Re: [PATCH v2 11/17] locking/lockdep: Adjust lockdep selftest cases

2019-05-30 Thread Yuyang Du
Thanks for review. On Wed, 29 May 2019 at 19:44, Boqun Feng wrote: > > > @@ -424,7 +424,7 @@ static void rwsem_ABBA2(void) > > ML(Y1); > > RSL(X1); > > RSU(X1); > > - MU(Y1); // should fail > > + MU(Y1); // should NOT fail > > I'm afraid you get this wrong ;-) reader of

  1   2   3   4   5   6   7   8   9   10   >