]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agopkgbase: allow the pkg format to be overridden
emaste [Sun, 19 Jan 2020 14:46:28 +0000 (14:46 +0000)]
pkgbase: allow the pkg format to be overridden

Compressing .txz packages can be rather slow, and speed is likely more
important than disk space during development.  Allow package format to
be set via PKG_FORMAT make variable.

Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23257

4 years agocache: convert numcachehv to counter(9) on 64-bit platforms
mjg [Sun, 19 Jan 2020 05:37:27 +0000 (05:37 +0000)]
cache: convert numcachehv to counter(9) on 64-bit platforms

4 years agovfs: plug a conditional assigment of lo_name in getnewvnode
mjg [Sun, 19 Jan 2020 05:36:45 +0000 (05:36 +0000)]
vfs: plug a conditional assigment of lo_name in getnewvnode

It only matters for witness. No functional changes.

4 years ago[PowerPC] Fix 32-bit ubldr calling convention
bdragon [Sun, 19 Jan 2020 04:13:19 +0000 (04:13 +0000)]
[PowerPC] Fix 32-bit ubldr calling convention

Due to the way u-boot for 32-bit powerpc is compiled, the interrupt code
assumes that the GOT pointer (r30) on u-boot is always intact.

When making syscalls to u-boot, ensure that we have restored r30 like we
found it before we enable interrupts to prevent u-boot from crashing if a
timer interrupt was pending.

This fixes ubldr on e500 qemu (assuming you have recompiled qemu's u-boot
with API support!)

Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23258

4 years agolibbe: use the new zfs_mount_at()
kevans [Sun, 19 Jan 2020 02:48:56 +0000 (02:48 +0000)]
libbe: use the new zfs_mount_at()

More background is available in r356876, but this new interface is more
portable across ZFS implementations and cleaner for what libbe is attempting
to achieve anyways.

MFC after: 3 days

4 years agolibzfs: add zfs_mount_at
kevans [Sun, 19 Jan 2020 02:45:02 +0000 (02:45 +0000)]
libzfs: add zfs_mount_at

This will be used in libbe in place of the internal zmount(); libbe only
wants to be able to mount a dataset at an arbitrary mountpoint without
altering dataset/pool properties. The natural way to do this in a portable
way is by creating a zfs_mount_at() interface that's effectively zfs_mount()
+ a mountpoint parameter. zfs_mount() is now a light wrapper around the new
method.

The interface and implementation have already been accepted into ZFS On
Linux, and the next commit to switch libbe() over to this new interface will
solve the last compatibility issue with ZoL.  The next sysutils/openzfs
rebase against ZoL should be able to build libbe/bectl with only minor
adjustments to build glue.

Reviewed by: Ryan Moeller <ryan freqlabs com>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D23132

4 years agopkgbase: cache pkg ABI for all world/kernel packages
emaste [Sat, 18 Jan 2020 22:58:32 +0000 (22:58 +0000)]
pkgbase: cache pkg ABI for all world/kernel packages

Rather than invoking `pkg config ABI` repeatedly.

Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23255

4 years agosysent targets: further cleanup and deduplication
kevans [Sat, 18 Jan 2020 20:37:45 +0000 (20:37 +0000)]
sysent targets: further cleanup and deduplication

r355473 vastly improved the readability and cleanliness of these Makefiles.
Every single one of them follows the same pattern and duplicates the exact
same logic.

Now that we have GENERATED/SRCS, split SRCS up into the two parameters we'll
use for ${MAKESYSCALLS} rather than assuming a specific ordering of SRCS and
include a common sysent.mk to handle the rest. This makes it less tedious to
make sweeping changes.

Some default values are provided for GENERATED/SYSENT_*; almost all of these
just use a 'syscalls.master' and 'syscalls.conf' in cwd, and they all use
effectively the same filenames with an arbitrary prefix. Most ABIs will be
able to get away with just setting GENERATED_PREFIX and including
^/sys/conf/sysent.mk, while others only need light additions. kern/Makefile
is the notable exception, as it doesn't take a SYSENT_CONF and the generated
files are spread out between ^/sys/kern and ^/sys/sys, but it otherwise fits
the pattern enough to use the common version.

Reviewed by: brooks, imp
Nice!: emaste
Differential Revision: https://reviews.freebsd.org/D23197

4 years agoCirrus-CI: bump VM image to FreeBSD 12.1
emaste [Sat, 18 Jan 2020 20:19:07 +0000 (20:19 +0000)]
Cirrus-CI: bump VM image to FreeBSD 12.1

12.0 will be EOL.

Sponsored by: The FreeBSD Foundation

4 years agopcpu_page_alloc: guard against empty NUMA domains
gallatin [Sat, 18 Jan 2020 18:25:37 +0000 (18:25 +0000)]
pcpu_page_alloc: guard against empty NUMA domains

Some systems, such as higher end Threadripper, may have
NUMA domains with no physical memory, Don't allocate
from these domains.

This fixes a "panic: vm_wait in early boot" on my 2990WX desktop

Reviewed by: jeff
Sponsored by: Netflix

4 years agoifa_maintain_loopback_route: adjust debugging output
eugen [Sat, 18 Jan 2020 04:48:05 +0000 (04:48 +0000)]
ifa_maintain_loopback_route: adjust debugging output

Correction after r333476:

- write this as LOG_DEBUG again instead of LOG_INFO;
- get back function name into the message;
- error may be ESRCH if an address is removed in process (by carp f.e.),
not only ENOENT;
- expression complexity grows, so try making it more readable.

MFC after: 1 week

4 years agoD23057: [PowerPC] Fix offset calculations in bridge mode
bdragon [Sat, 18 Jan 2020 04:12:41 +0000 (04:12 +0000)]
D23057: [PowerPC] Fix offset calculations in bridge mode

In rS354701, I replaced text relocations with offsets from &generictrap.

Unfortunately, the magic variable I was using doesn't actually mean the
address of &generictrap, in bridge mode it actually means &generictrap64.

