]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoUpdate other man pages to match leap second reality
cem [Fri, 1 Jun 2018 22:37:59 +0000 (22:37 +0000)]
Update other man pages to match leap second reality

Missed these in r334501; see justification there:

https://svnweb.freebsd.org/base?view=revision&revision=334501

Sponsored by: Dell EMC Isilon

6 years agotouch.1: Update to conform to POSIX 2004
cem [Fri, 1 Jun 2018 22:34:59 +0000 (22:34 +0000)]
touch.1: Update to conform to POSIX 2004

POSIX borrowed the "double leap second" bug from C89.  Double leap seconds can
never happen.  This mistake was present in at least POSIX 1997 and fixed by
POSIX 2004.  I can't find a copy of 2001 online to determine if the bug was
present in that revision.

While here, remove duplicate language between -d and -t.  A few other minor
enhancements and an igor (lint) bugfix.

Further reading:

2018 POSIX (documents -d):
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html

2004 POSIX (documents SS from 0-60):
http://pubs.opengroup.org/onlinepubs/009695399/utilities/touch.html

1997 POSIX/SUSv2 (historical interest, 0-61):
http://pubs.opengroup.org/onlinepubs/007908799/xcu/touch.html

More on this subject (start at "Unix system time and the POSIX standard")
https://www.ucolick.org/~sla/leapsecs/onlinebib.html

And: https://marc.info/?l=openbsd-tech&m=92682843416159&w=2

Reported by: Vishal Sahu <vsahu AT isilon.com>
Sponsored by: Dell EMC Isilon

6 years agoRemove support for SYS_sys_exit in favor of SYS_exit.
brooks [Fri, 1 Jun 2018 22:09:27 +0000 (22:09 +0000)]
Remove support for SYS_sys_exit in favor of SYS_exit.

SYS_exit has been defined in the repo since 1994 except for a brief
window when SYS_sys_exit was defined in 2000.

6 years agoOnly a small subset of mmap(2)'s flags should be used in combination with
alc [Fri, 1 Jun 2018 21:37:42 +0000 (21:37 +0000)]
Only a small subset of mmap(2)'s flags should be used in combination with
the flag MAP_GUARD.  Rather than enumerating the flags that are not
allowed, enumerate the flags that are allowed.  The list of allowed flags
is much shorter and less likely to change.  (As an aside, one of the
previously enumerated flags, MAP_PREFAULT, was not even a legal flag for
mmap(2).  However, because of an earlier check within kern_mmap(), this
misuse of MAP_PREFAULT was harmless.)

Reviewed by: kib
MFC after: 10 days

6 years agoIncrease powerpc64 KVA from ~7.25GB to 32GB
jhibbits [Fri, 1 Jun 2018 21:37:20 +0000 (21:37 +0000)]
Increase powerpc64 KVA from ~7.25GB to 32GB

This will let us use much more KVA for ZFS ARC where needed.  This may be
incresed in the future if memory requirements increase.

Discussed with: nwhitehorn

6 years agoLimit the retransmission timer for SYN-ACKs by TCPTV_REXMTMAX.
tuexen [Fri, 1 Jun 2018 21:24:27 +0000 (21:24 +0000)]
Limit the retransmission timer for SYN-ACKs by TCPTV_REXMTMAX.

Use the same logic to handle the SYN-ACK retransmission when sent from
the syn cache code as when sent from the main code.

MFC after: 3 days
Sponsored by: Netflix, Inc.

6 years agoaudit(4): add tests for the fd audit class
asomers [Fri, 1 Jun 2018 21:24:10 +0000 (21:24 +0000)]
audit(4): add tests for the fd audit class

The only syscalls in this class are rmdir, unlink, unlinkat, rename, and
renameat.  Also, set is_exclusive for all audit(4) tests, because they can
start and stop auditd.

Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15647

6 years agoindent(1): improve an error message
pstef [Fri, 1 Jun 2018 20:45:35 +0000 (20:45 +0000)]
indent(1): improve an error message

When producing a "[...] requires a parameter" error, provide the recognized
name of the option instead of argument provided.

6 years agoEnsure net.inet.tcp.syncache.rexmtlimit is limited by TCP_MAXRXTSHIFT.
tuexen [Fri, 1 Jun 2018 19:58:19 +0000 (19:58 +0000)]
Ensure net.inet.tcp.syncache.rexmtlimit is limited by TCP_MAXRXTSHIFT.

If the sysctl variable is set to a value larger than TCP_MAXRXTSHIFT+1,
the array tcp_syn_backoff[] is accessed out of bounds.

Discussed with: jtl@
MFC after: 3 days
Sponsored by: Netflix, Inc.

6 years agoindent(1): restore working -pcs
pstef [Fri, 1 Jun 2018 19:56:41 +0000 (19:56 +0000)]
indent(1): restore working -pcs

My previous indent(1) commit accidentally broke the -pcs option (which adds
space between function name and opening parenthesis in function calls) by
copying all but one of a few conditions in an if clause. Reinstate the
condition.

Add a regression test to lower the chances of breaking it again.

