]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoxen: add a grant-table user-space device
royger [Mon, 31 Oct 2016 13:12:58 +0000 (13:12 +0000)]
xen: add a grant-table user-space device

A grant-table user-space device will allow user-space applications to map
and share grants (Xen way to share memory) among Xen domains. This grant
table user-space device has been tested with the QEMU Qdisk Xen backed.

Submitted by: jaggi
Reviewed by: royger
Differential review: https://reviews.freebsd.org/D7293

7 years agoxen/intr: add reference counts to event channels
royger [Mon, 31 Oct 2016 13:00:53 +0000 (13:00 +0000)]
xen/intr: add reference counts to event channels

Add a reference count to xenisrc. This is required for implementation of
unmap-notifications in the grant table userspace device (gntdev). We need to
hold a reference to the event channel port, in case the user deallocates the
port before we send the notification.

Submitted by: jaggi
Reviewed by: royger
Differential review: https://reviews.freebsd.org/D7429

7 years agoxen/netfront: fix statistics
royger [Mon, 31 Oct 2016 11:31:11 +0000 (11:31 +0000)]
xen/netfront: fix statistics

Fix the statistics used by netfront.

Reported by:    Trond.Endrestol@ximalas.info
Submitted by:   ae
Reviewed by:    royger, Wei Liu <wei.liu2@citrix.com>
MFC after: 4 weeks
PR: 213439

7 years agoIn loader.efi, instead of exiting directly, try to fallback on the
manu [Mon, 31 Oct 2016 11:30:01 +0000 (11:30 +0000)]
In loader.efi, instead of exiting directly, try to fallback on the
first EFI device if we can't find the one from which the image was loaded.

Reviewed by: allanjude,imp,jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D6780

7 years agoOn arm64 build the efi loader with -fPIC. Without this clang 3.9 will
andrew [Mon, 31 Oct 2016 11:13:36 +0000 (11:13 +0000)]
On arm64 build the efi loader with -fPIC. Without this clang 3.9 will
generate relocation in the self relocation code.

MFC after: 1 week
Sponsored by: ABT Systems Ltd

7 years agoAdd preliminary support for the RTL8153.
kevlo [Mon, 31 Oct 2016 05:58:11 +0000 (05:58 +0000)]
Add preliminary support for the RTL8153.

Reviewed by: hselasky

7 years agohyperv/hn: Don't start shared TX taskq, if the hypervisor is not Hyper-V.
sephe [Mon, 31 Oct 2016 05:22:00 +0000 (05:22 +0000)]
hyperv/hn: Don't start shared TX taskq, if the hypervisor is not Hyper-V.

- Move the SYSINIT to DRIVER/SECOND, i.e. after the vm_guest becomes
  determistic.
- Minor style changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8370

7 years agohyperv/hn: Reset do_lro, if the hash types are not TCP related.
sephe [Mon, 31 Oct 2016 05:05:12 +0000 (05:05 +0000)]
hyperv/hn: Reset do_lro, if the hash types are not TCP related.

Mainly because the host side only set TCPCS and IPCS even for
UDP datagrams.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8369

7 years agohyperv/hn: Cleanup RXBUF ack processing.
sephe [Mon, 31 Oct 2016 04:54:15 +0000 (04:54 +0000)]
hyperv/hn: Cleanup RXBUF ack processing.

- Increase the # of retries.
- Add comment.
- Log error, if RXBUF ack fails.
- Add stat for RXBUF ack failures.

RXBUF ack really should _not_ fail...

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8368

7 years agohyperv/hn: Rework temporary channel packet buffer expanding.
sephe [Mon, 31 Oct 2016 04:46:02 +0000 (04:46 +0000)]
hyperv/hn: Rework temporary channel packet buffer expanding.

And use large default temporary channel packer buffer; we really
don't want it to be expanded at run time.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8367

7 years agohyperv/hn: Rename cleaned up RNDIS source file.
sephe [Mon, 31 Oct 2016 01:36:28 +0000 (01:36 +0000)]
hyperv/hn: Rename cleaned up RNDIS source file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8361

7 years agoRevert r308107
lwhsu [Sun, 30 Oct 2016 22:18:22 +0000 (22:18 +0000)]
Revert r308107

Requested by: jhb

7 years agoChange remained internal uses of boolean_t to bool in vm/vm_fault.c.
kib [Sun, 30 Oct 2016 20:39:38 +0000 (20:39 +0000)]
Change remained internal uses of boolean_t to bool in vm/vm_fault.c.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRemove vm_pager_has_page() declaration. It is not too useful since
kib [Sun, 30 Oct 2016 20:38:57 +0000 (20:38 +0000)]
Remove vm_pager_has_page() declaration.  It is not too useful since
static inline definition appears later in the file.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoMerge and sort vm_fault_hold()'s "int" variable definitions.
alc [Sun, 30 Oct 2016 19:15:59 +0000 (19:15 +0000)]
Merge and sort vm_fault_hold()'s "int" variable definitions.

