]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoBump the __FreeBSD_version after recent LinuxKPI changes.
Hans Petter Selasky [Mon, 18 Sep 2017 13:39:51 +0000 (13:39 +0000)]
Bump the __FreeBSD_version after recent LinuxKPI changes.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoThe LinuxKPI atomics do not have acquire nor release semantics unless
Hans Petter Selasky [Mon, 18 Sep 2017 13:37:14 +0000 (13:37 +0000)]
The LinuxKPI atomics do not have acquire nor release semantics unless
specified. Fix code to use READ_ONCE() and WRITE_ONCE() where appropriate.

Suggested by: kib @
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoOnly wire pages in the LinuxKPI instead of holding and wiring them.
Hans Petter Selasky [Mon, 18 Sep 2017 13:23:59 +0000 (13:23 +0000)]
Only wire pages in the LinuxKPI instead of holding and wiring them.
This prevents the page daemon from regularly scanning the held pages.

Suggested by: kib @
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd support for shared memory functions to the LinuxKPI.
Hans Petter Selasky [Mon, 18 Sep 2017 13:17:23 +0000 (13:17 +0000)]
Add support for shared memory functions to the LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agolinsysfs(5): Add support for recent libdrm
Conrad Meyer [Sun, 17 Sep 2017 23:40:16 +0000 (23:40 +0000)]
linsysfs(5): Add support for recent libdrm

Expose more information about PCI devices (and GPUs in particular) via
linsysfs to libdrm.

This allows unmodified modern 64-bit Linux libdrm to work, which allows
modern Linux Mesa to work.  The submitter reports that he tested the change
with an Ubuntu 16.04 chroot + amdgpu from graphics/drm-next-kmod.

PR: 222375
Submitted by: Greg V <greg AT unrelenting.technology>

6 years agoGive icee(4) a detach() method so it can be used as a module. Add a
Ian Lepore [Sun, 17 Sep 2017 22:58:13 +0000 (22:58 +0000)]
Give icee(4) a detach() method so it can be used as a module.  Add a
module makefile for it.

6 years agoMCA: Expand AMD Thresholding support to cover all banks
Conrad Meyer [Sun, 17 Sep 2017 22:58:13 +0000 (22:58 +0000)]
MCA: Expand AMD Thresholding support to cover all banks

When it was added in r314636, AMD Thresholding was hardcoded to only
bank 4 (Northbridge) for some reason.  However, even on family 10h the
MCAx_MISC register Valid/Present bits determine whether thresholding is
supported on that bank.

Expand thresholding support to monitor all monitorable banks.  This
simplifies some of the logic and makes it more consistent with our Intel
CMCI support.

