dragonfly.git
17 years agoClean up more #include files. Create an internal __boolean_t so two or
Matthew Dillon [Sun, 21 May 2006 03:43:48 +0000 (03:43 +0000)]
Clean up more #include files.  Create an internal __boolean_t so two or
three sys/ header files don't have to juggle the type.  Use
_KERNEL_STRUCTURES in variuos pieces of user code that delve into kvm.

Reported-by: Rumko <rumcic@gmail.com>, walt <wa1ter@myrealbox.com>
17 years agoA little script that runs through all the header files and checks that
Matthew Dillon [Sun, 21 May 2006 00:27:59 +0000 (00:27 +0000)]
A little script that runs through all the header files and checks that
they can be singly included, or that they generate the appropriate
#error or #warning.  The following flags combinations are used:

_KERNEL kernel access
_KERNEL_STRUCTURES userland access to kernel structures
[none] userland access

17 years agoRemove the (unmaintained for 10+ years) svr4 and ibcs2 emulation code.
Matthew Dillon [Sat, 20 May 2006 18:26:36 +0000 (18:26 +0000)]
Remove the (unmaintained for 10+ years) svr4 and ibcs2 emulation code.
Poof, gone.

17 years agoRemove so_gencnt and so_gen_t. The generation counter is not used any more.
Matthew Dillon [Sat, 20 May 2006 17:41:42 +0000 (17:41 +0000)]
Remove so_gencnt and so_gen_t.  The generation counter is not used any more.

17 years agoFix a build issue with libnetgraph. net/bpf.h does not need to include
Matthew Dillon [Sat, 20 May 2006 16:48:51 +0000 (16:48 +0000)]
Fix a build issue with libnetgraph.  net/bpf.h does not need to include
sys/mbuf.h, not even for _KERNEL compiles.

Reported-by: Rumko <rumcic@gmail.com>
17 years ago- Add ral(4) for Ralink RT2500/RT2501/RT2600 chip based wireless NIC
Sepherosa Ziehau [Sat, 20 May 2006 09:13:09 +0000 (09:13 +0000)]
- Add ral(4) for Ralink RT2500/RT2501/RT2600 chip based wireless NIC
- Add ral(4) to GENERIC and LINT
- Add man page for ral(4)
Reviewed-by: swildner
Thank Damien Bergamini for his work on this driver

For RT2500:
- Fix a ieee80211_node leakage
- Due to the inter-dependency nature of DONE/(ENCRYPT|DECRYPT) intr, reap desc
  rings twice if one of them comes.  This change gives me ~17.6% TX performance
  boost on my ASUS WL-107G (WPA is used here):
  Original way of TX/RX intr processing
  ------------------------------------------------------------
  Client connecting to sephe-test, TCP port 5001
  TCP window size: 32.5 KByte (default)
  ------------------------------------------------------------
  [  3] local 192.168.2.14 port 1063 connected with 192.168.2.254 port 5001
  [  3]  0.0- 5.0 sec  10.2 MBytes  17.1 Mbits/sec
  [  3]  5.0-10.0 sec  9.95 MBytes  16.7 Mbits/sec
  [  3] 10.0-15.0 sec  9.67 MBytes  16.2 Mbits/sec
  [  3] 15.0-20.0 sec  10.1 MBytes  17.0 Mbits/sec
  [  3] 20.0-25.0 sec  10.2 MBytes  17.1 Mbits/sec
  [  3] 25.0-30.0 sec  10.0 MBytes  16.8 Mbits/sec
  [  3] 30.0-35.0 sec  9.91 MBytes  16.6 Mbits/sec
  [  3] 35.0-40.0 sec  10.3 MBytes  17.2 Mbits/sec
  [  3] 40.0-45.0 sec  9.87 MBytes  16.6 Mbits/sec
  [  3] 45.0-50.0 sec  9.94 MBytes  16.7 Mbits/sec
  [  3] 50.0-55.0 sec  10.2 MBytes  17.2 Mbits/sec
  [  3] 55.0-60.0 sec  9.73 MBytes  16.3 Mbits/sec
  [  3]  0.0-60.0 sec    120 MBytes  16.8 Mbits/sec

  Adapted way of TX/RX intr processing
  ------------------------------------------------------------
  Client connecting to sephe-test, TCP port 5001
  TCP window size: 32.5 KByte (default)
  ------------------------------------------------------------
  [  3] local 192.168.2.14 port 1062 connected with 192.168.2.254 port 5001
  [  3]  0.0- 5.0 sec  11.8 MBytes  19.8 Mbits/sec
  [  3]  5.0-10.0 sec  11.5 MBytes  19.4 Mbits/sec
  [  3] 10.0-15.0 sec  11.1 MBytes  18.7 Mbits/sec
  [  3] 15.0-20.0 sec  12.0 MBytes  20.1 Mbits/sec
  [  3] 20.0-25.0 sec  12.6 MBytes  21.2 Mbits/sec
  [  3] 25.0-30.0 sec  11.7 MBytes  19.6 Mbits/sec
  [  3] 30.0-35.0 sec  12.3 MBytes  20.7 Mbits/sec
  [  3] 35.0-40.0 sec  11.9 MBytes  19.9 Mbits/sec
  [  3] 40.0-45.0 sec  11.9 MBytes  19.9 Mbits/sec
  [  3] 45.0-50.0 sec  12.2 MBytes  20.4 Mbits/sec
  [  3] 50.0-55.0 sec  12.1 MBytes  20.2 Mbits/sec
  [  3] 55.0-60.0 sec  12.3 MBytes  20.7 Mbits/sec
  [  3]  0.0-60.0 sec    143 MBytes  20.0 Mbits/sec

