dragonfly.git
10 years agobmake: Revert local modification patches.
Alexandre Perrin [Fri, 22 Nov 2013 15:42:54 +0000 (16:42 +0100)]
bmake: Revert local modification patches.

  Preparing a clean vendor branch merge.

10 years agoUpdate to bmake-20131001 on the vendor branch
Alexandre Perrin [Thu, 21 Nov 2013 12:34:06 +0000 (13:34 +0100)]
Update to bmake-20131001 on the vendor branch

10 years agokernel: Remove NULL checks after kmalloc(..., M_INTWAIT).
Alexandre Perrin [Fri, 22 Nov 2013 17:19:22 +0000 (18:19 +0100)]
kernel: Remove NULL checks after kmalloc(..., M_INTWAIT).

  M_INTWAIT will not return NULL unless M_NULLOK is passed too.

10 years agokernel - Fix bug in ehci port reset code
Matthew Dillon [Fri, 22 Nov 2013 00:57:29 +0000 (16:57 -0800)]
kernel - Fix bug in ehci port reset code

* Fix a bug when the port reset fails where the port locks up and no longer
  works.  The reset code was returning without disposing of the transfer
  request.

* Some devices (usually smart phones) won't reset on the first attempt.
  Try at least twice before reporting an error.

* Change the PR clear test to wait up to one second, instead of 250ms.

10 years agokernel: Remove random_poll().
Sascha Wildner [Thu, 21 Nov 2013 21:36:09 +0000 (22:36 +0100)]
kernel: Remove random_poll().

It is no longer used since device polling was torn out in favor of
kq filters in 163625b9bf04f32ec3cbbaef7e6b242aeb8a152c.

10 years agoFix indentation from the previous commit.
Antonio Huete Jimenez [Thu, 21 Nov 2013 18:50:04 +0000 (10:50 -0800)]
Fix indentation from the previous commit.

10 years agohammer - Ignore privilege check for HAMMERIOC_PFS_ITERATE.
Antonio Huete Jimenez [Thu, 21 Nov 2013 18:33:09 +0000 (10:33 -0800)]
hammer - Ignore privilege check for HAMMERIOC_PFS_ITERATE.

* This caused 'hammer info' to display an empty list of PFSes
  when run by non-root.

Pointed-out-by: dillon
10 years agokernel: Fix two typos, _KERNRL -> _KERNEL and ALTQ_unLOCK -> ALTQ_UNLOCK.
Sascha Wildner [Thu, 21 Nov 2013 00:45:27 +0000 (01:45 +0100)]
kernel: Fix two typos, _KERNRL -> _KERNEL and ALTQ_unLOCK -> ALTQ_UNLOCK.

10 years agobnx: Only 5718 chip family use PCI_BAR4 as MSI-X table; rest use PCI_BAR2
Sepherosa Ziehau [Thu, 21 Nov 2013 00:43:57 +0000 (08:43 +0800)]
bnx: Only 5718 chip family use PCI_BAR4 as MSI-X table; rest use PCI_BAR2

DragonFly-bug: http://bugs.dragonflybsd.org/issues/2605

10 years agopcidevs: Add VMware vendor id
François Tigeot [Wed, 20 Nov 2013 21:44:26 +0000 (22:44 +0100)]
pcidevs: Add VMware vendor id

10 years agoboot: switch limits check and usage of the index in two for()s.
Sascha Wildner [Wed, 20 Nov 2013 19:40:22 +0000 (20:40 +0100)]
boot: switch limits check and usage of the index in two for()s.

10 years agoboot: Remove an unused variable.
Sascha Wildner [Wed, 20 Nov 2013 19:38:58 +0000 (20:38 +0100)]
boot: Remove an unused variable.

10 years agoboot: Adjust some printfs which take unsigned but had %d.
Sascha Wildner [Wed, 20 Nov 2013 19:38:13 +0000 (20:38 +0100)]
boot: Adjust some printfs which take unsigned but had %d.

10 years ago<sys/types.h>: Remove wrong #include guard check.
Sascha Wildner [Wed, 20 Nov 2013 19:33:57 +0000 (20:33 +0100)]
<sys/types.h>: Remove wrong #include guard check.

