]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agostrerror.3: Fix whitespace issue introduced in r368714
jrtc27 [Fri, 18 Dec 2020 22:10:17 +0000 (22:10 +0000)]
strerror.3: Fix whitespace issue introduced in r368714

MFC with: 368714

3 years agoSwitch direct rt fields access in rtsock.c to newly-create field acessors.
melifaro [Fri, 18 Dec 2020 22:00:57 +0000 (22:00 +0000)]
Switch direct rt fields access in rtsock.c to newly-create field acessors.

rtsock code was build around the assumption that each rtentry record
 in the system radix tree is a ready-to-use sockaddr. This assumptions
 turned out to be not quite true:
* masks have their length tweaked, so we have rtsock_fix_netmask() hack
* IPv6 addresses have their scope embedded, so we have another explicit
 deembedding hack.

Change the code to decouple rtentry internals from rtsock code using
 newly-created rtentry accessors. This will allow to eventually eliminate
 both of the hacks and change rtentry dst/mask format.

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

3 years agoSkip the vm.pmap.kernel_maps sysctl by default.
jhb [Fri, 18 Dec 2020 20:41:23 +0000 (20:41 +0000)]
Skip the vm.pmap.kernel_maps sysctl by default.

This sysctl node can generate very verbose output, so don't trigger it
for sysctl -a or sysctl vm.pmap.

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

3 years agoriscv: report additional known SBI implementations
mhorne [Fri, 18 Dec 2020 20:10:30 +0000 (20:10 +0000)]
riscv: report additional known SBI implementations

These implementation IDs are defined in the SBI spec, so we should print
their name if detected.

Submitted by: Danjel Qyteza <danq1222@gmail.com>
Reviewed by: jhb, kp
Differential Revision: https://reviews.freebsd.org/D27660

3 years agoarm64: rk3399: Export the watchdog clock
manu [Fri, 18 Dec 2020 16:55:54 +0000 (16:55 +0000)]
arm64: rk3399: Export the watchdog clock

This clock is used by the watchdog IP and can be controlled only
in the secure world.

3 years agoamd64: use register macros for gdb_cpu_getreg()
mhorne [Fri, 18 Dec 2020 16:16:03 +0000 (16:16 +0000)]
amd64: use register macros for gdb_cpu_getreg()

Prefer these newly-added definitions to bare values.

MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.

3 years agoamd64: allow gdb(4) to write to most registers
mhorne [Fri, 18 Dec 2020 16:09:24 +0000 (16:09 +0000)]
amd64: allow gdb(4) to write to most registers

Similar to the recent patch to arm's gdb stub in r368414, allow GDB to
update the contents of most general purpose registers.

Reviewed by: cem, jhb, markj
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
NetApp PR: 44
Differential Revision: https://reviews.freebsd.org/D27642

3 years agoacpi: Ensure that adjacent memory affinity table entries are coalesced
markj [Fri, 18 Dec 2020 16:04:48 +0000 (16:04 +0000)]
acpi: Ensure that adjacent memory affinity table entries are coalesced

The SRAT may contain multiple distinct entries that together describe a
contiguous region of physical memory.  In this case we were not
coalescing the corresponding entries in the memory affinity table, which
led to fragmented phys_avail[] entries.  Since r338431 the vm_phys_segs[]
entries derived from phys_avail[] will be coalesced, resulting in a
situation where vm_phys_segs[] entries do not have a covering
phys_avail[] entry.  vm_page_startup() will not add such segments to the
physical memory allocator, leaving them unused.

Reported by: Don Morris <dgmorris@earthlink.net>
Reviewed by: kib, vangyzen
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27620

3 years agoFix the ipfw service status output when ipfw.ko isn't loaded
markj [Fri, 18 Dec 2020 16:02:28 +0000 (16:02 +0000)]
Fix the ipfw service status output when ipfw.ko isn't loaded

Reported by: lme
Reviewed by: lme
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27657

3 years agovirtio_mmio: Fix feature negotiation copy-paste issue in r361943
jrtc27 [Fri, 18 Dec 2020 15:07:14 +0000 (15:07 +0000)]
virtio_mmio: Fix feature negotiation copy-paste issue in r361943

This caused us to write to the low half of the feature word twice, once with
the high bits and once with the low bits. Common legacy device implementations
seem to be fairly lenient about being able to write to the feature bits
multiple times, but Arm's models use a stricter implementation that will ignore
the second write. This fixes using vtnet(4) on those models.

Reported by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Pointy hat: jrtc27

3 years agoFix abort in jemalloc extent coalescing.
mw [Fri, 18 Dec 2020 10:09:21 +0000 (10:09 +0000)]
Fix abort in jemalloc extent coalescing.

Fix error in extent_try_coalesce_impl(), which could cause abort
to happen when trying to coalesce extents backwards. The error could
happen because of how extent_before_get() function works. This function
gets address of previous extent, by subtracting page size from current
extent address. If current extent is located at PAGE_SIZE offset, this
address resolved to 0x0000. An assertion in rtree_leaf_elm_lookup
then caused the running program to abort.

