Commit Graph

106073 Commits

Author SHA1 Message Date
Ed Maste
319a55f4cd arm64: add kbd.c to the build for ukbd to fix the build
Pointy hat to:	emaste
2015-09-15 23:44:19 +00:00
Mateusz Guzik
7665e341ca sysctl: switch sysctllock to a sleepable rmlock, take 2
This restores r285125. Previous attempt was reverted due to a bug in rmlocks,
which is fixed since r287833.
2015-09-15 23:06:56 +00:00
John Baldwin
e89d5f43da Threads holding a read lock of a sleepable rm lock are not permitted
to sleep.  The rmlock implementation enforces this by disabling
sleeping when a read lock is acquired. To simplify the implementation,
sleeping is disabled for most of the duration of rm_rlock.  However,
it doesn't need to be disabled until the lock is acquired.  If a
sleepable rm lock is contested, then rm_rlock may need to acquire the
backing sx lock.  This tripped the overly-broad assertion.  Fix by
relaxing the assertion around the call to sx_xlock().

Reported by:	mjg
Reviewed by:	kib, mjg
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3324
2015-09-15 22:16:21 +00:00
Brad Davis
e5fe11011a Remove redundant 'man page'
Reviewed by:	allanjude
2015-09-15 21:16:45 +00:00
Conrad Meyer
55d33667ee kevent(2): Note DOOMED vnodes with NOTE_REVOKE
In poll mode, check for and wake VBAD vnodes.  (Vnodes that are VBAD at
registration will never be woken by the RECLAIM trigger.)

Add post-VOP_RECLAIM hook to trigger notes on vnode reclamation.  (Vnodes that
were fine at registration but are vgoned while being monitored should signal
waiters.)

Reviewed by:	kib
Approved by:	markj (mentor)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3675
2015-09-15 20:22:30 +00:00
Hiren Panchasara
550e9d4235 Remove unnecessary tcp state transition call.
Differential Revision:	D3451
Reviewed by:		markj
MFC after:		2 weeks
Sponsored by:		Limelight Networks
2015-09-15 20:04:30 +00:00
Ed Maste
9b76bf99d5 arm64: add xhci driver and umass/ukbd to GENERIC for Cavium ThunderX
Sponsored by:	The FreeBSD Foundation
2015-09-15 19:59:35 +00:00
Renato Botelho
1a2b77cf2e Add support for Sierra MC7355 card
Submitted by:	Jeremy Porter <jporter@netgate.com>
Approved by:	loos
Obtained from:	pfSense
MFC after:	1 week
Sponsored by:	Rubicon Communications (Netgate)
2015-09-15 18:21:56 +00:00
Edward Tomasz Napierala
bb27d7ed90 Add a way to specify stripesize and stripeoffset to gnop(8). This makes
it possible to "simulate" 4K media, to eg test alignment handling.

Reviewed by:	mav@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3664
2015-09-15 18:01:59 +00:00
Alexander V. Chernikov
0e2dcee6b2 Simplify nd6_cache_lladdr:
* Move isRouter calculation code to separate nd6_is_router() function.
* Make nd6_cache_lladdr() return void: its return value hasn't been used
  since r53541 KAME import in 1999.

Sponsored by:	Yandex LLC
2015-09-15 17:16:31 +00:00
Ed Maste
aafbd0257a Add Cavium ThunderX xHCI controller PCI ID
There is an issue with interrupts at the moment, but it works with
polling mode set (hw.usb.xhci.use_polling=1).

Reviewed by:	hselasky
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3665
2015-09-15 16:08:25 +00:00
Alexander Motin
c39d464164 Make CAM log errors that make it wait.
Waiting can take minutes, and it would be good for user to know what is
going on.

MFC after:	2 weeks
2015-09-15 10:57:16 +00:00
Alexander Motin
18e87f95f7 Fix completion/error status reporting. 2015-09-15 10:42:53 +00:00
Alexander Motin
923863546a Close potential race between datamove and HA failover. 2015-09-15 09:36:46 +00:00
Alexander V. Chernikov
eec33ea052 * Improve logging invalid arp messages
* Remove redundant check in ip_arpinput

Suggested by:	glebius
MFC after:	2 weeks
2015-09-15 08:50:44 +00:00
Alexander V. Chernikov
d3cdb71655 * Require explicitl lle unlink prior to calling llentry_delete().
This one slightly decreases time of holding afdata wlock.
* While here, make nd6_free() return void. No one has used its return value
  since r186119.
2015-09-15 06:48:19 +00:00
Mark Johnston
87dd1668e0 Preserve the device queue status before retrying a sense request in
chdone(). Previously, the retry could clear the CAM_DEV_QFRZN bit in the
CCB status, leaving the queue frozen.

Submitted by:	Jeff Miller <Jeff.Miller@isilon.com>
Reviewed by:	ken
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-15 05:09:17 +00:00
Adrian Chadd
89fd823782 Replace the scan event input path hack with the new rx-stats based method.
This allows for arbitrary channel info to be placed in the input call rather
than the totally gross hack of overriding ic_curchan.

Without this I'm sure ic_curchan setting was racing with the scan code
setting the channel itself..
2015-09-15 03:01:40 +00:00
Eric van Gyzen
17a036563d Fix the handling of IPv6 On-Link Redirects.
On receipt of a redirect message, install an interface route for the
redirected destination.  On removal of the corresponding Neighbor Cache
entry, remove the interface route.

This requires changes in rtredirect_fib() to cope with an AF_LINK
address for the gateway and with the absence of RTF_GATEWAY.

This fixes the "Redirected On-Link" test cases in the Tahi IPv6 Ready Logo
Phase 2 test suite.

Unrelated to the above, fix a recursion on the radix node head lock
triggered by the Tahi Redirected to Alternate Router test cases.

When I first wrote this patch in October 2012, all Section 2
(Neighbor Discovery) test cases passed on 10-CURRENT, 9-STABLE,
and 8-STABLE.  cem@ recently rebased the 10.x patch onto head and reported
that it passes Tahi.  (Thanks!)

These other test cases also passed in 2012:

* the RTF_MODIFIED case, with IPv4 and IPv6 (using a
  RTF_HOST|RTF_GATEWAY route for the destination)

* the redirected-to-self case, with IPv4 and IPv6

* a valid IPv4 redirect

All testing in 2012 was done with WITNESS and INVARIANTS.

Tested by:    EMC / Isilon Storage Division via Conrad Meyer (cem) in 2015,
              Mark Kelley <mark_kelley@dell.com> in 2012,
              TC Telkamp <terence_telkamp@dell.com> in 2012
PR:           152791
Reviewed by:  melifaro (current rev), bz (earlier rev)
Approved by:  kib (mentor)
MFC after:    1 month
Relnotes:     yes
Sponsored by: Dell Inc.
Differential Revision: https://reviews.freebsd.org/D3602
2015-09-14 19:17:25 +00:00
Alexander V. Chernikov
3e7a2321e3 * Do more fine-grained locking: call eventhandlers/free_entry
without holding afdata wlock
* convert per-af delete_address callback to global lltable_delete_entry() and
  more low-level "delete this lle" per-af callback
* fix some bugs/inconsistencies in IPv4/IPv6 ifscrub procedures

Sponsored by:		Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D3573
2015-09-14 16:48:19 +00:00
Alexander Motin
d0f25804a7 Implement data/status aggregation for secondary HA node.
For short read requests this reduces latency by 30%, reporting command
completion after two interlink roundtrips instead of full three.
2015-09-14 15:21:23 +00:00
Alexander Motin
3ed019a919 Implement data/status aggregation for camsim backend.
This is almost pointless for primary HA node, but useful for secondary,
where between fe_datamove and fe_done calls goes another link roundtrip.
2015-09-14 15:15:32 +00:00
Hans Petter Selasky
9acc0eafd7 Implement callout_drain_async(), inspired by the projects/hps_head
branch.

This function is used to drain a callout via a callback instead of
blocking the caller until the drain is complete. Refer to the
callout_drain_async() manual page for a detailed description.

Limitation: If a lock is used with the callout, the callout can only
be drained asynchronously one time unless the callout_init_mtx()
function is called again. This limitation is not present in
projects/hps_head and will require more invasive changes to the
timeout code, which was not in the scope of this patch.

Differential Revision:	https://reviews.freebsd.org/D3521
Reviewed by:		wblock
MFC after:		1 month
2015-09-14 10:52:26 +00:00
Alexander V. Chernikov
deb6bda6e3 * Improve error checking for arp messages.
* Clean stale headers from if_ether.c.

Reported by:	rozhuk.im at gmail.com
Reviewed by:	ae
MFC after:	2 weeks
2015-09-14 10:28:47 +00:00
Alexander Motin
7b6660c9aa Remove CTL_PRIV_LBA_LEN from HA messages.
Previously it was used for statistics, but now just a 16 extra bytes.
2015-09-14 09:56:01 +00:00
Hans Petter Selasky
d76d40126e Update TSO limits to include all headers.
To make driver programming easier the TSO limits are changed to
reflect the values used in the BUSDMA tag a network adapter driver is
using. The TCP/IP network stack will subtract space for all linklevel
and protocol level headers and ensure that the full mbuf chain passed
to the network adapter fits within the given limits.

Implementation notes:

If a network adapter driver needs to fixup the first mbuf in order to
support VLAN tag insertion, the size of the VLAN tag should be
subtracted from the TSO limit. Else not.

Network adapters which typically inline the complete header mbuf could
technically transmit one more segment. This patch does not implement a
mechanism to recover the last segment for data transmission. It is
believed when sufficiently large mbuf clusters are used, the segment
limit will not be reached and recovering the last segment will not
have any effect.

The current TSO algorithm tries to send MTU-sized packets, where the
MTU typically is 1500 bytes, which gives 1448 bytes of TCP data
payload per packet for IPv4. That means if the TSO length limitiation
is set to 65536 bytes, there will be a data payload remainder of
(65536 - 1500) mod 1448 bytes which is equal to 324 bytes. Trying to
recover total TSO length due to inlining mbuf header data will not
have any effect, because adding or removing the ETH/IP/TCP headers
to or from 324 bytes will not cause more or less TCP payload to be
TSO'ed.

Existing network adapter limits will be updated separately.

