dragonfly.git
10 years agosystat - Widen process summary, add execs v3.7.1
Matthew Dillon [Fri, 8 Nov 2013 04:32:16 +0000 (20:32 -0800)]
systat - Widen process summary, add execs

* Widen the process summary for 'r', 'p', 'd', and 's'.  Remove 'w'.

* Add execs/sec (to the right of the path stats)

10 years agodebug - Sync debug utilites, add a few more
Matthew Dillon [Thu, 7 Nov 2013 19:51:34 +0000 (11:51 -0800)]
debug - Sync debug utilites, add a few more

* Sync debug utilites to recent changes and add a few more.

* Enhance zallocinfo

10 years agokernel - Fix memory leak, clean up kernel slab fragmentation
Matthew Dillon [Thu, 7 Nov 2013 19:21:12 +0000 (11:21 -0800)]
kernel - Fix memory leak, clean up kernel slab fragmentation

* The kernel slab allocator collects off-cpu kfree()s in z_RChunks.  This
  linked list is freed up by the owning cpu.  However, zones which are not
  at the head of the list can wind up with non-NULL z_RChunks which never
  get freed.

* Add a 10-second callout on every cpu to clean-up these stale zones, giving
  the kernel a chance to free the related zones.

* This was probably the cause for other kernel memory leaks reported in the
  past.

Found-by: sephe
10 years agohammer2 - Stabilization
Matthew Dillon [Thu, 7 Nov 2013 02:20:59 +0000 (18:20 -0800)]
hammer2 - Stabilization

* Fix bugs where cached values in the chain's shared core were being
  used and modified during a flush by dead chains.  These values
  are only supposed to be used by live chains.  Should fix a number of
  assertion panics.

* Fix bug where the live_count calculation in a chain's shared core could
  be made based on a dead chain's block table.  This calculation is also
  meant to only be made/used by live chains.

10 years agokernel - rename vm_map lock wmesg
Matthew Dillon [Thu, 7 Nov 2013 02:01:47 +0000 (18:01 -0800)]
kernel - rename vm_map lock wmesg

* Rename the vm_map lock wmesg from "thrd_sleep" to "vm_maplk" to reduce
  confusion when observing 'ps' output.

10 years agokernel - Remove most buffer_map contention on 64-bit systems
Matthew Dillon [Thu, 7 Nov 2013 01:55:06 +0000 (17:55 -0800)]
kernel - Remove most buffer_map contention on 64-bit systems

* Set BKVASIZE to MAXBSIZE (65536) on 64-bit systems.  This has the effect
  of always reserving a maximal amount of KVM for each buffer cache buffer.

* The change removes most buffer_map interactions once the system caches
  have stabilized.

* The change removes the need to defragment the buffer cache.

* Significant performance improvement for HAMMER1 and HAMMER2 which use
  larger buffers and were hitting degenerate fragmentation issues before
  this change.

* But also results in lower buffer data density when buffering data for
  smaller files, so may have a slight detrimental effect on UFS and on
  the amount of time dirty data can be cached before being flushed to
  disk.

* NOTE: The 64K limit is for normal buffers and is unrelated to the
  physical cluster buffer (pbuf) limit of 128KB (MAXPHYS).

10 years agostrcasecmp.3: Fix wrong type name (site_t -> size_t).
Sascha Wildner [Wed, 6 Nov 2013 19:51:23 +0000 (20:51 +0100)]
strcasecmp.3: Fix wrong type name (site_t -> size_t).

10 years agohammer2 - Stabilization
Matthew Dillon [Wed, 6 Nov 2013 19:27:31 +0000 (11:27 -0800)]
hammer2 - Stabilization

* Fix bugs in hammer2_chain_insert(). Chain->inlayer was not being properly
  set in all cases.  Also, the core->chain_count was not tracking properly
  and could lead to premature removal or even prevent removal.

* Fix a double-unlock bug on oparent in hammer2_chain_getparent() which could
  occur when the function races a duplication.

10 years ago<sys/param.h>: Fix comment.
Sascha Wildner [Wed, 6 Nov 2013 18:25:46 +0000 (19:25 +0100)]
<sys/param.h>: Fix comment.

10 years agotcpd(8): Make it compile with -std=gnu99.
Sascha Wildner [Wed, 6 Nov 2013 18:11:00 +0000 (19:11 +0100)]
tcpd(8): Make it compile with -std=gnu99.

10 years agolibsmb: Make it compile with -std=gnu99.
Sascha Wildner [Wed, 6 Nov 2013 18:09:07 +0000 (19:09 +0100)]
libsmb: Make it compile with -std=gnu99.

10 years agotcpd{chk,match}(8): Fix compilation with -std=gnu99.
Sascha Wildner [Wed, 6 Nov 2013 17:50:49 +0000 (18:50 +0100)]
tcpd{chk,match}(8): Fix compilation with -std=gnu99.

10 years agomxge: Properly setup RSS key
Sepherosa Ziehau [Wed, 6 Nov 2013 15:00:21 +0000 (23:00 +0800)]
mxge: Properly setup RSS key

Thank folks at Myricom very much for sending me information about the
firmware RSS key length.

10 years agoAdjust the usual files for 3.7 on master.
Sascha Wildner [Wed, 6 Nov 2013 13:37:37 +0000 (14:37 +0100)]
Adjust the usual files for 3.7 on master.

10 years agoipfw(8): Add missing header for _long_to_time().
Sascha Wildner [Wed, 6 Nov 2013 12:44:04 +0000 (13:44 +0100)]
ipfw(8): Add missing header for _long_to_time().