Reviewed by: kib
MFC after: 7 days

7 years agoRemove vnode_locked label and goto, by collapsing vp calculation into
kib [Sun, 30 Oct 2016 18:05:18 +0000 (18:05 +0000)]
Remove vnode_locked label and goto, by collapsing vp calculation into
the conditional.

Suggested and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoSplit long line instead of unindenting it. Add KASSERT() verifying
kib [Sun, 30 Oct 2016 18:04:11 +0000 (18:04 +0000)]
Split long line instead of unindenting it.  Add KASSERT() verifying
that a device object with the same handle has the same ops vector.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years ago- Fix `make` in sys/modules/bhnd
lwhsu [Sun, 30 Oct 2016 15:56:42 +0000 (15:56 +0000)]
- Fix `make` in sys/modules/bhnd

Approved by: landonf
Differential Revision: https://reviews.freebsd.org/D7774

7 years ago- Use virtualbox-ose-additions-nox11 for vagrant image to reduce size
lwhsu [Sun, 30 Oct 2016 15:46:24 +0000 (15:46 +0000)]
- Use virtualbox-ose-additions-nox11 for vagrant image to reduce size

Reviewed by: brd, gjb, swills
Approved by: gjb

7 years agoFix H3 temperature reporting. The formula in for V1.0 of the H3 datasheet
jmcneill [Sun, 30 Oct 2016 14:39:33 +0000 (14:39 +0000)]
Fix H3 temperature reporting. The formula in for V1.0 of the H3 datasheet
seems to be incorrect, so use the same method of conversion as the H3 BSP
instead.

7 years agoadd iic interface to ig4 driver, move isl and cyapa to iicbus
avg [Sun, 30 Oct 2016 12:15:33 +0000 (12:15 +0000)]
add iic interface to ig4 driver, move isl and cyapa to iicbus

Summary:
The hardware does not expose a classic SMBus interface.
Instead it has a lower level interface that can express a far richer
I2C protocol than what smbus offers.  However, the interface does not
provide a way to explicitly generate the I2C stop and start conditions.
It's only possible to request that the stop condition is generated
after transferring the next byte in either direction.  So, at least
one data byte must always be transferred.
Thus, some I2C sequences are impossible to generate, e.g., an equivalent
of smbus quick command (<start>-<slave addr>-<r/w bit>-<stop>).

At the same time isl(4) and cyapa(4) are moved to iicbus and now they use
iicbus_transfer for communication.  Previously they used smbus_trans()
interface that is not defined by the SMBus protocol and was implemented
only by ig4(4).  In fact, that interface was impossible to implement
for the typical SMBus controllers like intpm(4) or ichsmb(4) where
a type of the SMBus command must be programmed.

The plan is to remove smbus_trans() and all its uses.
As an aside, the smbus_trans() method deviates from the standard,
but perhaps backwards, FreeBSD convention of using 8-bit slave
addresses (shifted by 1 bit to the left).  The method expects
7-bit addresses.

There is a user facing consequence of this change.
A user must now provide device hints for isl and cyapa that specify an iicbus to use
and a slave address on it.
On Chromebook hardware where isl and cyapa devices are commonly found
it is also possible to use a new chromebook_platform(4) driver that
automatically configures isl and cyapa devices.  There is no need to
provide the device hints in that case,

Right now smbus(4) driver tries to discover all slaves on the bus.
That is very dangerous.  Fortunately, the probing code uses smbus_trans()
to do its job, so it is really enabled for ig4 only.
The plan is to remove that auto-probing code and smbus_trans().

Tested by: grembo, Matthias Apitz <guru@unixarea.de> (w/o
chromebook_platform)
Discussed with: grembo, imp
Reviewed by: wblock (docs)
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D8172

7 years agohwpmc: fix a race between amd_stop_pmc and amd_intr
avg [Sun, 30 Oct 2016 09:38:10 +0000 (09:38 +0000)]
hwpmc: fix a race between amd_stop_pmc and amd_intr

It is possible that wrmsr in amd_stop_pmc() causes an overflow in a counter
that it disables.  In that case a non-maskable interrupt is generated.  The
interrupt handler code was written in such a way that it would re-enable the
counter.  That would lead to an unexpected interrupt later on.

This problem was easy to reproduce with
$ pmcstat -T -P instructions -t $pid
if the target process is sufficiently busy and there are context switches from
time to time.  There would be a lot of interrupts to "race" with amd_stop_pmc()
called during the context switches.  The problem affected only AMD processors.

While there, trace whether amd_intr() claimed an interrupt.

Reviewed by: jhb
MFC after: 2 weeks

7 years agocompile libunwind c source with -fexceptions
emaste [Sun, 30 Oct 2016 02:57:47 +0000 (02:57 +0000)]
compile libunwind c source with -fexceptions

When an exception is thrown the unwinder must unwind its own C source
(starting with _Unwind_RaiseException in UnwindLevel1.c), so it needs to
be built with unwinding data.

