]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoUse nitems() from sys/param.h.
araujo [Fri, 10 Mar 2017 06:25:54 +0000 (06:25 +0000)]
Use nitems() from sys/param.h.

Reviewed by: ngie
MFC after: 3 weeks.
Differential Revision: https://reviews.freebsd.org/D9940

7 years agoUse nitems() from sys/param.h.
araujo [Fri, 10 Mar 2017 06:23:15 +0000 (06:23 +0000)]
Use nitems() from sys/param.h.

Reviewed by: ngie
MFC after: 3 weeks.
Differential Revision: https://reviews.freebsd.org/D9936

7 years agoUse nitems() from sys/param.h and also remove the cast.
araujo [Fri, 10 Mar 2017 04:49:40 +0000 (04:49 +0000)]
Use nitems() from sys/param.h and also remove the cast.

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

7 years agoUse nitems() from sys/param.h.
araujo [Fri, 10 Mar 2017 04:30:31 +0000 (04:30 +0000)]
Use nitems() from sys/param.h.

Reviewed by: ume
MFC after: 3 weeks.
Differential Revision: https://reviews.freebsd.org/D9938

7 years agoUse nitems() from sys/param.h.
araujo [Fri, 10 Mar 2017 04:24:21 +0000 (04:24 +0000)]
Use nitems() from sys/param.h.

Reviewed by: asomers
MFC after: 3 weeks.
Differential Revision: https://reviews.freebsd.org/D9944

7 years agolocaledef(1): Fix small coverity issues.
pfg [Thu, 9 Mar 2017 21:49:11 +0000 (21:49 +0000)]
localedef(1): Fix small coverity issues.

- Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
- Buffer not null terminated (BUFFER_SIZE_WARNING)

CID: 13385571338565

Obtained from: illumos
MFC after: 5 days

7 years agoAvoid bind lock recursion.
kib [Thu, 9 Mar 2017 21:05:47 +0000 (21:05 +0000)]
Avoid bind lock recursion.

When dlclose(3) unloads an object with filtees, it recursively calls
dlclose(3) on each filtee in free_needed_filtees().  Introduce
dlclose_locked() helper, called from free_needed_filtees() instead of
dlclose(), and pass the bind lockstate down to avoid recursing.

Reported and tested by: jhibbits
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRevert r314969, r314961:
pfg [Thu, 9 Mar 2017 19:02:36 +0000 (19:02 +0000)]
Revert r314969, r314961:

The localdef(1) changes are breaking world:

00:18:40.750 /usr/src/share/colldef/af_ZA.UTF-8.src: 2421: error: Bad file
descriptor

I will fix them offline.

Reported by: lwshu and many others

7 years agoFix implementation of the DECLARE_WORK() macro in the LinuxKPI to fully
hselasky [Thu, 9 Mar 2017 18:37:17 +0000 (18:37 +0000)]
Fix implementation of the DECLARE_WORK() macro in the LinuxKPI to fully
initialize the declared work structure and not only the function callback
pointer.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoImplement support for mutexes with deadlock avoidance in the LinuxKPI.
hselasky [Thu, 9 Mar 2017 18:33:40 +0000 (18:33 +0000)]
Implement support for mutexes with deadlock avoidance in the LinuxKPI.

When locking a mutex and deadlock is detected the first mutex lock
call that sees the deadlock will return -EDEADLK .

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agolocaledef(1): Fix mismatch in previous commit.
pfg [Thu, 9 Mar 2017 18:06:48 +0000 (18:06 +0000)]
localedef(1): Fix mismatch in previous commit.

delete_category is meant to replace fclose() and unlink().
This broke world.

Found by: kib
Pointedhat: pfg

7 years agoReport some more data in XPT_PATH_INQ.
mav [Thu, 9 Mar 2017 17:53:37 +0000 (17:53 +0000)]
Report some more data in XPT_PATH_INQ.

I am not sure they are used anywhere, but why not.

MFC after: 2 weeks

7 years agoAdd support for XPT_GET_SIM_KNOB in FC mode.
mav [Thu, 9 Mar 2017 17:35:35 +0000 (17:35 +0000)]
Add support for XPT_GET_SIM_KNOB in FC mode.

MFC after: 2 weeks

7 years agoReport FC link speed.
mav [Thu, 9 Mar 2017 17:06:34 +0000 (17:06 +0000)]
Report FC link speed.

MFC after: 2 weeks

7 years agoCleanup the LinuxKPI mutex wrappers.
hselasky [Thu, 9 Mar 2017 17:01:00 +0000 (17:01 +0000)]
Cleanup the LinuxKPI mutex wrappers.

Add support for using mutexes during KDB and shutdown. This is also
required for doing mode-switching during panic for drm-next.

Add new mutex functions mutex_init_witness() and mutex_destroy()
allowing LinuxKPI mutexes to be tracked by witness.

Declare mutex_is_locked() and mutex_is_owned() like inline functions
to get cleaner warnings. These functions are used inside WARN_ON()
statements which might look a bit odd if these functions get fully
expanded.

Give mutexes better debug names through the mutex_name() macro when
WITNESS_ALL is defined. The mutex_name() macro can prefix parts of the
filename and line number before the mutex name.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoDecode modern PIM flags.
mav [Thu, 9 Mar 2017 16:34:55 +0000 (16:34 +0000)]
Decode modern PIM flags.

MFC after: 2 weeks

7 years agoFix harmless mismerge from r286964
asomers [Thu, 9 Mar 2017 16:22:21 +0000 (16:22 +0000)]
Fix harmless mismerge from r286964

MFC after: 3 days
Sponsored by: Spectra Logic Corp

7 years agoloader.efi: only include the machine/ header files on x86
dexuan [Thu, 9 Mar 2017 15:44:25 +0000 (15:44 +0000)]
loader.efi: only include the machine/ header files on x86

The 2 files may not exist on other archs like aarch64 and hence we
can have a build failure there.

Reported by: lwhsu
MFC after: 2 weeks
Sponsored by: Microsoft

7 years agolocaledef(1): Fix for memory leaks reported by coverity.
pfg [Thu, 9 Mar 2017 15:21:03 +0000 (15:21 +0000)]
localedef(1): Fix for memory leaks reported by coverity.

Also some small cleanups to match better current illumos.

CID: 1338540133854113385571338566

Obtained from: illumos
Discussed with: Yuri Pankov (@Nexenta)
MFC after: 5 days

7 years agoFix typo in comment.
kib [Thu, 9 Mar 2017 13:41:57 +0000 (13:41 +0000)]
Fix typo in comment.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 years agoloader.efi: only reduce the size of the staging area on Hyper-V
dexuan [Thu, 9 Mar 2017 12:09:07 +0000 (12:09 +0000)]
loader.efi: only reduce the size of the staging area on Hyper-V

Doing this on physical hosts turns out to be problematic, e.g. see comment
24 and 28 in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211746.

To fix the real underlying issue correctly & thoroughly, IMO we need
a relocatable kernel, but that would require a lot of complicated long
term work:  https://reviews.freebsd.org/D9686?id=25414#inline-56969

For now, let's only apply efi_verify_staging_size() to VMs running on
Hyper-V, and restore the old behavior on physical machines since that
has been working for people for a long period of time, though that's
potentially unsafe...

MFC after: 2 weeks
Sponsored by: Microsoft

7 years agoo Typo in the comment fixed.
maxim [Thu, 9 Mar 2017 09:54:23 +0000 (09:54 +0000)]
o Typo in the comment fixed.

PR: 217617
Submitted by: lutz

7 years agostyle(9): sort the #includes
ngie [Thu, 9 Mar 2017 09:25:11 +0000 (09:25 +0000)]
style(9): sort the #includes

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoDon't create any threads before SI_SUB_INIT_IF in the LinuxKPI. Else
hselasky [Thu, 9 Mar 2017 09:17:43 +0000 (09:17 +0000)]
Don't create any threads before SI_SUB_INIT_IF in the LinuxKPI. Else
kthread_add() will assert it is called too soon. This fixes a startup
issue when COMPAT_LINUXKPI is in enabled the kernel configuration
file.

Reported by: Michael Butler <imb@protected-networks.net>
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix unused variable when built without INVARIANT_SUPPORT.
mav [Thu, 9 Mar 2017 07:55:58 +0000 (07:55 +0000)]
Fix unused variable when built without INVARIANT_SUPPORT.

MFC after: 2 weeks

7 years agoExpect :test_zero_input to fail on amd64
ngie [Thu, 9 Mar 2017 06:58:47 +0000 (06:58 +0000)]
Expect :test_zero_input to fail on amd64

The clang 4.x+ upgrade now causes this testcase to fail, but
only on amd64.

More investigation will be done to determine the cause.

MFC after: 1 week
Reported by: Jenkins
PR: 217528
Sponsored by: Dell EMC Isilon

7 years agoDon't expect :test_large_inputs to fail with i386 anymore
ngie [Thu, 9 Mar 2017 06:56:44 +0000 (06:56 +0000)]
Don't expect :test_large_inputs to fail with i386 anymore

Recent changes (maybe a side-effect of the ATF-ification in r314649)
invalidate the failure expectation.

PR: 205446
MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoCache NLS data for strerror(3).
oshogbo [Thu, 9 Mar 2017 06:41:00 +0000 (06:41 +0000)]
Cache NLS data for strerror(3).

7 years agoTry to extract the RFC1048 data from PXE. If we get enough info we can skip
oshogbo [Thu, 9 Mar 2017 06:01:24 +0000 (06:01 +0000)]
Try to extract the RFC1048 data from PXE. If we get enough info we can skip
the bootp(). It removes unnecessary DHCP request from pxeloader.

Submitted by: kczekirda
Sponsored by: Oktawave
Initiated by: Matthew Dillon
Reviewed by: smh, gnn, bapt, oshogbo
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D9847

7 years agoSlight rewording in nvme(4)
asomers [Thu, 9 Mar 2017 05:30:05 +0000 (05:30 +0000)]
Slight rewording in nvme(4)

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

7 years agoConfigure leap-second smearing (always).
cy [Thu, 9 Mar 2017 05:29:24 +0000 (05:29 +0000)]
Configure leap-second smearing (always).

Leap-second smearing is an experimental option that may be specified in
ntp.conf(5) and the -x option on the command line to spread the effect
of a leap-second over an interval as specified by the leapsmearinterval
config file statement. Recommended values are between 7200 (2 hours) and
86400 (24 hours).

