]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agomakefs: Fix "time" mtree attribute handling
emaste [Mon, 18 Mar 2019 19:26:36 +0000 (19:26 +0000)]
makefs: Fix "time" mtree attribute handling

When processing mtree(5) MANIFEST files, makefs(8) previously threw an
error if it encountered an entry whose "time" attribute contained a
non-zero subsecond component (e.g. time=1551620152.987220000).

Update the handling logic to properly assign the subsecond component if
built with nanosecond support, or silently discard it otherwise.

Also, re-enable the time attribute for the kyua tests.

PR: 194703
Submitted by: Mitchell Horne <mhorne063@gmail.com>
Differential Revision: https://reviews.freebsd.org/D19627

5 years agosys/stat.h: Improve timespec compatibility with other BSDs
emaste [Mon, 18 Mar 2019 19:23:19 +0000 (19:23 +0000)]
sys/stat.h: Improve timespec compatibility with other BSDs

OpenBSD and NetBSD provide macros to directly reference the underlying
struct timespec's tv_nsec member.  While FreeBSD has such macros for
tv_sec, the others are missing.  Add the following macros:

st->st_atimensec
st->st_mtimensec
st->st_ctimensec
st->st_birthtimensec

Adding these fields will provide programs which reference them better
portability to FreeBSD.  An example of such a program is makefs(8),
which has unused support for subseconds that it has inherited from
NetBSD.

Submitted by: Mitchell Horne <mhorne063@gmail.com>
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D19626

5 years agoAlso explicitly link libomp.so against -lm, as it transitively depends
dim [Mon, 18 Mar 2019 19:11:11 +0000 (19:11 +0000)]
Also explicitly link libomp.so against -lm, as it transitively depends
on scalbn and a few other math functions, via libcompiler-rt.  This
should allow OpenMP programs to link with BFD linkers too.

Reported by: jbeich
PR: 236062, 236581
MFC after: 1 month
X-MFC-With: r344779

5 years agoFixup syslog() call that should have used logging function pointer
lidl [Mon, 18 Mar 2019 15:45:06 +0000 (15:45 +0000)]
Fixup syslog() call that should have used logging function pointer

PR: 236614
Submitted by: Helge Oldach <freebsd@oldach.net>

5 years agoRevert r345274. It appears that not all 32-bit architectures have
ae [Mon, 18 Mar 2019 14:00:19 +0000 (14:00 +0000)]
Revert r345274. It appears that not all 32-bit architectures have
necessary CK primitives.

5 years agoUpdate NAT64LSN implementation:
ae [Mon, 18 Mar 2019 12:59:08 +0000 (12:59 +0000)]
Update NAT64LSN implementation:

o most of data structures and relations were modified to be able support
  large number of translation states. Now each supported protocol can
  use full ports range. Ports groups now are belongs to IPv4 alias
  addresses, not hosts. Each ports group can keep several states chunks.
  This is controlled with new `states_chunks` config option. States
  chunks allow to have several translation states for single alias address
  and port, but for different destination addresses.
o by default all hash tables now use jenkins hash.
o ConcurrencyKit and epoch(9) is used to make NAT64LSN lockless on fast path.
o one NAT64LSN instance now can be used to handle several IPv6 prefixes,
  special prefix "::" value should be used for this purpose when instance
  is created.
o due to modified internal data structures relations, the socket opcode
  that does states listing was changed.

Obtained from: Yandex LLC
MFC after: 1 month
Sponsored by: Yandex LLC

5 years agoFix a typo introduced in r344133
gallatin [Mon, 18 Mar 2019 12:41:42 +0000 (12:41 +0000)]
Fix a typo introduced in r344133

The line was misedited to change tt to st instead of
changing ut to st.

The use of st as the denominator in mul64_by_fraction() will lead
to an integer divide fault in the intr proc (the process holding
ithreads) where st will be 0.  This divide by 0 happens after
the total runtime for all ithreads exceeds 76 hours.

Submitted by: bde

5 years agonetmap: add support for multiple host rings
vmaffione [Mon, 18 Mar 2019 12:22:23 +0000 (12:22 +0000)]
netmap: add support for multiple host rings

Some applications forward from/to host rings most or all the
traffic received or sent on a physical interface. In this
cases it is desirable to have more than a pair of RX/TX host
rings, and use multiple threads to speed up forwarding.
This change adds support for multiple host rings. On registering
a netmap port, the user can specify the number of desired receive
and transmit host rings in the nr_host_tx_rings and nr_host_rx_rings
fields of the nmreq_register structure.

MFC after: 2 weeks

5 years agoAdd NAT64 CLAT implementation as defined in RFC6877.
ae [Mon, 18 Mar 2019 11:44:53 +0000 (11:44 +0000)]
Add NAT64 CLAT implementation as defined in RFC6877.

CLAT is customer-side translator that algorithmically translates 1:1
private IPv4 addresses to global IPv6 addresses, and vice versa.
It is implemented as part of ipfw_nat64 kernel module. When module
is loaded or compiled into the kernel, it registers "nat64clat" external
action. External action named instance can be created using `create`
command and then used in ipfw rules. The create command accepts two
IPv6 prefixes `plat_prefix` and `clat_prefix`. If plat_prefix is ommitted,
IPv6 NAT64 Well-Known prefix 64:ff9b::/96 will be used.

  # ipfw nat64clat CLAT create clat_prefix SRC_PFX plat_prefix DST_PFX
  # ipfw add nat64clat CLAT ip4 from IPv4_PFX to any out
  # ipfw add nat64clat CLAT ip6 from DST_PFX to SRC_PFX in