Obtained-from: FreeBSD

17 years ago- Add ciphy for PHY modules produced by Cicada Semiconductor
Sepherosa Ziehau [Sat, 20 May 2006 07:15:17 +0000 (07:15 +0000)]
- Add ciphy for PHY modules produced by Cicada Semiconductor
- Add vge(4) for VIA VT612x GigE, which may have ciphy as its PHY module
- Add vge(4) into GENERIC and LINT
- Add man page for vge(4)

Thank Bill Paul for his work on this driver.
Thank Sascha Wildner for preparing the man page.

Obtained-from: FreeBSD
Tested-by: herrgard <herrgard@gmail.com>
NOTE:
Although polling(4) is claimed to be supported by this driver, but it does not
work that well with vge(4) (extremely slow, ~7000ms for ping, as reported by
herrgard).

17 years agoEmbed the netmsg in the mbuf itself rather than allocating one for
Matthew Dillon [Sat, 20 May 2006 06:32:41 +0000 (06:32 +0000)]
Embed the netmsg in the mbuf itself rather than allocating one for
each received packet.  This greatly reduces the overhead in the
network receive path (removing a malloc() and free()).

17 years agoregen
Sepherosa Ziehau [Sat, 20 May 2006 04:35:30 +0000 (04:35 +0000)]
regen

17 years agoAdd model id for Cicada Semiconductor PHY modules
Sepherosa Ziehau [Sat, 20 May 2006 04:27:16 +0000 (04:27 +0000)]
Add model id for Cicada Semiconductor PHY modules

17 years agoregen
Sepherosa Ziehau [Sat, 20 May 2006 03:28:07 +0000 (03:28 +0000)]
regen

17 years agoAdd VIA 612X GigE product id
Sepherosa Ziehau [Sat, 20 May 2006 03:24:53 +0000 (03:24 +0000)]
Add VIA 612X GigE product id

17 years agoI'm growing tired of having to add #include lines for header files that
Matthew Dillon [Sat, 20 May 2006 02:42:15 +0000 (02:42 +0000)]
I'm growing tired of having to add #include lines for header files that
the include file(s) I really want depend on.

Go through nearly all major system include files and add appropriately
#ifndef'd #include lines to include all dependant header files.  Kernel
source files now only need to #include the header files they directly
depend on.

So, for example, if I wanted to add a SYSCTL to a kernel source file,
I would only have to #include <sys/sysctl.h> to bring in the support for
it, rather then four or five header files in addition to <sys/sysctl.h>.

17 years agoRecent lwkt_token work broke UP builds. Fix the token code to operate
Matthew Dillon [Fri, 19 May 2006 18:26:29 +0000 (18:26 +0000)]
Recent lwkt_token work broke UP builds.  Fix the token code to operate
properly for both UP and SMP builds.  The SMP build uses spinlocks to
control access and also to do the preemption check.  The tokens are
explicitly obtained when a thread is switched in and released when a
thread is (non-preemptively) switched out.  Spinlocks cannot be
used for this purpose on UP because they are coded to a degenerate
case on a UP build.

On a UP build an explicit preemption check is needed, but no spinlock or
per-thread counter is required because the definition of a token is that
it is only 'held' while a thread is actually running or preempted.  So,
by definition, a token can always be obtained and held by a thread on UP
EXCEPT in the case where a preempting thread is trying to obtain a token
held by the preempted thread.

Conditionalize elements in the lwkt_token structure definition to guarentee
that SMP fields cannot be used in UP builds or vise-versa.  The lwkt_token
structure is made the same size for both builds.  Also remove some of
the degenerate spinlock functions (spin_trylock() and spin_tryunlock())
for UP builds to force a compile-time error if an attempt is made to use
them.  spin_lock*() and spin_unlock*() are retained as degenerate cases
on UP.

Reported-by: Sascha Wildner <saw@online.de>, walt <wa1ter@myrealbox.com>
17 years agoConvert most manual accesses to filedesc->fd_files[] into the appropriate
Matthew Dillon [Fri, 19 May 2006 07:33:46 +0000 (07:33 +0000)]
Convert most manual accesses to filedesc->fd_files[] into the appropriate
holdfp() call.  Fix a number of places where ops were being executed
on the file pointer without holding a private reference to it (mainly
fo_ioctl(), revoke(), and lseek()).

Create procedures in kern_descrip.c to set and clear descriptor flags
and to handle the bootstrap filedesc for proc0.  Replace manual code
elsewhere with calls to the new procedures.

Move getvnode() to kern_descrip.c.  Remove nsmb_getfp().  Use holdfp()
instead.

17 years agoConsolidate the file descriptor destruction code used when a newly created
Matthew Dillon [Fri, 19 May 2006 05:15:36 +0000 (05:15 +0000)]
Consolidate the file descriptor destruction code used when a newly created
file descriptor must be destroyed due to an error into a new procedure,
fdealloc(), rather then manually repeating it over and over again.

Move holdsock() and holdfp() into kern/kern_descrip.c.

17 years agoRemove the last vestiges of UF_MAPPED. All the removed code was already
Matthew Dillon [Thu, 18 May 2006 18:58:28 +0000 (18:58 +0000)]
Remove the last vestiges of UF_MAPPED.  All the removed code was already
commented out.

17 years agoMake spinlocks panic-friendly.
Matthew Dillon [Thu, 18 May 2006 17:53:45 +0000 (17:53 +0000)]
Make spinlocks panic-friendly.

* Add code to detect indefinite waits.  If a spinlock cannot be obtained
  after one second a warning is issued to the console.  After 10 seconds
  a DDB backtrace is output to the console.

