NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-sparc64/59312: t_timerfd tests are failing because isQEMU is broken



>Number:         59312
>Category:       port-sparc64
>Synopsis:       t_timerfd tests are failing because isQEMU is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-sparc64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 17 14:10:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The SparqemuBSD Lostation
>Environment:
>Description:
Test case: lib/libc/sys/t_timerfd/timerfd_abstime

Duration: 2.120843 seconds
Termination reason

FAILED: /tmp/build/2025.04.16.12.05.52-sparc64/src/tests/lib/libc/sys/t_timerfd.c:411: then=7816.751641753 now=7818.759207383 delta=2.007565630
Standard output stream

val 2 not in [ 1, 1 ]

Test case: lib/libc/sys/t_timerfd/timerfd_repeating

Duration: 2.116827 seconds
Termination reason

FAILED: /tmp/build/2025.04.16.12.05.52-sparc64/src/tests/lib/libc/sys/t_timerfd.c:362: check_value_against_bounds(val, 3, 5) not met
Standard output stream

val 10 not in [ 3, 5 ]

https://releng.netbsd.org/b5reports/sparc64/2025/2025.04.16.12.05.52/test.html#lib_libc_sys_t_timerfd_timerfd_abstime

These tests are supposed to have some slop for qemu:

     83 	/*
     84 	 * If running under QEMU make sure the upper bound is large
     85 	 * enough for the effect of kern/43997
     86 	 */
     87 	if (isQEMU()) {
     88 		upper *= 4;
     89 	}

https://nxr.netbsd.org/xref/src/tests/lib/libc/sys/t_timerfd.c?r=1.12#83

But the output shows the slop is not getting applied, so presumably isQEMU is not working.

The definition relies on detecting a qemufwcfg0 autoconf instance with drvctl(4):

     46 static __inline bool
     47 isQEMU(void) {
     48        struct devlistargs dla = {
     49 	       .l_devname = "qemufwcfg0",
     50 	       .l_childname = NULL,
     51 	       .l_children = 0,
     52        };
     53        int fd = open(DRVCTLDEV, O_RDONLY, 0);
     54        if (fd == -1)
     55 	       return false;
     56        if (ioctl(fd, DRVLISTDEV, &dla) == -1) {
     57 	       close(fd);
     58 	       return false;
     59        }
     60        close(fd);
     61        return true;
     62 }

https://nxr.netbsd.org/xref/src/tests/lib/libc/gen/isqemu.h?r=1.6#46

But it looks like sparc64 doesn't have a qemufwcfg* attachment at all.  On x86, arm, and riscv, it attaches via acpi or fdt, but there's no acpi or fdt on sparc/sparc64.

Curiously, the tests don't seem to be failing on 32-bit sparc, even though it doesn't have qemufwcfg* either.
>How-To-Repeat:
Under qemu-system-sparc64:

>Fix:
Either:

1. find how to attach qemufwcfg(4) on sparc64, or
2. find another way to detect qemu in tests on sparc64, or
3. implement proper high-resolution timers.



Home | Main Index | Thread Index | Old Index