Correct a comment with description of what the option does.

6 years agoAdd the BindConnectiontoSession operation to the NFSv4.1 server.
rmacklem [Fri, 1 Jun 2018 19:47:41 +0000 (19:47 +0000)]
Add the BindConnectiontoSession operation to the NFSv4.1 server.

Under some fairly unusual circumstances, the Linux NFSv4.1 client is
doing a BindConnectiontoSession operation for TCP connections.
It is also used by the ESXi6.5 NFSv4.1 client.
This patch adds this operation to the NFSv4.1 server.

Reported by: andreas.nagy@frequentis.com
Tested by: andreas.nagy@frequentis.com
MFC after: 2 weeks

6 years agoAdd PNP_INFO to aac
imp [Fri, 1 Jun 2018 19:42:59 +0000 (19:42 +0000)]
Add PNP_INFO to aac

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoUpdate the sysctl(9) manpage to indicate that <sys/param.h> is required
jtl [Fri, 1 Jun 2018 16:47:39 +0000 (16:47 +0000)]
Update the sysctl(9) manpage to indicate that <sys/param.h> is required
instead of <sys/types.h>.  (<sys/sysctl.h> includes NULL, which is defined
with <sys/param.h> and not <sys/types.h>.)

Sponsored by: Netflix

6 years agocxgbe(4): Include full duplex mediaopt in media that can be reported as
np [Fri, 1 Jun 2018 16:46:29 +0000 (16:46 +0000)]
cxgbe(4): Include full duplex mediaopt in media that can be reported as
active.  Always report full duplex in active media.

Sponsored by: Chelsio Communications

6 years agoUnbreak 32-bit binaries on powerpc64
jhibbits [Fri, 1 Jun 2018 16:31:05 +0000 (16:31 +0000)]
Unbreak 32-bit binaries on powerpc64

Recently a change was made which broke loading 32-bit binaries on powerpc64,
with an assertion in ld-elf32.so.1:

ld-elf32.so.1: assert failed:
/usr/local/poudriere/jails/ppc64/usr/src/libexec/rtld-elf/rtld.c:390

It turns out Elf32_AuxInfo was broken for a very long time on powerpc64, as
it uses long and pointers, which are both 64 bits on powerpc64, and only
manifested with the recent work on auxargs.

6 years agoaudit(4): Add tests for the fw class of syscalls.
asomers [Fri, 1 Jun 2018 16:23:47 +0000 (16:23 +0000)]
audit(4): Add tests for the fw class of syscalls.

truncate and ftruncate are the only syscalls in this class, apart from
certain variations of open and openat, which will be handled in a different
file.

Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15640

6 years agoANSIfy sys/kern
emaste [Fri, 1 Jun 2018 13:26:45 +0000 (13:26 +0000)]
ANSIfy sys/kern

6 years agopowerpc64: Avoid overwriting initrd area
leitao [Fri, 1 Jun 2018 12:43:13 +0000 (12:43 +0000)]
powerpc64: Avoid overwriting initrd area

Currently kexec loads an initrd file into the main memory but does not
mark that region as reserved, thus the area is not protected.

If any initrd/md file is loaded from kexec/petitboot, the region might become
corarupted/overwritten since FreeBSD does not know the region is 'reserved'.

This patch simply adds the initrd area as a reserved memory region.

Approved by: jhibbits
Differential Revision: https://reviews.freebsd.org/D15610

6 years agoImplement the __sg_alloc_table_from_pages() function based on the existing
hselasky [Fri, 1 Jun 2018 12:09:07 +0000 (12:09 +0000)]
Implement the __sg_alloc_table_from_pages() function based on the existing
sg_alloc_table_from_pages() function in the LinuxKPI.

This basically allow segments to have a limit, max_segment.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement radix_tree_iter_delete() in the LinuxKPI.
hselasky [Fri, 1 Jun 2018 11:42:09 +0000 (11:42 +0000)]
Implement radix_tree_iter_delete() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImprove high resolution timer support in the LinuxKPI.
hselasky [Fri, 1 Jun 2018 11:33:14 +0000 (11:33 +0000)]
Improve high resolution timer support in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoAdd more GFP macro definitions in the LinuxKPI.
hselasky [Fri, 1 Jun 2018 11:14:59 +0000 (11:14 +0000)]
Add more GFP macro definitions in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoindent(1): don't add unneeded space to function pointer declarations
pstef [Fri, 1 Jun 2018 09:58:44 +0000 (09:58 +0000)]
indent(1): don't add unneeded space to function pointer declarations

If the current token is an opening parenthesis, it's either a function call
(or sizeof or offsetof) or a declaration. The former doesn't need a space
before the parenthesis.

6 years agocall AcpiLeaveSleepStatePrep after re-enabling interrupts
avg [Fri, 1 Jun 2018 09:44:23 +0000 (09:44 +0000)]
call AcpiLeaveSleepStatePrep after re-enabling interrupts

