]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoImport kernel WireGuard support
mmacy [Sun, 29 Nov 2020 19:38:03 +0000 (19:38 +0000)]
Import kernel WireGuard support

Data path largely shared with the OpenBSD implementation by
Matt Dunwoodie <ncon@nconroy.net>

Reviewed by: grehan@freebsd.org
MFC after: 1 month
Sponsored by: Rubicon LLC, (Netgate)
Differential Revision: https://reviews.freebsd.org/D26137

3 years agoReduce MAXPHYS back to 128KB on 32bit architectures.
kib [Sun, 29 Nov 2020 19:06:32 +0000 (19:06 +0000)]
Reduce MAXPHYS back to 128KB on 32bit architectures.

Some of them have limited KVA, like arm, which prevents startup from
allocating needed number of large pbufs.  Other, for instance i386,
are dis-balanced enough after 4/4 that blind bump is probably harmful
because it allows for much more in-flight io than other tunables are
ready for.

Requested by: mmel
Reviewed by: emaste, mmel
Sponsored by: The FreeBSD Foundation

3 years agoStore MPIDR register in pcpu.
mmel [Sun, 29 Nov 2020 18:59:01 +0000 (18:59 +0000)]
Store MPIDR register in pcpu.

MPIDR represents physical locality of given core and it should be used as
the only viable/robust connection between cpuid (which have zero relation to
cores topology) and external description (for example  in FDT).  It can be
used for determining which interrupt is associated to given per-CPU PMU
or by scheduler for determining big/little core or cluster topology.

MFC after: 3 weeks

3 years agoiconv(1): Add EXAMPLE
fernape [Sun, 29 Nov 2020 18:22:14 +0000 (18:22 +0000)]
iconv(1): Add EXAMPLE

Just a small example to show simple usage.

Approved by: manpages (0mp@)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27385

3 years agoRemove unused options.
mmel [Sun, 29 Nov 2020 17:42:32 +0000 (17:42 +0000)]
Remove unused options.

Marvell files and their related SOC_MV_<foo> options should be cleaned up
in another pass.

3 years ago_ARM_ARCH_5E is always defined, we not support older CPUs.
mmel [Sun, 29 Nov 2020 16:44:22 +0000 (16:44 +0000)]
_ARM_ARCH_5E is always defined, we not support older CPUs.

3 years agosecurity(7): fix copy/paste error and correct aslr oids
yuripv [Sun, 29 Nov 2020 16:29:40 +0000 (16:29 +0000)]
security(7): fix copy/paste error and correct aslr oids

Submitted by: Mina Galić <me_igalic.co>
Differential Revision: https://reviews.freebsd.org/D27408

3 years agoOnly set the PCI bus end when we are reducing it
andrew [Sun, 29 Nov 2020 16:22:33 +0000 (16:22 +0000)]
Only set the PCI bus end when we are reducing it

We read the bus end value from the _CRS method. On some systems we need
to further limit it based on the MCFG table.

Support this by setting a default value, then update it if needed in the
_CRS table, and finally reduce it if it is past the end of the MCFG tabel.
This will allow for both systems that use either method to encode this
value.

This partially reverts r347929, removing the error printf.

Reviewed by: philip
Tested by: philip, Andrey Fesenko <f0andrey_gmail.com>
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D27274

3 years agoRemove orphaned configs.
mmel [Sun, 29 Nov 2020 15:39:54 +0000 (15:39 +0000)]
Remove orphaned configs.

3 years agoRemove remaining fragments of code for older already ceased ARM versions.
mmel [Sun, 29 Nov 2020 15:24:00 +0000 (15:24 +0000)]
Remove remaining fragments of code for older already ceased ARM versions.

3 years agoRemove remaining support of big endian byte order.
mmel [Sun, 29 Nov 2020 15:04:39 +0000 (15:04 +0000)]
Remove remaining support of big endian byte order.
Big endian support was ceased by removing ARMv4 sub architecture.

3 years agoIntroduce rib_walk_ext_internal() to allow iteration with rnh pointer.
melifaro [Sun, 29 Nov 2020 13:54:49 +0000 (13:54 +0000)]
Introduce rib_walk_ext_internal() to allow iteration with rnh pointer.

This solves the case when rib is not yet attached/detached to/from the
 system rib array.

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

3 years agoAdd nhop_ref_any() to unify referencing nhop or nexthop group.
melifaro [Sun, 29 Nov 2020 13:52:06 +0000 (13:52 +0000)]
Add nhop_ref_any() to unify referencing nhop or nexthop group.

It allows code within routing subsystem to transparently reference nexthops
 and nexthop groups, similar to nhop_free_any(), abstracting ROUTE_MPATH
 details.

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

3 years agohastd(8) assumes it has no extra file descriptors opened
eugen [Sun, 29 Nov 2020 13:45:53 +0000 (13:45 +0000)]
hastd(8) assumes it has no extra file descriptors opened
and aborts otherwise, so call closefrom() early.

PR: 227461
MFC after: 2 weeks

