]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoAdd DSCP support for network QoS to iscsi initiator.
rscheff [Fri, 9 Oct 2020 14:33:09 +0000 (14:33 +0000)]
Add DSCP support for network QoS to iscsi initiator.

Allow the DSCP codepoint also to be configurable
for the traffic in the direction from the initiator
to the target, such that writes and any requests
are also treated in the appropriate QoS class.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26714

3 years agoFix a few mandoc issues
gbe [Fri, 9 Oct 2020 14:03:45 +0000 (14:03 +0000)]
Fix a few mandoc issues

- no blank before trailing delimiter
- whitespace at end of input line
- sections out of conventional order
- normalizing date format
- AUTHORS section without An macro

3 years agoAdd iommu_get_dev_ctx() helper that allows to instantiate an iommu context
br [Fri, 9 Oct 2020 13:11:14 +0000 (13:11 +0000)]
Add iommu_get_dev_ctx() helper that allows to instantiate an iommu context
for a given device_t.

Submitted by: andrew
Reviewed by: kib
Sponsored by: DARPA, AFRL

3 years agoStop sending tiny new data segments during SACK recovery
rscheff [Fri, 9 Oct 2020 12:44:56 +0000 (12:44 +0000)]
Stop sending tiny new data segments during SACK recovery

Consider the currently in-use TCP options when
calculating the amount of new data to be injected during
SACK loss recovery. That addresses the effect that very small
(new) segments could be injected on partial ACKs while
still performing a SACK loss recovery.

Reported by: Liang Tian
Reviewed by: tuexen, chengc_netapp.com
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26446

3 years agoAdd IP(V6)_VLAN_PCP to set 802.1 priority per-flow.
rscheff [Fri, 9 Oct 2020 12:06:43 +0000 (12:06 +0000)]
Add IP(V6)_VLAN_PCP to set 802.1 priority per-flow.

This adds a new IP_PROTO / IPV6_PROTO setsockopt (getsockopt)
option IP(V6)_VLAN_PCP, which can be set to -1 (interface
default), or explicitly to any priority between 0 and 7.

Note that for untagged traffic, explicitly adding a
priority will insert a special 801.1Q vlan header with
vlan ID = 0 to carry the priority setting

Reviewed by: gallatin, rrs
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26409

3 years agoFix EINVAL message when CPU binding information is requested for IRQ.
ae [Fri, 9 Oct 2020 11:24:19 +0000 (11:24 +0000)]
Fix EINVAL message when CPU binding information is requested for IRQ.

`cpuset -g -x N` along with requested information always prints
message `cpuset: getdomain: Invalid argument'. The EINVAL is returned
from kern_cpuset_getdomain(), since it doesn't expect CPU_LEVEL_WHICH
and CPU_WHICH_IRQ parameters.

To fix the error, do not call cpuset_getdomain() when `-x' is specified.

MFC after: 1 week

3 years agoExtend netstat to display TCP stack and detailed congestion state (2)
rscheff [Fri, 9 Oct 2020 10:55:19 +0000 (10:55 +0000)]
Extend netstat to display TCP stack and detailed congestion state (2)

Extend netstat to display TCP stack and detailed congestion state

Adding the "-c" option used to show detailed per-connection
congestion control state for TCP sessions.

This is one summary patch, which adds the relevant variables into
xtcpcb. As previous "spare" space is used, these changes are ABI
compatible.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26518

3 years agoExtend netstat to display TCP stack and detailed congestion state
rscheff [Fri, 9 Oct 2020 10:07:41 +0000 (10:07 +0000)]
Extend netstat to display TCP stack and detailed congestion state

Adding the "-c" option used to show detailed per-connection
congestion control state for TCP sessions.

This is one summary patch, which adds the relevant variables into
xtcpcb. As previous "spare" space is used, these changes are ABI
compatible.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26518

3 years agoMFV: r366539
jkim [Fri, 9 Oct 2020 05:27:02 +0000 (05:27 +0000)]
MFV: r366539

Merge ACPICA 20200925.

3 years agoCorrect the primary to find(1)
lwhsu [Fri, 9 Oct 2020 04:03:57 +0000 (04:03 +0000)]
Correct the primary to find(1)

Sponsored by: The FreeBSD Foundation

3 years agoRemove now-unused files
imp [Fri, 9 Oct 2020 01:48:21 +0000 (01:48 +0000)]
Remove now-unused files

makeLINT.mk isn't needed or used anymore, remove it and all the files
it uses.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540

3 years agoCreate in-tree LINT files
imp [Fri, 9 Oct 2020 01:48:14 +0000 (01:48 +0000)]
Create in-tree LINT files

Now that config(8) has supported include for 19 years, transition to
including the NOTES files. include support didn't exist at the time,
nor did the envvar stuff recently added. Now that it does, eliminate
the building of LINT files by just including everything you need.

Note: This may cause conflicts with updating in some cases.
find sys -name LINT\* -rm
is suggested across this commit to remove the generated LINT
files.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540

3 years agoMake vn_generic_copy_file_range() interruptible via a signal.
rmacklem [Fri, 9 Oct 2020 01:04:28 +0000 (01:04 +0000)]
Make vn_generic_copy_file_range() interruptible via a signal.

