mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/4] ci: fixes for PowerPC and networking test
@ 2026-03-02 13:47 Ahmad Fatoum
  2026-03-02 13:47 ` [PATCH 1/4] test: py: network: preserve saved_log_level across _await_prompt Ahmad Fatoum
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2026-03-02 13:47 UTC (permalink / raw)
  To: barebox

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(-)

-- 
2.47.3




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] test: py: network: preserve saved_log_level across _await_prompt
  2026-03-02 13:47 [PATCH 0/4] ci: fixes for PowerPC and networking test Ahmad Fatoum
@ 2026-03-02 13:47 ` Ahmad Fatoum
  2026-03-02 13:47 ` [PATCH 2/4] powerpc: fix initjmp storing function pointer at wrong offset Ahmad Fatoum
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2026-03-02 13:47 UTC (permalink / raw)
  To: barebox; +Cc: Claude Opus 4.6, Ahmad Fatoum

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.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 test/py/test_network.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/py/test_network.py b/test/py/test_network.py
index c8c5e9ec7606..922e425a2b9c 100644
--- a/test/py/test_network.py
+++ b/test/py/test_network.py
@@ -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")
 
-- 
2.47.3




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/4] powerpc: fix initjmp storing function pointer at wrong offset
  2026-03-02 13:47 [PATCH 0/4] ci: fixes for PowerPC and networking test Ahmad Fatoum
  2026-03-02 13:47 ` [PATCH 1/4] test: py: network: preserve saved_log_level across _await_prompt Ahmad Fatoum
@ 2026-03-02 13:47 ` Ahmad Fatoum
  2026-03-02 13:47 ` [PATCH 3/4] powerpc: qemu-ppce500_defconfig: increase malloc area to default 4 MiB Ahmad Fatoum
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2026-03-02 13:47 UTC (permalink / raw)
  To: barebox; +Cc: Claude Opus 4.6, 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.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 arch/powerpc/lib/setjmp.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/lib/setjmp.S b/arch/powerpc/lib/setjmp.S
index 021a57eebc3c..7f4d041ce213 100644
--- a/arch/powerpc/lib/setjmp.S
+++ b/arch/powerpc/lib/setjmp.S
@@ -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)
-- 
2.47.3




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/4] powerpc: qemu-ppce500_defconfig: increase malloc area to default 4 MiB
  2026-03-02 13:47 [PATCH 0/4] ci: fixes for PowerPC and networking test Ahmad Fatoum
  2026-03-02 13:47 ` [PATCH 1/4] test: py: network: preserve saved_log_level across _await_prompt Ahmad Fatoum
  2026-03-02 13:47 ` [PATCH 2/4] powerpc: fix initjmp storing function pointer at wrong offset Ahmad Fatoum
@ 2026-03-02 13:47 ` Ahmad Fatoum
  2026-03-02 13:47 ` [PATCH 4/4] test: selftest: mmu: skip mirroring tests when not supported Ahmad Fatoum
  2026-03-04  7:36 ` [PATCH 0/4] ci: fixes for PowerPC and networking test Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2026-03-02 13:47 UTC (permalink / raw)
  To: barebox; +Cc: 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.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 arch/powerpc/configs/qemu-ppce500_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/qemu-ppce500_defconfig b/arch/powerpc/configs/qemu-ppce500_defconfig
index 6a0e070f4996..318db05ba3cd 100644
--- a/arch/powerpc/configs/qemu-ppce500_defconfig
+++ b/arch/powerpc/configs/qemu-ppce500_defconfig
@@ -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
-- 
2.47.3




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/4] test: selftest: mmu: skip mirroring tests when not supported
  2026-03-02 13:47 [PATCH 0/4] ci: fixes for PowerPC and networking test Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2026-03-02 13:47 ` [PATCH 3/4] powerpc: qemu-ppce500_defconfig: increase malloc area to default 4 MiB Ahmad Fatoum
@ 2026-03-02 13:47 ` Ahmad Fatoum
  2026-03-04  7:36 ` [PATCH 0/4] ci: fixes for PowerPC and networking test Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2026-03-02 13:47 UTC (permalink / raw)
  To: barebox; +Cc: Claude Opus 4.6, 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.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 test/self/mmu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/self/mmu.c b/test/self/mmu.c
index f5a09d76131e..1dd42db7e9c1 100644
--- a/test/self/mmu.c
+++ b/test/self/mmu.c
@@ -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");
-- 
2.47.3




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] ci: fixes for PowerPC and networking test
  2026-03-02 13:47 [PATCH 0/4] ci: fixes for PowerPC and networking test Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2026-03-02 13:47 ` [PATCH 4/4] test: selftest: mmu: skip mirroring tests when not supported Ahmad Fatoum
@ 2026-03-04  7:36 ` Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2026-03-04  7:36 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Mon, 02 Mar 2026 14:47:32 +0100, Ahmad Fatoum wrote:
> 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(-)
> 
> [...]

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,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-04  7:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-02 13:47 [PATCH 0/4] ci: fixes for PowerPC and networking test Ahmad Fatoum
2026-03-02 13:47 ` [PATCH 1/4] test: py: network: preserve saved_log_level across _await_prompt Ahmad Fatoum
2026-03-02 13:47 ` [PATCH 2/4] powerpc: fix initjmp storing function pointer at wrong offset Ahmad Fatoum
2026-03-02 13:47 ` [PATCH 3/4] powerpc: qemu-ppce500_defconfig: increase malloc area to default 4 MiB Ahmad Fatoum
2026-03-02 13:47 ` [PATCH 4/4] test: selftest: mmu: skip mirroring tests when not supported Ahmad Fatoum
2026-03-04  7:36 ` [PATCH 0/4] ci: fixes for PowerPC and networking test Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox