Commit Graph

115784 Commits

Author SHA1 Message Date
Alexander Motin
03ea6ef2db Axe out some forever disabled questionable functionality.
This code is complicated enough even in its base shape.

MFC after:	2 weeks
2017-02-25 04:24:51 +00:00
Alexander Motin
3afd480696 Improve CAM target frontend reference counting.
Before this change it was possible to trigger some use-after-free panics
by disabling LUNs/ports under heavy load.

MFC after:	2 weeks
2017-02-25 04:04:11 +00:00
Andriy Voskoboinyk
d7de0a2c2a iwn: some initialization / RF switch state change fixes.
- Check return code from initialization path; otherwise, vap state
may be wrong after an error.
- Do not try to run iwn_stop() / iwn_init() multiple times.
- Merge iwn_radio_on/off() and move RFKILL bit check into the task.
- Try to handle possible RF switch state change in S3 state (PR 181694).

PR:		181694
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D9797
2017-02-25 00:40:50 +00:00
Mahdi Mokhtari
bd911530b7 Add linux_preadv() and linux_pwritev() syscalls to Linuxulator.
Reviewed by:	dchagin
Approved by:	dchagin, trasz (src committers)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9722
2017-02-24 20:04:02 +00:00
Dmitry Chagin
8665c4d9cd Revert r314217. Commit is not match that I have approved. 2017-02-24 19:47:27 +00:00
Mahdi Mokhtari
21d23e3249 Add linux_preadv() and linux_pwritev() syscalls to Linuxulator.
Reviewed by:	dchagin
Approved by:	dchagin, trasz (src committers)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9722
2017-02-24 19:22:17 +00:00
Jonathan T. Looney
a81ce6e9d5 We have seen several cases recently where we appear to get a double-fault:
We have an original panic. Then, instead of writing the core to the dump
device, the kernel has a second panic: "smp_targeted_tlb_shootdown:
interrupts disabled". This change is an attempt to fix that second panic.

When the other CPUs are stopped, we can't notify them of the TLB shootdown,
so we skip that operation. However, when the CPUs come back up, we
invalidate the TLB to ensure they correctly observe any changes to the
page mappings.

Reviewed by:	kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D9786
2017-02-24 18:56:00 +00:00
Hans Petter Selasky
0f32531a56 Implement more string functions in the LinuxKPI.
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-24 17:36:55 +00:00
Hans Petter Selasky
5a5a8c8a17 Prototype device structure to ensure LinuxKPI header file can be
included standalone.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-24 17:03:14 +00:00
Allan Jude
f91d1c83cd Remove control+r handling from geliboot's pwgets()
pwgets() is based on ngets() from libstand, which includes a feature
that is not wanted in a very of the function designed for password
handling.

Pressing control+r echos out the entered string

This commit removes that feature from pwgets()

PR:		217298
Reported by:	ehaupt
Reviewed by:	kristof, tsoome, ehaupt
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D9782
2017-02-24 16:52:57 +00:00
Ruslan Bukin
e42e2a1edc Use correct macro for Synopsys UART driver declaration. 2017-02-24 16:37:35 +00:00
Konstantin Belousov
8cd5962571 Remove cpu_deepest_sleep variable.
On Core2 and older Intel CPUs, where TSC stops in C2, system does not
allow C2 entrance if timecounter hardware is TSC.  This is done by
tc_windup() which tests for TC_FLAGS_C2STOP flag of the new
timecounter and increases cpu_disable_c2_sleep if flag is set.  Right
now init_TSC_tc() only sets the flag if cpu_deepest_sleep >= 2, but
TSC is initialized too early for this variable to be set by
acpi_cpu.c.

There is no reason to require that ACPI reported C2 and deeper states
to set TC_FLAGS_C2STOP, so remove cpu_deepest_sleep test from
init_TSC_tc() condition.  And since this is the only use of the
variable, remove it at all.

Reported and submitted by:	Jia-Shiun Li <jiashiun@gmail.com>
Suggested by:	jhb
MFC after:	2 weeks
2017-02-24 16:11:55 +00:00
Adrian Chadd
9c8efa1dfb [iwm] add if_iwm_fw.c. 2017-02-24 15:17:43 +00:00
Alexander Motin
87de303c4a Respecting r314204 tighten ATIO cleanup requirements.
Every ATIO must complete with either successfully sent status or XPT_ABORT.

MFC after:	2 weeks
2017-02-24 14:48:17 +00:00
Hans Petter Selasky
959d6165a2 Implement srcu_dereference() macro in the LinuxKPI.
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-24 14:40:15 +00:00
Hans Petter Selasky
797046eebb Implement BIT_ULL() macro in the LinuxKPI.
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-24 14:23:46 +00:00
Alexander Motin
d7c2cc352e Explicitly abort ATIO if CTIO sending status has failed.
This helps SIM to free related resources in questionable cases.

MFC after:	2 weeks
2017-02-24 12:12:30 +00:00
Alexander Motin
5c0b756a9a Fix missing xpt_done() for ATIO/INOT on missing LUN.
MFC after:	2 weeks
2017-02-24 12:11:17 +00:00
Alexander Motin
8d1316f914 We can't access periph after ctlfe_free_ccb().
MFC after:	2 weeks
2017-02-24 11:25:32 +00:00
Alexander Motin
a504738fac Unify ATIO/INOT CCBs requeuing.
MFC after:	2 weeks
2017-02-24 09:16:21 +00:00
Konstantin Belousov
63cdcaaead Properly handle possible underflow in vm_fault_prefault().
In vm_fault_prefault(), if backward count causes underflow in
calculation of
	starta = addra - backward * PAGE_SIZE;
then starta must be clipped to entry->start, instead of zero.
Clipping to zero allowed mapping outside of the map entries address
ranges, in particular, map at zero.

Submitted by:	Yanko Yankulov <yanko.yankulov@gmail.com>
Reviewed by:	alc
MFC after:	1 week
2017-02-24 08:09:16 +00:00
Andriy Gapon
7fa27112f3 zfs: clean up unused files and definitions
MFC after:	1 month
X-MFC after:	r314048
2017-02-24 07:53:56 +00:00
Alexander Motin
6b0878502e Some code cleanup.
MFC after:	2 weeks
2017-02-24 07:47:50 +00:00
Adrian Chadd
ad35d47138 [iwm] Add support for Firmware paging, needed for newer 8000C firmware.
* Uses the IWM_FW_PAGING_BLOCK_CMD firmware command to tell the firmware
  what memory ranges to use for paging.

Obtained from:	dragonflybsd.git 8a5b199964f8e7bdb00039f0b48817a01b402f18
2017-02-24 07:07:58 +00:00
Warner Losh
bbf6e5144e Cast values to (int) before comparing them to the range of the
enum. This ensures they are in range w/o the warnings.
2017-02-24 01:39:12 +00:00
Warner Losh
df1c30f6bd KDTRACE_HOOKS isn't guaranteed to be defined. Change to check to see
if it is defined or not rather than if it is non-zero.

Sponsored by: Netflix, Inc
2017-02-24 01:39:08 +00:00
Pedro F. Giffuni
ee7030f303 at91: double assignment.
Found with:	coccinelle (da.cocci)
Suggested by:	cognet
2017-02-23 23:48:44 +00:00
Mateusz Guzik
dfaa7859d6 mtx: microoptimize lockstat handling in spin mutexes and thread lock
While here make the code compilablle on kernels with LOCK_PROFILING but without
KDTRACE_HOOKS.
2017-02-23 22:46:01 +00:00
Brooks Davis
b853277efc Fix and shorten BERI kernel builds during universe.
Stop building BERI_DE4_BASE and BERI_SIM_BASE, they aren't particularly
valid as they don't have a root dev.  Do build BERI_DE4_SDROOT which
does so devices get coverage.

Remove ident from BERI_DE4_BASE for the reasons above which will cause
it to fail to build.  BERI_SIM_BASE was already this way and broke
universe.[0]

Reported by:	rpokala
Sponsored by:	DARPA, AFRL
2017-02-23 20:41:55 +00:00
Eric van Gyzen
b215ceaaec Add sem_clockwait_np()
This function allows the caller to specify the reference clock
and choose between absolute and relative mode.  In relative mode,
the remaining time can be returned.

The API is similar to clock_nanosleep(3).  Thanks to Ed Schouten
for that suggestion.

While I'm here, reduce the sleep time in the semaphore "child"
test to greatly reduce its runtime.  Also add a reasonable timeout.

Reviewed by:	ed (userland)
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D9656
2017-02-23 19:36:38 +00:00
Navdeep Parhar
3ae36eee9c cxgbe/iw_cxgbe: Minor changes for T6.
Submitted by:	Krishnamraju Eraparaju at Chelsio
Sponsored by:	Chelsio Communications
2017-02-23 19:02:40 +00:00
Pedro F. Giffuni
46f8be3953 vxge(4): Yet another (minor) mismatch.
VXGE_DEFAULT_TTI_RTIMER_VAL and VXGE_DEFAULT_RTI_RTIMER_VAL have value
zero but nevertheless we should use the right value on each.

Pointed by:	jhb
X-MFC with:	r314145
2017-02-23 18:56:31 +00:00
Pedro F. Giffuni
d43e62ddea rt_attach(): double assignment.
Found with:	coccinelle (da.cocci)
2017-02-23 18:15:04 +00:00
Michael Tuexen
8d62aae8df TCP window updates are only sent if the window can be increased by at
least 2 * MSS. However, if the receive buffer size is small, this might
be impossible. Add back a criterion to send a TCP window update if
the window can be increased by at least half of the receive buffer size.
This condition was removed in r242252. This patch simply brings it back.
PR:			211003
Reviewed by:		gnn
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D9475
2017-02-23 18:14:36 +00:00
Enji Cooper
6233db9fac Unbreak if_iwm.ko after r314076
Add if_iwm_7000.c/if_iwm_8000.c to SRCS to match similar additions made
to sys/conf/files after refactoring done in the commit noted.

PR:		217308
Pointyhat to:	adrian
Submitted by:	Andreas Nilsson <andrnils@gmail.com>
Reported by:	Jakob Alvermark <jakob@alvermark.net>, Juan Ramómon Molina Menor <listjm@club.fr>
Sponsored by:	Dell EMC Isilon
2017-02-23 17:44:06 +00:00
Alan Somers
65244d585f Fix the xnb(4) unit tests
One test was inadvertently expecting a bug in the kernel's sscanf
implementation circa 2012. I don't know when that bug got fixed.

Reported by:	royger
Reviewed by:	royger
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9766
2017-02-23 16:54:30 +00:00
Alan Somers
407d708cc7 Misc Coverity fixes in xnb(4)
Most of these are null pointer dereferences or missing error checks in the
unit tests. One is a missing error check in xnb_attach_failed. None can
cause real problems in running systems.

Reported by:	Coverity
CIDs:		1092469 1092468 1092467 2092466 1092465 1092512 1092511 1092510
CIDs:		1092510 1092509 1092508 1092507
Reviewed by:	royger
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9234
2017-02-23 16:31:04 +00:00
Pedro F. Giffuni
466bc1573f bktr(4): double assignment.
First assignment is obviously overwritten by the next line.
Leave newest assignment: it was introduced in r29233.

Found with:	coccinelle (da.cocci)
2017-02-23 16:18:57 +00:00
Pedro F. Giffuni
0778102b03 dev/vxe: double assignments.
Fix some suspicious code, likely caused by excessive copy-pasting.

Found with:	coccinelle (da.cocci)
MFC after:	2 weeks
2017-02-23 16:10:15 +00:00
Pedro F. Giffuni
e54226a396 dev/ce: double assignment.
The code is not operational right now so just comment away an obviously
useless assignment. Fix some typos while here.

Found with: coccinelle (da.cocci)
2017-02-23 15:30:21 +00:00
Roger Pau Monné
d908d2ef5e xen/gndev: use UOFF_TO_IDX instead of OFF_TO_IDX
The Xen grant table device treats the mmap offset parameter as an unsigned
type, and as so it must use the newly introduced UOFF_TO_IDX.

Sponsored by:   Citrix Systems R&D
MFC after:      2 weeks
X-MFC-with:     r313690
2017-02-23 13:14:28 +00:00
Hans Petter Selasky
cffaf933d7 Implement __test_and_clear_bit() and __test_and_set_bit() in the LinuxKPI.
The clang compiler will optimise these functions down to three AMD64
instructions if the bit argument is a constant during compilation.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-23 09:53:54 +00:00
Dmitry Chagin
c1f156d447 Right clock defines specified in linux_timer.h.
Get rid of spirious clock defines from linux_misc.h.

MFC after:	1 week
2017-02-23 08:17:42 +00:00
Navdeep Parhar
3d4f452402 Avoid NULL dereference in a couple of sysctl handlers in ibcore.
iw_cxgbe sets ib_device->dma_device to NULL (since r311880).

Reviewed by:	hselasky@
Sponsored by:	Chelsio Communications
2017-02-23 07:48:58 +00:00
Emmanuel Vadot
dd165efb5a Do not check divider length if we have a div table.
Reviewed by:	mmel
2017-02-23 05:33:20 +00:00
Jonathan T. Looney
c9cde8251c Fix a panic during boot caused by inadequate locking of some vt(4) driver
data structures.

vt_change_font() calls vtbuf_grow() to change some vt driver data
structures. It uses TF_MUTE to prevent the console from trying to use those
data structures while it changes them.

During the early stage of the boot process, the vt driver's tc_done routine
uses those data structures; however, it is currently called outside the
TF_MUTE check.

Move the tc_done routine inside the locked TF_MUTE check.

PR:		217282
Reviewed by:	ed, ray
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D9709
2017-02-23 01:18:47 +00:00
John Baldwin
0049360352 Use LDFLAGS with CC instead of _LDFLAGS.
This is a followup to r311458.  _LDFLAGS is for use with LD, whereas
LDFLAGS is for use with CC.
2017-02-22 23:58:54 +00:00
Toomas Soome
84a6eddc43 loader: update symlink support in zfs reader
As the current zfs file system is providing symlink via system attributes, need
to update the code accordingly.

Note, as the zfsboot code does not free the memory at this time, the
object list will put some stress on the boot2 heap, eventually we should
address the issue.

Reviewed by:	allanjude, smh
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D9706
2017-02-22 22:00:50 +00:00
Hans Petter Selasky
72ebbe00b3 Convert magic values into macros in the LinuxKPI scatterlist
implementation.

Suggested by:		cem @
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-22 20:24:09 +00:00
Hans Petter Selasky
1cdefd084d Optimise unmapped LinuxKPI page allocations.
When allocating unmapped pages, take advantage of the direct map on
AMD64 to get the virtual address corresponding to a page. Else all
pages allocated must be mapped because sometimes the virtual address
of a page is requested.

Move all page allocation and deallocation code into an own C-file.

Add support for GFP_DMA32, GFP_KERNEL, GFP_ATOMIC and __GFP_ZERO
allocation flags.

Make a clear separation between mapped and unmapped allocations.

Obtained from:		kmacy @
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-22 19:39:54 +00:00
Hans Petter Selasky
8306998f5b Improve LinuxKPI scatter list support.
The i915kms driver in Linux 4.9 reimplement parts of the scatter list
functions with regards to performance. In other words there is not so
much room for changing structure layouts and functionality if the
i915kms should be built AS-IS. This patch aligns the scatter list
support to what is expected by the i915kms driver. Remove some
comments not needed while at it.

Obtained from:		kmacy @
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-22 19:31:02 +00:00
Andriy Gapon
a4806d2a62 don't use C99 static array indices with older GCC versions
For example, the FreeBSD GCC (4.2.1) has a spotty support for that
feature.  If the static keyword is used with an unnamed array parameter
in a function declaration, then the compilation fails with:
error: static or type qualifiers in abstract declarator

The feature does work if the parameter is named.
So, the restriction introduced in this commit can be removed when all
affected function prototypes have the workaround.

MFC after:	1 week
Sponsored by:	Panzura
2017-02-22 17:20:18 +00:00
Andriy Gapon
465e69edca fix a typo in __STDC_VERSION__ in __min_size requirements
MFC after:	1 week
Sponsored by:	Panzura
2017-02-22 17:13:00 +00:00
Marius Strobl
4874af73c1 - Allow different slicers for different flash types to be registered
with geom_flashmap(4) and teach it about MMC for slicing enhanced
  user data area partitions. The FDT slicer still is the default for
  CFI, NAND and SPI flash on FDT-enabled platforms.
- In addition to a device_t, also pass the name of the GEOM provider
  in question to the slicers as a single device may provide more than
  provider.
- Build a geom_flashmap.ko.
- Use MODULE_VERSION() so other modules can depend on geom_flashmap(4).
- Remove redundant/superfluous GEOM routines that either do nothing
  or provide/just call default GEOM (slice) functionality.
- Trim/adjust includes

Submitted by:	jhibbits (RouterBoard bits)
Reviewed by:	jhibbits
2017-02-22 10:21:39 +00:00
Roger Pau Monné
de7d5ac603 xen/timer: mark the Xen PV timer as not safe for suspension
Note that the timer itself fully supports suspension, but due to the lack of
ordering during the resume process FreeBSD cannot guarantee that the timer is
resumed before any device attempts to use it.

Submitted by:		Liuyingdong <liuyingdong@huawei.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D9639
2017-02-22 09:22:17 +00:00
Alexander Motin
cfbeb41ccf Slightly polish isp_dump_atpd().
MFC after:	2 weeks
2017-02-22 07:12:20 +00:00
Konstantin Belousov
091326f2ad More fixes for regression in r313898 on i386.
Use long long constants where needed.

Reported and tested by:	kargl
Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2017-02-22 07:07:05 +00:00
Alexander Motin
8290ea90be Fix multiple problems around LUN disable under load.
- Move private data about ATIOs/INOTs from per-LUN to per-channel data.
This allows active commands to continue operation after LUN destruction.
This also simplifies lookup of the data by tag in some situations.
 - Unify three restart_queue processing implementations.
 - Complete all ATIOs from restart_queue on LUN disable.
 - Delete ATIO private data when command completed or aborted, not depending
on the ATIO being requeued, that was ugly hack and could never happen.  CAM
should always call ether XPT_CONT_TARGET_IO with status or XPT_ABORT.
 - Implement XPT_ABORT for queued ATIOs/INOTs to allow CAM do graceful
shutdown, not depending on LUN disable, as it is done in ahd(4)/targ(4).
 - Unify isp_endcmd() arguments to make it more usable in generic code.
 - Remove never really used LUN state reference counter.

MFC after:	2 weeks
2017-02-22 06:43:49 +00:00
Adrian Chadd
b28a6ab3bd [iwm] Move iwm_dma_contig_alloc/_free functions to if_iwm_util.c.
Obtained from:	dragonflybsd.git 83a1185edeede081051a6c00417d4c5a8f5988eb
2017-02-22 05:11:24 +00:00
Adrian Chadd
2fd963796d [iwm] Switch 7265D and 3165 devices to 7265D firmware.
Obtained from:	dragonflybsd.git 0cb0a810cb4e04b30937cb4260e779f717a86492
2017-02-22 04:53:33 +00:00
Adrian Chadd
b60b5e75a0 [iwmfw] add 7265D firmware. 2017-02-22 04:50:52 +00:00
Adrian Chadd
d4dd31fd5e add 7265D firmware. 2017-02-22 04:44:08 +00:00
Adrian Chadd
027d4da3e0 Add 7265D firmware. 2017-02-22 04:42:02 +00:00
Adrian Chadd
6c2c3bd86d [iwm] Move struct iwm_cfg chipset configs to if_iwm_7000.c and _8000.c
* This is more similar to how code/definitions are distributed in
  Linux's iwlwifi.

* This should make recognizing new chipset variants, and adding additional
  flags from the Linux iwlwifi code easier, without blowing up if_iwm.c

Obtained from:	dragonflybsd.git 27d11320e707d2c41424efc1983762f6799941d6
2017-02-22 04:35:53 +00:00
Adrian Chadd
10e7a12c26 [iwm] Simplify device id matching code a bit.
* Just add the struct iwm_cfg pointers to the iwm_devices array, to get
  rid of the large switch clause.

Obtained from:	dragonflybsd.git 35f0e6c86c1654323d6b19f7a077f4ab8ac85868
2017-02-22 04:28:10 +00:00
Adrian Chadd
e5beb03bc6 [iwm] Remove OpenBSD-specific comment. Beautify pci cfg space accesses.
Obtained from:	dragonflybsd.git 710fdd011c30a1bd9f53b87c843fb8907c4a6cfd
2017-02-22 04:27:07 +00:00
Ian Lepore
c5727c468f Revert to this driver's historic behavior: assume an sd card is writable
if the fdt data doesn't provide a gpio pin for reading the write protect
switch and also doesn't contain a "wp-disable" property.

In r311735 the long-bitrotted code in this driver for using the non-
standard fdt "mmchs-wp-gpio-pin" property was replaced with new common
support code for handling write-protect and card-detect gpio pins.  The
old code never found a property with that name, and the logic was to
assume that no gpio pin meant that the card was not write protected.

The new common code behaves differently.  If there is no fdt data saying
what to do about sensing write protect, the value in the standard SDHCI
PRESENT_STATE register is used.  On this hardware, if there is no signal
for write protect muxed into the sd controller then that bit in the
register indicates write protect.

The real problem here is the fdt data, which should contain "wp-disable"
properties for eMMC and micro-sd slots where write protect is not even
an option in the hardware, but we are not in control of that data, it
comes from linux.  So we have to make the same flawed assumption in our
driver that the corresponding linux driver has: no info means no protect.

Reported by:	several users on the arm@ list
Pointy hat:	me, for not testing enough before committing r311735
2017-02-22 03:49:46 +00:00
Adrian Chadd
0a68d61092 [iwm] Fix typo in commit a7697ea01c11fd493aec52260a02f31df680eb91.
* The sc->sc_uc.uc_error_event_table value is now at sc->error_event_table,
  and not sc->umac_error_event_table.

Obtained from:	dragonflybsd.git 612855b1a8c321ec9ba34f63edf913e7ecff8363
2017-02-22 02:51:30 +00:00
Adrian Chadd
dfdbaed494 [iwm] Get rid of unneeded IWM_FWDMASEGSZ and IWM_FWMAXSIZE constants
* We only need IWM_FH_MEM_TB_MAX_LENGTH bytes for the fw_dma memory.

Obtained from:	dragonflybsd.git f414b8da30816705e32573cc58097cacac34f161
2017-02-22 02:49:57 +00:00
Pedro F. Giffuni
e099b90b80 sys: Replace zero with NULL for pointers.
Found with:	devel/coccinelle
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D9694
2017-02-22 02:35:59 +00:00
Adrian Chadd
dae82c37b0 [iwm] With the previous commits, this DELAY no longer seems to be needed.
Obtained from:	dragonflybsd.git 516272d3d02c821ace16a91cfdeb28540ac74ecc
2017-02-22 02:24:42 +00:00
Adrian Chadd
9df5244309 [iwm] Sync IWM_MVM_ALIVE waiting and start_fw handling with iwlwifi.
* Use the notification wait API, like it's done in the Linux iwlwifi code,
  to wait for the IWM_MVM_ALIVE notification.

* This also should fix some firmware load interrupt issues, and errors
  in the nic lock using.

Tested:

* (adrian) Intel 7260, STA mode

Obtained from:	dragonflybsd.git a7697ea01c11fd493aec52260a02f31df680eb91
2017-02-22 02:23:14 +00:00
Adrian Chadd
e97a1048d1 [iwm] Synchronize firmware loading code with Linux iwlwifi.
* While there, rename some functions to match the names and functionality
  of the similarly named functions in Linux iwlwifi.

Obtained from:	dragonflybsd.git e98ee77a816bfd8b4912047b93dfb2c560788f24
2017-02-22 02:18:04 +00:00
Ian Lepore
9063812353 Remove a variable that has been unused since r311735 (it should have been
removed as part of those changes).
2017-02-22 01:07:04 +00:00
David C Somayajulu
08d82f85d7 add bus_dmamap_unload in ql_free_dmabuf()
MFC after:5 days
2017-02-21 23:32:27 +00:00
Ian Lepore
5c65c9998a Fix typos in bootverbose printfs... display the write-protect pin info,
not the card-detect pin info.
2017-02-21 21:21:58 +00:00
Andriy Gapon
b93763e55d zfs: move zio_taskq_basedc under SYSDC
That knob is useless without SDC (or alike) scheduling class support.
That is, it's unused on FreeBSD.

MFC after:	4 days
2017-02-21 21:11:58 +00:00
Andriy Gapon
2b1bedaf06 zfs: lower priority of zio_write_issue threads by four
The difference of one was insignificant because zio_write_issue threads
ended up on the same run queues as other zio threads.
See sys/priority.h and sys/runq.h for more details.

Add a comment describing FreeBSD priority considerations and restore
the illumos variant of the code for comparison.

Obtained from:	Panzura
MFC after:	2 weeks
Sponsored by:	Panzura
2017-02-21 21:09:21 +00:00
Mark Johnston
a384a37df8 ddb show pte: use pmap of kdb_thread
show pte from the pmap of the process of the current DDB thread, instead
of necessarily the PCPU pmap.

Submitted by:	Ryan Libby <rlibby@gmail.com>
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9645
2017-02-21 21:06:12 +00:00
Ed Maste
0e8b3ab348 Exclude -flto when building *genassym.o
The build process generates *assym.h using nm from *genassym.o (which is
in turn created from *genassym.c).

When compiling with link-time optimization (LTO) using -flto, .o files
are LLVM bitcode, not ELF objects. This is not usable by genassym.sh,
so remove -flto from those ${CC} invocations.

Submitted by:	George Rimar
Reviewed by:	dim
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D9659
2017-02-21 18:59:17 +00:00
Warner Losh
6fec662c86 Make the code match the comments: If we have ANY buf's that failed
then return EAGAIN. The current code just returns that if the LAST buf
failed.

Reviewed by: kib@, trasz@
Differential Revision: https://reviews.freebsd.org/D9677
2017-02-21 18:56:06 +00:00
Warner Losh
ac027d9307 Document what the different flags mean for locking. 2017-02-21 18:49:51 +00:00
Hans Petter Selasky
1a01b4e566 Replace dummy implementation of RCU in the LinuxKPI with one based on
the in-kernel concurrency kit's ck_epoch API. Factor RCU hlist_xxx()
functions into own rculist.h header file.

Obtained from:		kmacy @
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-21 18:04:21 +00:00
Andriy Gapon
47c8e3d912 reimplement zfsctl (.zfs) support
The current code is written on top of GFS, a library with the generic
support for writing filesystems, which was ported from illumos.
Because of significant differences between illumos VFS and FreeBSD
VFS models, both the GFS and zfsctl code were heavily modified to
work on FreeBSD.  Nonetheless, they still contain quite a few ugly
hacks and bugs.

This is a reimplementation of the zfsctl code where the VFS-specific
bits are written from scratch and only the code that interacts with
the rest of ZFS is reused.

Some highlights.

We use two types of nodes, static and on-demand. The static nodes
are used for permanent directories like .zfs, .zfs/snapshot, etc. The
on-demand nodes are used for ephemeral directories that act as snapshot
mount points.
Initially only static nodes are created. Their vnodes are instantiated
when they are looked up. The on-demand nodes and vnodes are instantiated
as needed and the nodes are destroyed as soon as the corresponding
vnodes are reclaimed.
We also try very hard to ensure that uncovered snapshot vnodes do not
linger.  They are supposed to become inactive as soon as they are
uncovered and we try to recycle them immediately.
When a filesystem is unmounted all snapshots under .zfs are unmounted
first, then all vnodes are flushed and finally the static .zfs nodes
are destroyed.

There are some changes outside of zfsctl code too.
z_ctldir is never used directly (as it is an opaque pointer),
zfsctl_root() has to be used instead.  The function returns a locked
vnode now, so it accepts a lock flags parameter.  The function can
also fail now, e.g. during force unmounting, whereas previously it
was infallible.
zfsctl_root_lookup() is retired, instead of it VOP_LOOKUP() on the .zfs
vnode (obtained with zfsctl_root) is used.

Some ideas are picked from an independent work by will.

Reviewed by:	asomers, smh
MFC after:	1 month
Relnotes:	maybe
Differential Revision: https://reviews.freebsd.org/D7421
2017-02-21 17:47:08 +00:00
Brooks Davis
9fa34a2b0c Rename BERI_TEMPLATE to std.BERI to be more like other configs.
Sponsored by:	DARPA, AFRL
2017-02-21 17:34:27 +00:00
Edward Tomasz Napierala
3b51ec0886 Get rid of foo_sys() in linuxulator code. It was commented out, and it
would be useless anyway - there is no point in pretending to have block
devices; our "block" devices are in fact character ones, and can only
be accessed as such.

Discussed with:	dchagin
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-02-21 15:57:01 +00:00
Alexander Motin
26719198a7 Remove duplicate INOT allocation.
For some reason isp_handle_platform_notify_fc() allocated INOT just
before calling isp_handle_platform_target_tmf(), which also allocates
INOT.  It seems to be a braino introduced in r196008.

MFC after:	2 weeks
2017-02-21 14:31:58 +00:00
Hans Petter Selasky
e560eab72c Streamline the LinuxKPI spinlock wrappers.
1) Add better spinlock debug names when WITNESS_ALL is defined.

2) Make sure that the calling thread gets bound to the current CPU
while a spinlock is locked. Some Linux kernel code depends on that the
CPU ID doesn't change while a spinlock is locked.

3) Add support for using LinuxKPI spinlocks during a panic().

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-21 14:22:14 +00:00
Hans Petter Selasky
ef23481a79 Add support for LinuxKPI tasklets.
Tasklets are implemented using a taskqueue and a small statemachine on
top. The additional statemachine is required to ensure all LinuxKPI
tasklets get serialized. FreeBSD taskqueues do not guarantee
serialisation of its tasks, except when there is only one worker
thread configured.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-21 13:23:53 +00:00
Hans Petter Selasky
1e3db1de0c Make the LinuxKPI task struct persistent accross system calls.
A set of helper functions have been added to manage the life of the
LinuxKPI task struct. When an external system call or task is invoked,
a check is made to create the task struct by demand. A thread
destructor callback is registered to free the task struct when a
thread exits to avoid memory leaks.

This change lays the ground for emulating the Linux kernel more
closely which is a dependency by the code using the LinuxKPI APIs.

Add new dedicated td_lkpi_task field has been added to struct thread
instead of abusing td_retval[1].

Fix some header file inclusions to make LINT kernel build properly
after this change.

Bump the __FreeBSD_version to force a rebuild of all kernel modules.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-21 12:43:02 +00:00
Alexander Motin
069f5ef977 Remove ancient __FreeBSD_version checks.
MFC after:	2 weeks
2017-02-21 12:29:07 +00:00
Andriy Gapon
e3a1f14881 jedec_ts: fix slave address check
The mask should cover all bits that can not vary.

MFC after:	3 days
2017-02-21 12:24:31 +00:00
Andriy Gapon
b929de1078 mca: change type of last_intr to time_t for consinstency
time_uptime is time_t