Reviewed by: markj (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12321

6 years agoFix bogus FREAD with NFSV4OPEN_ACCESSREAD. No functional change.
Rick Macklem [Sun, 17 Sep 2017 22:18:01 +0000 (22:18 +0000)]
Fix bogus FREAD with NFSV4OPEN_ACCESSREAD. No functional change.

The code in nfscl_doflayoutio() bogusly used FREAD instead of
NFSV4OPEN_ACCESSREAD. Since both happen to be defined as "1", this
worked and the patch doesn't result in a functional change.
Found by inspection during development of Flex File Layout support.

MFC after: 2 weeks

6 years agoDon't use a non-zero argument for __builtin_frame_address
Justin Hibbits [Sun, 17 Sep 2017 20:07:20 +0000 (20:07 +0000)]
Don't use a non-zero argument for __builtin_frame_address

__builtin_frame_address with a non-zero argument is unsafe and rejected by
newer gcc.  Since it doesn't seem to impact the stacktrace, don't bother
with gymnastics to unwind to a different frame for starting.

PR: kern/220118
MFC after: 2 weeks

6 years agoPrint the correct bitmask for the running Book-E CPU
Justin Hibbits [Sun, 17 Sep 2017 19:40:17 +0000 (19:40 +0000)]
Print the correct bitmask for the running Book-E CPU

All the Book-E world is no longer e500v{1,2}.  e500mc the 64-bit derivatives do
not use the DOZE/NAP bits with MSR[WE], instead using the `wait' instruction to
wait for interrupts, and SoC plane controls (via CCSR) for power management.

MFC after: 1 week

6 years agoMFV r323678: file 5.32
Gordon Tetlow [Sun, 17 Sep 2017 19:14:38 +0000 (19:14 +0000)]
MFV r323678: file 5.32

Approved by: emaste (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12400

6 years agoVendor import of file 5.32.
Gordon Tetlow [Sun, 17 Sep 2017 15:57:06 +0000 (15:57 +0000)]
Vendor import of file 5.32.

6 years agoImplement mmu_page_init for AIM platforms.
Mark Johnston [Sun, 17 Sep 2017 15:40:12 +0000 (15:40 +0000)]
Implement mmu_page_init for AIM platforms.

As of r323290 we cannot rely on the vm_page array being
zero-initialized.

Reported and tested by: andreast
MFC after: 1 week

6 years agolibsysdecode: report invalid cap_rights_t
Ed Maste [Sun, 17 Sep 2017 14:03:54 +0000 (14:03 +0000)]
libsysdecode: report invalid cap_rights_t

Previously we'd have an assertion failure in cap_rights_is_set if
sysdecode_cap_rights is called with an invalid cap_rights_t, so test for
validity first.

PR: 222258
Reviewed by: cem
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12391

6 years agoFix language used in the r322923.
Mariusz Zaborski [Sun, 17 Sep 2017 10:28:45 +0000 (10:28 +0000)]
Fix language used in the r322923.

Pointed out by: wblock@
MFC after:      1 week
X-MFC-with:     r322923

6 years agoFix an accounting bug and use sctp_timer_start to start a timer.
Michael Tuexen [Sun, 17 Sep 2017 09:27:27 +0000 (09:27 +0000)]
Fix an accounting bug and use sctp_timer_start to start a timer.

MFC after: 1 week

6 years agoRemove code not used on any platform currently supported.
Michael Tuexen [Sat, 16 Sep 2017 21:26:06 +0000 (21:26 +0000)]
Remove code not used on any platform currently supported.

MFC after: 1 week

6 years agoModify blst_leaf_alloc to take only the cursor argument.
Alan Cox [Sat, 16 Sep 2017 18:12:15 +0000 (18:12 +0000)]
Modify blst_leaf_alloc to take only the cursor argument.

Modify blst_leaf_alloc to find allocations that cross the boundary between
one leaf node and the next when those two leaves descend from the same
meta node.

Update the hint field for leaves so that it represents a bound on how
large an allocation can begin in that leaf, where it currently represents
a bound on how large an allocation can be found within the boundaries of
the leaf.

The first phase of blst_leaf_alloc currently shrinks sequences of
consecutive 1-bits in mask until each has been shrunken by count-1 bits,
so that any bits remaining show where an allocation can begin, or until
all the bits have disappeared, in which case the allocation fails. This
change amends that so that the high-order bit is copied, as if, when the
last block was free, it was followed by an endless stream of free
blocks. It also amends the early stopping condition, so that the shrinking
of 1-sequences stops early when there are none, or there is only one
unbounded one remaining.

The search for the first set bit is unchanged, and the code path
thereafter is mostly unchanged unless the first set bit is in a position
that makes some of those copied sign bits matter. In that case, we look
for a next leaf, and at what blocks it can provide, to see if a
cross-boundary allocation is possible.

The hint is updated on a successful allocation that clears the last bit,
but it not updated on a failed allocation that leaves the last bit
set. So, as long as the last block is free, the hint value for the leaf is
large. As long as the last block is free, and there's a next leaf, a large
allocation can begin here, perhaps. A stricter rule than this would mean
that allocations and frees in one leaf could require hint updates to the
preceding leaf, and this change seeks to leave the freeing code
unmodified.

Define BLIST_BMAP_MASK, and use it for bit masking in blst_leaf_free and
blist_leaf_fill, as well as in blst_leaf_alloc.

Correct a panic message in blst_leaf_free.

Submitted by: Doug Moore <dougm@rice.edu>
Reviewed by: markj (an earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11819

6 years agoAdd missing links to the nv man page.
Mariusz Zaborski [Sat, 16 Sep 2017 17:52:25 +0000 (17:52 +0000)]
Add missing links to the nv man page.

MFC after: 1 week

6 years agoFix names of the array functions in the nv man page.
Mariusz Zaborski [Sat, 16 Sep 2017 17:50:24 +0000 (17:50 +0000)]
Fix names of the array functions in the nv man page.

Submitted by: def@
MFC after: 1 week

6 years agokern.osreldate is an integer, not a string
Allan Jude [Sat, 16 Sep 2017 16:23:00 +0000 (16:23 +0000)]
kern.osreldate is an integer, not a string

PR: 217501
Submitted by: Yavuz Tanriverdi <stemix@gmail.com>
MFC after: 1 week

6 years agoAdd a missing header file to SRCS to fix out-of-kernel builds.
Ian Lepore [Sat, 16 Sep 2017 16:09:05 +0000 (16:09 +0000)]
Add a missing header file to SRCS to fix out-of-kernel builds.

PR: 222354
Submitted by: eugen@
Pointy hat: ian@

6 years agoAllwinner usb phy: Rework resource allocation
Emmanuel Vadot [Sat, 16 Sep 2017 15:58:20 +0000 (15:58 +0000)]
Allwinner usb phy: Rework resource allocation

The usbphy node for allwinner have two kind of resources, one for the
phy_ctrl and one per phy. Instead of blindy allocating resources, alloc
the phy_ctrl and pmu ones separately.
Also add a configuration struct for all different phy that hold the difference
between them (number of phys, unknow needed register write etc ...).

While here remove A83T code as upstream and FreeBSD dts don't have
nodes for USB.

This (plus 323640) re-enable OHCI on Pine64 on the bottom USB port.
The top USB port is routed to the OHCI0/EHCI0 which is by default in OTG mode.
While the phy code can handle the re-route to standard OHCI/EHCI we still need
a driver for musb to probe and configure it in host mode.

EHCI is still buggy on Pine64 (hang the board) so do not enable it for now.

Tested On: Bananapi (A20), BananapiM2 (A31S), OrangePi One (H3) Pine64 (A64)

6 years agoA64 CCUNG: Correct gate and reset for OHCI0/1
Emmanuel Vadot [Sat, 16 Sep 2017 15:50:31 +0000 (15:50 +0000)]
A64 CCUNG: Correct gate and reset for OHCI0/1

Reported by: jmcneill
Pointy Hat: manu

6 years agoAllwinner: a10_gpio Fix panic on multiple lock
Emmanuel Vadot [Sat, 16 Sep 2017 14:08:20 +0000 (14:08 +0000)]
Allwinner: a10_gpio Fix panic on multiple lock

r323392 introduce gpio_pin_get/gpio_pin_set for a10_gpio driver.
When called via gpio method they must aquire the device lock while
when they are called via gpio_pin_configure the lock is already aquire.

Introduce a10_gpio_pin_{s,g}et_locked and call them in pin_gpio_configure
instead.

Tested On: BananaPi (A20)

Reported by: Richard Puga richard@puga.net

6 years agoUse OBJS_SRCS_FILTER to control setting OBJS from SRCS
Simon J. Gerraty [Sat, 16 Sep 2017 05:42:27 +0000 (05:42 +0000)]
Use OBJS_SRCS_FILTER to control setting OBJS from SRCS

Some makefiles do reachover builds.
In some cases it is convenient to list subdirs of the distribution
in SRCS.

It is not very convenient, or always even desirable to have corresponding
subdirs in .OBJDIR, so OBJS_SRCS_FILTER allows the makefile to choose.
The default value 'R' matches existing practice.

But a makefile can set OBJS_SRCS_FILTER= T (the R gets added by
bsd.init.mk) to avoid the need for subdirs in .OBJDIR

Differential Revision: https://reviews.freebsd.org/D12218
Reviewed by: bdrewery

6 years agoRevert r323516 (iflib rollup)
Stephen Hurd [Sat, 16 Sep 2017 02:41:38 +0000 (02:41 +0000)]
Revert r323516 (iflib rollup)

This was really too big of a commit even if everything worked, but there
are multiple new issues introduced in the one huge commit, so it's not
worth keeping this until it's fixed.

I'll work on splitting this up into logical chunks and introduce them one
at a time over the next week or two.

Approved by: sbruno (mentor)
Sponsored by: Limelight Networks

6 years agoAdd missing newline after unknown MIPS-specific dynamic entries.
John Baldwin [Fri, 15 Sep 2017 22:56:39 +0000 (22:56 +0000)]
Add missing newline after unknown MIPS-specific dynamic entries.

Reviewed by: emaste
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D12384

6 years agoAdd an -a flag to getconf.
John Baldwin [Fri, 15 Sep 2017 22:55:15 +0000 (22:55 +0000)]
Add an -a flag to getconf.

When -a is specified, the name and value of all system or path
configuration values is reported to standard output.

Reviewed by: kib (earlier version)
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D12373

6 years agoAvoid reusing the wrong buffer for a DDP AIO request.
John Baldwin [Fri, 15 Sep 2017 22:40:57 +0000 (22:40 +0000)]
Avoid reusing the wrong buffer for a DDP AIO request.

To optimize the case of ping-ponging between two buffers, the DDP code
caches the last two buffers used keeping the pages wired and page pods
stored in the NIC's RAM.  If a new aio_read() request uses one of the
same buffers, then the work of holding pages, etc. can be avoided.
However, the starting virtual address of an aio buffer was not saved,
only the page count, length, and initial page offset.  Thus, an
aio_read() request could match a different buffer in the address
space.  (Earlier during development vm_fault_hold_quick_pages() was
always called and the vm_page_t values were compared, but that was
eventually removed without being adequately replaced.)  Fix by storing
the starting virtual address and comparing that (along with other
fields) to determine if a buffer can be reused.

MFC after: 3 days
Sponsored by: Chelsio Communications

6 years agoFix line wrap issues.
Scott Long [Fri, 15 Sep 2017 20:58:52 +0000 (20:58 +0000)]
Fix line wrap issues.

Sponsored by: Netflix

6 years agoRemove tailing whitespace.
Michael Tuexen [Fri, 15 Sep 2017 20:46:51 +0000 (20:46 +0000)]
Remove tailing whitespace.

6 years agoRemove empty line accidently introduced in r323626.
Michael Tuexen [Fri, 15 Sep 2017 20:41:12 +0000 (20:41 +0000)]
Remove empty line accidently introduced in r323626.

6 years agoAdd references. Suggested by Maxim Konovalov.
Michael Tuexen [Fri, 15 Sep 2017 20:34:52 +0000 (20:34 +0000)]
Add references. Suggested by Maxim Konovalov.

Sponsored by: Netflix, Inc.

6 years agoAllow multiple TRIMs to be done for nda
Warner Losh [Fri, 15 Sep 2017 20:16:06 +0000 (20:16 +0000)]
Allow multiple TRIMs to be done for nda

Don't call cam_iosched_trim_done or cam_iosched_submit_trim for nda
since its hardware can handle almost an arbitrary number of TRIMs and
we don't have to be careful to only ever do one.

Sponsored by: Netflix

6 years agoUpdate comments on what the CAM_IOSCHED_FLAG_TRIM_ACTIVE means.
Warner Losh [Fri, 15 Sep 2017 20:15:55 +0000 (20:15 +0000)]
Update comments on what the CAM_IOSCHED_FLAG_TRIM_ACTIVE means.

It's intended only for those situations where the periph driver
ones to limit the number of trims active to one and only one.
Also update comments on associated functions.

Sponsored by: Netflix

6 years agorename(2): document capability mode errors
Ed Maste [Fri, 15 Sep 2017 20:12:38 +0000 (20:12 +0000)]
rename(2): document capability mode errors

Reviewed by: allanjude
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12339

6 years agoopen(2): update ENOTCAPABLE description for .. lookups
Ed Maste [Fri, 15 Sep 2017 20:05:55 +0000 (20:05 +0000)]
open(2): update ENOTCAPABLE description for .. lookups

After r308212 Capsicum permits .. lookups in capability mode, as long as
path component traversal does not escape the directory corresponding to
the provided file descriptor.

We should add a description of the vfs.lookup_cap_dotdot and
vfs.lookup_cap_dotdot_nonlocal sysctls, perhaps as a cross-reference to
capsicum(4). I intend to look at that soon.

Reviewed by: bjk, cem, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12343

6 years agoAdd MIPS32/64 Rev2 CP0 intctl register definitions.
Landon J. Fuller [Fri, 15 Sep 2017 19:56:21 +0000 (19:56 +0000)]
Add MIPS32/64 Rev2 CP0 intctl register definitions.

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D12300

6 years agoFix the raise tests.
Bryan Drewery [Fri, 15 Sep 2017 19:48:48 +0000 (19:48 +0000)]
Fix the raise tests.

- The exit probe was not appropriately filtered to only the known pid so it
  was firing on any random process that would exit rather the only the one
  we cared about.
- The dtest script executes the tst.raise*.exe in the background from
  POSIX sh without jobs control.  POSIX mandates that SIGINT be set to
  SIG_IGN in this case.  The test executable never actually tested that
  SIGINT could be caught despite trying to block and delay the signal.
  So the SIGINT sent from raise() is never actually received since it
  is ignored.  This could be fixed by calling 'trap - INT' from dtest
  before running the executable but I've opted to just use SIGUSR1
  instead in these specific tests rather than adding more logic to
  test that SIGINT is not ignored at startup.

These 2 issues meant that the tests would randomly work but only if a process
coincidentally exited during the test.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoMiscellaneous fixes and improvements to MMCCAM stack
Ilya Bakulin [Fri, 15 Sep 2017 19:47:44 +0000 (19:47 +0000)]
Miscellaneous fixes and improvements to MMCCAM stack

 * Demote the level of several debug messages to CAM_DEBUG_TRACE
 * Add detection for SDHC cards that can do 1.8V. No voltage switch sequence
   is issued yet;
 * Don't create a separate LUN for each SDIO function. We need just one to make
   pass(4) attach;
 * Remove obsolete mmc_sdio* files. SDIO functionality will be moved into the
   separate device that will manage a new sdio(4) bus;
 * Terminate probing if got no reply to CMD0;
 * Make bcm2835 SDHCI host controller driver compile with 'option MMCCAM'.

Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D12109

6 years agoBatch freeing of the pages in vm_object_page_remove() under the same
Konstantin Belousov [Fri, 15 Sep 2017 16:07:09 +0000 (16:07 +0000)]
Batch freeing of the pages in vm_object_page_remove() under the same
free queue mutex lock owning session, same as it was done for the
object termination in r323561.

Reported and tested by: mjg
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agobsdgrep: disable TRE implementation by default
Kyle Evans [Fri, 15 Sep 2017 15:57:15 +0000 (15:57 +0000)]
bsdgrep: disable TRE implementation by default

Start the phasing out of TRE by disabling it by default. r317254 introduced
a BSD_GREP_FASTMATCH knob (defaulting to on) for testing of bsdgrep with and
without TRE enabled. More bugs have cropped up since then, and
WITHOUT_BSD_GREP_FASTMATCH has shown in testing to be more stable than its
counterpart.

Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D12381

6 years agoAdd support for parsing the Watchdog Descriptor Table (WDDT)
Scott Long [Fri, 15 Sep 2017 15:41:07 +0000 (15:41 +0000)]
Add support for parsing the Watchdog Descriptor Table (WDDT)

Sponsored by: Netflix

6 years agoInclude _bitset.h to get BITSET_DEFINE, used to define struct slabbits.
Mark Johnston [Fri, 15 Sep 2017 14:59:35 +0000 (14:59 +0000)]
Include _bitset.h to get BITSET_DEFINE, used to define struct slabbits.

MFC after: 1 week

6 years agogmirror: treat ENXIO as disk disconnect, not media error
Andriy Gapon [Fri, 15 Sep 2017 13:57:08 +0000 (13:57 +0000)]
gmirror: treat ENXIO as disk disconnect, not media error

In theory, all data access errors mean that a member is out of sync
at most.  But they were treated as more serious errors to avoid the
situation where a flaky disk gets repeatedly disconnected, re-synchronized,
reconnected and then disconnected again.

ENXIO is a special error that means that the member disk disappeared,
so it should get the same handling as the GEOM orphaning event.
There is a better chance that when the disk is reconnected, it will be
a good member again.

When ENXIO happens on a read we use the exisiting G_MIRROR_BUMP_SYNCID
mechanism which means that the mirror's syncid is increased as soon
as there is a write to the mirror.  That's because no data has got out
of sync yet, but the problematic memeber is disconnected, so the future
write will make it stale.

When ENXIO happens on a write we use a new G_MIRROR_BUMP_SYNCID_NOW
mechanism which means that we update the mirror metadata as soon as
possible because the problematic memeber is already behind.

Reviewed by: markj, imp
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D9463

6 years agofastmatch.h: remove duplicate #defines
Ed Maste [Fri, 15 Sep 2017 13:34:00 +0000 (13:34 +0000)]
fastmatch.h: remove duplicate #defines

Reviewed by: kevans
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12375

6 years agoAdd the ARMv8.3 ID register fields. These were found in the A-Profile
Andrew Turner [Fri, 15 Sep 2017 12:57:34 +0000 (12:57 +0000)]
Add the ARMv8.3 ID register fields. These were found in the A-Profile
exploration tools documentation:
https://developer.arm.com/products/architecture/a-profile/exploration-tools

Sponsored by: DARPA, AFRL

6 years agoUpdate OptionalObsoleteFiles.inc with NTP docs
Ed Maste [Fri, 15 Sep 2017 00:54:37 +0000 (00:54 +0000)]
Update OptionalObsoleteFiles.inc with NTP docs

The list of files for MK_NTP was incomplete.

PR: 218193
Submitted by: brnrd
MFC after: 1 week

6 years agoAdd myself (leres) as a ports committer with ler and matthew as mentors.
Craig Leres [Fri, 15 Sep 2017 00:08:36 +0000 (00:08 +0000)]
Add myself (leres) as a ports committer with ler and matthew as mentors.

Reviewed by: matthew (mentor)
Approved by: matthew (mentor)
Differential Revision: https://reviews.freebsd.org/D12372

6 years agoFix some incorrect sysctl pointers for some error stats.
John Baldwin [Thu, 14 Sep 2017 21:06:08 +0000 (21:06 +0000)]
Fix some incorrect sysctl pointers for some error stats.

The bad_session, sglist_error, and process_error sysctl nodes were
returning the value of the pad_error node instead of the appropriate
error counters.

Sponsored by: Chelsio Communications

6 years agoBump date missed in r323596. Trim trailing whitespace.
Michael Tuexen [Thu, 14 Sep 2017 20:42:19 +0000 (20:42 +0000)]
Bump date missed in r323596. Trim trailing whitespace.

Sponsored by: Netflix, Inc.

6 years agolibedit: raise the warning level to 3.
Pedro F. Giffuni [Thu, 14 Sep 2017 19:50:07 +0000 (19:50 +0000)]
libedit: raise the warning level to 3.

NetBSD has the warning level to 5 but that actually triggers -Wcast-qual.

6 years agoSilently handle freeaddrinfo(NULL) for compatibility with code which
Konstantin Belousov [Thu, 14 Sep 2017 19:18:24 +0000 (19:18 +0000)]
Silently handle freeaddrinfo(NULL) for compatibility with code which
works on other OSes.  Also avoid unnecessary NULL check, free(NULL) is
valid.

Reviewed by: bjk (man page), hrs, hselasky, ume
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D12354

6 years agoAdd a description how tcpdrop handles the case of specifying the
Michael Tuexen [Thu, 14 Sep 2017 18:50:40 +0000 (18:50 +0000)]
Add a description how tcpdrop handles the case of specifying the
-s and the -S option.

Sponsored by: Netflix, Inc.

6 years agoFix locking in soisconnected().
Gleb Smirnoff [Thu, 14 Sep 2017 18:05:54 +0000 (18:05 +0000)]
Fix locking in soisconnected().

When a newborn socket moves from incomplete queue to complete
one, we need to obtain the listening socket lock after the child,
which is a wrong order.  The old code did that in potentially
endless loop of mtx_trylock().  The new one does only one attempt
of mtx_trylock(), and in case of failure references listening
socket, unlocks child and locks everything in right order.  In
case if listening socket shuts down during that, just bail out.

Reported & tested by: Jason Eggleston <jeggleston llnw.com>
Reported & tested by: Jason Wolfe <jason llnw.com>

6 years agoAdd support for handling undefined instructions in userspace and the
Andrew Turner [Thu, 14 Sep 2017 17:29:51 +0000 (17:29 +0000)]
Add support for handling undefined instructions in userspace and the
kernel. We can register callbacks to perform the required operation on the
saved registers before returning.

This is initially used to work around a bug in old versions of QEMU that
trigger such an exception when reading from an ID register when it should
load z zero value.

I expect this could be used with other exception types, e.g. to emulate
special register access from userland.

Sponsored by: DARPA, AFRL

6 years agoloader: biosmem.c cstyle cleanup
Toomas Soome [Thu, 14 Sep 2017 16:42:29 +0000 (16:42 +0000)]
loader: biosmem.c cstyle cleanup

No functional changes, just cleanup.

Reviewed by: allanjude, imp
Differential Revision: https://reviews.freebsd.org/D12370

6 years agoRecognize NT_PTLWPINFO and NT_ARM_VFP in FreeBSD ELF cores.
John Baldwin [Thu, 14 Sep 2017 16:41:24 +0000 (16:41 +0000)]
Recognize NT_PTLWPINFO and NT_ARM_VFP in FreeBSD ELF cores.

Reviewed by: emaste
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12371

6 years agoocteon sdk: initialize variable to quiet Clang warning
Ed Maste [Thu, 14 Sep 2017 16:41:22 +0000 (16:41 +0000)]
octeon sdk: initialize variable to quiet Clang warning

Clang complains "variable 'dummy' is uninitialized when used here".

Reported by: Clang
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoAdd PNP metadata to a few drivers
Conrad Meyer [Thu, 14 Sep 2017 15:34:45 +0000 (15:34 +0000)]
Add PNP metadata to a few drivers

An eventual devd(8) or other component should be able to scan buses and
automatically load drivers that match device ids described in this metadata.

Reviewed by: imp
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12364

6 years agoAdd AT_EHDRFLAGS and AT_HWCAP on amd64.
John Baldwin [Thu, 14 Sep 2017 15:34:29 +0000 (15:34 +0000)]
Add AT_EHDRFLAGS and AT_HWCAP on amd64.

x86 has two separate (but identical) list of AT_* constants and the
earlier commit to add AT_HWCAP only updated the i386 list.

6 years agoAdd a NT_ARM_VFP ELF core note to hold VFP registers for each thread.
John Baldwin [Thu, 14 Sep 2017 15:07:48 +0000 (15:07 +0000)]
Add a NT_ARM_VFP ELF core note to hold VFP registers for each thread.

The core note matches the format and layout of NT_ARM_VFP on Linux.
Debuggers use the AT_HWCAP flags to determine how many VFP registers
are actually used and their format.

Reviewed by: mmel (earlier version w/o gcore)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12293

6 years agoExport get/set_vfpcontext from machdep.c.
John Baldwin [Thu, 14 Sep 2017 15:06:29 +0000 (15:06 +0000)]
Export get/set_vfpcontext from machdep.c.

Should have been part of the previous commit to add ptrace operations
for VFP registers.

MFC after: 1 month

6 years agoAdd ptrace operations to fetch and store VFP registers.
John Baldwin [Thu, 14 Sep 2017 15:03:43 +0000 (15:03 +0000)]
Add ptrace operations to fetch and store VFP registers.

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

6 years agoOnly mess with VFP state on the CPU for curthread for get/set_vfpcontext.
John Baldwin [Thu, 14 Sep 2017 14:36:56 +0000 (14:36 +0000)]
Only mess with VFP state on the CPU for curthread for get/set_vfpcontext.

Future changes will use these functions to fetch and store VFP state for
threads other than curthread.

Reviewed by: andrew, stevek, Michal Meloun <meloun-miracle-cz>
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12292

6 years agoAdd AT_HWCAP flags for VFP settings for FreeBSD/arm.
John Baldwin [Thu, 14 Sep 2017 14:30:43 +0000 (14:30 +0000)]
Add AT_HWCAP flags for VFP settings for FreeBSD/arm.

These flags match the meaning and value of flags in Linux, though
Linux has many more flags.

Reviewed by: stevek, Michal Meloun <meloun-miracle-cz> (earlier version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12291

6 years agoAdd AT_HWCAP and AT_EHDRFLAGS on all platforms.
John Baldwin [Thu, 14 Sep 2017 14:26:55 +0000 (14:26 +0000)]
Add AT_HWCAP and AT_EHDRFLAGS on all platforms.

A new 'u_long *sv_hwcap' field is added to 'struct sysentvec'.  A
process ABI can set this field to point to a value holding a mask of
architecture-specific CPU feature flags.  If an ABI does not wish to
supply AT_HWCAP to processes the field can be left as NULL.

The support code for AT_EHDRFLAGS was already present on all systems,
just the #define was not present.  This is a step towards unifying the
AT_* constants across platforms.

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

6 years agodounmount: do not release the mount point's reference on the covered vnode
Andriy Gapon [Thu, 14 Sep 2017 08:47:06 +0000 (08:47 +0000)]
dounmount: do not release the mount point's reference on the covered vnode

As long as mnt_ref is not zero there can be a consumer that might try
to access mnt_vnodecovered.  For this reason the covered vnode must not
be freed until mnt_ref goes to zero.
So, move the release of the covered vnode to vfs_mount_destroy.

Reviewed by: kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D12329

6 years agoImplement gawk multiple-arg extension to and, or, and xor.
Warner Losh [Thu, 14 Sep 2017 05:48:23 +0000 (05:48 +0000)]
Implement gawk multiple-arg extension to and, or, and xor.

gawk allows multiple arguemnts to bit-wiste and, or and xor
functions. Implement an arbitrary number of arguments for these
functions. Also, use NULL in preference to 0 to match rest of file.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12361

6 years agoBring in bit operation functions, ala gawk.
Warner Losh [Thu, 14 Sep 2017 05:47:55 +0000 (05:47 +0000)]
Bring in bit operation functions, ala gawk.

These are from OpenBSD:
>>> Extend awk with bitwise operations. This is an extension to the awk
>>> spec and documented as such, but comes in handy from time to time.
>>> The prototypes make it compatible with a similar GNU awk extension.
>>>
>>> ok millert@, enthusiasm from deraadt@

Edited to fix cut and paste in error messages, as well as
using tabs instead of spaces after #defines added.

Obtained From: OpenBSD awk.h 1.12, lex.c 1.10, run.c 1.29
Differential Revision: https://reviews.freebsd.org/D12361
Sponsored by: Netflix

6 years agoAdd second entry to LUT on a link side in B2B mode.
Alexander Motin [Thu, 14 Sep 2017 04:51:17 +0000 (04:51 +0000)]
Add second entry to LUT on a link side in B2B mode.

Each of two entries on a virtual side should have its counterpart on a
peer's link side.

MFC after: 1 week

6 years agogcc builds: reenable -Wstrict-overflow for kern.mk
Ryan Libby [Thu, 14 Sep 2017 03:42:41 +0000 (03:42 +0000)]
gcc builds: reenable -Wstrict-overflow for kern.mk

Reviewed by: emaste
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12284

6 years agogcc builds: reenable -Wstrict-overflow for bsd.sys.mk
Ryan Libby [Thu, 14 Sep 2017 03:41:49 +0000 (03:41 +0000)]
gcc builds: reenable -Wstrict-overflow for bsd.sys.mk

This effectively reverts r304877, after having relegated the warning
suppression to the zic(8) makefile in r323572.

Reviewed by: emaste
Sponsored by: Dell EMC Isilon
X-Differential Revision: https://reviews.freebsd.org/D12284

6 years agozic: -Wno-error=strict-overflow
Ryan Libby [Thu, 14 Sep 2017 03:39:42 +0000 (03:39 +0000)]
zic: -Wno-error=strict-overflow

Reviewed by: emaste
Sponsored by: Dell EMC Isilon
X-Differential Revision: https://reviews.freebsd.org/D12284

6 years agoUse soref() in sendfile(2) instead fhold() to reference a socket.
Gleb Smirnoff [Wed, 13 Sep 2017 22:11:05 +0000 (22:11 +0000)]
Use soref() in sendfile(2) instead fhold() to reference a socket.

The problem is that fdrop() requires syscall context, as it may
enter sleep in some cases.  The reason to use it in the original
non-blocking sendfile implementation, was to avoid use of global
ACCEPT_LOCK() on every I/O completion. Now in head sorele() no
longer requires this lock.

6 years agoWiden uk_pgoff, the slab header offset field.
Mark Johnston [Wed, 13 Sep 2017 21:54:37 +0000 (21:54 +0000)]
Widen uk_pgoff, the slab header offset field.

16 bits is only wide enough for kegs with an item size of up to 64KB.
At that size or larger, slab headers are typically offpage because the
item size is a multiple of the page size, but there is no requirement
that this be the case.

We can widen the field without affecting the layout of struct uma_keg
since the removal of uk_slabsize in r315077 left an adjacent hole.

PR: 218911
MFC after: 2 weeks

6 years agoRemove inline specifier from vm_page_free_wakeup(), do not
Konstantin Belousov [Wed, 13 Sep 2017 19:30:09 +0000 (19:30 +0000)]
Remove inline specifier from vm_page_free_wakeup(), do not
micro-manage compiler.

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

6 years agoDo not relock free queue mutex for each page, free whole terminating
Konstantin Belousov [Wed, 13 Sep 2017 19:22:07 +0000 (19:22 +0000)]
Do not relock free queue mutex for each page, free whole terminating
object' page queue under the single mutex lock.

First, all pages on the queue are prepared for free by calls to
vm_page_free_prep(), and pages which should not be returned to the
physical allocator (e.g. wired or fictitious) are simply removed from
the queue.  On the second pass, vm_page_free_phys_pglist() inserts all
pages from the queue without relocking the mutex.

The change improves the object termination, e.g. on the process exit
where large anonymous memory objects otherwise cause relocks the free
queue mutex for each page.  More, if several such processes are
exiting or execing in parallel, the mutex was highly contended on
the address space demolition.

Diagnosed and tested by: mjg (previous version)
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoSplit vm_page_free_toq() into two parts, preparation vm_page_free_prep()
Konstantin Belousov [Wed, 13 Sep 2017 19:11:52 +0000 (19:11 +0000)]
Split vm_page_free_toq() into two parts, preparation vm_page_free_prep()
and insertion into the phys allocator free queues vm_page_free_phys().
Also provide a wrapper vm_page_free_phys_pglist() for batched free.

Reviewed by: alc, markj
Tested by: mjg (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoUse existing tag name for the vm_object' memq.
Konstantin Belousov [Wed, 13 Sep 2017 19:03:59 +0000 (19:03 +0000)]
Use existing tag name for the vm_object' memq.

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

6 years agoRemove an unneeded sentence stop.
Glen Barber [Wed, 13 Sep 2017 18:32:43 +0000 (18:32 +0000)]
Remove an unneeded sentence stop.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agoRetire the T3 iWARP and TOE drivers. This saves catch-up work when OFED or
Navdeep Parhar [Wed, 13 Sep 2017 17:49:23 +0000 (17:49 +0000)]
Retire the T3 iWARP and TOE drivers.  This saves catch-up work when OFED or
other kernel infrastructure changes.

Note that this doesn't affect the base cxgb(4) NIC driver for T3 at all.

MFC after: No MFC.
Sponsored by: Chelsio Communications

6 years agointpm(4): Decrease requested i/o port range width
Conrad Meyer [Wed, 13 Sep 2017 17:43:18 +0000 (17:43 +0000)]
intpm(4): Decrease requested i/o port range width

On some AMD FCH devices driven by intpm(4) (read: mine), the SMBus I/O port
range is split in two and the low range is only 0x10 wide.  intpm(4) does
not access any registers above 0x0f, so there is no need for the wider
range.

Discussed with: avg
Sponsored by: Dell EMC Isilon

6 years agoIncrease EFI boot file size frok 128k to 384k
Allan Jude [Wed, 13 Sep 2017 17:00:02 +0000 (17:00 +0000)]
Increase EFI boot file size frok 128k to 384k

generate_fat.sh does the following:
- create an 800kb zero-filled file
- create an md device backed by this file
- format the device fat12
- mount the filesystem
- create the EFI ESP directory structure
- create the EFI boot file (BOOTx64 for amd64, BOOTaa64 for aarch64, etc)
- Adds a marker to the beginning of the file, and pad it to 384kb
- 384kb was chosen as it is less than half of 800kb, thus allowing
  users to keep a backup of their older boot file in the small partition
- Unmount the filesystem
- Scan the image and find the offset where the marker was inserted
- The process requires root, to make image generation easier, images for
  each architecture are pregenerated, compressed with xz, and checked
  into svn.

The Makefile that generates boot1.efifat does the following:
- Ensure the compiled boot1.efi file is no larger than the generated image
- Decompress the template created by generate-fat.sh
- dd the contents of boot1.efi into boot1.efifat starting at the offset
  where the marker is found. This allows any file less than the maximum
  size to be written into the fat filesystem without having to mount it,
  so no root privileges are required.

Later work by imp and myself makes bsdinstall create a 200mb fat16 instead
of using this process, but it is retained to make image generation easier.

Submitted by: Eric McCorkle (original version)
Reviewed by: emaste, tsoome, Eric McCorkle
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9680

6 years agoDefer attaching and probing iicbus and its children until interrupts are
Ian Lepore [Wed, 13 Sep 2017 16:54:27 +0000 (16:54 +0000)]
Defer attaching and probing iicbus and its children until interrupts are
available, in i2c controller drivers that require interrupts for transfers.

This is the result of auditing all 22 existing drivers that attach iicbus.
These drivers were the only ones remaining that require interrupts and were
not using config_intrhook to defer attachment.  That has led, over the
years, to various i2c slave device drivers needing to use config_intrhook
themselves rather than performing bus transactions in their probe() and
attach() methods, just in case they were attached too early.

6 years agoFix two issues with not ready data in sockets (read: sendfile)
Gleb Smirnoff [Wed, 13 Sep 2017 16:47:23 +0000 (16:47 +0000)]
Fix two issues with not ready data in sockets (read: sendfile)
in UNIX sockets.

o Check that socket is still connected in uipc_ready(). If not
  we are responsible to free mbufs.
o In uipc_send() if socket appears to be disconnected, but we
  are sending data with pending I/Os, don't free mbufs.

Reported by: Kevin Bowling <kbowling llnw.com>
Tested by: Kevin Bowling <kbowling llnw.com>
PR: 222259
Reported by: Mark Martinec <Mark.Martinec ijs.si>
MFC after: 3 days

6 years agointpm(4): While here, remove redundant 'res' check
Conrad Meyer [Wed, 13 Sep 2017 16:43:31 +0000 (16:43 +0000)]
intpm(4): While here, remove redundant 'res' check

Reported by: avg
Sponsored by: Dell EMC Isilon

6 years agoDeorbit catman. The tradeoff of disk for performance has long since tipped
Gordon Tetlow [Wed, 13 Sep 2017 16:35:16 +0000 (16:35 +0000)]
Deorbit catman. The tradeoff of disk for performance has long since tipped
in favor of just rendering the manpage instead of relying on pre-formatted
catpages. Note, this does not impede the ability to use existing catpages,
it just removes the utility to generate them.

Reviewed by: imp, allanjude
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D12317

6 years agointpm(4): Do not attach if io_res can not be allocated
Conrad Meyer [Wed, 13 Sep 2017 16:23:59 +0000 (16:23 +0000)]
intpm(4): Do not attach if io_res can not be allocated

Attempts to use the driver without an io_res result in immediate panic.

Sponsored by: Dell EMC Isilon

6 years agolibedit: add missing bracket.
Pedro F. Giffuni [Wed, 13 Sep 2017 16:13:14 +0000 (16:13 +0000)]
libedit: add missing bracket.

We never hit this because we always build with widechar support.

Reported by: cognet
MFC after: 3 days

6 years agoFix a logic error in the item size calculation for internal UMA zones.
Mark Johnston [Wed, 13 Sep 2017 15:44:54 +0000 (15:44 +0000)]
Fix a logic error in the item size calculation for internal UMA zones.

Kegs for internal zones always keep the slab header in the slab itself.
Therefore, when determining the allocation size, we need to take the
slab header size into account.

Reported and tested by: ae, rakuco
Reviewed by: avg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12342

6 years agoDon't (try to) build lio(4) if the SOURCELESS_UCODE is set.
Sean Bruno [Wed, 13 Sep 2017 15:17:35 +0000 (15:17 +0000)]
Don't (try to) build lio(4) if the SOURCELESS_UCODE is set.

Submitted by: Fabien Keil <fk@fabiankeil.de>

6 years agoIncrease arm{,64} SoC image sizes to prevent "filesystem full" build
Glen Barber [Wed, 13 Sep 2017 14:30:30 +0000 (14:30 +0000)]
Increase arm{,64} SoC image sizes to prevent "filesystem full" build
failures.

Sponsored by: The FreeBSD Foundation

6 years agolibefi: efipart_realstrategy rsize pointer may be NULL
Toomas Soome [Wed, 13 Sep 2017 14:27:13 +0000 (14:27 +0000)]
libefi: efipart_realstrategy rsize pointer may be NULL

Need to check rsize before dereferencing it.

6 years agojedec_ts: add many more devices from various vendors
Andriy Gapon [Wed, 13 Sep 2017 13:03:29 +0000 (13:03 +0000)]
jedec_ts: add many more devices from various vendors

The new IDs are taken from the hardware to which I have access
and from open datasheets.

Also, the hardware probing is moved to the device probe method.

Reviewed by: rpokala
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11730

6 years agoqlnx: exclude if WITHOUT_SOURCELESS_UCODE set
Ed Maste [Wed, 13 Sep 2017 12:16:27 +0000 (12:16 +0000)]
qlnx: exclude if WITHOUT_SOURCELESS_UCODE set

PR: 222277
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week

6 years agoAdd MMCCAM-enabled kernel config for IMX6, reduce debug noice in MMCCAM kernels
Ilya Bakulin [Wed, 13 Sep 2017 10:56:02 +0000 (10:56 +0000)]
Add MMCCAM-enabled kernel config for IMX6, reduce debug noice in MMCCAM kernels

CAM_DEBUG_TRACE results in way too much debug output than needed now.
When debugging, it's always possible to turn on trace level using camcontrol.

Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D12110

6 years agoMFV r323527: 5815 libzpool's panic function doesn't set global panicstr, ::status...
Andriy Gapon [Wed, 13 Sep 2017 10:34:31 +0000 (10:34 +0000)]
MFV r323527: 5815 libzpool's panic function doesn't set global panicstr, ::status not as useful

illumos/illumos-gate@fae6347731c9d3f46b26338313b0422927f29cf6
https://github.com/illumos/illumos-gate/commit/fae6347731c9d3f46b26338313b0422927f29cf6

https://www.illumos.org/issues/5815
  When panic() is called from within ztest, the mdb ::status command isn't as
  useful as it could be since the global panicstr variable isn't updated. We
  should modify the function to make sure panicstr is set, so ::status can
  present the error message just like it does on a failed assertion.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Prakash Surya <prakash.surya@delphix.com>
MFC after: 4 weeks

6 years ago5815 libzpool's panic function doesn't set global panicstr, ::status not as useful
Andriy Gapon [Wed, 13 Sep 2017 10:33:09 +0000 (10:33 +0000)]
5815 libzpool's panic function doesn't set global panicstr, ::status not as useful

illumos/illumos-gate@fae6347731c9d3f46b26338313b0422927f29cf6
https://github.com/illumos/illumos-gate/commit/fae6347731c9d3f46b26338313b0422927f29cf6

https://www.illumos.org/issues/5815
  When panic() is called from within ztest, the mdb ::status command isn't as
  useful as it could be since the global panicstr variable isn't updated. We
  should modify the function to make sure panicstr is set, so ::status can
  present the error message just like it does on a failed assertion.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Prakash Surya <prakash.surya@delphix.com>