This problem was discovered when trying to build world on 32-bit
machines with ASLR and PIE enabled. The problem was encountered
on armv7 and i386 machines, but most likely other 32-bit
architectures are affected as well.

While this patch fixes one problem with buildworld on 32-bit platforms
with ASLR, the build still fails, however it happens much later
and due to lack of memory.

The change is aligned with accepted fix in the upstream Jemalloc
repository (https://github.com/jemalloc/jemalloc/pull/1973).
As it doesn't apply on top of Jemalloc tree, its updated version
was eventually merged: https://github.com/jemalloc/jemalloc/pull/2003

PR: 249937
Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D27025

3 years agotools/tools/locale: fix static-colldef
yuripv [Fri, 18 Dec 2020 08:43:06 +0000 (08:43 +0000)]
tools/tools/locale: fix static-colldef

3 years agoMFV r368746:
delphij [Fri, 18 Dec 2020 04:23:20 +0000 (04:23 +0000)]
MFV r368746:

Apply upstream fix 08968baec1122a58bb90d8f97ad948a75f8a5d69:

Fix error cases when udp-connect is set and send() returns an error

Obtained from: unbound git
MFC after: 3 days

3 years agotools/tools/locale: install generated files in current src checkout
yuripv [Fri, 18 Dec 2020 04:01:05 +0000 (04:01 +0000)]
tools/tools/locale: install generated files in current src checkout

3 years agopci_iov: When pci_iov_detach(9) is called, destroy VF children
kib [Fri, 18 Dec 2020 03:46:50 +0000 (03:46 +0000)]
pci_iov: When pci_iov_detach(9) is called, destroy VF children

instead of bailing out with EBUSY if there are any.

If driver module is unloaded, or just device is forcibly detached from
the driver, there is no way for driver to correctly unload otherwise.
Esp. if there are resources dedicated to the VFs which prevent turning
down other resources.

Reviewed by: jhb
Sponsored by: Mellanox Technologies / NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27615

3 years agoFix issues with various VNC clients.
grehan [Fri, 18 Dec 2020 00:38:48 +0000 (00:38 +0000)]
Fix issues with various VNC clients.

- support VNC version 3.3 (macos "Screen Sharing" builtin client)
- wait until client has requested an update prior to sending framebuffer data
- don't send an update if no framebuffer updates detected
- increase framebuffer poll frequency to 30Hz, and double that when
  kbd/mouse input detected
- zero uninitialized array elements in rfb_send_server_init_msg()
- fix overly large allocation in rfb_init()
- use atomics for flags shared between input and output threads
- use #defines for constants

 This work was contributed by Marko Kiiskila, with reuse of some earlier
work by Henrik Gulbrandsen.

Clients tested :
FreeBSD-current
 - tightvnc
 - tigervnc
 - krdc
 - vinagre

Linux (Ubuntu)
 - krdc
 - vinagre
 - tigervnc
 - xtightvncviewer
 - remmina

MacOS
 - VNC Viewer
 - TigerVNC
 - Screen Sharing (builtin client)

Windows 10
 - Tiger VNC
 - VNC Viewer (cursor lag)
 - UltraVNC (cursor lag)

o/s independent
 - noVNC (browser) using websockify relay

PR: 250795
Submitted by: Marko Kiiskila <marko@apache.org>
Reviewed by: jhb (bhyve)
MFC after: 3 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27605

3 years agoice: quiet -Wredundant-decls
rlibby [Thu, 17 Dec 2020 22:53:45 +0000 (22:53 +0000)]
ice: quiet -Wredundant-decls

Reapply r364240 after driver update in r365617.

Reviewed by: lwhsu
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27561

3 years agoVFS_QUOTACTL: Remove needless casts of arg
brooks [Thu, 17 Dec 2020 21:58:10 +0000 (21:58 +0000)]
VFS_QUOTACTL: Remove needless casts of arg

The argument is a void * so there's no need to cast it to caddr_t.

Update documentation to match function decleration.

Reviewed by: freqlabs
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27093

3 years agonet tests: Re-enable most if_clone tests
kp [Thu, 17 Dec 2020 21:54:25 +0000 (21:54 +0000)]
net tests: Re-enable most if_clone tests

All but one of these (tap_ipv6_up_stress) currently pass, so we should enable
them so we don't regress.

3 years agoFix f_pkt_into_t typo.
mav [Thu, 17 Dec 2020 21:02:58 +0000 (21:02 +0000)]
Fix f_pkt_into_t typo.

MFC after: 1 week

3 years agoUse __containerof() instead of home-rolled versions.
jhb [Thu, 17 Dec 2020 20:45:10 +0000 (20:45 +0000)]
Use __containerof() instead of home-rolled versions.

Reviewed by: imp, hselasky
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27582

3 years agoDescribe the commit message template our git hook script produces
emaste [Thu, 17 Dec 2020 20:31:45 +0000 (20:31 +0000)]
Describe the commit message template our git hook script produces

Reported by: rpokala

3 years agoUse a template assembly file for firmware object files.
jhb [Thu, 17 Dec 2020 20:31:17 +0000 (20:31 +0000)]
Use a template assembly file for firmware object files.

Similar to r366897, this uses the .incbin directive to pull in a
firmware file's contents into a .fwo file.  The same scheme for
computing symbol names from the filename is used as before to maximize
compatiblity and not require rebuilding existing .fwo files for
NO_CLEAN builds.  Using ld -o binary requires extra hacks in linkers
to either specify ABI options (e.g. soft- vs hard-float) or to ignore
ABI incompatiblities when linking certain objects (e.g.  object files
with only data).  Using the compiler driver avoids the need for these
hacks as the compiler driver is able to set all the appropriate ABI
options.

Reviewed by: imp, markj
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27579

3 years agoCleanups to *ERR* compat shims.
jhb [Thu, 17 Dec 2020 20:28:53 +0000 (20:28 +0000)]
Cleanups to *ERR* compat shims.

- Use [u]intptr_t casts to convert pointers to integers.

- Change IS_ERR* to return bool instead of long.

Reviewed by: manu
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27577

3 years agochmod +x the git commit message prep hook
emaste [Thu, 17 Dec 2020 20:11:31 +0000 (20:11 +0000)]
chmod +x the git commit message prep hook

3 years agoAdd initial version of git commit message preparation hook
emaste [Thu, 17 Dec 2020 19:58:29 +0000 (19:58 +0000)]
Add initial version of git commit message preparation hook

Start with a slightly modified version of the SVN commit template, to
allow developers to experiment.  This will be updated in the future as
our process and techniques evolve.

This can be installed by copying or symlinking into the .git/hooks/
directory.

Feedback from: cem, jhb
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27633

3 years agoFix a race in tty_signal_sessleader() with unlocked read of s_leader.
kib [Thu, 17 Dec 2020 19:51:39 +0000 (19:51 +0000)]
Fix a race in tty_signal_sessleader() with unlocked read of s_leader.

Since we do not own the session lock, a parallel killjobc() might
reset s_leader to NULL after we checked it.  Read s_leader only once
and ensure that compiler is not allowed to reload.

While there, make access to t_session somewhat more pretty by using
local variable.

PR: 251915
Submitted by: Jakub Piecuch <j.piecuch96@gmail.com>
MFC after: 1 week

3 years agoUpdate the unbound version number from r368478.
cy [Thu, 17 Dec 2020 19:50:41 +0000 (19:50 +0000)]
Update the unbound version number from r368478.

Updating the version number is an extra manual step.

Pointy hat to: cy
Reported by: Herbert J. Skuhra <herbert _ gojira.at>
MFC after: 3 days

3 years agofd: reimplement close_range to avoid spurious relocking
mjg [Thu, 17 Dec 2020 18:52:30 +0000 (18:52 +0000)]
fd: reimplement close_range to avoid spurious relocking

3 years agoaudit: rework AUDIT_SYSCLOSE
mjg [Thu, 17 Dec 2020 18:52:04 +0000 (18:52 +0000)]
audit: rework AUDIT_SYSCLOSE

This in particular avoids spurious lookups on close.

3 years agofd: refactor closefp in preparation for close_range rework
mjg [Thu, 17 Dec 2020 18:51:09 +0000 (18:51 +0000)]
fd: refactor closefp in preparation for close_range rework

3 years agolualoader: fix lua-lint run
kevans [Thu, 17 Dec 2020 18:29:30 +0000 (18:29 +0000)]
lualoader: fix lua-lint run

luacheck rightfully complains that i is unused in the show-module-options
loop at the end (it was used for some debugging in the process).

We've added a new pager module that's compiled in, so declare that as an
acceptable global.

3 years agolualoader: cli: provide a show-module-options loader command
kevans [Thu, 17 Dec 2020 18:24:36 +0000 (18:24 +0000)]
lualoader: cli: provide a show-module-options loader command

This effectively dumps everything lualoader knows about to the console using
the libsa pager; that particular lua interface was added in r368591.

A pager stub implementation has been added that just dumps the output as-is
as a compat shim for older loader binaries that do not have lpager. This
stub should be moved into a more appropriate .lua file if we add anything
else that needs the pager.

3 years ago[ng_socket] Don't take the SOCKBUF_LOCK() twice in the RX data path.
afedorov [Thu, 17 Dec 2020 18:15:07 +0000 (18:15 +0000)]
[ng_socket] Don't take the SOCKBUF_LOCK() twice in the RX data path.

This is just a minor optimization, but it's sensitive. This gives an improvement of 30-50 kpps.

Reviewed by: kp, markj, glebius, lutz_donnerhacke.de
Approved by: vmaffione (mentor)
Sponsored by: vstack.com
Differential Revision: https://reviews.freebsd.org/D27382

3 years agoAdd IRQ resource to SPIBUS
manu [Thu, 17 Dec 2020 17:11:14 +0000 (17:11 +0000)]
Add IRQ resource to SPIBUS

Add capability to SPIBUS to have child device with IRQ.
For example many ADC chip have a dedicated pin to signal "data ready"
and the host can just wait for a interrupt to go out and read the result.

It is the same code as in R282674 and R282702 for IICBUS by Michal Meloun

Submitted by: Oskar Holmund <oskar.holmlund@ohdata.se>
Differential Revision: https://reviews.freebsd.org/D27396

3 years agoarm: Remove samsung exnynos port
manu [Thu, 17 Dec 2020 17:09:43 +0000 (17:09 +0000)]
arm: Remove samsung exnynos port

Remove the exynos SoC support, this haven't been updated in a while,
isn't present in GENERIC and nobody is motivated to resurect it.

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

3 years agoChange POSIX compliance level for visibility of strerror_l(3).
kib [Thu, 17 Dec 2020 17:08:25 +0000 (17:08 +0000)]
Change POSIX compliance level for visibility of strerror_l(3).

Third-party code tests for strerror_l(3) without specifying
_POSIX_SOURCE, and then expects that the function is prototyped with
_POSIX_SOURCE set to 200112.

Reported and tested by: antoine
Sponsored by: The FreeBSD Foundation
MFC after: 13 days

3 years agokyua: Only install examples if requested
manu [Thu, 17 Dec 2020 17:06:57 +0000 (17:06 +0000)]
kyua: Only install examples if requested

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D27638

3 years agoDrop EFI_STAGING_SIZE back down to 64M
imp [Thu, 17 Dec 2020 17:02:09 +0000 (17:02 +0000)]
Drop EFI_STAGING_SIZE back down to 64M

vmware can't cope with anything larger than 64MB. Drop this back to
64MB everywhere but arm.

PR: 251866
MFC After: 1 week

3 years ago[bhyve] virtio-net: Do not allow receiving packets until features have been negotiated.
afedorov [Thu, 17 Dec 2020 16:52:40 +0000 (16:52 +0000)]
[bhyve] virtio-net: Do not allow receiving packets until features have been negotiated.

Enforce the requirement that the RX callback cannot be called after a reset until the features have been negotiated.
This fixes a race condition where the receive callback is called during a device reset.

Reviewed by: vmaffione, grehan
Approved by: vmaffione (mentor)
Sponsored by: vstack.com
Differential Revision: https://reviews.freebsd.org/D27381

3 years agobsdinstall: remove VTOC8 partition scheme option
mhorne [Thu, 17 Dec 2020 15:00:19 +0000 (15:00 +0000)]
bsdinstall: remove VTOC8 partition scheme option

Now that sparc64 has been removed, there are no kernels built with
support for the VTOC8 partitioning scheme by default. Remove the option
from the installer, as it is unsupported on all installer images
produced by re@.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D27641

3 years agoMake non-debug kernels installable.
nwhitehorn [Thu, 17 Dec 2020 14:20:36 +0000 (14:20 +0000)]
Make non-debug kernels installable.

Setting DEBUG_FLAGS results in make installkernel trying to install debug
information that doesn't exist if the kernel was built without it.

3 years agostrerror.3: Add an example for perror()
0mp [Thu, 17 Dec 2020 12:41:47 +0000 (12:41 +0000)]
strerror.3: Add an example for perror()

This is a nice and quick reference.

Reviewed by: jilles, yuripv
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27623

3 years agofreebsd-update: unconditionally regenerate passwd/login.conf files
kevans [Thu, 17 Dec 2020 03:42:54 +0000 (03:42 +0000)]
freebsd-update: unconditionally regenerate passwd/login.conf files

The existing logic is nice in theory, but in practice freebsd-update will
not preserve the timestamps on these files. When doing a major upgrade, e.g.
from 12.1-RELEASE -> 12.2-RELEASE, pwd.mkdb et al. appear in the INDEX and
we clobber the timestamp several times in the process of packaging up the
existing system into /var/db/freebsd-update/files and extracting for
comparisons. This leads to these files not getting regenerated when they're
most likely to be needed.

Measures could be taken to preserve timestamps, but it's unclear whether
the complexity and overhead of doing so is really outweighed by the marginal
benefit.

I observed this issue when pkg subsequently failed to install a package that
wanted to add a user, claiming that the user was removed in the process.
bapt@ pointed to this pre-existing bug with freebsd-update as the cause.

PR: 234014, 232921
Reviewed by: bapt, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27635

3 years ago/etc/services: attempt to bring the database to this century 2/2.
pfg [Thu, 17 Dec 2020 02:54:32 +0000 (02:54 +0000)]
/etc/services: attempt to bring the database to this century 2/2.

This is the final half of splitting r358153 in two, in order to avoid a build
system bugs and being able to merge an earlier change to previous releases.

Add a note to UPDATING to avoid people building from very old systems from
having issues with mergemaster

MFC after: 3 days (only 12-stable)

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

3 years agonl_langinfo(3): document recognized item names
yuripv [Thu, 17 Dec 2020 02:33:52 +0000 (02:33 +0000)]
nl_langinfo(3): document recognized item names

While here, remove .Tn macro usage (prompted by mandoc lint).

PR: 251468
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D27606

3 years agoMake mountcritremote dependent upon nfscbd.
rmacklem [Thu, 17 Dec 2020 00:20:57 +0000 (00:20 +0000)]
Make mountcritremote dependent upon nfscbd.

Although it is not often needed, the nfscbd(8) should be running when
NFSv4 mounts are done if callback functionality is required.
Callback functionality is required for the NFSv4 server to issue
delegations or pNFS layouts.

This patch adds nfscbd to the mountcritremote's REQUIRED line
to ensure it is started before NFS mounts specified in /etc/fstab
are done.

Reviewed by: 0mp
Differential Revision: https://reviews.freebsd.org/D27506

3 years agonewvers.sh: Speed up git_tree_modified
brooks [Thu, 17 Dec 2020 00:00:21 +0000 (00:00 +0000)]
newvers.sh: Speed up git_tree_modified

We're looking for file content differences, so ask the question of git
more directly. This helps a lot, saving tens of thousands of fork()s,
when the builder and editor see different stat() results (e.g., UIDs),
as they might with containers.

Submitted by: Nathaniel Wesley Filardo <nwf20@cl.cam.ac.uk>
Reviewed by: bdrewery, emaste, imp
Obtained from: CheriBSD
MFC after: 3 days
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27646

3 years agoriscv: increase GENERICSD gap
mhorne [Wed, 16 Dec 2020 20:21:56 +0000 (20:21 +0000)]
riscv: increase GENERICSD gap

Leave more room for bootloaders at the beginning of the image. In
particular, the u-boot files for the HiFive Unleashed are ~5MB in size.

3 years agoAppend the branch commit count to _SNAP_SUFFIX for development
gjb [Wed, 16 Dec 2020 18:40:49 +0000 (18:40 +0000)]
Append the branch commit count to _SNAP_SUFFIX for development
snapshot builds.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agofd: remove redundant saturation check from fget_unlocked_seq
mjg [Wed, 16 Dec 2020 18:01:41 +0000 (18:01 +0000)]
fd: remove redundant saturation check from fget_unlocked_seq

refcount_acquire_if_not_zero returns true on saturation.
The case of 0 is handled by looping again, after which the originally
found pointer will no longer be there.

Noted by: kib

3 years agoComplete steps 5 and 9 from Committer's guide
otis [Wed, 16 Dec 2020 16:59:52 +0000 (16:59 +0000)]
Complete steps 5 and 9 from Committer's guide

Reviewed by: osa (mentor)
Approved by: osa (mentor)
Differential Revision: https://reviews.freebsd.org/D27632

3 years agoFix whitespace in r368698
jrtc27 [Wed, 16 Dec 2020 14:48:46 +0000 (14:48 +0000)]
Fix whitespace in r368698

MFC with: r368698

3 years agoFix whitespace in comment modified by r368697
jrtc27 [Wed, 16 Dec 2020 14:47:49 +0000 (14:47 +0000)]
Fix whitespace in comment modified by r368697

3 years agoUse the standard method for localizing of MSI-X table bar.
mmel [Wed, 16 Dec 2020 14:39:24 +0000 (14:39 +0000)]
Use the standard method for localizing of MSI-X table bar.

Current way, hardcoded value plus heuristic is not conform to the PCI(e)
specification and it fails on systems where MSI-X bar is not initialized by
BIOS/ACPI (many arm or arm64 systems for example).
Instead, use the standard PCI(e) capability for determining of
MSIX table bar address.

MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D27265

3 years agoAllocate right number of pages for the bounced buffers crossing the page.
mmel [Wed, 16 Dec 2020 14:36:57 +0000 (14:36 +0000)]
Allocate right number of pages for the bounced buffers crossing the page.

One of the disadvantages of our current busdma code is the fact that
we process the bounced buffer in a page-by-page manner. This means that
the short (subpage) buffer allocated across page boundaries is bounced
to 2 separate pages.

This suboptimal behavior is consistent across all platforms and can be
related to (probably unimplementable or incompatible with bouncing)
BUS_DMA_KEEP_PG_OFFSET flag.

Therefore, allocate one additional page to be fully comply with this
requirement.

Discused with: markj
PR: 251018

3 years agoRemove contrib/binutils, unused after r368667
emaste [Wed, 16 Dec 2020 14:01:04 +0000 (14:01 +0000)]
Remove contrib/binutils, unused after r368667

3 years agosrc.conf.5: regen after r368667, GDB retirement
emaste [Wed, 16 Dec 2020 14:00:42 +0000 (14:00 +0000)]
src.conf.5: regen after r368667, GDB retirement

3 years agoImplement strerror_l().
kib [Wed, 16 Dec 2020 09:02:09 +0000 (09:02 +0000)]
Implement strerror_l().

Only for the arches that provide user-mode TLS.

PR: 251651
Requested by: yuri
Discussed with: emaste, jilles, tijl
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27495
MFC after: 2 weeks

3 years agoUse more standard types for manipulating pointers.
jhb [Wed, 16 Dec 2020 00:27:28 +0000 (00:27 +0000)]
Use more standard types for manipulating pointers.

- Use a uintptr_t cast to get the virtual address of a pointer in
  USB_P2U() instead of a ptrdiff_t.

- Add offsets to a char * pointer directly without roundtripping the
  pointer through a ptrdiff_t in USB_ADD_BYTES().

Reviewed by: imp, hselasky
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27581

3 years agoUse uintptr_t instead of unsigned long for integers holding pointers.
jhb [Wed, 16 Dec 2020 00:17:54 +0000 (00:17 +0000)]
Use uintptr_t instead of unsigned long for integers holding pointers.

Reviewed by: imp, gallatin
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27580

3 years agoUse uintptr_t instead of unsigned long for pointers.
jhb [Wed, 16 Dec 2020 00:13:32 +0000 (00:13 +0000)]
Use uintptr_t instead of unsigned long for pointers.

The sense_ptr thing is quite broken.  As near as I can tell, the
driver tries to copyout to a physical address rather than whatever
user address the sense buffer should be copied to.  It is not
immediately obvious what user address the sense buffer should be
copied to.

Reviewed by: imp
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27578

3 years agoUse the 't' modifier to print a ptrdiff_t.
jhb [Wed, 16 Dec 2020 00:11:30 +0000 (00:11 +0000)]
Use the 't' modifier to print a ptrdiff_t.

Reviewed by: imp
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27576

3 years agoloader: allow loader to accept zfs feature com.delphix:bookmark_written
tsoome [Tue, 15 Dec 2020 22:37:03 +0000 (22:37 +0000)]
loader: allow loader to accept zfs feature com.delphix:bookmark_written

We do not need to actually read bookmarks, just whitelist this feature.

Reported by: mjg

3 years agoloader: allow loader to accept zfs feature com.datto:bookmark_v2
tsoome [Tue, 15 Dec 2020 21:48:35 +0000 (21:48 +0000)]
loader: allow loader to accept zfs feature com.datto:bookmark_v2

We do not need to actually read bookmarks, just whitelist this feature

Reported by: jpaetzel

3 years agoBugfix to not hide jailparam flags, which for example changes the output
jamie [Tue, 15 Dec 2020 20:56:35 +0000 (20:56 +0000)]
Bugfix to not hide jailparam flags, which for example changes the output
"vnet=2" to the less opaque "vnet=inherit"

Reported by: kevans
MFC after: 5 days

3 years agoRevert r368523 which fixed contig allocs waiting forever.
bdrewery [Tue, 15 Dec 2020 19:38:16 +0000 (19:38 +0000)]
Revert r368523 which fixed contig allocs waiting forever.

This needs to account for empty NUMA domains or domains which do not
satisfy the requested range.

Discussed with: markj

3 years agohme(4): remove stray directories
brooks [Tue, 15 Dec 2020 18:46:23 +0000 (18:46 +0000)]
hme(4): remove stray directories

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

3 years agoRemove Doxyfiles for removed drivers
brooks [Tue, 15 Dec 2020 18:44:41 +0000 (18:44 +0000)]
Remove Doxyfiles for removed drivers

Reported by: emaste

3 years agoRemove additional GDB leftovers missed in r368667
emaste [Tue, 15 Dec 2020 18:12:03 +0000 (18:12 +0000)]
Remove additional GDB leftovers missed in r368667

3 years agoAdd relnote for r368667, GDB 6.1.1 removal
emaste [Tue, 15 Dec 2020 17:52:04 +0000 (17:52 +0000)]
Add relnote for r368667, GDB 6.1.1 removal

3 years agoRetire obsolete GDB 6.1.1
emaste [Tue, 15 Dec 2020 17:44:19 +0000 (17:44 +0000)]
Retire obsolete GDB 6.1.1

GDB 6.1.1 was released in June 2004 and is long obsolete. It does not
support all of the architectures that FreeBSD does, and imposes
limitations on the FreeBSD kernel build, such as the continued use of
DWARF2 debugging information.

It was kept (in /usr/libexec/) only for use by crashinfo(8), which
extracts some basic information from a kernel core dump after a crash.
Crashinfo already prefers gdb from port/package if installed.

Future work may add kernel debug support to LLDB or find another path
for crashinfo's needs, but in any case we do not want to ship the
excessively outdated GDB in FreeBSD 13.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27610

3 years agoImprove handling of alternate settings in the USB stack.
hselasky [Tue, 15 Dec 2020 15:36:41 +0000 (15:36 +0000)]
Improve handling of alternate settings in the USB stack.

Move initialization of num_altsetting under USB_CFG_INIT, else
there will be a page fault when enumerating USB devices.

PR: 251856
MFC after: 1 week
Submitted by: Ma, Horse <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agorelease: Rename arm64/RPI3.conf to arm64/RPI.conf
manu [Tue, 15 Dec 2020 15:13:06 +0000 (15:13 +0000)]
release: Rename arm64/RPI3.conf to arm64/RPI.conf

We now have a u-boot port and config.txt for booting on all 64bits
variant of the RPI boards (RPI2v1.1, RPI3* and RPI4*) so use
the new u-boot-rpi-arm64 and the config_arm64.txt files.

Discussed with: karels, kevans

3 years agoImprove handling of alternate settings in the USB stack.
hselasky [Tue, 15 Dec 2020 12:05:07 +0000 (12:05 +0000)]
Improve handling of alternate settings in the USB stack.

Allow setting the alternate interface number to fail when there is only
one alternate setting present, to comply with the USB specification.

Refactor how iface->num_altsetting is computed.

Bump the __FreeBSD_version due to change of core USB structure.

PR: 251856
MFC after: 1 week
Submitted by: Ma, Horse <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoImprove handling of alternate settings in the USB stack.
hselasky [Tue, 15 Dec 2020 11:51:17 +0000 (11:51 +0000)]
Improve handling of alternate settings in the USB stack.

Limit the number of alternate settings to 256.
Else the alternate index variable may wrap around.

PR: 251856
MFC after: 1 week
Submitted by: Ma, Horse <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoWhen receiving a file having a length, which is a mulitple of the blocksize,
tuexen [Tue, 15 Dec 2020 09:43:18 +0000 (09:43 +0000)]
When receiving a file having a length, which is a mulitple of the blocksize,
close the file once it is received.

Reported by: Timo Voelker
MFC after: 1 week

3 years agoRemove more cx,ctau leftovers
emaste [Tue, 15 Dec 2020 01:45:19 +0000 (01:45 +0000)]
Remove more cx,ctau leftovers

Missed in r359178

3 years agoFix LINT-NOINET6 build after r368571.
melifaro [Mon, 14 Dec 2020 22:54:32 +0000 (22:54 +0000)]
Fix LINT-NOINET6 build after r368571.

Reported by: mjg

3 years agoamd64 pmap: fix PCID mode invalidations
kib [Mon, 14 Dec 2020 22:52:29 +0000 (22:52 +0000)]
amd64 pmap: fix PCID mode invalidations

When r362031 moved local TLB invalidation after shootdown IPI send, it
moved too much.  In particular, PCID-mode clearing of the pm_gen
generation counters must occur before IPIs are send, which is in fact
described by the comment before seq_cst fence in the invalidation
functions.

Fix it by extracting pm_gen clearing into new helper
pmap_invalidate_preipi(), which is executed before a call to
smp_masked_tlb_shootdown().

Rest of the local invalidation callbacks is simplified as result, and
become very similar to the remote shootdown handlers (to be merged in
some future).

Move pin of the thread to pmap_invalidate_preipi(), and do unpin in
smp_masked_tlb_shootdown().

Reported and tested by: mjg (previous version)
Reviewed by: alc, cem (previous version), markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D227588

3 years agoEnable ROUTE_MPATH support in GENERIC kernels.
melifaro [Mon, 14 Dec 2020 22:23:08 +0000 (22:23 +0000)]
Enable ROUTE_MPATH support in GENERIC kernels.

Ability to load-balance traffic over multiple path is a must-have thing for routers.
It may be used by the servers to balance outgoing traffic over multiple default gateways.

The previous implementation, RADIX_MPATH stayed in the shadow for too long.
It was not well maintained, which lead us to a vicious circle - people were using
 non-contiguous mask or firewalls to achieve similar goals. As a result, some routing
 daemons implementation still don't have multipath support enabled for FreeBSD.

Turning on ROUTE_MPATH by default would fix it. It will allow to reduce networking
 feature gap to other operating systems. Linux and OpenBSD enabled similar support
 at least 5 years ago.

ROUTE_MPATH does not consume memory unless actually used. It enables around ~1k LOC.

It does not bring any behaviour changes for userland.
Additionally, feature is (temporarily) turned off by the net.route.multipath sysctl
 defaulting to 0.

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

3 years agoImprove the counting of blocks used to transfer a file from the
tuexen [Mon, 14 Dec 2020 22:13:58 +0000 (22:13 +0000)]
Improve the counting of blocks used to transfer a file from the
server to the client in case of not using an OACK: Don't miss
the first block in case of it is not also the last one.

MFC after: 1 week

3 years agoRemove unused functions and variables in cpufunc.[ch].
mmel [Mon, 14 Dec 2020 14:00:54 +0000 (14:00 +0000)]
Remove unused functions and variables in cpufunc.[ch].

3 years agoFinish implementation of ARM PMU interrupts.
mmel [Mon, 14 Dec 2020 13:10:19 +0000 (13:10 +0000)]
Finish implementation of ARM PMU interrupts.
The ARM PMU may use single per-core interrupt or may use multiple generic
interrupts, one per core. In this case, special attention must be paid to
the correct identification of the physical location of the core, its order
in the external database (FDT) and the associated cpuid.

Also keep in mind that a SoC can have multiple different PMUs
(usually one per cluster)

3 years agoVerify (and fix) the context_id argument passed to the mpentry () by PSCI.
mmel [Mon, 14 Dec 2020 11:57:43 +0000 (11:57 +0000)]
Verify (and fix) the context_id argument passed to the mpentry () by PSCI.

Some older PSCI implementations corrupt (or do not pass) the context_id
argument to newly started secondary cores. Although the ideal solution to this
problem is u-boot update, we can find the correct value for the argument (cpuid)
by comparing of real core mpidr register with the value stored in pcu->mpidr.

MFC after: 2 weeks

3 years agoBe bug compatible with other operating systems by allowing non-sequential
hselasky [Mon, 14 Dec 2020 11:56:16 +0000 (11:56 +0000)]
Be bug compatible with other operating systems by allowing non-sequential
interface numbering for USB descriptors in userspace. Else certain USB
control requests using the interface number, won't be recognized by the
USB firmware.

Refer to section 9.2.3 in the USB 2.0 specification:
Interfaces are numbered from zero to one less than the number of concurrent interfaces
supported by the configuration.

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

3 years agoloader: Ignore the .interp section on RISC-V
jrtc27 [Mon, 14 Dec 2020 00:54:05 +0000 (00:54 +0000)]
loader: Ignore the .interp section on RISC-V

Without this we risk having the .interp section be placed earlier in the
file and mess with section offsets; in particular it has been seen to be
placed at the start of the file and cause the PE/COFF header to not be
at address 0. This is the same fix as was done for arm64 in r365578.

Reviewed by: mhorne, imp
Approved by: mhorne, imp
Differential Revision: https://reviews.freebsd.org/D27603

3 years agostrdup.3: Function appeared in 4.3BSD-Reno, not 4.4BSD
jrtc27 [Mon, 14 Dec 2020 00:50:45 +0000 (00:50 +0000)]
strdup.3: Function appeared in 4.3BSD-Reno, not 4.4BSD

Linux claims 4.3BSD, we claim 4.4BSD and OpenBSD claims 4.3BSD-Reno. It turns
out that OpenBSD got it right: the function was added in late 1988 a few months
after 4.3BSD-Tahoe, well in advance of 4.3BSD-Reno.

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

3 years agomips: Fix sub-word atomics implementation
jrtc27 [Mon, 14 Dec 2020 00:47:59 +0000 (00:47 +0000)]
mips: Fix sub-word atomics implementation

These aligned the address but then always used the least significant
bits of the value in memory, which is the wrong half 50% of the time for
16-bit atomics and the wrong quarter 75% of the time for 8-bit atomics.
These bugs were all present in r178172, the commit that added the mips
port, and have remained for its entire existence to date.

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

3 years agoloader: Print autoboot countdown immediately, not at 9
jrtc27 [Mon, 14 Dec 2020 00:46:24 +0000 (00:46 +0000)]
loader: Print autoboot countdown immediately, not at 9

For the first second otime and ntime are equal so no message gets
printed. Instead we should print the countdown right from the start,
although we do it at the end of the first iteration so that if a key has
already been pressed then the message is suppressed.

Reviewed by: imp
Approved by: imp
Differential Revision: https://reviews.freebsd.org/D26935

3 years agoHarden the handling of outgoing streams in case of an restart or INIT
tuexen [Sun, 13 Dec 2020 23:51:51 +0000 (23:51 +0000)]
Harden the handling of outgoing streams in case of an restart or INIT
collision. This avouds an out-of-bounce access in case the peer can
break the cookie signature. Thanks to Felix Wilhelm from Google for
reporting the issue.

MFC after: 1 week

3 years agouipc: disable prediction in unp_pcb_lock_peer
mjg [Sun, 13 Dec 2020 21:32:19 +0000 (21:32 +0000)]
uipc: disable prediction in unp_pcb_lock_peer

The branch is not very predictable one way or the other, at least during
buildkernel where it only correctly matched 57% of calls.

3 years agoPatch annotation in sigdeferstop
mjg [Sun, 13 Dec 2020 21:30:42 +0000 (21:30 +0000)]
Patch annotation in sigdeferstop

Probability flipped since sigdefer handling was moved away from regular VOP
calls.

3 years agocache: fix ups bad predicts
mjg [Sun, 13 Dec 2020 21:29:39 +0000 (21:29 +0000)]
cache: fix ups bad predicts

- last level fallback normally sees CREATE; the code should be optimized to not
get there for said case
- fast path commonly fails with ENOENT

3 years agovfs: correctly predict last fdrop on failed open
mjg [Sun, 13 Dec 2020 21:28:15 +0000 (21:28 +0000)]
vfs: correctly predict last fdrop on failed open

Arguably since the count is guaranteed to be 1 the code should be modified
to avoid the work.

3 years agoFix TDP_WAKEUP/thr_wake(curthread->td_tid) after r366428.
kib [Sun, 13 Dec 2020 19:45:42 +0000 (19:45 +0000)]
Fix TDP_WAKEUP/thr_wake(curthread->td_tid) after r366428.

Reported by: arichardson
Reviewed by: arichardson, markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27597

3 years agoCorrect indent.
kib [Sun, 13 Dec 2020 19:43:45 +0000 (19:43 +0000)]
Correct indent.

Sponsored by: The FreeBSD Foundation

3 years agoFix WITHOUT_ICONV build
se [Sun, 13 Dec 2020 19:06:59 +0000 (19:06 +0000)]
Fix WITHOUT_ICONV build

Move the include of langinfo.h out of the WITH_ICONV condition block,
since it is not dependent on ICONV. This was correct when nl_langinfo()
had only been called in the WITH_ICONV case, but that is no longer the
case.

Submitted by: yuripv

3 years agoRevert r368606
se [Sun, 13 Dec 2020 19:03:38 +0000 (19:03 +0000)]
Revert r368606

The issue will be fixed in a different way.

Reported by: yuripv

3 years agofd: fix fdrop prediction when closing a fd
mjg [Sun, 13 Dec 2020 18:06:24 +0000 (18:06 +0000)]
fd: fix fdrop prediction when closing a fd

Most of the time this is the last reference, contrary to typical fdrop use.