dragonfly.git
16 years agoMerge from vendor branch LIBARCHIVE:
Peter Avalos [Wed, 9 May 2007 19:11:49 +0000 (19:11 +0000)]
Merge from vendor branch LIBARCHIVE:
Import libarchive 2.2.1.

16 years agoImport libarchive 2.2.1.
Peter Avalos [Wed, 9 May 2007 19:11:49 +0000 (19:11 +0000)]
Import libarchive 2.2.1.

16 years agoFix a bug where multiple mounts on the same mount point cause the
Matthew Dillon [Wed, 9 May 2007 05:12:45 +0000 (05:12 +0000)]
Fix a bug where multiple mounts on the same mount point cause the
machine to lockup when the mount is access.  The wrong namecache handle
was being used to traverse "..", causing an endless loop when more then one
iteration was required to chain up the mount points.

Reported-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue583>

16 years agoSynchronize libkvm etc, with recent kernel major/minor device
Matthew Dillon [Wed, 9 May 2007 04:33:52 +0000 (04:33 +0000)]
Synchronize libkvm etc, with recent kernel major/minor device
numbering changes.

16 years agoGive the device major / minor numbers their own separate 32 bit fields
Matthew Dillon [Wed, 9 May 2007 00:53:36 +0000 (00:53 +0000)]
Give the device major / minor numbers their own separate 32 bit fields
in the kernel.  Change dev_ops to use a RB tree to index major device
numbers and remove the 256 device major number limitation.

Build a dynamic major number assignment feature into dev_ops_add() and
adjust ASR (which already had a hand-rolled one), and MFS to use the
feature.  MFS at least does not require any filesystem visibility to
access its backing device.  Major devices numbers >= 256 are used for
dynamic assignment.

Retain filesystem compatibility for device numbers that fall within the
range that can be represented in UFS or struct stat (which is a single
32 bit field supporting 8 bit major numbers and 24 bit minor numbers).

16 years agoFix some warnings and raise WARNS to 6.
Sascha Wildner [Tue, 8 May 2007 20:59:37 +0000 (20:59 +0000)]
Fix some warnings and raise WARNS to 6.

16 years agoSync zoneinfo database with tzdata2007f from elsie.
Sascha Wildner [Tue, 8 May 2007 17:47:28 +0000 (17:47 +0000)]
Sync zoneinfo database with tzdata2007f from elsie.

africa:         8.7  -> 8.8
australasia:    8.6  -> 8.7
northamerica:   8.16 -> 8.17

From Paul Eggert's comments:

Changes affecting current time stamps:

* Haiti no longer observes DST.  (Thanks to Stephen Colebourne for this.)

Changes affecting past and future time stamps:

* The Turks and Caicos switch at 02:00, not at 00:00, and have adopted
  US DST rules.  (Thanks to Chris Dunn and Brian Inglis for this.)

Changes affecting future time stamps only:

* New Zealand is extending DST, starting later this year.
  (Thanks to Colin Sharples and many others for this info.)

Changes affecting commentary only:

* The Caprivi Strip unofficially does not observe DST, but we currently
  have no further details.  (Thanks to Petronella Sibeene for this.)

16 years agoReplace NOCDEV with NULL. NOCDEV was ((void *)-1) and as inherited
Matthew Dillon [Tue, 8 May 2007 02:31:43 +0000 (02:31 +0000)]
Replace NOCDEV with NULL.  NOCDEV was ((void *)-1) and as inherited
from *BSD a long time ago due to the device pointer / device number
duality.  Now that the pointer and device number has been separated, we
can just use NULL to indicate no-pointer.

Replace si_refs with si_sysref.  Use SYSREF for ref-count cdev_t.  Enable
cdev_t reclamation on deletion.

16 years agoAdd fields to the ktrace header to allow kdump to also display the TID
Matthew Dillon [Mon, 7 May 2007 15:43:31 +0000 (15:43 +0000)]
Add fields to the ktrace header to allow kdump to also display the TID
for individual threads.  Add a new option to ktrace, -j, which forces
TID display even if kdump doesn't think the program is threaded.

Submitted-by: Joe Talbott <josepht@cstone.net>
With-additions-by: Matt Dillon
16 years agoAdd hardware crypto support for 2x61 part of ral(4). This kind of hardware
Sepherosa Ziehau [Mon, 7 May 2007 14:14:21 +0000 (14:14 +0000)]
Add hardware crypto support for 2x61 part of ral(4).  This kind of hardware
can do hardware TKIP, TKIP MIC, WEP40/104 and CCMP.

Registers and global/pairwise key table layout are obtained from Ralink RT61
linux driver.  Their driver does not use pairwise key table, but how to setup
pairwise key table and how to enable pairwise key slot are shown.  BUT That's
still NOT enough to use pairwise key --- driver has to write 1 to SEC_CSR4 to
make the wheel whirl.  It is mentioned in no place, and I had to figure it
out myself ;)

2x61 part has 64 pairwise key slots, only last 60 slots will be used currently.
It is mainly because the RX descriptor does not contain a field to indicate
in which key table the decryption key belongs.

16 years agoAdapt 802.11 generic layer to support hardware crypto other than ath(4).
Sepherosa Ziehau [Mon, 7 May 2007 14:12:16 +0000 (14:12 +0000)]
Adapt 802.11 generic layer to support hardware crypto other than ath(4).
More specificly, it is changed for Wifi chips from Ralink (2x61 is used
as an example here), which have following hardware crypto features.  These
features are different from ath(4)'s and need special cares:
1) For TX, host does not need to insert IV and Extended IV after 802.11 MAC
   header, instead, host provides them in TX descriptor.
2) For RX, IV and Extended IV will not be left in RX buffer, instead, they
   are recorded in RX descriptor.
3) For RX and TKIP is used as crypto method, if the received MPDU is the
   only fragment of an MSDU then MIC is stripped and hardware will verify
   MIC for host.