10 years agoNote on ABI change requiring rebuild of third-party software.
Justin C. Sherrill [Wed, 20 Nov 2013 05:03:41 +0000 (00:03 -0500)]
Note on ABI change requiring rebuild of third-party software.

(cherry picked from commit ac04afc3258dcdbfc2072a1df56803905e8bbbad)

10 years agoAdd note about reboot before 'make upgrade' step.
Justin C. Sherrill [Wed, 20 Nov 2013 05:01:21 +0000 (00:01 -0500)]
Add note about reboot before 'make upgrade' step.

Based on:

http://lists.dragonflybsd.org/pipermail/users/2013-September/090163.html
(cherry picked from commit 43f7fa4fcaec7f2308a0442cf485b180de7b3c1a)

10 years agokernel/isp: Remove two checks which were never true.
Sascha Wildner [Wed, 20 Nov 2013 04:03:27 +0000 (05:03 +0100)]
kernel/isp: Remove two checks which were never true.

10 years agomemcpy.3: Bring back mempcpy() docs which were removed by mistake.
Sascha Wildner [Tue, 19 Nov 2013 11:34:00 +0000 (12:34 +0100)]
memcpy.3: Bring back mempcpy() docs which were removed by mistake.

10 years agoRevert "da: Independant read/write bioqs are used, so no need to use bioqdisksort"
Sepherosa Ziehau [Tue, 19 Nov 2013 02:43:31 +0000 (10:43 +0800)]
Revert "da: Independant read/write bioqs are used, so no need to use bioqdisksort"

This reverts commit 3f9f5f9aaf14daa1f014ab9c4780f90b4c17bd6d.

bioqdisksort may be augmented later to support read-read or write-write
reordering.  At least currently it does not hurt, so leave it there.

Pointed-out-by: dillon@
10 years agocmp(1): Take latest changes from FreeBSD's implementation.
Eitan Adler [Mon, 18 Nov 2013 23:13:24 +0000 (18:13 -0500)]
cmp(1): Take latest changes from FreeBSD's implementation.

In particular handle symbolic links more correctly, add a
signal handler, and other misc changes.

10 years agoRemove advertising clause from extern.h header.
Eitan Adler [Mon, 18 Nov 2013 23:04:45 +0000 (18:04 -0500)]
Remove advertising clause from extern.h header.

Taken From: FreeBSD

10 years agoAdd support for an -h flag which causes cmp(1) to not follow symlinks.
Eitan Adler [Mon, 18 Nov 2013 22:43:44 +0000 (17:43 -0500)]
Add support for an -h flag which causes cmp(1) to not follow symlinks.

10 years agocmp(1): fix some build nits (to build on FreeBSD)
Eitan Adler [Mon, 18 Nov 2013 22:36:52 +0000 (17:36 -0500)]
cmp(1): fix some build nits (to build on FreeBSD)

Add standard headers where appropriate.

Convert variable to static where appropriate.

10 years agofix the INT64_C and INTMAX_C family macro for x86_64.
Alexandre Perrin [Mon, 18 Nov 2013 22:16:22 +0000 (23:16 +0100)]
fix the INT64_C and INTMAX_C family macro for x86_64.

  This patch fix the expanding type of both the INT64_C and the INTMAX_C
  family macros to match their corresponding type:
  - INT64_C(value) to `int_least64_t`
  - UINT64_C(value) to `uint_least64_t`
  - INTMAX_C(value) to `intmax_t`
  - UINTMAX_C(value) to `uintmax_t`

10 years agoAdd MLINKS for kmalloc_cachealign() and kmalloc_raise_limit().
Sascha Wildner [Mon, 18 Nov 2013 19:11:43 +0000 (20:11 +0100)]
Add MLINKS for kmalloc_cachealign() and kmalloc_raise_limit().

10 years agokmalloc.9: Mention kmalloc_cachealign() in the NAME section, too.
Sascha Wildner [Mon, 18 Nov 2013 19:11:29 +0000 (20:11 +0100)]
kmalloc.9: Mention kmalloc_cachealign() in the NAME section, too.

10 years agokernel - Fix ESTALE handling in stat() and access()
Matthew Dillon [Mon, 18 Nov 2013 18:42:08 +0000 (10:42 -0800)]
kernel - Fix ESTALE handling in stat() and access()