3 years agoRefactor fib4/fib6 functions.
melifaro [Sun, 29 Nov 2020 13:41:49 +0000 (13:41 +0000)]
Refactor fib4/fib6 functions.

No functional changes.

* Make lookup path of fib<4|6>_lookup_debugnet() separate functions
 (fib<46>_lookup_rt()). These will be used in the control plane code
 requiring unlocked radix operations and actual prefix pointer.
* Make lookup part of fib<4|6>_check_urpf() separate functions.
 This change simplifies the switch to alternative lookup implementations,
 which helps algorithmic lookups introduction.
* While here, use static initializers for IPv4/IPv6 keys

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

3 years agoAdd tracking for rib/nhops/nhgrp objects and provide cumulative number accessors.
melifaro [Sun, 29 Nov 2020 13:27:24 +0000 (13:27 +0000)]
Add tracking for rib/nhops/nhgrp objects and provide cumulative number accessors.

The resulting KPI can be used by routing table consumers to estimate the required
 scale for route table export.

* Add tracking for rib routes
* Add accessors for number of nexthops/nexthop objects
* Simplify rib_unsubscribe: store rnh we're attached to instead of requiring it up
 again on destruction. This helps in the cases when rnh is not linked yet/already unlinked.

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

3 years agobhyve: limit max GPA to VM_MAXUSER_ADDRESS_LA48.
kib [Sun, 29 Nov 2020 10:32:38 +0000 (10:32 +0000)]
bhyve: limit max GPA to VM_MAXUSER_ADDRESS_LA48.

We use 4-level EPT pages, correct the upper bound.

Reviewed by: grehan
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27402

3 years agobio aio: Destroy ephemeral mapping before unwiring page.
kib [Sun, 29 Nov 2020 10:30:56 +0000 (10:30 +0000)]
bio aio: Destroy ephemeral mapping before unwiring page.

Apparently some architectures, like ppc in its hashed page tables
variants, account mappings by pmap_qenter() in the response from
pmap_is_page_mapped().

While there, eliminate useless userp variable.

Noted and reviewed by: alc (previous version)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27409

3 years agoRemove the pre-ARMv6 and pre-INTRNG code.
mmel [Sun, 29 Nov 2020 08:40:12 +0000 (08:40 +0000)]
Remove the pre-ARMv6 and pre-INTRNG code.
ARM has required ARMV6+ and INTRNg for some time now, so remove
always false #ifdefs and unconditionally do always true #ifdefs.

3 years agohwpstate_intel: don't unconditionally print the error message
yuripv [Sun, 29 Nov 2020 01:43:04 +0000 (01:43 +0000)]
hwpstate_intel: don't unconditionally print the error message

Actually check the wrmsr_safe() return value when setting autonomous
HWP for package.

PR: 245582
Differential Revision: https://reviews.freebsd.org/D24744

3 years agoRemove alignment requirements for KVA buffer mapping.
mav [Sun, 29 Nov 2020 01:30:17 +0000 (01:30 +0000)]
Remove alignment requirements for KVA buffer mapping.

After r368124 pbuf_zone has extra page to handle this particular case.

3 years agoRemove aligment requirements for passthrough buffer.
mav [Sun, 29 Nov 2020 00:57:19 +0000 (00:57 +0000)]
Remove aligment requirements for passthrough buffer.

After r368124 vmapbuf() should happily map misaligned maxphys-sized buffers
thanks to extra page added to pbuf_zone.

3 years agoRemove alignment requirements for KVA buffer mapping.
mav [Sun, 29 Nov 2020 00:49:14 +0000 (00:49 +0000)]
Remove alignment requirements for KVA buffer mapping.

After r368124 vmapbuf() should happily map misaligned maxphys-sized buffers
thanks to extra page added to pbuf_zone.

3 years agoMark inline functions static.
mav [Sun, 29 Nov 2020 00:35:13 +0000 (00:35 +0000)]
Mark inline functions static.

3 years agoIncrease nvme(4) maximum transfer size from 1MB to 2MB.
mav [Sun, 29 Nov 2020 00:20:31 +0000 (00:20 +0000)]
Increase nvme(4) maximum transfer size from 1MB to 2MB.

With 4KB page size the 2MB is the maximum we can address with one page PRP.
Going further would require chaining, that would add some more complexity.

On the other side, to reduce memory consumption, allocate the PRP memory
respecting maximum transfer size reported in the controller identify data.
Many of NVMe devices support much smaller values, starting from 128KB.
To do that we have to change the initialization sequence to pull the data
earlier, before setting up the I/O queue pairs.  The admin queue pair is
still allocated for full MIN(maxphys, 2MB) size, but it is not a big deal,
since there is only one such queue with only 16 trackers.

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

3 years agoping: allow building without INET support
asomers [Sat, 28 Nov 2020 23:24:19 +0000 (23:24 +0000)]
ping: allow building without INET support

Building without INET6 support was already possible. Now it's possible to
build ping with only INET6, or even with neither INET nor INET6.

Reported by: bz
Reviewed by: bz
MFC-With: 368045
Differential Revision: https://reviews.freebsd.org/D27394