It is advised that leap-second smearing not be used for public NTP
servers (https://www.meinbergglobal.com/download/burnicki/Leap\
%20Second%20Smearing%20With%20NTP.pdf). It is also advised that NTP
clients not use a mix of NTP servers using leap-second smearing with
NTP servers not using leap-second smearing as that could cause
undefined client behaviour.

Leap-second smearing was committed to ports net/ntp and net/ntp-devel
by r426825 on 2016-11-22.

Suggested by: des
MFC after: 4 weeks

7 years agoSome style(9) fixes. No functional changes.
oshogbo [Thu, 9 Mar 2017 05:13:07 +0000 (05:13 +0000)]
Some style(9) fixes. No functional changes.

Submitted by: kczekirda
Sponsored by: Oktawave
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D9395

7 years agoRename some tests to end in _test.
bdrewery [Thu, 9 Mar 2017 04:20:00 +0000 (04:20 +0000)]
Rename some tests to end in _test.

Requested by: ngie
MFC after: 2 weeks
X-MFC-With: r314886

7 years agoRemove unneeded -x from tests.
bdrewery [Thu, 9 Mar 2017 04:19:52 +0000 (04:19 +0000)]
Remove unneeded -x from tests.

Reported by: ngie
MFC after: 2 weeks
X-MFC-With: r314886

7 years agoImport the awk(1) manpage from OpenBSD
bapt [Thu, 9 Mar 2017 03:27:53 +0000 (03:27 +0000)]
Import the awk(1) manpage from OpenBSD

As discussed during AsiaBSDcon devsummit, import the manpage from OpenBSD which
is has been rewritten in mdoc(7) format making it readable by default with
mandoc, it also has been extended by OpenBSD to cover all awk(1) options

Obtained from: OpenBSD
MFH: 1 week

7 years agoValidate values read from the RTC before trying BCD decoding
vangyzen [Thu, 9 Mar 2017 02:19:30 +0000 (02:19 +0000)]
Validate values read from the RTC before trying BCD decoding

Submitted by: cem
Reported by: Michael Gmelin <freebsd@grem.de>
Tested by: Oleksandr Tymoshenko <gonzo@bluezbox.com>
Sponsored by: Dell EMC

7 years agoec2.conf and vmimage.subr can be used from the installation livecd after
thompsa [Thu, 9 Mar 2017 01:26:10 +0000 (01:26 +0000)]
ec2.conf and vmimage.subr can be used from the installation livecd after
install to prepare an AMI image. This can be used to create a ZFS AMI disk
image using a virtual machine.

Change ec2.conf to use the pkg tool from a chroot rather than trying to
bootstrap it and fail from the livecd readonly filesystem.

Reviewed by: gjb

7 years ago[spigen] Add spigen module
gonzo [Thu, 9 Mar 2017 01:21:28 +0000 (01:21 +0000)]
[spigen] Add spigen module

spigen provides userland API to SPI bus. Make it available as a loadable
module so people using official ARM images can enabled it on devices like
BBB or RPi without re-building kernel

MFC after: 1 week

7 years ago[spigen] make spigen device ready to be compiled as a module
gonzo [Thu, 9 Mar 2017 01:00:27 +0000 (01:00 +0000)]
[spigen] make spigen device ready to be compiled as a module

- Add flag to indicate that device is opened by userland
- Replace "always fail" detach method with proper detach implementation

MFC after: 1 week

7 years agoDo not turn LOCK_DEBUG for INVARIANT_SUPPORT. This allows to add
glebius [Thu, 9 Mar 2017 00:58:21 +0000 (00:58 +0000)]
Do not turn LOCK_DEBUG for INVARIANT_SUPPORT.  This allows to add
INVARIANT_SUPPORT into a kernel without performance penalties.

Discussed with: jhb, mjg

7 years agoIn linker_load_file() print name of a file that failed to load.
glebius [Thu, 9 Mar 2017 00:56:07 +0000 (00:56 +0000)]
In linker_load_file() print name of a file that failed to load.

Discussed with: kib

7 years agoMake inp_lock_assert() depend on INVARIANT_SUPPORT, not INVARIANTS.
glebius [Thu, 9 Mar 2017 00:55:19 +0000 (00:55 +0000)]
Make inp_lock_assert() depend on INVARIANT_SUPPORT, not INVARIANTS.
This will make INVARIANT-enabled modules, that use this function to load
successfully on a kernel that has INVARIANT_SUPPORT only.

7 years agoReduce stack usage in link_elf_load_file(), allocating struct nameidata.
glebius [Thu, 9 Mar 2017 00:45:15 +0000 (00:45 +0000)]
Reduce stack usage in link_elf_load_file(), allocating struct nameidata.
This function may be called recursively, when a module pulls its dependencies.
Under certain circumstances, e.g. quad chain of dependencies and presence
of dtrace we may run out of stack.

7 years agoefidp manipulates UEFI Device Paths in various ways. At the moment, it
imp [Thu, 9 Mar 2017 00:33:38 +0000 (00:33 +0000)]
efidp manipulates UEFI Device Paths in various ways. At the moment, it
formats and parses UEFI standard Device Paths. In the future it will
also translate between FreeBSD driver names and UEFI Device Paths.

Sponsored by: Netflix