MFC after:	1 day
X-MFC with:	r313752
2017-02-21 09:33:21 +00:00
Alexander Motin
3b63a91d6d Do not blindly free completed ATIOs/INOTs on invalidation.
When LUN is disabled, SIM starts returning queued ATIOs/INOTs.  But at the
same time there can be some ATIOs/INOTs still carrying real new requests.
If we free those, SIM may leak some resources, forever expecting for any
response from us.  So try to be careful, separating ATIOs/INOTs carrying
requests which still must be processed, from ATIOs/INOTs completed with
errors which can be freed.

MFC after:	2 weeks
2017-02-21 06:10:11 +00:00
Justin Hibbits
27da2007da Correct the return value for pmap_change_attr()
pmap_change_attr() returns an error code, not a paddr.  This function is
currently unused for powerpc.

MFC after:	2 weeks
2017-02-21 05:08:07 +00:00
John Baldwin
150599be12 Consolidate statements to initialize files.
Previously, the first lines of various generated files from system call
tables were generated in two sections.  Some of the initialization was
done in BEGIN, and the rest was done when the first line was encountered.
The main reason for this split before r313564 was that most of the
initialization done in the second section depended on the $FreeBSD$ tag
extracted from the system call table.  Now that the $FreeBSD$ tag is no
longer used, consolidate all of the file initialization in the BEGIN
section.

This change was tested by confirming that the content of generated files
did not change.
2017-02-20 20:37:25 +00:00
Mateusz Guzik
13d2ef0f3a mtx: fix spin mutexes interaction with failed fcmpset
While doing so move recursion support down to the fallback routine.
2017-02-20 19:08:36 +00:00
Edward Tomasz Napierala
15cbcf4bab Add /proc/self/mounts to linprocfs; some linux binaries need it.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-02-20 17:33:25 +00:00
Edward Tomasz Napierala
1a2dbd1aa3 Simplify devfs_fsync() by removing it. This might also be a minor
optimization, as vn_isdisk() needs to lock a global mutex.

Reviewed by:	imp
Tested by:	pho
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9628
2017-02-20 16:18:33 +00:00
Edward Tomasz Napierala
5a49cd0099 Reimplement linux_arch_prctl() as a wrapper around sysarch(2).
This also adds support for LINUX_ARCH_SET_GS.

Reviewed by:	dchagin
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9372
2017-02-20 16:13:40 +00:00
Eric Badger
82a4538f31 Defer ptracestop() signals that cannot be delivered immediately
When a thread is stopped in ptracestop(), the ptrace(2) user may request
a signal be delivered upon resumption of the thread. Heretofore, those signals
were discarded unless ptracestop()'s caller was issignal(). Fix this by
modifying ptracestop() to queue up signals requested by the ptrace user that
will be delivered when possible. Take special care when the signal is SIGKILL
(usually generated from a PT_KILL request); no new stop events should be
triggered after a PT_KILL.

Add a number of tests for the new functionality. Several tests were authored
by jhb.

PR:		212607
Reviewed by:	kib
Approved by:	kib (mentor)
MFC after:	2 weeks
Sponsored by:	Dell EMC
In collaboration with:	jhb
Differential Revision:	https://reviews.freebsd.org/D9260
2017-02-20 15:53:16 +00:00
Stanislav Galabov
31735ccf8a etherswitch: Fix RT305x vlan group operation
Fix an issue which prevents proper operation (addition/removal of members)
of RT305x vlan groups.

Tested by:	yamori813@yahoo.co.jp

Submitted by:	yamori813@yahoo.co.jp (initial version)
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D9607
2017-02-20 08:10:41 +00:00
Adrian Chadd
46788bb1d2 [net80211] validate VHT IEs. 2017-02-20 04:04:59 +00:00
Adrian Chadd
ac0b7d3206 [net80211] teach the probe response routine to add VHT IEs as appropriate. 2017-02-20 04:02:50 +00:00
Adrian Chadd
7f19273c7c [net80211] fix up VHT IE comparison typo
Whilst here, add a comment that I need to validate VHT IEs.
2017-02-20 04:02:29 +00:00
Adrian Chadd
2023566223 [net80211] fix NULL pointer dereference in VHT operation in hostap mode.
The vht IEs are NULL at this point, so we shouldn't upgrade a node to VHT.
I'll fix the upgrade after this!

Tested:

* ath10k, hostap mode
2017-02-20 03:45:41 +00:00
Pedro F. Giffuni
4d24901ac9 sys/dev: Replace zero with NULL for pointers.
Makes things easier to read, plus architectures may set NULL to something
different than zero.

Found with:	devel/coccinelle
MFC after:	3 weeks
2017-02-20 03:43:12 +00:00
Adrian Chadd
617f8b101e [net80211] RX parameter shuffle in net80211 in preparation for 4x4 NICs and 160MHz channels.
* Migrate the rx_params stuff out from ieee80211_freebsd.h where it doesn't belong -
  this isn't freebsd specific anymore.

* Don't use a hard-coded number of chains in the ioctl header; now we can shuffle
  MAX_CHAINS around so it can be used in the right spot.

* Extend the signal/noisefloor levels in the mimo stats struct to userland to include
  the signal and noisefloor levels for each 20MHz slice of a 160MHz channel.

* Bump the number of EVM pilots in preparation for 4x4 and 160MHz channels.

Tested:

* ath(4), STA mode
* iwn(4), STA mode
* local ath10k port, STA mode

TODO:

* 11ax chips will come with 5GHz 8x8 hardware for lots of MU-MIMO - I'll re-bump it
  at that point.

Note:

* This breaks the driver and ifconfig ABI; please recompile  the kernel,
  ifconfig and wpa_supplicant/hostapd.
2017-02-20 02:08:08 +00:00
Konstantin Belousov
ecc6c515ab Apply noexec mount option for mmap(PROT_EXEC).
Right now the noexec mount option disallows image activators to try
execve the files on the mount point.  Also, after r127187, noexec
also limits max_prot map entries permissions for mappings of files
from such mounts, but not the actual mapping permissions.

As result, the API behaviour is inconsistent.  The files from noexec
mount can be mapped with PROT_EXEC, but if mprotect(2) drops execution
permission, it cannot be re-enabled later.  Make this consistent
logically and aligned with behaviour of other systems, by disallowing
PROT_EXEC for mmap(2).

