]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoContinued ipfilter #ifdef cleanup. The r343701 log entry contains a
Cy Schubert [Tue, 27 Oct 2020 04:35:36 +0000 (04:35 +0000)]
Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after: 3 days

3 years agoriscv: make use of SBI legacy replacement extensions
Mitchell Horne [Mon, 26 Oct 2020 19:13:22 +0000 (19:13 +0000)]
riscv: make use of SBI legacy replacement extensions

Version 0.2 of the SBI specification [1] marked the existing SBI
functions as "legacy" in order to move to a newer calling convention. It
also introduced a set of replacement extensions for some of the legacy
functionality. In particular, the TIME, IPI, and RFENCE extensions
implement and extend the semantics of their legacy counterparts, while
conforming to the newer version of the spec.

Update our SBI code to use the new replacement extensions when
available, and fall back to the legacy ones. These will eventually be
dropped, when support for version 0.2 is ubiquitous.

[1] https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc

Submitted by: Danjel Q. <danq1222@gmail.com>
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D26953

3 years agoriscv: remove sbi_clear_ipi()
Mitchell Horne [Mon, 26 Oct 2020 19:06:30 +0000 (19:06 +0000)]
riscv: remove sbi_clear_ipi()

S-mode software has write access to the SIP.SSIP bit, so instead of
making a second round-trip through the SBI we can clear it ourselves.
The SBI spec has deprecated this function for this exactly this reason.

Submitted by: Danjel Q. <danq1222@gmail.com
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D26952

3 years agolinux: silence renameat2 flags warning
Mateusz Guzik [Mon, 26 Oct 2020 18:03:50 +0000 (18:03 +0000)]
linux: silence renameat2 flags warning

Hogs the console while building the Linux kernel in a Ubuntu Focal jail.

3 years agolinux: add missing conversions for compat.linux.use_emul_path handling
Mateusz Guzik [Mon, 26 Oct 2020 18:02:52 +0000 (18:02 +0000)]
linux: add missing conversions for compat.linux.use_emul_path handling

3 years agocache: add missing NIRES_ABS handling
Mateusz Guzik [Mon, 26 Oct 2020 18:01:18 +0000 (18:01 +0000)]
cache: add missing NIRES_ABS handling

3 years agoKey decleration of union semun on src version
Brooks Davis [Mon, 26 Oct 2020 17:52:28 +0000 (17:52 +0000)]
Key decleration of union semun on src version

__FreeBSD__ is defined by the compiler derived from the triple. When
building FreeBSD 11 on a FreeBSD 12 with a CROSS_TOOLCHAIN=llvm10,
__FreeBSD__ was set to 12 when building lib32 (for some reason no triple
is being passed which seems to mean that we're taking default values
from the build system).  This in turn meant we end up with a double
decleration of union semun which is a build error.

Reviewed by: gshapiro, dim
Differential Revision: https://reviews.freebsd.org/D26902

3 years agoaudit: also correctly audit linux_execve()
Kyle Evans [Mon, 26 Oct 2020 17:30:17 +0000 (17:30 +0000)]
audit: also correctly audit linux_execve()

Linux execve() gets audited as AUE_EXECVE as well, we should also interpret
the return from this correctly for the same reasoning as in r367002.

MFC with: r367002

3 years agodb_search_symbol: prevent pollution from bogus symbols
Eric van Gyzen [Mon, 26 Oct 2020 16:42:53 +0000 (16:42 +0000)]
db_search_symbol: prevent pollution from bogus symbols

The kernel will never map the first page, so any symbols in that
range cannot refer to addresses.  Some third-party assembly files
define internal constants which appear in their symbol table.
Avoiding the lookup for those symbols avoids replacing small offsets
with those symbols during disassembly.

Reported by: Anton Rang <rang%acm.org>
Reviewed by: Anton Rang <rang%acm.org>, markj
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26895

3 years agozfs: remove unused support for zfs_znode_move
Mateusz Guzik [Mon, 26 Oct 2020 08:17:41 +0000 (08:17 +0000)]
zfs: remove unused support for zfs_znode_move

3 years agoCorrect calendar entry for myself
Scott Long [Mon, 26 Oct 2020 05:22:52 +0000 (05:22 +0000)]
Correct calendar entry for myself

3 years agoEnable bioq 'car limit' added at r335066 at 128 bios.
Alexander Motin [Mon, 26 Oct 2020 04:04:06 +0000 (04:04 +0000)]
Enable bioq 'car limit' added at r335066 at 128 bios.

Without the 'car limit' enabled (before this), running sequential ZFS scrub
on HDD without command queuing support, I've measured latency on concurrent
random reads reaching 4 seconds (surprised that not more).  Enabling this
reduced the latency to 65 milliseconds, while scrub still doing ~180MB/s.

For disks with command queuing this does not make much difference (if any),
since most time all the requests are queued down to the disk or HBA, leaving
nothing in the queue to sort.  And even if something does not fit, staying on
the queue, it is likely not for long.  To not limit sorting in such bursty
scenarios I've added batched counter zeroing when the queue is getting empty.

The internal scheduler of the SAS HDD I was testing seems to be even more
loyal to random I/O, reducing the scrub speed to ~120MB/s.  So in case
somebody worried this is limit is too strict -- it actually looks relaxed.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

