Skip to contentSkip to conversation

ci: fixes for PowerPC and networking test

PATCH Applied Ahmad Fatoum 2 participants 6 messages Mar 2 – Mar 4 PowerPC

lore
Share & tools
lore
#0 lore raw

cover ci: fixes for PowerPC and networking test

Ahmad Fatoum (4):
test: py: network: preserve saved_log_level across _await_prompt
powerpc: fix initjmp storing function pointer at wrong offset
powerpc: qemu-ppce500_defconfig: increase malloc area to default 4 MiB
test: selftest: mmu: skip mirroring tests when not supported

 arch/powerpc/configs/qemu-ppce500_defconfig | 1 -
 arch/powerpc/lib/setjmp.S                   | 4 ++--
 test/py/test_network.py                     | 5 +++++
 test/self/mmu.c                             | 6 ++++++
 4 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.47.3
#1 lore raw

PATCH 1/4 test: py: network: preserve saved_log_level across _await_prompt

After sendcontrol("c") in tftp_conversation, the call to _await_prompt() re-queries global.loglevel. At this point, loglevel has already been silenced to 0 by the previous _run() command's cleanup, so _await_prompt() saves 0 as the log level to use for future commands.

This causes the barebox_interfaces fixture's ifup -a to run at loglevel 0 on the next test, suppressing the dev_info "DHCP client bound to address" message that the fixture parses to discover interfaces. The test_barebox_network_real_tftp test then fails with "Network testing is only possible with at least one DHCP interface".

Fix by saving and restoring saved_log_level across the _await_prompt() call.

---
 test/py/test_network.py | 5 +++++
 1 file changed, 5 insertions(+)
test/py/test_network.py +5 -0
index c8c5e9ec7606..922e425a2b9c 100644
@@ -68,7 +68,12 @@ def tftp_conversation(barebox, barebox_interface, guestaddr):
     finally:
         # terminate a timed-out tftp
         barebox.console.sendcontrol("c")
+        saved_log_level = barebox.saved_log_level
         barebox._await_prompt()
+        # _await_prompt() re-queries global.loglevel, which has been
+        # silenced to 0 by _run(), and saves it. Restore the original
+        # level so subsequent run_check() calls still raise it.
+        barebox.saved_log_level = saved_log_level
         tftp_thread.join()
         barebox.run_check("ifdown eth0")
 
Signature · 1 line
2.47.3
#2 lore raw

PATCH 2/4 powerpc: fix initjmp storing function pointer at wrong offset

In reply to Ahmad Fatoum

initjmp was storing the function pointer at offset 88, which is the CR (condition register) slot in the jmp_buf, instead of offset 84, which is the LR (link register) slot. When longjmp later restored the buffer, it would load uninitialized data into LR and jump to it, causing a crash.

This was caught by the setjmp selftest, which triggered a reboot loop on qemu-ppce500.

---
 arch/powerpc/lib/setjmp.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/lib/setjmp.S +2 -2
index 021a57eebc3c..7f4d041ce213 100644
@@ -79,8 +79,8 @@ END(longjmp)
 ENTRY(initjmp)
 	addi	r3,r3,7		# align to 8 byte boundary
 	rlwinm	r3,r3,0,0,28
-	stw	r5,0(r3)	# offset 0
-	stwu	r4,88(r3)	# offset 88
+	stw	r5,0(r3)	# offset 0 - stack pointer
+	stw	r4,84(r3)	# offset 84 - link register
 	li	r3,0
 	blr
 END(initjmp)
Signature · 1 line
2.47.3
#3 lore raw

PATCH 3/4 powerpc: qemu-ppce500_defconfig: increase malloc area to default 4 MiB

In reply to Ahmad Fatoum

qemu-ppce500 was the only PowerPC board with a 1 MiB malloc area, while other boards range from 16 to 64 MiB and the Kconfig default is 4 MiB.

