Commit Graph

253484 Commits

Author SHA1 Message Date
Kyle Evans
7cc42f6d25 Do a sweep and remove most WARNS=6 settings
Repeating the default WARNS here makes it slightly more difficult to
experiment with default WARNS changes, e.g. if we did something absolutely
bananas and introduced a WARNS=7 and wanted to try lifting the default to
that.

Drop most of them; there is one in the blake2 kernel module, but I suspect
it should be dropped -- the default WARNS in the rest of the build doesn't
currently apply to kernel modules, and I haven't put too much thought into
whether it makes sense to make it so.
2020-10-01 01:10:51 +00:00
Rick Macklem
9f669985b2 Modify the NFSv4.2 VOP_COPY_FILE_RANGE() client call to return after one
successful RPC.

Without this patch, the NFSv4.2 VOP_COPY_FILE_RANGE() client call would
loop until the copy "len" was completed.  The problem with doing this is
that it might take a considerable time to complete for a large "len".
By returning after a single successful Copy RPC that copied some of the
data, the application that did the copy_file_range(2) syscall will be
more responsive to signal delivery for large "len" copies.
2020-10-01 00:47:35 +00:00
Rick Macklem
961afe3c99 Clip the "len" argument to vn_generic_copy_file_range() at a
hole size boundary.

By clipping the len argument of vn_generic_copy_file_range() to end at
an exact multiple of hole size, holes are more likely to be maintained
during the copy.
A hole can still straddle the boundary at the end of the
copy range, resulting in a block being allocated in the
output file as it is being grown in size, but this will reduce the
likelyhood of this happening.

While here, also modify setting of blksize to better handle the
case where _PC_MIN_HOLE_SIZE is returned as 1.

Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D26570
2020-10-01 00:33:44 +00:00
Konstantin Belousov
96128185f6 pciconf: print PCIe CTL max read request.
To not complicate existing parsers, the value is printed on a new
output line.

Sponsored by:	Mellanox Technologies/NVIDIA Networking
MFC after:	1 week
2020-09-30 21:12:14 +00:00
John Baldwin
8128c65b4c Avoid a dubious assignment to bio_data in aio_qbio().
A user pointer is not a suitable value for bio_data and the next block
of code always overwrites bio_data anyway.  Just use cb->aio_buf
directly in the call to vm_fault_quick_hold_pages().

Reviewed by:	kib
Obtained from:	CheriBSD
MFC after:	1 month
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26595
2020-09-30 17:49:06 +00:00
Emmanuel Vadot
6b74091dd5 ahci_generic: add quirk for NXP0004 (NXP Layerscape LX2160A)
This fixes this error :
(aprobe3:ahcich3:0:15:0): NOP FLUSHQUEUE. ACB: 00 00 00 00 00 00 00 00 00 00 00 00
(aprobe3:ahcich3:0:15:0): CAM status: Command timeout
(aprobe3:ahcich3:0:15:0): Error 5, Retries exhausted

Submitted by:	Greg V <greg@unrelenting.technology>
Reviewed by:	imp, mav
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25157
2020-09-30 17:10:49 +00:00
Emmanuel Vadot
a52c8a6502 acpi_resource: support multiple IRQs
Some DSDT entries have multiple interrupts for one device.
Add support for it.

This fixes ahci on NXP LS2160 and genet on RPi4

Submitted by:	Greg V <greg@unrelenting.technology>
Reviewed by:	jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25145
2020-09-30 17:09:17 +00:00
Mateusz Guzik
4301a5a794 cache: push the lock into cache_purge_impl 2020-09-30 17:08:34 +00:00
Conrad Meyer
a91812f69f gdb(4): Don't escape GDB special characters at application layer
In r351368, we introduced this XML- and GDB-encoded data.  The protocol
'offset' should reflex the logical XML data offset, but unfortunately we
counted the GDB escapes as well.

In fact, we cannot safely do GDB character escaping at this layer at
all, because we don't know what will be flushed in a packet.  It is
bogus to send only the first character of a two-character escape
sequence.

