Commit Graph

6875 Commits

Author SHA1 Message Date
joerg
f5b0fec0e0 Remove SHMMAXPGS from all kernel configs. Dynamically compute the
initial limit as 1/4 of the physical memory. Ensure the limit is at
least 1024 pages, the old default on most platforms.
2009-03-06 20:31:46 +00:00
uebayasi
c8f1efab53 xc_lowpri: don't truncate `where' from uint64_t to u_int. 2009-03-05 13:18:51 +00:00
yamt
c75123c99b main: disable kerenel preemption during early on boot. namely, between
configure() and configure2().  some kernel threads are not expected
to be run before "cold = 0".  fixes cache_thread() busy-loop.
2009-03-05 06:37:03 +00:00
skrll
5ccc095a3e Fix the posix_fadvise return value... finally.
Tested martin on sparc64/m68k and me on hppa.
2009-03-04 18:11:24 +00:00
rmind
4f1720c349 lwp_create: fix the locking bugs on affinity ingerition path (mea culpa).
pset_assign: traverse the list of LWPs safely.
sched_setaffinity: free cpuset (unused path) outside the lock.

Reviewed (with feedback) by <ad>.
2009-03-03 21:55:06 +00:00
ad
822f68cc07 If DEBUG is enabled, drop kpreempt_pri to zero. It means that every
wakeup will cause a kernel preemption, simulating massive concurrency.

Proposed on tech-kern@.
2009-03-02 21:17:29 +00:00
rmind
4bd0e7cebc fd_copy: fix off-by-one bug in a race condition path and assert.
Should fix PR/40625.  OK by <ad>.
2009-03-02 19:28:08 +00:00
kenh
dc5d469510 If sys/param.h is not included, the kernel compile fails on some platforms
with SOFTINT_COUNT undefined (I noticed it on some evbarm kernels)
2009-02-26 05:50:54 +00:00
ad
b2dec392e0 Fix some comments. 2009-02-23 20:33:30 +00:00
ad
59fcf21389 PR kern/26878 FFSv2 + softdep = livelock (no free ram)
PR kern/16942 panic with softdep and quotas
PR kern/19565 panic: softdep_write_inodeblock: indirect pointer #1 mismatch
PR kern/26274 softdep panic: allocdirect_merge: ...
PR kern/26374 Long delay before non-root users can write to softdep partitions
PR kern/28621 1.6.x "vp != NULL" panic in ffs_softdep.c:4653 while unmounting a softdep (+quota) filesystem
PR kern/29513 FFS+Softdep panic with unfsck-able file-corruption
PR kern/31544 The ffs softdep code appears to fail to write dirty bits to disk
PR kern/31981 stopping scsi disk can cause panic (softdep)
PR kern/32116 kernel panic in softdep (assertion failure)
PR kern/32532 softdep_trackbufs deadlock
PR kern/37191 softdep: locking against myself
PR kern/40474 Kernel panic after remounting raid root with softdep

Retire softdep, pass 2. As discussed and later formally announced on the
mailing lists.
2009-02-22 20:28:05 +00:00
ad
430f67aa17 PR kern/39564 wapbl performance issues with disk cache flushing
PR kern/40361 WAPBL locking panic in -current
PR kern/40361 WAPBL locking panic in -current
PR kern/40470 WAPBL corrupts ext2fs
PR kern/40562 busy loop in ffs_sync when unmounting a file system
PR kern/40525 panic: ffs_valloc: dup alloc

- A fix for an issue that can lead to "ffs_valloc: dup" due to dirty cg
  buffers being invalidated. Problem discovered and patch by dholland@.

- If the syncer fails to lazily sync a vnode due to lock contention,
  retry 1 second later instead of 30 seconds later.

- Flush inode atime updates every ~10 seconds (this makes most sense with
  logging). Presently they didn't hit the disk for read-only files or
  devices until the file system was unmounted. It would be better to trickle
  the updates out but that would require more extensive changes.

- Fix issues with file system corruption, busy looping and other nasty
  problems when logging and non-logging file systems are intermixed,
  with one being the root file system.

