Commit Graph

7430 Commits

Author SHA1 Message Date
rmind
5f0ac9a4fa - Merge sched_pstats() and uvm_meter()/uvm_loadav(). Avoids double loop
through all LWPs and duplicate locking overhead.

- Move sched_pstats() from soft-interrupt context to process 0 main loop.
  Avoids blocking effect on real-time threads.  Mostly fixes PR/38792.

Note: it might be worth to move the loop above PRI_PGDAEMON.  Also,
sched_pstats() might be cleaned-up slightly.
2010-04-16 03:21:49 +00:00
rmind
93deacb9f4 Remove mclpool_allocator, which is unnecessary since mb_map removal. 2010-04-16 02:57:15 +00:00
pooka
cc69e4568b will it include, that is the question
(to everyone's disappointment on some archs it didn't)
2010-04-15 20:46:08 +00:00
pooka
0d8b367e2d Need a few funny #defines in kern_syscall.c too. 2010-04-14 15:15:37 +00:00
pooka
64d6a27dc2 need opt_modular.h in kern_syscall 2010-04-14 15:12:44 +00:00
pooka
7ea24651a7 Move routines related to syscall establishment from kern_subr.c and
kern_stub.c to kern_syscall.c.
2010-04-14 14:46:59 +00:00
pooka
00dd646066 regen: rump vnodeif went on a diet 2010-04-14 14:00:04 +00:00
pooka
fcde1e9ca0 Make rump vnode interface lightweight: the only things we
really need are:

  0) provide VOP_OP in the alternate RUMP_VOP_OP namespace

  and for each op:
  1) schedule rump cpu
  2) call VOP_OP
  3) unschedule rump cpu

While here, take the opportunity to get rid of _t lossage in the
rump-exported interfaces.
2010-04-14 13:58:51 +00:00
pooka
592f1701c5 regenefactor for comment and whitespace changes 2010-04-14 12:21:04 +00:00
pooka
7b0c00ddf9 Print "end of special cases" only where special cases end and not
a second time at the end of the file.  Adjust whitespace for the
sheer functional joy of it.

(i hope i didn't ruin someone's joke by missing a humorous implication
that all vnode operations are considered a little special)
2010-04-14 12:19:50 +00:00
pooka
794d5a7111 _KERNEL_OPT 2010-04-13 22:46:10 +00:00
pooka
2c4f731dd6 tyop 2010-04-12 23:20:18 +00:00
christos
302c1e42ae void police! 2010-04-12 23:09:28 +00:00
pooka
290fe400e0 Separate lwp specificdata data structure management from lwp cpu/vm
management.

No functional change.

(specificdata routines went from kern_lwp.c to subr_lwp_specificdata.c)
2010-04-12 22:15:31 +00:00
mrg
18d175fa3c reject attempts to write CTLTYPE_BOOL nodes with a value other than 0 or 1. 2010-04-11 01:50:25 +00:00
pooka
cfff0936d1 regen: remove unused vdesc_transports 2010-04-10 19:44:02 +00:00
pooka
790df5ab8d "Not yet" since 4.4BSD is quite a lot of "not yet", so remove
vdesc_transports from vnodeop_desc until we have a "not not yet"
situation.

Ride 5.99.27 bump (full build still in progress.  i wanted to get
this in as soon as possible to most effectively ride the bump.)
2010-04-10 19:41:54 +00:00
njoly
cb925a949e Make lwp_ctl_alloc() return 0 instead of EINVAL, when lwpctl user
address already exists. This allow calling _lwp_ctl(2) more than once
on the same LWP.
2010-04-09 11:47:17 +00:00
njoly
4f2ea8f3c9 Add a new clock_gettime1() function that holds most of the
clock_gettime syscall code (except for the copyout). Adjust all
corresponding syscalls to make use of it.
2010-04-08 11:51:13 +00:00
christos
2909eda13b fix build for ports that don't have PT_STEP (Havard Eidnes) 2010-04-07 13:10:46 +00:00
christos
ca843a73b0 PR/43128: Paul Koning: Threads support in ptrace() is insufficient for gdb to
debug threaded live apps: Add an optional lwpid in PT_STEP and PT_CONTINUE to
indicate which lwp to operate on, and implement the glue required to make it
work.
2010-04-06 13:50:22 +00:00
he
d399695a05 Follow christos' suggestions, and make ks_active a u_short, and
also only use 16 u_shorts instead of 32 ints.  Also add panic()
calls for under- and overflow of the ks_active members under
DIAGNOSTIC.  The MAXBUCKET constant ended up in sys/mallocvar.h
and not sys/param.h, as the latter caused build problems.

