<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/locking/locktorture.c, branch v5.14</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.14</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.14'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2021-03-19T11:13:10Z</updated>
<entry>
<title>locking/locktorture: Fix incorrect use of ww_acquire_ctx in ww_mutex test</title>
<updated>2021-03-19T11:13:10Z</updated>
<author>
<name>Waiman Long</name>
<email>longman@redhat.com</email>
</author>
<published>2021-03-18T17:28:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c52cca04f97a4c09ec2f0bd8fe6d0cdf49834e4'/>
<id>urn:sha1:8c52cca04f97a4c09ec2f0bd8fe6d0cdf49834e4</id>
<content type='text'>
The ww_acquire_ctx structure for ww_mutex needs to persist for a complete
lock/unlock cycle. In the ww_mutex test in locktorture, however, both
ww_acquire_init() and ww_acquire_fini() are called within the lock
function only. This causes a lockdep splat of "WARNING: Nested lock
was not taken" when lockdep is enabled in the kernel.

To fix this problem, we need to move the ww_acquire_fini() after
the ww_mutex_unlock() in torture_ww_mutex_unlock(). This is done by
allocating a global array of ww_acquire_ctx structures. Each locking
thread is associated with its own ww_acquire_ctx via the unique thread
id it has so that both the lock and unlock functions can access the
same ww_acquire_ctx structure.

Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20210318172814.4400-6-longman@redhat.com
</content>
</entry>
<entry>
<title>locking/locktorture: Pass thread id to lock/unlock functions</title>
<updated>2021-03-19T11:13:10Z</updated>
<author>
<name>Waiman Long</name>
<email>longman@redhat.com</email>
</author>
<published>2021-03-18T17:28:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=aa3a5f31877e5dc131cc286ce707413d441c8375'/>
<id>urn:sha1:aa3a5f31877e5dc131cc286ce707413d441c8375</id>
<content type='text'>
To allow the lock and unlock functions in locktorture to access
per-thread information, we need to pass some hint on how to locate
those information. One way to do this is to pass in a unique thread
id which can then be used to access a global array for thread specific
information.

Change the lock and unlock method to add a thread id parameter which
can be determined by the offset of the lwsp/lrsp pointer from the global
lwsa/lrsa array.

There is no other functional change in this patch.

Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20210318172814.4400-5-longman@redhat.com
</content>
</entry>
<entry>
<title>locking/locktorture: Fix false positive circular locking splat in ww_mutex test</title>
<updated>2021-03-19T11:13:09Z</updated>
<author>
<name>Waiman Long</name>
<email>longman@redhat.com</email>
</author>
<published>2021-03-18T17:28:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2ea55bbba23e9d36996299664d618393c8602646'/>
<id>urn:sha1:2ea55bbba23e9d36996299664d618393c8602646</id>
<content type='text'>
In order to avoid false positive circular locking lockdep splat
when runnng the ww_mutex torture test, we need to make sure that
the ww_mutexes have the same lock class as the acquire_ctx. This
means the ww_mutexes must have the same lockdep key as the
acquire_ctx. Unfortunately the current DEFINE_WW_MUTEX() macro fails
to do that. As a result, we add an init method for the ww_mutex test
to do explicit ww_mutex_init()'s of the ww_mutexes to avoid the false
positive warning.

Suggested-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20210318172814.4400-3-longman@redhat.com
</content>
</entry>
<entry>
<title>Merge branches 'doc.2021.01.06a', 'fixes.2021.01.04b', 'kfree_rcu.2021.01.04a', 'mmdumpobj.2021.01.22a', 'nocb.2021.01.06a', 'rt.2021.01.04a', 'stall.2021.01.06a', 'torture.2021.01.12a' and 'tortureall.2021.01.06a' into HEAD</title>
<updated>2021-01-22T23:26:44Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@kernel.org</email>
</author>
<published>2021-01-22T23:26:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0d2460ba61841e5c2e64e77f7a84d3fc69cfe899'/>
<id>urn:sha1:0d2460ba61841e5c2e64e77f7a84d3fc69cfe899</id>
<content type='text'>
doc.2021.01.06a: Documentation updates.
fixes.2021.01.04b: Miscellaneous fixes.
kfree_rcu.2021.01.04a: kfree_rcu() updates.
mmdumpobj.2021.01.22a: Dump allocation point for memory blocks.
nocb.2021.01.06a: RCU callback offload updates and cblist segment lengths.
rt.2021.01.04a: Real-time updates.
stall.2021.01.06a: RCU CPU stall warning updates.
torture.2021.01.12a: Torture-test updates and polling SRCU grace-period API.
tortureall.2021.01.06a: Torture-test script updates.
</content>
</entry>
<entry>
<title>locking: Remove duplicate include of percpu-rwsem.h</title>
<updated>2021-01-04T23:54:49Z</updated>
<author>
<name>Wang Qing</name>
<email>wangqing@vivo.com</email>
</author>
<published>2020-11-07T08:24:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c5586e32dfe258925c5dbb599bea3eadf34e79c1'/>
<id>urn:sha1:c5586e32dfe258925c5dbb599bea3eadf34e79c1</id>
<content type='text'>
This commit removes an unnecessary #include.

