Commit Graph

93411 Commits

Author SHA1 Message Date
Andre Oppermann
33e0730e2d Specify a maximum TSO length limiting the segment chain to what the
Xen host side can handle after defragmentation.

This prevents the driver from throwing away too long TSO chains and
improves the performance on Amazon AWS instances with 10GigE virtual
interfaces to the normally expected throughput.

Submitted by:	cperciva (earlier version)
Reviewed by:	cperciva
Tested by:	cperciva
MFC after:	1 week
2013-06-03 13:00:33 +00:00
Andre Oppermann
3c914c547e Allow drivers to specify a maximum TSO length in bytes if they are
limited in the amount of data they can handle at once.

Drivers can set ifp->if_hw_tsomax before calling ether_ifattach() to
change the limit.

The lowest allowable size is IP_MAXPACKET / 8 (8192 bytes) as anything
less wouldn't be very useful anymore.  The upper limit is still at
IP_MAXPACKET (65536 bytes).  Raising it requires further auditing of
the IPv4/v6 code path's as the length field in the IP header would
overflow leading to confusion in firewalls and others packet handler on
the real size of the packet.

The placement into "struct ifnet" is a bit hackish but the best place
that was found.  When the stack/driver boundary is updated it should
be handled in a better way.

Submitted by:	cperciva (earlier version)
Reviewed by:	cperciva
Tested by:	cperciva
MFC after:	1 week (using spare struct members to preserve ABI)
2013-06-03 12:55:13 +00:00
David Schultz
0921e73008 Bump __FreeBSD_version for the addition of the following functions to libm:
cacos, cacosf, cacosh, cacoshf,
  casin, casinf, casinh, casinhf,
  catan, catanf, catanh, catanhf,
  logl, log2l, log10l, log1pl
I am hoping kargl@ will commit expl and expm1l soon, in which case this
bump will cover those, too.

Requested by:	danfe
2013-06-03 09:33:51 +00:00
Konstantin Belousov
1e65d73c74 Do not map the shared page COW. If the process wired its address
space, fork(2) would cause shadowing of the physical object and
copying of the shared page into private copy, effectively preventing
updates for the exported timehands structure and stopping the clock.

Specify the maximum allowed permissions for the page to be read and
execute, preventing write from the user mode.

Reported and tested by:	<huanghwh@yahoo.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2013-06-03 04:32:53 +00:00
Konstantin Belousov
07d46f9c18 MFamd64: when printing the trap information, show the %esp value.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2013-06-03 04:19:21 +00:00
Konstantin Belousov
92fab43f7f When auto-sizing the buffer cache, limit the amount of physical memory
used as the estimation of size, to 32GB.  This provides around 100K of
buffer headers and corresponding KVA for buffer map at the peak.
Sizing the cache larger is not useful, also resulting in the wasting
and exhausting of KVA for large machines.

Reported and tested by:	bdrewery
Sponsored by:	The FreeBSD Foundation
2013-06-03 04:16:48 +00:00
Konstantin Belousov
aed1e745d0 The vm_page lock is not needed around the call to vm_page_insert().
Submitted by:	alc
MFC after:	1 week
2013-06-03 04:11:42 +00:00
Alan Cox
b417181250 Require that the page lock is held, instead of the object lock, when
clearing the page's PGA_REFERENCED flag.  Since we are typically
manipulating the page's act_count field when we are clearing its
PGA_REFERENCED flag, the page lock is already held everywhere that we clear
the PGA_REFERENCED flag.  So, in fact, this revision only changes some
comments and an assertion.  Nonetheless, it will enable later changes to
object locking in the pageout code.

Introduce vm_page_assert_locked(), which completely hides the implementation
details of the page lock from the caller, and use it in
vm_page_aflag_clear().  (The existing vm_page_lock_assert() could not be
used in vm_page_aflag_clear().)  Over the coming weeks, I expect that we'll
either eliminate or replace the various uses of vm_page_lock_assert() with
vm_page_assert_locked().

Reviewed by:	attilio
Sponsored by:	EMC / Isilon Storage Division
2013-06-03 01:22:54 +00:00
Alan Cox
eeff88a7ca Remove unnecessary #include's. 2013-06-02 18:10:16 +00:00
Alan Cox
39a4cd0cec Reduce the scope of the VM object locking in brelse(). In my tests, this
change reduced the total number of VM object lock acquisitions by brelse()
by 74%.

Sponsored by:	EMC / Isilon Storage Division
2013-06-02 16:18:03 +00:00
Hans Petter Selasky
e45547006e Correct the TD size computation. npkt should reflect the number of packets
remaining after the current TRB has been executed. Refer to section 4.11.2.4
of the XHCI specification for USB.

