dragonfly.git
13 years agosavecore,crashinfo - fix several problems
Alex Hornung [Sat, 11 Sep 2010 12:25:34 +0000 (13:25 +0100)]
savecore,crashinfo - fix several problems

* Fix the savecore rc.d script to only run savecore (and crashinfo) when
  there's actually a core dump available.

* Limit the kgdb CPU time to 15 seconds to avoid looping forever if we
  have a somewhat broken vmcore.

13 years agokernel: bzeront() - Switch out loop instruction in i386 bzero for sub/jnz.
Venkatesh Srinivas [Sat, 11 Sep 2010 11:16:39 +0000 (04:16 -0700)]
kernel: bzeront() - Switch out loop instruction in i386 bzero for sub/jnz.

Much as I like loop, it has a ~7-9 cycle latency on AMD CPUs. Lets spend
idlezero time actually zeroing...

13 years agoftp-proxy.8 & pflogd.8: Fix some mdoc issues.
Sascha Wildner [Sat, 11 Sep 2010 09:40:56 +0000 (11:40 +0200)]
ftp-proxy.8 & pflogd.8: Fix some mdoc issues.

13 years agoFix LINT build.
Sascha Wildner [Sat, 11 Sep 2010 08:57:34 +0000 (10:57 +0200)]
Fix LINT build.

I never get why LINT isn't just checked before pushing such huge
changes. Takes just a couple of minutes, really. :)

13 years agonetwork - Correct double free of mbuf during reboot
Matthew Dillon [Sat, 11 Sep 2010 06:02:39 +0000 (23:02 -0700)]
network - Correct double free of mbuf during reboot

* Correct code which was leaving a stale mbuf pointer intact
  when flushing the so_rcv sockbuf in a socket.  This normally
  occured during shutdown/reboot.

13 years agobuild - Fix netgraph
Matthew Dillon [Sat, 11 Sep 2010 05:41:30 +0000 (22:41 -0700)]
build - Fix netgraph

* Some source files were missing newly required includes for their
  use of the mplock and socketvar2.h inlines.

Reported-by: lentferj
13 years agonetwork - raw_input needs further protection
Matthew Dillon [Sat, 11 Sep 2010 11:58:35 +0000 (11:58 +0000)]
network - raw_input needs further protection

* We also need the so_rcv.ssb_token to protect against userland

13 years agodevfs - Let devfs assume degenerate knotes when a device goes away
Samuel J. Greear [Sat, 14 Aug 2010 14:41:35 +0000 (14:41 +0000)]
devfs - Let devfs assume degenerate knotes when a device goes away

* Some devices can disappear while knotes are still active on the klist
  embedded in the devices softc or etc., create a mechanism to allow devfs
  to assume these degenerate knotes.

* Convert ums to this new way of things

* This does not actually fix the reported panic (where X is holding a mouse
  open across detach), panic is moved into the new devfs handler.

* Other devices which could be detached and support the kq interface need to
  use this interface as well (umass, ...)

Reported-by: Rumko
13 years agonetwork - Fixes for wpa, general sockets.
Matthew Dillon [Sat, 11 Sep 2010 09:32:24 +0000 (09:32 +0000)]
network - Fixes for wpa, general sockets.

* netisr_characterize() was not properly handling unknown
  characterizations (array overflow).

* The raw protocol was not MPSAFE.

* Protect kqinfo->ki_mlist in sowakeup

13 years agonetwork - Tokenize NFS, fix MP races
Matthew Dillon [Fri, 10 Sep 2010 19:09:34 +0000 (12:09 -0700)]
network - Tokenize NFS, fix MP races

* Now that the rest of the network stack is running MPSAFE, poor NFS is
  hitting races and other issues because it was depending on the MP lock.

* Recombobulate NFS with tokens, protecting all border crossings:

  A global nfs_token is used for the nfs mount list, nfsd list, and
  server socket list.

  A per-socket token (nfssvc_sock->ns_token) governs each served mount.

  A per-mount token (nfsmount->nm_token) governs each client mount.

* Callouts and TCP upcalls are protected.  The per-socket TCP upcall
  is protected by the nfssvc_sock token.

* The NFS iod thread pairs and nfsd threads now run MPSAFE.

