History log of /openbsd-src/sys/kern/sys_generic.c (Results 26 – 50 of 160)
Revision Date Author Comments
# 9f7f4188 08-Jan-2021 visa <visa@openbsd.org>

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

The use of kqueue as backend has introduced a significant regression
in the performance of select(2), so go back to using the original c

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

The use of kqueue as backend has introduced a significant regression
in the performance of select(2), so go back to using the original code.

Some additional management overhead is to be expected when using kqueue.
However, the overhead of the current implementation is too high.

Reported by bluhm@ on bugs@

show more ...


# e9597557 26-Dec-2020 visa <visa@openbsd.org>

Simplify parameters of pselregister().

OK mpi@


# f6df7a3a 22-Dec-2020 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().

ktrac

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().

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.

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

ok visa@

show more ...


# c62c648b 02-Oct-2020 deraadt <deraadt@openbsd.org>

expose timeval/timespec from system calls into ktrace, before determining
if they are out of range, making it easier to isolate reason for EINVAL
ok cheloha


# 2e0a8431 20-Mar-2020 cheloha <cheloha@openbsd.org>

poll(2), ppoll(2), pselect(2), select(2): tsleep(9) -> tsleep_nsec(9)

With input from visa@.

ok visa@


# 112e0b7c 14-Feb-2020 mpi <mpi@openbsd.org>

Push the KERNEL_LOCK() insidge pgsigio() and selwakeup().

The 3 subsystems: signal, poll/select and kqueue can now be addressed
separatly.

Note that bpf(4) and audio(4) currently delay the wakeups

Push the KERNEL_LOCK() insidge pgsigio() and selwakeup().

The 3 subsystems: signal, poll/select and kqueue can now be addressed
separatly.

Note that bpf(4) and audio(4) currently delay the wakeups to a separate
context in order to respect the KERNEL_LOCK() requirement. Sockets (UDP,
TCP) and pipes spin to grab the lock for the sames reasons.

ok anton@, visa@

show more ...


# 1672369d 01-Feb-2020 anton <anton@openbsd.org>

Make writes to the f_flag field of `struct file' MP-safe using atomic
operations. Since the type of f_flag must change in order to use the
atomic(9) API, reorder the struct in order to avoid padding;

Make writes to the f_flag field of `struct file' MP-safe using atomic
operations. Since the type of f_flag must change in order to use the
atomic(9) API, reorder the struct in order to avoid padding; as pointed
out by tedu@.

ok mpi@ visa@

show more ...


# 9566af89 16-Jan-2020 mpi <mpi@openbsd.org>

Introduce wakeup_proc() a function to un-SSTOP/SSLEEP a thread.

This moves most of the SCHED_LOCK() related to protecting the sleepqueue
and its states to kern/kern_sync.c

Name suggestion from jsg@

Introduce wakeup_proc() a function to un-SSTOP/SSLEEP a thread.

This moves most of the SCHED_LOCK() related to protecting the sleepqueue
and its states to kern/kern_sync.c

Name suggestion from jsg@, ok kettenis@, visa@

show more ...


# 36b1b8b4 08-Jan-2020 visa <visa@openbsd.org>

Unify handling of ioctls FIOSETOWN/SIOCSPGRP/TIOCSPGRP and
FIOGETOWN/SIOCGPGRP/TIOCGPGRP. Do this by determining the meaning of
the ID parameter inside the sigio code. Also add cases for FIOSETOWN
an

Unify handling of ioctls FIOSETOWN/SIOCSPGRP/TIOCSPGRP and
FIOGETOWN/SIOCGPGRP/TIOCGPGRP. Do this by determining the meaning of
the ID parameter inside the sigio code. Also add cases for FIOSETOWN
and FIOGETOWN where there have been TIOCSPGRP and TIOCGPGRP before.
These changes allow removing the ID translation from sys_fcntl() and
sys_ioctl().

Idea from NetBSD

OK mpi@, claudio@

show more ...


# ade04487 03-Oct-2019 cheloha <cheloha@openbsd.org>

poll(2), ppoll(2), select(2), pselect(2): always set P_SELECT before tsleep

When I introduced the tsleep loops in r1.23 I screwed it up and introduced
a bug: on EWOULDBLOCK we loop but fail to reset

poll(2), ppoll(2), select(2), pselect(2): always set P_SELECT before tsleep

When I introduced the tsleep loops in r1.23 I screwed it up and introduced
a bug: on EWOULDBLOCK we loop but fail to reset P_SELECT, so the thread
will continue to sleep but miss all relevant descriptor activity after
INT_MAX ticks have elapsed.

Spotted by mpi@ back in July.

ok mpi@

show more ...


# 86391f5b 22-Jun-2019 semarie <semarie@openbsd.org>

push the KERNEL_LOCK deeper on read(2) and write(2)

unlocks read(2) and write(2) syscalls families, and push the KERNEL_LOCK
deeper in the code path. KERNEL_LOCK is managed per file type in fileops

push the KERNEL_LOCK deeper on read(2) and write(2)

unlocks read(2) and write(2) syscalls families, and push the KERNEL_LOCK
deeper in the code path. KERNEL_LOCK is managed per file type in fileops
handlers (fo_read, fo_write, and fo_close). read(2) and write(2) on
socket are KERNEL_LOCK-free.