3 years agocalendar: remove all datafiles except freebsd one
Warner Losh [Mon, 26 Oct 2020 03:26:18 +0000 (03:26 +0000)]
calendar: remove all datafiles except freebsd one

Move all the data files for the calendar(1) program, except
calendar.freebsd to the calendar-data package. When a file
can't be found, and /usr/local/share/calendar doesn't exist
provide a helpful hint to install this package.

Reviewed by: se@
Differential Revision:  https://reviews.freebsd.org/D26926

3 years agoupdate write(2)'s iovec limit w/ info about the iosize_max_clamp sysctl...
John-Mark Gurney [Mon, 26 Oct 2020 00:37:31 +0000 (00:37 +0000)]
update write(2)'s iovec limit w/ info about the iosize_max_clamp sysctl...

3 years agoUse proper type (ino_t) for inode numbers to avoid improper sign extention
Kirk McKusick [Sun, 25 Oct 2020 21:04:07 +0000 (21:04 +0000)]
Use proper type (ino_t) for inode numbers to avoid improper sign extention
in the Pass 5 checks. The manifestation was fsck_ffs exiting with this error:

  ** Phase 5 - Check Cyl groups
  fsck_ffs: inoinfo: inumber 18446744071562087424 out of range

The error only manifests itself for filesystems bigger than about 100Tb.

Reported by:  Nikita Grechikhin <ngrechikhin at yandex.ru>
MFC after:    2 weeks
Sponsored by: Netflix

3 years agoIntroduce support of SCSI Command Priority.
Alexander Motin [Sun, 25 Oct 2020 19:34:02 +0000 (19:34 +0000)]
Introduce support of SCSI Command Priority.

SAM-3 specification introduced concept of Task Priority, that was renamed
to Command Priority in SAM-4, and supported by all modern SCSI transports.
It provides 15 levels of relative priorities: 1 - highest, 15 - lowest and
0 - default.  SAT specification for SATA devices translates priorities 1-3
into NCQ high priority.

This change adds new "priority" field into empty spots of struct ccb_scsiio
and struct ccb_accept_tio of CAM and struct ctl_scsiio of CTL.  Respective
support is added into iscsi(4), isp(4), mpr(4), mps(4) and ocs_fc(4) drivers
for both initiator and where applicable target roles.  Minimal support was
added to CTL to receive the priority value from different frontends, pass it
between HA controllers and report in few places.

This patch does not add consumers of this functionality, so nothing should
really change yet, since the field is still set to 0 (default) on initiator
and not actively used on target.  Those are to be implemented separately.

I've confirmed priority working on WD Red SATA disks connected via mpr(4)
and properly transferred to CTL target via iscsi(4), isp(4) and ocs_fc(4).

While there, added missing tag_action support to ocs_fc(4) initiator role.

MFC after: 1 month
Relnotes: yes
Sponsored by: iXsystems, Inc.

3 years agorc.d/syscons: remove spaces before tab
Ed Maste [Sun, 25 Oct 2020 18:27:21 +0000 (18:27 +0000)]
rc.d/syscons: remove spaces before tab

3 years agomergemaster: Clarify installed and updated versions
Ed Maste [Sun, 25 Oct 2020 18:06:45 +0000 (18:06 +0000)]
mergemaster: Clarify installed and updated versions

Describe "diff installed new" as "Displaying differences between
installed and new."  Previously mergemaster described them in the
opposite order.

PR: 249214
Reported by: Yuri Victorovich
MFC after: 2 weeks

3 years agoFix incorrect constants of target tag action.
Alexander Motin [Sun, 25 Oct 2020 16:58:48 +0000 (16:58 +0000)]
Fix incorrect constants of target tag action.

ocs_scsi_recv_cmd() receives the flags after ocs_get_flags_fcp_cmd(),
which translates them from FCP_TASK_ATTR_* to OCS_SCSI_CMD_*.  As result
non-SIMPLE requests turned into HEAD or ORDERED depending on direction.

MFC after: 2 weeks

3 years agocalendar.1: Fix locale of the month in Dd ;)
Mateusz Piotrowski [Sun, 25 Oct 2020 16:01:03 +0000 (16:01 +0000)]
calendar.1: Fix locale of the month in Dd ;)

3 years agoifconfig.8: Remove spurious commas
Mateusz Piotrowski [Sun, 25 Oct 2020 15:01:01 +0000 (15:01 +0000)]
ifconfig.8: Remove spurious commas

Correct misuse of commas/parentheses in an enumeration that makes the
number of actual parameters more important than expected.

PR: 250526
Submitted by: Samy Mahmoudi <samy.mahmoudi__gmail_com>
MFC after: 1 week

3 years agoRemove the check that prevents creating "loops" from mount_nullfs(8).
Edward Tomasz Napierala [Sun, 25 Oct 2020 14:09:00 +0000 (14:09 +0000)]
Remove the check that prevents creating "loops" from mount_nullfs(8).

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

3 years agoAdd IOMMU support to GICv3 Interrupt Translation Service (ITS) driver.
Ruslan Bukin [Sun, 25 Oct 2020 10:08:46 +0000 (10:08 +0000)]
Add IOMMU support to GICv3 Interrupt Translation Service (ITS) driver.

Submitted by: andrew
Sponsored by: Innovate DSbD
Differential Revision: https://reviews.freebsd.org/D26878

