Alan Cox [Thu, 22 Jul 2004 23:04:41 +0000 (23:04 +0000)]
MFi386 revision 1.421
- Use kmem_alloc_nofault() rather than kmem_alloc_pageable() in
pmap_mapdev(). See revision 1.140 of kern/sys_pipe.c for a detailed
rationale.
Warner Losh [Thu, 22 Jul 2004 22:53:38 +0000 (22:53 +0000)]
MFp4:
Improve child_detached a little and make it conform better to
style(9). Also, improve comment about what we'll be doing in the
future about driver_added. Soon it will be possible to kldload usb
drivers and have them attach w/o a need to disconnect/reconnect them.
Warner Losh [Thu, 22 Jul 2004 22:29:45 +0000 (22:29 +0000)]
Remove ahb, aha, ie, le and wl devices. They are all ISA/EISA only.
I went ahead and left in the ISA cards that also have pccard
attachments. There's no way that these devices could attach.
Robert Watson [Thu, 22 Jul 2004 20:40:23 +0000 (20:40 +0000)]
Push Giant acquisition down into fo_stat() from most callers. Acquire
Giant conditional on debug.mpsafenet in the socket soo_stat() routine,
unconditionally in vn_statfile() for VFS, and otherwise don't acquire
Giant. Accept an unlocked read in kqueue_stat(), and cryptof_stat() is
a no-op. Don't acquire Giant in fstat() system call.
Note: in fdescfs, fo_stat() is called while holding Giant due to the VFS
stack sitting on top, and therefore there will still be Giant recursion
in this case.
Warner Losh [Thu, 22 Jul 2004 20:19:57 +0000 (20:19 +0000)]
Add IDs from TI's web site. Reports from the field and inspection of
the data sheets leads me to believe these will just work. Those parts
with the various media readers on them may not have the required
FreeBSD drivers that will attach to the subdevices that will be seen
on some of these parts.
Warner Losh [Thu, 22 Jul 2004 20:02:16 +0000 (20:02 +0000)]
More TI device IDs.
These are from the datasheets downloaded from TI's web site.
They describe the PCI[67]x[12]1 and PCI[67]x20 parts, with and without
the smartcard enabled.
Alan Cox [Thu, 22 Jul 2004 19:44:49 +0000 (19:44 +0000)]
- Change uma_zone_set_obj() to call kmem_alloc_nofault() instead of
kmem_alloc_pageable(). The difference between these is that an errant
memory access to the zone will be detected sooner with
kmem_alloc_nofault().
The following changes serve to eliminate the following lock-order
reversal reported by witness:
There is no potential deadlock in this case. However, witness is unable
to recognize this because vm objects used by UMA have the same type as
ordinary vm objects. To remedy this, we make the following changes:
- Add a mutex type argument to VM_OBJECT_LOCK_INIT().
- Use the mutex type argument to assign distinct types to special
vm objects such as the kernel object, kmem object, and UMA objects.
- Define a static swap zone object for use by UMA. (Only static
objects are assigned a special mutex type.)
Robert Watson [Thu, 22 Jul 2004 18:35:43 +0000 (18:35 +0000)]
Push acquisition of Giant from fdrop_closed() into fo_close() so that
individual file object implementations can optionally acquire Giant if
they require it:
Giant is still acquired in close() even when closing MPSAFE objects
due to kqueue requiring Giant in the calling closef() code.
Microbenchmarks indicate that this removal of Giant cuts 3%-3% off
of pipe create/destroy pairs from user space with SMP compiled into
the kernel.
The cryptodev and opencrypto code appears MPSAFE, but I'm unable to
test it extensively and so have left Giant over fo_close(). It can
probably be removed given some testing and review.
Robert Watson [Thu, 22 Jul 2004 17:05:04 +0000 (17:05 +0000)]
suser() accepts a thread argument; as suser() dereferences td_ucred, a
thread-local pointer, in practice that thread needs to be curthread. If
we're running with INVARIANTS, generate a warning if not. If we have
KDB compiled in, generate a stack trace. This doesn't fire at all in my
local test environment, but could be irritating if it fires frequently
for someone, so there will be motivation to fix things quickly when it
does.
Robert Watson [Thu, 22 Jul 2004 17:03:14 +0000 (17:03 +0000)]
In devfs_allocv(), rather than assigning 'td = curthread', assert that
the caller passes in a td that is curthread, and consistently pass 'td'
into vget(). Remove some bogus logic that passed in td or curthread
conditional on td being non-NULL, which seems redundant in the face of
the earlier assignment of td to curthread if td is NULL.
In devfs_symlink(), cache the passed thread in 'td' so we don't have
to keep retrieving it from the 'ap' structure, and assert that td is
curthread (since we dereference it to get thread-local td_ucred). Use
'td' in preference to curthread for later lockmgr calls, since they are
equal.
Scott Long [Thu, 22 Jul 2004 14:32:48 +0000 (14:32 +0000)]
Disable the PREEMPTION-enabled code in critical_exit() that encourages
switching to a different thread. This is just a hack to try to improve
stability some more, but likely points closer to the real culprit.
Johan Karlsson [Thu, 22 Jul 2004 13:14:42 +0000 (13:14 +0000)]
display.c:
- 'savech' is only used if it is set a few lines above where
it is used, initialize it to silence warning.
- 'length' is either -1 or greater than 0, hence it is safe to cast it
to unsigned when comparing it here.
odsyntax.c:
- 'p' is assigned either (*argvp)[0] or (*argvp)[1] which both are
char *. 'num' and 'end' are assigned values based on 'p'.
Hence use char * instead of unsigned char * for these variables.
'&end' as the second argument to strtoll does not need to be casted
to char** any more.
This solves a
'dereferencing type-punned pointer will break strict-aliasing rules'
warning when compiling with -O2.
parse.c:
- 'prec' is only used when sokay == USEPREC and sokay = USEPREC
when 'prec' is assigned. Hence 'prec' is not used uninitialized,
initialize it to silence warning.
- The code involving 'nextpr' is hard to follow, but I belive
'nextpr' will not be used unless it is initialized.
Anyway, IF 'nextpr' is used uninitialized it is better to
get a consistant error (seg fault, when dereferencing a NULL pointer)
than potentially accessing some random memory.
The above changes makes hexdump WARNS=6 clean even when compiled with
-O2. Hence bump WARNS to keep it clean.
Fix handling of comments on .elif lines. The patch given in a followup
to the PR failed, because the line skipping function is actually called
from two places in the code to do quite different things (this should
be two functions probably): in a false .if to skip to the next line
beginning with a dot and to collect .for loops. In the seconds case we
should not skip comments, because they are actually harder to handle than
we need for the .if case and should defer this to the main code.
Tim J. Robbins [Thu, 22 Jul 2004 09:20:51 +0000 (09:20 +0000)]
Add a macro, __pure, which expands to __attribute__((__pure__)) on gcc
versions that support it (>=2.96). This is similar to but not the same
as the __pure macro that was removed in rev. 1.21.
Instead of doing everything in identify, do a proper probe/attach. Also,
don't add another device if identify is called twice. Minor reworking by
myself.
Peter Grehan [Thu, 22 Jul 2004 01:28:51 +0000 (01:28 +0000)]
Update the callframe structure to leave space for the frame pointer
and saved link register as per the ABI call sequence. Update code
that uses this (fork_trampoline etc) to use the correct genassym'd
offsets.
This fixes the 'invalid LR' message when backtracing kernel
threads in DDB.
Brian Feldman [Wed, 21 Jul 2004 23:56:09 +0000 (23:56 +0000)]
Fix a race in vm_page_sleep_if_busy(). Due to vm_object locking
being incomplete, it currently has to know how to drop and pick back
up the vm_object's mutex if it has to sleep and drop the page queue
mutex. The problem with this is that if the page is busy, while we
are sleeping, the page can be freed and object disappear. When trying
to lock m->object, we'd get a stale or NULL pointer and crash.
The object is now cached, but this makes the assumption that
the object is referenced in some manner and will not itself
disappear while it is unlocked. Since this only happens if
the object is locked, I had to remove an assumption earlier in
contigmalloc() that reversed the order of locking the object and
doing vm_page_sleep_if_busy(), not the normal order.
Back out just a portion of Alfred's last commit. Remove the MBUF_CHECK
(WITNESS) for code paths that always call uma_zalloc_arg() shortly
after where the check was, because uma_zalloc_arg() already does
a similar check.
Andre Oppermann [Wed, 21 Jul 2004 19:55:14 +0000 (19:55 +0000)]
Extend versrcreach by checking against the rt_flags for RTF_REJECT and
RTF_BLACKHOLE as well.
To quote the submitter:
The uRPF loose-check implementation by the industry vendors, at least on Cisco
and possibly Juniper, will fail the check if the route of the source address
is pointed to Null0 (on Juniper, discard or reject route). What this means is,
even if uRPF Loose-check finds the route, if the route is pointed to blackhole,
uRPF loose-check must fail. This allows people to utilize uRPF loose-check mode
as a pseudo-packet-firewall without using any manual filtering configuration --
one can simply inject a IGP or BGP prefix with next-hop set to a static route
that directs to null/discard facility. This results in uRPF Loose-check failing
on all packets with source addresses that are within the range of the nullroute.
Warner Losh [Wed, 21 Jul 2004 17:38:04 +0000 (17:38 +0000)]
Add support for ignoring locking failures. This is only enabled when
you've specified a directory. It is intended to be used in building
custom releases over NFS where locking may be unreliable at best and
there is no contention that the locking is designed to arbitrate.
Other uses of this flag are discouraged. Document same in usage and
man page (including the warning about unwise).
Warner Losh [Wed, 21 Jul 2004 17:02:36 +0000 (17:02 +0000)]
Two style related changes:
(1) use strlcpy instead of strncpy since the use here of the latter
was incorrect.
(2) Move 'N' case into proper sorted order (sorted the same way that
ls sorts its args).
Robert Watson [Wed, 21 Jul 2004 16:04:46 +0000 (16:04 +0000)]
Don't sync the file system on panic by default. This seems to basically
work very infrequently, and often results in a compound panic which
confuses debugging; locking/SMP have made the layering violation (and
risks) of this more obvious over time.
Allow the help file path and name to be overwritten by cc -D...
Also remove the current directory from the default help file path
and add an appropriate directory in /usr/local instead.
Peter Wemm [Wed, 21 Jul 2004 05:08:10 +0000 (05:08 +0000)]
Semi-gratuitous change. Move two refcount operations to their own lines
rather than be buried inside an if (expression). And now that the if
expression is the same in both exit paths, use the same ordering.
Unify db_stack_trace_cmd(). All it did was look up the thread given
the thread ID and call db_trace_thread().
Since arm has all the logic in db_stack_trace_cmd(), rename the
new DB_COMMAND function to db_stack_trace to avoid conflicts on
arm.
While here, have db_stack_trace parse its own arguments so that
we can use a more natural radix for IDs. If the ID is not a thread
ID, or more precisely when no thread exists with the ID, try if
there's a process with that ID and return the first thread in it.
This makes it easier to print stack traces from the ps output.
requested by: rwatson@
tested on: amd64, i386, ia64
Peter Wemm [Wed, 21 Jul 2004 00:29:21 +0000 (00:29 +0000)]
Move the initialization and teardown of pmaps to the vmspace zone's
init and fini handlers. Our vm system removes all userland mappings at
exit prior to calling pmap_release. It just so happens that we might
as well reuse the pmap for the next process since the userland slate
has already been wiped clean.
However. There is a functional benefit to this as well. For platforms
that share userland and kernel context in the same pmap, it means that
the kernel portion of a pmap remains valid after the vmspace has been
freed (process exit) and while it is in uma's cache. This is significant
for i386 SMP systems with kernel context borrowing because it avoids
a LOT of IPIs from the pmap_lazyfix() cleanup in the usual case.
Tested on: amd64, i386, sparc64, alpha
Glanced at by: alc
Robert Watson [Tue, 20 Jul 2004 20:52:30 +0000 (20:52 +0000)]
M_PREPEND() the IP header on to the front of an outgoing raw IP packet
using M_DONTWAIT rather than M_WAITOK to avoid sleeping on memory
while holding a mutex.
Remove reference to ENOTDIR in the documented errors
for statfs(2). This is false, if the pathname specified
is a regular file, then the information for the file
system that the file lives on will be returned.
Note that the mount point which is not accessible shows
up as the previous file system that was printed. The reason
for this is that df -t will call statfs(2) on the pathname
supplied by getfsstat(2).
This is done to refresh the file system statistics in the
event that a previous file system had a long delay in
providing its stats.
This change affects the df utility in the following ways:
o Teach df has to deal with statfs(2) failing. If statfs(2)
fails, fall back on the possibly stale stats provided by
the initial call to getfsstat(2).
o Print a warning that the fs stats could possibly be stale
o Modify the man page and document this new behavior
as a bug.
Slight cosmetic changes.
Also introduce a macro to be called by persistent nodes to signal their
persistence during shutdown to hide this mechanism from the node author.
Make node flags have a consistent style in naming.
Ollivier Robert [Tue, 20 Jul 2004 15:44:32 +0000 (15:44 +0000)]
Update our ntpd to the long awaited 4.2.0 version.
This bring us several things:
- updated drivers
- IPv6 support at last
- ntp-genkeys is replaced by ntp-keygen
- ntptrace is now a script (courtesy of John Hay)
- lots of renamed files from .htm to .html (while I prefer .html, I
find the change a bit gratuitous)
- still no manpages :(
Please test and report.
Commit very much helped by: GNU arch (http://gnuarch.org/)