Signed-off-by: Wang Qing &lt;wangqing@vivo.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>locktorture: Invoke percpu_free_rwsem() to do percpu-rwsem cleanup</title>
<updated>2020-11-07T01:13:56Z</updated>
<author>
<name>Hou Tao</name>
<email>houtao1@huawei.com</email>
</author>
<published>2020-09-24T14:18:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0d7202876bcb968a68f5608b9ff7a824fbc7e94d'/>
<id>urn:sha1:0d7202876bcb968a68f5608b9ff7a824fbc7e94d</id>
<content type='text'>
When executing the LOCK06 locktorture scenario featuring percpu-rwsem,
the RCU callback rcu_sync_func() may still be pending after locktorture
module is removed.  This can in turn lead to the following Oops:

  BUG: unable to handle page fault for address: ffffffffc00eb920
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x0000) - not-present page
  PGD 6500a067 P4D 6500a067 PUD 6500c067 PMD 13a36c067 PTE 800000013691c163
  Oops: 0000 [#1] PREEMPT SMP
  CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.9.0-rc5+ #4
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
  RIP: 0010:rcu_cblist_dequeue+0x12/0x30
  Call Trace:
   &lt;IRQ&gt;
   rcu_core+0x1b1/0x860
   __do_softirq+0xfe/0x326
   asm_call_on_stack+0x12/0x20
   &lt;/IRQ&gt;
   do_softirq_own_stack+0x5f/0x80
   irq_exit_rcu+0xaf/0xc0
   sysvec_apic_timer_interrupt+0x2e/0xb0
   asm_sysvec_apic_timer_interrupt+0x12/0x20

This commit avoids tis problem by adding an exit hook in lock_torture_ops
and using it to call percpu_free_rwsem() for percpu rwsem torture during
the module-cleanup function, thus ensuring that rcu_sync_func() completes
before module exits.

It is also necessary to call the exit hook if lock_torture_init()
fails half-way, so this commit also adds an -&gt;init_called field in
lock_torture_cxt to indicate that exit hook, if present, must be called.

Signed-off-by: Hou Tao &lt;houtao1@huawei.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>locktorture: Prevent hangs for invalid arguments</title>
<updated>2020-11-07T01:13:53Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@kernel.org</email>
</author>
<published>2020-09-18T18:18:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6b74fa0a776e3715d385b23d29db469179c825b0'/>
<id>urn:sha1:6b74fa0a776e3715d385b23d29db469179c825b0</id>
<content type='text'>
If an locktorture torture-test run is given a bad kvm.sh argument, the
test will complain to the console, which is good.  What is bad is that
from the user's perspective, it will just hang for the time specified
by the --duration argument.  This commit therefore forces an immediate
kernel shutdown if a lock_torture_init()-time error occurs, thus avoiding
the appearance of a hang.  It also forces a console splat in this case
to clearly indicate the presence of an error.

Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>locktorture: Ignore nreaders_stress if no readlock support</title>
<updated>2020-11-07T01:13:52Z</updated>
<author>
<name>Hou Tao</name>
<email>houtao1@huawei.com</email>
</author>
<published>2020-09-18T11:44:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e5ace37d83af459bd491847df570b6763c602344'/>
<id>urn:sha1:e5ace37d83af459bd491847df570b6763c602344</id>
<content type='text'>
Exclusive locks do not have readlock support, which means that a
locktorture run with the following module parameters will do nothing:

 torture_type=mutex_lock nwriters_stress=0 nreaders_stress=1

This commit therefore rejects this combination for exclusive locks by
returning -EINVAL during module init.

Signed-off-by: Hou Tao &lt;houtao1@huawei.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>locktorture: Track time of last -&gt;writeunlock()</title>
<updated>2020-11-07T01:13:29Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@kernel.org</email>
</author>
<published>2020-08-31T04:48:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3480d6774f07341e3e1cf3114f58bef98ea58ae0'/>
<id>urn:sha1:3480d6774f07341e3e1cf3114f58bef98ea58ae0</id>
<content type='text'>
This commit adds a last_lock_release variable that tracks the time of
the last -&gt;writeunlock() call, which allows easier diagnosing of lock
hangs when using a kernel debugger.

Acked-by: Davidlohr Bueso &lt;dbueso@suse.de&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>locktorture: Make function torture_percpu_rwsem_init() static</title>
<updated>2020-08-25T01:45:32Z</updated>
<author>
<name>Wei Yongjun</name>
<email>weiyongjun1@huawei.com</email>
</author>
<published>2020-07-03T05:05:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d49bed9abc3454bd123cbe974ecbeae119701b92'/>
<id>urn:sha1:d49bed9abc3454bd123cbe974ecbeae119701b92</id>
<content type='text'>
The sparse tool complains as follows:

kernel/locking/locktorture.c:569:6: warning:
 symbol 'torture_percpu_rwsem_init' was not declared. Should it be static?

And this function is not used outside of locktorture.c,
so this commit marks it static.

Signed-off-by: Wei Yongjun &lt;weiyongjun1@huawei.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
</feed>