I want to do this change because this call (actually,
AcpiHwLegacyWakePrep) does a memory allocation and ACPI namespace
evaluation.  Although it is not very likely to run into any trouble, it
is still not safe to make those calls with interrupts disabled.
witness(4) and malloc(9) do not currently check for a context with
interrupts disabled via intr_disable and we lack a facility for doing
that.  So, those unsafe operations fly under the radar.  But if
intr_disable in acpi_EnterSleepState was replaced with spinlock_enter
(which it probably should be), then witness and malloc would immediately
complain.

Also, AcpiLeaveSleepStatePrep is documented as called when interrupts
are enabled.  It used to require disabled interrupts, but that
requirement was changed a long time ago when support for _BFS and _GTS
was removed from ACPICA.

The ACPI wakeup sequence is very sensitive to changes. I consider this
change to be correct, but there can be fallouts from it.

What AcpiHwLegacyWakePrep essentially does is writing a value
corresponding to S0 into SLP_TYPx bits of PM1 Control Register(s).
According to ACPI specifications that write should be a NOP as SLP_EN
bit is not set.  But I see in some chipset specifications that they
allow to ignore SLP_EN altogether and to act on a change of SLP_TYPx
alone.

Also, there are a couple of accesses to ACPI hardware before the new
location of the call to AcpiLeaveSleepStatePrep.  One is to clear the
power button status and the other is to enable SCI.  So, the move may
affect the interaction between then OS and ACPI platform.

I have not seen any regressions on my test system, but it's a desktop.

MFC after: 5 weeks

6 years agoindent(1): don't indent typedef declarations as object declarations
pstef [Fri, 1 Jun 2018 09:41:15 +0000 (09:41 +0000)]
indent(1): don't indent typedef declarations as object declarations

6 years agoindent(1): consider tab characters when forcing a newline after a comma
pstef [Fri, 1 Jun 2018 09:32:42 +0000 (09:32 +0000)]
indent(1): consider tab characters when forcing a newline after a comma

6 years agoSet bDeviceClass properly for composite device (template 8). There should
trasz [Fri, 1 Jun 2018 09:17:20 +0000 (09:17 +0000)]
Set bDeviceClass properly for composite device (template 8).  There should
be no functional change.

PR: 203289
Reviewed by: hselasky@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoindent(1): identifiers inside parentheses are not declarations
pstef [Fri, 1 Jun 2018 08:54:51 +0000 (08:54 +0000)]
indent(1): identifiers inside parentheses are not declarations

Also make lparen position calculation consider tab stops.

This improves function pointer typedef formatting.

6 years agotop(1): Display of TID when using 'H' flag
eadler [Fri, 1 Jun 2018 05:51:40 +0000 (05:51 +0000)]
top(1): Display of TID when using 'H' flag

Some users prefer seeing the TID when viewing individual threads. This
makes sense as the PID will be the same for multiple entries. An attempt
was made to include both, but there is insufficient room. As such, using
the TID.

While here, rename the header variables to be more understandable.

Discussed with: mmacy
Reported on: 2009-10-07

6 years agoservice(1): Improve manual page
eadler [Fri, 1 Jun 2018 04:14:16 +0000 (04:14 +0000)]
service(1): Improve manual page

* Sort options..
* Fix some typos.
* Use one Bd macro for code blocks instead of a bunch of Dl macros.
* Improve formatting.
* Clarify 'jail' argument

PR: 228552
Submitted by: 0mp
MFC After: 3 weeks

6 years agoaudit(4): Add tests for the fr class of syscalls
asomers [Fri, 1 Jun 2018 01:37:07 +0000 (01:37 +0000)]
audit(4): Add tests for the fr class of syscalls

readlink and readlinkat are the only syscalls in this class.  open and
openat are as well, but they'll be handled in a different file.  Also, tidy
up the copyright headers of recently added files in this area.

Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15636

6 years agocxgbe(4): Retire an old check.
np [Fri, 1 Jun 2018 01:05:34 +0000 (01:05 +0000)]
cxgbe(4): Retire an old check.

6 years agoUpdate FreeBSD_version to reflect removal of in-kernel pmc tables for Intel
mmacy [Fri, 1 Jun 2018 00:49:20 +0000 (00:49 +0000)]
Update FreeBSD_version to reflect removal of in-kernel pmc tables for Intel

6 years agopmc: add list-events command
mmacy [Fri, 1 Jun 2018 00:45:59 +0000 (00:45 +0000)]
pmc: add list-events command

6 years agolibpmc: allow substring for list and add function for printing event details
mmacy [Fri, 1 Jun 2018 00:45:53 +0000 (00:45 +0000)]
libpmc: allow substring for list and add function for printing event details

6 years agolibpmc: Intel doesn't require runtime counter table init
mmacy [Fri, 1 Jun 2018 00:45:48 +0000 (00:45 +0000)]
libpmc: Intel doesn't require runtime counter table init

6 years agolibpmc/pmu: update aliases table
mmacy [Fri, 1 Jun 2018 00:45:43 +0000 (00:45 +0000)]
libpmc/pmu: update aliases table

6 years agohwpmc: remove unused pre-table driven bits for intel
mmacy [Thu, 31 May 2018 22:41:07 +0000 (22:41 +0000)]
hwpmc: remove unused pre-table driven bits for intel

