games.git
13 years agokernel - Fix NFS panic
Matthew Dillon [Thu, 16 Sep 2010 17:03:30 +0000 (10:03 -0700)]
kernel - Fix NFS panic

* nfs_write() was not wrapped with a token, leading to races.

* Add some queueing assertions while we are here.

Reported-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk>
13 years agonetwork - Fix unconverted netmsg function
Matthew Dillon [Thu, 16 Sep 2010 16:37:34 +0000 (09:37 -0700)]
network - Fix unconverted netmsg function

* Fix a function I forgot to convert to the netmsg argument format.

Reported-by: swildner
13 years agoHAMMER Utility - Adjust documentation
Matthew Dillon [Thu, 16 Sep 2010 15:55:54 +0000 (08:55 -0700)]
HAMMER Utility - Adjust documentation

* Add some missing bits re: checkmap

Reported-by: Ilya Dryomov <idryomov@gmail.com>
13 years agonetwork - Fix if_gif build when no INET6
Matthew Dillon [Thu, 16 Sep 2010 15:50:39 +0000 (08:50 -0700)]
network - Fix if_gif build when no INET6

* Make if_gif build properly when INET6 is not specified.

Reported-by: Ilya Dryomov <idryomov@gmail.com>
13 years agoinitrd - Allow realroot to not have /dev for paths
Alex Hornung [Thu, 16 Sep 2010 10:03:01 +0000 (12:03 +0200)]
initrd - Allow realroot to not have /dev for paths

* Check if the realroot (for local and crypt) has a MOUNTFROM that
  begins with /dev/, i.e. is a full path. If not, just prepend /dev/.

13 years agonetwork - Add some serious assertions when MBUF_DEBUG is enabled (2)
Matthew Dillon [Thu, 16 Sep 2010 07:52:46 +0000 (00:52 -0700)]
network - Add some serious assertions when MBUF_DEBUG is enabled (2)

* Missed in the first commit, the sys/mbuf.h changes.  Note that a full
  kernel compile is required when MBUF_DEBUG is added (or removed)
  from the kernel config.  You can't mix-n-match

13 years agonetwork - Allow asynchronous shutdown and fix a MP race in soshutdown().
Matthew Dillon [Thu, 16 Sep 2010 07:50:40 +0000 (00:50 -0700)]
network - Allow asynchronous shutdown and fix a MP race in soshutdown().

* The ssb_release() call in sorflush() must be protected by
  socket->so_rcv.ssb_token.  This call is made from the user
  side when soshutdown() is called.

* Allow shutdowns to interrupt another thread read()ing from the same
  descriptor by removing the user-side interlock in the shutdown code
  path.

13 years agonetwork - Add assertions for direct messaged calls
Matthew Dillon [Thu, 16 Sep 2010 07:49:33 +0000 (00:49 -0700)]
network - Add assertions for direct messaged calls

* Certain pru_* functions are direct-messaged calls and the operation must
  be done on return.  Assert that the operation is done.

13 years agonetwork - Add some serious assertions when MBUF_DEBUG is enabled
Matthew Dillon [Thu, 16 Sep 2010 07:48:05 +0000 (00:48 -0700)]
network - Add some serious assertions when MBUF_DEBUG is enabled

* Assert that the mbuf field state is sane when pulling a new one out of
  the object cache.

* Store the last function (name) to free an mbuf as a debugging aid.

13 years agokernel - Make interrupt thread preemption programmable
Matthew Dillon [Thu, 16 Sep 2010 07:44:10 +0000 (00:44 -0700)]
kernel - Make interrupt thread preemption programmable

* Add sysctl lwkt.preempt_enable (default on) to allow interrupt thread
  preemption to be controlled for debugging purposes.

13 years agonetwork - Fix nasty bug in udp6_send()
Matthew Dillon [Thu, 16 Sep 2010 07:38:49 +0000 (00:38 -0700)]
network - Fix nasty bug in udp6_send()

* This bug was causing machines receiving inet6 udp packets to crash
  very quickly, but was nearly impossible to find due to the weird
  way it caused mbufs to interact.

Reported-by: Peter Avalos <peter@theshell.com>,
     Francois Tigeot <ftigeot@wolfpond.org>

13 years agocrashinfo - (hopefully) fix hang
Alex Hornung [Thu, 16 Sep 2010 08:37:27 +0000 (10:37 +0200)]
crashinfo - (hopefully) fix hang