Ride the kernel revision bump of my previous change.
2010-04-05 08:03:41 +00:00
he
bb89b7208d Extend struct malloc_type to count the number of active allocations
per size, and make vmstat report this information under the "Memory
statistics by type" display, which is only printed when the kernel
has been compiled with KMEMSTATS defined, like this:

Memory statistics by type                                Type  Kern
           Type InUse  MemUse HighUse   Limit   Requests Limit Limit Size(s)
          wapbl    15   4192K   4192K  78644K     376426     0     0 32:0,256:3,512:6,131072:1,262144:2,524288:3

Since struct malloc_type is user-visible and is changed, bump kernel
revision to 5.99.26.

While it is true that malloc(9) is in general on the path of slowly
being replaced by kmem(9) (kmem_alloc/kmem_free), there remains a
lot of points of usage of malloc/free, and this could aid in finding
any leaks.  (It helped finding the leak fixed in PR#42661.)

This was discussed with and somewhat hestitantly OKed by rmind@
2010-04-05 07:16:12 +00:00
jnemeth
bc239ea58a don't leak a vnode and don't call namei (implicitly) twice 2010-04-04 17:18:04 +00:00
njoly
0876f873dd Move most clock_getres syscall code, except for coypout call, to a new
clock_getres1() function which can be used by emulations. Adjust all
clock_getres syscalls to now make of use it.
2010-04-03 17:20:05 +00:00
tsutsui
55bc1f1a41 Use time_t (not long) to save time_second value. 2010-04-02 23:31:42 +00:00
christos
8c20e0e884 fix debugging printf. 2010-04-02 14:11:18 +00:00
ad
78f9946c6b Fix copyrights. 2010-03-31 19:59:39 +00:00
pooka
242bf1c3e7 Stop exposing fifofs internals and leave only fifo_vnodeop_p visible. 2010-03-29 13:11:32 +00:00
pooka
8b70574df1 Add init/fini for components (modules etc.). These eat the standard
driver/attach/data typically present and once some locking is grown
in here, these routines can be made to fail or succeed a component
attachment/detachment atomically.
2010-03-25 19:23:18 +00:00
drochner
713b10dc38 When choosing the start address of a dynamic (ie relocatable) executable,
respect the alignment in the ELF phdr.
Also, for correctness, use the maximum alignment of the PT_LOAD
sections rather than just the first one found.
Also, use more meaningful types.
2010-03-22 22:10:10 +00:00
christos
b691db097d more debugging compilation fixes. 2010-03-20 01:52:16 +00:00
christos
7fa75c35d6 fix debugging code. 2010-03-20 01:47:12 +00:00
christos
6d16572ef4 minimize ifdefs and avoid duplicated code. 2010-03-20 01:45:30 +00:00
christos
3e2a63c711 - Make maximum memory limits for various things #define constants and use the
consistently across the code.
- Re-do note parsing code to read the section headers instead of the program
  headers because the new binutils merge all the note sections in one program
  header. This fixes all the pax note parsing which has been broken for all
  binaries built with the new binutils.
- Add diagnostics to the note parsing code to detect malformed binaries.
- Allocate and free note scratch space only once, not once per note.
2010-03-19 22:08:13 +00:00
pooka
1c55854229 Print builtin "use -f" message only if not autoloading. Otherwise
it'll get spammy.

XXX: this should probably be printed iff the toplevel module is
not being autoloaded (i.e. there is a human to interpret the error).
Otherwise disabled dependencies give a misleading EPERM.
2010-03-18 18:25:45 +00:00
pooka
d76b630321 Never autounload builtin modules (they will never be autoloaded if disabled). 2010-03-18 17:33:18 +00:00
christos
724aa20200 rename DEBUG_ASLR -> PAX_ASLR_DEBUG 2010-03-15 20:35:19 +00:00
darran
0ede06284a DTrace: Make the CTF handling conditional on KDTRACE_HOOKS for now since
it breaks the boot of the atari kernel (and possibly others).
2010-03-14 21:27:49 +00:00
christos
05cb23b544 call accept_filter_init int setopt so that don't use an uninitialized lock
from the setsockopt path.
2010-03-13 23:03:39 +00:00
christos
e8cb686278 make this compile. 2010-03-13 16:27:06 +00:00
christos
04140a33ca make this compile. 2010-03-13 01:41:14 +00:00
darran
38c72d335c DTrace: Add support for CTF sections in the netbsd elf image, load these
at boot.
Add a ksyms_mod_foreach() function to iterate a callback function over the
set of elf symbols for a specific module (netbsd included).
Add kern_ctf.c and mod_ctf_get() to allow the retrieval and decompression
of CTF sections for a specific module.
2010-03-12 21:43:10 +00:00
pooka
effc302a58 Make module_{lookup,enqueue}() static now that it's possible again
(effectively reverts my kern_module rev. 1.53 from some months ago)
2010-03-05 20:10:05 +00:00
pooka
ee7bfacd73 Move builtin modules to a list in init and load them from there
instead of using linksets directly.  This has two implications:

1) It is now possible to "unload" a builtin module provided it is
   not busy.  This is useful e.g. to disable a kernel feature as
   an immediate workaround to a security problem.  To re-initialize
   the module, modload -f <name> is required.
