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.
Antonio Huete Jimenez [Wed, 6 Mar 2013 10:56:48 +0000 (11:56 +0100)]
mkinitrd(8) - Exit upon vnconfig failure.
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.
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
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.
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
Sascha Wildner [Tue, 5 Mar 2013 17:03:01 +0000 (18:03 +0100)]
strchr.3: Small wording fixes.
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
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
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
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@
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
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
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.
Sascha Wildner [Sun, 3 Mar 2013 17:16:31 +0000 (18:16 +0100)]
kernel/tmpfs: Add missing include for vm_wait_nominal() prototype.
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
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.
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.
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.
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.
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.
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.
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
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
Sascha Wildner [Fri, 1 Mar 2013 21:21:16 +0000 (22:21 +0100)]
amd(4): Remove duplicate assignment.
Sascha Wildner [Fri, 1 Mar 2013 21:59:55 +0000 (22:59 +0100)]
libc/regex: Fix setting the maximum of the range.
Sascha Wildner [Fri, 1 Mar 2013 21:04:51 +0000 (22:04 +0100)]
kernel/ic: Fix allocation of the output buffer.
Sascha Wildner [Fri, 1 Mar 2013 20:50:43 +0000 (21:50 +0100)]
ndis(4): Fix a wrong assignment.
Sascha Wildner [Fri, 1 Mar 2013 20:29:27 +0000 (21:29 +0100)]
mfi(4): Fix a wrong assignment.
Sascha Wildner [Fri, 1 Mar 2013 08:14:51 +0000 (09:14 +0100)]
varsym.1: Use EXIT STATUS.
Sascha Wildner [Fri, 1 Mar 2013 08:13:35 +0000 (09:13 +0100)]
Small correction in man5 MLINKS.
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.
Antonio Huete Jimenez [Fri, 1 Mar 2013 00:04:19 +0000 (01:04 +0100)]
ufs.5 - Add missing MLINKS
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
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.
Sascha Wildner [Thu, 28 Feb 2013 18:35:23 +0000 (19:35 +0100)]
kernel/u4b: sc is NULL here, so don't dereference it.
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.
Antonio Huete Jimenez [Thu, 28 Feb 2013 12:17:31 +0000 (13:17 +0100)]
vkernel64 - Remove some dead code (JGV).
Matthew Dillon [Thu, 28 Feb 2013 03:38:28 +0000 (19:38 -0800)]
world - Fix world build
* Fix world build for VMOUNT flag removal.
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.
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.
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.
Sascha Wildner [Wed, 27 Feb 2013 19:13:21 +0000 (20:13 +0100)]
kernel: Fix -Wundef in a number of places.
Sepherosa Ziehau [Wed, 27 Feb 2013 01:52:57 +0000 (09:52 +0800)]
gcc47/i386: Add more -mno flags
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.
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@
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).
Antonio Huete Jimenez [Tue, 26 Feb 2013 12:51:42 +0000 (13:51 +0100)]
kqueue.2 - Mention tmpfs(5) as a kqueue-enabled filesystem.
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.
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
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
Sepherosa Ziehau [Tue, 26 Feb 2013 09:42:40 +0000 (17:42 +0800)]
gcc47/x86_64: Add more -mno flags
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.
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().
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
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.
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.
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.
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.
Sascha Wildner [Mon, 25 Feb 2013 17:42:17 +0000 (18:42 +0100)]
kernel/i386: Use offsetof() here.
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@
Sepherosa Ziehau [Mon, 25 Feb 2013 09:11:12 +0000 (17:11 +0800)]
netmsg: Update comment
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.
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@
Sascha Wildner [Sun, 24 Feb 2013 15:39:24 +0000 (16:39 +0100)]
ccd(4): Fix operator precedence.
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
Sepherosa Ziehau [Sun, 24 Feb 2013 14:14:10 +0000 (22:14 +0800)]
bce: Save CID into related TX/RX ring struct
Sascha Wildner [Sun, 24 Feb 2013 09:46:11 +0000 (10:46 +0100)]
ath(4): s/long long unsigned/unsigned long long/
Sascha Wildner [Sun, 24 Feb 2013 05:10:28 +0000 (06:10 +0100)]
kernel/vm_object: Add debugvm_object_hold_maybe_shared() prototype.
Matthew Dillon [Sat, 23 Feb 2013 19:49:31 +0000 (11:49 -0800)]
debug - vmpageinfo changes
* Adjust vmpageinfo to print more information.
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.
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.
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.
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.
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.
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).
Sascha Wildner [Sat, 23 Feb 2013 13:33:27 +0000 (14:33 +0100)]
kernel/x86_64: Remove some bogus #ifndefs.
Sascha Wildner [Sat, 23 Feb 2013 12:21:02 +0000 (13:21 +0100)]
kernel/isa: Remove empty isa_init() (formerly used for COMPAT_OLDISA).
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.
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().
Sascha Wildner [Sat, 23 Feb 2013 01:56:51 +0000 (02:56 +0100)]
Use NULL for pointers in a couple of places.
Sascha Wildner [Sat, 23 Feb 2013 01:31:06 +0000 (02:31 +0100)]
libdmsg: Fix pointer dereference.
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.
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
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
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.
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.
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.
Matthew Dillon [Fri, 22 Feb 2013 09:54:47 +0000 (01:54 -0800)]
kernel - Increase NCMOUNT_NUMCACHE, add enable & statistics
* Increase NCMOUNT_NUMCACHE to 1009 (prime number), change to modulo.
This cache improves long namecache path lookups.
* Add enable and statistics. Cache defaults to enabled.
debug.ncmount_cache_enable (defaults to 1)
debug.ncmount_cache_hit
debug.ncmount_cache_miss
debug.ncmount_cache_overwrite
Sepherosa Ziehau [Fri, 22 Feb 2013 09:15:11 +0000 (17:15 +0800)]
bce: Move RX serializers before TX serializers
RX serializers will be use to protect MSI-X
Sepherosa Ziehau [Fri, 22 Feb 2013 08:28:27 +0000 (16:28 +0800)]
bce: Free serializer array in detach path
Sepherosa Ziehau [Fri, 22 Feb 2013 07:16:36 +0000 (15:16 +0800)]
altq/hfsc: Fix wrong malloc size
Reported-by: pavalos@
Matthew Dillon [Fri, 22 Feb 2013 06:32:11 +0000 (22:32 -0800)]
kernel - Fix performance issue due to buffer fragmentation
* Systems with a lot of memory have very large buffer pools. Defragmenting
these pools can be expensive. Often the buffer_map becomes full well
before the bufspace actually hits its limits. Filesystems such as HAMMER
which use large buffer sizes (64K) are more likely to cause the problem.
The result is extremely bad I/O performance for data not in the buffer
cache which requires a new buffer to be instantiated.
* To solve this we double the size of the buffer_map's KVA area on
64-bit systems while leaving the maximum buffer space allowed the
same. The larger virtual space greatly reduces KVA allocation
failures due to fragmentation.
* This solves significant performance issues on monster with its 64G
of ram, but should improve performance on any 64-bit system by
reducing buffer cache defrag iterations.
* Also fix a possible intermediate value overflow in vlrureclaim().
Matthew Dillon [Fri, 22 Feb 2013 04:32:03 +0000 (20:32 -0800)]
kernel - Add frontend cache for cache_findmount()
* When a name lookup crosses a mount point boundary it must call
cache_findmount() to locate the mount linkage. This linkage is
not stored in the vp or ncp because there is a 1:N relationship
between vp/ncp and possible mounts due to DragonFly's ability
to do arbitrary nullfs mounts in the topology.
* The mountlist scan requires an exclusive token to deal with ripouts
during the scan. This creates a bottleneck when highly parallel
filesystem operations are being run on the machine and use mount-crossing
paths or absolute paths.
* The frontend cache is able to use a shared spinlock for the fast path,
and implements a simple non-chained linear array hashed by pointer
values.
Matthew Dillon [Fri, 22 Feb 2013 02:14:45 +0000 (18:14 -0800)]
kernel - Fix network lockup due to msgport bug
* Netisr threads (i.e. arp thread) which issue route table updates
use a synchronous netmsg from a 'spin' type port to a 'thread' type
port.
When going spin->thread, the lwkt_thread_putport*() code was not
using an atomic op to manipulate ms_flags. This could interfere
with the originator on the spin port issuing a lwkt_spin_waitmsg()
and cause one or more flags to be lost.
Ensure that lwkt_thread_putport*() uses atomic ops when manipulating
ms_flags.
* Another serious issue is that the lwkt_*_waitmsg() code was testing
MSGF_QUEUED outside of its port lock. This flag can only be tested
while the port is locked.
* lwkt_thread_replyport() must use an atomic op when setting
MSGF_INTRANSIT and MSGF_REPLY to avoid SMP races on ms_flags
updates.
* lwkt_thread_replyport() requires a critical section against
possible preemption when adjusting ms_flags.
* lwkt_forwardmsg() does not need a critical section.
* Other notes: Not all ms_flags manipulation needs an atomic op. For
example, when initializing a new message or when a lock is held to
rendezvous at a reply port when replying. However, all 'put' and 'wait'
interactions on messages absolutely require atomic ops when manipulating
ms_flags.
Finally, note that all msgport queue operations use atomic ops to
adjust MSGF_QUEUED when adding or removing a message to a port queue.
Antonio Huete Jimenez [Wed, 20 Feb 2013 11:09:26 +0000 (12:09 +0100)]
vkd(4) - Announce virtual disks upon initialization.
Antonio Huete Jimenez [Wed, 20 Feb 2013 10:26:54 +0000 (11:26 +0100)]
vke(4) - Show backing tap only if one was used.
Antonio Huete Jimenez [Fri, 22 Feb 2013 00:51:22 +0000 (01:51 +0100)]
vkernel(7) - Minor manpage adjustments.
Antonio Huete Jimenez [Fri, 22 Feb 2013 00:14:01 +0000 (01:14 +0100)]
vkernel - Settable serial numbers for virtual disks.
User can specify now serial numbers for their virtual disks
from the command line.
Example:
./vkernel -m 128m -r root.img:VKDMYSERNO
Matthew Dillon [Thu, 21 Feb 2013 23:33:26 +0000 (15:33 -0800)]
kernel - Fix issue with ARP packets stalling out entire network
* ARP packets can cause ARP routing table updates to occur. An ARP
routing table update is an expensive synchronous netmsg that is
forwarded through *ALL* cpus.
* ARP was previously being handled by netisr 0 and on large multi-way
machines (aka monster the 48-way opteron) under very heavy loads this
could result in very long stalls for any packet processing forwarded
to cpu 0.
Stalls exceeding 200 seconds were observed on monster when a large
number of ARP packets had to be processed.
* Implement a dedicated thread feature for the NETISR mechanism and
modify NETISR_ARP to use it. This takes the expensive synchronous
ARP packet processing off the general per-cpu netisr threads.
This thread currently runs on cpu (18 % ncpus) (NETISR_ARP == 18).
Thus the general per-cpu (netisr 0) thread will no longer stall
on ARP packets.
* ping latencies under extreme loads improved to (approximately):
ping -i 0.001 monster-nr
11735 packets transmitted, 11735 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.073/0.190/27.019/0.382 ms