Intel now provides comprehensive tables for all performance counters
and the various valid configuration permutations as text .json files.
Libpmc has been converted to use these and hwpmc_core has been greatly
simplified by moving to passthrough of the table values.

The one gotcha is that said tables don't support pentium pro and and pentium
IV. There's very few users of hwpmc on _amd64_ kernels on new hardware. It is
unlikely that anyone is doing low level optimization on 15 year old Intel
hardware. Nonetheless, if someone feels strongly enough to populate the
corresponding tables for p4 and ppro I will reinstate the files in to the
build.

Code for the K8 counters and !x86 architectures remains unchanged.

6 years agolibpmc/pmu: enable for i386 as well
mmacy [Thu, 31 May 2018 22:26:55 +0000 (22:26 +0000)]
libpmc/pmu: enable for i386 as well

6 years agolibpmc: add pmu support for uncore events
mmacy [Thu, 31 May 2018 22:26:50 +0000 (22:26 +0000)]
libpmc: add pmu support for uncore events

6 years agocxgbe(4): Add support for SMAC-rewriting filters.
np [Thu, 31 May 2018 21:56:57 +0000 (21:56 +0000)]
cxgbe(4): Add support for SMAC-rewriting filters.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

6 years agoReduce overhead of entropy collection
mmacy [Thu, 31 May 2018 21:53:07 +0000 (21:53 +0000)]
Reduce overhead of entropy collection

- move harvest mask check inline
- move harvest mask to frequently_read out of actively
  modified cache line
- disable ether_input collection and describe its limitations
  in NOTES

Typically entropy collection in ether_input was stirring zero
in to the entropy pool while at the same time greatly reducing
max pps. This indicates that perhaps we should more closely
scrutinize how much entropy we're getting from a given source
as well as what our actual entropy collection needs are for
seeding Yarrow.

Reviewed by: cem, gallatin, delphij
Approved by: secteam
Differential Revision: https://reviews.freebsd.org/D15526

6 years agocxgbe(4): Add code to deal with the chip's source MAC table (aka SMT).
np [Thu, 31 May 2018 21:31:08 +0000 (21:31 +0000)]
cxgbe(4): Add code to deal with the chip's source MAC table (aka SMT).

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

6 years agoResolve conflicts between macros in fenv.h and ieeefp.h
dim [Thu, 31 May 2018 20:22:47 +0000 (20:22 +0000)]
Resolve conflicts between macros in fenv.h and ieeefp.h

This is a follow-up to r321483, which disabled -Wmacro-redefined for
some lib/msun tests.

If an application included both fenv.h and ieeefp.h, several macros such
as __fldcw(), __fldenv() were defined in both headers, with slightly
different arguments, leading to conflicts.

Fix this by putting all the common macros in the machine-specific
versions of ieeefp.h.  Where needed, update the arguments in places
where the macros are invoked.

This also slightly reduces the differences between the amd64 and i386
versions of ieeefp.h.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D15633

6 years agodhclient(8): allow to supersede interface-mtu option
cem [Thu, 31 May 2018 19:36:24 +0000 (19:36 +0000)]
dhclient(8): allow to supersede interface-mtu option

In some cases broken DHCP servers might send invalid MTU value, so allow to
use 'supersede' in dhclient.conf to override this. When superseded value is
0, MTU value is not updated at all.

PR: 206721
Submitted by: novel@
Reported by: <jimp AT pfsense.org>
MFC after: 37 minutes (if you care about 11, please MFC to 11.2)
Relnotes: yes (potentially surprising behavior change w/ broken dhcpd mtu)
Differential Revision: https://reviews.freebsd.org/D15484

6 years agoaw_mmc: Get max-frequency from the dtb
manu [Thu, 31 May 2018 15:41:56 +0000 (15:41 +0000)]
aw_mmc: Get max-frequency from the dtb

If a max-frequency is supplied in the dtb use it, otherwise fallback to a
default one of 52Mhz.

6 years agoaw_mmc: Use the DEVMETHOD vccq for the IO line voltage
manu [Thu, 31 May 2018 15:41:00 +0000 (15:41 +0000)]
aw_mmc: Use the DEVMETHOD vccq for the IO line voltage

MMC controller should use this and not set the voltage during update_ios.

6 years agoaw_mmc: Rework DMA
manu [Thu, 31 May 2018 15:39:39 +0000 (15:39 +0000)]
aw_mmc: Rework DMA

 - Calculate the number of segments based on the page size
 - Add some comments on dma function so it's easier to read
 - Only enable interrupts on the last dma segment
 - If the segments size is the max transfer size, use the special size 0
 for the controller.
 - The max_data ivars is in block so calculate it properly.

6 years agoaw_mmc: Rename clock register defines consistently
manu [Thu, 31 May 2018 15:36:26 +0000 (15:36 +0000)]
aw_mmc: Rename clock register defines consistently

6 years agoFix build of stand with base gcc
dim [Thu, 31 May 2018 14:38:13 +0000 (14:38 +0000)]
Fix build of stand with base gcc