So, for bridge mode to work, it is necessary to differentiate between
"where do we need to branch to to handle a trap" and "where is &generictrap
for purposes of doing relative math".

Introduce a new TRAP_ENTRY and use it instead of TRAP_GENTRAP for doing
actual calls to the generic trap handler.

Reported by: Mark Millard <marklmi@yahoo.com>
Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23057
> Description of fields to fill in above:                     76 columns --|
> PR:                       If and which Problem Report is related.
> Submitted by:             If someone else sent in the change.
> Reported by:              If someone else reported the issue.
> Reviewed by:              If someone else reviewed your modification.
> Approved by:              If you needed approval for this commit.
> Obtained from:            If the change is from a third party.
> MFC after:                N [day[s]|week[s]|month[s]].  Request a reminder email.
> MFH:                      Ports tree branch name.  Request approval for merge.
> Relnotes:                 Set to 'yes' for mention in release notes.
> Security:                 Vulnerability reference (one per line) or description.
> Sponsored by:             If the change was sponsored by an organization (each collaborator).
> Differential Revision:    https://reviews.freebsd.org/D### (*full* phabric URL needed).
> Empty fields above will be automatically removed.

M    sys/powerpc/aim/aim_machdep.c
M    sys/powerpc/aim/trap_subr32.S
M    sys/powerpc/aim/trap_subr64.S
M    sys/powerpc/include/trap.h

4 years agoGEOM label: strip leading/trailing space synthesizing devfs names
cem [Sat, 18 Jan 2020 03:33:44 +0000 (03:33 +0000)]
GEOM label: strip leading/trailing space synthesizing devfs names

%20%20%20 is ugly and doesn't really help make human-readable devfs names.

PR: 243318
Reported by: Peter Eriksson <pen AT lysator.liu.se>
Relnotes: yes

4 years agoAdd a 'SINGLETON' directive to kobj interface definition
jhibbits [Sat, 18 Jan 2020 02:39:38 +0000 (02:39 +0000)]
Add a 'SINGLETON' directive to kobj interface definition

Summary:
This makes the interface described in the definition file act like a
pseudo-IFUNC service, by caching the found method locally.

Applying this to the PowerPC MMU definitions, it yields a significant
(15-20%) performance improvement, seen in both a 'make buildworld' and a
parallel build of LLVM, on a POWER9 system.

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D23245

4 years agovfs: distribute freevnodes counter per-cpu
mjg [Sat, 18 Jan 2020 01:29:02 +0000 (01:29 +0000)]
vfs: distribute freevnodes counter per-cpu

It gets rolled up to the global when deferred requeueing is performed.
A dedicated read routine makes sure to return a value only off by a certain
amount.

This soothes a global serialisation point for all 0<->1 hold count transitions.

Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D23235

4 years agopowerpc: Fix the NUMA domain list on powernv
jhibbits [Sat, 18 Jan 2020 01:26:54 +0000 (01:26 +0000)]
powerpc: Fix the NUMA domain list on powernv

Summary:
Consolidate the NUMA associativity handling into a platform function.
Non-NUMA platforms will just fall back to the default (0).  Currently
only implemented for powernv, which uses a lookup table to map the
device tree associativity into a system NUMA domain.

Fixes hangs on powernv after r356534, and corrects a fairly longstanding
bug in powernv's NUMA handling, which ended up using domains 1 and 2 for
devices and memory on power9, while CPUs were bound to domains 0 and 1.

Reviewed by: bdragon, luporl
Differential Revision: https://reviews.freebsd.org/D23220

4 years ago[PowerPC] Fix Book-E direct map for >=16G ram on e5500
bdragon [Sat, 18 Jan 2020 01:22:54 +0000 (01:22 +0000)]
[PowerPC] Fix Book-E direct map for >=16G ram on e5500

It turns out the maximum TLB1 page size on e5500 is 4G, despite the format
being defined for up to 1TB.

So, we need to clamp the DMAP TLB1 entries to not attempt to create 16G or
larger entries.

Fixes boot on my X5000 in which I just installed 16G of RAM.

Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23244

4 years ago[PowerPC] Save a dword in the powerpc64 signal trampoline
bdragon [Fri, 17 Jan 2020 23:41:35 +0000 (23:41 +0000)]
[PowerPC] Save a dword in the powerpc64 signal trampoline

In r291668, an instruction was added to sigcode64.S without the nop pad at
the end being taken out.

Due to alignment, this means that a dword is being wasted on the shared
page for no reason.

Take out this nop, and add some comments while I'm here.

Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23055

4 years agoFix regression in bsdinstall post r356740 - partedit errno(2) 21 EISDIR
woodsb02 [Fri, 17 Jan 2020 22:26:41 +0000 (22:26 +0000)]
Fix regression in bsdinstall post r356740 - partedit errno(2) 21 EISDIR

This resulted in the partitioning step failing if either of the
"Auto (UFS)" or "Manual" options were selected.

Reason: partedit was attempting to open a directory (TMPDIR) read/write,
which resulted in errno(2) 21 - EISDIR - Is a directory.

Reported by: Clay Daniels <clay.daniels.jr@gmail.com>
Reviewed by: Ryan Moeller <ryan@freqlabs.com>
Approved by: emaste, bcran
Differential Revision: https://reviews.freebsd.org/D23232

4 years agonet80211: Move rate printing in amrr_node_stats() to a separate method
cem [Fri, 17 Jan 2020 22:04:11 +0000 (22:04 +0000)]
net80211: Move rate printing in amrr_node_stats() to a separate method

This makes amrr_node_stats() cleaner and allows the rate printing to be
reusable.

Submitted by: Neel Chauhan <neel at neelc.org>
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D22318

4 years agobcm2835_vcbus: unifdef all platform definitions
kevans [Fri, 17 Jan 2020 21:39:28 +0000 (21:39 +0000)]
bcm2835_vcbus: unifdef all platform definitions