7 years agoAdd sysctls for zfs_immediate_write_sz and zvol_immediate_write_sz.
mav [Sat, 29 Oct 2016 23:25:12 +0000 (23:25 +0000)]
Add sysctls for zfs_immediate_write_sz and zvol_immediate_write_sz.

7 years agoThe "lookup_is_valid" field is used as a "bool". Make it one.
alc [Sat, 29 Oct 2016 21:01:49 +0000 (21:01 +0000)]
The "lookup_is_valid" field is used as a "bool".  Make it one.

Convert vm_fault_hold()'s Boolean variables that are only used
internally to "bool".  Add a comment describing why the one
remaining "boolean_t" was not converted.

Reviewed by: kib
MFC after: 8 days

7 years agoFix WITNESS hints for pagequeue locks.
markj [Sat, 29 Oct 2016 20:01:48 +0000 (20:01 +0000)]
Fix WITNESS hints for pagequeue locks.

MFC after: 1 week

7 years agoWith one exception, "hardfault" is used like a "bool". Change that
alc [Sat, 29 Oct 2016 19:22:38 +0000 (19:22 +0000)]
With one exception, "hardfault" is used like a "bool".  Change that
exception and make it a "bool".

Reviewed by: kib
MFC after: 7 days

7 years agoAdd one more use of unlock_vp().
markj [Sat, 29 Oct 2016 18:47:28 +0000 (18:47 +0000)]
Add one more use of unlock_vp().

Discussed with: kib
X-MFC With: r308094

7 years agoAdd unlock_vp() helper.
kib [Sat, 29 Oct 2016 18:03:29 +0000 (18:03 +0000)]
Add unlock_vp() helper.
Trim space.

Discussed with: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agozfsbootcfg: a simple tool to set next boot (one time) options for zfsboot
avg [Sat, 29 Oct 2016 14:09:32 +0000 (14:09 +0000)]
zfsbootcfg: a simple tool to set next boot (one time) options for zfsboot

(gpt)zfsboot will read one-time boot directives from a special ZFS pool
area.  The area was previously described as "Boot Block Header", but
currently it is know as Pad2, marked as reserved and is zeroed out on
pool creation.  The new code interprets data in this area, if any, using
the same format as boot.config.  The area is immediately wiped out.
Failure to parse the directives results in a reboot right after the
cleanup.  Otherwise the boot sequence proceeds as usual.

zfsbootcfg writes zfsboot arguments specified on its command line to the
Pad2 area of a disk identified by vfs.zfs.boot.primary_pool and
vfs.zfs.boot.primary_vdev kenv variables that are set by loader during
boot.  Please see the manual page for more.

Thanks to all who reviewed, contributed and made suggestions!  There are
many potential improvements to the feature, please see the review for
details.

Reviewed by: wblock (docs)
Discussed with: jhb, tsoome
MFC after: 3 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D7612

7 years agoFix getfsstat(2) handling of flags. The 'flags' argument is an enum,
trasz [Sat, 29 Oct 2016 12:38:30 +0000 (12:38 +0000)]
Fix getfsstat(2) handling of flags. The 'flags' argument is an enum,
not a bitfield. For the intended usage - being passed either MNT_WAIT,
or MNT_NOWAIT - this shouldn't introduce any changes in behaviour.

Reviewed by: jhb@
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D8373

7 years agoAdd the SPE feature mask for e500v1 and e500v2
jhibbits [Sat, 29 Oct 2016 01:24:30 +0000 (01:24 +0000)]
Add the SPE feature mask for e500v1 and e500v2

On e500v2 SoCs it will now print:

cpu0: Features 84e08000<PPC32,MMU,SPE,EFPS,EFPD,BOOKE>

at bootup.

7 years agoFix a copy&paste-o causing a segfault with sigsetjmp.
jhibbits [Sat, 29 Oct 2016 01:22:55 +0000 (01:22 +0000)]
Fix a copy&paste-o causing a segfault with sigsetjmp.

I'm not sure how this passed my code inspection and initial testing, it's
obviously wrong.  Found when debugging csh.

7 years agoioat(4): Use memory completion rather than device register
cem [Fri, 28 Oct 2016 23:53:37 +0000 (23:53 +0000)]
ioat(4): Use memory completion rather than device register

The CHANSTS register is a split 64-bit register on CBDMA units before
hardware v3.3.  If a torn read happens during ioat_process_events(),
software cannot know when to stop completing descriptors correctly.

So, just use the device-pushed main memory channel status instead.

Remove the ioat_get_active() seatbelt as well.  It does nothing if the
completion address is valid.

Sponsored by: Dell EMC Isilon

7 years agoioat(4): Add failpoint for delay() in ioat_release
cem [Fri, 28 Oct 2016 23:53:36 +0000 (23:53 +0000)]
ioat(4): Add failpoint for delay() in ioat_release

Sponsored by: Dell EMC Isilon

7 years agoioat(4): Assert the submit lock in ioat_submit_single
cem [Fri, 28 Oct 2016 23:53:35 +0000 (23:53 +0000)]
ioat(4): Assert the submit lock in ioat_submit_single