Note that this change only ensures aligned results from mmap(2) and
mprotect(2), it does not prevent actual code execution from files
coming from noexec mount.  Such files can always be read into
anonymous executable memory and executed from there.

Reported by:	shamaz.mazum@gmail.com
PR:	217062
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-02-19 20:51:04 +00:00
Konstantin Belousov
901b55218f MFamd64 r313933: microoptimize pmap_protect_pte1().
Noted by:	alc
Tested by:	mmel
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-02-19 20:40:07 +00:00
Justin Hibbits
d9720179fd Add a driver for the RouterBoard RB800 User LED
This may work on other RouterBoard PPC platforms, but I don't have any to test
with.
2017-02-19 19:56:12 +00:00
Allan Jude
85c15ab853 improve PBKDF2 performance
The PBKDF2 in sys/geom/eli/pkcs5v2.c is around half the speed it could be

GELI's PBKDF2 uses a simple benchmark to determine a number of iterations
that will takes approximately 2 seconds. The security provided is actually
half what is expected, because an attacker could use the optimized
algorithm to brute force the key in half the expected time.

With this change, all newly generated GELI keys will be approximately 2x
as strong. Previously generated keys will talk half as long to calculate,
resulting in faster mounting of encrypted volumes. Users may choose to
rekey, to generate a new key with the larger default number of iterations
using the geli(8) setkey command.

Security of existing data is not compromised, as ~1 second per brute force
attempt is still a very high threshold.

PR:		202365
Original Research:	https://jbp.io/2015/08/11/pbkdf2-performance-matters/
Submitted by:	Joe Pixton <jpixton@gmail.com> (Original Version), jmg (Later Version)
Reviewed by:	ed, pjd, delphij
Approved by:	secteam, pjd (maintainer)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8236
2017-02-19 19:30:31 +00:00
Alan Cox
4b4c84cfc3 In pmap_enter(), set the PG_MANAGED flag on the new PTE in one place,
rather two places, and do so before the pmap lock is acquired.

Submitted by:	Yufeng Zhou <yz70@rice.edu>
Reviewed by:	kib
MFC after:	1 week
2017-02-19 18:00:57 +00:00
Edward Tomasz Napierala
cc5bbcb275 Add USB Mass Storage CTL frontend. This makes it possible
for USB OTG-capable hardware to implement device side of USB
Mass Storage, ie pretend it's a flash drive.  It's configured
in the same way as other CTL frontends, using ctladm(8)
or ctld(8).  Differently from usfs(4), all the configuration
can be done without rebuilding the kernel.

Testing and review is welcome.  Right now I'm still moving,
and I don't have access to my test environment, so I'm somewhat
reluctant to making larger changes to this code; on the other
hand I don't want to let it sit on Phab until my testing setup
is back, because I want to get it into 11.1-RELEASE.

Reviewed by:	emaste (cursory), wblock (man page)
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8787
2017-02-19 17:47:43 +00:00
Warner Losh
adc8145e6f Remove obsolete comment after prior rev. 2017-02-19 17:38:17 +00:00
Alexander Motin
950c5aca4a Remove dead mentions of CAM target mode APIs from drivers.
This makes grepping kernel for target mode implementation much easier.
2017-02-19 17:27:58 +00:00
Edward Tomasz Napierala
c6d57d3073 There are some Linux binaries that expect the system to obey the "addr"
parameter to mmap(2), even if MAP_FIXED is not explicitly specified.
Android ART is one example.  Implement bug compatibility for this case
in linuxulator.

Reviewed by:	dchagin@
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9373
2017-02-19 17:17:06 +00:00
Alexander Motin
91d226ca26 Remove broken remnants of obsolete INOT API.
MFC after:	2 weeks
2017-02-19 16:40:03 +00:00
Mateusz Guzik
b247fd395d locks: make trylock routines check for 'unowned' value
Since fcmpset can fail without lock contention e.g. on arm, it was possible
to get spurious failures when the caller was expecting the primitive to succeed.

Reported by:	mmel
2017-02-19 16:28:46 +00:00
Hans Petter Selasky
316e092a77 Make sure the thread constructor and destructor eventhandlers are
called for all threads belonging to a procedure. Currently the first
thread in a procedure is kept around as an optimisation step and is
never freed. Because the first thread in a procedure is never freed
nor allocated, its destructor and constructor callbacks are never
called which means per thread structures allocated by dtrace and the
Linux emulation layers for example, might be present for threads which
don't need these structures.

This patch adds a thread construction and destruction call for the
first thread in a procedure.

Tested:			dtrace, linux emulation
Reviewed by:		kib @
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-02-19 13:15:33 +00:00
Dmitry Chagin
486a06bdf0 Implement rt_tgsigqueueinfo system call used by glibc for pthread_sigqueue(3).
MFC after:	2 week
2017-02-19 07:38:11 +00:00
Konstantin Belousov
dab486441f MFamd64 r313933: microoptimize pmap_protect_pde().
Noted by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-02-19 06:14:33 +00:00
Alexander Motin
0d96562989 Missed addition to r313936.
CTIO waitq present only in ISP_TARGET_MODE.

MFC after:	2 weeks
2017-02-19 05:29:06 +00:00
Alexander Motin
09ddc7ad7d Move CTIO waitq from per-LUN to per-channel.
All resources lack of which may put CTIO into the queue are either
per-channel or potentially per-queue, but none of them are per-LUN.

This is a first step to fix live LUN disabling.  Before this change
any CTIOs held in a queue in time of disabling were just leaked.

MFC after:	2 weeks
2017-02-19 05:07:02 +00:00
Sean Bruno
38b7de95a1 Restore PBA setup for igb(4) class devices.
Do no write to PBA register on igb(4) devices unless we need
to make adjustments for the 82575 and jumbo frames.

Remove redundant LPE/~LPE assignments.

Move e1000_lv_jumbo_workaround_ich8lan() invokcation into a block
so that its not executed in the igb case.

Move em(4) class assignments of RCTL values to its own code block.

Adjust a few direct accesses of ifp->mtu to use accessor functions.

PR:		216734
Submitted by:	Kaho Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>
2017-02-19 05:06:29 +00:00
Konstantin Belousov
8403b5a129 Fix regression in r313898 on i386.
Use large enough type for calculation of mtrr physmask.  Typical
cpu_maxphyaddr is 36 or larger.

