]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoSpell LOADER correctly so we test lua build.
Warner Losh [Fri, 1 May 2020 17:50:26 +0000 (17:50 +0000)]
Spell LOADER correctly so we test lua build.

4 years agoRemove more stray sparc64 ifdefs.
Warner Losh [Fri, 1 May 2020 17:50:21 +0000 (17:50 +0000)]
Remove more stray sparc64 ifdefs.

Also, dmabuf appears to only be set for sparc64 case, but there was a
comment at its only use that says it was broken for some apple
adapters. #ifdef it all of that out now that nothing sets it.

4 years agoCatch up to arm/arm and sparc64 removal.
Warner Losh [Fri, 1 May 2020 17:17:01 +0000 (17:17 +0000)]
Catch up to arm/arm and sparc64 removal.

4 years agoWhen we have an invalid build option, don't rm -rf the current
Warner Losh [Fri, 1 May 2020 17:16:57 +0000 (17:16 +0000)]
When we have an invalid build option, don't rm -rf the current
directory.

Add a quick sanity check to objdir before using it.  It must start
with /. If there was a make error getting it, report that and continue
with the next target. If there was anything else, bail out.

4 years ago[PowerPC] Set fixed boot1.elf load address
Brandon Bergren [Fri, 1 May 2020 16:56:36 +0000 (16:56 +0000)]
[PowerPC] Set fixed boot1.elf load address

Due to the way claiming works, we need to ensure on AIM OFW machines that
we don't have overlapping ranges on any step of the load.

Load boot1.elf at 0x38000 so it will not overlap with anything even if the
entire PReP partition gets loaded by OFW.

Tested on an iBook G4, a PowerBook G4, a PowerMac G5, and qemu pseries.
(qemu pseries is broken without this patch due to the high address used
by lld10.)

Reviewed by: adalava
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D24623

4 years agoRemove sparc relocation support from reloc_elf.c.
Brandon Bergren [Fri, 1 May 2020 16:47:54 +0000 (16:47 +0000)]
Remove sparc relocation support from reloc_elf.c.

It got missed in the sparc64 removal.