Sponsored by: Dell EMC Isilon

7 years agoioat(4): Add additional tracing
cem [Fri, 28 Oct 2016 23:53:33 +0000 (23:53 +0000)]
ioat(4): Add additional tracing

These probes help track down driver bugs.

Sponsored by: Dell EMC Isilon

7 years agocxgbe(4): Accurate statistics for all chip settings.
np [Fri, 28 Oct 2016 23:01:11 +0000 (23:01 +0000)]
cxgbe(4): Accurate statistics for all chip settings.

There are 4 independent knobs in T5+ chips to include or exclude PAUSE
frames from the "total frames" and "multicast frames" counters in either
direction.  This change lets the driver deal with any combination of
these settings.

7 years agoRemove a PCI ID for a raid controller from Adaptec that was planned,
imp [Fri, 28 Oct 2016 20:23:38 +0000 (20:23 +0000)]
Remove a PCI ID for a raid controller from Adaptec that was planned,
but never released. Since no real hardware was released with this ID,
just drop it from the aacraid driver. This paves the path for future
drivers for hardware that actually has this ID.

Submitted by: Scott Benesh from Microsemi.
Differential Revision: https://reviews.freebsd.org/D8377
MFC After: 3 days

7 years agoAvoid possible overflow when calclating malloc size for auxillary
mckusick [Fri, 28 Oct 2016 20:15:19 +0000 (20:15 +0000)]
Avoid possible overflow when calclating malloc size for auxillary
data structure sizes when mounting and reloading UFS/FFS
filesystems by using a u_long rather than an int for the size.

Reported by: Mariusz Zaborski <oshogbo@>
MFC after:   1 week

7 years agoFix formatting of tables.
jhb [Fri, 28 Oct 2016 18:09:08 +0000 (18:09 +0000)]
Fix formatting of tables.

Specifically, use .Ta instead of tabs to separate column entries.  While
here fix a few other things:
- Use .Sy for all column headers (previously only the first column header
  was bold)
- Use .Dv to markup constants used for MIB names.
- Use "1234" and "4321" for the byte order descriptions without
  thousands separators.
- Mark up header files in the first table with .In.

MFC after: 2 weeks

7 years agoAdd vdev_reopening support to vdev_geom.
mav [Fri, 28 Oct 2016 17:05:14 +0000 (17:05 +0000)]
Add vdev_reopening support to vdev_geom.

It allows to avoid extra GEOM providers flapping without significant need.
Since GEOM got resize support, we don't need to reopen provider to get new
size.  If provider was orphaned and no longer valid, ZFS should already
know that, and in such case reopen should be done in full as expected.

MFC after: 2 weeks

7 years agoMatching GUIDs, handle possible race on vdev detach.
mav [Fri, 28 Oct 2016 16:21:31 +0000 (16:21 +0000)]
Matching GUIDs, handle possible race on vdev detach.

In case of vdev detach, causing top level mirror vdev destruction, leaf
vdev changes its GUID to one of the destroyed mirror, that creates race
condition when GUID in vdev label may not match one in the pool config.

This change replicates logic nuance of vdev_validate() by adding special
exception, matching the vdev GUID against the top level vdev GUID.
Since this exception is not completely reliable (may give false positives
if we fail to erase label on detached vdev), use it only as last resort.

Quick way to reproduce this scenario now is detach vdev from a pool with
enabled autoextend.  During vdev detach autoextend logic tries to reopen
remaining vdev, that always fails now since in-memory configuration is
already updated, while on-disk labels are not yet.

MFC after: 2 weeks

7 years agofix a syntax error in r308039 ...
avg [Fri, 28 Oct 2016 15:57:55 +0000 (15:57 +0000)]
fix a syntax error in r308039 ...

that I somehow introduced between testing the change
iand committing it.

MFC after: 1 week
X-MFC with: r307903

7 years agoImprove few debugging log messages.
mav [Fri, 28 Oct 2016 15:30:10 +0000 (15:30 +0000)]
Improve few debugging log messages.

7 years agonap time between pats is forced to be at most half of the timeout
avg [Fri, 28 Oct 2016 14:49:54 +0000 (14:49 +0000)]
nap time between pats is forced to be at most half of the timeout

Previously, if the timeout was less than 10 seconds, for example, about
8 seconds, then the watchdog timer would be let to expire before patting
the watchdog.

MFC after: 2 weeks

7 years agovmm: another take at maximmum address passed to contigmalloc
avg [Fri, 28 Oct 2016 14:38:01 +0000 (14:38 +0000)]
vmm: another take at maximmum address passed to contigmalloc

Just using vm_paddr_t value with all bits set.
That should work as long as the type is unsigned.

While there, fix a couple of whitespace issues nearby.

MFC after: 1 week
X-MFC with: r307903