Since these kinds of hardwares need to know IV and Extended IV,
ieee80211_crypto_iv structure is added.  It can hold IV and Extended IV, and
is used to pass these two IVs to and from 802.11 generic layer.  It requires
a special layout to ease crypto modules' processing, so comment is added to
make sure the structure's layout will not be changed.

To address the problems introduced by the hardware feature 1), following
changes are made:
- Add ic_getiv() interface for all crypto modules, which is (obviously) used
  to get IV and extended IV from crypto module.  Except that it puts IVs in
  ieee80211_crypto_iv instead of TX buffer, the new interface is quite similar
  to ic_encap().  Wrap ic_getiv() interface by ieee80211_crypto_getiv().
- Split ieee80211_crypto_encap() into two functions:
  o  ieee80211_crypto_findkey().  It is used to find the crypto key for given
     MPDU and receiver.
  o  ieee80211_crypto_encap_withkey().  It does the real encryption work.
     For Ralink's Wifi chips, this function is only called when host based
     encryption is used.
  After this splition, driver will have a chance to decide whether it need to
  do host encryption, which could happen when there are not enough hardware
  pairwise keys, or offload the encryption to hardware.  ath(4) does not need
  this interception, since no matter hardware encryption is used or not, host
  always has to insert IVs, while for Ralink Wifi chips, IV insertion can be
  done only if host encryption is to be used, for hardware encryption, they
  must be set in TX descriptor.
  This splition also causes another problem:
  ieee80211_crypto_encap_withkey() requires a keyid (read: not key index) and
  it will be too bloated to add a keyid parameter for both
  ieee80211_crypto_encap_withkey() and ieee80211_crypto_findkey(), so
  o  Change ieee80211_key.wk_pad to ieee80211_key.wk_keyid, which is keyid for
     a given key, and is set in ieee80211_crypto_resetkey().  Since
     ieee80211_crypto_resetkey() will need to know internals of ieee80211com,
     put it into ieee80211_crypto.c.
  o  Add assertion in ieee80211_crypto_findkey() to make sure that the crypto
     key has correct keyid.
  o  Make ieee80211_crypto_encap() a wrapper of ieee80211_crypto_findkey() and
     ieee80211_crypto_encap_withkey().  Old symantic of this function is still
     kept.
  The crypto encapsulation for Ralink Wifi chips will look like following:
  ...
  k = ieee80211_crypto_findkey();
  if (k is hardware encryption key)
      k = ieee80211_crypto_getiv(k, iv);
  else
      k = ieee80211_crypto_encap_withkey(k);
  ...
- Add a crypto key flag, IEEE80211_KEY_NOHDR, to indicate that host does not
  need to reserve space in TX buffer if hardware encryption is used.
- Honor IEEE80211_KEY_NOHDR in ieee80211_mbuf_adjust().
- Add an extended capability flag, IEEE80211_CEXT_CRYPTO_HDR, which is set by
  driver to inform crypto module that if hardware encryption is used for a
  crypto key, the key should have IEEE80211_KEY_NOHDR turned on.

To address the problems introduced by the hardware feature 2), following
changes are made:
- Add ic_update() interface for all crypto modules, which is used to update
  crypto modules' internal state according to the IVs passed in.  Except that
  it peeks at the passed in ieee80211_crypto_iv instead of RX buffer, it acts
  similarly to ic_decap().  Wrap ic_update() interface by
  ieee80211_crypto_update().  ieee80211_crypto_update() also locates the crypto
  key for given MPDU and sender.
- Add ieee80211_input_withiv(), which accepts an ieee80211_crypto_iv 'iv'
  parameter in addition to the original ieee80211_input() parameters.  If 'iv'
  parameter is NULL, old ieee80211_input() behaviour is used, if 'iv' is not
  NULL, ieee80211_crypto_update() will be called instead of
  ieee80211_crypto_decap().  ath(4) does not require this special processing,
  since no matter hardware encryption is used or not, IVs are always in RX
  buffer, but for Wifi chips from Ralink, we will have to explicitly pass the
  recorded IVs in RX descriptor down to crypto modules.
- Change ieee80211_input() to call ieee80211_input_withiv() with NULL 'iv'.
  Old symantic of this function is still kept.

To address the problems introduced by the hardware feature 3), following
changes are made:
- Add a key flag, IEEE80211_KEY_NOMIC, to give hint to TKIP crypto module that
  hardware will strip TKIP MIC.
- Honor IEEE80211_KEY_NOMIC in tkip_demic().
- Add an extended capability flag, IEEE80211_CEXT_STRIP_MIC, which is set by
  driver to inform crypto module that if hardware TKIP MIC is used for a
  crypto key, then the key should have IEEE80211_KEY_NOMIC turned on.

16 years agoMore agressive fix for IPv6 routing header type 0 issue.
Hasso Tepper [Mon, 7 May 2007 13:00:16 +0000 (13:00 +0000)]
More agressive fix for IPv6 routing header type 0 issue.
The ip6_rthdr0() function is commented out at all and the incoming Type 0
Routing Header is now processed as an unknown Routing Header. Also drop
packets with more than 1 routing headers and increment ifs6_in_hdrerr on
ip6s_toomanyhdr.

Obtained-from: KAME

16 years agoRevert intial IPv6 routing header type 0 processing fix.
Hasso Tepper [Mon, 7 May 2007 12:40:30 +0000 (12:40 +0000)]
Revert intial IPv6 routing header type 0 processing fix.

16 years agoReturn lowest rate for a "reclaimed" node, whose TX rate control data was
Sepherosa Ziehau [Mon, 7 May 2007 10:45:42 +0000 (10:45 +0000)]
Return lowest rate for a "reclaimed" node, whose TX rate control data was
already freed.  Since this kind of node will vanish soon, there is no need
to initialize TX rate control data for it here.  Add comment about it.

