Commit Graph

115849 Commits

Author SHA1 Message Date
Eric van Gyzen
8a8bea603c Fix grammar in some comments in subr_sleepqueue.c
While I'm here, remove trailing whitespace.

Reviewed by:	kib, mostly, as part of a larger review
MFC after:	3 days
2017-03-03 21:03:28 +00:00
Mark Johnston
7813302434 Fix a ticks comparison in sched_pctcpu_update().
We may fail to reset the %CPU tracking window if a thread does not run
for over half of the ticks rollover period, resulting in a bogus %CPU
value for the thread until ticks fully rolls over. Handle this by comparing
the unsigned difference ticks - ts_ltick with SCHED_TICK_TARG instead.

Reviewed by:	cem, jeff
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-03 20:57:40 +00:00
Mark Johnston
a0bbf9e0e3 Reject userland CCBs that have CAM_UNLOCKED set.
CAM_UNLOCKED is internal flag and cannot correctly be set by userland.
Return EINVAL from CAMIOCOMMAND and CAMIOQUEUE if it is set.

Also fix leaks in some of the error paths for CAMIOQUEUE.

PR:		215356
Reviewed by:	ken, mav
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9869
2017-03-03 20:51:57 +00:00
Andrey V. Elsukov
43b294a4db Fix matching table entry value. Use real table value instead of its index
in valuestate array.

When opcode has size equal to ipfw_insn_u32, this means that it should
additionally match value specified in d[0] with table entry value.
ipfw_table_lookup() returns table value index, use TARG_VAL() macro to
convert it to its value. The actual 32-bit value stored in the tag field
of table_value structure, where all unspecified u32 values are kept.

PR:		217262
Reviewed by:	melifaro
MFC after:	1 week
Sponsored by:	Yandex LLC
2017-03-03 20:22:42 +00:00
Jung-uk Kim
0d84335f99 Merge ACPICA 20170303. 2017-03-03 18:56:15 +00:00
Hans Petter Selasky
1f827dab9e Update the LinuxKPI RCU and SRCU wrappers for the concurrency kit, CK.
- Optimise the RCU implementation to not allocate and free
ck_epoch_records during runtime. Instead allocate two sets of
ck_epoch_records per CPU for general purpose use. The first set is
only used for reader locks and the second set is only used for
synchronization and barriers and is protected with a regular mutex to
prevent simultaneous issues.

- Move the task structure away from the rcu_head structure and into
the per-CPU structures. This allows the size of the rcu_head structure
to be reduced down to the size of two pointers.

- Fix a bug where the linux_rcu_barrier() function only waited for one
per-CPU epoch record to be completed instead of all.

- Use a critical section or a mutex to protect ck_epoch_begin() and
ck_epoch_end() depending on RCU or SRCU type. All the ck_epoch_xxx()
functions, except ck_epoch_register(), ck_epoch_unregister() and
ck_epoch_recycle() are not re-entrant and needs a critical section or
a mutex to operate in the LinuxKPI, after inspecting the CK
implementation of the above mentioned functions. The simultaneous
issues arise from per-CPU epoch records being shared between multiple
threads depending on the amount of taskswitching and how many threads
are involved with the RCU and SRCU operations.

- Properly free all epoch records by using safe list traversal at
LinuxKPI module unload. It turns out the ck_epoch_recycle() always
have the records on an internal list and use a flag in the epoch
record to track allocated and free entries. This would lead to use
after free during module unload.

- Remove redundant synchronize_rcu() call from the
linux_compat_uninit() function. Let the linux_rcu_runtime_uninit()
function do the final rcu_barrier() instead.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-03-03 16:28:03 +00:00
Ruslan Bukin
6fd86cf752 Add FPGA manager driver for Intel Arria 10.
With this driver we able to program FPGA core from FreeBSD system
running on ARM core.

Sponsored by:	DARPA, AFRL
2017-03-03 14:19:37 +00:00
Ruslan Bukin
609a6315b7 Import latest vendor DTS files for Intel Arria 10. 2017-03-03 14:17:07 +00:00
Navdeep Parhar
401032c67d cxgbe/iw_cxgbe: Implement sq/rq drain operation.
ULPs can set a qp's state to ERROR and then post a work request on the
sq and/or rq.  When the reply for that work request comes back it is
guaranteed that all previous work requests posted on that queue have
been drained.