Without this patch, when vn_generic_copy_file_range() is
doing a large copy, it will remain in the function for a
considerable amount of time, delaying handling of any
outstanding signals until the copy completes.

This patch adds checks for signals that need to be
processed after each successful data copy cycle.
When sig_intr() returns non-zero, vn_generic_copy_file_range()
will return.
The check "if (len < savlen)" ensures that some data
has been copied, so that progress will be made.

Note that, since copy_file_range(2) is allowed to
return fewer bytes copied than requested, it
will never return EINTR/ERESTART when sig_intr()
returns non-zero.

Reviewed by: kib, asomers
Differential Revision: https://reviews.freebsd.org/D26620

3 years agoStop ignoring makeLINT generated files
imp [Fri, 9 Oct 2020 00:27:45 +0000 (00:27 +0000)]
Stop ignoring makeLINT generated files

We're going to check these files in shortly since we don't need to
generate them anymore. Generated files cause issues for different work
flows anyway.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540

3 years agoEliminate building LINT makefiles
imp [Fri, 9 Oct 2020 00:27:40 +0000 (00:27 +0000)]
Eliminate building LINT makefiles

LINT config files are about to be checked in directly. Eliminate
building them by hand here from NOTES files.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540

3 years agoInitial support for implementing the bootXXX.efi workaround
imp [Fri, 9 Oct 2020 00:16:26 +0000 (00:16 +0000)]
Initial support for implementing the bootXXX.efi workaround

Too many version of UEFI firmware (so far only confirmed on amd64)
don't really support efibootmgr selection of boot. That's the most
reliable, when it works, since there's no guesswork. However, many do
not save, unmolested, the variables that efibootmgr sets, so as a
fallback we also install loader.efi as bootXXX.efi (where XXX is
either aa64 or x64) if it doesn't already exist in /efi/boot on the
ESP. The standard only defines this for removable devices, but it's
almost ubiquitously used as a fallback. Many BIOSes implement a drive
selection feature that takes over the efibootmgr protocol, rendinering
it useless (either generally, or for those vendors not on the short
list). bootxxx.efi works around this. However, we don't install it
unconditionally there, as that breaks some popular multi-boot setups.

MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D26428

3 years agovm_page_dump_index_to_pa(): Add braces to the expression involving + and &.
kib [Thu, 8 Oct 2020 22:46:15 +0000 (22:46 +0000)]
vm_page_dump_index_to_pa(): Add braces to the expression involving + and &.

The precedence of the '&' operator is less than of '+'.  Added braces
do change the order of evaluation into the natural one, in my opinion.
On the other hand, the value of the expression should not change since
all elements should have page-aligned values.

This fixes a gcc warning reported.

Reported by: adrian
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoDo not leak B_BARRIER.
kib [Thu, 8 Oct 2020 22:41:02 +0000 (22:41 +0000)]
Do not leak B_BARRIER.

Normally when a buffer with B_BARRIER is written, the flag is cleared
by g_vfs_strategy() when creating bio.  But in some cases FFS buffer
might not reach g_vfs_strategy(), for instance when copy-on-write
reports an error like ENOSPC.  In this case buffer is returned to
dirty queue and might be written later by other means.  Among then
bdwrite() reasonably asserts that B_BARRIER is not set.

In fact, the only current use of B_BARRIER is for lazy inode block
initialization, where write of the new inode block is fenced against
cylinder group write to mark inode as used.  The situation could be
seen that we break dependency by updating cg without written out
inode.  Practically since CoW was not able to find space for a copy of
inode block, for the same reason cg group block write should fail.

Reported by: pho
Discussed with: chs, imp, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26511

3 years agosig_intr(9): return early if AST is not scheduled.
kib [Thu, 8 Oct 2020 22:34:34 +0000 (22:34 +0000)]
sig_intr(9): return early if AST is not scheduled.

Check td_flags for relevant AST requests lock-less.  This opens the
race slightly wider where sig_intr() returns false negative, but might
be it is worth it.

Requested by: mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoDo not allow to use O_BENEATH as an oracle.
kib [Thu, 8 Oct 2020 22:31:11 +0000 (22:31 +0000)]
Do not allow to use O_BENEATH as an oracle.

Specifically, if lookup() returned any error and the topping directory
was not latched, which means that (non-existent) path did not returned
to the topping location, give ENOTCAPABLE a priority over the lookup()
error.

PR: 249960
Reviewed by: emaste, ngie
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26695

3 years ago[PowerPC] add machdep.uprintf_signal sysctl
alfredo [Thu, 8 Oct 2020 22:00:31 +0000 (22:00 +0000)]
[PowerPC] add machdep.uprintf_signal sysctl

Add support for sysctl 'machdep.uprintf_signal' that prints debugging
information on trap signal.

Reviewed by: jhibbits, luporl, bdragon
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D26004

3 years agotimer_restore is now unused, remove it
imp [Thu, 8 Oct 2020 20:56:11 +0000 (20:56 +0000)]
timer_restore is now unused, remove it

apm was the only consumer of timer_restore. Now that it's gone, this
can be removed.