MFC after:	1 week
2013-06-02 12:28:29 +00:00
Hans Petter Selasky
c82b624fdc Correct TRB type for multi TRB transfers of non-NORMAL type, like isochronous.
Only the first TRB should be markes as special. Subsequent ones should be
marked as NORMAL. Optimise away TD first variable.

MFC after:	1 week
2013-06-02 12:16:58 +00:00
Hans Petter Selasky
fc66305366 Use the correct constant for 8000 IRQ/s.
MFC after:	1 week
2013-06-02 12:00:16 +00:00
Hans Petter Selasky
60decf203d Block event interrupts when we don't need it as soon as possible.
Typically this feature is used for isochronous transfers.
This reduces the amount of XHCI interrupting.

MFC after:	1 week
2013-06-02 11:58:31 +00:00
Tijl Coosemans
53089271a1 Convert old make variable modifiers :U and :L to bmake :tu and :tl.
Reviewed by:	sjg
2013-06-02 11:44:23 +00:00
Hans Petter Selasky
ef32af2180 Don't set the start ISOC ASAP bit for non-isochronous TRBs.
MFC after:	1 week
2013-06-02 10:54:47 +00:00
Michael Tuexen
fe1831e06f Use LIST_EMPTY when appropriate.
MFC after: 1 week
2013-06-02 10:35:08 +00:00
Hans Petter Selasky
cfa00b0d75 Correct some XHCI streams mode transfer handling found by code inspection.
The existing streams mode support is not working and has not been tested
due to lack of hardware which supports the given feature.

MFC after:	1 week
2013-06-02 10:32:57 +00:00
Mark Johnston
f263e440d4 SDT probes can directly pass up to five arguments as arguments to
dtrace_probe(). Arguments beyond these five must be obtained in an
architecture-specific way; this can be done through the getargval provider
method, and through dtrace_getarg() if getargval isn't overridden.

This change fixes two off-by-one bugs in the way these arguments are fetched
in FreeBSD's DTrace implementation. First, the SDT provider must set the
aframes parameter to 1 when creating a probe. The aframes parameter controls
the number of frames that dtrace_getarg() will step over in order to find
the frame containing the extra arguments. On FreeBSD, dtrace_getarg() is
called in SDT probe context via

dtrace_probe()->dtrace_dif_emulate()->dtrace_dif_variable->dtrace_getarg()

so aframes must be 3 since the arguments are in dtrace_probe()'s frame; it
was previously being called with a value of 2 instead. illumos uses a
different aframes value for SDT probes, but this is because illumos SDT
probes fire by triggering the #UD fault handler rather than calling
dtrace_probe() directly.

The second bug has to do with the way arguments are grabbed out
dtrace_probe()'s frame on amd64. The code currently jumps over the first
stack argument and retrieves the rest of them using a pointer into the
stack. This works on i386 because all of dtrace_probe()'s arguments will be
on the stack and the first argument is the probe ID, which should be
ignored. However, it is incorrect to ignore the first stack argument on
amd64, so we correct the pointer used to access the arguments.

MFC after:	2 weeks
2013-06-02 01:05:36 +00:00
Mark Johnston
18161786c6 Port the SDT test now that it's possible to create SDT probes that take
seven arguments.

The original test uses Solaris' uadmin system call to trigger the test
probe; this change adds a sysctl to the dtrace_test module and gets the test
program to trigger the test probe via the sysctl handler.

The test is currently failing on amd64 because of some bugs in the way that
probe arguments beyond the first five are obtained - these bugs will be
fixed in a separate change.
2013-06-02 00:33:36 +00:00
Ed Schouten
06bee445d4 Move <stdatomic.h> into sys/sys/.
This will allow us to use C11 atomics in kernelspace, although it will
need to be included as <sys/stdatomic.h>.
2013-06-01 21:02:26 +00:00
Alan Cox
b4e498071d Now that access to the page's "act_count" field is synchronized by the page
lock instead of the object lock, there is no reason for vm_page_activate()
to assert that the object is locked for either read or write access.
(The "VPO_UNMANAGED" flag never changes after page allocation.)

Sponsored by:	EMC / Isilon Storage Division
2013-06-01 20:32:34 +00:00
Yoshihiro Takahashi
9a068b2e34 MFi386: revision 245848
Always update the hw.uart.console hint.
2013-06-01 12:27:48 +00:00
Yoshihiro Takahashi
0ead4cbf9f MFi386: revision 251039
Use slightly more idiomatic expression to get the address of array.
2013-06-01 12:21:59 +00:00
Marius Strobl
0ad17e4b32 Move an assertion to the right spot; only bus_dmamap_load_mbuf(9)
requires a pkthdr being present but that's not the case for either
_bus_dmamap_load_mbuf_sg() or bus_dmamap_load_mbuf_sg(9).

