dragonfly.git
11 years agoshlock(1) - Fix a possible overflow.
Gwenio [Sat, 9 Mar 2013 11:28:05 +0000 (12:28 +0100)]
shlock(1) - Fix a possible overflow.

11 years agoddb.4 - Mention recently added 'show tokens' command.
Antonio Huete Jimenez [Fri, 8 Mar 2013 13:32:12 +0000 (14:32 +0100)]
ddb.4 - Mention recently added 'show tokens' command.

11 years agobce: Utilize hardware supplied RSS hash
Sepherosa Ziehau [Sat, 9 Mar 2013 09:37:13 +0000 (17:37 +0800)]
bce: Utilize hardware supplied RSS hash

The IP fragment detection needs further investigation.  Currently we
can't tell for 100% sure whether the received packet is an IP fragment
or not; we just test the hardware supplied checksum against 0xffff for
IP fragment detection.  However, it is not a big deal in the current
code base, since IP fragments reassemabling is under a token (the IP
fragments reassemabing used to be only allowed on netisr0)

11 years agoethernet: Make hash check possible even if RSS_DEBUG is not defined
Sepherosa Ziehau [Sat, 9 Mar 2013 03:06:15 +0000 (11:06 +0800)]
ethernet: Make hash check possible even if RSS_DEBUG is not defined

This makes debugging RSS hash related stuffs easier

11 years agokernel/ddb - Add 'show tokens' function.
Antonio Huete Jimenez [Fri, 8 Mar 2013 00:40:39 +0000 (01:40 +0100)]
kernel/ddb - Add 'show tokens' function.

11 years agobce: Pack RX/TX mbuf related fields into struct
Sepherosa Ziehau [Thu, 7 Mar 2013 13:24:18 +0000 (21:24 +0800)]
bce: Pack RX/TX mbuf related fields into struct

Mainly to improve cache utilization.

11 years agobce: Strip extra blank lines
Sepherosa Ziehau [Thu, 7 Mar 2013 07:54:55 +0000 (15:54 +0800)]
bce: Strip extra blank lines

11 years agoSync zoneinfo database with tzdata2013a from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Thu, 7 Mar 2013 02:04:19 +0000 (03:04 +0100)]
Sync zoneinfo database with tzdata2013a from ftp://ftp.iana.org/tz/releases

* antarctica & southamerica: Chile's 2013 rules, and we guess rules for
    2014 and later, will be the same as 2012, namely Apr Sun>=23 03:00 UTC
    to Sep Sun>=2 04:00 UTC. (Thanks to Steffen Thorsen and Robert Elz.)

* europe: New "Asia/Khandyga" and "Asia/Ust-Nera" and "Europe/Busingen"
    zones. Also, improve the commentary about which districts observe
    what times in Russia. (Thanks to Tobias Conradi, Oscar van Vlijmen
    and Arthur David Olson.)

* various files: Many changes affecting historical time stamps before
    1940. These were deduced from: Milne J. Civil time. Geogr J. 1899
    Feb;13(2):173-94 <http://www.jstor.org/stable/1774359>.

11 years agovkernel.7: Use .Pa and break line on new sentence.
Sascha Wildner [Wed, 6 Mar 2013 16:49:10 +0000 (17:49 +0100)]
vkernel.7: Use .Pa and break line on new sentence.

11 years agovke(4) - Use M_ZERO for tx/rx ring allocation.
Antonio Huete Jimenez [Wed, 6 Mar 2013 15:59:34 +0000 (16:59 +0100)]
vke(4) - Use M_ZERO for tx/rx ring allocation.

Pointed-out-by: sephe
11 years agobce: White space cleanup
Sepherosa Ziehau [Wed, 6 Mar 2013 13:13:34 +0000 (21:13 +0800)]
bce: White space cleanup

11 years agobce: Put per RX ring received packets debug stats under BCE_RSS_DEBUG
Sepherosa Ziehau [Wed, 6 Mar 2013 13:11:32 +0000 (21:11 +0800)]
bce: Put per RX ring received packets debug stats under BCE_RSS_DEBUG

11 years agobce: Implement multiple TX/RX rings and MSI-X support for 5709/5716
Sepherosa Ziehau [Wed, 27 Feb 2013 13:53:37 +0000 (21:53 +0800)]
bce: Implement multiple TX/RX rings and MSI-X support for 5709/5716

5709/5716 support 9 RX rings, 9 TX rings and 9 MSI-X vectors; each
MSI-X vector has its own interrupt moderation parameters.

(N + 1) RX rings, N TX rings and (N + 1) MSI-X vectors will be enabled;
N is ncpus2, if ncpus2 is less than 8, else N will be 8.

The extra RX ring is enabled mainly because:
The first RX ring is only used for packets whose RSS hash could not
be calculated, so it is actually _not_ involved in RSS.  This extra RX
ring is used for the packets whose masked RSS hash equal 0.

An extra MSI-X vector is allocated for this extra RX ring; there is no
correponding TX ring for this extra RX ring.  In polling(4), this extra
RX ring is polled along with the first RX ring in the first RX polling
handler, in which the packets whose RSS hash equal 0 should be processed.

Hardware provided RSS hash and packet type are not utilized yet; they will
be supported in the upcoming commits.