* ESTALE could cause a panic due to shared namecache lock.  Relock
  the ncp exclusively when forcing re-resolution of the ncp due to
  ESTALE.

  ESTALE can occur on NFS mounts.

Reported-by: thesjg
10 years agoda: Independant read/write bioqs are used, so no need to use bioqdisksort
Sepherosa Ziehau [Mon, 18 Nov 2013 13:35:40 +0000 (21:35 +0800)]
da: Independant read/write bioqs are used, so no need to use bioqdisksort

10 years agoahci: If the "nominal rotation rate" is 1, then disk is SSD
Sepherosa Ziehau [Mon, 18 Nov 2013 12:44:05 +0000 (20:44 +0800)]
ahci: If the "nominal rotation rate" is 1, then disk is SSD

10 years agoahci: Print "Serial ATA Additional capabilities"
Sepherosa Ziehau [Mon, 18 Nov 2013 11:26:34 +0000 (19:26 +0800)]
ahci: Print "Serial ATA Additional capabilities"

The 7th bit of this field indicates whether SEND FPDMA QUEUED and
RECEIVE FPDMA QUEUED are supported or not.  SEND FPDMA QUEUED could
be used to support NCQ TRIM.

If this bit is set, following steps are needed to determine whether
NCQ TRIM could be used or not:

    READ LOG EXT (0x00, General Purpose Log Directory Log)
    if (!log8[0x26]) {
       no NCQ TRIM support
       return
    }
    READ LOG EXT (0x13, NCQ Send and Receive Log)
    if ((log32[0] & 0x1) == 0) {
       no NCQ TRIM support
       return
    }
    if ((log32[1] & 0x1) == 0) {
       no NCQ TRIM support
       return
    }
    /* NCQ TRIM is supported */

10 years agoisphonogram.3: Fix xlocale(3) reference.
Sascha Wildner [Mon, 18 Nov 2013 06:47:16 +0000 (07:47 +0100)]
isphonogram.3: Fix xlocale(3) reference.

10 years agolibc: Sync strfmon() with FreeBSD (brings in strfmon_l(), too).
Sascha Wildner [Sun, 17 Nov 2013 23:24:23 +0000 (00:24 +0100)]
libc: Sync strfmon() with FreeBSD (brings in strfmon_l(), too).

10 years ago<xlocale.h>: Mark strftime_l() as __strftimelike.
Sascha Wildner [Sun, 17 Nov 2013 23:23:42 +0000 (00:23 +0100)]
<xlocale.h>: Mark strftime_l() as __strftimelike.

10 years ago<sys/cdefs.h>: Add __strfmonlike and __strftimelike (from FreeBSD).
Sascha Wildner [Sun, 17 Nov 2013 23:22:41 +0000 (00:22 +0100)]
<sys/cdefs.h>: Add __strfmonlike and __strftimelike (from FreeBSD).

10 years agoAdd localeconv_l(3) MLINK.
Sascha Wildner [Sun, 17 Nov 2013 18:33:49 +0000 (19:33 +0100)]
Add localeconv_l(3) MLINK.

10 years agodigittoint.3: Add missing whitespace.
Sascha Wildner [Sun, 17 Nov 2013 18:19:29 +0000 (19:19 +0100)]
digittoint.3: Add missing whitespace.

10 years agogroff: properly display $Mdocdate magic
Franco Fichtner [Sun, 17 Nov 2013 13:39:56 +0000 (13:39 +0000)]
groff: properly display $Mdocdate magic

OpenSSH and mdocml pages require this.  Reduces the groff/mandoc
output diff.  I heard this was suggested upstream a while ago, but
never made it into the code base.

Taken-from: OpenBSD

10 years agowscanf_l.3: Adjust wording yet again to match scanf_l.3.
Sascha Wildner [Sun, 17 Nov 2013 06:16:44 +0000 (07:16 +0100)]
wscanf_l.3: Adjust wording yet again to match scanf_l.3.

10 years agolibc: Add atof_l(), atoi_l(), atol_l() and atoll_l().
Sascha Wildner [Sun, 17 Nov 2013 06:12:02 +0000 (07:12 +0100)]
libc: Add atof_l(), atoi_l(), atol_l() and atoll_l().