Obtained from: Yandex LLC
Submitted by: Boris N. Lytochkin
MFC after: 1 month
Relnotes: yes
Sponsored by: Yandex LLC

5 years agoAdd SPDX-License-Identifier and update year in copyright.
ae [Mon, 18 Mar 2019 10:50:32 +0000 (10:50 +0000)]
Add SPDX-License-Identifier and update year in copyright.

MFC after: 1 month

5 years agoModify struct nat64_config.
ae [Mon, 18 Mar 2019 10:39:14 +0000 (10:39 +0000)]
Modify struct nat64_config.

Add second IPv6 prefix to generic config structure and rename another
fields to conform to RFC6877. Now it contains two prefixes and length:
PLAT is provider-side translator that translates N:1 global IPv6 addresses
to global IPv4 addresses. CLAT is customer-side translator (XLAT) that
algorithmically translates 1:1 IPv4 addresses to global IPv6 addresses.
Use PLAT prefix in stateless (nat64stl) and stateful (nat64lsn)
translators.

Modify nat64_extract_ip4() and nat64_embed_ip4() functions to accept
prefix length and use plat_plen to specify prefix length.

Retire net.inet.ip.fw.nat64_allow_private sysctl variable.
Add NAT64_ALLOW_PRIVATE flag and use "allow_private" config option to
configure this ability separately for each NAT64 instance.

Obtained from: Yandex LLC
MFC after: 1 month
Sponsored by: Yandex LLC

5 years agoRevert r345244 for now.
markj [Mon, 18 Mar 2019 05:03:55 +0000 (05:03 +0000)]
Revert r345244 for now.

The code which advances the block number is simplistic and is not
correct when the starting offset is non-zero.  Revert the change until
this is fixed.

5 years agonet80211: correct check for SMPS node flags updates
avos [Mon, 18 Mar 2019 02:40:22 +0000 (02:40 +0000)]
net80211: correct check for SMPS node flags updates

Update node flags when driver supports SMPS, not when it is disabled or
in dynamic mode ((iv_htcaps & HTCAP_SMPS) != 0).

Checked with RTL8188EE (1T1R), STA mode - 'smps' word should disappear
from 'ifconfig wlan0' output.

MFC after: 2 weeks

5 years agoChange date of Canberra Day, now on second Monday in March.
grog [Sun, 17 Mar 2019 22:26:50 +0000 (22:26 +0000)]
Change date of Canberra Day, now on second Monday in March.
  https://en.wikipedia.org/wiki/Canberra_Day

5 years agoi386: improve detection of the fast page fault assist.
kib [Sun, 17 Mar 2019 18:31:48 +0000 (18:31 +0000)]
i386: improve detection of the fast page fault assist.

In particular, check that we are assisting the page fault from kernel mode.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoFix the gcc build (-Wstrict-prototypes) after r345244.
markj [Sun, 17 Mar 2019 18:06:13 +0000 (18:06 +0000)]
Fix the gcc build (-Wstrict-prototypes) after r345244.

Reported by: jenkins
MFC with: r345244

5 years agoOptimize lseek(SEEK_DATA) on UFS.
markj [Sun, 17 Mar 2019 17:34:06 +0000 (17:34 +0000)]
Optimize lseek(SEEK_DATA) on UFS.

The old implementation, at the VFS layer, would map the entire range of
logical blocks between the starting offset and the first data block
following that offset.  With large sparse files this is very
inefficient.  The VFS currently doesn't provide an interface to improve
upon the current implementation in a generic way.

Add ufs_bmap_seekdata(), which uses the obvious algorithm of scanning
indirect blocks to look for data blocks.  Use it instead of
vn_bmap_seekhole() to implement SEEK_DATA.

Reviewed by: kib, mckusick
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19598

5 years agoExplicitly link libomp.so against -lpthread, as it depends on pthread
dim [Sun, 17 Mar 2019 11:27:27 +0000 (11:27 +0000)]
Explicitly link libomp.so against -lpthread, as it depends on pthread
functionality.  This should make example OpenMP programs work out of the
box.

Reported by: jbeich
PR: 236062, 236581
MFC after: 1 month
X-MFC-With: r344779

5 years agoFix legacy IP autoconfiguration.
bz [Sun, 17 Mar 2019 09:31:09 +0000 (09:31 +0000)]
Fix legacy IP autoconfiguration.

It seems my subconcious plan in r345088 to not only prefer IPv6 autoconf
but to also slowly deteriorate legacy IP auto-configuration was uncovered
way too early.

In case IPv6 is a thing yet ipv6_autoconfif was not true, we would not
bring up the interface yet tell the follow-up DHCPv4 configuration in
ifconfig_up() that we did.  So unless you were doing SYNCDHCP or IPv6
you would not get legacy-IP DHCPv4 configuration.

I see multiple problems here: (a) people not yet using IPv6 (obviously a
problem), and (b) the dhclient startup script not running dhclient in
that case despite configured to do so (needs to be investigated seperately).

Reported by: Pawel Biernacki (pawel.biernacki gmail.com)
Tested by: Pawel Biernacki
Differential Revision: https://reviews.freebsd.org/D19488
Pointyhat to: bz (not sure if it is for breaking or
for letting them notice it so easily)

