Commit Graph

7493 Commits

Author SHA1 Message Date
yamt
e38edea451 use NULL instead of 0 for pointers. 2010-06-13 03:32:47 +00:00
pooka
9dac69e895 Fix DIAGNOSTIC. Moral of the story: don't comment xen kernels out of the
build even if you'd like to go to sleep earlier.
2010-06-11 07:32:32 +00:00
pooka
51542301d2 lwp0 seems like an lwp instead of a process, so move bits related
to it from kern_proc.c to kern_lwp.c.  This makes kern_proc
"scheduling-clean" and more easily usable in environments with a
non-integrated scheduler (like, to take a random example, rump).
2010-06-10 20:54:53 +00:00
pooka
13ce287a55 rump stubs for _ksem* 2010-06-10 19:09:03 +00:00
pooka
36e68995ca smoke the smoke, hack the hack, *beep* the *beep*, _KERNEL_OPT the _KERNEL_POT 2010-06-10 19:06:26 +00:00
hannken
62bfdd2b21 Change layered file systems to always pass the locking VOP's down to the
leaf file system.  Remove now unused member v_vnlock from struct vnode.
Welcome to 5.99.30

Discussed on tech-kern.
2010-06-06 08:01:30 +00:00
skrll
1c518780b3 Follow the correct locking protocol when creating an LWP and the process
is stopping.

Problem found by running the gdb testsuite (gdb didn't have pthreads
support)

Thanks to rmind for help with this.
2010-06-06 07:46:17 +00:00
dholland
c2fc97579a Improve previous: there were two printfs and I'd only noticed and fixed
one of them. PR 43217.
2010-06-06 06:20:16 +00:00
rmind
189974619e proc_alloc: move kdtrace_proc_ctor() out of the proc_lock. 2010-06-04 23:02:18 +00:00
njoly
fe0d8c08a5 Rumpify pathconf(2)/fpathconf(2)
ok from pooka@
2010-06-04 16:32:00 +00:00
pooka
d71ac89211 Report result of pool_reclaim() from pool_drain_end(). 2010-06-03 10:40:17 +00:00
pooka
41bed623f4 .. except we need to check the flag while still clinging to iLock. 2010-05-27 23:58:38 +00:00
pooka
072ab7f0ce Assert that a VI_CLEAN vnode is not succesfully vget'd. 2010-05-27 23:54:35 +00:00
pooka
f0c67b0751 Feed dust to a few linkset uses and explicitly call the constructor. 2010-05-26 23:53:21 +00:00
pgoyette
c77c96962b Move definition of module_load_vfs_vec from kern_module_vfs.c to
kern_module.c - keeps rump happy.

Thanks, pooka!
2010-05-24 16:37:17 +00:00
pgoyette
c269eb06dd Clean up kern_module.c rev 1.66, thanks to pooka@ for review & suggestions 2010-05-24 15:34:48 +00:00
pgoyette
2c4465aaa0 Protect against attempting to load modules from the filesystem until we
have mounted the root file-system.  This allows us to load built-in and
boot-loader-provided modules much earlier during startup.
2010-05-24 03:50:25 +00:00
pooka
42da46e1d2 Don't namei while holding vnode lock. kern/43328 2010-05-21 16:48:55 +00:00
drochner
8239dc73b5 fix sigwaitinfo/sigtimedwait:
-allow NULL "info" pointer
-return signal number
2010-05-20 17:10:42 +00:00
njoly
a00a76ca8d Add multiple inclusion protection to rump_syscalls.h. 2010-05-17 12:35:20 +00:00
cegger
dfa8eb2f81 Move PMAP_KMPAGE to be used in pmap_kenter_pa flags argument.
'Looks good to me' gimpy@
2010-05-14 05:02:05 +00:00
haad
6b319cec0e Fix bogus KASSERT, typo and KNFize my previous patch. 2010-05-12 15:53:20 +00:00
rmind
70f6a0718b pool_{cache_}get: improve previous diagnostic by checking for panicstr,
so it wont trigger the assert while trying to dump core on crash.
2010-05-12 08:11:16 +00:00
rmind
b3d53a5f95 - Sprinkle asserts to catch calls from interrupt context on IPL_NONE pools.
- Add diagnostic drain attempt.
2010-05-12 03:43:46 +00:00
rmind
6bf9a07036 execve1: move few PNBUF_PUT() outside the lock paths. 2010-05-12 03:40:38 +00:00
haad
6af3749398 Add support for kthread_join in our kernel thread implementation. This is used
by zfs but I think that it can be generaly usefull. Thread need to be created
with KTHREAD_JOINABLE flag and can be joined only once.
When joinable thread was created it will not e automatically reaped from system
and kthread_join must be called on it to reap it.