Differential Revision:	https://reviews.freebsd.org/D3458
Reviewed by:		rmacklem
MFC after:		2 weeks
2015-09-14 08:36:22 +00:00
Alexander Motin
ceff31dc0c Implement QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT.
Now we support most of SAM-5 task management.
2015-09-14 08:01:05 +00:00
Hans Petter Selasky
6e17d3a7fc Add missing file to build. 2015-09-14 07:11:53 +00:00
Hans Petter Selasky
6eed0dd7c4 Correct PCI ID.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 month
PR:		202807
2015-09-14 07:08:29 +00:00
Marius Strobl
96b2c26ae1 Add preliminary support for RTL8168H, tested by Sreenath Battalahalli.
MFC after:	1 week
2015-09-13 22:22:30 +00:00
Marius Strobl
100f3d3da6 - Sanity check that the parent ranges given in the "ranges" property
of PCI-EBus-bridges actually match the BARs as specified in and
  required by [1, p. 113 f.]. Doing so earlier would have simplified
  diagnosing a bug in QEMU/OpenBIOS getting the mapping of child
  addresses wrong, which still needs to be fixed there.
  In theory, we could try to change the BARs accordingly if we hit
  this problem. However, at least with real machines changing the
  decoding likely won't work, especially if the PCI-EBus-bridge is
  beneath an APB one. So implementing such functionality generally
  is rather pointless.
- Actually change the allocation type of EBus resources if they
  change from SYS_RES_MEMORY to SYS_RES_IOPORT when mapping them
  to PCI ranges in ebus_alloc_resource() and passing them up to
  bus_activate_resource(9). This may happen with the QEMU/OpenBIOS
  PCI-EBus-bridge but not real ones. Still, this is only cleans up
  the code and the result of resource allocation and activation is
  unchanged.
- Change the remainder of printf(9) to device_printf(9) calls and
  canonicalize their wording.

MFC after:	1 week

Peripheral Component Interconnect Input Output Controller,
Part No.: 802-7837-01, Sun Microelectronics, March 1997 [1]
2015-09-13 21:59:56 +00:00
Alexander Motin
bb978da493 Map CLEAR TASK SET and I_T NEXUS RESET for iSCSI.
The last should not be called without iSCSIProtocolLevel negotiation.
2015-09-13 20:40:00 +00:00
Alexander Motin
4cbc0bc5ae Implement iSCSI TARGET COLD RESET task management function.
Implement it as CTL_TASK_TARGET_RESET plus termination of all sessions.
2015-09-13 20:22:18 +00:00
Adrian Chadd
cf52bbe053 Disable mgmt frame sending in if_rsu.
The firmware in this NIC sends management frames.  So far I'm not sure which
ones it handles and which ones it doesn't handle - but this is what openbsd
does.

The association messages are handled by the firmware; the key negotiation
for 802.1x and WPA are done as raw frames, not management frames.

This successfully allows it to associate to my home networks whereas it didn't
work beforehand.

Tested:

* RTL8712, cut 3, STA mode

TODO:

* The firmware does send a join response with a status code; that should be
  logged in a more obvious way to assist with debugging.  Ie, the firmware
  is the thing that is saying "couldn't join, sorry!", not net80211.
2015-09-13 19:17:26 +00:00
Sean Bruno
a44aa8e030 Update em(4) with D3162 after testing further on hardware that failed
to attach with the last version of this commit. This commit fixes
attach failures on "ICH8" class devices via modifications to
e1000_init_nvm_params_ich8lan()

-   Fix compiler warning in 80003es2lan.c
-   Add return value handler for e1000_*_kmrn_reg_80003es2lan
-   Fix usage of DEBUGOUT
-   Remove unnecessary variable initializations.
-   Removed unused variables (complaints from gcc).
-   Edit defines in 82571.h.
-   Add workaround for igb hw errata.
-   Shared code changes for Skylake/I219 support.
-   Remove unused OBFF and LTR functions.

Tested by some of the folks that reported breakage in previous incarnation.
Thanks to AllanJude, gjb, gnn, tijl for tempting fate with their machines.

Submitted by:	erj@freebsd.org
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D3162
2015-09-13 18:26:05 +00:00
Alexander Motin
6187d4722a Improve read-only support. 2015-09-13 16:49:41 +00:00
George V. Neville-Neil
5d06879adb dd DTrace probe points, translators and a corresponding script
to provide the TCPDEBUG functionality with pure DTrace.

Reviewed by:	rwatson
MFC after:	2 weeks
Sponsored by:	Limelight Networks
Differential Revision:	D3530
2015-09-13 15:50:55 +00:00
Alexander Motin
6b56dd0cfa Reannounce port to HA peer if LUN map changed after online. 2015-09-13 15:31:55 +00:00
Alexander Motin
cfa0987386 Report INQUIRY DATA HAS CHANGED for related LUNs on port on-/offline. 2015-09-13 14:52:31 +00:00
Alexander Motin
eebde34629 Report CTL_UA_LUN_CHANGE on LUN map change. 2015-09-13 14:04:42 +00:00
Alexander Motin
844c2a3a94 Make TARGET RESET respect LUN mapping. 2015-09-13 13:00:20 +00:00
Alexander Motin
0a5c75e53c Add ID for Intel Panther Point KT Controller
Found on ASUS P8Q77-M motherboard.

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2015-09-13 12:08:25 +00:00
Xin LI
b4f6099b9f MFV r287623: 5997 FRU field not set during pool creation and never
updated

ZFS already supports storing the vdev FRU in a vdev property.  There
is code in libzfs to work with this property, and there is code in
the zfs-retire FMA module that looks for that information.  But there
is no code actually setting or updating the FRU.

To address this, ZFS is changed to send a handful of new events
whenever a vdev is added, attached, cleared, or onlined, as well
as when a pool is created or imported.

Note that syseventd is not currently available on FreeBSD and thus
some work is needed to actually support the new ZFS events (e.g. in
zfsd) to actually use this capability, this changeset is mostly a
diff reduction from upstream.

illumos/illumos-gate@1437283407

Illumos issues:

    5997 FRU field not set during pool creation and never updated
    https://www.illumos.org/issues/5997
2015-09-13 07:15:14 +00:00
Xin LI
011ecb128f Note r286552 as merged and reduce diff against upstream. 2015-09-13 06:49:42 +00:00
Adrian Chadd
a934198b02 Add RSSI logging to the event survey results. 2015-09-13 05:22:20 +00:00
Adrian Chadd
9b6916dbed After reading the linux driver, document what this bit is doing
(doing a full NIC awake.)
2015-09-13 04:41:13 +00:00
Adrian Chadd
e6d258f6ac * fiddle with some more of the debugging output
* yes, when a "sta disconnect" message comes through we should, like,
  disconnect things.  We're not currently generating beacon miss messages,
  and net80211 isn't disconnecting things via software beacon miss receive.

Tested:

* RTL8712, cut 3, STA mode
2015-09-13 04:12:51 +00:00
Marius Strobl
1ed1ef30ee Merge r286374 from x86:
Formally pair store_rel(&smp_started) with load_acq(&smp_started).
Similarly to x86, this change is mostly a NOP due to the kernel
being run in total store order.

MFC after:	1 week
2015-09-13 00:08:04 +00:00
Adrian Chadd
4914fa0fd6 if_rsu debug fixes:
* use an ath/iwn style debug bitmap - it's still global rather than per-device,
  but it's better than debug levels
* disable bgscan - it just makes things unstable/unpredictable for now.

Tested:

* if_rsu - RTL8712 cut 3, STA mode
2015-09-12 23:10:34 +00:00
Marius Strobl
9888f86a16 - Factor out the common and generic parts of the sparc64 host-PCI-bridge
drivers into the revived sys/sparc64/pci/ofw_pci.c, previously already
  serving a similar purpose. This has been done with sun4v in mind, which
  explains a) the otherwise not that obvious scheme employed and b) why
  reusing sys/powerpc/ofw/ofw_pci.c was even lesser an option.
- Add a workaround for QEMU once again not emulating real machines, in
  this case by not providing the OFW_PCI_CS_MEM64 range. [1]

Submitted by:	jhb [1]
MFC after:	1 week
2015-09-12 22:49:32 +00:00
Michael Tuexen
30811e70d9 Fix compilation issue introduced in r287717.
Thanks to bz@ for making me aware of it.

MFC after:	1 week
2015-09-12 21:23:24 +00:00
Alexander Motin
84e2fad15a Check for obsolete NUL bin in CSCD descriptor. 2015-09-12 20:45:09 +00:00
Alexander Motin
051481a24e Add HA support for CTL_TASK_I_T_NEXUS_RESET. 2015-09-12 20:06:22 +00:00
Alexander Motin
0a4c638188 Fix false CTL_UA_RES_RELEASE on secondary HA node. 2015-09-12 18:29:05 +00:00
Michael Tuexen
6802b0904f Address a compile warning.
MFC after:	1 week
2015-09-12 18:00:06 +00:00
Alexander Motin
119c9aca64 Decode WRITE ATOMIC(16) command. 2015-09-12 17:53:49 +00:00
Michael Tuexen
86eda749af Cleanup the handling of error causes for ERROR chunks. This fixes
an inconsistency of the padding handling. The final padding is
now considered to be a chunk padding.

MFC after:	1 week
2015-09-12 17:08:51 +00:00
Luiz Otavio O Souza
8fbc5d1840 Do not call mii_mediachg() from NIC interrupt handler.
This fixes the link instability on banana pi (A20).

Suggested by:	yongari
2015-09-12 16:46:41 +00:00
Alexander Motin
a65a997fd9 Improve XCOPY error reporting. 2015-09-12 16:30:01 +00:00
Alexander Motin
238b6b7c75 Report that we have no limit on POPULATE TOKEN segment size. 2015-09-12 14:20:11 +00:00
Alexander Motin
eed0d596cf Correct RTPG bitmask. 2015-09-12 13:53:41 +00:00
Alexander Motin
e184d2576a Some HA polishing. 2015-09-12 12:46:04 +00:00
Alexander Motin
d36c617616 CTL documentation update, mostly for HA. 2015-09-12 10:23:23 +00:00
Xin LI
653809335f MFV r287699: 6214 zpools going south
In r286570 (MFV of r277426) an unprotected write to b_flags to
set the compression mode was introduced.  This would open a race
window where data is partially decompressed, modified, checksummed
and written to the pool, resulting in pool corruption due to the
partial decompression.

Prevent this by reintroducing b_compress

illumos/illumos-gate@d4cd038c92

Illumos issues:

    6214 zpools going south
    https://www.illumos.org/issues/6214
2015-09-12 09:56:23 +00:00
Xin LI
3e691a57db MFV r287684: 6091 avl_add doesn't assert on non-debug builds
Use assfail() from libuutil instead of ASSERT() in userland
AVL avl_add.

illumos/illumos-gate@faa2b6be2f

Illumos issues:

    6091 avl_add doesn't assert on non-debug builds
    https://www.illumos.org/issues/6091