7 years agoFinish implementing -d/--device/--device-path flag to print variable
imp [Thu, 9 Mar 2017 00:31:36 +0000 (00:31 +0000)]
Finish implementing -d/--device/--device-path flag to print variable
as if it were a device path.

Remove language about a=b syntax on the command line. This will not be
implemented due to its limited usefulness. UEFI variables are binary
blobs, on the whole, and a simple work around exists for
strings. Clarify that the new value of the variable is taken from
stdin. Update manual with history.

Sponsored by: Netflix

7 years agoBring in EDK2 routines for printing and parsing device paths.
imp [Thu, 9 Mar 2017 00:31:31 +0000 (00:31 +0000)]
Bring in EDK2 routines for printing and parsing device paths.

This commit implements the (mostly?) Linux compatible
efidp_format_device_path and efidp_parse_device_path APIs. These are
the only APIs exposed through this library. However, they are built on
code from Tianocore's EDK2 MdePkg. They are brought in as new files
here for reasons described in FreeBSD-update.

Symbol versioning will be introduced to control what's exported from
the EDK2 code.

Some structural changes may be necessary when we move to sharing with
sys/boot/efi.

Sponsored by: Netflix

7 years agoShare UCS2/UTF8 routines between boot loader and userland.
imp [Thu, 9 Mar 2017 00:24:01 +0000 (00:24 +0000)]
Share UCS2/UTF8 routines between boot loader and userland.

Move the UCS2 to UTF8 routines over into sys/boot/efi and have
libefivar grab them from there.

Sponsored by: Netflix

7 years agosbin/devfs: clarify usage
ngie [Wed, 8 Mar 2017 23:58:10 +0000 (23:58 +0000)]
sbin/devfs: clarify usage

- Note existence of -m option.
- Note that -s applies to rule keyword, only, by adding usage text
  specifically for the `rule` and `ruleset` keywords.

Don't go into any further detail in usage(..) -- it's best that one
reads the manpage to get a better idea of how things work as there are
a number of different option-specific keywords and arguments, as well
as some rule grammar.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoiwn: add promiscuous mode support.
avos [Wed, 8 Mar 2017 22:49:22 +0000 (22:49 +0000)]
iwn: add promiscuous mode support.

Tested with Intel 6205, STA / MONITOR modes.

7 years agoFix compilation warning for powerpc64 by not using const keyword in
hselasky [Wed, 8 Mar 2017 21:28:53 +0000 (21:28 +0000)]
Fix compilation warning for powerpc64 by not using const keyword in
return types:

Type qualifiers ignored on function return type [-Wreturn-type]

Reported by: andreast @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoUpdate the comment for the Wacom WACF00e to make it clear it's not an
ian [Wed, 8 Mar 2017 20:58:56 +0000 (20:58 +0000)]
Update the comment for the Wacom WACF00e to make it clear it's not an
accidental duplicate of WACF004.

PR: 217306

7 years agoAdd the pnp id for a Wacom 'WACF00e' tablet.
ian [Wed, 8 Mar 2017 20:41:27 +0000 (20:41 +0000)]
Add the pnp id for a Wacom 'WACF00e' tablet.

PR: 217306
Submitted by: large.hadron.collider@gmx.com

7 years agoHandle fifo size differences between older and newer revs of pl011 hardware.
ian [Wed, 8 Mar 2017 18:53:32 +0000 (18:53 +0000)]
Handle fifo size differences between older and newer revs of pl011 hardware.

Starting with rev 5 (which is inexplicably indicated by a version number
of '3' in the Peripheral ID register), the pl011 doubled the size of the
rx and tx fifos, to 32 bytes, so read the ID register and set the size
variables in the softc accordingly.

An interesting wrinkle in this otherwise-simple concept is that the
bcm2835 SoC, used in Raspberry Pi systems among others, has the rev 5
pl011 hardware, but somehow also has the older 16-byte fifos.  We check
the FDT data to see if the hardware is part of a bcm283x system and use
the smaller size if so.

Thanks to jchandra@ for pointing out that newer hardware has bigger fifos.

7 years agoFix permissions on /tmp when installing the runtime package.
gjb [Wed, 8 Mar 2017 18:52:40 +0000 (18:52 +0000)]
Fix permissions on /tmp when installing the runtime package.

Reported by: many
Patch by: Kyle Evans
PR: 217574
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years agoUse the buildworld includes and defaults when building pkt-gen. This will
sbruno [Wed, 8 Mar 2017 17:29:40 +0000 (17:29 +0000)]
Use the buildworld includes and defaults when building pkt-gen.  This will
mean that you need a world built to reliably build pkg-gen but this keeps
the build from failing when your source doesn't match your host running
version, e.g. building 12 on 11.

Submitted by: Matt Macy <mmacy@nextbsd.org>
MFC after: 2 weeks
Sponsored by: Limelight Networks

7 years agoRelease all previously allocated resources.
mmel [Wed, 8 Mar 2017 14:52:03 +0000 (14:52 +0000)]
Release all previously allocated resources.

7 years agoMFV r314911: 7867 ARC space accounting leak
avg [Wed, 8 Mar 2017 13:52:45 +0000 (13:52 +0000)]
MFV r314911: 7867 ARC space accounting leak

illumos/illumos-gate@6de76ce2a90f54fecb0dba46dca08c99cef7aa08
https://github.com/illumos/illumos-gate/commit/6de76ce2a90f54fecb0dba46dca08c99cef7aa08