Ok by ad@.
2010-05-11 22:26:00 +00:00
pooka
a96791040e remove unnecessary #ifdef 2010-05-11 20:21:56 +00:00
pooka
14d288df20 _RUMPKERNEL -> _KERNEL 2010-05-11 20:09:11 +00:00
pooka
b2cb120dee This not working on ews4800mips has nothing to do with rump, so:
_RUMPKERNEL -> _MACHINE != ews4800mips
2010-05-11 20:07:40 +00:00
pooka
5fd51e5ff8 the crowd went crazy
as typo left the stage
2010-05-11 09:30:29 +00:00
christos
242fd69b63 give the name of the dup initialization. 2010-05-05 02:20:42 +00:00
kardel
a2c1ee7188 switch to nanotime() for 100ns resolution 2010-05-04 19:23:56 +00:00
tsutsui
9a9555d932 Some KNF. 2010-05-04 14:14:54 +00:00
tsutsui
25362a67ff Don't #error on invalid LABELSECTOR or LABELOFFSET on __RUMPKERNEL build.
As mentioned in src/sys/rump/dev/lib/libdisk/Makefile,
rump(4) builds don't check if each ${MACHINE} actually supports
MBR in MD readdisklabel(9) ops while it pulls MD <machine/disklabel.h>.

Workarounds so long broken build of ews4800mips.
2010-05-04 12:20:50 +00:00
darran
17b7c13057 DTrace: Fix several bugs where the mod_ctf_get() function could return
success even though no CTF section was present in the kernel or module.
This fixes the panic that several people saw when trying out the FBT
provider without updating /boot or missing a CTF section in /netbsd.
2010-05-03 09:51:36 +00:00
dholland
05d90ebea1 Blanking the path buffer only needs to be done when DIAGNOSTIC.
(I meant to set it back this way before committing but evidently forgot
last night. Thanks to rmind for noticing.)
2010-05-02 23:22:51 +00:00
pooka
193bcc771a If a builtin dependency is missing, error instead of panic. As
pointed out by martin, configurations like builtin nfsserver can
be succesfully linked without including all dependencies (specifically,
nfs).  Until all such weirdosities are fixed, opt for at least a
semifunctional system.
2010-05-02 11:01:03 +00:00
dholland
30c9deb259 Don't printf a userspace pointer; print the copied-in kernel version
instead, now that it's readily available. Fixes PR 43217.
2010-05-02 06:35:21 +00:00
dholland
54f6c52ba9 Remove the nameidata from struct exec_package. It was used only for two
things: passing an argument to check_exec, which is better done explicitly,
and handing back the resolved pathname generated by namei, which we can
make an explicit slot for in struct exec_package instead. While here,
perform some related tidyup, and store the kernel-side copy of the path
to the executable as well as the pointer into userspace. (But the latter
should probably be removed in the future.)
2010-05-02 05:30:20 +00:00
dyoung
b875f6ccc8 IPL_VM is the highest interrupt priority where alldevs is read/written,
and acquiring alldevs_mtx already blocks those interrupts, so delete the
splhigh()/splx() in config_alldevs_lock()/_unlock().

Release alldevs_mtx while freeing memory with kmem_free(9); according to
new documentation, kmem_free(9) can sleep! :-) Thanks to rmind@ for the
tip.

Next step: use finer-grained locking, probably by adding a mutex to
    cfdriver_t.

And after that: make sure that all threads of execution are out of the
    device_t and/or softc before releasing their memory.