The small heap caused the talloc stress test to run out of memory (the test randomly allocates up to 1024 buffers of 1-4096 bytes). Drop the explicit CONFIG_MALLOC_SIZE override to use the default.

---
 arch/powerpc/configs/qemu-ppce500_defconfig | 1 -
 1 file changed, 1 deletion(-)
arch/powerpc/configs/qemu-ppce500_defconfig +0 -1
index 6a0e070f4996..318db05ba3cd 100644
@@ -1,7 +1,6 @@
 CONFIG_ARCH_MPC85XX=y
 CONFIG_QEMU_PPCE500=y
 CONFIG_NAME="qemu-ppce500_defconfig"
-CONFIG_MALLOC_SIZE=0x100000
 CONFIG_RELOCATABLE=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
Signature · 1 line
2.47.3
#4 lore raw

PATCH 4/4 test: selftest: mmu: skip mirroring tests when not supported

In reply to Ahmad Fatoum

PowerPC e500 uses large CAM-style TLB entries that can't do arbitrary virtual-to-physical remapping. When arch_remap_range returns -ENOSYS for the mirroring case, skip the 6 mirroring subtests instead of counting them as failures.

---
 test/self/mmu.c | 6 ++++++
 1 file changed, 6 insertions(+)
test/self/mmu.c +6 -0
index f5a09d76131e..1dd42db7e9c1 100644
@@ -107,6 +107,10 @@ static void test_remap(void)
 	expect_success(ret, "asserting no mirror before remap");
 
 	ret = arch_remap_range(mirror, buffer_phys, TEST_BUFFER_SIZE, MAP_UNCACHED);
+	if (ret == -ENOSYS) {
+		skipped_tests += 6;
+		goto skip_mirroring;
+	}
 	expect_success(ret, "remapping with mirroring");
 
 	for (i = 0; i < TEST_BUFFER_SIZE; i += sizeof(u32)) {
@@ -150,6 +154,8 @@ static void test_remap(void)
 
 	expect_success(ret, "asserting mirroring after remap (virt += 4K)");
 
+skip_mirroring:
+
 	ret = remap_range(buffer, TEST_BUFFER_SIZE, MAP_DEFAULT);
 	expect_success(ret, "remapping buffer with default attrs");
 	memtest(buffer, TEST_BUFFER_SIZE, "newly cached buffer");
Signature · 1 line
2.47.3
Applied
#5 lore raw
In reply to Ahmad Fatoum
Quoted 6 lines · Ahmad Fatoum

Ahmad Fatoum (4):
test: py: network: preserve saved_log_level across _await_prompt
powerpc: fix initjmp storing function pointer at wrong offset
powerpc: qemu-ppce500_defconfig: increase malloc area to default 4 MiB
test: selftest: mmu: skip mirroring tests when not supported

Quoted 7 lines

arch/powerpc/configs/qemu-ppce500_defconfig | 1 -

 arch/powerpc/lib/setjmp.S                   | 4 ++--
 test/py/test_network.py                     | 5 +++++
 test/self/mmu.c                             | 6 ++++++
 4 files changed, 13 insertions(+), 3 deletions(-)

[...]

Applied, thanks!

[1/4] test: py: network: preserve saved_log_level across _await_prompt

      https://git.pengutronix.de/cgit/barebox/commit/?id=523220c127c7 (link may not be stable)

[2/4] powerpc: fix initjmp storing function pointer at wrong offset
https://git.pengutronix.de/cgit/barebox/commit/?id=bb1ddbf129b6 (link may not be stable)
[3/4] powerpc: qemu-ppce500_defconfig: increase malloc area to default 4 MiB
https://git.pengutronix.de/cgit/barebox/commit/?id=f643a2fc17bf (link may not be stable)
[4/4] test: selftest: mmu: skip mirroring tests when not supported
https://git.pengutronix.de/cgit/barebox/commit/?id=a4b831b2ebc2 (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>