2015-09-12 08:50:43 +00:00
Xin LI
8c4f41ff34 MFV r287624: 5987 zfs prefetch code needs work
Rewrite the ZFS prefetch code to detect only forward, sequential
streams.

The following kstats have been added:

    kstat.zfs.misc.arcstats.sync_wait_for_async

	How many sync reads have waited for async read
	to complete. (less is better)

    kstat.zfs.misc.arcstats.demand_hit_predictive_prefetch

	How many demand read didn't have to wait for I/O
	because of predictive prefetch.  (more is better)

zfetch kstats have been similified to hits, misses, and max_streams,
with max_streams representing times when we were not able to create
new stream because we already have the maximum number of sequences
for a file.

The sysctl variable/loader tunable vfs.zfs.zfetch.block_cap have been
replaced by vfs.zfs.zfetch.max_distance, which controls maximum bytes
to prefetch per stream.

illumos/illumos-gate@cf6106c8a0

Illumos ZFS issues:

    5987 zfs prefetch code needs work
    https://www.illumos.org/issues/5987
2015-09-12 08:35:51 +00:00
Tai-hwa Liang
05081ecd11 Fixing a memory leak on module unloading.
MFC after:	3 weeks
2015-09-11 22:43:35 +00:00
Cy Schubert
43fd750b64 Revert ip_fil_freebsd.c -r287674. This should not have gone in yet. 2015-09-11 16:52:13 +00:00
Cy Schubert
e1d4f0626e Fix ipfilter bug 3600459 NAT bucket count wrong.
Obtained from:	ipfilter cvs repo r1.48.2.25
MFC after:	2 weeks
2015-09-11 16:49:52 +00:00
Andriy Gapon
8f875df090 radeon_suspend_kms: don't mess with pci state that's managed by the bus
The pci bus driver handles the power state, it also manages
configuration state saving and restoring for its child devices.  Thus a
PCI device driver does not have to worry about those things.  In fact, I
observe a hard system hang when trying to suspend a system with active
radeonkms driver where both the bus driver and radeonkms driver try to
do the same thing.  I suspect that it could be because of an access to a
PCI configuration register after the device is placed into D3 state.

Reviewed by:	dumbbell, jhb
MFC after:	13 days
Differential Revision:	https://reviews.freebsd.org/D3561
2015-09-11 15:51:20 +00:00
Alexander Motin
572846e089 Make ctld restart on primary HA node less invasive for secondary. 2015-09-11 14:47:35 +00:00
Alexander Motin
ee4ad294d2 Close races between device close and request processing.
All requests arriving for processing after OFFLINE flag set are rejected
with BUSY status.  Races around OFFLINE flag setting are closed by calling
taskqueue_drain_all().
2015-09-11 14:33:05 +00:00
Michael Tuexen
e629b9fc56 Ensure that ERROR chunks are always padded by implementing this
in the routine, which queues an ERROR chunk, instead on relyinh
on the callers to do so. Since one caller missed this, this actially
fixes a bug.

MFC after:	1 week
2015-09-11 13:54:33 +00:00
Alexander Motin
3236151ea8 Reference/release devices on every I/O, rather on open/close.
While this may be slower, it allows device destruction to complete,
rather then block waiting for indefinitely long time.
2015-09-11 12:50:52 +00:00
Alexander Motin
5b363c09dc Add support for PPP-Max-Payload PPPoE tag (RFC4638).
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2015-09-11 09:15:27 +00:00
Cy Schubert
4d54c313b2 Revert $FreeBSD$. 2015-09-11 08:48:16 +00:00
Cy Schubert
7671e3b5b6 Fix mutex errors.
Obtained from:	NetBSD r1.4.
MFC after:	1 week
2015-09-11 08:35:53 +00:00
Cy Schubert
d7b78c26dc Fixup typos in comments.
Obtained from:	NetBSD r1.4.
MFC after:	1 week
2015-09-11 08:27:32 +00:00
Warner Losh
7297c5e535 bufdonebio is now unused. Retire it too. 2015-09-11 04:20:04 +00:00
Mark Johnston
610141cebb Add stack_save_td_running(), a function to trace the kernel stack of a
running thread.

It is currently implemented only on amd64 and i386; on these
architectures, it is implemented by raising an NMI on the CPU on which
the target thread is currently running. Unlike stack_save_td(), it may
fail, for example if the thread is running in user mode.

This change also modifies the kern.proc.kstack sysctl to use this function,
so that stacks of running threads are shown in the output of "procstat -kk".
This is handy for debugging threads that are stuck in a busy loop.

Reviewed by:	bdrewery, jhb, kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3256
2015-09-11 03:54:37 +00:00
Mark Johnston
1e954a7c63 Remove the arg0 field from struct amd64_frame. Its existence was a bug,
since on amd64 the first argument to a function is generally not on the
stack.

Revert an old DTrace bug fix to some code that assumed that
sizeof(struct amd64_frame) == 16.

Reviewed by:	jhb, kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3255
2015-09-11 03:31:22 +00:00
Mark Johnston
4db79feb8f Merge stack(9) implementations for i386 and amd64 under x86/.
Reviewed by:	jhb, kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3255
2015-09-11 03:24:07 +00:00
Mark Johnston
e8baaa998c MFV r283513:
5930 fasttrap_pid_enable() panics when prfind() fails in forking process
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>

illumos/illumos-gate@9df7e4e12e
2015-09-11 03:06:34 +00:00
Mark Johnston
2275da185c MFV r283512:
3599 dtrace_dynvar tail calls can blow stack
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>

illumos/illumos-gate@d47448f09a
2015-09-11 03:04:24 +00:00
Mark Johnston
d73ce4c698 Remove the v_cache_min and v_cache_max sysctls. They are unused and have
no effect.

Reviewed by:	alc
Sponsored by:	EMC / Isilon Storage Division
2015-09-11 03:00:20 +00:00
Warner Losh
ad8d57a99d dev_strategy and dev_strategy_csw are unused since r281825. Remove
them.

Differential Revision: https://reviews.freebsd.org/D3620
2015-09-11 00:38:58 +00:00
John Baldwin
8fb15ddb00 Add a comment that to clarify how to determine the amount of received DDP
data.

Reviewed by:	np
Differential Revision:	https://reviews.freebsd.org/D3619
2015-09-10 21:41:11 +00:00
Konstantin Belousov
1fa6712471 Do not hold the process around the vm_fault() call from the trap()s.
The only operation which is prevented by the hold is the kernel stack
swapout for the faulted thread, which should be fine to allow.

Remove useless checks for NULL curproc or curproc->p_vmspace from the
trap_pfault() wrappers on x86 and powerpc.