3 years agoRemove APM BIOS support
imp [Thu, 8 Oct 2020 20:56:06 +0000 (20:56 +0000)]
Remove APM BIOS support

APM BIOS was relevant only to early laptops (approximately P166 or
P200 and slower). These have not been relevant for a long time, and
this code has been untested for a long time (as far as I can
tell). The APM compat code in ACPI and the apm(8) command is not being
retired. Both of these items are still in use (apm(8) is more
scriptable than the replacement acpiconf, for the most part). This has
been commented out of i386 GENERIC since 2002. This code is not
relevant to any other port.

Discussed on: arch@

3 years agoRemove apm screen saver.
imp [Thu, 8 Oct 2020 20:56:00 +0000 (20:56 +0000)]
Remove apm screen saver.

APM BIOS support is about to be removed. Remove the apm screen saver
and its module. They are about to be irrelevant.

3 years agoRemove apm module
imp [Thu, 8 Oct 2020 20:55:55 +0000 (20:55 +0000)]
Remove apm module

The apm code is about to be removed. Remove the module since it's
about to be useless.

3 years agoFix a loop condition
mhorne [Thu, 8 Oct 2020 18:29:17 +0000 (18:29 +0000)]
Fix a loop condition

The correct way to identify the end of the metadata is two adjacent
entries set to zero/MODINFO_END. I made a typo and this was checking the
first entry twice.

Reported by: rpokala
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.

3 years agoAdd a routine to dump boot metadata
mhorne [Thu, 8 Oct 2020 18:02:05 +0000 (18:02 +0000)]
Add a routine to dump boot metadata

The boot metadata (also referred to as modinfo, or preload metadata)
provides information about the size and location of the kernel,
pre-loaded modules, and other metadata (e.g. the EFI framebuffer) to be
consumed during by the kernel during early boot. It is encoded as a
series of type-length-value entries and is usually constructed by
loader(8) and passed to the kernel. It is also faked on some
architectures when booted by other means.

Although much of the module information is available via kldstat(8),
there is no easy way to debug the metadata in its entirety. Add some
routines to parse this data and allow it to be printed to the console
during early boot or output via a sysctl.

Since the output can be lengthly, printing to the console is gated
behind the debug.dump_modinfo_at_boot kenv variable as well as the
BOOTVERBOSE flag. The sysctl to print the metadata is named
debug.dump_modinfo.

Reviewed by: tsoome
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26687

3 years agoRace in 32-bit fixed
imp [Thu, 8 Oct 2020 17:30:05 +0000 (17:30 +0000)]
Race in 32-bit fixed

Use install insteald of install.sh for 32-bit builds to fight races there.

Reviewed by: markj

3 years ago[pf] /etc/rc.d/pf should REQUIRE routing
kaktus [Thu, 8 Oct 2020 11:45:10 +0000 (11:45 +0000)]
[pf] /etc/rc.d/pf should REQUIRE routing

When a system with pf_enable="YES" in /etc/rc.conf uses hostnames in
/etc/pf.conf, these hostnames cannot be resolved via external nameservers
because the default route is not yet set. This results in an empty
(all open) ruleset.

Since r195026 already put netif back to REQUIRE, this change does not affect
the issue that the firewall should rather have been setup before any
network traffic can occur.

PR: 211928
Submitted by: Robert Schulze
Reported by: Robert Schulze
Tested by: Mateusz Kwiatkowski
No objections from: kp
MFC after: 3 days

3 years agoTry a bit harder to get the USB device descriptor in case the initial read fails.
hselasky [Thu, 8 Oct 2020 11:30:22 +0000 (11:30 +0000)]
Try a bit harder to get the USB device descriptor in case the initial read fails.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoThe ethernet header structure is read-only. Add const keyword.
hselasky [Thu, 8 Oct 2020 11:25:19 +0000 (11:25 +0000)]
The ethernet header structure is read-only. Add const keyword.

(This is a diff reduction towards D26254)

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoRemove yet another useless assignment, adding a KASSERT just in case.
trasz [Thu, 8 Oct 2020 11:04:32 +0000 (11:04 +0000)]
Remove yet another useless assignment, adding a KASSERT just in case.

Reviewed by: kp
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26698

3 years agoAllow evdev's rcpt_mask and sysmouse_t_axis parameters to be specified in
hselasky [Thu, 8 Oct 2020 10:59:49 +0000 (10:59 +0000)]
Allow  evdev's rcpt_mask and sysmouse_t_axis parameters to be specified in
/boot/loader.conf .

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agocxgbe(4): knobs to drop various kinds of undesirable frames on ingress.
np [Thu, 8 Oct 2020 10:00:13 +0000 (10:00 +0000)]
cxgbe(4): knobs to drop various kinds of undesirable frames on ingress.

These kind of drops come for free in the sense that they do not use the
filter TCAM or any other resource that wouldn't normally be used during
rx.  Frames dropped by the hardware get counted in the MAC's rx stats
but are not delivered to the driver.

hw.cxgbe.attack_filter
Set to 1 to enable the "attack filter".  Default is 0.  The attack
filter will drop an incoming frame if any of these conditions is true:
src ip/ip6 == dst ip/ip6; tcp and src/dst ip is not unicast; src/dst ip
is loopback (127.x.y.z); src ip6 is not unicast; src/dst ip6 is loopback
(::1/128) or unspecified (::/128); tcp and src/dst ip6 is mcast
(ff00::/8).

