Skip to contentSkip to conversation

of: unittest: add overlay gpio test to catch gpio hog problem

PATCH Applied [email protected] 3 participants 11 messages Feb 20, 2020 – Apr 8, 2020 Device tree

lore
Share & tools
lore
#0 lore raw

v2 cover of: unittest: add overlay gpio test to catch gpio hog problem

From: Frank Rowand <[email protected]>

Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an patch to fix the problem [1].

Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's patch and "0 failed" after applying Geert's patch.

I did not have a development system for which it would be easy to experiment with applying an overlay containing a gpio hog, so I instead created this unittest that uses a fake gpio node.

Some tests in the devicetree unittests result in printk messages from the code being tested. It can be difficult to determine whether the messages are the result of unittest or are potentially reporting bugs that should be fixed. The most recent example of a person asking whether to be concerned about these messages is [2].

Patch 2 adds annotations for all messages triggered by unittests, except KERN_DEBUG messages. (KERN_DEBUG is a special case due to the possible interaction of CONFIG_DYNAMIC_DEBUG.)

The annotations added in patch 2/2 add a small amount of verbosity to the console output. I have created a proof of concept tool to explore (1) how test harnesses could use the annotations and
(2) how to make the resulting console output easier to read and understand as a human being. The tool 'of_unittest_expect' is available at https://github.com/frowand/dt_tools

The format of the annotations is expected to change when unittests are converted to use the kunit infrastructure when the broader testing community has an opportunity to discuss the implementation of annotations of test triggered messages.

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]

Frank Rowand (2):
of: unittest: add overlay gpio test to catch gpio hog problem
of: unittest: annotate warnings triggered by unittest

 drivers/of/unittest-data/Makefile             |   8 +-
 drivers/of/unittest-data/overlay_gpio_01.dts  |  23 +
 drivers/of/unittest-data/overlay_gpio_02a.dts |  16 +
 drivers/of/unittest-data/overlay_gpio_02b.dts |  16 +
 drivers/of/unittest-data/overlay_gpio_03.dts  |  23 +
 drivers/of/unittest-data/overlay_gpio_04a.dts |  16 +
 drivers/of/unittest-data/overlay_gpio_04b.dts |  16 +
 drivers/of/unittest.c                         | 628 ++++++++++++++++++++++++--
 8 files changed, 715 insertions(+), 31 deletions(-)
 create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts
Signature · 1 line
Frank Rowand <[email protected]>
#1 lore raw

PATCH v2 1/2 of: unittest: add overlay gpio test to catch gpio hog problem

From: Frank Rowand <[email protected]>

Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an RFC patch to fix the problem [1].

Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's RFC patch and "0 failed" after applying Geert's RFC patch.

[1] https://lore.kernel.org/linux-devicetree/[email protected]/

---

changes since v1:
- base on 5.6-rc1
- fixed node names in overlays
- removed unused fields from struct unittest_gpio_dev
- of_unittest_overlay_gpio() cleaned up comments
- of_unittest_overlay_gpio() moved saving global values into probe_pass_count and chip_request_count more tightly around test code expected to trigger changes in the global values

v1 of this patch incorrectly reported that it had made changes since the RFC version, but it was mistakenly created from the wrong branch.

There are checkpatch warnings.
- New files are in a directory already covered by MAINTAINERS
- The undocumented compatibles are restricted to use by unittest and should not be documented under Documentation
- The printk() KERN_<LEVEL> warnings are false positives. The level is supplied by a define parameter instead of a hard coded constant
- The lines over 80 characters are consistent with unittest.c style

This unittest was also valuable in that it allowed me to explore possible issues related to the proposed solution to the gpio hog problem.

 drivers/of/unittest-data/Makefile             |   8 +-
 drivers/of/unittest-data/overlay_gpio_01.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_02a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_02b.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_03.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_04a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_04b.dts |  16 ++
 drivers/of/unittest.c                         | 253 ++++++++++++++++++++++++++
 8 files changed, 370 insertions(+), 1 deletion(-)
 create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts
drivers/of/unittest-data/Makefile +7 -1
index 9b6807065827..009f4045c8e4 100644
@@ -21,7 +21,13 @@ obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \
 			    overlay_bad_add_dup_prop.dtb.o \
 			    overlay_bad_phandle.dtb.o \
 			    overlay_bad_symbol.dtb.o \
-			    overlay_base.dtb.o
+			    overlay_base.dtb.o \
+			    overlay_gpio_01.dtb.o \
+			    overlay_gpio_02a.dtb.o \
+			    overlay_gpio_02b.dtb.o \
+			    overlay_gpio_03.dtb.o \
+			    overlay_gpio_04a.dtb.o \
+			    overlay_gpio_04b.dtb.o
 
 # enable creation of __symbols__ node
 DTC_FLAGS_overlay += -@
drivers/of/unittest-data/overlay_gpio_01.dts new file +23 -0
new file mode 100644
index 000000000000..699ff104ae10
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+/plugin/;
+
+&unittest_test_bus {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	gpio@0 {
+		compatible = "unittest-gpio";
+		reg = <0>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		ngpios = <2>;
+		gpio-line-names = "line-A", "line-B";
+
+		line-b {
+			gpio-hog;
+			gpios = <2 0>;
+			input;
+			line-name = "line-B-input";
+		};
+	};
+};
drivers/of/unittest-data/overlay_gpio_02a.dts new file +16 -0
new file mode 100644
index 000000000000..ec59aff6ed47
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+/plugin/;
+
+&unittest_test_bus {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	gpio@2 {
+		compatible = "unittest-gpio";
+		reg = <2>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		ngpios = <2>;
+		gpio-line-names = "line-A", "line-B";
+	};
+};
drivers/of/unittest-data/overlay_gpio_02b.dts new file +16 -0
new file mode 100644
index 000000000000..43ce111d41ce
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+/plugin/;
+
+&unittest_test_bus {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	gpio@2 {
+		line-a {
+			gpio-hog;
+			gpios = <1 0>;
+			input;
+			line-name = "line-A-input";
+		};
+	};
+};
drivers/of/unittest-data/overlay_gpio_03.dts new file +23 -0
new file mode 100644
index 000000000000..6e0312340a1b
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+/plugin/;
+
+&unittest_test_bus {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	gpio@3 {
+		compatible = "unittest-gpio";
+		reg = <3>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		ngpios = <2>;
+		gpio-line-names = "line-A", "line-B", "line-C", "line-D";
+
+		line-d {
+			gpio-hog;
+			gpios = <4 0>;
+			input;
+			line-name = "line-D-input";
+		};
+	};
+};
drivers/of/unittest-data/overlay_gpio_04a.dts new file +16 -0
new file mode 100644
index 000000000000..7b1e04ebfa7a
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+/plugin/;
+
+&unittest_test_bus {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	gpio@4 {
+		compatible = "unittest-gpio";
+		reg = <4>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		ngpios = <2>;
+		gpio-line-names = "line-A", "line-B", "line-C", "line-D";
+	};
+};
drivers/of/unittest-data/overlay_gpio_04b.dts new file +16 -0
new file mode 100644
index 000000000000..a14e95c6699a
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+/plugin/;
+
+&unittest_test_bus {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	gpio@4 {
+		line-c {
+			gpio-hog;
+			gpios = <3 0>;
+			input;
+			line-name = "line-C-input";
+		};
+	};
+};
drivers/of/unittest.c +253 -0

289 lines not on this page · raw message

Signature · 1 line
Frank Rowand <[email protected]>
maintainer Applied
#2 lore raw
Quoted 41 lines · On Thu, 20 Feb 2020 12:40:20 -0600, [email protected] wrote:

From: Frank Rowand <[email protected]>

Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an RFC patch to fix the problem [1].

Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's RFC patch and "0 failed" after applying Geert's RFC patch.

[1] https://lore.kernel.org/linux-devicetree/[email protected]/

---

changes since v1:
- base on 5.6-rc1
- fixed node names in overlays
- removed unused fields from struct unittest_gpio_dev
- of_unittest_overlay_gpio() cleaned up comments
- of_unittest_overlay_gpio() moved saving global values into probe_pass_count and chip_request_count more tightly around test code expected to trigger changes in the global values

v1 of this patch incorrectly reported that it had made changes since the RFC version, but it was mistakenly created from the wrong branch.

There are checkpatch warnings.
- New files are in a directory already covered by MAINTAINERS
- The undocumented compatibles are restricted to use by unittest and should not be documented under Documentation
- The printk() KERN_<LEVEL> warnings are false positives. The level is supplied by a define parameter instead of a hard coded constant
- The lines over 80 characters are consistent with unittest.c style

This unittest was also valuable in that it allowed me to explore possible issues related to the proposed solution to the gpio hog problem.

Quoted 16 lines
 drivers/of/unittest-data/Makefile             |   8 +-
 drivers/of/unittest-data/overlay_gpio_01.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_02a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_02b.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_03.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_04a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_04b.dts |  16 ++
 drivers/of/unittest.c                         | 253 ++++++++++++++++++++++++++
 8 files changed, 370 insertions(+), 1 deletion(-)
 create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts

Applied, thanks.

Rob

#3 lore raw

Hi Anders,

Quoted 13 lines · Anders Roxell

From: Rob Herring <[email protected]>

Quoted 11 lines · On Thu, 20 Feb 2020 12:40:20 -0600, [email protected] wrote:
Quoted 10 lines

From: Frank Rowand <[email protected]>

Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an RFC patch to fix the problem [1].

Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's RFC patch and "0 failed" after applying Geert's RFC patch.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

[1] https://lore.kernel.org/linux-devicetree/[email protected]/

I'm building arm64 on tag next-20200312, and booting in qemu, and I see this "Kernel panic":

Thank you for the panic report.

There has also been an x86_64 failure (with a very different stack trace). I am going to investigate the x86_64 failure first.

Can you please send the kernel .config?

Thanks,

Frank

Quoted 130 lines

[...]