10 years agoUse 'static' where appropriate
Justin C. Sherrill [Sun, 17 Nov 2013 04:27:51 +0000 (23:27 -0500)]
Use 'static' where appropriate

Patch-from: Eitan Adler <lists@eitanadler.com>

10 years agowscanf_l.3: Fix description.
Sascha Wildner [Sun, 17 Nov 2013 03:22:20 +0000 (04:22 +0100)]
wscanf_l.3: Fix description.

10 years agow{print,scan}f_l.3: Fix manual page titles.
Sascha Wildner [Sun, 17 Nov 2013 03:02:21 +0000 (04:02 +0100)]
w{print,scan}f_l.3: Fix manual page titles.

10 years agolibc: Oops, typo in the Makefile.
Sascha Wildner [Sun, 17 Nov 2013 02:56:01 +0000 (03:56 +0100)]
libc: Oops, typo in the Makefile.

10 years agoAdd a wscanf_l.3 manual page, modeled after scanf_l.3.
Sascha Wildner [Sun, 17 Nov 2013 02:47:36 +0000 (03:47 +0100)]
Add a wscanf_l.3 manual page, modeled after scanf_l.3.

10 years agolibc: Add swscanf_l() and vwscanf_l().
Sascha Wildner [Sun, 17 Nov 2013 02:46:20 +0000 (03:46 +0100)]
libc: Add swscanf_l() and vwscanf_l().

10 years agoAdd the scanf_l.3 manual page from FreeBSD.
Sascha Wildner [Sun, 17 Nov 2013 01:33:33 +0000 (02:33 +0100)]
Add the scanf_l.3 manual page from FreeBSD.

10 years agoAdd a wprintf_l.3 manual page, modeled after printf_l.3.
Sascha Wildner [Sun, 17 Nov 2013 00:59:20 +0000 (01:59 +0100)]
Add a wprintf_l.3 manual page, modeled after printf_l.3.

10 years agowprintf.3: Add a missing argument name.
Sascha Wildner [Sun, 17 Nov 2013 00:58:15 +0000 (01:58 +0100)]
wprintf.3: Add a missing argument name.

10 years agolibc: Add swprintf_l() and vwprintf_l().
Sascha Wildner [Sun, 17 Nov 2013 00:57:33 +0000 (01:57 +0100)]
libc: Add swprintf_l() and vwprintf_l().

10 years agoAdd the printf_l.3 manual page from FreeBSD.
Sascha Wildner [Sat, 16 Nov 2013 22:10:01 +0000 (23:10 +0100)]
Add the printf_l.3 manual page from FreeBSD.

10 years agolibc: Add vprintf_l(), which somehow was missed.
Sascha Wildner [Sat, 16 Nov 2013 22:09:27 +0000 (23:09 +0100)]
libc: Add vprintf_l(), which somehow was missed.

10 years agoFix some typos in manual page references.
Sascha Wildner [Sat, 16 Nov 2013 03:49:00 +0000 (04:49 +0100)]
Fix some typos in manual page references.

10 years agoUpdate the pciconf(8) database.
Sascha Wildner [Fri, 15 Nov 2013 13:31:12 +0000 (14:31 +0100)]
Update the pciconf(8) database.

November 14, 2013 snapshot from http://pciids.sourceforge.net/

10 years agohammer2 - Stabilization
Matthew Dillon [Fri, 15 Nov 2013 08:21:23 +0000 (00:21 -0800)]
hammer2 - Stabilization

Yet more stabilization.  Generally speaking the code is starting to look
pretty good, but finding the corner cases for the in-memory chain state
has taken more time than I had hoped.  All of this complexity exists solely
in order to allow flushes to run concurrently with modifying operations by
the front-end (which is a pretty significant performance feature).

* Fix a bug in the hammer2_chain_get() race detection code.

* Refactor hammer2_freemap_alloc() a bit.

* Save debug info in dead block array fields (temporary), and add some
  debugging field to the chain structure.

* Refactor the flush code that checks whether a deleted chain should be
  ignored or not, fixing a bug at the same time.

* Refactor the transaction sequencing.  Flushes now allocate an extra
  transaction id so a distinction can be made between chains whos block
  arrays have not been updated and chains whos block arrays have been
  updated.