hw.cxgbe.drop_ip_fragments
Set to 1 to drop all incoming IP fragments.  Default is 0.  Note that
this drops valid frames.

hw.cxgbe.drop_pkts_with_l2_errors
Set to 1 to drop incoming frames with Layer 2 length or checksum errors.
Default is 1.

hw.cxgbe.drop_pkts_with_l3_errors
Set to 1 to drop incoming frames with IP version, length, or checksum
errors.  Default is 0.

hw.cxgbe.drop_pkts_with_l4_errors
Set to 1 to drop incoming frames with Layer 4 length, checksum, or other
errors.  Default is 0.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

3 years agoImport tzdata 2020b
philip [Thu, 8 Oct 2020 00:35:36 +0000 (00:35 +0000)]
Import tzdata 2020b

Changes: https://github.com/eggert/tz/blob/2020b/NEWS

MFC after: 3 days

3 years agoHandle kmod local relocation failures gracefully
mhorne [Wed, 7 Oct 2020 23:14:49 +0000 (23:14 +0000)]
Handle kmod local relocation failures gracefully

It is possible for elf_reloc_local() to fail in the unlikely case of
an unsupported relocation type. If this occurs, do not continue to
process the file.

Reviewed by: kib, markj (earlier version)
MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26701

3 years agonet80211: whitespace
bz [Wed, 7 Oct 2020 22:52:24 +0000 (22:52 +0000)]
net80211: whitespace

Fix indentation for the multi-line copies of
ieee80211_add_channel_list_5ghz() for the 3 bands.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years ago80211: ifconfig replace MS() with _IEEE80211_MASKSHIFT()
bz [Wed, 7 Oct 2020 22:29:26 +0000 (22:29 +0000)]
80211: ifconfig replace MS() with _IEEE80211_MASKSHIFT()

As we did in the kernel in r366112 replace the MS() macro with the version(s)
added to the kernel: _IEEE80211_MASKSHIFT().  Also provide its counter part.
This will later allow use to use other macros defined in net80211 headers
here in ifconfig.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoLinuxKPI: add a bitfield.h implementation.
bz [Wed, 7 Oct 2020 22:07:26 +0000 (22:07 +0000)]
LinuxKPI: add a bitfield.h implementation.

This code was iteratively implemented during the work on various WiFi
drivers -- from individual functions to a macro-created implementations
for the various bit sized needed (and then extended to more for
comepleteness). Some of the bit combinations do not seem to make sense
so are left out.

The __bf_shf(x) was obtained from D26681 [1].

Requested by: manu [1]
Reviewed by: hselasky, manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26708

3 years ago80211: non-functional changes
bz [Wed, 7 Oct 2020 21:56:58 +0000 (21:56 +0000)]
80211: non-functional changes

Sort a few VHT160 and 80+80 lines, update some comments, and remove
a superfluous ','.

No functional changes intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agobhyveload(8): Implement loader_callbacks::diskwrite
cem [Wed, 7 Oct 2020 20:31:13 +0000 (20:31 +0000)]
bhyveload(8): Implement loader_callbacks::diskwrite

The method was optional prior to r365938, which made it mandatory but did add
any test that an implementation provides the method nor implement it for
bhyveload.  The code path might not be hit unless the user's loader was
configured to write to a file on disk, such as with nextboot(8).

Reviewed by: grehan, tsoome
Approved by: bhyve
X-MFC-With: r365938
Differential Revision: https://reviews.freebsd.org/D26710

3 years agoPrint symbol index for unsupported relocation types
mhorne [Wed, 7 Oct 2020 18:48:10 +0000 (18:48 +0000)]
Print symbol index for unsupported relocation types

It is unlikely, but possible, that an unrecognized or unsupported
relocation type is encountered while trying to load a kernel module. If
this occurs we should offer the symbol index as a hint to the user.

While here, fix some small style issues.

Reviewed by: markj, kib (amd64 part, in D26701)
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.

3 years agoProperly cleanup driver during remove_one() in mlx5core.
hselasky [Wed, 7 Oct 2020 17:46:49 +0000 (17:46 +0000)]
Properly cleanup driver during remove_one() in mlx5core.

Cleanup all host resources, SYSCTLs, MSIX vectors and memory used
by the host and only leave the device allocated memory behind, if any,
because it may still be in use, when the PCI remove function is called.
Else future probe calls may fail due to SYSCTLs already existing.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMinor cleanups.
tuexen [Wed, 7 Oct 2020 15:22:48 +0000 (15:22 +0000)]
Minor cleanups.

MFC after: 3 days

3 years agoul(1): Remove references to colcrt(1) and nroff(1)
fernape [Wed, 7 Oct 2020 14:43:16 +0000 (14:43 +0000)]
ul(1): Remove references to colcrt(1) and nroff(1)

colcrt(1) and nroff(1) where removed in r319664.
Remove references to these commands in ul(1) man page.

PR: 244127
Reported by: freebsd@tim.thechases.com
Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D2614

