jhb [Tue, 25 Jan 2011 20:48:48 +0000 (20:48 +0000)]
MFC 215540:
Set various POSIX capability sysctls to the version of the API that is
supported rather than 1. They are supposed to return a suitable value
for sysconf(3). While here, make the fsync sysctl match <unistd.h>.
jhb [Tue, 25 Jan 2011 20:44:11 +0000 (20:44 +0000)]
MFC 204329,210723,210933,214778,215526:
Sync mfiutil(8) with HEAD:
- Handle malloc() failures more gracefully by error'ing out rather than
segfaulting.
- Fixed dependencies (make checkdpadd).
- Fix typos and spelling mistakes.
jhb [Tue, 25 Jan 2011 20:33:12 +0000 (20:33 +0000)]
MFC 211514,214158:
- There isn't really a need to hold the ktrace mutex just to read the
value of p_traceflag that is stored in the kinfo_proc structure.
- When disabling ktracing on a process, free any pending requests that
may be left. This fixes a memory leak that can occur when tracing is
disabled on a process via disabling tracing of a specific file (or if
an I/O error occurs with the tracefile) if the process's next system
call is exit(). The trace disabling code clears p_traceflag, so exit1()
doesn't do any KTRACE-related cleanup leading to the leak. I chose to
make the free'ing of pending records synchronous rather than patching
exit1().
- Move KTRACE-specific logic out of kern_(exec|exit|fork).c and into
kern_ktrace.c instead. Make ktrace_mtx private to kern_ktrace.c as a
result.
jhb [Tue, 25 Jan 2011 19:44:42 +0000 (19:44 +0000)]
MFC 214144:
- Make 'vm_refcnt' volatile so that compilers won't be tempted to treat
its value as a loop invariant. Currently this is a no-op because
'atomic_cmpset_int()' clobbers all memory on current architectures.
- Use atomic_fetchadd_int() instead of an atomic_cmpset_int() loop to drop
a reference in vmspace_free().
kib [Tue, 25 Jan 2011 10:14:12 +0000 (10:14 +0000)]
MFC r217561:
For architectures not using direct map , and requiring real KVA page for
sf buf allocation, use wakeup() instead of wakeup_one() to notify sf
buffer waiters about free buffer.
sf_buf_alloc() calls msleep(PCATCH) when SFB_CATCH flag was given,
and for simultaneous wakeup and signal delivery, msleep() returns
EINTR/ERESTART despite the thread was selected for wakeup_one(). As
result, we loose a wakeup, and some other waiter will not be woken up.
yongari [Sun, 23 Jan 2011 02:15:50 +0000 (02:15 +0000)]
MFC r217649:
Correct wrong definition of PM timer mask and adjust L1/PM timer
value. While I'm here enable all clocks before initializing
controller. This change should fix lockup issue seen on AR8152
v1.1 PCIe Fast Ethernet controller.
rmacklem [Fri, 21 Jan 2011 01:12:22 +0000 (01:12 +0000)]
MFC: r217432
Modify the experimental NFSv4 server so that it posts a SIGUSR2
signal to the master nfsd daemon whenever the stable restart
file has been modified. This will allow the master nfsd daemon
to maintain an up to date backup copy of the file. This is
enabled via the nfssvc() syscall, so that older nfsd daemons
will not be signaled.
marius [Fri, 21 Jan 2011 00:53:32 +0000 (00:53 +0000)]
MFC: r217417
- Even after masking the media with IFM_GMASK the result may have bits
besides the duplex ones set so just comparing it with IFM_FDX may lead
to false negatives.
- Just let the default case handle all unsupported media types.
- In pnphy_status() don't unnecessarily read a register twice.
- Remove unnused macros.
marius [Fri, 21 Jan 2011 00:48:04 +0000 (00:48 +0000)]
MFC: r217413
- Even after masking the media with IFM_GMASK the result may have bits
besides the duplex ones set so just comparing it with IFM_FDX may lead
to false negatives.
- Simplify ciphy_service() to only set the manual configuration bits
once after we have figured them all out. This also means we no longer
unnecessarily update the hardware along the road.
marius [Fri, 21 Jan 2011 00:40:25 +0000 (00:40 +0000)]
MFC: r217412
- Masking IFM_GMASK when also masking IFM_FDX is redundant and just
complicates the code.
- Don't let atphy_setmedia() announce PAUSE support for half-duplex when
MIIF_FORCEPAUSE is set.
- Simplify e1000phy_service() and ip1000phy_service() to only set the
manual configuration bits once after we have figured them all out. For
ip1000phy_service() this also means we no longer unnecessarily update
the hardware along the road.
yongari [Fri, 21 Jan 2011 00:33:10 +0000 (00:33 +0000)]
MFC r217548:
Rework RX filter programming by providing separate handler for
DP8381[56] and SiS 900/7016 controllers. After r212119, sis(4) no
longer reinitializes controller if ALLMULTI/PROMISC was changed.
However, RX filter handling code assumed some bits of the RX filter
is programmed by driver initialization. This caused ALLMULTI/PROMISC
configuration is ignored under certain conditions.
Fix that issue by reprogramming all bits of RX filter register.
While I'm here follow recommended RX filter programming steps
recommended by National DP8381[56] data sheet(RX filter should be
is disabled before programming).
bschmidt [Thu, 20 Jan 2011 18:41:46 +0000 (18:41 +0000)]
MFC r217511:
Pull ieee80211_ratectl_node_init() calls from drivers into net80211.
This fixes hostap mode for at least ral(4) and run(4), because there is
no sufficient call into drivers which could be used initialize the node
related ratectl variables.
keramida [Wed, 19 Jan 2011 21:49:21 +0000 (21:49 +0000)]
MFC r217481 and r217606 from /head
r217481...
Fix the mount example of xfs(5) filesystems by including the read-only
option. We only support ro mounts for xfs, so it’s nice if the examples
we show in the manpage are easy to copy/paste.
keramida [Wed, 19 Jan 2011 21:34:42 +0000 (21:34 +0000)]
MFC r199985 from /head
Describe what setpgid(2) does when pgid=0. The text has been
copied from NetBSD’s manpage, and it also matches the behavior
described by the Open Group’s online copy of setpgid.2 at
http://www.opengroup.org/onlinepubs/009695399/functions/setpgid.html
keramida [Wed, 19 Jan 2011 21:09:39 +0000 (21:09 +0000)]
MFC r217064 - sort & fix includes, remove -include from CFLAGS of acct tests
- Sort the includes of pack.c, moving sys/*.h files near the top.
- Add a couple of missing #include lines, and remove the need for
custom -include options in the CFLAGS of the test Makefile.
- Remove the ad-hoc ’all’ target, but keep its ’regress’ bits for
testing.
- Convert the ad-hoc ’clean’ target to proper CLEANFILES stuff,
so that the normal bsd.prog.mk machinery can clean up.
- Use ‘make -V .OBJDIR’ to detect the place where ’pack’ lives,
so that regress.t works both with and without ’make obj’.
ae [Wed, 19 Jan 2011 05:13:40 +0000 (05:13 +0000)]
MFC r217305:
Sector size can not be greater than MAXPHYS. Since GRAID3 calculates
sector size from user-specified block size, report to user about
big blocksize.
rmacklem [Wed, 19 Jan 2011 01:26:49 +0000 (01:26 +0000)]
MFC: r217176
Modify readdirplus in the experimental NFS server in a
manner analogous to r216633 for the regular server. This
change busies the file system so that VFS_VGET() is
guaranteed to be using the correct mount point even
during a forced dismount attempt. Since nfsd_fhtovp() is
not called immediately before readdirplus, the patch is
actually a clone of pjd@'s nfs_serv.c.4.patch instead of
the one committed in r216633.
marius [Tue, 18 Jan 2011 11:51:48 +0000 (11:51 +0000)]
MFC: r217464, r217468, r217475
Add a manual page for rgephy(4) and reference it as appropriate. The
motivation for having rgephy.4 is to document the special media option
added in r217415 (MFC'ed to stable/8 in r217502).
rmacklem [Tue, 18 Jan 2011 01:20:15 +0000 (01:20 +0000)]
MFC: r217242
Fix a bug in the client side krpc where it was, sometimes
erroneously, assumed that 4 bytes of data were in the first
mbuf of a list by replacing the bcopy() with m_copydata().
Also, replace the uses of m_pullup(), which can fail for
reasons other than not enough data, with m_copydata().
For the cases where it isn't known that there is enough
data in the mbuf list, check first via m_len and m_length().
This is believed to fix a problem reported by dpd at dpdtech.com
and george+freebsd at m5p.com.
rmacklem [Tue, 18 Jan 2011 01:07:09 +0000 (01:07 +0000)]
MFC: r217066
Delete the NFS_STARTWRITE() and NFS_ENDWRITE() macros that
obscured vn_start_write() and vn_finished_write() for the
old OpenBSD port, since most uses have been replaced by the
correct calls.
rmacklem [Tue, 18 Jan 2011 00:53:55 +0000 (00:53 +0000)]
MFC: r217063
Since the VFS_LOCK_GIANT() code in the experimental NFS
server is broken and the major file systems are now all
mpsafe, modify the server so that it will only export
mpsafe file systems. This was discussed on freebsd-fs@
and removes a fair bit of crufty code.
bschmidt [Mon, 17 Jan 2011 20:22:03 +0000 (20:22 +0000)]
MFC r216835:
The mwl's HAL manages an array of MWL_MBSS_MAX VAPs where the first 8 are
supposed to be APs and the later 24 are pre-configured as STAs. A wrong
condition during initialization is responsible for not configuring the last
8 array members. This is results in being able to create more than 8,
possible uninitialized, AP-VAPs.
Submitted by: Erik Fonnesbeck <efonnes at gmail.com>
mav [Mon, 17 Jan 2011 17:23:59 +0000 (17:23 +0000)]
MFC r217245:
Add IDs for HighPoint RocketRAID 64x controllers.
These controllers consist of two Marvell 88SE9128 6Gbps SATA chips and
PLX PCIe bridge. As result, they seem to be agree to work with ahci(4)
as usual HBAs. The only noticed issue is that RAID BIOS disables all
drive caches during boot, though `camcontrol cmd ...` is able to fix that.
Those who wants RAID functionality can still use closed proprietary driver
from HighPoint site.
marius [Mon, 17 Jan 2011 15:12:29 +0000 (15:12 +0000)]
MFC: r217415
- Allow IFM_FLAG0 to be set indicating that auto-negotiation with manual
configuration, which is used to work around issues with certain setups
(see r161237) by default, should not be triggered as it may in turn
cause harm in some edge cases.
- Even after masking the media with IFM_GMASK the result may have bits
besides the duplex ones set so just comparing it with IFM_FDX may lead
to false negatives.
- Announce PAUSE support also for manually selected 1000BASE-T, but for
all manually selected media types only in full-duplex mode. Announce
asymmetric PAUSE support only for manually selected 1000BASE-T.
- Simplify setting the manual configuration bits to only once after we
have figured them all out. This also means we no longer unnecessarily
update the hardware along the road.
- Remove a stale comment.
rmacklem [Mon, 17 Jan 2011 01:49:47 +0000 (01:49 +0000)]
MFC: r217023
Modify the experimental NFS server so that it calls
vn_start_write() with a non-NULL vp. That way it will
find the correct mount point mp and use that mp for the
subsequent vn_finished_write() call. Also, it should fail
without crashing if the mount point is being forced dismounted
because vn_start_write() will set the mp NULL via VOP_GETWRITEMOUNT().
rmacklem [Mon, 17 Jan 2011 01:37:39 +0000 (01:37 +0000)]
MFC: r217017
Fix the experimental NFS server to use vfs_busyfs() instead
of vfs_getvfs() so that the mount point is busied for the
VFS_FHTOVP() call. This is analagous to r185432 for the
regular NFS server.
rmacklem [Mon, 17 Jan 2011 01:26:13 +0000 (01:26 +0000)]
MFC: r216931
Fix the nlm so that it no longer depends on the regular
nfs client and, as such, can be loaded for the experimental
nfs client without the regular client.
rmacklem [Mon, 17 Jan 2011 00:59:04 +0000 (00:59 +0000)]
MFC: r216897
Modify the experimental NFSv4 server so that the lookup
ops return a locked vnode. This ensures that the associated mount
point will always be valid for the code that follows the operation.
Also add a couple of additional checks
for non-error to the other functions that create file objects.
jilles [Sun, 16 Jan 2011 22:10:18 +0000 (22:10 +0000)]
MFC r216806: sh: Properly restore exception handler in fc.
If SIGINT arrived at exactly the right moment (unlikely), an exception
handler in a no longer active stack frame would be called.
Because the old handler was not used in the normal path, clang thought it
was a dead value and if an exception happened it would longjmp() to garbage.
This caused builtins/fc1.0 to fail if histedit.c was compiled with clang.
(Note: not tested on stable/8 with clang.)
rmacklem [Sun, 16 Jan 2011 14:15:46 +0000 (14:15 +0000)]
MFC: r216893
Add checks for VI_DOOMED and vn_lock() failures to the
experimental NFS server, to handle the case where an
exported file system is forced dismounted while an RPC
is in progress. Further commits will fix the cases where
a mount point is used when the associated vnode isn't locked.
rwatson [Sat, 15 Jan 2011 19:49:08 +0000 (19:49 +0000)]
Merge r204499, r204515 from head to stable/8:
Teach netstat -Q to work with -N and -M by adding libkvm versions of data
query routines. This code is necessarily more fragile in the presence of
kernel changes than querying the kernel via sysctl (the default), but
useful when investigating crashes or live kernel state via firewire.
Sponsored by: Juniper Networks
Prefer vocabulary of 'Current' and 'Limit' to 'Value' and 'Maximum' in
netstat -Q.
rwatson [Sat, 15 Jan 2011 19:46:36 +0000 (19:46 +0000)]
Merge r204497, r204499 from head to stable/8:
Changes to support crashdump analysis of netisr:
- Rename the netisr protocol registration array, 'np' to 'netisr_proto',
in order to reduce the chances of symbol name collisions. It remains
statically defined, but it will be looked up by netstat(1).
- Move certain internal structure definitions from netisr.c to
netisr_internal.h so that netstat(1) can find them. They remain
private, and should not be used for any other purpose (for example,
they should not be used by kernel modules, which must instead use the
public interfaces in netisr.h).
- Store a kernel-compiled version of NETISR_MAXPROT in the global variable
netisr_maxprot, and export via a sysctl, so that it is available for use
by netstat(1). This is especially important for crashdump
interpretation, where the size of the workstream structure is determined
by the maximum number of protocols compiled into the kernel.
rwatson [Sat, 15 Jan 2011 19:23:14 +0000 (19:23 +0000)]
Merge r204494, r204511 from head to stable/8:
A first cut at teaching libkvm how to deal with dynamic per-CPU storage
(DPCPU):
A new API, kvm_dpcpu_setcpu(3), selects the active CPU for the purposes
of DPCPU. Calls to kvm_nlist(3) will automatically translate DPCPU
symbols and return a pointer to the current CPU's version of the data.
Consumers needing to read the same symbol on several CPUs will invoke a
series of setcpu/nlist calls, one per CPU of interest.
This addition makes it possible for tools like netstat(1) to query the
values of DPCPU variables during crashdump analysis, and is based on
similar code handling virtualized global variables.
Sponsored by: Juniper Networks, Inc.
Not all programs including kvm.h include the necessary headers to use
u_int, so prefer unsigned int.
rwatson [Sat, 15 Jan 2011 19:05:06 +0000 (19:05 +0000)]
Merge r204303 from head to stable/8:
Fix edge cases in several KASSERTs: use <= rather than < when testing that
counters have not gone about MAXCPU or NETISR_MAXPROT. These problems
caused panics on UP kernels with INVARIANTS when using sysctl -a, but
would also have caused problems for 32-core boxes or if the netisr
protocol vector was fully populated.
Reported by: nwhitehorn, Neel Natu <neelnatu@gmail.com>
rwatson [Sat, 15 Jan 2011 18:51:45 +0000 (18:51 +0000)]
Merge r204202 from head to stable/8:
Teach netstat(1) to print out netisr statistics when given the -Q argument.
Currently supports only reporting on live systems via sysctl, kmem support
needs to be edded.
pjd [Sat, 15 Jan 2011 08:18:58 +0000 (08:18 +0000)]
MFC r217307,r217308,r217312:
r217307:
Install default signal handlers before masking signals we want to handle.
It is possible that the parent process ignores some of them and sigtimedwait()
will never see them, eventhough they are masked.
The most common situation for this to happen is boot process where init(8)
ignores SIGHUP before starting to execute /etc/rc. This in turn caused
hastd(8) to ignore SIGHUP.
Reported by: trasz
Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
r217308:
Add a note that when custom signal handler is installed for a signal,
signal action is restored to default in child after fork(2).
In this case there is no need to do anything with dummy SIGCHLD handler,
because after fork(2) it will be automatically reverted to SIG_IGN.
Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
r217312:
execve(2), not fork(2) resets signal handler to the default value (if it isn't
ignored). Correct comment talking about that.
yongari [Sat, 15 Jan 2011 00:32:15 +0000 (00:32 +0000)]
MFC r217296:
For re(4) controllers that uses new jumbo frame scheme(RTL8168C/D/E),
limit maximum RX buffer size to RE_RX_DESC_BUFLEN instead of
blindly configuring it to 16KB. Due to lack of documentation, re(4)
didn't allow jumbo frame on these controllers. However it seems
controller is confused with jumbo frame such that it can DMA the
received frame to wrong address instead of splitting it into
multiple RX buffers. Of course, this caused panic.
Since re(4) does not support jumbo frames on these controllers,
make controller drop frame that is longer than RE_RX_DESC_BUFLEN
sized frame. Fortunately RTL810x controllers, which do not support
jumbo frame, have no such issues but this change also limited
maximum RX buffer size allowed to RTL810x controllers. Allowing
16KB RX buffer for controllers that have no such capability is
meaningless.
yongari [Fri, 14 Jan 2011 22:36:33 +0000 (22:36 +0000)]
MFC r216284:
r184610 changed the way how TX frames are handled on AX88178 and
AX88772 controllers. ASIX added a new feature for AX88178/AX88772
controllers which allows combining multiple TX frames into a single
big frame. This was to overcome one of USB limitation where it
can't generate more than 8k interrupts/sec which in turn means USB
ethernet controllers can not send more than 8k packets per second.
Using ASIX's feature greatly enhanced TX performance(more than 3~4
times) compared to 7.x driver. However it seems r184610 removed
boundary checking for buffered frames which in turn caused
instability issues under certain conditions. In addition, using
ASIX's feature triggered another issue which made USB controller
hang under certain conditions. Restarting ethernet controller
didn't help under this hang condition and unplugging and replugging
the controller was the only solution. I believe there is a silicon
bug in TX frame combining feature on AX88178/AX88772 controllers.
To address these issues, reintroduce the boundary checking for both
AX88178 and AX88772 after copying a frame to USB buffer and do not
use ASIX's multiple frame combining feature. Instead, use USB
controller's multi-frame transmit capability to enhance TX
performance as suggested by Hans[1].
This should fix a long standing axe(4) instability issues reported
on AX88772 and AX88178 controllers. While I'm here remove
unnecessary TX frame length check since upper stack always
guarantee the size of a frame to be less than MCLBYTES.
Special thanks to Derrick Brashear who tried numerous patches
during last 4 months and waited real fix with patience. Without
this enthusiastic support, patience and H/W donation I couldn't fix
it since I was not able to trigger the issue on my box.
yongari [Fri, 14 Jan 2011 22:31:26 +0000 (22:31 +0000)]
MFC r215968:
Introduce new macro AXE_IS_178_FAMILY and AXE_IS_772. Include
AX88772A and AX88772B for future extension. While here add TX
buffer size for 178 family controllers.
yongari [Fri, 14 Jan 2011 22:29:45 +0000 (22:29 +0000)]
MFC r215960,215962-215964,215966:
r215960:
Apply GPIO configuration for all CICADA PHYs.
While I'm here show selected phymode to ease of debugging.
r215962:
Move axe_reset() to axe_init().
r215963:
Do not reinitialize controller if it's already running.
r215964:
Make sure to change to currently selected media.
r215966:
Do full controller initialization in axe_reset() for controllers
that require special configuration from EEPROM. This will put
controllers into known sane state.
marius [Fri, 14 Jan 2011 20:43:21 +0000 (20:43 +0000)]
MFC: r217013
Teach ifconfig(8) the handy shared option shortcut aliases the NetBSD
counterpart also takes, i.e. "fdx" for "full-duplex", "flow" for
"flowcontrol", "hdx" for "half-duplex" as well as "loop" and "loopback"
for "hw-loopback".
cperciva [Fri, 14 Jan 2011 16:30:22 +0000 (16:30 +0000)]
Don't use amdc1e on XEN && !XEN_PRIVILEGED. The Xen hypervisor
gets justifiably annoyed when a guest OS tries to halt the CPU.
This fixes a panic when booting FreeBSD/XEN on recent AMD CPUs.
This is not an MFC; the problem was (accidentally?) fixed in HEAD
four months ago via SVN r212541.
jh [Fri, 14 Jan 2011 11:12:56 +0000 (11:12 +0000)]
MFC r214748:
Extend the g_eventlock mutex coverage in one_event() to include setting
of the EV_DONE flag and use the mutex to protect against losing wakeups
in g_waitfor_event().