5 years agofdt: Explicitly mark fdt_slicer as dependent on geom_flashmap
jhibbits [Sun, 17 Mar 2019 04:33:17 +0000 (04:33 +0000)]
fdt: Explicitly mark fdt_slicer as dependent on geom_flashmap

Without this dependency relationship, the linker doesn't find the
flash_register_slicer() function, so kldload fails to load fdt_slicer.ko.

Discussed with: ian@

5 years ago`make buildkernel' should display the build time in seconds
wosch [Sat, 16 Mar 2019 20:02:57 +0000 (20:02 +0000)]
`make buildkernel' should display the build time in seconds

PR: 224433
Approved by: cem
Differential Revision: https://reviews.freebsd.org/D13910

5 years agoDisable lib/libomp build for the 32-bit part of amd64 buildworld, as it
dim [Sat, 16 Mar 2019 17:55:22 +0000 (17:55 +0000)]
Disable lib/libomp build for the 32-bit part of amd64 buildworld, as it
is not supported for that target.

Reported by: Michael Butler <imb@protected-networks.net>
PR: 236062
MFC after: 1 month
X-MFC-With: r344779

5 years agoConnect lib/libomp to the build.
dim [Sat, 16 Mar 2019 15:45:15 +0000 (15:45 +0000)]
Connect lib/libomp to the build.

* Set MK_OPENMP to yes by default only on amd64, for now.
* Bump __FreeBSD_version to signal this addition.
* Ensure gcc's conflicting omp.h is not installed if MK_OPENMP is yes.
* Update OptionalObsoleteFiles.inc to cope with the conflicting omp.h.
* Regenerate src.conf(5) with new WITH/WITHOUT fragments.

Relnotes: yes
PR: 236062
MFC after: 1 month
X-MFC-With: r344779

5 years agoAdd lib/libomp, with a Makefile, and generated configuration headers.
dim [Sat, 16 Mar 2019 15:01:36 +0000 (15:01 +0000)]
Add lib/libomp, with a Makefile, and generated configuration headers.
Not connected to the main build yet, as there is still the issue of the
GNU omp.h header conflicting with the LLVM one.  (That is, if MK_GCC is
enabled.)

PR: 236062
MFC after: 1 month
X-MFC-With: r344779

5 years agoAdd openmp __kmp_gettid() wrapper, using pthread_getthreadid_np(3).
dim [Sat, 16 Mar 2019 13:45:14 +0000 (13:45 +0000)]
Add openmp __kmp_gettid() wrapper, using pthread_getthreadid_np(3).
This has also been submitted upstream.

PR:           236062
MFC after:    1 month
X-MFC-With:   r344779

5 years agoMerge openmp release_80 branch r356034 (effectively, 8.0.0 rc5).
dim [Sat, 16 Mar 2019 13:43:07 +0000 (13:43 +0000)]
Merge openmp release_80 branch r356034 (effectively, 8.0.0 rc5).

PR: 236062
MFC after: 1 month
X-MFC-With: r344779

5 years agoAdd LLVM openmp trunk r351319 (just before the release_80 branch point)
dim [Sat, 16 Mar 2019 13:40:27 +0000 (13:40 +0000)]
Add LLVM openmp trunk r351319 (just before the release_80 branch point)
to contrib/llvm.  This is not yet connected to the build, the glue for
that will come in a follow-up commit.

PR: 236062
MFC after: 1 month
X-MFC-With: r344779

5 years agoUpdate maintainers for libunwind and lldb.
dim [Sat, 16 Mar 2019 13:26:42 +0000 (13:26 +0000)]
Update maintainers for libunwind and lldb.

5 years agoproccontrol(1): Add kpti control mode.
kib [Sat, 16 Mar 2019 11:46:48 +0000 (11:46 +0000)]
proccontrol(1): Add kpti control mode.