7 years agoThe buffer address is always overwritten in the extended descriptor format,
sbruno [Fri, 28 Oct 2016 13:37:58 +0000 (13:37 +0000)]
The buffer address is always overwritten in the extended descriptor format,
we have to refresh it ... always.  This fixes problems reported in NetMap
with em(4) devices after conversion to extended descriptor format in
svn r293331.

Submitted by: luigi@
Reported by: franco@opnsense.org
MFC after: 2 days

7 years agoFix indentation and remove duplicate queue stopped stats increment.
hselasky [Fri, 28 Oct 2016 12:36:59 +0000 (12:36 +0000)]
Fix indentation and remove duplicate queue stopped stats increment.

Found by: Ryan Stone <rysto32@gmail.com>
Sponsored by: Mellanox Technologies
MFC after: 1 week

7 years agoUse correct cpu id in the banner. Fix style.
kib [Fri, 28 Oct 2016 12:27:05 +0000 (12:27 +0000)]
Use correct cpu id in the banner.  Fix style.

Noted by: avg
Sponsored by: The FreeBSD Foundation
MFC after: 9 days

7 years agoHandle pmap_enter() over an existing 4/2M page in KVA on i386.
kib [Fri, 28 Oct 2016 11:53:22 +0000 (11:53 +0000)]
Handle pmap_enter() over an existing 4/2M page in KVA on i386.

The userspace case was already handled by pmap_allocpte().  For kernel
VA, page table page must exist, and demote cannot fail, so we need to
just call pmap_demote_pde().  Also note that due to the machine AS
layout, promotions in the KVA on i386 are highly unlikely, so this
change is mostly for completeness.

Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D8323

7 years agoUse buffer pager for cd9660.
kib [Fri, 28 Oct 2016 11:46:39 +0000 (11:46 +0000)]
Use buffer pager for cd9660.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoUse buffer pager for msdosfs.
kib [Fri, 28 Oct 2016 11:46:15 +0000 (11:46 +0000)]
Use buffer pager for msdosfs.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoGeneralize UFS buffer pager to allow it serving other filesystems
kib [Fri, 28 Oct 2016 11:43:59 +0000 (11:43 +0000)]
Generalize UFS buffer pager to allow it serving other filesystems
which also use buffer cache.

Most important addition to the code is the handling of filesystems
where the block size is less than the machine page size, which might
require reading several buffers to validate single page.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoEnable vn_io_fault() deadlock avoidance for msdosfs.
kib [Fri, 28 Oct 2016 11:35:06 +0000 (11:35 +0000)]
Enable vn_io_fault() deadlock avoidance for msdosfs.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoEnsure that cluster allocations never allocate clusters outside the
kib [Fri, 28 Oct 2016 11:34:32 +0000 (11:34 +0000)]
Ensure that cluster allocations never allocate clusters outside the
volume limits.  In particular:
- Assert that usemap_alloc() and usemap_free() cluster number argument
  is valid.
- In chainlength(), return 0 if cluster start is after the max cluster.
- In chainlength(), cut the calculated cluster chain length at the max
  cluster.
- For true paranoia, after the pm_inusemap is calculated in
  fillinusemap(), reset all bits in the array for clusters after the
  max cluster, as in-use.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoIf the fatchain() call in chainalloc() returned an error, revert
kib [Fri, 28 Oct 2016 11:26:44 +0000 (11:26 +0000)]
If the fatchain() call in chainalloc() returned an error, revert
marking the cluster run as in-use.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoUse symbolic name for the value of fully free word in pm_inusemap.
kib [Fri, 28 Oct 2016 11:23:36 +0000 (11:23 +0000)]
Use symbolic name for the value of fully free word in pm_inusemap.
Explicitely mention every bit in the value.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoUse symbolic name for the free cluster number.
kib [Fri, 28 Oct 2016 11:01:49 +0000 (11:01 +0000)]
Use symbolic name for the free cluster number.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoFix comment formatting.
kib [Fri, 28 Oct 2016 10:59:34 +0000 (10:59 +0000)]
Fix comment formatting.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoRemove useless NULL check.
kib [Fri, 28 Oct 2016 10:57:41 +0000 (10:57 +0000)]
Remove useless NULL check.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agohyeprv/hn: Rename cleaned up RNDIS header file.
sephe [Fri, 28 Oct 2016 08:53:18 +0000 (08:53 +0000)]
hyeprv/hn: Rename cleaned up RNDIS header file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8360

7 years agohyperv/hn: Change header guardian; in preparation for the upcoming rename.
sephe [Fri, 28 Oct 2016 08:41:30 +0000 (08:41 +0000)]
hyperv/hn: Change header guardian; in preparation for the upcoming rename.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8359

7 years agohyperv/hn: Cleanup RNDIS related files.
sephe [Fri, 28 Oct 2016 08:32:54 +0000 (08:32 +0000)]
hyperv/hn: Cleanup RNDIS related files.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8358

7 years agohyperv/hn: Pull data path code up.
sephe [Fri, 28 Oct 2016 08:18:49 +0000 (08:18 +0000)]
hyperv/hn: Pull data path code up.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8357