Obtained from:	Chelsio Communications
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-03-03 03:07:54 +00:00
Andriy Voskoboinyk
dfabbaa0e0 net80211: fix ieee80211_htrateset setup, return EINVAL for an unsupported
ucast/mcast/mgmt HT rate.

- Init global ieee80211_htrateset only once; neither ic_htcaps nor
ic_txstream is changed when device is attached;
- Move global ieee80211_htrateset structure to ieee80211com;
there was a possible data race when more than 1 wireless device is
used simultaneously;
- Discard unsupported rates in ieee80211_ioctl_settxparams(); otherwise,
an unsupported value may break connectivity (actually,
'ifconfig wlan0 ucastrate 8' for RTL8188EU results in immediate
disconnect + infinite 'device timeout's after it).

Tested with:
 - Intel 6205, STA mode.
 - RTL8821AU, STA mode.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D9871
2017-03-03 01:06:27 +00:00
Martin Matuska
0132c9cd4a Fix null pointer dereference in zfs_freebsd_setacl().
Prevents unprivileged users from panicking the kernel by calling
__acl_delete_*() on files or directories inside a ZFS mount.

MFC after:	3 days
2017-03-02 23:23:28 +00:00
Ed Maste
e052a8b932 kern_sig.c: ANSIfy and remove archaic register keyword
Sponsored by:	The FreeBSD Foundation
2017-03-02 22:17:53 +00:00
Dimitry Andric
ed085b68ab Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
4.0.0 (branches/release_40 296509).  The release will follow soon.

Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
support to build; see UPDATING for more information.

Also note that as of 4.0.0, lld should be able to link the base system
on amd64 and aarch64.  See the WITH_LLD_IS_LLD setting in src.conf(5).
Though please be aware that this is work in progress.

Release notes for llvm, clang and lld will be available here:
<http://releases.llvm.org/4.0.0/docs/ReleaseNotes.html>
<http://releases.llvm.org/4.0.0/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/4.0.0/tools/lld/docs/ReleaseNotes.html>

Thanks to Ed Maste, Jan Beich, Antoine Brodin and Eric Fiselier for
their help.

Relnotes:	yes
Exp-run:	antoine
PR:		215969, 216008
MFC after:	1 month
2017-03-02 20:49:40 +00:00
Konstantin Belousov
fe0a8a3994 Style.
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2017-03-02 17:35:13 +00:00
Ruslan Bukin
6fa2cb00ec Fix build: include machine/bus.h before uart.h
Reported by:	emaste
Sponsored by:	DARPA, AFRL
2017-03-02 17:09:14 +00:00
Alexander Motin
82f7fa7ae6 Inline some trivial wrapper functions.
MFC after:	2 weeks
2017-03-02 16:14:15 +00:00
Hans Petter Selasky
403f4a31ab Implement taskqueue_poll_is_busy() for use by the LinuxKPI.
Refer to comment above function for a detailed description.

Discussed with:		kib @
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-03-02 12:20:23 +00:00
Alexander Motin
6d1ccf40cc Execute last ZIO of log commit synchronously.
For short transactions overhead of context switch can be too large.
Skipping it gives significant latency reduction.  For large ones,
including multiple ZIOs, latency is less critical, while throughput
there may become limited by checksumming speed of single CPU core.
To get best of both cases, execute last ZIO directly from calling
thread context to save latency, while all others (if there are any)
enqueue to taskqueues in traditional way.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2017-03-02 07:55:47 +00:00
Alexander Motin
e93f9c7708 Completely skip cache flushing for not supporting log devices.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2017-03-02 07:50:06 +00:00
Dexuan Cui
985455c0cc loader.efi: reduce the size of the staging area if necessary
The loader assumes physical memory in [2MB, 2MB + EFI_STAGING_SIZE)
is Conventional Memory, but actually it may not, e.g. in the case
of Hyper-V Generation-2 VM (i.e. UEFI VM) running on Windows
Server 2012 R2 host, there is a BootServiceData memory block at
the address 47.449MB and the memory is not writable.

Without the patch, the loader will crash in efi_copy_finish():
see PR 211746.

The patch verifies the end of the staging area, and reduces its
size if necessary. This way, the loader will not try to write into
the BootServiceData memory any longer.

Thank Marcel Moolenaar for helping me on this issue!

The patch also allocates the staging area in the first 1GB memory.
See the comment in the patch for this.

