Yaroslav Tykhiy [Sun, 18 Jun 2006 12:27:59 +0000 (12:27 +0000)]
Add a funny sysctl: debug.kdb.trap_code .
It is similar to debug.kdb.trap, except for it tries to cause a page fault
via a call to an invalid pointer. This can highlight differences between
a fault on data access vs. a fault on code call some CPUs might have.
This appeared as a test for a work \
Sponsored by: RiNet (Cronyx Plus LLC)
Yaroslav Tykhiy [Sun, 18 Jun 2006 12:07:00 +0000 (12:07 +0000)]
The i386 "call" instruction works as follows: it pushes
the return address on the stack and only then "dereferences" %pc.
Therefore, in the case of a call to an invalid address, we arrive
to the trap handler with the invalid value in tf_eip. This used
to prevent db_backtrace() from assigning the most recent and interesting
frame on the stack to the right spot in the right function, from
which the invalid call was attempted.
Try to detect and work around that by recovering the return address
from the stack.
The work-around requires the fault address be passed to db_backtrace().
Smuggle it as tf_err.
MFC after: 1 month
Sponsored by: RiNet (Cronyx Plus LLC)
Yaroslav Tykhiy [Sun, 18 Jun 2006 11:14:40 +0000 (11:14 +0000)]
Give a major overhaul to asf(8).
The improvements are:
- can get the kld info from core files via kvm(3);
- can use kldstat(2) directly, which is a piece of cake;
- can use .symbols or whatever, which allows for use by
non-developers when reporting system crashes -- now asf(8)
can be mentioned in the handbook at last;
- speed (no more double fts(3) per loaded module);
- various bugs fixed.
At the same time, the new asf(8) should stay compatible with
the old one, bar bugs. Perhaps some defaults may be changed
later to match today's state of affairs.
Warner Losh [Sat, 17 Jun 2006 23:24:35 +0000 (23:24 +0000)]
Carefully note the RMII bit in the config register at attach time.
The boot loader is supposed to leave this bit set to the right value
for the board. If this bit was set at attach time, use it to init the
config register correctly.
Note: this means the boot loader has to properly initialize it.
Robert Watson [Sat, 17 Jun 2006 22:48:34 +0000 (22:48 +0000)]
Remove sbinsertoob(), sbinsertoob_locked(). They violate (and have
basically always violated) invariannts of soreceive(), which assume
that the first mbuf pointer in a receive socket buffer can't change
while the SB_LOCK sleepable lock is held on the socket buffer,
which is precisely what these functions do. No current protocols
invoke these functions, and removing them will help discourage them
from ever being used. I should have removed them years ago, but
lost track of it.
MFC after: 1 week
Prodded almost by accident by: peter
- Bring the hardware list up to date
- Convert to our standard SYNOPSIS layout
- Remove the kld from FILES, it's now mentioned in the SYNOPSIS
- Remove useless .Pp call at eof
Andre Oppermann [Sat, 17 Jun 2006 17:32:38 +0000 (17:32 +0000)]
Add locking to TCP syncache and drop the global tcpinfo lock as early
as possible for the syncache_add() case. The syncache timer no longer
aquires the tcpinfo lock and timeout/retransmit runs can happen in
parallel with bucket granularity.
On a P4 the additional locks cause a slight degression of 0.7% in tcp
connections per second. When IP and TCP input are deserialized and
can run in parallel this little overhead can be neglected. The syncookie
handling still leaves room for improvement and its random salts may be
moved to the syncache bucket head structures to remove the second lock
operation currently required for it. However this would be a more
involved change from the way syncookies work at the moment.
- fix compatibility with newer versions of FreeBSD
- fix all warnings during compilation
- fix obvious bugs
- add support for more cards
Now supported:
- M-Audio Delta Dio 2496
- M-Audio Audiophile 2496
- Terratec DMX 6fire
Known bugs (detected by Nokolas and Stefan):
- $ kldunload snd_ak452x.ko
Warning: memory type ak452x leaked memory on destroy (1 allocations,
64 bytes leaked).
- No sound in KDE: Everything works fine at the console but when I load KDE
(3.5.3) the sound stutters and plays at less then 1/2 speed.
- 'mixer: WRITE_MIXER: Device not configured' The message repeats x
times at system startup, x = whatever hw.snd.maxautovchans is set to.
(this is because only vol, pcm and line are supported, but the driver
shows more than those mixer devices and setting those additional mixers
results in this error message)
- vchans don't work
- 24 bit playback not supported (only 16/32 bit)
- after kld(un)loading some times, the card fails to be probed until reboot
Datasheets are available from:
http://www.nbritton.org/uploads/envy24/
http://www.asahi-kasei.co.jp/akm/en/product/ak4528/ak4528_f01e.pdf
http://www.asahi-kasei.co.jp/akm/en/product/ak4528/ekd4528-01.pdf
http://www.asahi-kasei.co.jp/akm/en/product/ak4524/ak4524_f03e.pdf
http://www.asahi-kasei.co.jp/akm/en/product/ak4524/ekd4524.pdf
http://www.wolfson.co.uk/uploads/documents/en/WM8728.pdf
http://www.richtech.co.kr/down/richtek/RT9131.pdf
http://xkodi.svobodno.com/xkodi/space71.html
http://people.freebsd.org/~lofi/envy24.pdf
http://people.freebsd.org/~lofi/4524.pdf
Submitted by: Konstantin Dimitrov <kosio.dimitrov@gmail.com>
Tested by: Nikolas Britton <nikolas.britton@gmail.com>
Stefan Ehmann <shoesoft@gmx.net>
Wayne Salamon [Sat, 17 Jun 2006 13:53:04 +0000 (13:53 +0000)]
Make the size of the subject32_ex and process32_ex tokens depend on
whether we have an IPv6 address. Write the term ID as 4 or
16 bytes depending on address type. This change matches the recent
OpenBSM change, and what Solaris does.
John Baldwin [Fri, 16 Jun 2006 21:06:03 +0000 (21:06 +0000)]
Check for errors when registering and unregistering firmware modules. This
prevents the unfortunate situation whereby one might kldload a firmware
module by hand and later kldunload it while a driver still has an open
reference to it.
Never zero-out db_last_symtab. Whan backtraces are done
in parallel in several threads, one symbol lookup could
clear db_last_symtab when another one going to use it as
starting point for traversal.
Yaroslav Tykhiy [Fri, 16 Jun 2006 11:14:54 +0000 (11:14 +0000)]
Guess the number of arguments to a function somewhat better.
Now GCC likes to stick a "mov %eax, %FOO" instruction before
"addl $BAR, %esp" if the function just called returns an int,
which is a very common case in the kernel.
Axe Giant from vn_fullpath(9). The vnode -> pathname lookup should be
filesystem agnostic. We are not touching any file system specific functions
in this code path. Since we have a cache lock, there is really no need to
keep Giant around here.
This eliminates Giant acquisitions for any syscall which is auditing pathnames.
Remove COMPAT_43 from GENERIC (and other kernel configs). For amd64 there's
an explicit comment that it's needed for the linuxolator. This is not the
case anymore. For all other architectures there was only a "KEEP THIS".
I'm (and other people too) running a COMPAT_43-less kernel since it's not
necessary anymore for the linuxolator. Roman is running such a kernel for a
for longer time. No problems so far. And I doubt other (newer than ia32
or alpha) architectures really depend on it.
This may result in a small performance increase for some workloads.
If the removal of COMPAT_43 results in a not working program, please
recompile it and all dependencies and try again before reporting a
problem.
The only place where COMPAT_43 is needed (as in: does not compile without
it) is in the (outdated/not usable since too old) svr4 code.
Note: this does not remove the COMPAT_43TTY option.
Since we are doing some bpf(4) clean up, change a couple of function prototypes
to be consistent. Also, ANSI'fy function definitions. There is no functional
change here.
Gleb Smirnoff [Thu, 15 Jun 2006 14:31:49 +0000 (14:31 +0000)]
Possess some work from OpenBSD, with some local additions.
- Add more device IDs, ASIC revisions and chip IDs.
- Rewrite a bit code that picks the description for device.
- Introduce several macros to shorten quirks for bugs and
features.[*]
- Use some magic values, that OpenBSD has successfully
possessed from Linux (Broadcom supplied) driver.
- Remove disabled code that tried to access VPD.
[*] The macro that matches Jumbo capable NICs is
rewritten to preserve our current behavior. I
need clarify whether our or theirs is correct.
PR: 68351 (and may be others)
Obtained from: OpenBSD, brad@ mostly
Oleg Bulyzhin [Thu, 15 Jun 2006 09:39:22 +0000 (09:39 +0000)]
Add support of 'tablearg' feature for:
- 'tag' & 'untag' action parameters.
- 'tagged' & 'limit' rule options.
Rule examples:
pipe 1 tag tablearg ip from table(1) to any
allow ip from any to table(2) tagged tablearg
allow tcp from table(3) to any 25 setup limit src-addr tablearg
sbin/ipfw/ipfw2.c:
1) new macros
GET_UINT_ARG - support of 'tablearg' keyword, argument range checking.
PRINT_UINT_ARG - support of 'tablearg' keyword.
2) strtoport(): do not silently truncate/accept invalid port list expressions
like: '1,2-abc' or '1,2-3-4' or '1,2-3x4'. style(9) cleanup.
Implement the PS4 variable which is defined by the POSIX User Portability
Utilities option. Its value is printed at the beginning of the line if tracing
(-x) is active. PS4 defaults to the string "+ " which is compatible with the
old behaviour to always print "+ ".
We still need to expand variables in PS1, PS2 and PS4.
David Xu [Thu, 15 Jun 2006 06:37:39 +0000 (06:37 +0000)]
Add scheduler API sched_relinquish(), the API is used to implement
yield() and sched_yield() syscalls. Every scheduler has its own way
to relinquish cpu, the ULE and CORE schedulers have two internal run-
queues, a timesharing thread which calls yield() syscall should be
moved to inactive queue.
Stephan Uphoff [Thu, 15 Jun 2006 01:01:06 +0000 (01:01 +0000)]
Remove mpte optimization from pmap_enter_quick().
There is a race with the current locking scheme and removing
it should have no measurable performance impact.
This fixes page faults leading to panics in pmap_enter_quick_locked()
on amd64/i386.
Andrew Gallatin [Wed, 14 Jun 2006 19:32:00 +0000 (19:32 +0000)]
Much to my surprise, IFQ_DRV_DEQUEUE() can return a null mbuf even if
!IFQ_DRV_IS_EMPTY(). Taking this into account, I re-structured the
transmit routine so as to avoid adding another if/then in the
critical path.
Thanks to brueffer for showing my how to test with altq/pf.
Alan Cox [Wed, 14 Jun 2006 17:48:45 +0000 (17:48 +0000)]
Correct an error in the previous revision that could lead to a panic:
Found mapped cache page. Specifically, if cnt.v_free_count dips below
cnt.v_free_reserved after p_start has been set to a non-NULL value,
then vm_map_pmap_enter() would break out of the loop and incorrectly
call pmap_enter_object() for the remaining address range. To correct
this error, this revision truncates the address range so that
pmap_enter_object() will not map any cache pages.
Andrew Gallatin [Wed, 14 Jun 2006 16:23:17 +0000 (16:23 +0000)]
Update the mxge driver.
- Update the firmware to the latest released firmware
(1.4.3), which corresponds to the firmware in the
latest shipping drivers from Myricom. This firmware
fixes several bugs in the firmware's PCI-e implementation,
and it also changes the driver/firmware interface:
o TSO was added, and changed the format of the transmit
descriptors.
o The firmware no longer counts transmits descriptors,
but frames. So the driver needs to keep a count
of the number of frames sent.
o The weird interrupt strategy changed to a normal receive
return ring. This ring is much bigger, and we may be
able to support DEVICE_POLLING.
o Myricom's header files changed the name of firmware
related #define's and enums (s/_MCP_/FW_).
- Stopped spamming the console with lots of printfs unless
mxge_verbose (or bootverbose) is set.
- Made additional information available via sysctl, including
the results of a PCI-e DMA benchmark run at device reset.
- Decreased the excessively long timeouts when sending commands
from 2 seconds to 20ms.
Maxim Konovalov [Wed, 14 Jun 2006 15:09:52 +0000 (15:09 +0000)]
o Revert a previous delta as strlcpy(3) operates with NUL-terminated
strings and cp is not. Fix logic in the original code and eliminate
core dumps on lines without '\n'.
David Xu [Wed, 14 Jun 2006 03:46:03 +0000 (03:46 +0000)]
Clear ke_runq before calling maybe_preempt, this avoids a
KASSERT(ke->ke_runq == NULL) panic when the sched_add is recursively
called by maybe_preempt.
Reported by: Wojciech A. Koszek < dunstan at freebsd dot czest dot pl >
Marcel Moolenaar [Wed, 14 Jun 2006 03:01:06 +0000 (03:01 +0000)]
Unbreak 64-bit architectures. The 3rd argument to kern_kldload() is
a pointer to an integer and td->td_retval[0] is of type register_t.
On 64-bit architectures register_t is wider than an integer.
If bpf(4) has not been compiled into the kernel, initialize the bpf interface
pointer to a zeroed, statically allocated bpf_if structure. This way the
LIST_EMPTY() macro will always return true. This allows us to remove the
additional unconditional memory reference for each packet in the fast path.
John Baldwin [Tue, 13 Jun 2006 21:36:23 +0000 (21:36 +0000)]
Use kern_kldload() and kern_kldunload() to load and unload modules when
we intend for the user to be able to unload them later via kldunload(2)
instead of calling linker_load_module() and then directly adjusting the
ref count on the linker file structure. This makes the resulting
consumer code simpler and cleaner and better hides the linker internals
making it possible to sanely lock the linker.
John Baldwin [Tue, 13 Jun 2006 21:28:18 +0000 (21:28 +0000)]
- Add a kern_kldload() that is most of the previous kldload() and push
Giant down in it.
- Push Giant down in kern_kldunload() and reorganize it slightly to avoid
using gotos. Also, expose this function to the rest of the kernel.
John Baldwin [Tue, 13 Jun 2006 21:11:12 +0000 (21:11 +0000)]
- Push down Giant some in kldstat().
- Use a 'struct kld_file_stat' on the stack to read data under the lock
and then do one copyout() w/o holding the lock at the end to push the
data out to userland.
John Baldwin [Tue, 13 Jun 2006 19:45:08 +0000 (19:45 +0000)]
Handle the simple case of just dropping a reference near the start of
linker_file_unload() instead of in the middle of a bunch of code for
the case of dropping the last reference to improve readability and sanity.
While I'm here, remove pointless goto's that were just jumping to a
return statement.
Marius Strobl [Tue, 13 Jun 2006 19:18:09 +0000 (19:18 +0000)]
- Complete breaking out the definition of bus_space_{tag,handle}_t by
moving the typedef of bus_space_tag_t from sys/sparc64/include/bus.h
to sys/sparc64/include/_bus.h. This brings sparc64 in sync with the
other platforms and fixes the compilation of drivers which include
<sys/rman.h> before <machine/bus.h> after sys/sys/rman.h rev. 1.34.
- Remove the definition of bus_type_t from sys/sparc64/include/_bus.h
as it's unused since sys/sparc64/include/bus.h rev. 1.6 and
sys/sparc64/sparc64/bus_machdep.c rev. 1.3.
- Remove some pointless comments.
Update of syscall.master:
o Adding of several new dummy syscalls (268-310)
o Synchronization of amd64 syscall.master with i386 one
o Auditing added to amd64 syscall.master
o Change auditing type for lstat syscall (bugfix). [1]