https://www.illumos.org/issues/7867
  It seems that in the case where arc_hdr_free_pdata() sees HDR_L2_WRITING() we
  would fail to update the ARC space statistics.
  In the normal case those statistics are updated in arc_free_data_buf(). But in
  the arc_hdr_free_on_write() path we don't do that.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Andriy Gapon <avg@FreeBSD.org>

MFC after: 10 days

7 years agoMFV r314910: 7843 get_clones_stat() is suboptimal for lots of clones
avg [Wed, 8 Mar 2017 13:48:26 +0000 (13:48 +0000)]
MFV r314910: 7843 get_clones_stat() is suboptimal for lots of clones

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

https://www.illumos.org/issues/7843
  get_clones_stat() could be very slow if a snapshot has many (thousands) clones.
  Clone names are added to an nvlist that's created with NV_UNIQUE_NAME.
  So, each time a new name is appended to the list, the whole list is searched
  linearly to see if that name is not already in the list. That results in the
  quadratic complexity.
  That should be easy to fix as we know in advance that we should not get any
  duplicate names, so we can drop NV_UNIQUE_NAME when creating the list.

Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Andriy Gapon <avg@FreeBSD.org>

MFC after: 1 week
Sponsored by: ClusterHQ

7 years agoWhen chunking large DIOCGDELETE, do it on stripe edge.
mav [Wed, 8 Mar 2017 12:18:58 +0000 (12:18 +0000)]
When chunking large DIOCGDELETE, do it on stripe edge.

MFC after: 2 weeks

7 years agoUnbreak ARMv6 world.
mmel [Wed, 8 Mar 2017 11:40:27 +0000 (11:40 +0000)]
Unbreak ARMv6 world.

The new compiler_rt library imported with clang 4.0.0 have several fatal
issues (non-functional __udivsi3 for example) with ARM specific instrict
functions. As temporary workaround, until upstream solve these problems,
disable all thumb[1][2] related feature.

7 years agoAdd initial support for UNMAP granularity.
mav [Wed, 8 Mar 2017 11:24:33 +0000 (11:24 +0000)]
Add initial support for UNMAP granularity.

Report UNMAP granularity as stripesize/-offset if we have no other values
to report there.

Add new quirk DA_Q_STRICT_UNMAP for cases when target is too critical to
misaligned UNMAP request, reporting errors instead of being suboptimal.
Setting this quirk makes da periph to forcefully align all UNMAP requests
to avoid those errors by the cost of some odd ranges not being UNMAP'ed.
This makes UNMAP usable within VMware 6.x VMs, just now 100% efficient.

MFC after: 2 weeks

7 years agoCleanup the LinuxKPI slab implementation.
hselasky [Wed, 8 Mar 2017 11:09:27 +0000 (11:09 +0000)]
Cleanup the LinuxKPI slab implementation.

Put large functions into linux_slab.c instead of declaring them static
inline.

Add support for more memory allocation wrappers like kmalloc_array()
and __vmalloc().

Make sure either the M_WAITOK or the M_NOWAIT flag is set and mask
away unused memory allocation flags before calling FreeBSD's malloc()
routine.

Move kmalloc_node() definition to slab.h where it belongs.

Implement support for the SLAB_DESTROY_BY_RCU feature when creating a
kmem_cache which basically means kmem_cache memory is freed using
call_rcu().

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoImplement eth_zero_addr() in the LinuxKPI.
hselasky [Wed, 8 Mar 2017 09:53:20 +0000 (09:53 +0000)]
Implement eth_zero_addr() in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoRemove reference to GNU info hier(7)
bapt [Wed, 8 Mar 2017 08:57:35 +0000 (08:57 +0000)]
Remove reference to GNU info hier(7)
we have removed texinfo in FreeBSD 11.0

7 years agotexinfo is gone in r276551 remove the related directories
bapt [Wed, 8 Mar 2017 08:52:15 +0000 (08:52 +0000)]
texinfo is gone in r276551 remove the related directories

Reported by: jbeich

7 years agoUse LDFLAGS rather than CFLAGS when linking.
brooks [Wed, 8 Mar 2017 08:25:26 +0000 (08:25 +0000)]
Use LDFLAGS rather than CFLAGS when linking.

Reviewed by: kan
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9882

7 years agoRemove now unneded cast.
ae [Wed, 8 Mar 2017 08:09:41 +0000 (08:09 +0000)]
Remove now unneded cast.

7 years agoMatch JETSON-TK1 FreeBSD specific DTS stub with r314854.
mmel [Wed, 8 Mar 2017 07:23:15 +0000 (07:23 +0000)]
Match JETSON-TK1 FreeBSD specific DTS stub with r314854.

7 years agoRemove extraneous arguments and options, which don't make sense for
cy [Wed, 8 Mar 2017 07:02:39 +0000 (07:02 +0000)]
Remove extraneous arguments and options, which don't make sense for
a file documented in volume 5.

MFC after: 3 days

7 years agoOnly install 900.tcpwrap if MK_INETD != "no" and MK_TCP_WRAPPERS != "no"
ngie [Wed, 8 Mar 2017 06:12:16 +0000 (06:12 +0000)]
Only install 900.tcpwrap if MK_INETD != "no" and MK_TCP_WRAPPERS != "no"