This patch "corrects" the problem by squashing these characters in the
transmitted XML document.  It would be nice to transmit the characters
faithfully, but that is a more complicated change.  Thread names are a
nice convenience feature for the GDB client, but one can always inspect
td_name or p_comm directly to find the true name.

Reported by:	Ka Ho Ng <khng300 AT gmail.com>
Tested by:	Ka Ho Ng
Reviewed by:	emaste, markj, rlibby
Differential Revision:	https://reviews.freebsd.org/D26599
2020-09-30 14:55:54 +00:00
Cy Schubert
d9bc41a1c2 Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after:	1 week
2020-09-30 08:26:25 +00:00
Cy Schubert
6dbd2fb858 ipfilter getifname ifdef cleanup.
MFC after:	2 months
2020-09-30 08:26:22 +00:00
Cy Schubert
2c1685f369 Resurrect ipfilter's getifname, replacing the stub with the real
function.

MFC after:	2 months
2020-09-30 08:26:00 +00:00
Kristof Provost
0d3aa0fb64 riscv: Panic on PMP errors
Load/store/fetch access exceptions always indicate a violation of a PMP
rule. We can't treat those as page faults, because updating the page
table and trying again will only result in exactly the same access
exception recurring. This leaves us in an endless exception loop.

We cannot recover from these exceptions, so panic instead.

Reviewed by:	jhb
Sponsored by:	Axiado
Differential Revision:	https://reviews.freebsd.org/D26544
2020-09-30 08:23:43 +00:00
Mateusz Guzik
d4cac59429 cache: use cache_has_entries where appropriate instead of opencoding it 2020-09-30 04:27:38 +00:00
Jessica Clarke
7de649170f riscv: Define __PCI_REROUTE_INTERRUPT
Every other architecture defines this and this is required for
interrupts to work when using QEMU's PCI VirtIO devices (which all
report an interrupt line of 0) for two reasons.

Firstly, interrupt line 0 is wrong; they use one of 0x20-0x23 with the
lines being cycled across devices like normal. Moreover, RISC-V uses
INTRNG, whose IRQs are virtual as indices into its irq_map, so even if
we have the right interrupt line we still need to try and route the
interrupt in order to ultimately call into intr_map_irq and get back a
unique index into the map for the given line, otherwise we will use
whatever happens to be in irq_map[line] (which for QEMU where the line
is initialised to 0 results in using the first allocated interrupt,
namely the RTC on IRQ 11 at time of commit).

Note that pci_assign_interrupt will still do the wrong thing for INTRNG
when using a tunable, as it will bypass INTRNG entirely and use the
tunable's value as the index into irq_map, when it should instead
(indirectly) call intr_map_irq to allocate a new entry for the given
IRQ and treat the tunable as stating the physical line in use, which is
what one would expect. This, however, is a problem shared by all INTRNG
architectures, and not exclusive to RISC-V.

Reviewed by:	kib
Approved by:	kib
Differential Revision:	https://reviews.freebsd.org/D26564
2020-09-30 02:21:38 +00:00
Rick Macklem
164aa1e941 Make copy_file_range(2) Linux compatible for overflow of offset + len.
Without this patch, if a call to copy_file_range(2) specifies an input file
offset + len that would wrap around, EINVAL is returned.
I thought that was the Linux behaviour, but recent testing showed that
Linux accepts this case and does the copy_file_range() to EOF.

This patch changes the FreeBSD code to exhibit the same behaviour as
Linux for this case.

Reviewed by:	asomers, kib
Differential Revision:	https://reviews.freebsd.org/D26569
2020-09-30 02:18:09 +00:00
Kyle Evans
55be47b894 Makefile.inc1: sysent: allow subordinate sysent targets to run in parallel
makesyscalls.lua (and indeed makesyscalls.sh) are both safe to be run in
parallel, so let's do it.

This is a trivial difference because runtime per-target is pretty small, but
I like seeing it run in parallel when my muscle memory types `make -sj4`.

