dragonfly.git
12 years agoAdjust some comment indentation.
Sascha Wildner [Thu, 1 Dec 2011 19:36:28 +0000 (20:36 +0100)]
Adjust some comment indentation.

12 years agoMerge branch 'master' of /repository/git/dragonfly
Venkatesh Srinivas [Thu, 1 Dec 2011 19:12:30 +0000 (11:12 -0800)]
Merge branch 'master' of /repository/git/dragonfly

12 years agokernel - ddb: Print raw instruction pointers in ddb backtrace.
Venkatesh Srinivas [Thu, 1 Dec 2011 19:11:58 +0000 (11:11 -0800)]
kernel - ddb: Print raw instruction pointers in ddb backtrace.

12 years agogold linker 2.22: Unbreak it
John Marino [Thu, 1 Dec 2011 17:32:06 +0000 (18:32 +0100)]
gold linker 2.22: Unbreak it

The trick to avoid rebuilding 6 object files unnecessarily ended up making
the gold linker of binutils 2.22 stop working.  This commit takes them
off of the gold library and back to the gold program, and again to the
incremental-dump program.  Until somebody shows me the way the latter
program can use object files from the former one, we're just going to
build them twice.

12 years agorcrun(8): Teach rcstart, rcstop and friends to handle other rc dirs.
Sascha Wildner [Thu, 1 Dec 2011 17:15:49 +0000 (18:15 +0100)]
rcrun(8): Teach rcstart, rcstop and friends to handle other rc dirs.

