Commit Graph

272 Commits

Author SHA1 Message Date
jdolecek
6801660c77 expose disk device FUA/DPO support via DIOCGCACHE, and allow the flags
to be set for I/O; implement support in sd(4) and nvme(4)

discussed on tech-kern
2017-04-05 20:15:49 +00:00
skrll
fa90529ca0 Use brelsel while the bufcache_lock is held rather than dropping it
and re-taking / dropping it in brelse
2017-03-21 10:46:49 +00:00
riastradh
068914dcb9 Nix trailing whitespace. 2017-03-18 05:45:48 +00:00
skrll
c8226a8b4f Fix build 2017-01-20 09:45:13 +00:00
skrll
fd0caf00f0 Simplify getiobuf. buf_init already does bp->b_objlock == &buffer_lock 2017-01-20 08:16:31 +00:00
pgoyette
c129bbe940 Remove some extraneous whitespace 2016-12-28 06:25:40 +00:00
pgoyette
ee1d5b993e Decouple BIOHIST from other users of KERNHIST. 2016-12-27 04:12:34 +00:00
pgoyette
6a7e4606d5 Fix locking so we don't release the lock between the time we check the
tailq (for being non-empty) and the time we remove an entry.
2016-12-26 23:15:15 +00:00
pgoyette
7f0851cee1 Add a BIOHIST option. As mentioned on tech-kern. 2016-12-26 23:12:33 +00:00
dholland
b79a953f51 typo in comment 2016-12-18 05:43:20 +00:00
jdolecek
71a8e131fb fixup comment 2016-10-28 20:17:27 +00:00
christos
d18e278dd0 Allow sparc kernels to build with SSP by using a constant PAGE_SIZE... 2016-09-29 18:47:35 +00:00
dholland
28ccf570bf In bwrite, add assertion that vp != NULL. (vp is the vnode from the
buffer being written.)

There's some logic here that carefully checks for vp being null, and
other logic that will crash if it is. It appears that it's all
needless paranoia. See tech-kern for more info.

Unless someone sees the assertion go off (in which case a lot more
investigation is needed) I or someone will clean out the logic at some
future point.

Spotted by coypu.
2016-07-31 04:05:32 +00:00
riz
716b7d01f8 Implement the 'io' provider for DTrace. From riastradh@, with
fixes from me.
2016-02-01 05:05:43 +00:00
dholland
d59f36443c Whatever the point of this "biodone_vfs" global function pointer is
(something rumpity?) declare it properly in a header file instead of
in secret where its types can diverge.
2016-01-11 01:22:36 +00:00
martin
31584ffedb KASSERT->KASSERTMSG to allow debugging a double-free'd buffer in ddb. 2016-01-01 18:58:58 +00:00
pooka
d8e04c9094 to garnish, dust with _KERNEL_OPT 2015-08-24 22:50:32 +00:00
maxv
6e39240181 Remove the 'cred' argument from bread(). Remove a now unused var in
ffs_snapshot.c. Update the man page accordingly.

ok hannken@
2015-03-28 19:24:04 +00:00
maxv
bb338d5f26 Remove the 'cred' argument from breadn(), and update the man page
accordingly.

ok hannken@
2015-03-28 17:23:42 +00:00
maxv
4c5ff2135a Remove the 'cred' argument from bio_doread(). 2015-03-28 16:55:21 +00:00
joerg
83d5fa366c Replace random with cprng_fast32. Reorganise computation to replace
(32bit) division with (long) multiplication.
2014-09-08 22:01:24 +00:00
matt
a35d1a8c7c Don't next structure and enum definitions.
Don't use C++ keywords new, try, class, private, etc.
2014-09-05 05:57:21 +00:00
pooka
bc09db942d Call biodone() in the bdev_strategy() error via a pointer. Decouples
subr_devsw from VFS -- not that I/O buffers are _VFS_ entities -- and
eliminates the last weak alias from librump, which means things now
fully work on glibc (w/o LD_DYNAMIC_WEAK) and musl.

The whole code path is suspect anyway, since nothing prevents the device
from escaping after the lookup, suggesting that the whole error path
should be handled by the caller, but oh well.
2014-05-25 16:31:51 +00:00
pooka
4f6fb3bf35 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.
2014-02-25 18:30:08 +00:00
martin
419cac9e69 Mark a diagnostic-only variable 2013-10-25 20:28:33 +00:00
hannken
3881f4f3f9 Replace macro v_specmountpoint with two functions spec_node_getmountedfs()
and spec_node_setmountedfs() to manage the file system mounted on a device.
Assert the device is a block device.

Welcome to 6.99.24

Discussed on tech-kern@ some time ago.

Reviewed by: David Holland <dholland@netbsd.org>
2013-09-30 18:57:59 +00:00
martin
7dbdb14bec Remove unused variable 2013-09-15 15:57:26 +00:00
christos
348fd11f73 remove useless initialization
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
2013-06-28 15:34:21 +00:00
njoly
1f01deacdd Redo case where buf_map is not yet mapped when buf_memcalc() is called
early from pmap_bootstrap(). Makes alpha, and probably others, boot
again.
2013-05-19 11:02:12 +00:00
para
82aa1e7edd calculate vnode cache size based on the resource it gets allocated from
this stops setting kern.maxvnodes to high so it exhausts available space in kmem

