NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/57273: poll timeout is doubled when NetBSD is run inside QEMU
>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:
Home |
Main Index |
Thread Index |
Old Index