It relies on output from inetd that is triggered by MK_TCP_WRAPPERS=yes.

We need to check for both knobs being set -- otherwise the script doesn't
have much value.

PR: 217577
Submitted by: Sergey <kpect@protonmail.com> (MK_TCP_WRAPPERS piece)
MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoFix a couple of typos and reword some sentences in bsd.README.
jhb [Wed, 8 Mar 2017 05:49:58 +0000 (05:49 +0000)]
Fix a couple of typos and reword some sentences in bsd.README.

Reviewed by: bdrewery
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9922

7 years agousr.bin/fortune: convert to OBJTOP/SRCTOP idioms
ngie [Wed, 8 Mar 2017 05:31:54 +0000 (05:31 +0000)]
usr.bin/fortune: convert to OBJTOP/SRCTOP idioms

- Use OBJTOP/SRCTOP-relative paths when looking for include files and
  strfile.
- Add FORTUNES_OBJ and FORTUNES_SRC to abbreviate usr.bin/fortune
  pathing.

This is being done to simplify make output/idioms.

MFC after: 1 week
Reviewed by: bdrewery
Sponsored by: Dell EMC Isilon
Differential Revision: D9916

7 years agoFix install due to incorrect placement of pwait dir in r314886.
cy [Wed, 8 Mar 2017 05:27:04 +0000 (05:27 +0000)]
Fix install due to incorrect placement of pwait dir in r314886.

Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>
MFC after: 2 weeks
X-MFC with: r314886

7 years agoloader.efi: finally fix the off-by-one bug in efi_verify_staging_size()
dexuan [Wed, 8 Mar 2017 02:50:29 +0000 (02:50 +0000)]
loader.efi: finally fix the off-by-one bug in efi_verify_staging_size()

r314828(loader.efi: fix an off-by-one bug in efi_verify_staging_size())
doesn't really fix the bug and this patch adds the missing part.

It's a shame that I didn't make everything correct at the very beginning...

MFC after: 2 weeks
Sponsored by: Microsoft

7 years agoCopy needed include files from EDK2. This is a minimal set gleened
imp [Wed, 8 Mar 2017 02:47:59 +0000 (02:47 +0000)]
Copy needed include files from EDK2. This is a minimal set gleened
from the .depend files after the build:
cp -r ../vendor/edk2/MdePkg/Include sys/contrib/edk2
cd lib/libefivar
make
pushd `make -V .OBJDIR`
cat .depend*.o | grep sys/contrib | cut -d' ' -f 3 |
sort -u | sed -e 's=/full/path/sys/contrib/edk2/==' > /tmp/xxx
popd
cd ../../sys/contrib/edk2
rm -rf Include
for i in `cat /tmp/xxx`; do
svn cp svn+ssh://repo.freebsd.org/base/vendor/edk2/dist/MdePkg/$i $i
done
svn cp svn+ssh://repo.freebsd.org/base/vendor/edk2/dist/MdePkg/MdePkg.dec .

The original EDK2 repo is ~265MB, the MdePkg is ~23MB, all
MdePkg/Includes is ~7MB and this minimal set is ~1.3MB.

Sponsored by: Netflix

7 years agoAvoid dereferencing unintialized elements in the error path.
imp [Tue, 7 Mar 2017 23:06:41 +0000 (23:06 +0000)]
Avoid dereferencing unintialized elements in the error path.

Some drives sometimes have errors for things like setting the number
of queue entries in the submission queue. The error paths taken for
these drives ensure a panic dereferencing uninialized data.

Sponsored by: Netflix

7 years agocwd10 takes the low 32-bits and cwd11 takes the upper 32-bits of the
imp [Tue, 7 Mar 2017 23:02:59 +0000 (23:02 +0000)]
cwd10 takes the low 32-bits and cwd11 takes the upper 32-bits of the
lba. Rather than do a cast to uint64_t, which clang warns might be
unaligned, do the stores 32-bits at a time.

Sponsored by: Netflix

7 years agoAdd and use a MMC_DECLARE_BRIDGE macro for declaring mmc(4) bridges
marius [Tue, 7 Mar 2017 22:42:44 +0000 (22:42 +0000)]
Add and use a MMC_DECLARE_BRIDGE macro for declaring mmc(4) bridges
as kernel drivers and their dependency onto mmc(4); this allows for
incrementing the mmc(4) module version but also for entire omission
of these bridge declarations for mmccam(4) in a single place, i. e.
in dev/mmc/bridge.h.

7 years agopwait: Add a -t flag to specify a timeout before exiting, and tests.
bdrewery [Tue, 7 Mar 2017 22:16:55 +0000 (22:16 +0000)]
pwait: Add a -t flag to specify a timeout before exiting, and tests.

The exit status will be 124, as the timeout(1) utility uses.

Reviewed by: jilles
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9697

7 years agoFix booting with >4GB RAM on PowerMac G5 hardware
jhibbits [Tue, 7 Mar 2017 22:11:57 +0000 (22:11 +0000)]
Fix booting with >4GB RAM on PowerMac G5 hardware

===
From Nathan Whitehorn:

Open Firmware runs in virtual mode on the Powermac G5. This runs inside the
kernel page table, which preserves all address translations made by OF before
the kernel starts; as a result, the kernel address space is a strict superset of
OF's.

