CVSROOT: /cvs Module name: src Changes by: chel...@cvs.openbsd.org 2020/04/05 20:44:31
Modified files: sys/kern : sys_futex.c Log message: futex(2): FUTEX_WAIT: rwsleep_nsec(9) at least one nanosecond mpi@ and I added a warning log to *sleep_nsec(9) last year to smoke out division-to-zero bugs when converting kernel code from *sleep(9) to the new interfaces. It whines if you tell it to sleep for zero nanoseconds. Now that rwsleep_nsec(9) is exposed to userspace via futex(2), though, it is possible to get a legitimate zero-nanosecond timeout from the user. This can cause a lot of logging, which apparently can cause hiccups and hangs in Mesa. As a quick fix we can round the timeout up to one nanosecond and silence the warning. No logs, no delays, no hiccups or hangs. -- Aside: it is unclear what we are supposed to do in the FUTEX_WAIT zero-nanosecond timeout case: block for a tick or return ETIMEDOUT immediately. The Linux futex(2) manpage does not mention the case. It'd be nice to knew what the proper behavior is. -- Prompted by matthieu@. Input from kettenis@ and deraadt@. Tested by matthieu@, ajacoutot@. In snaps since Mar 27 2020. ok ajacoutot@, deraadt@, kettenis@.