3 years agoAdd watchdog(9) driver for the Fintek F81803 SuperIO chip
phk [Sat, 28 Nov 2020 22:34:33 +0000 (22:34 +0000)]
Add watchdog(9) driver for the Fintek F81803 SuperIO chip

3 years agoAdd nhgrp_get_idx() as a counterpart for nhop_get_idx().
melifaro [Sat, 28 Nov 2020 15:46:40 +0000 (15:46 +0000)]
Add nhgrp_get_idx() as a counterpart for nhop_get_idx().

It allows the routing-related code to reference nexthop groups by index
 instead of storing a pointer.

3 years agoCleanup nexthops request flags:
melifaro [Sat, 28 Nov 2020 15:11:59 +0000 (15:11 +0000)]
Cleanup nexthops request flags:
* remove NHR_IFAIF as it was used by previous version of nexthop KPI
* update NHR_REF description

3 years agoRemove now unused armv4 and not-INTRNG files.
mmel [Sat, 28 Nov 2020 15:00:08 +0000 (15:00 +0000)]
Remove now unused armv4 and not-INTRNG files.

3 years agolibc: Add pthread_attr_get_np(3) stub, reporting ESRCH.
kib [Sat, 28 Nov 2020 12:19:20 +0000 (12:19 +0000)]
libc: Add pthread_attr_get_np(3) stub, reporting ESRCH.

This seems to be required by recent clang asan.
I do not see other way than put the symbol under FBSD_1.0 version.

PR: 251112
Reported by: Andrew Stitcher <astitcher@apache.org>
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27389

3 years agoMake MAXPHYS tunable. Bump MAXPHYS to 1M.
kib [Sat, 28 Nov 2020 12:12:51 +0000 (12:12 +0000)]
Make MAXPHYS tunable.  Bump MAXPHYS to 1M.

Replace MAXPHYS by runtime variable maxphys. It is initialized from
MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.