Related hardware registers and hardware initialization order are infered
from Linux's bnx2 (*); NetXtremeII-PG203-R.pdf provided on Broadcom's
website does not contain enough information for multiple rings and MSI-X
to function.

(*) Unlike Linux's bnx2, which limits number of RX rings to 8, DragonFly
limits number of RX rings to 9 and 9 RX rings actually work quite well.

11 years agomkinitrd(8) - Exit upon vnconfig failure.
Antonio Huete Jimenez [Wed, 6 Mar 2013 10:56:48 +0000 (11:56 +0100)]
mkinitrd(8) - Exit upon vnconfig failure.

11 years agovke(4) - Add a tunable to set the max number of mbuf clusters per device.
Antonio Huete Jimenez [Tue, 5 Mar 2013 22:33:11 +0000 (23:33 +0100)]
vke(4) - Add a tunable to set the max number of mbuf clusters per device.

* Also cap it to 256 mbuf clusters by default.

11 years agokernel - Fix namecache hash list corruption
Matthew Dillon [Wed, 6 Mar 2013 01:22:33 +0000 (17:22 -0800)]
kernel - Fix namecache hash list corruption

* Fix namecache hash list corruption.  A rare race is possible where
  a dummy namecache element used as a placeholder in hash list scans
  might be improperly removed by another cpu.

Reported-by: ftigeot
11 years agokernel/pf: Fix a bunch of gcc47 -Waddress warnings.
Sascha Wildner [Tue, 5 Mar 2013 17:50:53 +0000 (18:50 +0100)]
kernel/pf: Fix a bunch of gcc47 -Waddress warnings.

The REASON_SET() macro is sometimes called with the address of a local
u_short instead of a pointer passed to the macro's caller. In its NULL
check, gcc47 detects that the address can never be NULL and issues a
-Waddress warning which part of -Wall.

To silence it, go via a u_short pointer in the macro. This fix is about
as harmless as the "issue" gcc47 was warning about.

While here, put two "x" parameters in parentheses.

11 years agokernel - remove kprintf info about magazine capacity
John Marino [Tue, 5 Mar 2013 17:08:54 +0000 (18:08 +0100)]
kernel - remove kprintf info about magazine capacity

This kprintf was added when the magazine capacity calculation was
modified (commit 765b1ae0159cca211559c3035641d842f28defd7).

While it only emits with verbose boot, the message can become quite a
nuisance with tmpfs mounts.  Running poudriere with verbose boot
effectively takes away the first virtual terminal.  This information
isn't very useful anymore, so get rid of it altogether.

Approved-by: dillon
11 years agostrchr.3: Small wording fixes.
Sascha Wildner [Tue, 5 Mar 2013 17:03:01 +0000 (18:03 +0100)]
strchr.3: Small wording fixes.

11 years agokernel - Fix at least one 64-bit ddb backtrace issue
Matthew Dillon [Tue, 5 Mar 2013 01:15:09 +0000 (17:15 -0800)]
kernel - Fix at least one 64-bit ddb backtrace issue

* Fix DDB support functions which were overflowing a 4-byte buffer when
  reading and writing 8-byte values.

Reported-by: tuxillo
11 years agokernel - Attempt to fix SMP races with ^T
Matthew Dillon [Mon, 4 Mar 2013 22:42:07 +0000 (14:42 -0800)]
kernel - Attempt to fix SMP races with ^T

* The ^T (ttyinfo()) code was still using critical-sections to protect
  its probe.  This no longer works.  Replace with appropriate hold's and
  tokens.

Reported-by: marino
11 years agolibc: Add strchrnul(), a glibc extension
François Tigeot [Sun, 3 Mar 2013 19:04:26 +0000 (20:04 +0100)]
libc: Add strchrnul(), a glibc extension

* This function behaves like strchr() but returns a pointer to the
  terminating \0 byte of the string instead of NULL if the character
  was not found

* It was first implemented in glibc-2.1.1

Obtained-from: FreeBSD

11 years agoaltq: Don't use poll cache
Sepherosa Ziehau [Mon, 4 Mar 2013 07:37:48 +0000 (15:37 +0800)]
altq: Don't use poll cache

The poll/dequeue model is no longer applicable to SMP system, e.g.

   CPU-A            CPU-B
     :                :
   poll               :
     :              poll
   dequeue (+)        :

The dequeue at (+) will hit the poll cache set by CPU-B.

Reported-by: pavalos@
11 years agokernel - Increase size of savefpu area in pcb for vkernel64
Matthew Dillon [Mon, 4 Mar 2013 02:25:14 +0000 (18:25 -0800)]
kernel - Increase size of savefpu area in pcb for vkernel64

* The vkernel64 uses bcopy.  The ucontext_t/mcontext_t reserves a 1024
  byte space for the fpu area, but the savefpu structure only reserves
  834 bytes.  Increase the savefpu structure appropriately.

* Did not effect real 64-bit kernels because they used machine instructions
  to save/restore the FP state and/or bcopy'd using the savefpu structure
  sdize instead of the size of the fpu area in the ucontext/mcontext
  structure.

* Fixes panics in vkernel64

