Commit Graph

3970 Commits

Author SHA1 Message Date
hannken bc4af00256 Make it compile again for sparc64/DIAGNOSTIC.
All archs should use `cpuid_t ci_cpuid' ...
2004-08-12 12:15:21 +00:00
christos 5647899427 make the reset time a DIAGNOSTIC, and print the cpu#. 2004-08-11 16:25:51 +00:00
jdolecek 9aba366e0b Linux enforces CLONE_VM if CLONE_SIGHAND in clone(2) is specified,
follow the suit - this is intended to be Linux-compatible call
2004-08-08 11:02:10 +00:00
jdolecek 142def6b36 pass the fork flags down the emulation proc fork hook 2004-08-08 11:00:05 +00:00
christos 0b82702558 PR/26468: Andrew Brown: Setting stopfork can panic the kernel.
When stopfork is set, we need to set p_nrlwps, since we are not going to
ber running.
2004-08-07 03:35:55 +00:00
christos 251940a98f Use the P_ZOMBIE macro instead of open-coding it. No functional change. 2004-08-07 03:34:37 +00:00
enami 8d37dcb7dc The different loop variable is no longer necessary due to recent change. 2004-08-05 22:06:48 +00:00
yamt 1e4aff5d38 add missing wakeups in the cases of lock failure.
from Stephan Uphoff, FreeBSD PR/69964.

(http://www.freebsd.org/cgi/query-pr.cgi?pr=69964)
> The LK_WANT_EXCL and LK_WANT_UPGRADE bits act as mini-locks and can block
> other threads.
> Normally this is not a problem since the mini locks are upgraded to full loc
> and the release of the locks will unblock the other threads.
> However if a thread reset the bits without optaining a full lock
> other threads are not awoken.
> This can happens if obtaining the full lock fails because of a LK_SLEEPFAIL,
> or a signal (if lock priority includes PCATCH .. don't think this is used).
2004-08-04 10:37:08 +00:00
yamt 8b4f43c443 - revert a part of the previous which breaks LK_SPIN locks.
(reported by Nicolas Joly on current-users@)
- propagate the previous to spinlock_acquire_count.
2004-08-04 01:16:06 +00:00
yamt c602229c1a when acquiring an exclusive lock,
ensure that no one else have the same lock.
a patch from Stephan Uphoff, FreeBSD PR/69934.

(http://www.freebsd.org/cgi/query-pr.cgi?pr=69934)
>	Upgrading a lock does not play well together with acquiring
>	an exclusive lock and can lead to two threads being
>	granted exclusive access.
>
>	Problematic sequence:
>	Thread A acquires a previous unlocked lock in shared mode.
>	Thread B tries to acquire the same lock in exclusive mode
>	and blocks.
>	Thread A upgrades its lock - waking up thread B.
>	Thread B wakes up and also acquires the same lock as it only checks
>	if the lock is not shared or if someone wants to upgrade the lock
>	and not if someone already upgraded the lock to an exclusive lock.
2004-08-03 12:08:51 +00:00
jdolecek 41405858b3 bump the number of allowed sections to 1024; e.g. SuSE 9.1 packaged
Mozilla 1.6 has 726 sections
2004-08-01 22:16:19 +00:00
lukem 66ff0c053c Rename LIBCOMPAT* -> SYSLIBCOMPAT*, now that <bsd.own.mk> provides LIBCOMPAT.
Fixes kernel link problem noted by Sebastien Erard.
2004-07-31 00:55:51 +00:00
atatat 91e4762204 The message buffer datum instrumented by KERN_MSGBUFSIZE is actually a
long, not an int, and this causes "problems" on LP64be machines
(sparc64, etc).  Assign the value to a temporary int and instrument
that instead.  Should be fine until someone wants a message buffer
larger than two gigabytes.
2004-07-27 12:46:18 +00:00
yamt 1e19d56b66 m_pulldown: fix mbuf leaks and chain truncation
in the case that m_dup() returns a chain of mbufs.
eg. when you attempt to m_pulldown() the middle of
a large M_EXT mbuf.
2004-07-21 12:09:43 +00:00
yamt 7af0699fdd m_copyback: add an assertion to detect write attempts to a read-only mbuf. 2004-07-21 12:06:46 +00:00
he afe2341535 Cast register type via intptr_t before cast to pointer.
Fixes build problem for evbsh5.
2004-07-20 14:56:10 +00:00
chs 423159120b add support for hppa to the MI scheduler activations kernel code:
- on hppa the stack grows up, so handle that using the STACK_* macros.
2004-07-18 21:29:26 +00:00
mycroft 4605cec510 PRIBIO -> PSOCK. This emulates the pre-sys_pipe behavior, and avoids including
processes blocked on pipe I/O in the load average.
2004-07-17 20:50:08 +00:00
yamt 118553b061 sa_release: NULL out l_savp to avoid having a stale reference to per-vp data.
it matters when an application using SA does exec() an application which also
uses SA.  (firefox 0.9 seems to do this.)
2004-07-06 12:23:40 +00:00
pk a7c40722d8 Call inittodr() from main(). Let file system code set the recorded `last
update' time (if any) through the new function setrootfstime().
2004-07-05 07:28:45 +00:00
manu 26200ee754 In MacOS X.3, the kernel maps tw opages of memory in every user process.
This areas is called the comm pages. It is used to provide fast access to
several data and functions.