Make b_pages[] array in struct buf flexible.  Size b_pages[] for buffer
cache buffers exactly to atop(maxbcachebuf) (currently it is sized to
atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1.
The +1 for pbufs allow several pbuf consumers, among them vmapbuf(),
to use unaligned buffers still sized to maxphys, esp. when such
buffers come from userspace (*).  Overall, we save significant amount
of otherwise wasted memory in b_pages[] for buffer cache buffers,
while bumping MAXPHYS to desired high value.

Eliminate all direct uses of the MAXPHYS constant in kernel and driver
sources, except a place which initialize maxphys.  Some random (and
arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted
straight.  Some drivers, which use MAXPHYS to size embeded structures,
get private MAXPHYS-like constant; their convertion is out of scope
for this work.

Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs,
dev/siis, where either submitted by, or based on changes by mav.

Suggested by: mav (*)
Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions)
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27225

3 years agoSuspend I/O on ahci-cd devices during a snapshot.
jhb [Sat, 28 Nov 2020 04:21:22 +0000 (04:21 +0000)]
Suspend I/O on ahci-cd devices during a snapshot.

Submitted by: Vitaliy Gusev <gusev.vitaliy@gmail.com>

3 years agobhyve: Add snapshot support for virtio-rnd.
jhb [Sat, 28 Nov 2020 04:06:09 +0000 (04:06 +0000)]
bhyve: Add snapshot support for virtio-rnd.

This uses the same snapshot routine as other VirtIO devices.

Submitted by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Differential Revision: https://reviews.freebsd.org/D26265

3 years agobhyve: 'xhci,tablet' snapshot fixes
jhb [Sat, 28 Nov 2020 03:54:48 +0000 (03:54 +0000)]
bhyve: 'xhci,tablet' snapshot fixes

Permit suspend/resume of a XHCI device model that has not been
attached to by a driver in a guest OS.

Submitted by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Differential Revision: https://reviews.freebsd.org/D26264

3 years agokern: cpuset: drop the lock to allocate domainsets
kevans [Sat, 28 Nov 2020 01:21:11 +0000 (01:21 +0000)]
kern: cpuset: drop the lock to allocate domainsets

Restructure the loop a little bit to make it a little more clear how it
really operates: we never allocate any domains at the beginning of the first
iteration, and it will run until we've satisfied the amount we need or we
encounter an error.

The lock is now taken outside of the loop to make stuff inside the loop
easier to evaluate w.r.t. locking.

This fixes it to not try and allocate any domains for the freelist under the
spinlock, which would have happened before if we needed any new domains.

Reported by: syzbot+6743fa07b9b7528dc561@syzkaller.appspotmail.com
Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D27371

3 years agoConvert vmm_ops calls to IFUNC
grehan [Sat, 28 Nov 2020 01:16:59 +0000 (01:16 +0000)]
Convert vmm_ops calls to IFUNC

There is no need for these to be function pointers since they are
never modified post-module load.

Rename AMD/Intel ops to be more consistent.

Submitted by: adam_fenn.io
Reviewed by: markj, grehan
Approved by: grehan (bhyve)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D27375

3 years agoaddr2line: add label checks when DW_AT_range and DW_AT_low_pc cannot be used
emaste [Fri, 27 Nov 2020 21:38:03 +0000 (21:38 +0000)]
addr2line: add label checks when DW_AT_range and DW_AT_low_pc cannot be used

Check label's ranges for address we want to translate if a CU doesn't
have usable DW_AT_range or DW_AT_low_pc.

Use more appropriate names: "struct CU" -> "struct range"

Developed as part of upstream ELF Tool Chain bug report
https://sourceforge.net/p/elftoolchain/tickets/552/ although this does
not address the specific case reported there.

Submitted by: Tiger Gao <tig@freebsdfoundation.org>
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23782

3 years agoo Move options IOMMU from Debugging section back to the Bus section
br [Fri, 27 Nov 2020 21:37:48 +0000 (21:37 +0000)]
o Move options IOMMU from Debugging section back to the Bus section
  where it originally was. The bug introduced in r366267.
o Remove options IOMMU from i386/MINIMAL as we don't have it in
  i386/GENERIC.

Reported by: Harry Schmalzbauer <freebsd@omnilan.de>
Reviewed by: kib
Sponsored by: Innovate DSbD
Differential Revision: https://reviews.freebsd.org/D27399

3 years agocallout(9): Remove some leftover APM BIOS support
markj [Fri, 27 Nov 2020 20:46:02 +0000 (20:46 +0000)]
callout(9): Remove some leftover APM BIOS support

This code is obsolete since r366546.

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

3 years agofix casper initialization for setting scripts.
ume [Fri, 27 Nov 2020 18:40:51 +0000 (18:40 +0000)]
fix casper initialization for setting scripts.

MFC after: 1 week

3 years agoarm: Correctly report the size of FPA registers to GDB
markj [Fri, 27 Nov 2020 16:35:43 +0000 (16:35 +0000)]
arm: Correctly report the size of FPA registers to GDB

Modern ARM systems do not have an FPA unit but GDB reserves register
indices for FPA registers and expects the stub to know their sizes.

PR: 251022
Submitted by: Dmitry Salychev <dsl@mcusim.org>
MFC after: 2 weeks

3 years agoSome code reorganization.
mav [Fri, 27 Nov 2020 15:50:20 +0000 (15:50 +0000)]
Some code reorganization.

 - Remove code duplication by adding two new functions to execute prepared
queue entry via either mbox or request queue and wait for result.
 - Since the new function executing via request queue sleeps any way, make
it sleep also in case of overflows or handle shortages.  It should make it
more reliable and less affecting other less flexible request queue users.
 - Turn isp_target_put_entry() into not target-specific isp_send_entry().
 - Make handling of responses with control handles more universal.
 - Move RQSTYPE_RPT_ID_ACQ handling into new function.
 - Inline isp_handle_other_response(), becoming trivial after above.
 - Clean the list of IOCBs from pre-24xx ones.

3 years agoMake generated C files depend on this Makefile
se [Fri, 27 Nov 2020 09:00:21 +0000 (09:00 +0000)]
Make generated C files depend on this Makefile

The contents of lib.c, lib2.c, bc_help.c, and dc_help.c depends on the
parameters passed to strgen.sh in this Makefile. A change to the number
of parameters of strgen.sh has been applied to the invocation of this
command, but this did not cause a rebuild of the generated files.

Reported by: Cy.Schubert@cschubert.com

3 years agoFix bhyve SMBIOS type 19 handling to avoid misreporting total RAM amount
bcran [Fri, 27 Nov 2020 08:00:32 +0000 (08:00 +0000)]
Fix bhyve SMBIOS type 19 handling to avoid misreporting total RAM amount

This fixes the amount of memory displayed in the EDK2 UiApp to be the same
as passed on the bhyve command line. Otherwise, 8GB is displayed as 4GB,
32GB as 28GB etc.

Reviewed by: jhb, kib, rgrimes
Differential Revision: https://reviews.freebsd.org/D27348

3 years agobhyve: fix smbiostbl.c style issues and add comment about date format
bcran [Fri, 27 Nov 2020 07:53:15 +0000 (07:53 +0000)]
bhyve: fix smbiostbl.c style issues and add comment about date format

Fix a couple of style issues introduced in my previous commit.
Add a comment explaining that the SMBIOS specification defines the date
format to be mm/dd/yyyy, which is why we don't use ISO 8601.

3 years agoRestore break statement lost in r367857.
mav [Fri, 27 Nov 2020 05:13:52 +0000 (05:13 +0000)]
Restore break statement lost in r367857.

3 years agolibprocstat.3: Correct two occurrences of kvm_getprocs to procstat_getprocs
0mp [Thu, 26 Nov 2020 22:49:05 +0000 (22:49 +0000)]
libprocstat.3: Correct two occurrences of kvm_getprocs to procstat_getprocs

Submitted by: otis_sk.freebsd.org
Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26151

3 years agoRemove stray column.
kib [Thu, 26 Nov 2020 20:27:23 +0000 (20:27 +0000)]
Remove stray column.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoStyle.
kib [Thu, 26 Nov 2020 20:23:17 +0000 (20:23 +0000)]
Style.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoarm64: Do not rely on SPCR table to detect acpi
manu [Thu, 26 Nov 2020 20:22:34 +0000 (20:22 +0000)]
arm64: Do not rely on SPCR table to detect acpi

Since EDK2 commit d8e36289cef7bde628b023219cd65fa8e8d4562a, the Graphical console may
completely hide SPCR, causing panics later when locating timers.
As such simply rely on the ACPI Root pointer presence.

Submitted by: dan.kotowski@a9development.com
Reviewed by: andrew, mw
Differential Revision: https://reviews.freebsd.org/D27306

3 years agoUpdate Makefile for new version 3.2.0
se [Thu, 26 Nov 2020 19:38:02 +0000 (19:38 +0000)]
Update Makefile for new version 3.2.0

3 years agoMore cleanup in response queue and reset code.
mav [Thu, 26 Nov 2020 18:47:23 +0000 (18:47 +0000)]
More cleanup in response queue and reset code.

3 years agoping: add a ping6 hard link for backwards compatibility
asomers [Thu, 26 Nov 2020 18:33:04 +0000 (18:33 +0000)]
ping: add a ping6 hard link for backwards compatibility

When invoked as "ping6", ping will now attempt to use ICMPv6 for hostnames
that resolve both IPv4 and IPv6 addresses.

Reviewed by: bz, manu
MFC-With: r368045
Differential Revision: https://reviews.freebsd.org/D27384

3 years agonullfs: provide custom bypass for VOP_READ_PGCACHE().
kib [Thu, 26 Nov 2020 18:16:32 +0000 (18:16 +0000)]
nullfs: provide custom bypass for VOP_READ_PGCACHE().

Normal bypass expects locked vnode, which is not true for
VOP_READ_PGCACHE().  Ensure liveness of the lower vnode by taking the
upper vnode interlock, which is also taked by null_reclaim() when
setting v_data to NULL.

Reported and tested by: pho
Reviewed by: markj, mjg
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27327

3 years agovn_read_from_obj(): fix handling of doomed vnodes.
kib [Thu, 26 Nov 2020 18:13:33 +0000 (18:13 +0000)]
vn_read_from_obj(): fix handling of doomed vnodes.

There is no reason why vp->v_object cannot be NULL. If it is, it's
fine, handle it by delegating to VOP_READ().

Tested by: pho
Reviewed by: markj, mjg
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27327

3 years agoMore careful handling of the mount failure.
kib [Thu, 26 Nov 2020 18:08:42 +0000 (18:08 +0000)]
More careful handling of the mount failure.

- VFS_UNMOUNT() requires vn_start_write() around it [*].
- call VFS_PURGE() before unmount.
- do not destroy mp if cleanup unmount did not succeed.
- set MNTK_UNMOUNT, and indicate forced unmount with MNTK_UNMOUNTF
  for VFS_UNMOUNT() in cleanup.

PR: 251320 [*]
Reported by: Tong Zhang <ztong0001@gmail.com>
Reviewed by: markj, mjg
Discussed with: rmacklem
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27327

3 years agoclear_inodedeps: handle ERELOOKUP from ffs_syncvnode().
kib [Thu, 26 Nov 2020 18:03:24 +0000 (18:03 +0000)]
clear_inodedeps: handle ERELOOKUP from ffs_syncvnode().

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation

3 years agoMake max ticks for pause in vn_lock_pair() adjustable at runtime.
kib [Thu, 26 Nov 2020 18:00:26 +0000 (18:00 +0000)]
Make max ticks for pause in vn_lock_pair() adjustable at runtime.

Reduce default value from hz / 10 to hz / 100.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation

3 years agoUpdate to version 3.2.0
se [Thu, 26 Nov 2020 17:39:51 +0000 (17:39 +0000)]
Update to version 3.2.0

3 years agobsd.lib.mk: Work around build system raciness
arichardson [Thu, 26 Nov 2020 17:37:27 +0000 (17:37 +0000)]
bsd.lib.mk: Work around build system raciness

We are seeing regular build failures due to libc.so being installed again and
another parallel make job tries to read the partially written libc.so at the
same time. When building with -j32 or higher this almost always happens on
the first clean build (subsequent incremental builds always work fine).
Using -S should "fix" the "section header table goes past the end of the
file: e_shoff = 0x..." errors that have started to plague our builds.

We originally thought this only affected CheriBSD, but I just got the same
error while building the latest upstream FreeBSD.

The real fix should be to not install libraries twice, but until then this
workaround is needed.

Original patch by jrtc27@, I only made some minor changes to the comment.

Obtained from: CheriBSD (https://github.com/CTSRD-CHERI/cheribsd/commit/49837edd3efd5d02a1b120c47f00cfc2d59a9a8e)
Reviewed By: markj, bdrewery
Differential Revision: https://reviews.freebsd.org/D27102

3 years agoAdd .cfi_{start,end}proc for RISC-V assembly functions
arichardson [Thu, 26 Nov 2020 17:37:22 +0000 (17:37 +0000)]
Add .cfi_{start,end}proc for RISC-V assembly functions

This allows GDB to print more useful backtraces when setting a breakpoint
on an assembly function.

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D27177

3 years agoImport version 3.2.0
se [Thu, 26 Nov 2020 17:27:07 +0000 (17:27 +0000)]
Import version 3.2.0

3 years agoarm: allwinner: a23 timer functions are only used for arm64
manu [Thu, 26 Nov 2020 17:19:47 +0000 (17:19 +0000)]
arm: allwinner: a23 timer functions are only used for arm64

3 years agoarm: tegra: Remove unused variable
manu [Thu, 26 Nov 2020 17:19:30 +0000 (17:19 +0000)]
arm: tegra: Remove unused variable

3 years agoarm: mv: Remove unused code
manu [Thu, 26 Nov 2020 17:19:13 +0000 (17:19 +0000)]
arm: mv: Remove unused code

3 years agoarm: ti: Remove unused function ti_first_gpio_bank
manu [Thu, 26 Nov 2020 17:18:54 +0000 (17:18 +0000)]
arm: ti: Remove unused function ti_first_gpio_bank

3 years agoRevert incomplete import of version 3.2.0
se [Thu, 26 Nov 2020 17:18:18 +0000 (17:18 +0000)]
Revert incomplete import of version 3.2.0

3 years agoUpdate to version 3.2.0
se [Thu, 26 Nov 2020 16:52:17 +0000 (16:52 +0000)]
Update to version 3.2.0

3 years agosdhci: mmccam: Update vccq in the driver ios
manu [Thu, 26 Nov 2020 16:40:39 +0000 (16:40 +0000)]
sdhci: mmccam: Update vccq in the driver ios

Otherwise we always report that the card is running at 1.2V.

3 years agosdhci: Only print mmccam debug code if hw.sdhci.debug is > 1
manu [Thu, 26 Nov 2020 16:40:20 +0000 (16:40 +0000)]
sdhci: Only print mmccam debug code if hw.sdhci.debug is > 1

3 years agommccam: We can't sleep during sdda_add_part so use M_NOWAIT
manu [Thu, 26 Nov 2020 16:39:56 +0000 (16:39 +0000)]
mmccam: We can't sleep during sdda_add_part so use M_NOWAIT

Reviewed by: kibab
Differential Revision: https://reviews.freebsd.org/D25947

3 years agoEnsure consistent error messages from ifconfig(8).
hselasky [Thu, 26 Nov 2020 16:36:50 +0000 (16:36 +0000)]
Ensure consistent error messages from ifconfig(8).

If multiple threads are invoking "ifconfig XXX create" a race may occur
which can lead to two different error messages for the same error.

a) ifconfig: SIOCIFCREATE2: File exists
b) ifconfig: interface XXX already exists