* Count the number of contested events, short and long, via two sysctls:
  debug.spinlocks_contested1 and debug.spinlocks.contested2.

* Add a sysctl to test the indefinite wait code: sysctl debug.spin_lock_test=1.
  (only if INVARIANTS is turned on).

* If an indefinite wait occurs while the system is paniced, the spinlock
  code will hand the spinlock over to the requester after 1 second.  This
  should allow panics to proceed even if they occur at a bad point in the
  code.

* lwkt_switch normally panics if spinlocks are held by the current thread
  (and it tries to switch).  Do not panic if the system is already in a
  panic.  This should allow the system to restabilize itself due to the
  indefinite wait panic handling code, well enough to generate a dump
  or enter into DDB, anyhow.

17 years agoReplace the LWKT token code's passive management of token ownership with
Matthew Dillon [Thu, 18 May 2006 16:25:20 +0000 (16:25 +0000)]
Replace the LWKT token code's passive management of token ownership with
active management based on Jeff's spin locks (which themselves are an
adaptation of Sun spinlocks, I tihnk).

LWKT tokens still have the same behavior.  That is, even though tokens now
use a spinlock internally, they are still active only while the thread
is running (or preempted).  When a thread non-preemptively switches away
all held tokens are released as before and when a thread
switches back in all held tokens are reacquired.

Use spinlocks instead of tokens to manage access to LWKT RW lock structures.
Use spinlocks instead of tokens to manage LWKT wait lists.

Tokens are designed to fill a niche between spinlocks and lockmgr locks.
Spinlocks are only to be used for short bits of low level code.  Tokens
are designed to be used when broad serialization is desired but when the
caller may be making calls to procedures which might block.  Lockmgr locks
are designed to be used when strict serialization is desired even across
blocking conditions.

It should be noted that token overhead is only slightly greater than
core spinlock overhead.  The only real difference is due to the extra
structural management required to record the token in the thread structure
so it can be released and reacquired.  The overhead of saving and restoring
tokens in a thread switch is very rarely exercised (i.e. only when the
underlying code actually blocks while holding a token).

This patch reduces buildworld -j 8 times by about 5 seconds (1400->1395
seconds on my test box), about 0.3%, but is expected to have a more
pronounced effect as further MP work is accomplished.

17 years agoRemove old 802.11 sources code, they have been repo copied into
Sepherosa Ziehau [Thu, 18 May 2006 14:40:49 +0000 (14:40 +0000)]
Remove old 802.11 sources code, they have been repo copied into
sys/netproto/802_11/wlan/

17 years agoAdd man page for 802.11
Sepherosa Ziehau [Thu, 18 May 2006 14:34:31 +0000 (14:34 +0000)]
Add man page for 802.11

Obtained-from: FreeBSD
Reviewed-by: swildner
17 years ago- Describe new 802.11 options
Sepherosa Ziehau [Thu, 18 May 2006 14:24:34 +0000 (14:24 +0000)]
- Describe new 802.11 options
- Describe missing options for bridge(4)

Obtained-from: FreeBSD
Reviewed-by: swildner
17 years agoSync 802.11 support with FreeBSD6:
Sepherosa Ziehau [Thu, 18 May 2006 13:51:46 +0000 (13:51 +0000)]
Sync 802.11 support with FreeBSD6:
    "it includes completed 802.11g, WPA, 802.11i, 802.1x, WME/WMM, AP-side
     power-save, crypto plugin framework, authenticator plugin framework,
     and access control plugin frameowrk."

Reoriganize the layout of netproto/802_11: put generic 802.11 layer, crypto
modules, authentication module and access control module into their own
directories.  Header files are still in their original place.

Nuke all of the mutexing in generic 802.11, reorganize ieee80211_node table
scanning a little bit.

Rename FreeBSD's m_append() to ieee80211_mbuf_append(), rename FreeBSD's
m_unshare() to ieee80211_mbuf_clone() and put them into
netproto/802_11/wlan/ieee80211_dragonly.c
They are not generic enough for public using, at least for now.
Pointed-out-by: hsu
Expose ieee80211_add_{ssid, xrates, rates}() which are used by acx(4)

Keep using opencrypto's AES implmentation for 802.11 CCMP crypto module

Sync ifconfig(8)'s 802.11 support with FreeBSD6

Update acx(4) and ndis(4) for the new 802.11 support

Sync iwi(4), ipw(4), wi(4) and ray(4) with FreeBSD6

For iwi(4):
- Fix ieee80211_node leakage
- Use a bitmap instead of FreeBSD's "unit number alloctor" to allocate IBSS node

Add generic 802.11 layer and crypto modules into GENERIC and LINT,
authentication module and access module are only added to LINT

