David E. O'Brien [Sun, 16 Oct 2005 08:58:27 +0000 (08:58 +0000)]
For AMD processors, nullify CPUID.HTT. FreeBSD has no need for the
information it conveys, and it is only confusing people.
This fixes incorrect output in the previous commit.
Peter Grehan [Sun, 16 Oct 2005 05:29:14 +0000 (05:29 +0000)]
The BCM5401 dspcode load on media changes also applies
to the 100/1000 BCM5400 phy. This fixes the problem with
the GEM port not syncing up on Sawtooth G4's.
Obtained from: NetBSD
Reported by: Ben Rosengart <ben + freebsd org at narcissus net>
Kris Kennaway [Fri, 14 Oct 2005 23:56:13 +0000 (23:56 +0000)]
mpsafevm has been stable and defaulted to 1 on sparc64 for over 6 months,
so we are ready for mpsafevfs=1 by default on sparc64 too. I have been
running this on all my sparc64 machines for over 6 months, and have not
encountered MD problems.
Yaroslav Tykhiy [Fri, 14 Oct 2005 23:54:20 +0000 (23:54 +0000)]
Revise the manpage to a certain extent, mostly with respect to
make's processing of top-level and included makefiles. Point
out at make.conf(5) and __MAKE_CONF when telling about sys.mk.
Yaroslav Tykhiy [Fri, 14 Oct 2005 23:30:17 +0000 (23:30 +0000)]
Let modules use the kernel's opt_*.h files if built along with
the kernel by wrapping all targets for fake opt_*.h files in
.if defined(KERNBUILDDIR). Thus, such fake files won't be
created at all if modules are built with the kernel.
Some modules undergo cleanup like removing unused or unneeded
options or .h files, without which they wouldn't build this way
or the other.
Reviewed by: ru
Tested by: no binary changes in modules built alone
Tested on: i386 sparc64 amd64
Yaroslav Tykhiy [Fri, 14 Oct 2005 23:17:45 +0000 (23:17 +0000)]
In preparation for making the modules actually use opt_*.h files
provided in the kernel build directory, fix modules that were
failing to build this way due to not quite correct kernel option
usage. In particular:
ng_mppc.c uses two complementary options, both of which are listed
in sys/conf/files. Ideally, there should be a separate option for
including ng_mppc.c in kernel build, but now only
NETGRAPH_MPPC_ENCRYPTION is usable anyway, the other one requires
proprietary files.
nwfs and smbfs were trying to ensure they were built with proper
network components, but the check was rather questionable.
Don Lewis [Fri, 14 Oct 2005 22:13:33 +0000 (22:13 +0000)]
Close a race in the ufs_lookup() code that handles the ISDOTDOT
case by saving the value of dp->i_ino before unlocking the vnode
for the current directory and passing the saved value to VFS_VGET().
Without this change, another thread can overwrite dp->i_ino after
the current directory is unlocked, causing ufs_lookup() to lock
and return the wrong vnode in place of the vnode for its parent
directory. A deadlock can occur if dp->i_ino was changed to a
subdirectory of the current directory because the root to leaf vnode
lock ordering will be violated. A vnode lock can be leaked if
dp->i_ino was changed to point to the current directory, which
causes the current vnode lock for the current directory to be
recursed, which confuses lookup() into calling vrele() when it
should be calling vput().
The probability of this bug being triggered seems to be quite low
unless the sysctl variable debug.vfscache is set to 0.
Kris Kennaway [Fri, 14 Oct 2005 20:31:12 +0000 (20:31 +0000)]
Add a default value for VM_BCACHE_SIZE_MAX of 400MB. This is copied from
amd64, and is a factor of 3 less than the value previously auto-sized on
a 12GB machine, which would cause an overflow in calculations involving the
maxbcache int, causing bufinit() to loop forever at boot.
Kris Kennaway [Fri, 14 Oct 2005 19:15:10 +0000 (19:15 +0000)]
Partially revert revision 1.66, which contained a change that did not
correspond to the commit log. It changed the maxswzone and maxbcache
parameters from int to long, without changing the extern definitions
in <sys/buf.h>.
In fact it's a good thing it did not, because other parts of the system
are not yet ready for this, and on large-memory sparc machines it causes
severe filesystem damage if you try.
The worst effect of the change was that the tunables controlling the
above variables stopped working. These were necessary to allow such
large sparc64 machines (with >12GB RAM) to boot, since sparc64 did not
set a hard-coded upper limit on these parameters and they ended
up overflowing an int, causing an infinite loop at boot in bufinit().
John Baldwin [Fri, 14 Oct 2005 18:24:58 +0000 (18:24 +0000)]
Remove the sx(4) driver at the request of the author. The author
originally wrote it for 4.x and hasn't really had the time to fully update
it to 5.x and later. Also, the author doesn't use the hardware anymore as
well. If someone does need this driver they can always resurrect it from
the Attic.
John Baldwin [Fri, 14 Oct 2005 18:07:45 +0000 (18:07 +0000)]
Change the userland atomic operations on arm to use memory operands for
the modified memory rather than using register operands that held a pointer
to the memory. The biggest effect is that we now correctly tell the
compiler that these functions change the memory that these functions
modify.
Tim Kientzle [Fri, 14 Oct 2005 16:32:50 +0000 (16:32 +0000)]
Fix installworld breakage. <sigh>
expr and printf are not available during installworld, so
use /bin/sh arithmetic expansion instead of expr and simply
give up on vanity formatting. ;-)
Scott Long [Fri, 14 Oct 2005 16:22:45 +0000 (16:22 +0000)]
Fix a regression that prevented PERC3 hardware from working. Apparently they
do not support the GETINFO immediate command, unlike just about every other
variant of the hardware. Also document some magic values and fix some minor
nearby whitespace.
David Xu [Fri, 14 Oct 2005 12:43:47 +0000 (12:43 +0000)]
1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, most
changes in MD code are trivial, before this change, trapsignal and
sendsig use discrete parameters, now they uses member fields of
ksiginfo_t structure. For sendsig, this change allows us to pass
POSIX realtime signal value to user code.
2. Remove cpu_thread_siginfo, it is no longer needed because we now always
generate ksiginfo_t data and feed it to libpthread.
3. Add p_sigqueue to proc structure to hold shared signals which were
blocked by all threads in the proc.
4. Add td_sigqueue to thread structure to hold all signals delivered to
thread.
5. i386 and amd64 now return POSIX standard si_code, other arches will
be fixed.
6. In this sigqueue implementation, pending signal set is kept as before,
an extra siginfo list holds additional siginfo_t data for signals.
kernel code uses psignal() still behavior as before, it won't be failed
even under memory pressure, only exception is when deleting a signal,
we should call sigqueue_delete to remove signal from sigqueue but
not SIGDELSET. Current there is no kernel code will deliver a signal
with additional data, so kernel should be as stable as before,
a ksiginfo can carry more information, for example, allow signal to
be delivered but throw away siginfo data if memory is not enough.
SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can
not be caught or masked.
The sigqueue() syscall allows user code to queue a signal to target
process, if resource is unavailable, EAGAIN will be returned as
specification said.
Just before thread exits, signal queue memory will be freed by
sigqueue_flush.
Current, all signals are allowed to be queued, not only realtime signals.
Earlier patch reviewed by: jhb, deischen
Tested on: i386, amd64
Fix parsing of mdmfs(8) option "-w <user>:<group>" in case <user> or
<group> is a numeric user/group ID instead of a user/group name (as
explicitly intended to be allowed by both the manual page and the
implementation).
The "mi_have_[ug]id" fields were only set in case a name lookup was
successful. Instead they also have to be set in case the string to
integer conversion was successful.
Additionally, as a result of this fix, two assertions at the end of
the function are now always true and hence can be just be removed. It
is guarrantied that both the UID and the GID are set when the function
returns regularily, else it would have been already bailed out with
usage()/exit(3) or errx(3) before.
Spotted by: Christoph Schug <chris@schug.net>
MFC after: 3 days
Gleb Smirnoff [Fri, 14 Oct 2005 11:00:15 +0000 (11:00 +0000)]
From the PR:
The receive function em_process_receive_interrupts() unlocks the
adapter while ether_input() processes the packet, and then locks
it back. In the meantime, em_init() may be called, either from
em_watchdog() from softclock interrupt or from the ifconfig(8)
program. The em_init() resets the card, in particular it sets
adapter->next_rx_desc_to_check to 0 and resets hardware RX Head
and Tail descriptor pointers. The loop in
em_process_receive_interrupts() does not expect these things to
change, and a mess may result.
This fixes long wedges of em(4) interfaces receive part under high
load and IP fastforwarding enabled.
Andrew Thompson [Fri, 14 Oct 2005 10:38:12 +0000 (10:38 +0000)]
Change most of the bridge and stp funtions to static. This has highlighted
that the following funtions are not used, wrap in '#ifdef noused' for the
moment.
Andrew Thompson [Fri, 14 Oct 2005 02:38:47 +0000 (02:38 +0000)]
Further clean up the bridge hooks in if_ethersubr.c and ng_ether.c
- move the function pointer definitions to if_bridgevar.h
- move most of the logic to the new BRIDGE_INPUT and BRIDGE_OUTPUT macros
- remove unneeded functions from if_bridgevar.h and sort a little.
Andrew Thompson [Thu, 13 Oct 2005 23:05:55 +0000 (23:05 +0000)]
From 101 ways to panic your kernel.
Use bridge_ifdetach() to notify the bridge that a member has been detached. The
bridge can then remove it from its interface list and not try to send out via a
dead pointer.
Warner Losh [Thu, 13 Oct 2005 22:12:34 +0000 (22:12 +0000)]
If we can't probe the RTL80x9 for some reason, fall back to probing it
as a Novell NE-2000. This is necessary for unpatched qemu working
correctly. qemu claims to be a RTL8029, but doesn't implement the
RTL8029 specific registers at this time. I've created patches for
that, but there's no reason we can't use qemu's emulation w/o these
patches. This should make life easier for those folks that boot
FreeBSD via qemu.
Warner Losh [Thu, 13 Oct 2005 22:06:02 +0000 (22:06 +0000)]
o Fix probing of rtl80x9 parts. We shouldn't be calling
ed_probe_generic8390 where we're calling it. It will be done as part
of ed_probe_Novel_generic after things are setup in a way that
ed_probe_generic8390 will grok.
o Fix operator precedence botch that causes a panic when setting the media
type for 10baseT connections.
o Save the type of device so that it prints with the rest of the probe.
# this should make it work with qemu again, but only if it has my patches
# to actually implement the RTL8029 specific registers.
John Baldwin [Thu, 13 Oct 2005 20:22:07 +0000 (20:22 +0000)]
Minor tweaks and fixups:
- Use device_printf() and if_printf() and remove nge_unit.
- Use callout_init_mtx() and remove nge_tick_locked() as nge_tick() is now
always called with the driver lock held.
- Use M_ZERO to contigmalloc() when allocating nge_ldata. It was possible
for the random garbage to be used in certain cases otherwise.
- Cleanup attach error handling including no longer leaking nge_ldata.
- Add locking to the ifmedia callouts.
- Lock accesses to if_hwassist and if_capenable in nge_ioctl().
Submitted by: Yuriy N. Shkandybin jura at networks dot ru (1, 3, 4)
Tested by: Yuriy N. Shkandybin jura at networks dot ru
MFC after: 3 days
John Baldwin [Thu, 13 Oct 2005 16:57:53 +0000 (16:57 +0000)]
- Clarify when the softc is allocated. It is allocated when a device is
probed and attached, not on the first call to device_get_softc().
- Add a cross reference to DEVICE_PROBE regarding the caveats of using the
softc in a driver's probe routine.
- Fix a grammar bogon.
PR: docs/87176 (1)
Submitted by: Devon H. O'Dell dodell at offmyserver dot com (1)
MFC after: 3 days
John Baldwin [Thu, 13 Oct 2005 16:01:28 +0000 (16:01 +0000)]
- When bintime was added to this manpage, standalone .Nm changed from
microtime to bintime. However, one standaline .Nm wasn't changed, and as
a result, the manpage claimed that bintime was added in both 5.0 and 3.0.
Fix by listing microtime explicitly.
- Fix a grammar bogon.
PR: docs/87147 (1)
Submitted by: Matthew Luckie (1)
MFC after: 3 days
Gleb Smirnoff [Thu, 13 Oct 2005 11:55:50 +0000 (11:55 +0000)]
- When flushing node input queue, check whether item has a callback. If
it does, then call it suppling ENOENT as error value.
- Add assert, that helped to catch the above error.
Tim Kientzle [Thu, 13 Oct 2005 05:51:38 +0000 (05:51 +0000)]
1) Use GNU libtool to build shared libraries on non-FreeBSD
systems (or on FreeBSD systems when using ports).
2) Overhaul the versioning logic. In particular,
SHLIB_MAJOR number is now computed as "major+minor",
which ensures library versions are the same for
the FreeBSD build system and the portable
libtool/autoconf/automake build system.
Andrew Thompson [Wed, 12 Oct 2005 19:52:16 +0000 (19:52 +0000)]
Change the reference counting to count the number of cloned interfaces for each
cloner. This ensures that ifc->ifc_units is not prematurely freed in
if_clone_detach() before the clones are destroyed, resulting in memory modified
after free. This could be triggered with if_vlan.
Assert that all cloners have been destroyed when freeing the memory.
Change all simple cloners to destroy their clones with ifc_simple_destroy() on
module unload so the reference count is properly updated. This also cleans up
the interface destroy routines and allows future optimisation.
Warner Losh [Wed, 12 Oct 2005 19:12:46 +0000 (19:12 +0000)]
Be pedantic here: We're converting from network byte order to host
byte order in these cases. This is a nop in terms of the generated
code, but is logically incorrect.
Doug Ambrisko [Wed, 12 Oct 2005 17:51:31 +0000 (17:51 +0000)]
Add in kqueue support to LIO event notification and fix how it handled
notifications when LIO operations completed. These were the problems
with LIO event complete notification:
- Move all LIO/AIO event notification into one general function
so we don't have bugs in different data paths. This unification
got rid of several notification bugs one of which if kqueue was
used a SIGILL could get sent to the process.
- Change the LIO event accounting to count all AIO request that
could have been split across the fast path and daemon mode.
The prior accounting only kept track of AIO op's in that
mode and not the entire list of operations. This could cause
a bogus LIO event complete notification to occur when all of
the fast path AIO op's completed and not the AIO op's that
ended up queued for the daemon.
Robert Watson [Wed, 12 Oct 2005 14:18:58 +0000 (14:18 +0000)]
When performing a VOP_LOOKUP() as part of UFS1 extended attribute
auto-start, set cnp.cn_lkflags to LK_EXCLUSIVE. This flag must now
be set so that lockmgr knows what kind of lock to acquire, and it
will panic if not specified. This resulted in a panic when using
extended attributes on UFS1 as of locking work present in the 6.x
branch.
Move execve's access time update functionality into a new
vfs_mark_atime() function, and use the new function for
performing efficient atime updates in mmap().