3 years agoDon't use critical section when calling intr_irq_handler() - that function
trasz [Wed, 7 Oct 2020 12:11:11 +0000 (12:11 +0000)]
Don't use critical section when calling intr_irq_handler() - that function
enters critical section by itself anyway.

Reviewed by: kp
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26694

3 years agoFix typo.
kib [Wed, 7 Oct 2020 10:58:56 +0000 (10:58 +0000)]
Fix typo.

Sponsored by: Mellanox Technologies/NVIDIA Networking
MFC after: 3 days

3 years agoTemporarily skip failing test cases in CI:
lwhsu [Wed, 7 Oct 2020 09:53:24 +0000 (09:53 +0000)]
Temporarily skip failing test cases in CI:

sys.capsicum.functional.Capability__NoBypassDAC
sys.capsicum.functional.Pdfork__OtherUserForked

PR: 250178, 250179
Sponsored by: The FreeBSD Foundation

3 years agoUse intmax_t to print uint64_t values.
imp [Wed, 7 Oct 2020 07:55:55 +0000 (07:55 +0000)]
Use intmax_t to print uint64_t values.

This fixes the 32-bit build where the types are different.

3 years agoRevert r358001 in favor of r366509
lwhsu [Wed, 7 Oct 2020 07:55:55 +0000 (07:55 +0000)]
Revert r358001 in favor of r366509

Sponsored by: The FreeBSD Foundation

3 years agoSkip test written in Googltest in the wrapper script
lwhsu [Wed, 7 Oct 2020 07:23:29 +0000 (07:23 +0000)]
Skip test written in Googltest in the wrapper script

This leaves the main test body untouched and only skip running in the CI env,
makes doing local test easier while developing.

PR: 244165
Sponsored by: The FreeBSD Foundation

3 years agoMove kernel env global variables, etc to sys/kenv.h
imp [Wed, 7 Oct 2020 06:16:37 +0000 (06:16 +0000)]
Move kernel env global variables, etc to sys/kenv.h

The kernel globals for kenv are confined to 2 files that need them and
a few that likely shouldn't (but as written the code does). Move them
from sys/systm.h to sys/kenv.h. This removed a XXX from systm.h and
cleans it up a little bit...

3 years agocam: Add quirk for Samsung MZ7* behind a SATA-to-SAS interposer
imp [Wed, 7 Oct 2020 05:44:35 +0000 (05:44 +0000)]
cam: Add quirk for Samsung MZ7* behind a SATA-to-SAS interposer

Sometimes, this drive will be present in the system such that the the
firmware identification string doesn't start with ATA, such as when
it's behind a SATA-to-SAS interposer. Add another quirk for that.

Submitted by: github user mr44er
Github PR: 423

3 years agonvmecontrol: Update wdc module for newer WDC NVMe products
imp [Wed, 7 Oct 2020 05:36:05 +0000 (05:36 +0000)]
nvmecontrol: Update wdc module for newer WDC NVMe products

Update the to log fetch operation for latest WDC NVMe products.

Tested on HGST SN100 (a few years old) and WDC SN720 (more recent).

Submitted by: Akhilesh Rn <Akhilesh.RN@wdc.com> (minor style tweak by me)
Github PR: 435

3 years agonvme: Note where the CCB was released for passthrough command
imp [Tue, 6 Oct 2020 23:35:26 +0000 (23:35 +0000)]
nvme: Note where the CCB was released for passthrough command

3 years agocam: Assert we have a reference when freeing sim
imp [Tue, 6 Oct 2020 23:33:56 +0000 (23:33 +0000)]
cam: Assert we have a reference when freeing sim

Before we decrement refcount to sleep on the sim, assert that the
refcount >= 1. If it were 0 here, we'd never wake up.

3 years agoRemove unused function cpu_boot()
mhorne [Tue, 6 Oct 2020 23:16:56 +0000 (23:16 +0000)]
Remove unused function cpu_boot()

The prototype was added with the creation of kern_shutdown.c in r17658,
but it appears to have never been implemented. Remove it now.

Reviewed by: cem, kib
Differential Revision: https://reviews.freebsd.org/D26702

3 years agoadd the FILESYSTEMS placeholder and note that it's the default early_late_divider
jmg [Tue, 6 Oct 2020 22:53:11 +0000 (22:53 +0000)]
add the FILESYSTEMS placeholder and note that it's the default early_late_divider

3 years agoext2fs: minor typo.
pfg [Tue, 6 Oct 2020 21:31:04 +0000 (21:31 +0000)]
ext2fs: minor typo.

Obtained from: Dragonfly
MFC after: 3 days

3 years agobridge: call member interface ioctl() without NET_EPOCH
kp [Tue, 6 Oct 2020 19:19:56 +0000 (19:19 +0000)]
bridge: call member interface ioctl() without NET_EPOCH

We're not allowed to hold NET_EPOCH while sleeping, so when we call ioctl()
handlers for member interfaces we cannot be in NET_EPOCH.  We still need some
protection of our CK_LISTs, so hold BRIDGE_LOCK instead.

