History log of /openbsd-src/sys/kern/sys_generic.c (Results 1 – 25 of 160)
Revision Date Author Comments
# b9ae17a0 30-Dec-2024 guenther <guenther@openbsd.org>

All the device and file type ioctl routines just ignore FIONBIO,
so stop calling down into those layer from fcntl(F_SETFL) or
ioctl(FIONBIO) and delete the "do nothing for this" stubs in all
the *ioc

All the device and file type ioctl routines just ignore FIONBIO,
so stop calling down into those layer from fcntl(F_SETFL) or
ioctl(FIONBIO) and delete the "do nothing for this" stubs in all
the *ioctl routines.

ok dlg@

show more ...


# 2de7505c 05-Nov-2024 claudio <claudio@openbsd.org>

Unlock ptsignal by using the ps_mtx instead of KERNEL_LOCK to ensure
the process is not modified during signal delivery.
This also unlocks psignal and prsignal since those are simple wrappers
around

Unlock ptsignal by using the ps_mtx instead of KERNEL_LOCK to ensure
the process is not modified during signal delivery.
This also unlocks psignal and prsignal since those are simple wrappers
around ptsignal.

OK mpi@

show more ...


# 0d3cf1c0 12-Aug-2024 anton <anton@openbsd.org>

Conditionally compile kqueue poll debug printfs, mainly preventing them
from being included in the ramdisk kernel.

Looks sensible to deraadt@


# a2f40c7d 10-Apr-2024 claudio <claudio@openbsd.org>

Unlock dosigsuspend() and with that some aspects of ppoll and pselect

Change p_sigmask from atomic back to non-atomic updates. All changes to
p_sigmask are only allowed by curproc (the owner). There

Unlock dosigsuspend() and with that some aspects of ppoll and pselect

Change p_sigmask from atomic back to non-atomic updates. All changes to
p_sigmask are only allowed by curproc (the owner). There is no need for
atomic instructions here.

p_sigmask is mostly accessed by curproc with the exception of ptsignal().
In ptsignal() p_sigmask is now only read once unless a SSLEEP proc gets
the signal. In that case recheck the p_sigmask before wakeup to ensure
that no unnecessary wakeup happens.

Add some KASSERT(p == curproc) to ensure this precondition.
sigabort() is special since it is also called by ddb but apart from that
only works for curproc.

With and OK mvs@ OK mpi@

show more ...


# d1d5acb9 09-May-2023 visa <visa@openbsd.org>

Don't return EPIPE from pipe kqfilter

Proceed with the registration of an EVFILT_WRITE filter even if the
pipe's other end has been closed, instead of failing with error EPIPE.
The filter will trigg

Don't return EPIPE from pipe kqfilter

Proceed with the registration of an EVFILT_WRITE filter even if the
pipe's other end has been closed, instead of failing with error EPIPE.
The filter will trigger immediately. This reduces the possible outcomes
when a kevent(2) call and a close(2) call race on the different ends
of a pipe.

This fixes a failure of lang/ghc unit test as reported by gnezdo@.

OK gnezdo@ mpi@

show more ...


# be29726c 25-Feb-2023 mvs <mvs@openbsd.org>

Unlock select(2), pselect(2), poll(2) and ppoll(2).

The assertion within tsleep(9) was relaxed to allow calls on special
`nowake' channel without kernel lock held. So the sisguspend(2) like
cases "s

Unlock select(2), pselect(2), poll(2) and ppoll(2).

The assertion within tsleep(9) was relaxed to allow calls on special
`nowake' channel without kernel lock held. So the sisguspend(2) like
cases "select(0, NULL, NULL, NULL, NULL)" and "poll(NULL, 0, INFTIM)"
should not trigger it. Commit reverted diff back.

ok claudio@

show more ...


# 97b0c015 14-Feb-2023 mvs <mvs@openbsd.org>

Backout previous. Assertion was triggered within tsleep().


# 396bdaae 13-Feb-2023 mvs <mvs@openbsd.org>

Push kernel lock down to dopselect() and doppoll() and unlock select(2),
pselect(2), poll(2) and ppoll(2).

select(2) and poll(2) are just wrappers for kqueue(2)/kevent(2) which
are already unlocked.

Push kernel lock down to dopselect() and doppoll() and unlock select(2),
pselect(2), poll(2) and ppoll(2).

select(2) and poll(2) are just wrappers for kqueue(2)/kevent(2) which
are already unlocked. They do temporary event queue initialization and
scan for this call only. The difference is in local data conversion
between select(2)/poll(2) and kevent(2) formats.

