diff options
| author | riastradh <riastradh@NetBSD.org> | 2020-02-01 02:23:03 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2020-02-01 02:23:03 +0000 |
| commit | fcee5fe3ac44ab4e0eb6bc72b68b761c44cd1c1a (patch) | |
| tree | f3eb971f7ca56e68d49a763b1d4374195b9b26b4 /sys/ddb | |
| parent | 1f6c4f3fb46a5e746b9ad2ad8c2dfc8a3216bdd9 (diff) | |
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.
Diffstat (limited to 'sys/ddb')
| -rw-r--r-- | sys/ddb/db_xxx.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/ddb/db_xxx.c b/sys/ddb/db_xxx.c index cac0c8362e0..4d92f310528 100644 --- a/sys/ddb/db_xxx.c +++ b/sys/ddb/db_xxx.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_xxx.c,v 1.71 2015/02/27 00:47:30 ozaki-r Exp $ */ +/* $NetBSD: db_xxx.c,v 1.72 2020/02/01 02:23:04 riastradh Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.71 2015/02/27 00:47:30 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.72 2020/02/01 02:23:04 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_kgdb.h" @@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.71 2015/02/27 00:47:30 ozaki-r Exp $"); #endif #include <sys/param.h> +#include <sys/atomic.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/proc.h> @@ -173,7 +174,7 @@ db_show_files_cmd(db_expr_t addr, bool haddr, p = (struct proc *) (uintptr_t) addr; fdp = p->p_fd; - dt = fdp->fd_dt; + dt = atomic_load_consume(&fdp->fd_dt); for (i = 0; i < dt->dt_nfiles; i++) { if ((ff = dt->dt_ff[i]) == NULL) continue; |