That requires changing BRIDGE_LOCK into a sleepable lock, and separating the
BRIDGE_RT_LOCK, to protect bridge_rtnode lists. That lock is taken in the data
path (while in NET_EPOCH), so it cannot be a sleepable lock.

While here document the locking strategy.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D26418

3 years agoDon't permit DRM buffer mappings to be upgraded to executable.
jhb [Tue, 6 Oct 2020 18:13:15 +0000 (18:13 +0000)]
Don't permit DRM buffer mappings to be upgraded to executable.

Reviewed by: kib
MFC after: 1 month
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26697

3 years agoSimplify swcr_authcompute() after removal of deprecated algorithms.
jhb [Tue, 6 Oct 2020 18:07:52 +0000 (18:07 +0000)]
Simplify swcr_authcompute() after removal of deprecated algorithms.

- Just use sw->octx != NULL to handle the HMAC case when finalizing
  the MAC.

- Explicitly zero the on-stack auth context.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26688

3 years agoCheck if_capenable, not if_capabilities when enabling rate limiting.
jhb [Tue, 6 Oct 2020 18:02:33 +0000 (18:02 +0000)]
Check if_capenable, not if_capabilities when enabling rate limiting.

if_capabilities is a read-only mask of supported capabilities.
if_capenable is a mask under administrative control via ifconfig(8).

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26690

3 years agoStore the send tag type in the common send tag header.
jhb [Tue, 6 Oct 2020 17:58:56 +0000 (17:58 +0000)]
Store the send tag type in the common send tag header.

Both cxgbe(4) and mlx5(4) wrapped the existing send tag header with
their own identical headers that stored the type that the
type-specific tag structures inherited from, so in practice it seems
drivers need this in the tag anyway.  This permits removing these
extra header indirections (struct cxgbe_snd_tag and struct
mlx5e_snd_tag).

In addition, this permits driver-independent code to query the type of
a tag, e.g. to know what type of tag is being queried via
if_snd_query.

Reviewed by: gallatin, hselasky, np, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26689

3 years agoReset delayed SACK state when restarting an SCTP association.
tuexen [Tue, 6 Oct 2020 14:26:05 +0000 (14:26 +0000)]
Reset delayed SACK state when restarting an SCTP association.

MFC after: 3 days

3 years agoriscv: Remove outdated condition in page_fault_handler
jrtc27 [Tue, 6 Oct 2020 13:03:31 +0000 (13:03 +0000)]
riscv: Remove outdated condition in page_fault_handler

Since r366355 and r366284 we panic on access faults rather than treating
them like page faults so this condition is never true.

Reviewed by: jhb (mentor), markj, mhorne
Approved by: jhb (mentor), markj, mhorne
Differential Revision: https://reviews.freebsd.org/D26686

3 years agoriscv: Handle supervisor instruction page faults
jrtc27 [Tue, 6 Oct 2020 13:02:20 +0000 (13:02 +0000)]
riscv: Handle supervisor instruction page faults

We should never take instruction page faults when in the kernel, but by
using the standard page fault code we should get a more-informative
message about faulting on a NOFAULT page rather than branching to the
default case here and printing an "Unknown kernel exception ..."
message.

Reviewed by: jhb (mentor), markj
Approved by: jhb (mentor), markj
Differential Revision: https://reviews.freebsd.org/D26685

3 years agoTemporarily skip failing test cases in CI:
lwhsu [Tue, 6 Oct 2020 12:57:54 +0000 (12:57 +0000)]
Temporarily skip failing test cases in CI:

sys.capsicum.functional.ForkedOpenatTest_WithFlagInCapabilityMode___
sys.capsicum.functional.OpenatTest__WithFlag

PR: 249960
Sponsored by: The FreeBSD Foundation

3 years agoriscv: De-Arm a few names
jrtc27 [Tue, 6 Oct 2020 12:56:29 +0000 (12:56 +0000)]
riscv: De-Arm a few names

These names were inherited from the arm64 port and should be changed to
the RISC-V terminology.

Reviewed by: jhb (mentor), kp, markj
Approved by: jhb (mentor), kp, markj
Differential Revision: https://reviews.freebsd.org/D26671

3 years agoEnsure variables are initialized before used.
tuexen [Tue, 6 Oct 2020 11:29:08 +0000 (11:29 +0000)]
Ensure variables are initialized before used.

MFC after: 3 days

3 years agoRemove dead stores reported by clang static code analysis
tuexen [Tue, 6 Oct 2020 11:08:52 +0000 (11:08 +0000)]
Remove dead stores reported by clang static code analysis

MFC after: 3 days

3 years agointro(3): Update the list of included libraries
gbe [Tue, 6 Oct 2020 10:51:47 +0000 (10:51 +0000)]
intro(3): Update the list of included libraries

- Extend the list of main libraries of section 3
- Extend the library functions that are included in the libc

MFC after: 2 weeks
Submitted by: Naga Chaitanya Vellanki <pnagato at protonmail dot com>
Approved by: gbe
Differential Revision: https://reviews.freebsd.org/D26476

3 years agoCleanup, no functional change intended.
tuexen [Tue, 6 Oct 2020 10:41:04 +0000 (10:41 +0000)]
Cleanup, no functional change intended.

MFC after: 3 days