7 years agohyperv/hn: Reorganize RX path; mainly pull non-control code path up
sephe [Fri, 28 Oct 2016 08:08:46 +0000 (08:08 +0000)]
hyperv/hn: Reorganize RX path; mainly pull non-control code path up

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8356

7 years agohyperv/hn: Nuke unnecessary indirection.
sephe [Fri, 28 Oct 2016 07:59:02 +0000 (07:59 +0000)]
hyperv/hn: Nuke unnecessary indirection.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8355

7 years agohyperv/hn: Rename cleaned up NVS source file.
sephe [Fri, 28 Oct 2016 07:48:17 +0000 (07:48 +0000)]
hyperv/hn: Rename cleaned up NVS source file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8354

7 years agohyperv/hn: Rename cleaned up NVS header file.
sephe [Fri, 28 Oct 2016 05:56:23 +0000 (05:56 +0000)]
hyperv/hn: Rename cleaned up NVS header file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8353

7 years agohyperv/hn: Change header guardian; in preparation for the upcoming rename.
sephe [Fri, 28 Oct 2016 05:31:34 +0000 (05:31 +0000)]
hyperv/hn: Change header guardian; in preparation for the upcoming rename.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8352

7 years ago[net80211] add comments!
adrian [Fri, 28 Oct 2016 02:10:07 +0000 (02:10 +0000)]
[net80211] add comments!

7 years ago[net80211] don't abort a background scan upon reception of a single packet.
adrian [Fri, 28 Oct 2016 02:09:45 +0000 (02:09 +0000)]
[net80211] don't abort a background scan upon reception of a single packet.

Full offload drivers don't need this behaviour - they do it in firmware.

7 years agolibunwind: consistently add \n to log and trace messages
emaste [Fri, 28 Oct 2016 00:04:04 +0000 (00:04 +0000)]
libunwind: consistently add \n to log and trace messages

Previously most messages included a newline in the string, but a few of
them were missing. Fix these and simplify by just adding the newline in
the _LIBUNWIND_LOG macro itself.

While here correct 'libuwind' typo (missing 'n').

Upstream LLVM libunwind commits r280086 and r280103.

7 years agoAdd powerd(8) support for several families of AMD CPUs.
jhb [Thu, 27 Oct 2016 21:31:56 +0000 (21:31 +0000)]
Add powerd(8) support for several families of AMD CPUs.

Use the same logic to calculate the nominal CPU frequency from the P-state
MSRs on family 0x12, 0x15, and 0x16 CPUs as is used for family 0x10.
Family 0x14 was included in the original patch in the PR but I left that
out as the BIOS writer's guide for family 0x14 CPUs show a different layout
for the relevant MSR and include a different formulate for calculating the
frequency.

While here, simplify a few expressions and print out the family of
unsupported CPUs in hex rather than decimal.

PR: 212020
Submitted by: Anthony Jenkins <Scoobi_doo@yahoo.com>
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D7587

7 years agoMFamd64: Add bounds checks on addresses used with /dev/mem.
jhb [Thu, 27 Oct 2016 21:23:14 +0000 (21:23 +0000)]
MFamd64: Add bounds checks on addresses used with /dev/mem.

Reject attempts to read from or memory map offsets in /dev/mem that are
beyond the maximum-supported physical address of the current CPU.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D7408

7 years agoRevert r307823 (Use upstream suffixes for LLVM IR) for now. It causes a
dim [Thu, 27 Oct 2016 18:46:52 +0000 (18:46 +0000)]
Revert r307823 (Use upstream suffixes for LLVM IR) for now.  It causes a
number of ports to fail, which use bmake, and use .ll file extensions
(usually for for C++-based lex input).

Reported by: antoine

7 years agolibgcc_eh/libgcc_s: apply hidden visibility only to static libs
emaste [Thu, 27 Oct 2016 14:21:54 +0000 (14:21 +0000)]
libgcc_eh/libgcc_s: apply hidden visibility only to static libs

7 years agoVarious fixes for ptnet/ptnetmap (passthrough of netmap ports). In detail:
luigi [Thu, 27 Oct 2016 09:46:22 +0000 (09:46 +0000)]
Various fixes for ptnet/ptnetmap (passthrough of netmap ports). In detail:
- use PCI_VENDOR and PCI_DEVICE ids from a publicly allocated range
  (thanks to RedHat)
- export memory pool information through PCI registers
- improve mechanism for configuring passthrough on different hypervisors
Code is from Vincenzo Maffione as a follow up to his GSOC work.

7 years ago3746 ZRLs are racy
avg [Thu, 27 Oct 2016 07:38:07 +0000 (07:38 +0000)]
3746 ZRLs are racy

illumos/illumos-gate@260af64db74a52d64de8c6c5f67dd0a71d228ca5
https://github.com/illumos/illumos-gate/commit/260af64db74a52d64de8c6c5f67dd0a71d228ca5