This patch ensures ifconfig prints the same error code
for the same case.

Reviewed by: imp@ and kib@
Differential Revision: https://reviews.freebsd.org/D27380
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoGH Actions: Use pre-installed clang packages
uqs [Thu, 26 Nov 2020 14:42:16 +0000 (14:42 +0000)]
GH Actions: Use pre-installed clang packages

Also fix the run by setting up the environment in non-deprecated way.

Always run with --debug to understand better what sort of stuff is happening in
the background. Also split out the bmake bootstrap stage (takes about 31s on
ubuntu, but 1m14 on macOS?)

Drops the dependency on coreutils (realpath, nproc) and thus (?) fixes macOS to
be just as fast (4 logical cores vs 2 physical cores before, go figure.)

Reviewed by: arichardson

3 years agoSignificantly speed up libthr/mutex_test and make more reliable
arichardson [Thu, 26 Nov 2020 13:31:57 +0000 (13:31 +0000)]
Significantly speed up libthr/mutex_test and make more reliable

Instead of using a simple global++ as the data race, with this change we
perform the increment by loading the global, delaying for a bit and then
storing back the incremented value. If I move the increment outside of the
mutex protected range, I can now see the data race with only 100 iterations
on amd64 in almost all cases. Before this change such a racy test almost
always passed with < 100,000 iterations and only reliably failed with the
current limit of 10 million.