4 years agocorrect procctl(PROC_PROTMAX_STATUS _NOFORCE return
Ed Maste [Fri, 1 May 2020 14:30:59 +0000 (14:30 +0000)]
correct procctl(PROC_PROTMAX_STATUS _NOFORCE return

Previously procctl(PROC_PROTMAX_STATUS, ... used the PROC_ASLR_NOFORCE
macro for the "system-wide configured policy" status, instead of
PROC_PROTMAX_NOFORCE.

They both have a value of 3, so no functional change.

Sponsored by: The FreeBSD Foundation

4 years agoFix typo in r360492:
Benedict Reuschling [Fri, 1 May 2020 11:36:39 +0000 (11:36 +0000)]
Fix typo in r360492:

appeard -> appeared

Reported by: trasz (via IRC)

4 years agoImplement more PCI-express bandwidth functions in the LinuxKPI.
Hans Petter Selasky [Fri, 1 May 2020 10:32:42 +0000 (10:32 +0000)]
Implement more PCI-express bandwidth functions in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement mutex_lock_killable() in the LinuxKPI.
Hans Petter Selasky [Fri, 1 May 2020 10:28:21 +0000 (10:28 +0000)]
Implement mutex_lock_killable() in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement DIV64_U64_ROUND_UP() in the LinuxKPI.
Hans Petter Selasky [Fri, 1 May 2020 10:25:07 +0000 (10:25 +0000)]
Implement DIV64_U64_ROUND_UP() in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement more lockdep macros in the LinuxKPI.
Hans Petter Selasky [Fri, 1 May 2020 10:18:07 +0000 (10:18 +0000)]
Implement more lockdep macros in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement kstrtou64() in the LinuxKPI.
Hans Petter Selasky [Fri, 1 May 2020 10:14:45 +0000 (10:14 +0000)]
Implement kstrtou64() in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix a number of the following issues in man4:
Benedict Reuschling [Fri, 1 May 2020 10:02:38 +0000 (10:02 +0000)]
Fix a number of the following issues in man4:
- Inconsistencies in .Dd like abbreviated month names,
"th" after numbers, or leading zeros
- No line breaks after a sentence stop
- Whitespace at the end of the line
- Use macros for BSD OS names instead of hardcoded names
- CAVEATS instead of CAVEAT in section name

No actual content change in terms of additions were made, so
no bump of the .Dd for these man pages.
All of these issues were found and fixed by Gordon Bergling.

Submitted by:     gbergling_gmail.com
Approved by:     bcr
Differential Revision: https://reviews.freebsd.org/D24648

4 years agoAdd RISC-V interpreter example
Mitchell Horne [Fri, 1 May 2020 01:31:19 +0000 (01:31 +0000)]
Add RISC-V interpreter example

Now that RISC-V support has landed in qemu-user-static, add to the list
of examples in the binmiscctl(8) manpage.

Reviewed by: kevans
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D24646

4 years agoMFV: r360512
Jung-uk Kim [Fri, 1 May 2020 01:26:36 +0000 (01:26 +0000)]
MFV: r360512

Merge ACPICA 20200430.

4 years agoFactor some code out of nfsm_dissct() into separate functions.
Rick Macklem [Fri, 1 May 2020 00:36:14 +0000 (00:36 +0000)]
Factor some code out of nfsm_dissct() into separate functions.

Factoring some of the code in nfsm_dissct() out into separate functions
allows these functions to be used elsewhere in the NFS mbuf handling code.
Other uses of these functions will be done in future commits.
It also makes it easier to add support for ext_pgs mbufs, which is needed
for nfs-over-tls under development in base/projects/nfs-over-tls.

Although the algorithm in nfsm_dissct() is somewhat re-written by this
patch, the semantics of nfsm_dissct() should not have changed.

4 years agoImport ACPICA 20200430.
Jung-uk Kim [Thu, 30 Apr 2020 23:40:36 +0000 (23:40 +0000)]
Import ACPICA 20200430.

4 years agoRemove the SYMVER build option.
John Baldwin [Thu, 30 Apr 2020 22:08:40 +0000 (22:08 +0000)]
Remove the SYMVER build option.

This option was added as a transition aide when symbol versioning was
first added.  It was enabled by default in 2007 and is supported even
by the old GPLv2 binutils.  Trying to disable it currently fails to
build in libc and at this point it isn't worth fixing the build.

Reported by: Michael Dexter
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D24637

4 years agogeli tests require OpenSSL - exclude them under WITHOUT_OPENSSL
Ed Maste [Thu, 30 Apr 2020 21:09:01 +0000 (21:09 +0000)]
geli tests require OpenSSL - exclude them under WITHOUT_OPENSSL

PR: 245931
Submitted by: The FreeBSD Foundation

4 years agoFix three bugs highlighted by review:
Warner Losh [Thu, 30 Apr 2020 21:08:59 +0000 (21:08 +0000)]
Fix three bugs highlighted by review:

- maxio should be dp->d_maxsize. This is often MAXPHYS, but not always
  (especially if MAXPHYS is > 1MB).
- Unlock the periph before returning. We don't need to relock it to
  release the ccb.
- Make sure we release the ccb in error paths.

Reviewed by: cperciva

4 years agosrc.conf.5: regen after WITHOUT_OPENSSL dep changes
Ed Maste [Thu, 30 Apr 2020 21:08:22 +0000 (21:08 +0000)]
src.conf.5: regen after WITHOUT_OPENSSL dep changes

4 years agolualoader: config: improve readConfFiles, rename to readConf
Kyle Evans [Thu, 30 Apr 2020 21:04:39 +0000 (21:04 +0000)]
lualoader: config: improve readConfFiles, rename to readConf

The previous interface was pretty bad, and required the caller to get some
implementation details correct that it really shouldn't need to (e.g.
loader_conf_files handling) and pass in an empty table for it to use.

The new and much improved interface, readConf, is much less of a hack;
hiding these implementation details and just doing the right thing.
config.lua will now use it to process /boot/defaults/loader.conf and the
subsequent loader_conf_files from there, and read-conf will also use it.

This improvement submitted by Olivier (cited below), loader_conf_files
handling from the original patch was changed to just clobber it before
processing and not bother restoring it after the fact following r360505
where it's now guaranteed to evade the loader environment.

PR: 244640
Submitted by: Olivier Certner (olivier freebsd free fr>

4 years agolualoader: config: add a table for restricted environment vars
Kyle Evans [Thu, 30 Apr 2020 20:58:58 +0000 (20:58 +0000)]
lualoader: config: add a table for restricted environment vars

This new table should be used for transient values that don't need to end up
in the loader environment. Generally, these will be things that are internal
details that really aren't needed or interesting outside of the config
module (e.g. if we changed how ${module}_* directives work, they might use
this instead).

To start, populate it with loader_conf_files. Any specific value of
loader_conf_files isn't all that interesting; if we're going to export it,
we should really instead export a loader_conf_files that indicates all of
the configuration files we processed. This will be used to reduce
bookkeeping overhead in a future commit that cleans up readConfFiles.

4 years agoStyle(9) nit: put function name at start of line.
Warner Losh [Thu, 30 Apr 2020 20:58:38 +0000 (20:58 +0000)]
Style(9) nit: put function name at start of line.

4 years agoMove / reword a comment.
Warner Losh [Thu, 30 Apr 2020 20:58:33 +0000 (20:58 +0000)]
Move / reword a comment.

Explain what we're doing with mapping CAM's notion of a LUN to NVMe's
notion of a namespace.

4 years agoRemove stray blank line.
Warner Losh [Thu, 30 Apr 2020 19:48:55 +0000 (19:48 +0000)]
Remove stray blank line.

This was accidentally added in r360483.

4 years agosrc.opts.mk: add WITHOUT_OPENSSL dependencies
Ed Maste [Thu, 30 Apr 2020 18:11:56 +0000 (18:11 +0000)]
src.opts.mk: add WITHOUT_OPENSSL dependencies

A number of components require OpenSSL and fail to build if it is not
enabled.  As a first phase force these off under WITHOUT_OPENSSL.  A
second phase should make these more fine-grained, allowing the component
to build but without OpenSSL.

PR: 245931
Sponsored by: The FreeBSD Foundation

4 years agoig4iic_acpi_probe: remove set but unused variable
Andriy Gapon [Thu, 30 Apr 2020 15:45:01 +0000 (15:45 +0000)]
ig4iic_acpi_probe: remove set but unused variable

MFC after: 1 week

4 years agoIncrease the iflib txq callout mutex name length to 32 bytes.
Mark Johnston [Thu, 30 Apr 2020 15:39:04 +0000 (15:39 +0000)]
Increase the iflib txq callout mutex name length to 32 bytes.

With a length of 16, the name ("<if name>:TX(<qid>):callout") typically
gets truncated.

PR: 245712
Reported by: ghuckriede@blackberry.com
MFC after: 1 week

4 years agoAdd a new manual page for unionfs(5), written by
Benedict Reuschling [Thu, 30 Apr 2020 12:02:13 +0000 (12:02 +0000)]
Add a new manual page for unionfs(5), written by
Gordon Bergling. Hook it up to the build by adding
it to the Makefile.

Submitted by:     gbergling_gmail.com
Approved by:     bcr
Differential Revision: https://reviews.freebsd.org/D24589

4 years agoAdd HISTORY sections to disk(9), driver(9), and
Benedict Reuschling [Thu, 30 Apr 2020 11:17:29 +0000 (11:17 +0000)]
Add HISTORY sections to disk(9), driver(9), and
epoch(9).

In one instance, remove a trailing whitespace while here.

Submitted by: gbergling_gmail.com
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24243

4 years agoIntroduce a lower bound of 2 MSS to TCP Cubic.
Richard Scheffenegger [Thu, 30 Apr 2020 11:11:28 +0000 (11:11 +0000)]
Introduce a lower bound of 2 MSS to TCP Cubic.

Running TCP Cubic together with ECN could end up reducing cwnd down to 1 byte, if the
receiver continously sets the ECE flag, resulting in very poor transmission speeds.

In line with RFC6582 App. B, a lower bound of 2 MSS is introduced, as well as a typecast
to prevent any potential integer overflows during intermediate calculation steps of the
adjusted cwnd.

Reported by: Cheng Cui
Reviewed by: tuexen (mentor)
Approved by: tuexen (mentor)
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D23353

4 years agoloader.conf(5): document that loader_conf_files may be clobbered
Kyle Evans [Thu, 30 Apr 2020 02:50:58 +0000 (02:50 +0000)]
loader.conf(5): document that loader_conf_files may be clobbered

A future change in lualoader may take some liberties with the
loader_conf_files in the name of efficiency; namely, it may start omitting
it from the loader environment entirely so that it doesn't need to worry
about maintaining any specific value.

This variable has historically been incredibly volatile anyways, as it may
get set to completely different values in any given configuration file to
trigger a load of more files.

Document now that we may not maintain it in the future, but perhaps we'll
reserve the right to change our minds and eventually formally export all of
the loader configuration files that were read using this variable.

MFC after: 3 days

4 years agoMake sure that we get the sbuf resources we need.
Warner Losh [Thu, 30 Apr 2020 00:43:11 +0000 (00:43 +0000)]
Make sure that we get the sbuf resources we need.

Since we're calling sbuf_new with NOWAIT, make sure it can allocate a
buffer to use. Don't print anything if we can't get it.

Noticed by: rpokala

4 years agoImplement the NVME_GET_NSID and NVME_PASSTHROUGH_CMD ioctls
Warner Losh [Thu, 30 Apr 2020 00:43:07 +0000 (00:43 +0000)]
Implement the NVME_GET_NSID and NVME_PASSTHROUGH_CMD ioctls

With these two ioctls implemented in the nda driver, nvmecontrol now
works with nda just like it does with nvd. It eliminates the need to
jump through odd hoops to get this data.

4 years agoReturn the nvmeX device associated with the ndaX device.
Warner Losh [Thu, 30 Apr 2020 00:43:02 +0000 (00:43 +0000)]
Return the nvmeX device associated with the ndaX device.

Add the nvmeX device to the XPT_PATH_INQ nvme specific
information. while one could figure this out by looking up the
domain:bus:slot:function, it's a lot easier to have the SIM set it
directly since the sim knows this.

4 years agoGenerate a devctl event for interesting events
Warner Losh [Thu, 30 Apr 2020 00:27:19 +0000 (00:27 +0000)]
Generate a devctl event for interesting events

When we reset the controller, and when the controller tells us about a
critical warning, send an event.

4 years agosrc.conf.5: regen after 359736, ZONEINFO_OLD_TIMEZONES_SUPPORT removal
Ed Maste [Thu, 30 Apr 2020 00:14:14 +0000 (00:14 +0000)]
src.conf.5: regen after 359736, ZONEINFO_OLD_TIMEZONES_SUPPORT removal

4 years agoPrevent premature shrinking of the scaled receive window
Richard Scheffenegger [Wed, 29 Apr 2020 22:01:33 +0000 (22:01 +0000)]
Prevent premature shrinking of the scaled receive window
which can cause a TCP client to use invalid or stale TCP sequence numbers for ACK packets.

Packets with old sequence numbers are ignored and not used to update the send window size.
This might cause the TCP session to hang indefinitely under some circumstances.

Reported by: Cui Cheng
Reviewed by: tuexen (mentor), rgrimes (mentor)
Approved by: tuexen (mentor), rgrimes (mentor)
MFC after: 3 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D24515

4 years agoConvert more rtentry field accesses into nhop fields accesses.
Alexander V. Chernikov [Wed, 29 Apr 2020 21:54:09 +0000 (21:54 +0000)]
Convert more rtentry field accesses into nhop fields accesses.

Continue routing subsystem conversion to nhop objects defined in r359823.
Use fields from nhop structure instead of "struct rtentry" fields.
This is one of the last changes prior to removing rt_ifp, rt_ifa,
 rt_gateway and rt_mtu from struct rtentry.

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

4 years agoCorrectly set up the initial TCP congestion window in all cases,
Richard Scheffenegger [Wed, 29 Apr 2020 21:48:52 +0000 (21:48 +0000)]
Correctly set up the initial TCP congestion window in all cases,
by not including the SYN bit sequence space in cwnd related calculations.
Snd_und is adjusted explicitly in all cases, outside the cwnd update, instead.

This fixes an off-by-one conformance issue with regular TCP sessions not
using Appropriate Byte Counting (RFC3465), sending one more packet during
the initial window than expected.

PR: 235256
Reviewed by: tuexen (mentor), rgrimes (mentor)
Approved by: tuexen (mentor), rgrimes (mentor)
MFC after: 3 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D19000

4 years agodtrace tests: Support globbing for excludes
Bryan Drewery [Wed, 29 Apr 2020 21:12:32 +0000 (21:12 +0000)]
dtrace tests: Support globbing for excludes

Downstream this makes skipping tests like common/ip/tst.*sctp*.ksh simpler.

Reviewed by: vangyzen, cem, markj
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D24608

4 years agoAdd nhop to the ifa_rtrequest() callback.
Alexander V. Chernikov [Wed, 29 Apr 2020 19:28:56 +0000 (19:28 +0000)]
Add nhop to the ifa_rtrequest() callback.

With the upcoming multipath changes described in D24141,
 rt->rt_nhop can potentially point to a nexthop group instead of
 an individual nhop.
To simplify caller handling of such cases, change ifa_rtrequest() callback
 to pass changed nhop directly.

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

4 years agoMove ARM specific flags to arm/Makefile.inc
Michal Meloun [Wed, 29 Apr 2020 16:05:50 +0000 (16:05 +0000)]
Move ARM specific flags to arm/Makefile.inc

Requested by: kib
MFC with: r360463

4 years agoFix style(9). Strip write only variables.
Michal Meloun [Wed, 29 Apr 2020 14:36:50 +0000 (14:36 +0000)]
Fix style(9). Strip write only variables.
Not a functional change.

MFC after: 1 week

4 years agoExport tracing facility of GIC500 ITS block.
Michal Meloun [Wed, 29 Apr 2020 14:31:25 +0000 (14:31 +0000)]
Export tracing facility of GIC500 ITS block.
Possibility of tracing of processing message based interrupts is very
useful for debugging of PCIe driver, mainly for its MSI part.

MFC after: 1 week

4 years agoSkip bectl jail test if jail not installed (WITHOUT_JAIL).
Olivier Cochard [Wed, 29 Apr 2020 14:15:21 +0000 (14:15 +0000)]
Skip bectl jail test if jail not installed (WITHOUT_JAIL).

Approved by: kevans
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D24613

4 years agoDon't try to set frequendcy for enumerated but newer started CPUs.
Michal Meloun [Wed, 29 Apr 2020 14:14:15 +0000 (14:14 +0000)]
Don't try to set frequendcy for enumerated but newer started CPUs.

Openfirmare enumerates and installs the driver for all processors,
regardless of whether they will be started later (because of power
constrains for example).

MFC after: 3 weeks

4 years agoDon't allow to use FPU inside of rtld library.
Michal Meloun [Wed, 29 Apr 2020 14:06:42 +0000 (14:06 +0000)]
Don't allow to use FPU inside of rtld library.
Clang10 may use FPU instructions for optimizing operations with
memory blocks. But we don't want to do lengthy save/restore of all
FPU registers across each rtld_start() call.

MFC after: 3 week

4 years agoDon't try to re-initialize already preseted regulator.
Michal Meloun [Wed, 29 Apr 2020 13:45:21 +0000 (13:45 +0000)]
Don't try to re-initialize already preseted regulator.

Don't set initial voltage for regulators having their voltage already
in allowed range. As side effect of this change, we don't try to set
initial voltage for fixed voltage regulators - these don't have impemented
voltage set  method so their initialization has always failed.

MFC after: 3 weeks

4 years agoMultiple fixes for rockchip iodomain driver:
Michal Meloun [Wed, 29 Apr 2020 13:43:15 +0000 (13:43 +0000)]
Multiple fixes for rockchip iodomain driver:
- always initialize selector of voltage signaling standard.
  Various versions of U-boot leaves voltage signaling standard settings
  for PMUIO2 domain in different state.  Always initialize it
  into expected state.
- start the driver as early as possible, the IO domains should be
  initialized before other drivers are attached.
- rename RK3399 register to its name founds in TRM.

This is the second part of fixes for serial port corruption observed after
DT 5.6 import.

Reviewed by: manu
MFC after: 1 week

4 years agoliblua: ensure that "require" will fail in bootstrap flua
Ed Maste [Wed, 29 Apr 2020 13:41:32 +0000 (13:41 +0000)]
liblua: ensure that "require" will fail in bootstrap flua

We do not want to support bootstrapping lua modules, so ensure that
require will fail by providing a nonexistent path.

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

4 years agoAdd HISTORY section to domain(9).
Benedict Reuschling [Wed, 29 Apr 2020 11:46:01 +0000 (11:46 +0000)]
Add HISTORY section to domain(9).

Submitted by: gbergling_gmail.com
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24150

4 years agoWhen copying and pasting the code in the EXAMPLE
Benedict Reuschling [Wed, 29 Apr 2020 11:25:04 +0000 (11:25 +0000)]
When copying and pasting the code in the EXAMPLE
section, it would result in the following error:

"ngctl: send msg: Invalid argument"

The reason for this is the missing whitespace to
separate the arguments. When adding the whitespace,
the example works as intended.

Submitted by:     lutz_donnerhacke.de
Approved by:     bcr
Differential Revision: https://reviews.freebsd.org/D23773

4 years agoUse universe-toolchain config(8)
Bryan Drewery [Wed, 29 Apr 2020 02:18:39 +0000 (02:18 +0000)]
Use universe-toolchain config(8)

This is a temporary hack to aid with config(8) changing in r360443.
It will not work for all cases.

env PATH is used because universe-toolchain is only built when worlds
are built, and then only if clang is needed, so it may not exist.

universe-toolchain needs to be expanded to always be built, inspected to
remove non-cross-build-safe tools, used for buildworld/buildkernel,
and potentially incremental build support.

Sponsored by: Dell EMC

4 years agosh: Assert INTOFF rather than applying it in ck*
Jilles Tjoelker [Tue, 28 Apr 2020 20:34:27 +0000 (20:34 +0000)]
sh: Assert INTOFF rather than applying it in ck*

As I noted in https://reviews.freebsd.org/D22756, INTOFF should be in effect
when calling ckmalloc/ckrealloc/ckfree to avoid memory leaks and double
frees. Therefore, change the functions to check if INTOFF is in effect
instead of applying it.

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

4 years agoMove route-specific ddb commands to route/route_ddb.c
Alexander V. Chernikov [Tue, 28 Apr 2020 20:00:17 +0000 (20:00 +0000)]
Move route-specific ddb commands to route/route_ddb.c

Currently functionality resides in rtsock.c, which is a controlling
 interface, partially external to the routing subsystem.
Additionally, DDB-supporting functionality is > 100SLOC, which deserves
 a separate file.

Given that, move this functionality to a newly-created net/route/ subdir.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D24561

4 years agoMove route_temporal.c and route_var.h to net/route.
Alexander V. Chernikov [Tue, 28 Apr 2020 19:14:09 +0000 (19:14 +0000)]
Move route_temporal.c and route_var.h to net/route.

Nexthop objects implementation, defined in r359823,
 introduced sys/net/route directory intended to hold all
 routing-related code. Move recently-introduced route_temporal.c and
 private route_var.h header there.

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

4 years agoRevert r360445
Bryan Drewery [Tue, 28 Apr 2020 18:53:49 +0000 (18:53 +0000)]
Revert r360445

I did not intend to commit this yet as more work is needed for
non-amd64 kernels.

4 years agoMove struct rtentry definition to nhop_var.h.
Alexander V. Chernikov [Tue, 28 Apr 2020 18:42:30 +0000 (18:42 +0000)]
Move struct rtentry definition to nhop_var.h.

One of the goals of the new routing KPI defined in r359823
 is to entirely hide`struct rtentry` from the consumers.
It will allow to improve routing subsystem internals and deliver
 features much faster.

This is one of the last changes, effectively moving struct rtentry
 definition to a net/route_var.h header, internal to the routing subsystem.

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

4 years agoctfmerge: Assert that there is enough room for types.
Bryan Drewery [Tue, 28 Apr 2020 16:09:28 +0000 (16:09 +0000)]
ctfmerge: Assert that there is enough room for types.

Sponsord by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D24537

4 years agoDon't try ctfconvert on file without debug info.
Bryan Drewery [Tue, 28 Apr 2020 16:09:25 +0000 (16:09 +0000)]
Don't try ctfconvert on file without debug info.

This was currently an ignored error but will change to a hard error
eventually.

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

4 years agoconfig: Add no-ctfconvert support.
Bryan Drewery [Tue, 28 Apr 2020 16:09:22 +0000 (16:09 +0000)]
config: Add no-ctfconvert support.

Bump CONFIGVERS to 600018 for this support.

Some files may purposely have debug info disabled or are *source files*
that attempt to run ctfconvert on them. Currently ctfconvert ignores
these errors but I have a change to make the errors real so we can
catch real problems like exceeding type limits.

Sponsored by: Dell EMC
Reviewed by: imp, cem, kevans
Differential Revision: https://reviews.freebsd.org/D24535

4 years agoNone of these use opt_sched.h
Bryan Drewery [Tue, 28 Apr 2020 16:09:18 +0000 (16:09 +0000)]
None of these use opt_sched.h

4 years agoRestore local kernel "prog" filtering lost in r332099.
Bryan Drewery [Tue, 28 Apr 2020 16:07:15 +0000 (16:07 +0000)]
Restore local kernel "prog" filtering lost in r332099.

This behavior is most relevant for ipfw(4) as documented in syslog.conf(5).
The recent addition of property-based regex filters in r359327 is a
fine workaround for this but the behavior was present since 1997 and
documented.

This only fixes local matching of the "kernel program". It does not
change the forwarded format at all. On the remote side it will still
be "kernel: ipfw:" and not be parsed as a kernel message. This matches
old behavior.

MFC after: 2 weeks
Reviewed by: markj
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D24286

4 years agoAdd le_read_buffer_size command and manpage.
Takanori Watanabe [Tue, 28 Apr 2020 16:00:34 +0000 (16:00 +0000)]
Add le_read_buffer_size command and manpage.
It supports both v1 and v2 command.

PR:245964
Submitted by: Marc Veldman <marc@bumblingdork.com>

4 years agoMake sendfile(SF_SYNC)'s CV wait interruptible.
Mark Johnston [Tue, 28 Apr 2020 15:02:44 +0000 (15:02 +0000)]
Make sendfile(SF_SYNC)'s CV wait interruptible.

Otherwise, since the CV is not signalled until data is drained from the
socket, it is trivial to create an unkillable process using
sendfile(SF_SYNC) and a process-private PF_LOCAL socket pair.  In
particular, the cv_wait() in sendfile() does not get interrupted until
data is drained from the receiving socket buffer.

Reported by: pho
Discussed with: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agodiff(1): don't reject specifying the same format multiple times
Kyle Evans [Tue, 28 Apr 2020 14:33:33 +0000 (14:33 +0000)]
diff(1): don't reject specifying the same format multiple times

This may happen, for instance, if one happens to have an alias of diff to
diff -up and attempts to specify the amount of context on top of that.

Aliases like this may cause other problems, but if they're really not ever
generating non-unified diffs then we should at least not break that
use-case.

In addition, we'll now pick up a format mismatch if -p is specified with
!contextual && !unified && !unset.

Fix up a small trailing whitespace nit in the tests while we're here, and
add tests to make sure that we can double up all the formatting options.

Reported by: jbeich
MFC after: 3 days

4 years agoRe-check for wirings after busying the page in vm_page_release_locked().
Mark Johnston [Tue, 28 Apr 2020 13:51:41 +0000 (13:51 +0000)]
Re-check for wirings after busying the page in vm_page_release_locked().

A concurrent unlocked lookup can wire the page after
vm_page_release_locked() releases the last wiring, in which case
vm_page_release_locked() must not free the page.  Once the xbusy lock is
acquired, that, the object lock and the fact that the page is unmapped
ensure that the wire count cannot increase, so re-check for new wirings
after the page is xbusied.

Update the comment above vm_page_wired() to reflect the new
synchronization rules.

Reported by: glebius
Reviewed by: alc, jeff, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24592

4 years agoImprove error handling
Takanori Watanabe [Tue, 28 Apr 2020 13:28:58 +0000 (13:28 +0000)]
Improve error handling
Check return values from hci_request()
Check rp.status
Print error messages with hci_status2str()

PR: 245769
Submitted by: Marc Veldman

4 years agoConvert rtalloc_mpath_fib() users to the new KPI.
Alexander V. Chernikov [Tue, 28 Apr 2020 08:06:56 +0000 (08:06 +0000)]
Convert rtalloc_mpath_fib() users to the new KPI.

New fib[46]_lookup() functions support multipath transparently.
Given that, switch the last rtalloc_mpath_fib() calls to
 dib4_lookup() and eliminate the function itself.

Note: proper flowid generation (especially for the outbound traffic) is a
 bigger topic and will be handled in a separate review.
This change leaves flowid generation intact.

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

4 years agoEliminate now-unused parts of old routing KPI.
Alexander V. Chernikov [Tue, 28 Apr 2020 07:25:34 +0000 (07:25 +0000)]
Eliminate now-unused parts of old routing KPI.

r360292 switched most of the remaining routing customers to a new KPI,
 leaving a bunch of wrappers for old routing lookup functions unused.

Remove them from the tree as a part of routing cleanup.

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

4 years agoRemove rtable dumping code from bootp.
Alexander V. Chernikov [Tue, 28 Apr 2020 07:23:41 +0000 (07:23 +0000)]
Remove rtable dumping code from bootp.

This debugging code printing routing table data was introduced in rS25723,
 22+ years ago. The last functional commit to this code was rS67534, 19 years ago.
The code has been turned off by default all this time.
Lastly, this code directly iterates radix tree and rtentries, which is not
 not a proper interaction with routing system.

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

4 years agoDo not overflow when calculating file system size.
Xin LI [Tue, 28 Apr 2020 05:10:34 +0000 (05:10 +0000)]
Do not overflow when calculating file system size.

Reported by: Hyeongseok Kim <hyeongseok kim lge com>
Reviewed by: cem, Hyeongseok Kim
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D24603

4 years agoconfig.lua(8): catch up to recently added hooks
Kyle Evans [Tue, 28 Apr 2020 03:43:55 +0000 (03:43 +0000)]
config.lua(8): catch up to recently added hooks

While we're here, let's stylize these as functions instead of just raw text.
A future change may allow arbitrary data arguments to be passed some of
these, and the distinction is useful.

4 years agoconfig.lua(8): "may should" is not proper grammar
Kyle Evans [Tue, 28 Apr 2020 02:13:17 +0000 (02:13 +0000)]
config.lua(8): "may should" is not proper grammar

Reported by: rpokala
X-MFC-With: r360421

4 years agoGet rid of uio_XXX macros used for the Mac OS/X port.
Rick Macklem [Tue, 28 Apr 2020 02:11:02 +0000 (02:11 +0000)]
Get rid of uio_XXX macros used for the Mac OS/X port.

The NFS code had a bunch of Mac OS/X accessor functions named uio_XXX
left over from the port to Mac OS/X. Since that port is long forgotten,
replace the calls with the code generated by the FreeBSD macros for these
in nfskpiport.h. This allows the macros to be deleted from nfskpiport.h
and I think makes the code more readable.

This patch should not result in any semantic change.

4 years agolualoader: cli: clobber loader_conf_files before proceeding
Kyle Evans [Tue, 28 Apr 2020 02:08:55 +0000 (02:08 +0000)]
lualoader: cli: clobber loader_conf_files before proceeding

This makes sure that config.readConfFiles doesn't see a stale
loader_conf_files from before, in case the newly loaded file doesn't set it.

MFC after: 3 days

4 years agolualoader: cli: add read-conf
Kyle Evans [Tue, 28 Apr 2020 02:04:51 +0000 (02:04 +0000)]
lualoader: cli: add read-conf

This is a straightforward match to the command used by many in forthloader;
it uses the newly-exported config.readConfFiles() to make sure that any
loader_conf_files gets done as appropriate.

PR: 244640
Submitted by: Olivier Certner <olivier freebsd free fr>
MFC after: 3 days

4 years agolualoader: config: start exporting readConfFiles
Kyle Evans [Tue, 28 Apr 2020 02:03:03 +0000 (02:03 +0000)]
lualoader: config: start exporting readConfFiles

In the process, change it slightly: readConfFiles will take a string like
loader_conf_files in addition to the loaded_files table that it normally
takes. This is to facilitate the addition of a read-conf CLI command, which
will just pass in the single file to read and an empty table.

MFC after: 3 days

4 years agolualoader config: don't call loader.getenv() as much
Kyle Evans [Tue, 28 Apr 2020 01:39:34 +0000 (01:39 +0000)]
lualoader config: don't call loader.getenv() as much

We don't actually need to fetch loader_conf_files as much as we do; we've
already fetched it once at the beginning, we only really need to fetch it
again after each file we've processed. If it changes, then we can stash that
off into our local prefiles.

While here, drop a note about the recursion so that I stop trying to
change it. It may very well make redundant some of the work we're doing, but
that's OK.

MFC after: 3 days

4 years agoBump __FreeBSD_version for KTLS RX support.
John Baldwin [Tue, 28 Apr 2020 00:06:49 +0000 (00:06 +0000)]
Bump __FreeBSD_version for KTLS RX support.

4 years agoAdd support for KTLS RX over TOE to T6.
John Baldwin [Mon, 27 Apr 2020 23:59:42 +0000 (23:59 +0000)]
Add support for KTLS RX over TOE to T6.

This largely reuses the TLS TOE support added in r330884.  However,
this uses the KTLS framework in upstream OpenSSL rather than requiring
Chelsio-specific patches to OpenSSL.  As with the existing TLS TOE
support, use of RX offload requires setting the tls_rx_ports sysctl.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24453

4 years agoFix sosend_generic() so that it can handle a list of ext_pgs mbufs.
Rick Macklem [Mon, 27 Apr 2020 23:55:09 +0000 (23:55 +0000)]
Fix sosend_generic() so that it can handle a list of ext_pgs mbufs.

Without this patch, sosend_generic() will try to use top->m_pkthdr.len,
assuming that the first mbuf has a pkthdr.
When a list of ext_pgs mbufs is passed in, the first mbuf is not a
pkthdr and cannot be post-r359919.  As such, the value of top->m_pkthdr.len
is bogus (0 for my testing).
This patch fixes sosend_generic() to handle this case, calculating the
total length via m_length() for this case.

There is currently nothing that hands a list of ext_pgs mbufs to
sosend_generic(), but the nfs-over-tls kernel RPC code in
projects/nfs-over-tls will do that and was used to test this patch.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24568

4 years agoExport the nda device's flags as a sysctl.
Warner Losh [Mon, 27 Apr 2020 23:43:17 +0000 (23:43 +0000)]
Export the nda device's flags as a sysctl.

4 years agoConvert rotating to a flag bit.
Warner Losh [Mon, 27 Apr 2020 23:43:12 +0000 (23:43 +0000)]
Convert rotating to a flag bit.

Move rotating to a flag bit. Add bit definitions for it. Create a
compat sysctl for it.

4 years agoConvert unmappedio over to a flag.
Warner Losh [Mon, 27 Apr 2020 23:43:08 +0000 (23:43 +0000)]
Convert unmappedio over to a flag.

Make unmappedio a flag. Move it to the flags definition. Add compat
sysctl for it.

4 years agoAdd flags sysctl to ada
Warner Losh [Mon, 27 Apr 2020 23:43:04 +0000 (23:43 +0000)]
Add flags sysctl to ada

Report the ada device flags like we do the da devices. No booleans
have (yet) been converted, but iomapped and rotating are planned.

4 years agoChange the flags back to an enum
Warner Losh [Mon, 27 Apr 2020 23:39:32 +0000 (23:39 +0000)]
Change the flags back to an enum

This was changed in the review process for the flags sysctl. The
reasons for the change are no longer valid as the code changed after
that. Cast the one place where it might make a difference (but I don't
think it does).  This restores the ability to see flags for softc in
gdb.

4 years agoInitial support for kernel offload of TLS receive.
John Baldwin [Mon, 27 Apr 2020 23:17:19 +0000 (23:17 +0000)]
Initial support for kernel offload of TLS receive.

- Add a new TCP_RXTLS_ENABLE socket option to set the encryption and
  authentication algorithms and keys as well as the initial sequence
  number.

- When reading from a socket using KTLS receive, applications must use
  recvmsg().  Each successful call to recvmsg() will return a single
  TLS record.  A new TCP control message, TLS_GET_RECORD, will contain
  the TLS record header of the decrypted record.  The regular message
  buffer passed to recvmsg() will receive the decrypted payload.  This
  is similar to the interface used by Linux's KTLS RX except that
  Linux does not return the full TLS header in the control message.

- Add plumbing to the TOE KTLS interface to request either transmit
  or receive KTLS sessions.

- When a socket is using receive KTLS, redirect reads from
  soreceive_stream() into soreceive_generic().

- Note that this interface is currently only defined for TLS 1.1 and
  1.2, though I believe we will be able to reuse the same interface
  and structures for 1.3.

4 years agoAdd the initial sequence number to the TLS enable socket option.
John Baldwin [Mon, 27 Apr 2020 22:31:42 +0000 (22:31 +0000)]
Add the initial sequence number to the TLS enable socket option.

This will be needed for KTLS RX.

Reviewed by: gallatin
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24451

4 years agoUpdate the cached MSI state when any MSI capability register is written.
John Baldwin [Mon, 27 Apr 2020 22:27:35 +0000 (22:27 +0000)]
Update the cached MSI state when any MSI capability register is written.

bhyve uses cached copies of the MSI capability registers to generate
MSI interrupts for device models.  Previously, these cached fields
were only set when the MSI capability control register was updated.
The Linux kernel recently adopted a change to deal with races in MSI
interrupt delivery that writes to the MSI capability address and data
registers to alter the destination of MSI interrupts without writing
to the MSI capability control register.  bhyve was not updating its
cached registers for these writes and continued to send interrupts
with the old data value to the old address.  Fix this by recomputing
the cached values for every write to any MSI capability register.

Reported by: Jason Tubnor, Ryan Moeller
Reported by: Marc Dionne (bisected the Linux kernel commit)
Reviewed by: grehan
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24593

4 years agoiflib: Stop interface before (un)registering VLAN
Eric Joyner [Mon, 27 Apr 2020 22:02:44 +0000 (22:02 +0000)]
iflib: Stop interface before (un)registering VLAN

This patch is intended to solve a specific problem that iavf(4)
encounters, but what it does can be extended to solve other issues.

To summarize the iavf(4) issue, if the PF driver configures VLAN
anti-spoof, then the VF driver needs to make sure no untagged traffic is
sent if a VLAN is configured, and vice-versa. This can be an issue when
a VLAN is being registered or unregistered, e.g. when a packet may be on
the ring with a VLAN in it, but the VLANs are being unregistered. This
can cause that tagged packet to go out and cause an MDD event.

To fix this, include a new interface-dependent function that drivers can
implement named IFDI_NEEDS_RESTART(). Right now, this function is called
in iflib_vlan_unregister/register() to determine whether the interface
needs to be stopped and started when a VLAN is registered or
unregistered. The default return value of IFDI_NEEDS_RESTART() is true,
so this fixes the MDD problem that iavf(4) encounters, since the
interface rings are flushed during a stop/init.

A future change to iavf(4) will implement that function just in case the
default value changes, and to make it explicit that this interface reset
is required when a VLAN is added or removed.

Reviewed by: gallatin@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D22086

4 years agoRetire the GENERICSF kernel config.
John Baldwin [Mon, 27 Apr 2020 21:51:22 +0000 (21:51 +0000)]
Retire the GENERICSF kernel config.

Now that hw.machine_arch handles soft-float vs hard-float there is no
longer a reason for this config.

Submitted by: mhorne (kern.mk hunk)
Reviewed by: imp (earlier version), kp
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24544

4 years agoSet use_nvd=0 in EC2 AMIs.
Colin Percival [Mon, 27 Apr 2020 21:44:02 +0000 (21:44 +0000)]
Set use_nvd=0 in EC2 AMIs.

FreeBSD is in the process of switching from nvd(4) to nda(4) as the disk
device front-end to NVMe. Changing the default in the kernel is tricky
since existing systems may have /dev/nvd* hard-coded e.g. in /etc/fstab;
however, there's no reason to not change the default in HEAD for *new*
systems.

At present I have no intention of MFCing this to stable branches, since
someone might reasonably expect scripts they use for launching and
configuring FreeBSD 12.1 instances to work with FreeBSD 12.2 AMIs, for
example.

Reviewed by: gjb, imp
Relnotes: NVMe disks in EC2 instances launched from 13.0 and later
now show up as nda(4) devices.
Differential Revision: https://reviews.freebsd.org/D24583

4 years agoDon't run strcmp() against strings stored in user memory.
John Baldwin [Mon, 27 Apr 2020 18:04:42 +0000 (18:04 +0000)]
Don't run strcmp() against strings stored in user memory.

Instead, copy the strings into a temporary buffer on the stack and
run strcmp on the copies.

Reviewed by: brooks, kib
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24567

4 years agoImprove MACHINE_ARCH handling for hard vs soft-float on RISC-V.
John Baldwin [Mon, 27 Apr 2020 17:55:40 +0000 (17:55 +0000)]
Improve MACHINE_ARCH handling for hard vs soft-float on RISC-V.

For userland, MACHINE_ARCH reflects the current ABI via preprocessor
directives.  For the kernel, the hw.machine_arch sysctl uses the ELF
header flags of the current process to select the correct MACHINE_ARCH
value.

Reviewed by: imp, kp
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24543

4 years agoExtend support in sysctls for supporting multiple native ABIs.
John Baldwin [Mon, 27 Apr 2020 17:53:38 +0000 (17:53 +0000)]
Extend support in sysctls for supporting multiple native ABIs.

This extends some of the changes in place to support reporting support
for 32-bit ABIs to permit reporting hard-float vs soft-float ABIs.

Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24542

4 years agoThis change does a small prepratory step in getting the
Randall Stewart [Mon, 27 Apr 2020 16:30:29 +0000 (16:30 +0000)]
This change does a small prepratory step in getting the
latest rack and bbr in from the NF repo. When those come
in the OOB data handling will be fixed where Skyzaller crashes.

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