2010-04-30 21:17:22 +00:00
pooka
6e3fa8db54 Add translation from vtype to dirent type. Convert rumpfs now.
I'll convert the rest of the file servers in need after the next
version bump to avoid the coding module crisis.
2010-04-30 10:03:13 +00:00
martin
ffb5896ed4 Add a CTASSERT to make sure the cexp and ldavg arrays are kept in sync 2010-04-30 10:02:00 +00:00
dyoung
3f82819ca5 Add data types, function prototypes, and stub implementations
for pci_chipset_tag_create() and pci_chipset_tag_destroy().  On
architectures that support it, an MI PCI bus driver can override the
architecture's default pci(9) and pci_intr(9) implementation.

Coming up next: documentation.
After that: x86 implementation.
Last but not least: make cbb(4) use MI PCI overrides.
2010-04-28 20:33:52 +00:00
pooka
6ec71a1c75 Use sys_nomodule for modular rump system calls so that they can be
autoloaded.
2010-04-27 10:57:46 +00:00
pooka
da792af712 Add an optional hook for adjusting module string table after load.
Currently to be used for rump "SAOS" namespace trick.
2010-04-26 22:58:53 +00:00
rmind
3144d8ae3f Revert rev1.6, it shall return ETIMEDOUT for pthread calls. 2010-04-26 16:26:11 +00:00
ad
a0f75dc2db Allocate the cpu_infos array dynamically. 2010-04-25 15:57:59 +00:00
ad
3f21f42490 - console spam.
- atomic_dec_uint -> vfs_destroy.
2010-04-25 15:56:00 +00:00
ad
2e2855a6f2 Make select/poll work with more than 32 CPUs.
No ABI change.
2010-04-25 15:55:24 +00:00
ad
caac34d32b MAXCPUS -> maxcpus 2010-04-25 11:49:22 +00:00
ad
b445fb5178 MAXCPUS -> __arraycount 2010-04-25 11:49:04 +00:00
rmind
5b61593723 mq_timed{send,receive}: as required by POSIX, return EINVAL on invalid
timeout and thread would have blocked, instead of ETIMEDOUT.  Change is
to abstimeout2timo(), thus also affects _lwp_park(2).

Reported by Stathis Kamperis some months ago.
2010-04-23 19:29:23 +00:00
rmind
13f624ca0f Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.
2010-04-23 19:18:09 +00:00
rmind
d8eaa1fed9 Remove M_IOV (missed in previous commit) and M_1394DATA types. 2010-04-23 19:09:15 +00:00
pooka
0c20c076ce Enforce RLIMIT_FSIZE before VOP_WRITE. This adds support to file
system drivers where it was missing from and fixes one buggy
implementation.  The arguably weird semantics of the check are
maintained (v_size vs. va_bytes, overwrite).
2010-04-23 15:38:46 +00:00
rmind
d00df28408 Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
  Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
2010-04-23 15:19:19 +00:00
pooka
33de26e6c6 dumdidumdum, need _KERNEL in previous for fsck. noticed by moof 2010-04-21 19:50:57 +00:00
pooka
34244e1069 Reduce #ifdef spew by attaching wapbl as a module.
(no, it's still too ifdef-ridden to be able to actually do anything
useful and module-like like load into any kernel)
2010-04-21 16:51:24 +00:00
pooka
593dfe42a8 make get/setrlimit as rump-capable 2010-04-21 16:17:04 +00:00
rmind
f08aebed01 sched_pstats: fix previous, exclude system/softintr threads from loadavg. 2010-04-20 16:49:48 +00:00
dyoung
ad6e139a80 Add default implementations for bus_space_is_equal(9),
bus_space_tag_create(9), and bus_space_tag_destroy(9).  Use
bus_space_is_equal(9) throughout the kernel to compare
bus_space_tag_t's.  Tested on i386 and on sparc64.
2010-04-19 18:24:26 +00:00
jruoho
1cbdcd8dc6 Use CTLTYPE_BOOL. 2010-04-19 11:20:56 +00:00
pooka
d8c5395931 Don't loop eternal if init of a builtin module fails. 2010-04-16 11:51:23 +00:00
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