]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoadd SIOCGIFDATA ioctl
emaste [Mon, 28 Sep 2020 16:54:39 +0000 (16:54 +0000)]
add SIOCGIFDATA ioctl

For interfaces that do not support SIOCGIFMEDIA (for which there are
quite a few) the only fallback is to query the interface for
if_data->ifi_link_state.  While it's possible to get at if_data for an
interface via getifaddrs(3) or sysctl, both are heavy weight mechanisms.

SIOCGIFDATA is a simple ioctl to retrieve this fast with very little
resource use in comparison.  This implementation mirrors that of other
similar ioctls in FreeBSD.

Submitted by: Roy Marples <roy@marples.name>
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D26538

3 years agoFor mulitcons boot, report it and which console is primary
imp [Mon, 28 Sep 2020 16:19:29 +0000 (16:19 +0000)]
For mulitcons boot, report it and which console is primary

Until we can do proper /etc/rc output on both consoles in multicons
boot (or all of them if we ever generalize), report when we are
booting multicons. Also report the primary console. This will be a big
hint why output stops after this line (though some slow USB discovery
still happens after mountroot / init starts).

Reviewed by: scottl@, tsoome@
Differential Revision: https://reviews.freebsd.org/D26574

3 years agoReport the kernel console on the boot screen
imp [Mon, 28 Sep 2020 16:19:21 +0000 (16:19 +0000)]
Report the kernel console on the boot screen

Report what console the boot loader is telling the kernel to use:
o Dual (Serial Primary)
o Dual (Video Primary)
o Serial
o Video

This allows the user to interrupt the boot and tweak the cosnole, if
needed, in a trivial way. Useful for installs where the default
selected may not be quite what you want, or when you are running a
dual setup and need to toggle over to the other console being primary.
The 'c'/'C' keys will do the cycling through the consoles.  Note:
you'll still have to drop into the loader to set details about serial
consoles. And this doesn't change the console the loader is using.

Reviewed by: kevans@
MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D26573

3 years agoMinor cleanup.
tuexen [Mon, 28 Sep 2020 14:11:53 +0000 (14:11 +0000)]
Minor cleanup.

MFC after: 3 days

3 years agoFix booting arm64 EFI with LINUX_BOOT_ABI enabled.
mmel [Mon, 28 Sep 2020 09:16:27 +0000 (09:16 +0000)]
Fix booting arm64 EFI with LINUX_BOOT_ABI enabled.
Use address of the pointer passed to kernel to determine whether the pointer
is a FDT block (physical address) or a module pointer (virtual kernel address).
This fragment was supposed to be committed before r366196, but I accidentally
skipped it in a patch series.

Reported by: bz

3 years agoSpeciy the dev in an easily changed variable
imp [Mon, 28 Sep 2020 06:00:56 +0000 (06:00 +0000)]
Speciy the dev in an easily changed variable

Rather than hard coding ada0 everywhere, use ${dev}. Also, set
dev=vtbd0 since both qemu and bhyve support this. More work
should be done to use labels instead for fstab.

qemu scripts likely need adjustment. And we should also
likely generate byhve scripts too.

3 years agoFix video on PCI heuristic
imp [Mon, 28 Sep 2020 06:00:39 +0000 (06:00 +0000)]
Fix video on PCI heuristic

The video on PCI heuristic was broken. It was supposed to infer a
video device when the last element of the path was a PCI DEVICE PATH
node. However, the last node in the device path is an END node, so
this heuristic never fired.

This leads, among other things, to bhyve only producing output in the
serial connection once we leave the boot loader. This restores the
dual headed boot on bhyve + UEFI (as we did in 11.2), but will favor
serial in the absence of other config which may be a change from 11.2.

MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D26572

3 years agoUse %ju and cast to (uintmax_t) to avoid using PRI* macros.
delphij [Mon, 28 Sep 2020 04:30:31 +0000 (04:30 +0000)]
Use %ju and cast to (uintmax_t) to avoid using PRI* macros.

Suggested by: kevlo

3 years agoConsistently use __FBSDID("FreeBSD") for ids in usr.bin/procstat.
kib [Sun, 27 Sep 2020 23:01:54 +0000 (23:01 +0000)]
Consistently use __FBSDID("FreeBSD") for ids in usr.bin/procstat.

Submitted by: Juraj Lutter <juraj@lutter.sk>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26568

3 years agoMisc compiler warning fixes in lib/libc
asomers [Sun, 27 Sep 2020 22:26:41 +0000 (22:26 +0000)]
Misc compiler warning fixes in lib/libc

Reviewed by: kevans, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26534

3 years agoAdd DSCP support for network QoS to iscsi target.
rscheff [Sun, 27 Sep 2020 21:43:19 +0000 (21:43 +0000)]
Add DSCP support for network QoS to iscsi target.

In order to prioritize iSCSI traffic across a network,
DSCP can be used. In order not to rely on "ipfw setdscp"
or in-network reclassification, this adds the dscp value
directly to the portal group (where TCP sessions are accepted).