PR:		211746
Reviewed by:	marcel, kib, sephe
Approved by:	sephe (mentor)
MFC after:	2 weeks
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D9686
2017-03-02 07:25:50 +00:00
Oleksandr Tymoshenko
a5d8db32f8 [intelspi][bytgio] Fix buildworld with MODULES_WITH_WORLD set
Add opt_platform.h and opt_acpi.h to the dependencies so modules can be
built as a part of buildworld when MODULES_WITH_WORLD is set

Reported by:	Andre Albsmeier (for 11-stable)
MFC after:	1 day
2017-03-02 03:19:39 +00:00
Dimitry Andric
e1bb2a8264 Bump __FreeBSD_version, and set tentative merge date. 2017-03-01 21:58:26 +00:00
Dimitry Andric
ca6e5d9882 Merge ^/head r314482 through r314522. 2017-03-01 21:55:49 +00:00
Navdeep Parhar
f52a45c98e cxgbe/iw_cxgbe: Do not check the size of the memory region being
registered.  T4/5/6 have no internal limit on this size.  This is
probably a copy paste from the T3 iw_cxgb driver.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-03-01 20:23:21 +00:00
Andrey V. Elsukov
576429f04b Fix NPTv6 rule counters when one_pass is not enabled.
Consider the rule matching when both @done and @retval values
returned from ipfw_run_eaction() are zero. And modify ipfw_nptv6()
to return IP_FW_DENY and @done=0 when addresses do not match.

Obtained from:	Yandex LLC
Sponsored by:	Yandex LLC
2017-03-01 20:00:19 +00:00
Pedro F. Giffuni
8a13944bc7 Split the ficl CFLAGS when they refer to an arch-specific include path.
This is a minimal attempt to keep consistency in the Makefiles so that
moving ficl to somwehere like contrib will be less error prone.

MFC after:	1 week
2017-03-01 19:36:32 +00:00
Toomas Soome
d8b59bf47d loader: r314112 did introduce dereference freed pointer entry
CID: 1371675
Reported by:	Coverity
Reviewed by:	jhb, allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D9846
2017-03-01 19:02:43 +00:00
Sean Bruno
d945ed6472 Make gtaskqueue compatible with drm-next such that they can be used with the
linuxkpi tasklets.

Submitted by:	mmacy@nextbsd.org
Reported by:	hps
2017-03-01 18:37:35 +00:00
Andrey V. Elsukov
19b60f70c0 Do not invoke the resize event when previous provider's size was zero.
This is similar to r303637 fix for geom_disk.

Reported by:	avg
Tested by:	avg
MFC after:	1 week
2017-03-01 18:03:32 +00:00
Alexander Motin
9d42b1fc43 Add check missed in r314257.
MFC after:	11 days
2017-03-01 17:35:56 +00:00
Konstantin Belousov
27f333125b Add some explanation for SV_TIMEKEEP flag.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2017-03-01 12:10:24 +00:00
Konstantin Belousov
ef130ff64c With the removal of IA64, the only arch which uses ia32 compat is amd64.
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-03-01 11:39:29 +00:00
Ruslan Bukin
10102d1ce4 Set USB OTG mode to host (missed in vendor DTS for some reason).
Sponsored by:	DARPA, AFRL
2017-03-01 10:55:12 +00:00
Konstantin Belousov
55b985b43b Use vm_map_insert() instead of vm_map_find() in elf_map_insert().
Elf_map_insert() needs to create mapping at the known fixed address.
Usage of vm_map_find() assumes, on the other hand, that any suitable
address space range above or equal the specified hint, is acceptable.
Due to operating on the fresh or cleared address space, vm_map_find()
usually creates mapping starting exactly at hint.

Switch to vm_map_insert() use to clearly request fixed mapping from
the VM.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-03-01 10:28:15 +00:00
Konstantin Belousov
e3d8f8fed4 When deallocating the vm object in elf_map_insert() due to
vm_map_insert() failure, drop the vnode lock around the call to
vm_object_deallocate().