Where this explodes is if OF uses an unmapped SLB entry. The SLB fault handler
runs in real mode and refers to the PCPU pointer in SPRG0, which blows up the
kernel. Having a value of SPRG0 that works for the kernel is less fatal than
preserving OF's value in this case.

===

The result of this is seemingly random panics from NULL dereferences, or hangs
immediately upon boot.  By not restoring SPRG0 for Open Firmware entry the
kernel PCPU pointer is preserved and SLB faults are successful, resulting in a
stable kernel.

PR: 205458
Reported by: several (over bugzilla, lists, IRC)
Reviewed by: andreast
Tested by: many (various forms)
MFC after: 2 weeks

7 years agoMake multi-namespace nvme drives more robust.
imp [Tue, 7 Mar 2017 21:47:54 +0000 (21:47 +0000)]
Make multi-namespace nvme drives more robust.

Fix assumptions about name spaces in NVME driver. First, it assumes
cdata.nn is the number of configured devices. However, it is the
number of supported name spaces. Second, it assumes that there will
never be more than 16 name spaces supported, but a certain drive I'm
testing reports 1024. It assumes that name spaces are a tightly packed
namespace, but the standard seems to indicate otherwise. Finally, it
assumes that an error would be generated when quearying an
unconfigured namespace. Instead, it succeeds but the identify data is
all zeros.

Fix these by limiting the number of name spaces we probe to 16. Remove
aborting when we find one in error. When the size of the name space is
zero, ignore it.

This is admittedly a bandaide. The long term fix will be to
participate in the enumeration and name space change protocols
definfed in the NVNe standard.

Sponsored by: Netflix

7 years agoufsread: Use appropriate UFS_MAXNAMLEN constant
cem [Tue, 7 Mar 2017 21:40:01 +0000 (21:40 +0000)]
ufsread: Use appropriate UFS_MAXNAMLEN constant

A follow-up to r313475.

Submitted by: Gaurav Gangalwar <Gaurav.Gangalwar at emc.com>
Sponsored by: Dell EMC Isilon

7 years agoMove down to required dist directory for vendor tracking.
imp [Tue, 7 Mar 2017 20:58:08 +0000 (20:58 +0000)]
Move down to required dist directory for vendor tracking.

Pointy Hat To: me

7 years agoAdd support for constant pointer constructs to READ_ONCE() in the
hselasky [Tue, 7 Mar 2017 20:24:34 +0000 (20:24 +0000)]
Add support for constant pointer constructs to READ_ONCE() in the
LinuxKPI. When the type of the argument is constant the temporary
variable cannot be assigned after the barrier. Instead assign the
temporary variable by initialization.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agolpr(1): small bounds check with reallocarray(3).
pfg [Tue, 7 Mar 2017 19:30:22 +0000 (19:30 +0000)]
lpr(1): small bounds check with reallocarray(3).

While here plug a memory leak upon error and postpose a multiplication
until after reallocation has succeded.

Hinted partially by: OpenBSD
Reviewed by: gad
MFC after: 2 weeks

7 years agom_mbuftouio() doesn't modify the mbuf.
glebius [Tue, 7 Mar 2017 19:00:50 +0000 (19:00 +0000)]
m_mbuftouio() doesn't modify the mbuf.

7 years agoCatch up with Clang 4.0.0.
jkim [Tue, 7 Mar 2017 19:00:27 +0000 (19:00 +0000)]
Catch up with Clang 4.0.0.

7 years agoAdd bsd.man.mk references for MAN under bsd.lib.mk and bsd.prog.mk
ngie [Tue, 7 Mar 2017 17:53:53 +0000 (17:53 +0000)]
Add bsd.man.mk references for MAN under bsd.lib.mk and bsd.prog.mk

The latter set of manpages directly consume bsd.man.mk, so the bsd.man.mk
behavior should be the source of truth for underlying behavior, whereas
the other manpage fragment descriptions should document how they tweak
the variable behavior, if at all (bsd.prog.mk does tweak the default
value, as noted in its description)

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoFix LINKS example in bsd.prog.mk
ngie [Tue, 7 Mar 2017 17:42:23 +0000 (17:42 +0000)]
Fix LINKS example in bsd.prog.mk

LINKS appends DESTDIR -- don't suggest double-append in example.

MFC after: 1 week
Reported by: rgrimes (D9918)
Sponsored by: Dell EMC Isilon

7 years agoAdd mechanism to unload CAM periph drivers.
mav [Tue, 7 Mar 2017 17:41:08 +0000 (17:41 +0000)]
Add mechanism to unload CAM periph drivers.

For now it allows to unload CTL kernel module if there are no target-capable
SIMs in CAM.  As next step full teardown of CAM targets can be implemented.

7 years agoAlphabetically sort variables
ngie [Tue, 7 Mar 2017 17:38:52 +0000 (17:38 +0000)]
Alphabetically sort variables

The only content change is minor rewording around CLEANDIRS/CLEANFILES to
accomodate sorting order.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoLinux semop system call return EINVAL in case when the invalid nsops
dchagin [Tue, 7 Mar 2017 17:12:22 +0000 (17:12 +0000)]
Linux semop system call return EINVAL in case when the invalid nsops
or semid values specified.

MFC after: 1 month