* Make autoboot() a static function in stand/common/boot.c, so it does
  not shadow local variables in gptboot.c and zfsboot.c.
* Remove -Winline from the Makefiles for gptboot, gptzfsboot and
  zfsboot, as gcc will always fail to inline some functions, and there
  is nothing we can do about it.
* For gcc <= 4.2.1, silence -Wuninitialized for isoboot, as it produces
  a false positive warning.
* Remove deprecated and unnecessary -mcpu=i386 flag from stand/defs.mk,
  as there is already a -march=i386 flag further in the file.

Reviewed by: imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D15628

6 years agoDepart from normal man page proactice a little and provide guidance on
imp [Thu, 31 May 2018 14:23:33 +0000 (14:23 +0000)]
Depart from normal man page proactice a little and provide guidance on
when to use assert, as well as providing a bad example of using
assert.  While not strictly necessary, experience has shown issues
with poor assert choice happen often enough that this departure seems
warranted. Also, tighten up the previous example (there's no need
to have extra paragraphs or gratuitously long lines).

Reviewed by: emaste@ (earlier version)

6 years agoMove all of the directory path into the DIR part of the component and make the
brd [Thu, 31 May 2018 13:26:12 +0000 (13:26 +0000)]
Move all of the directory path into the DIR part of the component and make the
NAME be only the filename.

This makes it possible to use the DIR as part of the dep in the future.

Approved by: bapt (mentor)

6 years agoImplement support for the PCI_BUS_NUM() function macro in the LinuxKPI.
hselasky [Thu, 31 May 2018 13:17:34 +0000 (13:17 +0000)]
Implement support for the PCI_BUS_NUM() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoImplement support for the kvmalloc_array() function in the LinuxKPI.
hselasky [Thu, 31 May 2018 13:13:08 +0000 (13:13 +0000)]
Implement support for the kvmalloc_array() function in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoCorrect macroname in the LinuxKPI.
hselasky [Thu, 31 May 2018 12:55:38 +0000 (12:55 +0000)]
Correct macroname in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoDefine __initconst in the LinuxKPI.
hselasky [Thu, 31 May 2018 12:50:42 +0000 (12:50 +0000)]
Define __initconst in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoImplement bitmap_complement() in the LinuxKPI.
hselasky [Thu, 31 May 2018 12:48:24 +0000 (12:48 +0000)]
Implement bitmap_complement() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoMove the code to print the EFI memory table to a new function and call it
andrew [Thu, 31 May 2018 12:37:34 +0000 (12:37 +0000)]
Move the code to print the EFI memory table to a new function and call it
in teh bootverbose path after cninit().

This allows users to see these tables when booting with boot -v.

Sponsored by: DARPA, AFRL

6 years agoImplement idr_is_empty() in the LinuxKPI and make idr_remove() API compatible
hselasky [Thu, 31 May 2018 12:35:21 +0000 (12:35 +0000)]
Implement idr_is_empty() in the LinuxKPI and make idr_remove() API compatible
with upstream Linux by returning the pointer to the removed element.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoCorrect argument for evdev_push_rel().
hselasky [Thu, 31 May 2018 12:10:30 +0000 (12:10 +0000)]
Correct argument for evdev_push_rel().

This is a regression issue after r319162.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoFix the early spelling of bootverbose.
andrew [Thu, 31 May 2018 11:53:46 +0000 (11:53 +0000)]
Fix the early spelling of bootverbose.

Sponsored by: DARPA, AFRL

6 years agoFix the memory attribute for EFI_MD_ATTR_UC on arm64.
andrew [Thu, 31 May 2018 11:11:23 +0000 (11:11 +0000)]
Fix the memory attribute for EFI_MD_ATTR_UC on arm64.

This is defined as Device-nGnRnE in the UEFI spec (UEFI 2.4, section
2.3.6.1). This is the VM_MEMATTR_DEVICE type in FreeBSD.

Reported by: tuexen
Sponsored by: DARPA, AFRL

6 years agoamd64: switch pagecopy from non-temporal stores to rep movsq
mjg [Thu, 31 May 2018 09:56:02 +0000 (09:56 +0000)]
amd64: switch pagecopy from non-temporal stores to rep movsq

The copied data is accessed in part soon after and it results with additional
cache misses during a -j 1 buildkernel WITHOUT_CTF=yes KERNFAST=1, as measured
with pmc stat.

before:
       256165411  cache-references # 0.003 refs/inst
        15105408  cache-misses # 5.897%
           20.70  real # 99.67% cpu
           13.24  user # 63.94% cpu
            7.40  sys # 35.73% cpu

after:
       256764469  cache-references # 0.003 refs/inst
        11913551  cache-misses # 4.640%
           20.70  real # 99.67% cpu
           13.19  user # 63.73% cpu
            7.44  sys # 35.95% cpu

Note the real time did not change, but traffic to RAM was reduced (multiple
measurements performed with switching the implementation at runtime).
Since nobody else is using non-temporal for this and there is no apparent
benefit at least these days, don't use them either.

Side note is that pagecopy arguments should probably get reversed to not
have to flip them around in the primitive.