3 years agolinuxkpi: Add pagemap.h
manu [Tue, 6 Oct 2020 10:41:00 +0000 (10:41 +0000)]
linuxkpi: Add pagemap.h

Add release_pages needed by drm which simply calls put_page for
all the pages provided

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26680

3 years agolinuxkpi: Add power_supply.h
manu [Tue, 6 Oct 2020 10:39:40 +0000 (10:39 +0000)]
linuxkpi: Add power_supply.h

Add power_supply_is_system_supplied which is needed by drm.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26679

3 years agolinuxkpi: Add prefetch.h
manu [Tue, 6 Oct 2020 10:37:21 +0000 (10:37 +0000)]
linuxkpi: Add prefetch.h

Only add prefetchw as it is the only function used by drm.
Simply use the __builtin_prefetch which is available in all
compiler for a long time.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26677

3 years agolinuxkpi: Add numa.h
manu [Tue, 6 Oct 2020 10:36:16 +0000 (10:36 +0000)]
linuxkpi: Add numa.h

Only contain NUMA_NO_NODE needed by drm

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26676

3 years agolinuxkpi: Add gcd function
manu [Tue, 6 Oct 2020 10:35:03 +0000 (10:35 +0000)]
linuxkpi: Add gcd function

This compute the common greater divider
Taken from OpenBSD

Reviewed by: bz, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26674

3 years agoWhitespace changes.
tuexen [Tue, 6 Oct 2020 09:51:40 +0000 (09:51 +0000)]
Whitespace changes.

MFC after: 3 days

3 years agobacklight: check the lenght if the input before trimming '%'
bapt [Tue, 6 Oct 2020 08:18:09 +0000 (08:18 +0000)]
backlight: check the lenght if the input before trimming '%'

Reported by: hps
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D26693

3 years agobacklight: accept '%' in the brightness input value
bapt [Tue, 6 Oct 2020 08:05:19 +0000 (08:05 +0000)]
backlight: accept '%' in the brightness input value

Improve friendlyness of the command line by accepting the percent brightness
in both format: with or without a trailing '%'

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D26692

3 years agoMake capsicum test cases fine-grained
lwhsu [Tue, 6 Oct 2020 06:45:52 +0000 (06:45 +0000)]
Make capsicum test cases fine-grained

Add a wrapping script to use ATF to run tests written with Googletest
one by one. This helps locating and tracking the failing case in CI easier.

This is a temporarily solution while Googletest support in Kyua is developing.
We will revert this once Kyua+Googletest integration is ready.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25896

3 years agoClear the dmesg buffer to prevent rotating causes issues
lwhsu [Tue, 6 Oct 2020 04:18:42 +0000 (04:18 +0000)]
Clear the dmesg buffer to prevent rotating causes issues

This is a workaround for the current continuously failing test case

sys.kern.sonewconn_overflow.sonewconn_overflow_01

The side effect is the dmesg buffer got cleared and may effect other tests
depends on dmesg output running in parallel.  The better solution would be
tailing the log file like /var/log/debug.log

Sponsored by: The FreeBSD Foundation

3 years agolibkvm: catch up with pre-subtracated per-cpu addresses
mjg [Tue, 6 Oct 2020 02:57:37 +0000 (02:57 +0000)]
libkvm: catch up with pre-subtracated per-cpu addresses

Only concerns amd64.

Reported by: imp

3 years agocxgbe(4) sysctls do not need Giant.
np [Mon, 5 Oct 2020 22:18:04 +0000 (22:18 +0000)]
cxgbe(4) sysctls do not need Giant.

Sponsored by: Chelsio Communications

3 years agocrunchgen: fix MK_AUTO_OBJ logic after r364166
kevans [Mon, 5 Oct 2020 20:57:44 +0000 (20:57 +0000)]
crunchgen: fix MK_AUTO_OBJ logic after r364166

r364166 converted echo -n `/bin/pwd` to a raw pwd invocation, leaving a
trailing newline at the end of path.  This caused a later stat() of it to
erroneously fail and the fallback to MK_AUTO_OBJ=no logic proceeded as
unexpected.

Harry Schmalzbauer bissected the resulting build failure he experienced
(stable/12 host, -HEAD build) down to r365887. This change is mostly
unrelated, except it switches the build to bootstrapped crunchgen - clue!

I then bissected recent crunchgen changes going back a bit since we wouldn't
observe the failure immediately with -CURRENT in most configurations, which
landed me on r364166. After many intense head-scratching minutes and printf
debugging, I realized that the newline was the difference. This is where our
tale ends.

Reported by: Harry Schmalzbauer, O. Hartmann, Mike Tancsa, kevans
MFC after: 3 days

3 years agoEnable iterating all sysctls, even ones with CTLFLAG_SKIP
freqlabs [Mon, 5 Oct 2020 20:13:22 +0000 (20:13 +0000)]
Enable iterating all sysctls, even ones with CTLFLAG_SKIP

Add an "nextnoskip" sysctl that allows for listing of sysctls intended to be
normally skipped for cost reasons.

This makes it so the names/descriptions of those sysctls can be discovered with
sysctl -aN/sysctl -ad/sysctl -at.