https://www.illumos.org/issues/3746
  From the original change log:
  It was possible for a reference to be added even with the lock held, and
  for references added just after a lock release to be lost.
  This bug was also independently found and reported in wesunsolve.net
  issues 6985013 6995524.
  In zrl_add(), always use an atomic operation to update the refcount.
  The mutex in the ZRL only guarantees that wakeups occur for waiters on the
  lock. It offers no protection against concurrent updates of the refcount.
  The only refcount transition that is safe to perform without an atomic
  operation is from ZRL_LOCKED back to 0, since this can only be performed
  by the thread which has the ZRL locked.

Authored by: Will Andrews <will@freebsd.org>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Reviewed by: Pavel Zakharov <pavel.zakha@gmail.com>
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Reviewed by: Justin T. Gibbs <gibbs@scsiguy.com>
Approved by: Matt Ahrens <mahrens@delphix.com>
Author: Youzhong Yang <yyang@mathworks.com>
PR: 204037
MFC after: 1 week

7 years agohyperv/hn: NVS inclusion cleanup and forward declare functions.
sephe [Thu, 27 Oct 2016 05:33:48 +0000 (05:33 +0000)]
hyperv/hn: NVS inclusion cleanup and forward declare functions.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8347

7 years agohyperv/hn: Move send context to NVS domain.
sephe [Thu, 27 Oct 2016 05:26:04 +0000 (05:26 +0000)]
hyperv/hn: Move send context to NVS domain.

Since all sends are encapsulated in NVS messages.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8346

7 years agohyperv/hn: Move hn_softc to if_hnvar.h
sephe [Thu, 27 Oct 2016 05:13:00 +0000 (05:13 +0000)]
hyperv/hn: Move hn_softc to if_hnvar.h

While I'm here, use consistent macro names.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8345

7 years agohyperv/hn: Shuffle chimney sending buffer alloc/free around.
sephe [Thu, 27 Oct 2016 05:04:54 +0000 (05:04 +0000)]
hyperv/hn: Shuffle chimney sending buffer alloc/free around.

This paves way for more chimney sending buffer reorganization.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8343

7 years agohyperv/hn: Define empty packet filter.
sephe [Thu, 27 Oct 2016 04:55:19 +0000 (04:55 +0000)]
hyperv/hn: Define empty packet filter.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8342

7 years agohyperv/hn: Move %b format string for capabilities near their definition.
sephe [Thu, 27 Oct 2016 04:42:39 +0000 (04:42 +0000)]
hyperv/hn: Move %b format string for capabilities near their definition.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8341

7 years agohyperv/hn: Nuke unnecessary M_NETVSC
sephe [Thu, 27 Oct 2016 04:28:01 +0000 (04:28 +0000)]
hyperv/hn: Nuke unnecessary M_NETVSC

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8340

7 years agoAdd support for Allwinner Consumer IR interface.
ganbold [Thu, 27 Oct 2016 04:26:33 +0000 (04:26 +0000)]
Add support for Allwinner Consumer IR interface.
RX is supported now and the driver is using evdev framework.
It was tested on Cubieboard2 (A20 SoC) using lirc
with dfrobot's IR remote controller.

7 years agohyperv/hn: Properly configure RSS according to RSS capabilities
sephe [Thu, 27 Oct 2016 03:43:27 +0000 (03:43 +0000)]
hyperv/hn: Properly configure RSS according to RSS capabilities

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8338

7 years agoDisable CLKREQ for ASPM since re(4) doesn't implement link level power saving.
kevlo [Thu, 27 Oct 2016 02:20:13 +0000 (02:20 +0000)]
Disable CLKREQ for ASPM since re(4) doesn't implement link level power saving.

Reviewed by:  yongari

7 years agoRemove excess CTLFLAG_VNET
bdrewery [Wed, 26 Oct 2016 23:40:07 +0000 (23:40 +0000)]
Remove excess CTLFLAG_VNET

Sponsored by: Dell EMC Isilon

7 years agoThe UFS/FFS filesystem checks directory link counts when doing
mckusick [Wed, 26 Oct 2016 20:28:23 +0000 (20:28 +0000)]
The UFS/FFS filesystem checks directory link counts when doing
directory create and delete operations. If it ever finds a directory
with a link count less than 2, it panics. Thus, an rm -rf that
encounters a directory with a link count below 2 causes a kernel
panic. The proposed fix is to return the error EINVAL rather than
panicing. The effect is that the requested operation is not done,
but the system continues to run. At a more convenient later time,
the filesystem can be unmounted and cleaned (with fsck or journal
run). Once cleaned, the operation can be rerun to successful
completion.

This fix takes that approach. The panic message has been converted
into a uprintf(9) to provide the user with the inode number and
filesystem mount point of the offending directory and EINVAL is
returned for the operation.

The long (three year) delay in fixing this problem occurred because
the bug was misclassified when originally assigned and only this week
was found during a sweep of old unresolved bug reports.

PR:          180894
Reviewed by: kib
MFC after:   2 weeks