Discussed with: jeff

6 years agoRe-apply r190640.
hselasky [Thu, 31 May 2018 09:11:21 +0000 (09:11 +0000)]
Re-apply r190640.

- Restore local change to include <net/bpf.h> inside pcap.h.
This fixes ports build problems.
- Update local copy of dlt.h with new DLT types.
- Revert no longer needed <net/bpf.h> includes which were added
as part of r334277.

Suggested by: antoine@, delphij@, np@
MFC after: 3 weeks
Sponsored by: Mellanox Technologies

6 years agoRemove a debug printf from opal_pci driver
jhibbits [Thu, 31 May 2018 04:11:40 +0000 (04:11 +0000)]
Remove a debug printf from opal_pci driver

6 years agoNote the need for a new kernel / userland for devinfo to work
imp [Thu, 31 May 2018 02:58:08 +0000 (02:58 +0000)]
Note the need for a new kernel / userland for devinfo to work

Differential Revision: https://reviews.freebsd.org/D15628

6 years agoUpdate to device enumeration protocol 2
imp [Thu, 31 May 2018 02:58:03 +0000 (02:58 +0000)]
Update to device enumeration protocol 2

The new protocol from the kernel encodes things as a string table,
extract it into fields. strdup the strings, and free them when we're
done.

Differential Revision: https://reviews.freebsd.org/D15629

6 years agoMake the data returned by devinfo harder to overflow.
imp [Thu, 31 May 2018 02:57:58 +0000 (02:57 +0000)]
Make the data returned by devinfo harder to overflow.

Rather than using fixed-length strings, pack them into a string table
to return. Also expand the buffer from ~300 charaters to 3k. This should
be enough, even for USB.

This fixes a problem where USB pnp info is truncated on return to
userland.

Differential Revision: https://reviews.freebsd.org/D15629

6 years agoSanity check the return from the kernel.
imp [Thu, 31 May 2018 02:57:51 +0000 (02:57 +0000)]
Sanity check the return from the kernel.

We should be getting back as many bytes as we asked for, and we
don't handle shortages at all, so just reject anything that's
not right.

Differential Revision: https://reviews.freebsd.org/D15629

6 years agoPass a struct devdesc to the format commands. Use proper type rather
imp [Thu, 31 May 2018 02:54:11 +0000 (02:54 +0000)]
Pass a struct devdesc to the format commands. Use proper type rather
than doing weird type-punning that happened to work because the size
was right. We copied a zfs devdesc into a disk_devdesc and then after
passing through a NULL pointer reinterpreted it as a
zfs_devdesc. Instead, pass the base devdesc around and 'upcase' when
we know the types are right.

This has the happy side effect of fixing a gcc warning about bad
type punning.

Differential Revision: https://reviews.freebsd.org/D15629

6 years agocxgbe(4): Use ifm for ifmedia just like the rest of the kernel.
np [Thu, 31 May 2018 02:22:40 +0000 (02:22 +0000)]
cxgbe(4): Use ifm for ifmedia just like the rest of the kernel.

No functional change.

6 years agocxgbe(4): Implement ifm_change callback.
np [Thu, 31 May 2018 02:10:50 +0000 (02:10 +0000)]
cxgbe(4): Implement ifm_change callback.

Sponsored by: Chelsio Communications

6 years agolibpmc/jevents: fix cross-compile _to_ amd64
mmacy [Thu, 31 May 2018 01:01:35 +0000 (01:01 +0000)]
libpmc/jevents: fix cross-compile _to_ amd64

Reported by: emaste

6 years agoOnly conform to PCIe spec of 1 device per bus on !x86
jhibbits [Wed, 30 May 2018 22:39:41 +0000 (22:39 +0000)]
Only conform to PCIe spec of 1 device per bus on !x86

bhyve's root PCI complex shows up as PCIe, but behaves as traditional PCI.
Until that is special cased in a root complex driver, leave x86 as it was.

Requested by: grehan

6 years agocxgbe(4): Consider all supported speeds when building the ifmedia list
np [Wed, 30 May 2018 22:36:09 +0000 (22:36 +0000)]
cxgbe(4): Consider all supported speeds when building the ifmedia list
for a port.  Fix other related issues while here:
- Require port lock for access to link_config.
- Allow 100Mbps operation by tracking the speed in Mbps.  Yes, really.
- New port flag to indicate that the media list is immutable.  It will
  be used in future refinements.

This also fixes a bug where the driver reports incorrect media with
recent firmwares.

MFC after: 2 days
Sponsored by: Chelsio Communications

6 years agoRemove alternative names that are identical to the default.
brooks [Wed, 30 May 2018 22:22:58 +0000 (22:22 +0000)]
Remove alternative names that are identical to the default.

Verified by make sysent producing no changes.

6 years agopmc stat: fix format strings for 32-bit
mmacy [Wed, 30 May 2018 22:03:02 +0000 (22:03 +0000)]
pmc stat: fix format strings for 32-bit