10 years agolibwrap: Make it build with -std=gnu99.
Sascha Wildner [Wed, 6 Nov 2013 09:31:04 +0000 (10:31 +0100)]
libwrap: Make it build with -std=gnu99.

10 years agohammer2 - performance, stabilization
Matthew Dillon [Wed, 6 Nov 2013 06:49:44 +0000 (22:49 -0800)]
hammer2 - performance, stabilization

* Add hysteresis to anything calling H2's strategy functions.  Because
  the BIOs are queued to a thread and compression might be required,
  it is possible for buffer flushes to queue thousands of BIOs to the
  thread all at once.  This can result in thousands of locked BUFs which
  then stall frontend code.

  Stall strategy calls (typically the buffer flush code) after queueing
  a BIO when the number of pending file BIOs exceeds vfs.hammer2.flush_pipe,
  whos value defaults to 100.  Hysteresis is set at 3/4ths the value so
  a maximum efficiency pipeline is maintained.

* Do not try to update blockrefs in an inode when the inode is flagged
  DIRECTDATA.  This case can occur when a hardlink is shifted up to a
  higher directory.  The original inode is converted into an OBJT_HARDLINK
  object which has no file data.  Fixes a panic.

10 years agoopie{info,key,passwd}(1): Build with -std=gnu99, our default.
Sascha Wildner [Wed, 6 Nov 2013 04:51:51 +0000 (05:51 +0100)]
opie{info,key,passwd}(1): Build with -std=gnu99, our default.

Add a missing #include for getopt() and a missing prototype.

10 years agokernel - Fix vn_syncer_add panic with UFS
Matthew Dillon [Tue, 5 Nov 2013 22:46:00 +0000 (14:46 -0800)]
kernel - Fix vn_syncer_add panic with UFS

* The new VONWORKLST requirements were expanded to include VOBJDIRTY
  for both the standard syncer and the new syncer.  There was a path
  in the VM system which could clear VOBJDIRTY but failed to resynchronize
  VONWORKLST which could cause UFS to accidently leave a vnode on the
  syncer list after reclamation, causing a crash.

* Fix the VM path.

Reported-by: David Shao
10 years agolibopie: Update config.h, clean up Makefile and use CSTD=gnu99.
Sascha Wildner [Tue, 5 Nov 2013 20:53:12 +0000 (21:53 +0100)]
libopie: Update config.h, clean up Makefile and use CSTD=gnu99.

* Include all necessary includes to compile with -std=gnu99, our default.

* Add some missing prototypes to <opie.h>.