Reported by:	sbruno
MFC after:	1 week
2013-06-01 11:42:47 +00:00
John Baldwin
f112d4f8b7 Remove an unused macro we originally got from BSD/OS. 2013-06-01 11:31:09 +00:00
Justin T. Gibbs
7283d23698 sys/dev/xen/blkfront/blkfront.c:
Remove dead code.

Sponsored by:	Spectra Logic Corporation
MFC after:	1 week
2013-06-01 04:07:56 +00:00
Justin T. Gibbs
d9fab01d7b sys/dev/xen/blkfront/blkfront.c:
Remove local, and incorrect, definition for the value of an invalid
	grant reference.

	Extract ring cleanup code into xbd_free_ring() function for
	symetry with xbd_alloc_ring().  This process also eliminated
	an initialized but unused variable.

Sponsored by:	Spectra Logic Corporation
MFC after:	1 week
2013-06-01 04:02:51 +00:00
Navdeep Parhar
9e4ffff197 cxgbe(4): Some more debug sysctls. These work on both T4 and T5 based
cards.

dev.t5nex.0.misc.cim_ma_la: CIM MA logic analyzer
dev.t5nex.0.misc.cim_pif_la: CIM PIF logic analyzer
dev.t5nex.0.misc.mps_tcam: MPS TCAM entries
dev.t5nex.0.misc.tp_la: TP logic analyzer
dev.t5nex.0.misc.ulprx_la: ULPRX logic analyzer

Obtained from:	Chelsio
MFC after:	1 week
2013-06-01 02:07:37 +00:00
Justin T. Gibbs
cdf5d66f2f Style changes. No intended functional changes.
o rename flush_requests => xbd_flush_requests
 o rename xbd_setup_ring => xbd_alloc_ring