[  172.779435][    T1] systemd[1]: Mounted POSIX Message Queue File System.
[[0;32m  OK  [0m] Mounted POSIX Message Queue File System.
[  172.844551][    T1] systemd[1]: Mounted Huge Pages File System.
[[0;32m  OK  [0m] Mounted Huge Pages File System.
[  172.917332][    T1] systemd[1]: Mounted Debug File System.
[[0;32m  OK  [0m] Mounted Debug File System.
[  173.465694][  T251] _warn_unseeded_randomness: 6 callbacks suppressed
[  173.465803][  T251] random: get_random_u64 called from arch_mmap_rnd+0x94/0xb0 with crng_init=1
[  173.466000][  T251] random: get_random_u64 called from randomize_stack_top+0x4c/0xb0 with crng_init=1
[  173.466163][  T251] random: get_random_u32 called from arch_align_stack+0x6c/0x88 with crng_init=1
[  173.544157][    T1] systemd[1]: Started Create Static Device Nodes in /dev.
[[0;32m  OK  [0m] Started Create Static Device Nodes in /dev.
[  174.283422][  T240] Unable to handle kernel paging request at virtual address 978061b552800000
[  174.286169][  T240] Mem abort info:
[  174.303268][  T240]   ESR = 0x96000004
[  174.304652][  T240]   EC = 0x25: DABT (current EL), IL = 32 bits
[  174.323298][  T240]   SET = 0, FnV = 0
[  174.324677][  T240]   EA = 0, S1PTW = 0
[  174.325937][  T240] Data abort info:
[  174.345383][  T240]   ISV = 0, ISS = 0x00000004
[  174.359310][  T240]   CM = 0, WnR = 0
[  174.360641][  T240] [978061b552800000] address between user and kernel address ranges
[  174.378712][  T240] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  174.381030][  T240] Modules linked in:
[  174.382362][  T240] CPU: 0 PID: 240 Comm: systemd-journal Tainted: G    B   W         5.6.0-rc5-next-20200312-00018-g5c00c2e7cf27 #6
[  174.386251][  T240] Hardware name: linux,dummy-virt (DT)
[  174.388056][  T240] pstate: 40400005 (nZcv daif +PAN -UAO)
[  174.389892][  T240] pc : sysfs_kf_seq_show+0x114/0x250
[  174.391638][  T240] lr : sysfs_kf_seq_show+0x114/0x250
[  174.393325][  T240] sp : ffff00006374faa0
[  174.394697][  T240] x29: ffff00006374faa0 x28: ffff000062620040 
[  174.396751][  T240] x27: ffff000062b0a010 x26: 978061b552800000 
[  174.398779][  T240] x25: ffff000068aae020 x24: ffff000068aae010 
[  174.400798][  T240] x23: ffff00006311c000 x22: ffff000064f4f800 
[  174.402794][  T240] x21: 0000000000001000 x20: ffff000068aae008 
[  174.404820][  T240] x19: 0000000000001000 x18: 0000000000000000 
[  174.406792][  T240] x17: 0000000000000000 x16: 0000000000000000 
[  174.408814][  T240] x15: 0000000000000000 x14: 0000000000000000 
[  174.410805][  T240] x13: ffff80000c623a00 x12: 1fffe0000c623800 
[  174.412829][  T240] x11: 1fffe0000c6239ff x10: ffff80000c6239ff 
[  174.414821][  T240] x9 : 0000000000000000 x8 : ffff00006311d000 
[  174.416865][  T240] x7 : 0000000000000000 x6 : 000000000000003f 
[  174.418907][  T240] x5 : 0000000000000040 x4 : 000000000000002d 
[  174.420932][  T240] x3 : ffffa000109a1274 x2 : 0000000000000001 
[  174.422924][  T240] x1 : ffffa00016010000 x0 : 0000000000000000 
[  174.424954][  T240] Call trace:
[  174.426097][  T240]  sysfs_kf_seq_show+0x114/0x250
[  174.427769][  T240]  kernfs_seq_show+0xa4/0xb8
[  174.429306][  T240]  seq_read+0x3a4/0x8e8
[  174.430678][  T240]  kernfs_fop_read+0x8c/0x6e0
[  174.432244][  T240]  __vfs_read+0x64/0xc0
[  174.433622][  T240]  vfs_read+0x158/0x2b0
[  174.435014][  T240]  ksys_read+0xfc/0x1e0
[  174.436427][  T240]  __arm64_sys_read+0x50/0x60
[  174.437944][  T240]  el0_svc_common.constprop.1+0x294/0x330
[  174.439795][  T240]  do_el0_svc+0xe4/0x100
[  174.441218][  T240]  el0_svc+0x70/0x80
[  174.442550][  T240]  el0_sync_handler+0xd0/0x7b4
[  174.444143][  T240]  el0_sync+0x164/0x180
[  174.445578][  T240] Code: aa1703e0 97f6e03a aa1a03e0 97f6e880 (f9400355) 
[  174.447885][  T240] ---[ end trace 5bcb796ff4270d74 ]---
[  174.449629][  T240] Kernel panic - not syncing: Fatal exception
[  174.451590][  T240] Kernel Offset: disabled
[  174.453005][  T240] CPU features: 0x80002,20002004
[  174.454597][  T240] Memory Limit: none
[  174.455955][  T240] ---[ end Kernel panic - not syncing: Fatal exception ]---

When I say CONFIG_OF_UNITTEST=n it works.
If I revert there it starts to work when I revert the last one, f4056e705b2e, from the list below:

485bb19d0b3e of: unittest: make gpio overlay test dependent on CONFIG_OF_GPIO 0ac174397940 of: unittest: annotate warnings triggered by unittest f4056e705b2e of: unittest: add overlay gpio test to catch gpio hog problem

Cheers,
Anders

Quoted 48 lines
Quoted 28 lines

---

changes since v1:
- base on 5.6-rc1
- fixed node names in overlays
- removed unused fields from struct unittest_gpio_dev
- of_unittest_overlay_gpio() cleaned up comments
- of_unittest_overlay_gpio() moved saving global values into probe_pass_count and chip_request_count more tightly around test code expected to trigger changes in the global values

v1 of this patch incorrectly reported that it had made changes since the RFC version, but it was mistakenly created from the wrong branch.

There are checkpatch warnings.
- New files are in a directory already covered by MAINTAINERS
- The undocumented compatibles are restricted to use by unittest and should not be documented under Documentation
- The printk() KERN_<LEVEL> warnings are false positives. The level is supplied by a define parameter instead of a hard coded constant
- The lines over 80 characters are consistent with unittest.c style

This unittest was also valuable in that it allowed me to explore possible issues related to the proposed solution to the gpio hog problem.

Quoted 16 lines
 drivers/of/unittest-data/Makefile             |   8 +-
 drivers/of/unittest-data/overlay_gpio_01.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_02a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_02b.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_03.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_04a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_04b.dts |  16 ++
 drivers/of/unittest.c                         | 253 ++++++++++++++++++++++++++
 8 files changed, 370 insertions(+), 1 deletion(-)
 create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts

Applied, thanks.

Rob

#4 lore raw
Quoted 21 lines · Frank Rowand

Hi Anders,

Quoted 17 lines · Anders Roxell

From: Rob Herring <[email protected]>

Quoted 14 lines · On Thu, 20 Feb 2020 12:40:20 -0600, [email protected] wrote:
Quoted 13 lines

From: Frank Rowand <[email protected]>

Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an RFC patch to fix the problem [1].

Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's RFC patch and "0 failed" after applying Geert's RFC patch.

[1] https://lore.kernel.org/linux-devicetree/[email protected]/

Quoted 7 lines
Quoted 2 lines

I'm building arm64 on tag next-20200312, and booting in qemu, and I see this "Kernel panic":

Thank you for the panic report.

There has also been an x86_64 failure (with a very different stack trace). I am going to investigate the x86_64 failure first.

OK.

Quoted 2 lines

Can you please send the kernel .config?

https://s3.amazonaws.com/builds.tuxbuild.com/43BB3Qry46bSzMK82iPbBg/kernel.config

Cheers,
Anders

Quoted 137 lines

Thanks,

Frank

Quoted 130 lines

[...]

[  172.779435][    T1] systemd[1]: Mounted POSIX Message Queue File System.
[[0;32m  OK  [0m] Mounted POSIX Message Queue File System.
[  172.844551][    T1] systemd[1]: Mounted Huge Pages File System.
[[0;32m  OK  [0m] Mounted Huge Pages File System.
[  172.917332][    T1] systemd[1]: Mounted Debug File System.
[[0;32m  OK  [0m] Mounted Debug File System.
[  173.465694][  T251] _warn_unseeded_randomness: 6 callbacks suppressed
[  173.465803][  T251] random: get_random_u64 called from arch_mmap_rnd+0x94/0xb0 with crng_init=1
[  173.466000][  T251] random: get_random_u64 called from randomize_stack_top+0x4c/0xb0 with crng_init=1
[  173.466163][  T251] random: get_random_u32 called from arch_align_stack+0x6c/0x88 with crng_init=1
[  173.544157][    T1] systemd[1]: Started Create Static Device Nodes in /dev.
[[0;32m  OK  [0m] Started Create Static Device Nodes in /dev.
[  174.283422][  T240] Unable to handle kernel paging request at virtual address 978061b552800000
[  174.286169][  T240] Mem abort info:
[  174.303268][  T240]   ESR = 0x96000004
[  174.304652][  T240]   EC = 0x25: DABT (current EL), IL = 32 bits
[  174.323298][  T240]   SET = 0, FnV = 0
[  174.324677][  T240]   EA = 0, S1PTW = 0
[  174.325937][  T240] Data abort info:
[  174.345383][  T240]   ISV = 0, ISS = 0x00000004
[  174.359310][  T240]   CM = 0, WnR = 0
[  174.360641][  T240] [978061b552800000] address between user and kernel address ranges
[  174.378712][  T240] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  174.381030][  T240] Modules linked in:
[  174.382362][  T240] CPU: 0 PID: 240 Comm: systemd-journal Tainted: G    B   W         5.6.0-rc5-next-20200312-00018-g5c00c2e7cf27 #6
[  174.386251][  T240] Hardware name: linux,dummy-virt (DT)
[  174.388056][  T240] pstate: 40400005 (nZcv daif +PAN -UAO)
[  174.389892][  T240] pc : sysfs_kf_seq_show+0x114/0x250
[  174.391638][  T240] lr : sysfs_kf_seq_show+0x114/0x250
[  174.393325][  T240] sp : ffff00006374faa0
[  174.394697][  T240] x29: ffff00006374faa0 x28: ffff000062620040
[  174.396751][  T240] x27: ffff000062b0a010 x26: 978061b552800000
[  174.398779][  T240] x25: ffff000068aae020 x24: ffff000068aae010
[  174.400798][  T240] x23: ffff00006311c000 x22: ffff000064f4f800
[  174.402794][  T240] x21: 0000000000001000 x20: ffff000068aae008
[  174.404820][  T240] x19: 0000000000001000 x18: 0000000000000000
[  174.406792][  T240] x17: 0000000000000000 x16: 0000000000000000
[  174.408814][  T240] x15: 0000000000000000 x14: 0000000000000000
[  174.410805][  T240] x13: ffff80000c623a00 x12: 1fffe0000c623800
[  174.412829][  T240] x11: 1fffe0000c6239ff x10: ffff80000c6239ff
[  174.414821][  T240] x9 : 0000000000000000 x8 : ffff00006311d000
[  174.416865][  T240] x7 : 0000000000000000 x6 : 000000000000003f
[  174.418907][  T240] x5 : 0000000000000040 x4 : 000000000000002d
[  174.420932][  T240] x3 : ffffa000109a1274 x2 : 0000000000000001
[  174.422924][  T240] x1 : ffffa00016010000 x0 : 0000000000000000
[  174.424954][  T240] Call trace:
[  174.426097][  T240]  sysfs_kf_seq_show+0x114/0x250
[  174.427769][  T240]  kernfs_seq_show+0xa4/0xb8
[  174.429306][  T240]  seq_read+0x3a4/0x8e8
[  174.430678][  T240]  kernfs_fop_read+0x8c/0x6e0
[  174.432244][  T240]  __vfs_read+0x64/0xc0
[  174.433622][  T240]  vfs_read+0x158/0x2b0
[  174.435014][  T240]  ksys_read+0xfc/0x1e0
[  174.436427][  T240]  __arm64_sys_read+0x50/0x60
[  174.437944][  T240]  el0_svc_common.constprop.1+0x294/0x330
[  174.439795][  T240]  do_el0_svc+0xe4/0x100
[  174.441218][  T240]  el0_svc+0x70/0x80
[  174.442550][  T240]  el0_sync_handler+0xd0/0x7b4
[  174.444143][  T240]  el0_sync+0x164/0x180
[  174.445578][  T240] Code: aa1703e0 97f6e03a aa1a03e0 97f6e880 (f9400355)
[  174.447885][  T240] ---[ end trace 5bcb796ff4270d74 ]---
[  174.449629][  T240] Kernel panic - not syncing: Fatal exception
[  174.451590][  T240] Kernel Offset: disabled
[  174.453005][  T240] CPU features: 0x80002,20002004
[  174.454597][  T240] Memory Limit: none
[  174.455955][  T240] ---[ end Kernel panic - not syncing: Fatal exception ]---

When I say CONFIG_OF_UNITTEST=n it works.
If I revert there it starts to work when I revert the last one, f4056e705b2e, from the list below:

485bb19d0b3e of: unittest: make gpio overlay test dependent on CONFIG_OF_GPIO 0ac174397940 of: unittest: annotate warnings triggered by unittest f4056e705b2e of: unittest: add overlay gpio test to catch gpio hog problem

Cheers,
Anders

Quoted 48 lines
Quoted 28 lines

---

changes since v1:
- base on 5.6-rc1
- fixed node names in overlays
- removed unused fields from struct unittest_gpio_dev
- of_unittest_overlay_gpio() cleaned up comments
- of_unittest_overlay_gpio() moved saving global values into probe_pass_count and chip_request_count more tightly around test code expected to trigger changes in the global values

v1 of this patch incorrectly reported that it had made changes since the RFC version, but it was mistakenly created from the wrong branch.

There are checkpatch warnings.
- New files are in a directory already covered by MAINTAINERS
- The undocumented compatibles are restricted to use by unittest and should not be documented under Documentation
- The printk() KERN_<LEVEL> warnings are false positives. The level is supplied by a define parameter instead of a hard coded constant
- The lines over 80 characters are consistent with unittest.c style

This unittest was also valuable in that it allowed me to explore possible issues related to the proposed solution to the gpio hog problem.

Quoted 16 lines
 drivers/of/unittest-data/Makefile             |   8 +-
 drivers/of/unittest-data/overlay_gpio_01.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_02a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_02b.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_03.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_04a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_04b.dts |  16 ++
 drivers/of/unittest.c                         | 253 ++++++++++++++++++++++++++
 8 files changed, 370 insertions(+), 1 deletion(-)
 create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts

Applied, thanks.

Rob

#5 lore raw
In reply to Frank Rowand
Quoted 20 lines · Frank Rowand

Hi Anders,

Quoted 17 lines · Anders Roxell

From: Rob Herring <[email protected]>

Quoted 14 lines · On Thu, 20 Feb 2020 12:40:20 -0600, [email protected] wrote:
Quoted 13 lines

From: Frank Rowand <[email protected]>

Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an RFC patch to fix the problem [1].

Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's RFC patch and "0 failed" after applying Geert's RFC patch.

[1] https://lore.kernel.org/linux-devicetree/[email protected]/

Quoted 7 lines
Quoted 2 lines

I'm building arm64 on tag next-20200312, and booting in qemu, and I see this "Kernel panic":

Thank you for the panic report.

There has also been an x86_64 failure (with a very different stack trace). I am going to investigate the x86_64 failure first.

I have fixed the x86_64 failure:

https://lore.kernel.org/linux-devicetree/[email protected]/

Can you check if the two patches in that series fixes the problem that you are seeing?

Thanks,

Frank

Quoted 140 lines

Can you please send the kernel .config?

Thanks,

Frank

Quoted 130 lines

[...]

[  172.779435][    T1] systemd[1]: Mounted POSIX Message Queue File System.
[[0;32m  OK  [0m] Mounted POSIX Message Queue File System.
[  172.844551][    T1] systemd[1]: Mounted Huge Pages File System.
[[0;32m  OK  [0m] Mounted Huge Pages File System.
[  172.917332][    T1] systemd[1]: Mounted Debug File System.
[[0;32m  OK  [0m] Mounted Debug File System.
[  173.465694][  T251] _warn_unseeded_randomness: 6 callbacks suppressed
[  173.465803][  T251] random: get_random_u64 called from arch_mmap_rnd+0x94/0xb0 with crng_init=1
[  173.466000][  T251] random: get_random_u64 called from randomize_stack_top+0x4c/0xb0 with crng_init=1
[  173.466163][  T251] random: get_random_u32 called from arch_align_stack+0x6c/0x88 with crng_init=1
[  173.544157][    T1] systemd[1]: Started Create Static Device Nodes in /dev.
[[0;32m  OK  [0m] Started Create Static Device Nodes in /dev.
[  174.283422][  T240] Unable to handle kernel paging request at virtual address 978061b552800000
[  174.286169][  T240] Mem abort info:
[  174.303268][  T240]   ESR = 0x96000004
[  174.304652][  T240]   EC = 0x25: DABT (current EL), IL = 32 bits
[  174.323298][  T240]   SET = 0, FnV = 0
[  174.324677][  T240]   EA = 0, S1PTW = 0
[  174.325937][  T240] Data abort info:
[  174.345383][  T240]   ISV = 0, ISS = 0x00000004
[  174.359310][  T240]   CM = 0, WnR = 0
[  174.360641][  T240] [978061b552800000] address between user and kernel address ranges
[  174.378712][  T240] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  174.381030][  T240] Modules linked in:
[  174.382362][  T240] CPU: 0 PID: 240 Comm: systemd-journal Tainted: G    B   W         5.6.0-rc5-next-20200312-00018-g5c00c2e7cf27 #6
[  174.386251][  T240] Hardware name: linux,dummy-virt (DT)
[  174.388056][  T240] pstate: 40400005 (nZcv daif +PAN -UAO)
[  174.389892][  T240] pc : sysfs_kf_seq_show+0x114/0x250
[  174.391638][  T240] lr : sysfs_kf_seq_show+0x114/0x250
[  174.393325][  T240] sp : ffff00006374faa0
[  174.394697][  T240] x29: ffff00006374faa0 x28: ffff000062620040 
[  174.396751][  T240] x27: ffff000062b0a010 x26: 978061b552800000 
[  174.398779][  T240] x25: ffff000068aae020 x24: ffff000068aae010 
[  174.400798][  T240] x23: ffff00006311c000 x22: ffff000064f4f800 
[  174.402794][  T240] x21: 0000000000001000 x20: ffff000068aae008 
[  174.404820][  T240] x19: 0000000000001000 x18: 0000000000000000 
[  174.406792][  T240] x17: 0000000000000000 x16: 0000000000000000 
[  174.408814][  T240] x15: 0000000000000000 x14: 0000000000000000 
[  174.410805][  T240] x13: ffff80000c623a00 x12: 1fffe0000c623800 
[  174.412829][  T240] x11: 1fffe0000c6239ff x10: ffff80000c6239ff 
[  174.414821][  T240] x9 : 0000000000000000 x8 : ffff00006311d000 
[  174.416865][  T240] x7 : 0000000000000000 x6 : 000000000000003f 
[  174.418907][  T240] x5 : 0000000000000040 x4 : 000000000000002d 
[  174.420932][  T240] x3 : ffffa000109a1274 x2 : 0000000000000001 
[  174.422924][  T240] x1 : ffffa00016010000 x0 : 0000000000000000 
[  174.424954][  T240] Call trace:
[  174.426097][  T240]  sysfs_kf_seq_show+0x114/0x250
[  174.427769][  T240]  kernfs_seq_show+0xa4/0xb8
[  174.429306][  T240]  seq_read+0x3a4/0x8e8
[  174.430678][  T240]  kernfs_fop_read+0x8c/0x6e0
[  174.432244][  T240]  __vfs_read+0x64/0xc0
[  174.433622][  T240]  vfs_read+0x158/0x2b0
[  174.435014][  T240]  ksys_read+0xfc/0x1e0
[  174.436427][  T240]  __arm64_sys_read+0x50/0x60
[  174.437944][  T240]  el0_svc_common.constprop.1+0x294/0x330
[  174.439795][  T240]  do_el0_svc+0xe4/0x100
[  174.441218][  T240]  el0_svc+0x70/0x80
[  174.442550][  T240]  el0_sync_handler+0xd0/0x7b4
[  174.444143][  T240]  el0_sync+0x164/0x180
[  174.445578][  T240] Code: aa1703e0 97f6e03a aa1a03e0 97f6e880 (f9400355) 
[  174.447885][  T240] ---[ end trace 5bcb796ff4270d74 ]---
[  174.449629][  T240] Kernel panic - not syncing: Fatal exception
[  174.451590][  T240] Kernel Offset: disabled
[  174.453005][  T240] CPU features: 0x80002,20002004
[  174.454597][  T240] Memory Limit: none
[  174.455955][  T240] ---[ end Kernel panic - not syncing: Fatal exception ]---

When I say CONFIG_OF_UNITTEST=n it works.
If I revert there it starts to work when I revert the last one, f4056e705b2e, from the list below:

485bb19d0b3e of: unittest: make gpio overlay test dependent on CONFIG_OF_GPIO 0ac174397940 of: unittest: annotate warnings triggered by unittest f4056e705b2e of: unittest: add overlay gpio test to catch gpio hog problem

Cheers,
Anders

Quoted 48 lines
Quoted 28 lines

---

changes since v1:
- base on 5.6-rc1
- fixed node names in overlays
- removed unused fields from struct unittest_gpio_dev
- of_unittest_overlay_gpio() cleaned up comments
- of_unittest_overlay_gpio() moved saving global values into probe_pass_count and chip_request_count more tightly around test code expected to trigger changes in the global values

v1 of this patch incorrectly reported that it had made changes since the RFC version, but it was mistakenly created from the wrong branch.

There are checkpatch warnings.
- New files are in a directory already covered by MAINTAINERS
- The undocumented compatibles are restricted to use by unittest and should not be documented under Documentation
- The printk() KERN_<LEVEL> warnings are false positives. The level is supplied by a define parameter instead of a hard coded constant
- The lines over 80 characters are consistent with unittest.c style

This unittest was also valuable in that it allowed me to explore possible issues related to the proposed solution to the gpio hog problem.

Quoted 16 lines
 drivers/of/unittest-data/Makefile             |   8 +-
 drivers/of/unittest-data/overlay_gpio_01.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_02a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_02b.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_03.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_04a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_04b.dts |  16 ++
 drivers/of/unittest.c                         | 253 ++++++++++++++++++++++++++
 8 files changed, 370 insertions(+), 1 deletion(-)
 create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts

Applied, thanks.

Rob

#6 lore raw
Quoted 25 lines · Frank Rowand
Quoted 23 lines · Frank Rowand

Hi Anders,

Quoted 19 lines · Anders Roxell

From: Rob Herring <[email protected]>

Quoted 7 lines · On Thu, 20 Feb 2020 12:40:20 -0600, [email protected] wrote:
Quoted 6 lines

From: Frank Rowand <[email protected]>

Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an RFC patch to fix the problem [1].

Quoted 7 lines
Quoted 7 lines

Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's RFC patch and "0 failed" after applying Geert's RFC patch.

[1] https://lore.kernel.org/linux-devicetree/[email protected]/

I'm building arm64 on tag next-20200312, and booting in qemu, and I see this "Kernel panic":

Quoted 6 lines
Quoted 4 lines

Thank you for the panic report.

There has also been an x86_64 failure (with a very different stack trace). I am going to investigate the x86_64 failure first.

I have fixed the x86_64 failure:

Great.

Quoted 5 lines
   https://lore.kernel.org/linux-devicetree/[email protected]/

Can you check if the two patches in that series fixes the problem that you are seeing?

I got a new error instead.

next-20200325 before I applied your patches [1]:

[ 1933.602460][ T2795] random: get_random_u64 called from
arch_mmap_rnd+0x90/0xb8 with crng_init=1
[ 1933.602770][ T2795] random: get_random_u64 called from
randomize_stack_top+0x50/0xb8 with crng_init=1
[ 1933.603017][ T2795] random: get_random_u32 called from
arch_align_stack+0x70/0x90 with crng_init=1
[ 1936.391730][    T1] systemd[1]: Mounted Configuration File System.
[ [0;32m  OK   [0m] Mounted Configuration File System.
[ 1937.577008][ T2787] Unable to handle kernel paging request at
virtual address ccccccccccccccd4
[ 1937.604944][ T2787] Mem abort info:
[ 1937.622884][ T2787]   ESR = 0x96000004
[ 1937.624443][ T2787]   EC = 0x25: DABT (current EL), IL = 32 bits
[ 1937.651817][ T2787]   SET = 0, FnV = 0
[ 1937.672276][ T2787]   EA = 0, S1PTW = 0
[ 1937.679201][ T2787] Data abort info:
[ 1937.680594][ T2787]   ISV = 0, ISS = 0x00000004
[ 1937.705713][ T2787]   CM = 0, WnR = 0
[ 1937.707184][ T2787] [ccccccccccccccd4] address between user and
kernel address ranges
[ 1937.725628][ T2787] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 1937.727743][ T2787] Modules linked in:
[ 1937.729157][ T2787] CPU: 0 PID: 2787 Comm: systemd-journal Tainted:
G    B   W       T 5.6.0-rc7-next-20200325-11880-gbae0ebe545c5 #1
[ 1937.733403][ T2787] Hardware name: linux,dummy-virt (DT)
[ 1937.735393][ T2787] pstate: 40400005 (nZcv daif +PAN -UAO)
[ 1937.737480][ T2787] pc : sysfs_file_ops+0xd0/0xf0
[ 1937.739292][ T2787] lr : sysfs_file_ops+0xd0/0xf0
[ 1937.741052][ T2787] sp : ffff000062287a80
[ 1937.742614][ T2787] x29: ffff000062287a80 x28: ffff000060868040
[ 1937.744875][ T2787] x27: ffff000068553810 x26: ffff000062287d80
[ 1937.747164][ T2787] x25: ffff00006263b200 x24: ffff000068415528
[ 1937.749355][ T2787] x23: ffff000068415538 x22: 0000000000000001
[ 1937.751610][ T2787] x21: ffff000068553810 x20: 0000000000000000
[ 1937.753908][ T2787] x19: cccccccccccccccc x18: 0000000000007ec0
[ 1937.756130][ T2787] x17: 0000000000002208 x16: 0000000000001650
[ 1937.758384][ T2787] x15: 0000000000000000 x14: 0000000000000000
[ 1937.760481][ T2787] x13: 0000000000000000 x12: 0000000000002240
[ 1937.762720][ T2787] x11: 00000000f1f1f1f1 x10: ffff000060868040
[ 1937.764810][ T2787] x9 : ffffa00010a03d28 x8 : 1fffe0000c3c2730
[ 1937.766856][ T2787] x7 : ffff80000c3c2730 x6 : dfffa00000000000
[ 1937.768926][ T2787] x5 : ffff000060868040 x4 : 0000000000000000
[ 1937.770980][ T2787] x3 : ffffa00010a03bc8 x2 : 0000000000000001
[ 1937.773041][ T2787] x1 : ffffa0001626d000 x0 : 0000000000000000
[ 1937.775068][ T2787] Call trace:
[ 1937.776252][ T2787]  sysfs_file_ops+0xd0/0xf0
[ 1937.777785][ T2787]  sysfs_kf_seq_show+0x70/0x240
[ 1937.779429][ T2787]  kernfs_seq_show+0xa8/0xc0
[ 1937.781004][ T2787]  seq_read+0x350/0x860
[ 1937.782437][ T2787]  kernfs_fop_read+0x94/0x3f8
[ 1937.784013][ T2787]  __vfs_read+0x68/0xc8
[ 1937.785456][ T2787]  vfs_read+0x15c/0x2b0
[ 1937.786876][ T2787]  ksys_read+0x104/0x1e8
[ 1937.788318][ T2787]  __arm64_sys_read+0x54/0x68
[ 1937.789931][ T2787]  el0_svc_common.constprop.0+0x294/0x338
[ 1937.791822][ T2787]  do_el0_svc+0xe8/0x108
[ 1937.793287][ T2787]  el0_svc+0x74/0x88
[ 1937.794656][ T2787]  el0_sync_handler+0xcc/0x77c
[ 1937.796259][ T2787]  el0_sync+0x17c/0x180
[ 1937.797758][ T2787] Code: b40000b3 97e8e4d9 91002260 97f6c841 (f9400673)
[ 1937.800049][ T2787] ---[ end trace 8e9be5808e45ebb1 ]---
[ 1937.801854][ T2787] Kernel panic - not syncing: Fatal exception
[ 1937.803844][ T2787] Kernel Offset: disabled
[ 1937.805325][ T2787] CPU features: 0x080002,20002004
[ 1937.806961][ T2787] Memory Limit: none
[ 1937.808349][ T2787] ---[ end Kernel panic - not syncing: Fatal exception ]---

and with the two patches applied I see this [2]:

node:test-bus:test-unittest0'

[ 1839.107618][    T1] PM: Removing info for
platform:testcase-data:overlay-node:test-bus:test-unittest0
[ 1839.111218][    T1] kobject:
'testcase-data:overlay-node:test-bus:test-unittest0'
((____ptrval____)): kobject_uevent_env
[ 1839.116021][    T1] kobject:
'testcase-data:overlay-node:test-bus:test-unittest0'
((____ptrval____)): fill_kobj_path: path =
'/devices/platform/testcase-data:overlay-node:test-bus:test-unittest0'
[ 1839.124287][    T1] kobject:
'testcase-data:overlay-node:test-bus:test-unittest0'
((____ptrval____)): kobject_release, parent (____ptrval____) (delayed
1000)
[ 1839.130497][    T1] Unexpected kernel BRK exception at EL1
[ 1839.132466][    T1] Internal error: ptrace BRK handler: f20003e8
[#1] PREEMPT SMP
[ 1839.134933][    T1] Modules linked in:
[ 1839.136395][    T1] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G    B
W       T 5.6.0-rc7-next-20200325-11882-ge7ffe3ef0d63 #1
[ 1839.140051][    T1] Hardware name: linux,dummy-virt (DT)
[ 1839.141976][    T1] pstate: 80400005 (Nzcv daif +PAN -UAO)
[ 1839.143958][    T1] pc : of_unittest_untrack_overlay+0x6c/0x13c
[ 1839.146026][    T1] lr : of_unittest_untrack_overlay+0x6c/0x13c
[ 1839.148046][    T1] sp : ffff000069807af0
[ 1839.149468][    T1] x29: ffff000069807af0 x28: ffffa00017258000
[ 1839.151579][    T1] x27: ffffa00017258400 x26: 0000000000000000
[ 1839.153635][    T1] x25: ffffa00017258480 x24: ffffa00013418a20
[ 1839.155735][    T1] x23: 0000000000000000 x22: ffffa000152dc880
[ 1839.157828][    T1] x21: 0000000000000000 x20: 00000000ffffffff
[ 1839.160076][    T1] x19: 00000000ffffffff x18: 0000000000001ca0
[ 1839.162198][    T1] x17: 00000000000019d8 x16: 0000000000001c60
[ 1839.164321][    T1] x15: 00000000000019b8 x14: 616c65642820295f
[ 1839.166388][    T1] x13: 5f5f5f6c61767274 x12: 705f5f5f5f282074
[ 1839.168503][    T1] x11: 00000000f1f1f1f1 x10: ffff00006a3f8040
[ 1839.170589][    T1] x9 : ffffa00013d6f370 x8 : 1ffff40002a5a688
[ 1839.172686][    T1] x7 : ffff940002a5a688 x6 : dfffa00000000000
[ 1839.174781][    T1] x5 : ffff00006a3f8040 x4 : 0000000000000000
[ 1839.176871][    T1] x3 : ffffa00011f234ac x2 : 00000000ffffffff
[ 1839.178947][    T1] x1 : ffff00006a3f8040 x0 : 0000000000000000
[ 1839.181034][    T1] Call trace:
[ 1839.182286][    T1]  of_unittest_untrack_overlay+0x6c/0x13c
[ 1839.184295][    T1]  of_unittest+0x3330/0x3638
[ 1839.185892][    T1]  do_one_initcall+0x480/0xa40
[ 1839.187598][    T1]  kernel_init_freeable+0x794/0x95c
[ 1839.189394][    T1]  kernel_init+0x20/0x1f8
[ 1839.190924][    T1]  ret_from_fork+0x10/0x18
[ 1839.192523][    T1] Code: 97955a2c d4210000 14000024 97955a29 (d4207d00)
[ 1839.194889][    T1] ---[ end trace 39370fb7c4bf9e64 ]---
[ 1839.196706][    T1] Kernel panic - not syncing: Fatal exception
[ 1839.198735][    T1] Kernel Offset: disabled
[ 1839.200246][    T1] CPU features: 0x080002,20002004
[ 1839.201900][    T1] Memory Limit: none
[ 1839.203340][    T1] ---[ end Kernel panic - not syncing: Fatal exception ]---

Cheers,
Anders
[1] https://people.linaro.org/~anders.roxell/output-next-20200325.log
[2] https://people.linaro.org/~anders.roxell/output-next-20200325.test.log

Quoted 147 lines

Thanks,

Frank

Quoted 140 lines

Can you please send the kernel .config?

Thanks,

Frank

Quoted 130 lines

[...]

[  172.779435][    T1] systemd[1]: Mounted POSIX Message Queue File System.
[[0;32m  OK  [0m] Mounted POSIX Message Queue File System.
[  172.844551][    T1] systemd[1]: Mounted Huge Pages File System.
[[0;32m  OK  [0m] Mounted Huge Pages File System.
[  172.917332][    T1] systemd[1]: Mounted Debug File System.
[[0;32m  OK  [0m] Mounted Debug File System.
[  173.465694][  T251] _warn_unseeded_randomness: 6 callbacks suppressed
[  173.465803][  T251] random: get_random_u64 called from arch_mmap_rnd+0x94/0xb0 with crng_init=1
[  173.466000][  T251] random: get_random_u64 called from randomize_stack_top+0x4c/0xb0 with crng_init=1
[  173.466163][  T251] random: get_random_u32 called from arch_align_stack+0x6c/0x88 with crng_init=1
[  173.544157][    T1] systemd[1]: Started Create Static Device Nodes in /dev.
[[0;32m  OK  [0m] Started Create Static Device Nodes in /dev.
[  174.283422][  T240] Unable to handle kernel paging request at virtual address 978061b552800000
[  174.286169][  T240] Mem abort info:
[  174.303268][  T240]   ESR = 0x96000004
[  174.304652][  T240]   EC = 0x25: DABT (current EL), IL = 32 bits
[  174.323298][  T240]   SET = 0, FnV = 0
[  174.324677][  T240]   EA = 0, S1PTW = 0
[  174.325937][  T240] Data abort info:
[  174.345383][  T240]   ISV = 0, ISS = 0x00000004
[  174.359310][  T240]   CM = 0, WnR = 0
[  174.360641][  T240] [978061b552800000] address between user and kernel address ranges
[  174.378712][  T240] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  174.381030][  T240] Modules linked in:
[  174.382362][  T240] CPU: 0 PID: 240 Comm: systemd-journal Tainted: G    B   W         5.6.0-rc5-next-20200312-00018-g5c00c2e7cf27 #6
[  174.386251][  T240] Hardware name: linux,dummy-virt (DT)
[  174.388056][  T240] pstate: 40400005 (nZcv daif +PAN -UAO)
[  174.389892][  T240] pc : sysfs_kf_seq_show+0x114/0x250
[  174.391638][  T240] lr : sysfs_kf_seq_show+0x114/0x250
[  174.393325][  T240] sp : ffff00006374faa0
[  174.394697][  T240] x29: ffff00006374faa0 x28: ffff000062620040
[  174.396751][  T240] x27: ffff000062b0a010 x26: 978061b552800000
[  174.398779][  T240] x25: ffff000068aae020 x24: ffff000068aae010
[  174.400798][  T240] x23: ffff00006311c000 x22: ffff000064f4f800
[  174.402794][  T240] x21: 0000000000001000 x20: ffff000068aae008
[  174.404820][  T240] x19: 0000000000001000 x18: 0000000000000000
[  174.406792][  T240] x17: 0000000000000000 x16: 0000000000000000
[  174.408814][  T240] x15: 0000000000000000 x14: 0000000000000000
[  174.410805][  T240] x13: ffff80000c623a00 x12: 1fffe0000c623800
[  174.412829][  T240] x11: 1fffe0000c6239ff x10: ffff80000c6239ff
[  174.414821][  T240] x9 : 0000000000000000 x8 : ffff00006311d000
[  174.416865][  T240] x7 : 0000000000000000 x6 : 000000000000003f
[  174.418907][  T240] x5 : 0000000000000040 x4 : 000000000000002d
[  174.420932][  T240] x3 : ffffa000109a1274 x2 : 0000000000000001
[  174.422924][  T240] x1 : ffffa00016010000 x0 : 0000000000000000
[  174.424954][  T240] Call trace:
[  174.426097][  T240]  sysfs_kf_seq_show+0x114/0x250
[  174.427769][  T240]  kernfs_seq_show+0xa4/0xb8
[  174.429306][  T240]  seq_read+0x3a4/0x8e8
[  174.430678][  T240]  kernfs_fop_read+0x8c/0x6e0
[  174.432244][  T240]  __vfs_read+0x64/0xc0
[  174.433622][  T240]  vfs_read+0x158/0x2b0
[  174.435014][  T240]  ksys_read+0xfc/0x1e0
[  174.436427][  T240]  __arm64_sys_read+0x50/0x60
[  174.437944][  T240]  el0_svc_common.constprop.1+0x294/0x330
[  174.439795][  T240]  do_el0_svc+0xe4/0x100
[  174.441218][  T240]  el0_svc+0x70/0x80
[  174.442550][  T240]  el0_sync_handler+0xd0/0x7b4
[  174.444143][  T240]  el0_sync+0x164/0x180
[  174.445578][  T240] Code: aa1703e0 97f6e03a aa1a03e0 97f6e880 (f9400355)
[  174.447885][  T240] ---[ end trace 5bcb796ff4270d74 ]---
[  174.449629][  T240] Kernel panic - not syncing: Fatal exception
[  174.451590][  T240] Kernel Offset: disabled
[  174.453005][  T240] CPU features: 0x80002,20002004
[  174.454597][  T240] Memory Limit: none
[  174.455955][  T240] ---[ end Kernel panic - not syncing: Fatal exception ]---

When I say CONFIG_OF_UNITTEST=n it works.
If I revert there it starts to work when I revert the last one, f4056e705b2e, from the list below:

485bb19d0b3e of: unittest: make gpio overlay test dependent on CONFIG_OF_GPIO 0ac174397940 of: unittest: annotate warnings triggered by unittest f4056e705b2e of: unittest: add overlay gpio test to catch gpio hog problem

Cheers,
Anders

Quoted 48 lines
Quoted 28 lines

---

changes since v1:
- base on 5.6-rc1
- fixed node names in overlays
- removed unused fields from struct unittest_gpio_dev
- of_unittest_overlay_gpio() cleaned up comments
- of_unittest_overlay_gpio() moved saving global values into probe_pass_count and chip_request_count more tightly around test code expected to trigger changes in the global values

v1 of this patch incorrectly reported that it had made changes since the RFC version, but it was mistakenly created from the wrong branch.

There are checkpatch warnings.
- New files are in a directory already covered by MAINTAINERS
- The undocumented compatibles are restricted to use by unittest and should not be documented under Documentation
- The printk() KERN_<LEVEL> warnings are false positives. The level is supplied by a define parameter instead of a hard coded constant
- The lines over 80 characters are consistent with unittest.c style

This unittest was also valuable in that it allowed me to explore possible issues related to the proposed solution to the gpio hog problem.

Quoted 16 lines
 drivers/of/unittest-data/Makefile             |   8 +-
 drivers/of/unittest-data/overlay_gpio_01.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_02a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_02b.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_03.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_04a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_04b.dts |  16 ++
 drivers/of/unittest.c                         | 253 ++++++++++++++++++++++++++
 8 files changed, 370 insertions(+), 1 deletion(-)
 create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts

Applied, thanks.

Rob

#7 lore raw

Hi Anders,

Quoted 160 lines · Anders Roxell
Quoted 25 lines · Frank Rowand
Quoted 23 lines · Frank Rowand

Hi Anders,

Quoted 19 lines · Anders Roxell

From: Rob Herring <[email protected]>

Quoted 7 lines · On Thu, 20 Feb 2020 12:40:20 -0600, [email protected] wrote:
Quoted 6 lines

From: Frank Rowand <[email protected]>

Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an RFC patch to fix the problem [1].

Quoted 7 lines
Quoted 7 lines

Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's RFC patch and "0 failed" after applying Geert's RFC patch.

[1] https://lore.kernel.org/linux-devicetree/[email protected]/

I'm building arm64 on tag next-20200312, and booting in qemu, and I see this "Kernel panic":

Quoted 6 lines
Quoted 4 lines

Thank you for the panic report.

There has also been an x86_64 failure (with a very different stack trace). I am going to investigate the x86_64 failure first.

I have fixed the x86_64 failure:

Great.

Quoted 5 lines
   https://lore.kernel.org/linux-devicetree/[email protected]/

Can you check if the two patches in that series fixes the problem that you are seeing?

I got a new error instead.

next-20200325 before I applied your patches [1]:

[ 1933.602460][ T2795] random: get_random_u64 called from
arch_mmap_rnd+0x90/0xb8 with crng_init=1
[ 1933.602770][ T2795] random: get_random_u64 called from
randomize_stack_top+0x50/0xb8 with crng_init=1
[ 1933.603017][ T2795] random: get_random_u32 called from
arch_align_stack+0x70/0x90 with crng_init=1
[ 1936.391730][    T1] systemd[1]: Mounted Configuration File System.
[ [0;32m  OK   [0m] Mounted Configuration File System.
[ 1937.577008][ T2787] Unable to handle kernel paging request at
virtual address ccccccccccccccd4
[ 1937.604944][ T2787] Mem abort info:
[ 1937.622884][ T2787]   ESR = 0x96000004
[ 1937.624443][ T2787]   EC = 0x25: DABT (current EL), IL = 32 bits
[ 1937.651817][ T2787]   SET = 0, FnV = 0
[ 1937.672276][ T2787]   EA = 0, S1PTW = 0
[ 1937.679201][ T2787] Data abort info:
[ 1937.680594][ T2787]   ISV = 0, ISS = 0x00000004
[ 1937.705713][ T2787]   CM = 0, WnR = 0
[ 1937.707184][ T2787] [ccccccccccccccd4] address between user and
kernel address ranges
[ 1937.725628][ T2787] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 1937.727743][ T2787] Modules linked in:
[ 1937.729157][ T2787] CPU: 0 PID: 2787 Comm: systemd-journal Tainted:
G    B   W       T 5.6.0-rc7-next-20200325-11880-gbae0ebe545c5 #1
[ 1937.733403][ T2787] Hardware name: linux,dummy-virt (DT)
[ 1937.735393][ T2787] pstate: 40400005 (nZcv daif +PAN -UAO)
[ 1937.737480][ T2787] pc : sysfs_file_ops+0xd0/0xf0
[ 1937.739292][ T2787] lr : sysfs_file_ops+0xd0/0xf0
[ 1937.741052][ T2787] sp : ffff000062287a80
[ 1937.742614][ T2787] x29: ffff000062287a80 x28: ffff000060868040
[ 1937.744875][ T2787] x27: ffff000068553810 x26: ffff000062287d80
[ 1937.747164][ T2787] x25: ffff00006263b200 x24: ffff000068415528
[ 1937.749355][ T2787] x23: ffff000068415538 x22: 0000000000000001
[ 1937.751610][ T2787] x21: ffff000068553810 x20: 0000000000000000
[ 1937.753908][ T2787] x19: cccccccccccccccc x18: 0000000000007ec0
[ 1937.756130][ T2787] x17: 0000000000002208 x16: 0000000000001650
[ 1937.758384][ T2787] x15: 0000000000000000 x14: 0000000000000000
[ 1937.760481][ T2787] x13: 0000000000000000 x12: 0000000000002240
[ 1937.762720][ T2787] x11: 00000000f1f1f1f1 x10: ffff000060868040
[ 1937.764810][ T2787] x9 : ffffa00010a03d28 x8 : 1fffe0000c3c2730
[ 1937.766856][ T2787] x7 : ffff80000c3c2730 x6 : dfffa00000000000
[ 1937.768926][ T2787] x5 : ffff000060868040 x4 : 0000000000000000
[ 1937.770980][ T2787] x3 : ffffa00010a03bc8 x2 : 0000000000000001
[ 1937.773041][ T2787] x1 : ffffa0001626d000 x0 : 0000000000000000
[ 1937.775068][ T2787] Call trace:
[ 1937.776252][ T2787]  sysfs_file_ops+0xd0/0xf0
[ 1937.777785][ T2787]  sysfs_kf_seq_show+0x70/0x240
[ 1937.779429][ T2787]  kernfs_seq_show+0xa8/0xc0
[ 1937.781004][ T2787]  seq_read+0x350/0x860
[ 1937.782437][ T2787]  kernfs_fop_read+0x94/0x3f8
[ 1937.784013][ T2787]  __vfs_read+0x68/0xc8
[ 1937.785456][ T2787]  vfs_read+0x15c/0x2b0
[ 1937.786876][ T2787]  ksys_read+0x104/0x1e8
[ 1937.788318][ T2787]  __arm64_sys_read+0x54/0x68
[ 1937.789931][ T2787]  el0_svc_common.constprop.0+0x294/0x338
[ 1937.791822][ T2787]  do_el0_svc+0xe8/0x108
[ 1937.793287][ T2787]  el0_svc+0x74/0x88
[ 1937.794656][ T2787]  el0_sync_handler+0xcc/0x77c
[ 1937.796259][ T2787]  el0_sync+0x17c/0x180
[ 1937.797758][ T2787] Code: b40000b3 97e8e4d9 91002260 97f6c841 (f9400673)
[ 1937.800049][ T2787] ---[ end trace 8e9be5808e45ebb1 ]---
[ 1937.801854][ T2787] Kernel panic - not syncing: Fatal exception
[ 1937.803844][ T2787] Kernel Offset: disabled
[ 1937.805325][ T2787] CPU features: 0x080002,20002004
[ 1937.806961][ T2787] Memory Limit: none
[ 1937.808349][ T2787] ---[ end Kernel panic - not syncing: Fatal exception ]---

and with the two patches applied I see this [2]:

node:test-bus:test-unittest0'

[ 1839.107618][    T1] PM: Removing info for
platform:testcase-data:overlay-node:test-bus:test-unittest0
[ 1839.111218][    T1] kobject:
'testcase-data:overlay-node:test-bus:test-unittest0'
((____ptrval____)): kobject_uevent_env
[ 1839.116021][    T1] kobject:
'testcase-data:overlay-node:test-bus:test-unittest0'
((____ptrval____)): fill_kobj_path: path =
'/devices/platform/testcase-data:overlay-node:test-bus:test-unittest0'
[ 1839.124287][    T1] kobject:
'testcase-data:overlay-node:test-bus:test-unittest0'
((____ptrval____)): kobject_release, parent (____ptrval____) (delayed
1000)
[ 1839.130497][    T1] Unexpected kernel BRK exception at EL1
[ 1839.132466][    T1] Internal error: ptrace BRK handler: f20003e8
[#1] PREEMPT SMP
[ 1839.134933][    T1] Modules linked in:
[ 1839.136395][    T1] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G    B
W       T 5.6.0-rc7-next-20200325-11882-ge7ffe3ef0d63 #1
[ 1839.140051][    T1] Hardware name: linux,dummy-virt (DT)
[ 1839.141976][    T1] pstate: 80400005 (Nzcv daif +PAN -UAO)
[ 1839.143958][    T1] pc : of_unittest_untrack_overlay+0x6c/0x13c
[ 1839.146026][    T1] lr : of_unittest_untrack_overlay+0x6c/0x13c
[ 1839.148046][    T1] sp : ffff000069807af0
[ 1839.149468][    T1] x29: ffff000069807af0 x28: ffffa00017258000
[ 1839.151579][    T1] x27: ffffa00017258400 x26: 0000000000000000
[ 1839.153635][    T1] x25: ffffa00017258480 x24: ffffa00013418a20
[ 1839.155735][    T1] x23: 0000000000000000 x22: ffffa000152dc880
[ 1839.157828][    T1] x21: 0000000000000000 x20: 00000000ffffffff
[ 1839.160076][    T1] x19: 00000000ffffffff x18: 0000000000001ca0
[ 1839.162198][    T1] x17: 00000000000019d8 x16: 0000000000001c60
[ 1839.164321][    T1] x15: 00000000000019b8 x14: 616c65642820295f
[ 1839.166388][    T1] x13: 5f5f5f6c61767274 x12: 705f5f5f5f282074
[ 1839.168503][    T1] x11: 00000000f1f1f1f1 x10: ffff00006a3f8040
[ 1839.170589][    T1] x9 : ffffa00013d6f370 x8 : 1ffff40002a5a688
[ 1839.172686][    T1] x7 : ffff940002a5a688 x6 : dfffa00000000000
[ 1839.174781][    T1] x5 : ffff00006a3f8040 x4 : 0000000000000000
[ 1839.176871][    T1] x3 : ffffa00011f234ac x2 : 00000000ffffffff
[ 1839.178947][    T1] x1 : ffff00006a3f8040 x0 : 0000000000000000
[ 1839.181034][    T1] Call trace:
[ 1839.182286][    T1]  of_unittest_untrack_overlay+0x6c/0x13c
[ 1839.184295][    T1]  of_unittest+0x3330/0x3638
[ 1839.185892][    T1]  do_one_initcall+0x480/0xa40
[ 1839.187598][    T1]  kernel_init_freeable+0x794/0x95c
[ 1839.189394][    T1]  kernel_init+0x20/0x1f8
Quoted 8 lines
[ 1839.190924][    T1]  ret_from_fork+0x10/0x18
[ 1839.192523][    T1] Code: 97955a2c d4210000 14000024 97955a29 (d4207d00)
[ 1839.194889][    T1] ---[ end trace 39370fb7c4bf9e64 ]---
[ 1839.196706][    T1] Kernel panic - not syncing: Fatal exception
[ 1839.198735][    T1] Kernel Offset: disabled
[ 1839.200246][    T1] CPU features: 0x080002,20002004
[ 1839.201900][    T1] Memory Limit: none
[ 1839.203340][    T1] ---[ end Kernel panic - not syncing: Fatal exception ]---

At least this time the call trace is inside the unittest code. :-)

Can you send me the exact qemu command you use?

Can I do the qemu command without an initrd image? If not, any pointers to an arm64 initrd?

-Frank

Quoted 154 lines

Cheers,
Anders
[1] https://people.linaro.org/~anders.roxell/output-next-20200325.log
[2] https://people.linaro.org/~anders.roxell/output-next-20200325.test.log

Quoted 147 lines

Thanks,

Frank

Quoted 140 lines

Can you please send the kernel .config?

Thanks,

Frank

Quoted 130 lines

[...]

[  172.779435][    T1] systemd[1]: Mounted POSIX Message Queue File System.
[[0;32m  OK  [0m] Mounted POSIX Message Queue File System.
[  172.844551][    T1] systemd[1]: Mounted Huge Pages File System.
[[0;32m  OK  [0m] Mounted Huge Pages File System.
[  172.917332][    T1] systemd[1]: Mounted Debug File System.
[[0;32m  OK  [0m] Mounted Debug File System.
[  173.465694][  T251] _warn_unseeded_randomness: 6 callbacks suppressed
[  173.465803][  T251] random: get_random_u64 called from arch_mmap_rnd+0x94/0xb0 with crng_init=1
[  173.466000][  T251] random: get_random_u64 called from randomize_stack_top+0x4c/0xb0 with crng_init=1
[  173.466163][  T251] random: get_random_u32 called from arch_align_stack+0x6c/0x88 with crng_init=1
[  173.544157][    T1] systemd[1]: Started Create Static Device Nodes in /dev.
[[0;32m  OK  [0m] Started Create Static Device Nodes in /dev.
[  174.283422][  T240] Unable to handle kernel paging request at virtual address 978061b552800000
[  174.286169][  T240] Mem abort info:
[  174.303268][  T240]   ESR = 0x96000004
[  174.304652][  T240]   EC = 0x25: DABT (current EL), IL = 32 bits
[  174.323298][  T240]   SET = 0, FnV = 0
[  174.324677][  T240]   EA = 0, S1PTW = 0
[  174.325937][  T240] Data abort info:
[  174.345383][  T240]   ISV = 0, ISS = 0x00000004
[  174.359310][  T240]   CM = 0, WnR = 0
[  174.360641][  T240] [978061b552800000] address between user and kernel address ranges
[  174.378712][  T240] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  174.381030][  T240] Modules linked in:
[  174.382362][  T240] CPU: 0 PID: 240 Comm: systemd-journal Tainted: G    B   W         5.6.0-rc5-next-20200312-00018-g5c00c2e7cf27 #6
[  174.386251][  T240] Hardware name: linux,dummy-virt (DT)
[  174.388056][  T240] pstate: 40400005 (nZcv daif +PAN -UAO)
[  174.389892][  T240] pc : sysfs_kf_seq_show+0x114/0x250
[  174.391638][  T240] lr : sysfs_kf_seq_show+0x114/0x250
[  174.393325][  T240] sp : ffff00006374faa0
[  174.394697][  T240] x29: ffff00006374faa0 x28: ffff000062620040
[  174.396751][  T240] x27: ffff000062b0a010 x26: 978061b552800000
[  174.398779][  T240] x25: ffff000068aae020 x24: ffff000068aae010
[  174.400798][  T240] x23: ffff00006311c000 x22: ffff000064f4f800
[  174.402794][  T240] x21: 0000000000001000 x20: ffff000068aae008
[  174.404820][  T240] x19: 0000000000001000 x18: 0000000000000000
[  174.406792][  T240] x17: 0000000000000000 x16: 0000000000000000
[  174.408814][  T240] x15: 0000000000000000 x14: 0000000000000000
[  174.410805][  T240] x13: ffff80000c623a00 x12: 1fffe0000c623800
[  174.412829][  T240] x11: 1fffe0000c6239ff x10: ffff80000c6239ff
[  174.414821][  T240] x9 : 0000000000000000 x8 : ffff00006311d000
[  174.416865][  T240] x7 : 0000000000000000 x6 : 000000000000003f
[  174.418907][  T240] x5 : 0000000000000040 x4 : 000000000000002d
[  174.420932][  T240] x3 : ffffa000109a1274 x2 : 0000000000000001
[  174.422924][  T240] x1 : ffffa00016010000 x0 : 0000000000000000
[  174.424954][  T240] Call trace:
[  174.426097][  T240]  sysfs_kf_seq_show+0x114/0x250
[  174.427769][  T240]  kernfs_seq_show+0xa4/0xb8
[  174.429306][  T240]  seq_read+0x3a4/0x8e8
[  174.430678][  T240]  kernfs_fop_read+0x8c/0x6e0
[  174.432244][  T240]  __vfs_read+0x64/0xc0
[  174.433622][  T240]  vfs_read+0x158/0x2b0
[  174.435014][  T240]  ksys_read+0xfc/0x1e0
[  174.436427][  T240]  __arm64_sys_read+0x50/0x60
[  174.437944][  T240]  el0_svc_common.constprop.1+0x294/0x330
[  174.439795][  T240]  do_el0_svc+0xe4/0x100
[  174.441218][  T240]  el0_svc+0x70/0x80
[  174.442550][  T240]  el0_sync_handler+0xd0/0x7b4
[  174.444143][  T240]  el0_sync+0x164/0x180
[  174.445578][  T240] Code: aa1703e0 97f6e03a aa1a03e0 97f6e880 (f9400355)
[  174.447885][  T240] ---[ end trace 5bcb796ff4270d74 ]---
[  174.449629][  T240] Kernel panic - not syncing: Fatal exception
[  174.451590][  T240] Kernel Offset: disabled
[  174.453005][  T240] CPU features: 0x80002,20002004
[  174.454597][  T240] Memory Limit: none
[  174.455955][  T240] ---[ end Kernel panic - not syncing: Fatal exception ]---

When I say CONFIG_OF_UNITTEST=n it works.
If I revert there it starts to work when I revert the last one, f4056e705b2e, from the list below:

485bb19d0b3e of: unittest: make gpio overlay test dependent on CONFIG_OF_GPIO 0ac174397940 of: unittest: annotate warnings triggered by unittest f4056e705b2e of: unittest: add overlay gpio test to catch gpio hog problem

Cheers,
Anders

Quoted 48 lines
Quoted 28 lines

---

changes since v1:
- base on 5.6-rc1
- fixed node names in overlays
- removed unused fields from struct unittest_gpio_dev
- of_unittest_overlay_gpio() cleaned up comments
- of_unittest_overlay_gpio() moved saving global values into probe_pass_count and chip_request_count more tightly around test code expected to trigger changes in the global values

v1 of this patch incorrectly reported that it had made changes since the RFC version, but it was mistakenly created from the wrong branch.

There are checkpatch warnings.
- New files are in a directory already covered by MAINTAINERS
- The undocumented compatibles are restricted to use by unittest and should not be documented under Documentation
- The printk() KERN_<LEVEL> warnings are false positives. The level is supplied by a define parameter instead of a hard coded constant
- The lines over 80 characters are consistent with unittest.c style

This unittest was also valuable in that it allowed me to explore possible issues related to the proposed solution to the gpio hog problem.

Quoted 16 lines
 drivers/of/unittest-data/Makefile             |   8 +-
 drivers/of/unittest-data/overlay_gpio_01.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_02a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_02b.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_03.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_04a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_04b.dts |  16 ++
 drivers/of/unittest.c                         | 253 ++++++++++++++++++++++++++
 8 files changed, 370 insertions(+), 1 deletion(-)
 create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts

Applied, thanks.

Rob

#8 lore raw
Quoted 173 lines · Frank Rowand

Hi Anders,

Quoted 168 lines · Anders Roxell
Quoted 25 lines · Frank Rowand
Quoted 23 lines · Frank Rowand

Hi Anders,

Quoted 19 lines · Anders Roxell

From: Rob Herring <[email protected]>

Quoted 7 lines · On Thu, 20 Feb 2020 12:40:20 -0600, [email protected] wrote:
Quoted 6 lines

From: Frank Rowand <[email protected]>

Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an RFC patch to fix the problem [1].

Quoted 7 lines
Quoted 7 lines

Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's RFC patch and "0 failed" after applying Geert's RFC patch.

[1] https://lore.kernel.org/linux-devicetree/[email protected]/

I'm building arm64 on tag next-20200312, and booting in qemu, and I see this "Kernel panic":

Quoted 6 lines
Quoted 4 lines

Thank you for the panic report.

There has also been an x86_64 failure (with a very different stack trace). I am going to investigate the x86_64 failure first.

I have fixed the x86_64 failure:

Great.

Quoted 5 lines
   https://lore.kernel.org/linux-devicetree/[email protected]/

Can you check if the two patches in that series fixes the problem that you are seeing?

I got a new error instead.

next-20200325 before I applied your patches [1]:

[ 1933.602460][ T2795] random: get_random_u64 called from
arch_mmap_rnd+0x90/0xb8 with crng_init=1
[ 1933.602770][ T2795] random: get_random_u64 called from
randomize_stack_top+0x50/0xb8 with crng_init=1
[ 1933.603017][ T2795] random: get_random_u32 called from
arch_align_stack+0x70/0x90 with crng_init=1
[ 1936.391730][    T1] systemd[1]: Mounted Configuration File System.
[ [0;32m  OK   [0m] Mounted Configuration File System.
[ 1937.577008][ T2787] Unable to handle kernel paging request at
virtual address ccccccccccccccd4
[ 1937.604944][ T2787] Mem abort info:
[ 1937.622884][ T2787]   ESR = 0x96000004
[ 1937.624443][ T2787]   EC = 0x25: DABT (current EL), IL = 32 bits
[ 1937.651817][ T2787]   SET = 0, FnV = 0
[ 1937.672276][ T2787]   EA = 0, S1PTW = 0
[ 1937.679201][ T2787] Data abort info:
[ 1937.680594][ T2787]   ISV = 0, ISS = 0x00000004
[ 1937.705713][ T2787]   CM = 0, WnR = 0
[ 1937.707184][ T2787] [ccccccccccccccd4] address between user and
kernel address ranges
[ 1937.725628][ T2787] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 1937.727743][ T2787] Modules linked in:
[ 1937.729157][ T2787] CPU: 0 PID: 2787 Comm: systemd-journal Tainted:
G    B   W       T 5.6.0-rc7-next-20200325-11880-gbae0ebe545c5 #1
[ 1937.733403][ T2787] Hardware name: linux,dummy-virt (DT)
[ 1937.735393][ T2787] pstate: 40400005 (nZcv daif +PAN -UAO)
[ 1937.737480][ T2787] pc : sysfs_file_ops+0xd0/0xf0
[ 1937.739292][ T2787] lr : sysfs_file_ops+0xd0/0xf0
[ 1937.741052][ T2787] sp : ffff000062287a80
[ 1937.742614][ T2787] x29: ffff000062287a80 x28: ffff000060868040
[ 1937.744875][ T2787] x27: ffff000068553810 x26: ffff000062287d80
[ 1937.747164][ T2787] x25: ffff00006263b200 x24: ffff000068415528
[ 1937.749355][ T2787] x23: ffff000068415538 x22: 0000000000000001
[ 1937.751610][ T2787] x21: ffff000068553810 x20: 0000000000000000
[ 1937.753908][ T2787] x19: cccccccccccccccc x18: 0000000000007ec0
[ 1937.756130][ T2787] x17: 0000000000002208 x16: 0000000000001650
[ 1937.758384][ T2787] x15: 0000000000000000 x14: 0000000000000000
[ 1937.760481][ T2787] x13: 0000000000000000 x12: 0000000000002240
[ 1937.762720][ T2787] x11: 00000000f1f1f1f1 x10: ffff000060868040
[ 1937.764810][ T2787] x9 : ffffa00010a03d28 x8 : 1fffe0000c3c2730
[ 1937.766856][ T2787] x7 : ffff80000c3c2730 x6 : dfffa00000000000
[ 1937.768926][ T2787] x5 : ffff000060868040 x4 : 0000000000000000
[ 1937.770980][ T2787] x3 : ffffa00010a03bc8 x2 : 0000000000000001
[ 1937.773041][ T2787] x1 : ffffa0001626d000 x0 : 0000000000000000
[ 1937.775068][ T2787] Call trace:
[ 1937.776252][ T2787]  sysfs_file_ops+0xd0/0xf0
[ 1937.777785][ T2787]  sysfs_kf_seq_show+0x70/0x240
[ 1937.779429][ T2787]  kernfs_seq_show+0xa8/0xc0
[ 1937.781004][ T2787]  seq_read+0x350/0x860
[ 1937.782437][ T2787]  kernfs_fop_read+0x94/0x3f8
[ 1937.784013][ T2787]  __vfs_read+0x68/0xc8
[ 1937.785456][ T2787]  vfs_read+0x15c/0x2b0
[ 1937.786876][ T2787]  ksys_read+0x104/0x1e8
[ 1937.788318][ T2787]  __arm64_sys_read+0x54/0x68
[ 1937.789931][ T2787]  el0_svc_common.constprop.0+0x294/0x338
[ 1937.791822][ T2787]  do_el0_svc+0xe8/0x108
[ 1937.793287][ T2787]  el0_svc+0x74/0x88
[ 1937.794656][ T2787]  el0_sync_handler+0xcc/0x77c
[ 1937.796259][ T2787]  el0_sync+0x17c/0x180
[ 1937.797758][ T2787] Code: b40000b3 97e8e4d9 91002260 97f6c841 (f9400673)
[ 1937.800049][ T2787] ---[ end trace 8e9be5808e45ebb1 ]---
[ 1937.801854][ T2787] Kernel panic - not syncing: Fatal exception
[ 1937.803844][ T2787] Kernel Offset: disabled
[ 1937.805325][ T2787] CPU features: 0x080002,20002004
[ 1937.806961][ T2787] Memory Limit: none
[ 1937.808349][ T2787] ---[ end Kernel panic - not syncing: Fatal exception ]---

and with the two patches applied I see this [2]:

node:test-bus:test-unittest0'

[ 1839.107618][    T1] PM: Removing info for
platform:testcase-data:overlay-node:test-bus:test-unittest0
[ 1839.111218][    T1] kobject:
'testcase-data:overlay-node:test-bus:test-unittest0'
((____ptrval____)): kobject_uevent_env
[ 1839.116021][    T1] kobject:
'testcase-data:overlay-node:test-bus:test-unittest0'
((____ptrval____)): fill_kobj_path: path =
'/devices/platform/testcase-data:overlay-node:test-bus:test-unittest0'
[ 1839.124287][    T1] kobject:
'testcase-data:overlay-node:test-bus:test-unittest0'
((____ptrval____)): kobject_release, parent (____ptrval____) (delayed
1000)
[ 1839.130497][    T1] Unexpected kernel BRK exception at EL1
[ 1839.132466][    T1] Internal error: ptrace BRK handler: f20003e8
[#1] PREEMPT SMP
[ 1839.134933][    T1] Modules linked in:
[ 1839.136395][    T1] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G    B
W       T 5.6.0-rc7-next-20200325-11882-ge7ffe3ef0d63 #1
[ 1839.140051][    T1] Hardware name: linux,dummy-virt (DT)
[ 1839.141976][    T1] pstate: 80400005 (Nzcv daif +PAN -UAO)
[ 1839.143958][    T1] pc : of_unittest_untrack_overlay+0x6c/0x13c
[ 1839.146026][    T1] lr : of_unittest_untrack_overlay+0x6c/0x13c
[ 1839.148046][    T1] sp : ffff000069807af0
[ 1839.149468][    T1] x29: ffff000069807af0 x28: ffffa00017258000
[ 1839.151579][    T1] x27: ffffa00017258400 x26: 0000000000000000
[ 1839.153635][    T1] x25: ffffa00017258480 x24: ffffa00013418a20
[ 1839.155735][    T1] x23: 0000000000000000 x22: ffffa000152dc880
[ 1839.157828][    T1] x21: 0000000000000000 x20: 00000000ffffffff
[ 1839.160076][    T1] x19: 00000000ffffffff x18: 0000000000001ca0
[ 1839.162198][    T1] x17: 00000000000019d8 x16: 0000000000001c60
[ 1839.164321][    T1] x15: 00000000000019b8 x14: 616c65642820295f
[ 1839.166388][    T1] x13: 5f5f5f6c61767274 x12: 705f5f5f5f282074
[ 1839.168503][    T1] x11: 00000000f1f1f1f1 x10: ffff00006a3f8040
[ 1839.170589][    T1] x9 : ffffa00013d6f370 x8 : 1ffff40002a5a688
[ 1839.172686][    T1] x7 : ffff940002a5a688 x6 : dfffa00000000000
[ 1839.174781][    T1] x5 : ffff00006a3f8040 x4 : 0000000000000000
[ 1839.176871][    T1] x3 : ffffa00011f234ac x2 : 00000000ffffffff
[ 1839.178947][    T1] x1 : ffff00006a3f8040 x0 : 0000000000000000
[ 1839.181034][    T1] Call trace:
[ 1839.182286][    T1]  of_unittest_untrack_overlay+0x6c/0x13c
[ 1839.184295][    T1]  of_unittest+0x3330/0x3638
[ 1839.185892][    T1]  do_one_initcall+0x480/0xa40
[ 1839.187598][    T1]  kernel_init_freeable+0x794/0x95c
[ 1839.189394][    T1]  kernel_init+0x20/0x1f8
[ 1839.190924][    T1]  ret_from_fork+0x10/0x18
[ 1839.192523][    T1] Code: 97955a2c d4210000 14000024 97955a29 (d4207d00)
[ 1839.194889][    T1] ---[ end trace 39370fb7c4bf9e64 ]---
[ 1839.196706][    T1] Kernel panic - not syncing: Fatal exception
[ 1839.198735][    T1] Kernel Offset: disabled
[ 1839.200246][    T1] CPU features: 0x080002,20002004
[ 1839.201900][    T1] Memory Limit: none
[ 1839.203340][    T1] ---[ end Kernel panic - not syncing: Fatal exception ]---

I'm sorry for the late reply. =/

Quoted 1 line

At least this time the call trace is inside the unittest code. :-)

yeah =)

Quoted 2 lines

Can you send me the exact qemu command you use?

sudo qemu-system-aarch64 --enable-kvm -cpu cortex-a53 -kernel
Image-20200408 -serial stdio -monitor none -nographic -m 2G -M virt
-fsdev local,id=root,path=/srv/kvm/tmp/stretch/arm64,security_model=none,writeout=immediate -device virtio-rng-pci -device
virtio-9p-pci,fsdev=root,mount_tag=/dev/root -append "root=/dev/root rootfstype=9p rootflags=trans=virtio console=ttyA
MA0,38400n8 earlycon=pl011,0x9000000 initcall_debug softlockup_panic=0 security=none kpti=no"

Quoted 3 lines

Can I do the qemu command without an initrd image? If not, any pointers to an arm64 initrd?

I used debootstrap

sudo qemu-debootstrap --arch=arm64 stretch /srv/kvm/tmp/stretch/arm64
http://ftp.de.debian.org/debian/
echo "/dev/root / 9p rw,relatime,sync,dirsync,access=client,trans=virtio 1 1" | sudo tee /srv/kvm/tmp/stretch/arm64/etc/fstab
sudo chroot /srv/kvm/tmp/stretch/arm64 passwd

Cheers,
Anders

Quoted 159 lines

-Frank

Quoted 154 lines

Cheers,
Anders
[1] https://people.linaro.org/~anders.roxell/output-next-20200325.log
[2] https://people.linaro.org/~anders.roxell/output-next-20200325.test.log

Quoted 147 lines

Thanks,

Frank

Quoted 140 lines

Can you please send the kernel .config?

Thanks,

Frank

Quoted 130 lines

[...]

[  172.779435][    T1] systemd[1]: Mounted POSIX Message Queue File System.
[[0;32m  OK  [0m] Mounted POSIX Message Queue File System.
[  172.844551][    T1] systemd[1]: Mounted Huge Pages File System.
[[0;32m  OK  [0m] Mounted Huge Pages File System.
[  172.917332][    T1] systemd[1]: Mounted Debug File System.
[[0;32m  OK  [0m] Mounted Debug File System.
[  173.465694][  T251] _warn_unseeded_randomness: 6 callbacks suppressed
[  173.465803][  T251] random: get_random_u64 called from arch_mmap_rnd+0x94/0xb0 with crng_init=1
[  173.466000][  T251] random: get_random_u64 called from randomize_stack_top+0x4c/0xb0 with crng_init=1
[  173.466163][  T251] random: get_random_u32 called from arch_align_stack+0x6c/0x88 with crng_init=1
[  173.544157][    T1] systemd[1]: Started Create Static Device Nodes in /dev.
[[0;32m  OK  [0m] Started Create Static Device Nodes in /dev.
[  174.283422][  T240] Unable to handle kernel paging request at virtual address 978061b552800000
[  174.286169][  T240] Mem abort info:
[  174.303268][  T240]   ESR = 0x96000004
[  174.304652][  T240]   EC = 0x25: DABT (current EL), IL = 32 bits
[  174.323298][  T240]   SET = 0, FnV = 0
[  174.324677][  T240]   EA = 0, S1PTW = 0
[  174.325937][  T240] Data abort info:
[  174.345383][  T240]   ISV = 0, ISS = 0x00000004
[  174.359310][  T240]   CM = 0, WnR = 0
[  174.360641][  T240] [978061b552800000] address between user and kernel address ranges
[  174.378712][  T240] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  174.381030][  T240] Modules linked in:
[  174.382362][  T240] CPU: 0 PID: 240 Comm: systemd-journal Tainted: G    B   W         5.6.0-rc5-next-20200312-00018-g5c00c2e7cf27 #6
[  174.386251][  T240] Hardware name: linux,dummy-virt (DT)
[  174.388056][  T240] pstate: 40400005 (nZcv daif +PAN -UAO)
[  174.389892][  T240] pc : sysfs_kf_seq_show+0x114/0x250
[  174.391638][  T240] lr : sysfs_kf_seq_show+0x114/0x250
[  174.393325][  T240] sp : ffff00006374faa0
[  174.394697][  T240] x29: ffff00006374faa0 x28: ffff000062620040
[  174.396751][  T240] x27: ffff000062b0a010 x26: 978061b552800000
[  174.398779][  T240] x25: ffff000068aae020 x24: ffff000068aae010
[  174.400798][  T240] x23: ffff00006311c000 x22: ffff000064f4f800
[  174.402794][  T240] x21: 0000000000001000 x20: ffff000068aae008
[  174.404820][  T240] x19: 0000000000001000 x18: 0000000000000000
[  174.406792][  T240] x17: 0000000000000000 x16: 0000000000000000
[  174.408814][  T240] x15: 0000000000000000 x14: 0000000000000000
[  174.410805][  T240] x13: ffff80000c623a00 x12: 1fffe0000c623800
[  174.412829][  T240] x11: 1fffe0000c6239ff x10: ffff80000c6239ff
[  174.414821][  T240] x9 : 0000000000000000 x8 : ffff00006311d000
[  174.416865][  T240] x7 : 0000000000000000 x6 : 000000000000003f
[  174.418907][  T240] x5 : 0000000000000040 x4 : 000000000000002d
[  174.420932][  T240] x3 : ffffa000109a1274 x2 : 0000000000000001
[  174.422924][  T240] x1 : ffffa00016010000 x0 : 0000000000000000
[  174.424954][  T240] Call trace:
[  174.426097][  T240]  sysfs_kf_seq_show+0x114/0x250
[  174.427769][  T240]  kernfs_seq_show+0xa4/0xb8
[  174.429306][  T240]  seq_read+0x3a4/0x8e8
[  174.430678][  T240]  kernfs_fop_read+0x8c/0x6e0
[  174.432244][  T240]  __vfs_read+0x64/0xc0
[  174.433622][  T240]  vfs_read+0x158/0x2b0
[  174.435014][  T240]  ksys_read+0xfc/0x1e0
[  174.436427][  T240]  __arm64_sys_read+0x50/0x60
[  174.437944][  T240]  el0_svc_common.constprop.1+0x294/0x330
[  174.439795][  T240]  do_el0_svc+0xe4/0x100
[  174.441218][  T240]  el0_svc+0x70/0x80
[  174.442550][  T240]  el0_sync_handler+0xd0/0x7b4
[  174.444143][  T240]  el0_sync+0x164/0x180
[  174.445578][  T240] Code: aa1703e0 97f6e03a aa1a03e0 97f6e880 (f9400355)
[  174.447885][  T240] ---[ end trace 5bcb796ff4270d74 ]---
[  174.449629][  T240] Kernel panic - not syncing: Fatal exception
[  174.451590][  T240] Kernel Offset: disabled
[  174.453005][  T240] CPU features: 0x80002,20002004
[  174.454597][  T240] Memory Limit: none
[  174.455955][  T240] ---[ end Kernel panic - not syncing: Fatal exception ]---

When I say CONFIG_OF_UNITTEST=n it works.
If I revert there it starts to work when I revert the last one, f4056e705b2e, from the list below:

485bb19d0b3e of: unittest: make gpio overlay test dependent on CONFIG_OF_GPIO 0ac174397940 of: unittest: annotate warnings triggered by unittest f4056e705b2e of: unittest: add overlay gpio test to catch gpio hog problem

Cheers,
Anders

Quoted 48 lines
Quoted 28 lines

---

changes since v1:
- base on 5.6-rc1
- fixed node names in overlays
- removed unused fields from struct unittest_gpio_dev
- of_unittest_overlay_gpio() cleaned up comments
- of_unittest_overlay_gpio() moved saving global values into probe_pass_count and chip_request_count more tightly around test code expected to trigger changes in the global values

v1 of this patch incorrectly reported that it had made changes since the RFC version, but it was mistakenly created from the wrong branch.

There are checkpatch warnings.
- New files are in a directory already covered by MAINTAINERS
- The undocumented compatibles are restricted to use by unittest and should not be documented under Documentation
- The printk() KERN_<LEVEL> warnings are false positives. The level is supplied by a define parameter instead of a hard coded constant
- The lines over 80 characters are consistent with unittest.c style

This unittest was also valuable in that it allowed me to explore possible issues related to the proposed solution to the gpio hog problem.

Quoted 16 lines
 drivers/of/unittest-data/Makefile             |   8 +-
 drivers/of/unittest-data/overlay_gpio_01.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_02a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_02b.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_03.dts  |  23 +++
 drivers/of/unittest-data/overlay_gpio_04a.dts |  16 ++
 drivers/of/unittest-data/overlay_gpio_04b.dts |  16 ++
 drivers/of/unittest.c                         | 253 ++++++++++++++++++++++++++
 8 files changed, 370 insertions(+), 1 deletion(-)
 create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts

Applied, thanks.

Rob

#9 lore raw

PATCH v2 2/2 of: unittest: annotate warnings triggered by unittest

In reply to [email protected]

From: Frank Rowand <[email protected]>

Some tests in the devicetree unittests result in printk messages from the code being tested. It can be difficult to determine whether the messages are the result of unittest or are potentially reporting bugs that should be fixed. The most recent example of a person asking whether to be concerned about these messages is [1].

Add annotations for all messages triggered by unittests, except KERN_DEBUG messages. (KERN_DEBUG is a special case due to the possible interaction of CONFIG_DYNAMIC_DEBUG.)

The format of the annotations is expected to change when unittests are converted to use the kunit infrastructure when the broader testing community has an opportunity to discuss the implementation of annotations of test triggered messages.

[1] https://lore.kernel.org/r/[email protected]

---
changes since v1:
- none

 drivers/of/unittest.c | 375 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 345 insertions(+), 30 deletions(-)
drivers/of/unittest.c +345 -30
index 6059bb363097..96ae8a762a9e 100644
@@ -51,6 +51,9 @@
  * Expected message may have a message level other than KERN_INFO.
  * Print the expected message only if the current loglevel will allow
  * the actual message to print.
+ *
+ * Do not use EXPECT_BEGIN() or EXPECT_END() for messages generated by
+ * pr_debug().
  */
 #define EXPECT_BEGIN(level, fmt, ...) \
 	printk(level pr_fmt("EXPECT \\ : ") fmt, ##__VA_ARGS__)
@@ -536,29 +539,77 @@ static void __init of_unittest_parse_phandle_with_args(void)
 
 	/* Check for missing cells property */
 	memset(&args, 0, sizeof(args));
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-data/phandle-tests/provider1");
+
 	rc = of_parse_phandle_with_args(np, "phandle-list",
 					"#phandle-cells-missing", 0, &args);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-data/phandle-tests/provider1");
+
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-data/phandle-tests/provider1");
+
 	rc = of_count_phandle_with_args(np, "phandle-list",
 					"#phandle-cells-missing");
+
+	EXPECT_END(KERN_INFO,
+		   "OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-data/phandle-tests/provider1");
+
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
 
 	/* Check for bad phandle in list */
 	memset(&args, 0, sizeof(args));
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle");
+
 	rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle",
 					"#phandle-cells", 0, &args);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle");
+
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle");
+
 	rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle",
 					"#phandle-cells");
+
+	EXPECT_END(KERN_INFO,
+		   "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle");
+
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
 
 	/* Check for incorrectly formed argument list */
 	memset(&args, 0, sizeof(args));
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
+
 	rc = of_parse_phandle_with_args(np, "phandle-list-bad-args",
 					"#phandle-cells", 1, &args);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
+
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
+
 	rc = of_count_phandle_with_args(np, "phandle-list-bad-args",
 					"#phandle-cells");
+
+	EXPECT_END(KERN_INFO,
+		   "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
+
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
 }
 
@@ -669,20 +720,41 @@ static void __init of_unittest_parse_phandle_with_args_map(void)
 
 	/* Check for missing cells,map,mask property */
 	memset(&args, 0, sizeof(args));
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-data/phandle-tests/provider1");
+
 	rc = of_parse_phandle_with_args_map(np, "phandle-list",
 					    "phandle-missing", 0, &args);
+	EXPECT_END(KERN_INFO,
+		   "OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-data/phandle-tests/provider1");
+
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
 
 	/* Check for bad phandle in list */
 	memset(&args, 0, sizeof(args));
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle");
+
 	rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-phandle",
 					    "phandle", 0, &args);
+	EXPECT_END(KERN_INFO,
+		   "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle");
+
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
 
 	/* Check for incorrectly formed argument list */
 	memset(&args, 0, sizeof(args));
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1");
+
 	rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args",
 					    "phandle", 1, &args);
+	EXPECT_END(KERN_INFO,
+		   "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1");
+
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
 }
 
@@ -1213,7 +1285,15 @@ static void __init of_unittest_platform_populate(void)
 		np = of_find_node_by_path("/testcase-data/testcase-device2");
 		pdev = of_find_device_by_node(np);
 		unittest(pdev, "device 2 creation failed\n");
+
+		EXPECT_BEGIN(KERN_INFO,
+			     "platform testcase-data:testcase-device2: IRQ index 0 not found");
+
 		irq = platform_get_irq(pdev, 0);
+
+		EXPECT_END(KERN_INFO,
+			   "platform testcase-data:testcase-device2: IRQ index 0 not found");
+
 		unittest(irq < 0 && irq != -EPROBE_DEFER,
 			 "device parsing error failed - %d\n", irq);
 	}
@@ -1417,6 +1497,9 @@ static int __init unittest_data_add(void)
 		return 0;
 	}
 
+	EXPECT_BEGIN(KERN_INFO,
+		     "Duplicate name in testcase-data, renamed to \"duplicate-name#1\"");
+
 	/* attach the sub-tree to live tree */
 	np = unittest_data_node->child;
 	while (np) {
@@ -1427,6 +1510,9 @@ static int __init unittest_data_add(void)
 		np = next;
 	}
 
+	EXPECT_END(KERN_INFO,
+		   "Duplicate name in testcase-data, renamed to \"duplicate-name#1\"");
+
 	of_overlay_mutex_unlock();
 
 	return 0;
@@ -1769,8 +1855,18 @@ static int __init of_unittest_apply_revert_overlay_check(int overlay_nr,
 /* test activation of device */
 static void __init of_unittest_overlay_0(void)
 {
+	int ret;
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest0/status");
+
 	/* device should enable */
-	if (of_unittest_apply_overlay_check(0, 0, 0, 1, PDEV_OVERLAY))
+	ret = of_unittest_apply_overlay_check(0, 0, 0, 1, PDEV_OVERLAY);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest0/status");
+
+	if (ret)
 		return;
 
 	unittest(1, "overlay test %d passed\n", 0);
@@ -1779,28 +1875,58 @@ static void __init of_unittest_overlay_0(void)
 /* test deactivation of device */
 static void __init of_unittest_overlay_1(void)
 {
+	int ret;
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest1/status");
+
 	/* device should disable */
-	if (of_unittest_apply_overlay_check(1, 1, 1, 0, PDEV_OVERLAY))
+	ret = of_unittest_apply_overlay_check(1, 1, 1, 0, PDEV_OVERLAY);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest1/status");
+
+	if (ret)
 		return;
 
 	unittest(1, "overlay test %d passed\n", 1);
+
 }
 
 /* test activation of device */
 static void __init of_unittest_overlay_2(void)
 {
+	int ret;
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest2/status");
+
 	/* device should enable */
-	if (of_unittest_apply_overlay_check(2, 2, 0, 1, PDEV_OVERLAY))
-		return;
+	ret = of_unittest_apply_overlay_check(2, 2, 0, 1, PDEV_OVERLAY);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest2/status");
 
+	if (ret)
+		return;
 	unittest(1, "overlay test %d passed\n", 2);
 }
 
 /* test deactivation of device */
 static void __init of_unittest_overlay_3(void)
 {
+	int ret;
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest3/status");
+
 	/* device should disable */
-	if (of_unittest_apply_overlay_check(3, 3, 1, 0, PDEV_OVERLAY))
+	ret = of_unittest_apply_overlay_check(3, 3, 1, 0, PDEV_OVERLAY);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest3/status");
+
+	if (ret)
 		return;
 
 	unittest(1, "overlay test %d passed\n", 3);
@@ -1819,8 +1945,18 @@ static void __init of_unittest_overlay_4(void)
 /* test overlay apply/revert sequence */
 static void __init of_unittest_overlay_5(void)
 {
+	int ret;
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest5/status");
+
 	/* device should disable */
-	if (of_unittest_apply_revert_overlay_check(5, 5, 0, 1, PDEV_OVERLAY))
+	ret = of_unittest_apply_revert_overlay_check(5, 5, 0, 1, PDEV_OVERLAY);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest5/status");
+
+	if (ret)
 		return;
 
 	unittest(1, "overlay test %d passed\n", 5);
@@ -1834,6 +1970,8 @@ static void __init of_unittest_overlay_6(void)
 	int before = 0, after = 1;
 	const char *overlay_name;
 
+	int ret;
+
 	/* unittest device must be in before state */
 	for (i = 0; i < 2; i++) {
 		if (of_unittest_device_exists(unittest_nr + i, PDEV_OVERLAY)
@@ -1848,18 +1986,41 @@ static void __init of_unittest_overlay_6(void)
 	}
 
 	/* apply the overlays */
-	for (i = 0; i < 2; i++) {
 
-		overlay_name = overlay_name_from_nr(overlay_nr + i);
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest6/status");
+
+	overlay_name = overlay_name_from_nr(overlay_nr + 0);
 
-		if (!overlay_data_apply(overlay_name, &ovcs_id)) {
-			unittest(0, "could not apply overlay \"%s\"\n",
-					overlay_name);
+	ret = overlay_data_apply(overlay_name, &ovcs_id);
+
+	if (!ret) {
+		unittest(0, "could not apply overlay \"%s\"\n", overlay_name);
+			return;
+	}
+	ov_id[0] = ovcs_id;
+	of_unittest_track_overlay(ov_id[0]);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest6/status");
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest7/status");
+
+	overlay_name = overlay_name_from_nr(overlay_nr + 1);
+
+	ret = overlay_data_apply(overlay_name, &ovcs_id);
+
+	if (!ret) {
+		unittest(0, "could not apply overlay \"%s\"\n", overlay_name);
 			return;
-		}
-		ov_id[i] = ovcs_id;
-		of_unittest_track_overlay(ov_id[i]);
 	}
+	ov_id[1] = ovcs_id;
+	of_unittest_track_overlay(ov_id[1]);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest7/status");
+
 
 	for (i = 0; i < 2; i++) {
 		/* unittest device must be in after state */
@@ -1900,6 +2061,7 @@ static void __init of_unittest_overlay_6(void)
 	}
 
 	unittest(1, "overlay test %d passed\n", 6);
+
 }
 
 /* test overlay application in sequence */
@@ -1908,26 +2070,65 @@ static void __init of_unittest_overlay_8(void)
 	int i, ov_id[2], ovcs_id;
 	int overlay_nr = 8, unittest_nr = 8;
 	const char *overlay_name;
+	int ret;
 
 	/* we don't care about device state in this test */
 
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest8/status");
+
+	overlay_name = overlay_name_from_nr(overlay_nr + 0);
+
+	ret = overlay_data_apply(overlay_name, &ovcs_id);
+	if (!ret)
+		unittest(0, "could not apply overlay \"%s\"\n", overlay_name);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest8/status");
+
+	if (!ret)
+		return;
+
+	ov_id[0] = ovcs_id;
+	of_unittest_track_overlay(ov_id[0]);
+
+	overlay_name = overlay_name_from_nr(overlay_nr + 1);
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest8/property-foo");
+
 	/* apply the overlays */
-	for (i = 0; i < 2; i++) {
+	ret = overlay_data_apply(overlay_name, &ovcs_id);
 
-		overlay_name = overlay_name_from_nr(overlay_nr + i);
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest8/property-foo");
 
-		if (!overlay_data_apply(overlay_name, &ovcs_id)) {
-			unittest(0, "could not apply overlay \"%s\"\n",
-					overlay_name);
-			return;
-		}
-		ov_id[i] = ovcs_id;
-		of_unittest_track_overlay(ov_id[i]);
+	if (!ret) {
+		unittest(0, "could not apply overlay \"%s\"\n", overlay_name);
+		return;
 	}
 
+	ov_id[1] = ovcs_id;
+	of_unittest_track_overlay(ov_id[1]);
+
 	/* now try to remove first overlay (it should fail) */
 	ovcs_id = ov_id[0];
-	if (!of_overlay_remove(&ovcs_id)) {
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unittest8");
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: overlay #6 is not topmost");
+
+	ret = of_overlay_remove(&ovcs_id);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: overlay #6 is not topmost");
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unittest8");
+
+	if (!ret) {
 		unittest(0, "%s was destroyed @\"%s\"\n",
 				overlay_name_from_nr(overlay_nr + 0),
 				unittest_path(unittest_nr,
@@ -1959,6 +2160,7 @@ static void __init of_unittest_overlay_10(void)
 
 	/* device should disable */
 	ret = of_unittest_apply_overlay_check(10, 10, 0, 1, PDEV_OVERLAY);
+
 	if (unittest(ret == 0,
 			"overlay test %d failed; overlay application\n", 10))
 		return;
@@ -1982,6 +2184,7 @@ static void __init of_unittest_overlay_11(void)
 	/* device should disable */
 	ret = of_unittest_apply_revert_overlay_check(11, 11, 0, 1,
 			PDEV_OVERLAY);
+
 	unittest(ret == 0, "overlay test %d failed; overlay apply\n", 11);
 }
 
@@ -2212,12 +2415,21 @@ static int of_unittest_overlay_i2c_init(void)
 		return ret;
 
 	ret = platform_driver_register(&unittest_i2c_bus_driver);
+
 	if (unittest(ret == 0,
 			"could not register unittest i2c bus driver\n"))
 		return ret;
 
 #if IS_BUILTIN(CONFIG_I2C_MUX)
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "i2c i2c-1: Added multiplexed i2c bus 2");
+
 	ret = i2c_add_driver(&unittest_i2c_mux_driver);
+
+	EXPECT_END(KERN_INFO,
+		   "i2c i2c-1: Added multiplexed i2c bus 2");
+
 	if (unittest(ret == 0,
 			"could not register unittest i2c mux driver\n"))
 		return ret;
@@ -2237,8 +2449,18 @@ static void of_unittest_overlay_i2c_cleanup(void)
 
 static void __init of_unittest_overlay_i2c_12(void)
 {
+	int ret;
+
 	/* device should enable */
-	if (of_unittest_apply_overlay_check(12, 12, 0, 1, I2C_OVERLAY))
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-test-bus/test-unittest12/status");
+
+	ret = of_unittest_apply_overlay_check(12, 12, 0, 1, I2C_OVERLAY);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-test-bus/test-unittest12/status");
+
+	if (ret)
 		return;
 
 	unittest(1, "overlay test %d passed\n", 12);
@@ -2247,8 +2469,18 @@ static void __init of_unittest_overlay_i2c_12(void)
 /* test deactivation of device */
 static void __init of_unittest_overlay_i2c_13(void)
 {
+	int ret;
+
+	EXPECT_BEGIN(KERN_INFO,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-test-bus/test-unittest13/status");
+
 	/* device should disable */
-	if (of_unittest_apply_overlay_check(13, 13, 1, 0, I2C_OVERLAY))
+	ret = of_unittest_apply_overlay_check(13, 13, 1, 0, I2C_OVERLAY);
+
+	EXPECT_END(KERN_INFO,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-test-bus/test-unittest13/status");
+
+	if (ret)
 		return;
 
 	unittest(1, "overlay test %d passed\n", 13);
@@ -2261,8 +2493,18 @@ static void of_unittest_overlay_i2c_14(void)
 
 static void __init of_unittest_overlay_i2c_15(void)
 {
+	int ret;
+
 	/* device should enable */
-	if (of_unittest_apply_overlay_check(15, 15, 0, 1, I2C_OVERLAY))
+	EXPECT_BEGIN(KERN_INFO,
+		     "i2c i2c-1: Added multiplexed i2c bus 3");
+
+	ret = of_unittest_apply_overlay_check(15, 15, 0, 1, I2C_OVERLAY);
+
+	EXPECT_END(KERN_INFO,
+		   "i2c i2c-1: Added multiplexed i2c bus 3");
+
+	if (ret)
 		return;
 
 	unittest(1, "overlay test %d passed\n", 15);
@@ -2723,6 +2965,7 @@ static __init void of_unittest_overlay_high_level(void)
 	struct device_node *overlay_base_symbols;
 	struct device_node **pprev;
 	struct property *prop;
+	int ret;
 
 	if (!overlay_base_root) {
 		unittest(0, "overlay_base_root not initialized\n");
@@ -2837,15 +3080,86 @@ static __init void of_unittest_overlay_high_level(void)
 
 	/* now do the normal overlay usage test */
 
-	unittest(overlay_data_apply("overlay", NULL),
-		 "Adding overlay 'overlay' failed\n");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/status");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/status");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@30/incline-up");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@40/incline-up");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/lights@40000/status");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/lights@40000/color");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/lights@40000/rate");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_left");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_right");
+
+	ret = overlay_data_apply("overlay", NULL);
+
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_right");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_left");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/lights@40000/rate");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/lights@40000/color");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/lights@40000/status");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@40/incline-up");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@30/incline-up");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/status");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/status");
+
+	unittest(ret, "Adding overlay 'overlay' failed\n");
+
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/controller");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/controller/name");
 
 	unittest(overlay_data_apply("overlay_bad_add_dup_node", NULL),
 		 "Adding overlay 'overlay_bad_add_dup_node' failed\n");
 
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/controller/name");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/controller");
+
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail");
+	EXPECT_BEGIN(KERN_ERR,
+		     "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail");
+
 	unittest(overlay_data_apply("overlay_bad_add_dup_prop", NULL),
 		 "Adding overlay 'overlay_bad_add_dup_prop' failed\n");
 
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail");
+	EXPECT_END(KERN_ERR,
+		   "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail");
+
 	unittest(overlay_data_apply("overlay_bad_phandle", NULL),
 		 "Adding overlay 'overlay_bad_phandle' failed\n");
 
@@ -2869,6 +3183,8 @@ static int __init of_unittest(void)
 	struct device_node *np;
 	int res;
 
+	pr_info("start of unittest - you will see error messages\n");
+
 	/* adding data for unittest */
 
 	if (IS_ENABLED(CONFIG_UML))
@@ -2887,7 +3203,6 @@ static int __init of_unittest(void)
 	}
 	of_node_put(np);
 
-	pr_info("start of unittest - you will see error messages\n");
 	of_unittest_check_tree_linkage();
 	of_unittest_check_phandles();
 	of_unittest_find_node_by_name();
Signature · 1 line
Frank Rowand <[email protected]>
maintainer Applied
#10 lore raw

Re: [PATCH v2 2/2] of: unittest: annotate warnings triggered by unittest

Quoted 19 lines · On Thu, 20 Feb 2020 12:40:21 -0600, [email protected] wrote:

From: Frank Rowand <[email protected]>

Some tests in the devicetree unittests result in printk messages from the code being tested. It can be difficult to determine whether the messages are the result of unittest or are potentially reporting bugs that should be fixed. The most recent example of a person asking whether to be concerned about these messages is [1].

Add annotations for all messages triggered by unittests, except KERN_DEBUG messages. (KERN_DEBUG is a special case due to the possible interaction of CONFIG_DYNAMIC_DEBUG.)

The format of the annotations is expected to change when unittests are converted to use the kunit infrastructure when the broader testing community has an opportunity to discuss the implementation of annotations of test triggered messages.

[1] https://lore.kernel.org/r/[email protected]

Quoted 8 lines

---
changes since v1:
- none

 drivers/of/unittest.c | 375 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 345 insertions(+), 30 deletions(-)

Applied, thanks.

Rob