initial work from mpi@ and ians@

ok mpi@ kettenis@ visa@ ians@

show more ...


# edc99bcd 21-Jun-2019 visa <visa@openbsd.org>

Make resource limit access MP-safe. So far, the copy-on-write sharing
of resource limit structs has been done between processes. By applying
copy-on-write also between threads, threads can read rlimi

Make resource limit access MP-safe. So far, the copy-on-write sharing
of resource limit structs has been done between processes. By applying
copy-on-write also between threads, threads can read rlimits in
a nearly lock-free manner.

Inspired by code in DragonFly BSD and FreeBSD.

OK mpi@, agreement from jmatthew@ and anton@

show more ...


# 82dc0b3f 21-Jan-2019 cheloha <cheloha@openbsd.org>

select(2), pselect(2), poll(2), ppoll(2): Support full timeout range.

Remove the arbitrary and undocumented 24hr limits for timeouts from these
interfaces. To do so, loop tsleep(9) to chip away at

select(2), pselect(2), poll(2), ppoll(2): Support full timeout range.

Remove the arbitrary and undocumented 24hr limits for timeouts from these
interfaces. To do so, loop tsleep(9) to chip away at timeouts larger than
what tsleep(9) can handle in one call.

Use timerisvalid(3)/timespecisvalid() for input validation instead of
itimerfix()/timespecfix() to avoid the 100 million second upper bounds
those functions introduce.

POSIX requires support for timeouts of at least 31 days for select(2) and
pselect(2), so these changes make our implementation more compliant.

Other improvements here include better variable names for the time stuff
and more consolidated timeout logic with less backwards goto jumping, all
of which made dopselect() and doppoll() a bear to read.

Naming improvements prompted by tedu@ in a prior patch for nanosleep(2).
With input from deraadt@. Validation bug spotted by matthew@ in an earlier
version.

ok visa@

show more ...


# 2bd648c0 20-Aug-2018 mpi <mpi@openbsd.org>

Reorder checks in the read/write(2) family of syscalls to prepare making
file operations mp-safe.

This change makes it clear that `f_offset' is only accessed in vn_read()
and vn_write(), which will

Reorder checks in the read/write(2) family of syscalls to prepare making
file operations mp-safe.

This change makes it clear that `f_offset' is only accessed in vn_read()
and vn_write(), which will help taking it out of the KERNEL_LOCK().

This refactoring uncovered a race in vn_read() which is now documented
and will be addressed in a later diff.

ok visa@

show more ...


# 4c73c37a 14-Jul-2018 jsg <jsg@openbsd.org>

Don't pass an uninitialised size value to free(9). Pointer argument is
NULL in this path so free will return early without accessing it.

ok jca@ tb@


# 30cae0e1 10-Jul-2018 mpi <mpi@openbsd.org>

Move socket & pipe specific logic in their ioctl handler.

ok visa@, tb@


# be76c0e7 08-May-2018 mpi <mpi@openbsd.org>

Protect per-file counters and document which lock is used to protect
the other fields.

Once we no longer have any [k] (kernel lock) protections, we'll be
able to unlock almost all network related sy

Protect per-file counters and document which lock is used to protect
the other fields.

Once we no longer have any [k] (kernel lock) protections, we'll be
able to unlock almost all network related syscalls.

Inputs from and ok bluhm@, visa@

show more ...


# bae06bfd 27-Apr-2018 mpi <mpi@openbsd.org>

Move FREF() inside fd_getfile().

ok visa@


# 52c92054 09-Apr-2018 mpi <mpi@openbsd.org>

Call FREF() right after fd_getfile_mode() in sys_ioctl().

ok visa@, bluhm@


# 4b1f64dc 02-Jan-2018 guenther <guenther@openbsd.org>

Stop assuming <sys/file.h> will pull in fcntl.h when _KERNEL is defined.

ok millert@ sthen@


# 06235387 26-Jun-2017 mpi <mpi@openbsd.org>

Assert that the corresponding socket is locked when manipulating socket
buffers.

This is one step towards unlocking TCP input path. Note that all the
functions asserting for the socket lock are not

Assert that the corresponding socket is locked when manipulating socket
buffers.

This is one step towards unlocking TCP input path. Note that all the
functions asserting for the socket lock are not necessarilly MP-safe.
All the fields of 'struct socket' aren't protected.

Introduce a new kernel-only kqueue hint, NOTE_SUBMIT, to be able to
tell when a filter needs to lock the underlying data structures. Logic
and name taken from NetBSD.

Tested by Hrvoje Popovski.

ok claudio@, bluhm@, mikeb@

show more ...


# 69e7eddb 24-Jan-2017 mpi <mpi@openbsd.org>

Rename pfind(9) into tfind(9) to reflect that it deals with threads.

While here document prfind(9.

with and ok guenther@


# 3b7181b7 07-Nov-2016 guenther <guenther@openbsd.org>

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@


# fc68b3f3 05-Jul-2016 tedu <tedu@openbsd.org>

remove some casts that aren't necessary.


# cd632112 07-Jun-2016 deraadt <deraadt@openbsd.org>

ktrace support for pollfd[] arrays
ok guenther


1234567