Reported-by: tuxillo
11 years agokernel/ufs: Use __offsetof() instead of offsetof() (unbreaks buildworld).
Sascha Wildner [Mon, 4 Mar 2013 00:51:24 +0000 (01:51 +0100)]
kernel/ufs: Use __offsetof() instead of offsetof() (unbreaks buildworld).

__offsetof() is known to userland too, and <vfs/ufs/dir.h> is shared with
some userland programs.

Reported-by: marino
11 years agokernel: Use our offsetof() from <sys/types.h> instead of a local one.
Sascha Wildner [Sun, 3 Mar 2013 19:23:26 +0000 (20:23 +0100)]
kernel: Use our offsetof() from <sys/types.h> instead of a local one.

On GCC 4.1 and later, our offsetof() winds up being __builtin_offsetof(),
which is constant to GCC, so as a nice benefit this commit also fixes two
GCC 4.7 warnings:

.../dirhash.h:97:95: warning: variably modified 'dh_firstfree' at file scope
.../vdevice.h:145:2: warning: variably modified '_ArrayTables' at file scope

There are more offsetof() candidates I need to get to but since those two
fix warnings, I commit them now.

11 years agokernel/tmpfs: Add missing include for vm_wait_nominal() prototype.
Sascha Wildner [Sun, 3 Mar 2013 17:16:31 +0000 (18:16 +0100)]
kernel/tmpfs: Add missing include for vm_wait_nominal() prototype.

11 years agokernel/arpresolve: Initialize 'rt' with NULL.
Sascha Wildner [Sun, 3 Mar 2013 12:19:41 +0000 (13:19 +0100)]
kernel/arpresolve: Initialize 'rt' with NULL.

This fixes a case where NULL was passed for 'rt0' and 'rt' could end up
uninitialized at the log() call in line 509.

Review by sephe showed that we never pass NULL as 'rt0' but let's fix it
anyway, to be safer.

Reported-by: enroljas
Reviewed-by: sephe
11 years agokernel - Improve vm.vmmeter sysctl performance
Matthew Dillon [Sun, 3 Mar 2013 08:17:42 +0000 (00:17 -0800)]
kernel - Improve vm.vmmeter sysctl performance

* Improve performance by reducing the rate at which the marker is moved.

* Fix a bug, noting that lwkt_yield() can cause us to lose the token,
  by always using the marker for both it and the collision case.

11 years agokernel - Refactor swapoff scan code
Matthew Dillon [Sun, 3 Mar 2013 08:15:42 +0000 (00:15 -0800)]
kernel - Refactor swapoff scan code

* Refactor the scan code to be far more optimal.  The old scan was
  restarting the entire VM object scan on each swap block removed
  from the swap device being turned off.

* Scan twice before giving up to try to catch any elements which
  are in-transition.

11 years agokernel - Make VM fault waits in low memory the same as other low memory waits
Matthew Dillon [Sun, 3 Mar 2013 01:11:19 +0000 (17:11 -0800)]
kernel - Make VM fault waits in low memory the same as other low memory waits

* Nominal memory allocations, particularly by tmpfs, allow allocations
  down to the 'min' before waiting for memory to recover to 'target'.
  The VM fault code required memory to be at or above the 'target'
  at all times.  This led to extreme starvation because other user-accessible
  subsystems could force free memory to remain below 'target'.

* Change the VM code to use substantially the same down-to 'min' and
  recover-to 'target' parameters that other subsystems use.  This
  should reduce the excessive stalls under low memory conditions.

* Rename vm_waitpfault() to vm_wait_pfault() to conform with other
  naming schemes in the same API.

11 years agokernel - Add swap block allocation iterator
Matthew Dillon [Sun, 3 Mar 2013 01:03:17 +0000 (17:03 -0800)]
kernel - Add swap block allocation iterator

* Instead of allocating the first available block the swap allocator
  now has an iterator and attempts to allocate a block near the iterator.
  On failure the iterator resets to the beginning of swap (0) and it
  tries again.

* This theoretically should result in more linearized allocations of
  swap space, allowing the pageout daemon to flush memory to a
  hard-drive-based swap at much higher bandwidth.

* Greatly improves poudriere when using stressful memory parameters,
  at least in the first pass.

* There are still some obvious linearity issues that can occur once
  the iterator recycles back to 0 which need to be addressed.  However,
  this change is certainly not going to be worse and should
  prevent degenerative swap situations where performance winds up
  being permanently bad due to fragmented data laid down earlier that
  is never paged back into memory.

11 years agokernel - Abort pageout operations when free memory recovers
Matthew Dillon [Sat, 2 Mar 2013 06:07:51 +0000 (22:07 -0800)]
kernel - Abort pageout operations when free memory recovers

* Nominal pageout operations free memory.  On systems with large amounts
  of ram the pageout count can be very large and take a long time to
  clear.  During this period, other unrelated processes might free memory.
  But even when sufficient memory is freed the pageout daemon still tries
  to finish clearing its previously calculated number of pages.

* Add a check in the deactivation scan to break out of the loop if
  a sufficient number of free pages is detected.

* Fixes unnecessary extra paging out of data (which can go on for several
  minutes) on large systems when memory is freed by other means.

11 years agokernel - Fix tmpfs hogging of the VM system
Matthew Dillon [Sat, 2 Mar 2013 06:06:42 +0000 (22:06 -0800)]
kernel - Fix tmpfs hogging of the VM system