Reviewed by:	brooks, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26594
2020-09-30 00:47:57 +00:00
Brooks Davis
78380908e5 Hoist comment on fixup of ld path
Reported by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D26591
2020-09-29 23:48:05 +00:00
Mitchell Horne
fe9602fbf8 arm64: set the correct HWCAP
This appears to be a typo. The AdvSIMD field encodes support for
half-precision floating point SIMD instructions, which corresponds to
HWCAP_ASIMDHP, not HWCAP_ASIMDDP.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2020-09-29 23:21:56 +00:00
Brooks Davis
17b8b8fb5f Prefer --ld-path=/path/to/ld on clang >= 12
Clang 12 warns about passing a path to -fuse-ld and -Werror makes that
an error preventing building world without this change.

Reviewed by:	arichardson, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26591
2020-09-29 22:30:15 +00:00
John Baldwin
0e99339684 Fallback to software for more GCM and CCM requests.
ccr(4) uses software to handle GCM and CCM requests not supported by
the crypto engine (e.g. with only AAD and no payload).  This change
adds a fallback for a few more requests such as those with more SGL
entries than can fit in a work request (this can happen for GCM when
decrypting a TLS record split across 15 or more packets).

Reported by:	Chelsio QA
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D26582
2020-09-29 21:51:32 +00:00
Bjoern A. Zeeb
3917c9ba65 rtwn: narrow the epoch area
Rather than placing the epoch around the entire receive loop which
might call into rtwn_rx_frame() and USB and sleep, split the loop
into two[1] and leave us with one unlock/lock cycle as well.

PR:		249925
Reported by:	thj, (rkoberman gmail.com)
Tested by:	thj
Suggested by:	adrian [1]
Reviewed by:	adrian
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation (initially, paniced my iwl lab host)
Differential Revision:	https://reviews.freebsd.org/D26554
2020-09-29 20:46:25 +00:00
Ruslan Bukin
6186bfbd18 Rename kernel option ACPI_DMAR to IOMMU.
This is mostly needed for a common arm64/amd64 iommu code.

Reviewed by:	kib
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D26587
2020-09-29 20:29:07 +00:00
Warner Losh
61c4a6f317 Updates to chroot(2) docs
1. Note what settings give historic behavior
2. Recommend jail under security considerations.
2020-09-29 18:13:54 +00:00
Warner Losh
dc761d84e2 Standalone SX shims
Create a do-nothing version of SX locks. OpenZFS needs them. However,
since the boot loader is single threaded, they can be nops.
2020-09-29 18:06:02 +00:00
Fernando Apesteguía
cf0fd1f84a kldconfig(8): Add EXAMPLES to the man page
Add EXAMPLES section to the man page showing the use of all flags except for
-S.

While here, clarify -f description. It not only suppresses diagnostic messages
but it also affects the exit status of the command itself. This is shown in two
of the examples.

Approved by:	bcr@
Differential Revision:	https://reviews.freebsd.org/D26588
2020-09-29 17:52:15 +00:00
Warner Losh
6ab1ffcbfe Implement some time variables from kernel
OpenZFS will start using some of the kernel timekeeping bits
shortly. This implements the bare minimum of that which currently
is just the time_seconds variable.
2020-09-29 16:29:50 +00:00
Ruslan Bukin
025730aad6 o Rename acpi_iommu_get_dma_tag() -> iommu_get_dma_tag().
This function isn't ACPI dependent and we may use it on FDT systems
  as well.
o Don't repeat the function declaration, include iommu.h instead.

Reviewed by:	andrew, kib
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D26584
2020-09-29 15:10:56 +00:00
Mark Johnston
752c1d14e3 ZFS: Fix a logic bug in the FreeBSD getpages VOP
This was introduced when I merged r361287 to OpenZFS and has been fixed
there already, commit 3f6bb6e43fd68e.

Reported by:	swills
Reviewed by:	allanjude, freqlabs, mmacy
2020-09-29 13:41:47 +00:00
Edward Tomasz Napierala
39e75a5a79 Build debug kernels with -O2.
LLVM 11 changed the meaning of '-O' from '-O2' to '-O1', which resulted
in debug kernels (with 'makeoptions DEBUG=-g') being built with inlining
disabled, causing severe performance hit.

The -O2 was already being used for building amd64, powerpc, and powerpcspe.