- For logging, do not flush metadata on an inode-at-a-time basis if the sync
  has been requested by ioflush. Previously, we could try hundreds of log
  sync operations a second due to inode update activity, causing the syncer
  to fall behind and metadata updates to be serialized across the entire
  file system. Instead, burst out metadata and log flushes at a minimum
  interval of every 10 seconds on an active file system (happens more often
  if the log becomes full). Note this does not change the operation of
  fsync() etc.

- With the flush issue fixed, re-enable concurrent metadata updates in
  vfs_wapbl.c.
2009-02-22 20:10:25 +00:00
pooka
b50bd8632e Instead of linking rump system call entry points directly to the
backend, perform all calls through a syscall table.  This makes it
possible to make system calls to non-local rump kernels.
(requires a bit support code.  it's written but quite messy currently)
2009-02-20 17:56:36 +00:00
yamt
777ded00ac cache_lookup_entry: add an assertion. 2009-02-18 13:36:11 +00:00
yamt
c69852d701 vmem_rehash_all: remove a debug printf slipped in with the previous changes. 2009-02-18 13:33:46 +00:00
yamt
f68e4571e5 - fix vmem unittest. rename VMEM_DEBUG so that it won't be abused again.
- reimplement vmem sanity checks with less code duplication.
- reimplement ddb vmem-related commands in a more consistent ways.
  remove automatic whatis.
2009-02-18 13:31:59 +00:00
yamt
947efbeab9 cache_purge1: consistently unlock ncp a little earlier. 2009-02-18 13:24:18 +00:00
yamt
4c5a0bb384 redo rev.1.19 correctly. 2009-02-18 13:22:10 +00:00
yamt
a13bb3bef4 whitespace 2009-02-18 13:12:00 +00:00
yamt
feff5384df use %zu for size_t 2009-02-18 13:04:59 +00:00
rmind
3de401ae19 Make sched_getrq() inline (gcc does not optimize it), avoids call. 2009-02-17 22:00:14 +00:00
ad
81525af92d Fix min/max confusion that causes a problem with DEBUG on some
architectures. Independently spotted by yamt@. /brick ad
2009-02-17 21:54:30 +00:00
enami
fb8633d4a9 Simplify the code; we already have a hint to decide which string to copy.
(And at least gcc generates better code.)
2009-02-15 03:52:49 +00:00
enami
60ebbc4e81 The knote objects attached by peer will still be linked in our list
if we are closed before the peer.  So, remove them.  It didn't matter
when pipe objects are directly returned to pool, but nowadays they
are cached.
2009-02-15 00:07:54 +00:00
christos
24587463c9 remove 2038 comment 2009-02-14 20:45:29 +00:00
christos
bd1260c5ff from enami: Only apply rootdir changes if the chroot dir != / 2009-02-14 17:06:35 +00:00
christos
78a45c73e9 PR/40634: Christoph Badura: "chroot / /sbin/mount" shows only / as mounted 2009-02-14 16:55:25 +00:00
pooka
3e656734b8 cosmetic: don't print empty line at end of init_sysent.c 2009-02-14 16:21:23 +00:00
apb
0cc72e51ac Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.
2009-02-13 22:41:00 +00:00
christos
160a37667a Unbreak ssp kernels. The issue here that when the ssp_init() call was deferred,
it caused the return from the enclosing function to break, as well as the
ssp return on i386. To fix both issues, split configure in two pieces
the one before calling ssp_init and the one after, and move the ssp_init()
call back in main. Put ssp_init() in its own file, and compile this new file
with -fno-stack-protector. Tested on amd64.
XXX: If we want to have ssp kernels working on 5.0, this change needs to
be pulled up.
2009-02-12 18:24:18 +00:00
enami
d5b0f6df4c s/NOFOLLOW/FOLLOW/ in NDINIT so that it matches actual behavior
which is controlled by NO_FOLLOW bit passed in 2nd arg of vn_open().
2009-02-11 00:32:45 +00:00
enami
7efd6dbe73 Make module (auto)loading under chroot envrionment actually work:
- NOCHROOT flag must be assigned to different bit from TRYEMULROOT
  since the code expected to be executed is in the else clase of
  if (flags & TRYEMULROOT).
- Necessary variables aren't set.
2009-02-11 00:19:11 +00:00
rmind
db4ca04011 dosetrlimit: remove the checks which are no longer needed since rlim_t
is unsigned again.  Hi <christos>!
2009-02-09 11:13:20 +00:00
pooka
8e52b87ec3 Don't try to fd_putfile() descriptors we didn't manage to fd_getfile().
Fixes local DoS panic described in kern/40570.
2009-02-08 16:38:12 +00:00
enami
e3b99073fb Previous code ususally works since compiler won't put gap between
those struct members but there is no reason to rely on that.
While here, I rewrite the loop using an usual idiom.  It shaves
both source and object code.
2009-02-06 23:56:26 +00:00
enami
e1be06d405 Instead of missing NULL check in pipe_create, let the pipe_ctor to wait
on buffer allocation.  The other allocation is simply an optimization,
so leave it as is.
2009-02-06 23:04:57 +00:00
enami
60b229d2eb Use same expression to decide to use pool cache or not in both
kmem_alloc/free.
2009-02-06 22:58:49 +00:00
dyoung
b4f3367acd Extract a subroutine pmf_device_resume_descendants() from
pmf_device_resume_subtree(), for re-use later.
2009-02-06 01:19:33 +00:00
enami
e6aec5115a Make revoke(2) works as before:
- vfs_syscalls.c rev. 1.342 fails to invert condition correcly when
  then-clause and else-clause is swapped.  Since then, revoke(2) fails
  if it is issued by file owner.
- Probably since rev. 1.160 of genfs_vnops.c, revoke(2) fails if it is
  applied to non-device file and drops kernel into ddb.
2009-02-05 13:37:24 +00:00
ad
2015b56df5 Warn once and no more about backwards monotonic clock. 2009-02-04 21:29:54 +00:00
ad
3c32363107 PR kern/36183 problem with ptrace and multithreaded processes
Fix the crashy test case that Thor provided.
2009-02-04 21:17:39 +00:00
haad
07b62696b9 Add support for loading pseudo-device drivers. Try to autoload modules from
specs_open routine. If devsw_open fail, get driver name with devsw_getname
routine and autoload module.

For now only dm drivervcan be loaded, other pseudo drivers needs more work.

Ok by ad@.
2009-02-02 14:00:27 +00:00
enami
ad526ef003 - An errno is missed in rev. 1.11 while converting return statement to
goto statement.
- A local variable still in use is intercepted in rev. 1.6.  Define and
  use variable of its own.
2009-02-02 11:19:29 +00:00
yamt
5e978bf3b6 remove a non-ascii comment. 2009-02-02 00:10:18 +00:00
yamt
e1146d7ee9 back to malloc for now as wapbl_biodone is called by softint. 2009-02-02 00:07:06 +00:00
ad
c26577a1b0 Apply kmem patch posted to tech-kern.
- Add another level of caches, for max quantum cache size -> PAGE_SIZE.
- Add debug code to verify that kmem_free() is given the correct size.
2009-02-01 18:51:07 +00:00
ad
58fb9db514 Apply pipe patch posted to tech-kern, slightly updated:
- Cache kva.
- Convert to use mutex_obj_alloc().
- Make better use of pool_cache.

Also:

Disable direct transfers for the moment. I believe there may be a bug that
can cause transfers to stall when switching between direct/buffered access.
I think this has most recently been run into on 'denver' but I have seen it
as far back as 3.1.

(As an aside, direct is a not a clear win on modern systems with large cache
and high TLB invalidation overhead. Particularly so on MP systems, although
micro benchmarks may report otherwise because they typically do not tax the
system. Anyone want to write a decent benchmark?)
2009-02-01 18:23:04 +00:00
yamt
fc774e4e61 settime1: fix a bug i introduced when i made l_stime use monotonic time.
from Matthias Drochner on tech-kern@.  PR/40511 from Martin Husemann.
2009-01-31 15:53:36 +00:00
yamt
740c75e25d - malloc -> kmem_alloc
- kill WAPBL_UVM_ALLOC.
- kill wapbl_blk_pool to reduce #ifdef.
2009-01-31 09:33:36 +00:00
ad
697e4adf70 timer_intr: hold proc_lock across the loop, otherwise the process we are
about to signal could disappear.
2009-01-30 23:11:27 +00:00
pooka
42356a10b5 Quote PR number in XXX comment. No functional change. 2009-01-30 21:16:51 +00:00
agc
276ab299a6 Fix a tyop in the previous commit 2009-01-30 04:09:35 +00:00
drochner
338f42d97e put back a range check in setrlimit() for now
(thanks to Andrew Doran for remembering)
rlim_t _should_ be unsigned, but this needs more work
2009-01-29 22:27:23 +00:00
ad
a9743c2461 - Allow creating timeshard kthreads. To be used to fix the RAIDframe
parity rewrite issue.
- Create kthreads in the SCHED_RR class by default, not SCHED_FIFO.
2009-01-29 22:00:26 +00:00
rmind
a487ff992f sched_pstats: add few checks to catch the problem. OK by <ad>. 2009-01-28 22:59:46 +00:00
reinoud
69f4b23bdc Don't claim its an ISO partitioning scheme too early in the label. An MBR
might me there instead.
2009-01-28 15:26:28 +00:00
njoly
f024404c50 Do not call put_type() but use copyout() when returning the message
segments to the user.

ok by rmind.
2009-01-28 00:59:03 +00:00
njoly
122f627e90 Make msgsnd(2)/msgrcv(2) fail with EINVAL for messages larger than
SSIZE_MAX. Adjust man pages accordingly.

ok by christos.
2009-01-26 13:08:48 +00:00
pooka
89fa47c428 Tag a few more socket syscalls with RUMP:
recvmsg, sendmsg, recvfrom, getpeername, getsockname, sendto,
shutdown, socketpair
2009-01-26 12:20:05 +00:00
yamt
f4fa6bbef9 bump VMEM_HASHSIZE_MAX from 8192 to 65536. 2009-01-25 13:08:56 +00:00
rmind
5a84a46b8c mutex_vector_enter: few predictions. 2009-01-25 04:45:14 +00:00
rmind
66063c53a6 Set l_psid to PS_NONE for lwp0 (consistency change). 2009-01-24 22:42:32 +00:00
rmind
6d73ddd355 Revert path of modules back to "/stand". 2009-01-24 22:14:44 +00:00
rmind
f0e51651e4 Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0.  Proposed on <tech-kern>.
2009-01-24 00:29:12 +00:00
pooka
06abc8c3f9 Remove debug print -- this is what happens when there's several
hours between implementation and commit.
2009-01-23 19:29:38 +00:00
pooka
c7e5a8be4e Remove the "int *error" parameter from rump syscalls. Instead use
rumpuser_seterrno() to set the errno for the caller.  This makes
the difference between real and rump syscalls way less intrusive
in calling code.
2009-01-23 19:27:18 +00:00
pooka
f6724ea74f solock() in compat code error branch to avoid panic 2009-01-23 15:40:19 +00:00
rmind
9e43fad609 sys__pset_bind: obviously, sched_takecpu() should take "t" LWP, not "l". 2009-01-23 13:58:08 +00:00
pooka
8b32829eeb Change VMEM_HASHSIZE_INIT from 1 to 128. This mainly benefits
quick-running or non-threaded rump jobs, where the rehash algorithm
does not have a chance to run.  For other cases it doesn't make
much difference, since the size will grow or decrease when the
rehash algorithm runs for the first time (t=10*hz currently).
2009-01-23 13:45:06 +00:00
jmmv
f084134ae9 Initialize SYMTAB_SPACE ksyms during ksyms_init. Per PR port-evbarm/40311. 2009-01-23 09:22:25 +00:00
drochner
cf45120117 Avoid deadlock in tty code if a terminal emulation responds to
type/status/etc inquiries. (PR kern/37915)
This is clearly a design problem in tty, but we need a cheap fix now.
The problem is that ttyinput() tries to pull a spinlock which
is already held on calls to t_oproc.
The workaround is based on the fact that within wscons code, the
wsdisplay_emulinput() function is only called directly from
wsdisplaystart(). So we can be sure that the tty lock is held,
and use an inofficial entry point in ttc.c which avoids the locking.
These ate certainly more assumptions than needed by the fix
proposed in the PR, but it doesn't affect (and slow down) other
tty drivers.
2009-01-22 20:40:20 +00:00
yamt
cb1e92d5d5 malloc -> kmem_alloc 2009-01-22 14:38:34 +00:00
yamt
812bb0d164 restore the pre socket locking patch signal behaviour.
this fixes a busy-loop in nfs_connect.
2009-01-21 06:59:29 +00:00
enami
3d21969dbd Fix a bug introduced by rev. 1.311. Make the kern.vnode sysctl to expose
correct address of each vnode to userland again.
2009-01-21 00:54:05 +00:00
drochner
dc83650fb8 add __gcc__ __format__ __string__ __attributes__ to catch mistakes early 2009-01-20 20:12:41 +00:00
drochner
d767912be3 Change major()/minor() to return 32-bit types again, called
devmajor_t/devminor_t, as proposed on tech-kern.
This avoids 64-bit arithmetics and 64-bit printf formats in parts
of the kernel where it is not really useful, and helps clarity.
2009-01-20 18:20:47 +00:00
yamt
e80f4e9ccb fix inverted POLL_ directions. 2009-01-20 14:51:43 +00:00
yamt
62bd2e85ef pipeselwakeup: now POLL_HUP != POLL_ERR. remove unnecessary #if. 2009-01-20 14:50:22 +00:00
rmind
909e7f4259 - Make thread-affinity and processor-set interfaces mutually exlusive.
- pset_assign: when CPU is assigned, migrate out all LWPs from it.
2009-01-20 01:57:35 +00:00
njoly
97781244ee Clear error value on exit for IOC_CPU_OGETSTATE ioctl command. 2009-01-19 23:04:26 +00:00
christos
143e6033a9 Provide compatibility for pre-christos-time_t sysv sysctls. 2009-01-19 19:39:41 +00:00
christos
d610baec20 provide compat_50 2009-01-19 17:39:02 +00:00
yamt
3e196b68ff malloc -> kmem_alloc 2009-01-19 14:54:28 +00:00
christos
14ba6c67a5 Provide compatibility to the old timeval SCM_TIMESTAMP messages. 2009-01-19 02:27:57 +00:00
rmind
d1efa8f729 - Avoid calling sched_catchlwp() if CPUs have different processor-sets.
- sched_takecpu: check for psid earlier (be more strict).

PR/40419.
2009-01-18 05:07:51 +00:00
cegger
cc23319cdd whitespace nit 2009-01-17 09:00:24 +00:00
yamt
cea19a4d14 malloc -> kmem_alloc. 2009-01-17 07:02:35 +00:00
yamt
ae07703384 cache_prune: use (a - b > 0) rather than (a > b) to compare ticks. 2009-01-16 06:59:21 +00:00
yamt
3e54d28391 use TAILQ_FOREACH where appropriate, rather than rolling their own. 2009-01-16 01:48:09 +00:00
yamt
46b53b5f94 replace clearly broken bufq_priocscan_cancel with
something which might work.  (hi reinoud)
2009-01-16 01:44:27 +00:00
yamt
b9b9c67db2 bufq_cancel: KNF. 2009-01-15 16:11:19 +00:00
christos
dfcfa95743 check for error in the COMPAT_50 case. 2009-01-15 15:29:10 +00:00
christos
a46d2217e9 reverse the polarity of the use of the error variable. Using a different
variable would be cleaner but it would require more ifdefs.
2009-01-15 15:25:37 +00:00
christos
6e8bc6579f correct previous, fix reversed test, remove memset. 2009-01-14 23:28:23 +00:00
cegger
16f884ca6d make this compile: fix gcc warning about uninitialized use of tv.sec and tv.usec. 2009-01-14 20:33:19 +00:00
pooka
32713ca49c Generate local prototypes in rump_syscalls.c and disallow using
the rump_syscalls.h interface from inside the rump kernel.
2009-01-14 19:40:30 +00:00
christos
6d87d90fe9 version get/set send/recv timeout setsockopt. 2009-01-14 18:09:00 +00:00
pooka
09ba2d6689 Regen to prove I didn't screw up the conversion: purely RCSID changes. 2009-01-13 22:33:11 +00:00
pooka
a9a2ce837b Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat).  Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
2009-01-13 22:27:43 +00:00
pooka
71ef2103a7 Print delimiters around expected string in parse error message. 2009-01-13 16:29:19 +00:00
pooka
b2acbf4328 fix error message: expecting (, not ) 2009-01-13 16:25:43 +00:00