* tmpfs pretty much bypasses the buffer cache's normal clean/dirty
  handling.  Add appropriate VM paging wait states to prevent
  tmpfs operations from hogging free memory and causing other processes
  to stall for long periods of time in low memory situations.

11 years agokernel - Change namecache negative caching algorithm
Matthew Dillon [Sat, 2 Mar 2013 06:02:18 +0000 (22:02 -0800)]
kernel - Change namecache negative caching algorithm

* Use desiredvnodes instead of numcache (current number of namecache
  entries) to scale the number of negative cache entries.

  This allows for more negative cache entries and no longer has
  degenerate situations when the value of numcache is low.

* namecache entries are still cleaned up in the critical namecache
  paths, but vnlru() now also cleans up the namecache when it exceeds
  80% of its nominal maximum.  The result is that the namecache is
  kept under better control AND the cleanups are generally able to be
  handled by vnlru() and do not effect the critical paths.

* Huge improvement in poudriere during concurrent python easy_install
  execution.  The python easy_install performs horribly without sufficient
  negative caching.  This fixes that.

Reported-by: thesjg
11 years agokernel - remove PAGE RACE kprintf
Matthew Dillon [Sat, 2 Mar 2013 01:08:33 +0000 (17:08 -0800)]
kernel - remove PAGE RACE kprintf

* Used for debugging verification of the race, no longer needed.

Reported-by: tuxillo
11 years agoamd(4): Remove duplicate assignment.
Sascha Wildner [Fri, 1 Mar 2013 21:21:16 +0000 (22:21 +0100)]
amd(4): Remove duplicate assignment.

11 years agolibc/regex: Fix setting the maximum of the range.
Sascha Wildner [Fri, 1 Mar 2013 21:59:55 +0000 (22:59 +0100)]
libc/regex: Fix setting the maximum of the range.

11 years agokernel/ic: Fix allocation of the output buffer.
Sascha Wildner [Fri, 1 Mar 2013 21:04:51 +0000 (22:04 +0100)]
kernel/ic: Fix allocation of the output buffer.

11 years agondis(4): Fix a wrong assignment.
Sascha Wildner [Fri, 1 Mar 2013 20:50:43 +0000 (21:50 +0100)]
ndis(4): Fix a wrong assignment.

11 years agomfi(4): Fix a wrong assignment.
Sascha Wildner [Fri, 1 Mar 2013 20:29:27 +0000 (21:29 +0100)]
mfi(4): Fix a wrong assignment.

11 years agovarsym.1: Use EXIT STATUS.
Sascha Wildner [Fri, 1 Mar 2013 08:14:51 +0000 (09:14 +0100)]
varsym.1: Use EXIT STATUS.

11 years agoSmall correction in man5 MLINKS.
Sascha Wildner [Fri, 1 Mar 2013 08:13:35 +0000 (09:13 +0100)]
Small correction in man5 MLINKS.

11 years agokernel - Do not clean VM pages on fsync() for tmpfs
Matthew Dillon [Fri, 1 Mar 2013 01:18:40 +0000 (17:18 -0800)]
kernel - Do not clean VM pages on fsync() for tmpfs

* tmpfs fsync()s are basically NOPs, but the kernel had some
  code to clean the VM object (flush to backing store) on
  fsync, which would actually cause pages to go out to swap
  unnecessarily.

* Detect the appropriate flag and turn this off.  Only effects
  tmpfs.

* Improves poudriere and other tmpfs-related use cases.

11 years agoufs.5 - Add missing MLINKS
Antonio Huete Jimenez [Fri, 1 Mar 2013 00:04:19 +0000 (01:04 +0100)]
ufs.5 - Add missing MLINKS

11 years agovarsym(1) - Fix return codes.
Antonio Huete Jimenez [Thu, 28 Feb 2013 23:29:59 +0000 (00:29 +0100)]
varsym(1) - Fix return codes.

* varsym was always returning 0 (success) which was incorrect.
* Return codes are now as indicated in the man page.

Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/2517>
Reported-by: Dmitry Razumovsky
11 years agovke(4) - Dynamic mbuf cluster allocation.
Antonio Huete Jimenez [Thu, 28 Feb 2013 20:54:49 +0000 (21:54 +0100)]
vke(4) - Dynamic mbuf cluster allocation.

* Calculate the number of mbuf clusters per ring buffer
  based on the total amount available in the system.

* Up to 50% of the total mbuf clusters is shared among
  all the vke devices configured in a vkernel.

11 years agokernel/u4b: sc is NULL here, so don't dereference it.
Sascha Wildner [Thu, 28 Feb 2013 18:35:23 +0000 (19:35 +0100)]
kernel/u4b: sc is NULL here, so don't dereference it.

11 years agokernel - Fix incorrectly ordered lwkt_reltoken() call in pageout daemon
Matthew Dillon [Thu, 28 Feb 2013 17:01:04 +0000 (09:01 -0800)]
kernel - Fix incorrectly ordered lwkt_reltoken() call in pageout daemon

* The pageout daemon was incorrectly swapping the top two VM objects
  in order to drop the prior object in a specific case where the 'new'
  object being rotated into is NULL.