* Refactor the MOVED flag removal algorithm a little, fixing a bug or two.

* Adjust the freemap to detect forked chains and ensure that a different
  reserved block is calculated for the two possible forks.

* Fix a few mount fail cases that were panicing.

* Update bref.mirror_tid in scan1 skip cases.

* Do not update bref.mirror_tid in the skip case as this can confuse
  how a child's block array is interpreted in a future flush.

* Augment chain code with maxloops counters for debugging infinite
  loops.

* Remove the CHAIN_DUPLICATED tests in hammer2_chain_find() as this can
  catch a delete-duplicate in-progress and incorrectly cause the search
  to fail.

* Remove looping on CHAIN_DUPLICATED detection.  Instead what we do now
  is lock the chain before testing the CHAIN_DELETED bit.  Locking the
  chain will resolve delete-duplicate races and place the chain in a
  deterministic state.  The CHAIN_DELETED test is then sufficient.

10 years agokernel - Performance tuning (4)
Matthew Dillon [Fri, 15 Nov 2013 08:19:02 +0000 (00:19 -0800)]
kernel - Performance tuning (4)

* Fix another bug in the new buf/bio code.  The flushing state can
  inadvertently become active and cause an endless loop due to a
  64-bit optimization (when BKVASIZE == MAXBSIZE) which is not properly
  conditionalized.

* Fix the endless loop.

* Add some debug variables and a sysctl to control it (temporary).

10 years agoAdded CFLAGS+= -DTARGET_SYSTEM_ROOT=\"${USRDATA_PREFIX}\" to makefile for ld.
Markus Pfeiffer [Thu, 14 Nov 2013 20:31:21 +0000 (20:31 +0000)]
Added CFLAGS+= -DTARGET_SYSTEM_ROOT=\"${USRDATA_PREFIX}\" to makefile for ld.

The ld that is build into ctools_x86_64 to build world tries to check runtime
dynamic dependencies. For this it tried loading /var/run/ld-elf.so.hints and
hence failed if symbols in libc or libpthread are removed for the new
buildworld.

10 years agocpdup - Add another way to prevent host:path misintepretation
Matthew Dillon [Thu, 14 Nov 2013 20:23:15 +0000 (12:23 -0800)]
cpdup - Add another way to prevent host:path misintepretation

* Allow a local file or directory name to be prefixed with localhost:
  to prevent colons in the filename from being misinterpreted as a
  remote-host specification.

  This is in addition to the nominal absolute-path method to prevent
  misinterpretation (a '/' occuring before any ':' prevents
  misinterpretation of the ':' as a remote-host specification)

10 years agokernel - Performance tuning (3)
Matthew Dillon [Thu, 14 Nov 2013 19:54:09 +0000 (11:54 -0800)]
kernel - Performance tuning (3)

* The VOP_CLOSE issues revealed a bigger issue with vn_lock().  Many
  callers do not check the return code for vn_lock() and in nearly all
  of those cases it wouldn't fail anyway due to a prior ref, but it
  creates an API issue.

* Add the LK_FAILRECLAIM flag to vn_lock().  This flag explicitly allows
  vn_lock() to fail if the vnode is undergoing reclamation.

  This fixes numerous issues, particularly when VOP_CLOSE() is called
  during a reclaim due to recent LK_UPGRADE's that we do in some VFS
  *_close() functions.

* Remove some unused LK_ defines.

10 years agokernel - Fine-grain getnewbuf() and related vfs/bio data structures (2)
Matthew Dillon [Thu, 14 Nov 2013 18:36:32 +0000 (10:36 -0800)]
kernel - Fine-grain getnewbuf() and related vfs/bio data structures (2)

* Fix bug where bufinit() was being called prior to SMP initialization,
  so it was only initializing the queues for one cpu instead of all of
  them.

10 years agokernel - Performance tuning (2)
Matthew Dillon [Thu, 14 Nov 2013 17:50:33 +0000 (09:50 -0800)]
kernel - Performance tuning (2)

* Fix but in VOP_CLOSE changes.  All calls to VOP_CLOSE() require the
  vnode to be locked shared or exclusive.  sys_swapoff() wasn't.