7 years agoPrefer ACFLAGS over CFLAGS for compiling aarch64 assembly files.
jkim [Wed, 26 Oct 2016 20:12:30 +0000 (20:12 +0000)]
Prefer ACFLAGS over CFLAGS for compiling aarch64 assembly files.

7 years agoBuild OpenSSL assembly sources for aarch64. Tested with ThunderX by andrew.
jkim [Wed, 26 Oct 2016 20:02:22 +0000 (20:02 +0000)]
Build OpenSSL assembly sources for aarch64.  Tested with ThunderX by andrew.

7 years agoEnable EFER_NXE properly on APs.
jhb [Wed, 26 Oct 2016 18:47:47 +0000 (18:47 +0000)]
Enable EFER_NXE properly on APs.

EFER_NXE is set in the EFER MSR by initializecpu() and must be set on all
CPUs in the system.  When PG_NX support was added to PAE on i386, the
block to enable EFER_NXE was placed in a section of initializecpu() that
only runs if 'cpu == CPU_686'.  During early boot, locore does an
initial pass to set cpu that sets it to CPU_686 on all CPUs later than
a Pentium.  Later, printcpuinfo() adjusts the 'cpu' variable on
PII and later CPUs to one of CPU_PII, CPU_PIII, or CPU_P4.  However,
printcpuinfo() is called after initializecpu() on the BSP, so the BSP
would enable EFER_NXE and pg_nx.  The APs execute initializecpu() much
later after printcpuinfo() has run.  The end result on a modern CPU was
that cpu was set to CPU_PIII when the APs invoked initializecpu(), so
they did not enable EFER_NXE.  As a result, the APs would fault when
trying to access any pages marked with PG_NX set.

When booting a 2 CPU PAE kernel in bhyve this manifested as a hang before
single user mode.  The attempt to execute /bin/init tried to copy out
the exec strings (argv, etc.) to a non-executable mapping while running
on the AP.  The instruction kept faulting due to invalid bits in the PTE
in an infinite loop.

Fix this by moving the code to enable EFER_NXE out of the switch statement
on 'cpu' and always doing it if 'amd_feature' supports AMDID_NX.

MFC after: 2 weeks

7 years agoCorrect definition of 'struct sigcontext' on MIPS.
jhb [Wed, 26 Oct 2016 17:37:08 +0000 (17:37 +0000)]
Correct definition of 'struct sigcontext' on MIPS.

Add missing fields ('sr' and 'mc_tls') to 'struct sigcontext'.

The kernel doesn't use 'struct sigcontext' but instead uses 'ucontext_t'
which includes 'mcontext_t' in 'struct sigframe' to build the signal frame.
As a result, this change is not an ABI change but simply making
'struct sigcontext' correct.  Note that 'struct sigcontext' is only used
for "Traditional BSD style" signal handlers.

While here, rename the 'xxx' field to '__spare__' to match 'mcontext_t'.

Sponsored by: DARPA, AFRL

7 years agostrings: fix exit status if a file before the last one fails
emaste [Wed, 26 Oct 2016 17:07:53 +0000 (17:07 +0000)]
strings: fix exit status if a file before the last one fails

Previously a command like "strings f1 f2 f3" reported the exit status
based only on processing the last file.

As with GNU strings, report an error exit status if an error was
encountered processing any of the files. While here simplify the
exit status handling to just success (0) / failure (1).

Reviewed by: brooks
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8334

7 years agoUse the new fdt_intr.h constants in the Allwinner NMI driver.
andrew [Wed, 26 Oct 2016 16:03:26 +0000 (16:03 +0000)]
Use the new fdt_intr.h constants in the Allwinner NMI driver.

Sponsored by: DARPA, AFRL

7 years agoAllow config to be compiled from another source directory, such as one
marcel [Wed, 26 Oct 2016 15:58:41 +0000 (15:58 +0000)]
Allow config to be compiled from another source directory, such as one
for building tools. This boils down to replacing ${.CURDIR} with
${SRCDIR}, where the latter is the directory in which this makefile
lives.

Also allow overriding where file2c comes from using ${FILE2C}.

7 years agoRemove an extraneous call to soisconnected() in syncache_socket(),
jch [Wed, 26 Oct 2016 15:19:18 +0000 (15:19 +0000)]
Remove an extraneous call to soisconnected() in syncache_socket(),
introduced with r261242.  The useful and expected soisconnected()
call is done in tcp_do_segment().

Has been found as part of unrelated PR:212920 investigation.

Improve slightly (~2%) the maximum number of TCP accept per second.

Tested by: kevin.bowling_kev009.com, jch
Approved by: gnn, hiren
MFC after: 1 week
Sponsored by: Verisign, Inc
Differential Revision: https://reviews.freebsd.org/D8072

7 years agoPull the common FDT interrupt values into a new header rather than be magic
andrew [Wed, 26 Oct 2016 15:18:08 +0000 (15:18 +0000)]
Pull the common FDT interrupt values into a new header rather than be magic
numbers.

Sponsored by: DARPA, AFRL