Commit Graph

114423 Commits

Author SHA1 Message Date
Emmanuel Vadot
bbd72acb3b clk_div: Add a div lookup table
Some clocks on SoC have a diff between the value written in the register
and the real divider.
Add a table that where we can lookup the real value of the divider.

Reviewed by:	mmel (earlier revision)
Differential Revision:	https://reviews.freebsd.org/D8728
2016-12-12 16:43:31 +00:00
Mateusz Guzik
5afb134c32 vfs: add vrefact, to be used when the vnode has to be already active
This allows blind increment of relevant counters which under contention
is cheaper than inc-not-zero loops at least on amd64.

Use it in some of the places which are guaranteed to see already active
vnodes.

Reviewed by:	kib (previous version)
2016-12-12 15:37:11 +00:00
Jayachandran C.
3ce73b2662 Fix gic_cpu_mask() calculation in ARM GIC
r309616 changed the definition of GICD_ITARGETSR(n) to take the irq
id as argument, but the usage of the macro in gic_cpu_mask() was not
updated to reflect this. This causes the cpu mask to be computed
incorrectly.

Update the GICD_ITARGETSR() call to fix this, this fixes a hang seen
while booting freebsd on qemu-system-aarch64 with SMP enabled.
2016-12-12 15:35:57 +00:00
Edward Tomasz Napierala
223cb0e434 Avoid dereferencing NULL pointers in devtoname(). I've seen it panic,
called from ufs_print() in DDB.

MFC after:	1 month
2016-12-12 15:22:21 +00:00
Jayachandran C.
7d9082cafa Increase interrupt cells in generic_pcie_fdt_route_interrupt
ARM GIC specification in device trees use 3 cells, so the current
limit of 2 causes the last cell to be dropped. This in turn can
cause the interrupt polarity and trigger settings to be incorrect.

Increase the limit to 4 which should handle all reasonable cases.
This fixes issues seen in QEMU when registering PCI interrupts.
2016-12-12 15:17:56 +00:00
Andrey V. Elsukov
8a030e9c6e Modify IPv6 statistic accounting in ip6_input().
Add rcvif local variable to keep inbound interface pointer. Count
ifs6_in_discard errors in all "goto bad" cases. Now it will count
errors even if mbuf was freed. Modify all places where m->m_pkthdr.rcvif
is used to use local rcvif variable.

Obtained from:	Yandex LLC
MFC after:	1 month
2016-12-12 11:26:59 +00:00
Konstantin Belousov
778aa66a68 Enable lookup_cap_dotdot and lookup_cap_dotdot_nonlocal.
Requested and reviewed by:	cem
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D8746
2016-12-12 11:12:04 +00:00
Konstantin Belousov
545d312293 When a zombie gets reparented due to the parent exit, send SIGCHLD to
the reaper.

The traditional reaper init(8) is aware of zombies silently reparented
to it after the parents exit, it loops around waitpid(2) to collect
them.  For other reapers, the silent reparenting is surprising and
collecting zombies requires a thread blocking in waitpid(2) just for
that purpose.  It seems that sending second SIGCHLD is a better
workaround than forcing all reapers to obey the setup.