Reported-by: swildner
10 years agoifq: Use lwkt_sendmsg_oncpu to schedule the netisr on the current CPU
Sepherosa Ziehau [Thu, 14 Nov 2013 13:46:48 +0000 (21:46 +0800)]
ifq: Use lwkt_sendmsg_oncpu to schedule the netisr on the current CPU

10 years agokernel/drm: Remove an unused MALLOC_DECLARE.
Sascha Wildner [Thu, 14 Nov 2013 12:03:29 +0000 (13:03 +0100)]
kernel/drm: Remove an unused MALLOC_DECLARE.

10 years agoed(1): Sync with FreeBSD.
Sascha Wildner [Thu, 14 Nov 2013 12:01:25 +0000 (13:01 +0100)]
ed(1): Sync with FreeBSD.

Plugs some memory leaks and bumps WARNS to 6, mainly.

10 years agohammer2 - Implement crash recovery, cleanups, stabilization
Matthew Dillon [Thu, 14 Nov 2013 04:23:02 +0000 (20:23 -0800)]
hammer2 - Implement crash recovery, cleanups, stabilization

* Allocations which are made by the flush itself run in the next
  transaction instead of the current transaction.  We do this so the
  flush code can flush a stable version of the freemap itself.

* Implement crash recovery.  Due to the above mechanics an incremental
  scan must be run at mount-time of all chains belonging to the last
  transaction and ensure that the blocks are marked allocated in the
  freemap.  Since the scan is incremental this doesn't take very long.

* Add some chain API infrastructure to support the incremental scan.

* Allow transactions to operate on a single media mount point (hmp)
  (verses a pfsmount (pmp)).  Used by the recovery code.

* Take another pass on the flush algorithm, fixing a few bugs.  The
  filter is still pretty fragile unfortunately.  Having to special-case
  the root chains (hmp->vchain and hmp->fchain) is causing problems.

  Add debugging to help figure out an assertion that still occurs.

10 years ago<time.h>: #if 0 some prototypes of syscalls which we don't (yet) have.
Sascha Wildner [Tue, 12 Nov 2013 21:14:24 +0000 (22:14 +0100)]
<time.h>: #if 0 some prototypes of syscalls which we don't (yet) have.

Came in with the "locale megapatch". Useless without implementation, but
leave them in #if 0 since (being standard) we want them.

10 years agokernel/iwn: Update FreeBSD SVN IDs.
Sascha Wildner [Sat, 9 Nov 2013 09:33:37 +0000 (10:33 +0100)]
kernel/iwn: Update FreeBSD SVN IDs.

10 years agokernel/drm: Fix incomplete commit 116d6d9766.
Sascha Wildner [Tue, 12 Nov 2013 08:34:43 +0000 (09:34 +0100)]
kernel/drm: Fix incomplete commit 116d6d9766.

Remove drm_drawable.c from 'files' and while here, also remove a no
longer used malloc type.

10 years agovkernel - Minor adjustments to test/vkernel
Matthew Dillon [Tue, 12 Nov 2013 01:44:10 +0000 (17:44 -0800)]
vkernel - Minor adjustments to test/vkernel

* Minor adjustments to the Makefile

10 years agodrm: drm_drawable.c has been useless for years
François Tigeot [Mon, 11 Nov 2013 19:59:43 +0000 (20:59 +0100)]
drm: drm_drawable.c has been useless for years

Remove it.

10 years agoconfig: improve stale ThinkPad keyboard situation
Franco Fichtner [Mon, 11 Nov 2013 19:17:53 +0000 (20:17 +0100)]
config: improve stale ThinkPad keyboard situation

Neither the DragonFly release nor snapshots accept the builtin keyboard
of a Lenovo T430u (and apparently a couple of others).  FreeBSD as old as
8.3, however, works just fine.  Turns out that the KB_CONF_FAIL_IF_NO_KBD
flag of atkbd(4) still lingers in GENERIC, SOEKRIS and X86_64_GENERIC.

Tested against regressions when hotplugging USB keyboards without a PS/2
keyboard present on an old Athlon64.

We have one panic report by sephe in the kbdsw code, which is triggered
by pressing a key on a previously unresponsive keyboard, but no further
info for debugging at this point.

