Commit Graph

184 Commits

Author SHA1 Message Date
ad
4b8a875ae2 uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched.  It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.
2020-06-11 19:20:42 +00:00
ad
5c06357c90 Rename uvm_free() -> uvm_availmem(). 2019-12-31 13:07:09 +00:00
ad
ddd3a0be1e uvmexp.free -> uvm_free() 2019-12-21 13:00:20 +00:00
mlelstv
5a52f2af3d Switch to vn_bdev_open* functions. 2019-12-08 12:14:40 +00:00
pgoyette
97b627eca5 Many years ago someone created a new __link_set_sysctl_funcs to hold
the list of routines that need to be called for setting up sysctl
variables.  This worked great for all code included in the kernel
itself, but didn't deal with modules that want to create their own
sysctl data.  So, we ended up with a lot of #ifdef _MODULE blocks
so modules could explicitly call their setup functions when loaded
as non-built-in modules.

So today, we complete the task that was started so many years ago.

When modules are loaded, after we've called xxx_modcmd(INIT...) we
check if the module contains its own __link_set_sysctl_funcs, and
if so we call the functions listed.  We add a struct sysctllog member
to the struct module so we can call sysctl_teardown() when the module
gets unloaded.  (The sequence of events ensures that the sysctl stuff
doesn't get created until the rest of the module's init code does any
required memory allocation.)

So, no more need to explicitly call the sysctl setup routines when
built as a loadable module.
2019-08-07 00:38:01 +00:00
martin
ad4912fd9b Add a disk ioctl DIOCRMWEDGES to remove all wedges of a given disk
(if not busy).
2019-03-27 19:13:33 +00:00
pgoyette
8c2f80f160 Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
2019-03-01 11:06:55 +00:00
pgoyette
d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
christos
e634efa8ef factor out the ccd COMPAT_60 code. 2018-03-18 20:33:52 +00:00
pgoyette
9d1eb4704f Add "bufq_fcfs" requirement to all those driver modules that explicitly
request it in their calls to bufq_alloc().
2018-01-23 22:42:29 +00:00
pgoyette
ee9841898b Ooppss, need an ampersand call calling LIST_EMPTY() macro 2017-12-19 03:31:12 +00:00
pgoyette
c09700cf11 There is currently a counter nactive which tracks the INSERT and REMOVE
of entries in the ccds LIST.

Since the counter is checked only when the ccd module is being unloaded,
remove the counter completely and just check for LIST_EMPTY(ccds).

No functional change intended.
2017-12-19 03:24:09 +00:00
chs
fd34ea77eb 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.
2017-06-01 02:45:05 +00:00
jdolecek
1af402fe8a introduce DKCACHE_COMBINE() macro - it combines the flags in a way that
all common flags are retained, and flags regarding write cache are preserved
if either of the devices has it; callers can thus rely on write cache not
being possible to be used when both flags are missing

use the new macro for ccd(4)
2017-04-05 18:34:56 +00:00
jdolecek
22308629ce support DIOCGCACHE - result is intersection of flags returned by underlying
devices; devices can't be added or removed, so the feature flags remain
static

add support for DIOCGSTRATEGY while here, mainly to make dkctl(8) output neater
2017-03-30 16:50:32 +00:00
mlelstv
ba576b71a7 Enhance disk metrics by calculating a weighted sum that is incremented
by the number of concurrent I/O requests. Also introduce a new disk_wait()
function to measure requests waiting in a bufq.
iostat -y now reports data about waiting and active requests.

So far only drivers using dksubr and dk, ccd, wd and xbd collect data about
waiting requests.
2017-03-05 23:07:12 +00:00
pgoyette
e38abff020 Avoid calling bufq_free() from critical section. 2016-11-20 02:34:27 +00:00
pgoyette
aeebcff218 Create the kern.ccd sysctl sub-tree when built as a module. Even though
the contents of the sub-tree are all structures, and thus not displayed
via sysctl(8), the info is potentially useful to programs.  (For example,
ccdconfig could use this to determine how many units are available.)

The sub-tree is already available when the module is included as built-in
module.
2016-08-07 02:40:41 +00:00
christos
8d10f96266 Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
2015-12-08 20:36:14 +00:00
christos
e7ae23fd9e include "ioconf.h" to get the 'void <driver>attach(int count);' prototype. 2015-08-20 14:40:16 +00:00
skrll
216c99d88d Trailing whitespace. 2015-07-21 21:42:15 +00:00
christos
ddeabcf2cb initialized sc_unit (from Riastradh)
XXX: pullup-7
2015-06-18 17:21:55 +00:00
christos
c182898b0d We have three sets of DTYPE_ constants in the kernel:
altq		Drop 		Type
	disklabel	Disk 		Type
	file		Descriptor	Type