7 years agoLinux kernel does not export to the user space ipc_perm.mode values
dchagin [Tue, 7 Mar 2017 17:09:12 +0000 (17:09 +0000)]
Linux kernel does not export to the user space ipc_perm.mode values
other than S_IRWXUGO (0777).

MFC after: 1 month

7 years agoReduce code duplication between MD Linux code by moving SYSV IPC 64-bit
dchagin [Tue, 7 Mar 2017 17:07:16 +0000 (17:07 +0000)]
Reduce code duplication between MD Linux code by moving SYSV IPC 64-bit
related struct definitions out into the MI path.

Invert the native ipc structs to the Linux ipc structs convesion logic.
Since 64-bit variant of ipc structs has more precision convert native ipc
structs to the 64-bit Linux ipc structs and then truncate 64-bit values
into the non 64-bit if needed. Unlike Linux, return EOVERFLOW if the
values do not fit.

Fix SYSV IPC for 64-bit Linuxulator which never sets IPC_64 bit.

MFC after: 1 month

7 years agoBump __FreeBSD_version for removal of pcap-int.h.
delphij [Tue, 7 Mar 2017 16:09:37 +0000 (16:09 +0000)]
Bump __FreeBSD_version for removal of pcap-int.h.

PR: 217221

7 years agofirewire/sbp: try to improve locking, plus a few style nits
avg [Tue, 7 Mar 2017 16:07:52 +0000 (16:07 +0000)]
firewire/sbp: try to improve locking, plus a few style nits

This change tries to fix the most obvious locking problems.

sbp_cam_scan_lun() is never called with the sbp lock held, so the lock
needs to be acquired internally (if it's needed at all).
Without this change a kernel with INVARIANTS panics when a firewire disk
is connected:
  panic: mutex sbp not owned at /usr/src/sys/dev/firewire/sbp.c:967
  KDB: stack backtrace:
  db_trace_self_wrapper() at 0xffffffff80420bbb = db_trace_self_wrapper+0x2b/frame 0xfffffe0504df0930
  kdb_backtrace() at 0xffffffff80670359 = kdb_backtrace+0x39/frame 0xfffffe0504df09e0
  vpanic() at 0xffffffff8063986c = vpanic+0x14c/frame 0xfffffe0504df0a20
  panic() at 0xffffffff806395b3 = panic+0x43/frame 0xfffffe0504df0a80
  __mtx_assert() at 0xffffffff8061c40d = __mtx_assert+0xed/frame 0xfffffe0504df0ac0
  sbp_cam_scan_lun() at 0xffffffff80474667 = sbp_cam_scan_lun+0x37/frame 0xfffffe0504df0af0
  xpt_done_process() at 0xffffffff802aacfa = xpt_done_process+0x2da/frame 0xfffffe0504df0b30
  xpt_done_td() at 0xffffffff802ac2e5 = xpt_done_td+0xd5/frame 0xfffffe0504df0b80
  fork_exit() at 0xffffffff805ff72f = fork_exit+0xdf/frame 0xfffffe0504df0bf0
  fork_trampoline() at 0xffffffff8082483e = fork_trampoline+0xe/frame
  0xfffffe0504df0bf0
  --- trap 0, rip = 0, rsp = 0, rbp = 0 ---

Also, I tried to reduce the scope of the sbp lock to avoid holding it
while doing bus_dma allocations.

The code badly needs some re-engineering.  SBP really should implement
a CAM transport, so that it avoids control flow inversion when re-scanning
the bus.  Also, the sbp lock seems to be too coarse.

Additionally, the commit includes some changes not related to locking.

- sbp_cam_scan_lun: restore CAM_DEV_QFREEZE before re-queueing the ccb
  because xpt_setup_ccb resets ccb_h.flags
- sbp_post_busreset: call xpt_release_simq only if it's actually frozen
- don't place private SIMQ_FREEZED flag (sic, "freezed") into sim->flags,
  use sbp->flags for that
- some style fixes and control flow enhancements

Reviewed by: sbruno
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9898

7 years agoStop installing pcap-int.h, which is the internal interface for libpcap.
delphij [Tue, 7 Mar 2017 16:06:53 +0000 (16:06 +0000)]
Stop installing pcap-int.h, which is the internal interface for libpcap.

Reference: https://github.com/the-tcpdump-group/libpcap/issues/560
PR: 217221

7 years agoqlxgbe: add GCC_MS_EXTENSIONS to CFLAGS to make old base GCC happy
avg [Tue, 7 Mar 2017 15:43:49 +0000 (15:43 +0000)]
qlxgbe: add GCC_MS_EXTENSIONS to CFLAGS to make old base GCC happy

The module uses unnamed structure and union fields and base GCC in
stable/10 doesn't like it.
I think that that is a C11 feature, so it is courteous of more modern
compilers to not complain about it when compiling in C99 mode.

Approved by: davidcs
MFC after: 5 days

7 years agoImplement time_is_after_eq_jiffies() function in the LinuxKPI.
hselasky [Tue, 7 Mar 2017 15:37:51 +0000 (15:37 +0000)]
Implement time_is_after_eq_jiffies() function in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix implementation of the DECLARE_RWSEM() macro in the LinuxKPI.
hselasky [Tue, 7 Mar 2017 15:34:49 +0000 (15:34 +0000)]
Fix implementation of the DECLARE_RWSEM() macro in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies