NetBSD-Bugs archive

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

Re: kern/57273: poll timeout is doubled when NetBSD is run inside QEMU



See kern/43997

On Thu, 16 Mar 2023, roy%marples.name@localhost wrote:

Number:         57273
Category:       kern
Synopsis:       poll timeout is doubled when NetBSD is run inside QEMU
Confidential:   no
Severity:       serious
Priority:       medium
Responsible:    kern-bug-people
State:          open
Class:          sw-bug
Submitter-Id:   net
Arrival-Date:   Thu Mar 16 16:55:00 +0000 2023
Originator:     Roy Marples
Release:        NetBSD-9.3
Organization:
Environment:
NetBSD netbsd9 9.3_STABLE NetBSD 9.3_STABLE (GENERIC) #0: Mon Mar 13 21:38:46 UTC 2023  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Description:
Testing dhcpcd timings in a NetBSD vm is impossible because the time to sleep with any polling mechanism (poll, pollts, kqueue) is doubled.
Outside the vm, on bare metal, it works fine.
How-To-Repeat:
Install NetBSD to a qemu VM hosted on NetBSD.

Reproducer:

#include <poll.h>
#include <stdio.h>
#include <time.h>

int
main(void)
{
       struct timespec ts = { .tv_sec = 10 };
       struct timespec start, end;

       fprintf(stderr, "ppoll timeout %ld secs\n", ts.tv_sec);
       clock_gettime(CLOCK_MONOTONIC, &start);
       fprintf(stderr, "poll start is %ld, timeout is %ld, end should be %ld\n",
           start.tv_sec, ts.tv_sec, start.tv_sec + ts.tv_sec);
       pollts(NULL, 0, &ts, NULL);
       clock_gettime(CLOCK_MONOTONIC, &end);
       fprintf(stderr, "poll end is %ld, off by %ld secs\n",
           end.tv_sec, end.tv_sec - (start.tv_sec + ts.tv_sec));
       return 0;
}
Fix:


!DSPAM:641349ef114062545387549!



+--------------------+--------------------------+----------------------+
| Paul Goyette       | PGP Key fingerprint:     | E-mail addresses:    |
| (Retired)          | FA29 0E3B 35AF E8AE 6651 | paul%whooppee.com@localhost    |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette%netbsd.org@localhost  |
| & Network Engineer |                          | pgoyette99%gmail.com@localhost |
+--------------------+--------------------------+----------------------+


Home | Main Index | Thread Index | Old Index