History log of /src/sys/kern/sys_aio.c |
Revision | | Date | Author | Comments |
1.50 |
| 07-Dec-2024 |
riastradh | sys/kern/sys_aio.c: Sprinkle SET_ERROR dtrace probes.
PR kern/58378: Kernel error code origination lacks dtrace probes
|
1.49 |
| 07-Dec-2024 |
riastradh | sys/kern/sys_aio.c: KNF
|
1.48 |
| 23-May-2020 |
ad | Move proc_lock into the data segment. It was dynamically allocated because at the time we had mutex_obj_alloc() but not __cacheline_aligned.
|
1.47 |
| 16-Mar-2020 |
pgoyette | Use the module subsystem's ability to process SYSCTL_SETUP() entries to automate installation of sysctl nodes.
Note that there are still a number of device and pseudo-device modules that create entries tied to individual device units, rather than to the module itself. These are not changed.
|
1.46 |
| 01-Feb-2020 |
riastradh | Load struct filedesc::fd_dt with atomic_load_consume.
Exceptions: when fd_refcnt <= 1, or when holding fd_lock.
While here:
- Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused. => This is used only in fd_close and fd_abort, where it holds. - Move bounds check assertion in fd_putfile to where it matters. - Store fd_dt with atomic_store_release. - Move load of fd_dt under lock in knote_fdclose. - Omit membar_consumer in fdesc_readdir. => atomic_load_consume serves the same purpose now. => Was needed only on alpha anyway.
|
1.45 |
| 23-Nov-2019 |
ad | branches: 1.45.2; Minor scheduler cleanup:
- Adapt to cpu_need_resched() changes. Avoid lost & duplicate IPIs and ASTs. sched_resched_cpu() and sched_resched_lwp() contain the logic for this. - Changes for LSIDL to make the locking scheme match the intended design. - Reduce lock contention and false sharing further. - Numerous small bugfixes, including some corrections for SCHED_FIFO/RT. - Use setrunnable() in more places, and merge cut & pasted code.
|
1.44 |
| 10-Feb-2019 |
christos | branches: 1.44.4; Introduce PR_ZERO to avoid open-coding memset()s everywhere. OK riastradh@.
|
1.43 |
| 01-Jun-2017 |
chs | branches: 1.43.10; remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP kmem_zalloc() with KM_SLEEP percpu_alloc() pserialize_create() psref_class_create()
all of these paths include an assertion that the allocation has not failed, so callers should not assert that again.
|
1.42 |
| 21-Apr-2017 |
christos | - Propagate the signal mask from the ucontext_t to the newly created thread as specified by _lwp_create(2) - Reset the signal stack for threads created with _lwp_create(2)
|
1.41 |
| 07-Jul-2016 |
msaitoh | branches: 1.41.2; 1.41.4; KNF. Remove extra spaces. No functional change.
|
1.40 |
| 05-Sep-2014 |
matt | branches: 1.40.2; Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get a correctly typed pointer.
|
1.39 |
| 25-Feb-2014 |
pooka | Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before the sysctl link sets are processed, and remove redundancy.
Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate lines of code.
|
1.38 |
| 25-Oct-2013 |
martin | Mark a diagnostic-only variable
|
1.37 |
| 17-Feb-2011 |
matt | branches: 1.37.4; 1.37.14; 1.37.18; Remove curproc == NULL test.
|
1.36 |
| 17-Dec-2010 |
yamt | branches: 1.36.2; 1.36.4; aio_worker: add an assertion
|
1.35 |
| 06-Aug-2010 |
jruoho | Like with mqueue(3), create and remove the aio(3) sysctl nodes dynamically.
|
1.34 |
| 24-Jun-2010 |
hannken | Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.
Welcome to 5.99.32.
Discussed on tech-kern.
|
1.33 |
| 13-Jun-2010 |
yamt | aio_enqueue_job: don't bother to check curjob. - it's an undefined behaviour anyway. - the check sometimes prevent legal reuse of userland aiocb. note that the userland can notice the i/o completion and reuse the aiocb before the aio_worker kernel thread clears curjob.
|
1.32 |
| 13-Jun-2010 |
yamt | increment p_nrlwps in lwp_create rather than letting callers do so as it's always decremented by lwp_exit. this fixes error recovery of eg. aio_procinit.
|
1.31 |
| 30-Jan-2010 |
rmind | branches: 1.31.2; 1.31.4; aio_suspend1: remove wrong comment, add one new. Tidy up a little, while here.
|
1.30 |
| 22-Nov-2009 |
mbalmer | more s/the the/the/
|
1.29 |
| 21-Oct-2009 |
rmind | Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828. - Some simplification in threading and sleepq subsystems. - Eliminates pmap_collect() and, as a side note, allows pmap optimisations. - Eliminates XS_CTL_DATA_ONSTACK in scsipi code. - Avoids few scans on LWP list and thus potentially long holds of proc_lock. - Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k. - Removes __SWAP_BROKEN cases.
Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on acorn26 (thanks to <bjh21>).
Discussed on <tech-kern>, reviewed by <ad>.
|
1.28 |
| 12-Oct-2009 |
yamt | sys___aio_suspend50, sys_lio_listio: - fix the buffer sizes. - use kmem_alloc instead of kmem_zalloc for buffers which we will overwrite soon.
|
1.27 |
| 12-Oct-2009 |
yamt | wrap long lines. no functional changes.
|
1.26 |
| 12-Oct-2009 |
yamt | make aio_worker static.
|
1.25 |
| 12-Oct-2009 |
yamt | aio_suspend1: fix a double free bug.
|
1.24 |
| 24-May-2009 |
ad | More changes to improve kern_descrip.c.
- Avoid atomics in more places. - Remove the per-descriptor mutex, and just use filedesc_t::fd_lock. It was only being used to synchronize close, and in any case we needed to take fd_lock to free the descriptor slot. - Optimize certain paths for the <NDFDFILE case. - Sprinkle more comments and assertions. - Cache more stuff in filedesc_t. - Fix numerous minor bugs spotted along the way. - Restructure how the open files array is maintained, for clarity and so that we can eliminate the membar_consumer() call in fd_getfile(). This is mostly syntactic sugar; the main functional change is that fd_nfiles now lives alongside the open file array.
Some measurements with libmicro:
- simple file syscalls are like close() are between 1 to 10% faster. - some nice improvements, e.g. poll(1000) which is ~50% faster.
|
1.23 |
| 22-Feb-2009 |
ad | PR kern/26878 FFSv2 + softdep = livelock (no free ram) PR kern/16942 panic with softdep and quotas PR kern/19565 panic: softdep_write_inodeblock: indirect pointer #1 mismatch PR kern/26274 softdep panic: allocdirect_merge: ... PR kern/26374 Long delay before non-root users can write to softdep partitions PR kern/28621 1.6.x "vp != NULL" panic in ffs_softdep.c:4653 while unmounting a softdep (+quota) filesystem PR kern/29513 FFS+Softdep panic with unfsck-able file-corruption PR kern/31544 The ffs softdep code appears to fail to write dirty bits to disk PR kern/31981 stopping scsi disk can cause panic (softdep) PR kern/32116 kernel panic in softdep (assertion failure) PR kern/32532 softdep_trackbufs deadlock PR kern/37191 softdep: locking against myself PR kern/40474 Kernel panic after remounting raid root with softdep
Retire softdep, pass 2. As discussed and later formally announced on the mailing lists.
|
1.22 |
| 11-Jan-2009 |
christos | branches: 1.22.2; merge christos-time_t
|
1.21 |
| 16-Nov-2008 |
pooka | more <sys/buf.h> police
|
1.20 |
| 14-Nov-2008 |
ad | Make POSIX AIO loadable as a module.
|
1.19 |
| 26-May-2008 |
rmind | branches: 1.19.4; 1.19.6; 1.19.8; 1.19.10; 1.19.12; Adjust and thus unify my license.
|
1.18 |
| 24-Apr-2008 |
ad | branches: 1.18.2; 1.18.4; Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since we no longer need to guard against access from hardware interrupt handlers.
Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the child process share the parent's lock so that signal state may be kept in sync. Partially addresses PR kern/37437.
|
1.17 |
| 24-Apr-2008 |
ad | Network protocol interrupts can now block on locks, so merge the globals proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock). Implications:
- Inspecting process state requires thread context, so signals can no longer be sent from a hardware interrupt handler. Signal activity must be deferred to a soft interrupt or kthread.
- As the proc state locking is simplified, it's now safe to take exit() and wait() out from under kernel_lock.
- The system spends less time at IPL_SCHED, and there is less lock activity.
|
1.16 |
| 21-Mar-2008 |
ad | branches: 1.16.2; 1.16.4; Catch up with descriptor handling changes. See kern_descrip.c revision 1.173 for details.
|
1.15 |
| 21-Dec-2007 |
ad | branches: 1.15.6; KM_NOSLEEP -> KM_SLEEP
|
1.14 |
| 20-Dec-2007 |
dsl | Convert all the system call entry points from: int foo(struct lwp *l, void *v, register_t *retval) to: int foo(struct lwp *l, const struct foo_args *uap, register_t *retval) Fixup compat code to not write into 'uap' and (in some cases) to actually pass a correctly formatted 'uap' structure with the right name to the next routine. A few 'compat' routines that just call standard ones have been deleted. All the 'compat' code compiles (along with the kernels required to test build it). 98% done by automated scripts.
|
1.13 |
| 30-Nov-2007 |
rmind | branches: 1.13.2; 1.13.6; aio_enqueue_job: Fix the mix of previous commits, that is, increase aio_jobs_count only once; also, decrease it in second error case too.
Noted by <ad>.
|
1.12 |
| 29-Nov-2007 |
rmind | Finish the usage of atomic operations: - Leave non-accurate pre-checks; - Use atomic_inc_uint_nv() with re-check;
Reviewed by <ad>.
|
1.11 |
| 29-Nov-2007 |
ad | Use atomics to maintain aio_jobs_count. XXX There is still a race, we should should use atomic_inc_uint_nv() before setup to ensure that we don't exceed the max number of concurrent jobs.
|
1.10 |
| 28-Nov-2007 |
rmind | Unify the license: All rights reserved. No functional change.
|
1.9 |
| 26-Nov-2007 |
pooka | Remove the "struct lwp *" argument from all VFS and VOP interfaces. The general trend is to remove it from all kernel interfaces and this is a start. In case the calling lwp is desired, curlwp should be used.
quick consensus on tech-kern
|
1.8 |
| 06-Nov-2007 |
ad | Merge scheduler changes from the vmlocking branch. All discussed on tech-kern:
- Invert priority space so that zero is the lowest priority. Rearrange number and type of priority levels into bands. Add new bands like 'kernel real time'. - Ignore the priority level passed to tsleep. Compute priority for sleep dynamically. - For SCHED_4BSD, make priority adjustment per-LWP, not per-process.
|
1.7 |
| 01-Sep-2007 |
pooka | branches: 1.7.2; 1.7.6; 1.7.8; Make bioops a pointer and point it to the softdeps struct in softdep init. Decouples "options SOFTDEP" from the main kernel and ffs code.
|
1.6 |
| 11-Jul-2007 |
rmind | branches: 1.6.2; 1.6.4; 1.6.8; 1.6.10; According to POSIX, signal should be sent in aio_cancel() case too.
|
1.5 |
| 31-May-2007 |
rmind | branches: 1.5.2; Make AIO initialization MP-safe.
Actually, lwp_exit() with (l != curlwp) will not work. This fix might be pulled up from vmlocking branch.
|
1.4 |
| 31-May-2007 |
rmind | - Make aio_worker to handle pending exits and coredumps - Allow aio_suspend() to be ended early by a signal - Fix reference counting on LIO structures (remove hack) - Use two global pools for AIO structures - Minor cleanups
Patch provided by <ad>. Some additional modifications by me. Reviewed by <yamt>.
|
1.3 |
| 21-May-2007 |
christos | rename si_sigval -> si_value to match POSIX RTS.
|
1.2 |
| 17-May-2007 |
yamt | merge yamt-idlelwp branch. asked by core@. some ports still needs work.
from doc/BRANCHES:
idle lwp, and some changes depending on it.
1. separate context switching and thread scheduling. (cf. gmcgarry_ctxsw) 2. implement idle lwp. 3. clean up related MD/MI interfaces. 4. make scheduler(s) modular.
|
1.1 |
| 07-May-2007 |
rmind | branches: 1.1.2; Rename vfs_aio.c to sys_aio.c as decided in <tech-kern>.
Please note, that <tech-kern> people should note about file names before commit. Otherwise, function may fail with errno set to EDIRTY, and return -1. ;)
|
1.1.2.3 |
| 17-May-2007 |
yamt | apply vfs_aio.c rev.1.5.2.1 to sys_aio.c.
|
1.1.2.2 |
| 17-May-2007 |
yamt | sync with head.
|
1.1.2.1 |
| 07-May-2007 |
yamt | file sys_aio.c was added on branch yamt-idlelwp on 2007-05-17 13:41:47 +0000
|
1.5.2.11 |
| 01-Nov-2007 |
ad | - Fix interactivity problems under high load. Beacuse soft interrupts are being stacked on top of regular LWPs, more often than not aston() was being called on a soft interrupt thread instead of a user thread, meaning that preemption was not happening on EOI.
- Don't use bool in a couple of data structures. Sub-word writes are not always atomic and may clobber other fields in the containing word.
- For SCHED_4BSD, make p_estcpu per thread (l_estcpu). Rework how the dynamic priority level is calculated - it's much better behaved now.
- Kill the l_usrpri/l_priority split now that priorities are no longer directly assigned by tsleep(). There are three fields describing LWP priority:
l_priority: Dynamic priority calculated by the scheduler. This does not change for kernel/realtime threads, and always stays within the correct band. Eg for timeshared LWPs it never moves out of the user priority range. This is basically what l_usrpri was before.
l_inheritedprio: Lent to the LWP due to priority inheritance (turnstiles).
l_kpriority: A boolean value set true the first time an LWP sleeps within the kernel. This indicates that the LWP should get a priority boost as compensation for blocking. lwp_eprio() now does the equivalent of sched_kpri() if the flag is set. The flag is cleared in userret().
- Keep track of scheduling class (OTHER, FIFO, RR) in struct lwp, and use this to make decisions in a few places where we previously tested for a kernel thread.
- Partially fix itimers and usr/sys/intr time accounting in the presence of software interrupts.
- Use kthread_create() to create idle LWPs. Move priority definitions from the various modules into sys/param.h.
- newlwp -> lwp_create
|
1.5.2.10 |
| 18-Oct-2007 |
ad | Free uareas back to the uarea cache on the CPU where they were last used.
|
1.5.2.9 |
| 16-Oct-2007 |
ad | Oops - fat fingered previous.
|
1.5.2.8 |
| 16-Oct-2007 |
ad | Fix scheduler priority lossage. From rmind@.
|
1.5.2.7 |
| 09-Oct-2007 |
ad | Sync with head.
|
1.5.2.6 |
| 09-Oct-2007 |
ad | Sync with head.
|
1.5.2.5 |
| 20-Aug-2007 |
ad | softdep locking improvements. It hangs looping in flush_inodedep_deps(), more work required.
|
1.5.2.4 |
| 15-Jul-2007 |
ad | Sync with head.
|
1.5.2.3 |
| 09-Jun-2007 |
ad | Sync with head.
|
1.5.2.2 |
| 08-Jun-2007 |
ad | Sync with head.
|
1.5.2.1 |
| 31-May-2007 |
ad | file sys_aio.c was added on branch vmlocking on 2007-06-08 14:17:25 +0000
|
1.6.10.2 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.6.10.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.6.8.4 |
| 03-Dec-2007 |
joerg | Sync with HEAD.
|
1.6.8.3 |
| 27-Nov-2007 |
joerg | Sync with HEAD. amd64 Xen support needs testing.
|
1.6.8.2 |
| 06-Nov-2007 |
joerg | Sync with HEAD.
|
1.6.8.1 |
| 03-Sep-2007 |
jmcneill | Sync with HEAD.
|
1.6.4.1 |
| 03-Sep-2007 |
skrll | Sync with HEAD.
|
1.6.2.2 |
| 11-Jul-2007 |
mjf | Sync with head.
|
1.6.2.1 |
| 11-Jul-2007 |
mjf | file sys_aio.c was added on branch mjf-ufs-trans on 2007-07-11 20:10:08 +0000
|
1.7.8.3 |
| 27-Dec-2007 |
mjf | Sync with HEAD.
|
1.7.8.2 |
| 08-Dec-2007 |
mjf | Sync with HEAD.
|
1.7.8.1 |
| 19-Nov-2007 |
mjf | Sync with HEAD.
|
1.7.6.1 |
| 13-Nov-2007 |
bouyer | Sync with HEAD
|
1.7.2.6 |
| 24-Mar-2008 |
yamt | sync with head.
|
1.7.2.5 |
| 21-Jan-2008 |
yamt | sync with head
|
1.7.2.4 |
| 07-Dec-2007 |
yamt | sync with head
|
1.7.2.3 |
| 15-Nov-2007 |
yamt | sync with head.
|
1.7.2.2 |
| 03-Sep-2007 |
yamt | sync with head.
|
1.7.2.1 |
| 01-Sep-2007 |
yamt | file sys_aio.c was added on branch yamt-lazymbuf on 2007-09-03 14:41:07 +0000
|
1.13.6.1 |
| 02-Jan-2008 |
bouyer | Sync with HEAD
|
1.13.2.1 |
| 26-Dec-2007 |
ad | Sync with head.
|
1.15.6.3 |
| 17-Jan-2009 |
mjf | Sync with HEAD.
|
1.15.6.2 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.15.6.1 |
| 03-Apr-2008 |
mjf | Sync with HEAD.
|
1.16.4.2 |
| 04-Jun-2008 |
yamt | sync with head
|
1.16.4.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.16.2.4 |
| 20-Nov-2008 |
christos | catch up with head.
|
1.16.2.3 |
| 20-Nov-2008 |
christos | merge with head.
|
1.16.2.2 |
| 01-Nov-2008 |
christos | Sync with head.
|
1.16.2.1 |
| 29-Mar-2008 |
christos | Welcome to the time_t=long long dev_t=uint64_t branch.
|
1.18.4.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.18.2.4 |
| 11-Aug-2010 |
yamt | sync with head.
|
1.18.2.3 |
| 11-Mar-2010 |
yamt | sync with head
|
1.18.2.2 |
| 20-Jun-2009 |
yamt | sync with head
|
1.18.2.1 |
| 04-May-2009 |
yamt | sync with head.
|
1.19.12.1 |
| 21-Apr-2010 |
matt | sync to netbsd-5
|
1.19.10.3 |
| 30-Jan-2010 |
snj | Pull up following revision(s) (requested by rmind in ticket #1288): sys/kern/sys_aio.c: revision 1.28 sys_aio_suspend, sys_lio_listio: - fix the buffer sizes. - use kmem_alloc instead of kmem_zalloc for buffers which we will overwrite soon.
|
1.19.10.2 |
| 30-Jan-2010 |
snj | Revert ticket 1286.
|
1.19.10.1 |
| 30-Jan-2010 |
snj | Pull up following revision(s) (requested by rmind in ticket #1286): sys/kern/sys_aio.c: revision 1.25 aio_suspend1: fix a double free bug.
|
1.19.8.3 |
| 30-Jan-2010 |
snj | Pull up following revision(s) (requested by rmind in ticket #1288): sys/kern/sys_aio.c: revision 1.28 via patch sys_aio_suspend, sys_lio_listio: - fix the buffer sizes. - use kmem_alloc instead of kmem_zalloc for buffers which we will overwrite soon.
|
1.19.8.2 |
| 30-Jan-2010 |
snj | Revert ticket 1286.
|
1.19.8.1 |
| 30-Jan-2010 |
snj | Pull up following revision(s) (requested by rmind in ticket #1286): sys/kern/sys_aio.c: revision 1.25 aio_suspend1: fix a double free bug.
|
1.19.6.2 |
| 03-Mar-2009 |
skrll | Sync with HEAD.
|
1.19.6.1 |
| 19-Jan-2009 |
skrll | Sync with HEAD.
|
1.19.4.1 |
| 13-Dec-2008 |
haad | Update haad-dm branch to haad-dm-base2.
|
1.22.2.2 |
| 23-Jul-2009 |
jym | Sync with HEAD.
|
1.22.2.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Commit is split, to avoid a "too many arguments" protocol error.
|
1.31.4.2 |
| 05-Mar-2011 |
rmind | sync with head
|
1.31.4.1 |
| 03-Jul-2010 |
rmind | sync with head
|
1.31.2.1 |
| 17-Aug-2010 |
uebayasi | Sync with HEAD.
|
1.36.4.1 |
| 05-Mar-2011 |
bouyer | Sync with HEAD
|
1.36.2.1 |
| 06-Jun-2011 |
jruoho | Sync with HEAD.
|
1.37.18.1 |
| 18-May-2014 |
rmind | sync with head
|
1.37.14.2 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.37.14.1 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.37.4.1 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.40.2.2 |
| 28-Aug-2017 |
skrll | Sync with HEAD
|
1.40.2.1 |
| 09-Jul-2016 |
skrll | Sync with HEAD
|
1.41.4.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.41.2.1 |
| 26-Apr-2017 |
pgoyette | Sync with HEAD
|
1.43.10.2 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.43.10.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.44.4.1 |
| 20-Nov-2024 |
martin | Pull up following revision(s) (requested by riastradh in ticket #1921):
sys/kern/kern_event.c: revision 1.106 sys/kern/sys_select.c: revision 1.51 sys/kern/subr_exec_fd.c: revision 1.10 sys/kern/sys_aio.c: revision 1.46 sys/kern/kern_descrip.c: revision 1.244 sys/kern/kern_descrip.c: revision 1.245 sys/ddb/db_xxx.c: revision 1.72 sys/ddb/db_xxx.c: revision 1.73 sys/miscfs/fdesc/fdesc_vnops.c: revision 1.132 sys/kern/uipc_usrreq.c: revision 1.195 sys/kern/sys_descrip.c: revision 1.36 sys/kern/uipc_usrreq.c: revision 1.196 sys/kern/uipc_socket2.c: revision 1.135 sys/kern/uipc_socket2.c: revision 1.136 sys/kern/kern_sig.c: revision 1.383 sys/kern/kern_sig.c: revision 1.384 sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.107 sys/miscfs/procfs/procfs_vnops.c: revision 1.208 sys/kern/subr_exec_fd.c: revision 1.9 sys/kern/kern_descrip.c: revision 1.252 (all via patch)
Load struct filedesc::fd_dt with atomic_load_consume.
Exceptions: when fd_refcnt <= 1, or when holding fd_lock.
While here: - Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused. => This is used only in fd_close and fd_abort, where it holds. - Move bounds check assertion in fd_putfile to where it matters. - Store fd_dt with atomic_store_release. - Move load of fd_dt under lock in knote_fdclose. - Omit membar_consumer in fdesc_readdir. => atomic_load_consume serves the same purpose now. => Was needed only on alpha anyway.
Load struct fdfile::ff_file with atomic_load_consume. Exceptions: when we're only testing whether it's there, not about to dereference it.
Note: We do not use atomic_store_release to set it because the preceding mutex_exit should be enough.
(That said, it's not clear the mutex_enter/exit is needed unless refcnt > 0 already, in which case maybe it would be a win to switch from the membar implied by mutex_enter to the membar implied by atomic_store_release -- which I would generally expect to be much cheaper. And a little clearer without a long comment.) kern_descrip.c: Fix membars around reference count decrement.
In general, the `last one out hit the lights' style of reference counting (as opposed to the `whoever's destroying must wait for pending users to finish' style) requires memory barriers like so:
... usage of resources associated with object ... membar_release(); if (atomic_dec_uint_nv(&obj->refcnt) != 0) return; membar_acquire(); ... freeing of resources associated with object ...
This way, all usage happens-before all freeing. This fixes several errors: - fd_close failed to ensure whatever its caller did would happen-before the freeing, in the case where another thread is concurrently trying to close the fd (ff->ff_file == NULL). Fix: Add membar_release before atomic_dec_uint(&ff->ff_refcnt) in that branch. - fd_close failed to ensure all loads its caller had issued will have happened-before the freeing, in the case where the fd is still in use by another thread (fdp->fd_refcnt > 1 and ff->ff_refcnt-- > 0). Fix: Change membar_producer to membar_release before atomic_dec_uint(&ff->ff_refcnt). - fd_close failed to ensure that any usage of fp by other callers would happen-before any freeing it does. Fix: Add membar_acquire after atomic_dec_uint_nv(&ff->ff_refcnt). - fd_free failed to ensure that any usage of fdp by other callers would happen-before any freeing it does. Fix: Add membar_acquire after atomic_dec_uint_nv(&fdp->fd_refcnt).
While here, change membar_exit -> membar_release. No semantic change, just updating away from the legacy API.
|
1.45.2.1 |
| 29-Feb-2020 |
ad | Sync with head.
|