The comm pages are mapped starting at 0xffff800 (address chosed so that
absolute branch can be used, so it can be accessed even when dynamic linking
is not ready). NetBSD has the user stack here, so we need to provide a
Darwin-specific stack setup routine which sets the top of the stack at
0xbfff0000.

This implementation is not complete but it does enough to get MacOS X.3
starting again (static binaries run, dynamic binaries still have an issue).
in the comm pages functions, we only implement bcopy, pthread_self and
memcpy.

TODO:
- clean up the powerpc specific code from MD parts
- for now we map only one page to avoid a crash, we want two pages.
- write all the comm functions.
2004-07-03 00:14:30 +00:00
yamt fb277865d7 bump sb_timeo from short to int to allow longer timeouts.
especially when hz is high.

while i'm here, bump sb_flags to int, as suggested by
Jason Thorpe and Bill Studenmund.

ride on 2.0G.
2004-07-01 12:42:57 +00:00
yamt 0f3ce64ad4 statclock: don't assume hz==100 when determining frequency to call schedclock. 2004-07-01 12:36:57 +00:00
hannken f59f039ea5 Keep a pointer to the leaf mount. Needed for write gating where a
file system gets suspended and has layered mounts above it.

Welcome to 2.0G

Reviewed by: Bill Studenmund <wrstuden@netbsd.org>
2004-07-01 10:03:29 +00:00
fredb 430f0ecf15 Multiply before divide, correcting a mistake introduced by revision 1.7.
The loss of precision could be significant in some cases.
2004-06-27 15:21:30 +00:00
yamt ce02ffbc68 introduce a new function, cache_lookup_raw(), for filesystems which
want more flexible namecache handling.
it just looks up a dnlc entry and vget() the result vnode.
ie. no automatic entry removal, no automatic vnode locking.

discussed on tech-kern@.
2004-06-27 08:50:44 +00:00
fredb ca3c6f824f Partly back out the last, to avoid a deadlock when microtime() is called
from levels below IPL_CLOCK (pointed out by thorpej). Just take the lock
before reading the time and cycle counter.
2004-06-27 01:36:04 +00:00
chs a4bbde95f7 add a workaround for PR 25664 (failure to map sigcode for Tru64 binaries). 2004-06-27 00:55:08 +00:00
chs a77ca34b8a rearrange the handling of p_textvp so that the ref-counting is correct.
fixes PR 25663.
2004-06-27 00:41:03 +00:00
fredb f17b436426 Take the lock earlier, before reading the cycle counter, so that it
doesn't advance while we're waiting on the lock. In fact, try to take
the lock even before blocking interrupts: the lock is locking "lasttime"
against other callers of cc_microtime(), not against the clock routines,
and if we take a clock interrupt while waiting for the lock, that's one
we don't have to take after the computations, but before returning to
the caller, and that makes the data a little fresher to the caller.

Moreover, inverting the order of splXXX() and simple_lock() permits us
to unblock interrupts before doing the long division.

With this, finally, performance of "ntpd" on my MP i386 seems to be no
worse than on non-MP i386, so this may fix PR kern/24207.
2004-06-26 16:31:33 +00:00
christos 39e498b419 Explain why the comment is a lie. 2004-06-24 15:06:35 +00:00
jonathan 5249b5a2a5 Rename MBUFTRACE helper function m_claim() to m_claimm(),
for consistency with M_FREE() and m_freem().  Affected files:

sys/mbuf.h
kern/uipc_socket2.c
kern/uipc_mbuf.c
net/if_ethersubr.c
netatalk/ddp_input.c
nfs/nfs_socket.c
2004-06-24 04:15:50 +00:00
christos 7e8ca29827 Fix a panic induced by forcing ktrace to inject an emul record on
a ktraced file descriptor that has already been invalidated. Change
all ktrace functions to propagate the error from ktrwrite() and
check for it. Thanks to Pavel Cahyna for finding this and giving
a perfect bug report.