Requested by: jhb
Reviewed by: jhb, markj (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19514

5 years agoamd64 KPTI: add control from procctl(2).
kib [Sat, 16 Mar 2019 11:44:33 +0000 (11:44 +0000)]
amd64 KPTI: add control from procctl(2).

Add the infrastructure to allow MD procctl(2) commands, and use it to
introduce amd64 PTI control and reporting.  PTI mode cannot be
modified for existing pmap, the knob controls PTI of the new vmspace
created on exec.

Requested by: jhb
Reviewed by: jhb, markj (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19514

5 years agoamd64: Add md process flags and first P_MD_PTI flag.
kib [Sat, 16 Mar 2019 11:31:01 +0000 (11:31 +0000)]
amd64: Add md process flags and first P_MD_PTI flag.

PTI mode for the process pmap on exec is activated iff P_MD_PTI is set.

On exec, the existing vmspace can be reused only if pti mode of the
pmap matches the P_MD_PTI flag of the process.  Add MD
cpu_exec_vmspace_reuse() callback for exec_new_vmspace() which can
vetoed reuse of the existing vmspace.

MFC note: md_flags change struct proc KBI.

Reviewed by: jhb, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19514

5 years agoamd64: fix switching to the pmap with pti disabled.
kib [Sat, 16 Mar 2019 11:16:09 +0000 (11:16 +0000)]
amd64: fix switching to the pmap with pti disabled.

When the pmap with pti disabled (i.e. pm_ucr3 == PMAP_NO_CR3) is
activated, tss.rsp0 was not updated.  Any interrupt that happen before
next context switch would use pti trampoline stack for hardware frame
but fault and interrupt handlers are not prepared to this.  Correctly
update tss.rsp0 for both PMAP_NO_CR3 and pti pmaps.

Note that this case, pti = 1 but pmap->pm_ucr3 == PMAP_NO_CR3 is not
used at the moment.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19514

5 years agoamd64: rewrite cpu_switch.S fragment to reload tss.rsp0 on context switch.
kib [Sat, 16 Mar 2019 11:12:02 +0000 (11:12 +0000)]
amd64: rewrite cpu_switch.S fragment to reload tss.rsp0 on context switch.

New code avoids jumps.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19514

5 years agopf: Rename pfsync bucket lock
kp [Sat, 16 Mar 2019 10:14:03 +0000 (10:14 +0000)]
pf: Rename pfsync bucket lock

Previously the main pfsync lock and the bucket locks shared the same name.
This lead to spurious warnings from WITNESS like this:

    acquiring duplicate lock of same type: "pfsync"
     1st pfsync @ /usr/src/sys/netpfil/pf/if_pfsync.c:1402
     2nd pfsync @ /usr/src/sys/netpfil/pf/if_pfsync.c:1429

It's perfectly okay to grab both the main pfsync lock and a bucket lock at the
same time.

We don't need different names for each bucket lock, because we should always
only acquire a single one of those at a time.

MFC after: 1 week

5 years agoRemove empty directory left by r342255.
jmallett [Sat, 16 Mar 2019 06:12:28 +0000 (06:12 +0000)]
Remove empty directory left by r342255.

5 years agoRemove obsolete wrappers for 64-bit loads/stores which were only used by the
jmallett [Sat, 16 Mar 2019 06:09:45 +0000 (06:09 +0000)]
Remove obsolete wrappers for 64-bit loads/stores which were only used by the
removed (r342255) SiByte port.

Reviewed by: imp

5 years agoFix build for KLD dyn_sysctl example
gonzo [Sat, 16 Mar 2019 04:24:02 +0000 (04:24 +0000)]
Fix build for KLD dyn_sysctl example

Looks like the example was broken by change of SYSCTL_STATIC_CHILDREN
definition in r267992. Fix build by switching to using SYSCTL_ADD_ROOT_NODE

PR: 236139
Submitted by: Andrew Reiter <arr@watson.org>
MFC after: 1 week

5 years agoRemove duplicate `${PACKAGE}FILES+= cleanup.ksh` line
ngie [Sat, 16 Mar 2019 03:37:47 +0000 (03:37 +0000)]
Remove duplicate `${PACKAGE}FILES+= cleanup.ksh` line

This mutes the duplicate target warning emitted via bsd.files.mk each build.

MFC after: 1 week
Reviewed by: asomers
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D19603

5 years agostack(9): Drop unused API mode and comment that referenced it
cem [Fri, 15 Mar 2019 22:39:55 +0000 (22:39 +0000)]
stack(9): Drop unused API mode and comment that referenced it

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D19601

5 years agoIntegrate cddl/usr.sbin/zfds/tests into the FreeBSD test suite
ngie [Fri, 15 Mar 2019 21:49:19 +0000 (21:49 +0000)]
Integrate cddl/usr.sbin/zfds/tests into the FreeBSD test suite

This change integrates the unit tests for zfsd into the test suite using the
integration method described in r345203.

This change removes the `LOCALBASE` includes added for the port version of
googlemock/googletest, as well as unnecessary `LIBADD`/`DPADD` and `CXXFLAGS`
defines, which are included in the `GTEST_CXXFLAGS` variable, as part of
r345203.

Reviewed by: asomers
Approved by: emaste (mentor)
MFC after: 2 months
MFC with: r345203
Differential Revision: https://reviews.freebsd.org/D19552

5 years agoRegenerate src.conf(5) after r345203 (MK_GOOGLETEST addition)
ngie [Fri, 15 Mar 2019 21:46:54 +0000 (21:46 +0000)]
Regenerate src.conf(5) after r345203 (MK_GOOGLETEST addition)

MFC after: 2 months
MFC with: r345203
Approved by: emaste (mentor; implicit: https://reviews.freebsd.org/D19551)

5 years agoInitial googlemock/googletest integration into the build/FreeBSD test suite
ngie [Fri, 15 Mar 2019 21:43:52 +0000 (21:43 +0000)]
Initial googlemock/googletest integration into the build/FreeBSD test suite

This initial integration takes googlemock/googletest release 1.8.1, integrates
the library, tests, and sample unit tests into the build.

googlemock/googletest's inclusion is optionally available via `MK_GOOGLETEST`.
`MK_GOOGLETEST` is dependent on `MK_TESTS` and is enabled by default when
built with a C++11 capable toolchain.

Google tests can be specified via the `GTESTS` variable, which, in comparison
with the other test drivers, is more simplified/streamlined, as Googletest only
supports C++ tests; not raw C or shell tests (C tests can be written in C++
using the standard embedding methods).

No dependent libraries are assumed for the tests. One must specify `gmock`,
`gmock_main`, `gtest`, or `gtest_main`, via `LIBADD` for the program.

More information about googlemock and googletest can be found on the
Googletest [project page](https://github.com/google/googletest), and the
[GoogleMock](https://github.com/google/googletest/blob/v1.8.x/googlemock/docs/Documentation.md)
and
[GoogleTest](https://github.com/google/googletest/tree/v1.8.x/googletest/docs)
docs.

These tests are originally integrated into the build as plain driver tests, but
will be natively integrated into Kyua in a later version.

Known issues/Errata:
* [WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD](https://github.com/google/googletest/issues/2172)

Reviewed by: asomers
Approved by: emaste (mentor)
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D19551

5 years agoVOP_INACTIVE(9): clarify wording
asomers [Fri, 15 Mar 2019 21:11:47 +0000 (21:11 +0000)]
VOP_INACTIVE(9): clarify wording

Reviewed by: kib, 0mp
MFC after:  2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19596

5 years agoMFV r336930: 9284 arc_reclaim_thread has 2 jobs
mav [Fri, 15 Mar 2019 18:59:04 +0000 (18:59 +0000)]
MFV r336930: 9284 arc_reclaim_thread has 2 jobs

`arc_reclaim_thread()` calls `arc_adjust()` after calling
`arc_kmem_reap_now()`; `arc_adjust()` signals `arc_get_data_buf()` to
indicate that we may no longer be `arc_is_overflowing()`.

The problem is, `arc_kmem_reap_now()` can take several seconds to
complete, has no impact on `arc_is_overflowing()`, but due to how the
code is structured, can impact how long the ARC will remain in the
`arc_is_overflowing()` state.

The fix is to use seperate threads to:

1. keep `arc_size` under `arc_c`, by calling `arc_adjust()`, which
    improves `arc_is_overflowing()`

2. keep enough free memory in the system, by calling
 `arc_kmem_reap_now()` plus `arc_shrink()`, which improves
 `arc_available_memory()`.

illumos/illumos-gate@de753e34f9c399037936e8bc547d823bba9d4b0d

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Tim Kordas <tim.kordas@joyent.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Brad Lewis <brad.lewis@delphix.com>

5 years agoDeanonymize thread and proc state enums, so that a userland app can
glebius [Fri, 15 Mar 2019 18:18:05 +0000 (18:18 +0000)]
Deanonymize thread and proc state enums, so that a userland app can
use them without redefining the value names. New clang no longer
allows to redefine a enum value name to the same value.

Bump __FreeBSD_version, since ports depend on that.

Discussed with: jhb

5 years agoif_bridge(4): Drop pointless rtflush
kevans [Fri, 15 Mar 2019 17:19:36 +0000 (17:19 +0000)]
if_bridge(4): Drop pointless rtflush

At this point, all routes should've already been dropped by removing all
members from the bridge. This condition is in-fact KASSERT'd in the line
immediately above where this nop flush was added.

5 years agoRevert r345192: Too many trees in play for bridge(4) bits
kevans [Fri, 15 Mar 2019 17:18:19 +0000 (17:18 +0000)]
Revert r345192: Too many trees in play for bridge(4) bits

An accidental appendage was committed that has not undergone review yet.

5 years agoif_bridge(4): Drop pointless rtflush
kevans [Fri, 15 Mar 2019 17:13:05 +0000 (17:13 +0000)]
if_bridge(4): Drop pointless rtflush

At this point, all routes should've already been dropped by removing all
members from the bridge. This condition is in-fact KASSERT'd in the line
immediately above where this nop flush was added.

5 years agoProvide deterministic (and somewhat useful) value for RDPID result,
kib [Fri, 15 Mar 2019 16:43:28 +0000 (16:43 +0000)]
Provide deterministic (and somewhat useful) value for RDPID result,
and for %ecx after RDTSCP.

Initialize TSC_AUX MSR with CPUID.  It allows for userspace to cheaply
identify CPU it was executed on some time ago, which is sometimes useful.

Note: The values returned might be changed in future.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoAdd symbolic name for TSC_AUX MSR address.
kib [Fri, 15 Mar 2019 16:39:05 +0000 (16:39 +0000)]
Add symbolic name for TSC_AUX MSR address.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agobridge: Fix STP-related panic
kp [Fri, 15 Mar 2019 15:52:36 +0000 (15:52 +0000)]
bridge: Fix STP-related panic

After r345180 we need to have the appropriate vnet context set to delete an
rtnode in bridge_rtnode_destroy().
That's usually the case, but not when it's called by the STP code (through
bstp_notify_rtage()).

We have to set the vnet context in bridge_rtable_expire() just as we do in the
other STP callback bridge_state_change().

Reviewed by: kevans

5 years agotrim(8): emit more user-friendly error message in verbose mode.
eugen [Fri, 15 Mar 2019 14:42:23 +0000 (14:42 +0000)]
trim(8): emit more user-friendly error message in verbose mode.

If underlying driver provides no TRIM/UNMAP support and operation fails
due to this reason, state it clearly in verbose mode (default)
instead of writing standard message that may be too cryptic for a user:

trim: ioctl(DIOCGDELETE) failed: nda0: Operation not supported

Now it would write:

trim: nda0: TRIM/UNMAP not supported by driver

But still use previous format including errno value for quiet mode.

Small candelete() function borrowed from diskinfo(8) code.
This function was committed by Alan Somers <asomers@FreeBSD.org>,
so give him some credit.

Reported by: chuck

5 years agoif_bridge(4): Fix module teardown
kevans [Fri, 15 Mar 2019 13:19:52 +0000 (13:19 +0000)]
if_bridge(4): Fix module teardown

bridge_rtnode_zone still has outstanding allocations at the time of
destruction in the current model because all of the interface teardown
happens in a VNET_SYSUNINIT, -after- the MOD_UNLOAD has already been
processed.  The SYSUNINIT triggers destruction of the interfaces, which then
attempts to free the memory from the zone that's already been destroyed, and
we hit a panic.

Solve this by virtualizing the uma_zone we allocate the rtnodes from to fix
the ordering. bridge_rtable_fini should also take care to flush any
remaining routes that weren't taken care of when dynamic routes were flushed
in bridge_stop.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D19578

5 years agoRemove unneeded mount point unlock function calls.
fsu [Fri, 15 Mar 2019 11:49:46 +0000 (11:49 +0000)]
Remove unneeded mount point unlock function calls.

The ext2_nodealloccg() function unlocks the mount point
in case of successful node allocation.
The additional unlocks are not required and should be removed.

PR: 236452
Reported by: pho
MFC after: 3 days

5 years agobridge: Fix panic if the STP root is removed
kp [Fri, 15 Mar 2019 11:21:20 +0000 (11:21 +0000)]
bridge: Fix panic if the STP root is removed

If the spanning tree root interface is removed from the bridge we panic
on the next 'ifconfig'.
While the STP code is notified whenever a bridge member interface is
removed from the bridge it does not clear the bs_root_port. This means
bs_root_port can still point at an bridge_iflist which has been free()d.
The next access to it will panic.

Explicitly check if the interface we're removing in bstp_destroy() is
the root, and if so re-assign the roles, which clears bs_root_port.

Reviewed by: philip
MFC after: 2 weeks

5 years agopf :Use counter(9) in pf tables.
kp [Fri, 15 Mar 2019 11:08:44 +0000 (11:08 +0000)]
pf :Use counter(9) in pf tables.

The counters of pf tables are updated outside the rule lock. That means state
updates might overwrite each other. Furthermore allocation and
freeing of counters happens outside the lock as well.

Use counter(9) for the counters, and always allocate the counter table
element, so that the race condition cannot happen any more.

PR: 230619
Submitted by: Kajetan Staszkiewicz <vegeta@tuxpowered.net>
Reviewed by: glebius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19558

5 years agoFix bhyve PCIe capability emulation
chuck [Fri, 15 Mar 2019 02:11:28 +0000 (02:11 +0000)]
Fix bhyve PCIe capability emulation

PCIe devices starting with version 1.1 must set the Role-Based Error
Reporting bit.

And while we're in the neighborhood, generalize the code assigning the
device type.

Reviewed by: imp, araujo, rgrimes
Approved by: imp (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19580

5 years agoFix bhyve's NVMe Identify Namespace data
chuck [Fri, 15 Mar 2019 02:11:27 +0000 (02:11 +0000)]
Fix bhyve's NVMe Identify Namespace data

The NVMe Identify Namespace data structure's Number of LBA Formats
(NLBAF) field is a 0's based value (i.e. 0x0 means 1). Since the
emulation only supports a single format, set NLBAF to 0x0, not 1.

Reviewed by: imp, araujo, rgrimes
Approved by: imp (mentor)
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D19579

5 years agoAdd myself to committers-doc.dot.
ygy [Fri, 15 Mar 2019 00:20:28 +0000 (00:20 +0000)]
Add myself to committers-doc.dot.

Reminded by: rgrimes

5 years agoPFIL_MEMPTR for ipfw link level hook
glebius [Thu, 14 Mar 2019 22:52:16 +0000 (22:52 +0000)]
PFIL_MEMPTR for ipfw link level hook

With new pfil(9) KPI it is possible to pass a void pointer with length
instead of mbuf pointer to a packet filter. Until this commit no filters
supported that, so pfil run through a shim function pfil_fake_mbuf().

Now the ipfw(4) hook named "default-link", that is instantiated when
net.link.ether.ipfw sysctl is on, supports processing pointer/length
packets natively.

- ip_fw_args now has union for either mbuf or void *, and if flags have
  non-zero length, then we use the void *.
- through ipfw_chk() we handle mem/mbuf cases differently.
- ether_header goes away from args. It is ipfw_chk() responsibility
  to do parsing of Ethernet header.
- ipfw_log() now uses different bpf APIs to log packets.

Although ipfw_chk() is now capable to process pointer/length packets,
this commit adds support for the link level hook only, see
ipfw_check_frame(). Potentially the IP processing hook ipfw_check_packet()
can be improved too, but that requires more changes since the hook
supports more complex actions: NAT, divert, etc.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D19357

5 years agoRemove 'dir' argument from dummynet_io(). This makes it possible to make
glebius [Thu, 14 Mar 2019 22:32:50 +0000 (22:32 +0000)]
Remove 'dir' argument from dummynet_io(). This makes it possible to make
dn_dir flags private to dummynet. There is still some room for improvement.

5 years agoReduce argument list to ipfw_divert(), as args holds the rule ref and
glebius [Thu, 14 Mar 2019 22:31:12 +0000 (22:31 +0000)]
Reduce argument list to ipfw_divert(), as args holds the rule ref and
the direction. While here make 'tee' a bool.

5 years agoRemove 'dir' argument in ng_ipfw_input, since ip_fw_args now has this info.
glebius [Thu, 14 Mar 2019 22:30:05 +0000 (22:30 +0000)]
Remove 'dir' argument in ng_ipfw_input, since ip_fw_args now has this info.
While here make 'tee' boolean.

5 years ago- Add more flags to ip_fw_args. At this changeset only IPFW_ARGS_IN and
glebius [Thu, 14 Mar 2019 22:28:50 +0000 (22:28 +0000)]
- Add more flags to ip_fw_args. At this changeset only IPFW_ARGS_IN and
  IPFW_ARGS_OUT are utilized. They are intented to substitute the "dir"
  parameter that is often passes together with args.
- Rename ip_fw_args.oif to ifp and now it is set to either input or
  output interface, depending on IPFW_ARGS_IN/OUT bit set.

5 years agoMake second argument of ip_divert(), that specifies packet direction a bool.
glebius [Thu, 14 Mar 2019 22:23:09 +0000 (22:23 +0000)]
Make second argument of ip_divert(), that specifies packet direction a bool.
This allows pf(4) to avoid including ipfw(4) private files.

5 years agoSimplify ipfw_bpf_mtap2(). No functional change.
glebius [Thu, 14 Mar 2019 22:20:48 +0000 (22:20 +0000)]
Simplify ipfw_bpf_mtap2(). No functional change.

5 years agopkgbase: Use uname as ABI_FILE
manu [Thu, 14 Mar 2019 22:08:09 +0000 (22:08 +0000)]
pkgbase: Use uname as ABI_FILE

uname is always rebuild on FreeBSD so use this as ABI_FILE for pkg when
building pkg for pkgbase.
pkg uses uname too as default ABI_FILE as of commit d8bbf980b7f6f424fb7cc672c23ab2dfc82b6599
https://github.com/freebsd/pkg/commit/d8bbf980b7f6f424fb7cc672c23ab2dfc82b6599

Discussed with: bapt
MFC after: 1 week

5 years agobhyve(8): Fix uart emulation bug
cem [Thu, 14 Mar 2019 21:08:48 +0000 (21:08 +0000)]
bhyve(8): Fix uart emulation bug

THRE is always asserted in LSR reads, so REG_IER writes that raise
IER_ETXRDY must also set thre_int_pending.

Reported by: Illumos, according to emaste@
https://twitter.com/ed_maste/status/1106195949087584258
MFC after: 2 weeks

5 years agoVendor import of LLVM openmp trunk r351319 (just before the release_80
dim [Thu, 14 Mar 2019 20:09:10 +0000 (20:09 +0000)]
Vendor import of LLVM openmp trunk r351319 (just before the release_80
branch point):
https://llvm.org/svn/llvm-project/openmp/trunk@351319

5 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, and lldb
dim [Thu, 14 Mar 2019 19:52:12 +0000 (19:52 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, and lldb
release_80 branch r356034 (effectively, 8.0.0 rc5), resolve conflicts,
and bump version numbers.

PR: 236062
MFC after: 1 month
X-MFC-With: r344779

5 years agoether_fakeaddr: Use 'b' 's' 'd' for the prefix
kevans [Thu, 14 Mar 2019 19:48:43 +0000 (19:48 +0000)]
ether_fakeaddr: Use 'b' 's' 'd' for the prefix

This has the advantage of being obvious to sniff out the designated prefix
by eye and it has all the right bits set. Comment stolen from ffec.

I've removed bryanv@'s pending question of using the FreeBSD OUI range --
no one has followed up on this with a definitive action, and there's no
particular reason to shoot for it and the administrative overhead that comes
with deciding exactly how to use it.

5 years agomips: remove dead comment and definitions.
kib [Thu, 14 Mar 2019 19:07:41 +0000 (19:07 +0000)]
mips: remove dead comment and definitions.

Reviewed by: brooks, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D19584

5 years agoether: centralize fake hwaddr generation
kevans [Thu, 14 Mar 2019 17:18:00 +0000 (17:18 +0000)]
ether: centralize fake hwaddr generation

We currently have two places with identical fake hwaddr generation --
if_vxlan and if_bridge. Lift it into if_ethersubr for reuse in other
interfaces that may also need a fake addr.

Reviewed by: bryanv, kp, philip
Differential Revision: https://reviews.freebsd.org/D19573

5 years agofirmware(9): remove uuencoded example
emaste [Thu, 14 Mar 2019 17:09:07 +0000 (17:09 +0000)]
firmware(9): remove uuencoded example

We can (should) just commit the binary files to the source tree.

Reviewed by: bz, imp, 0mp
Differential Revision: https://reviews.freebsd.org/D19581

5 years agoRemove radeonkmsfw firmware files
emaste [Thu, 14 Mar 2019 17:05:46 +0000 (17:05 +0000)]
Remove radeonkmsfw firmware files

The drivers were removed in r344299 so there is no need to keep the
firmware files in the src tree.

Reviewed by: imp, jhibbits, johalun
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19583

5 years agoStyle(9): add a missing space between argument declerations.
brooks [Thu, 14 Mar 2019 15:56:34 +0000 (15:56 +0000)]
Style(9): add a missing space between argument declerations.

5 years agoRemove an unused struct proc *p1 in cpu_fork().
brooks [Thu, 14 Mar 2019 15:55:30 +0000 (15:55 +0000)]
Remove an unused struct proc *p1 in cpu_fork().

The only reference to p1 after a dead store was in a comment so update
the comment to refer to td1.

Submitted by: sbruno
Differential Revision: https://reviews.freebsd.org/D16226

5 years agochroot.8: Add examples & clean up
0mp [Thu, 14 Mar 2019 14:34:36 +0000 (14:34 +0000)]
chroot.8: Add examples & clean up

- Sort arguments in synopsis.
- Clarify that it is possible to specify arguments to the command (and that
  they could be passed as further arguments to chroot(1)).
- Standardize the description of the flags.
- Improve formatting (e.g., do not use macros in strings specifying width).
- Add examples.

Reviewed by: bcr
Approved by: bcr (doc)
Approved by: krion (mentor, implicit), mat (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D19582

5 years agoRemove npe microcode
emaste [Thu, 14 Mar 2019 13:28:21 +0000 (13:28 +0000)]
Remove npe microcode

The driver was removed in r336436.

5 years agotrim(8): add another safety net
eugen [Thu, 14 Mar 2019 12:25:16 +0000 (12:25 +0000)]
trim(8): add another safety net

It is quite easy make a mistake and run something like this:

trim -f /dev/da0 -r rfile

This would trim the whole device then emit an error on non-existing file -r.

Add another check to prevent this while allowing this form still
for real object names beginning from dash:

trim -f -- /dev/da0 -r rfile

MFC after: 1 week

5 years agoRevert r345102 until the DRM next port issues are resolved.
hselasky [Thu, 14 Mar 2019 09:18:54 +0000 (09:18 +0000)]
Revert r345102 until the DRM next port issues are resolved.

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

5 years agoResolve duplicate symbol name conflict after r345095, when building LINT.
hselasky [Wed, 13 Mar 2019 19:53:20 +0000 (19:53 +0000)]
Resolve duplicate symbol name conflict after r345095, when building LINT.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoImplement sg_virt() function in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 19:31:33 +0000 (19:31 +0000)]
Implement sg_virt() function in the LinuxKPI.

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

5 years agoDefine SG_CHAIN and SG_END in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 19:30:40 +0000 (19:30 +0000)]
Define SG_CHAIN and SG_END in the LinuxKPI.

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

5 years agoImplement pr_info_ratelimited() function macro in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 19:26:24 +0000 (19:26 +0000)]
Implement pr_info_ratelimited() function macro in the LinuxKPI.

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

5 years agoDefine some RCU debug macros in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 19:24:30 +0000 (19:24 +0000)]
Define some RCU debug macros in the LinuxKPI.

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

5 years agoHonor SYSCTL function return values when creating sysfs nodes in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 19:21:19 +0000 (19:21 +0000)]
Honor SYSCTL function return values when creating sysfs nodes in the LinuxKPI.
Return proper error code upon failure.

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

5 years agoImplement more malloc function macros in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 19:17:52 +0000 (19:17 +0000)]
Implement more malloc function macros in the LinuxKPI.
Fix arguments for currently unused kvmalloc().

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

5 years agoImplement more PCI speed related functions and macros in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 19:15:36 +0000 (19:15 +0000)]
Implement more PCI speed related functions and macros in the LinuxKPI.

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

5 years agoImplement IS_ALIGNED() and DIV_ROUND_DOWN_ULL() function macros in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 19:04:06 +0000 (19:04 +0000)]
Implement IS_ALIGNED() and DIV_ROUND_DOWN_ULL() function macros in the LinuxKPI.

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

5 years agoImplement si_meminfo() in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 19:01:55 +0000 (19:01 +0000)]
Implement si_meminfo() in the LinuxKPI.

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

5 years agoImplement task_euid() and get_task_state() function macros in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 18:55:41 +0000 (18:55 +0000)]
Implement task_euid() and get_task_state() function macros in the LinuxKPI.

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

5 years agoImplement get_task_comm() in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 18:53:29 +0000 (18:53 +0000)]
Implement get_task_comm() in the LinuxKPI.

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

5 years agoImplement current_exiting() in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 18:51:33 +0000 (18:51 +0000)]
Implement current_exiting() in the LinuxKPI.

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