* Pipe the commands into kgdb instead of using <. This seems to fix an
  issue where kgdb wouldn't really get anything out of the file on the
  other side of < and would get stuck in kqread.

Reported-by: Peter Avalos
13 years agonetwork - Fix MP races in GIF
Matthew Dillon [Thu, 16 Sep 2010 00:41:31 +0000 (17:41 -0700)]
network - Fix MP races in GIF

* GIF used a single route cache across all CPUs causing races.  In addition
  GIF did not clean out the cache when destroying an interface or changing
  the address family.

* Change the single route cache entry to an array[SMP_MAXCPU] and also
  separate out the inet4 and inet6 route cache entries.

13 years agovknetd - Adjust unsecure mode (-U) to also pass any IP protocol.
Matthew Dillon [Thu, 16 Sep 2010 00:40:50 +0000 (17:40 -0700)]
vknetd - Adjust unsecure mode (-U) to also pass any IP protocol.

* When running in unsecure mode all IP protocols will now be passed.

13 years agokernel - Rename the sndtok to sndtok
Samuel J. Greear [Thu, 16 Sep 2010 00:23:41 +0000 (00:23 +0000)]
kernel - Rename the sndtok to sndtok

* After all, they can't both be a rcvtok.

13 years agokernel - Fix MADV_NOSYNC and MAP_NOSYNC, improve vkernel performance
Matthew Dillon [Wed, 15 Sep 2010 20:22:25 +0000 (13:22 -0700)]
kernel - Fix MADV_NOSYNC and MAP_NOSYNC, improve vkernel performance

* The vm_prefault() code was not setting PG_NOSYNC so only 1/4 of the
  pages of a NOSYNC memory mapping were actually NOSYNC.

* This bug caused the vkernel to essentially flush out all of its
  dirty memory pages every 30 seconds.  Needless to say this was bad.

  The vkernel can now be run with its memory set in the multiples
  of gigabytes (if you happen to have that much real memory) without
  creating a massive disk load.

13 years agokernel - Increase x86_64 & vkernel kvm, adjust vm_page_array mapping
Matthew Dillon [Wed, 15 Sep 2010 20:17:18 +0000 (13:17 -0700)]
kernel - Increase x86_64 & vkernel kvm, adjust vm_page_array mapping

* Change the vm_page_array and dmesg space to not use the DMAP area.
  The space could not be accessed by userland kvm utilities due
  to that issue.

  TODO - reoptimize to use 2M super-pages.

* Auto-size NKPT to accomodate the above changes as vm_page_array[]
  is now mapped into the kernel page tables.

* Increase NKPDPE to 128 PDPs to accomodate machines with large
  amounts of ram.  This increases the kernel KVA space to 128G.

13 years agonetwork - Major netmsg retooling, part 2
Matthew Dillon [Wed, 15 Sep 2010 16:42:06 +0000 (09:42 -0700)]
network - Major netmsg retooling, part 2

* Convert remaining protocols (divert, ipx, mpls, natm).

* Minor code correction in gif (no operational change).

* Remove NS protocol from LINT in preparation for complete removal
  from tree.

13 years agodloader - Add support for kernel_options=""
Alex Hornung [Wed, 15 Sep 2010 11:41:39 +0000 (13:41 +0200)]
dloader - Add support for kernel_options=""

* Add back the support to specify kernel_options a la
  kernel_options="-v -a".

Reported-by: Sascha Wildner (swildner@)
13 years agodloader - Allow foo_name for modules
Alex Hornung [Wed, 15 Sep 2010 11:07:11 +0000 (13:07 +0200)]
dloader - Allow foo_name for modules

* Allow a foo_name apart from foo_load and foo_type to specify the
  actual file name (module name) to load.

* This fixes the acpi dsdt overrides.

Reported-by: Sascha Wildner (swildner@)
13 years agodloader - Allow foo_type for modules
Alex Hornung [Wed, 15 Sep 2010 10:41:01 +0000 (12:41 +0200)]
dloader - Allow foo_type for modules

* Allow a foo_type apart from foo_load to specify the type of the module
  to be loaded.

* This fixes the use of md_image type for md preloads, and this in turn
  fixes the initrd system.