* NFSv3 is now holy-shit fast and can trivially max-out a GigE link
  without TSO when the server is not otherwise limited by server-side
  disks.

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 10 Sep 2010 16:09:17 +0000 (09:09 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agopf: Fix some byte ordering
Jan Lentfer [Fri, 10 Sep 2010 13:39:07 +0000 (15:39 +0200)]
pf: Fix some byte ordering

13 years agokernel - tmpfs: Set M_NULLOK on node allocations and safe node_init against
Venkatesh Srinivas [Fri, 10 Sep 2010 13:03:59 +0000 (06:03 -0700)]
kernel - tmpfs: Set M_NULLOK on node allocations and safe node_init against
null node pointers.

Dragonfly-bug: Still 1726 (tmpfs malloc limit exceeded).

13 years agosavecore - Allow automatic text summary generation
Alex Hornung [Fri, 10 Sep 2010 09:49:59 +0000 (10:49 +0100)]
savecore - Allow automatic text summary generation

* Add two rc variables to automatically generate the text summary for a
  core dump every time savecore does its job.

Obtained-From: FreeBSD

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 10 Sep 2010 09:28:37 +0000 (02:28 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 10 Sep 2010 09:28:06 +0000 (02:28 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agobuild - Fix kernel build issue
Matthew Dillon [Fri, 10 Sep 2010 09:27:41 +0000 (02:27 -0700)]
build - Fix kernel build issue

* Missing include for token declaration

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 10 Sep 2010 09:25:58 +0000 (02:25 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agonetwork - MP socket free & abort interactions, so_state
Matthew Dillon [Fri, 10 Sep 2010 04:01:20 +0000 (21:01 -0700)]
network - MP socket free & abort interactions, so_state

* Add so_refs and ref-count the socket structure to deal with
  MP races on sofree().

* Ref the socket structure for all soabort() operations (they are usually
  asynchronous).  The netmsg_pru_abort() handler will sofree() the ref
  after calling the protocol stack's abort function.

* Use atomic ops to set and clear bits in so_state, because it is modified
  by both the fronttend and the backend.

* Remove numerous critical sections that are no longer effective.

* Protect the accept queues with so_rcv.ssb_token.

* Protect after-the-fact calls to soisdisconnected() with a soreference()
  to avoid use-after-free cases.

* Wrap unix domain, mroute, div, raw, and key sockets/protocols with their
  own private tokens.

13 years agocrashinfo - Add script to gather info from dumps
Alex Hornung [Fri, 10 Sep 2010 09:15:57 +0000 (10:15 +0100)]
crashinfo - Add script to gather info from dumps

* Add a script to automatically gather as much info as possible from a
  crash dump and save it in text form.

* This is originally from FreeBSD, with a bunch of changes related to
  DragonFly.

Obtained-from: FreeBSD

13 years agogdb.kernel - Add commands for tokens
Alex Hornung [Fri, 10 Sep 2010 09:13:05 +0000 (10:13 +0100)]
gdb.kernel - Add commands for tokens

* Add lstok and infotok commands to list some information about the
  global mpsafe-ing tokens and show information about any token.

13 years agobuild - Fixup world/kernel build
Matthew Dillon [Fri, 10 Sep 2010 09:11:46 +0000 (02:11 -0700)]
build - Fixup world/kernel build

* Fixup the world/kernel build for 64 bit etc.  Cleanup recent work.

13 years agosystat - Fix overflow in page calculation on display
Matthew Dillon [Fri, 10 Sep 2010 08:51:32 +0000 (01:51 -0700)]
systat - Fix overflow in page calculation on display

* Fix an overflow that caused large amounts of memory to display
  incorrectly in the VM page queues column.

* Display the Act/All fields from KB to MB.

13 years agoHopefully fix mountroot on our LiveCDs.
Sascha Wildner [Fri, 10 Sep 2010 08:30:37 +0000 (10:30 +0200)]
Hopefully fix mountroot on our LiveCDs.

Before the recent loader changes, the root device to use for CD-ROM
booting (/dev/cd0) was properly passed from the loader to the kernel
so the entry in fstab was never used.

However, with the new loader code this doesn't happen anymore (for
yet unknown reasons), so the fstab entry is tried and fails, because
it is wrong.

So for now, adjust our fstabs to use /dev/cd0.

13 years agogdb.kernel - Fix functions
Alex Hornung [Fri, 10 Sep 2010 08:23:09 +0000 (09:23 +0100)]
gdb.kernel - Fix functions

* Fix a bunch of functions in gdb.kernel, as well as some formatting
  issues.

13 years agohardclock - Get proc_token for ksignal
Alex Hornung [Fri, 10 Sep 2010 07:12:15 +0000 (08:12 +0100)]
hardclock - Get proc_token for ksignal

* Try to get the proc_token to be able to call ksignal instead of the
  mplock.

* This fixes a panic that occured when using luksFormat.

Reported-By: Matthias Schmidt (matthias@)
13 years agoMerge branch 'master' of git://git.dragonflybsd.org/dragonfly
Matthias Schmidt [Fri, 10 Sep 2010 06:19:49 +0000 (08:19 +0200)]
Merge branch 'master' of git://git.dragonflybsd.org/dragonfly

13 years agocpdup: Fix off-by-one error.
Peter Avalos [Fri, 10 Sep 2010 02:33:19 +0000 (16:33 -1000)]
cpdup:  Fix off-by-one error.

Submitted-by: dillon@

13 years agokernel - Convert mpipe global token to per-pipe tokens.
Venkatesh Srinivas [Fri, 10 Sep 2010 01:26:45 +0000 (18:26 -0700)]
kernel - Convert mpipe global token to per-pipe tokens.

13 years agonetwork - Completely revamp the netisr / dispatch code
Matthew Dillon [Thu, 9 Sep 2010 22:13:36 +0000 (15:13 -0700)]
network - Completely revamp the netisr / dispatch code

* All netisrs are dispatched MPSAFE (followup in later commits)

* Centralize the protocol threads.  There is now just one thread
  per cpu managed by the netisr code.  No more separate tcp/udp threads
  on each cpu.

* Make the mbuf M_HASH/m_pkthdr.hash mechanic the central routing
  mechanic for netmsgs.

* Remove the netisr ip_mport and pktinfo_portfn stuff and replace with a
  cpufn function which handles M_HASH/m_pkthdr.hash when M_HASH is not
  already set.

* Seriously clean up the packet input paths.  Adjust ether_input_chain() and
  friends to not have to adjust the mbuf forwards and backwards, instead
  pass a header offset to the ni_cpufn function.  The ip pullup and other
  related code will use the offset to determine where the ip header is
  within the packet.

13 years agomkinitrd.8 - Add history and authors section
Matthias Schmidt [Thu, 9 Sep 2010 20:21:33 +0000 (22:21 +0200)]
mkinitrd.8 - Add history and authors section

13 years agoLINT: readd accidently removed iwi driver
Jan Lentfer [Thu, 9 Sep 2010 19:40:31 +0000 (21:40 +0200)]
LINT: readd accidently removed iwi driver

13 years agowlan - Bring iwi back into the fold.
Joe Talbott [Thu, 9 Sep 2010 19:03:34 +0000 (15:03 -0400)]
wlan - Bring iwi back into the fold.

This also fixes LINT builds.

Submitted-By: Johannes Hofmann (jh33)
13 years agocryptsetup - fix hash() frontend function
Alex Hornung [Thu, 9 Sep 2010 18:57:33 +0000 (19:57 +0100)]
cryptsetup - fix hash() frontend function

* hash() in backends.c would always return ENOENT, because the return
  variable r wasn't being updated.

* luks wasn't affected by this as it uses a different path, but using
  cryptsetup without luks would trigger this.

Reported-by: Matthias Schmidt (matthias@)
13 years agohier.7: Add some lines about /pfs and /var/hammer.
Sascha Wildner [Thu, 9 Sep 2010 18:57:03 +0000 (20:57 +0200)]
hier.7: Add some lines about /pfs and /var/hammer.

Suggested-by: matthias
13 years agopf: add patch from rev 1.553 to patch.c
Jan Lentfer [Thu, 9 Sep 2010 18:34:04 +0000 (20:34 +0200)]
pf: add patch from rev 1.553 to patch.c

    allow RSTs with th_seq == seqlo +- 1, reduces the amount of 'loose state'
    messages, add 'dir=' part to 'loose state' message

13 years agopf: Add patch from rev 1.554
Jan Lentfer [Thu, 9 Sep 2010 18:09:03 +0000 (20:09 +0200)]
pf: Add patch from rev 1.554

    RSTs sent due to "block return(-rst)" could be routed using
    the main routing table instead of an alternate one specified
    on the block rule.

13 years agopf: Update pf.c to fix memory leak
Jan Lentfer [Thu, 9 Sep 2010 13:54:56 +0000 (15:54 +0200)]
pf: Update pf.c to fix memory leak

pf.c 1.552.2.1 2007/11/27 fixes a memory leak issue.
This was MFC'd to OpenBSD 4.2

13 years agopf: Update to OpenBSD 4.2
Jan Lentfer [Fri, 27 Aug 2010 20:01:56 +0000 (22:01 +0200)]
pf: Update to OpenBSD 4.2

All sorts of informations is now stored directly in
the mbuf header instead of a seperate mbuf tag. This
brings in a 100% performance increase in comparison
to OpenBSD 4.1. For DragonFly this basically means
this is the same performance as in 2.6, but we are
equal again with OpenBSD's pf data structures.

Necesary additions:

sys/net: add more interface groups related functions

if_creategroup()
if_addgroup()
if_delgroup()
if_getgroup()
if_getgroupmembers()

Imported from OpenBSD

carp: add carp_group_demote_adj()

altq: re-add check of packet tagging

fairq & red support, UDP nat'ing, reassembly fixed by Matthew Dillon

13 years agonetwork - Make toeplitz the default
Matthew Dillon [Thu, 9 Sep 2010 16:27:40 +0000 (09:27 -0700)]
network - Make toeplitz the default

13 years agokernel - Add nfs rpc packet sanity check
Matthew Dillon [Thu, 9 Sep 2010 16:18:27 +0000 (09:18 -0700)]
kernel - Add nfs rpc packet sanity check

* Try to catch potential issues with NFS packet generation.
  Temporary.

13 years agolibc: nmalloc - Add a per-thread magazine layer and a malloc slab magazine.
Venkatesh Srinivas [Thu, 9 Sep 2010 10:51:28 +0000 (03:51 -0700)]
libc: nmalloc - Add a per-thread magazine layer and a malloc slab magazine.

The per-thread magazine layer is based on the Solaris umem/vmem paper; it
creates fixed-sized arrays ('magazines') of buffers and binds them to threads.
Local allocations can often now occur with minimal locking and interference.

The slab magazine is meant to buffer calls calls to mmap when requesting slabs.
In tests with MySQL/sysbench OLTP, it leads to fairly dramatic reductions in
the total number of mmap system calls.

nmalloc now also respects the MALLOC_OPTIONS environment variable:
- The 'U' option generates ktrace entries for all malloc/realloc/free calls
- The 'H' option calls madvise liberally to return pages to the system often
- The 'Z' option zeroes all allocations

This work was developed out-of-tree; the RCS log is on leaf.

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Thu, 9 Sep 2010 08:35:59 +0000 (01:35 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agokernel - network protocol thread routing
Matthew Dillon [Thu, 9 Sep 2010 08:32:07 +0000 (01:32 -0700)]
kernel - network protocol thread routing

* ip_input() now calls ip_mport() unconditionally and physically compares
  the port to &curthread->td_msgport.  If they do not match the packet
  will be forwarded to the correct protocol thread.

* ip6_input() now unconditionally calls sw6->pr_soport() on the last
  received header and forwards the packet to the correct protocol thread.

  udp6, tcp6, and rip6 are now marked as terminal protocol (PR_LASTHDR).
  Though I'm not sure this is correct they must be marked this way for
  the packet to be forwarded to the correct protocol thread.

  This fixes an assertion panic when tcp6_input() calls tcp_input().
  tcp_input() is expecting to be run on the same protocol thread assigned
  to its socket, otherwise callout timers and other entities will get
  confused.

13 years agowi(4): Remove an unused variable.
Sascha Wildner [Thu, 9 Sep 2010 07:24:02 +0000 (09:24 +0200)]
wi(4): Remove an unused variable.

13 years agokernel - MPSAFE the protocol drain routines
Matthew Dillon [Thu, 9 Sep 2010 05:53:49 +0000 (22:53 -0700)]
kernel - MPSAFE the protocol drain routines

* The ip fragment drain was not MPSAFE at all.  Use a token to protect
  the ipq[] queues.

* The tcp reassembly code was only partially MPSAFE due to being
  per-cpu.  Finish it up.  Use atomic ops for the tcp_reass_qsize
  global.

* Add port assertions in the TCP input and output paths.  If we
  are not in the correct thread we panic, period.

* Code cleanup.

13 years agokernel - Finish MPSAFEing uipc_mbuf.c
Matthew Dillon [Thu, 9 Sep 2010 05:51:03 +0000 (22:51 -0700)]
kernel - Finish MPSAFEing uipc_mbuf.c

* Make the mbuf tracking debug code MPSAFE.

* Get rid of worthless critical sections.

* Code cleanup.

13 years agokernel - MPSAFE kern_mpipe.c
Matthew Dillon [Thu, 9 Sep 2010 05:46:36 +0000 (22:46 -0700)]
kernel - MPSAFE kern_mpipe.c

* Make the mpipe code MPSAFE.  The mpipe code is used in numerous places
  including the ip reassembly code and some of the tcp code.

* Absolutely required now that the protocol stacks are running MPSAFE.

13 years agowlan - Update ath, sync rev 1.276@FreeBSD
Matthew Dillon [Thu, 9 Sep 2010 05:43:37 +0000 (22:43 -0700)]
wlan - Update ath, sync rev 1.276@FreeBSD

* Don't delay updating the longcal timer - instead, update the longcal
  flag immediately so it's only set once per longcal interval.

  Without this, the current AR5416 code will continuously spam NF
  calibrations during a periodic calibration if the longcal flag
  is set. The longcal flag wouldn't be cleared until the calibration
  method indicates that calibrations are "complete".

  This could cause numerous problems including stuck beacons.

Taken-From: FreeBSD

13 years agowlan - Add ral and wi back into the build system.
Joe Talbott [Thu, 9 Sep 2010 03:30:59 +0000 (23:30 -0400)]
wlan - Add ral and wi back into the build system.

13 years agowlan - Bring ral back into the fold.
Joe Talbott [Thu, 9 Sep 2010 03:30:00 +0000 (23:30 -0400)]
wlan - Bring ral back into the fold.

*** NB ***
This has not been tested other than that it compiles (due to lack of
hardware) but will be tested within the week.

13 years agowlan - Docuement lksleep changes as well.
Joe Talbott [Thu, 9 Sep 2010 03:29:25 +0000 (23:29 -0400)]
wlan - Docuement lksleep changes as well.

13 years agowlan - Bring wi back into the fold.
Joe Talbott [Thu, 9 Sep 2010 03:28:17 +0000 (23:28 -0400)]
wlan - Bring wi back into the fold.

*** NB ***
This has not yet been tested other than that it compiles (due to lack of
hardware).  It will be tested within the week.

13 years agouserland - dhclient - Fix possible infinite loop from unhandled poll(2) return
Samuel J. Greear [Thu, 9 Sep 2010 01:19:09 +0000 (01:19 +0000)]
userland - dhclient - Fix possible infinite loop from unhandled poll(2) return

* This -probably- doesn't happen, but exercise some defensive programming
  here. This will prevent dhclient from running away and eating 100% cpu in the
  event of an error on the socket. Plus, we let the user know something went
  wrong.

13 years agouserland - dhclient - Fix possible infinite loop
Samuel J. Greear [Thu, 9 Sep 2010 01:12:31 +0000 (01:12 +0000)]
userland - dhclient - Fix possible infinite loop

FreeBSD commit message:

It is possible for bpf to return a length such that:

length != BPF_WORDALIGN(length)

This meeans that it is possible for this to be true:

interface->rbuf_offset > interface->rbuf_len

Handle this case in the test for running out of packets.  While
OpenBSD's solution of setting interface->rbuf_len to
BPF_WORDALIGN(length) is safe due to the size of the buffer, I think
this solution results in less hidden assumptions.

This should fix the problem of dhclient running away and consuming 100%
CPU.

PR: bin/102226
Submitted by: Joost Bekkers <joost at jodocus.org>

Reported-by: Many
Obtained-from: FreeBSD

13 years agokernel - Bring if_alc up to FreeBSD rev 1.16
Matthew Dillon [Thu, 9 Sep 2010 00:33:26 +0000 (17:33 -0700)]
kernel - Bring if_alc up to FreeBSD rev 1.16

* Bring in all recent if_alc work from FreeBSD.

Taken-from: FreeBSD

13 years agowlan - Fix serializer in destroy path, update docs
Matthew Dillon [Wed, 8 Sep 2010 22:26:54 +0000 (15:26 -0700)]
wlan - Fix serializer in destroy path, update docs

* Update the README.DRAGONFLY to include tidbits no tsleeps and
  firmware loading.

* Fix an issue when a low level driver attempts to destroy a wlan
  interface.

13 years agowlan - Bring iwn back into the fold.
Matthew Dillon [Wed, 8 Sep 2010 22:22:14 +0000 (15:22 -0700)]
wlan - Bring iwn back into the fold.

* Note in addition to the usual instructions we also have to release
  the wlan_global_serializer across a number of tsleep()s and the
  firmware loader.

13 years agowlan - Bring wpi back into the fold.
Joe Talbott [Wed, 8 Sep 2010 17:06:18 +0000 (13:06 -0400)]
wlan - Bring wpi back into the fold.

13 years agowpi - Convert to wlan_global_serializer use.
Joe Talbott [Wed, 8 Sep 2010 17:03:13 +0000 (13:03 -0400)]
wpi - Convert to wlan_global_serializer use.

* Rip out old locking inherited from FreeBSD
* Use wlan_serialize_{enter,exit}() to serialize wlan boundary crossings
  per sys/netproto/802_11/README.DRAGONFLY
* Clean up some minor cruft left over from porting.

13 years agowlan - if_ath driver - Make some adjustments to ath (preliminary)
Matthew Dillon [Wed, 8 Sep 2010 07:20:23 +0000 (00:20 -0700)]
wlan - if_ath driver - Make some adjustments to ath (preliminary)

These adjustments correct some chip races and appear to fix issues
related to running the wlan in AP mode with the atheros driver.

* Fix a bug in ath_txqmove().  This bug was hidden due to a queue
  length check in the one place that used the routine but fix it anyway.

* Call stoptxdma() before messing with the beacon linkages rather than
  afterwords (ap mode).  I'm a bit unclear as to whether the previously
  installed beacon should have been allowed to continue to run if no
  new beacons are found.  For now it isn't.

* Redo the qbusy logic.  The old logic had at least 2 chipset/driver
  races related to the link field.  The new logic makes no assumptions
  and only reactivates the txdma if the queue is clearly idle and
  we are adding the first (bf) to it.  Otherwise leave it to the INT_TX
  code to detect where the txdma stopped and restart it at the
  appropriate place.

  This bit of code needs more work as the INT_TX for tx completion may
  be delayed indefinitely (we might need a callout check in there too,
  I'm not sure).

* For the moment use MB_WAIT when loading or replentishing the receive ring.
  There does not appear to be a proper mechanism to deal with stalls that
  might be created if a mbuf fails to allocate.

  What we really need here is proper rx ring mbuf replacement logic where
  the filled mbuf is NOT removed if no new mbuf can be allocated to take
  its place.  Using MB_WAIT is a bad hack.  It isn't entirely trivial
  due to the DMA load and the 32 bit address space restriction.

* Add a few cpu_sfence()s when poking the (bf) link field.  This probably
  isn't correct.

* Cleanup, add some debugging kprintf()s for a few unexpected conditions

13 years agowlan - Bug fixes for recent work
Matthew Dillon [Wed, 8 Sep 2010 07:18:04 +0000 (00:18 -0700)]
wlan - Bug fixes for recent work

* handoff (if in "ap" mode) serializer adjustments.

* interface deletion serializer adjustments.

13 years agowlan - Disable bgscan by default
Matthew Dillon [Wed, 8 Sep 2010 04:40:48 +0000 (21:40 -0700)]
wlan - Disable bgscan by default

* bgscan mode (station scanning while associated) blows up the
  Atheros driver (tested w/ AR9280 chipset).  Turn it off by default.

13 years agowlan - cleanup
Matthew Dillon [Tue, 7 Sep 2010 20:28:36 +0000 (13:28 -0700)]
wlan - cleanup

* Remove some debugging.

13 years agobuild - Temporary adjustments for further wlan conversion work
Matthew Dillon [Tue, 7 Sep 2010 20:26:53 +0000 (13:26 -0700)]
build - Temporary adjustments for further wlan conversion work

* Remove iwn, ral, wi, and wpi temporarily until they can be converted
  like ath was.

13 years agowlan - Convert low level if_ath driver.
Matthew Dillon [Tue, 7 Sep 2010 20:25:40 +0000 (13:25 -0700)]
wlan - Convert low level if_ath driver.

* Ripout old lock API.

* Use the new wlan_serialize_enter/exit and &wlan_global_serializer.

13 years agowlan - Rip out all wlan locks part 2/2 - cleanup
Matthew Dillon [Tue, 7 Sep 2010 20:18:31 +0000 (13:18 -0700)]
wlan - Rip out all wlan locks part 2/2 - cleanup

* Clean up a few snafus and adjust the names for some procedures.

* Flesh out README.DRAGONFLY

13 years agowlan - Rip out all wlan locks part 2/2
Matthew Dillon [Tue, 7 Sep 2010 17:01:17 +0000 (10:01 -0700)]
wlan - Rip out all wlan locks part 2/2

* Add wlan_global_serializer and wlan_*() API calls.

* Use the calls at all border crossings.

* NOTE: callout_stop() may still have deadlock issues if it catches a
  callout in-progress.

13 years agowlan - Rip out all wlan locks part 1/2
Matthew Dillon [Tue, 7 Sep 2010 16:00:23 +0000 (09:00 -0700)]
wlan - Rip out all wlan locks part 1/2

* Rip out all the individiual wlan locks

13 years agokernel - Add LWKT_SERIALIZE_INITIALIZER
Matthew Dillon [Tue, 7 Sep 2010 15:58:38 +0000 (08:58 -0700)]
kernel - Add LWKT_SERIALIZE_INITIALIZER

* Add an initializer for serializer static/global declarations.

13 years agomsdosfs - Fix panic when mounting msdos filesystems.
Joe Talbott [Tue, 7 Sep 2010 04:17:00 +0000 (00:17 -0400)]
msdosfs - Fix panic when mounting msdos filesystems.

bread()ing different sizes from the same address requires this
flag before b[q]relse() is called.

Discussed-With: dillon

13 years agoral - Cleanup leftovers from tokenization.
Joe Talbott [Mon, 6 Sep 2010 21:00:58 +0000 (17:00 -0400)]
ral - Cleanup leftovers from tokenization.

Reported-By: swildner
13 years agouserland - sysctl - Fix stack overflow
Samuel J. Greear [Tue, 7 Sep 2010 03:09:25 +0000 (03:09 +0000)]
userland - sysctl - Fix stack overflow

* alloca(3) was being used to allocate space for a call to sysctl(3) that
  returned data. This could occasionally be on the order of 50-100MB
  (net.inet.tcp.pcblist) resulting in a segfault.

13 years agokernel - Expose mpsafe/collision internals of kq token via sysctl
Samuel J. Greear [Tue, 7 Sep 2010 02:10:14 +0000 (02:10 +0000)]
kernel - Expose mpsafe/collision internals of kq token via sysctl

13 years agoinstallkernel - Fix kernel.old/kernel overwrite
Matthew Dillon [Tue, 7 Sep 2010 01:58:54 +0000 (18:58 -0700)]
installkernel - Fix kernel.old/kernel overwrite

* The kernel was being copied to kernel.old/kernel twice, once normally,
  and once (after the new kernel was installed) by the module objcopy.

  This left kernel.old/kernel as the new kernel instead of the old kernel.

* Fix by restricting the module copy to .ko files.

13 years agokernel - Refactor kqueue interlocks
Matthew Dillon [Tue, 7 Sep 2010 01:44:03 +0000 (18:44 -0700)]
kernel - Refactor kqueue interlocks

* Make KN_PROCESSING a soft lock flag.  When set nobody else can mess
  with a particular knote (other than setting certain flags) even if
  the originator blocks.

* Interlock major processing with KN_PROCESSING.  Registration, event
  scan, knote(), deletion, and filter ops.

* Block & restart when conflicts occur.  For the knote() hot-path we only
  block and restart if the 'hint' is non-zero, otherwise we just flag with
  KN_REPROCESS to indicate that reprocessing is required.

* This should fix kqueue races related to blocking operations confusing
  the list scan.

* Document the shit out of everything.

Reported-by: Francois Tigeot <ftigeot@wolfpond.org>
13 years agokernel - Fix panic when X11 intercepts console (III)
Matthew Dillon [Mon, 6 Sep 2010 20:48:21 +0000 (13:48 -0700)]
kernel - Fix panic when X11 intercepts console (III)

* Oops, ripped a little too much out of kputchar().  Put the TOTTY
  logic back in for the tprintf()/uprintf()/ttyprintf() cases.

* The console logic remains unchanged for kprintf() (it no longer
  attempts to tputchar() to a console tty intercept, instead we have
  a thread handle it from the dmesg buffer).

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 6 Sep 2010 20:36:05 +0000 (13:36 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agokernel - Fix numerous MP issues with sockbuf's and ssb_flags part 1/2
Matthew Dillon [Mon, 6 Sep 2010 20:34:01 +0000 (13:34 -0700)]
kernel - Fix numerous MP issues with sockbuf's and ssb_flags part 1/2

* Use atomic ops for ssb_flags handling

* Use atomic_cmpset_int() to interlock SSB_LOCK with SSB_WANT, and
  SSB_WAIT with SSB_WAKEUP.

  Note in particular that WAIT/WAKEUP assumes the client side of the
  socket is single threaded via an appropriate lock.  This needs more
  work.

13 years agoral - Convert to use wlan_token.
Joe Talbott [Sun, 5 Sep 2010 02:39:53 +0000 (22:39 -0400)]
ral - Convert to use wlan_token.

Tested-by: Johannes Hofmann <Johannes.Hofmann@gmx.de>
13 years agokernel - Add required kq_token around timer event
Matthew Dillon [Mon, 6 Sep 2010 18:05:19 +0000 (11:05 -0700)]
kernel - Add required kq_token around timer event

* filt_timerexpire() is called from a callout and needs the kq_token.

13 years agouserland - Port TCP-MD5 (RFC 2385) implementation.
Matthew Dillon [Mon, 6 Sep 2010 18:04:35 +0000 (11:04 -0700)]
userland - Port TCP-MD5 (RFC 2385) implementation.

Userland portion of he TCP_SIGNATURE port.

Submitted-by: David =?iso-8859-1?Q?B=C9RARD?= <david@nfrance.com>
Ported-from: FreeBSD

13 years agokernel - Port TCP-MD5 (RFC 2385) implementation.
Matthew Dillon [Mon, 6 Sep 2010 18:01:49 +0000 (11:01 -0700)]
kernel - Port TCP-MD5 (RFC 2385) implementation.

I have imported FreeBSD commits r125680, r125681 and r183001 into the
DragonFlyBSD code, it works well for both IPv4 and IPv6 BGP sessions.

This adds TCP_SIGNATURE to IPSEC.

For the uninitiated, this is a TCP option which provides for a means of
authenticating TCP sessions which came into being before IPSEC. It is
still relevant today, however, as it is used by many commercial router
vendors, particularly with BGP, and as such has become a requirement for
interconnect at many major Internet points of presence.

Tested with a Cisco 2611XM running IOS 12.3(24), and Quagga 0.99.17

Submitted-by: David =?iso-8859-1?Q?B=C9RARD?= <david@nfrance.com>
Ported-from: FreeBSD

13 years agoarcmsr.4: Add some more cards which are supported by this driver.
Sascha Wildner [Mon, 6 Sep 2010 12:38:20 +0000 (14:38 +0200)]
arcmsr.4: Add some more cards which are supported by this driver.

Pointed-out-by: Ching <ching2048@areca.com.tw>
13 years agoAdd arcmsr(4) to our GENERIC configs and adjust comments a bit.
Sascha Wildner [Mon, 6 Sep 2010 12:32:43 +0000 (14:32 +0200)]
Add arcmsr(4) to our GENERIC configs and adjust comments a bit.

13 years agoloader(8): Make the init_path setting work again.
Sascha Wildner [Sun, 5 Sep 2010 21:49:38 +0000 (23:49 +0200)]
loader(8): Make the init_path setting work again.

13 years agoloader.8: Some more cleanup.
Sascha Wildner [Sun, 5 Sep 2010 21:45:09 +0000 (23:45 +0200)]
loader.8: Some more cleanup.

13 years agoRemove /usr/share/examples/bootforth.
Sascha Wildner [Sun, 5 Sep 2010 21:44:47 +0000 (23:44 +0200)]
Remove /usr/share/examples/bootforth.

13 years agoRemove FICL code from sys/boot and clean up some more.
Sascha Wildner [Sun, 5 Sep 2010 20:53:38 +0000 (22:53 +0200)]
Remove FICL code from sys/boot and clean up some more.

13 years agoRemove loader.4th.8 and references to it.
Sascha Wildner [Sun, 5 Sep 2010 20:23:59 +0000 (22:23 +0200)]
Remove loader.4th.8 and references to it.

13 years agoHook loader.conf.5 into the build again.
Sascha Wildner [Sun, 5 Sep 2010 20:14:17 +0000 (22:14 +0200)]
Hook loader.conf.5 into the build again.

13 years agoloader(8): Add back some loader.conf vars which the old code handled.
Sascha Wildner [Sun, 5 Sep 2010 20:01:43 +0000 (22:01 +0200)]
loader(8): Add back some loader.conf vars which the old code handled.

These are variables which all correspond to boot(8) options:

Variable           Equivalent to
======================================
boot_askname       boot -a
boot_cdrom         boot -C
boot_ddb           boot -d
boot_gdb           boot -g
boot_serial        boot -h
boot_single        boot -s
boot_userconfig    boot -c
boot_verbose       boot -v
boot_vidcons       boot -V

13 years agoloader(8): Put the kenv variables into an array for easier checking.
Sascha Wildner [Sun, 5 Sep 2010 19:45:45 +0000 (21:45 +0200)]
loader(8): Put the kenv variables into an array for easier checking.

Also remove the code that unsetenv()'s a variable if its value is empty.
We cannot do this since some variables (boot_ddb, boot_gdb etc.) need no
value.

13 years agokernel - Fix panic when X11 intercepts console (II)
Matthew Dillon [Sun, 5 Sep 2010 18:14:49 +0000 (11:14 -0700)]
kernel - Fix panic when X11 intercepts console (II)

* There is a secondary issue when the console is runs through a pty or
  other device and kqueue is used, the tty_token is not enough.

* Rewrite kputchar() and shift all constty intercepts over to their own
  kernel thread.  kputchar() will write to the dmesg buffer and will call
  cnputc() to write to the real console, and (for tprintf()) it will
  output a specified tty.  But it will no longer attempt to write to
  the console tty via the kprintf() path.

  Instead kputchar() simply wakes up the monitoring kernel thread and
  the monitoring kernel thread tracks and copies the dmesg buffer to
  the constty.

* This completely fixes the constty intercept issue.  'xconsole' now works
  perfectly.  Nothing can go wrong.  Go wrong.  Go wrong.

13 years agokernel - Fix panic when X11 intercepts console
Matthew Dillon [Sun, 5 Sep 2010 16:57:56 +0000 (09:57 -0700)]
kernel - Fix panic when X11 intercepts console

* The kprintf() path was trying to acquire the tty_token.  When called
  from a hard code section without the token already held this can block
  and thus will assert.

* When a console intercept is active we now only print to it if we can
  acquire the tty_token non-blocking.  And too bad otherwise.  The
  dmesg log will still get the whole of the output.

* Remove a recursive kprintf() in the clist code.

* Document the return value for lwkt_trytoken().

Reported-by: Johannes Hofmann <johannes.hofmann@gmx.de>
13 years agokernel - More pty fixes
Matthew Dillon [Sun, 5 Sep 2010 04:27:08 +0000 (21:27 -0700)]
kernel - More pty fixes

* Allow the pts to be closed and reopened while the ptc is held open
  (xterm issues a revoke + open).  This fixes xterm.

* Add a flag to differentiate between a slave not yet initially opened
  and a slave which has been closed, so ptc reads and the kqfilter
  can properly return EOF (tmux).

* Remove pt_flags2 and fold its flags into pt_flags.

* Create a shim to track ttyunhold()'s for session releases and release
  the underlying pts (for screen).

Reported-by: josepht (xterm issue)
13 years agokernel - Fix direct getpages call to devfs cdev
Matthew Dillon [Sun, 5 Sep 2010 01:40:50 +0000 (18:40 -0700)]
kernel - Fix direct getpages call to devfs cdev

* This will be used by swapoff to bring pages in via VM objects.  devfs
  was using getpbuf() when it really needed to be using getpbuf_kva().

Found-via: Ilya Dryomov's swapoff port

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sat, 4 Sep 2010 18:30:55 +0000 (11:30 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agokernel - More tty/pty fixes
Matthew Dillon [Sat, 4 Sep 2010 18:28:21 +0000 (11:28 -0700)]
kernel - More tty/pty fixes

* Notify the pty master when the slave closes.

* Fix the zombie state stuff.  Clear the zombie state on initial open of
  either side, prior to running any modem controls.

* This appears to fix screen and tmux.

Reported-by: YONETANI Tomokazu <qhwt+dfly@les.ath.cx>, Antonio Huete Jimenez <tuxillo@crater.dragonflybsd.org>
13 years agoinclude - Install smbus headers in the system.
Antonio Huete Jimenez [Sat, 4 Sep 2010 16:17:38 +0000 (18:17 +0200)]
include - Install smbus headers in the system.

This will fix gkrellm build as it was trying to
include smb.h, which wasn't in /usr/include/machine
anymore.

In-collaboration-with: <swildner@>