The incoming iSCSI session is first handled by ctld for any
CHAP authentication and the socket is then handed off to the
in-kernel iscsi driver without modification of the socket
parameters. Simply setting up the socket in ctld is sufficient
to keep sending outgoing iSCSI related traffic with the
configured DSCP value.

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

3 years agoGet rid of sa->narg. It serves no purpose; use sa->callp->sy_narg instead.
trasz [Sun, 27 Sep 2020 18:47:06 +0000 (18:47 +0000)]
Get rid of sa->narg.  It serves no purpose; use sa->callp->sy_narg instead.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26458

3 years agoRemove extraneous bracket.
cy [Sun, 27 Sep 2020 18:39:15 +0000 (18:39 +0000)]
Remove extraneous bracket.

MFC after: 3 days

3 years agoRemove Linux and IRIX specific files.
cy [Sun, 27 Sep 2020 18:39:12 +0000 (18:39 +0000)]
Remove Linux and IRIX specific files.

MFC after: 1 week

3 years agoContinuing the effort started in r343701, #ifdef cleanup, remove
cy [Sun, 27 Sep 2020 18:39:09 +0000 (18:39 +0000)]
Continuing the effort started in r343701, #ifdef cleanup, remove
never to be used again checks.

MFC after: 1 week

3 years agoShrink struct sysent from 48 to 32 bytes (on LP64; on ILP32 its probably
trasz [Sun, 27 Sep 2020 18:14:01 +0000 (18:14 +0000)]
Shrink struct sysent from 48 to 32 bytes (on LP64; on ILP32 its probably
from 32 to 28) by shrinking some entries and reordering them.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26508

3 years agoCheck the result of the function, not the pointer to it.
mmel [Sun, 27 Sep 2020 16:15:03 +0000 (16:15 +0000)]
Check the result of the function, not the pointer to it.

3 years agoCleanup, no functional change intended.
tuexen [Sun, 27 Sep 2020 13:32:02 +0000 (13:32 +0000)]
Cleanup, no functional change intended.

MFC after: 3 days

3 years agoImprove the handling of receiving unordered and unreliable user
tuexen [Sun, 27 Sep 2020 13:24:01 +0000 (13:24 +0000)]
Improve the handling of receiving unordered and unreliable user
messages using DATA chunks. Don't use fsn_included when not being
sure that it is set to an appropriate value. If the default is
used, which is -1, this can result in SCTP associaitons not
making any user visible progress.

Thanks to Yutaka Takeda for reporting this issue for the the
userland stack in https://github.com/pion/sctp/issues/138.

MFC after: 3 days

3 years agoDon't send a signal with uninitialized 'sig' and 'code' fields.
mmel [Sun, 27 Sep 2020 11:37:17 +0000 (11:37 +0000)]
Don't send a signal with uninitialized 'sig' and 'code' fields.
We have a few shortcuts in the arm trap code to speed up obvious "must fail"
cases. In these situations, make sure that we fill in the "sig" and "code"
fields of the generated signal.

MFC after: 3 weeks

3 years agoAdd LINUX_BOOT_ABI back to arm64 GENERIC kernel.
mmel [Sun, 27 Sep 2020 10:15:03 +0000 (10:15 +0000)]
Add LINUX_BOOT_ABI back to arm64 GENERIC kernel.

It was removed in r355289 but forgot to return it back when new u-boot booti
support was committed.  Although booti is not the preferred method of
booting the kernel, it is very useful for the initial phase of porting
FreeBSD to a new platform or booting the kernel on various embedded boards
in an industrial environment.

3 years agoReapply r366193 with proper commit log.
mmel [Sun, 27 Sep 2020 09:27:39 +0000 (09:27 +0000)]
Reapply r366193 with proper commit log.

Don't map same physical memory multiple times with different cache attributes.
This is explicitly stated as architectural undefined behavior, leading to
coherency issues sooner or later.

3 years agoRevert r366193, it was committed with unsaved commit log.
mmel [Sun, 27 Sep 2020 09:24:31 +0000 (09:24 +0000)]
Revert r366193, it was committed with unsaved commit log.

3 years agoDon't map same physical memory multiple times with different cache attributes.
mmel [Sun, 27 Sep 2020 09:14:16 +0000 (09:14 +0000)]
Don't map same physical memory  multiple times with different cache attributes.
This is explicitly stated as architectural undefined behavior, leadint to
coherencz issues sonner or later.

3 years agoDon't try to print EFI memeory map if it doesn't exist.
mmel [Sun, 27 Sep 2020 09:12:36 +0000 (09:12 +0000)]
Don't try to print EFI memeory map if it doesn't exist.

MFC after: 1 week

3 years agoBjorn reported a problem where the Linux NFSv4.1 client is
rmacklem [Sat, 26 Sep 2020 23:05:38 +0000 (23:05 +0000)]
Bjorn reported a problem where the Linux NFSv4.1 client is
using an open_to_lock_owner4 when that lock_owner4 has already
been created by a previous open_to_lock_owner4. This caused the NFS server
to reply NFSERR_INVAL.

For NFSv4.0, this is an error, although the updated NFSv4.0 RFC7530 notes
that the correct error reply is NFSERR_BADSEQID (RFC3530 did not specify
what error to return).

For NFSv4.1, it is not obvious whether or not this is allowed by RFC5661,
but the NFSv4.1 server can handle this case without error.
This patch changes the NFSv4.1 (and NFSv4.2) server to handle multiple
uses of the same lock_owner in open_to_lock_owner so that it now correctly
interoperates with the Linux NFS client.
It also changes the error returned for NFSv4.0 to be NFSERR_BADSEQID.

Thanks go to Bjorn for diagnosing this and testing the patch.
He also provided a program that I could use to reproduce the problem.

Tested by: bj@cebitec.uni-bielefeld.de (Bjorn Fischer)
PR: 249567
Reported by: bj@cebitec.uni-bielefeld.de (Bjorn Fischer)
MFC after: 3 days

3 years agoCheck for the only 32-bit MIPS ABIs we support, rather than !n64
jhibbits [Sat, 26 Sep 2020 21:47:11 +0000 (21:47 +0000)]
Check for the only 32-bit MIPS ABIs we support, rather than !n64

There may be additional 64-bit ABIs supported, so use a positive check rather
than a negative check.
Suggested by: imp
MFC after: 1 week
Sponsored by: Juniper Networks, Inc

3 years agobsdconfig, bsdinstall: Prune dead mirrors
zeising [Sat, 26 Sep 2020 16:27:09 +0000 (16:27 +0000)]
bsdconfig, bsdinstall: Prune dead mirrors

Prune dead mirrors from the list of mirrors in bsdconfig and bsdinstall.
All these return NXDOMAIN when trying to resolve them.

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

3 years agofix typo imorted -> imported.
imp [Sat, 26 Sep 2020 04:06:16 +0000 (04:06 +0000)]
fix typo imorted -> imported.

Noticed by: Maigurs Stalidzans

3 years agoRevert most of r360179.
jhb [Fri, 25 Sep 2020 21:19:56 +0000 (21:19 +0000)]
Revert most of r360179.

I had failed to notice that sgsendccb() was using cam_periph_mapmem()
and thus was not passing down user pointers directly to drivers.  In
practice this broke requests submitted from userland.

PR: 249395
Reported by: Trenton Schulz <trueos@norwegianrockcat.com>
Reviewed by: scottl
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26550

3 years agoAdjustments to includes for openzfs in _STANDALONE
imp [Fri, 25 Sep 2020 20:51:07 +0000 (20:51 +0000)]
Adjustments to includes for openzfs in _STANDALONE

Allow the necessary parts of systm.h to be visible in the _STANDALONE
environnment. Limit the reset to only being visible for _KERNEL
builds.  Map KASSERT, etc to printf on failure in the bootloader until
we have more confidence things won't break and leave systems
unbootable. Eventually, this should map to a full panic in the
bootloader, but that also needs some enhancement to be more useful.

Reviewed by: tsoome, jhb
Differential Revision:  https://reviews.freebsd.org/D26543

3 years agoFix mips64 build
jhibbits [Fri, 25 Sep 2020 20:27:36 +0000 (20:27 +0000)]
Fix mips64 build

Original patch was against FreeBSD 12, and a test compile wasn't run against
head.  md_tls_tcb_offset field was moved from mdthread to mdproc in the
meantime.

MFC after: 1 week
Sponsored by: Juniper Networks, Inc.

3 years agomips: Fix compat32 library builds from r366162
jhibbits [Fri, 25 Sep 2020 19:04:03 +0000 (19:04 +0000)]
mips: Fix compat32 library builds from r366162

Re-add the a_ptr and a_fcn fields to Elf32_Auxinfo.

MFC after: 1 week
Sponsored by: Juniper Networks, Inc.

3 years agoDont let kernel and standalone both be defined at the same time
imp [Fri, 25 Sep 2020 19:02:49 +0000 (19:02 +0000)]
Dont let kernel and standalone both be defined at the same time

_KERNEL and _STANDALONE are different things. They cannot both be true
at the same time. If things that are normally visible only to _KERNEL
are needed for the _STANDALONE environment, you need to also make them
visible to _STANDALONE. Often times, this will be just a subset of the
required things for _KERNEL (eg global variables are but one example).

sys/cdefs.h is included by pretty much everything in both the loader
and the kernel, so is the ideal choke point.

3 years agong_l2tp: Fix callout synchronization in the rexmit timeout handler
markj [Fri, 25 Sep 2020 18:55:50 +0000 (18:55 +0000)]
ng_l2tp: Fix callout synchronization in the rexmit timeout handler

A received control packet may cause the transmit queue to be flushed, in
which case ng_l2tp_seq_recv_nr() cancels the transmit timeout handler.
The handler checks to see if it was cancelled before doing anything, but
did so before acquiring the node lock, so a small race window could
cause ng_l2tp_seq_rack_timeout() to attempt to flush an empty queue,
ultimately causing a null pointer dereference.

PR: 241133
Reviewed by: bz, glebius, Lutz Donnerhacke
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D26548

3 years agoComment out bogus command line entry
imp [Fri, 25 Sep 2020 18:20:45 +0000 (18:20 +0000)]
Comment out bogus command line entry

Linux implements -d to mean --print-decimal. We don't implement that
and use -d for --device-path. Note that.

3 years agoTweak output of the loader variable
imp [Fri, 25 Sep 2020 18:20:41 +0000 (18:20 +0000)]
Tweak output of the loader variable

When the DEVICE_PATH is <= 4 that means it's effectively empty. I have
a laptop that has a BIOS that likes to generate these:

8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot2001
0000: 01 00 00 00 04 00 45 00 46 00 49 00 20 00 55 00
0010: 53 00 42 00 20 00 44 00 65 00 76 00 69 00 63 00
0020: 65 00 00 00 7f ff 04 00 52 43

which now decodes as
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot2001
* EFI USB Device
Empty path
Option:
0000: 52 43

which matches my hand-decode.

Add an extra newline after Option: to make it look nice.

I suspect that these entries really should be VenHw entries instead,
but my ability to change that is NIL, so cope with them as best we can.

efibootmgr(8)'s output is fine and doesn't need adjusting.

3 years agoFix compat32 on mips64
jhibbits [Fri, 25 Sep 2020 17:13:45 +0000 (17:13 +0000)]
Fix compat32 on mips64

Summary:
Two bugs:
* Elf32_Auxinfo is broken, using pointers in the union, which are 64-bits not
  32.
* freebsd32_sysarch() doesn't update the 'user local' register when handling
  MIPS_SET_TLS, leading to a NULL pointer dereference in the 32-bit
  application.

Reviewed by: #mips, brooks
MFC after: 1 week
Sponsored by: Juniper Networks, Inc
Differential Revision: https://reviews.freebsd.org/D26556

3 years agoRefine locking inside of syscon driver.
mmel [Fri, 25 Sep 2020 16:44:01 +0000 (16:44 +0000)]
Refine locking inside of syscon driver.
In some cases, the syscon driver may be used by consumer requiring better
control about locking (ie. it may be used as registe file provider for clock
driver which needs locked access to multiple registers).
Add fine locking protocol methods together with bunch of helper functions
in syscon driver and implement this functionality in syscon_generic driver.

MFC after: 4 weeks

3 years agoEnable SO_LINGER to the so_reuseport_lb_test regression tests, preventing
olivier [Fri, 25 Sep 2020 16:02:13 +0000 (16:02 +0000)]
Enable SO_LINGER to the so_reuseport_lb_test regression tests, preventing
many sockets in TIME_WAIT state at the end of the test.

PR: 249885
Reviewed by: markj
Approved by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26549

3 years agoCorrectly handle nodes compatible with "syscon", "simple-bus".
mmel [Fri, 25 Sep 2020 13:52:31 +0000 (13:52 +0000)]
Correctly handle nodes compatible with "syscon", "simple-bus".
Syscon can also have child nodes that share a registration file with it.
To do this correctly, follow these steps:
- subclass syscon from simplebus and expose it if the node is also
  "simple-bus" compatible.
- block simplebus probe for this compatible string, so it's priority
 (bus pass) doesn't colide with syscon driver.

While I'm in, also block "syscon", "simple-mfd" for the same reason.

MFC after: 4 weeks

3 years agoTCP: send full initial window when timestamps are in use
rscheff [Fri, 25 Sep 2020 10:38:19 +0000 (10:38 +0000)]
TCP: send full initial window when timestamps are in use

The fastpath in tcp_output tries to send out
full segments, and avoid sending partial segments by
comparing against the static t_maxseg variable.
That value does not consider tcp options like timestamps,
while the initial window calculation is using
the correct dynamic tcp_maxseg() function.

Due to this interaction, the last, full size segment
is considered too short and not sent out immediately.

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

3 years agoTCP newreno: improve after_idle ssthresh
rscheff [Fri, 25 Sep 2020 10:23:14 +0000 (10:23 +0000)]
TCP newreno: improve after_idle ssthresh

Adjust ssthresh in after_idle to the maximum of
the prior ssthresh, or 3/4 of the prior cwnd. See
RFC2861 section 2 for an in depth explanation for
the rationale around this.

As newreno is the default "fall-through" reaction,
most tcp variants will benefit from this.

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

3 years agovi(1): Add URL to the vi/ex reference manual in the man page
fernape [Fri, 25 Sep 2020 10:20:12 +0000 (10:20 +0000)]
vi(1): Add URL to the vi/ex reference manual in the man page

Reported in PR 241985

The manual page references the "vi/ex reference manual" but there is no
information about where to find that document. Add a reference to the manual in
the SEE ALSO section since the Project hosts a copy of it[1].

Change sent upstream[2]

If D26158 gets reviewed and committed, we could close that PR.

[1] https://docs.freebsd.org/44doc/usd/13.viref/paper.pdf).
[2] https://github.com/lichray/nvi2/pull/85

Submitted by: freebsd@tim.thechases.com
Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D26163

3 years agoRegen after r366145.
trasz [Fri, 25 Sep 2020 10:05:38 +0000 (10:05 +0000)]
Regen after r366145.

Sponsored by: DARPA

3 years agoMake simplebus friendlier for subclassing.
mmel [Fri, 25 Sep 2020 09:56:50 +0000 (09:56 +0000)]
Make simplebus friendlier for subclassing.

MFC after: 1 week

3 years agoMake makesyscalls.lua initialize 'struct sysent' entries using c99
trasz [Fri, 25 Sep 2020 09:34:00 +0000 (09:34 +0000)]
Make makesyscalls.lua initialize 'struct sysent' entries using c99
designated initializers.  This makes it easier to modify 'struct sysent'
layout.

Reviewed by: kevans
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26530

3 years agopwm(8): fix potential duty overflow, use unsigneds for period and duty
avg [Fri, 25 Sep 2020 07:55:08 +0000 (07:55 +0000)]
pwm(8): fix potential duty overflow, use unsigneds for period and duty

For a long period value and the duty specified as a percentage,
there could be an overflow.
Using unsigned integers aligns the code with struct pwm_state and allows
to safely use periods up to 4 seconds where supported by drivers.

MFC after: 2 weeks

3 years agopwm(8): do not exit with failure after successfully reading configuration
avg [Fri, 25 Sep 2020 07:54:38 +0000 (07:54 +0000)]
pwm(8): do not exit with failure after successfully reading configuration

MFC after: 1 week

3 years agoaw_pwm: add a check and some comments related to long periods
avg [Fri, 25 Sep 2020 07:41:51 +0000 (07:41 +0000)]
aw_pwm: add a check and some comments related to long periods

The hardware supports periods as long as 196 seconds[*] when using the
maximal prescaling of 72000 and maximum cycle count of 2^16.

But the code becomes incorrect when the period length approaches 1 second.
That's because of things like NS_PER_SEC / period.

[*] At the same time I must note that the KPI provides for maximum
period of about 4 seconds (2^32 nanoseconds).

MFC after: 2 weeks

3 years agoaw_pwm: ensure sane configuration, just in case
avg [Fri, 25 Sep 2020 07:40:56 +0000 (07:40 +0000)]
aw_pwm: ensure sane configuration, just in case

Make sure that the hardware is configured to cycle mode and that the
bypass is disabled.

MFC after: 2 weeks

3 years agoaw_pwm: fix programming of the period
avg [Fri, 25 Sep 2020 07:40:26 +0000 (07:40 +0000)]
aw_pwm: fix programming of the period

The programmed value is biased by one: 0 means 1 cycle,
1 means 2 cycles, etc.

MFC after: 3 weeks

3 years agoaw_pwm: fix selection of the prescaler
avg [Fri, 25 Sep 2020 07:40:02 +0000 (07:40 +0000)]
aw_pwm: fix selection of the prescaler

Prescaling divides the frequency, not multiplies it.

MFC after: 2 weeks

3 years agoaw_pwm: remove the busy bit check
avg [Fri, 25 Sep 2020 07:39:41 +0000 (07:39 +0000)]
aw_pwm: remove the busy bit check

The bit seems to always be set on my hardware, H3.
However, programming the hardware seems to work just fine.

MFC after: 3 weeks

3 years agoaw_pwm: trivially add H3 support
avg [Fri, 25 Sep 2020 07:39:14 +0000 (07:39 +0000)]
aw_pwm: trivially add H3 support

MFC after: 2 weeks

3 years agoamdtemp(4), amdsmn(4): Attach to Ryzen 4000 APU (Zen 2, "Renoir")
cem [Fri, 25 Sep 2020 04:16:28 +0000 (04:16 +0000)]
amdtemp(4), amdsmn(4): Attach to Ryzen 4000 APU (Zen 2, "Renoir")

PR: 249864
Reported by: Florian Millet <florian.millet AT laposte.net>
Tested by: Florian Millet

3 years agolib/libc/tests/iconv: raise WARNS to 6
asomers [Thu, 24 Sep 2020 21:42:44 +0000 (21:42 +0000)]
lib/libc/tests/iconv: raise WARNS to 6

MFC after: 2 weeks

3 years agolib/libc/tests/sys: raise WARNS to 6
asomers [Thu, 24 Sep 2020 21:39:09 +0000 (21:39 +0000)]
lib/libc/tests/sys: raise WARNS to 6

MFC after: 2 weeks

3 years agotcp(4): Add a reference for tcp_bbr(4) man page
gbe [Thu, 24 Sep 2020 19:59:29 +0000 (19:59 +0000)]
tcp(4): Add a reference for tcp_bbr(4) man page

3 years agoAdd missing file (tcp_bbr.4) from r366127
gbe [Thu, 24 Sep 2020 19:35:34 +0000 (19:35 +0000)]
Add missing file (tcp_bbr.4) from r366127

Reviewed by: bcr
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24915

3 years agoAdd a manual page for TCP BBR
gbe [Thu, 24 Sep 2020 19:33:48 +0000 (19:33 +0000)]
Add a manual page for TCP BBR

Reviewed by: bcr
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24915

3 years agoFix a typo in the 366098.
sobomax [Thu, 24 Sep 2020 19:12:03 +0000 (19:12 +0000)]
Fix a typo in the 366098.

Reported by: 0mp
MFC after: 2 weeks
(along with 366098)

3 years agocrypto_buffer(9): Add a HISTORY and a AUTHORS section
gbe [Thu, 24 Sep 2020 16:50:14 +0000 (16:50 +0000)]
crypto_buffer(9): Add a HISTORY and a AUTHORS section

Reviewed by: jhb
Approved by: jhb
Differential Revision: https://reviews.freebsd.org/D26487

3 years agoFix typo and environment variable macro
fernape [Thu, 24 Sep 2020 16:42:17 +0000 (16:42 +0000)]
Fix typo and environment variable macro

Follow up for r366119

Reported by: xtouqh@mm.st
Differential Revision: https://reviews.freebsd.org/D26182

3 years agofusefs: fix mmap'd writes in direct_io mode
asomers [Thu, 24 Sep 2020 16:27:53 +0000 (16:27 +0000)]
fusefs: fix mmap'd writes in direct_io mode

If a FUSE server returns FOPEN_DIRECT_IO in response to FUSE_OPEN, that
instructs the kernel to bypass the page cache for that file. This feature
is also known by libfuse's name: "direct_io".

However, when accessing a file via mmap, there is no possible way to bypass
the cache completely. This change fixes a deadlock that would happen when
an mmap'd write tried to invalidate a portion of the cache, wrongly assuming
that a write couldn't possibly come from cache if direct_io were set.

Arguably, we could instead disable mmap for files with FOPEN_DIRECT_IO set.
But allowing it is less likely to cause user complaints, and is more in
keeping with the spirit of open(2), where O_DIRECT instructs the kernel to
"reduce", not "eliminate" cache effects.

PR: 247276
Reported by: trapexit@spawn.link
Reviewed by: cem
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26485

3 years agowhich(1): Add EXAMPLES section to manpage
fernape [Thu, 24 Sep 2020 16:11:53 +0000 (16:11 +0000)]
which(1): Add EXAMPLES section to manpage

Add EXAMPLES section showing the use of -a and -s flags and how which(1)
treates duplicates.

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

3 years agoFix some signed/unsigned comparison warnings in NFS
asomers [Thu, 24 Sep 2020 15:38:01 +0000 (15:38 +0000)]
Fix some signed/unsigned comparison warnings in NFS

Reviewed by: rmacklem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26533

3 years agomgb.4: add note about experimental status
emaste [Thu, 24 Sep 2020 14:42:22 +0000 (14:42 +0000)]
mgb.4: add note about experimental status

Also remove HISTORY section until it is connected to the build.

3 years agoWhitespace changes.
tuexen [Thu, 24 Sep 2020 12:26:06 +0000 (12:26 +0000)]
Whitespace changes.

MFC after: 3 days

3 years agoRemove pointless local variable.
kib [Thu, 24 Sep 2020 12:14:25 +0000 (12:14 +0000)]
Remove pointless local variable.

Reported by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 6 days

3 years agoProvide MS() and SM() macros for 80211 and wireless drivers.
bz [Thu, 24 Sep 2020 10:57:39 +0000 (10:57 +0000)]
Provide MS() and SM() macros for 80211 and wireless drivers.

We have (two versions) of MS() and SM() macros which we use throughout
the wireless code.  Change all but three places (ath_hal, rtwn, and rsu)
to the newly provided _IEEE80211_MASKSHIFT() and _IEEE80211_SHIFTMASK()
macros.  Also change one internal case using both _S and _M instead of
just _S away from _M (one of the reasons rtwn and rsu were not changed).

This was done semi-mechanically.  No functional changes intended.

Requested by: gnn (D26091)
Reviewed by: adrian (pre line wrap)
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision: https://reviews.freebsd.org/D26539

3 years agoClean up the arm64 bus_dma_run_filter
andrew [Thu, 24 Sep 2020 10:42:28 +0000 (10:42 +0000)]
Clean up the arm64 bus_dma_run_filter

 - We can exit the loop as soon as the filter check passes.
 - The alignment check has already passed so there is no need to also run
   it here.

Sponsored by: Innovate UK

3 years agoEnsure arm64 DMA alignment is passed from parents to children
andrew [Thu, 24 Sep 2020 10:40:49 +0000 (10:40 +0000)]
Ensure arm64 DMA alignment is passed from parents to children

This ensures the alignment check will take these alignments into account.

Sponsored by: Innovate UK

3 years agoAdd danish translations provided by GitHub user scootergriesen
se [Thu, 24 Sep 2020 09:06:04 +0000 (09:06 +0000)]
Add danish translations provided by GitHub user scootergriesen

These translations did already exist in the index files for "vt".

Obtained from: https://github.com/scootergrisen/freebsd/

3 years agoRegen after r365903
lwhsu [Thu, 24 Sep 2020 08:51:23 +0000 (08:51 +0000)]
Regen after r365903

Sponsored by: The FreeBSD Foundation

3 years agoAdd missing declarations of 64-bit variants of bus_peek/bus_poke on amd64.
mmel [Thu, 24 Sep 2020 08:40:32 +0000 (08:40 +0000)]
Add missing declarations of 64-bit variants of bus_peek/bus_poke on amd64.
It fixes GENERIC-KCSAN build.

Reported by: rpokala
MFC after: 1 month
MFC with: r365899

3 years agoBounce in more cases in the arm64 busdma
andrew [Thu, 24 Sep 2020 07:17:05 +0000 (07:17 +0000)]
Bounce in more cases in the arm64 busdma

We need to use a bounce buffer when the memory we are operating on is not
aligned to a cacheline, and not aligned to the maps alignment.

The former is to stop other threads from dirtying the cacheline while we
are performing DMA operations with it. The latter is to check memory
passed in by a driver is correctly aligned for the device.

Reviewed by: mmel
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D26496

3 years agoEnsure we always align and size arm64 busdma allocations to a cacheline
andrew [Thu, 24 Sep 2020 07:13:13 +0000 (07:13 +0000)]
Ensure we always align and size arm64 busdma allocations to a cacheline

This will ensure nothing modifies the cacheline while DMA is in progress
so we won't need to bounce the data.

Reviewed by: mmel
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D26495

3 years agoDon't define _STANDALONE when building kernel modules.
imp [Thu, 24 Sep 2020 07:10:34 +0000 (07:10 +0000)]
Don't define _STANDALONE when building kernel modules.

_STANDALONE is only for the bootloader, not kernel modules. Remove it
from the build. This was harmless before, but sys/malloc.h now does
different things for the standalone environment, triggering the issue.

3 years agoAdd a coherent flag on the arm64 dma map struct
andrew [Thu, 24 Sep 2020 07:07:54 +0000 (07:07 +0000)]
Add a coherent flag on the arm64 dma map struct

Use it to decide if we can skip cache management.

While here remove the DMAMAP_COULD_BOUNCE flag as it's unneeded.

Reviewed by: mmel
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D26494

3 years agoAdd bounce helpers to the arm64 busdma
andrew [Thu, 24 Sep 2020 07:03:26 +0000 (07:03 +0000)]
Add bounce helpers to the arm64 busdma

Add helper functions to the arm64 busdma for common cases of checking if
we may need to bounce, and if we must bounce for a given address.

These will be expanded later as we handle cache-misaligned memory.

Reported by: mmel
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D26493

3 years agoCreate a standalone version of sys/malloc.h
imp [Thu, 24 Sep 2020 06:40:35 +0000 (06:40 +0000)]
Create a standalone version of sys/malloc.h

The ZSTD support for the boot loader will need to include files that
use the kernel's malloc interface. Create a standalone stub version
that's functional enough to allow this to work. There's some
limitations in this interface, and it's not quite a perfect
match. Specifically, M_WAITOK allocations can fail because there's
nothing that can be done we no memory is available.

3 years agoSlightly modify wording to better match nearby entries.
se [Thu, 24 Sep 2020 06:12:57 +0000 (06:12 +0000)]
Slightly modify wording to better match nearby entries.

MFC after: 3 days

3 years agocache: eliminate cache_zap_locked_vnode
mjg [Thu, 24 Sep 2020 03:38:32 +0000 (03:38 +0000)]
cache: eliminate cache_zap_locked_vnode

It is only ever called for negative entries and for those it is
just a wrapper around cache_zap_negative_locked_vnode_kl which
always succeeds.

This also fixes a bug where cache_lookup_fallback should have been
calling cache_zap_locked_bucket instead. Note that in order to trigger
the bug NOCACHE must not be set, which currently only happens when
creating a new coredump (and then the coredump-to-be has to have a
negative entry).

3 years agodd a new option (-H) to daemon(8) to catch SIGHUP and re-open output_file file when
sobomax [Thu, 24 Sep 2020 02:44:58 +0000 (02:44 +0000)]
dd a new option (-H) to daemon(8) to catch SIGHUP and re-open output_file file when
received.

The default system log rotation mechanism (newsyslog(8)) requires ability to send
signal to a daemon in order to properly complete rotation of the logs in an "atomic"
manner without having to making a copy and truncating original file. Unfortunately
our built-in mechanism to convert "dumb" programs into daemons has no way to handle
this rotation properly. This change adds this ability, to be enabled by supplying -H
option in addition to the -o option.

Reviewed by: markj, rpokala (manpages)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26526

3 years agoRemove stray lines
imp [Wed, 23 Sep 2020 22:49:27 +0000 (22:49 +0000)]
Remove stray lines

I snagged the license boiler plate. Fix that. also, it's spelled .Va
not .Vn. Plus " quoting issues.

Noticed by: rgrimes, xtouqh at hotmail dot com

3 years agotests: move the memfd tests over to sys/posixshm
kevans [Wed, 23 Sep 2020 19:54:59 +0000 (19:54 +0000)]
tests: move the memfd tests over to sys/posixshm

memfd_create is implemented on top of posixshm, so this is a logically
correct place for them to be. Moreover, this reduces the number of places to
look to run tests when working in this part of the tree.

Discussed with: kib (to some extent, a while ago)

3 years agoFlag vm_reserv and vm_phys sysctls as MPSAFE.
markj [Wed, 23 Sep 2020 19:36:07 +0000 (19:36 +0000)]
Flag vm_reserv and vm_phys sysctls as MPSAFE.

Nothing in these subsystems relies on Giant.

MFC after: 1 week

3 years agoAdd a vmparam.h constant indicating pmap support for large pages.
markj [Wed, 23 Sep 2020 19:34:21 +0000 (19:34 +0000)]
Add a vmparam.h constant indicating pmap support for large pages.

Enable SHM_LARGEPAGE support on arm64.

Reviewed by: alc, kib
Sponsored by: Juniper Networks, Inc., Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26467

3 years agoAdd largepage support to the arm64 pmap.
markj [Wed, 23 Sep 2020 19:33:47 +0000 (19:33 +0000)]
Add largepage support to the arm64 pmap.

Reviewed by: alc, kib
Sponsored by: Juniper Networks, Inc., Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26466

3 years agoUse envvar rather than nonstandard hint. lines
imp [Wed, 23 Sep 2020 19:18:53 +0000 (19:18 +0000)]
Use envvar rather than nonstandard hint. lines

The NOTES files have a bunch of hint lines that are removed when
generating LINT. However, we can achieve the same effect by prepending
each of the lines with 'envvar' so the NOTES files become standard
config(8) files. No functional changes as the sed script to generate
the LINT files filters these either way.

Suggested by: kevans

3 years agoloader: fix non-zfs build
tsoome [Wed, 23 Sep 2020 19:15:22 +0000 (19:15 +0000)]
loader: fix non-zfs build

We can not include zfs headers while building without zfs.

Reported by: Oscar Holmlund

3 years agoriscv: Trap cleanup - use nitems()
nick [Wed, 23 Sep 2020 18:54:14 +0000 (18:54 +0000)]
riscv: Trap cleanup - use nitems()

No functional changes, just cleanup.

Reviewed by: kp
Approved by: kp (mentor)
Sponsored by: Axiado

3 years agoDo not leak oldvmspace if image activation failed
kib [Wed, 23 Sep 2020 18:03:07 +0000 (18:03 +0000)]
Do not leak oldvmspace if image activation failed

and current address space is already destroyed, so kern_execve()
terminates the process.

While there, clean up some internals of post_execve() inlined in init_main.

Reported by: Peter <pmc@citylink.dinoex.sub.org>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26525

3 years agonextboot(8): Fix behavior on non-ZFS /boot systems
cem [Wed, 23 Sep 2020 17:04:27 +0000 (17:04 +0000)]
nextboot(8): Fix behavior on non-ZFS /boot systems

Fix unquoted test for an empty value, which broke nextboot(8) on non-ZFS /boot
systems after r365938.

Discussed with: allanjude, tsoome
X-MFC-With: r365938

3 years agoremove reference to obsolete arm NOTES files
emaste [Wed, 23 Sep 2020 14:52:43 +0000 (14:52 +0000)]
remove reference to obsolete arm NOTES files

We left these in the clean rule to avoid having stale files remain in
working trees, but enough time has now passed that it's no longer
relevant.

Discussed with: imp

3 years agobyacc: fix UBSan signed shift range error
arichardson [Wed, 23 Sep 2020 12:54:42 +0000 (12:54 +0000)]
byacc: fix UBSan signed shift range error

I've submitted this patch upstream, so apply this to contrib/ until a new
version containing this change has been released.

Reviewed By: jkim
Differential Revision: https://reviews.freebsd.org/D26505

3 years agoAdd github CI for testing cross-building from Linux and macOS
arichardson [Wed, 23 Sep 2020 12:54:37 +0000 (12:54 +0000)]
Add github CI for testing cross-building from Linux and macOS

This builds the kernel-toolchain target and an amd64 GENERIC kernel on
Ubuntu 18.04, 20.04 and the latest macOS to ensure that new changes
don't regress building on non-FreeBSD hosts.

Reviewed By: emaste, lwhsu
Differential Revision: https://reviews.freebsd.org/D26512

3 years agoBump __FreeBSD_version after cache_purgevfs change
mjg [Wed, 23 Sep 2020 11:02:23 +0000 (11:02 +0000)]
Bump __FreeBSD_version after cache_purgevfs change

3 years agocache: drop the force flag from purgevfs
mjg [Wed, 23 Sep 2020 10:46:07 +0000 (10:46 +0000)]
cache: drop the force flag from purgevfs

The optional scan is wasteful, thus it is removed altogether from unmount.

Callers which always want it anyway remain unaffected.