jilles [Sun, 14 Nov 2010 19:36:55 +0000 (19:36 +0000)]
MFC r213775: sh: Make DEBUG traces 64-bit clean:
- Use %t to print ptrdiff_t values.
- Cast a ptrdiff_t value explicitly to int for a field width specifier.
kientzle [Sat, 13 Nov 2010 06:00:27 +0000 (06:00 +0000)]
MFC r203568: Refactor and simplify the SIGINFO/SIGUSR1
handling. Switch to a custom function to format 64-bit
ints to avoid the headache of trying to guess printf
modifiers on different platforms.
kientzle [Sat, 13 Nov 2010 05:52:45 +0000 (05:52 +0000)]
MFC: Allow -b up to 8192. Folks working with
modern high-speed tape drives are routinely using
block sizes of 1MB (-b 2048), allowing up to 8192
should allow a little room for future growth.
yongari [Sat, 13 Nov 2010 01:09:44 +0000 (01:09 +0000)]
MFC r214844:
Add simple MAC statistics counter reading support. Unfortunately
useful counters like rl_missed_pkts is 16 bits quantity which is
too small to hold meaningful information happened in a second. This
means driver should frequently read these counters in order not to
lose accuracy and that approach is too inefficient in driver's
view. Moreover it seems there is no way to trigger an interrupt to
detect counter near-full or wraparound event as well as lacking
clearing the MAC counters. Another limitation of reading the
counters from RealTek controllers is lack of interrupt firing at
the end of DMA cycle of MAC counter read request such that driver
have to poll the end of the DMA which is a time consuming process
as well as inefficient. The more severe issue of the MAC counter
read request is it takes too long to complete the DMA. All these
limitation made maintaining MAC counters in driver impractical. For
now, just provide simple sysctl interface to trigger reading the
MAC counters. These counters could be used to track down driver
issues. Users can read MAC counters maintained in controller with
the following command.
#sysctl dev.re.0.stats=1
While I'm here add check for validity of dma map and allocated
memory before unloading/freeing them.
yongari [Sat, 13 Nov 2010 01:02:09 +0000 (01:02 +0000)]
MFC r214840:
Enable 64bit DMA addressing for RTL810xE/RTL8168/RTL8111 PCIe
controllers. Some old PCI controllers may work with DAC but it was
known to be buggy so 64bit DMA addressing is used only on PCIe
controllers.
yongari [Sat, 13 Nov 2010 00:58:34 +0000 (00:58 +0000)]
MFC r214899:
Fix a long standing bug in programming station address for Yukon
controllers. sk(4) never reprogrammed station address for Yukon
controllers so overriding station address with ifconfig(8) was not
possible.
Fix the bug by reprogramming all registers that control station
address, flow-control and virtual station address. Virtual station
address has no use at this moment since driver does not make use of
fail over feature.
mdf [Fri, 12 Nov 2010 18:09:06 +0000 (18:09 +0000)]
MFC r213813. This is a direct commit because the diff is against
several non-MFC'd changes.
Use a safer mechanism for determining if a task is currently running,
that does not rely on the lifetime of pointers being the same. This
also restores the task KBI.
brucec [Fri, 12 Nov 2010 11:22:59 +0000 (11:22 +0000)]
MFC r214279:
Mostly revert r203420, and add similar functionality into ada(4) since the
existing code caused problems with some SCSI controllers.
A new sysctl kern.cam.ada.spindown_shutdown has been added that controls
whether or not to spin-down disks when shutting down.
Spinning down the disks unloads/parks the heads - this is much better than
removing power when the disk is still spinning because otherwise an
Emergency Unload occurs which may cause damage to the actuator.
The FLUSH_CACHE + STANDBY_IMMEDIATE commands are issued following the
procedure documented in Fujitsu's MHW series product documentation under
section 1.10.1, "Recommended power-off sequence".
delphij [Fri, 12 Nov 2010 01:45:29 +0000 (01:45 +0000)]
MFC r214854:
Validate whether the zfs_cmd_t submitted from userland is not smaller than
what we have. Without the check the kernel could accessing memory that
does not belong to the request struct.
Note that we do not test if the struct equals in size at this time, which
may faciliate forward compatibility with newer binaries.
jhb [Thu, 11 Nov 2010 19:39:38 +0000 (19:39 +0000)]
MFC 211149,211151,211197,211518,215128:
Update various places that store or manipulate CPU masks to use cpumask_t
instead of int or u_int. Since cpumask_t is currently u_int on all
platforms this should just be a cosmetic change.
attilio [Wed, 10 Nov 2010 14:59:13 +0000 (14:59 +0000)]
Fix-up MFC r214446, r214516:
Use the appropriate SYSINIT() ordering between the arches.
This is intended as a fixup for r215059, so no further notes are merged.
kib [Wed, 10 Nov 2010 08:46:29 +0000 (08:46 +0000)]
MFC r214728:
If dlopen() is called for the dso that has been already loaded as a
dependency, then the dso never has its DAG initialized. Empty DAG
makes ref_dag() call in dlopen() a nop, and the dso refcount is off
by one.
Initialize the DAG on the first dlopen() call, using a boolean flag
to prevent double initialization.
MFC r214776:
Fix style.
MFC r214777:
Change init_dag() to not increment DAG refcount. Unconditionally call
both init_dag() and ref_dag() in dlopen() for the case when the object
was already loaded.
nork [Wed, 10 Nov 2010 05:22:12 +0000 (05:22 +0000)]
MFC 211249
This depends on ACPI, so only build on i386:i386, amd64:amd64 and
ia64:ia64. It can't possibly work on pc98, or any of the embedded
platforms, since they lack ACPI.
jilles [Tue, 9 Nov 2010 22:32:11 +0000 (22:32 +0000)]
MFC r198454: sh: Exempt $@ and $* from set -u
This seems more useful and will likely be in the next POSIX standard.
Also document more precisely in the man page what set -u does (note that
$@, $* and $! are the only special parameters that can ever be unset, all
the others are always set, although they may be empty).
marius [Tue, 9 Nov 2010 21:00:24 +0000 (21:00 +0000)]
MFC: r214873
- Move Sun Fire V240 to the list of known working machines.
- For the parallel stable/7 and stable/8 branches mention both releases that
first supported a particular sparc64 machine and update the sparc64 hardware
list regarding machines that will be supported beginning with 7.4-RELEASE.
jhb [Tue, 9 Nov 2010 20:00:23 +0000 (20:00 +0000)]
MFC 210939:
Add a new ipi_cpu() function to the MI IPI API that can be used to send an
IPI to a specific CPU by its cpuid. Replace calls to ipi_selected() that
constructed a mask for a single CPU with calls to ipi_cpu() instead.
OpenSolaris onnv-revision: 10209:91f47f0e7728 6830541 zfs_get_data_trips on a verify 6696242 multiple zfs_fillpage() zfs: accessing past end of object panics 6785914 zfs fails to drop dn_struct_rwlock in recovery code path
jhb [Tue, 9 Nov 2010 18:46:09 +0000 (18:46 +0000)]
MFC 214682:
Tweak the waitchannel messages for the dead lock detection kthread. Use
a shorter message (userland generally only sees the first 6 to 8
characters) when waiting for the allproc lock. Use "-" when idle to match
the behavior of other kthreads.
mav [Tue, 9 Nov 2010 15:14:10 +0000 (15:14 +0000)]
MFC r208436, r208438:
Make table-based HPET identification more clever. Before creating fake
device, make sure we have no real HPET device entry with same ID.
As side effect, it potentially allows several HPETs to be attached.
Use first of them for timecounting, rest (if ever present) could later
be used as event sources.
nork [Tue, 9 Nov 2010 13:39:17 +0000 (13:39 +0000)]
MFC 211201
Add tpm(4) driver for Trusted Platform Module.
You may want to look at http://bsssd.sourceforge.net/ .
Submitted by: Hans-Joerg Hoexer <Hans-Joerg_Hoexer@genua.de>
MFC 211204
Fix copyright information.
MFC 211270
Cosmetic change for splitting bus frontend file and core file.
MFC 211271
Hook tpm.4 manual to hook.
MFC 212861
Add support 'device tpm' for amd64.
Add tpm(4)'s default setting to /boot/defaults/loader.conf.
Add 'device tpm' to NOTES for amd64 and i386.
attilio [Tue, 9 Nov 2010 01:57:56 +0000 (01:57 +0000)]
MFC r204309, r204313 and r204319 by nyan:
Introduce the x86 subtree for code shared between amd64, i386 and pc98.
Differently from the HEAD version, the headers are not moved around,
in order to avoid breaking the KPI but it can be eventually done once the
core mechanism of r214629 is MFCed.
MFCing this patch does allow for simpler MFCs handling on i386/amd64
specific code.
jkim [Mon, 8 Nov 2010 20:25:19 +0000 (20:25 +0000)]
MFC: r213755
Use AcpiReset() from ACPICA instead of rolling our own, which is actually
incomplete. If FADT says the register is available, enable the capability
by default. Remove the previous default value from acpi(4).
yongari [Mon, 8 Nov 2010 20:14:38 +0000 (20:14 +0000)]
MFC r214542:
Don't bother to enable ASPM L1 to save more power. Even though I am
not able to trigger the issue with sample boards, some users seems
to suffer from freeze/lockup when system is booted without UTP cable
plugged in. I'm not sure whether this is BIOS issue or controller
bug. This change fixes AR8132 lockup issue seen on EEE PC.
yongari [Mon, 8 Nov 2010 19:36:00 +0000 (19:36 +0000)]
MFC r214428:
Add initial BCM5718 family support. The BCM5718 family includes
the dual port BCM5717 and BCM5718 devices which are intended for
mainstream workstation and entry-level server designs and
represents the twelfth generation of NetXtreme Ethernet controllers.
This family is the successor to the BCM5714/BCM5715 family and
supports IPv4/IPv6 checksum offloading, TSO, VLAN hardware tagging,
jumbo frames, MSI/MSIX, IOV, RSS and TSS.
This change set supports all hardware features except IOV and
RSS/TSS. Unlike its predecessors, only extended RX buffer
descriptors can be posted to the jumbo producer ring. Single RX
buffer descriptors for jumbo frame are not supported. RSS requires
a more substantial set of changes and will apply to a larger set
of NetXtreme devices so RSS/TSS multi-queue support will be
implemented in a future releases.
Special thanks to Broadcom who kindly sent a sample board to me
and to davidch who gave provided the initial support code.
rpaulo [Mon, 8 Nov 2010 11:22:55 +0000 (11:22 +0000)]
MFC r210682, r210683, r210690:
Build librtld_db.
Simplify the Makefile. The i386 and amd64 sections are equal.
libproc is going to be i386/amd64 only with the next update.
kib [Mon, 8 Nov 2010 10:23:39 +0000 (10:23 +0000)]
MFC r214026:
Do not synchronously start the nfsiod threads at all. The r212506
fixed the issues with file descriptor locks, but the same problems are
present for vnode lock/user map lock.
kib [Mon, 8 Nov 2010 10:18:01 +0000 (10:18 +0000)]
MFC r214851:
Fix a bug in r214049. The nvp == vp case shall be handled specially
only for !usevget case. If VFS_VGET is working, the vnode shared lock
is obtained recursively and vput() shall be done, not vunref().
MFC r214352 adapted to stable/8:
Reimplemented "gpart destroy -F". Now it does all work in kernel.
This was needed for recover implementation.
Implement the recover command for GPT. Now GPT will marked as
corrupt when any of three types of corruption will be detected:
1. Damaged primary GPT header or table
2. Damaged secondary GPT header or table
3. Secondary header is not located in the last LBA
Marked GPT becomes read-only. Any changes with corrupt table
are prohibited. Only "destroy" and "recover" commands are allowed.
marius [Sun, 7 Nov 2010 17:50:54 +0000 (17:50 +0000)]
MFC: r214528
- When resetting pm_active and pm_context of a pmap in pmap_pinit() we
need locking as otherwise we may race against the other parts of the
MD code which expects a consistent state of these. While at it move
the resetting of the pmap before entering it in the TSB.
- Spell a 0 as TLB_CTX_KERNEL.
marius [Sun, 7 Nov 2010 17:48:07 +0000 (17:48 +0000)]
MFC: r214264
- Add IFM_10_2 and IFM_10_5 media via tlphy(4) only in case the respective
interface also has such connectors.
- In tl_attach() unify three different ways of obtaining the device and
vendor IDs and remove the now obsolete tl_dinfo from tl_softc.
- Given that tlphy(4) only handles the integrated PHYs of NICs driven by
tl(4) make it only probe on the latter.
- Switch mlphy(4) and tlphy(4) to use mii_phy_add_media()/mii_phy_setmedia().
- Simplify looking for the respective companion PHY in mlphy(4) and tlphy(4)
by ignoring the native one by just comparing the device_t's directly rather
than the device name.
marius [Sun, 7 Nov 2010 17:35:42 +0000 (17:35 +0000)]
MFC: r214262
- Take advantage of mii_phy_dev_probe().
- Use mii_phy_add_media() instead of mii_add_media(). I'm not sure how
this driver actually managed to work before as mii_add_media() is
intended to be used to gether with mii_anar() while mii_phy_add_media()
is intended to be used with mii_phy_setmedia(), however this driver
mii_add_media() along with mii_phy_setmedia().
marius [Sun, 7 Nov 2010 16:56:29 +0000 (16:56 +0000)]
MFC: r213894, r213896, r214913
Converted the remainder of the NIC drivers to use the mii_attach()
introduced in r213878 (MFC'ed to stable/8 in r214685) instead of
mii_phy_probe(). Unlike r213893 (MFC'ed to stable/8 in r214909) these
are only straight forward conversions though.
marius [Sun, 7 Nov 2010 11:12:29 +0000 (11:12 +0000)]
MFC: r213893, r213908, r214566, r214605, r214846
Convert the PHY drivers to honor the mii_flags passed down and convert
the NIC drivers as well as the PHY drivers to take advantage of the
mii_attach() introduced in r213878 (MFC'ed to stable/8 in r214684) to
get rid of certain hacks. For the most part these were:
- Artificially limiting miibus_{read,write}reg methods to certain PHY
addresses; we now let mii_attach() only probe the PHY at the desired
address(es) instead.
- PHY drivers setting MIIF_* flags based on the NIC driver they hang
off from, partly even based on grabbing and using the softc of the
parent; we now pass these flags down from the NIC to the PHY drivers
via mii_attach(). This got us rid of all such hacks except those of
brgphy() in combination with bce(4) and bge(4), which is way beyond
what can be expressed with simple flags.
While at it, I took the opportunity to change the NIC drivers to pass
up the error returned by mii_attach() (previously by mii_phy_probe())
and unify the error message used in this case where and as appropriate
as mii_attach() actually can fail for a number of reasons, not just
because of no PHY(s) being present at the expected address(es).
Make the IPsec SADB embedded route cache a union to be able to hold both the
legacy and IPv6 route destination address.
Previously in case of IPv6, there was a memory overwrite due to not enough
space for the IPv6 address.
lstewart [Sat, 6 Nov 2010 10:31:52 +0000 (10:31 +0000)]
MFC r213913:
Retire the system-wide, per-reassembly queue segment limit. The mechanism is far
too coarse grained to be useful and the default value significantly degrades TCP
performance on moderate to high bandwidth-delay product paths with non-zero loss
(e.g. 5+Mbps connections across the public Internet often suffer).
Replace the outgoing mechanism with an individual per-queue limit based on the
number of MSS segments that fit into the socket's receive buffer. This should
strike a good balance between performance and the potential for resource
exhaustion when FreeBSD is acting as a TCP receiver. With socket buffer
autotuning (which is enabled by default), the reassembly queue tracks the socket
buffer and benefits too.
As the XXX comment suggests, my testing uncovered some unexpected behaviour
which requires further investigation. By using so->so_rcv.sb_hiwat instead of
sbspace(&so->so_rcv), we allow more segments to be held across both the socket
receive buffer and reassembly queue than we probably should. The tradeoff is
better performance in at least one common scenario, versus a devious sender's
ability to consume more resources on a FreeBSD receiver.
Sponsored by: FreeBSD Foundation
Reviewed by: andre, gnn, rpaulo
lstewart [Sat, 6 Nov 2010 10:26:49 +0000 (10:26 +0000)]
MFC r213912:
- Switch the "net.inet.tcp.reass.cursegments" and
"net.inet.tcp.reass.maxsegments" sysctl variables to be based on UMA zone
stats. The value returned by the cursegments sysctl is approximate owing to
the way in which uma_zone_get_cur is implemented.
- Discontinue use of V_tcp_reass_qsize as a global reassembly segment count
variable in the reassembly implementation. The variable was used without
proper synchronisation and was duplicating accounting done by UMA already. The
lack of synchronisation was particularly problematic on SMP systems
terminating many TCP sessions, resulting in poor TCP performance for
connections with non-zero packet loss.
Sponsored by: FreeBSD Foundation
Reviewed by: andre, gnn, rpaulo (as part of a larger patch)
lstewart [Sat, 6 Nov 2010 10:17:43 +0000 (10:17 +0000)]
MFC r210203:
- Move common code from the hook functions that fills in a packet node struct to
a separate inline function. This further reduces duplicate code that didn't
have a good reason to stay as it was.
- Reorder the malloc of a pkt_node struct in the hook functions such that it
only occurs if we managed to find a usable tcpcb associated with the packet.
- Make the inp_locally_locked variable's type consistent with the prototype of
siftr_siftdata().
lstewart [Sat, 6 Nov 2010 10:06:58 +0000 (10:06 +0000)]
MFC r213910:
- Simplify implementation of uma_zone_get_max.
- Add uma_zone_get_cur which returns the current approximate occupancy of a
zone. This is useful for providing stats via sysctl amongst other things.
Sponsored by: FreeBSD Foundation
Reviewed by: gnn, jhb
lstewart [Sat, 6 Nov 2010 09:56:14 +0000 (09:56 +0000)]
MFC r211396 (originally committed by andre):
Add uma_zone_get_max() to obtain the effective limit after a call
to uma_zone_set_max().
The UMA zone limit is not exactly set to the value supplied but rounded up to
completely fill the backing store increment (a page normally). This can lead to
surprising situations where the number of elements allocated from UMA is higher
than the supplied limit value. The new get function reads back the effective
value so that the supplied limit value can be adjusted to the real limit.
lstewart [Sat, 6 Nov 2010 09:42:41 +0000 (09:42 +0000)]
MFC r213158:
Internalise reassembly queue related functionality and variables which should
not be used outside of the reassembly queue implementation. Provide a new
function to flush all segments from a reassembly queue and call it from the
appropriate places instead of manipulating the queue directly.
Sponsored by: FreeBSD Foundation
Reviewed by: andre, gnn, rpaulo
lstewart [Sat, 6 Nov 2010 09:34:51 +0000 (09:34 +0000)]
MFC r209662,209665:
Import the Statistical Information For TCP Research (SIFTR) kernel module into
FreeBSD. SIFTR logs a range of statistics on active TCP connections to a log
file, providing the ability to make highly granular measurements of TCP
connection state. The tool is aimed at system administrators, developers and
researchers alike. Please take it for a spin and test it out - the man page
should have all the information required to get you going.
Many thanks go to the Cisco University Research Program Fund at Community
Foundation Silicon Valley and the FreeBSD Foundation. Their support of our work
at the Centre for Advanced Internet Architectures, Swinburne University of
Technology is greatly appreciated.
r209980:
Catch up with the rename of DPCPU_SUM to DPCPU_VARSUM.
r209982:
The SIFTR DPCPU statistics struct was not being zeroed between enable/disable
cycles so the values would accumulate rather than reset for each cycle.
Sponsored by: Cisco URP (r209662), FreeBSD Foundation
Reviewed by: dwmalone, gnn, rpaulo (r209662)
Tested by: Many on freebsd-current@ and elsewhere over the years
lstewart [Sat, 6 Nov 2010 09:23:49 +0000 (09:23 +0000)]
MFC r209050 (originally committed by jhb):
Add helper macros to iterate over available CPUs in the system.
CPU_FOREACH(i) iterates over the CPU IDs of all available CPUs. The
CPU_FIRST() and CPU_NEXT(i) macros can also be used to iterate over
available CPU IDs. CPU_NEXT(i) wraps around to CPU_FIRST() rather than
returning some sort of terminator.
rmacklem [Fri, 5 Nov 2010 02:33:27 +0000 (02:33 +0000)]
MFC: r214511
Add a call for nfsrpc_close() to ncl_reclaim() in the experimental
NFSv4 client, since the call in ncl_inactive() might be missed
because VOP_INACTIVE() is not guaranteed to be called before
VOP_RECLAIM().
rmacklem [Fri, 5 Nov 2010 02:12:18 +0000 (02:12 +0000)]
MFC: r214406
Add a flag to the experimental NFSv4 client to indicate when
delegations are being returned for reasons other than a Recall.
Also, re-organize nfscl_recalldeleg() slightly, so that it leaves
clearing NMODIFIED to the ncl_flush() call and invalidates the
attribute cache after flushing. It is hoped that these changes
might fix the problem others have seen when using the NFSv4
client with delegations enabled, since I can't reliably reproduce
the problem. These changes only affect the client when doing NFSv4
mounts with delegations enabled.