Discussed with:	jrtc27, arichardson, bdragon, jhibbits
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26471
2020-09-29 11:48:22 +00:00
Edward Tomasz Napierala
3409864922 Use the 'traced' variable instead of comparing p->p_flag again.
Reviewed by:	kib
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26577
2020-09-29 11:18:48 +00:00
Mateusz Piotrowski
c9370e5cec Bump manual page date after 366243
While here, address mandoc warnings.
2020-09-29 10:07:46 +00:00
Michael Tuexen
b15f541113 Improve the input validation and processing of cookies.
This avoids setting the association in an inconsistent
state, which could result in a use-after-free situation.
This can be triggered by a malicious peer, if the peer
can modify the cookie without the local endpoint recognizing
it.
Thanks to Ned Williamson for reporting the issue.

MFC after:		3 days
2020-09-29 09:36:06 +00:00
Navdeep Parhar
822967e7e5 cxgbe(4): Avoid unnecessary work in the firmware during netmap tx.
Bind the netmap tx queues to a special '0xff' scheduling class which
makes the firmware skip some processing related to rate limiting on the
outgoing traffic.  Future firmwares will do this automatically.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-09-29 09:25:52 +00:00
Navdeep Parhar
7efe256233 Remove duplicate line. 2020-09-29 09:11:51 +00:00
Navdeep Parhar
15ca0766ed cxgbe(4): adjust the doorbell threshold for netmap freelists to match the
maximum burst size used when fetching descriptors from the list.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-09-29 07:51:06 +00:00
Navdeep Parhar
f7b8615af5 cxgbe(4): display an error message when netmap cannot be enabled because
the interface is down.

MFC after:	1 week
2020-09-29 07:36:21 +00:00
Greg Lehey
314c5b3583 Document the fact (bug?) that the -a option will normally process
root's calendar files three times, once each for root, toor and
daemon.

This relates to bug 246943, but does not solve it.  See discussion in
bug report for more details.

PR:		246943
Reported by:	wcarson.bugzilla@disillusion.net
2020-09-29 05:49:45 +00:00
Navdeep Parhar
a9f476580e cxgbe(4): fixes for netmap operation with only some queues active.
- Only active netmap receive queues should be in the RSS lookup table.

- The RSS table should be restored for NIC operation when the last
  active netmap queue is switched off, not the first one.

- Support repeated netmap ON/OFF on a subset of the queues.  This works
  whether the the queues being enabled and disabled are the only ones
  active or not.  Some kring indexes have to be reset in the driver for
  the second case.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-09-29 05:08:45 +00:00
Konstantin Belousov
34d7dd1561 procstat: Fix regression after 365880.
Basically it reverts one chunk that reversed the parsing logic, making
legacy variants of invocation, like `procstat -a -f', non-operational.

Reported and tested by:	Dewayne Geraghty <dewayne@heuristicsystems.com.au>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2020-09-29 00:20:58 +00:00
Kyle Evans
5f0601fd19 Address whitespace nits in subr_rtc.c
These were separated out from a nearby patch from Andrew Gierth.

MFC after:	3 days
2020-09-28 17:19:57 +00:00
Ed Maste
c1aedfcbd9 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
2020-09-28 16:54:39 +00:00
Warner Losh
ab3f5b6ef2 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
2020-09-28 16:19:29 +00:00
Warner Losh
8f3b36103b 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
2020-09-28 16:19:21 +00:00
Michael Tuexen
fbc6840bae Minor cleanup.
MFC after:		3 days
2020-09-28 14:11:53 +00:00
Michal Meloun
722779c7dd 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
2020-09-28 09:16:27 +00:00
Warner Losh
4c4e2b3de3 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.
2020-09-28 06:00:56 +00:00
Warner Losh
d53ed73590 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
2020-09-28 06:00:39 +00:00
Xin LI
5e8221100a Use %ju and cast to (uintmax_t) to avoid using PRI* macros.
Suggested by:	kevlo
2020-09-28 04:30:31 +00:00
Konstantin Belousov
b65eb2f8a8 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
2020-09-27 23:01:54 +00:00