This problem (null pointer dereference) pops up when hostapd(8) is used on
a Ralink 2561S based ral(4).

16 years agoChanges to consdev - low level kernel console initialization.
Matthew Dillon [Mon, 7 May 2007 05:21:42 +0000 (05:21 +0000)]
Changes to consdev - low level kernel console initialization.

The consdev API was calling make_dev() extremely early in the boot sequence,
but except for a little code in syscons didn't really need the abstraction
to operate the kernel console during boot.

Change the consdev API to no longer require the use the device abstraction
to operate.  This will allow the device ABI (cdev_t) to be converted to
use SYSREF.

16 years agoAdd new devices support for bge(4)
Sepherosa Ziehau [Mon, 7 May 2007 04:54:32 +0000 (04:54 +0000)]
Add new devices support for bge(4)
- Recognize more devices, including PCI ids, chip ids and asic ids.
- Use meaningful macros to distinguish chip family and capability, instead of
  test against chip id or asic id directly.
- Pack bool fields of bge_softc into bge_softc.bge_flags,
  o  bge_softc.bge_extram is gone, which was never adopted.
  o  Add flags for jumbo frame capability.
  o  Add flags for various chip families.
  o  Add flags for the bus types (PCI-e/PCI-X).
  o  Add flags for various PHY bugs, which will be used by brgphy.
- Fix the detection of the bus type (PCI-e/PCI-X). (*)
- Properly initialize PCI-X bge(4).
- Fix support for certain 575x/578x chips (*):
  o  Correct bge_{read,write}mem_ind() by clearing BGE_PCI_MEMWIN_BASEADDR
     before returning.
  o  Use the appropriate register writing method when reseting the chip.
  o  Program the descriptor DMA engine correctly.
  o  Disable fastboot if the chips support it.
  o  Add some 'magical' magics on chip resetting path.
Obtained-from: FreeBSD
# (*) are done in if_bge.c rev 1.159 and 1.178 by scottl@freebsd.org and
# jkim@freebsd.org, based on code provided by David Christenson from Broadcom.

Adapt brgphy to work with the changes in bge(4)
- Recognize Broadcom 5755/5787 PHY.
- Add DSP code for various PHY bug workarounds.
- Detect PHY bugs based on the flags passed by bge(4) and load corresponding
  workaround DSP code.
Obtained-from: OpenBSD

- Set PHY jumbo frame settings.
Obtained-from: FreeBSD