(not to mention constants that contain the string DTYPE).
Let's make them two, by changing the disklabel one to be DisK TYPE since the
other disklabel constants seem to do that. Not many userland programs use
these constants (and the ones that they do are mostly in ifdefs). They will
be fixed shortly.
2015-01-02 19:42:05 +00:00
christos
c60db2e923 make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
2014-12-31 19:52:04 +00:00
christos
3be6bb2414 Centralize wedge ioctls in disk_ioctl. 2014-12-31 17:06:48 +00:00
christos
37efed977c destroy the pool and the mutex when detaching. 2014-12-30 20:57:37 +00:00
christos
ef78102379 - only create ccd's when we ask them to be created.
- keep track of the number of active ccd's so that we don't modunload and
  crash
- fix formatting.
- don't attach 4, the argument is not used.
2014-12-30 20:29:42 +00:00
mlelstv
c5ff2ab77e Fix locking error.
Clear EPASSTHROUGH return value from disk_ioctl.
Add missing wedge ioctls.
2014-12-30 19:11:05 +00:00
jnemeth
026ad6683b Slowly bring this thing kicking and screaming into the 21st century:
- use struct disk_geom
- add wedge support
2014-12-30 12:42:16 +00:00
christos
75320acf84 call disk_ioctl. 2014-12-30 02:21:10 +00:00
mlelstv
49e3024a88 No longer warn about differences bewteen disk size and total sector count
in disklabel when the latter is just clamped to the maximum.
2014-10-11 12:36:25 +00:00
mlelstv
53385cb9cd clamp total number of sectors to UINT32_MAX instead of providing the
lower 32bit of the 64bit number.
2014-10-11 12:01:27 +00:00
sborrill
7d706cf73d Switch size_t to uint64_t in appropriate places to ensure that ccd(4) works
with component and total sizes of > 2TB.
Add COMPAT_60 code for platforms where this alters userland-accessible
structures.
Make kernel print device information when a ccd configured.
Fix some typos in comments.
2014-08-16 19:27:27 +00:00
dholland
f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland
8c70ef39af Add d_discard to all struct bdevsw instances I could find.
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
2014-07-25 08:02:18 +00:00
hannken
292a0c7f1d Change dk_lookup() to return an anonymous vnode not associated with
any file system.  Change all consumers of dk_lookup() to get the
device from "v_rdev" instead of VOP_GETATTR() as specfs does not
support VOP_GETATTR().  Devices obtained with dk_lookup() will no
longer disappear on forced unmounts.

Fix for PR kern/48849 (root mirror raid fails on shutdown)

Welcome to 6.99.44
2014-06-14 07:39:00 +00:00
joerg
552522025c Don't destroy locked mutex. Don't access freed memory. 2014-04-06 00:56:39 +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
pgoyette
8682ae0dd0 ccd module also needs dk_subr 2013-12-28 19:44:41 +00:00
martin
cd2a35a0c5 #ifdef a few variable declarations/initializations to match their use 2013-09-12 12:22:40 +00:00
christos
b08b65c634 - no limit on the number of ccd devices.
- provide sysctl for getting information.
2013-04-27 17:13:32 +00:00
christos
e839ec30fc use getdisksize 2011-11-13 23:02:46 +00:00
hannken
2cc7a01f10 Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock.  Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
2011-10-14 09:23:28 +00:00
joerg
258624699d Fix memset usage. 2011-07-04 16:06:17 +00:00
jruoho
b4a3a8f3ec Adjust the #ifdefs such that ccd(4) and cgd(4) show in
modstat(8) even if built into the kernel.
2011-06-21 06:23:38 +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
9b6bd2d968 Remove clause 3 (UCB advertising clause) from the University of Utah
copyright.  Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
2011-02-08 20:20:06 +00:00
dholland
0a4a6fb035 Fix previous, was all wrong. noticed by enami. 2010-11-19 09:11:45 +00:00
dholland
8f6ed30d57 Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
2010-11-19 06:44:33 +00:00
uebayasi
19b39d64b4 Include uvm/uvm_extern.h to access uvmexp. gtmpsc.c doesn't need
uvm(9) API at all.
2010-11-14 03:49:52 +00:00