Reported and tested by:	sbruno
Sponsored by:	The FreeBSD Foundation
MFC after:	13 days
2017-02-19 03:57:41 +00:00
Konstantin Belousov
d9440197b4 Microoptimize amd64/pmap.c pmap_protect_pde().
For the loop that dirties vm_pages in case superpage was written to,
check the complete condition before the loop.

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-02-19 03:33:20 +00:00
Jason A. Harmening
e2a8d17887 Bring back r313037, with fixes for mips:
Implement get_pcpu() for amd64/sparc64/mips/powerpc, and use it to
replace pcpu_find(curcpu) in MI code.

Reviewed by:	andreast, kan, lidl
Tested by:	lidl(mips, sparc64), andreast(powerpc)
Differential Revision:	https://reviews.freebsd.org/D9587
2017-02-19 02:03:09 +00:00
Mateusz Guzik
5c5df0d99b locks: clean up trylock primitives
In particular thius reduces accesses of the lock itself.
2017-02-18 22:06:03 +00:00
Andrey V. Elsukov
fbed6d606a For translated packets do not adjust UDP checksum if it is zero.
In case when decrypted and decapsulated packet is an UDP datagram,
check that its checksum is not zero before doing incremental checksum
adjustment.

Reported by:	Eugene Grosbein
Tested by:	Eugene Grosbein
2017-02-18 19:53:37 +00:00
Ian Lepore
da1b1e8eca Add dtb files for Boundary Devices Nitrogen 6 family boards. FreeBSD runs
on a nitrogen6x quad 2gb, and is expected to run on all the imx6 boards in
the nitrogen6 family.
2017-02-18 18:31:42 +00:00
Ian Lepore
2f45dab71f Add definitions for the IEEE-1588 registers. 2017-02-18 18:27:28 +00:00
Ian Lepore
5002d69f9b Change the naming of imx{5,6} gpio pins to exactly match the names used in
the chip reference manuals: GPIOn_IOnn.
2017-02-18 18:24:03 +00:00
Dmitry Chagin
dddb7e7f25 Style(9), some XXX comments fix. No functional changes.
MFC after:	1 week
2017-02-18 10:01:17 +00:00
Dmitry Chagin
fa580e65c4 Initialize cap_rights before use.
MFC after:	1 week
2017-02-18 09:39:20 +00:00
Dmitry Chagin
56fba8e66b Finich r313684.
Convert linux_recv(), linux_send() and linux_accept() system call arguments
to the register_t type too.

PR:		217161
MFC after:	3 days
xMFC with:	r313284,r313285,r313684
2017-02-18 07:21:50 +00:00
Luiz Otavio O Souza
959bd29aa8 Spell VMXNET3_LEGACY_TX correctly.
Obtained from:	pfSense
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-02-18 06:18:14 +00:00
Alexander Motin
46511441fb Change XCOPY memory allocations.
Before this change XCOPY code could allocate memory in chunks up to 16-32MB
(VMware does XCOPY in 4MB chunks by default), that could be difficult for
VM subsystem to do due to KVA fragmentation, that sometimes created huge
allocation delays, blocking any I/O for respective LU for that time.

This change limits allocations down to TPC_MAX_IO_SIZE, which is 1MB now.
1MB is also not a cookie, but ZFS also can do that for large blocks, so
it should be less dramatic.  As drawback this increases CPU overhead, but
it still look acceptable comparing to time consumed by ZFS read/write.

MFC after:	1 week
2017-02-18 06:03:16 +00:00
Bryan Drewery
8e31b510b0 Fix panic with unlocked vnode to vrecycle().
MFC after:	2 weeks
2017-02-18 05:07:53 +00:00
Mateusz Guzik
a24c8eb847 mtx: plug the 'opts' argument when not used 2017-02-18 01:52:10 +00:00
Andriy Voskoboinyk
ce017db11c iwi, ral, zyd: fix possible use-after-free.
MFC after:	5 days
2017-02-17 23:20:22 +00:00
Konstantin Belousov
83ebde953c Rely on CPUID feature only to enable attaching. MTRR are architectural
and there is no reason to check cpu family or vendor.

Noted by:   royger
Reviewed by: jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D9657
2017-02-17 22:50:41 +00:00
Konstantin Belousov
befb38bf9a smp_rendezvous() works for UP case as well, reduce duplicated
code.  Also fix cast and remove unneeded XXX in comment.

Noted and reviewed by: jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D9657
2017-02-17 22:49:52 +00:00
Mateusz Guzik
936a2c763e sx: fix mips builld after r313855
The namespace in this file really needs cleaning up. In the meantime
let inline primitives be defined as long as LOCK_DEBUG is not enabled.

Reported by:	kib
2017-02-17 22:09:55 +00:00
Sean Bruno
9c030a21d0 Push max_frame_len back into iflib so that jumbo frame sizes work.
Reported by:	pho
2017-02-17 21:30:16 +00:00
Brooks Davis
621c56330d Enable capsicum on MALTA kernels.
This adds less that 10K to the kernel and should probably be done in the
other std.* configs.
2017-02-17 21:25:24 +00:00
Konstantin Belousov
b1fa987835 Merge i386 and amd64 mtrr drivers.
Reviewed by:	royger, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D9648
2017-02-17 21:08:32 +00:00
Pedro F. Giffuni
b624457280 ext2fs: Remove unused assignment.
Value is re-assigned a few lines later without being read.

Found by:	Clang static analyzer
MFC after:	1 week
2017-02-17 20:56:43 +00:00
Kenneth D. Merry
e9200a6cc2 Make ctl(4) build with CTL_IO_DELAY defined.
sys/cam/ctl/ctl.c:
	In ctl_datamove(), inside CTL_IO_DELAY, add a lun variable and fill
	it in before trying to dereference it.

MFC after:	3 days
Sponsored by:	Spectra Logic
2017-02-17 20:15:27 +00:00
Adrian Chadd
109e2d29cc [asmc] Add support for MacBook Pro 11,2
This patch will add support for MacBookPro 11.2.
For the macros, the MBP11_* macros (for the existing MacBookPro11.3) did not
match so they have been renamed to MBP113_* and a new MBP112_* has been
added (modified copy of MBP11_*).

Some trailing whitespaces may have been removed automatically.

PR:		kern/214836
Obtained from:	Johannes Lundberg <johannes@brilliantservice.co.jp
2017-02-17 18:49:18 +00:00