<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-openbsd/sys/kern/sys_futex.c, branch jd/queueboosts</title>
<subtitle>WireGuard implementation for the OpenBSD kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-openbsd/atom/sys/kern/sys_futex.c?h=jd%2Fqueueboosts</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-openbsd/atom/sys/kern/sys_futex.c?h=jd%2Fqueueboosts'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/'/>
<updated>2020-04-06T02:44:31Z</updated>
<entry>
<title>futex(2): FUTEX_WAIT: rwsleep_nsec(9) at least one nanosecond</title>
<updated>2020-04-06T02:44:31Z</updated>
<author>
<name>cheloha</name>
<email>cheloha@openbsd.org</email>
</author>
<published>2020-04-06T02:44:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=59fcf85e94cf403a7c925f524e436f89456dac8b'/>
<id>urn:sha1:59fcf85e94cf403a7c925f524e436f89456dac8b</id>
<content type='text'>
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@.
</content>
</entry>
<entry>
<title>futex(2): futex_wait(): ensure timeout is set when calling rwsleep_nsec(9)</title>
<updated>2020-03-20T17:17:31Z</updated>
<author>
<name>cheloha</name>
<email>cheloha@openbsd.org</email>
</author>
<published>2020-03-20T17:17:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=e48149febb33412d827977632c0f6d47a456c928'/>
<id>urn:sha1:e48149febb33412d827977632c0f6d47a456c928</id>
<content type='text'>
rwsleep_nsec(9) will not set a timeout if the nsecs parameter is
equal to INFSLP (UINT64_MAX).  We need to limit the duration to
 MAXTSLP (UINT64_MAX - 1) to ensure a timeout is set.
</content>
</entry>
<entry>
<title>Introduce TIMESPEC_TO_NSEC() and use it to convert userland facing</title>
<updated>2020-01-14T08:52:18Z</updated>
<author>
<name>mpi</name>
<email>mpi@openbsd.org</email>
</author>
<published>2020-01-14T08:52:18Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=e80014c68b2561493718bbcef6e7fcb172d7f885'/>
<id>urn:sha1:e80014c68b2561493718bbcef6e7fcb172d7f885</id>
<content type='text'>
tsleep(9) to tsleep_nsec(9).

ok bluhm@
</content>
</entry>
<entry>
<title>Stop sleeping at PUSER.</title>
<updated>2019-07-10T15:52:17Z</updated>
<author>
<name>mpi</name>
<email>mpi@openbsd.org</email>
</author>
<published>2019-07-10T15:52:17Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=8b6fe72e4c9549f8ea0f52831f916c6c6df51ab6'/>
<id>urn:sha1:8b6fe72e4c9549f8ea0f52831f916c6c6df51ab6</id>
<content type='text'>
This allows to enforce that sleeping priorities will now always be &lt;
PUSER.

ok visa@, ratchov@
</content>
</entry>
<entry>
<title>Use ktrreltimespec() as the timeout is relative, pointed by matthew@.</title>
<updated>2019-02-06T15:11:20Z</updated>
<author>
<name>mpi</name>
<email>mpi@openbsd.org</email>
</author>
<published>2019-02-06T15:11:20Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=a51004ae7cc510761b616d6798533d8d9a707c6b'/>
<id>urn:sha1:a51004ae7cc510761b616d6798533d8d9a707c6b</id>
<content type='text'>
ok cheloha@
</content>
</entry>
<entry>
<title>Sprinkle a pinch of timerisvalid/timespecisvalid over the rest of sys/kern</title>
<updated>2019-01-23T21:53:42Z</updated>
<author>
<name>cheloha</name>
<email>cheloha@openbsd.org</email>
</author>
<published>2019-01-23T21:53:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=9448fb1baea18db0386914d638f3b206078564bb'/>
<id>urn:sha1:9448fb1baea18db0386914d638f3b206078564bb</id>
<content type='text'>
</content>
</entry>
<entry>
<title>futex(2): validate relative timeout before sleeping.</title>
<updated>2019-01-18T05:06:37Z</updated>
<author>
<name>cheloha</name>
<email>cheloha@openbsd.org</email>
</author>
<published>2019-01-18T05:06:37Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=1cd39fe86126b028eee228895c3faa4277e450ac'/>
<id>urn:sha1:1cd39fe86126b028eee228895c3faa4277e450ac</id>
<content type='text'>
Linux does validation.

Document this new failure case as an EINVAL, like Linux.

"stop waiting" deraadt
</content>
</entry>
<entry>
<title>Split the system-wide list of all futexes into process-specific lists</title>
<updated>2018-08-30T03:30:25Z</updated>
<author>
<name>visa</name>
<email>visa@openbsd.org</email>
</author>
<published>2018-08-30T03:30:25Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=dbb9e73f5c4a3032c7e16db983dfa4f7c022e352'/>
<id>urn:sha1:dbb9e73f5c4a3032c7e16db983dfa4f7c022e352</id>
<content type='text'>
of private futexes and a shared list of shared futexes. This speeds up
futex lookups.

Tested by and OK krw@
OK mpi@
</content>
</entry>
<entry>
<title>Implement process-shared futexes.  These are now the default implementation.</title>
<updated>2018-06-03T15:09:26Z</updated>
<author>
<name>kettenis</name>
<email>kettenis@openbsd.org</email>
</author>
<published>2018-06-03T15:09:26Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=672a12b33825d37824af0ad0853546e9826c5e48'/>
<id>urn:sha1:672a12b33825d37824af0ad0853546e9826c5e48</id>
<content type='text'>
Introduce process-private futexs.  These will bypass the uvm mapping lookup
and should be slightly more efficient.

ok visa@, mpi@
</content>
</entry>
<entry>
<title>Make futex(2) also return ECANCELED in case SA_RESTART was set.</title>
<updated>2018-04-24T17:19:35Z</updated>
<author>
<name>pirofti</name>
<email>pirofti@openbsd.org</email>
</author>
<published>2018-04-24T17:19:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=e6f936ae14eefce39afc9f91b0bfa68a690753d9'/>
<id>urn:sha1:e6f936ae14eefce39afc9f91b0bfa68a690753d9</id>
<content type='text'>
Prodded by and ok mpi@
</content>
</entry>
</feed>