It also makes it so children are visited when a node flagged with CTLFLAG_SKIP
is explicitly requested.

The intended use case is to mark the root "kstat" node with CTLFLAG_SKIP so that
the extensive and expensive stats are skipped by default but may still be easily
obtained without having to know them all (which may not even be possible) and
request each one-by-one.

Reviewed by: jhb
MFC after: 2 weeks
Relnotes: yes
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D26560

3 years agore(4): Add a 8168-compatible device ID
markj [Mon, 5 Oct 2020 19:58:55 +0000 (19:58 +0000)]
re(4): Add a 8168-compatible device ID

This is described in RealTek's driver as a "RTL8168 Series add-on card."

PR: 250037
Submitted by: Hiroshi HASEGAWA <hhase1973@gmail.com>
MFC after: 1 week

3 years agocache: fix pwd use-after-free in setting up fallback
mjg [Mon, 5 Oct 2020 19:38:51 +0000 (19:38 +0000)]
cache: fix pwd use-after-free in setting up fallback

Since the code exits smr section prior to calling pwd_hold, the used
pwd can be freed and a new one allocated with the same address, making
the comparison erroneously true.

Note it is very unlikely anyone ran into it.

3 years agodevfs.rules: unhide pf in vnet jails
kp [Mon, 5 Oct 2020 19:26:54 +0000 (19:26 +0000)]
devfs.rules: unhide pf in vnet jails

/dev/pf is usable in vnet jails, so don't hide the node there.

We shouldn't expose /dev/pf in regular jails, as that gives them control over
the host (or parent vnet jail) firewall.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D26537

3 years agoTweak arm64's cpu_fetch_syscall_args(). This should make it possible
trasz [Mon, 5 Oct 2020 18:46:14 +0000 (18:46 +0000)]
Tweak arm64's cpu_fetch_syscall_args().  This should make it possible
for the compiler to inline the memcpy().

Reviewed by: andrew
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26629

3 years agoDrop useless assignment, and add a KASSERT to make sure it really was useless.
trasz [Mon, 5 Oct 2020 18:41:35 +0000 (18:41 +0000)]
Drop useless assignment, and add a KASSERT to make sure it really was useless.

Reviewed by: nick, jhb
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26649

3 years agoufs: restore uniqueness of st_dev as returned by ufs_stat()
chs [Mon, 5 Oct 2020 18:17:50 +0000 (18:17 +0000)]
ufs: restore uniqueness of st_dev as returned by ufs_stat()

switch ufs_stat() to use the same value for st_dev as was used by
the previous ufs_getattr() stat path.

Submitted by: gallatin
Reviewed by: mjg, imp, kib, mckusick
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26596

3 years agoRemove sysctl_kern_consmute()
markj [Mon, 5 Oct 2020 15:54:19 +0000 (15:54 +0000)]
Remove sysctl_kern_consmute()

It is a trivial wrapper for sysctl_handle_int() since r184521.  Also
remove the NEEDGIANT flag, cn_mute is accessed locklessly.

MFC after: 1 week

3 years agoprocstat(1): Add EXAMPLES section
fernape [Mon, 5 Oct 2020 14:07:32 +0000 (14:07 +0000)]
procstat(1): Add EXAMPLES section

* Add some examples showing binary, arguments and file info from living
  processes.
* Show information from core dumps including an attempt using an old core file.
* While here, fix warning 'no blank before trailing delimiter' reported by igor.

Approved by: manpages (0mp@)
Differential Revision: https://reviews.freebsd.org/D25467

3 years agopkill(1): Add EXAMPLES section to man page
fernape [Mon, 5 Oct 2020 13:52:31 +0000 (13:52 +0000)]
pkill(1): Add EXAMPLES section to man page

Add a dozen of examples to the EXAMPLES section for pgrep(1) and pkill(1).

Flags covered: -f, -F, -n, -j, -l, -S, -x

Approved by: mandoc (bcr@)
Differential Revision: pkill(1): Add EXAMPLES section to man page

3 years agokenv(1): Add EXAMPLES to man page
fernape [Mon, 5 Oct 2020 13:49:45 +0000 (13:49 +0000)]
kenv(1): Add EXAMPLES to man page

Add EXAMPLES section covering all the options

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26664

3 years agohostname(1): Add EXAMPLES to man page
fernape [Mon, 5 Oct 2020 13:46:19 +0000 (13:46 +0000)]
hostname(1): Add EXAMPLES to man page

Add a very simple set of examples

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26663

3 years agodf(1): Add EXAMPLES section to man page
fernape [Mon, 5 Oct 2020 13:39:37 +0000 (13:39 +0000)]
df(1): Add EXAMPLES section to man page

* Add EXAMPLES section with four simple examples.
* Simplify -H flag description. This makes easy to see the difference between
  this flag and -h
* While here, fix .Tn deprecated macro.

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26662

3 years agopwait(1): Add EXAMPLES section to man page
fernape [Mon, 5 Oct 2020 13:35:34 +0000 (13:35 +0000)]
pwait(1): Add EXAMPLES section to man page

* Add small EXAMPLES section to the man page showing the different
  flags and exit codes.

* Complete description for -v flag.

Approved by: manpages (bcr@)