Since the deallocated object is the vm object of the vnode, we might
get the vnode lock recursion there.  In fact, it is almost impossible
to make vm_map_insert() failing there on stock kernel.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-03-01 10:22:07 +00:00
Sepherosa Ziehau
920adec330 hyperv/hn: Misaligned chimney sending buffers should not be used
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D9714
2017-03-01 09:05:12 +00:00
Sepherosa Ziehau
7675868a04 hyperv/hn: Make sure that RNDIS packet message is at least 4B aligned.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D9713
2017-03-01 08:50:41 +00:00
Sepherosa Ziehau
8fe90f73ae hyperv/hn: Simplify RNDIS packet total length calculation.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D9712
2017-03-01 08:24:17 +00:00
Dimitry Andric
348238dbd4 Merge ^/head r314420 through r314481. 2017-03-01 08:22:51 +00:00
Warner Losh
1d3e57669e Add kernel support for the TP-LINK MR3040.
Submitted by:	Chris Christensen <cchristensen@llnw.com>
Pull Request:	https://github.com/freebsd/freebsd/pull/38
2017-03-01 05:53:53 +00:00
Warner Losh
607a4c520e Back out r314471. In https://reviews.freebsd.org/D1858 it was clear
that this shouldn't go in. I was unaware when I merged the pull
request. I don't wish to upset the status quo, so backout per
project practice.

Pull Request:	https://github.com/freebsd/freebsd/pull/92
Noted by:	hrs@
2017-03-01 05:38:04 +00:00
Warner Losh
9417c448f8 Fixed TCO v3 tick convert
TCO v3's internal timer is stored as seconds.

Submitted by:	Denir Li <denir-li@users.noreply.github.com>
Pull Request:	https://github.com/freebsd/freebsd/pull/51
Pull Request:	https://github.com/freebsd/freebsd/pull/52
2017-03-01 05:18:43 +00:00
Mateusz Guzik
51abf0d5e3 locks: fix compilation with KTR wihout KTR_LOCKS
While here wrap the overly long line.

Reported by:	np
2017-03-01 05:18:22 +00:00
Mateusz Guzik
a21018063b locks: ensure proper barriers are used with atomic ops when necessary
Unclear how, but the locking routine for mutexes was using the *release*
barrier instead of acquire. This must have been either a copy-pasto or bad
completion.

Going through other uses of atomics shows no barriers in:
- upgrade routines (addressed in this patch)
- sections protected with turnstile locks - this should be fine as necessary
  barriers are in the worst case provided by turnstile unlock

I would like to thank Mark Millard and andreast@ for reporting the problem and
testing previous patches before the issue got identified.

ps.
  .-'---`-.
,'          `.
|             \
|              \
\           _  \
,\  _    ,'-,/-)\
( * \ \,' ,' ,'-)
 `._,)     -',-')
   \/         ''/
    )        / /
   /       ,'-'

Hardware provided by: IBM LTC
2017-03-01 05:06:21 +00:00
Warner Losh
7d85b06ecf Fix VNET - DAD detected duplicate IPv6 address
Assign a hopefully unique, locally administered etheraddr. - for
epairNa & epairNb

Submitted by:	Catalin <sslevil@users.noreply.github.com>
Pull Request:	https://github.com/freebsd/freebsd/pull/92
2017-03-01 04:47:22 +00:00
Warner Losh
2ab05547d3 Update tw_cl_share.h to allow 255 LUNs
TW_CL_MAX_NUM_LUNS should not be 16 but I presume 255. I have a 3ware
controller with more than 16 volumes (LUN's) and otherwise all LUN's
above the 16'th are not working.

Submitted by:	jcatrysse <j.catrysse@proximedia.be>
Pull Request:	https://github.com/freebsd/freebsd/pull/100
2017-03-01 04:40:57 +00:00
Warner Losh
450ba47a5d Make wsp process a single touchpad tap and interpret it as a
left-click event.  It can be disabled setting the new
hw.usb.wsp.enable_single_tap_clicks sysctl to 0.

Submitted by:	K Staring <qdk@quickdekay.net>
Pull Request:	https://github.com/freebsd/freebsd/pull/97
2017-03-01 04:27:58 +00:00
Warner Losh
43b96a4eb5 Revert prior commit to restore the files mangled by my "fixing" merge
conflicts for a git rebase I tried to do.
2017-03-01 02:10:40 +00:00
Warner Losh
59b34b3404 strstr.c was inadvertently blasted with a copy of isa_nmi.c. Revert
and remove clause 3 while I'm here.
2017-03-01 02:07:51 +00:00
Andriy Voskoboinyk
7ab1926316 iwn: fix data rate parsing for Rx radiotap header.
Tested with Intel 6205, MONITOR mode + RTL8188EU, STA mode.
2017-03-01 00:42:38 +00:00