This commit makes rcrun(8) and its various incarnations work also with
rc scripts that are in either /usr/pkg/etc/rc.d or /usr/local/etc/rc.d
(the paths in rc.conf's local_startup, actually).

While here, do some cleanup:

* Remove some unneeded 'cd' commands (rcorder as we call it will already
  give the full path to the script)

* Remove extra whitespace at the end of the file

* Add a copyright.

12 years agokernel - Fix race between procfs / proc sysctls and exec, refactor PHOLD/etc
Matthew Dillon [Thu, 1 Dec 2011 04:29:15 +0000 (20:29 -0800)]
kernel - Fix race between procfs / proc sysctls and exec, refactor PHOLD/etc

* During a [v]fork/exec sequence the exec will replace the VM space of the
  target process.  A concurrent 'ps' operation could access the target
  process's vmspace as it was being ripped out, resulting in memory
  corruption.

* The P_INEXEC test in procfs was insufficient, the exec code itself must
  also wait for procfs's PHOLD() on the process to go away before it can
  proceed.  This should properly interlock the entire operation.

* Can occur with procfs or non-procfs ps's (via proc sysctls).

* Possibly related to the seg-fault issue we have where the user stack gets
  corrupted.

* Also revamp PHOLD()/PRELE() and add PSTALL(), changing all manual while()
  loops waiting on p->p_lock to use PSTALL().

  These functions now integrate a wakeup request flag into p->p_lock
  using atomic ops and no longer tsleep() for 1 tick (or hz ticks, or
  whatever).  Wakeups are issued proactively.

12 years agokernel - Minor cleanups
Matthew Dillon [Thu, 1 Dec 2011 01:34:39 +0000 (17:34 -0800)]
kernel - Minor cleanups

* lwkt_wait_free() no longer exists, remove the prototype.

* Reformat a kprintf() in vm/swap_pager.c to not overflow 80 columns.

12 years agokernel - Fix pmap->pm_active race in switch code
Matthew Dillon [Thu, 1 Dec 2011 01:29:35 +0000 (17:29 -0800)]
kernel - Fix pmap->pm_active race in switch code

* Use an atomic cmpxchg to set the cpu bit in the pmap->pm_active bitmap
  AND test the pmap interlock bit at the same time, instead of testing
  the interlock bit afterwords.

* In addition, if we find the lock bit set and must spin-wait for it to
  clear, we skip the %cr3 comparison check and unconditionally load %cr3.

* It is unclear if the race could be realized in any way.  It was probably
  not responsible for the seg-fault issue as prior tests with an unconditional
  load of %cr3 did not fix the problem.  Plus in the same-%cr3-as-last-thread
  case the cpu bit is already set so there should be no possibility of
  losing a TLB interlock IPI (and %cr3 is loaded unconditionally when it
  doesn't match, so....).

  But fix the race anyway.

12 years agokernel - Add requires p->p_token locking and holds around fork()'s child proc
Matthew Dillon [Thu, 1 Dec 2011 01:24:11 +0000 (17:24 -0800)]
kernel - Add requires p->p_token locking and holds around fork()'s child proc

* fork() and vfork() allocate a new process, p2, initialize, and add it to
  the allproc list as well as other lists.

* These functions failed to acquire p2's token, p2 becomes visible to the
  rest of the system when it's added to the allproc list.  Even though p2's
  state is set to SIDL, this is insufficient protection.

  Acquire the token prior to adding p2 to allproc and keep holding the token
  until after we have finished initializing p2.

* We must also PHOLD()/PRELE() p2 around the start_forked_proc() call
  to prevent it from getting ripped out from under us (if it exits
  quickly and/or detaches itself from its parent).

* Possibly fixes the random seg-faulting issue we've seen under very heavy
  fork/exec (parallel compile) loads on the 48-core monster.

12 years agokernel - Fix minor bug in last swapcache commit
Matthew Dillon [Wed, 30 Nov 2011 22:28:25 +0000 (14:28 -0800)]
kernel - Fix minor bug in last swapcache commit

* Fix an issue where the marker could get stuck at the end of the
  vm_object_list and stop the cleaning process.

12 years agokernel - Add missing lwkt_switch_return() call to pcb_ext path
Matthew Dillon [Wed, 30 Nov 2011 20:04:10 +0000 (12:04 -0800)]
kernel - Add missing lwkt_switch_return() call to pcb_ext path

* Add missing lwkt_switch_return() call to pcb_ext path

* This path is only used when a program accesses /dev/io (basically
  none in normal system operation).

12 years agokernel - swtch.s cleanup
Matthew Dillon [Wed, 30 Nov 2011 20:03:27 +0000 (12:03 -0800)]
kernel - swtch.s cleanup

* Cleanup the code a bit, no functional changes.

12 years agomkdir - Fix MP race in mkdir -p
Matthew Dillon [Wed, 30 Nov 2011 17:52:08 +0000 (09:52 -0800)]
mkdir - Fix MP race in mkdir -p

* mkdir -p can race other mkdir -p commands

* Do the same fix that we did for xinstall... if the mkdir() fails after
  the stat() check, stat() again to see if the directory creation raced.

12 years agoxinstall - Fix bug in last commit
Matthew Dillon [Wed, 30 Nov 2011 17:51:38 +0000 (09:51 -0800)]
xinstall - Fix bug in last commit

* Fix bug in last commit, the mode to create with is nmode, not mode.

12 years agotcp6: Implement pru_savefaddr
Sepherosa Ziehau [Wed, 30 Nov 2011 13:52:12 +0000 (21:52 +0800)]
tcp6: Implement pru_savefaddr

12 years agokernel - Fix fragmentation and object list scan bug in swapcache
Matthew Dillon [Wed, 30 Nov 2011 04:46:03 +0000 (20:46 -0800)]
kernel - Fix fragmentation and object list scan bug in swapcache

* When swapcache reaches maxswappct (typically 75% of swap) it reduces
  swap use before allowing it to continue to build again, with some
  hysteresis.

* The cleanup phase which reduces swap use was seriously fragmenting swap
  space by cleaning up too small a portion of each VM object.

* Increase the amount cleaned up before moving onto the next VM object.

* Fix bugs in the vm_object_list traversal which could result in a bad
  object being accessed followed by a panic.

12 years agokernel - Fix a few edge cases in subr_blist.c
Matthew Dillon [Wed, 30 Nov 2011 04:41:20 +0000 (20:41 -0800)]
kernel - Fix a few edge cases in subr_blist.c

* In the all-allocated special case set bm_bighint to 0 instead of to
  count.  This fixes an edge case where failed allocations wind up
  traversing too much of the radix tree.

* In the all-free special case be sure to set bm_bighint to the radix,
  higher layers check bm_bighint when recursing.  (This bug could not occur
  unless you had 4 swap devices configured).

* Improve code documentation and minor cleanups.

12 years agolibkvm - Enhance swapinfo dump
Matthew Dillon [Wed, 30 Nov 2011 02:20:05 +0000 (18:20 -0800)]
libkvm - Enhance swapinfo dump

* pstat -ss dumps the swap space radix tree, do additional checks and
  dump more information.

12 years agodmesg - Don't fail when the kernel is adding to the dmesg quickly
Matthew Dillon [Tue, 29 Nov 2011 21:41:54 +0000 (13:41 -0800)]
dmesg - Don't fail when the kernel is adding to the dmesg quickly

* If the kernel is quickly adding to the dmesg buffer and has not started
  recycling the FIFO the increasing size of the buffer will exceed the
  probed size.

* Add another 4K to the probed size to try to deal with this case.

12 years agobuild - Significantly improve parallel buildworld times
Matthew Dillon [Tue, 29 Nov 2011 21:38:34 +0000 (13:38 -0800)]
build - Significantly improve parallel buildworld times

* Change the serialized command sequence used for bootstrap tools,
  btools, and ctools into dependencies so buildworld can build them
  concurrently.

* Utilize the new SUBDIR concurrent build feature by specifying
  a SUBDIR_ORDERED make variable (usually empty) in various high-level
  Makefile's.

12 years agobuild - Support concurrent SUBDIR traversal, fix make depend bug
Matthew Dillon [Tue, 29 Nov 2011 21:34:03 +0000 (13:34 -0800)]
build - Support concurrent SUBDIR traversal, fix make depend bug

* Support concurrent SUBDIR traversals during a make -j N.

  Create individual targets for each target/directory combination so Make
  will run them in parallel when possible.

* SUBDIR_ORDERED, if it exists, indicates the subset of SUBDIR which must
  be ordered.  Any directories not mentioned can run concurrently.

* If SUBDIR_ORDERED does not exist at all then all directories default
  to being strongly ordered and will NOT run concurrently.

* Try to make sure that all include files and generated source files
  are generated before running the depend core.

12 years agobuild - install should not complain if the mkdir() races
Matthew Dillon [Tue, 29 Nov 2011 21:32:27 +0000 (13:32 -0800)]
build - install should not complain if the mkdir() races

* install should not complain if the mkdir() races

* A make -j N can cause concurrent install's to race their mkdir() calls.

12 years agobuildworld - Fix parallel build race in ncurses
Matthew Dillon [Tue, 29 Nov 2011 20:40:49 +0000 (12:40 -0800)]
buildworld - Fix parallel build race in ncurses

* Generated files must depend on headers during make depend step
  (at the very least), because make has no idea about the dependencies
  during that step.

12 years agobuildworld: Be more relaxed with which binutils are on the host.
Sascha Wildner [Tue, 29 Nov 2011 17:50:26 +0000 (18:50 +0100)]
buildworld: Be more relaxed with which binutils are on the host.

If the building world has a new binutils version (which at this
point isn't yet on the host), don't make assumptions about what
binutils version is on the host.

Instead, just take from /usr/libexec/binutils* the one with the
highest version number.

12 years agoaccept: Save foreign address earlier, if protocol supports it
Sepherosa Ziehau [Tue, 29 Nov 2011 13:38:34 +0000 (21:38 +0800)]
accept: Save foreign address earlier, if protocol supports it

- Add so_faddr into socket, which records the accepted socket's foreign
  address.  If it is set, kern_accept() will use it directly instead of
  calling protocol specific method to extract the foreign address.
- Add protocol specific method, pru_safefaddr, which will save the
  foreign address into socket.so_faddr if the necessary information is
  supplied.  This protocol method will only be called in protocol
  thread.
- Pass the foreign address to sonewconn() if possible, so the foreign
  address could be saved before the accepted socket is put onto the
  complete list.

Currently only IPv4/TCP implemented pru_savefaddr

This intends to address the following problems:
- Calling pru_accept directly from user context is not MPSAFE, we
  always races the socket.so_pcb check->use against protocol thread
  clear/free socket.so_pcb, though the race window is too tiny to
  be hit.  To make it mpsafe, we should dispatch pru_accept to
  protocol thread.
  If socket.so_faddr is set here, we are race against nothing and
  nothing expensive like put the current user thread into sleep will
  happen.  However, if the socket is dropped when it still sits
  on the complete list, the error will not be timely delivered, i.e.
  accept(2) will not return error, but the later on read(2)/write(2)
  on the socket will deliver the error.
- Calling pru_accept directly races against the inpcb.inp_f{addr,port}
  setting up in the protocol thread, since inpcb.inp_f{addr,port} is
  setup _after_ the accepted socket was put onto the complete list.

     user thread                  proto thread
          :                             :
          :                  accepted socket -> comp
          :             (inpcb.inp_f{addr,port} are 0 here)
    comp -> socket                      :
     pru_accept                         :
          :                setup inpcb.inp_f{addr,port}

  Returning of 0.0.0.0:0 from accept(2) was observed on heavily loaded
  web servers.

12 years agokernel - Fix race in multi-LWP exit
Matthew Dillon [Tue, 29 Nov 2011 06:13:38 +0000 (22:13 -0800)]
kernel - Fix race in multi-LWP exit

* Fix a very small race condition after TDF_EXITING could get set where a
  LWPs thread could get destroyed by another cpu (reaping it) before
  the thread actually finished exiting.

* Clean up a case where we were improperly testing TDF_RUNQ which could
  result in unnecessary 1-tick delays in exit reaping.

* Beef up the assertion when TDF_EXITING is found to be set that
  both TDF_RUNQ and TDF_TSLEEPQ are not set (before it was just checking
  TDF_TSLEEPQ).

* Clean up reaplwp().

* Remove lwkt_wait_free()

* lwkt_free_thread() now waits for td_refs to drop to 0 before freeing
  the thread.

12 years agokernel - Add required vm_token back in to swaponvp()
Matthew Dillon [Tue, 29 Nov 2011 06:10:29 +0000 (22:10 -0800)]
kernel - Add required vm_token back in to swaponvp()

* This case is not normally hit unless you try to add new swap space
  while the machine is already heavily paging to or from swap.

* The blist operations and vm_swap_size variable manipulation needs
  the token.

* Clean-up the exit code by creating a common exit code section.

12 years agokernel - Check PG_MARKER in pmap_object_init_pt_callback()
Matthew Dillon [Tue, 29 Nov 2011 06:08:40 +0000 (22:08 -0800)]
kernel - Check PG_MARKER in pmap_object_init_pt_callback()

* All PG_MARKER pages are also PG_BUSY so the code was already handling
  the case, but checking for PG_MARKER is the official way to check for
  a marker so do that too.

12 years agokernel - RB_SCAN() requires a short-term spinlock
Matthew Dillon [Tue, 29 Nov 2011 06:03:23 +0000 (22:03 -0800)]
kernel - RB_SCAN() requires a short-term spinlock

* RB_SCAN() links and unlinks an info structure.  If called with a shared
  lock the linking and unlinking operations requires a very short-term spin
  lock to avoid clobbering each other.

* Note that RB_REMOVE() scans the inprog list but this function can only
  be safely called with the RB tree held exclusively anyway, so there's
  no need to spinlock the info list.

* Add kern/subr_rbtree.c glue functions for acquiring and releasing the
  spinlock, so sys/tree.h only needs to include sys/spinlock.h and not
  also sys/spinlock2.h

Reported-by: sephe
12 years agokernel - Attempt to fix early release panic w/USB's sim.
Matthew Dillon [Tue, 29 Nov 2011 05:14:45 +0000 (21:14 -0800)]
kernel - Attempt to fix early release panic w/USB's sim.

* Acquire the CAM_SIM lock when called via the callout, and don't
  acquire the lock when we already hold it via the xpt_dev_async() path.

Reported-by: JustinS
12 years ago<sys/rman.h>: rman_get_rid() macro takes one parameter only.
Sascha Wildner [Mon, 28 Nov 2011 19:06:41 +0000 (20:06 +0100)]
<sys/rman.h>: rman_get_rid() macro takes one parameter only.

12 years agox86_64/pmap: Remove an unused function.
Sascha Wildner [Mon, 28 Nov 2011 19:06:02 +0000 (20:06 +0100)]
x86_64/pmap: Remove an unused function.

12 years agoldns: Update local files for update to 1.6.11
Jan Lentfer [Mon, 28 Nov 2011 15:58:25 +0000 (16:58 +0100)]
ldns: Update local files for update to 1.6.11

12 years agoMerge branch 'vendor/LDNS'
Jan Lentfer [Mon, 28 Nov 2011 12:52:48 +0000 (13:52 +0100)]
Merge branch 'vendor/LDNS'

12 years agoldns: Removed empty file common.h
Jan Lentfer [Mon, 28 Nov 2011 12:48:06 +0000 (13:48 +0100)]
ldns: Removed empty file common.h

12 years agoldns: Update vendor branch to 1.6.11
Jan Lentfer [Mon, 28 Nov 2011 09:57:30 +0000 (10:57 +0100)]
ldns: Update vendor branch to 1.6.11

This fixes a severe bug (CVE-2011-3581)

12 years agolibc -- Remove assembler i386 strlen() routine.
Venkatesh Srinivas [Sun, 27 Nov 2011 17:57:36 +0000 (09:57 -0800)]
libc -- Remove assembler i386 strlen() routine.

On a number of processors, it is slower than the obvious C version.
(400,000,000 loops, times in sec)

On a 2.66 GHz Core 2:
                asm     C
10-by string    22.9    9.5
68-by string    77.2    19.8
175-by string   173.7   40.6

On a 2.0 GHz Athlon64 3000+:
                asm     C
10-by string    11.3    9.9
68-by string    34.7    34.7
175-by string   78.7    77.6

On a 2.2 GHz Core i7 (nehalem):
                asm     C
10-by string    13.4    5.2
68-by string    33.8    29.5
175-by string   71.6    67.4

12 years agokernel -- ktrace: Fix possible one-word stack leak to userspace.
Venkatesh Srinivas [Sun, 27 Nov 2011 17:16:45 +0000 (09:16 -0800)]
kernel -- ktrace: Fix possible one-word stack leak to userspace.

From OpenBSD kern_ktrace.c 1.55, via Loganaden Velvindron.

12 years agox86_64/ioapic_abi: Implement MachIntrABI.rman_setup
Sepherosa Ziehau [Sun, 27 Nov 2011 13:49:16 +0000 (21:49 +0800)]
x86_64/ioapic_abi: Implement MachIntrABI.rman_setup

12 years agotest: from lancer
Sepherosa Ziehau [Sun, 27 Nov 2011 11:16:41 +0000 (19:16 +0800)]
test: from lancer

12 years agotest: from xanadu64
Sepherosa Ziehau [Sun, 27 Nov 2011 11:13:03 +0000 (19:13 +0800)]
test: from xanadu64

12 years agotest: from enigma
Sepherosa Ziehau [Sun, 27 Nov 2011 11:09:54 +0000 (19:09 +0800)]
test: from enigma

12 years agoUnbreak buildworld
Thomas Nikolajsen [Sun, 27 Nov 2011 08:20:38 +0000 (09:20 +0100)]
Unbreak buildworld

12 years agobinutils 2.20: remove source files
John Marino [Sat, 26 Nov 2011 09:23:14 +0000 (10:23 +0100)]
binutils 2.20: remove source files

Binutils 2.20 has not been building for a month, but the source files
were still present in case we wanted to switch it back on.

Per IRC discussion, the general consensus is that DragonFly wants to
continue to maintain two sets of binutils in addition to two compilers.
A new vendor branch has been created, vendor/BINUTILS-ALL, and
binutils 2.20 is the first version to go into this branch.  All future
versions of binutils will also go into this branch rather than create
a new vendor branch each time.  Everything else including objformat
and the naming scheme will remain as it was.  The idea is that the
newest version of binutils is always "prime" and the older version is
the backup which does not require updating.  When a new version of
binutils is brought in, the previous backup version will be deleted.
That's what is happening with binutils version 2.20 today.

12 years agobinutils 2.22: Promote to primary binutils
John Marino [Fri, 25 Nov 2011 23:14:58 +0000 (00:14 +0100)]
binutils 2.22: Promote to primary binutils

12 years agobinutils 2.22: Activate building in world
John Marino [Fri, 25 Nov 2011 23:05:34 +0000 (00:05 +0100)]
binutils 2.22: Activate building in world

The next commit will change the default to make binutils 2.22 prime
and demote binutils 2.21 to be the backup.

12 years agobinutils 2.22: Add makefiles, new incremental-dump binary
John Marino [Fri, 25 Nov 2011 22:42:29 +0000 (23:42 +0100)]
binutils 2.22: Add makefiles, new incremental-dump binary

The makefiles and headers for binutils 2.22 are similar to those of
binutils 2.21 with the exception of the restructuring of the gold
build.  A dedicated include file was created, and several files were
moved to libgold.  This was done to avoid redundant compiling of
object files in common between ld.gold and incremental-dump.  The
latter was never built before although the source was previously
available.

12 years agobinutils 2.22: Add READMEs and local modifications
John Marino [Fri, 25 Nov 2011 22:30:41 +0000 (23:30 +0100)]
binutils 2.22: Add READMEs and local modifications

12 years agoMerge branch 'vendor/BINUTILS_ALL'
John Marino [Sat, 26 Nov 2011 11:44:16 +0000 (12:44 +0100)]
Merge branch 'vendor/BINUTILS_ALL'

12 years agoInitial import of binutils 2.22 on the new vendor branch gitea/vendor/BINUTILS_ALL origin/vendor/BINUTILS_ALL
John Marino [Sat, 26 Nov 2011 11:42:21 +0000 (12:42 +0100)]
Initial import of binutils 2.22 on the new vendor branch

Future version of binutils will also reside on this branch rather
than continuing to create new binutils branches for each version.

12 years agoRevert "Merge branch 'vendor/BINUTILS-ALL'"
John Marino [Sat, 26 Nov 2011 11:05:52 +0000 (12:05 +0100)]
Revert "Merge branch 'vendor/BINUTILS-ALL'"

This reverts commit 92a1e2d9549ce76d785444d000d358126cf7762f, reversing
changes made to 2b195d6a566cb8441f5d6d66363235683bbd92af.

12 years agoRevert "binutils 2.22: Add READMEs and local modifications"
John Marino [Sat, 26 Nov 2011 11:04:00 +0000 (12:04 +0100)]
Revert "binutils 2.22: Add READMEs and local modifications"

This reverts commit ca679fdaaa1df38750514ba8786c627ce15864d0.

12 years agoRevert "binutils 2.22: Add makefiles, new incremental-dump binary"
John Marino [Sat, 26 Nov 2011 11:03:59 +0000 (12:03 +0100)]
Revert "binutils 2.22: Add makefiles, new incremental-dump binary"

This reverts commit d83cfc8d85b905d12358d755882d57f95b2a0f48.

12 years agoRevert "binutils 2.22: Activate building in world"
John Marino [Sat, 26 Nov 2011 11:03:57 +0000 (12:03 +0100)]
Revert "binutils 2.22: Activate building in world"

This reverts commit e8402471895f5f3b9bc77fde77d732db0feea249.

12 years agoRevert "binutils 2.22: Promote to primary binutils"
John Marino [Sat, 26 Nov 2011 11:03:54 +0000 (12:03 +0100)]
Revert "binutils 2.22: Promote to primary binutils"

This reverts commit c2e570e14a87f984d27b71ec02365064555dee87.

12 years agobinutils 2.22: Promote to primary binutils
John Marino [Fri, 25 Nov 2011 23:14:58 +0000 (00:14 +0100)]
binutils 2.22: Promote to primary binutils

12 years agobinutils 2.22: Activate building in world
John Marino [Fri, 25 Nov 2011 23:05:34 +0000 (00:05 +0100)]
binutils 2.22: Activate building in world

The next commit will change the default to make binutils 2.22 prime
and demote binutils 2.21 to be the backup.

12 years agobinutils 2.22: Add makefiles, new incremental-dump binary
John Marino [Fri, 25 Nov 2011 22:42:29 +0000 (23:42 +0100)]
binutils 2.22: Add makefiles, new incremental-dump binary

The makefiles and headers for binutils 2.22 are similar to those of
binutils 2.21 with the exception of the restructuring of the gold
build.  A dedicated include file was created, and several files were
moved to libgold.  This was done to avoid redundant compiling of
object files in common between ld.gold and incremental-dump.  The
latter was never built before although the source was previously
available.

12 years agobinutils 2.22: Add READMEs and local modifications
John Marino [Fri, 25 Nov 2011 22:30:41 +0000 (23:30 +0100)]
binutils 2.22: Add READMEs and local modifications

12 years agoMerge branch 'vendor/BINUTILS-ALL'
John Marino [Sat, 26 Nov 2011 08:32:25 +0000 (09:32 +0100)]
Merge branch 'vendor/BINUTILS-ALL'

12 years agoInitial import of binutils 2.22 on the new vendor branch
John Marino [Sat, 26 Nov 2011 08:27:44 +0000 (09:27 +0100)]
Initial import of binutils 2.22 on the new vendor branch

Future versions of binutils will also reside on this branch rather
than continuing to create new binutils branches for each new version.

12 years agox86_64/ioapic_abi: Disable interrupt load balance by default
Sepherosa Ziehau [Fri, 25 Nov 2011 06:17:43 +0000 (14:17 +0800)]
x86_64/ioapic_abi: Disable interrupt load balance by default

Add hw.ioapic.gsi.balance tunable to enable/disable interrupt
load balance.  It is disabled by default.

12 years agoaccept: Implement fast soaccept predication
Sepherosa Ziehau [Thu, 24 Nov 2011 05:53:54 +0000 (13:53 +0800)]
accept: Implement fast soaccept predication

Fast soaccept predication tries to run soaccept_predicate before
domsg to the proto-thread, i.e. put the current thread into sleep.

We could do this because listen socket's completion list is always
protected by the listen socket's pool-token.  Domsg to proto-thread
to extract socket from completion list for non-block listen socket
does not make any sense.  Even for blocking listen socket if there
are sockets on the completion list, domsg to the proto-thread to
extract socket from completion list also wastes time.

The result:

192.168.249.42 (Xeon E3-1230 HT enabled, 16G) runs httperf
192.168.249.29 (i7-2600 HT enabled, 16G) runs nginx (web server)

The server runs nginx-1.0.4 (from pkgsrc-2011Q2), using the default
configure w/ following changes:
events {
    worker_connections  10240;
    use kqueue;
}

The client runs httperf-0.9.0 manually compiled w/ FD_SETSIZE to 16424
The client machine runs following commands before starting benching:
net.inet.ip.portrange.last=60000
route change -net 192.168.249.0/24 -msl 500

16 parallel httperf --server=192.168.249.29 --wsess=5000,1,1 --max-conn=4
4 runs (Request rate, unit: req/s)

old  23554.0  23542.0  23557.0  23526.2
new  24793.7  24809.9  24792.7  24794.4

This gives 5.3% performance improvement

12 years agobce: Use MPSAFE callout
Sepherosa Ziehau [Mon, 21 Nov 2011 05:46:13 +0000 (13:46 +0800)]
bce: Use MPSAFE callout

12 years ago<ucontext.h>: For now, mark *context() as i386 only.
Sascha Wildner [Wed, 23 Nov 2011 20:36:28 +0000 (21:36 +0100)]
<ucontext.h>: For now, mark *context() as i386 only.

Note that is not intended as an argument against implementing the
missing functions on x86_64. It just isn't nice to have prototypes
for missing functions.

Suggested-by: pavalos
12 years agoRemove /usr/X11R6/... paths from various config and default files.
Sascha Wildner [Wed, 23 Nov 2011 18:10:36 +0000 (19:10 +0100)]
Remove /usr/X11R6/... paths from various config and default files.

Reported-by: ftigeot
12 years agoSync 'make distribution' with an upgraded system, file-wise.
Sascha Wildner [Wed, 23 Nov 2011 17:58:15 +0000 (18:58 +0100)]
Sync 'make distribution' with an upgraded system, file-wise.

Two symlinks in /usr/include/machine are created via 'make upgrade' for
historical reasons detailed in a8f70ff21e2ea644b109f4ecb198b6cfa6fef8dc.

Add the creation of those to 'make distribution' too, so that a fresh
system off the CD has them. At some later point, we can remove it from
upgrade.

Reported-by: marino
12 years agoi386/cpufunc.h: Adjust opcodes which are specified as ".byte 0xNN, 0xMM".
Sascha Wildner [Tue, 22 Nov 2011 03:34:57 +0000 (04:34 +0100)]
i386/cpufunc.h: Adjust opcodes which are specified as ".byte 0xNN, 0xMM".

This was from the days when older assemblers wouldn't recognize the
new Pentium instructions.

Taken-from: FreeBSD

12 years agonwfs - Use global ncpus
Antonio Huete Jimenez [Tue, 22 Nov 2011 00:41:03 +0000 (01:41 +0100)]
nwfs - Use global ncpus

No need to use a sysctl call to get hw.ncpu when we
have the ncpus global from systm.h

12 years agoBump __DragonFly_version after new functions added to libc
John Marino [Mon, 21 Nov 2011 22:32:58 +0000 (23:32 +0100)]
Bump __DragonFly_version after new functions added to libc

12 years agolibc: Add wcsncasecmp function
John Marino [Mon, 21 Nov 2011 22:30:09 +0000 (23:30 +0100)]
libc: Add wcsncasecmp function

This function performs a case-insensitive string comparison test of
not more than a specified number of wide characters.  It is a GNU
extension, not POSIX.  Some packages in pkgsrc may require it.

12 years agolibc: Add wcscasecmp function
John Marino [Mon, 21 Nov 2011 22:13:43 +0000 (23:13 +0100)]
libc: Add wcscasecmp function

This function performs a case-insensitive string comparison test on
wide characters.  It is a GNU extension, not POSIX.  Some packages
in pkgsrc require it.

12 years agokernel -- nata: Raise ATA timeout for FLUSHCACHE requests.
Venkatesh Srinivas [Mon, 21 Nov 2011 23:09:38 +0000 (15:09 -0800)]
kernel -- nata: Raise ATA timeout for FLUSHCACHE requests.

(S)ATA devices may take longer than the default ata timeout to respond to
FLUSHCACHE requests, particularly when they are spinning-up. Seen with
Western Digital Caviar Green SATA disks.

From: FreeBSD PR 136182 (http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/136182)

12 years agodfr2text, tbridge.9 - fix typos/etc
Alex Hornung [Mon, 21 Nov 2011 20:55:31 +0000 (20:55 +0000)]
dfr2text, tbridge.9 - fix typos/etc

12 years agoDisable aps(4) in the GENERIC kernels.
Sascha Wildner [Mon, 21 Nov 2011 11:09:39 +0000 (12:09 +0100)]
Disable aps(4) in the GENERIC kernels.

Its probe routine doesn't play nice with the Intel S5520SC motherboard.
Until that is properly fixed, disable it as it is not strictly needed.

Reported-by: Michael Kosarev <russiane39@gmail.com>
12 years agotest commit
Sascha Wildner [Mon, 21 Nov 2011 09:50:48 +0000 (10:50 +0100)]
test commit

12 years agokernel/scsi: Use __unused instead of assigning to itself.
Sascha Wildner [Mon, 21 Nov 2011 05:34:51 +0000 (06:34 +0100)]
kernel/scsi: Use __unused instead of assigning to itself.

12 years agokernel/nfs: Fix two wrong sizeofs.
Sascha Wildner [Mon, 21 Nov 2011 04:31:52 +0000 (05:31 +0100)]
kernel/nfs: Fix two wrong sizeofs.

NFSKERBKEY_T (key's type) is (in <vfs/nfs/rpcv2.h>):

typedef u_char NFSKERBKEY_T[2];

and key is one of the function's args, so we need to use the type for
the sizeof, else we'll get the size of a pointer.

12 years agodfregress - fix copy&paste mistake, add newline in output
Alex Hornung [Sun, 20 Nov 2011 22:21:48 +0000 (22:21 +0000)]
dfregress - fix copy&paste mistake, add newline in output

12 years agodfregress - Add default values for args, add direct arg
Alex Hornung [Sun, 20 Nov 2011 21:55:40 +0000 (21:55 +0000)]
dfregress - Add default values for args, add direct arg

 * Use a direct argument instead of -r for the runlist file.

 * Add defaults for the -t and -o options based on the path to the
   runlist file.

Suggested-by: Sascha Wildner (swildner@)
12 years agokernel - Correct wire count statistics
Matthew Dillon [Sun, 20 Nov 2011 20:21:19 +0000 (12:21 -0800)]
kernel - Correct wire count statistics

* When wiring pages for the dma pool we also have to increment
  vmstats.v_wire_count to match the later return of the pages
  to the free pool which decrements it.

Reported-by: lentferj
12 years agokernel - Fix vm_object token deadlock (3)
Matthew Dillon [Sun, 20 Nov 2011 19:19:32 +0000 (11:19 -0800)]
kernel - Fix vm_object token deadlock (3)

* Fix bug in this commit sequence, m->object is NULL'd out after the
  free so we have to save a copy to drop.

Reported-by: marino
12 years agokernel - Fix vm_object token deadlock (2)
Matthew Dillon [Sun, 20 Nov 2011 18:17:12 +0000 (10:17 -0800)]
kernel - Fix vm_object token deadlock (2)

* Files missed in original commit.

12 years agokernel - Fix broken assertion
Matthew Dillon [Sun, 20 Nov 2011 18:00:37 +0000 (10:00 -0800)]
kernel - Fix broken assertion

* The assertion in _lwkt_trytokeref() was printing out the contents of
  an uninitialized variable.  The assertion condition itself was ok.

12 years agokernel - Fix incorrect VA on interlock
Matthew Dillon [Sun, 20 Nov 2011 17:58:50 +0000 (09:58 -0800)]
kernel - Fix incorrect VA on interlock

* The pmap_clearbit() code was interlocking the wrong VA due to an
  uninitalized variable.  This could lead to stale tlbs.

Reported-by: swildner
12 years agokernel - Fix vm_object token deadlock
Matthew Dillon [Sun, 20 Nov 2011 17:47:47 +0000 (09:47 -0800)]
kernel - Fix vm_object token deadlock

* vm_page_alloc() needs an exclusive vm_object token when recycling
  random cache pages into the free queue.  Because these are effectively
  random pages it is possible for this exclusive token to interfere
  with a shared token already held by the thread.

* Make sure we can actually get the token.  If we cannot we deactivate
  the page instead.

12 years agokernel - Fix DRM_DEBUG() macro
Matthew Dillon [Sun, 20 Nov 2011 17:45:36 +0000 (09:45 -0800)]
kernel - Fix DRM_DEBUG() macro

* It was dereferencing td->td_proc without checking whether a process
  even exists first.

Reported-by: juanfra_
12 years agokernel: Fix sizeof()s that were taking a pointer.
Sascha Wildner [Sun, 20 Nov 2011 15:39:50 +0000 (16:39 +0100)]
kernel: Fix sizeof()s that were taking a pointer.

12 years agosocket: Speed up soclose by avoiding putting the user thread into sleep
Sepherosa Ziehau [Sun, 20 Nov 2011 11:25:05 +0000 (19:25 +0800)]
socket: Speed up soclose by avoiding putting the user thread into sleep

- Embed a netmsg_base into socket, it will be used if fast soclose
  is possible
- Factor out sodiscard(), which abort the connections on the listen
  socket and set the SS_NOFDREF bit.  This function is shared across
  fast soclose and synchronized soclose
- Rename the original soclose() to soclose_sync(), which uses domsg
  to perform proto-specific operation
- If kern.ipc.soclose_fast is 1 (it is 1 by default) and SO_LINGER
  socket option is not set and the socket does not use synchronized
  msgport (e.g. UNIX domain socket), fast soclose will be used
- The fast soclose is implemented to avoid putting the caller thread
  (usually a user thread) into sleep.  It uses the socket's embeded
  "close message" with different dispatch functions based on the
  current socket state and send the "close message" (asynchronized)
  to proto thread to carry out various tasks.

The result:
On Phenom 9550 (4 core, 2.2GHz):
route change -host 127.0.0.1 -msl 50 (set MSL to 50ms)
8 parallel netperf -H 127.0.0.1 -t TCP_CC -P0 (4 runs, unit: tps)

old  33181.18  33005.66  33130.48  33010.50
new  39109.07  39032.48  39022.75  38993.72

This gives 18% performance improvement

12 years agodfregress.8: Some little cleanup.
Sascha Wildner [Sun, 20 Nov 2011 09:29:17 +0000 (10:29 +0100)]
dfregress.8: Some little cleanup.

12 years agodfr2text(8): Remove custom DEBUG_FLAGS.
Sascha Wildner [Sun, 20 Nov 2011 09:27:59 +0000 (10:27 +0100)]
dfr2text(8): Remove custom DEBUG_FLAGS.

12 years agorc.conf.5: Add some words about the recently added change_routes variable.
Sascha Wildner [Sun, 20 Nov 2011 09:10:04 +0000 (10:10 +0100)]
rc.conf.5: Add some words about the recently added change_routes variable.

12 years agort_metrics: Change msl unit to millisecond
Sepherosa Ziehau [Sun, 20 Nov 2011 06:53:09 +0000 (14:53 +0800)]
rt_metrics: Change msl unit to millisecond

12 years agofastbulk - Minor corrections & docs
Matthew Dillon [Sat, 19 Nov 2011 22:40:46 +0000 (14:40 -0800)]
fastbulk - Minor corrections & docs

* Minor correction to the setup script

* Document more targets

12 years agofastbulk - Commit to /usr/src/test/fastbulk
Matthew Dillon [Sat, 19 Nov 2011 21:54:49 +0000 (13:54 -0800)]
fastbulk - Commit to /usr/src/test/fastbulk

* Commit the fastbulk (fast pkgsrc bulk building system) that I was
  working on late last year so others can mess around with it.

* This is a set of scripts that attempt to figure out pkgsrc tree
  dependencies and then run as many package builds in parallel as
  possible, keeping track of completions which effect other dependencies
  in order to keep as many concurrent (up to NPARALLEL) builds going as
  possible.

* Once the source archives get synchronized concurrency is actually limited
  more by the sludgepile that is the pkgsrc/bmake system which we have to
  use to figure out the dependencies in the first place.  It takes a bit
  for enough of the dependency tree to build for concurrency to ramp up
  but it does pretty well once the core packages that everyone else depends
  on have been built.

* Easy tracking of the state of the build via per-package log files and
  status information in /build/fastbulk/root/tmp/logs/{good,bad,run}.
  Log files for currently running builds are placed in run and then
  moved to good or bad when the build completes.

* Remaining issues include multi-dependencies (e.g. when multiple versions
  of the same package is available for install), because other packages in
  the tree might depend on different versions of the same package,
  missing dependencies, and other conflicts.

12 years agoLINT/LINT64: Remove page breaks.
Sascha Wildner [Sat, 19 Nov 2011 20:01:29 +0000 (21:01 +0100)]
LINT/LINT64: Remove page breaks.

12 years agokernel - Add ts check to dotimeout_only()
Matthew Dillon [Sat, 19 Nov 2011 17:41:48 +0000 (09:41 -0800)]
kernel - Add ts check to dotimeout_only()

* We have to add a null-check before calling dotimeout_only().  When
  poll()/select() are called with a NULL timeout that means wait forever
  and does not mean a fixed delay.

Reported-by: YONETANI Tomokazu <y0n3t4n1@gmail.com>
12 years agokernel - Fix swapcache related crash
Matthew Dillon [Sat, 19 Nov 2011 10:32:31 +0000 (02:32 -0800)]
kernel - Fix swapcache related crash

* VM object must be held while vmobj_token serializes list, before
  the lwkt_yield() not after.

* Fixes crash when swapcache fills up and starts to remove entries.

12 years agodfregress.8 - spelling: synopsys => synopsis
Alex Hornung [Sat, 19 Nov 2011 05:24:55 +0000 (05:24 +0000)]
dfregress.8 - spelling: synopsys => synopsis

12 years agokernel - Fix crash in pmap_enter()
Matthew Dillon [Sat, 19 Nov 2011 08:06:53 +0000 (00:06 -0800)]
kernel - Fix crash in pmap_enter()

* When taking a concurrent fault in KVM on a pipe buffer the pte
  replacement path when a pte is found to already exist was not
  checking whether pt_pv was NULL or not before trying to wire its
  page.

Reported-by: n00b183