3 years agoFilesystem utilities that modify the filesystem (growfs(8), tunefs(8),
Kirk McKusick [Sun, 25 Oct 2020 01:36:33 +0000 (01:36 +0000)]
Filesystem utilities that modify the filesystem (growfs(8), tunefs(8),
and fsirand(8)) should check the filesystem status and require that
fsck(8) be run if it is unclean. This requirement is not imposed on
fsdb(8) or clri(8) since they may be used to clean up a filesystem.

MFC after:    2 weeks
Sponsored by: Netflix

3 years agoVarious new check-hash checks have been added to the UFS filesystem
Kirk McKusick [Sun, 25 Oct 2020 00:43:48 +0000 (00:43 +0000)]
Various new check-hash checks have been added to the UFS filesystem
over various major releases. Superblock check hashes were added for
the 12 release and cylinder-group and inode check hashes will appear
in the 13 release.

When a disk with a UFS filesystem is writably mounted, the kernel
clears the feature flags for anything that it does not support. For
example, if a UFS disk from a 12-stable kernel is mounted on an
11-stable system, the 11-stable kernel will clear the flag in the
filesystem superblock that indicates that superblock check-hashs
are being maintained. Thus if the disk is later moved back to a
12-stable system, the 12-stable system will know to ignore its
incorrect check-hash.

If the only filesystem modification done on the earlier kernel is
to run a utility such as growfs(8) that modifies the superblock but
neither updates the check-hash nor clears the feature flag indicating
that it does not support the check-hash, the disk will fail to mount
if it is moved back to its original newer kernel.

This patch moves the code that clears the filesystem feature flags
from the mount code (ffs_mountfs()) to the code that reads the
superblock (ffs_sbget()). As ffs_sbget() is used by the kernel mount
code and is imported into libufs(3), all the filesystem utilities
will now also clear these flags when they make modifications to the
filesystem.

As suggested by John Baldwin, fsck_ffs(8) has been changed to accept
and repair bad superblock check-hashes rather than refusing to run.
This change allows fsck to recover filesystems that have been impacted
by utilities older than those created after this change and is a
sensible thing to do in any event.

Reported by:  John Baldwin (jhb@)
MFC after:    2 weeks
Sponsored by: Netflix

3 years agoFix build after r367020
Mitchell Horne [Sat, 24 Oct 2020 23:21:51 +0000 (23:21 +0000)]
Fix build after r367020

DTrace also relies on these definitions.

Reported by: jenkins

3 years agocdefs.h: remove intel_compiler support
Warner Losh [Sat, 24 Oct 2020 23:21:31 +0000 (23:21 +0000)]
cdefs.h: remove intel_compiler support

The  age  of   the  intel  compiler  support  is  so   old  as  to  be
uninteresting. No recent recports of  intel compiler support have been
received.  Remove  all the  special  case  workarounds for  the  Intel
compiler. Should there be interest in supporting the compiler, contact
me and I'll work with people to make it happen, though I suspect these
instances are more likely to be in the way than to be helpful.

Reviewed by: cem, emaste, vangyzen, dim
Differential Revision: https://reviews.freebsd.org/D26817

3 years agoRemove support for intel compiler from i386 in_cksum
Warner Losh [Sat, 24 Oct 2020 23:21:27 +0000 (23:21 +0000)]
Remove support for intel compiler from i386 in_cksum

We no longer support building the kernel with the old intel
compiler. Remove support for it from in_cksum. Should there be
interest in reviving it, this is as likely to get in the way as to
help anyway.

3 years agoRemove intel compiler support from math.h
Warner Losh [Sat, 24 Oct 2020 23:21:22 +0000 (23:21 +0000)]
Remove intel compiler support from math.h

The intel compiler support has badly decayed over the years. Stop
pretending that we support it. Note, I've stopped short of requiring
gcc builtin support with this commit since other compilers may be used
to build non-base software and we need to support those so more
investigation is needed before simplifying further.

3 years agoRemove support for ancient compilers
Warner Losh [Sat, 24 Oct 2020 23:21:18 +0000 (23:21 +0000)]
Remove support for ancient compilers

We don't support building the kernel from such old compilers, nor with
the Intel Compiler specifically. Remove support for this old construct
that was copied from stdbool.h and not relevant here.

3 years agoRemove obsolete check for GCC < 3 and support for Intel Compiler
Warner Losh [Sat, 24 Oct 2020 23:21:06 +0000 (23:21 +0000)]
Remove obsolete check for GCC < 3 and support for Intel Compiler

We no longer support old versions of GCC. Remove this check by
assuming it's false. That will make the entire expression false.  Also
remove support for Intel compiler, it's badly bitrotted.  Technically,
this removes support for C89 and K&R from compilers that don't define
_Bool in those compilation environments as well. I'm unaware of any
working compiler today for which that would be relevant (pcc has it
and tcc sadly isn't working for other reasons), though if one
pops up in ports, I'll work to resolve the issue.

3 years agoUpdate man page for -R option added by r376026.
Rick Macklem [Sat, 24 Oct 2020 22:52:29 +0000 (22:52 +0000)]
Update man page for -R option added by r376026.

This is a content change.

Reviewed by: bcr
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26746

3 years agoAdd "-R" option to tell mountd to not register with rpcbind.
Rick Macklem [Sat, 24 Oct 2020 22:48:28 +0000 (22:48 +0000)]
Add "-R" option to tell mountd to not register with rpcbind.

rpcbind is now considered a security risk for some sites.
Since an NFSv4 only NFS server does not need rpcbind,
it makes sense to have an option that implements this.

This patch adds a "-R" option that disables the Mount
protocol (not used by NFSv4) and does not register
with rpcbind.

Changes are required to /etc/rc.d/mountd and /etc/rc.d/nfsd.
Those will be in a separate commit.

Reviewed by: freqlabs, asomers
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26746

3 years agosockstat: Fix error message when jail_attach fails
Ryan Moeller [Sat, 24 Oct 2020 22:36:20 +0000 (22:36 +0000)]
sockstat: Fix error message when jail_attach fails

jail_errmsg is for libjail, jail_attach() is a system call.

3 years agoAdd network QoS support for PCP to iscsi target.
Richard Scheffenegger [Sat, 24 Oct 2020 21:10:53 +0000 (21:10 +0000)]
Add network QoS support for PCP to iscsi target.

Mak the Ethernet PCP codepoint configurable
for L2 local traffic, to allow lower latency for
iSCSI block IO. This addresses the target
side only.

Reviewed by: mav, trasz, bcr
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26740

3 years agoAdd network QoS support for PCP to iscsi initiator.
Richard Scheffenegger [Sat, 24 Oct 2020 21:07:13 +0000 (21:07 +0000)]
Add network QoS support for PCP to iscsi initiator.

Make the Ethernet PCP codepoint configurable
for L2 local traffic, to allow lower latency for
iSCSI block IO. This addresses the initiator
side only.

Reviewed by: mav, trasz, bcr
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26739

3 years agoFix asymmetry in devstat(9) calls by GEOM.
Alexander Motin [Sat, 24 Oct 2020 21:07:10 +0000 (21:07 +0000)]
Fix asymmetry in devstat(9) calls by GEOM.

Before this GEOM passed bio pointer to transaction start, but not end.
It was irrelevant until devstat(9) got DTrace hooks, that appeared to
provide bio pointer on I/O completion, but not on submission.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

3 years agoMake use of IP_VLAN_PCP setsockopt in ping and ping6.
Richard Scheffenegger [Sat, 24 Oct 2020 21:01:18 +0000 (21:01 +0000)]
Make use of IP_VLAN_PCP setsockopt in ping and ping6.

In order to validate the proper marking and use of a different
ethernet priority class, add the new session-specific PCP
feature to the ping/ping6 utilities.

Reviewed by: mav, bcr
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26627

3 years agoriscv: improve exception code naming
Mitchell Horne [Sat, 24 Oct 2020 20:57:13 +0000 (20:57 +0000)]
riscv: improve exception code naming

The existing names were inherited from arm64, but we should prefer
RISC-V terminology. Change the prefix to SCAUSE, and further change the
names to better match the RISC-V spec and be more consistent with one
another. Also, remove two codes that are not defined for S-mode (machine
and hypervisor ecall).

While here, apply style(9) to some condition checks.

Reviewed by: kp
Discussed with: jrtc27
Differential Revision: https://reviews.freebsd.org/D26918

3 years agoo Add iommu de-initialization method for MSI interface.
Ruslan Bukin [Sat, 24 Oct 2020 20:09:27 +0000 (20:09 +0000)]
o Add iommu de-initialization method for MSI interface.
o Add iommu_unmap_msi() to release the msi GAS entry.
o Provide default implementations for iommu init/deinit methods.

Reviewed by: kib
Sponsored by: Innovate DSbD
Differential Revision: https://reviews.freebsd.org/D26906

3 years agoflua: Add a libjail module
Ryan Moeller [Sat, 24 Oct 2020 17:08:59 +0000 (17:08 +0000)]
flua: Add a libjail module

libjail is pretty small, so it makes for a good proof of concept demonstrating
how a system library can be wrapped to create a loadable Lua module for flua.

* Introduce 3lua section for man pages
* Add libjail module

Reviewed by: kevans, manpages
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D26080

3 years agopwd(1): Add EXAMPLES section
Fernando Apesteguía [Sat, 24 Oct 2020 16:42:35 +0000 (16:42 +0000)]
pwd(1): Add EXAMPLES section

Small EXAMPLES section.

Add reference to realpath(1) due to similarity.

Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D26862

3 years agogetent(1): Add EXAMPLES section
Fernando Apesteguía [Sat, 24 Oct 2020 16:40:34 +0000 (16:40 +0000)]
getent(1): Add EXAMPLES section

Add 3 small examples to the EXAMPLES section.

Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D26866

3 years agoSkip RAW kstat sysctls by default
Ryan Moeller [Sat, 24 Oct 2020 16:25:52 +0000 (16:25 +0000)]
Skip RAW kstat sysctls by default

hese kstats are often expensive to compute so we want to avoid them
unless specifically requested.

The following kstats are affected by this change:

kstat.zfs.${pool}.multihost
kstat.zfs.${pool}.misc.state
kstat.zfs.${pool}.txgs
kstat.zfs.misc.fletcher_4_bench
kstat.zfs.misc.vdev_raidz_bench
kstat.zfs.misc.dbufs
kstat.zfs.misc.dbgmsg

PR: 249258
Reported by: mjg
Reviewed by: mjg, allanjude
Obtained from: https://github.com/openzfs/zfs/pull/11099
Sponsored by: iXsystems, Inc.

3 years agosysctl+kern_sysctl: Honor SKIP for descendant nodes
Ryan Moeller [Sat, 24 Oct 2020 16:17:07 +0000 (16:17 +0000)]
sysctl+kern_sysctl: Honor SKIP for descendant nodes

Ensure we also skip descendants of SKIP nodes when iterating through children
of an explicitly specified node.

Reported by: np
Reviewed by: np
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D26833

3 years agoTCP Cubic: improve reaction to (and rollback from) RTO
Richard Scheffenegger [Sat, 24 Oct 2020 16:11:46 +0000 (16:11 +0000)]
TCP Cubic: improve reaction to (and rollback from) RTO

1. fix compliancy issue of CUBIC RTO handling according to RFC8312 section 4.7
2. add CUBIC CC_RTO_ERR handling

Submitted by: chengc_netapp.com
Reviewed by: rrs, tuexen, rscheff
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26808

3 years agotcp: move cwnd and ssthresh updates into cc modules
Richard Scheffenegger [Sat, 24 Oct 2020 16:09:18 +0000 (16:09 +0000)]
tcp: move cwnd and ssthresh updates into cc modules

This will pave the way of setting ssthresh differently in TCP CUBIC, according
to RFC8312 section 4.7.

No functional change, only code movement.

Submitted by: chengc_netapp.com
Reviewed by: rrs, tuexen, rscheff
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26807

3 years agosysctl: Misc code cleanup
Ryan Moeller [Sat, 24 Oct 2020 16:05:37 +0000 (16:05 +0000)]
sysctl: Misc code cleanup

* Use defined SYS_SYSCTL names
* Use memcmp instead of explicit loop
* Use NULL instead of 0 for pointer value
* Use __FBSDID
* Reformat, improve comments in parse()

No functional changes.

Reviewed by: imp
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D26832

3 years agoMFV r366990: less v563.
Xin LI [Sat, 24 Oct 2020 15:58:42 +0000 (15:58 +0000)]
MFV r366990: less v563.

MFC after: 2 weeks
Relnotes: yes

3 years agobacklight(9): compile with COMPAT_LINUXKPI as well
Kyle Evans [Sat, 24 Oct 2020 15:38:04 +0000 (15:38 +0000)]
backlight(9): compile with COMPAT_LINUXKPI as well

This would be more accurately expressed as COMPAT_LINUXKPI implying or
requiring backlight, but config(8) doesn't really have a way to express
that. This fixes the build with COMPAT_LINUXKPI specified in one's kernel
config.

3 years agokern_sysctl: Misc code cleanup
Ryan Moeller [Sat, 24 Oct 2020 14:46:38 +0000 (14:46 +0000)]
kern_sysctl: Misc code cleanup

Remove unused oidpp parameter from sysctl_sysctl_next_ls and
add high level comments to describe how it works.

No functional change.

Reviewed by: imp
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D26854

3 years agoaudit: correct reporting of *execve(2) success
Kyle Evans [Sat, 24 Oct 2020 14:39:17 +0000 (14:39 +0000)]
audit: correct reporting of *execve(2) success

r326145 corrected do_execve() to return EJUSTRETURN upon success so that
important registers are not clobbered. This had the side effect of tapping
out 'failures' for all *execve(2) audit records, which is less than useful
for auditing purposes.

Audit exec returns earlier, where we can know for sure that EJUSTRETURN
translates to success. Note that this unsets TDP_AUDITREC as we commit the
audit record, so the usual audit in the syscall return path will do nothing.

PR: 249179
Reported by: Eirik Oeverby <ltning-freebsd anduin net>
Reviewed by: csjp, kib
MFC after: 1 week
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26922

3 years agoTweak linux(4) socket(2) debug messages.
Edward Tomasz Napierala [Sat, 24 Oct 2020 14:25:38 +0000 (14:25 +0000)]
Tweak linux(4) socket(2) debug messages.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26900

3 years agoFurther improve prctl(2) debug.
Edward Tomasz Napierala [Sat, 24 Oct 2020 14:23:44 +0000 (14:23 +0000)]
Further improve prctl(2) debug.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26916

3 years agocache: assorted typo fixes
Mateusz Guzik [Sat, 24 Oct 2020 13:31:40 +0000 (13:31 +0000)]
cache: assorted typo fixes

3 years agocache: add the missing NC_NOMAKEENTRY and NC_KEEPPOSENTRY to lockless lookup
Mateusz Guzik [Sat, 24 Oct 2020 13:31:25 +0000 (13:31 +0000)]
cache: add the missing NC_NOMAKEENTRY and NC_KEEPPOSENTRY to lockless lookup

They are de facto ignored.

3 years agovfs: fix a race where reclaim vholds freed vnodes
Mateusz Guzik [Sat, 24 Oct 2020 13:30:37 +0000 (13:30 +0000)]
vfs: fix a race where reclaim vholds freed vnodes

Reported by: pho
Tested by: pho (previous version)
Fixes: r366974 ("vfs: stop taking the interlock in vnode reclaim")

3 years agoImplement xa_init() in the LinuxKPI as a wrapper for xa_init_flags().
Hans Petter Selasky [Sat, 24 Oct 2020 13:16:10 +0000 (13:16 +0000)]
Implement xa_init() in the LinuxKPI as a wrapper for xa_init_flags().

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

3 years agoMore style fixes (partial revert of r366994).
Hans Petter Selasky [Sat, 24 Oct 2020 13:07:50 +0000 (13:07 +0000)]
More style fixes (partial revert of r366994).

Suggested by: danfe@
Differential Revision: https://reviews.freebsd.org/D26254
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoFix order of header files:
Hans Petter Selasky [Sat, 24 Oct 2020 10:52:09 +0000 (10:52 +0000)]
Fix order of header files:
sys/systm.h should come right after sys/param.h

Suggested by: kib@
Differential Revision: https://reviews.freebsd.org/D26254
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoRun code through "clang-format -style=file" with some additional fixes.
Hans Petter Selasky [Sat, 24 Oct 2020 10:23:21 +0000 (10:23 +0000)]
Run code through "clang-format -style=file" with some additional fixes.
No functional change.

Suggested by: kib@ and emaste@
Differential Revision: https://reviews.freebsd.org/D26254
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agonfsstat: delete unused fields
Alan Somers [Sat, 24 Oct 2020 05:52:29 +0000 (05:52 +0000)]
nfsstat: delete unused fields

Ever since r192762 nfsstat has included a few fields whose values were
always 0. They were copied from OpenBSD, but have never been used on
FreeBSD. Don't display them.

Reviewed by: rmacklem
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D26920

3 years agoVendor import of less v563.
Xin LI [Sat, 24 Oct 2020 05:25:54 +0000 (05:25 +0000)]
Vendor import of less v563.

3 years agonvme: Remove compat code for older kernels
Warner Losh [Sat, 24 Oct 2020 01:59:01 +0000 (01:59 +0000)]
nvme: Remove compat code for older kernels

Remove code that supported pre-2011 kernels. CTLTYPE_S64 was defined
in rev 217616. All supported branches have it, so remove its compat
definition as OBE.

3 years agocache: batch updates to numcache in case of mass removal
Mateusz Guzik [Sat, 24 Oct 2020 01:14:52 +0000 (01:14 +0000)]
cache: batch updates to numcache in case of mass removal

3 years agocache: refactor alloc/free
Mateusz Guzik [Sat, 24 Oct 2020 01:14:17 +0000 (01:14 +0000)]
cache: refactor alloc/free

This in particular centralizes manipulation of numcache.

3 years agocache: fold branch prediction into cache_ncp_canuse
Mateusz Guzik [Sat, 24 Oct 2020 01:13:47 +0000 (01:13 +0000)]
cache: fold branch prediction into cache_ncp_canuse

3 years agocache: fix some typos
Mateusz Guzik [Sat, 24 Oct 2020 01:13:16 +0000 (01:13 +0000)]
cache: fix some typos

3 years agocache: drop write-only vars
Mateusz Guzik [Sat, 24 Oct 2020 01:13:02 +0000 (01:13 +0000)]
cache: drop write-only vars

3 years agowarnx: fix needless static
Warner Losh [Sat, 24 Oct 2020 00:03:11 +0000 (00:03 +0000)]
warnx: fix needless static

I noticed after the review that these shouldn't be static. Remove the
'static' from them, otherwise concurrent calls to warn* might see a
similar but to the original.

3 years agowarnx: Save errno across calls that might change it.
Warner Losh [Fri, 23 Oct 2020 23:56:00 +0000 (23:56 +0000)]
warnx: Save errno across calls that might change it.

When warn() family of functions is being used after err_set_file() has
been set to, for example, /dev/null, errno is being clobbered,
rendering it unreliable after, for example, procstat_getpathname()
when it is supposed to emit a warning. Then the errno is changed to
Inappropriate ioctl for device, destroying the original value (via
calls to fprintf()functions).

Submitted by: Juraj Lutter
Differential Revision: https://reviews.freebsd.org/D26871

3 years agoOnly use ASAN when using the in-tree compiler
Brooks Davis [Fri, 23 Oct 2020 22:27:45 +0000 (22:27 +0000)]
Only use ASAN when using the in-tree compiler

When building FreeBSD 11 on a FreeBSD 12 system with
CROSS_TOOLCHAIN=llvm10 we end up trying to link against the packaged
version of the sanitizer library.  This resulted in a requirement for
getentropy(3) which is not present in FreeBSD 11.

Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26903

3 years agoMove the iommu stubs to a generic place, so they are available on all the
Ruslan Bukin [Fri, 23 Oct 2020 21:27:48 +0000 (21:27 +0000)]
Move the iommu stubs to a generic place, so they are available on all the
platforms.

This allows to not depend on the IOMMU macro in AHCI driver.

Requested by: kib
Suggested by: andrew
Reviewed by: kib
Sponsored by: Innovate DSbD
Differential Revision: https://reviews.freebsd.org/D26887

3 years agoxhci: Handle the case when MSI-X BAR is the same as IO BAR.
Konstantin Belousov [Fri, 23 Oct 2020 18:18:45 +0000 (18:18 +0000)]
xhci: Handle the case when MSI-X BAR is the same as IO BAR.

PCIe allows for MSI-X BAR to be either dedicated, or MSI-X Table may
be co-located in some functional BAR.  In the later case xhci(4) is
unable to allocate active resource for the table because BAR is
already activated.

Handle it by checking for this special case, and not try to alloc
resource if MSI-X BAR is IO.

Reported and tested by: emaste
Reviewed by: emaste, hselasky
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D26913

3 years agolibelf: add compression header support
Ed Maste [Fri, 23 Oct 2020 16:35:23 +0000 (16:35 +0000)]
libelf: add compression header support

GNU and Oracle libelf implementations added support for section
compression, intended to reduce the size of DWARF debug info (which
might be an order of magnitude larger than the code).

There are two compressed ELF section formats:

1. Old GNU - sections are renmaed to start with 'z'.  Section contains
   a magic number, uncompressed size, and compressed data.

2. Oracle and New GNU - compressed sections use the SHF_COMPRESSED flag.
   The compression header contains the compression type, uncompressed
   size, and uncompressed alignment.

The second style is preferred and this change implements only that one.

Submitted by: Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by: markj
MFC after: 2 weeks
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24566

3 years agocache: reduce memory waste in struct namecache
Mateusz Guzik [Fri, 23 Oct 2020 15:56:22 +0000 (15:56 +0000)]
cache: reduce memory waste in struct namecache

The previous scheme for calculating the total size was doing sizeof
on the struct and then adding the wanted space for the buffer.

nc_name is at offset 58 while sizeof(struct namecache) is 64.
With CACHE_PATH_CUTOFF of 39 bytes and 1 byte of padding we were
allocating 104 bytes for the entry and never accounting for the 6
byte padding, wasting that space.

3 years agovfs: drop spurious cache_purge on rmdir
Mateusz Guzik [Fri, 23 Oct 2020 15:50:49 +0000 (15:50 +0000)]
vfs: drop spurious cache_purge on rmdir

The removed directory gets cache_purged which is sufficient to remove any entries
related to the parent.

Note only tmpfs, ufs and zfs are patched.

3 years agovfs: stop taking the interlock in vnode reclaim
Mateusz Guzik [Fri, 23 Oct 2020 15:49:18 +0000 (15:49 +0000)]
vfs: stop taking the interlock in vnode reclaim

It no longer protects any of tested fields, keeping all the checks racy.

While here make vtryrecycle drop the vnode on its own. Avoids an additional
lock trip.

3 years agontb: Fix the 32-bit build after r366969
Mark Johnston [Fri, 23 Oct 2020 15:12:06 +0000 (15:12 +0000)]
ntb: Fix the 32-bit build after r366969

Reported by: Jenkins
MFC with: r366969

3 years agortsold: Remove an incorrect __unused annotation
Mark Johnston [Fri, 23 Oct 2020 14:56:17 +0000 (14:56 +0000)]
rtsold: Remove an incorrect __unused annotation

MFC after: 1 week

3 years agoAdd some missing nv(9) MLINKS
Mark Johnston [Fri, 23 Oct 2020 14:25:48 +0000 (14:25 +0000)]
Add some missing nv(9) MLINKS

MFC after: 1 week

3 years agontb: Add Intel Xeon Gen3 support
Mark Johnston [Fri, 23 Oct 2020 14:16:52 +0000 (14:16 +0000)]
ntb: Add Intel Xeon Gen3 support

The NTB hardware starting with Skylake has some changes to the register
map and the doorbell interface.  Add a new NTB_XEON_GEN3 device type and
use it to conditionalize driver logic that differs from the existing
Xeon code.

Reviewed by: vangyzen
Discussed with: cem, Bret Ketchum <Bret.Ketchum@dell.com>
MFC after: 1 month
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26683

3 years agontb: Fix an assertion to permit >= 32 doorbells
Mark Johnston [Fri, 23 Oct 2020 14:15:58 +0000 (14:15 +0000)]
ntb: Fix an assertion to permit >= 32 doorbells

MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.

3 years agoImprove prctl(2) debug.
Edward Tomasz Napierala [Fri, 23 Oct 2020 12:00:30 +0000 (12:00 +0000)]
Improve prctl(2) debug.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26899

3 years agoAdd /proc/sys/kernel/ngroups_max to linprocfs(4). The id(1) command
Edward Tomasz Napierala [Fri, 23 Oct 2020 11:57:55 +0000 (11:57 +0000)]
Add /proc/sys/kernel/ngroups_max to linprocfs(4).  The id(1) command
seems to use it - it works fine without it, but still.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26898

3 years agoUdpate calendar man-page to mention the search path added in r366962.
Stefan Eßer [Fri, 23 Oct 2020 10:00:56 +0000 (10:00 +0000)]
Udpate calendar man-page to mention the search path added in r366962.

Calendar files in /usr/lcoal/share/calendar take precedence over files in
the base system. They can be provided by a port or package, but since such
a port has not been committed, yet, no specific port name is suggested.

In fact, multiple ports could exist (e.g. per locale) without conflicting
with each other.

3 years agoAdd search of LOCALBASE/share/calendar for calendars supplied by a port.
Stefan Eßer [Fri, 23 Oct 2020 09:22:23 +0000 (09:22 +0000)]
Add search of LOCALBASE/share/calendar for calendars supplied by a port.

Calendar files in LOCALBASE override similarily named ones in the base
system. This could easily be changed if the base system calendars should
have precedence, but it could lead to a violation of POLA since then the
port's files were ignored unless those in base have been deleted.

There was no definition of _PATH_LOCALBASE in paths.h, but verbatim uses
of /usr/local existed for _PATH_DEFPATH. Use _PATH_LOCALBASE here to ease
a consistent modification of this prefix.

Reviewed by: imp, pfg
Differential Revision: https://reviews.freebsd.org/D26882

3 years agoFix for loading cuse.ko via rc.d . Make sure we declare the cuse(3)
Hans Petter Selasky [Fri, 23 Oct 2020 08:44:53 +0000 (08:44 +0000)]
Fix for loading cuse.ko via rc.d . Make sure we declare the cuse(3)
module by name and not only by the version information, so that
"kldstat -q -m cuse" works.

Found by: Goran Mekic <meka@tilda.center>
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoConditionally compile struct vm_phys_seg's md_first field. This field is
Alan Cox [Fri, 23 Oct 2020 06:24:38 +0000 (06:24 +0000)]
Conditionally compile struct vm_phys_seg's md_first field.  This field is
only used by arm64's pmap.

Reviewed by: kib, markj, scottph
Differential Revision: https://reviews.freebsd.org/D26907

3 years agocxgbe(4): Fix min/max typo in r366958.
Navdeep Parhar [Fri, 23 Oct 2020 02:24:43 +0000 (02:24 +0000)]
cxgbe(4):  Fix min/max typo in r366958.

3 years agocxgbe(4): refine the values reported in if_ratelimit_query.
Navdeep Parhar [Fri, 23 Oct 2020 01:36:54 +0000 (01:36 +0000)]
cxgbe(4): refine the values reported in if_ratelimit_query.

- Get the number of classes from chip_params.
- Get the number of ethofld tids from the firmware.
- Do not let tcp_ratelimit allocate all traffic classes.

Sponsored by: Chelsio Communications

3 years agoHandle CPL_RX_DATA on active TLS sockets.
John Baldwin [Fri, 23 Oct 2020 00:23:54 +0000 (00:23 +0000)]
Handle CPL_RX_DATA on active TLS sockets.

In certain edge cases, the NIC might have only received a partial TLS
record which it needs to return to the driver.  For example, if the
local socket was closed while data was still in flight, a partial TLS
record might be pending when the connection is closed.  Receiving a
RST in the middle of a TLS record is another example.  When this
happens, the firmware returns the the partial TLS record as plain TCP
data via CPL_RX_DATA.  Handle these requests by returning an error to
OpenSSL (via so_error for KTLS or via an error TLS record header for
the older Chelsio OpenSSL interface).

Reported by: Sony Arpita Das @ Chelsio
Reviewed by: np
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: Revision: https://reviews.freebsd.org/D26800

3 years agoNegotiate iSCSIProtocolLevel of 2 (RFC 7144) in initiator.
Alexander Motin [Thu, 22 Oct 2020 20:26:27 +0000 (20:26 +0000)]
Negotiate iSCSIProtocolLevel of 2 (RFC 7144) in initiator.

It does not change anything immediately, but allows further support of
Command Priority, Status Qualifier and new task management functions.

MFC after: 1 month
Sponsored by: iXsystems, Inc.

3 years agonetmap: fix mutex double unlock bug
Vincenzo Maffione [Thu, 22 Oct 2020 20:21:11 +0000 (20:21 +0000)]
netmap: fix mutex double unlock bug

https://github.com/luigirizzo/netmap/pull/733

Submitted by:  brian90013
MFC after: 3 days

3 years agoloader: revert r342161 and r342151
Toomas Soome [Thu, 22 Oct 2020 20:02:02 +0000 (20:02 +0000)]
loader: revert r342161 and r342151

We are using asize property from pool label and we do not depend
on partition data to find last two pool labels and to validate LBA for disk IO.

This does allow us to re-enable support for partitionless disk setups.

3 years agovfs: prevent avoidable evictions on mkdir of existing directories
Mateusz Guzik [Thu, 22 Oct 2020 19:28:12 +0000 (19:28 +0000)]
vfs: prevent avoidable evictions on mkdir of existing directories

mkdir -p /foo/bar/baz will mkdir each path component and ignore EEXIST.

The NOCACHE lookup will make the namecache unnecessarily evict the existing entry,
and then fallback to the fs lookup routine eventually leading namei to return an
error as the directory is already there.

For invocations like mkdir -p /usr/obj/usr/src/sys/GENERIC/modules this triggers
fallbacks to the slowpath for concurrently executing lookups.

Tested by: pho
Discussed with: kib

3 years agostablerestart(5): Fix some issues reported by mandoc
Gordon Bergling [Thu, 22 Oct 2020 19:25:01 +0000 (19:25 +0000)]
stablerestart(5): Fix some issues reported by mandoc

- New sentence, new line

3 years agocache: assert the created entry does not point to itself
Mateusz Guzik [Thu, 22 Oct 2020 19:22:34 +0000 (19:22 +0000)]
cache: assert the created entry does not point to itself

3 years agopnfsserver(4): Fix some issues reported by mandoc
Gordon Bergling [Thu, 22 Oct 2020 19:19:42 +0000 (19:19 +0000)]
pnfsserver(4): Fix some issues reported by mandoc

- new sentence, new line

3 years agosocket(9): Remove duplicate word 'is is'
Gordon Bergling [Thu, 22 Oct 2020 18:45:49 +0000 (18:45 +0000)]
socket(9): Remove duplicate word 'is is'

MFC after: 1 week