To separate possible signal related fallout, dosigsuspend() left under
the kernel lock. It will be taken only if optional signal mask arg
passed to pselect(2) or ppoll(2). dosigsuspend() will be unlocked later
with sigsuspend(2).

Discussed with claudio@ and kettenis@.

ok claudio@

show more ...


# c78098b6 10-Feb-2023 visa <visa@openbsd.org>

Adjust knote(9) API

Make knote(9) lock the knote list internally, and add knote_locked(9)
for the typical situation where the list is already locked.

Remove the KNOTE(9) macro to simplify the API.

Adjust knote(9) API

Make knote(9) lock the knote list internally, and add knote_locked(9)
for the typical situation where the list is already locked.

Remove the KNOTE(9) macro to simplify the API.

Manual page OK jmc@
OK mpi@ mvs@

show more ...


# 04cdc2f2 27-Dec-2022 patrick <patrick@openbsd.org>

Fix array bounds mismatch with clang 15

New warning -Warray-parameter is a bit overzealous.
ok millert@ tb@


# df70b90c 16-Aug-2022 visa <visa@openbsd.org>

Remove kqueue-related ktrace points from poll(2) and select(2)

These ktrace points do not seem useful any longer because the new
implementation of poll(2) and select(2) appears to work well.

OK der

Remove kqueue-related ktrace points from poll(2) and select(2)

These ktrace points do not seem useful any longer because the new
implementation of poll(2) and select(2) appears to work well.

OK deraadt@ mpi@

show more ...


# 0d280c5f 14-Aug-2022 jsg <jsg@openbsd.org>

remove unneeded includes in sys/kern
ok mpi@ miod@


# d164f4a1 05-Jul-2022 visa <visa@openbsd.org>

Remove old poll/select wakeup mechanism.

Also remove unneeded seltrue() and selfalse().

OK mpi@ jsg@


# c5e59ae3 08-Feb-2022 visa <visa@openbsd.org>

poll(2): Switch to kqueue backend

Implement the poll(2) system call on top of the kqueue subsystem.
This obsoletes the old, non-MP-safe poll backend.

On entering poll(2), the new code translates ea

poll(2): Switch to kqueue backend

Implement the poll(2) system call on top of the kqueue subsystem.
This obsoletes the old, non-MP-safe poll backend.

On entering poll(2), the new code translates each pollfd array entry
into a set of knotes. When these knotes receive events through kqueue,
the events are translated back to pollfd format.

Entries in the pollfd array can refer to the same file descriptor with
overlapping event masks. To allow such overlap with knotes, use an extra
kn_pollid key that separates knotes of different pollfd entries.

Adapted from DragonFly BSD, initial implementation by mpi@.

Tested in snaps for three weeks.

OK mpi@

show more ...


# 6ecc0d7f 11-Dec-2021 visa <visa@openbsd.org>

Clarify usage of __EV_POLL and __EV_SELECT

Make __EV_POLL specific to kqueue-based poll(2), to remove overlap
with __EV_SELECT that only select(2) uses.

OK millert@ mpi@


# 8013d39c 08-Dec-2021 visa <visa@openbsd.org>

Fix select(2) exceptfds handling of FIFOs and pipes

Prevent select(2) from indicating an exceptional condition when the
other end of a FIFO or pipe is closed.

Originally, select(2) returned an exce

Fix select(2) exceptfds handling of FIFOs and pipes

Prevent select(2) from indicating an exceptional condition when the
other end of a FIFO or pipe is closed.

Originally, select(2) returned an exceptfds event only with a pty or
socket that has out-of-band data pending. millert@ says that OpenBSD
diverged from this by accident when poll(2) and select(2) were changed
to use the same backend code in year 2003.

OK millert@

show more ...


# f560a799 30-Nov-2021 visa <visa@openbsd.org>

Prevent select(2) from blocking if registering found pending events.

OK mpi@


# 8296614e 22-Nov-2021 visa <visa@openbsd.org>

Revert poll(2) back to the original implementation

The translation to and from kqueue still has major shortcomings.

Discussed with deraadt@


# 1cc89e63 22-Nov-2021 visa <visa@openbsd.org>

Translate POLLNVAL in ppollcollect()

This makes the kqueue-based poll(2) behave more similarly to the old
code when a monitored file descriptor is closed by another thread.

OK mpi@


# ebddda04 16-Nov-2021 visa <visa@openbsd.org>

Use nowake when poll/select has empty fd set

When the fd set is empty, the code waits for a signal or timeout.
Wakeups from the kqueue are neither expected nor wanted.

OK cheloha@, millert@, anton@

Use nowake when poll/select has empty fd set