Unhook awi(4) from GENERIC and LINT temporarily, since as of this commit it
is broken :(  It will be fixed sometime later.

Thank Sam Leffler and many other people for their work on 802.11 support.

Thank Andrew Atrens and Adrian Michael Nida for submitting the patch.

Thank all the people that helped testing 802.11 patches for this commit

Based-on-Patch-Submitted-by:
  Andrew Atrens <atrens@nortelnetworks.com>
  Adrian Michael Nida <nida@musc.edu>

Tested-by:
  Thomas Schlesinger <schlesinger@netcologne.de>
  Johannes Hofmann <Johannes.Hofmann@gmx.de>
  Andrew Thompson <andrew@hijacked.us>
  Erik Wikström <erik-wikstrom@telia.com>

17 years agoFix static array overrun.
Sepherosa Ziehau [Thu, 18 May 2006 12:43:24 +0000 (12:43 +0000)]
Fix static array overrun.

Obtained-from: FreeBSD (Coverity ID: 916)

17 years agop_tracep -> p_tracenode, tracking changes made in recent commits.
Matthew Dillon [Thu, 18 May 2006 08:25:23 +0000 (08:25 +0000)]
p_tracep -> p_tracenode, tracking changes made in recent commits.

17 years agop_tracep -> p_tracenode, tracking changes made in recent commits.
Matthew Dillon [Thu, 18 May 2006 08:17:14 +0000 (08:17 +0000)]
p_tracep -> p_tracenode, tracking changes made in recent commits.

Reported-by: Rumko <rumcic@gmail.com>
17 years agoAdd another mutex tester for Jeff's spinlock code w/ the refcount
Matthew Dillon [Thu, 18 May 2006 02:22:46 +0000 (02:22 +0000)]
Add another mutex tester for Jeff's spinlock code w/ the refcount
optimization.

17 years agoOops, last commit was slightly premature. Fix a bug-a-boo and remove
Matthew Dillon [Wed, 17 May 2006 20:35:33 +0000 (20:35 +0000)]
Oops, last commit was slightly premature.  Fix a bug-a-boo and remove
debugging code.

17 years agoThe ktracing code was not properly matching up VOP_OPEN and VOP_CLOSE calls.
Matthew Dillon [Wed, 17 May 2006 20:20:55 +0000 (20:20 +0000)]
The ktracing code was not properly matching up VOP_OPEN and VOP_CLOSE calls.

Replace the p_tracep tracing vnode in struct proc with a pointer to
a ref-counted ktrace_node.  Ref the node instead of the vnode to prevent
the destruction of the vnode.

17 years agoUse localhost instead of 127.0.0.1, since IPv6 should work as well.
Joerg Sonnenberger [Wed, 17 May 2006 19:22:32 +0000 (19:22 +0000)]
Use localhost instead of 127.0.0.1, since IPv6 should work as well.

17 years agoPass the process (p) instead of the vnode (p->p_tracep) to the kernel tracing
Matthew Dillon [Wed, 17 May 2006 18:30:22 +0000 (18:30 +0000)]
Pass the process (p) instead of the vnode (p->p_tracep) to the kernel tracing
API functions.  This allows the vnode ref to be consolidated into one place.

17 years agoRemove the (unused) copy-on-write support for a vnode's VM object. This
Matthew Dillon [Wed, 17 May 2006 17:47:58 +0000 (17:47 +0000)]
Remove the (unused) copy-on-write support for a vnode's VM object.  This
support originally existed to support the badly implemented and severely
hacked ENABLE_VFS_IOOPT I/O optimization which was removed long ago.

This also removes a bunch of cross-module pollution in UFS.

17 years agoDocument MAKEOBJDIRPREFIX.
Sascha Wildner [Wed, 17 May 2006 14:41:48 +0000 (14:41 +0000)]
Document MAKEOBJDIRPREFIX.

Submitted-by: Trevor Kendall <trevorjk@gmail.com>
17 years agoPer default, restrict recursive queries to 127.0.0.1.
Sascha Wildner [Wed, 17 May 2006 14:25:47 +0000 (14:25 +0000)]
Per default, restrict recursive queries to 127.0.0.1.

Submitted-by: Gary <gary@velocity-servers.net>
OK-by: corecode, joerg
17 years agoRemove isinff and isnanf prototypes. Our isinf and isnan functions are
Sascha Wildner [Wed, 17 May 2006 14:06:37 +0000 (14:06 +0000)]
Remove isinff and isnanf prototypes. Our isinf and isnan functions are
type-variadic. Also remove the isinff(3) manpage I added yesterday
(I had just looked at the prototypes).

Pointed-out-by: joerg
17 years agoAdd isinff(3) manpage.
Sascha Wildner [Wed, 17 May 2006 01:44:24 +0000 (01:44 +0000)]
Add isinff(3) manpage.

17 years agoAttempt to interlock races between the buffer cache and VM backing store
Matthew Dillon [Tue, 16 May 2006 18:20:32 +0000 (18:20 +0000)]
Attempt to interlock races between the buffer cache and VM backing store
that might cause new buffers to be instantiated beyond the new file EOF
during a truncate operation.

Truncate the VM object size before attempting to flush the pages and buffers
in order to prevent new VM pages from being created beyond EOF during the
flush.  Add an extra pass on the buffer cache after truncation to make sure
the buffers have been cleaned out.  Generate a warning to the console if
buffers are found during the extra pass.

If an old buffer were left intact during a truncate, then a re-extension of
the file or directory could have resulted in granting access to the old
buffer which might have had an incorrect cached block number translation
(vs the new block allocated by the extension of the file or directory),
causing new data to be written to the wrong disk block and resulting in
file or directory corruption.  The regular file truncation/extension
code had other checks in it prior to this patch so if this problem could
occur at all before it would have been in the directory code.

There is a small chance that this race was related to reported
ufs: dirbad panics.  The M.O. matches but unfortunately there is still
no smoking gun.

17 years agoRemove vnode lock assertions that are no longer used. Remove the
Matthew Dillon [Tue, 16 May 2006 18:09:20 +0000 (18:09 +0000)]
Remove vnode lock assertions that are no longer used.  Remove the
IS_LOCKING_VFS() macro.  All VFS's are required to be locking VFSs now.

17 years agoEnable TCP wrappers in sshd.
Simon Schubert [Tue, 16 May 2006 16:26:08 +0000 (16:26 +0000)]
Enable TCP wrappers in sshd.

Reported-by: Yiorgos Adamopoulos <adamo@central.tee.gr>
17 years agoAdd a commant, which warns atomic_cmpset_int() is a !I386_CPU function
Sepherosa Ziehau [Tue, 16 May 2006 14:24:06 +0000 (14:24 +0000)]
Add a commant, which warns atomic_cmpset_int() is a !I386_CPU function

Suggested-by: joerg
17 years agoPut atomic_cmpset_int() into central place. This function was defined and
Sepherosa Ziehau [Tue, 16 May 2006 12:34:15 +0000 (12:34 +0000)]
Put atomic_cmpset_int() into central place.  This function was defined and
used in many places.

Reviewed-by: dillon
OK: davidxu

17 years agoRemove all traces of umapfs and associated stuff.
Sascha Wildner [Sun, 14 May 2006 18:07:29 +0000 (18:07 +0000)]
Remove all traces of umapfs and associated stuff.

Discussed-with: dillon

[forced commit to correct message]

17 years ago/tmp/umap.msg
Sascha Wildner [Sun, 14 May 2006 18:00:05 +0000 (18:00 +0000)]
/tmp/umap.msg

17 years agocbb_probe() assumes that the subclass field is unique. This patch further
Matthew Dillon [Sun, 14 May 2006 17:28:36 +0000 (17:28 +0000)]
cbb_probe() assumes that the subclass field is unique. This patch further
qualifies the check to verify that the device belongs to the bus class as
well before claiming the device.

Submitted-by: Chuck Tuffli <ctuffli@gmail.com>
17 years agoNuke duplicated header files, which restores `buildworld'
Sepherosa Ziehau [Sun, 14 May 2006 01:28:54 +0000 (01:28 +0000)]
Nuke duplicated header files, which restores `buildworld'

17 years agoRemove mount_umap.
Matthew Dillon [Sat, 13 May 2006 05:10:42 +0000 (05:10 +0000)]
Remove mount_umap.

17 years agoMost of the fields in vnodeop_desc have been unused for a while now.
Matthew Dillon [Fri, 12 May 2006 22:26:47 +0000 (22:26 +0000)]
Most of the fields in vnodeop_desc have been unused for a while now.
Remove them.

17 years agoUMAPFS has been disabled (and non-working) for a long time. Scrap it
Matthew Dillon [Fri, 12 May 2006 22:07:23 +0000 (22:07 +0000)]
UMAPFS has been disabled (and non-working) for a long time.  Scrap it
entirely.

17 years agoFix spelling and remove hard sentence break.
Sascha Wildner [Fri, 12 May 2006 14:05:39 +0000 (14:05 +0000)]
Fix spelling and remove hard sentence break.

17 years agoRemove Alpha specific header file.
Sascha Wildner [Fri, 12 May 2006 07:43:56 +0000 (07:43 +0000)]
Remove Alpha specific header file.

17 years agoMerge revisions 1.38,1.41 of eval.c from FreeBSD:
YONETANI Tomokazu [Fri, 12 May 2006 01:56:11 +0000 (01:56 +0000)]
Merge revisions 1.38,1.41 of eval.c from FreeBSD:
  PR 28852
  sh -e behaviour was incorrect when && and || statements where used in
  "if" clauses.
revision 1.41 is a fix to a bug in 1.38 that subshells could lose
a non-zero status.

dfly problem reported-by: Johannes Hofmann <Johannes.Hofmann at gmx.de>
OK'ed: dillon@, joerg@

17 years agoFix three bugs in the last commit and document special cases. Tighten
Matthew Dillon [Thu, 11 May 2006 19:50:29 +0000 (19:50 +0000)]
Fix three bugs in the last commit and document special cases.  Tighten
up the count calculation.   The code now passes the /usr/src/test/lockf
system test.

* F_UNLCK wasn't being handled properly in certain cases, resulting in a
  panic.

* The 'next' pointer was not bring properly adjusted when removing an
  element (brange) other then the current element in the scan, resulting
  in a posix lock error.

* The first and last matches were not always being properly merged with
  the created range, resulting in a positive count panic.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
17 years agoRecognize the cpu ident for additional VIA processors.
Matthew Dillon [Thu, 11 May 2006 16:44:43 +0000 (16:44 +0000)]
Recognize the cpu ident for additional VIA processors.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD

17 years ago* Remove the following obsolete options from the system:
Sascha Wildner [Thu, 11 May 2006 08:23:20 +0000 (08:23 +0000)]
* Remove the following obsolete options from the system:

  AAC_COMPAT_LINUX
  ACPI_MAX_THREADS
  AVM_A1_PCI
  CD9660_ROOT
  CPU_UPGRADE_HW_CACHE
  DEBUG_LINUX
  DEBUG_TOKENS
  DPT_ALLOW_MEMIO
  IDE_DELAY
  INVARIANT_SUPPORT
  KERNFS
  MFS_ROOT
  MFS_ROOT_SIZE
  NTIMECOUNTER
  OLTR_NO_BULLSEYE_MAC
  OLTR_NO_HAWKEYE_MAC
  OLTR_NO_TMS_MAC
  UGEN_DEBUG
  UHCI_DEBUG
  UHID_DEBUG
  UHUB_DEBUG
  UKBD_DEBUG
  ULPT_DEBUG
  UMASS_DEBUG
  UMS_DEBUG
  VM_KMEM_SIZE
  VM_KMEM_SIZE_MAX
  VM_KMEM_SIZE_SCALE

* Add numerous options to LINT

* Fix typo in options: TWA_FLASH_FIREWARE -> TWA_FLASH_FIRMWARE

* Fix typo in dgb.c: opt_depricated.h -> opt_deprecated.h

* Fix some minor manpage issues

17 years agoCorrect test for fragmented packet.
Jeffrey Hsu [Thu, 11 May 2006 00:52:03 +0000 (00:52 +0000)]
Correct test for fragmented packet.

17 years agoSync with FreeBSD.
Sascha Wildner [Wed, 10 May 2006 15:18:29 +0000 (15:18 +0000)]
Sync with FreeBSD.

17 years agoComment out references to cnw(4). It's unlikely that we'll import it.
Sascha Wildner [Tue, 9 May 2006 07:18:39 +0000 (07:18 +0000)]
Comment out references to cnw(4). It's unlikely that we'll import it.

17 years agoSplit kern/vfs_journal.c. Leave the low level journal support code in
Matthew Dillon [Mon, 8 May 2006 18:45:53 +0000 (18:45 +0000)]
Split kern/vfs_journal.c.  Leave the low level journal support code in
kern/vfs_journal.c and move all the mount-based journaling code and
journaling VNOPS to kern/vfs_jops.c.  This is in preparation for utilizing
the core journaling protocol for userland VFS support.

17 years agoRewrite the POSIX locking code. It was becomming impossible to track
Matthew Dillon [Mon, 8 May 2006 00:38:59 +0000 (00:38 +0000)]
Rewrite the POSIX locking code.  It was becomming impossible to track
down bugs in the previous version due to code complexity (in particular
a large number of undocumented short cuts and gotos), and general lack of
documentation.

The new code uses a more straightforward method for managing the lock list
and is far better documented.  Basically the conflict space is ranged,
if no conflict occurs the new lock is inserted, overlaps are clipped or
removed, and finally a quick optimization to check for and collapse
compatible adjacent locks.

17 years agoAdd a little program that allows one to test posix range locks.
Matthew Dillon [Mon, 8 May 2006 00:30:41 +0000 (00:30 +0000)]
Add a little program that allows one to test posix range locks.

17 years agoRemove the internal F_FLOCK flag. Either F_POSIX or F_FLOCK must be set,
Matthew Dillon [Sun, 7 May 2006 19:17:18 +0000 (19:17 +0000)]
Remove the internal F_FLOCK flag.  Either F_POSIX or F_FLOCK must be set,
so just use F_POSIX to indicate whether its a posix style lock or an flock
style lock.

17 years agolockmgr_kernproc() wasn't checking whether the lockholder as already
Matthew Dillon [Sun, 7 May 2006 00:51:11 +0000 (00:51 +0000)]
lockmgr_kernproc() wasn't checking whether the lockholder as already
LK_KERNTHREAD, resulting in a panic in certain situations.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
17 years agoRecode the streamid selector. The streamid was faked before. Do it for
Matthew Dillon [Sun, 7 May 2006 00:24:58 +0000 (00:24 +0000)]
Recode the streamid selector.  The streamid was faked before.  Do it for
real now, guarenteeing that parallel transactions will have unique stream
identifiers.

In addition, while not required, streamid calculations are such that non
parallel transactions will have a tendancy to use the same id, so someone
observing the streamid's in a journaling stream can easily pick out when
parallel transactions occur.

17 years agoWe have to use pmap_extract() here. If we lose a race against page
Matthew Dillon [Sun, 7 May 2006 00:24:02 +0000 (00:24 +0000)]
We have to use pmap_extract() here.  If we lose a race against page
table cleaning pmap_kextract() could choke on a missing page directory.

17 years agoWe have to use pmap_extract() here. pmap_kextract() will choke on a missing
Matthew Dillon [Sun, 7 May 2006 00:23:08 +0000 (00:23 +0000)]
We have to use pmap_extract() here.  pmap_kextract() will choke on a missing
page directory and the user memory hasn't been touched yet.

17 years agoWe have to use pmap_extract here, pmap_kextract will choke if the page
Matthew Dillon [Sun, 7 May 2006 00:22:37 +0000 (00:22 +0000)]
We have to use pmap_extract here, pmap_kextract will choke if the page
directory is missing and the user memory has not been touched.

17 years agoFix a null pointer indirection, the VM fault rate limiting code only
Matthew Dillon [Sat, 6 May 2006 23:53:34 +0000 (23:53 +0000)]
Fix a null pointer indirection, the VM fault rate limiting code only
applies to processes.

17 years agoRemove the thread argument from all mount->vfs_* function vectors,
Matthew Dillon [Sat, 6 May 2006 18:48:53 +0000 (18:48 +0000)]
Remove the thread argument from all mount->vfs_* function vectors,
replacing it with a ucred pointer when applicable.  This cleans up a
considerable amount of VFS function code that previously delved into
the process structure to get the cred, though some code remains.

Get rid of the compatibility thread argument for hpfs and nwfs.  Our
lockmgr calls are now mostly compatible with NetBSD (which doesn't use a
thread argument either).

Get rid of some complex junk in fdesc_statfs() that nobody uses.

Remove the thread argument from dounmount() as well as various other
filesystem specific procedures (quota calls primarily) which no longer
need it due to the lockmgr, VOP, and VFS cleanups.  These cleanups also
have the effect of making the VFS code slightly less dependant on the
calling thread's context.

17 years agoFix .Os and a .Xr. Expand HISTORY a bit.
Sascha Wildner [Sat, 6 May 2006 17:39:29 +0000 (17:39 +0000)]
Fix .Os and a .Xr. Expand HISTORY a bit.

17 years agoRemove the thread argument from ext2_quotaoff(), ext2_flushfiles(),
Matthew Dillon [Sat, 6 May 2006 16:33:26 +0000 (16:33 +0000)]
Remove the thread argument from ext2_quotaoff(), ext2_flushfiles(),
ext2_mountfs(), and ext2_reload().

17 years agoRemove the thread argument from ffs_flushfiles(), ffs_mountfs(),
Matthew Dillon [Sat, 6 May 2006 16:20:19 +0000 (16:20 +0000)]
Remove the thread argument from ffs_flushfiles(), ffs_mountfs(),
softdep_flushfiles(), ffs_reload(), ufs_quotaon(), and ufs_quotaoff().

17 years agoRemove the thread_t argument from nfs_rslock() and nfs_rsunlock().
Matthew Dillon [Sat, 6 May 2006 16:01:21 +0000 (16:01 +0000)]
Remove the thread_t argument from nfs_rslock() and nfs_rsunlock().

17 years agoThe fdrop() procedure no longer needs a thread argument, remove it.
Matthew Dillon [Sat, 6 May 2006 06:38:39 +0000 (06:38 +0000)]
The fdrop() procedure no longer needs a thread argument, remove it.

17 years agoAdd some ifioctl() td -> ucred changes that were missed.
Matthew Dillon [Sat, 6 May 2006 03:16:44 +0000 (03:16 +0000)]
Add some ifioctl() td -> ucred changes that were missed.

17 years agoThe thread/proc pointer argument in the VFS subsystem originally existed
Matthew Dillon [Sat, 6 May 2006 02:43:15 +0000 (02:43 +0000)]
The thread/proc pointer argument in the VFS subsystem originally existed
for...  well, I'm not sure *WHY* it originally existed when most of the
time the pointer couldn't be anything other then curthread or curproc or
the code wouldn't work.  This is particularly true of lockmgr locks.

Remove the pointer argument from all VOP_*() functions, all fileops functions,
and most ioctl functions.

17 years agoRemove the thread_t argument from vfs_busy() and vfs_unbusy(). Passing a
Matthew Dillon [Fri, 5 May 2006 21:27:58 +0000 (21:27 +0000)]
Remove the thread_t argument from vfs_busy() and vfs_unbusy().  Passing a
thread_t to these functions has always been questionable at best.

17 years agoSimplify vn_lock(), VOP_LOCK(), and VOP_UNLOCK() by removing the thread_t
Matthew Dillon [Fri, 5 May 2006 21:15:11 +0000 (21:15 +0000)]
Simplify vn_lock(), VOP_LOCK(), and VOP_UNLOCK() by removing the thread_t
argument.  These calls now always use the current thread as the lockholder.
Passing a thread_t to these functions has always been questionable at best.

17 years agoRemove the thread pointer argument to lockmgr(). All lockmgr() ops use the
Matthew Dillon [Fri, 5 May 2006 20:15:02 +0000 (20:15 +0000)]
Remove the thread pointer argument to lockmgr().  All lockmgr() ops use the
current thread.

Move the lockmgr code in BUF_KERNPROC to lockmgr_kernproc().  This code
allows the lock owner to be set to a special value so any thread can unlock
the lock and is required for B_ASYNC I/O so biodone() can release the lock.

17 years agoRemove VOP_BWRITE(). This function provided a way for a VFS to override
Matthew Dillon [Fri, 5 May 2006 16:35:11 +0000 (16:35 +0000)]
Remove VOP_BWRITE().  This function provided a way for a VFS to override
the bwrite() function and was used *only* by NFS in order to allow NFS to
handle the B_NEEDCOMMIT flag as part of NFSv3's 2-phase commit operation.
However, over time, the handling of this flag was moved to the strategy code.
Additionally, the kernel now fully supports the redirtying of buffers
during an I/O (which both softupdates and NFS need to be able to do).

The override is no longer needed.  All former calls to VOP_BWRITE() now
simply call bwrite().

17 years agoCleanup procedure prototypes, get rid of extra spaces in pointer decls.
Matthew Dillon [Fri, 5 May 2006 16:15:56 +0000 (16:15 +0000)]
Cleanup procedure prototypes, get rid of extra spaces in pointer decls.

17 years agocorrect "polling" support
Sepherosa Ziehau [Fri, 5 May 2006 14:53:41 +0000 (14:53 +0000)]
correct "polling" support

17 years agoRemove unused label.
Sascha Wildner [Fri, 5 May 2006 09:28:05 +0000 (09:28 +0000)]
Remove unused label.

17 years agoBlock devices generally truncate the size of I/O requests which go past EOF.
Matthew Dillon [Thu, 4 May 2006 18:32:23 +0000 (18:32 +0000)]
Block devices generally truncate the size of I/O requests which go past EOF.
This is exactly what we want when manually reading or writing a block device
such as /dev/ad0s1a, but is not desired when a VFS issues I/O ops on
filesystem buffers.  In such cases, any EOF condition must be considered an
error.

Implement a new filesystem buffer flag B_BNOCLIP, which getblk() and friends
automatically set.  If set, block devices are guarenteed to return an error
if the I/O request is at EOF or would otherwise have to be clipped to EOF.
Block devices further guarentee that b_bcount will not be modified when this
flag is set.

Adjust all block device EOF checks to use the new flag, and clean up the code
while I'm there.  Also, set b_resid in a couple of degenerate cases where
it was not being set.

17 years agoDon't forget to replicate b_cmd, which has been split off of b_flags.
YONETANI Tomokazu [Thu, 4 May 2006 08:00:59 +0000 (08:00 +0000)]
Don't forget to replicate b_cmd, which has been split off of b_flags.

17 years ago- Clarify the definitions of b_bufsize, b_bcount, and b_resid.
Matthew Dillon [Wed, 3 May 2006 20:44:49 +0000 (20:44 +0000)]
- Clarify the definitions of b_bufsize, b_bcount, and b_resid.
- Remove unnecessary assignments based on the clarified fields.
- Add additional checks for premature EOF.

b_bufsize is only used by buffer management entities such as getblk() and
other vnode-backed buffer handling procedures.  b_bufsize is not required
for calls to vn_strategy() or dev_dstrategy().  A number of other subsystems
use it to track the original request size.

b_bcount is the I/O request size, but b_bcount() is allowed to be truncated
by the device chain if the request encompasses EOF (such as on a raw disk
device).  A caller which needs to record the original buffer size verses
the EOF-truncated buffer can compare b_bcount after the I/O against a
recorded copy of the original request size.  This copy can be recorded in
b_bufsize for unmanaged buffers (malloced or getpbuf()'d buffers).

b_resid is always relative to b_bcount, not b_bufsize.  A successful read
that is truncated to the device EOF will thus have a b_resid of 0 and a
truncated b_bcount.

17 years agoDocument the handling of a file holes in ufs_strategy() and clean up
Matthew Dillon [Wed, 3 May 2006 19:57:54 +0000 (19:57 +0000)]
Document the handling of a file holes in ufs_strategy() and clean up
the code flow a little.

17 years agoInvert a mistaken test. Set b_resid to 0 if B_ERROR is not set.
Matthew Dillon [Wed, 3 May 2006 16:34:16 +0000 (16:34 +0000)]
Invert a mistaken test.  Set b_resid to 0 if B_ERROR is not set.

17 years agoRemove the accounting argument from lf_create_range() and lf_destroy_range().
Matthew Dillon [Wed, 3 May 2006 15:20:43 +0000 (15:20 +0000)]
Remove the accounting argument from lf_create_range() and lf_destroy_range().
Integrate p_numposixlocks counting into lf_count_change().  Calculate the
correct delta when changing flags on existing locks.

17 years agoMinor cleanup, plus initialize a few additional fields in the proc
Matthew Dillon [Wed, 3 May 2006 15:18:38 +0000 (15:18 +0000)]
Minor cleanup, plus initialize a few additional fields in the proc
structure so we don't get bitten by them in the future.

17 years agoAdd a missing ohci_waitintr() call that allows polled operation of
Matthew Dillon [Wed, 3 May 2006 15:08:43 +0000 (15:08 +0000)]
Add a missing ohci_waitintr() call that allows polled operation of
bulk transfers to have a chance of working.  Kernel crash dumps
to umass() work with this change.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD PR:usb/93720

17 years agoFix a biodone/AR_WAIT case. b_cmd was not getting set to BUF_CMD_DONE,
Matthew Dillon [Wed, 3 May 2006 06:28:01 +0000 (06:28 +0000)]
Fix a biodone/AR_WAIT case.  b_cmd was not getting set to BUF_CMD_DONE,
causing ATA-RAID to timeout.

Reported-by: Stefan Krueger, YONETANI Tomokazu
17 years agoFix an information disclosure issue on AMD cpus. The x87 debug registers,
Matthew Dillon [Tue, 2 May 2006 22:52:24 +0000 (22:52 +0000)]
Fix an information disclosure issue on AMD cpus.  The x87 debug registers,
in particular the last instruction and last data pointers, are not restored
by fxrstor() if there was no pending exception.  Add some dummy FP
instructions (about ~7ns) to 'clean' the registers so a process has no
visibility into another process's FP state.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD
Security-Advistory: FreeBSD-SA-06:14.fpu

17 years agoFix a bug in close(). When a descriptor is closed, all process leaders
Matthew Dillon [Tue, 2 May 2006 21:30:43 +0000 (21:30 +0000)]
Fix a bug in close().  When a descriptor is closed, all process leaders
sharing that descriptor table must clear any related POSIX locks.  The
code was looping through all the leaders but passing the wrong process
pointer to VOP_ADVLOCK, resulting in an assertion panic later on in exit1().

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
17 years agoThe wrong pointer was being used to calculate the page offset, leading
Matthew Dillon [Tue, 2 May 2006 19:21:50 +0000 (19:21 +0000)]
The wrong pointer was being used to calculate the page offset, leading
to a vmapbuf() assertion.  This bug was introduced in a recent commit.

17 years ago- Add workarounds for dropped interrupts on VIA and ATI controllers.
Matthew Dillon [Tue, 2 May 2006 16:12:01 +0000 (16:12 +0000)]
- Add workarounds for dropped interrupts on VIA and ATI controllers.
- Include more vendor IDs.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD/NetBSD

17 years agoPlug memory leak in umass.
Matthew Dillon [Tue, 2 May 2006 16:08:44 +0000 (16:08 +0000)]
Plug memory leak in umass.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD/NetBSD

17 years agoSupply a stack pointer for a pure thread context so backtrace works.
Matthew Dillon [Mon, 1 May 2006 16:56:01 +0000 (16:56 +0000)]
Supply a stack pointer for a pure thread context so backtrace works.
Otherwise the 'back' command on a paniced kernel thread may get confused.

17 years ago32bit from 64bit value fixup.
Matthew Dillon [Mon, 1 May 2006 16:27:35 +0000 (16:27 +0000)]
32bit from 64bit value fixup.

fixed a bug comparing sav->key_auth and SADB_AALG_NONE. [From KAME]

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agomore strict sanity check for ESP tail. [From KAME]
Matthew Dillon [Mon, 1 May 2006 16:26:54 +0000 (16:26 +0000)]
more strict sanity check for ESP tail. [From KAME]

Fix IPv6 error statistics being recorded as IPv4.

m_cat() may free the mbuf on 2nd arg, so m_pkthdr manipulation
has to happen before the call to m_cat(). [May not apply.]

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agoFix fencepost error causing creation of 0-length mbufs when
Matthew Dillon [Mon, 1 May 2006 16:26:29 +0000 (16:26 +0000)]
Fix fencepost error causing creation of 0-length mbufs when
the boundary between header and data fell on the boundary
between two mbufs.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4