6 years ago#include <bsm/audit.h> in security/audit/audit_ioctl.h
asomers [Wed, 30 May 2018 21:50:23 +0000 (21:50 +0000)]
#include <bsm/audit.h> in security/audit/audit_ioctl.h

security/audit/audit_ioctl.h uses a type from bsm/audit.h, so needs to
include it.  And it needs to know the type's size, so it can't just
forward-declare.

PR: 228470
Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15561

6 years agoif_setlladdr: don't call ioctl in epoch context
mmacy [Wed, 30 May 2018 21:46:10 +0000 (21:46 +0000)]
if_setlladdr: don't call ioctl in epoch context

PR: 228612
Reported by: markj

6 years agoUse pmap_pte_ufast() instead of pmap_pte() in pmap_extract(),
kib [Wed, 30 May 2018 20:47:20 +0000 (20:47 +0000)]
Use pmap_pte_ufast() instead of pmap_pte() in pmap_extract(),
pmap_is_prefaultable() and pmap_incore(), pushing the number of
shootdown IPIs back to the 3/1 kernel.

Benchmarked by: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation

6 years agoExtract code for fast mapping of pte from pmap_extract_and_hold()
kib [Wed, 30 May 2018 20:43:48 +0000 (20:43 +0000)]
Extract code for fast mapping of pte from pmap_extract_and_hold()
into the helper function pmap_pte_ufast().

Benchmarked by: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation

6 years agoRestore pmap_copy() for 4/4 i386 pmap.
kib [Wed, 30 May 2018 20:39:22 +0000 (20:39 +0000)]
Restore pmap_copy() for 4/4 i386 pmap.

Create yet another temporal pte mapping routine pmap_pte_quick3(),
which is the copy of the pmap_pte_quick() and relies on the
pvh_global_lock to protect the frame.  It accounts into the same
counters as pmap_pte_quick().  It is needed since pmap_copy() uses
pmap_pte_quick() already, and since a user pmap is no longer current
pmap.

pmap_copy() still provides the advantage for real-world workloads
involving lot of forks where processes do not exec immediately.

Benchmarked by: bde
Sponsored by: The FreeBSD Foundation

6 years agoDo use pmap_pte_quick() in pmap_enter_quick_locked().
kib [Wed, 30 May 2018 20:26:47 +0000 (20:26 +0000)]
Do use pmap_pte_quick() in pmap_enter_quick_locked().

Benchmarked by: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation

6 years agoAvoid unneccessary TLB shootdowns in pmap_unwire_ptp() for user pmaps,
kib [Wed, 30 May 2018 20:24:21 +0000 (20:24 +0000)]
Avoid unneccessary TLB shootdowns in pmap_unwire_ptp() for user pmaps,
which no longer create recursive page table mappings.

Benchmarked by: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation

6 years agoStrengthen locking for the NFSv4.1 server DestroySession operation.
rmacklem [Wed, 30 May 2018 20:16:17 +0000 (20:16 +0000)]
Strengthen locking for the NFSv4.1 server DestroySession operation.

If a client did a DestroySession on a session while it was still in use,
the server might try to use the session structure after it is free'd.
I think the client has violated RFC5661 if it does this, but this patch
makes DestroySession block all other nfsd threads so no thread could
be using the session when it is free'd. After the DestroySession, nfsd
threads will not be able to find the session. The patch also adds a check
for nd_sessionid being set, although if that was not the case it would have
been all 0s and unlikely to have a false match.
This might fix the crashes described in PR#228497 for the FreeNAS server.

PR: 228497
MFC after: 1 week

6 years agoRevert r334362
asomers [Wed, 30 May 2018 19:58:36 +0000 (19:58 +0000)]
Revert r334362

Reconnect tests/sys/audit now that the GCC issue is fixed by 334388

MFC after: 2 weeks
X-MFC-With: 334362, 334360, 334388

6 years agoauditpipe(4): fix some ioctl arguments in the man page
asomers [Wed, 30 May 2018 19:57:15 +0000 (19:57 +0000)]
auditpipe(4): fix some ioctl arguments in the man page

Fix the argument types for the AUDITPIPE_[GS]ET_PRESELECT_(NA)?FLAGS ioctls.
Also, fix some grammar.

[skip ci]

PR: 226713
Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15620

6 years agoRegen src.conf.5 after r334391 - LLD_IS_LD default on amd64
emaste [Wed, 30 May 2018 18:34:45 +0000 (18:34 +0000)]
Regen src.conf.5 after r334391 - LLD_IS_LD default on amd64

Relnotes: yes
Sponsored by: The FreeBSD Foundation

6 years agoEnable lld as the system linker by default on amd64
emaste [Wed, 30 May 2018 18:04:25 +0000 (18:04 +0000)]
Enable lld as the system linker by default on amd64

The migration to LLVM's lld linker has been in progress for quite some
time - about three years ago I opened an upstream LLVM meta-bug to track
issues using lld as FreeBSD's linker, and about 1.5 years ago requested
the first exp-run with lld as the system linker.

As of r327783 we enabled LLD_BOOTSTRAP by default on amd64, using lld as
the linker to link the kernel and world, but GNU ld was still installed
as /usr/bin/ld.