Raspberry Pi are all over the board, and the reality is that there's no harm
in including all of the definitions by default but plenty of harm in the
current situation. This change is safe because we match a definition by root
/compatible in the FDT, so there will be no false-positives because of it.

The main array of definitions grows, but it's only walked exactly once to
determine which we need to use.

4 years agoCheck for invalid sstatus values in set_mcontext().
jhb [Fri, 17 Jan 2020 19:13:49 +0000 (19:13 +0000)]
Check for invalid sstatus values in set_mcontext().

Previously, this check was only in sys_sigreturn() which meant that
user applications could write invalid values to the register via
setcontext() or swapcontext().

Reviewed by: mhorne
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23219

4 years agoSave and restore floating point registers in get/set_mcontext().
jhb [Fri, 17 Jan 2020 19:01:59 +0000 (19:01 +0000)]
Save and restore floating point registers in get/set_mcontext().

arm64 and riscv were only saving and restoring floating point
registers for sendsig() and sys_sigreturn(), but not for getcontext(),
setcontext(), and swapcontext().

While here, remove an always-false check for uap being NULL from
sys_sigreturn().

Reviewed by: br, mhorne
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23218

4 years agosrc.conf.5: regen after r356836, DMAGENT dependency on OPENSSL
emaste [Fri, 17 Jan 2020 17:56:31 +0000 (17:56 +0000)]
src.conf.5: regen after r356836, DMAGENT dependency on OPENSSL

4 years agosrc.opts.mk: force DMAGENT off under WITHOUT_OPENSSL
emaste [Fri, 17 Jan 2020 17:53:13 +0000 (17:53 +0000)]
src.opts.mk: force DMAGENT off under WITHOUT_OPENSSL

dma(8) depends on OpenSSL unconditionally.

Reported by: Michael Dexter's Build Options Survey run
MFC after: 1 weeks
Sponsored by: The FreeBSD Foundation

4 years agoRISC-V: fix global pointer assignment at boot
mhorne [Fri, 17 Jan 2020 17:03:25 +0000 (17:03 +0000)]
RISC-V: fix global pointer assignment at boot

As part of the RISC-V ABI, the gp register is expected to initialized
with the address of __global_pointer$ as early as possible. This allows
loads and stores from .sdata to be relaxed based on the value of gp. In
locore.S we do this initialization twice, once each for va and mpva.
However, in both cases the initialization is preceded by an la
instruction, which in theory could be relaxed by the linker.

Move the initialization of gp to be slightly earlier (before la
cpu_exception_handler), and add an additional gp initialization at the
very beginning of _start, before virtual memory is set up.

Reported by: jrtc27
Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D23139

4 years agoUse unsigned loads in fubyte, fuword16, generic_bs_r_1, generic_bs_r_2
br [Fri, 17 Jan 2020 16:48:20 +0000 (16:48 +0000)]
Use unsigned loads in fubyte, fuword16, generic_bs_r_1, generic_bs_r_2
as these functions should do zero-extend.

Discovered by running pci_read_cap(), and by hint from James Clarke.

Reviewed by: James Clarke <jrtc27@jrtc27.com>
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D23236

4 years agolibc: fix build after r356830
mjg [Fri, 17 Jan 2020 15:45:39 +0000 (15:45 +0000)]
libc: fix build after r356830

Apparently building with 'cd lib/libc; make all install' is not the same
as buildworld.

Reported by: Michael Butler

4 years ago[PPC] Fix wrong comment
luporl [Fri, 17 Jan 2020 14:43:58 +0000 (14:43 +0000)]
[PPC] Fix wrong comment

pcb_context[20] holds r12-r31 and not r14-r31, as the comment said.

4 years agovfs: provide F_ISUNIONSTACK as a kludge for libc
mjg [Fri, 17 Jan 2020 14:42:25 +0000 (14:42 +0000)]
vfs: provide F_ISUNIONSTACK as a kludge for libc

Prior to introduction of this op libc's readdir would call fstatfs(2), in
effect unnecessarily copying kilobytes of data just to check fs name and a
mount flag.

Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D23162

4 years agolibc: assume no union stack if fstatfs fails in readdir
mjg [Fri, 17 Jan 2020 14:40:09 +0000 (14:40 +0000)]
libc: assume no union stack if fstatfs fails in readdir

The failure is not really expected, but should it happen it's better to
get some data.

Suggested by: kib

4 years agovfs: shorten lock hold time in vdbatch_process
mjg [Fri, 17 Jan 2020 14:39:00 +0000 (14:39 +0000)]
vfs: shorten lock hold time in vdbatch_process

4 years agoMETA_MODE: Allow 'make all install' to work with filemon.
bdrewery [Fri, 17 Jan 2020 14:29:27 +0000 (14:29 +0000)]
META_MODE: Allow 'make all install' to work with filemon.

Filemon will add the ability to ignore the cookie if the installed file is
missing. Without filemon that's not possible though so if the cookie is present
an the command unchanged then the install wouldn't run.

Sponsored by: DellEMC
MFC after: 2 weeks

4 years agoChange argument order of epoch_call() to more natural, first function,
glebius [Fri, 17 Jan 2020 06:10:24 +0000 (06:10 +0000)]
Change argument order of epoch_call() to more natural, first function,
then its argument.

Reviewed by: imp, cem, jhb

4 years agoFix a long standing bug that was made worse in r355765. When we are cowing a
jeff [Fri, 17 Jan 2020 03:44:04 +0000 (03:44 +0000)]
Fix a long standing bug that was made worse in r355765.  When we are cowing a
page that was previously mapped read-only it exists in pmap until pmap_enter()
returns.  However, we held no reference to the original page after the copy
was complete.  This allowed vm_object_scan_all_shadowed() to collapse an
object that still had pages mapped.  To resolve this, add another page pointer
to the faultstate so we can keep the page xbusy until we're done with
pmap_enter().  Handle busy pages in scan_all_shadowed.  This is already done
in vm_object_collapse_scan().

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

4 years agoSmall tweak to the default behavior of shutdown -c
imp [Fri, 17 Jan 2020 01:20:48 +0000 (01:20 +0000)]
Small tweak to the default behavior of shutdown -c

'shutdown -c' is supposed to power cycle the system rather than doing a normal
reboot. However, when that fails, it halts the system. This is not quite right
since the intent isn't to halt the system but to restart. Make the default init
behavior be to restart the system. The halt(8) interface can be used if you'd
like to powercycle or halt.

MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D23129

4 years agoWe only want to send the speedup to the lower layers when there's a shortage.
imp [Fri, 17 Jan 2020 01:16:23 +0000 (01:16 +0000)]
We only want to send the speedup to the lower layers when there's a shortage.

Only send a speedup when there's a shortage. While this is a little racy, lost
races aren't a big deal for this function. If there's a shorage just popping up
after we check these values, then we'll catch it next time. If there's a
shortage that's just clearing up, we may do some work at the lower layers a
little sooner than we otherwise would have. Sicne shortages are relatively rare
events, both races are acceptable.

Reviewed by: chs
Differential Revision: https://reviews.freebsd.org/D23182

4 years agoUse buf to send speedup
imp [Fri, 17 Jan 2020 01:16:19 +0000 (01:16 +0000)]
Use buf to send speedup

It turns out there's a problem with using g_io to send the speedup. It leads to
a race when there's a resource shortage when a disk fails.

Instead, send BIO_SPEEDUP via struct buf. This is pretty straight forward,
except we need to transfer the bio_flags from b_ioflags for BIO_SPEEDUP commands
in g_vfs_strategy.

Reviewed by: kirk, chs
Differential Revision: https://reviews.freebsd.org/D23117

4 years agoPass BIO_SPEEDUP through all the geom layers
imp [Fri, 17 Jan 2020 01:15:55 +0000 (01:15 +0000)]
Pass BIO_SPEEDUP through all the geom layers

While some geom layers pass unknown commands down, not all do. For the ones that
don't, pass BIO_SPEEDUP down to the providers that constittue the geom, as
applicable. No changes to vinum or virstor because I was unsure how to add this
support, and I'm also unsure how to test these. gvinum doesn't implement
BIO_FLUSH either, so it may just be poorly maintained. gvirstor is for testing
and not supportig BIO_SPEEDUP is fine.

Reviewed by: chs
Differential Revision: https://reviews.freebsd.org/D23183

4 years agounionfs: use MNTK_NOMSYNC
mjg [Thu, 16 Jan 2020 22:45:08 +0000 (22:45 +0000)]
unionfs: use MNTK_NOMSYNC

4 years agoFix pfdenied not returning any results
kp [Thu, 16 Jan 2020 22:08:05 +0000 (22:08 +0000)]
Fix pfdenied not returning any results

When _a is empty we end up with an invalid invocation of pfctl, and no output.
We must add quotes to make it clear to pfctl that we're passing an empty anchor
name.

PR: 224415
Submitted by: sigsys AT gmail.com
MFC after: 2 weeks

4 years agodwmmc: Remove max_hz from the softc
manu [Thu, 16 Jan 2020 21:50:53 +0000 (21:50 +0000)]
dwmmc: Remove max_hz from the softc

We never use it so directly set the value to the mmc host structure.

4 years agovfs: increment numvnodes without the vnode list lock unless under pressure
mjg [Thu, 16 Jan 2020 21:45:21 +0000 (21:45 +0000)]
vfs: increment numvnodes without the vnode list lock unless under pressure

The vnode list lock is only needed to reclaim free vnodes or kick the vnlru
thread (or to block and not miss a wake up (but note the sleep has a timeout so
this would not be a correctness issue)). Try to get away without the lock by
just doing an atomic increment.

The lock is contended e.g., during poudriere -j 104 where about half of all
acquires come from vnode allocation code.

Note the entire scheme needs a rewrite, the above just reduces it's SMP impact.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D23140

4 years agovfs: refcator vnode allocation
mjg [Thu, 16 Jan 2020 21:43:13 +0000 (21:43 +0000)]
vfs: refcator vnode allocation

Semantics are almost identical. Some code is deduplicated and there are
fewer memory accesses.

Reviewed by: kib, jeff
Differential Revision: https://reviews.freebsd.org/D23158

4 years agorandom(6): Fix off-by-one
cem [Thu, 16 Jan 2020 21:38:44 +0000 (21:38 +0000)]
random(6): Fix off-by-one

After r355693, random(6) -f sometimes fail to output all the lines of the
input file.  This is because the range from which random indices are chosen
is too big, so occasionally the random selection doesn't correspond to any
line and nothing gets printed.

(Ed. note: Mea culpa.  Working on r355693, I was confused by the sometime
use of 1-indexing, sometimes 0-indexing in randomize_fd().)

Submitted by: Ryan Moeller <ryan AT freqlabs.com>
X-MFC-With: r355693
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D23199

4 years agosetextattr: Increase stdin buffer size to 4096
asomers [Thu, 16 Jan 2020 21:31:56 +0000 (21:31 +0000)]
setextattr: Increase stdin buffer size to 4096

Extended attribute values can potentially be quite large. One test for ZFS
is supposed to set a 200MB xattr. However, the buffer size for reading
values from stdin with setextattr -i is so small that the test times out
waiting for tiny chunks of data to be buffered and appended to an sbuf.

Increasing the buffer size should help alleviate some of the burden of
reallocating larger sbufs when writing large extended attributes.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D23211

4 years agoarm64: rockchip: Add RK3399 PWM driver
manu [Thu, 16 Jan 2020 21:25:13 +0000 (21:25 +0000)]
arm64: rockchip: Add RK3399 PWM driver

Add a driver for the pwm controller in the RK3399 SoC

Submitted by: bdragon (original version)
Reviewed by: ganbold (previous version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19046

4 years agoarm64: rockchip: Add new interface for rk_pinctrl
manu [Thu, 16 Jan 2020 21:21:20 +0000 (21:21 +0000)]
arm64: rockchip: Add new interface for rk_pinctrl

The gpio controller in rockchips SoC in a child of the pinctrl driver
and cannot control pullups and pulldowns.
Use the new fdt_pinctrl interface for accessing pin capabilities and
setting them.
We can now report that every pins is capable of being IN or OUT function
and PULLUP PULLDOWN.
If the pin isn't in gpio mode no changes will be allowed.

Reviewed by: ganbold (previous version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D22849

4 years agofdt_pinctrl: Add new methods for gpios
manu [Thu, 16 Jan 2020 21:19:27 +0000 (21:19 +0000)]
fdt_pinctrl: Add new methods for gpios

Most of the gpio controller cannot configure or get the configuration
of the pin muxing as it's usually handled in the pinctrl driver.
But they can know what is the pinmuxing driver either because they are
child of it or via the gpio-range property.
Add some new methods to fdt_pinctrl that a pin controller can implement.
Some methods are :
fdt_pinctrl_is_gpio: Use to know if the pin in the gpio mode
fdt_pinctrl_set_flags: Set the flags of the pin (pullup/pulldown etc ...)
fdt_pinctrl_get_flags: Get the flags of the pin (pullup/pulldown etc ...)

The defaults method returns EOPNOTSUPP.

Reviewed by: ian, bcr (manpages)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23093

4 years agoregulator_fixed: Add a get_voltage method
manu [Thu, 16 Jan 2020 20:52:26 +0000 (20:52 +0000)]
regulator_fixed: Add a get_voltage method

Some consumer cannot know the voltage of the regulator without it.
While here, refuse to attach is min_voltage != max_voltage, it
shouldn't happens anyway.

Reviewed by: mmel
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23003

4 years agoarm: allwinner: ahci: target-supply is optional
manu [Thu, 16 Jan 2020 20:19:20 +0000 (20:19 +0000)]
arm: allwinner: ahci: target-supply is optional

The target-supply regulator is optional so don't fail if it's not present.
While here disable the clock on detach.

MFC after: 2 weeks
X-MFC-With: 356600

4 years agoGenerate MAC address from the FreeBSD OUI range.
krion [Thu, 16 Jan 2020 20:12:15 +0000 (20:12 +0000)]
Generate MAC address from the FreeBSD OUI range.

Submitted by: aleksandr.fedorov_vstack_com
Approved by: kevans
Differential Revision: https://reviews.freebsd.org/D23168

4 years agoarm: allwinner: Add support for bank supply
manu [Thu, 16 Jan 2020 20:02:41 +0000 (20:02 +0000)]
arm: allwinner: Add support for bank supply

Each GPIO bank is powered by a different pin and so can be powered at different
voltage from different regulators.
Add a new config that now hold the pinmux data and the banks available on each
SoCs.
Since the aw_gpio driver being also the pinmux one it's attached before the PMIC
so add a config_intrhook_oneshot function that will enable the needed regulators
when the system is fully functional.

MFC after: 2 weeks

4 years agoaxp8xx: Add a regnode_init method
manu [Thu, 16 Jan 2020 19:59:00 +0000 (19:59 +0000)]
axp8xx: Add a regnode_init method

This method will set the desired voltaged based on values in the DTS.
It will not enable the regulator, this is the job of either a consumer
or regnode_set_constraint SYSINIT if the regulator is boot_on or always_on.

MFC after: 2 weeks

4 years agoaxp8xx: Add missing voltage regulators offset
manu [Thu, 16 Jan 2020 19:57:38 +0000 (19:57 +0000)]
axp8xx: Add missing voltage regulators offset

This lead to writing the desired voltage value to the wrong register.

MFC after: 2 weeks

4 years agopkgbase: move profiling _p.a libs into -development packages
emaste [Thu, 16 Jan 2020 17:27:08 +0000 (17:27 +0000)]
pkgbase: move profiling _p.a libs into -development packages

Profiling library archives are part of the development environment; they
don't need to be in separate -profile packages.

(In fact we can probably just eliminate the _p.a archives assuming that
profiling will be done using hwpmc etc., but that is a change for later.)

Discussed with: bapt, manu
Sponsored by: The FreeBSD Foundation

4 years agoRemove debug code not needed anymore.
tuexen [Thu, 16 Jan 2020 17:15:06 +0000 (17:15 +0000)]
Remove debug code not needed anymore.

Submitted by: Richard Scheffenegger
Reviewed by: tuexen@
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23208

4 years agoUpdate release(7) to note OSRELEASE is only relevant when the
gjb [Thu, 16 Jan 2020 15:07:52 +0000 (15:07 +0000)]
Update release(7) to note OSRELEASE is only relevant when the
'install' target is invoked.

While here, bump the sample output version name, and explicitly
add the 'obj' target to avoid polluting the src checkout.

Submitted by: Trond Endrestol
PR: 243287 (related)
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (netgate.com)

4 years agoAllow building bin/cat on non-FreeBSD systems
arichardson [Thu, 16 Jan 2020 14:15:00 +0000 (14:15 +0000)]
Allow building bin/cat on non-FreeBSD systems

`cat -l` is needed during the installworld phase and other system's cat
don't support that flag. To avoid portability issues when compiling on
Linux/macOS (such as the the direct access to &fp->_mbstate), we
disable the entire multibyte support when building as a boostrap tool.

Reviewed By: brooks, emaste
Differential Revision: https://reviews.freebsd.org/D13939

4 years agoAllow bootstrapping mkimg on macOS/Linux
arichardson [Thu, 16 Jan 2020 14:14:55 +0000 (14:14 +0000)]
Allow bootstrapping mkimg on macOS/Linux

On these systems the (u)int64_t typedefs will not be implicitly defined by the
previous includes, so include <stdint.h> in the header that uses uint64_t.

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D23202

4 years agoMerge commit 894f742acb from llvm git (by me):
arichardson [Thu, 16 Jan 2020 14:14:50 +0000 (14:14 +0000)]
Merge commit 894f742acb from llvm git (by me):

  [MIPS][ELF] Use PC-relative relocations in .eh_frame when possible

  When compiling position-independent executables, we now use
  DW_EH_PE_pcrel | DW_EH_PE_sdata4. However, the MIPS ABI does not define a
  64-bit PC-relative ELF relocation so we cannot use sdata8 for the large
  code model case. When using the large code model, we fall back to the
  previous behaviour of generating absolute relocations.

  With this change clang-generated .o files can be linked by LLD without
  having to pass -Wl,-z,notext (which creates text relocations).
  This is simpler than the approach used by ld.bfd, which rewrites the
  .eh_frame section to convert absolute relocations into relative references.

  I saw in D13104 that apparently ld.bfd did not accept pc-relative relocations
  for MIPS ouput at some point. However, I also checked that recent ld.bfd
  can process the clang-generated .o files so this no longer seems true.

  Reviewed By: atanasyan
  Differential Revision: https://reviews.llvm.org/D72228

Merge commit 8e8ccf47 from llvm git (by me)

  [MIPS] Don't emit R_(MICRO)MIPS_JALR relocations against data symbols

  The R_(MICRO)MIPS_JALR optimization only works when used against functions.
  Using the relocation against a data symbol (e.g. function pointer) will
  cause some linkers that don't ignore the hint in this case (e.g. LLD prior
  to commit 5bab291) to generate a relative branch to the data symbol
  which crashes at run time. Before this patch, LLVM was erroneously emitting
  these relocations against local-dynamic TLS function pointers and global
  function pointers with internal visibility.

  Reviewers: atanasyan, jrtc27, vstefanovic
  Reviewed By: atanasyan
  Differential Revision: https://reviews.llvm.org/D72571

These two changes should allow using lld for MIPS64 (and maybe also MIPS32)
by default.
The second commit is not strictly necessary for clang+lld since LLD9 will
not perform the R_MIPS_JALR optimization (it was only added for 10) but it
is probably required in order to use recent ld.bfd.

Reviewed By: dim, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23203

4 years ago[PowerPC64] Enable virtio drivers
luporl [Thu, 16 Jan 2020 11:33:15 +0000 (11:33 +0000)]
[PowerPC64] Enable virtio drivers

This enables virtio modules on PowerPC* target.
On PowerPC64, drivers are also kernel builtin.

QEMU currently needs to be patched to in order to work on LE hosts due to known
issue affecting pre-1.0 (legacy) virtio drivers.

The patch was submitted to QEMU mail list by @afscoelho_gmail.com, available at
https://lists.nongnu.org/archive/html/qemu-devel/2020-01/msg01496.html

Submitted by: Alfredo Dal'Ava Junior <alfredo.junior@eldorado.org.br>
Reviewed by: luporl
Differential Revision: https://reviews.freebsd.org/D22833

4 years agovfs: reimplement vlrureclaim to actually use LRU
mjg [Thu, 16 Jan 2020 10:44:02 +0000 (10:44 +0000)]
vfs: reimplement vlrureclaim to actually use LRU

Take advantage of global ordering introduced in r356672.

Reviewed by: mckusick (previous version)
Differential Revision: https://reviews.freebsd.org/D23067

4 years agoSimplify VM and UMA startup by eliminating boot pages. Instead use careful
jeff [Thu, 16 Jan 2020 05:01:21 +0000 (05:01 +0000)]
Simplify VM and UMA startup by eliminating boot pages.  Instead use careful
ordering to allocate early pages in the same way boot pages were but only
as needed.  After the KVA allocator has started up we allocate the KVA that
we consumed during boot.  This also makes the boot pages freeable since they
have vm_page structures allocated with the rest of memory.

Parts of this patch were written and tested by markj.

Reviewed by: glebius, markj
Differential Revision: https://reviews.freebsd.org/D23102

4 years ago[PPC64] memcpy/memmove/bcopy optimization
luporl [Wed, 15 Jan 2020 20:25:52 +0000 (20:25 +0000)]
[PPC64] memcpy/memmove/bcopy optimization

For copies shorter than 512 bytes, the data is copied using plain
ld/std instructions.
For 512 bytes or more, the copy is done in 3 phases:

Phase 1: copy from the src buffer until it's aligned at a 16-byte boundary
Phase 2: copy as many aligned 64-byte blocks from the src buffer as possible
Phase 3: copy the remaining data, if any

In phase 2, this code uses VSX instructions when available. Otherwise,
it uses ldx/stdx.

Submitted by: Luis Pires <lffpires_ruabrasil.org> (original version)
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D15118

4 years ago[PPC64] strncpy optimization
luporl [Wed, 15 Jan 2020 19:53:03 +0000 (19:53 +0000)]
[PPC64] strncpy optimization

Assembly optimization of strncpy for PowerPC64, using double words
instead of bytes to copy strings.

Submitted by: Leonardo Bianconi <leonardo.bianconi_eldorado.org.br> (original version)
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D15369

4 years ago[PPC64] strcpy optimization
luporl [Wed, 15 Jan 2020 19:46:01 +0000 (19:46 +0000)]
[PPC64] strcpy optimization

Assembly optimization of strcpy for PowerPC64, using double words
instead of bytes to copy strings.

Submitted by: Leonardo Bianconi <leonardo.bianconi_eldorado.org.br> (original version)
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D15368

4 years agoacpi_ibm: reference ThinkPad instead of IBM
emaste [Wed, 15 Jan 2020 19:43:45 +0000 (19:43 +0000)]
acpi_ibm: reference ThinkPad instead of IBM

These are now Lenovo ThinkPads, not IBM ThinkPads.

PR: 234403
Submitted by: Kevin Zheng <kevinz5000@gmail.com> (original)

4 years agoPeter Holm reports that his test that does an umount(8) on an active
mckusick [Wed, 15 Jan 2020 18:53:32 +0000 (18:53 +0000)]
Peter Holm reports that his test that does an umount(8) on an active
mount point while numerous tests are running that are writing to
files on that mount point cause the unmount(8) to hang forever.

The unmount(8) system call is handled in the kernel by the dounmount()
function. The cause of the hang is that prior to dounmount() calling
VFS_UNMOUNT() it is calling VFS_SYNC(mp, MNT_WAIT). The MNT_WAIT
flag indicates that VFS_SYNC() should not return until all the dirty
buffers associated with the mount point have been written to disk.
Because user processes are allowed to continue writing and can do
so faster than the data can be written to disk, the call to VFS_SYNC()
can never finish.

Unlike VFS_SYNC(), the VFS_UNMOUNT() routine can suspend all processes
when they request to do a write thus having a finite number of dirty
buffers to write that cannot be expanded. There is no need to call
VFS_SYNC() before calling VFS_UNMOUNT(), because VFS_UNMOUNT() needs
to flush everything again anyway after suspending writes, to catch
anything that was dirtied between the VFS_SYNC() and writes being
suspended.

The fix is to simply remove the unnecessary call to VFS_SYNC() from
dounmount().

Reported by:  Peter Holm
Analysis by:  Chuck Silvers
Tested by:    Peter Holm
MFC after:    7 days
Sponsored by: Netflix

4 years agoFix a spacing error from the previous commit for -ll mode. Add a little
scottl [Wed, 15 Jan 2020 16:47:44 +0000 (16:47 +0000)]
Fix a spacing error from the previous commit for -ll mode.  Add a little
more space padding to that mode to give the columns a consistent offset.

4 years agomips trampoline: don't bother with unwind tables
kevans [Wed, 15 Jan 2020 15:59:32 +0000 (15:59 +0000)]
mips trampoline: don't bother with unwind tables

The utility here seems somewhat limited, but clang will attempt to generate
.eh_frame and actively fail in doing so. It is perhaps worth investigating
why it's being generated in the first place (GCC doesn't do so), but this
isn't a high priority.

4 years agoHandle a NULL thread pointer in linux_close_file().
markj [Wed, 15 Jan 2020 15:31:35 +0000 (15:31 +0000)]
Handle a NULL thread pointer in linux_close_file().

This can happen if a file is closed during unix socket GC.  The same bug
was fixed for devfs descriptors in r228361.

PR: 242913
Reported and tested by: iz-rpi03@hs-karlsruhe.de
Reviewed by: hselasky, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23178

4 years agoUpdate WITHOUT_BINUTILS* descriptions
emaste [Wed, 15 Jan 2020 13:52:13 +0000 (13:52 +0000)]
Update WITHOUT_BINUTILS* descriptions

In the WITHOUT_ descriptions we don't need to mention that ld.bfd is
limited to powerpc. When WITHOUT_BINUTILS is specified ld.bfd is not
installed on any CPU architecture.

4 years agobsdinstall: Change "default" (first) Partitioning method to ZFS
woodsb02 [Wed, 15 Jan 2020 07:47:52 +0000 (07:47 +0000)]
bsdinstall: Change "default" (first) Partitioning method to ZFS

Reported by: Ruben Schade (during his talk at linux.conf.au)
Approved by: philip
Differential Revision: https://reviews.freebsd.org/D23173

4 years agogif_transmit() must always be called in the network epoch.
glebius [Wed, 15 Jan 2020 06:18:32 +0000 (06:18 +0000)]
gif_transmit() must always be called in the network epoch.

4 years agoA miss from r356754.
glebius [Wed, 15 Jan 2020 06:12:39 +0000 (06:12 +0000)]
A miss from r356754.

4 years agoIntroduce NET_EPOCH_CALL() macro and use it everywhere where we free
glebius [Wed, 15 Jan 2020 06:05:20 +0000 (06:05 +0000)]
Introduce NET_EPOCH_CALL() macro and use it everywhere where we free
data based on the network epoch.   The macro reverses the argument
order of epoch_call(9) - first function, then its argument. NFC

4 years agoUse official macro to enter/exit the network epoch. NFC
glebius [Wed, 15 Jan 2020 05:48:36 +0000 (05:48 +0000)]
Use official macro to enter/exit the network epoch. NFC

4 years agoMechanically substitute assertion of in_epoch(net_epoch_preempt) to
glebius [Wed, 15 Jan 2020 05:45:27 +0000 (05:45 +0000)]
Mechanically substitute assertion of in_epoch(net_epoch_preempt) to
NET_EPOCH_ASSERT(). NFC

4 years agoStop header pollution and don't include if_var.h via in_pcb.h.
glebius [Wed, 15 Jan 2020 03:41:15 +0000 (03:41 +0000)]
Stop header pollution and don't include if_var.h via in_pcb.h.

4 years agoSince this code dereferences struct ifnet, it must include if_var.h
glebius [Wed, 15 Jan 2020 03:40:32 +0000 (03:40 +0000)]
Since this code dereferences struct ifnet, it must include if_var.h
explicitly, not via header pollution.  While here move TCPSTATES
declaration right above the include that is going to make use of it.

4 years agoSince this code uses if_ref()/if_rele() it must include if_var.h
glebius [Wed, 15 Jan 2020 03:39:11 +0000 (03:39 +0000)]
Since this code uses if_ref()/if_rele() it must include if_var.h
explicitly, not via header pollution.

4 years agoNetgraph queue processing thread must process all its items
glebius [Wed, 15 Jan 2020 03:35:57 +0000 (03:35 +0000)]
Netgraph queue processing thread must process all its items
in the network epoch.

Reported by: Michael Zhilin <mizhka@ >