Force the issue now that the release has been branched.

Backed-by: sephe, swildner
10 years agomdocml: bump DragonFly version number
Franco Fichtner [Mon, 11 Nov 2013 19:11:12 +0000 (20:11 +0100)]
mdocml: bump DragonFly version number

10 years agohammer2 - Add assertions, fix a flush race against delete-duplicate
Matthew Dillon [Mon, 11 Nov 2013 17:15:14 +0000 (09:15 -0800)]
hammer2 - Add assertions, fix a flush race against delete-duplicate

* hammer2_chain_delete_duplicate() does not require a lock on the parent
  chain, nor do we want to require one.  This can result in a race against
  indirect block creation which is trying to D-D chains from an upper chain
  to a lower one.

* Fix the problem by moving the DELETED check in
  hammer2_chain_create_indirect() from before the chain lock to after.

* Minor cleanup of the same routine.

* Add assertions to try to catch any situation where the block table is
  flushed twice, which would cause a later assertion.  Try to catch it
  earlier.

10 years agohammer - Remove cache_inval_vp() call
Matthew Dillon [Mon, 11 Nov 2013 17:14:15 +0000 (09:14 -0800)]
hammer - Remove cache_inval_vp() call

* Remova a call to cache_inval_vp() that no other VFSs use which was
  causing deadlocks against concurrent rm's of hardlinks to the same
  file.

Reported-by: ftigeot
10 years agokernel - Fix lock/delete race in the namecache
Matthew Dillon [Mon, 11 Nov 2013 17:12:58 +0000 (09:12 -0800)]
kernel - Fix lock/delete race in the namecache

* Re-check ncp connectivity and the NCF_DESTROYED flag after
  successfully locking the ncp.

10 years agokernel - Correct bug in buf/bio locking work
Matthew Dillon [Mon, 11 Nov 2013 17:11:43 +0000 (09:11 -0800)]
kernel - Correct bug in buf/bio locking work

* Use atomic_swap_int() to test-and-clear the buffer daemon request, and
  tsleep_interlock/tsleep to catch any races.

10 years agokernel: Add an alias for the FreeBSD callout_drain() function
François Tigeot [Sun, 10 Nov 2013 20:29:31 +0000 (21:29 +0100)]
kernel: Add an alias for the FreeBSD callout_drain() function

10 years agoiwn: fix compilation without INVARIANTS
Johannes Hofmann [Sat, 9 Nov 2013 20:13:49 +0000 (21:13 +0100)]
iwn: fix compilation without INVARIANTS

wlan_serializer is now held consistently, so we can get rid
of the conditional locking which breaks building without
INVARIANTS.

noticed-by: Andrey Oktyabrskiy

10 years agokernel - Fix bug in e11efbb
Matthew Dillon [Sat, 9 Nov 2013 18:13:14 +0000 (10:13 -0800)]
kernel - Fix bug in e11efbb

* Fix bug in runningbufreq handling.  We were never setting the value to
  non-zero so if we slept, we never woke up.

10 years agopkill - Optimize pgrep -F
Matthew Dillon [Sat, 9 Nov 2013 17:08:47 +0000 (09:08 -0800)]
pkill - Optimize pgrep -F

* Ask for a specific process instead of pulling down all processes when
  -F <pidfile> is specified.  This is much much faster.

10 years agokernel - Performance tuning
Matthew Dillon [Sat, 9 Nov 2013 04:59:32 +0000 (20:59 -0800)]
kernel - Performance tuning

* Use a shared lock in the exec*() code, open, close, chdir, fchdir,
  access, stat, and readlink.

* Adjust nlookup() to allow the last namecache record in a path to be
  locked shared if it is already resolved, and the caller requests it.

* Remove nearly all global locks from critical dsched paths.  Defer
  creation of the tdio until an I/O actually occurs (huge savings in
  the fork/exit paths).