11 years agovkernel64 - Remove some dead code (JGV).
Antonio Huete Jimenez [Thu, 28 Feb 2013 12:17:31 +0000 (13:17 +0100)]
vkernel64 - Remove some dead code (JGV).

11 years agoworld - Fix world build
Matthew Dillon [Thu, 28 Feb 2013 03:38:28 +0000 (19:38 -0800)]
world - Fix world build

* Fix world build for VMOUNT flag removal.

11 years agokernel - Remove improper EBUSY error on mount (2)
Matthew Dillon [Thu, 28 Feb 2013 01:08:37 +0000 (17:08 -0800)]
kernel - Remove improper EBUSY error on mount (2)

* Fix lock order reversal in checkdirs() exposed by the removal
  of the VMOUNT flag.

11 years agokernel - Remove improper EBUSY error on mount
Matthew Dillon [Thu, 28 Feb 2013 00:42:04 +0000 (16:42 -0800)]
kernel - Remove improper EBUSY error on mount

* Remove the old VMOUNT vnode flag.  This flag is no longer applicable
  to anything we do.

* Simultanious mounts onto the same target at different points in the
  topology could cause races against the VMOUNT flag due to the vnode
  being shared, resulting in an EBUSY error for a perfectly good mount
  request.

  For example, if you mount_null A to X, A to Y, and A to Z, then
  you simultaniously try to mount devfs onto X/dev, Y/dev, and Z/dev,
  some of those dev mount attempts could fail.  This was due to the
  VMOUNT flag set on the vnode.  X/dev, Y/dev, and Z/dev share the
  same physical vnode.

* Fixes poudriere weirdness when many jails are in use.

11 years agokernel: Remove <machine/apm_segments.h>.
Sascha Wildner [Wed, 27 Feb 2013 19:52:12 +0000 (20:52 +0100)]
kernel: Remove <machine/apm_segments.h>.

As far as I can see, those headers were never used for anything during
the lifetime of DragonFly.

11 years agokernel: Fix -Wundef in a number of places.
Sascha Wildner [Wed, 27 Feb 2013 19:13:21 +0000 (20:13 +0100)]
kernel: Fix -Wundef in a number of places.

11 years agogcc47/i386: Add more -mno flags
Sepherosa Ziehau [Wed, 27 Feb 2013 01:52:57 +0000 (09:52 +0800)]
gcc47/i386: Add more -mno flags

11 years agosystat - Fix overflowing path lookup fields
Matthew Dillon [Tue, 26 Feb 2013 23:20:43 +0000 (15:20 -0800)]
systat - Fix overflowing path lookup fields

* Reduce the field width for Path-lookups from 9 to 6 and
  hits from 7 to 6.  This normalizes the fields so similar
  numbers use the same units and ensures at least one space
  between them.

* Fixes display issues on large multi-way systems.

11 years agoisp(4): Remove a duplicate xpt_alloc_ccb() that was causing leakage.
Sascha Wildner [Tue, 26 Feb 2013 21:50:25 +0000 (22:50 +0100)]
isp(4): Remove a duplicate xpt_alloc_ccb() that was causing leakage.

Confirmed-by: mjacob@
11 years agokernel - Fix mount bug caught by assertion
Matthew Dillon [Tue, 26 Feb 2013 17:40:55 +0000 (09:40 -0800)]
kernel - Fix mount bug caught by assertion

* A recently added assertion caught a bug in the mount code where
  a namecache entry was not being properly locked.

* Fix the bug in checkdirs() (called by the mount code).

11 years agokqueue.2 - Mention tmpfs(5) as a kqueue-enabled filesystem.
Antonio Huete Jimenez [Tue, 26 Feb 2013 12:51:42 +0000 (13:51 +0100)]
kqueue.2 - Mention tmpfs(5) as a kqueue-enabled filesystem.

11 years agobce: Put interrupt reenabling into each interrupt handlers
Sepherosa Ziehau [Tue, 26 Feb 2013 13:18:51 +0000 (21:18 +0800)]
bce: Put interrupt reenabling into each interrupt handlers

So shared interrupt reenabling code do not need to check interrupt
type; only legacy interrupt needs extra register writing.

11 years agobce: Move status index's location and cached status index into RX ring
Sepherosa Ziehau [Tue, 26 Feb 2013 12:28:49 +0000 (20:28 +0800)]
bce: Move status index's location and cached status index into RX ring

11 years agoRevert "<malloc.h>: Restrict support for <malloc.h> to !defined(__STDC__)."
Sascha Wildner [Tue, 26 Feb 2013 09:35:26 +0000 (10:35 +0100)]
Revert "<malloc.h>: Restrict support for <malloc.h> to !defined(__STDC__)."

This reverts commit 1b3342693b737646f3cab0715e31ec6ab5216b38.

It caused too many issues in the package department.

Reported-by: marino
11 years agogcc47/x86_64: Add more -mno flags
Sepherosa Ziehau [Tue, 26 Feb 2013 09:42:40 +0000 (17:42 +0800)]
gcc47/x86_64: Add more -mno flags

11 years agokernel - Try harder to unmount a filesystem
Matthew Dillon [Tue, 26 Feb 2013 08:35:03 +0000 (00:35 -0800)]
kernel - Try harder to unmount a filesystem

