<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/lib/locking-selftest.c, branch v5.10.204</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.10.204</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.10.204'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2021-07-14T14:56:10Z</updated>
<entry>
<title>lockdep/selftests: Fix selftests vs PROVE_RAW_LOCK_NESTING</title>
<updated>2021-07-14T14:56:10Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2021-06-17T18:57:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f18f7a2276979e1ce3183152d560ca89ef97e73f'/>
<id>urn:sha1:f18f7a2276979e1ce3183152d560ca89ef97e73f</id>
<content type='text'>
[ Upstream commit c0c2c0dad6a06e0c05e9a52d65f932bd54364c97 ]

When PROVE_RAW_LOCK_NESTING=y many of the selftests FAILED because
HARDIRQ context is out-of-bounds for spinlocks. Instead make the
default hardware context the threaded hardirq context, which preserves
the old locking rules.

The wait-type specific locking selftests will have a non-threaded
HARDIRQ variant.

Fixes: de8f5e4f2dc1 ("lockdep: Introduce wait-type checks")
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Tested-by: Joerg Roedel &lt;jroedel@suse.de&gt;
Link: https://lore.kernel.org/r/20210617190313.322096283@infradead.org
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>lockdep/selftest: Introduce recursion3</title>
<updated>2020-08-26T10:42:08Z</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2020-08-07T07:42:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=96a16f45aed89cf024606a11679b0609d09552c7'/>
<id>urn:sha1:96a16f45aed89cf024606a11679b0609d09552c7</id>
<content type='text'>
Add a test case shows that USED_IN_*_READ and ENABLE_*_READ can cause
deadlock too.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20200807074238.1632519-20-boqun.feng@gmail.com
</content>
</entry>
<entry>
<title>locking/selftest: Add test cases for queued_read_lock()</title>
<updated>2020-08-26T10:42:07Z</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2020-08-07T07:42:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ad56450db86413ff911eb527b5a49e04a4345e61'/>
<id>urn:sha1:ad56450db86413ff911eb527b5a49e04a4345e61</id>
<content type='text'>
Add two self test cases for the following case:

	P0:			P1:			P2:

				&lt;in irq handler&gt;
	spin_lock_irq(&amp;slock)	read_lock(&amp;rwlock)
							write_lock_irq(&amp;rwlock)
	read_lock(&amp;rwlock)	spin_lock(&amp;slock)

, which is a deadlock, as the read_lock() on P0 cannot get the lock
because of the fairness.

	P0:			P1:			P2:

	&lt;in irq handler&gt;
	spin_lock(&amp;slock)	read_lock(&amp;rwlock)
							write_lock(&amp;rwlock)
	read_lock(&amp;rwlock)	spin_lock_irq(&amp;slock)

, which is not a deadlock, as the read_lock() on P0 can get the lock
because it could use the unfair fastpass.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20200807074238.1632519-19-boqun.feng@gmail.com
</content>
</entry>
<entry>
<title>Revert "locking/lockdep/selftests: Fix mixed read-write ABBA tests"</title>
<updated>2020-08-26T10:42:07Z</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2020-08-07T07:42:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=108dc42ed3507fe06214d51ab15fca7771df8bbd'/>
<id>urn:sha1:108dc42ed3507fe06214d51ab15fca7771df8bbd</id>
<content type='text'>
This reverts commit d82fed75294229abc9d757f08a4817febae6c4f4.

Since we now could handle mixed read-write deadlock detection well, the
self tests could be detected as expected, no need to use this
work-around.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20200807074238.1632519-18-boqun.feng@gmail.com
</content>
</entry>
<entry>
<title>lockdep/selftest: Add more recursive read related test cases</title>
<updated>2020-08-26T10:42:07Z</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2020-08-07T07:42:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8ef7ca75120a39167def40f41daefee013c4b5af'/>
<id>urn:sha1:8ef7ca75120a39167def40f41daefee013c4b5af</id>
<content type='text'>
Add those four test cases:

1.	X --(ER)--&gt; Y --(ER)--&gt; Z --(ER)--&gt; X is deadlock.

2.	X --(EN)--&gt; Y --(SR)--&gt; Z --(ER)--&gt; X is deadlock.

3.	X --(EN)--&gt; Y --(SR)--&gt; Z --(SN)--&gt; X is not deadlock.

4.	X --(ER)--&gt; Y --(SR)--&gt; Z --(EN)--&gt; X is not deadlock.