Reviewed by:	alc (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-09-10 17:46:48 +00:00
Alexander Motin
7ac58230ea Reimplement CTL High Availability.
CTL HA functionality was originally implemented by Copan many years ago,
but large part of the sources was never published.  This change includes
clean room implementation of the missing code and fixes for many bugs.

This code supports dual-node HA with ALUA in four modes:
 - Active/Unavailable without interlink between nodes;
 - Active/Standby with second node handling only basic LUN discovery and
reservation, synchronizing with the first node through the interlink;
 - Active/Active with both nodes processing commands and accessing the
backing storage, synchronizing with the first node through the interlink;
 - Active/Active with second node working as proxy, transfering all
commands to the first node for execution through the interlink.

Unlike original Copan's implementation, depending on specific hardware,
this code uses simple custom TCP-based protocol for interlink.  It has
no authentication, so it should never be enabled on public interfaces.

The code may still need some polishing, but generally it is functional.

Relnotes:	yes
Sponsored by:	iXsystems, Inc.
2015-09-10 12:40:31 +00:00
Alexander Motin
fb606ebabc Remove unused target and initiator IDs. 2015-09-10 10:46:21 +00:00
Alexander Motin
3f326305fc Disable CTL_IO_DELAY feature.
It is too developer-oriented to be enabled by default.
2015-09-10 09:27:22 +00:00
Hiroki Sato
120ff2d73d Remove SIOCGDRLST_IN6 and SIOCGPRLST_IN6 forgotten in the previous commit.
MFC after:	3 days
2015-09-10 08:37:03 +00:00
Hans Petter Selasky
8c626ca5dc Update USB quirk.
MFC after:	1 month
PR:		202968
2015-09-10 07:36:54 +00:00
Hiroki Sato
e3884653f6 - Remove SIOCGDRLST_IN6 and SIOCGPRLST_IN6. These are quite old APIs and
there is no consumer now.

MFC after:	3 days
2015-09-10 06:31:24 +00:00
Hiroki Sato
d0bec2c522 - Remove SIOCGDRLST_IN6 and SIOCGPRLST_IN6. These are quite old APIs and
there is no consumer now.

- Simplify first and duplicate LLA check.

MFC after:	3 days
2015-09-10 06:29:18 +00:00
Hiroki Sato
1fce58fc62 Do not add IN6_IFF_TENTATIVE when ND6_IFF_NO_DAD.
MFC after:	3 days
2015-09-10 06:10:30 +00:00
Hiroki Sato
3ba7e4ce9c Remove IN6_IFF_NOPFX. This flag was no longer used.
MFC after:	3 days
2015-09-10 06:08:42 +00:00
Hiroki Sato
b1c250ff3f - Remove GIF_{SEND,ACCEPT}_REVETHIP.
- Simplify EADDRNOTAVAIL and EAFNOSUPPORT conditions.

MFC after:	3 days
2015-09-10 05:59:39 +00:00
Adrian Chadd
32766cd281 Also make kern.maxfilesperproc a boot time tunable.
Auto-tuning threshold discussions aside, it turns out that if you want
to lower this on say, rather memory-packed machines, you either set maxusers
or kern.maxfiles, or you set it in sysctl.  The former is a non-exact
way to tune this; the latter doesn't actually affect anything in the
startup scripts.

This first occured because I wondered why the hell screen would take upwards
of 10 seconds to spawn a new screen.  I then found python doing the same
thing during fork/exec of child processes - it calls close() on each FD
up to the current openfiles limit.  On a 1TB machine this is like, 26 million
FDs per process.  Ugh.

So:

* This allows it to be set early in /boot/loader.conf;
* It can be used to work around the ridiculous situation of
  screen, python, etc doing a close() on potentially millions of FDs
  even though you only have four open.

Tested:

* 4GB, 32GB, 64GB, 128GB, 384GB, 1TB systems with autotune, ensuring
  screen and python forking doesn't result in some pretty hilariously
  bad behaviour.

TODO:

* Note that the default login.conf sets openfiles-cur to unlimited,
  effectively obeying kern.maxfilesperproc.  Perhaps we should fix
  this.

* .. and even if we do, we need to also ensure that daemons get
  a soft limit of something reasonable and capped - they can request
  more FDs themselves.

MFC after:	1 week
Sponsored by:	Norse Corp, Inc.
2015-09-10 04:05:58 +00:00
Konstantin Belousov
9e18c9eb27 For open("name", O_DIRECTORY | O_CREAT), do not try to create the
named node, open(2) cannot create directories.  But do allow the flag
combination to succeed if the directory already exists.

Declare the open("name", O_DIRECTORY | O_CREAT | O_EXCL) always
invalid for the same reason, since open(2) cannot create directory.

Note that there is an argument that O_DIRECTORY | O_CREAT should be
invalid always, regardless of the target directory existence or
O_EXCL.  The current fix is conservative and allows the call to
succeed in the situation where it succeeded before the patch.

Reported by:	Tom Ridge <freebsd@tom-ridge.com>
Reviewed by:	rwatson
PR:	 202892
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-09-09 19:31:08 +00:00
Andrew Turner
8fe99e427f Rework copyinstr to:
* Fail when the length passed in is 0
 * Remove an unneeded increment of the count on success
 * Return ENAMETOOLONG when the input pointer is too long

Sponsored by:	ABT Systems Ltd
2015-09-09 11:51:14 +00:00
Hans Petter Selasky
b28014dd0b Add new USB ID.
MFC after:	1 month
PR:		202968
2015-09-09 07:04:00 +00:00
Konstantin Belousov
b8db977617 Remove a check which caused spurious SIGSEGV on usermode access to the
mapped address without valid pte installed, when parallel wiring of
the entry happen.  The entry must be copy on write.  If entry is COW
but was already copied, and parallel wiring set
MAP_ENTRY_IN_TRANSITION, vm_fault() would sleep waiting for the
MAP_ENTRY_IN_TRANSITION flag to clear.  After that, the fault handler
is restarted and vm_map_lookup() or vm_map_lookup_locked() trip over
the check.  Note that this is race, if the address is accessed after
the wiring is done, the entry does not fault at all.

There is no reason in the current kernel to disallow write access to
the COW wired entry if the entry permissions allow it.  Initially this
was done in r24666, since that kernel did not supported proper
copy-on-write for wired text, which was fixed in r199869.  The r251901
revision re-introduced the r24666 fix for the current VM.

Note that write access must clear MAP_ENTRY_NEEDS_COPY entry flag by
performing COW.  In reverse, when MAP_ENTRY_NEEDS_COPY is set in
vmspace_fork(), the MAP_ENTRY_USER_WIRED flag is cleared.  Put the
assert stating the invariant, instead of returning the error.

Reported and debugging help by:	peter
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-09-09 06:19:33 +00:00
Justin Hibbits
dbaeb0610b Add PVR identifier for E6500, from the reference. 2015-09-09 03:15:25 +00:00
Kevin Lo
b904ffbde5 Correct setting R92C_TDECTRL_BLK_DESC_NUM_M bit. 2015-09-09 01:51:38 +00:00
Renato Botelho
22a5bb4c2a Remove duplicate entry for Sierra Wireless Aircard 875
Approved by:	loos
MFC after:	3 days
Sponsored by:	Rubicon Communications (Netgate)
2015-09-08 20:07:32 +00:00
Renato Botelho
5effc557d5 - Fix Sierra MC7354 ID from a bad copy/paste, correct ID is 68C0
Approved by:	loos
Obtained from:	pfSense
MFC after:	3 days
Sponsored by:	Rubicon Communications (Netgate)
2015-09-08 19:57:02 +00:00
Jean-Sébastien Pédron
7bead7ac28 drm/ttm: Drain taskqueue if taskqueue_cancel_timeout() returned an error
Before, this was done if `pending` was true. This is not what the
manpage suggests and not what was done elsewhere in the same file.
2015-09-08 19:41:19 +00:00
Andrew Turner
384dd3be15 Add support for pmap_mincore on arm64 by walking the page tables to find
the details for the requested address.

PR:		202307
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-09-08 18:41:06 +00:00
Warner Losh
9e3e3fe5b3 The swap pager is compatible with direct dispatch. It does its own
locking and doesn't sleep. Flag the consumer we create as such. In
addition, decrement the in flight index when we have an out of memory
error after having incremented it previously. This would have
prevented swapoff from working if the swap pager ever hit a resource
shortage trying to swap out something (the swap in path always waits
for a bio, so won't have this issue). Simplify the close logic by
abandoning the use of private and initializing the index to 1 and
dropping that reference when we previously set private.

Also, set sw_id only while sw_dev_mtx is held. This should only affect
swapping to a vnode, as opposed to a geom whose close always sets it to
NULL with sw_dev_mtx held.

Differential Review: https://reviews.freebsd.org/D3547
2015-09-08 17:47:56 +00:00
Andrew Turner
d5ad1d0d6d Allow us to set the console device tree node. This is needed as not all
vendor supplied device trees contain the needed properties for us to select
the correct uart to use as the kernel console.

An example of this would be to add the following to loader.conf.
hw.fdt.console="/smb/uart@f7113000"

The intention of this is slightly different than the existing
hw.uart.console option. The new option will mean the boot serial
configuration will be derived from the device node, while the existing
option expects the user to configure all this themselves.

Further work is planned to allow the uart configuration to be set based on
the stdout-path property devicetree bindings.

Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D3559
2015-09-08 16:06:04 +00:00
Jim Harris
854c31980e isci: check return value of pci_alloc_msix()
Certain VM guest types (VMware, Xen) do not support MSI, so pci_alloc_msix()
always fails.  isci(4) was not properly detecting the allocation failure,
and would try to proceed with MSIx resource initialization rather than
reverting to INTx.

Reported and tested by: Bradley W. Dutton (brad-fbsd-stable@duttonbros.com)
MFC after:	3 days
Sponsored by:	Intel
2015-09-08 16:05:18 +00:00
Jim Harris
c16120409b isci: explicitly enable/disable PCI busmaster
BIOS always enables PCI busmaster on the isci device, which effectively
worked around this omission.  But when passing the isci device through
to a guest VM, the hypervisor will disable busmaster and isci will not
work without calling pci_enable_busmaster().

MFC after:	3 days
Sponsored by:	Intel
2015-09-08 15:59:55 +00:00
Enji Cooper
e945651a90 Revert r286984 (adding opt_random.h to sys/modules/zfs/Makefile)
opt_random.h is no longer needed/referenced in the kernel build

X-MFC with: r287558
2015-09-08 08:54:40 +00:00
Enji Cooper
7afd9bf059 Remove opt_random.h header pollution from sys/random.h by moving
RANDOM_LOADABLE and RANDOM_YARROW's definitions from opt_random.h to
opt_global.h

This unbreaks `make depend` in sys/modules with multiple drivers (tmpfs, etc)
after r286839

X-MFC with: r286839
Reviewed by: imp
Submitted by: lwhsu
Differential Revision: D3486
2015-09-08 08:50:28 +00:00
Kevin Lo
599acbbcd8 Enable TSF timer in monitor mode.
Tested on RT5370, sta mode.
Submitted by:	Andriy Voskoboinyk <s3erios at gmail com>
Differential Revision:	https://reviews.freebsd.org/D3591
2015-09-08 08:06:20 +00:00
Kevin Lo
ef9c07684c Add TSF field into TX/RX radiotap headers
Tested on RT5370, sta mode.
Submitted by:	Andriy Voskoboinyk <s3erios at gmail com>
Differential Revision:	https://reviews.freebsd.org/D3590
2015-09-08 08:02:14 +00:00
Kevin Lo
3257f9021a Fix comparison in run_key_set_cb().
Tested on RT5370, sta mode.

Submitted by:	Andriy Voskoboinyk <s3erios at gmail com>
Differential Revision:	https://reviews.freebsd.org/D3589
2015-09-08 07:53:10 +00:00
Kevin Lo
de7eb46ed4 - Remove empty key_update_* functions.
- Hide "struct ieee80211_node *" -> "struct run_node *" casting behind
  RUN_NODE() macro.
- Simplify IEEE80211_HAS_ADDR4 macro definition
- Fix a comment (desn't -> doesn't)

Submitted by:	Andriy Voskoboinyk <s3erios at gmail com>
Differential Revision:	https://reviews.freebsd.org/D3588
2015-09-08 07:50:35 +00:00
Alan Cox
27a9fb2fc2 To simplify upcoming changes to the inactive queue scan, change the code
so that there is only one place where pages are freed and only one place
where pages are moved to the tail of the queue.

Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
2015-09-08 04:18:57 +00:00
Adrian Chadd
15b1492c9b Don't call enable_all_rings if the adapter has been freed.
This is a subtle use-after-free race that results in some very undesirable
hang behaviour.

Reviewed by:	pkelsey
Obtained from:	Kip Macy, NextBSD (91a9bd1dbb)
2015-09-07 23:16:39 +00:00
Luiz Otavio O Souza
c80b6ca937 Fix off-by-one bugs.
While here, only set the GPIO pin state for output pins.

Pointy hat to:	loos
Sponsored by:	Rubicon Communications (Netgate)
2015-09-07 21:59:11 +00:00
Mateusz Guzik
9af8c8b72b fd: make rights a mandatory argument to fgetvp_rights
The only caller already always passes rights.
2015-09-07 20:05:56 +00:00
Mateusz Guzik
d7832811a7 fd: make the common case in filecaps_copy work lockless
The filedesc lock is only needed if ioctls caps are present, which is a
rare situation. This is a step towards reducing the scope of the filedesc
lock.
2015-09-07 20:02:56 +00:00
Marcel Moolenaar
40ea8e710e As expected, things aren't as simple as hoped. Consequently, we have
no option but to use the smbios information to fill in the blanks.
It's a good thing UGA is a protocol of the past and GOP has all the
info we need.

Anyway, the logic has been tweaked a little to get the easier bits
of information up front. This includes the resolution and the frame
buffer address. Then we look at the smbios information and define
expected values as well as the missing bits (frame buffer offset and
stride). If the values obtained match the expect values, we fill in
the blanks and return. Otherwise we use the existing detection logic
to figure it out.

Rename the environment variables from uga_framebuffer abd uga_stride
to hw.efifb.address and hw.efifb.stride. The latter names are more
in line with other variable names.

We currently have hardcoded settings for:
1.  Mid-2007 iMac (iMac7,1)
2.  Late-2007 MacBook (MacBook3,1)
2015-09-07 17:56:49 +00:00
Conrad Meyer
bcb60d52e6 Follow-up to r287442: Move sysctl to compiled-once file
Avoid duplicate sysctl nodes.

Found by:	tijl
Approved by:	markj (mentor)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3586
2015-09-07 16:44:28 +00:00
Andrew Turner
0a21ab2c4b Use load-acquire semantics while waiting for td_lock to be released. The
store should have release semantics and will have due to the dsb above it
so add a comment to explain this. [1]

While here update the code to not reload the current thread, it's already
in a register, we just need to not trash it.

Suggested by:	kib [1]
Sponsored by:	ABT Systems Ltd
2015-09-07 14:01:18 +00:00
Michael Tuexen
0941640f34 RFC 4960 requires that packets containing an INIT chunk bundled with
another chunk are silently discarded. Do so, instead of sending an
ABORT.

MFC after:	1 week
2015-09-07 14:00:38 +00:00
Andrew Turner
f452c30169 When dropping to EL1 ensure we have written to all special registers by
moving the instruction barrier to just before we drop exception level.

Sponsored by:	ABT Systems Ltd
2015-09-07 10:13:14 +00:00
Allan Jude
32d321fa4a missed file that should have been included in r287528
PR:		184110
Submitted by:	Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Approved by:	wblock (mentor)
2015-09-07 02:00:05 +00:00
Adrian Chadd
68bb8d6249 Add support for receiving flowtype, flowid and RSS bucket information as part of recvmsg().
Submitted by:	Tiwei Bie <btw@mail.ustc.edu.cn>
Differential Revision:	https://reviews.freebsd.org/D3562
2015-09-06 20:57:57 +00:00
Adrian Chadd
499baf0aa7 Replace rss_m2cpuid with rss_soft_m2cpuid_v4 for ip_direct_nh.nh_m2cpuid,
because the RSS hash may need to be recalculated.

Submitted by:	Tiwei Bie <btw@mail.ustc.edu.cn>
Differential Revision:	https://reviews.freebsd.org/D3564
2015-09-06 20:20:48 +00:00
Alexander Motin
a3977bea20 Allow LUN options modification via CTL_LUNREQ_MODIFY.
Not all changes take effect, but that is a different question.
2015-09-06 11:23:01 +00:00
Alexander Motin
0bcd4ab6ba Move setting of media parameters inside open routines.
This is preparation for possibility to open/close media several times
per LUN life cycle.  While there, rename variables to reduce confusion.
As additional bonus this allows to open read-only media, such as ZFS
snapshots.
2015-09-06 09:54:56 +00:00
Kirk McKusick
17518b1a2b Track changes to kern.maxvnodes and appropriately increase or decrease
the size of the name cache hash table (mapping file names to vnodes)
and the vnode hash table (mapping mount point and inode number to vnode).
An appropriate locking strategy is the key to changing hash table sizes
while they are in active use.

Reviewed by: kib
Tested by:   Peter Holm
Differential Revision: https://reviews.freebsd.org/D2265
MFC after:   2 weeks
2015-09-06 05:50:51 +00:00
Baptiste Daroussin
dc6c827749 Reduce diff with linux 3.8.13 on i915 headers 2015-09-05 23:22:59 +00:00
Sean Bruno
c597a0199e Revert last two commits to em(4)/igb(4). Reports are coming in that
this breaks initialization and reads from EEPROM on boot/driver load.

r287469 is being reverted as a dependancy on r287467
2015-09-05 21:12:19 +00:00
Marcel Moolenaar
1f8577e633 Auto-detect the UGA frame buffer and stride on a MacBook. We're
striking a delicate balance between exhaustive searching and
banking on assumptions. The environment variables can be used
as a fall-back anyway. With this change, all known and tested
Macs with only UGA should have a working console out of the
box... for now...
2015-09-05 18:24:51 +00:00
Alan Cox
960810ccea Eliminate pointless requeueing of pages from terminated objects. These
pages will have left the inactive queue before the page daemon performs
its next scan.  Also, ignore references to pages from terminated objects.
This allows the clean pages to be freed a little sooner.

Move some comments to their proper place, i.e., next to the code that
they describe, and update other nearby comments.

Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
2015-09-05 17:34:49 +00:00
Andrew Turner
2dae850b5e Add ddb show commands to print the special registers and to ask the
hardware to perform address translation for us. These are useful to help
track down what caused us to enter the debugger.

Sponsored by:	ABT Systems Ltd
2015-09-05 17:29:07 +00:00
Alexander V. Chernikov
26deb8826c Do not pass lle to nd6_ns_output(). Use newly-added
nd6_llinfo_get_holdsrc() to extract desired IPv6 source
  from holdchain and pass it to the nd6_ns_output().
2015-09-05 14:14:03 +00:00
Konstantin Belousov
7a82f35c9d Do not consume extra reference. This is a bug in r287479.
Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-09-05 12:28:18 +00:00
Gleb Smirnoff
388909a12a Use Jenkins hash for TCP syncache.
o Unlike xor, in Jenkins hash every bit of input affects virtually
  every bit of output, thus salting the hash actually works. With
  xor salting only provides a false sense of security, since if
  hash(x) collides with hash(y), then of course, hash(x) ^ salt
  would also collide with hash(y) ^ salt. [1]
o Jenkins provides much better distribution than xor, very close to
  ideal.

TCP connection setup/teardown benchmark has shown a 10% increase
with default hash size, and with bigger hashes that still provide
possibility for collisions. With enormous hash size, when dataset is
by an order of magnitude smaller than hash size, the benchmark has
shown 4% decrease in performance decrease, which is expected and
acceptable.

Noticed by:	Jeffrey Knockel <jeffk cs.unm.edu> [1]
Benchmarks by:	jch
Reviewed by:	jch, pkelsey, delphij
Security:	strengthens protection against hash collision DoS
Sponsored by:	Nginx, Inc.
2015-09-05 10:15:19 +00:00
Konstantin Belousov
c65f759837 Declare the writes around the call to VFS_SYNC() in
softdep_ast_cleanup_proc().

Tested by:	pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-09-05 08:48:24 +00:00
Alexander V. Chernikov
deeedaa549 Do not skip entries without LLE_VALID flag.
This one fixes showing incomplete entries in ndp -an.

MFC after:	2 weeks
2015-09-05 06:24:00 +00:00
Alexander V. Chernikov
91bfd68e38 Make in6ifa_ifpwithaddr() take const param.
Remove unneded DECONST from in6_lltable_rtcheck().
2015-09-05 05:54:09 +00:00
Alexander V. Chernikov
441f9243df Constantify lookup key in ifa_ifwith* functions.
Some places in our network stack already have const
arguments (like if_output() routines and LLE functions).

Code using ifa_ifwith (and similar functins) along with
LLE/_output functions is currently bound to use tricks
like __DECONST(). Provide a cleaner way by making sockaddr
lookup key really constant.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D3464
2015-09-05 05:33:20 +00:00
Marcel Moolenaar
39993974aa My MacBook has UGA only, but we fail to detect any changes
in the frame buffer when we flip pixels. Allow the detection
to be bypassed by setting the uga_framebuffer and uga_stride
variables. The kernel console works fine even when we can't
detect pixel changes in the frame buffer, which indicates
that the problem could be with reading from the frame buffer
and not writing to it.
2015-09-05 03:27:23 +00:00
Sean Bruno
27b134f016 Remove rge driver from Broadcom XLR
nlge(4) is supposed to deprecate rge(4) for Broadcom XLR when it was
introduced 5 years ago.

rge doesn't build on -CURRENT due to MII changes. All the XLR kernel confs
use nlge. Let's get rid of the old driver for FreeBSD 11. We can use
10-STABLE or SVN to go back and look at the old driver if needed.

Differential Revision:	https://reviews.freebsd.org/D3339
Submitted by:	kevin.bowling@kev009.com
2015-09-04 19:57:28 +00:00
Sean Bruno
d751decc98 Add more BCM gigabit PHYs
Gleaned from a public header file. 5402 and 5404 look like they may be
used on embedded devices. 5478 and 5488 are switch PHYs. 5754 change is just
to note a product alias.

Differential Revision:	https://reviews.freebsd.org/D3338
Submitted by:	kevin.bowling@kev009.com
2015-09-04 17:48:19 +00:00
Sean Bruno
98ae230f07 em(4): Add Skylake/I219 support.
- driver rev 7.5.2
- use new functions em_flush* for i219 devices

Differential Revision:	https://reviews.freebsd.org/D3163
Submitted by:	erj jfv
Reviewed by:	jfv
MFC after:	1 month
Relnotes:	Yes
Sponsored by:	Intel Corporation
2015-09-04 17:21:55 +00:00
Sean Bruno
67ebffd348 e1000: Shared code updates
-    Fix compiler warning in 80003es2lan.c
-    Add return value handler for e1000_*_kmrn_reg_80003es2lan
-    Fix usage of DEBUGOUT
-    Remove unnecessary variable initializations.
-    Removed unused variables (complaints from gcc).
-    Edit defines in 82571.h.
-    Add workaround for igb hw errata.
-    Shared code changes for Skylake/I219 support.
-    Remove unused OBFF and LTR functions.

Differential Revision:	https://reviews.freebsd.org/D3162
Submitted by:	erj
MFC after:	1 month
Sponsored by:	Intel Corporation
2015-09-04 16:30:48 +00:00
Sean Bruno
02415af2ee igb(4): Update and fix HW errata
- HW errata workaround for IPv6 offload w/ extension headers
- Edited start of if_igb.c (Device IDs / #includes) to match ixgbe/ixl

Differential Revision:	https://reviews.freebsd.org/D3165
Submitted by:	erj
MFC after:	1 month
Sponsored by:	Intel Corporation
2015-09-04 16:07:27 +00:00
Gleb Smirnoff
24067db8ca Make tcp_mtudisc() static and void. No functional changes.
Sponsored by:	Nginx, Inc.
2015-09-04 12:02:12 +00:00
Michael Tuexen
6fb9db98b3 Don't leak memory in an error case.
MFC after:	1 week
2015-09-04 09:24:07 +00:00
Michael Tuexen
59713bbf27 Add a NULL pointer check to silence the clang code analyzer.
MFC after:	1 week
2015-09-04 09:22:16 +00:00
Alexander Motin
bd236ba5c0 Remove some dead code. 2015-09-04 09:19:01 +00:00
Xin LI
28ffe927c2 Expose an interface to determine if an ACE is inherited.
Submitted by:	sef
Reviewed by:	trasz
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D3540
2015-09-04 00:14:20 +00:00
Michael Tuexen
aa1cfca969 Fix a bug where two SHUTDOWN_ACK chunks were sent if a SHUTDOWN chunk was
received acking all outstanding data.
2015-09-03 22:15:56 +00:00
Conrad Meyer
14bdbaf2e4 Detect badly behaved coredump note helpers
Coredump notes depend on being able to invoke dump routines twice; once
in a dry-run mode to get the size of the note, and another to actually
emit the note to the corefile.

When a note helper emits a different length section the second time
around than the length it requested the first time, the kernel produces
a corrupt coredump.

NT_PROCSTAT_FILES output length, when packing kinfo structs, is tied to
the length of filenames corresponding to vnodes in the process' fd table
via vn_fullpath.  As vnodes may move around during dump, this is racy.

So:

 - Detect badly behaved notes in putnote() and pad underfilled notes.

 - Add a fail point, debug.fail_point.fill_kinfo_vnode__random_path to
   exercise the NT_PROCSTAT_FILES corruption.  It simply picks random
   lengths to expand or truncate paths to in fo_fill_kinfo_vnode().

 - Add a sysctl, kern.coredump_pack_fileinfo, to allow users to
   disable kinfo packing for PROCSTAT_FILES notes.  This should avoid
   both FILES note corruption and truncation, even if filenames change,
   at the cost of about 1 kiB in padding bloat per open fd.  Document
   the new sysctl in core.5.

 - Fix note_procstat_files to self-limit in the 2nd pass.  Since
   sometimes this will result in a short write, pad up to our advertised
   size.  This addresses note corruption, at the risk of sometimes
   truncating the last several fd info entries.

 - Fix NT_PROCSTAT_FILES consumers libutil and libprocstat to grok the
   zero padding.

With suggestions from:	bjk, jhb, kib, wblock
Approved by:	markj (mentor)
Relnotes:	yes
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3548
2015-09-03 20:32:10 +00:00
John Baldwin
188458ea7c Currently the Linux character device mmap handling only supports mmap
operations that map a single page that has an associated vm_page_t.
This does not permit mapping larger regions (such as a PCI memory
BAR) and it does not permit mapping addresses beyond the top of RAM
(such as a 64-bit BAR located above the top of RAM).

Instead of using a single OBJT_DEVICE object and passing the physaddr via
the offset as a hack, create a new sglist and OBJT_SG object for each
mmap request. The requested memory attribute is applied to the object
thus affecting all pages mapped by the request.

Reviewed by:	hselasky, np
MFC after:	1 week
Sponsored by:	Chelsio
Differential Revision:	https://reviews.freebsd.org/D3386
2015-09-03 18:27:39 +00:00
Sean Bruno
e6aa141248 r249170 was just plain wrong. The effect of the change is to always
delete a logic volume on status change which is NOT what we want here.

The original code is correct in that when the volume changes status
the driver will only delete the volume if the status is one of the
fatal errors.  A drive failure in a mirrored volume is NOT a situtation
where the volume should dissapear.

Reported on freebsd-scsi@:
https://lists.freebsd.org/pipermail/freebsd-scsi/2015-September/006800.html

MFC after:	3 days
2015-09-03 17:46:57 +00:00
Alexander Motin
420abfcecd Small UA cleanup. 2015-09-03 12:56:57 +00:00
Alexander Motin
8be6a2df51 Fix copy-paste bug introduced in r275458.
MFC after:	3 days
2015-09-03 12:15:14 +00:00
Marcelo Araujo
804fc8c859 Lower the compiler warning: unused-but-set-variable.
Approved by:		bapt (mentor)
Differential Revision:	D3556
2015-09-03 06:53:17 +00:00
Marcel Moolenaar
504ca52575 For UGA, the frame buffer address obtained by scanning the
PCI BARs does not necessarily correspond to the upper-left
most pixel. Scan the frame buffer for which byte changed
when changing the pixel at (0,0).

Use the same technique to determine the stride. Except for
changing the pixel at (0,0), we change the pixel at (0,1).

PR:		202730
Tested by:	hartzell (at) alerce.com
2015-09-03 04:35:17 +00:00
Oleksandr Tymoshenko
1aca4f8fb4 Enable both i2c1 and i2c2. These devices are disabled in TI's DTS
so they were disabled during DTS transition. Though there are
no standard devices/drivers on them people might use iic(4) userland
interface to access these buses.
2015-09-03 02:28:18 +00:00
Justin Hibbits
2109efd169 pmap_mapdev_attr() also takes a vm_paddr_t.
This was missed in r235936.  With recent work for 36-bit paddr, this is now
needed.
2015-09-03 01:38:15 +00:00
Mateusz Guzik
7e8f566c0c fd: remove UMA_ZONE_ZINIT argument from Files zone
Originally it was added in order to prevent trashing of objects with
INVARIANTS enabled. The same effect is now provided with mere UMA_ZONE_NOFREE.

This reverts r286921.

Discussed with:		kib
2015-09-02 23:14:39 +00:00
Mateusz Guzik
19c591bfe2 Don't trash memory from UMA_ZONE_NOFREE zones.
Objects obtained from such zones are supposed to retain type stability,
which was violated by aforementioned trashing.

This is a follow-up to r284861.

Discussed with:		kib
2015-09-02 23:09:01 +00:00
Conrad Meyer
0d1a05d9e6 ioat(4): pci_save/restore_state to persist MSI-X registers over BDXDE reset
Also for BWD devices, per jimharris@.

Reviewed by:	jhb
Approved by:	markj (mentor)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3552
2015-09-02 22:48:41 +00:00
Warner Losh
3f2e5b8584 After the introduction of direct dispatch, the pacing code in g_down()
broke in two ways. One, the pacing variable was accessed in multiple
threads in an unsafe way. Two, since large numbers of I/O could come
down from the buf layer at one time, large numbers of allocation
failures could happen all at once, resulting in a huge pace value that
would limit I/Os to 10 IOPS for minutes (or even hours) at a
time. While a real solution to these problems requires substantial
work (to go to a no-allocation after the first model, or to have some
way to wait for more memory with some kind of reserve for pager and
swapper requests), it is relatively easy to make this simplistic
pacing less pathological.

Move to using a volatile variable with loads and stores. While this is
a little racy, losing the race is safe: either you get memory and
proceed, or you don't and queue. Second, sleep for 1ms (or one tick, whichever
is larger) instead of 100ms. This removes the artificial 10 IOPS limit
while still easing up on new I/Os during memory shortages. Remove
tying the amount of time we do this to the number of failed requests
and do it only as long as we keep failing requests.

Finally, to avoid needless recursion when memory is tight (start ->
g_io_deliver() -> g_io_request() -> start -> ... until we use 1/2 the
stack), don't do direct dispatch while pacing. This should be a rare
event (not steady state) so the performance hit here is worth the
extra safety of not starving g_down() with directly dispatched I/O.

Differential Review: https://reviews.freebsd.org/D3546
2015-09-02 17:29:30 +00:00
Conrad Meyer
4253ea5083 ioat: re-initialize interrupts after resetting hw on BDXDE
Resetting some generations of the I/OAT hardware (just BDXDE for now)
resets the corresponding MSI-X registers.  So, teardown and
re-initialize interrupts after resetting the hardware.

Reviewed by:	jimharris
Approved by:	markj (mentor)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3549
2015-09-02 16:48:03 +00:00
Hiroki Sato
18e199ad72 Fix a panic which was reproducible by an infinite loop of
"ifconfig epair0 create && ifconfig epair0a destroy".

This was caused by an uninitialized function pointer in
softc->media.
2015-09-02 16:30:45 +00:00
Gleb Smirnoff
b0f99291de Remove the software queue, which is a remnant of ifnet ifqueue.
Reviewed by:	adrian
Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2015-09-02 15:23:51 +00:00
Edward Tomasz Napierala
089d32934a Fixes a panic triggered by threaded Linux applications when running
with RACCT/RCTL enabled.

Reviewed by:	ngie@, ed@
Tested by:	Larry Rosenman <ler@lerctr.org>
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3470
2015-09-02 14:04:13 +00:00
John Baldwin
ded3e7f08e The 'sa' argument to syscallret() is not unused. 2015-09-01 22:28:23 +00:00
John Baldwin
183b68f74f Export current system call code and argument count for system call entry
and exit events. procfs stop events for system call tracing report these
values (argument count for system call entry and code for system call exit),
but ptrace() does not provide this information. (Note that while the system
call code can be determined in an ABI-specific manner during system call
entry, it is not generally available during system call exit.)

The values are exported via new fields at the end of struct ptrace_lwpinfo
available via PT_LWPINFO.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3536
2015-09-01 22:24:54 +00:00
Kristof Provost
2f6c345adf pf: Fix misdetection of forwarding when net.link.bridge.pfil_bridge is set
If net.link.bridge.pfil_bridge is set we can end up thinking we're forwarding in
pf_test6() because the rcvif and the ifp (output interface) are different.
In that case we're bridging though, and the rcvif the the bridge member on which
the packet was received and ifp is the bridge itself.
If we'd set dir to PF_FWD we'd end up calling ip6_forward() which is incorrect.

Instead check if the rcvif is a member of the ifp bridge. (In other words, the
if_bridge is the ifp's softc). If that's the case we're not forwarding but
bridging.

PR:	202351
Reviewed by:	eri
Differential Revision:	https://reviews.freebsd.org/D3534
2015-09-01 19:04:04 +00:00
Andrew Turner
504a0067c7 Add support for the dwc usb in the HiSilicon hi6220 in the HiKey board. For
this we need to force the driver into host mode, as without this the driver
fails to detect any devices.

Relnotes:	yes
Sponsored by:	ABT Systems Ltd
2015-09-01 17:13:04 +00:00
Alexander Motin
1b7849d0f2 Make most of port methods optional and remove bunch of dummies. 2015-09-01 16:28:06 +00:00
Andrew Turner
c0e5e17237 Add support for the DesignWare MMC hardware in the HiSilicon hi6220. This
SoC is used in the HiKey board from 96boards.

Currently on the SD card is working on the HiKey, as such devices 0 and 2
will need to be disabled, for example by adding the following to
loader.conf:

hint.hisi_dwmmc.0.disabled=1
hint.hisi_dwmmc.2.disabled=1

Relnotes:	yes (Hikey board booting)
Sponsored by:	ABT Systems Ltd
2015-09-01 16:25:12 +00:00
Andrew Turner
fa6ea9962e Finish allowing the dwmmc driver to be subclassed, move the softc to a new
header, along with the hwtype enum, device attach prototype, and driver_t.

Sponsored by:	ABT Systems Ltd
2015-09-01 15:26:21 +00:00
Konstantin Belousov
6ae26d06dc Exit notification for EVFILT_PROC removes knote from the knlist. In
particular, this invalidates the knote kn_link linkage, making the
SLIST_FOREACH() loop accessing undefined values (e.g. trashed by
QUEUE_MACRO_DEBUG).  If the knote is freed by other thread when kq
lock is released or when influx is cleared, e.g. by knote_scan() for
kqueue owning the knote, the iteration step would access freed memory.

Use SLIST_FOREACH_SAFE() to fix iteration.

Diagnosed by:	avg
Tested by:	avg, lstewart, pawel
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-09-01 14:05:29 +00:00
Andrew Turner
2c63960222 Install the forth bits on arm64. For now limit it to just arm64 as on x86
these should have been installed as part of the regular loader.
2015-09-01 13:51:07 +00:00
Konstantin Belousov
78b9afe121 Clean up the kqueue use of the uma KPI.
Explain why it is fine to not check for M_NOWAIT failures in
kqueue_register().  Remove unneeded check for NULL result from
waitable allocation in kqueue_scan().  uma_free(9) handles NULL
argument correctly, remove checks for NULL.  Remove useless cast and
adjust style in knote_alloc().

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-09-01 13:21:32 +00:00
Konstantin Belousov
76cae067b8 By doing file extension fast, it is possible to create excess supply
of the D_NEWBLK kinds of dependencies (i.e. D_ALLOCDIRECT and
D_ALLOCINDIR), which can exhaust kmem.

Handle excess of D_NEWBLK in the same way as excess of D_INODEDEP and
D_DIRREM, by scheduling ast to flush dependencies, after the thread,
which created new dep, left the VFS/FFS innards.  For D_NEWBLK, the
only way to get rid of them is to do full sync, since items are
attached to data blocks of arbitrary vnodes.  The check for D_NEWBLK
excess in softdep_ast_cleanup_proc() is unlocked.

For 32bit arches, reduce the total amount of allowed dependencies by
two.  It could be considered increasing the limit for 64 bit platforms
with direct maps.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-09-01 13:07:27 +00:00
Andrew Turner
0e308268b0 Remove an variable we only ever write to, and stop assigning 0 to values
in the softc as it's the default value. The latter helps with subclassing
this driver.

Sponsored by:	ABT Systems Ltd
2015-09-01 10:47:42 +00:00
Hans Petter Selasky
6840adf6da Add new PCI ID.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 month
PR:		202807
2015-09-01 09:33:24 +00:00
Andriy Gapon
378d5c6c89 callout_reset: fix a reversed check for cc_exec_cancel
The typo was introduced in r278469 / 344ecf88af.

As a result of the bug there was a timing window where callout_reset()
would fail to cancel a concurrent execution of a callout that is about
to start and would schedule the callout again.
The callout would fire more times than it is scheduled.
That would happen even if the callout is initialized with a lock.

For example, the bug triggered the "Stray timeout" assertion in
taskqueue_timeout_func().

MFC after:	5 days
2015-09-01 09:27:14 +00:00
Alan Cox
a3aeedabb4 Handle held pages earlier in the inactive queue scan.
Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
2015-09-01 06:21:12 +00:00
Allan Jude
de84a5132c Apply the noline attribute to vdev_queue_max_async_writes
This makes it possible to analyze the performance of the new ZFS
write throttle with dtrace

PR:		200316
Submitted by:	Lacey Powers <lacey.leanne@gmail.com>
Reviewed by:	avg, smh, delphij (no objection)
Approved by:	bapt (mentor)
MFC after:	1 month
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3472
2015-08-31 23:10:42 +00:00
Sean Bruno
fac8243601 Restrict tso_max to IP_MAXPACKET to avoid the panic reported in:
https://lists.freebsd.org/pipermail/freebsd-current/2015-August/057192.html

Submitted by:	pyunyh@gmail.com
MFC after:	2 weeks
2015-08-31 19:12:10 +00:00
Gleb Smirnoff
a465d49ffa Remove now unneeded includes. 2015-08-31 10:43:00 +00:00
Andrew Turner
f05a5be590 Clean up the style of the LEAVE_HYP macro. 2015-08-31 09:39:16 +00:00
Hans Petter Selasky
98d3afa551 Add new USB quirk.
MFC after:	1 week
PR:		202783
2015-08-31 07:18:13 +00:00
Alexander V. Chernikov
3b0fd911fa Simplify lla_rt_output()/nd6_add_ifa_lle() by setting lle state in
alloc handler, based on flags.
2015-08-31 05:03:36 +00:00
Marcel Moolenaar
7aefa262d6 Add support for the UGA draw protocol. This includes adding a
command called 'uga' to show whether UGA is implemented by the
firmware and what the settings are. It also includes filling
the efi_fb structure from the UGA information when GOP isn't
implemented by the firmware.

Since UGA does not provide information about the stride, we
set the stride to the horizontal resolution. This is likely
not correct and we should determine the stride by trial and
error. For now, this should show something on the console
rather than nothing.

Refactor this file to maximize code reuse.

PR:		202730
2015-08-30 23:58:53 +00:00
Luiz Otavio O Souza
765701d193 Add the LED definitions from vendor's DTS.
Add gpioled support to A20 kernel.

While here rename the gpio phandle to match the one used in the vendor's
DTS.
2015-08-30 23:20:00 +00:00
Luiz Otavio O Souza
fbb065700c The vendor's DTS for Allwinner A20 uses a different way to map the gpio
pins, they specify the bank and the pin in two separated cells.

This allow the use of vendor's DTS definitions by adding a gpio map
routine that copes with that.
2015-08-30 22:38:06 +00:00
Adrian Chadd
4823a7500b Migrate the stats API for iwn(4) into a cdev ioctl, rather than tying
into the vap.

This allows for possible hardware interaction without needing a vap
configured.
2015-08-30 21:54:33 +00:00
Konstantin Belousov
8d830e02f5 Use P1B_PRIO_MAX to designate max posix priority for the RR/FIFO
scheduler types.  It was intended to be used there, compare with the
min value, and with the test for correctness in ksched_setscheduler().

Note that P1B_PRIO_MAX and RTP_PRIO_MAX do have the same numerical
values, the change is cosmetical.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-08-30 18:02:57 +00:00
Konstantin Belousov
44e629f18d Remove single-use macros obfuscating malloc(9) and free(9) calls.
Style.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-08-30 17:58:11 +00:00
Luiz Otavio O Souza
a7fc139721 Reduce the difference to vendor DTS by using the vendor compat strings (at
some point we have to use the complete vendor DTS files, but we're not
there yet).
2015-08-30 16:10:12 +00:00
Luiz Otavio O Souza
30f0be8ce0 In preparation to support other A20 based boards, rename the CUBIEBOARD2
kernel configuration to A20.

There are other boards (namely the banana pi) that use exactly the same
devices.

Additionally, we are moving from static FDT support (DTB compiled
in-kernel) to DTB passed to kernel by the boot loader (ubldr).  The u-boot
for these boards are already available on ports and as the crochet support
for these boards isn't committed yet, this should not bring any issues.

Discussed with:		ian
2015-08-30 15:38:41 +00:00
Julien Charbon
2ea3089cb1 Revert r286880: If at first this change made sense, it turns out
it helps only the TCP timers callout(9) usage.  As the benefit for
others callout(9) usages did not reach a consensus the historical
usage should prevail.

Differential Revision:      https://reviews.freebsd.org/D3078
2015-08-30 13:44:46 +00:00
Julien Charbon
d6de19ac2f Put r284245 back in place: If at first this fix was seen as a temporary
workaround for a callout(9) issue, it turns out it is instead the right
way to use callout in mpsafe mode without using callout_drain().

r284245 commit message:

Fix a callout race condition introduced in TCP timers callouts with r281599.
In TCP timer context, it is not enough to check callout_stop() return value
to decide if a callout is still running or not, previous callout_reset()
return values have also to be checked.

Differential Revision:	https://reviews.freebsd.org/D2763
2015-08-30 13:44:39 +00:00
Xin LI
42404113e6 Remove support for FreeBSD < 602110. 2015-08-30 08:48:31 +00:00
Adrian Chadd
9b11ed5f9d Fix compilation error on gcc-5.2.0 - it now warns on non-paranthen'ed
logical negation when used in this fashion.

Tested:

* compile only
2015-08-30 08:46:50 +00:00
Marcel Moolenaar
d81907ecbf Add a gop command to help diagnose VT efifb problems. The gop
command has the following sub-commands:
  list		- list all possible modes (paged)
  get		- return the current mode
  set <mode>	- set the current mode to <mode>
2015-08-30 01:39:59 +00:00
Gavin Atkinson
c6cc7ec120 Support the ZTE MF112 HSUPA 3G USB stick.
MFC after:	1 week
2015-08-29 18:37:09 +00:00
Michael Tuexen
2e2d67945a Use 5 times RTO.Max as the default for the shutdown guard timer
as required by RFC 4960. The sysctl variable can be used to
overwrite this.

Discussed with:	rrs
MFC after:	1 week
2015-08-29 17:26:29 +00:00
Alexander Motin
7278725be5 Remove 600 bytes of port_priv from struct ctl_io_hdr.
This field used only for camtgt frontend, and once it any way preallocates
all requests, let it preallocate this memory too, not bothering core code.
2015-08-29 15:33:31 +00:00
Alexander Motin
9202485814 Attach pass driver to LUNs is OFFLINE state.
Previously such LUNs were silently ignored.  But while they indeed unable
to process most of SCSI commands, some, like RTPG, they still can.

MFC after:	1 month
2015-08-29 11:21:20 +00:00
Xin LI
9053fe148b Fix a buffer overrun which may lead to data corruption, introduced in
r286951 by reinstating changes in r274628.

In l2arc_compress_buf(), we allocate a buffer to stash away the compressed
data in 'cdata', allocated of l2hdr->b_asize bytes.

We then ask zio_compress_data() to compress the buffer, b_l1hdr.b_tmp_cdata,
which is of l2hdr->b_asize bytes, and have the compressed size (or original
size, if compress didn't gain enough) stored in csize.

To pad the buffer to fit the optimal write size, we round up the compressed
size to L2 device's vdev_ashift.

Illumos code rounds up the size by at most SPA_MINBLOCKSIZE.  Because we
know csize <= b_asize, and b_asize is integer multiple of SPA_MINBLOCKSIZE,
we are guaranteed that the rounded up csize would be <= b_asize. However,
this is not necessarily true when we round up to 1 << vdev_ashift, because
it could be larger than SPA_MINBLOCKSIZE.

So, in the worst case scenario, we are overwriting at most

	(1 << vdev_ashift - SPA_MINBLOCKSIZE)

bytes of memory next to the compressed data buffer.

Andriy's original change in r274628 reorganized the code a little bit,
by moving the padding to after we determined that the compression was
beneficial.  At which point, we would check rounded size against the
allocated buffer size, and the buffer overrun would not be possible.
2015-08-29 09:22:32 +00:00
Michael Tuexen
e92c2a8d6a Fix the exporting of SCTP association states to userland. Without this,
associations in SHUTDOWN-PENDING were never reported correctly.

MFC after:	3 weeks
2015-08-29 09:14:32 +00:00
Xin LI
253d699d3c In r286705 (Illumos 5960/a2cdcdd), a separate thread is created with curproc
as parent.  In the case of a send or receive, the curproc would be the
userland application that issues the ioctl.  This would trigger an assertion
failure introduced in Solaris compatibility shims in r196458 when kernel is
compiled with INVARIANTS.

Fix this by using p0 (proc0 or kernel) as the parent thread when creating
the kernel threads.
2015-08-29 08:16:57 +00:00
Adrian Chadd
0be189151f Implement RSS hashing/re-hashing for IPv6 ingress packets.
This mirrors the basic IPv4 implementation - IPv6 packets under RSS
now are checked for a correct RSS hash and if one isn't provided,
it's done in software.

This only handles the initial receive - it doesn't yet handle
reinjecting / rehashing packets after being decapsulated from
various tunneling setups.  That'll come in some follow-up work.

For non-RSS users, this is almost a giant no-op.

It does change a couple of ipv6 methods to use const mbuf * instead of
mbuf * but it doesn't have any functional changes.

So, the following now occurs:

* If the NIC doesn't do any RSS hashing, it's all done in software.
  Single-queue, non-RSS NICs will now have the RX path distributed
  into multiple receive netisr queues.

* If the NIC provides the wrong hash (eg only IPv6 hash when we needed
  an IPv6 TCP hash, or IPv6 UDP hash when we expected IPv6 hash)
  then the hash is recalculated.

* .. if the hash is recalculated, it'll end up being injected into
  the correct netisr queue for v6 processing.

Submitted by:	Tiwei Bie <btw@mail.ustc.edu.cn>
Differential Revision:	https://reviews.freebsd.org/D3504
2015-08-29 07:14:29 +00:00
Adrian Chadd
2527ccad2d Rename rss_soft_m2cpuid() -> rss_soft_m2cpuid_v4() in preparation for
an IPv6 version to show up.

Submitted by:	Tiwei Bie <btw@mail.ustc.edu.cn>
Differential Revision:	https://reviews.freebsd.org/D3504
2015-08-29 06:58:30 +00:00
Justin Hibbits
12d44566ae The TLB1 TSIZE is a multiple of 4, not 2, so shift 2 bits, not 1. 2015-08-29 06:52:14 +00:00
Adrian Chadd
8f1111cf0b Remove now unused (and #if 0'ed out) headers. 2015-08-29 04:33:31 +00:00
Baptiste Daroussin
21bba0ead0 Mark ValleyView/Bay Trail as not supported 2015-08-29 00:05:39 +00:00
Warner Losh
de830d432c Remove now obsolete comment.
MFC After: 2 days
2015-08-28 20:06:58 +00:00
Warner Losh
3f27281613 Per overwhelming sentiment in the code review, use FEATURE instead.
Differential Revision: https://reviews.freebsd.org/D3488
MFC After: 2 days
2015-08-28 19:53:19 +00:00
Warner Losh
fd449cdf1e Comment out cleaning files, since it cleans too much. 2015-08-28 16:29:38 +00:00
Warner Losh
5e4fb9caca Add missing ofw_machdep.h. Make x86 ofw_machdep.h work pc98 too.
This allows the owc module to compile on pc98 and seems preferable to
adding another special case in the build system.
2015-08-28 15:41:09 +00:00
Pedro F. Giffuni
fa60bc2f86 Add underscores to attributes when checking for __has_attribute.
This is a good practice to avoid confusion with allowed macros.

Suggested by:	jilles
2015-08-28 15:36:05 +00:00
Andrew Turner
755eb18fd7 Move dwmmc.h to dwmmc_reg.h. This is in preperation for adding support to
subclass the dwmmc driver to allow SoC specific attachments.

Sponsored by:	ABT Systems Ltd
2015-08-28 15:27:55 +00:00
Warner Losh
93d5e88d46 Add back missing -m32 for amd64 and powerpc64 that was lost
in the move to bsd.stand.mk.
2015-08-28 14:50:36 +00:00
Edward Tomasz Napierala
1d4c0424c8 Fix an NFS server bug that manifested in "ls -al" displaying a plus
sign on every directory exported via NFSv4 with NFSv4 ACLs enabled.

Reviewed by:	rmacklem@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3502
2015-08-28 14:26:11 +00:00
Pedro F. Giffuni
46e45c23d4 trailing space 2015-08-28 14:13:01 +00:00
Pedro F. Giffuni
ddd54889b7 Be more GCC-friendly with attributes
Being clang the default compiler, we were always giving precedence to
the __has_attribute check. Unfortunately clang generally doesn't support
the new attributes (alloc_size was briefly supported and then reverted)
so we were always doing both checks. Give the precedence to GCC as that is
the working case now.

Do the same for  __has_builtin() for consistency.
2015-08-28 14:06:28 +00:00
Warner Losh
160c44fe95 Fix cleaning of files generated from .m sources. 2015-08-28 13:57:30 +00:00
Andrew Turner
725b72d5e0 Only check for the bus frequency if it has not already been set, for
example through a driver running as a subclass of this.

Sponsored by:	ABT Systems Ltd
2015-08-28 10:34:37 +00:00
Bjoern A. Zeeb
196074f3b2 remove a left-over after r220463 empty #ifdef INET check.
MFC after:	1 week
2015-08-28 09:38:18 +00:00
Adrian Chadd
e5562eb934 Replace the printf()s with optional rate limited debugging for RSS.
Submitted by:	Tiwei Bie <btw@mail.ustc.edu.cn>
Differential Revision:	https://reviews.freebsd.org/D3471
2015-08-28 05:58:16 +00:00
Justin Hibbits
992bbfac61 Fix text alignment. mcsr was indented one too many spaces. 2015-08-28 05:20:31 +00:00
Justin Hibbits
afefc223b1 Extend pmap to support e500mc and e5500.
As part of this, clean up tlb1_init(), since bootinfo is always NULL here just
eliminate the loop altogether.

Also, fix a bug in mmu_booke_mapdev_attr() where it's possible to map a larger
immediately following a smaller page, causing the mappings to overlap.  Instead,
break up the new mapping into smaller chunks.  The downside to this is that it
uses more precious TLB1 entries, which, on smaller chips (e500v2) it could cause
problems with TLB1 being out of space (e500v2 only has 16 TLB1 entries).

Obtained from:	Semihalf (partial)
Sponsored by:	Alex Perez/Inertial Computing
2015-08-28 03:03:09 +00:00
Warner Losh
d63180f2df Simply to appease gcc's warnings. 2015-08-28 02:29:31 +00:00
Pyun YongHyeon
97c477f86f Set DMA alignment constraint of status, TX and RX LEs(List Elements
in Marvell terms) to 32768.  32768 looks overkill but it will
ensure correct DMAed update.  This change addresses occasional
watchdog timeouts reported on 10.2-RELEASE.

Tested by:	Johann Hugo <jhugo@meraka.csir.co.za>
MFC after:	2 weeks
2015-08-28 01:32:42 +00:00
Mark Johnston
c25fabea97 Remove weighted page handling from vm_page_advise().
This was added in r51337 as part of the implementation of
madvise(MADV_DONTNEED).  Its objective was to ensure that the page daemon
would eventually reclaim other unreferenced pages (i.e., unreferenced pages
not touched by madvise()) from the active queue.

Now that the pagedaemon performs steady scanning of the active page queue,
this weighted handling is unnecessary.  Instead, always "cache" clean pages
by moving them to the head of the inactive page queue.  This simplifies the
implementation of vm_page_advise() and eliminates the fragmentation that
resulted from the distribution of pages among multiple queues.

Suggested by:	alc
Reviewed by:	alc
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3401
2015-08-28 00:44:17 +00:00
Mark Johnston
21be12e0ca Remove an unneeded instruction.
MFC after:	1 week
2015-08-28 00:17:21 +00:00
Warner Losh
9d2edd63d4 Use CFLAGS_NO_SIMD in preference to varying lists of -mno-xxxx flags.
Go ahead and defined -D_STANDALONE for all targets (only strictly
needed for some architecture, but harmless on those it isn't required
for). Also add -msoft-float to all architectures uniformly rather
that higgley piggley like it is today.

Differential Revision: https://reviews.freebsd.org/D3496
2015-08-27 23:46:42 +00:00
Warner Losh
ae1f3df434 New 1-Wire bus implementation. 1-Wire controller is abstracted, though
only gpiobus configured via FDT is supported. Bus enumeration is
supported. Devices are created for each device found. 1-Wire
temperature controllers are supported, but other drivers could be
written. Temperatures are polled and reported via a sysctl.  Errors
are reported via sysctl counters. Mis-wired bus detection is included
for more trouble shooting. See ow(4), owc(4) and ow_temp(4) for
details of what's supported and known issues.

This has been tested on Raspberry Pi-B, Pi2 and Beagle Bone Black
with up to 7 devices.

Differential Revision: https://reviews.freebsd.org/D2956
Relnotes: yes
MFC after: 2 weeks
Reviewed by: loos@ (with many insightful comments)
2015-08-27 23:33:38 +00:00
Kristof Provost
64b3b4d611 pf: Remove support for 'scrub fragment crop|drop-ovl'
The crop/drop-ovl fragment scrub modes are not very useful and likely to confuse
users into making poor choices.
It's also a fairly large amount of complex code, so just remove the support
altogether.

Users who have 'scrub fragment crop|drop-ovl' in their pf configuration will be
implicitly converted to 'scrub fragment reassemble'.

Reviewed by:	gnn, eri
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D3466
2015-08-27 21:27:47 +00:00
Alexander Motin
f6295033c1 Fix type bug introduced at r286811. 2015-08-27 21:16:24 +00:00
Alan Cox
40aa80a7c2 In vm_pageout_scan(), simplify the logic for determining if a page can be
paged out and apply some nearby style fixes.

In collaboration with:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation, EMC / Isilon Storage Division
2015-08-27 20:38:45 +00:00
Andrew Turner
2640322a2e There is no need to get the bus tag or handle.
Sponsored by:	ABT Systems Ltd
2015-08-27 16:27:51 +00:00
Andrew Turner
fd59e3a9d8 Limit the speed to the bus frequency.
Sponsored by:	ABT Systems Ltd
2015-08-27 16:24:30 +00:00
Andrew Turner
488d593a0c Allow the fifo-depth and num-slots to be missing. For the former we read
the value from the hardware, for the latter assume a single slot.

Sponsored by:	ABT Systems Ltd
2015-08-27 16:18:22 +00:00