Sponsored by:	Spectra Logic Corporation
MFC after:	1 week
2013-05-31 22:33:28 +00:00
Justin T. Gibbs
fac3fd8015 Style cleanups. No intended functional changes.
o Group functions by by their functionality.
 o Remove superfluous declarations.
 o Remove more unused (#ifdef'd out) code.

Sponsored by:	Spectra Logic Corporation
2013-05-31 22:21:37 +00:00
David E. O'Brien
1f4e9654bd Add a "kern.features" MIB for 32bit support under a 64bit kernel. 2013-05-31 21:43:17 +00:00
Justin T. Gibbs
33eebb6a75 Style cleanups. No intended functional changes.
o This driver is the "xbd" driver, not the "blkfront", "blkif", "xbf", or
   "xb" driver.  Use the "xbd_" naming conventions for all functions,
   structures, and constants.
 o The prevailing convention for structure fields in this driver is to
   prefix them with an abreviation of the structure type.  Update
   "recently added" fields to match this style.
 o Remove unused data structures.
 o Remove superfluous casts.
 o Make a pass over the whole driver and bring it closer to
   style(9) conformance.

Sponsored by:	Spectra Logic Corporation
MFC after:	1 week
2013-05-31 21:05:07 +00:00
Xin LI
cb5a918317 Explicitly use a pair of parentheses to ensure correct evaluation
ordering for bitwise operation.

Submitted by:	swildner (DragonFly)
MFC after:	2 weeks
2013-05-31 17:27:44 +00:00
John Baldwin
3d4c503cf0 Style fixes to vn_ioctl().
Suggested by:	bde
2013-05-31 16:15:22 +00:00
Alan Cox
ef5ba5a31d Simplify the definition of vm_page_lock_assert(). There is no compelling
reason to inline the implementation of vm_page_lock_assert() in the
!KLD_MODULES case.  Use the same implementation for both KLD_MODULES and
!KLD_MODULES.

Reviewed by:	kib
2013-05-31 16:00:42 +00:00
Justin T. Gibbs
e3242f9d08 Make netif_free() safe to call on a partially initialized softc.
Sponsored by:	Spectra Logic Corporation
MFC after:	1 week
2013-05-31 04:45:59 +00:00
Justin T. Gibbs
5e58295a1f Apply the ad* => ada* IDE device name transition to the Xen block
front driver.

Submitted by:	Bei Guan <gbtju85@gmail.com>
Reviewed by:	gibbs
MFC after:	1 week
2013-05-31 04:43:19 +00:00
Sean Bruno
f746997530 xpt_create_path() requires mfi_io_lock to be held, so do it.
mfi(4) doesn't panic on host startup now.

MFC this if svn 249468-242726 is shoveled back to stable/9

Obtained from:	Yahoo! Inc.
2013-05-31 03:14:49 +00:00
Jeff Roberson
22a722605d - Convert the bufobj lock to rwlock.
- Use a shared bufobj lock in getblk() and inmem().
 - Convert softdep's lk to rwlock to match the bufobj lock.
 - Move INFREECNT to b_flags and protect it with the buf lock.
 - Remove unnecessary locking around bremfree() and BKGRDINPROG.

Sponsored by:	EMC / Isilon Storage Division
Discussed with:	mckusick, kib, mdf
2013-05-31 00:43:41 +00:00
Mark Johnston
3dd2790a9f Add macros which allow one to define SDT probes with six or seven arguments;
they are needed when porting some of the Solaris providers (ip, iscsi, and
tcp in particular).

dtrace_probe() only takes five arguments from the probe site, so we need to
add the appropriate cast to allow for more than five arguments. The extra
arguments are later copied out of dtrace_probe()'s stack frame by
dtrace_getarg() (or the provider-specific getarg method) as needed.

MFC after:	1 week
2013-05-30 21:57:40 +00:00
Marius Strobl
939ce643ea - Checking for spurious interrupts is only necessary when using INTx.
Actually, this may be further optimized for controller variants
  supporting one-shot MSIs but I'm lacking the necessary hardware for
  testing.
- Add some missing synchronization of the statistics and status DMA
  maps.

MFC after:	1 week
2013-05-30 20:54:17 +00:00
Konstantin Belousov
7560005c41 After the object lock was dropped, the object' reference count could
change.  Retest the ref_count and return from the function to not
execute the further code which assumes that ref_count == 1 if it is
not.  Also, do not leak vnode lock if other thread cleared OBJ_TMPFS
flag meantime.

Reported by:	bdrewery
Tested by:	bdrewery, pho
Sponsored by:	The FreeBSD Foundation
2013-05-30 20:00:19 +00:00
Konstantin Belousov
782d4a636b Remove the capitalization in the assertion message. Print the address
of the object to get useful information from optimizated kernels dump.
2013-05-30 19:53:31 +00:00
Konstantin Belousov
67b4ed4b88 Assert that OBJ_TMPFS flag on the vm object for the tmpfs node is
cleared when the tmpfs node is going away.

Tested by:	bdrewery, pho
2013-05-30 19:51:33 +00:00
Marius Strobl
5f8c010fd9 - Do supply arguments as pointers to bce_get_{pg,rx}_buf() that are not
altered or actually needed there any longer.
- Honor errors passed to the DMA mapping callbacks.
- In bce_get_rx_buf(), do not reserve stack space for more DMA segments
  than actually necessary.
- In bce_get_pg_buf(), take advantage of bus_dmamap_load_mbuf_sg(9).
- In bce_rx_intr(), remove a pointless check for an empty mbuf pointer
  which can only happen in case of a severe programming error. Moreover,
  recovering from that situation would require way more actions with header
  splitting enabled (which it is by default).
- Fix VLAN tagging in the RX path; do not attach the VLAN tag twice if the
  firmware has been told to keep it. [1]

Obtained from:	OpenBSD [1]
MFC after:	1 week
2013-05-30 17:24:36 +00:00
Marius Strobl
4c39437f5f - As a follow-up to r247565, make firmware images that do not require
patching at runtime actually const.
- Remove pointless softc members by employing the corresponding constants
  directly.
- Remove pointless returns.
- Remove unnecessary inclusion of opt_device_polling.h.
- Replace an outdated and now bogus comment in bce_tick() with the
  appropriate one.

MFC after:	1 week
2013-05-30 16:09:56 +00:00
Luigi Rizzo
f18be5766f Bring in a number of new features, mostly implemented by Michio Honda:
- the VALE switch now support up to 254 destinations per switch,
  unicast or broadcast (multicast goes to all ports).

- we can attach hw interfaces and the host stack to a VALE switch,
  which means we will be able to use it more or less as a native bridge
  (minor tweaks still necessary).
  A 'vale-ctl' program is supplied in tools/tools/netmap
  to attach/detach ports the switch, and list current configuration.

- the lookup function in the VALE switch can be reassigned to
  something else, similar to the pf hooks. This will enable
  attaching the firewall, or other processing functions (e.g. in-kernel
  openvswitch) directly on the netmap port.

The internal API used by device drivers does not change.

Userspace applications should be recompiled because we
bump NETMAP_API as we now use some fields in the struct nmreq
that were previously ignored -- otherwise, data structures
are the same.

Manpages will be committed separately.
2013-05-30 14:07:14 +00:00
Luigi Rizzo
27892e02fb clarify usage of NETMAP_BUF 2013-05-30 13:41:19 +00:00
Marius Strobl
2dc26832f7 - Merge from r249476: Ensure that PCI bus BUS_GET_DMA_TAG() method sees
the actual PCI device which makes the request for DMA tag, instead of
  some descendant of the PCI device, by creating a pass-through trampoline.
- Sprinkle const on tables.
- Use NULL instead of 0 for pointers.
- Take advantage of nitems().

MFC after:	1 week
2013-05-30 12:16:55 +00:00