4 years ago- Move global network epoch definition to epoch.h, as more different
glebius [Wed, 15 Jan 2020 03:34:21 +0000 (03:34 +0000)]
- Move global network epoch definition to epoch.h, as more different
  subsystems tend to need to know about it, and including if_var.h is
  huge header pollution for them.  Polluting possible non-network
  users with single symbol seems much lesser evil.
- Remove non-preemptible network epoch.  Not used yet, and unlikely
  to get used in close future.

4 years agoThe non-preemptible network epoch identified by net_epoch isn't used.
glebius [Wed, 15 Jan 2020 03:30:33 +0000 (03:30 +0000)]
The non-preemptible network epoch identified by net_epoch isn't used.
This code definitely meant net_epoch_preempt.

4 years agovfs: in vop_stdadd_writecount only vlazy vnodes on mounts using msync
mjg [Wed, 15 Jan 2020 01:34:05 +0000 (01:34 +0000)]
vfs: in vop_stdadd_writecount only vlazy vnodes on mounts using msync

The only reason to vlazy there is to (overzealously) ensure all vnodes
which need to be visited by msync scan can be found there.

In particluar this is of no use zfs and tmpfs.

While here depessimize the check.

4 years agotmpfs: add missing CLTFLAG_MPSAFE annotation
mjg [Wed, 15 Jan 2020 01:32:11 +0000 (01:32 +0000)]
tmpfs: add missing CLTFLAG_MPSAFE annotation

4 years agonfs: add missing CLTFLAG_MPSAFE annotations
mjg [Wed, 15 Jan 2020 01:31:57 +0000 (01:31 +0000)]
nfs: add missing CLTFLAG_MPSAFE annotations

4 years agofusefs: add missing CLTFLAG_MPSAFE annotation
mjg [Wed, 15 Jan 2020 01:31:28 +0000 (01:31 +0000)]
fusefs: add missing CLTFLAG_MPSAFE annotation

4 years agortld: remove hand rolled memset and bzero
mjg [Wed, 15 Jan 2020 01:30:32 +0000 (01:30 +0000)]
rtld: remove hand rolled memset and bzero

They were introduced to take care of ifunc, but right now no architecture
provides ifunc'ed variants. Since rtld uses memset extensively this results in
a pessmization. Should someone want to use ifunc here they should provide a
mandatory symbol (e.g., rtld_memset).

See the review for profiling data.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D23176

4 years agobsdinstall: Use TMPDIR if set
bcran [Wed, 15 Jan 2020 00:45:05 +0000 (00:45 +0000)]
bsdinstall: Use TMPDIR if set

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Reviewed by: bcran, Nick Wolff <darkfiberiru@gmail.com>
Differential Revision: https://reviews.freebsd.org/D22979/

4 years agoWhen sync'ing a mount point, the mount point's vnodes were scanned
mckusick [Tue, 14 Jan 2020 22:27:46 +0000 (22:27 +0000)]
When sync'ing a mount point, the mount point's vnodes were scanned
twice. Once to update the changed inodes, and a second time to update
changed quota information. This change merges these two scans into a
single scan which does both inode and quota updates.

MFC after: 7 days

4 years agosrc.conf.5: regen after r356736, limiting ld.bfd to powerpc
emaste [Tue, 14 Jan 2020 18:06:09 +0000 (18:06 +0000)]
src.conf.5: regen after r356736, limiting ld.bfd to powerpc

4 years agoPreserve the inherited value of the status register in cpu_set_upcall().
jhb [Tue, 14 Jan 2020 18:00:04 +0000 (18:00 +0000)]
Preserve the inherited value of the status register in cpu_set_upcall().

Instead of re-deriving the value of SR using logic similar to
exec_set_regs(), just inherit the value from the existing thread
similar to fork().

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

4 years agolimit ld.bfd to powerpc
emaste [Tue, 14 Jan 2020 17:56:54 +0000 (17:56 +0000)]
limit ld.bfd to powerpc

All archs except powerpc either use lld or require external toolchain.
powerpc still needs binutils ld to link 32-bit binaries.

Reviewed by: jhibbits
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23107

4 years agoRevert r353140: Re-add ALLOW_MIPS_SHARED_TEXTREL, sprinkle it around
kevans [Tue, 14 Jan 2020 17:50:13 +0000 (17:50 +0000)]
Revert r353140: Re-add ALLOW_MIPS_SHARED_TEXTREL, sprinkle it around

arichardson has an actual fix for the same issue that this was working
around; given that we don't build with llvm today, go ahead and revert the
workaround in advance.

4 years agosrc.conf.5: regen after option description updates
emaste [Tue, 14 Jan 2020 17:38:34 +0000 (17:38 +0000)]
src.conf.5: regen after option description updates

4 years agoUpdate WITH_/WITHOUT_CLANG_IS_CC descriptions
emaste [Tue, 14 Jan 2020 17:35:34 +0000 (17:35 +0000)]
Update WITH_/WITHOUT_CLANG_IS_CC descriptions

Describe /usr/bin/cc etc. as links to the compiler, and don't conflate
WITHOUT_CLANG_IS_CC with installing GCC.  Leave a reference to WITH_GCC
and WITHOUT_CLANG_IS_CC installing links to GCC, although this will be
removed in ~1.5 months when GCC 4.2.1 is removed from the tree.

Sponsored by: The FreeBSD Foundation

4 years agoUpdate WITH_AMD description reflecting upcoming removal
emaste [Tue, 14 Jan 2020 16:59:21 +0000 (16:59 +0000)]
Update WITH_AMD description reflecting upcoming removal

In-tree amd(8) is deprecated; update WITH_AMD's description to make
this more clear.

Sponsored by: The FreeBSD Foundation

4 years agoDo not skip line-by-line comparison if -q and -I are specified.
markj [Tue, 14 Jan 2020 15:35:03 +0000 (15:35 +0000)]
Do not skip line-by-line comparison if -q and -I are specified.

This fixes a regression from r356695.

Submitted by: kevans
Reported by: Jenkins via lwhsu
MFC after: 6 days