* Improves fork/exec concurrency on monster of static binaries from
  14200/sec to 55000/sec+.  For dynamic binaries improve from around
  2500/sec to 9000/sec or so (48 cores fork/exec'ing different dynamic
  binaries).  For the same dynamic binary it's more around 5000/sec or
  so.

  Lots of issues here including the fact that all dynamic binaries load
  many shared resources, even hen the binaries are different programs.
  AKA libc.so.X and ld-elf.so.2, as well as /dev/urandom (from libc),
  and access numerous common path elements.

  Nearly all of these paths are now non-contending.  The major remaining
  contention is in per-vm_page/PMAP manipulation.  This is per-page and
  concurrent execs of the same program tend to pipeline so it isn't a
  big problem.

10 years agokernel - Fix lockmgr LK_UPGRADE bug
Matthew Dillon [Sat, 9 Nov 2013 04:46:43 +0000 (20:46 -0800)]
kernel - Fix lockmgr LK_UPGRADE bug

* Fix a bug in the LK_UPGRADE sequencing.  If an LKC_UPREQ owner is present
  and releasing the shared lock would release the lock, the UPREQ owner must
  be granted the exclusive lock right then and there.

10 years agokernel: Mark two variables as being used by KKASSERT() only.
Sascha Wildner [Sat, 9 Nov 2013 00:19:45 +0000 (01:19 +0100)]
kernel: Mark two variables as being used by KKASSERT() only.

Reported-by: Andrey Oktyabrskiy <ano@bestmx.net>
10 years agoopenssh - Fix an openssh issue.
Matthew Dillon [Fri, 8 Nov 2013 18:52:20 +0000 (10:52 -0800)]
openssh - Fix an openssh issue.

* Properly zero the newkey structure as per OpenBSD announcement.  Our older
  openssh does not implement the AES-GCM cipher that creates the vulnerability
  but fix the bug anyway.

10 years agokernel - Fine-grain getnewbuf() and related vfs/bio data structures
Matthew Dillon [Fri, 8 Nov 2013 18:32:57 +0000 (10:32 -0800)]
kernel - Fine-grain getnewbuf() and related vfs/bio data structures

* Replace the global bufqspin lock which the buffer cache uses to manage
  the clean/dirty/etc buffer queues with a per-cpu spinlock.

10 years agokernel - slotimer is MPSAFE, fix degenerate mplock case in callout threads
Matthew Dillon [Fri, 8 Nov 2013 18:29:49 +0000 (10:29 -0800)]
kernel - slotimer is MPSAFE, fix degenerate mplock case in callout threads

* The slotimer (runs once every 10 seconds) is MPSAFE.  This runs on all cpus
  all at once so it kinda created a little hicup before due to being defined
  wrong.

* When a callout thread sleeps, make sure any left-over mplock is not
  being held.

10 years agops - Remove display of the 'M'P state
Matthew Dillon [Fri, 8 Nov 2013 18:20:02 +0000 (10:20 -0800)]
ps - Remove display of the 'M'P state

* Remove display of the 'M' flag, which used to mean that the process was
  running MPSAFE w/regards to the kernel's mp_lock.  Well, pretty much
  all processes are MPSAFE now, so the flag just clutters the output.

10 years agosystat - Sync with kernel changes for SMP collision statistics
Matthew Dillon [Fri, 8 Nov 2013 07:23:59 +0000 (23:23 -0800)]
systat - Sync with kernel changes for SMP collision statistics

* Rename the tokcol fields to smpcol/label.  Remove the nice% field
  (combine it with user%) and expand the collision label space to
  18 characters.

* Now able to display token, lockmgr, mtx, and spinlock contention.

10 years agokernel - Improve SMP collision statistics
Matthew Dillon [Fri, 8 Nov 2013 07:22:20 +0000 (23:22 -0800)]
kernel - Improve SMP collision statistics

* Populate the per-cpu collision counter and label from the spinlock,
  lockmgr lock, and mutex code.  The token code already used it.

* Pass __func__ to the spinlock routines so it can be copied into
  the per-cpu collision label.

10 years agohammer2 - Stabilization
Matthew Dillon [Fri, 8 Nov 2013 05:51:46 +0000 (21:51 -0800)]
hammer2 - Stabilization

* Fix a bug where deferrals could cause a parent chain to be modified
  twice during a flush, and thus cause it to be flushed twice.

  The problem is that the double-modification is going from the current
  transaction id to the same id.  Block table updates can't tell whether
  the update has already been made in this situation and will try to apply
  the update twice, generally resulting in an assertion.

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.