I noticed this poorly written test because the mutex:mutex{2,3} and
timedmutex:mutex{2,3} tests were always timing out on our CheriBSD Jenkins.
Writing good concurrency tests is hard so I won't attempt to do so, but this
change should make the test more likely to fail if pthread_mutex_lock is not
implemented correctly while also significantly reducing the time it takes to
run these four tests. It will also reduce the time it takes for QEMU RISC-V
testsuite runs by almost 40 minutes (out of currently 7 hours).

Reviewed By: brooks, ngie
Differential Revision: https://reviews.freebsd.org/D26473

3 years agolibsysdecode: account for invalid protection flags
kaktus [Thu, 26 Nov 2020 09:07:45 +0000 (09:07 +0000)]
libsysdecode: account for invalid protection flags

Reported by: jhb
MFC with: r368022

3 years agoAdd support for Fintek F81803 SuperIO chip
phk [Thu, 26 Nov 2020 07:34:20 +0000 (07:34 +0000)]
Add support for Fintek F81803 SuperIO chip

Reviewed by: avg

3 years agothread: staticize thread_reap and move td_allocdomain
mjg [Thu, 26 Nov 2020 06:59:27 +0000 (06:59 +0000)]
thread: staticize thread_reap and move td_allocdomain

thread_init is a much better fit as the the value is constant after
initialization.