http://mail-index.netbsd.org/tech-kern/2013/03/08/msg015095.html
2013-03-18 13:36:21 +00:00
hannken
caf1788f80 Always call brelse() on error for breadn() too. 2012-12-30 09:19:24 +00:00
christos
250d24d86f Always call brelse() on error. Otherwise a possible error from bread() will
cause the buffer to stay lock and we end up blocking forever in
VOP_CLOSE->spec_close->vinvalbuf->bbysy since the buffer is marked busy
but there is no I/O pending.
This caused my laptop to hang on boot_findwedge because:
    findroot: unable to read block 358331527 of dev dk0 (22)
2012-12-29 21:56:04 +00:00
hannken
312d89f0de Change bread() and breadn() to never return a buffer on
error and modify all callers to not brelse() on error.

Welcome to 6.99.16

PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
2012-12-20 08:03:41 +00:00
dsl
5d8067f580 Use separate temporaries for the 'int' percentage and the 'long'
water marks.
Previous paniced on sparc64 due to a misaligned copy.
2012-06-03 16:23:44 +00:00
dsl
0334c2fd52 Fix processing of vm.bufmem_lowater and vm.bufmem_hiwater on 64bit systems.
The values are 'u_long' so copying them into an 'int' temporary
(to avoid writing an out of range value into the actual variable)
doesn't work too well at all.
Shows up on amd64 now that the sysctl values are marked as 64bit.
sparc64 must have been badly broken for ages.
2012-06-03 11:37:44 +00:00
dsl
e21a34c25e Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
  the item itself.
In the places where the caller specifies a function and a structure
  address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
  sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
  AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
  fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
2012-06-02 21:36:41 +00:00
para
e253ed8e30 allocate uareas and buffers from kernel_map again
add code to drain pools if kmem_arena runs out of space
2012-02-01 23:43:49 +00:00
rmind
bc9403f1a3 pool_page_alloc, pool_page_alloc_meta: avoid extra compare, use const.
ffs_mountfs,sys_swapctl: replace memset with kmem_zalloc.
sys_swapctl: move kmem_free outside the lock path.
uvm_init: fix comment, remove pointless numeration of steps.
uvm_map_enter: remove meflagval variable.
Fix some indentation.
2012-01-28 00:00:06 +00:00
para
e62ee4d475 extending vmem(9) to be able to allocated resources for it's own needs.
simplifying uvm_map handling (no special kernel entries anymore no relocking)
make malloc(9) a thin wrapper around kmem(9)
(with private interface for interrupt safety reasons)

releng@ acknowledged
2012-01-27 19:48:38 +00:00
rmind
5c644ed8dd sysctl_dobuf: re-acquire the sysctl lock on retry path. PR/45827. 2012-01-26 19:18:25 +00:00
jakllsch
8c5f62375a Make parts of this this somewhat less gross by using ilog2() from
<sys/bitops.h>.  Additionally, concoct shorter wchan names for >=1 MiB
buf pools using the irrelevantly-more-correct format specifier for u_int.
2011-10-05 01:53:03 +00:00
hannken
49511bba25 Change VOP_BWRITE() to take a vnode as its first argument like all other
VOPs do.  Layered file systems no longer have to modify bp->b_vp and run
into trouble when an async VOP_BWRITE() uses the wrong vnode.

- change all occurences of VOP_BWRITE(bp) to VOP_BWRITE(bp->b_vp, bp).
- remove layer_bwrite().
- welcome to 5.99.55

Adresses PR kern/38762 panic: vwakeup: neg numoutput

No objections from tech-kern@.
2011-07-11 08:27:37 +00:00
rmind
e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
rmind
bd5b92d68b - Replace few malloc(9) uses with kmem(9).
- Rename buf_malloc() to buf_alloc(), fix comments.
- Remove some unnecessary inclusions.
2011-04-24 18:46:22 +00:00
rmind
3346190448 G/C count_lock_queue (unused for 12 years) 2011-03-23 00:58:38 +00:00
uebayasi
9d567f003d Include internal definitions (uvm/uvm.h) only where necessary. 2011-01-17 07:13:31 +00:00
reinoud
766116b74d Fix nestio's behavior on error.
The mbp->b_resid is used to track if all the nested buffers have been issued
and reported back. When the last buffer calls in, mbp->b_resid becomes zero
and biodone(mbp) is called. This is fine as long as there are no errors.

If a read-error does occure in one of the nested buffers, the mbp->b_error is
set and on its call to biodone(mbp), with mbp->b_resid is zero, physio()
panics since it asserts that IF an error is set on a buffer, there should be a
residual amount of data left to transfered.

The patch fixes this case by setting mbp->b_resid back to mbp->b_bcount on
mbp->b_error just before biodone(mbp).

This behaviour is consistent with normal buffer issueing. It either succeeds
or doesn't succeed.
2010-12-22 14:05:50 +00:00
hannken
916ee575ee brelsel: Clear B_COWDONE flag on clean (! BO_DELWRI) buffer. B_COWDONE is set
if the buffer was read with intention to modify but the caller changed its mind.

This error could lead to snapshot corruption when a buffer with B_COWDONE set
resides on the freelist and we create a new snapshot.
2010-12-12 10:30:09 +00:00
pooka
7d421d6903 Don't sleep forever if hz < 25.
from Alessandro Forin
2010-11-02 15:09:52 +00:00
pooka
3f57313fc5 fs_ffs.h is no longer required (since the death of bufops / softdep) 2010-03-02 14:22:44 +00:00