2) It is possible to use builtin modules which were linked at
   runtime with an external linker (dlopen + rump).
2010-03-05 18:35:01 +00:00
pooka
7363f77230 Replace unsafe use of TAILQ_FOREACH: as the comment says, the
structures are pulled off the list in the loop and it's anyone's
guess where they go after that.
2010-03-03 17:58:36 +00:00
pooka
4a21cd9096 Remove fs_lfs now that the syscall is always defined. 2010-03-03 00:49:39 +00:00
yamt
b1521a3612 remove redundant checks of PK_MARKER. 2010-03-03 00:47:30 +00:00
pooka
7f245c149b regen: lfs megamaid syscalls -> MODULAR 2010-03-02 19:37:02 +00:00
pooka
773120876e Make lfs syscalls loadable. This nukes fs_lfs.h & #ifdef LFS.
(I don't mind if someone wants to go further and OBSOL them).
2010-03-02 19:34:26 +00:00
pooka
e867c34ab2 Make is possible to add extra output at the top of syscallargs.h.
Use this feature to stick sys/mount.h in there.
2010-03-02 19:33:12 +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
darran
c9e0343fff Revert accidental commit of CTF work-in-progress changes. 2010-03-01 22:27:07 +00:00
darran
6a9056a926 DTrace: Add an SDT (Statically Defined Tracing) provider framework, and
implement most of the proc provider.  Adds proc:::create, exec,
exec_success, exec_faillure, signal_send, signal_discard, signal_handle,
lwp_create, lwp_start, lwp_exit.
2010-03-01 21:10:13 +00:00
mlelstv
7ad5c184b5 Move block number computations to callers of wapl_read/wapl_write and
conditionally build DEV_BSIZE adjustments for kernel. fsck_ffs shares
the same code but accesses physical blocks.

Also compute correct block numbers for each physical sector.
2010-02-27 16:51:03 +00:00
mlelstv
ef95b640b0 Store physical block numbers in superblock that point to the journal.
Calculate position of both commit headers correctly for disks with
large sectors.
Correct calculation of circular buffer size.
2010-02-27 12:04:19 +00:00
mlelstv
c30b0f26b2 mnt_fs_bshift is the filesystem block size, not the fragment size.
Revert to physical block size. This is fine as long as filesystem
and log stay on a similar physical medium.
2010-02-26 22:24:07 +00:00
jym
cbdb1f8831 Change RSS (resident set size) limit. Instead of setting it arbitrarily
to the total free memory available to the system, use the smallest value
between VM_MAXUSER_ADDRESS and total free memory (having a RSS limit
bigger than VM_MAXUSER_ADDRESS has no real meaning).

Fix a possible int overflow when ptoa(uvmexp.free) is bigger than 4GB
with a 32 bits vaddr_t.

This change is similar to the one made in rev 1.144 of uvm/uvm_glue.c.
2010-02-26 18:47:13 +00:00
dyoung
c1b390d493 A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
2010-02-24 22:37:54 +00:00
darran
eda764aaf5 DTrace: remove kern_dtrace.c since it is no longer used. (Its functions
are inlined in dtrace_bsd.h).
2010-02-23 22:22:29 +00:00
darran
383b7f700b DTrace: Get rid of the KDTRACE_HOOKS ifdefs in the kernel. Replace the
functions with inline function that are empty when KDTRACE_HOOKS is not
defined.
2010-02-23 22:19:27 +00:00
mlelstv
b4d69db7b5 Use correct offset to block number calculations.
Also change access to filesystem blocks to be done by fragment instead
of by physical block. Fragments are the fundamental blocks of the
filesystem.

For a theoretical filesystem that accesses the disk in smaller units
than stored in mp->mnt_fs_bshift, the assumption might be wrong. But
this will also break other subsystems. The value mp->mnt_dev_bshift
which formerly represents the physical sector size is currently only
virtual in NetBSD (always DEV_BSIZE).
2010-02-23 20:51:25 +00:00
drochner
ec0c8f12ca Run binaries with ELF_TYPE==DYN at virtual address PAGE_SIZE rather
than 0. This is still not the intent of PIE, but it allows them to
run with VA 0 disabled.
(The PAX_ASLR stuff which should deal with this needs work.)
CV: ----------------------------------------------------------------------
2010-02-22 19:46:18 +00:00
darran
2c398f9ea9 DTrace: Add __predict_false() to the DTrace hooks per rmind's suggestion. 2010-02-21 07:39:18 +00:00
darran
8d0c2f9cd9 DTrace: missed kern_dtrace.c (thanks rmind!) 2010-02-21 07:28:51 +00:00
darran
37422f86b0 Added a defflag option for KDTRACE_HOOKS and included opt_dtrace.h in the
relevant files. (Per Quentin Garnier - thanks!).
2010-02-21 07:01:57 +00:00
darran
1bc28ea1e9 Add the DTrace hooks to the kernel (KDTRACE_HOOKS config option).
DTrace adds a pointer to the lwp and proc structures which it uses to
manage its state.  These are opaque from the kernel perspective to keep
the kernel free of CDDL code. The state arenas are kmem_alloced and freed
as proccesses and threads are created and destoyed.

Also add a check for trap06 (privileged/illegal instruction) so that
DTrace can check for D scripts that may have triggered the trap so it
can clean up after them and resume normal operation.

Ok with core@.
2010-02-21 02:11:39 +00:00
dyoung
754590e092 Avoid a potential crash: get more struct device initialization
out of the way before trying to get a unit number.  If we cannot
get a unit number, we call config_devfree(), which expects for
fields such as dv_flags, dv_cfattach, and dv_private to be initialized.
2010-02-19 22:28:47 +00:00
skrll
f3c7b2c4cd Fix comment(s).
OK'ed by rmind
2010-02-18 20:58:23 +00:00
dyoung
c26d0a3ad4 Initialize the temporary pmf_qual_t in pmf_device_subtree_release()
to avoid a failed ds != NULL assertion, later.
2010-02-17 00:15:24 +00:00
dholland
1b722ce8d0 Don't inspect vn_stat() results until after checking that it succeeded.
If anyone's been seeing random "File too large" results from module loading,
this should fix it.
2010-02-16 05:47:52 +00:00
dyoung
ff79c75809 Extract a subroutine, const char *cfdata_ifattr(cfdata_t cf), that
returns the name of the interface attribute that associates cf with
its parent.  Use cfdata_ifattr() at several sites in the autoconf
code.
2010-02-15 20:20:34 +00:00
yamt
ca9d84bc07 sysctl_doeproc: don't follow a possibly stale pointer. 2010-02-13 11:22:21 +00:00
haad
aa8090778a Add vrele_async routine which asynchronously release vnodes in different contex
and in some time in the future.

Ok: ad@.
2010-02-11 23:16:35 +00:00
haad
a23681588b Add kmem_asprintf rotuine which allocates string accordingly to format
string from kmem pool. Allocated string is string length + 1 char for ending
zero.

Ok: ad@.
2010-02-11 23:13:46 +00:00
wiz
8e35c759e7 Fix typo in comment. 2010-02-09 23:05:16 +00:00
joerg
1476e7a45a Handle rump like the direct mapping case. 2010-02-08 22:55:36 +00:00
joerg
d621e29eca Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
2010-02-08 19:02:25 +00:00
skrll
c53ddcfff2 Re-apply:
Invert the sense of the bit to mark if LOCKDEBUG is enabled to
	disabled.

	This will help my fellow developers spot "use before initialised"
	problems that hppa picks up very well.

but fix the !LOCKDEBUG case by defining the "no debug" bits to zero so
they have no effect on lock stubs.
2010-02-08 09:54:27 +00:00
uebayasi
2903e6d834 __inline -> inline 2010-02-06 12:10:59 +00:00
cube
5ba423200b Revert commit from Fri Feb 5 06:43:17 UTC 2010 by skrll:
Invert the sense of the bit to mark if LOCKDEBUG is enabled to disabled.

      This will help my fellow developers spot "use before initialised" problems
      that hppa picks up very well.

It has to be done differently, because the semantics of mtx_owner in the non-
LOCKDEBUG case can vary significantly between archs, and thus it is not
possible to simply flip a bit to 1.

Ok core@, as at least i386 is unbootable right now.
2010-02-06 04:50:19 +00:00
cegger
8e585686fb fix LOCKDEBUG panic 'uninitialized lock'.
seminit() calls exithook_establish(). exithook_establish() uses the exec_lock.
exec_lock is initialzed by exec_init(1).
Call exec_init(1) before seminit().
2010-02-05 11:06:36 +00:00
skrll
60b795dc0a Invert the sense of the bit to mark if LOCKDEBUG is enabled to disabled.
This will help my fellow developers spot "use before initialised" problems
that hppa picks up very well.
2010-02-05 06:43:16 +00:00
njoly
0da168aed4 Switch SSP init output to aprint_debug() instead of aprint_normal()
under DIAGNOSTIC ifdefs.
2010-02-01 16:14:58 +00:00
njoly
69c8ab9322 Aprintify. 2010-02-01 12:58:04 +00:00
pooka
0f9bb09e12 Device accessors are only marginally related to autoconf, so put them
into subr_device.c instead of having them in subr_autoconf.c.

Since none of the copyrights in subr_autoconf.c really match the
history of device accessors, I took the liberty of slapping (c)
2006 TNF onto subr_device.c.
2010-01-31 15:10:11 +00:00
skrll
e975ed8767 1 CTASSERT(foo) is enough for anyone. 2010-01-31 11:54:32 +00:00
martin
476c17bc5a This is using device_t, so it needs to include <sys/device.h>. 2010-01-31 09:27:40 +00:00
pooka
8288b650e5 uncommit part which wasn't supposed to get committed yet 2010-01-31 03:57:01 +00:00
pooka
3cba324816 Pass root device as a parameter to domountroothook(). 2010-01-31 02:04:43 +00:00
pooka
04b824ef52 Place *hook implementations in kern_hook.c instead of them floating
around in the kern_subr.c gruel.  Arrrrr.
2010-01-31 01:38:48 +00:00
pooka
3b780690a4 Use proper static initializers for *hooklist (currently they happened
to work accidentally anyway since the initializer is 0).
2010-01-31 00:48:07 +00:00
hubertf
af120bb199 Replace more printfs with aprint_normal / aprint_verbose
Makes "boot -z" go mostly silent for me.
2010-01-31 00:43:37 +00:00
pooka
92394bf5f3 Trade 200-something bytes for the death of an ifdef. 2010-01-30 23:19:55 +00:00
rmind
b8ea6ca48b aio_suspend1: remove wrong comment, add one new.
Tidy up a little, while here.
2010-01-30 21:23:46 +00:00
mlelstv
49be4d025a Add helper function that determines the size and block size of a disk device.
For now we query
- the disk label
- the wedge info and data from disk(9)
2010-01-30 11:57:17 +00:00
he
ce1061323d On a recursive panic(), don't try to take a dump, as that may very
well have triggered the recursive panic.
Fix the comment for panic() to reflect now-current reality: the code
was already changed never to sync() on panic(), now we avoid dumping
core on a recursive panic.
2010-01-26 12:59:50 +00:00
dholland
3c82208a56 Amplify comment about ultrix bits. 2010-01-24 19:56:26 +00:00
hubertf
739e259054 Let kernel build when MALLOCLOG is defined but DIAGNOSTIC is not.
Else, hitmlog() is defined but not used, which triggers a warning.
2010-01-22 08:32:05 +00:00
pgoyette
17d5113226 Remove unnecessary call to kauth_cred_free().
This resolves an occassional crash I'd been experiencing as reported on
current-users@

Fix suggested by and OK elad@
2010-01-21 04:40:22 +00:00