* Use LK_TIMELOCK (5 seconds) instead of LK_NOWAIT when getting the mp
  lockmgr lock for unforced unmounts.

* Remove the syncer vnode and issue VFS_SYNC prior to checking
  mnt_refs instead of after the check.  This appears to improve tmpfs's
  chances of unmounting, though it is a bit unclear as to why.

* Wait up to 1 second for mnt_refs to drop to 1 before giving up.

* Improves Poudriere's chances of successfully unmounting a tmpfs
  filesystem.

11 years agokernel - Fix shared/excl livelock with vm.shared_fault
Matthew Dillon [Tue, 26 Feb 2013 03:27:05 +0000 (19:27 -0800)]
kernel - Fix shared/excl livelock with vm.shared_fault

* The vop_helper_read_shortcut() code was holding a shared token on
  a VM object through a uiomove().  If the uiomove() generated a VM
  fault requiring a shadow copy, the shadow copy would try to get
  an exclusive token on potentially the same object and livelock.

* Fix by unlocking/relocking across the uiomove().

11 years agokernel - Fix vm.shared_fault for vkernels and 32-bit
Matthew Dillon [Tue, 26 Feb 2013 02:31:26 +0000 (18:31 -0800)]
kernel - Fix vm.shared_fault for vkernels and 32-bit

* The pmap code needed the same changes as were made to the 64-bit
  pmap code to avoid a live lock.

Reported-by: davshao, tuxillo
11 years agokernel - Fix panic on ptrace termination
Matthew Dillon [Tue, 26 Feb 2013 01:37:14 +0000 (17:37 -0800)]
kernel - Fix panic on ptrace termination

* Fix a panic in the situation where gdb is exiting and terminating
  a ptrace, but the original parent prpocess of the process being
  debugged no longer exists.

11 years agokernel - Beef up lwkt_dropmsg() API and fix deadlock in so_async_rcvd*()
Matthew Dillon [Tue, 26 Feb 2013 00:49:01 +0000 (16:49 -0800)]
kernel - Beef up lwkt_dropmsg() API and fix deadlock in so_async_rcvd*()

* Beef up the lwkt_dropmsg() API.  The API now conditionally returns
  success (0) or an error (ENOENT).

* so_pru_rcvd_async() improperly calls lwkt_sendmsg() with a spinlock
  held.  This is not legal.  Hack up lwkt_sendmsg() a bit to resolve.

11 years agokernel - Remove symbol space corruption from ncp_conn.h (2)
Matthew Dillon [Mon, 25 Feb 2013 19:51:15 +0000 (11:51 -0800)]
kernel - Remove symbol space corruption from ncp_conn.h (2)

* libncp also needed adjustment.

11 years agokernel - Remove symbol space corruption from ncp_conn.h
Matthew Dillon [Mon, 25 Feb 2013 19:15:26 +0000 (11:15 -0800)]
kernel - Remove symbol space corruption from ncp_conn.h

* ncp_conn.h was #defining 'ipxaddr', 'inaddr', and 'saddr', all
  commonly used variable names.  This was interfering with netmsg.h.

* Remove the definitions, replace use cases with expansion.

11 years agokernel/i386: Use offsetof() here.
Sascha Wildner [Mon, 25 Feb 2013 17:42:17 +0000 (18:42 +0100)]
kernel/i386: Use offsetof() here.

11 years agoarp: Embed netmsg_inarp in mbuf for asynchronized ARP input processing
Sepherosa Ziehau [Mon, 25 Feb 2013 14:13:14 +0000 (22:13 +0800)]
arp: Embed netmsg_inarp in mbuf for asynchronized ARP input processing

- Embed netmsg_inarp, which records necessary states for routing table
  updating and later ARP reply, into mbuf; this does not change mbuf
  header size.
- If routing tables need updating upon ARP packet reception, the
  netmsg_inarp embedded in the input ARP packet is sent asynchronizingly
  to routing threads and the possible ARP reply is defered until all
  routing tables are updated, i.e. the ARP packet is redispatched to
  netisr0 for the ARP reply sending from the last routing thread.
- Remove no longer needed dedicated network threads.

Discussed-with: dillon@

11 years agonetmsg: Update comment
Sepherosa Ziehau [Mon, 25 Feb 2013 09:11:12 +0000 (17:11 +0800)]
netmsg: Update comment

11 years agokernel - Fix incorrect assertion in nlookup()
Matthew Dillon [Mon, 25 Feb 2013 05:50:51 +0000 (21:50 -0800)]
kernel - Fix incorrect assertion in nlookup()

* Fix an incorrect assertion, When ISLOCKED is set the returned ncp
  can be locked shared or exclusive in the error case, rather than
  just exclusive.

11 years agonetisr: Dedicated network thread is not netisr
Sepherosa Ziehau [Mon, 25 Feb 2013 01:33:13 +0000 (09:33 +0800)]
netisr: Dedicated network thread is not netisr

Dedicated network thread should just fetch and run the netmsg on its
own port instead of performing full-fledged netisr operation,
e.g. run rollups

