]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agolibpmc/pmu: enable for i386 as well
Matt Macy [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
Matt Macy [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.
Navdeep Parhar [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
Matt Macy [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).
Navdeep Parhar [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
Dimitry Andric [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
Conrad Meyer [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
Emmanuel Vadot [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
Emmanuel Vadot [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
Emmanuel Vadot [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
Emmanuel Vadot [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
Dimitry Andric [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
Warner Losh [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
Brad Davis [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.
Hans Petter Selasky [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.
Hans Petter Selasky [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.
Hans Petter Selasky [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.
Hans Petter Selasky [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.
Hans Petter Selasky [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 Turner [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
Hans Petter Selasky [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().
Hans Petter Selasky [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 Turner [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 Turner [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
Mateusz Guzik [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.
Hans Petter Selasky [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
Justin Hibbits [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
Warner Losh [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
Warner Losh [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.
Warner Losh [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.
Warner Losh [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
Warner Losh [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.
Navdeep Parhar [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.
Navdeep Parhar [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
Matt Macy [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
Justin Hibbits [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
Navdeep Parhar [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 Davis [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
Matt Macy [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
Alan Somers [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
Matt Macy [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(),
Konstantin Belousov [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()
Konstantin Belousov [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.
Konstantin Belousov [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().
Konstantin Belousov [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,
Konstantin Belousov [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.
Rick Macklem [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
Alan Somers [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
Alan Somers [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
Ed Maste [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
Ed Maste [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
Alan Somers [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.
Mark Johnston [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
Alan Somers [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 Turner [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)
Emmanuel Vadot [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 Turner [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
Warner Losh [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
Warner Losh [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 Turner [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>
Ed Maste [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
Ed Maste [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.

6 years agopf: Add missing include statement
Kristof Provost [Wed, 30 May 2018 12:40:37 +0000 (12:40 +0000)]
pf: Add missing include statement

rmlocks require <sys/lock.h> as well as <sys/rmlock.h>.
Unbreak mips build.

6 years agoHide unsupported remote capture definitions to avoid breakage in ports.
Hans Petter Selasky [Wed, 30 May 2018 11:45:29 +0000 (11:45 +0000)]
Hide unsupported remote capture definitions to avoid breakage in ports.

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

6 years agoRemove redundant header file from source list in libpcap.
Hans Petter Selasky [Wed, 30 May 2018 08:24:57 +0000 (08:24 +0000)]
Remove redundant header file from source list in libpcap.

MFC after: 3 weeks
Sponsored by: Mellanox Technologies

6 years agopf: Replace rwlock on PF_RULES_LOCK with rmlock
Kristof Provost [Wed, 30 May 2018 07:11:33 +0000 (07:11 +0000)]
pf: Replace rwlock on PF_RULES_LOCK with rmlock

Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock with rmlock.
This change improves packet processing rate in high pps environments.
Benchmarking by olivier@ shows a 65% improvement in pps.

While here, also eliminate all appearances of "sys/rwlock.h" includes since it
is not used anymore.

Submitted by: farrokhi@
Differential Revision: https://reviews.freebsd.org/D15502

6 years agohwpmc: remove stale assert
Matt Macy [Wed, 30 May 2018 06:29:22 +0000 (06:29 +0000)]
hwpmc: remove stale assert

Reported by: eadler

6 years agoWe've removed the special case code for upgrading from FreeBSD 9 so
Warner Losh [Wed, 30 May 2018 05:00:30 +0000 (05:00 +0000)]
We've removed the special case code for upgrading from FreeBSD 9 so
remove the special warning. It's in svn if we need it.

6 years agoIf linebytes property is missing from the graphics device, assume no
Nathan Whitehorn [Wed, 30 May 2018 04:15:33 +0000 (04:15 +0000)]
If linebytes property is missing from the graphics device, assume no
overscan and synthesize it from the display depth and screen width.
This may not be right, but it sometimes right and is better than
returning CN_DEAD.

6 years agolibpmc: squelch valgrind warnings
Matt Macy [Wed, 30 May 2018 04:12:51 +0000 (04:12 +0000)]
libpmc: squelch valgrind warnings

6 years agoProtect dtrace_getpcstack() from a NULL stack pointer in a trap frame
Justin Hibbits [Wed, 30 May 2018 03:48:27 +0000 (03:48 +0000)]
Protect dtrace_getpcstack() from a NULL stack pointer in a trap frame

Found when trying to use lockstat on a POWER9, the stack pointer (r1) could
be NULL, and result in a NULL pointer dereference, crashing the kernel.

6 years agolibpmc: bring pmu_util closer in line with style(9)
Matt Macy [Wed, 30 May 2018 03:40:02 +0000 (03:40 +0000)]
libpmc: bring pmu_util closer in line with style(9)

6 years agoepoch(9): make epoch closer to style(9)
Matt Macy [Wed, 30 May 2018 03:39:57 +0000 (03:39 +0000)]
epoch(9): make epoch closer to style(9)

6 years agoMake opal_pci driver work with POWER9
Justin Hibbits [Wed, 30 May 2018 03:00:57 +0000 (03:00 +0000)]
Make opal_pci driver work with POWER9

Summary:
Coupled with r334365, this makes PCI work on POWER9.  There is still more to
do to fully exploit the hardware capabilities, but this is sufficient to
enable USB and ethernet controllers on a POWER9 Talos II system.

Reviewed by: nwhitehorn, leitao
Differential Revision: https://reviews.freebsd.org/D15566

6 years agoCache the phandle of the PCI node in opal_pci_attach
Justin Hibbits [Wed, 30 May 2018 02:47:23 +0000 (02:47 +0000)]
Cache the phandle of the PCI node in opal_pci_attach

Simple cleanup, no functional change.  This is related to the fixups needed
for POWER9 support.

6 years agoRestrict PCIe maxslots to 0, instead of PCI_SLOTMAX
Justin Hibbits [Wed, 30 May 2018 02:41:47 +0000 (02:41 +0000)]
Restrict PCIe maxslots to 0, instead of PCI_SLOTMAX

Summary:
PCIe only permits 1 device on an endpoint, so some devices ignore the device
part of B:D:F probing.  Although ARI likely fixes this, not all platforms
support ARI completely or correctly, so some devices end up showing up 32
times on the bus.

This was found during bringup of POWER9/Talos, and has been tested on POWER9
and POWER8 hardware.

Reviewed by: leitao
Differential Revision: https://reviews.freebsd.org/D15461

6 years agoRemove the mlx5 driver from LINT kernel config for 32-bit PPC
Ravi Pokala [Wed, 30 May 2018 02:26:36 +0000 (02:26 +0000)]
Remove the mlx5 driver from LINT kernel config for 32-bit PPC

The mlx5 driver requires 64-bit atomics, which are not supported on 32-bit
PPC. Exclude that driver from the LINT kernel config.

Submitted by: hps (but I re-worded the comment)
Reported by: rpokala
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D15611

6 years agoelfdump: chase ABI tag note name change from r232832
Ed Maste [Wed, 30 May 2018 01:16:50 +0000 (01:16 +0000)]
elfdump: chase ABI tag note name change from r232832

r232832 changed the ABI tag note name from .note.ABI-tag to .note.tag.
Follow suit in elfdump.

Elfdump's note parsing is very basic and should be significantly
reworked, but for now just restore the broken functionality.

PR: 228290
Submitted by: martin at lispworks.com
MFC after: 1 week

6 years agoTemporarily disconnect audit tests
Ed Maste [Wed, 30 May 2018 00:36:58 +0000 (00:36 +0000)]
Temporarily disconnect audit tests

Audit tests added in r334360 broke the build on a number of archs.
Remove the subdir from the top level tests/sys/Makefile until they're
fixed.

6 years agopmc: don't break build with format issues
Matt Macy [Wed, 30 May 2018 00:06:17 +0000 (00:06 +0000)]
pmc: don't break build with format issues

6 years agoAdd initial set of tests for audit(4)
Alan Somers [Tue, 29 May 2018 23:08:33 +0000 (23:08 +0000)]
Add initial set of tests for audit(4)

This change includes the framework for testing the auditability of various
syscalls, and includes changes for the first 12.  The tests will start
auditd(8) if needed, though they'll be much faster if it's already running.
The syscalls tested in this commit include mkdir(2), mkdirat(2), mknod(2),
mknodat(2), mkfifo(2), mkfifoat(2), link(2), linkat(2), symlink(2),
symlinkat(2), rename(2), and renameat(2).

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

6 years agodwatch(1): Fix "-t test" for post-processing profiles
Devin Teske [Tue, 29 May 2018 22:36:37 +0000 (22:36 +0000)]
dwatch(1): Fix "-t test" for post-processing profiles

Profiles that perform post-processing of the DTrace output were
dropping the "-t test" option on the floor. Fix handling of this
option for said profiles.

X-MFC-to: stable/11
X-MFC-with: r334261-334262
Sponsored by: Smule, Inc.

6 years agoiflib: mark irq allocation name parameter as constant
Stephen Hurd [Tue, 29 May 2018 21:56:39 +0000 (21:56 +0000)]
iflib: mark irq allocation name parameter as constant

The *name parameter passed to iflib_irq_alloc_generic and
iflib_softirq_alloc_generic is never modified. Many places in code pass
string literals and thus should not be modified.

Mark the *name parameter as a const char * instead, so that we enforce
that the name is not modified before passing to bus_describe_intr()

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: kmacy
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D15343

6 years agodumpon(8)
Sean Bruno [Tue, 29 May 2018 21:52:13 +0000 (21:52 +0000)]
dumpon(8)
- fix the WITHOUT_CRYPTO buildworld case.  Its rare, but some of us do
  build this way.

Sponsored by: Limelight Networks

6 years agoRevert second chunk of r333860. The warning from gcc is false positive. The
Gleb Smirnoff [Tue, 29 May 2018 21:45:15 +0000 (21:45 +0000)]
Revert second chunk of r333860. The warning from gcc is false positive. The
npages won't be ever used in no space case.

6 years agolibpmc: silence scan-build warnings
Matt Macy [Tue, 29 May 2018 21:02:13 +0000 (21:02 +0000)]
libpmc: silence scan-build warnings

6 years agopmc: silence scan-build warnings
Matt Macy [Tue, 29 May 2018 21:02:08 +0000 (21:02 +0000)]
pmc: silence scan-build warnings

6 years agopmc_annotate: adhere to the API
Eric van Gyzen [Tue, 29 May 2018 20:30:46 +0000 (20:30 +0000)]
pmc_annotate: adhere to the API

If the 'mode' parameter was invalid, pmc_annotate() would
return EINVAL instead of setting errno and returning -1.

Sponsored by: Dell EMC

6 years agopmc: Add new sub-command structured "pmc" utility
Matt Macy [Tue, 29 May 2018 20:28:34 +0000 (20:28 +0000)]
pmc: Add new sub-command structured "pmc" utility

This will manage pmc functionality with a more
manageable structure of subcommands rather than the
gradually accreted spaghetti logic of overlapping flags
that exists in pmcstat.

This is intended to ultimately have all the same functionality
as pmcannotate+pmccontrol+pmcstat. Currently it just has
"stat" and "system-stat" - counters for the process itself and counters
for the system as a whole respectively (i.e. system-stat includes kernel
threads). Note that the rusage results (page faults/context switches/
user/sys) for stat-system will not account for the system as a whole -
only for the child process specified on the command line.

Implementing stat was suggested by mjg@ and the output is based on that
from Linux's "perf stat".

% pmc stat -- make -j32 buildkernel -DNO_MODULES  -ss > /dev/null
         9598393  page faults           #       0.674 M/sec
          387085  voluntary csw         #       0.027 M/sec
          106989  involuntary csw       #       0.008 M/sec
   2763965982317  cycles
   2542953049760  instructions          #       0.920 inst/cycle
    511562750157  branches
     12917006881  branch-misses         #       2.525%
     17944429878  cache-references      #       0.007 refs/inst
      2205119560  cache-misses          #       12.289%
           43.74  real                  #       2019.72% cpu
          795.09  user                  #       1817.72% cpu
           88.35  sys                   #       202.00% cpu

% make -j32 buildkernel -DNO_MODULES  -ss > /dev/null &
% sudo pmc stat-system cat
^C             103  page faults         #       0.811 M/sec
               4  voluntary csw         #       0.031 M/sec
               0  involuntary csw       #       0.000 M/sec
   2843639070514  cycles
   2606171217438  instructions          #       0.916 inst/cycle
    522450422783  branches
     13092862839  branch-misses         #       2.506%
     18592101113  cache-references      #       0.007 refs/inst
      2562878667  cache-misses          #       13.785%
           44.85  real                  #       0.00% cpu
            0.00  user                  #       0.00% cpu
            0.00  sys                   #       0.00% cpu

6 years agolibpmc: don't return -1 on success in pmc_allocate
Matt Macy [Tue, 29 May 2018 20:09:35 +0000 (20:09 +0000)]
libpmc: don't return -1 on success in pmc_allocate

6 years agoCorrect pointer subtraction in KASSERT().
Brooks Davis [Tue, 29 May 2018 20:03:24 +0000 (20:03 +0000)]
Correct pointer subtraction in KASSERT().

The assertion would never fire without truly spectacular future
programming errors.

Reported by: Coverity
CID: 1391370
Sponsored by: DARPA, AFRL

6 years agolibpmc: don't leak string in error case either
Matt Macy [Tue, 29 May 2018 19:07:00 +0000 (19:07 +0000)]
libpmc: don't leak string in error case either

Reported by: vangyzen@

6 years agolibpmc: remove fixed counter diagnostic
Matt Macy [Tue, 29 May 2018 18:30:37 +0000 (18:30 +0000)]
libpmc: remove fixed counter diagnostic

6 years agolibpmc: free allocated string on return from pmc_allocate
Matt Macy [Tue, 29 May 2018 18:26:12 +0000 (18:26 +0000)]
libpmc: free allocated string on return from pmc_allocate

Reported by: Coverity
CID: 1391359

6 years agohwpmc: don't enter epoch section across mmap hook
Matt Macy [Tue, 29 May 2018 18:03:48 +0000 (18:03 +0000)]
hwpmc: don't enter epoch section across mmap hook

6 years agoiflib: hold context lock across detach for drivers that need it
Matt Macy [Tue, 29 May 2018 18:03:43 +0000 (18:03 +0000)]
iflib: hold context lock across detach for drivers that need it

6 years agoCorrect pointer subtraction in KASSERT().
Brooks Davis [Tue, 29 May 2018 17:49:03 +0000 (17:49 +0000)]
Correct pointer subtraction in KASSERT().

The assertion would never fire without truly spectacular future
programming errors.

Reported by: Coverity
CID: 13913671391368
Sponsored by: DARPA, AFRL

6 years agoIncrease the number of fdt memory regions we support to 16. Some SoCs have
Andrew Turner [Tue, 29 May 2018 17:44:40 +0000 (17:44 +0000)]
Increase the number of fdt memory regions we support to 16. Some SoCs have
many excluded regions causing a buffer overflow in the early boot code if
this value is too small.

Obtained from: ABT Systems Ltd
Sponsored by: Turing Robotic Industries

6 years agoadd support for console resuming, implement it for uart, use on x86
Andriy Gapon [Tue, 29 May 2018 16:16:24 +0000 (16:16 +0000)]
add support for console resuming, implement it for uart, use on x86

This change adds a new optional console method cn_resume and a kernel
console interface cnresume.  Consoles that may need to re-initialize
their hardware after suspend (e.g., because firmware does not care to do
it) will implement cn_resume.  Note that it is called in rather early
environment not unlike early boot, so the same restrictions apply.
Platform specific code, for platforms that support hardware suspend,
should call cnresume early after resume, before any console output is
expected.

This change fixes a problem with a system of mine failing to resume when
a serial console is used.  I found that the serial port was in a strange
configuration and an attempt to write to it likely resulted in an
infinite loop.

To avoid adding cn_resume method to every console driver, CONSOLE_DRIVER
macro has been extended to support optional methods.

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

6 years agoThe extension for zstd-compressed files is ".zst".
Mark Johnston [Tue, 29 May 2018 16:04:53 +0000 (16:04 +0000)]
The extension for zstd-compressed files is ".zst".

Reported by: manu