When the fd set is empty, the code waits for a signal or timeout.
Wakeups from the kqueue are neither expected nor wanted.

OK cheloha@, millert@, anton@, mpi@

show more ...


# cbf33da8 12-Nov-2021 visa <visa@openbsd.org>

Keep knotes between poll/select systems calls

Reduce the time overhead of kqueue-based poll(2) and select(2) by
keeping knotes registered between the system calls. It is expected that
the set of mon

Keep knotes between poll/select systems calls

Reduce the time overhead of kqueue-based poll(2) and select(2) by
keeping knotes registered between the system calls. It is expected that
the set of monitored file descriptors is relatively unchanged between
consecutive iterations of these system calls. By keeping the knotes,
the system saves the effort of repeated knote unregistering and
re-registering.

To avoid receiving events from file descriptors that are no longer in
the monitored set, each poll/select knote is assigned an increasing
serial number. Every iteration of poll/select uses a previously unused
range of serials for its knotes. In the setup stage, kqueue_register()
updates the serials of any existing knotes in the currently monitored
set. Function kqueue_scan() delivers only the events whose serials are
recent enough; expired knotes are dropped. When the serial range is
about to wrap around, all the knotes in the kqueue backend are dropped.

This change is a space-time tradeoff. Memory usage is increased somewhat
because of the retained knotes. The increase is limited by the number
of open file descriptors and active threads.

Idea from DragonFly BSD, initial patch by mpi@, kqueue_scan()-based
approach by me.

Tested by anton@ and mpi@
OK mpi@

show more ...


# fdbd9592 29-Oct-2021 anton <anton@openbsd.org>

poll needs similar treatment as select recently gained in order to not
mask failed kqueue_register() attempts which in turn causes the thread to
end up sleeping as opposed of propagating the failure

poll needs similar treatment as select recently gained in order to not
mask failed kqueue_register() attempts which in turn causes the thread to
end up sleeping as opposed of propagating the failure to user space.

Regression introduced in the recent switch to implement poll on top of
kqueue.

Thanks to Larry Hynes <larry at larryhynes dot com> for reporting and
Leah Neukirchen <leah at vuxu dot org> for providing a reproducer; which
also already made its way into regress.

ok mpi@

show more ...


# fdd2406a 24-Oct-2021 mpi <mpi@openbsd.org>

Implement poll(2), select(2), ppoll(2) & pselect(2) on top of kqueue.

The given set of fds are converted to equivalent kevents using EV_SET(2)
and passed to the scanning internals of kevent(2): kque

Implement poll(2), select(2), ppoll(2) & pselect(2) on top of kqueue.

The given set of fds are converted to equivalent kevents using EV_SET(2)
and passed to the scanning internals of kevent(2): kqueue_scan().

ktrace(1) will now output the converted kevents on top of the usuals set
bits to be able to find possible error in the convertion.

This switch implies that poll(2) and select(2) will now query underlying
kqfilters instead of the *_poll() routines. An increase in latency is
visible, especially with UDP sockets and NET_LOCK()-contended subsystems
and will be addressed in next steps.

Based on similar work done on MacOS and DragonFlyBSD with inputs from
visa@, millert@, anton@, cheloha@, thanks!

Tested by many, thanks!

ok claudio@, bluhm@

show more ...


# a45acc46 15-Oct-2021 mpi <mpi@openbsd.org>

Revert "Implement select(2) and pselect(2) on top of kqueue."

It introduced a regression exposed by the ssh tests.

Reported by anton@


# 66d924fb 14-Oct-2021 mpi <mpi@openbsd.org>

Implement select(2) and pselect(2) on top of kqueue.

The given set of fds are converted to equivalent kevents using EV_SET(2)
and passed to the scanning internals of kevent(2): kqueue_scan(). Those

Implement select(2) and pselect(2) on top of kqueue.

The given set of fds are converted to equivalent kevents using EV_SET(2)
and passed to the scanning internals of kevent(2): kqueue_scan(). Those
events are lazily deleted to reduce the overhard of freeing/allocating
them when select(2) is called in a loop.

ktrace(1) will now output the converted kevents on top of the usuals set
bits to be able to find possible error in the convertion.

This switch implies that select(2) and pselect(2) will now query the
underlying kqfilters instead of the *_poll() routines. An increase in
latency is visible, especially with UDP sockets and NET_LOCK()-contended
subsystems and will be addressed in a next step.

The various *_poll() routines could be removed as soon as poll(2) and
ppoll(2) are also converted.

Based on similar work done on DragonFlyBSD with inputs from from visa@,
millert@, anton@, cheloha@, thanks!

ok claudio@, bluhm@

show more ...


1234567