Those self testcases are valuable for the development of supporting
recursive read related deadlock detection.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20200807074238.1632519-17-boqun.feng@gmail.com
</content>
</entry>
<entry>
<title>lockdep/selftest: Unleash irq_read_recursion2 and add more</title>
<updated>2020-08-26T10:42:06Z</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2020-08-07T07:42:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=31e0d747708272356bee9b6a1b90c1e6525b0f6d'/>
<id>urn:sha1:31e0d747708272356bee9b6a1b90c1e6525b0f6d</id>
<content type='text'>
Now since we can handle recursive read related irq inversion deadlocks
correctly, uncomment the irq_read_recursion2 and add more testcases.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20200807074238.1632519-16-boqun.feng@gmail.com
</content>
</entry>
<entry>
<title>lockdep/selftest: Add a R-L/L-W test case specific to chain cache behavior</title>
<updated>2020-08-26T10:42:06Z</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2020-08-07T07:42:32Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d4f200e579e96051f1f081f795820787826eb234'/>
<id>urn:sha1:d4f200e579e96051f1f081f795820787826eb234</id>
<content type='text'>
As our chain cache doesn't differ read/write locks, so even we can
detect a read-lock/lock-write deadlock in check_noncircular(), we can
still be fooled if a read-lock/lock-read case(which is not a deadlock)
comes first.

So introduce this test case to test specific to the chain cache behavior
on detecting recursive read lock related deadlocks.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20200807074238.1632519-14-boqun.feng@gmail.com
</content>
</entry>
<entry>
<title>locking: More accurate annotations for read_lock()</title>
<updated>2020-08-26T10:42:02Z</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2020-08-07T07:42:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e918188611f073063415f40fae568fa4d86d9044'/>
<id>urn:sha1:e918188611f073063415f40fae568fa4d86d9044</id>
<content type='text'>
On the archs using QUEUED_RWLOCKS, read_lock() is not always a recursive
read lock, actually it's only recursive if in_interrupt() is true. So
change the annotation accordingly to catch more deadlocks.

Note we used to treat read_lock() as pure recursive read locks in
lib/locking-seftest.c, and this is useful, especially for the lockdep
development selftest, so we keep this via a variable to force switching
lock annotation for read_lock().

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20200807074238.1632519-2-boqun.feng@gmail.com
</content>
</entry>
<entry>
<title>locking/lockdep: Remove unused @nested argument from lock_release()</title>
<updated>2019-10-09T10:46:10Z</updated>
<author>
<name>Qian Cai</name>
<email>cai@lca.pw</email>
</author>
<published>2019-09-19T16:09:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5facae4f3549b5cf7c0e10ec312a65ffd43b5726'/>
<id>urn:sha1:5facae4f3549b5cf7c0e10ec312a65ffd43b5726</id>
<content type='text'>
Since the following commit:

  b4adfe8e05f1 ("locking/lockdep: Remove unused argument in __lock_release")

@nested is no longer used in lock_release(), so remove it from all
lock_release() calls and friends.

Signed-off-by: Qian Cai &lt;cai@lca.pw&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Acked-by: Will Deacon &lt;will@kernel.org&gt;
Acked-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: airlied@linux.ie
Cc: akpm@linux-foundation.org
Cc: alexander.levin@microsoft.com
Cc: daniel@iogearbox.net
Cc: davem@davemloft.net
Cc: dri-devel@lists.freedesktop.org
Cc: duyuyang@gmail.com
Cc: gregkh@linuxfoundation.org
Cc: hannes@cmpxchg.org
Cc: intel-gfx@lists.freedesktop.org
Cc: jack@suse.com
Cc: jlbec@evilplan.or
Cc: joonas.lahtinen@linux.intel.com
Cc: joseph.qi@linux.alibaba.com
Cc: jslaby@suse.com
Cc: juri.lelli@redhat.com
Cc: maarten.lankhorst@linux.intel.com
Cc: mark@fasheh.com
Cc: mhocko@kernel.org
Cc: mripard@kernel.org
Cc: ocfs2-devel@oss.oracle.com
Cc: rodrigo.vivi@intel.com
Cc: sean@poorly.run
Cc: st@kernel.org
Cc: tj@kernel.org
Cc: tytso@mit.edu
Cc: vdavydov.dev@gmail.com
Cc: vincent.guittot@linaro.org
Cc: viro@zeniv.linux.org.uk
Link: https://lkml.kernel.org/r/1568909380-32199-1-git-send-email-cai@lca.pw
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>locking/lockdep: Make it easy to detect whether or not inside a selftest</title>
<updated>2019-02-28T06:55:43Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2019-02-14T23:00:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cdc84d794947b5431c0a6916c303aee7114819d2'/>
<id>urn:sha1:cdc84d794947b5431c0a6916c303aee7114819d2</id>
<content type='text'>
The patch that frees unused lock classes will modify the behavior of
lockdep_free_key_range() and lockdep_reset_lock() depending on whether
or not these functions are called from the context of the lockdep
selftests. Hence make it easy to detect whether or not lockdep code
is called from the context of a lockdep selftest.

Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Johannes Berg &lt;johannes@sipsolutions.net&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will.deacon@arm.com&gt;
Cc: johannes.berg@intel.com
Cc: tj@kernel.org
Link: https://lkml.kernel.org/r/20190214230058.196511-10-bvanassche@acm.org
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
</feed>
