Bug 203647

Summary: Locking API testsuite fails "mixed read-lock/lock-write ABBA" rlock on kernels >=4.14.x
Product: Platform Specific/Hardware Reporter: Erhard F. (erhard_f)
Component: PPC-64Assignee: platform_ppc-64
Status: RESOLVED DOCUMENTED    
Severity: normal CC: matorola, michael
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.1.3 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg (5.1.3, G5 11,2)
dmesg (5.0.17, G5 11,2)
dmesg (4.19.44, G5 11,2)
dmesg (4.14.120, G5 11,2)
dmesg (4.9.177, G5 11,2)
kernel .config (5.1.3, G5 11,2)

Description Erhard F. 2019-05-19 19:34:47 UTC
Created attachment 282831 [details]
dmesg (5.1.3, G5 11,2)

Probably this test fails on ppc64 since it is around. Kernel 4.9.x passes all tests, since it does not seem to contain "mixed read-lock/lock-write ABBA".

Machine is a PowerMac G5 11,2 running Gentoo Linux ppc64, Big Endian, 4 KiB pagesize.

[    0.002051] ------------------------
[    0.002065] | Locking API testsuite:
[    0.002079] ----------------------------------------------------------------------------
[    0.002111]                                  | spin |wlock |rlock |mutex | wsem | rsem |
[    0.002142]   --------------------------------------------------------------------------
[    0.002179]                      A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.007366]                  A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.012471]              A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.017598]              A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.022740]          A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.027912]          A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.033083]          A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.038269]                     double unlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.043319]                   initialize held:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.048379]   --------------------------------------------------------------------------
[    0.048411]               recursive read-lock:             |  ok  |             |  ok  |
[    0.049894]            recursive read-lock #2:             |  ok  |             |  ok  |
[    0.051375]             mixed read-write-lock:             |  ok  |             |  ok  |
[    0.052859]             mixed write-read-lock:             |  ok  |             |  ok  |
[    0.054333]   mixed read-lock/lock-write ABBA:             |FAILED|             |  ok  |
[    0.055802]    mixed read-lock/lock-read ABBA:             |  ok  |             |  ok  |
[    0.057290]  mixed write-lock/lock-write ABBA:             |  ok  |             |  ok  |
[    0.058771]   --------------------------------------------------------------------------
Comment 1 Erhard F. 2019-05-19 19:35:25 UTC
Created attachment 282833 [details]
dmesg (5.0.17, G5 11,2)
Comment 2 Erhard F. 2019-05-19 19:35:49 UTC
Created attachment 282835 [details]
dmesg (4.19.44, G5 11,2)
Comment 3 Erhard F. 2019-05-19 19:36:19 UTC
Created attachment 282837 [details]
dmesg (4.14.120, G5 11,2)
Comment 4 Erhard F. 2019-05-19 19:36:45 UTC
Created attachment 282839 [details]
dmesg (4.9.177, G5 11,2)
Comment 5 Erhard F. 2019-05-19 19:37:20 UTC
Created attachment 282841 [details]
kernel .config (5.1.3, G5 11,2)
Comment 6 Michael Ellerman 2019-05-21 05:35:22 UTC
This appears to be working as expected, which I admit is a little confusing.

The key thing is that at the end you see, eg:

  [    0.179788] Good, all 261 testcases passed! |

See the commit that added the test:

https://git.kernel.org/torvalds/c/e91498589746

  locking/lockdep/selftests: Add mixed read-write ABBA tests

  Currently lockdep has limited support for recursive readers, add a few
  mixed read-write ABBA selftests to show the extend of these
  limitations.

And in the code:

	print_testname("mixed read-lock/lock-write ABBA");
	pr_cont("             |");
	dotest(rlock_ABBA1, FAILURE, LOCKTYPE_RWLOCK);
#ifdef CONFIG_PROVE_LOCKING
	/*
	 * Lockdep does indeed fail here, but there's nothing we can do about
	 * that now.  Don't kill lockdep for it.
	 */
	unexpected_testcase_failures--;
#endif
Comment 7 Anatoly Pugachev 2019-07-16 08:58:37 UTC
it's the same for sparc64:

`
[    0.000020] PROMLIB: Sun IEEE Boot Prom 'OBP 4.38.12 2018/03/28 14:54'
[    0.000032] PROMLIB: Root node compatible: sun4v
[    0.000080] Linux version 5.2.0-10808-g9637d517347e (mator@ttip) (gcc version 8.3.0 (Debian 8.3.0-7)) #1080 SMP Tue Jul 16 10:46:19 MSK 2019
[    0.000386] printk: bootconsole [earlyprom0] enabled
[    0.000441] ARCH: SUN4V
...
[    0.451068]  memory used by lock dependency info: 3855 kB
[    0.451104]  per task-struct memory footprint: 1920 bytes
[    0.451140] ------------------------
[    0.451167] | Locking API testsuite:
[    0.451194] ----------------------------------------------------------------------------
[    0.451244]                                  | spin |wlock |rlock |mutex | wsem | rsem |
[    0.451294]   --------------------------------------------------------------------------
[    0.451350]                      A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.454281]                  A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.457443]              A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.460744]              A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.464032]          A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.467545]          A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.471009]          A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.474475]                     double unlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.477425]                   initialize held:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.480301]   --------------------------------------------------------------------------
[    0.480352]               recursive read-lock:             |  ok  |             |  ok  |
[    0.481247]            recursive read-lock #2:             |  ok  |             |  ok  |
[    0.482120]             mixed read-write-lock:             |  ok  |             |  ok  |
[    0.482998]             mixed write-read-lock:             |  ok  |             |  ok  |
[    0.483878]   mixed read-lock/lock-write ABBA:             |FAILED|             |  ok  |
[    0.484755]    mixed read-lock/lock-read ABBA:             |  ok  |             |  ok  |
[    0.485676]  mixed write-lock/lock-write ABBA:             |  ok  |             |  ok  |
[    0.486597]   --------------------------------------------------------------------------
`