16 years agoDo not rely on the fact that components in module_path to have
YONETANI Tomokazu [Mon, 7 May 2007 02:11:33 +0000 (02:11 +0000)]
Do not rely on the fact that components in module_path to have
trailing slash.  The previous commit changed the default value
of kern.module_path to use boot loader variable `module_path',
whose default value doesn't have trailing slashes, so kldload
failed unless you explicitly define module_path to have
trailing slashes.

Noticed-by: Thomas Nikolajsen <thomas.nikolajsen at mail.dk>
16 years agoUpdate vnodeinfo to handle the recent vnode changes.
Matthew Dillon [Sun, 6 May 2007 20:45:01 +0000 (20:45 +0000)]
Update vnodeinfo to handle the recent vnode changes.
Update ncptrace to handle changes to mount-on mechanics that occured last year.

16 years agoUpdate for vnode changes.
Matthew Dillon [Sun, 6 May 2007 19:38:48 +0000 (19:38 +0000)]
Update for vnode changes.

16 years agoUse SYSREF to reference count struct vnode. v_usecount is now
Matthew Dillon [Sun, 6 May 2007 19:23:36 +0000 (19:23 +0000)]
Use SYSREF to reference count struct vnode.  v_usecount is now
v_sysref(.refcnt).  v_holdcnt is now v_auxrefs.  SYSREF's termination state
(using a negative reference count from -0x40000000+) now places the vnode in
a VCACHED or VFREE state and deactivates it.  The vnode is now assigned a
64 bit unique id via SYSREF.

vhold() (which manipulates v_auxrefs) no longer reactivates a vnode and
is explicitly used only to track references from auxillary structures
and references to prevent premature destruction of the vnode.  vdrop()
will now only move a vnode from VCACHED to VFREE on the 1->0 transition
of v_auxrefs if the vnode is in a termination state.

vref() will now panic if used on a vnode in a termination state.  vget()
must now be used to explicitly reactivate a vnode.  These requirements
existed before but are now explicitly asserted.

vlrureclaim() and allocvnode() should now interact a bit better.  In
particular, vlrureclaim() will do a better job of finding vnodes to flush
and transition from VCACHED to VFREE, and allocvnode() will do a better
job finding vnodes to reuse without getting blocked by a flush.

allocvnode now uses a real VX lock to sequence vnodes into VRECLAIMED.  All
vnode special state processing now uses a VX lock.

Vnodes are now able to be slowly returned to the memory pool when
kern.maxvnodes is reduced at run time.

Various initialization elements have been moved to CTOR/DTOR and are
no longer in the critical path, improving performance.  However, since
SYSREF uses atomic_cmpset_int() (aka cmpxchgl), which reduces performance
somewhat, overall performance tends to be about the same.

16 years agoUpgrade to latest version of awk. Significant changes can be found in
Peter Avalos [Sun, 6 May 2007 17:04:30 +0000 (17:04 +0000)]
Upgrade to latest version of awk.  Significant changes can be found in
src/contrib/awk20070501/FIXES.

16 years agoAdd our READMEs.
Peter Avalos [Sun, 6 May 2007 17:02:17 +0000 (17:02 +0000)]
Add our READMEs.

16 years agoMerge from vendor branch AWK:
Peter Avalos [Sun, 6 May 2007 16:59:11 +0000 (16:59 +0000)]
Merge from vendor branch AWK:
Import latest awk sources.

16 years agoImport latest awk sources.
Peter Avalos [Sun, 6 May 2007 16:59:11 +0000 (16:59 +0000)]
Import latest awk sources.

16 years agoEase maintenance when importing new versions.
Peter Avalos [Sat, 5 May 2007 21:28:19 +0000 (21:28 +0000)]
Ease maintenance when importing new versions.

16 years agoImport libarchive 2.1.10 which brings in a few minor code cleanups.
Peter Avalos [Sat, 5 May 2007 21:25:33 +0000 (21:25 +0000)]
Import libarchive 2.1.10 which brings in a few minor code cleanups.

16 years agoMerge from vendor branch LIBARCHIVE:
Peter Avalos [Sat, 5 May 2007 21:25:33 +0000 (21:25 +0000)]
Merge from vendor branch LIBARCHIVE:
Import libarchive 2.1.10 which brings in a few minor code cleanups.

16 years agoGrab version from the contributed code instead of manually updating it
Peter Avalos [Sat, 5 May 2007 21:16:57 +0000 (21:16 +0000)]
Grab version from the contributed code instead of manually updating it
every time.

16 years agoThe bus_get_resource_list DEVMETHOD is primarily used to by PCI devices
Matthew Dillon [Sat, 5 May 2007 16:52:55 +0000 (16:52 +0000)]
The bus_get_resource_list DEVMETHOD is primarily used to by PCI devices
to get a list of resources from their parent bus device.  The default
method should not just recurse up a randomly or a child might get
something really unexpected.  Instead, if the method is not supported,
NULL should be returned.

Obtained-from: FreeBSD
Suggestd-by: Martin <dragonfly@wommm.nl>
16 years ago(essential part of rev 1.54 in FreeBSD)
YONETANI Tomokazu [Sat, 5 May 2007 16:13:53 +0000 (16:13 +0000)]
(essential part of rev 1.54 in FreeBSD)
Pull out the module path from the loader.  When you boot a kernel
installed in a different place (say /test and /test/modules) using
module_path, you'd want your kern.module_path set to the same paths
or else you can end up loading out-of-sync modules.

16 years agoUpdate vnode.9, correct spelling.
Matthew Dillon [Sat, 5 May 2007 06:26:57 +0000 (06:26 +0000)]
Update vnode.9, correct spelling.

16 years agoUpdate the vget, vput, vref, vrele, vhold, and vdrop documentation
Matthew Dillon [Sat, 5 May 2007 06:09:01 +0000 (06:09 +0000)]
Update the vget, vput, vref, vrele, vhold, and vdrop documentation
to reflect reality.

16 years agoSync with NetBSD.
Peter Avalos [Sat, 5 May 2007 00:27:40 +0000 (00:27 +0000)]
Sync with NetBSD.

16 years agopci_get_resource_list() was returning an illegal pointer instead of NULL
Matthew Dillon [Fri, 4 May 2007 17:25:04 +0000 (17:25 +0000)]
pci_get_resource_list() was returning an illegal pointer instead of NULL
in cases where no resource list is present.

Reported-by: Martin <dragonfly@wommm.nl>
16 years agoFollowup commit - fix a bug in the last commit.
Matthew Dillon [Fri, 4 May 2007 17:18:55 +0000 (17:18 +0000)]
Followup commit - fix a bug in the last commit.

Submitted-by: Aggelos Economopoulos <aoiko@cc.ece.ntua.gr>
16 years agoMake libthread_xu use the new lwp_rtprio() system call, mainly taken from
Matthew Dillon [Thu, 3 May 2007 23:08:34 +0000 (23:08 +0000)]
Make libthread_xu use the new lwp_rtprio() system call, mainly taken from
FreeBSD.  Add additional code to bounds check priority values rather then
silently accepting out of bounds values.

Submitted-by: Aggelos Economopoulos <aoiko@cc.ece.ntua.gr>
Obtained-from: Portions obtained from FreeBSD

16 years agoAdd a new system call, lwp_rtprio(), and regenerate system calls.
Matthew Dillon [Thu, 3 May 2007 23:04:36 +0000 (23:04 +0000)]
Add a new system call, lwp_rtprio(), and regenerate system calls.
int lwp_rtprio (int, pid_t, lwpid_t, struct rtprio *);

This patch provides an alternative to rtprio(2) which is able to operate
on individual LWPs.

Submitted-by: Aggelos Economopoulos <aoiko@cc.ece.ntua.gr>
16 years agoRestore part of old behaviour of bge_tick() -- if link is up, then don't
Sepherosa Ziehau [Thu, 3 May 2007 14:09:22 +0000 (14:09 +0000)]
Restore part of old behaviour of bge_tick() -- if link is up, then don't
call mii_tick().  Mii_tick() will read and write various PHY registers.
For bge(4), PHY accessing registers normally involves flipping AUTOPOLL
bit of BGE_MI_MODE, which trigers interrupts about link state changing.

# This changing restores netperf UDP_RR

16 years agoregen
Sepherosa Ziehau [Thu, 3 May 2007 08:32:24 +0000 (08:32 +0000)]
regen

16 years agoPHY ids for Broadcom 5755/5787
Sepherosa Ziehau [Thu, 3 May 2007 08:31:33 +0000 (08:31 +0000)]
PHY ids for Broadcom 5755/5787

16 years agoregen
Sepherosa Ziehau [Thu, 3 May 2007 07:58:57 +0000 (07:58 +0000)]
regen

16 years agoMore Broadcom GigE PCI ids.
Sepherosa Ziehau [Thu, 3 May 2007 07:58:06 +0000 (07:58 +0000)]
More Broadcom GigE PCI ids.

16 years agoFix typo.
Jeremy C. Reed [Wed, 2 May 2007 16:37:36 +0000 (16:37 +0000)]
Fix typo.

16 years ago- Merge following link state detection fixes from FreeBSD:
Sepherosa Ziehau [Wed, 2 May 2007 14:34:10 +0000 (14:34 +0000)]
- Merge following link state detection fixes from FreeBSD:
  if_bge.c rev 1.{102, 104, 113, 120, 124} (mainly oleg@freebsd.org)
  Local modifications:
  o  Split bge_link_upd() into
     bge_bcm5700_link_upd() -- for 5700 chips, except B2
     bge_tbi_link_upd()     -- for fiber interface
     bge_copper_link_upd()  -- for the rest for the bge(4) chips
     Assign one of them to bge_softc.bge_link_upd based on chip type
     in attach routine.
  o  Add bge_softc.bge_link_chg, which is setup based on chip type in
     attach routine.  It is used to check against MAC_STS to determine
     whether link state is changed or not.
  o  We always trust that "link state changed" bit in MAC_STS is correct.
  o  Keep the PCS error checks for fiber interface during link state
     changing detection.
- After above change, bge_tick() is used to drive mii_tick(), so cleanup
  brgphy_mii_phy_auto().
- In brgphy_status(), use temporary variable to hold BRGPHY_MII_AUXSTS,
  so it is not accessed twice.
- For fiber interface, correct media status reporting if link is down.
  Obtained-from: OpenBSD (brad@openbsd.org)
- Correct chip id for 5700 B1 and 5700 B2.
- Minor style changes.

16 years agoCorrect inverse setting and clearing BBP_R3 "smart mode" bit.
Sepherosa Ziehau [Wed, 2 May 2007 11:29:27 +0000 (11:29 +0000)]
Correct inverse setting and clearing BBP_R3 "smart mode" bit.

Obtained-from: FreeBSD p4 (hselasky@freebsd.org)

16 years agoWhen thread0 is initialized it must also be LWKT scheduled or LWKT will
Matthew Dillon [Wed, 2 May 2007 05:55:35 +0000 (05:55 +0000)]
When thread0 is initialized it must also be LWKT scheduled or LWKT will
forget it exists when you switch away without sleeping.  This fixes
a lockup with early uses of DRIVERSLEEP().

Reported-by: Sascha Wildner <saw@online.de>, YONETANI Tomokazu <qhwt+dfly@les.ath.cx>
16 years agoReduce the livelock limit from 50Khz to 40Khz.
Matthew Dillon [Tue, 1 May 2007 23:53:51 +0000 (23:53 +0000)]
Reduce the livelock limit from 50Khz to 40Khz.

Change the livelock state machine to a one second test based on
gd_time_seconds instead of ticks to try to make the hysteresis
work better.

Add a debug mode so we can measure the interrupt rate while livelocked,
and automatically enable when booting -v (during the boot sequence only).

16 years agoDocument the interrupt moderation timer and the fact that even though
Matthew Dillon [Tue, 1 May 2007 23:48:03 +0000 (23:48 +0000)]
Document the interrupt moderation timer and the fact that even though
we are programming it, no interrupt moderation is actually occuring.

17 years agoata_boot_attach() is no longer used, #if 0 it out.
Matthew Dillon [Tue, 1 May 2007 17:16:23 +0000 (17:16 +0000)]
ata_boot_attach() is no longer used, #if 0 it out.

17 years agoAdd missing crit_exit();
Matthew Dillon [Tue, 1 May 2007 17:07:38 +0000 (17:07 +0000)]
Add missing crit_exit();

17 years agoMove clock registration from before SMP startup to after. APIC_IO builds
Matthew Dillon [Tue, 1 May 2007 02:29:31 +0000 (02:29 +0000)]
Move clock registration from before SMP startup to after.  APIC_IO builds
need the ioapic interrupt routing information from the mptable scan.

17 years agoImplement kern.do_async_attach. default disabled. To enable add
Matthew Dillon [Tue, 1 May 2007 00:05:18 +0000 (00:05 +0000)]
Implement kern.do_async_attach. default disabled.  To enable add
kern.do_async_attach="1" to your /boot/loader.conf.  This feature allows
conforming drivers to attach in their own thread, allowing multiple
drivers to attach in parallel.

Implement a new device state, DS_INPROGRESS.  Seems to work properly.
Implement device_set_async_attach(), which allows a device's probe
function to indicate that it is ok for its attach function to be run in
its own thread.

Split tsleep's enable out from the 'cold' variable. tsleep works earlier
then when cold is cleared.  Add a 'tsleep_now_works' variable to take
over the functionality.

Implement DRIVERSLEEP()... similar to DELAY(), this function works in
any context and will call lwkt_switch() in its spin loop.  It isn't perfect
yet.

ATA/NATA:
    * Uses the new async attach feature
    * Uses DRIVERSLEEP
    * No longer uses a configuration interrupt hook.  Interrupts are now
      available during device config.

    NOTE: atapicam does not seem to be scanning the 'bus' (from cam's point
    of view), so 'cd0' is not found until CAM scans the bus itself in the
    interrupt config hook code.

USB:
    * Uses the new async attach feature
    * Uses tsleep instead of DELAY

MISC:
    * IF_EM, IF_NFE also use the async attach feature as a test, but it
      doesn't seem to have a huge effect.

17 years agoBring kernel threads back into top.
Hasso Tepper [Mon, 30 Apr 2007 22:48:26 +0000 (22:48 +0000)]
Bring kernel threads back into top.

Reviewed-by: tgen
17 years agoMore cleanups, do not allow backspacing beyond the start of the line.
Matthew Dillon [Mon, 30 Apr 2007 20:02:45 +0000 (20:02 +0000)]
More cleanups, do not allow backspacing beyond the start of the line.

17 years agoMake the mountroot> prompt a bit more user-friendly.
Matthew Dillon [Mon, 30 Apr 2007 19:33:08 +0000 (19:33 +0000)]
Make the mountroot> prompt a bit more user-friendly.

17 years agoIt is possible for spurious interrupt(s) to be posted to an AP cpu
Matthew Dillon [Mon, 30 Apr 2007 17:41:15 +0000 (17:41 +0000)]
It is possible for spurious interrupt(s) to be posted to an AP cpu
while the cpu is being bootstrapped.  Explicitly enable interrupts
while still in a critical section near the end of ap_init to allow
the cpu to issue the interrupt vector(s), then clear the software
interrupt pending fields in the globaldata structure.

This stops the single report to the console of a spurious interrupt
occuring during AP booting.  This problem is unrelated to the multitude
of spurious interrupts that can be reported during device initialization.
Those will probably still occur.

17 years agoReorder cpu interrupt enablement, do it in the code that drops
Matthew Dillon [Mon, 30 Apr 2007 16:46:01 +0000 (16:46 +0000)]
Reorder cpu interrupt enablement, do it in the code that drops
the critical section during booting.  Add a new interrupt controller
ABI function 'cleanup' which is called after interrupts are enabled
but before the critical section is dropped.

17 years agoEST's module was being installed before the module list got initialized,
Matthew Dillon [Mon, 30 Apr 2007 16:39:20 +0000 (16:39 +0000)]
EST's module was being installed before the module list got initialized,
adjust its priority from SI_BOOT2_BIOS to SI_BOOT2_KLD.

Reported-by: Sascha Wildner <saw@online.de>
17 years ago- Don't use the status block's link state change bit to micro-optimize
Sepherosa Ziehau [Mon, 30 Apr 2007 14:05:22 +0000 (14:05 +0000)]
- Don't use the status block's link state change bit to micro-optimize
  performance, instead, read MAC_STS which always contains the correct
  value about link state changing.  Enormous amount of superflucious
  link up events, which keep coming originally when the interface is
  brought up before cable is plugged in, disappear after this change.
- Nuke the no longer needed PCI bridge cache flush.
- Minor style change.

17 years agoRevamp SYSINIT ordering. Relabel sysinit IDs (SI_* in sys/kernel.h) to
Matthew Dillon [Mon, 30 Apr 2007 07:18:57 +0000 (07:18 +0000)]
Revamp SYSINIT ordering.  Relabel sysinit IDs (SI_* in sys/kernel.h) to
make them less confusing, particularly with regard to the relative order
init routines are called in.

Reorder many sysinits.  Reorder the SMP and CLOCK code to bring all the
cpus up far earlier in the boot sequence and to make the full threading and
clocking subsystems available for device config.

17 years agoStore the frequency and cputimer used to initialize a periodic systimer.
Matthew Dillon [Mon, 30 Apr 2007 06:57:38 +0000 (06:57 +0000)]
Store the frequency and cputimer used to initialize a periodic systimer.
If the system cputimer changes, periodic systimers will be adjusted at
the next timeout.

This allows the cputimer to be changed with only minor glitches, which
in turn will allow us to initialize with the 8254 and then later change
over to the ACPI timer.

Theoretically this allows the cputimer to be changed on the fly, after
the system has booted, but the sysctl is read-only for now.

17 years ago* Use SYSREF for vmspace structures. This replaces the vmspace structure's
Matthew Dillon [Sun, 29 Apr 2007 18:25:41 +0000 (18:25 +0000)]
* Use SYSREF for vmspace structures.  This replaces the vmspace structure's
  roll-your-own refcnt implementation and replaces its zalloc backing store.
  Numerous procedures have been added to handle termination and DTOR
  operations and to properly interlock with vm_exitingcnt, all centered
  around the vmspace_sysref_class declaration.

* Replace pmap_activate() and pmap_deactivate() with add pmap_replacevm().
  This replaces numerous instances where roll-your-own deactivate/activate
  sequences were being used, creating small windows of opportunity where
  an update to the kernel pmap would not be visible to running code.

* Properly deactivate pmaps and add assertions to the fact in the teardown
  code.  Cases had to be fixed in cpu_exit_switch(), the exec code, the
  AIO code, and a few other places.

* Add pmap_puninit() which is called as part of the DTOR sequence for
  vmspaces, allowing the kmem mapping and VM object to be recovered.
  We could not do this with the previous zalloc() implementation.

* Properly initialize the per-cpu sysid allocator (globaldata->gd_sysid_alloc).

Make the following adjustments to the LWP exiting code.

* P_WEXIT interlocks the master exiting thread, eliminating races which can
  occur when it is signaling the 'other' threads.

* LWP_WEXIT interlocks individual exiting threads, eliminating races which
  can occur there and streamlining some of the tests.

* Don't bother queueing the last LWP to the reaper.  Instead, just leave it
  in the p_lwps list (but still decrement nthreads), and add code to
  kern_wait() to reap the last thread.  This improves exit/wait performance
  for unthreaded applications.

* Fix a VMSPACE teardown race in the LWP code.  It turns out that it was
  still possible for the VMSPACE for an exiting LWP to be ripped out from
  under it by the reaper (due to a conditional that was really supposed to
  be a loop), or by kern_wait() (due to not waiting for all the LWPs to
  enter an exiting state).  The fix is to have the LWPs PHOLD() the process
  and then PRELE() it when they are reaped.

This is a little mixed up because the addition of SYSREF revealed a number
of other semi-related bugs in the pmap and LWP code which also had to be
fixed.

17 years agoAlthough defined in sys/time.h we don't have CLOCK_VIRTUAL and CLOCK_PROF
Hasso Tepper [Sun, 29 Apr 2007 12:23:52 +0000 (12:23 +0000)]
Although defined in sys/time.h we don't have CLOCK_VIRTUAL and CLOCK_PROF
implemented yet. But we have CLOCK_MONOTONIC.

17 years agoRemove unneeded references to sys/syslink.h. Get syslink_desc from
Matthew Dillon [Sun, 29 Apr 2007 06:11:19 +0000 (06:11 +0000)]
Remove unneeded references to sys/syslink.h.  Get syslink_desc from
sys/syslink_rpc.h

17 years agoUse the __boolean_t defined in machine/stdint.h instead of the
Matthew Dillon [Sun, 29 Apr 2007 06:05:02 +0000 (06:05 +0000)]
Use the __boolean_t defined in machine/stdint.h instead of the
boolean_t from sys/types.h, which doesn't work from userland unless
sys/user.h is carefully positioned.

17 years agoWhen <sys/user.h> is included, it MUST be included first because it sets
Matthew Dillon [Sun, 29 Apr 2007 01:36:04 +0000 (01:36 +0000)]
When <sys/user.h> is included, it MUST be included first because it sets
a preprocessor variable that effects other header files.

17 years agoImplement SYSREF - structural reference counting, allocation, and sysid
Matthew Dillon [Sun, 29 Apr 2007 01:29:33 +0000 (01:29 +0000)]
Implement SYSREF - structural reference counting, allocation, and sysid
management subsystem.

* Structural reference count management, including creation and termination
  sequencing (e.g. where the structure might be temporarily referenced
  during termination).

* Allocation.  It uses an objcache backend for optimal allocation,
  deallocation, and memory recovery.

* Sysid assignment and red-black tree indexing.  It does this in the
  objcache CTOR and DTOR so it costs us absolutely nothing in the
  resource allocation / deallocation critical path.  sysids will be
  reused unless they are externally accessed.

17 years agoAdd a shortcut function, objcache_create_mbacked(), which is more complex
Matthew Dillon [Sun, 29 Apr 2007 01:26:46 +0000 (01:26 +0000)]
Add a shortcut function, objcache_create_mbacked(), which is more complex
then objcache_create_simple() but less complex then objcache_create().

17 years agoWhen <sys/user.h> is included, it MUST be included first because it sets
Matthew Dillon [Sun, 29 Apr 2007 01:10:33 +0000 (01:10 +0000)]
When <sys/user.h> is included, it MUST be included first because it sets
a preprocessor variable that effects other header files.

17 years agoUse the new PLATFORM_CONFIG_H mechanism rather than maintaining patches
Peter Avalos [Sat, 28 Apr 2007 16:16:31 +0000 (16:16 +0000)]
Use the new PLATFORM_CONFIG_H mechanism rather than maintaining patches
against contrib/.

Reminded-by: joerg
17 years agoAdd FreeBSD 6.3 (for archive_write_disk(3)).
Sascha Wildner [Sat, 28 Apr 2007 16:11:37 +0000 (16:11 +0000)]
Add FreeBSD 6.3 (for archive_write_disk(3)).

17 years ago- PHY error bit no longer exists in RX descriptor flags.
Sepherosa Ziehau [Sat, 28 Apr 2007 14:40:13 +0000 (14:40 +0000)]
- PHY error bit no longer exists in RX descriptor flags.
- Cipher error mask is off by one bit.
Obtained-from: Ralink Linux RT61 driver

- Cache host byte order RX descriptor flags.

17 years agoImplement ncpus_fit and ncpus_fit_mask. Admittedly not the best name.
Matthew Dillon [Fri, 27 Apr 2007 23:27:18 +0000 (23:27 +0000)]
Implement ncpus_fit and ncpus_fit_mask.  Admittedly not the best name.
This variable is the nearest power of 2 >= ncpus (ncpus2 is the nearest
power of 2 <= ncpus).

17 years agoAdd a generally accessible cpu_pause() inline for spin loops.
Matthew Dillon [Fri, 27 Apr 2007 23:23:59 +0000 (23:23 +0000)]
Add a generally accessible cpu_pause() inline for spin loops.

17 years agoGC old libarchive version.
Peter Avalos [Fri, 27 Apr 2007 23:02:55 +0000 (23:02 +0000)]
GC old libarchive version.

17 years agoUpgrade to libarchive 2.1.9. Including bug fixes, this improves ar support
Peter Avalos [Fri, 27 Apr 2007 22:56:18 +0000 (22:56 +0000)]
Upgrade to libarchive 2.1.9.  Including bug fixes, this improves ar support
and adds read/write_compress_program.

Discussed-with:  joerg

17 years agoAdd our READMEs.
Peter Avalos [Fri, 27 Apr 2007 22:14:42 +0000 (22:14 +0000)]
Add our READMEs.

17 years agoThese weren't supposed to get imported.
Peter Avalos [Fri, 27 Apr 2007 22:13:31 +0000 (22:13 +0000)]
These weren't supposed to get imported.

17 years agoImport libarchive 2.1.9.
Peter Avalos [Fri, 27 Apr 2007 22:01:15 +0000 (22:01 +0000)]
Import libarchive 2.1.9.

17 years agoMerge from vendor branch LIBARCHIVE:
Peter Avalos [Fri, 27 Apr 2007 22:01:15 +0000 (22:01 +0000)]
Merge from vendor branch LIBARCHIVE:
Import libarchive 2.1.9.

17 years agoSpecify section number for .Xr
Sascha Wildner [Fri, 27 Apr 2007 08:49:42 +0000 (08:49 +0000)]
Specify section number for .Xr

17 years agoTestcommit.
Hasso Tepper [Fri, 27 Apr 2007 06:56:36 +0000 (06:56 +0000)]
Testcommit.

17 years agoMerge from vendor branch SENDMAIL:
Gregory Neil Shapiro [Fri, 27 Apr 2007 03:55:39 +0000 (03:55 +0000)]
Merge from vendor branch SENDMAIL:
Bring in sendmail.org code from the future 8.14.2 release which restores
ABI compatibility to users of the libmilter.so shared library.

17 years agoBring in sendmail.org code from the future 8.14.2 release which restores
Gregory Neil Shapiro [Fri, 27 Apr 2007 03:55:39 +0000 (03:55 +0000)]
Bring in sendmail.org code from the future 8.14.2 release which restores
ABI compatibility to users of the libmilter.so shared library.

17 years agoFix various paths in rc.d/diskless and friends.
Matthew Dillon [Thu, 26 Apr 2007 23:34:27 +0000 (23:34 +0000)]
Fix various paths in rc.d/diskless and friends.

Submitted-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk>
17 years agoRemove unneeded comma.
Sascha Wildner [Thu, 26 Apr 2007 20:08:56 +0000 (20:08 +0000)]
Remove unneeded comma.

17 years agoUse .Xr for manpage references.
Sascha Wildner [Thu, 26 Apr 2007 17:35:03 +0000 (17:35 +0000)]
Use .Xr for manpage references.

17 years agoAdd a reference to manpath.config(5).
Sascha Wildner [Thu, 26 Apr 2007 15:47:43 +0000 (15:47 +0000)]
Add a reference to manpath.config(5).

17 years agoUse a smaller indentation because it looks better.
Sascha Wildner [Thu, 26 Apr 2007 15:45:59 +0000 (15:45 +0000)]
Use a smaller indentation because it looks better.

17 years ago- Factor out ieee80211_reset_state() from ieee80211_newstate(), so
Sepherosa Ziehau [Thu, 26 Apr 2007 12:59:14 +0000 (12:59 +0000)]
- Factor out ieee80211_reset_state() from ieee80211_newstate(), so
  802.11 layer can clean up its internal state machine without state
  changing or going through driver code.
- Merge sta_disassoc() and sta_disauth() into sta_disconnect(), which
  sends disassoc to associated STA and deauth to authenticating STA.
- Call ieee80211_reset_state(), if operational mode is going to be
  changed, so we will do a proper state machine clean up.  In the
  original way, if we are acting as AP and switch directly to act as
  STA, we will send out wrong management frames.
- Call ieee80211_reset_state(), if PHY is going to be changed.  This
  prevents panic (due to a proper assertion) under following scenario:
  o  Current PHY of the AP is 11b.
  o  An 11b STA joins the BSS created by the AP.  Since AP's current
     PHY is 11b, this STA will not be counted as long slot time STA,
     i.e. long slot time STA count left untouched.
  o  Switch AP's PHY to 11g.
  AP will panick (long slot time STA count is zero, while there is a
  long slot time STA associated, in ieee80211_node_leave_11g()).  The
  assertion fails, because 802.11 state machine is doing its clean up
  as if AP were using 11g PHY, but it actually used 11b PHY.

17 years ago- Don't disable interrupt in bge_intr(), just acknowledge it. This avoids
Sepherosa Ziehau [Thu, 26 Apr 2007 11:58:10 +0000 (11:58 +0000)]
- Don't disable interrupt in bge_intr(), just acknowledge it.  This avoids
  potential lose of interrupt when interrupt gets re-enabled, since writing
  to BGE_MBX_IRQ0_LO also serves as interrupt acknowledgment.
- Move interrupt acknowledgment before reading status block.  This lets us
  read the correct/complete status block.
- Reset ifnet.if_timer, only if there is nothing pending to be TXed.

Obtained-from: FreeBSD (bde@freebsd.org)

17 years agoAdd a manual page explaining the format of /etc/manpath.config.
Sascha Wildner [Thu, 26 Apr 2007 08:35:52 +0000 (08:35 +0000)]
Add a manual page explaining the format of /etc/manpath.config.

17 years agoSort alphabetically.
Sascha Wildner [Thu, 26 Apr 2007 08:33:24 +0000 (08:33 +0000)]
Sort alphabetically.

17 years agoRevert my previous commit to nrelease/Makefile and add /usr/local/share/man
Sascha Wildner [Thu, 26 Apr 2007 08:25:41 +0000 (08:25 +0000)]
Revert my previous commit to nrelease/Makefile and add /usr/local/share/man
to manpath.config.

Requested-by: dillon
17 years agoEnable manpath(1) to map more than one man dir to a bin dir.
Sascha Wildner [Thu, 26 Apr 2007 08:17:54 +0000 (08:17 +0000)]
Enable manpath(1) to map more than one man dir to a bin dir.

17 years agoMove syslink_desc to sys/syslink_rpc.h so kernel code does not need
Matthew Dillon [Thu, 26 Apr 2007 02:11:00 +0000 (02:11 +0000)]
Move syslink_desc to sys/syslink_rpc.h so kernel code does not need
to #include sys/syslink.h.  Add a kernel config option 'SYSLINK' to build
with kern_syslink.c, so it can be worked on (read: broken) without
interfering with other developer's kernel builds.  Add a shims file for
the syslink() system call for kernels not built with kern_syslink.c.  The
shims file can be used generally for this purpose.

17 years agoIPV6 type 0 route headers are a flawed design, insecure by default, and
Matthew Dillon [Wed, 25 Apr 2007 21:55:33 +0000 (21:55 +0000)]
IPV6 type 0 route headers are a flawed design, insecure by default, and
open hosts and networks up to DOS attacks by allowing normal router IP
filtering to be bypassed.  Disable them by default.

Submitted-by: Hasso Tepper <hasso@estpak.ee>
Obtained-from: OpenBSD

17 years agostyle(9) cleanup: Remove parameter names from prototypes.
Sascha Wildner [Wed, 25 Apr 2007 11:45:28 +0000 (11:45 +0000)]
style(9) cleanup: Remove parameter names from prototypes.

Submitted-by: Hasso Tepper <hasso@estpak.ee>
17 years agoUse .Nm
Sascha Wildner [Wed, 25 Apr 2007 09:35:31 +0000 (09:35 +0000)]
Use .Nm

17 years agoCreate a symbolic link /usr/local/share/man -> /usr/local/man because
Sascha Wildner [Wed, 25 Apr 2007 09:22:06 +0000 (09:22 +0000)]
Create a symbolic link /usr/local/share/man -> /usr/local/man because
apparently stuff using autotools prefers to install its manual pages
in this location.

Observed-and-suggested-by: Hasso Tepper <hasso@estpak.ee>