[should be pulled up for 2.0]
2004-06-23 23:05:48 +00:00
christos 0fe4a0b07a Don't check for negative offset in the memory case. 64 bit addresses can
have the high bit set, and thus be interpreted as negative offsets. This
is not a problem because uvm_io() does all the range checks.
2004-06-22 02:06:55 +00:00
hannken 7a5be5a9ff - Add flag L_COWINPROGRESS to struct lwp to avoid recursion when
doing copy-on-write.

- Change VFS_SNAPSHOT() to return the snapshot vnode locked.

- Make the IO path for copy-on-write and snapshot-read more lightweight.
  Avoids deadlocks where vn_rdwr(...READ...) has a shared lock and needs
  to copy-on-write.
  Avoids deadlocks/panics where to clean pages the copy-on-write needs
  to allocate pages for its VOP_PUTPAGES().

L_COWINPROGRESS part approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-06-20 18:55:58 +00:00
thorpej 3183ea47c2 When initializing the buffer cache memory pools where the size <= PAGE_SIZE,
also use the standard allocator on systems that use a direct-mapped memory
segment for mapping pool pages.
2004-06-20 18:29:47 +00:00
thorpej 3cd310ba0f Remove PR_IMMEDRELEASE, since setting the high water mark will achieve
the same thing.

Pointed out back in January by YAMAMOTO Takashi.
2004-06-20 18:19:27 +00:00
thorpej bbbb3183d6 Don't use PR_IMMEDRELEASE on buffer cache pools. Instead, set a high
water mark of 1, which will have the same effect.

Pointed out back in January by YAMAMOTO Takashi.
2004-06-20 18:17:09 +00:00
fredb c6f9967d69 Introduce a variable "cc" to hold the cpu counter delta, rather than
overloading "usec". The counter isn't counting micro-seconds, and using
the same variable to mean two different things is false economy: with
this change, the compiled object is 72 bytes smaller on i386, and the
code is easier to understand, to boot.
2004-06-19 20:02:38 +00:00
yamt 8a2c13021f cache_lookup: avoid to grab two vnode's v_interlock.
just hold a reference (usecount) to a vnode instead.
2004-06-19 18:49:47 +00:00
fredb e89e654031 Fix a typo in the comments. 2004-06-19 18:12:55 +00:00
yamt 79dd9743cd getcleanvnode: fix spurious ENFILE.
try vnode_hold_list if none of vnodes on vnode_free_list are re-usable.
2004-06-19 06:20:02 +00:00
christos c22e4ed8cd ptm is now mandatory, depends on pty, and can be disabled with -DNO_DEV_PTM 2004-06-18 15:02:29 +00:00
yamt b3384c452e getcleanvnode: don't try to reclaim a vnode marked as VXLOCK.
fix crashes with VOP_RECLAIM implementations which might block.
(eg. layered filesystems)
2004-06-16 12:35:51 +00:00
yamt a0d352ca6d getcleanvnode: add a comment on a VLAYER hack. 2004-06-16 12:32:51 +00:00
jonathan d907e82ddc Fix potential memory leak in sbappendaddrchain():
We do an MGETHDR)() for each mbuf "packet" of the input chain, to hold
the socket address prepended to that "packet".  If those MGETHDR()s
ever failed, we would leak all the successfully-allocated mbuf
headers.  Leak noted by Yamamoto-san (yamt@NetBSD.org); thanks for catching it!

Add socketbuf invariant-checking macros to sbappendaddrchain(), and
replace a stray bcopy() with memcpy(), also as suggested by Yamamoto-san.
2004-06-11 03:46:01 +00:00
he 32381a5299 PAGE_SIZE is apparently not a constant on the sparc port, so don't
use it in a static initializer.  Instead, initialize in signal_init().
2004-06-08 19:35:30 +00:00
lha a9970d44c9 Return directly when pty_alloc_master failes in ptmioctl,
bug-report on current users from Denis Lagno  dlagno at smtp dot ru.
Make debug message in pty_alloc_master to match the code.
2004-06-05 11:23:15 +00:00
skrll b00b102b41 Allow for struct sigacts being greater than PAGE_SIZE on sun2. sun2
-current kernels now work again.

Reviewed by Matt Thomas. Thanks.
2004-06-04 12:23:50 +00:00
nathanw 956448b619 Initialize simple_lock in struct cwd; otherwise, one gets an
uninitialized lock panic at the first use of cwdshare().
2004-06-03 20:35:30 +00:00