* Drop login.c and logwtmp.c from the build. Also drop libmissing/* files.

* Update config.h for <utmpx.h>, getutxline() and pututxline().

10 years agoipfw(8)/kldconfig(8): Clean up some __FreeBSD_version checks.
Sascha Wildner [Tue, 5 Nov 2013 20:17:28 +0000 (21:17 +0100)]
ipfw(8)/kldconfig(8): Clean up some __FreeBSD_version checks.

10 years agohammer2 - Implement I/O abstraction, fix deadlocks (2)
Matthew Dillon [Tue, 5 Nov 2013 18:43:14 +0000 (10:43 -0800)]
hammer2 - Implement I/O abstraction, fix deadlocks (2)

* Stabilize last commit, fix garbage collection SMP race.

10 years agohammer2 - Implement I/O abstraction, fix deadlocks
Matthew Dillon [Tue, 5 Nov 2013 17:34:08 +0000 (09:34 -0800)]
hammer2 - Implement I/O abstraction, fix deadlocks

* Implement a device buffer I/O abstraction, struct hammer2_io.  This
  abstraction allows multiple chains using smaller allocations to be
  locked concurrently sharing the same (larger) underlying buffer cache
  buffer.

* Does a very good job abstracting device block size selection from
  logical block size selection.

* The new implementation also abstracts asynchronous callbacks quite well.

* Not currently all that SMP friendly.

* Fixes buf/bio deadlocks under heavy loads.

10 years agopolling.4: Mention mxge(4)
Sepherosa Ziehau [Tue, 5 Nov 2013 14:32:54 +0000 (22:32 +0800)]
polling.4: Mention mxge(4)

10 years agomxge.4: Mention polling(4) support
Sepherosa Ziehau [Tue, 5 Nov 2013 14:32:37 +0000 (22:32 +0800)]
mxge.4: Mention polling(4) support

10 years agomxge: Add polling(4) support
Sepherosa Ziehau [Tue, 5 Nov 2013 10:16:52 +0000 (18:16 +0800)]
mxge: Add polling(4) support

The polling(4) support for mxge(4) is actually "hybrid":
- Polling TX and status does not work, so TX and status are still handled
  through interrupt.
- There is no way to disable RX interrupt explicitly; we will have to
  depend on RX interrupt: if RX interrupt comes, RX interrupt will be
  disabled by hardware and we don't enable it in interrupt handler.  And
  we don't process RX in RX interrupt.
- During RX polling, if there is no more packets ready, RX interrupt will
  have to be enabled again, else upcoming packets may suffer large delay.

Due to the "hybrid" nature of polling(4) support, RX polling is handled
on the same CPU which handles RX interrupt.

10 years agohammer2 - Stabilization
Matthew Dillon [Mon, 4 Nov 2013 19:41:09 +0000 (11:41 -0800)]
hammer2 - Stabilization

* Do not scrap deleted + modified chains unconditionally, this will mess
  up operations on unlinked-but-open files.  Also fixes an assertion which
  was getting hit and fixes poudriere test run stdout EBADF errors on
  unlinked fifos.

* Optimize handling of the DESTROYED flag to restore the feature where a
  rm -rf can get away with doing almost no write I/O.

* Remove a bunch of debug stuff

10 years agomdoc_local: Add two more FreeBSD versions which are used in manual pages.
Sascha Wildner [Mon, 4 Nov 2013 19:33:43 +0000 (20:33 +0100)]
mdoc_local: Add two more FreeBSD versions which are used in manual pages.

10 years agostrlcpy.3: Use OpenBSD's revamped description of strlcpy and strlcat.
Sascha Wildner [Mon, 4 Nov 2013 19:21:30 +0000 (20:21 +0100)]
strlcpy.3: Use OpenBSD's revamped description of strlcpy and strlcat.

This is FreeBSD's r257646.

Submitted-by: Eitan Adler <eadler@freebsd.org>
From their commit msg:

This explanation is supposed to be simpler and better.  In particular
"comparing it to the snprintf API provides lots of value, since it raises the
bar on understanding, so that programmers/auditors will a better job calling
all 3 of these functions."

10 years agopthread/sem_timedwait: sem_timedwait()'s timespec argument is const.
Sascha Wildner [Sun, 3 Nov 2013 22:00:28 +0000 (23:00 +0100)]
pthread/sem_timedwait: sem_timedwait()'s timespec argument is const.

10 years agoFix some more prototypes in manual pages.
Sascha Wildner [Sun, 3 Nov 2013 21:36:35 +0000 (22:36 +0100)]
Fix some more prototypes in manual pages.

10 years agobsd-family-tree: Sync with FreeBSD (for OpenBSD 5.4).
Sascha Wildner [Sun, 3 Nov 2013 20:51:34 +0000 (21:51 +0100)]
bsd-family-tree: Sync with FreeBSD (for OpenBSD 5.4).

10 years agoFix two prototypes in stringlist.3 and rpc_svc_reg.3.
Sascha Wildner [Sun, 3 Nov 2013 20:50:39 +0000 (21:50 +0100)]
Fix two prototypes in stringlist.3 and rpc_svc_reg.3.

10 years agokernel/x86_64: Do not print a message upon every segmentation fault.
Sascha Wildner [Sun, 3 Nov 2013 08:21:33 +0000 (09:21 +0100)]
kernel/x86_64: Do not print a message upon every segmentation fault.

It was printed even when the SIGSEGV was caught, such as by configure
tests, causing a rather noisy console when packages were built. After
this commit we're back to the traditional behavior (no message if the
signal is caught, and the usual message if not):

pid <pid> (<user>), uid <uid>: exited on signal 11 (core dumped)

While here, adjust some comments.

10 years agokernel/i386: Implement atomic_swap_long()
François Tigeot [Sun, 3 Nov 2013 07:13:18 +0000 (08:13 +0100)]
kernel/i386: Implement atomic_swap_long()

10 years agodrm: Use Linux atomic types and functions
François Tigeot [Sat, 2 Nov 2013 14:47:01 +0000 (15:47 +0100)]
drm: Use Linux atomic types and functions

Opportunistically sync to Linux 3.8 when possible

10 years agokref.h: Adapt to Linux 3.8's drm
François Tigeot [Sat, 2 Nov 2013 14:36:46 +0000 (15:36 +0100)]
kref.h: Adapt to Linux 3.8's drm

* Implement kref_sub()

* The internal counter is used by the drm code, rename it to refcount

* The internal counter must be of type atomic_t

10 years agodrm: Import linux/kernel.h from FreeBSD's OFED stack
François Tigeot [Sat, 2 Nov 2013 14:02:53 +0000 (15:02 +0100)]
drm: Import linux/kernel.h from FreeBSD's OFED stack

10 years agodrm: fix test_and_set_bit() prototype
François Tigeot [Sat, 2 Nov 2013 17:58:22 +0000 (18:58 +0100)]
drm: fix test_and_set_bit() prototype

10 years agodrm: Import linux/bitops.h from the FreeBSD OFED stack
François Tigeot [Sat, 2 Nov 2013 15:36:15 +0000 (16:36 +0100)]
drm: Import linux/bitops.h from the FreeBSD OFED stack

10 years agodrm: Improve linux/atomic.h
François Tigeot [Sat, 2 Nov 2013 12:41:31 +0000 (13:41 +0100)]
drm: Improve linux/atomic.h

* Add an atomic64_t definition

* Add back atomic_xchg()

* Add atomic64_read() atomic64_xchg() and atomic64_set()

10 years agodrm: Replace drm_atomic.h by linux/atomic.h from FreeBSD's OFED stack
François Tigeot [Sat, 2 Nov 2013 12:07:24 +0000 (13:07 +0100)]
drm: Replace drm_atomic.h by linux/atomic.h from FreeBSD's OFED stack

10 years agodirfs - Call VOP_INACTIVE() on last VOP_CLOSE()
Antonio Huete Jimenez [Sat, 2 Nov 2013 21:06:52 +0000 (22:06 +0100)]
dirfs - Call VOP_INACTIVE() on last VOP_CLOSE()

10 years agodirfs - Add VFS_STATFS() function
Antonio Huete Jimenez [Sat, 2 Nov 2013 21:02:41 +0000 (22:02 +0100)]
dirfs - Add VFS_STATFS() function

10 years agodirfs - Add KTR_LOG for VFS_MOUNT / VFS_UNMOUNT
Antonio Huete Jimenez [Sat, 2 Nov 2013 20:49:25 +0000 (21:49 +0100)]
dirfs - Add KTR_LOG for VFS_MOUNT / VFS_UNMOUNT

10 years agodirfs - Improve a couple KTR messages
Antonio Huete Jimenez [Sat, 2 Nov 2013 20:16:54 +0000 (21:16 +0100)]
dirfs - Improve a couple KTR messages

10 years agohammer2 - Stabilization
Matthew Dillon [Sat, 2 Nov 2013 07:06:57 +0000 (00:06 -0700)]
hammer2 - Stabilization

* Fix heavy cpu use in flush due to a blown recursion which can run down
  the same chain many times due to the aliasing of hammer2_chain_core
  structures.

  The basic problem is that there can be H2 operations running concurrently
  with a flush that are not part of the flush.  These operations have a
  higher transaction id.  When situated deep in the tree, they can cause
  the flush to repeatedly traverse large portions of the tree that it had
  already checked because the recording of the lower flush TID is lower
  than the update_tid from the concurrent operations.

* Fix a multitude of flush / concurrent-operations races.  The worst of the
  lot is related to the situation where a concurrent operation does a
  delete-duplicate on a chain containing a block table (which can include
  an inode chain) which the flush needs to update.  This results in TWO
  block tables needing updating relative to different synchronization
  points.  Essentially, one of the chains is strictly temporary for flush
  purposes while the other is the 'real' chain.

  For example, if the concurrent operation is adding or deleting elements
  from a block table the flush may have to add/delete DIFFERENT elements
  for its own view.  This requires two different versions of the block table
  (one being strictly temporary).

  Improper updates of the chain->bref.mirror_tid caused the flush to get
  confused and assert on the blocktable not containing the expected dat.

* More concurrent-operations during a flush issues fixed.  If a concurrent
  operation deletes a chain and the flush needs to fork a 'live' version
  of the chain, the flush's version will have a lower transaction id and
  must be properly ordered in hammer2_chain_core->ownerq.  It was not
  being ordered properly.

* Flushes are recursive and to improve concurrency the flush temporarily
  unlocks the old parent when diving under a child.  This can result in a
  race where, due to hammer2_chain_core aliasing the recursion can wrap
  around back to the parent.

  Detect the case after re-locking the parent on the way back up the tree
  and do the right thing.

* Fix handling of the flush block table rollup.  Consolidate the call to
  modify the parent (so we can adjust the blockrefs after flushing the
  children) to a single point.

* Improve flush performance.  If a parent is deferred at a higher level
  and then encountered again via a shallower path, we now leave it deferred
  and do not try to execute it in the shallower path even though the stack
  depth is ok, as it will likely become deferred at a lower level anyway.

  Check a deleted-chain case early before we recurse.  A deleted chain
  which is flagged DUPLICATED does not have to recurse as the sub-path
  is reachable via some other parent.  This significantly improves
  performance because there are often a ton of chains in-memory marked
  DELETED.

  This results in more efficient deferrals.

* Fix adjustments of modify_tid and delete_tid in delete-duplicate
  operations, clean up handling of CHAIN_INITIAL, properly transfer
  flags in delete-duplicate.

* Fix some gratuitous wakeups in the transaction API.

10 years agohammer2 - stabilization
Matthew Dillon [Fri, 1 Nov 2013 16:48:10 +0000 (09:48 -0700)]
hammer2 - stabilization

* Reduce HAMMER2_FLUSH_DEPTH_LIMIT from 40 to 10 to avoid blowing out
  the kernel stack.

* Retool hammer2_chain_drop() and hammer2_chain_lastdrop() to remove all
  possible recursion.  The in-memory topology can get very deep and very
  wide.  This fixes another kernel stack blowout.

* Fix a bug in hammer2_chain_flush()'s deferred flush.  Now that
  hammer2_chain_flush() can replace the passed-in chain, we have to drop
  the extra ref before calling it instead of after.

10 years agohammer2 - stabilization
Matthew Dillon [Fri, 1 Nov 2013 07:51:00 +0000 (00:51 -0700)]
hammer2 - stabilization

* Code generally assumes that a deleted-flagged chain can still be
  duplicated.  Remove bogus call to hammer2_freemap_free() and
  remove bogus masking of chain->bref.data_off in hammer2_chain_delete().

10 years agohammer1 - cleanup, minor bug fixes
Matthew Dillon [Fri, 1 Nov 2013 06:09:31 +0000 (23:09 -0700)]
hammer1 - cleanup, minor bug fixes

* Cleanup pass, remove some dead code

* Minor bug fixes, add tokens around some paths that need them.

* Remove use of the master token in several paths that don't need it,
  improving concurrency.

10 years agokernel - Improve panic handling
Matthew Dillon [Fri, 1 Nov 2013 06:07:03 +0000 (23:07 -0700)]
kernel - Improve panic handling

* Clear the gd_spinlocks counter when handling a panic.  This improves
  our chances of being able to obtain a crash dump

10 years agohammer2 - Stabilization pass, more flush refactoring
Matthew Dillon [Fri, 1 Nov 2013 05:57:55 +0000 (22:57 -0700)]
hammer2 - Stabilization pass, more flush refactoring

* Add voldata.inode_tid, separate inode TID allocations from
  transaction TID allocations in voldata.

* Rewrite the transaction management functions.

* Rewrite hammer2's filesystem sync code to reduce stalls.

* Keep track of a generation number on the hammer2_chain_core structure
  so the flush code can re-scan when it modifies elements within the
  flush transaction.

* Cleanup the duplication and delete-duplication code and hardlink handling.
  The delete-duplication code now properly tags delete_tid when a flush is
  delete-duplicating a chain which is deleted in the live view but is still
  valid in the flush view.

* Correct numerous bugs in tracking the modified/deleted state of
  a chain.

* Correct numerous flush bugs.

* Separate the mirror TID for the freemap chain from the volume chain.
  This will allow freemap updates to be delayed.

* Implement a more stringent algorithm to determine when CHAIN_MOVED
  can be cleared in chain->flags.

* Do a better job limiting the flush scan when concurrent modifying
  operations are occuring in large volumes.

10 years agotest - Adjust vnodeinfo for system changes
Matthew Dillon [Fri, 1 Nov 2013 05:55:45 +0000 (22:55 -0700)]
test - Adjust vnodeinfo for system changes

* Make vnodeinfo in test/debug compile again.

10 years agohammer2 - Refactor flush
Matthew Dillon [Wed, 30 Oct 2013 07:13:34 +0000 (00:13 -0700)]
hammer2 - Refactor flush

* Replace HAMMER2_CHAIN_SUBMODIFIED with core->update_tid.  SUBMODIFIED
  applies to chain->core, not to chain. Use a TID to track updates to
  make it easier for a flush to update records without messing up flush
  sequencing of chains being concurrently modified outside the flush's
  TID (that will be handled in the next flush).

* Make sure the DUPLICATED flag is set when duplicating a chain which
  has already been duplicated to another target.  This case is only during
  flushes and can occur when the flush races against concurrent updates
  which are not part of the flush.

* Refactor bioq flushing during a flush.  hammer2_vfs_sync now gives the
  bioq a window to operate using the flush's TID before the flush actually
  starts to flush.

* hammer2_chain_modify() retains the current allocation block if the TID
  does not cross a flush boundary.

* chain->bref.mirror_tid is now used to track flush progress and is compared
  against core->update_tid to determine when a flush is needed.

* Code cleanups.

10 years agoshutdown.8: Actually, start a new paragraph for poweroff's description.
Sascha Wildner [Thu, 31 Oct 2013 18:21:09 +0000 (19:21 +0100)]
shutdown.8: Actually, start a new paragraph for poweroff's description.

10 years agoshutdown.8: Remove an empty line.
Sascha Wildner [Thu, 31 Oct 2013 17:38:01 +0000 (18:38 +0100)]
shutdown.8: Remove an empty line.

10 years agoMention KTR_IF_POLL in LINT and the ktr(4) manual page.
Sascha Wildner [Thu, 31 Oct 2013 14:04:38 +0000 (15:04 +0100)]
Mention KTR_IF_POLL in LINT and the ktr(4) manual page.

10 years ago<sys/msgport.h>: Extend the #ifdef _KERNEL to cover the lwkt_* protos too.
Sascha Wildner [Wed, 30 Oct 2013 20:46:08 +0000 (21:46 +0100)]
<sys/msgport.h>: Extend the #ifdef _KERNEL to cover the lwkt_* protos too.

This unbreaks buildworld after the previous commit to <sys/msgport.h>.

Reported-by: Ed Berger <edwberger@gmail.com>
10 years agobsd-family-tree: Sync with FreeBSD.
Sascha Wildner [Wed, 30 Oct 2013 17:57:15 +0000 (18:57 +0100)]
bsd-family-tree: Sync with FreeBSD.

10 years agomsgport: Add putport_oncpu; helps scheduling netisr locally for spin port
Sepherosa Ziehau [Wed, 30 Oct 2013 13:50:55 +0000 (21:50 +0800)]
msgport: Add putport_oncpu; helps scheduling netisr locally for spin port

Background:
High rate (actually same rate as polling(4)) IPIs on random CPUs are
observed when polling(4) is enabled and there is virtually no network
activity.

After polling(4) activities are traced using ktr(9), it turns out that the
high rate IPIs are actually from the wakeup() on netisr's msgport.  Since
the sleep queue cpumask is indexed by the hash of ident, there are chances
that the netisr's msgport ident has the same hash value as other idents
that certain threads on other CPUs are waiting on.  If this ever happens
(well, it does happen), the netisr's msgport wakeup will trigger "wakeup"
IPIs to other CPUs.  However, these "wakeup" IPIs are actually useless,
since only netisr will wait on its msgport.

putport_oncpu() msgport method is added to call wakeup_mycpu() for spin
msgport, if we know that this port is only accessed by one thread on the
current CPU, e.g. polling(4).  This is also the case for other network
code, e.g.  syncache timeout, TCP timeout, fastforward flow cache timeout
etc.  However, these network code's running rate is too low to unveil the
extra "wakeup" IPIs problem.  lwkt_sendmsg_oncpu() is added as wrapper to
putport_oncpu() msgport method.

Currently, only polling(4) is using lwkt_sendmsg_oncpu().  Others will
be converted soon.

10 years agomsgport: Merge several sendmsg functions
Sepherosa Ziehau [Tue, 29 Oct 2013 14:10:14 +0000 (22:10 +0800)]
msgport: Merge several sendmsg functions

sendmsg_stage1 and sendmsg_stage2 are actually copy and paste of part of
sendmsg.  Make the functionality inline and let sendmsg call them
sequentially.

While I am here, rename "stage1" to "prepare" and "stage2" to "start"

10 years agopolling: Add preliminary KTR support
Sepherosa Ziehau [Tue, 29 Oct 2013 13:58:14 +0000 (21:58 +0800)]
polling: Add preliminary KTR support

10 years agoipsec_strerror.3: Ansify prototype.
Sascha Wildner [Tue, 29 Oct 2013 20:16:52 +0000 (21:16 +0100)]
ipsec_strerror.3: Ansify prototype.

10 years agoFix three typos I made in the locale manpages.
Sascha Wildner [Tue, 29 Oct 2013 17:51:23 +0000 (18:51 +0100)]
Fix three typos I made in the locale manpages.

10 years agomdocml: tweak mandocdb(8) database creation
Franco Fichtner [Mon, 28 Oct 2013 21:04:43 +0000 (22:04 +0100)]
mdocml: tweak mandocdb(8) database creation

Since the current apropos(1) has a few issues, it's desirable to
switch to mdocml's version.  In order to do this, tweak the handling
of MLINKS.  While there, be a bit nostalgic about apropos(1) output.

10 years agoman.conf: correctly point to database file
Franco Fichtner [Mon, 28 Oct 2013 18:24:28 +0000 (19:24 +0100)]
man.conf: correctly point to database file

10 years agodrm: Fix warnings introduced by recent commits
François Tigeot [Mon, 28 Oct 2013 15:16:08 +0000 (16:16 +0100)]
drm: Fix warnings introduced by recent commits

10 years agodrm: Import linux/types.h from the FreeBSD OFED stack
François Tigeot [Sun, 27 Oct 2013 14:52:48 +0000 (15:52 +0100)]
drm: Import linux/types.h from the FreeBSD OFED stack

10 years agodrm: Import asm/types.h from the FreeBSD OFED stack
François Tigeot [Sun, 27 Oct 2013 14:53:30 +0000 (15:53 +0100)]
drm: Import asm/types.h from the FreeBSD OFED stack

10 years agodrm/i915: Put i915_drm.h into include/
François Tigeot [Sun, 27 Oct 2013 09:02:44 +0000 (10:02 +0100)]
drm/i915: Put i915_drm.h into include/

Split the header in two separate files, like it is done in Linux 3.8.

10 years agohammer2 - Fix misc bugs
Matthew Dillon [Sun, 27 Oct 2013 05:09:28 +0000 (22:09 -0700)]
hammer2 - Fix misc bugs

* Move the live_zero optimization from hammer2_chain to
  hammer2_chain_core.  It is only applicable to the core
  and delete-duplicate operations can mess up the cache.

* Move the HAMMER2_CHAIN_COUNTEDBREFS flag to HAMMER2_CORE_COUNTEDBREFS.
  It is only applicable to the core and delete-duplication operations
  can really mess up calculations of live_count otherwise.

* Don't bump live_count if inserting a deleted chain.

* The vp in the hammer2_sync_scan2() is not locked on purpose.  Use the
  synclist token interlock to safely ref the hammer2_inode before
  potentially blocking, otherwise it can get ripped out from under us.

10 years agotmpfs - Fix SMP race
Matthew Dillon [Sun, 27 Oct 2013 05:06:17 +0000 (22:06 -0700)]
tmpfs - Fix SMP race

* Hold the node lock in order to safely indirect through
  node->tn_dir.tn_parent.

10 years agomxge.4: Update according to recent changes
Sepherosa Ziehau [Sun, 27 Oct 2013 04:22:00 +0000 (12:22 +0800)]
mxge.4: Update according to recent changes

10 years agohammer2 - add fifo/dev support, bug fixes
Matthew Dillon [Sat, 26 Oct 2013 23:38:03 +0000 (16:38 -0700)]
hammer2 - add fifo/dev support, bug fixes

* Add vops for fifo, blk, and chr devices

* Fix bug in hammer2_chain_insert() - allow insertion races to push a new
  layer in all cases except when requested not to.

* Fix bug in hammer2_chain_duplicate() - Must call hammer2_chain_create()
  instead of hammer2_chain_insert() in case the duplication target needs
  indirect blocks.

10 years agomxge: Log TX and RX descriptor count
Sepherosa Ziehau [Sat, 26 Oct 2013 14:13:32 +0000 (22:13 +0800)]
mxge: Log TX and RX descriptor count

10 years agomxge: Avoid stopping TX enging, if there are more packets pending on ifq
Sepherosa Ziehau [Sat, 26 Oct 2013 13:47:56 +0000 (21:47 +0800)]
mxge: Avoid stopping TX enging, if there are more packets pending on ifq

10 years agomxge: Remove unused code
Sepherosa Ziehau [Sat, 26 Oct 2013 13:37:51 +0000 (21:37 +0800)]
mxge: Remove unused code

10 years agomxge: Enable multiple RX queues and TX queues by default
Sepherosa Ziehau [Sat, 26 Oct 2013 13:33:21 +0000 (21:33 +0800)]
mxge: Enable multiple RX queues and TX queues by default

10 years agomxge: Use chip private input hash instead of standard RSS input hash
Sepherosa Ziehau [Sat, 26 Oct 2013 12:38:01 +0000 (20:38 +0800)]
mxge: Use chip private input hash instead of standard RSS input hash

This restores RX performance when multiple RX queues are enable.

If the stardard RSS input hash is used, the chip's firmware will compute
the RSS hash (*); this kinda explains why using standard RSS input hash
hurts RX performance greatly.

Sysctl hw.mxgeX.use_rss is added to turn on standard RSS input hash.
It is disabled by default.  It is also controlled globally by tunable
hw.mxge.use_rss.

(*) Thank Andrew Gallatin <gallatin@FreeBSD.org> for giving the hint.

10 years agomxge: Implement multiple TX queue support
Sepherosa Ziehau [Sat, 26 Oct 2013 10:48:02 +0000 (18:48 +0800)]
mxge: Implement multiple TX queue support

To enable multiple multiple TX queues, you will need to set tunable
hw.mxge.num_slices or hw.mxgeX.num_slices to 0 or any value >1.

If you want only enable multiple RX queues bu only one TX queue,
in addition to the above tunables tunable hw.mxge.multi_tx should
be set to 0.

10 years agonrelease: Fix two pkgsrc references which i had forgotten in c36c5990ecc.
Sascha Wildner [Sat, 26 Oct 2013 10:27:32 +0000 (12:27 +0200)]
nrelease: Fix two pkgsrc references which i had forgotten in c36c5990ecc.

10 years agofind(1): Fix locate database updating, again. :)
Sascha Wildner [Sat, 26 Oct 2013 10:06:38 +0000 (12:06 +0200)]
find(1): Fix locate database updating, again. :)

This commit re-applies 83c5db2eae3d86.

I should have been more clear in its commit message that locate.updatedb
was not failing with an error if this local change wasn't kept, but that
the database was incomplete and of a much smaller size.

When testing find(1) after an upgrade, a good general rule is that
/var/db/locate.database needs to have about the same size after the
upgrade as it had before the upgrade.

10 years agodrm/i915: Remove unused file
François Tigeot [Sat, 26 Oct 2013 07:35:19 +0000 (09:35 +0200)]
drm/i915: Remove unused file

10 years agomxge: Implement MSI-X support; multiple RX rings could be enabled
Sepherosa Ziehau [Wed, 23 Oct 2013 13:25:37 +0000 (21:25 +0800)]
mxge: Implement MSI-X support; multiple RX rings could be enabled

One thing need to note is the interrupt moderation when MSI-X is
enabled.  On the PCIE-8AL-C, it looks like that the interrupt rate
set to the chip means total interrupt rate, NOT per MSI-X vector
interrupt rate: e.g. Given the interrupt rate is set too 8000 and 8
MSI-X vectors are allocated.  If two MSI-X vectors are active, then
the interrupt rate for each MSI-X vector will be ~4000.  If all
MSI-X vectors are active, then the interrupt rate for each MSI-X
vector will be ~1000.  This is kind of interrupt moderation for
MSI-X is very unfriendly ...

MSI-X is not enabled by default yet.  You could set tunable
hw.mxge.num_slices or hw.mxgeX.num_slices to 0 or any value greater
than 1 to enable MSI-X.

RSS key is not properly setup yet.

10 years agoFix memory leak in df(1)
Robin Hahling [Fri, 25 Oct 2013 10:15:37 +0000 (12:15 +0200)]
Fix memory leak in df(1)

Fix a memory leak in makenetvfslist which would occur when a previous
call to strdup fails and the function returns on error.
The simple fix is a call to free(3) to free memory allocated to listptr
before returning.

10 years agoAdd -T option to df(1).
Robin Hahling [Fri, 25 Oct 2013 08:32:36 +0000 (10:32 +0200)]
Add -T option to df(1).

Add -T option to df(1) as found in Linux and FreeBSD df(1).
When given, file system type will be included in df(1) output.
This has been adapted from FreeBSD df(1).

10 years agodf -hi prints inodes count "human-readable"
Robin Hahling [Fri, 25 Oct 2013 06:54:23 +0000 (08:54 +0200)]
df -hi prints inodes count "human-readable"

Enable "human-readable" printing of inodes count when df(1)
is called with both -h and -i flags. This is similar to what can be
found on FreeBSD df(1) or GNU df(1).

The code has been adapted from FreeBSD's df(1) and the manpage updated
accordingly.

Example output:

Now:
% df -hi
Filesystem                           Size   Used  Avail Capacity iused ifree %iused  Mounted on
[...]
/dev/serno/VB6cbedbd6-0a1f16ee.s1a   756M   302M   393M    43%     949   96k    1%   /boot
[...]

Before:
% df -hi
Filesystem                           Size   Used  Avail Capacity iused ifree %iused  Mounted on
[...]
/dev/serno/VB6cbedbd6-0a1f16ee.s1a   756M   302M   393M    43%     949 96329    1%   /boot
[...]

10 years agodeclare functions local to df module as static
Robin Hahling [Fri, 25 Oct 2013 06:44:59 +0000 (08:44 +0200)]
declare functions local to df module as static

This makes it compliant to style(9).

10 years agoA working IPSEC implementation (1/many)
Antonio Huete Jimenez [Fri, 25 Oct 2013 08:48:52 +0000 (01:48 -0700)]
A working IPSEC implementation (1/many)

* Fix fast_ipsec(4) so that it at least builds.
* Untested and probably not working.

Reported-by: Thomas Nikolajsen
Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/1843>

10 years agokernel/vmm: Rename struct guest_options to vmm_guest_options.
Sascha Wildner [Fri, 25 Oct 2013 17:38:50 +0000 (19:38 +0200)]
kernel/vmm: Rename struct guest_options to vmm_guest_options.

10 years agokernel: Some cleanup in ext2fs and linux emulation after recent work.
Sascha Wildner [Fri, 25 Oct 2013 14:58:15 +0000 (16:58 +0200)]
kernel: Some cleanup in ext2fs and linux emulation after recent work.

10 years agokernel: Rename idr.c to linux_idr.c
François Tigeot [Fri, 25 Oct 2013 08:16:22 +0000 (10:16 +0200)]
kernel: Rename idr.c to linux_idr.c

This should make it more obvious this file is implementing a Linux API.

Requested-by: swildner
10 years agoidr: Fix idr_get_new() and idr_get_new_above() return values
François Tigeot [Fri, 25 Oct 2013 06:47:53 +0000 (08:47 +0200)]
idr: Fix idr_get_new() and idr_get_new_above() return values

These functions are supposed to return -EAGAIN and not EAGAIN when
no more descriptors are available.

10 years agokernel - Remove proc_token, replace proc, pgrp, and session structure backend
Matthew Dillon [Fri, 25 Oct 2013 04:54:48 +0000 (21:54 -0700)]
kernel - Remove proc_token, replace proc, pgrp, and session structure backend

* Isolate the remaining exposed topology for proc, pgrp, and session
  into one source file (kern_proc.c).

* Remove allproc, zombproc, pgrp's spinlocks, and start tracking session
  structures so we don't have to indirect through other system structures.

* Replace with arrays-of-lists, 1024 elements, including a 1024 element
  token lock array to protect each list.

      proc_tokens[1024]
      allprocs[1024]
      allpgrps[1024]
      allsessn[1024]

  This removes nearly all the prior proc_token contention and also removes
  process-group processing contention and makes it easier to track tty
  sessions.

* Normal process, Zombie processes, the original linear list, and the
  original has mechanic are now all combined into a single allprocs[]
  table.  The various API functions will filter out zombie vs non-zombie
  based on the type of request.

* Rewrite the PID allocator to take advantage of the hashed array topology.
  An atomic_fetchadd_int() is used on the static base value which will cause
  each cpu to start at a different array entry, thus removing SMP conflicts.

  At the moment we iterate the relatively small number of elements in the
  bucket to find a free pid.

  Since the same proc_tokens[n] lock applies to all three arrays (proc,
  pgrp, and session), we can validate the pid against all three at the
  same time with a single lock.

* Rewrite the procs sysctl to iterate the hash table.  Since there are
  1024 different locks, a 'ps' or similar operation no longer has any
  significant effect on system performance, and 'ps' is VERY fast now
  regardless of the load.

* poudriere bulk build tests on a blade (4 core / 8 thread) shows virtually
  no SMP collisions even under extreme loads.

* poudriere bulk build tests on monster (48-core opteron) show very low
  SMP collision statistics outside of filesystem writes in most situations.
  Pipes (which are already fine-grained) sometimes show significant
  collisions.

  Most importantly, NO collisions on the process fork/exec/exit critical
  path, end-to-end.  Not even in the VM system.

10 years agokernel - proc_token removal pass stage 1/2
Matthew Dillon [Fri, 25 Oct 2013 01:51:24 +0000 (18:51 -0700)]
kernel - proc_token removal pass stage 1/2

* Remove proc_token use from all subsystems except kern/kern_proc.c.

* The token had become mostly useless in these subsystems now that process
  locking is more fine-grained.  Do the final wipe of proc_token except for
  allproc/zombproc list use in kern_proc.c

10 years agokernel - Replace global vmobj_token with vmobj_tokens[] array
Matthew Dillon [Fri, 25 Oct 2013 00:01:28 +0000 (17:01 -0700)]
kernel - Replace global vmobj_token with vmobj_tokens[] array

* Remove one of the two remaining major bottlenecks in the system, the
  global vmobj_token which is used to manage access to the vm_object_list.
  All VM object creation and deletion would get thrown into this list.

* Replace it with an array of 64 tokens and an array of 64 lists.
  vmobj_token[] and vm_object_lists[].  Use a simple right-shift
  hash code to index the array.

* This reduces contention by a factor of 64 or so which makes a big
  difference on multi-chip cpu systems.  It won't be as noticable on
  single-chip (e.g. 4-core/8-thread) systems.

* Rip-out some of the linux vmstats compat functions which were iterating
  the object list and replace with the pcpu accumulator scan that was
  recently implemented for dragonfly vmstats.

* TODO: proc_token.

10 years agokernel - Remove last exclusive vnode vm_object lock from the critical path
Matthew Dillon [Thu, 24 Oct 2013 20:39:11 +0000 (13:39 -0700)]
kernel - Remove last exclusive vnode vm_object lock from the critical path

* Remove the last exclusive vnode vm_object lock from the critical path.

* Path gets hit on exit, but it matters a lot if one is fork/exec'ing a
  lot of binaries.  For example, builds which fork/exec huge numbers of
  concurrent /bin/sh's, compilers, and other programs.

* vfork/exec rate on blade server, 10000 x 8-threads (80000 total) reduced
  from 10.6 seconds to 3.8 seconds, for a major 2.7x improvement in
  performance.

10 years agokernel - Improve vfork/exec and wait*() performance
Matthew Dillon [Thu, 24 Oct 2013 19:03:23 +0000 (12:03 -0700)]
kernel - Improve vfork/exec and wait*() performance

* Use a flags interlock instead of a token interlock for PPWAIT for
  vfork/exec (handling when the parent must wait for the child to
  finish exec'ing).

* The exit1() code must wakeup the parent's wait*()'s.  Delay the wakeup
  until after the token has been released.

* Change thet interlock in the parent's wait*() code to use a generation
  counter.

* Do not wakeup p_nthreads on exit if the program was never multi-threaded,
  saving a few cycles.

10 years agopstat - sync w/kernel
Matthew Dillon [Thu, 24 Oct 2013 18:26:23 +0000 (11:26 -0700)]
pstat - sync w/kernel

* Remove flags no longer used by the kernel

10 years agoRemove no longer used <sys/localedef.h>.
Sascha Wildner [Thu, 24 Oct 2013 13:43:32 +0000 (15:43 +0200)]
Remove no longer used <sys/localedef.h>.