3 years agoRemove manual instruction encodings for VMLOAD, VMRUN, and VMSAVE.
grehan [Thu, 26 Nov 2020 05:58:55 +0000 (05:58 +0000)]
Remove manual instruction encodings for VMLOAD, VMRUN, and VMSAVE.

This is a relic from when these instructions weren't supported by the toolchain.
No functional change.

Submitted by: adam_fenn.io
Reviewed by: grehan
Approved by: grehan (bhyve)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D27130

3 years agoping: fix some man pages and tests after r368045
asomers [Thu, 26 Nov 2020 04:55:02 +0000 (04:55 +0000)]
ping: fix some man pages and tests after r368045

MFC-with: r368045

3 years agoMerge ping6 to ping
asomers [Thu, 26 Nov 2020 04:29:30 +0000 (04:29 +0000)]
Merge ping6 to ping

There is now a single ping binary, which chooses to use ICMP or ICMPv4
based on the -4 and -6 options, and the format of the address.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google LLC (Google Summer of Code 2019)
MFC after: Never
Differential Revision: https://reviews.freebsd.org/D21377

3 years agoSome minor FCoE bits I had lying around.
mav [Thu, 26 Nov 2020 02:14:52 +0000 (02:14 +0000)]
Some minor FCoE bits I had lying around.

3 years agoRemove some more dead code from pre-24xx.
mav [Thu, 26 Nov 2020 01:59:44 +0000 (01:59 +0000)]
Remove some more dead code from pre-24xx.

3 years agoAdd the firmware blob required to use the sdma hardware in the imx6
ian [Thu, 26 Nov 2020 01:40:04 +0000 (01:40 +0000)]
Add the firmware blob required to use the sdma hardware in the imx6
processor, and its associated license text (which is similar to a
bsd-3-clause, but with a prohibition against decompiling).  Install a copy
of the license in /usr/share/doc/legal/imx, to comply with the license terms
that requires a copy of the license to be delivered along with the firmware.

Obtained from: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/imx/sdma/sdma-imx6q.bin https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/LICENSE.sdma_firmware

3 years agoUnobfuscate "KERNLOAD" parameter on amd64. This change lines-up amd64 with the
sobomax [Wed, 25 Nov 2020 23:19:01 +0000 (23:19 +0000)]
Unobfuscate "KERNLOAD" parameter on amd64. This change lines-up amd64 with the
i386 and the rest of supported architectures by defining KERNLOAD in the
vmparam.h and getting rid of magic constant in the linker script, which albeit
documented via comment but isn't programmatically accessible at a compile time.

Use KERNLOAD to eliminate another (matching) magic constant 100 lines down
inside unremarkable TU "copy.c" 3 levels deep in the EFI loader tree.

Reviewed by: markj
Approved by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D27355

3 years agoAdd a manpage for kernel TLS.
jhb [Wed, 25 Nov 2020 23:17:23 +0000 (23:17 +0000)]
Add a manpage for kernel TLS.

This subsumes some of the content from tcp(4) describing the socket
options but also adds additional notes.

Reviewed by: gallatin, hselasky
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27272

3 years agopipe: follow up cleanup to previous
mjg [Wed, 25 Nov 2020 22:53:21 +0000 (22:53 +0000)]
pipe: follow up cleanup to previous

The commited patch was incomplete.

- add back missing goto retry, noted by jhb
- 'if (error)'  -> 'if (error != 0)'
- consistently do:

if (error != 0)
    break;
continue;

instead of:

if (error != 0)
    break;
else
    continue;

This adds some 'continue' uses which are not needed, but line up with the
rest of pipe_write.

3 years agopipe: drop spurious pipeunlock/pipelock cycle on write
mjg [Wed, 25 Nov 2020 21:41:23 +0000 (21:41 +0000)]
pipe: drop spurious pipeunlock/pipelock cycle on write

3 years agoIPv6: set ifdisabled in the kernel rather than in rc
bz [Wed, 25 Nov 2020 20:58:01 +0000 (20:58 +0000)]
IPv6: set ifdisabled in the kernel rather than in rc

Enable ND6_IFF_IFDISABLED when the interface is created in the
kernel before return to user space.

This avoids a race when an interface is create by a program which
also calls ifconfig IF inet6 -ifdisabled and races with the
devd -> /etc/pccard_ether -> .. netif start IF -> ifdisabled
calls (the devd/rc framework disabling IPv6 again after the program
had enabled it already).

In case the global net.inet6.ip6.accept_rtadv was turned on,
we also default to enabling IPv6 on the interfaces, rather than
disabling them.