5 years agoImplement list_for_each_entry_from_reverse() and
hselasky [Wed, 13 Mar 2019 18:47:17 +0000 (18:47 +0000)]
Implement list_for_each_entry_from_reverse() and
list_bulk_move_tail() in the LinuxKPI.

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

5 years agoImplement dma_map_page_attrs() in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 18:44:06 +0000 (18:44 +0000)]
Implement dma_map_page_attrs() in the LinuxKPI.

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

5 years agoImplement ida_free() and ida_alloc_max() in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 18:02:47 +0000 (18:02 +0000)]
Implement ida_free() and ida_alloc_max() in the LinuxKPI.

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

5 years agoImplement DEFINE_STATIC_SRCU() function macro in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 18:00:25 +0000 (18:00 +0000)]
Implement DEFINE_STATIC_SRCU() function macro in the LinuxKPI.

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

5 years agoImplement BITS_PER_TYPE() function macro in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 17:55:58 +0000 (17:55 +0000)]
Implement BITS_PER_TYPE() function macro in the LinuxKPI.
Fix some style while at it.

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

5 years agoProperly define the DMA attribute values in the LinuxKPI.
hselasky [Wed, 13 Mar 2019 17:51:08 +0000 (17:51 +0000)]
Properly define the DMA attribute values in the LinuxKPI.

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