Reported by:	 Michael Zuo <muh.muhten@gmail.com>, jilles
PR:	213928
Reviewed by:	jilles (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-12-12 11:11:50 +00:00
Andrey V. Elsukov
5a1842a24a Add ip6_tryforward() - a run to completion forwarding implementation
for IPv6.

It gets performance benefits from reduced number of checks. It doesn't
copy mbuf to be able send ICMPv6 error message, because it keeps mbuf
unchanged until the moment, when the route decision has been made.
It doesn't do IPsec checks, and when some IPsec security policies present,
ip6_input() uses normal slow path.

Reviewed by:	bz, gnn
Obtained from:	Yandex LLC
MFC after:	1 month
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D8527
2016-12-12 10:57:32 +00:00
Sepherosa Ziehau
6c1204df36 hyperv/hn: Add polling support
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8739
2016-12-12 05:18:03 +00:00
Sepherosa Ziehau
b99113a1c1 hyperv/vmbus: Add channel polling support.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8738
2016-12-12 05:04:55 +00:00
Hiren Panchasara
b6ff672460 We currently don't do TSO if ip options are present. In case of IPv6, we look at
in6p_options to check that. That is incorrect as we carry ip options in
in6p_outputopts. Also, just checking for in6p_outputopts being NULL won't
suffice as we combine ip options and ip header fields both in that one field.
The commit fixes this by using ip6_optlen() which correctly calculates length
of only ip options for IPv6.

Reviewed by:	    ae, bz
MFC after:	    3 weeks
Sponsored by:	    Limelight Networks
2016-12-11 23:14:47 +00:00
Alexander Motin
2823b6467a Postpone ZVOL media/block size caching till first open.
At least on FreeBSD there are no legal way to access media or get its
size without opening device/provider first.  Postponing this caching
allows to skip several disk seeks per ZVOL/snapshot during import.

For HDD pool with 1 ZVOL in dev mode with 1000 snapshots this reduces
pool import time from 40 to 10 seconds.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2016-12-11 19:50:39 +00:00
Alan Cox
2d612d2dd2 When tmpfs and POSIX shm pagein a page for the sole purpose of performing
truncation, immediately queue the page for asynchronous laundering rather
than making the page pass through inactive queue first.

Reviewed by:	kib, markj
2016-12-11 19:24:41 +00:00
Konstantin Belousov
5ab0f0c3f0 Prefix hex memory addresses with 0x in diagnostic messages from the
SRAT parser.

Submitted by:	Oliver Pinter
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D8750
2016-12-11 19:01:27 +00:00
Andriy Voskoboinyk
ef06a176eb rsu: fix and enable Rx TCP checksum offloading.
Tested with Asus USB-N10, STA mode.
2016-12-11 17:15:25 +00:00
Michael Tuexen
8b9c95f4a9 Ensure that the reported ppid and tsn are taken from the first fragment.
This fixes a bug where the wrong ppid was reported, if
* I-DATA was used on the first fragement was not received first
* DATA was used and different ppids where used.

Thanks to Julian Cordes for making me aware of the issue.

MFC after:	1 week
2016-12-11 13:26:35 +00:00
Andriy Voskoboinyk
14a8d2f995 rsu: various initialization fixes.
- Do not ignore initialization errors; call ieee80211_stop()
when initialization failed.
- Use usb_pause_mtx() instead of DELAY() while waiting for firmware
loading; this fixes system freeze during firmware startup.
- Do not execute rsu_stop() when device is powered off; fixes
'unknown board type (rfconfig=0xff)' error when the device is
reattached.

Tested with Asus USB-N10.
2016-12-10 22:31:49 +00:00
Alexander Motin
2fb5d72d58 Add missed vfs.zfs.zfetch.max_idistance sysctl. 2016-12-10 21:19:27 +00:00
Andriy Voskoboinyk
88c2e36adb rsu: use bitmap for all debug messages.
- Replace all remaining DPRINTF(N)'s with RSU_DPRINTF.
- Add new RSU_DEBUG_USB flag to track error codes returned by
usbd_do_request_flags().
- Improve few messages.
2016-12-10 20:19:57 +00:00
Andriy Voskoboinyk
f06ccf881e rsu: add promiscuous mode support.
- Add partial promiscuous mode support (no management frames;
they cannot be received by the firmware and net80211 at the same time).
- Add monitor mode support (all frames).

Tested with Asus, USB-N10.
2016-12-10 18:47:13 +00:00
Oleksandr Tymoshenko
4af79d4f2b [evdev] Adds evdev support to sysmouse(4) driver
For horizontal (T-axis) wheel reporting which is not supported by
sysmouse protocol kern.evdev.sysmouse_t_axis sysctl is introduced.
It can take following values:

0 - no T-axis events (default)
1 - T-axis events are originated in ums(4) driver.
2 - T-axis events are originated in psm(4) driver.

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8597
2016-12-10 18:07:16 +00:00
Oleksandr Tymoshenko
c837b8e35f [iwn] Perform BUS_DMASYNC_PREREAD when initializing RX buffer
BUS_DMASYNC_PREREAD is required when setting up RX buffer, otherwise
data provided by card can be overwritten by data evicted from cache

Also use proper tag when setting up RX descriptor

Reviewed by:	adrian, avos, ivadasz
Differential Revision:	https://reviews.freebsd.org/D8717
2016-12-10 17:59:34 +00:00
Andriy Voskoboinyk
7a4575d0b5 rsu: increase Rx buffer size from 8k to 30k.
This is required for USB Rx aggregation
(and fixes 'could not allocate RX mbuf' / few other failures).

While here, reduce the number of Rx buffers from 100 to 1 -
the driver never uses more than one Rx buffer.

Tested with Asus USB-N10.
2016-12-10 17:06:55 +00:00
Konrad Witaszczyk
480f31c214 Add support for encrypted kernel crash dumps.
Changes include modifications in kernel crash dump routines, dumpon(8) and
savecore(8). A new tool called decryptcore(8) was added.

A new DIOCSKERNELDUMP I/O control was added to send a kernel crash dump
configuration in the diocskerneldump_arg structure to the kernel.
The old DIOCSKERNELDUMP I/O control was renamed to DIOCSKERNELDUMP_FREEBSD11 for
backward ABI compatibility.

dumpon(8) generates an one-time random symmetric key and encrypts it using
an RSA public key in capability mode. Currently only AES-256-CBC is supported
but EKCD was designed to implement support for other algorithms in the future.
The public key is chosen using the -k flag. The dumpon rc(8) script can do this
automatically during startup using the dumppubkey rc.conf(5) variable.  Once the
keys are calculated dumpon sends them to the kernel via DIOCSKERNELDUMP I/O
control.

When the kernel receives the DIOCSKERNELDUMP I/O control it generates a random
IV and sets up the key schedule for the specified algorithm. Each time the
kernel tries to write a crash dump to the dump device, the IV is replaced by
a SHA-256 hash of the previous value. This is intended to make a possible
differential cryptanalysis harder since it is possible to write multiple crash
dumps without reboot by repeating the following commands:
# sysctl debug.kdb.enter=1
db> call doadump(0)
db> continue
# savecore

A kernel dump key consists of an algorithm identifier, an IV and an encrypted
symmetric key. The kernel dump key size is included in a kernel dump header.
The size is an unsigned 32-bit integer and it is aligned to a block size.
The header structure has 512 bytes to match the block size so it was required to
make a panic string 4 bytes shorter to add a new field to the header structure.
If the kernel dump key size in the header is nonzero it is assumed that the
kernel dump key is placed after the first header on the dump device and the core
dump is encrypted.

Separate functions were implemented to write the kernel dump header and the
kernel dump key as they need to be unencrypted. The dump_write function encrypts
data if the kernel was compiled with the EKCD option. Encrypted kernel textdumps
are not supported due to the way they are constructed which makes it impossible
to use the CBC mode for encryption. It should be also noted that textdumps don't
contain sensitive data by design as a user decides what information should be
dumped.

savecore(8) writes the kernel dump key to a key.# file if its size in the header
is nonzero. # is the number of the current core dump.

decryptcore(8) decrypts the core dump using a private RSA key and the kernel
dump key. This is performed by a child process in capability mode.
If the decryption was not successful the parent process removes a partially
decrypted core dump.

Description on how to encrypt crash dumps was added to the decryptcore(8),
dumpon(8), rc.conf(5) and savecore(8) manual pages.

EKCD was tested on amd64 using bhyve and i386, mipsel and sparc64 using QEMU.
The feature still has to be tested on arm and arm64 as it wasn't possible to run
FreeBSD due to the problems with QEMU emulation and lack of hardware.

Designed by:	def, pjd
Reviewed by:	cem, oshogbo, pjd
Partial review:	delphij, emaste, jhb, kib
Approved by:	pjd (mentor)
Differential Revision:	https://reviews.freebsd.org/D4712
2016-12-10 16:20:39 +00:00
Andriy Voskoboinyk
88e8709ef1 rsu: add TSF field into Rx radiotap.
Tested with Asus USB-N10.
2016-12-10 13:30:16 +00:00
George V. Neville-Neil
c2e34f488c This adds a configuration for arm64 users that track CURRENT but
don't need the extra debug facilities.  Copied from the amd64
configuration of the same name.

Submitted by: Nikolai Lifanov
Reviewed by: emaste
MFC after: 2 weeks
2016-12-10 10:00:27 +00:00
Poul-Henning Kamp
34feb2d2cb Add Genesys Logic USB hub.
Make two other USB hub descriptions more precise.
2016-12-10 09:10:48 +00:00
Marcel Moolenaar
aa8c6a6dca Improve upon r309394
Instead of taking an extra reference to deal with pfsync_q_ins()
and pfsync_q_del() taken and dropping a reference (resp,) make
it optional of those functions to take or drop a reference by
passing an extra argument.

Submitted by:	glebius@
2016-12-10 03:31:38 +00:00
Mark Johnston
f99a517272 Don't create FBT probes for lock owner methods.
These functions may be called in DTrace probe context, so they cannot be
safely traced. Moreover, they are currently only used by DTrace, so their
corresponding FBT probes are not particularly useful.

MFC after:	2 weeks
2016-12-10 03:13:11 +00:00
Mark Johnston
8bb9b7f17a Consistently use fbt_excluded() on all architectures.
MFC after:	2 weeks
2016-12-10 03:11:05 +00:00
Mark Johnston
02315a6759 Use a consistent snapshot of the lock state in owner_mtx().
MFC after:	2 weeks
2016-12-10 02:59:34 +00:00
Mark Johnston
c365a2934e Return a non-NULL owner only if the lock is exclusively held in owner_sx().
Fix some whitespace bugs while here.

MFC after:	2 weeks
2016-12-10 02:56:44 +00:00
Warner Losh
8bece6062d Permit loading of efirt module even when there's no EFI to call. The
module loading is successful, but attempts to use it will not be
successful. This is similar to what we do (did?) with ACPI on non-ACPI
systems. We succeed if we can't find the necessary information to hook
into EFI, but still fail if we're unable to allocate resources if we
do find EFI.

Not Objected to by: kib@
MFC Afer: 3 days
2016-12-09 23:37:11 +00:00
Gleb Smirnoff
255003da42 Allow bogus_page to be passed to pager(s). 2016-12-09 21:21:24 +00:00
Gleb Smirnoff
8c70a35334 Fix build for 32-bit machines.
Submitted by:	tuexen
2016-12-09 20:50:35 +00:00
Gleb Smirnoff
5040da77c1 Use acquire write to cr_lock to complement with release write at end
of locked region.

Submitted by:	kib
2016-12-09 19:07:31 +00:00
Mark Johnston
90458813cd Conditionalize PG_CACHE sysctls on COMPAT_FREEBSD11.
Reviewed by:	glebius, imp, jhb
Differential Revision:	https://reviews.freebsd.org/D8736
2016-12-09 18:55:27 +00:00
Mark Johnston
7f68a896dc Add a COMPAT_FREEBSD11 kernel option.
Use it wherever COMPAT_FREEBSD10 is currently specified.

Reviewed by:	glebius, imp, jhb
Differential Revision:	https://reviews.freebsd.org/D8736
2016-12-09 18:54:12 +00:00
Gleb Smirnoff
f98751499c Treat R_X86_64_PLT32 relocs as R_X86_64_PC32.
If we load a binary that is designed to be a library, it produces
relocatable code via assembler directives in the assembly itself
(rather than compiler options).  This emits R_X86_64_PLT32 relocations,
which are not handled by the kernel linker.

Submitted by:	gallatin
Reviewed by:	kib
2016-12-09 18:07:28 +00:00
Gleb Smirnoff
296d65b7a9 Backout accidentially leaked in r309746 not yet reviewed patch :( 2016-12-09 18:00:45 +00:00
Gleb Smirnoff
3cbee8caa1 Use counter_ratecheck() in the ICMP rate limiting.
Together with:	rrs, jtl
2016-12-09 17:59:15 +00:00
Gleb Smirnoff
169170209c Provide counter_ratecheck(), a MP-friendly substitution to ppsratecheck().
When rated event happens at a very quick rate, the ppsratecheck() is not
only racy, but also becomes a performance bottleneck.

Together with:	rrs, jtl
2016-12-09 17:58:34 +00:00
Michael Tuexen
ebecdad811 Don't bundle a SACK chunk with a SHUTDOWN chunk if it is not required.
MFC after:	1 week
2016-12-09 17:58:07 +00:00
Michael Tuexen
8d0a31e19c Don't send multiple SHUTDOWN chunks in a single packet.
Thanks to Felix Weinrank for making me aware of this issue.

MFC after:	1 week
2016-12-09 17:57:17 +00:00
Ruslan Bukin
d9121bf564 Add registers for jz4780 audio and PDMA controllers.
Sponsored by:	DARPA, AFRL
2016-12-09 17:16:09 +00:00
Hans Petter Selasky
12af734d32 Add more LinuxKPI PCI definitions.
Obtained from:	kmacy @
Sponsored by:	Mellanox Technologies
MFC after:	1 week
2016-12-09 15:05:09 +00:00
Hans Petter Selasky
1724ded49c Prefer function macros over regular macros in the LinuxKPI.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-12-09 15:01:37 +00:00
Hans Petter Selasky
be48ab92ac Avoid malloc() warnings when using the LinuxKPI by zero-checking
the allocation flags.

Obtained from:		kmacy @
Sponsored by:           Mellanox Technologies
MFC after:		1 week
2016-12-09 14:06:22 +00:00
Hans Petter Selasky
0a61267a99 MSIX can support more than 256 IRQs. Make sure the invalid IRQ number
set in the LinuxKPI is big enough.

Sponsored by:           Mellanox Technologies
MFC after:		1 week
2016-12-09 13:53:31 +00:00
Hans Petter Selasky
e996b07c72 Prefix some _pci_xxx() functions in the Linux KPI with linux_ and make
sure the IRQ number used by these functions is unsigned.

Sponsored by:           Mellanox Technologies
MFC after:		1 week
2016-12-09 13:47:50 +00:00
Hans Petter Selasky
7fdce5c42b Prefix the Linux KPI's kmem_xxx() functions with linux_ to avoid
conflict with the opensolaris kernel module.

This patch solves a problem where the kernel linker will incorrectly
resolve opensolaris kmem_xxx() functions as linuxkpi ones, which leads
to a panic when these functions are used.

Submitted by:		gallatin @
Sponsored by:           Mellanox Technologies
MFC after:		1 week
2016-12-09 13:41:26 +00:00
Sepherosa Ziehau
4b167c2b4d hyperv/storvsc: Minor style changes; no functional changes.
Reported by:	rpokala
MFC after:	1 week
Sponsored by:	Microsoft
2016-12-09 06:18:12 +00:00
Sepherosa Ziehau
692cb24f10 hyperv/storvsc: Fix the SCSI disk attachment issue.
On pre-WS2016 Hyper-V, if the only LUNs > 7 are used, then all disks
fails to attach.  Mainly because those versions of Hyper-V do not set
SRB_STATUS properly and deliver junky INQUERY responses.

Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Reported by:	Hongxiong Xian <v-hoxian microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8724
2016-12-09 03:16:36 +00:00
Navdeep Parhar
b8c1ffef80 cxgbe(4): netmap does not set IFCAP_NETMAP in an ifnet's if_capabilities
any more (since r307394).  Do it in the driver instead.

MFC after:	1 week
2016-12-09 02:21:27 +00:00
Andriy Voskoboinyk
e1b3ed8f32 rsu: fix incorrect register addresses. 2016-12-08 20:54:54 +00:00
Luiz Otavio O Souza
8f1c8ade60 Fix the typos and style(9) in comment.
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-08 18:18:48 +00:00
Ruslan Bukin
4b3fae2c2d Add jz4780 internal codec initialization driver.
Sponsored by:	DARPA, AFRL
2016-12-08 16:28:34 +00:00
Alexander Motin
9373759d13 Fix spa_alloc_tree sorting by offset in r305331.
Original commit "7090 zfs should improve allocation order" declares alloc
queue sorted by time and offset.  But in practice io_offset is always zero,
so sorting happened only by time, while order of writes with equal time was
completely random.  On Illumos this did not affected much thanks to using
high resolution timestamps.  On FreeBSD due to using much faster but low
resolution timestamps it caused bad data placement on disks, affecting
further read performance.

This change switches zio_timestamp_compare() from comparing uninitialized
io_offset to really populated io_bookmark values.  I haven't decided yet
what to do with timestampts, but on simple tests this change gives the
same peformance results by just making code to work as declared.

MFC after:	1 week
2016-12-08 15:58:03 +00:00
Konstantin Belousov
29edde94ac Use the populate() driver paging method for i915 driver.
In particular, the fault access type is accounted for when the
aperture page is moved to GTT domain.  On the other hand, the current
pager structure is left intact, most important, only one page is
instantiated per populate call.

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2016-12-08 11:39:08 +00:00
Konstantin Belousov
ed01d9894e Implement the populate() pager method for phys pager.
It allows to provide configurable agressive prefaulting and useful
hints to page daemon about memory allocations, on faults for pages
managed by phys pager.  In fact, this implementation is superior to
the MAP_SHARED_PHYS hack from my Postgresql paper, while giving
similar benefits of reducing the page faults numbers on SysV shared
memory mappings.

Reviewed by:	alc
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2016-12-08 11:35:53 +00:00
Konstantin Belousov
c42b43a054 Add a new populate() pager method and extend device pager ops vector
with cdev_pg_populate() to provide device drivers access to it.  It
gives drivers fine control of the pages ownership and allows drivers
to implement arbitrary prefault policies.

The populate method is called on a page fault and is supposed to
populate the vm object with the page at the fault location and some
amount of pages around it, at pager's discretion.  VM provides the
pager with the hints about current range of the object mapping, to
avoid instantiation of immediately unused pages, if pager decides so.
Also, VM passes the fault type and map entry protection to the pager,
allowing it to force the optimal required ownership of the mapped
pages.

Installed pages must contiguously fill the returned region, be fully
valid and exclusively busied.  Of course, the pages must be compatible
with the object' type.

After populate() successfully returned, VM fault handler installs as
many instantiated pages into the process page tables as it sees
reasonable, while still obeying the correct semantic for COW and vm
map locking.

The method is opt-in, pager sets OBJ_POPULATE flag to indicate that
the method can be called.  If pager' vm objects can be shadowed, pager
must implement the traditional getpages() method in addition to the
populate().  Populate() might fall back to the getpages() on per-call
basis as well, by returning VM_PAGER_BAD error code.

For now for device pagers, the populate() method is only allowed to be
used by the managed device pagers, but the limitation is only made
because there is no unmanaged fault handlers which could use it right
now.

KPI designed together with, and reviewed by:	alc
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2016-12-08 11:26:11 +00:00
Konstantin Belousov
dc5401d240 Move map_generation snapshot value into struct faultstate.
Reviewed by:	alc
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-12-08 10:29:41 +00:00
Konstantin Belousov
272cc3c4d0 Style.
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-12-08 10:28:51 +00:00
Adrian Chadd
4869f5945e [net80211] add a field for storing a 64 bit TSC. 2016-12-08 07:57:16 +00:00
Adrian Chadd
36c8d0de0f [net80211] begin fleshing out support for channel survey information to be
pushed back up into net80211.
2016-12-08 07:56:25 +00:00
Sepherosa Ziehau
096d83feb9 hyperv/timesync: Support "sent TC" to improve accuracy.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8723
2016-12-08 05:37:39 +00:00
Sepherosa Ziehau
98cb13b6cc hyperv/vmbus: Utilize vmbus_chan_run_task()
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8686
2016-12-08 05:15:00 +00:00
Alan Cox
e94965d82e Previously, vm_radix_remove() would panic if the radix trie didn't
contain a vm_page_t at the specified index.  However, with this
change, vm_radix_remove() no longer panics.  Instead, it returns NULL
if there is no vm_page_t at the specified index.  Otherwise, it
returns the vm_page_t.  The motivation for this change is that it
simplifies the use of radix tries in the amd64, arm64, and i386 pmap
implementations.  Instead of performing a lookup before every remove,
the pmap can simply perform the remove.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D8708
2016-12-08 04:29:29 +00:00
Andriy Voskoboinyk
83faf8fc96 net80211: remove obsolete comment.
The described LOR should be fixed in r302283.
2016-12-07 23:33:59 +00:00
Gavin Atkinson
109005cc14 Switch if_run.c to use a bitmap for debug levels rather than arbitrary
values. This more closely matches other wifi drivers in the tree.
The bitmap levels have been based closely on other drivers (primarily
[u]rtwn(4)) in the hope that one day these can be unified into a shared
wifi-debug framework.

This is the first step of several pieces of work I'm planning on doing
with the run(4) driver. I may well adjust and refine some of the debug
bitmaps at a later date.

Reviewed by:	adrian, avos
Differential Revision:	https://reviews.freebsd.org/D8704
2016-12-07 22:52:12 +00:00
Andriy Voskoboinyk
4a19d71238 net80211 + drivers: convert to ieee80211_crypto_get_key_wepidx().
Proposed by:	adrian
2016-12-07 22:16:07 +00:00
Michael Tuexen
b594081bdf Silence a warning produced by newer versions of gcc.
MFC after:	1 week
2016-12-07 22:01:09 +00:00
Michael Tuexen
49656eefc8 Cleanup the names of SSN, SID, TSN, FSN, PPID and MID.
This made a couple of bugs visible in handling SSN wrap-arounds
when using DATA chunks. Now bulk transfer seems to work fine...
This fixes the issue reported in
https://github.com/sctplab/usrsctp/issues/111

MFC after:	1 week
2016-12-07 19:30:59 +00:00
Robert Watson
52b42f6287 Regnerate system-call definitions following r309677 correcting a whitespace
glitch in syscalls.master.
2016-12-07 16:12:27 +00:00
Robert Watson
82d8d2b8bc Replace spaces with tabs in definition of SCTP system calls, for consistency
with the remainder of the syscalls.master file.  This problem does not occur
in the freebsd32 version of the same system calls.
2016-12-07 16:11:55 +00:00
Eric van Gyzen
3d32d4a7c9 Export the whole thread name in kinfo_proc
kinfo_proc::ki_tdname is three characters shorter than
thread::td_name.  Add a ki_moretdname field for these three
extra characters.  Add the new field to kinfo_proc32, as well.
Update all in-tree consumers to read the new field and assemble
the full name, except for lldb's HostThreadFreeBSD.cpp, which
I will handle separately.  Bump __FreeBSD_version.

Reviewed by:	kib
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D8722
2016-12-07 15:04:22 +00:00
Andrew Turner
75747c209c Add ACPI support to the arm64 mp code. We use the Multiple APIC Description
Table to find the CPUs to find the CPUs to start. Currently we assume PSCI,
however this assumption is shared with the FDT code.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-12-07 14:35:05 +00:00
Andrew Turner
2b5014f6fe Add ACPI support to the PSCI driver. This checks the Fixed ACPI Description
Table to find if the hardware supports PSCI, and if so what method the
kernel should use to interact with it.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-12-07 14:24:53 +00:00
Ruslan Bukin
20a9f7715e Style fix.
Sponsored by:	DARPA, AFRL
2016-12-07 13:19:19 +00:00
Sepherosa Ziehau
6dbe58e249 hyperv/vmbus: Use pause if possible.
This makes booting on Hyper-V w/ small # of vCPUs work properly.

Reported by:	Hongxiong Xian <v-hoxian microsoft com>, Hongjiang Zhang <honzhan microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft
2016-12-07 08:12:02 +00:00
George V. Neville-Neil
af463464cf Fix a kernel panic in DTrace's rw_iswriter subroutine.
On FreeBSD the sense of rw_write_held() and rw_iswriter() were reversed,
probably due to a cut and paste error. Using rw_iswriter() would cause
the kernel to panic.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8718
2016-12-07 07:27:47 +00:00
Xin LI
d0155f67a3 Fix typo. 2016-12-07 06:29:01 +00:00
Navdeep Parhar
aa7792f2f6 cxgbe(4): unsigned short isn't large enough to store link speed (which
is in Mbps) for 100Gbps links.

MFC after:	3 days
2016-12-07 04:23:08 +00:00
Adrian Chadd
ba58946fd6 [net80211] flesh out more RX phy information.
I'm teaching my ath10k port to communicate up the per-rate / channel width
information I get from the firmware.

The HT40 flag field should just be retired and instead moved to use the
PHY bandwidth field.
2016-12-07 04:03:51 +00:00
Adrian Chadd
54a95d0d68 [net80211] start refactoring out the "am I a wep / group key!" code.
This is a bunch of pointer arithmetic that is copypasta'ed everywhere.
Let's undo that copypasta.
2016-12-07 04:02:41 +00:00
Mark Johnston
43482f897b Use the official spelling for NULL arguments to typed sysctl handlers.
Reported by:	bde
2016-12-07 01:15:10 +00:00
Andrey V. Elsukov
02784f106e Convert result of hash_packet6() into host byte order.
For IPv4 similar function uses addresses and ports in host byte order,
but for IPv6 it used network byte order. This led to very bad hash
distribution for IPv6 flows. Now the result looks similar to IPv4.

Reported by:	olivier
MFC after:	1 week
Sponsored by:	Yandex LLC
2016-12-06 23:52:56 +00:00
Mark Johnston
77edd8fa00 Provide dummy sysctls for v_cache_count and v_tcached.
Some utilities (notably top(1)) exit if any of their input sysctls don't
exist, and the removal of the above-mentioned PG_CACHE-related sysctls
makes it difficult to run such utilities on different versions of the
kernel without recompiling.

Requested by:	bde
2016-12-06 22:52:45 +00:00
Mark Johnston
10c480e775 Require the STACK option for code that captures stacks of running threads.
stack_machdep.c is compiled if either of the DDB or STACK options is
specified, but stack_save_td_running() isn't useable from DDB. Moreover,
stack_save_td_running() works by raising an NMI on the CPU running the
target thread, and the corresponding handler is compiled only if STACK is
configured.

Reported by:	kib
MFC after:	1 week
2016-12-06 22:48:28 +00:00
Andrew Turner
0afaf183d0 Add the missing gic_common.h include for GIC_BUS_FDT.
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-12-06 15:16:00 +00:00
Andrew Turner
be04b41da2 Create two GIC ivars to find the bus type and GIC hardware version. These
will be used by the gicv2m and ITS ACPI drivers to only attach to the
correct parent.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-12-06 15:12:14 +00:00
Mateusz Guzik
ef32958e5d ifndef atomic_cas_* in cddl code in preparation for native implementations
This is a temporary change to not require all architectures to import at once.

Discussed with:	jhb
2016-12-06 14:08:49 +00:00
Andrew Turner
c417fba9eb Move the common bit manipulation macros from the GICv3 header to the
common GIC header file.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-12-06 13:55:19 +00:00
Andrew Turner
31b892557f Move the stored signal mask later in the jump buf. It was being clobbered
by a later store of a VFP register.

Sponsored by:	ABT Systems Ltd
2016-12-06 13:46:12 +00:00
Andrew Turner
4d7d72fb23 Adda new common GIC header to handle the common parts of the GICv2 and
GICv3 drivers. For now it just contains common distributor registers.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-12-06 12:57:28 +00:00
Navdeep Parhar
3cbaf64f2e cxgbe(4): Update firmwares from version 1.16.12.0 to 1.16.22.0.
Obtained from:	Chelsio Communications
MFC after:	3 days
Sponsored by:	Chelsio Communications
2016-12-06 12:43:07 +00:00
Andrew Turner
00e61f254c Add the full set of GICD_PIDR* registers
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-12-06 11:41:19 +00:00
Michael Tuexen
5b495f17a5 Whitespace changes.
The tools using to generate the sources has been updated and produces
different whitespaces. Commit this seperately to avoid intermixing
these with real code changes.

MFC after:	3 days
2016-12-06 10:21:25 +00:00
Luiz Otavio O Souza
ff30498384 Fix the armv6 build after r309553.
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-06 06:15:28 +00:00