Reported-by: Matthias Schmidt (matthias@)
13 years agomkinitrd - Adjust initrd.img path to new loader
Alex Hornung [Wed, 15 Sep 2010 09:30:23 +0000 (11:30 +0200)]
mkinitrd - Adjust initrd.img path to new loader

* Adjust the path where to install the initrd.img to /boot/kernel, to be
  compatible with dloader.

Reported-by: Matthias Schmidt (matthias@)
13 years agosyscons(4): Move tty token release and acquirement around Debugger().
Sascha Wildner [Wed, 15 Sep 2010 09:37:27 +0000 (11:37 +0200)]
syscons(4): Move tty token release and acquirement around Debugger().

13 years agoips - Issue IPS_CACHE_FLUSH_CMD to the controller on BUF_CMD_FLUSH
YONETANI Tomokazu [Wed, 15 Sep 2010 05:07:56 +0000 (14:07 +0900)]
ips - Issue IPS_CACHE_FLUSH_CMD to the controller on BUF_CMD_FLUSH

Previously, BUF_CMD_FLUSH ended up as a zero-byte write command, which
always fails, flooding the console with `iobuf error 5'.  Filesystems
other than HAMMER almost never issues this command, so we've never
seen the error message in pre-HAMMER days.  This commit adds a new path
for BUF_CMD_FLUSH and issue IPS_CACHE_FLUSH_CMD for it.

Also mention the tunable/sysctl knob debug.ips.ignore_flush_cmd in ips(4)
man page in case the new behavior confuses your controller; when set, the
driver just discards BUF_CMD_FLUSH.

13 years agoMake it easier to find proper manual page for newer ServeRAID controllers.
YONETANI Tomokazu [Wed, 15 Sep 2010 05:07:53 +0000 (14:07 +0900)]
Make it easier to find proper manual page for newer ServeRAID controllers.

Obtained-From: FreeBSD r196701

13 years agoips - Add Adaptec ServeRAID 7x IDs. IDs taken from Linux.
YONETANI Tomokazu [Wed, 15 Sep 2010 05:07:50 +0000 (14:07 +0900)]
ips - Add Adaptec ServeRAID 7x IDs. IDs taken from Linux.

Taken-from: FreeBSD r163024, r163995

13 years agonetwork - Protect so_rcv sockbuf in udp and unix domain protocols
Matthew Dillon [Wed, 15 Sep 2010 03:47:10 +0000 (20:47 -0700)]
network - Protect so_rcv sockbuf in udp and unix domain protocols

* The so_rcv sockbuf was not being locked against the user side
  when the unix and udp protocols appended to it, resulting in
  assertions.

13 years agonetwork - Increase basic mbuf size from 256 to 384 bytes
Matthew Dillon [Wed, 15 Sep 2010 03:19:17 +0000 (20:19 -0700)]
network - Increase basic mbuf size from 256 to 384 bytes

* Due to the bloat in m_hdr and m_pkthdr the 256-byte mbuf structure
  is no longer large enough and there appears to be quite a bit of
  legacy code still using m_get() and making assumptions on the
  available space without checking actual space.

  We have assertions in place to catch these but stabilizing the
  system is more important right now.

* Increase the basic mbuf buffer size from 256 to 384 bytes.

13 years agonetwork - Major netmsg retooling, part 1
Matthew Dillon [Tue, 14 Sep 2010 23:28:53 +0000 (16:28 -0700)]
network - Major netmsg retooling, part 1

* Remove all the netmsg shims and make all pr_usrreqs and some proto->pr_*
  requests directly netmsg'd.

* Fix issues with tcp implied connects and tcp6->tcp4 fallbacks with
  implied connects.

* Fix an issue with a stack-based udp netmsg (allocate it)

* Consolidate struct ip6protosw and struct protosw into a single
  structure and normalize the API functions which differed between
  the two (primarily proto->pr_input()).

* Remove protosw->pr_soport()

* Replace varargs protocol *_input() functions (ongoing) with fixed
  arguments.

13 years agovkernel - Improve memory image file startup
Matthew Dillon [Tue, 14 Sep 2010 22:59:28 +0000 (15:59 -0700)]
vkernel - Improve memory image file startup

* Remove the code that pre-filled a memory image file with zeros.  It's
  completely worthless, particularly with HAMMER.

* On startup truncate the memory file to 0 and then extend to the
  memory size, deleting any backing store from the prior vkernel run.
  The new file will start out full of holes.

  This greatly improves vkernel startup time.

13 years agotwa(4): Sync with FreeBSD (twa(4) version 3.80.06.003).
Sascha Wildner [Tue, 14 Sep 2010 19:48:10 +0000 (21:48 +0200)]
twa(4): Sync with FreeBSD (twa(4) version 3.80.06.003).

Thanks to Xin Li for notifying me of this update.

Tested-by: Damian Lubosch <dl@xiqit.de>
13 years agoie(4): This driver is ISA only, so remove some unneeded files from SRCS.
Sascha Wildner [Tue, 14 Sep 2010 18:03:10 +0000 (20:03 +0200)]
ie(4): This driver is ISA only, so remove some unneeded files from SRCS.

13 years agopf: Make pf work w/ the MPSAFE network stack
Jan Lentfer [Sat, 11 Sep 2010 22:34:08 +0000 (00:34 +0200)]
pf: Make pf work w/ the MPSAFE network stack

   add pf_token where appropriate

   in pf_socket_lookup() use lwkt_domsg() instead of lwkt_sendmsg()
   to make race conditions more unlikely

   if_pfsyn.c: re-add lost init code

13 years agopf: Revert commit 5165ac2
Jan Lentfer [Sat, 11 Sep 2010 18:50:32 +0000 (20:50 +0200)]
pf: Revert commit 5165ac2

    I was too hasty changing byte ordering when trying
    to track down a NAT problem

13 years agoACPI P-State: Force P-State to use the first usable entry in P-State table
Sepherosa Ziehau [Tue, 14 Sep 2010 14:26:47 +0000 (22:26 +0800)]
ACPI P-State: Force P-State to use the first usable entry in P-State table

It looks like on certain boxes P-State will be set to the last usable
P-State (i.e. lowest frequency)

13 years agoACPI P-State: When there is no _PSD, create one CPU domain for each CPU
Sepherosa Ziehau [Tue, 14 Sep 2010 13:43:14 +0000 (21:43 +0800)]
ACPI P-State: When there is no _PSD, create one CPU domain for each CPU

13 years agotest commit
Sepherosa Ziehau [Tue, 14 Sep 2010 13:29:00 +0000 (21:29 +0800)]
test commit

13 years agonetwork - UDP currently only going to one proto thread
Matthew Dillon [Tue, 14 Sep 2010 01:40:54 +0000 (18:40 -0700)]
network - UDP currently only going to one proto thread

* Adjust udp_addrcpu() to always return cpu 0 for now, the UDP
  implementation currently only operates on protocol thread 0.

13 years agonetwork - Protect soreceive() from backend
Matthew Dillon [Tue, 14 Sep 2010 01:40:22 +0000 (18:40 -0700)]
network - Protect soreceive() from backend

* Somehow I missed the token required in soreceive() to protect it from
  the backend.

13 years agonetwork - Fix udp self-referential panic
Matthew Dillon [Tue, 14 Sep 2010 00:04:03 +0000 (17:04 -0700)]
network - Fix udp self-referential panic

* udp_ctlinput() can't call domsg, it has to start the chain going with
  lwkt_sendmsg().

* Currently udp only runs on protocol thread cpu 0.

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

13 years agokernel - swapoff - regenerate system calls
Matthew Dillon [Mon, 13 Sep 2010 23:50:55 +0000 (16:50 -0700)]
kernel - swapoff - regenerate system calls

* Added swapoff, regenerate system calls.

13 years agoKernel - Implement swapoff
Matthew Dillon [Mon, 13 Sep 2010 23:41:40 +0000 (16:41 -0700)]
Kernel - Implement swapoff

* Generally port of the swapoff implementation from FreeBSD to DragonFly,
  with major modifications.

  Modifications to handle swapcache issues (VCHR vnodes with VM objects
  can have swap associations for swapcache).

* Libkvm changes

    So there are two problems with libkvm. The first is not really
    swapoff-related - the new sysctl way of reporting numbers bzero'es
    swap_max elements in the given swap_ary array. This is in contrast to
    the old kvm way, which bzero'es only those elements that will be
    actually filled. So if we have 3 swap devices and swap_max is 16, then
    the sysctl code will zero out all 16 elements and fill the first 4,
    while the old kvm code will zero out exactly 4 elements and fill them.
    Since we want to keep API stable (I learned it the hard way :-) ) I
    think this fix can be separated out and go to master as a bugfix to the
    newly introduced sysctl way of reporting things.

    The second problem only shows up if we introduce a swapoff syscall
    and enforce using of the old kvm way. It was written with the
    assumption that swap devices can only be added, not removed - it
    assumes than if I have a swap device with index 3, 4 swap
    devices are active. This is not true with swapoff - I can swapon
    A, B, C and D, then swapoff B and C and here we are - I have an
    active swap device with index 3, but only 2 devices are active.

    It turned out to be easier to just rewrite it (based on sysctl way),
    because that assumption was rather deep and everything was based on it.
    Since along with sysctl way per-device swap accounting was introduced,
    the kvm way now uses it instead of scanning blist.

    Which brings us to the last change - blist scanning code is now used
    only for debugging purposes. getswapinfo_radix() is now called only if
    DUMP_TREE flag is set. Pieces that touched swap_ary entries are removed,
    swap_ary and swap_max are no longer passed to scanning code.

    After all that both ways are now working correctly with the regards to
    the swapoff call and the old kvm way (the behaviour is exactly the same,
    all boudary cases were tested, API remains the same). The only (minor)
    difference is that swapctl numbers are a little bit bigger than kvm way
    ones. Thats because kvm way subtracts dmmax (the assumption is that the
    first dmmax is never allocated), and sysctl way does not. I tried to fix
    this, but it turns out that we need to introduce a dmmax sysctl for that.
    So if you want I can add it, but I want to hear from you first (both on
    this thing and my changes to libkvm in general).

* Userspace.  Add swapoff & adjust manual pages.

Note: Bounty project ($300)
Submitted-by: Ilya Dryomov <idryomov@gmail.com>
13 years agoFix some mdoc issues in tcp.4's SEE ALSO.
Sascha Wildner [Mon, 13 Sep 2010 17:52:26 +0000 (19:52 +0200)]
Fix some mdoc issues in tcp.4's SEE ALSO.

13 years agoFix two typos in manual pages and messages.
Sascha Wildner [Mon, 13 Sep 2010 17:08:22 +0000 (19:08 +0200)]
Fix two typos in manual pages and messages.

13 years agobuild - Fix vkernel installation target for /usr/src/test/vkernel
Matthew Dillon [Mon, 13 Sep 2010 15:58:51 +0000 (08:58 -0700)]
build - Fix vkernel installation target for /usr/src/test/vkernel

* Fix the installation target in /usr/src/test/vkernel/Makefile, it
  was assuming the old style /boot kernel layout instead of the new.

13 years agodevfs - Fix use-after-free case when making pty's invisible
Matthew Dillon [Mon, 13 Sep 2010 15:20:16 +0000 (08:20 -0700)]
devfs - Fix use-after-free case when making pty's invisible

* Fix a use-after-free case when making a pty devfs node invisible.
  The dev_dclose().  Move the test/flag to before the dev_dclose() call.

* Document that the pty code may destroy the device in the dev_dclose()
  call, causing the node to become stale.

Reported-by: Francois Tigeot <ftigeot@wolfpond.org>
Reminded-by: sjg
13 years agoFix !INVARANTS build and reformat token asserts for easy reading.
Venkatesh Srinivas [Mon, 13 Sep 2010 11:26:33 +0000 (04:26 -0700)]
Fix !INVARANTS build and reformat token asserts for easy reading.

13 years agonetwork - Fix multiple MP races (2)
Matthew Dillon [Mon, 13 Sep 2010 07:08:53 +0000 (00:08 -0700)]
network - Fix multiple MP races (2)

* MEVENT signaling needs the ssb_token as well as the kq_token for now
  to prevent blocking inside the predicate.  This is a hack for now.

* Add missing porttoken protection in in_pcbremlists().

Reported-by: lentferj
13 years agonetwork - Fix multiple MP races
Matthew Dillon [Mon, 13 Sep 2010 05:33:08 +0000 (22:33 -0700)]
network - Fix multiple MP races

* Fix sonewconn() races.  sonewconn() was attaching prior to changing
  the socket->so_port, relying on the caller to set the socket->so_port.
  This resulted in a race where userland wound up with visibility on the
  socket and could issue commands, like close(), which would end up going
  to the original protocol thread instead of the post-connect protocol thread
  which was handling the sonewconn().

  Thus the close() could message the backend to detach and compete
  against the sonewconn() because the detach message was going to
  a different protocol thread.

* When the socket->so_port is changed the inpcb was not being moved
  from the old pcbinfo->pcblisthead list to the new one, resulting
  in MP races later on during removal.

* Add more debugging kprintf()s.

* Clean up sosetport() use, remove the now-unused *_soport_attach().

Reported-by: Many
13 years agonetwork - remove the redispatch local
Matthew Dillon [Mon, 13 Sep 2010 03:23:22 +0000 (20:23 -0700)]
network - remove the redispatch local

* Remove the resdispatch local variable which is no longer used.

13 years agosavecore: Fix typo in comment.
Peter Avalos [Mon, 13 Sep 2010 02:09:43 +0000 (02:09 +0000)]
savecore: Fix typo in comment.

13 years agonetwork - Add debugging assertions
Matthew Dillon [Sun, 12 Sep 2010 20:14:23 +0000 (13:14 -0700)]
network - Add debugging assertions

* Add some assertions to try to catch failure cases earlier.

13 years agokernel - Fix one-cycle MP race in vshouldmsync()
Matthew Dillon [Sun, 12 Sep 2010 17:30:38 +0000 (10:30 -0700)]
kernel - Fix one-cycle MP race in vshouldmsync()

* vshouldmsync() is the mntvnode fast function, which is called without
  any vnode lock.  vp->v_object can thus get ripped out from under the
  scan function.

  Hold vmobj_token through the scan so any pointer accessed via
  v_object remains stable (even if no longer related to the vnode
  due to the race).

Reported-by: swildner
13 years agopfctl.8: Adjust date.
Sascha Wildner [Sun, 12 Sep 2010 17:12:54 +0000 (19:12 +0200)]
pfctl.8: Adjust date.

13 years agocrashinfo.8: Remove trailing whitespace.
Sascha Wildner [Sun, 12 Sep 2010 17:12:36 +0000 (19:12 +0200)]
crashinfo.8: Remove trailing whitespace.

13 years agonetwork - Assert that the packet's data has not overrrun the buffer in m_free()
Matthew Dillon [Sun, 12 Sep 2010 04:35:14 +0000 (21:35 -0700)]
network - Assert that the packet's data has not overrrun the buffer in m_free()

* Add an assertion to try to catch subsystems which blow up a mbuf's
  data buffer.

13 years agopfctl(8): Fix some printf issues (and buildworld on x86_64).
Sascha Wildner [Sat, 11 Sep 2010 20:55:05 +0000 (22:55 +0200)]
pfctl(8): Fix some printf issues (and buildworld on x86_64).

13 years agonetwork - Fix tcp inpcb race
Matthew Dillon [Sat, 11 Sep 2010 20:37:21 +0000 (13:37 -0700)]
network - Fix tcp inpcb race

* tcbinfo[cpu].porthashbase was being shared across all the cpus,
  creating MP races.  Change it so it isn't shared.

Reported-by: "Samuel J. Greear" <sjg@evilcode.net>
13 years agonetwork - More tokens for ipsec
Matthew Dillon [Sat, 11 Sep 2010 18:53:57 +0000 (11:53 -0700)]
network - More tokens for ipsec

* Get key_token in more places to fix MP races.

13 years agokernel - cleanup & assertions in mbuf code
Matthew Dillon [Sat, 11 Sep 2010 18:52:45 +0000 (11:52 -0700)]
kernel - cleanup & assertions in mbuf code

* Assert the mbuf's next/nextpkt fields are NULL on allocation.

13 years agokernel - Fix mprace in kern_objcache
Matthew Dillon [Sat, 11 Sep 2010 18:50:56 +0000 (11:50 -0700)]
kernel - Fix mprace in kern_objcache

* mag_purge() is interruptable, do not continue the purge
  if the magazine is moved.  For example, the magazine could
  move to the depot and we would wind up continuing to purge
  it without the depot lock.

* Add some temporary debugging

13 years agoRe-add RSS_DEBUG to LINT.
Sascha Wildner [Sat, 11 Sep 2010 16:40:54 +0000 (18:40 +0200)]
Re-add RSS_DEBUG to LINT.

13 years agoFix manual break to debugger
Alex Hornung [Sat, 11 Sep 2010 13:21:23 +0000 (14:21 +0100)]
Fix manual break to debugger

* When manually breaking to debugger, we can't hold any tokens as they
  get in the way of kbdmux' lockmgr in an interrupt context.

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