Reported-by: pavalos@
11 years agoccd(4): Fix operator precedence.
Sascha Wildner [Sun, 24 Feb 2013 15:39:24 +0000 (16:39 +0100)]
ccd(4): Fix operator precedence.

11 years agobce: Cache TX/RX consumer indices' location
Sepherosa Ziehau [Sun, 24 Feb 2013 14:42:29 +0000 (22:42 +0800)]
bce: Cache TX/RX consumer indices' location

Using the them to access TX/RX consumer indices instead of directly
accessing status block; prepare for the MSI-X support

11 years agobce: Save CID into related TX/RX ring struct
Sepherosa Ziehau [Sun, 24 Feb 2013 14:14:10 +0000 (22:14 +0800)]
bce: Save CID into related TX/RX ring struct

11 years agoath(4): s/long long unsigned/unsigned long long/
Sascha Wildner [Sun, 24 Feb 2013 09:46:11 +0000 (10:46 +0100)]
ath(4): s/long long unsigned/unsigned long long/

11 years agokernel/vm_object: Add debugvm_object_hold_maybe_shared() prototype.
Sascha Wildner [Sun, 24 Feb 2013 05:10:28 +0000 (06:10 +0100)]
kernel/vm_object: Add debugvm_object_hold_maybe_shared() prototype.

11 years agodebug - vmpageinfo changes
Matthew Dillon [Sat, 23 Feb 2013 19:49:31 +0000 (11:49 -0800)]
debug - vmpageinfo changes

* Adjust vmpageinfo to print more information.

11 years agokernel - Clean up if_bridge bif_state tests
Matthew Dillon [Sat, 23 Feb 2013 19:47:01 +0000 (11:47 -0800)]
kernel - Clean up if_bridge bif_state tests

* bif_state is only valid when IFBIF_STP is set, adjust two bits of
  code that were using bif_state unconditionally.

* This is a semi-operational change because bif_state's default value
  when IFBIF_STP is not set resulted in correct operation anyway.

  However, setting STP and then clearing it on a sub-interface could
  cause problems with stale state.

11 years agokernel - Track slabs allocated and freed
Matthew Dillon [Sat, 23 Feb 2013 19:45:24 +0000 (11:45 -0800)]
kernel - Track slabs allocated and freed

* Add statistics counters kern.slabs_allocated and kern.slabs_freed,
  tracking kernel memory allocator slab statistics.

11 years agokernel - Separate page activity heuristic for anonymous memory vs files
Matthew Dillon [Sat, 23 Feb 2013 19:44:17 +0000 (11:44 -0800)]
kernel - Separate page activity heuristic for anonymous memory vs files

* Add sysctls vm.anonmem_decline and vm.filemem_decline with reasonable
  defaults.

* Should improve retention of anonymous memory over file cache.

11 years agokernel - Implementat much deeper use of shared VM object locks
Matthew Dillon [Sat, 23 Feb 2013 19:22:00 +0000 (11:22 -0800)]
kernel - Implementat much deeper use of shared VM object locks

* Use a shared VM object lock on terminal (and likely highly shared)
  OBJT_VNODE objects.  For example, binaries in the system such as
  /bin/sh or /usr/bin/make.

  This greatly improves fork/exec and related VM faults on concurrently
  executing binaries.  Most commonly, parallel builds often exec
  hundreds of thousands of sh's and make's.

  +50% to +100% nominal improved performance under these conditions.
  +200% to +300% improved poudriere performance during the depend
  stage.

* Formalize the shared VM object lock with a new API function,
  vm_object_lock_maybe_shared(), which determines whether a VM
  object meets the requirements for obtaining a shared lock.

* Adjust the vm_fault*() APIs to track whether the VM object is
  locked shared or exclusive on entry.

* Clarify that OBJ_ONEMAPPING is only applicable to OBJT_DEFAULT
  and OBJT_SWAP objects.

* Heavy work on the exec path.  Somewhat lighter work on the exit
  path.  Tons more work could be done.

11 years ago<malloc.h>: Restrict support for <malloc.h> to !defined(__STDC__).
Sascha Wildner [Sat, 23 Feb 2013 18:48:32 +0000 (19:48 +0100)]
<malloc.h>: Restrict support for <malloc.h> to !defined(__STDC__).

In essence this is what FreeBSD did: error if __STDC__ is defined, and
silently include <stdlib.h> if not.

Packages are expected to now fail their config checks for <malloc.h>
but to build nevertheless, which was confirmed with building ~500
packages as a test.

Adjust a few config.h files of contrib/ code as well, notably
libssp's, which gets rid of the malloc.h warnings from the buildworld
output.

11 years agolibkern: Stop compiling in (u)cmpdi2.c, because they are not used.
Sascha Wildner [Sat, 23 Feb 2013 18:46:25 +0000 (19:46 +0100)]
libkern: Stop compiling in (u)cmpdi2.c, because they are not used.

It's 32 bit code that assumes that two longs fit into 64 bits,
hence put it into i386 'files' (commented out).

11 years agokernel/x86_64: Remove some bogus #ifndefs.
Sascha Wildner [Sat, 23 Feb 2013 13:33:27 +0000 (14:33 +0100)]
kernel/x86_64: Remove some bogus #ifndefs.