PR: 248172
Reported by: Gert Doering (gert greenie.muc.de)
Reviewed by: glebius (, phk)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27324

3 years agoExtend the imx6 gpc->gic interrupt controller fixup of fdt data at runtime
ian [Wed, 25 Nov 2020 20:05:05 +0000 (20:05 +0000)]
Extend the imx6 gpc->gic interrupt controller fixup of fdt data at runtime
to work with the pmu and tempmon nodes as well as the soc node.  This allows
interrupts to work on the pmu and tempmon devices even though we don't have
a driver for the low-power gpc interrupt controller (which is not a problem
because we also don't have support for entering deep power-down modes where
it gets used).

3 years agoConvert the imx6_snvs RTC driver to access registers via the syscon device.
ian [Wed, 25 Nov 2020 19:10:20 +0000 (19:10 +0000)]
Convert the imx6_snvs RTC driver to access registers via the syscon device.
This is required for it to work correctly in the GENERIC kernel.

3 years agoAdd the standard extres pseudo devices to the IMX6 kernel config.
ian [Wed, 25 Nov 2020 19:08:22 +0000 (19:08 +0000)]
Add the standard extres pseudo devices to the IMX6 kernel config.

Some imx6 drivers are being converted to use features that weren't available
when they were first written (such as accessing shared device registers via
the syscon pseudo-device), so imx6 custom kernels that reference those
devices will now need this infrastructure in place.

3 years agoA couple small fixes for the imx6_sdma driver...
ian [Wed, 25 Nov 2020 18:09:01 +0000 (18:09 +0000)]
A couple small fixes for the imx6_sdma driver...

Attach after interrupt controllers, since the attach function tries to
set up an interrupt handler.

Check for the availability of the required firmware early in the attach
code (before allocating resources).  If the firmware is not available, set
a static var to remember that, so that if the device is re-probed on later
passes it won't repeatedly try to attach and then complain again about
missing firmware.

3 years agoif: Fix non-VIMAGE build
kp [Wed, 25 Nov 2020 17:15:24 +0000 (17:15 +0000)]
if: Fix non-VIMAGE build

if_link_ifnet() and if_unlink_ifnet() are needed even when VIMAGE is not
enabled.

MFC after: 2 weeks
Sponsored by: Modirum MDPay

3 years agoffs_softdep.c: get_parent_vp(): Fix bp lock leak when inum inode was already freed.
kib [Wed, 25 Nov 2020 17:12:21 +0000 (17:12 +0000)]
ffs_softdep.c: get_parent_vp(): Fix bp lock leak when inum inode was already freed.

Reported by: markj, pho
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoUse designated initializers for libc pthread stubs' jump table.
kib [Wed, 25 Nov 2020 17:04:26 +0000 (17:04 +0000)]
Use designated initializers for libc pthread stubs' jump table.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agolibsysdecode: correctly decode mmap flags
kaktus [Wed, 25 Nov 2020 16:30:57 +0000 (16:30 +0000)]
libsysdecode: correctly decode mmap flags

r352913 added decoding of mmap PROT_MAX()'d flags but didn’t account for the
case where different values were specified for PROT_MAX and regular flags.
Fix it.

Submitted by: sigsys_gmail.com
Reported by: sigsys_gmail.com
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D27312

3 years agoOnly attach the ti_scm_syscon driver when running on a compatible TI chip.
ian [Wed, 25 Nov 2020 15:45:20 +0000 (15:45 +0000)]
Only attach the ti_scm_syscon driver when running on a compatible TI chip.
This prevents attaching on non-TI systems in the GENERIC kernel.

Reviewed by: manu@, mmel@

3 years agoif: Protect V_ifnet in vnet_if_return()
kp [Wed, 25 Nov 2020 15:07:22 +0000 (15:07 +0000)]
if: Protect V_ifnet in vnet_if_return()

When we terminate a vnet (i.e. jail) we move interfaces back to their home
vnet. We need to protect our access to the V_ifnet CK_LIST.

We could enter NET_EPOCH, but if_detach_internal() (called from if_vmove())
waits for net epoch callback completion. That's not possible from NET_EPOCH.
Instead, we take the IFNET_WLOCK, build a list of the interfaces that need to
move and, once we've released the lock, move them back to their home vnet.

We cannot hold the IFNET_WLOCK() during if_vmove(), because that results in a
LOR between ifnet_sx, in_multi_sx and iflib ctx lock.

Separate out moving the ifp into or out of V_ifnet, so we can hold the lock as
we do the list manipulation, but do not hold it as we if_vmove().

Reviewed by: melifaro
MFC after: 2 weeks
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D27279

3 years agoclang: allow -fstack-clash-protection on FreeBSD
emaste [Wed, 25 Nov 2020 14:26:13 +0000 (14:26 +0000)]
clang: allow -fstack-clash-protection on FreeBSD

-fstack-clash-protection was added in Clang commit e67cbac81211 but was
enabled only on Linux.  It should work fine on FreeBSD as well, so
enable it.

To be discussed and upstreamed with a test.  The OS test should probably
just be removed.

Reviewed by: dim
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27366