The vast majority of issues observed when building ports with lld as the
system linker have now been solved, so set LLD_IS_LD by default on amd64
and install lld as /usr/bin/ld.  A small number of port failures remain
and these will be addressed in the near future.

Thanks to antoine@ for handling the exp-runs, krion@ for investigating
many port failures and adding LLD_UNSAFE or other fixes or workarounds,
and everyone who helped investigate, fix or tag ports.

PR: 214864 (exp-run)
Sponsored by: The FreeBSD Foundation

6 years agoau_read_rec(3): correct return value in man page
asomers [Wed, 30 May 2018 17:05:48 +0000 (17:05 +0000)]
au_read_rec(3): correct return value in man page

Submitted by: aniketp
Reviewed by: csjp (earlier version)
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15618

6 years agoTypo.
markj [Wed, 30 May 2018 16:48:48 +0000 (16:48 +0000)]
Typo.

PR: 228533
Submitted by: Jakub Piecuch <j.piecuch96@gmail.com>
MFC after: 1 week

6 years agoFix OpenBSM with GCC with -Wredundant-decls
asomers [Wed, 30 May 2018 15:51:48 +0000 (15:51 +0000)]
Fix OpenBSM with GCC with -Wredundant-decls

Upstream change ed47534 consciously added some redundant functional
declarations, and I'm not sure why. AFAICT they were never required. On
FreeBSD, they break the build with GCC (but not Clang) for any program
including libbsm.h with WARNS=6.

Fix by cherry-picking upstream change
https://github.com/openbsm/openbsm/commit/0553c27

Reported by: emaste
Reviewed by: cem
Obtained from: OpenBSM
MFC after: 2 weeks
Pull Request: https://github.com/openbsm/openbsm/pull/31

6 years agoRemove max_pa, it's unused.
andrew [Wed, 30 May 2018 15:37:09 +0000 (15:37 +0000)]
Remove max_pa, it's unused.

Sponsored by: DARPA, AFRL

6 years agoregulator: Fix typo (shuting/shutting)
manu [Wed, 30 May 2018 15:32:31 +0000 (15:32 +0000)]
regulator: Fix typo (shuting/shutting)

Submitted by: Jose Luis Duran (github pull #151)

6 years agoFurther limit when we call pmap_fault.
andrew [Wed, 30 May 2018 15:25:48 +0000 (15:25 +0000)]
Further limit when we call pmap_fault.

We should only call pmap_fault in the kernel when accessing a userspace
address. As this should always happen through specific functions that set
a fault handler we can use this to limit calls to pmap_fault to when this
is set.

This should help with NULL pointer dereferences when we are unable to sleep
so we fall into the correct case.

Sponsored by: DARPA, AFRL

6 years agodevinfo_init() returns an errno, but doesn't set errno, so the error
imp [Wed, 30 May 2018 15:08:59 +0000 (15:08 +0000)]
devinfo_init() returns an errno, but doesn't set errno, so the error
message when it fails reflects some random thing rather than what it
returned. Set errno to the return value.

6 years agoThere's no meaningful errno when there's a version mismatch, so use
imp [Wed, 30 May 2018 15:08:46 +0000 (15:08 +0000)]
There's no meaningful errno when there's a version mismatch, so use
warnx. Also, report the mis-matched versions.

6 years agoPush down the locking in pmap_fault to just be around the calls to
andrew [Wed, 30 May 2018 14:18:19 +0000 (14:18 +0000)]
Push down the locking in pmap_fault to just be around the calls to
arm64_address_translate_*. There is no need to lock around the switch
statement as we only care about a few cases.

Sponsored by: DARPA, AFRL

6 years agomakeroot.sh: allow duplicate entries even with -f <filelist>
emaste [Wed, 30 May 2018 13:51:00 +0000 (13:51 +0000)]
makeroot.sh: allow duplicate entries even with -f <filelist>

makefs disallows duplicate entries unless the -D option is specified.

Previously makeroot.sh enabled -D unless a filelist was provided via
the -f options.  The filelist logic creates an mtree manifest from the
METALOG and the provided filelist by passing them through `sort -u`,
so duplicates were not expected.  However, duplicates can still occur
when a directory appears in multiple packages -- for example,

./etc/pam.d type=dir uname=root gname=wheel mode=0755
./etc/pam.d type=dir mode=0755 tags=package=runtime
./etc/pam.d type=dir mode=0755 tags=package=at
./etc/pam.d type=dir mode=0755 tags=package=ftp
./etc/pam.d type=dir mode=0755 tags=package=telnet

For the purposes of makefs these directory entries are identical, but
are of course not identical for sort -u.

For now just leave the allow duplicates -D flag enabled.

PR: 228606
Sponsored by: The FreeBSD Foundation

6 years agolink_elf_obj: correct an error message
emaste [Wed, 30 May 2018 12:55:27 +0000 (12:55 +0000)]
link_elf_obj: correct an error message

Previously we'd report that a file has "no valid symbol table" if it in
fact had two or more.  Change the message to report that there must be
exactly one.