]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agohastd(8) assumes it has no extra file descriptors opened
Eugene Grosbein [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.
Alexander V. Chernikov [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.
Alexander V. Chernikov [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.
Konstantin Belousov [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.
Konstantin Belousov [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.
Michal Meloun [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
Yuri Pankov [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.
Alexander Motin [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.
Alexander Motin [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.
Alexander Motin [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.
Alexander Motin [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.
Alexander Motin [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
Alan Somers [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
Poul-Henning Kamp [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().
Alexander V. Chernikov [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:
Alexander V. Chernikov [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.
Michal Meloun [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.
Konstantin Belousov [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.
Konstantin Belousov [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.
John Baldwin [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.
John Baldwin [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
John Baldwin [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
Kyle Evans [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
Peter 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
Ed Maste [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
Ruslan Bukin [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
Mark Johnston [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.
Hajimu UMEMOTO [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
Mark Johnston [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.
Alexander Motin [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
Stefan Eßer [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
Rebecca Cran [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
Rebecca Cran [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.
Alexander Motin [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
Mateusz Piotrowski [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.
Konstantin Belousov [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.
Konstantin Belousov [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
Emmanuel Vadot [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
Stefan Eßer [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.
Alexander Motin [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
Alan Somers [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().
Konstantin Belousov [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.
Konstantin Belousov [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.
Konstantin Belousov [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().
Konstantin Belousov [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.
Konstantin Belousov [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
Stefan Eßer [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
Alex Richardson [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
Alex Richardson [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
Stefan Eßer [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
Emmanuel Vadot [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
Emmanuel Vadot [Thu, 26 Nov 2020 17:19:30 +0000 (17:19 +0000)]
arm: tegra: Remove unused variable

3 years agoarm: mv: Remove unused code
Emmanuel Vadot [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
Emmanuel Vadot [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
Stefan Eßer [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
Stefan Eßer [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
Emmanuel Vadot [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
Emmanuel Vadot [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
Emmanuel Vadot [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).
Hans Petter Selasky [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
Ulrich Spörlein [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
Alex Richardson [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
Pawel Biernacki [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
Poul-Henning Kamp [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
Mateusz Guzik [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.
Peter 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
Alan Somers [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
Alan Somers [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.
Alexander Motin [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.
Alexander Motin [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 Lepore [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
Maxim Sobolev [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.
John Baldwin [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
Mateusz Guzik [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
Mateusz Guzik [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
Bjoern A. Zeeb [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 Lepore [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 Lepore [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 Lepore [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 Lepore [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
Kristof Provost [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.
Konstantin Belousov [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.
Konstantin Belousov [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
Pawel Biernacki [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 Lepore [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()
Kristof Provost [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
Ed Maste [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

3 years agodtb: allwinner: Add pineh64 to the build
Emmanuel Vadot [Wed, 25 Nov 2020 11:21:03 +0000 (11:21 +0000)]
dtb: allwinner: Add pineh64 to the build

3 years agoarm: allwinner: aw_rtc: Add H6 compatible
Emmanuel Vadot [Wed, 25 Nov 2020 11:20:04 +0000 (11:20 +0000)]
arm: allwinner: aw_rtc: Add H6 compatible

3 years agoarm64: allwinner: H6: Fix pll 4x clocks
Emmanuel Vadot [Wed, 25 Nov 2020 11:19:42 +0000 (11:19 +0000)]
arm64: allwinner: H6: Fix pll 4x clocks

The clock configured by the registers are the 4x version not the 1x.

3 years agoif: Remove ifnet_rwlock
Kristof Provost [Wed, 25 Nov 2020 10:56:38 +0000 (10:56 +0000)]
if: Remove ifnet_rwlock

It no longer serves any purpose, as evidenced by the fact that we never take it
without ifnet_sxlock.

Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D27278

3 years agoDrop superfluous "of" from the systat example.
Benedict Reuschling [Wed, 25 Nov 2020 10:21:29 +0000 (10:21 +0000)]
Drop superfluous "of" from the systat example.

3 years agokern: cpuset: properly rebase when attaching to a jail
Kyle Evans [Wed, 25 Nov 2020 03:14:25 +0000 (03:14 +0000)]
kern: cpuset: properly rebase when attaching to a jail

The current logic is a fine choice for a system administrator modifying
process cpusets or a process creating a new cpuset(2), but not ideal for
processes attaching to a jail.

Currently, when a process attaches to a jail, it does exactly what any other
process does and loses any mask it might have applied in the process of
doing so because cpuset_setproc() is entirely based around the assumption
that non-anonymous cpusets in the process can be replaced with the new
parent set.

This approach slightly improves the jail attach integration by modifying
cpuset_setproc() callers to indicate if they should rebase their cpuset to
the indicated set or not (i.e. cpuset_setproc_update_set).

If we're rebasing and the process currently has a cpuset assigned that is
not the containing jail's root set, then we will now create a new base set
for it hanging off the jail's root with the existing mask applied instead of
using the jail's root set as the new base set.

Note that the common case will be that the process doesn't have a cpuset
within the jail root, but the system root can freely assign a cpuset from
a jail to a process outside of the jail with no restriction. We assume that
that may have happened or that it could happen due to a race when we drop
the proc lock, so we must recheck both within the loop to gather up
sufficient freed cpusets and after the loop.

To recap, here's how it worked before in all cases:

0     4 <-- jail              0      4 <-- jail / process
|                             |
1                 ->          1
|
3 <-- process

Here's how it works now:

0     4 <-- jail             0       4 <-- jail
|                            |       |
1                 ->         1       5 <-- process
|
3 <-- process

or

0     4 <-- jail             0       4 <-- jail / process
|                            |
1 <-- process     ->         1

More importantly, in both cases, the attaching process still retains the
mask it had prior to attaching or the attach fails with EDEADLK if it's
left with no CPUs to run on or the domain policy is incompatible. The
author of this patch considers this almost a security feature, because a MAC
policy could grant PRIV_JAIL_ATTACH to an unprivileged user that's
restricted to some subset of available CPUs the ability to attach to a jail,
which might lift the user's restrictions if they attach to a jail with a
wider mask.

In most cases, it's anticipated that admins will use this to be able to,
for example, `cpuset -c -l 1 jail -c path=/ command=/long/running/cmd`,
and avoid the need for contortions to spawn a command inside a jail with a
more limited cpuset than the jail.

Reviewed by: jamie
MFC after: 1 month (maybe)
Differential Revision: https://reviews.freebsd.org/D27298

3 years agokern: cpuset: rename _cpuset_create() to cpuset_init()
Kyle Evans [Wed, 25 Nov 2020 02:12:24 +0000 (02:12 +0000)]
kern: cpuset: rename _cpuset_create() to cpuset_init()

cpuset_init() is better descriptor for what the function actually does. The
name was previously taken by a sysinit that setup cpuset_zero's mask
from all_cpus, it was removed in r331698 before stable/12 branched.

A comment referencing the removed sysinit has now also been removed, since
the setup previously done was moved into cpuset_thread0().

Suggested by: markj
MFC after: 1 week

3 years agokern: cpuset: allow cpuset_create() to take an allocated *setp
Kyle Evans [Wed, 25 Nov 2020 01:42:32 +0000 (01:42 +0000)]
kern: cpuset: allow cpuset_create() to take an allocated *setp

Currently, it must always allocate a new set to be used for passing to
_cpuset_create, but it doesn't have to. This is purely kern_cpuset.c
internal and it's sparsely used, so just change it to use *setp if it's
not-NULL and modify the two consumers to pass in the address of a NULL
cpuset.

This paves the way for consumers that want the unr allocation without the
possibility of sleeping as long as they've done their due diligence to
ensure that the mask will properly apply atop the supplied parent
(i.e. avoiding the free_unr() in the last failure path).

Reviewed by: jamie, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27297

3 years agoRemove uses of CRIOGET in OCF tests after r368005.
John Baldwin [Wed, 25 Nov 2020 01:31:00 +0000 (01:31 +0000)]
Remove uses of CRIOGET in OCF tests after r368005.

Pointy hat to: jhb
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27367

3 years agoRemove a reference to CRIOGET missed in r368005.
John Baldwin [Wed, 25 Nov 2020 01:09:58 +0000 (01:09 +0000)]
Remove a reference to CRIOGET missed in r368005.

3 years agokern: never restart syscalls calling closefp(), e.g. close(2)
Kyle Evans [Wed, 25 Nov 2020 01:08:57 +0000 (01:08 +0000)]
kern: never restart syscalls calling closefp(), e.g. close(2)

All paths leading into closefp() will either replace or remove the fd from
the filedesc table, and closefp() will call fo_close methods that can and do
currently sleep without regard for the possibility of an ERESTART. This can
be dangerous in multithreaded applications as another thread could have
opened another file in its place that is subsequently operated on upon
restart.

The following are seemingly the only ones that will pass back ERESTART
in-tree:
- sockets (SO_LINGER)
- fusefs
- nfsclient

Reviewed by: jilles, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27310

3 years agoRemove the cloned file descriptors for /dev/crypto.
John Baldwin [Wed, 25 Nov 2020 00:10:54 +0000 (00:10 +0000)]
Remove the cloned file descriptors for /dev/crypto.

Crypto file descriptors were added in the original OCF import as a way
to provide per-open data (specifically the list of symmetric
sessions).  However, this gives a bit of a confusing API where one has
to open /dev/crypto and then invoke an ioctl to obtain a second file
descriptor.  This also does not match the API used with /dev/crypto on
other BSDs or with Linux's /dev/crypto driver.

Character devices have gained support for per-open data via cdevpriv
since OCF was imported, so use cdevpriv to simplify the userland API
by permitting ioctls directly on /dev/crypto descriptors.

To provide backwards compatibility, CRIOGET now opens another
/dev/crypto descriptor via kern_openat() rather than dup'ing the
existing file descriptor.  This preserves prior semantics in case
CRIOGET is invoked multiple times on a single file descriptor.

Reviewed by: markj
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27302

3 years agoPull the check for VM ownership into ppt_find().
John Baldwin [Tue, 24 Nov 2020 23:56:33 +0000 (23:56 +0000)]
Pull the check for VM ownership into ppt_find().

This reduces some code duplication.  One behavior change is that
ppt_assign_device() will now only succeed if the device is unowned.
Previously, a device could be assigned to the same VM multiple times,
but each time it was assigned, the device's state was reset.

Reviewed by: markj, grehan
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27301