11 years agokernel/isa: Remove empty isa_init() (formerly used for COMPAT_OLDISA).
Sascha Wildner [Sat, 23 Feb 2013 12:21:02 +0000 (13:21 +0100)]
kernel/isa: Remove empty isa_init() (formerly used for COMPAT_OLDISA).

11 years agokernel - Implement shared namecache locks
Matthew Dillon [Sat, 23 Feb 2013 05:57:45 +0000 (21:57 -0800)]
kernel - Implement shared namecache locks

* Currently highly experimental, so I've added a sysctl and default it
  to disabled for now.

  sysctl debug.ncp_shared_lock_disable
0 Shared namecache locks enabled
1 Shared namecache locks disabled (default)

* Removes most conflicts when concurrent processes are doing long path
  lookups with substantially similar prefixes.

* Also removes directory conflicts when concurrent processes are accessing
  different file names under the same directory using short paths.

* Shared mode is only used when the ncp is resolved and in a normal
  working state (this includes entries which have resolved to ENOENT).
  Otherwise the code falls back to exclusive mode.

* Shared namecache locks have three major complexities:

  (1) First, some bits of the nlookup() routine had to be rearranged to
      avoid double locking.  This is because the last namecache component
      always has to be locked exclusively, but a path such as a/b/d/.
      references the same ncp entry for both of the last two components.

  (2) Second, any lock on a namecache structure vhold()'s the related vp
      (if not NULL).  Shared locks present a particular issue where a
      second cpu may obtain a second shared lock before the first cpu
      is able to complete vhold()ing the vnode.  The vnode cannot be
      vhold()'d prior to the lock.  To deal with this an interlock was
      implemented (see NC_SHLOCK_VHOLD).

  (3) Finally, because there might be many concurrent shared lock users
      to avoid starving out an exclusive lock user we must stall further
      shared locks while an exclusive request is pending.

* The implementation specifically does not attempt to implement lock
  upgrading.  That's another can of worms that I'd rather not open.

11 years agokernel - cpu_pause() needs to be memory-modifying
Matthew Dillon [Sat, 23 Feb 2013 05:44:55 +0000 (21:44 -0800)]
kernel - cpu_pause() needs to be memory-modifying

* __asm __volatile isn't enough, it also needs the "memory"
  attribute to prevent gcc from optimizing out memory loads around
  loops using cpu_pause().

11 years agoUse NULL for pointers in a couple of places.
Sascha Wildner [Sat, 23 Feb 2013 01:56:51 +0000 (02:56 +0100)]
Use NULL for pointers in a couple of places.

11 years agolibdmsg: Fix pointer dereference.
Sascha Wildner [Sat, 23 Feb 2013 01:31:06 +0000 (02:31 +0100)]
libdmsg: Fix pointer dereference.

11 years agohier.7: Document that /boot/kernel is a directory and has the modules too.
Sascha Wildner [Sat, 23 Feb 2013 00:43:55 +0000 (01:43 +0100)]
hier.7: Document that /boot/kernel is a directory and has the modules too.

While here, also remove /usr/include/objc.

11 years agoiso639: Add Standard Moroccan Tamazight.
Sascha Wildner [Fri, 22 Feb 2013 23:35:00 +0000 (00:35 +0100)]
iso639: Add Standard Moroccan Tamazight.

See http://www.loc.gov/standards/iso639-2/php/code_changes.php

11 years agokernel - Fix cross-mount handling in tmpfs hardlink code
Matthew Dillon [Fri, 22 Feb 2013 21:03:04 +0000 (13:03 -0800)]
kernel - Fix cross-mount handling in tmpfs hardlink code

* Fix tmpfs to properly report EXDEV when a cross-mount hardlink is
  attempted instead of asserting and causing a panic.

Reported-by: ftigeot
11 years agokernel - Fix deadlock in tmpfs
Matthew Dillon [Fri, 22 Feb 2013 21:01:45 +0000 (13:01 -0800)]
kernel - Fix deadlock in tmpfs

* If the pageout daemon is paging out a file on a tmpfs mount concurrent
  with an unmount of same, a deadlock can occur.

* Fix the node vs vnode lock order in the tmpfs umount code.

11 years agokernel - Remove getnewvnode() bottlenecks
Matthew Dillon [Fri, 22 Feb 2013 18:16:30 +0000 (10:16 -0800)]
kernel - Remove getnewvnode() bottlenecks

* Move the global mntvnodescan_list into the mount structure and remove
  the global mntvnode_token.  Adjust the code to use the per-mount
  mp->mnt_token instead.

* This removes a major token bottleneck in getnewvnode(), particularly
  important when doing concurrent not-yet-cached directory scans or file
  creates under different mount points, and when the vnode cache reaches
  its nominal maximum.

* Also add a missing piece for the last cache_findmount() commit.

11 years agokernel - Add negative caching to cache_findmount()
Matthew Dillon [Fri, 22 Feb 2013 18:09:58 +0000 (10:09 -0800)]
kernel - Add negative caching to cache_findmount()

* Add negative caching to cache_findmount().  It turns out that there
  are quite a few cases, particularly during poudriere, so this is
  needed to avoid dropping down into the slow mountlist scan code.

* Removes remaining bottlenecks in mount-point crossings during path
  lookups.  The mountlist_token is no longer colliding in critical
  paths.