]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoRemove unnecessary MODULE_DEPEND() from imx_i2c.c, and also from rk_i2c
ian [Tue, 17 Dec 2019 17:03:03 +0000 (17:03 +0000)]
Remove unnecessary MODULE_DEPEND() from imx_i2c.c, and also from rk_i2c
where it got copied to.

4 years agoThis commit is a bit of a re-arrange of deck chairs. It
rrs [Tue, 17 Dec 2019 16:08:07 +0000 (16:08 +0000)]
This commit is a bit of a re-arrange of deck chairs. It
gets both rack and bbr ready for the completion of the STATs
framework in FreeBSD. For now if you don't have both NF_stats and
stats on it disables them. As soon as the rest of the stats framework
lands we can remove that restriction and then just uses stats when
defined.

Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D22479

4 years agoUpdate owc_gpiobus (one-wire over gpio) to the modern gpio_pin interface.
ian [Tue, 17 Dec 2019 15:56:48 +0000 (15:56 +0000)]
Update owc_gpiobus (one-wire over gpio) to the modern gpio_pin interface.

It used to be required that a device be a child of gpiobus(4) to manipulate
gpio pins. That requirement didn't work well for FDT-based systems with many
cross-hierarchy users of gpio, so a more modern framework was created that
removed the old hierarchy requirement.

These changes adapt the owc_gpiobus driver to use the newer gpio_pin_*
functions to acquire, release, and manipulate gpio pins. This allows a
single driver to work for both hinted-attachment and fdt-based systems, and
removes the requirement that any one-wire fdt nodes must appear at the root
of the devicetree.

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

4 years agoConvert zpcpu_* inlines to macros and add zpcpu_replace.
mjg [Tue, 17 Dec 2019 14:53:55 +0000 (14:53 +0000)]
Convert zpcpu_* inlines to macros and add zpcpu_replace.

This allows them to do basic type casting internally, effectively relieving
consumers from having to cast on their own.

4 years agoReplace homemade getline(3) by actual getline(3)
bapt [Tue, 17 Dec 2019 11:03:32 +0000 (11:03 +0000)]
Replace homemade getline(3) by actual getline(3)

4 years agoarm64: rockchip: rk_gpio: Fix pin number
manu [Tue, 17 Dec 2019 10:57:31 +0000 (10:57 +0000)]
arm64: rockchip: rk_gpio: Fix pin number

The maxpin counter starts at 0, fix one by one error.
This is still not totally correct for some banks in some SoC that have
fewer pins but this will be dealt with in another commit.

MFC after: 3 days

4 years agoarm64: rockchip: rk_pinctrl: Fix clear bits in SYSCON_MODIFY
manu [Tue, 17 Dec 2019 10:55:28 +0000 (10:55 +0000)]
arm64: rockchip: rk_pinctrl: Fix clear bits in SYSCON_MODIFY

r351187 change the SYSCON_WRITE to SYSCON_MODIFY but didn't changed the
mask variable that used to hold the bitmask in the upper 16 bits of the
register that control which bits are changed. So we ended up clearing
bit from the upper 16bits half which are always 0 after a read.
Use the correct bit mask for bits that we want to clear.

MFC after: 3 days

4 years agoUse strtoimax.
bapt [Tue, 17 Dec 2019 09:13:48 +0000 (09:13 +0000)]
Use strtoimax.

Use existing strtoimax instead of reinventing it

4 years agoloader.efi: efi_readkey_ex needs to key despite the shift status or toggle status
tsoome [Tue, 17 Dec 2019 08:30:11 +0000 (08:30 +0000)]
loader.efi: efi_readkey_ex needs to key despite the shift status or toggle status

From UEFI specification 2.8, page 434:
"It should also be noted that certain input devices may not be able to produce
shift or toggle state information, and in those cases the high order bit in
the respective Toggle and Shift state fields should not be active."

But we still need to check for ScanCode and UnicodeChar.

PR: 242660
Reported by: Trond Endrestol
MFC after: 1 week

4 years agoRevert r355831
imp [Tue, 17 Dec 2019 04:21:35 +0000 (04:21 +0000)]
Revert r355831

It wasn't supposed to change the defaults, but actually does. Back this out
until that can be sorted out.

4 years agokbd: const'ify a couple of keyboard_driver fields
kevans [Tue, 17 Dec 2019 03:30:49 +0000 (03:30 +0000)]
kbd: const'ify a couple of keyboard_driver fields

Nothing modifies these things, but const'ify out of an abundance of caution.
If we could const'ify the definition in each keyboard driver, I likely
would- improper mutations here can lead to misbehavior or slightly more
annoying to debug state.

4 years agoTwo minor issues:
imp [Tue, 17 Dec 2019 03:20:37 +0000 (03:20 +0000)]
Two minor issues:
(1) Don't define load/store 64 atomics for o32. They aren't atomic
there.
(2) Add comment about why we need 64 atomic define on n32 only.

4 years agoConvert routing statistics to VNET_PCPUSTAT.
glebius [Tue, 17 Dec 2019 02:02:26 +0000 (02:02 +0000)]
Convert routing statistics to VNET_PCPUSTAT.

Submitted by: ocochard
Reviewed by: melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D22834

4 years agoForgotten to remove the previous if statement in commit r355838.
araujo [Tue, 17 Dec 2019 01:37:02 +0000 (01:37 +0000)]
Forgotten to remove the previous if statement in commit r355838.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19400

4 years agoAttempt to load vmm(4) module before creating a guest using vm_create()
araujo [Tue, 17 Dec 2019 01:33:26 +0000 (01:33 +0000)]
Attempt to load vmm(4) module before creating a guest using vm_create()
wrapper in libvmmapi.

Submitted by: Rob Fairbanks <rob.fx907_gmail.com>
Reviewed by: jhb
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19400

4 years agoImplement bio_speedup
imp [Tue, 17 Dec 2019 00:13:45 +0000 (00:13 +0000)]
Implement bio_speedup

React to the BIO_SPEED command in the cam io scheduler by completing
as successful BIO_DELETE commands that are pending, up to the length
passed down in the BIO_SPEEDUP cmomand. The length passed down is a
hint for how much space on the drive needs to be recovered. By
completing the BIO_DELETE comomands, this allows the upper layers to
allocate and write to the blocks that were about to be trimmed. Since
FreeBSD implements TRIMSs as advisory, we can eliminliminate them and
go directly to writing.

The biggest benefit from TRIMS coomes ffrom the drive being able t
ooptimize its free block pool inthe log run. There's little nto no
bene3efit in the shoort term. , sepeciall whn the trim is followed by
a write. Speedup lets  us make this tradeoff.

Reviewed by: kirk, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18351

4 years agoAdd BIO_SPEEDUP signalling to UFS
imp [Tue, 17 Dec 2019 00:13:40 +0000 (00:13 +0000)]
Add BIO_SPEEDUP signalling to UFS

When we have a resource shortage in UFS, send down a BIO_SPEEDUP to
give the CAM I/O scheduler a heads up that we have a resource shortage
and that it should bias its decisions knowing that.

Reviewed by: kirk, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18351

4 years agoAdd BIO_SPEEDUP
imp [Tue, 17 Dec 2019 00:13:35 +0000 (00:13 +0000)]
Add BIO_SPEEDUP

Add BIO_SPEEDUP bio command and g_io_speedup wrapper. It tells the
lower layers that the upper layers are dealing with some shortage
(dirty pages and/or disk blocks). The lower layers should do what they
can to speed up anything that's been delayed.

The first use will be to tell the CAM I/O scheduler that any TRIM
shaping should be short-circuited because the system needs
blocks. We'll also call it when there's too many resources used by
UFS.

Reviewed by: kirk, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18351

4 years agoEliminate the TRIM_ACTIVE flag.
imp [Tue, 17 Dec 2019 00:13:30 +0000 (00:13 +0000)]
Eliminate the TRIM_ACTIVE flag.

Rather than a trim active flag, have a counter that can be used to
have a absolute limit on the number of trims in flight independent of
any I/O limiting factors.

Sponsored by: Netflix

4 years agoTweak the ddb show cam iosched command a bit.
imp [Tue, 17 Dec 2019 00:13:26 +0000 (00:13 +0000)]
Tweak the ddb show cam iosched command a bit.

For each of the different queue types, list the name of the
queue. While it can be worked out from context, this makes it more
useful and clearer.

Sponsored by: Netflix

4 years agoAdd rate limiters to TRIM.
imp [Tue, 17 Dec 2019 00:13:21 +0000 (00:13 +0000)]
Add rate limiters to TRIM.

Add rate limiters to trims. Trims are a bit different than reads or
writes in that they can be combined, so some care needs to be taken
where we rate limit them. Additional work will be needed to push the
working rate limit below the I/O quanta rate for things like IOPS.

Sponsored by: Netflix

4 years agoNVME trim stuff.
imp [Tue, 17 Dec 2019 00:11:48 +0000 (00:11 +0000)]
NVME trim stuff.

Add two sysctls to control pacing of nvme
trims. kern.cam.nda.X.goal_trim is the number of upper layer
BIO_DEELETE requests to try to collecet before sending TRIM down too
the nvme drive. trim_ticks is the number of ticks, at mosot, to wait
for at least goal_trim BIOS_DELEETE requests to come in.

Trim pacing is useful when a large number off disjoint trims are
comoing in from the upper layers. Since we have no way to chain
toogether trims from the upper layers that are sent down, this acts as
a hueristic to group trims into reasonable sized chunks. What's
reasonable varies from drive to drive.

Sponsored by: Netflix

4 years agoAvoid a tautological bitwise compare.
brooks [Tue, 17 Dec 2019 00:10:19 +0000 (00:10 +0000)]
Avoid a tautological bitwise compare.

This looks like a bit of debugging code that sliped into the initial
import of the new ATA framework. This changes the behavior to omit a
line of output that appears to have been intended for omission.

Reviewed by: mav
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22845

4 years ago[atheros] [mips] Add the GPIO driver (back) to the TL-WDR3600/TL-WDR4300 kernel.
adrian [Tue, 17 Dec 2019 00:00:03 +0000 (00:00 +0000)]
[atheros] [mips] Add the GPIO driver (back) to the TL-WDR3600/TL-WDR4300 kernel.

So it turns out that sometime in the past I removed the GPIO bits here
and was going to move it into a module in order to save a little space.
However, it turns out that was a mistake on this particular AP - it
uses a pair of GPIO lines to control the two receive LNAs on the 2GHz
radio and without them enabled the radio is a LOT DEAF.

With this re-introduced (and some replacement userland tools to save
space, *cough* cpio/libarchive) I can actually use these chipsets
again as a 2G station.  Without the LNA the AP was seeing a per-radio
RSSI upstairs here of around 3-5dB, with the LNA on it's around 15dB,
more than enough to actually use wifi upstairs and also in line with
the other Atheros / Intel devices I have up here.

Big oopsie to Adrian.  Big, big oopsie.

4 years agoDouble the size of ARG_MAX on LP64 platforms.
pfg [Mon, 16 Dec 2019 23:55:30 +0000 (23:55 +0000)]
Double the size of ARG_MAX on LP64 platforms.

As modern software keeps growing in size, we get requests to update the
value of ARG_MAX in order to link the resulting object files. Other OSs
have much higher values but Increasiong ARG_MAX has a multiplied effect on
KVA, so just bumping this value is dangerous in some archs like ARM32 that
can exhaust KVA rather easily.

While it would be better to have a unique value for all archs, other OSs
(Illumos in partidular) can have different ARG_MAX limits depending on the
platform,  For now we want to be really conservative so we are avoidng
the change on ILP32 and in the alternative case we only double it since that
seems to work well enough for recent Code Aster.

I was planning to bump the _FreeBSD_version but it was bumped recently
(r355798) so we can reuse the 1300068 value for this change.

PR: 241710
MFC after: 5 days

4 years agoAdd back accidentally dropped masking...
imp [Mon, 16 Dec 2019 23:08:09 +0000 (23:08 +0000)]
Add back accidentally dropped masking...

-       PCI_MASK_CONFIG(sc->dev, CBBR_BRIDGECTRL,
-           & ~CBBM_BRIDGECTRL_INTR_IREQ_ISA_EN, 2);

was accidentally dropped from r355822 in the refactor. Restore it since 16-bit
cards may fail without it (some bridges autodetect this properly, so my laptop
worked when I tested it).

Noticed by: rpokala@

4 years agoAllow proper builds of libxo's CSV encoder:
phil [Mon, 16 Dec 2019 22:05:03 +0000 (22:05 +0000)]
Allow proper builds of libxo's CSV encoder:
- Move libxo.a build to subdirectory (lib/libxo/libxo/Makefile)
- Add .WAIT target to delay encoder build til after libxo
- Use FILES to install encoder library as csv.enc
- Update import script to put xo_config.h in new location

4 years agoUse symbolic names for int13 calls
imp [Mon, 16 Dec 2019 21:52:12 +0000 (21:52 +0000)]
Use symbolic names for int13 calls

For all the INT13 calls, use symbolic names instead of magic numbers. This makes
it easier to understand what the code is doing w/o a trip to google to find what
these numbers mean.

4 years agoMove attachment of pccard children into exca library. Attach the
imp [Mon, 16 Dec 2019 21:35:02 +0000 (21:35 +0000)]
Move attachment of pccard children into exca library. Attach the
cardbus and pccard children before the sysctls are added rather than
after.

4 years agoAdd slot number ivar to return which slot number the child is attached to.
imp [Mon, 16 Dec 2019 21:34:57 +0000 (21:34 +0000)]
Add slot number ivar to return which slot number the child is attached to.

This will always be 0 for pccbb, but may be non-zero for other kinds of bridges,
should they show up in the tree. Make querying it generic.

4 years agoWe'll never have multiple slots a cardbus bridge. So, replace exca
imp [Mon, 16 Dec 2019 21:34:51 +0000 (21:34 +0000)]
We'll never have multiple slots a cardbus bridge. So, replace exca
array with a singleton.

Also, pccbb isa attachment is never going to happen, do disconnect it from the
build (will delete this in future commit). It would need to be updated as well,
but since this code is effectively dead code, remove it from the build instead.

4 years agoRemove all the RELEASE_CRUNCH defines, they are useless.
imp [Mon, 16 Dec 2019 21:06:24 +0000 (21:06 +0000)]
Remove all the RELEASE_CRUNCH defines, they are useless.

RELEASE_CRUNCH has been broken for a very long time. Remove the
last remants from the tree.

4 years agoAdd a hack to make ^T work for Linux binaries, enabled with
trasz [Mon, 16 Dec 2019 20:15:44 +0000 (20:15 +0000)]
Add a hack to make ^T work for Linux binaries, enabled with
'compat.linux.preserve_vstatus=1' sysctl.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21967

4 years agoRepeat the spinlock_enter/exit pattern from amd64 on other architectures to
jeff [Mon, 16 Dec 2019 20:15:04 +0000 (20:15 +0000)]
Repeat the spinlock_enter/exit pattern from amd64 on other architectures to
fix an assert violation introduced in r355784.  Without this spinlock_exit()
may see owepreempt and switch before reducing the spinlock count.  amd64
had been optimized to do a single critical enter/exit regardless of the
number of spinlocks which avoided the problem and this optimization had
not been applied elsewhere.

Reported by: emaste
Suggested by: rlibby
Discussed with: jhb, rlibby
Tested by: manu (arm64)

4 years agoAdd compat.linux.emul_path, so it can be set to something other
trasz [Mon, 16 Dec 2019 20:07:04 +0000 (20:07 +0000)]
Add compat.linux.emul_path, so it can be set to something other
than "/compat/linux".  Useful when you have several compat directories
with different Linux versions and you don't want to clash with files
installed by linux-c7 packages.

Reviewed by: bcr (manpages)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22574

4 years agoRevert r355813
imp [Mon, 16 Dec 2019 19:16:26 +0000 (19:16 +0000)]
Revert r355813

It was extracted from a larger tree and is incomplete. Will resubmit after
reworking.

4 years agoUPDATING: remove outdated caution against make -j
emaste [Mon, 16 Dec 2019 19:08:49 +0000 (19:08 +0000)]
UPDATING: remove outdated caution against make -j

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

4 years agoImplement a system-wide limit or da and ada devices for delete.
imp [Mon, 16 Dec 2019 18:16:44 +0000 (18:16 +0000)]
Implement a system-wide limit or da and ada devices for delete.

Excesively large TRIMs can result in timeouts, which cause big
problems. Limit trims to 1GB to mititgate these issues.

Reviewed by: scottl
Differential Revision: https://reviews.freebsd.org/D22809

4 years agoDon't use K&R definitions. No functional changes.
trasz [Mon, 16 Dec 2019 17:45:15 +0000 (17:45 +0000)]
Don't use K&R definitions.  No functional changes.

Reported by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agokbd drivers: don't double register keyboard drivers
kevans [Mon, 16 Dec 2019 16:41:24 +0000 (16:41 +0000)]
kbd drivers: don't double register keyboard drivers

Keyboard drivers are generally registered via linker set. In these cases,
they're also available as kmods which use KPI for registering/unregistering
keyboard drivers outside of the linker set.

For built-in modules, we still fire off MOD_LOAD and maybe even MOD_UNLOAD
if an error occurs, leading to registration via linker set and at MOD_LOAD
time.

This is a minor optimization at best, but it keeps the internal kbd driver
tidy as a future change will merge the linker set driver list into its
internal keyboard_drivers list via SYSINIT and simplify driver lookup by
removing the need to consult the linker set.

4 years agoFix LLVM libunwnwind _Unwind_Backtrace symbol version for ARM.
mmel [Mon, 16 Dec 2019 14:08:49 +0000 (14:08 +0000)]
Fix LLVM libunwnwind _Unwind_Backtrace symbol version for ARM.
In original  GNU libgcc, _Unwind_Backtrace is published with GCC_3.3 version
for all architectures but ARM. For ARM should be publishes with GCC_4.3.0
version. This was originally omitted in r255095, fixed in r318024 and omitted
aging in LLVM libunwind implementation in r354347.

For ARM _Unwind_Backtrace should be published as default with GCC_4.3.0
version , (because this is right original version) and again as
normal(not-default) with GCC_3.3 version (to maintain ABI compatibility
compiled/linked with wrong pre r318024 libgcc)

PR: 233664

4 years agoFix gcc build after r355790
lwhsu [Mon, 16 Dec 2019 13:32:06 +0000 (13:32 +0000)]
Fix gcc build after r355790

Sponsored by: The FreeBSD Foundation

4 years ago[PPC] Handle qOffsets packet
luporl [Mon, 16 Dec 2019 13:17:39 +0000 (13:17 +0000)]
[PPC] Handle qOffsets packet

On PowerPC, this is needed in order for the debugger to find out
the memory offset where the kernel image was loaded on the remote
target.

This fixes symbol resolution when remote debugging a PowerPC kernel.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D22767

4 years agoInstall missing pcap(3) manual pages and add missing manpage
hselasky [Mon, 16 Dec 2019 09:11:38 +0000 (09:11 +0000)]
Install missing pcap(3) manual pages and add missing manpage
section substitutions.

Submitted by: Martin Beran <martin@mber.cz>
PR: 237893
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agokbd: patch linker set methods, too
kevans [Mon, 16 Dec 2019 04:52:06 +0000 (04:52 +0000)]
kbd: patch linker set methods, too

This is needed after r355796. Some double-registration of kbd drivers needs
to be sorted out, then this sysinit will simply add these drivers into the
normal list and kill off any other bits in the driver that are aware of the
linker set, for simplicity.

4 years agokbd: remove kbdsw, store pointer to driver in each keyboard_t
kevans [Mon, 16 Dec 2019 03:12:53 +0000 (03:12 +0000)]
kbd: remove kbdsw, store pointer to driver in each keyboard_t

The previous implementation relied on a kbdsw array that mirrored the global
keyboards array. This is fine, but also requires extra locking consideration
when accessing to ensure that it's not being resized as new keyboards are
added.

The extra pointer costs little in a struct that there are relatively few of
on any given system, and simplifies locking requirements ever-so-slightly as
we only need to consider the locking requirements of whichever method is
being invoked.

__FreeBSD_version is bumped as any kbd modules will need rebuilt following
this change.

4 years agochrome_kb: remove default get_fkeystr/diag implementations
kevans [Mon, 16 Dec 2019 03:05:35 +0000 (03:05 +0000)]
chrome_kb: remove default get_fkeystr/diag implementations

This file was missed in r355796, but no harm would have come from this.

4 years agokbd: provide default implementations of get_fkeystr/diag
kevans [Mon, 16 Dec 2019 02:44:56 +0000 (02:44 +0000)]
kbd: provide default implementations of get_fkeystr/diag

Most keyboard drivers are using the genkbd implementations as it is;
formally use them for any that aren't set and make
genkbd_get_fkeystr/genkbd_diag private.

4 years agokeyboard switch definitions: standardize on c99 initializers
kevans [Mon, 16 Dec 2019 02:05:44 +0000 (02:05 +0000)]
keyboard switch definitions: standardize on c99 initializers

A future change will provide default implementations for some of these where
it makes sense and most of them are already using the genkbd
implementation (e.g. get_fkeystr, diag).

4 years agokbd drivers: use kbdd_* indirection for diag invocation
kevans [Mon, 16 Dec 2019 01:37:03 +0000 (01:37 +0000)]
kbd drivers: use kbdd_* indirection for diag invocation

These invocations were directly calling enkbd_diag(), rather than
indirection back through kbdd_diag/kbdsw. While they're functionally
equivent, invoking kbdd_diag where feasible (i.e. not in a diag
implementation) makes it easier to visually identify locking needs in these
other drivers.

4 years agoRemove a declaration of sched_clock() redundant after r355779.
markj [Mon, 16 Dec 2019 01:27:14 +0000 (01:27 +0000)]
Remove a declaration of sched_clock() redundant after r355779.

4 years agovfs: allow tail call optimisation in vops in the common case
mjg [Mon, 16 Dec 2019 00:07:51 +0000 (00:07 +0000)]
vfs: allow tail call optimisation in vops in the common case

Most frequently used vops boil down to checking SDT probes, doing the call and
checking again. There is no vop_post/pre in their case but the check after the
call prevents tail call optimisation from taking place. Instead, check once
upfront. Kernels with debug or vops with non-empty vop_post still don't short
circuit.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22739

4 years agovfs: flatten vop vectors
mjg [Mon, 16 Dec 2019 00:06:22 +0000 (00:06 +0000)]
vfs: flatten vop vectors

This eliminates the following loop from all VOP calls:

while(vop != NULL && \
    vop->vop_spare2 == NULL && vop->vop_bypass == NULL)
        vop = vop->vop_default;

Reviewed by: jeff
Tesetd by: pho
Differential Revision: https://reviews.freebsd.org/D22738

4 years agomtx: eliminate recursion support from thread lock
mjg [Mon, 16 Dec 2019 00:04:33 +0000 (00:04 +0000)]
mtx: eliminate recursion support from thread lock

Now that it is not used after schedlock changes got merged.

Note the unlock routine temporarily still checks for it on account of just using
regular spin unlock.

This is a prelude towards a general clean up.

4 years agoProperly detect ATA sanitize errors.
mav [Sun, 15 Dec 2019 23:28:53 +0000 (23:28 +0000)]
Properly detect ATA sanitize errors.

It seems I read specifications not careful enough.  There are devices not
setting successful completion bit, causing previous code report false error.

MFC after: 1 week

4 years agoApply a small optimization to pmap_remove_l3_range(). Specifically, hoist a
alc [Sun, 15 Dec 2019 22:41:57 +0000 (22:41 +0000)]
Apply a small optimization to pmap_remove_l3_range().  Specifically, hoist a
PHYS_TO_VM_PAGE() operation that always returns the same vm_page_t out of
the loop.  (Since arm64 is configured as VM_PHYSSEG_SPARSE, the
implementation of PHYS_TO_VM_PAGE() is more costly than that of
VM_PHYSSEG_DENSE platforms, like amd64.)

MFC after: 1 week

4 years agoloader: rewrite zfs vdev initialization
tsoome [Sun, 15 Dec 2019 21:52:40 +0000 (21:52 +0000)]
loader: rewrite zfs vdev initialization

In some cases the pool discovery will get stuck in infinite loop while setting
up the vdev children.

To fix, we split the vdev setup into two parts, first we create vdevs based on
configuration we do get from pool label, then, we process pool config from MOS
and update the pool config if needed.

Testing done: confirm previously hung loader is not hung any more.

MFC after: 1 week

4 years agoschedlock 4/4
jeff [Sun, 15 Dec 2019 21:26:50 +0000 (21:26 +0000)]
schedlock 4/4

Don't hold the scheduler lock while doing context switches.  Instead we
unlock after selecting the new thread and switch within a spinlock
section leaving interrupts and preemption disabled to prevent local
concurrency.  This means that mi_switch() is entered with the thread
locked but returns without.  This dramatically simplifies scheduler
locking because we will not hold the schedlock while spinning on
blocked lock in switch.

This change has not been made to 4BSD but in principle it would be
more straightforward.

Discussed with: markj
Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22778

4 years agopowerpc/powernv: Set the PTCR for the Nest MMU
jhibbits [Sun, 15 Dec 2019 21:20:18 +0000 (21:20 +0000)]
powerpc/powernv: Set the PTCR for the Nest MMU

The Nest MMU manages address translation for accelerators on the POWER9.  To
do so, it needs a page table, so export the system page table to the Nest
MMU.  This will quietly fail on pre-POWER9 systems that do not have a NMMU.

The NMMU is currently unused, so this change is currently effectively a NOP,
but the NMMU and VAS will eventually be used.

4 years agoschedlock 3/4
jeff [Sun, 15 Dec 2019 21:19:41 +0000 (21:19 +0000)]
schedlock 3/4

Eliminate lock recursion from turnstiles.  This was simply used to avoid
tracking the top-level turnstile lock.  explicitly check for it before
picking up and dropping locks.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22746

4 years agoschedlock 2/4
jeff [Sun, 15 Dec 2019 21:18:07 +0000 (21:18 +0000)]
schedlock 2/4

Do all sleepqueue post-processing in sleepq_remove_thread() so that we
do not require the thread lock after a context switch.

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

4 years agoRewrite arm kernel stack unwind code to work when unwinding through modules.
ian [Sun, 15 Dec 2019 21:16:35 +0000 (21:16 +0000)]
Rewrite arm kernel stack unwind code to work when unwinding through modules.

The arm kernel stack unwinder has apparently never been able to unwind when
the path of execution leads through a kernel module. There was code that
tried to handle modules by looking for the unwind data in them, but it did
so by trying to find symbols which have never existed in arm kernel
modules. That caused the unwind code to panic, and because part of panic
handling calls into the unwind code, that just created a recursion loop.

Locating the unwind data in a loaded module requires accessing the Elf
section headers to find the SHT_ARM_EXIDX section. For preloaded modules
those headers are present in a metadata blob. For dynamically loaded
modules, the headers are present only while the loading is in progress; the
memory is freed once the module is ready to use. For that reason, there is
new code in kern/link_elf.c, wrapped in #ifdef __arm__, to extract the
unwind info while the headers are loaded. The values are saved into new
fields in the linker_file structure which are also conditional on __arm__.

In arm/unwind.c there is new code to locally cache the per-module info
needed to find the unwind tables. The local cache is crafted for lockless
read access, because the unwind code often needs to run in context where
sleeping is not allowed.  A large comment block describes the local cache
list, so I won't repeat it all here.

4 years agoschedlock 1/4
jeff [Sun, 15 Dec 2019 21:11:15 +0000 (21:11 +0000)]
schedlock 1/4

Eliminate recursion from most thread_lock consumers.  Return from
sched_add() without the thread_lock held.  This eliminates unnecessary
atomics and lock word loads as well as reducing the hold time for
scheduler locks.  This will eventually allow for lockless remote adds.

Discussed with: kib
Reviewed by: jhb
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22626

4 years agopowerpc/mpc85xx: Clean up Freescale SATA driver a little
jhibbits [Sun, 15 Dec 2019 21:08:40 +0000 (21:08 +0000)]
powerpc/mpc85xx: Clean up Freescale SATA driver a little

* Remove unused ATA_IN/OUT macros, they just clutter up the file.
* Fix some RID management bits for the channel memory resource.

4 years agoSupport --all-repeats in uniq(1) for compatibility with gnu coreutils.
ian [Sun, 15 Dec 2019 18:05:18 +0000 (18:05 +0000)]
Support --all-repeats in uniq(1) for compatibility with gnu coreutils.

This adds a new -D/--all-repeats option to uniq(1), which outputs each copy
of any repeated lines (as opposed to a single copy of a repeated line). You
can specify a separator option to output a blank line before or after each
group of repeated lines. This adds compatibility with the GNU coreutils
version of uniq(1).

This change also re-groups the -c, -d, -D, -u options in the usage display
and man page to indicate that they are mutally exclusive of each other. This
matches the posix/opengroup definition of uniq(1) command line args. Note
that this change does NOT actually enforce the mutual exclusion in the code,
for now, it simply documents that the arguments should be considered
exclusive with each other.

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

4 years agoRevert r355760, r355759
cem [Sun, 15 Dec 2019 17:33:26 +0000 (17:33 +0000)]
Revert r355760, r355759

And remove the inline/deprecated attribute use entirely in stdlib.h, from
r355747.  The intent was to provide a buildable API transitionary period, but
clearly that was counter-productive.

Reported by: delphij, imp, others

4 years agokbd: convert kbdd_* macros to inline functions
kevans [Sun, 15 Dec 2019 16:28:12 +0000 (16:28 +0000)]
kbd: convert kbdd_* macros to inline functions

This reduces the noise when interested parties wish to de-Giant kbd; these
accesses to kbdsw will need to be properly locked.

4 years agoProperly synchronize completion DMA buffers.
mmel [Sun, 15 Dec 2019 14:28:38 +0000 (14:28 +0000)]
Properly synchronize completion DMA buffers.
Within command completion processing the callback function may access
DMAed data buffer. Synchronize it before use, not after.
This allows to use NVMe disk on non-DMA coherent arm64 system.

MFC after: 3 weeks

4 years agoloader: zfsimpl.c cstyle cleanup
tsoome [Sun, 15 Dec 2019 14:09:49 +0000 (14:09 +0000)]
loader: zfsimpl.c cstyle cleanup

No functional changes intended.

MFC after: 1 week

4 years agoFix a mistake in r355765. We need to activate the page if it is not yet
jeff [Sun, 15 Dec 2019 06:26:47 +0000 (06:26 +0000)]
Fix a mistake in r355765.  We need to activate the page if it is not yet
on a pagequeue.

Reported by: pho

4 years agokbd: drop _KERNEL #ifdef in kbdreg.h
kevans [Sun, 15 Dec 2019 04:22:50 +0000 (04:22 +0000)]
kbd: drop _KERNEL #ifdef in kbdreg.h

This #ifdef is misleading as there are actually no user-serviceable parts
inside and, as far as I can tell, there is no pollution leading from
userland to this header. Furthermore, it becomes a slight nuisance when
attempting to move things around in this header.

4 years agoPreviously we did not support invalid pages in default objects. This means
jeff [Sun, 15 Dec 2019 04:08:24 +0000 (04:08 +0000)]
Previously we did not support invalid pages in default objects.  This means
that if fault fails to progress and needs to restart the loop it must free
the page it is working on and allocate again on restart.  Resolve the few
places that need to be modified to support this condition and simply
deactivate the page.  Presently, we only permit this when fault restarts
for busy contention.  This has an added benefit of removing some object
trylocking in this case.

While here consolidate some page cleanup logic into fault_page_free() and
fault_page_release() to reduce redundant code and automate some teardown.

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

4 years agoAdd a deferred free mechanism for freeing swap space that does not require
jeff [Sun, 15 Dec 2019 03:15:06 +0000 (03:15 +0000)]
Add a deferred free mechanism for freeing swap space that does not require
an exclusive object lock.

Previously swap space was freed on a best effort basis when a page that
had valid swap was dirtied, thus invalidating the swap copy.  This may be
done inconsistently and requires the object lock which is not always
convenient.

Instead, track when swap space is present.  The first dirty is responsible
for deleting space or setting PGA_SWAP_FREE which will trigger background
scans to free the swap space.

Simplify the locking in vm_fault_dirty() now that we can reliably identify
the first dirty.

Discussed with: alc, kib, markj
Differential Revision: https://reviews.freebsd.org/D22654

4 years agoSlightly optimize locking in vm_map_copy_swap_entry(). Anonymous objects
jeff [Sun, 15 Dec 2019 02:02:27 +0000 (02:02 +0000)]
Slightly optimize locking in vm_map_copy_swap_entry().  Anonymous objects
require the object lock to synchronize collapse.  Other swap objects such
as tmpfs do not.

Reported by: mjg
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D22747

4 years agoHandle pagein clustering in vm_page_grab_valid() so that it can be used by
jeff [Sun, 15 Dec 2019 02:00:32 +0000 (02:00 +0000)]
Handle pagein clustering in vm_page_grab_valid() so that it can be used by
exec_map_first_page().  This will also enable pagein clustering for other
interested consumers (tmpfs, md, etc).

Discussed with: alc
Approved by: kib
Differential Revision: https://reviews.freebsd.org/D22731

4 years agocdefs: use more accurate GCC version for the deprecated attribute.
pfg [Sun, 15 Dec 2019 01:56:56 +0000 (01:56 +0000)]
cdefs: use more accurate GCC version for the deprecated attribute.

The message argument in the "deprecated" attribute was introduced in GCC 4.5 *.
Use the accurate version number for consistency, as done already with other
attributes.

* https://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Function-Attributes.html

4 years ago<unistd.h>: remove redundant __BSD_VISIBLE
kevans [Sun, 15 Dec 2019 01:26:57 +0000 (01:26 +0000)]
<unistd.h>: remove redundant __BSD_VISIBLE

This bit is already inside of a larger __BSD_VISIBLE block.

Reported by: vangyzen

4 years agolinuxkpi: Drop incompatible __deprecated definition
cem [Sat, 14 Dec 2019 23:39:32 +0000 (23:39 +0000)]
linuxkpi: Drop incompatible __deprecated definition

Probably all of these linuxkpi stubs should be '#ifndef' guarded, but maybe
that would prevent people from noticing when they are defined.

Introduced in r355759.  For some reason I only ran a buildworld and not a
kernel.  Mea culpa.

Reported by: Mark Millard
X-MFC-with: r355759

4 years agocdefs: Add __deprecated(message) function attribute macro
cem [Sat, 14 Dec 2019 21:52:49 +0000 (21:52 +0000)]
cdefs: Add __deprecated(message) function attribute macro

The legacy version of GCC4 currently in base does not support the
parameterized form of this function attribute, as recent introduced in
stdlib.h (r355747).

As we have done for other function attributes with similar compatibility
problems, add a version-compatibile definition in sys/cdefs.h.  Note that
Clang defines itself to be GCC 4, so one must check for __clang__ in
addition to __GNUC__ version.  On legacy GCC 4, the macro expands to just
the __deprecated__ attribute; on modern GCC or Clang, the macro expands to
the parameterized variant with the message.

Ignoring legacy or unsupported compilers, the macro is also beneficial in
that it is a bit more ergonomic than the full
__attribute__((__deprecated__())) boilerplate.

Reported by: CI (but not tinderbox); imp and others
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D22817

4 years agoUpdate the mount_nfs.8 man page to include NFSv4.2.
rmacklem [Sat, 14 Dec 2019 21:49:47 +0000 (21:49 +0000)]
Update the mount_nfs.8 man page to include NFSv4.2.

r355677 added NFSv4.2 support to the NFS client. This patch updates the
mount_nfs.8 man page to reflect that.
It also clarifies that the "nolockd" option does not apply to NFSv4 mounts.

This is a content change.

4 years agoSimplify the processing a leaf mask to find big-enough ranges of set
dougm [Sat, 14 Dec 2019 19:44:42 +0000 (19:44 +0000)]
Simplify the processing a leaf mask to find big-enough ranges of set
bits, by storing and modifying the complement of the original leaf
mask, and by avoiding some unnecessary intermediate variables in
computing the shift amounts. The logic is similar to what has recently
been committed to sys/sys/bitstring.h.

Compute better hint updates for the case when the cursor starts in
mid-leaf, and eliminates some otherwise viable solutions. Assume the
worst case, that all the eliminated offsets could have been solutions,
and you can still compute a better hint than we use now.

Eliminate some unnecessary conditional control flow.

Approved by: alc
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22666

4 years agoAdd driver for Rockchip PCIe root complex found in RK3399 SOC.
mmel [Sat, 14 Dec 2019 14:56:34 +0000 (14:56 +0000)]
Add driver for Rockchip PCIe root complex found in RK3399 SOC.
Unfortunately, there are some limitations:
- memory aperture of his controller is only 16MiB, so it is nearly
  unusable for graphic cards
- every attempt to generate type 1 config cycle always causes trap.
  These config cycles are disabled now and we don't support cards
  with PCIe switch.
- in some cases, attempt to do config cycle to (probably) not-yet ready
  card also causes trap. This cannot be detected at runtime, but it seems
  like very rare issue.

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

4 years agoAdd sync_file_range(2) implementation to linux(4); it's a thin wrapper
trasz [Sat, 14 Dec 2019 13:37:17 +0000 (13:37 +0000)]
Add sync_file_range(2) implementation to linux(4); it's a thin wrapper
over the usual fsync(2).

This silences some warnings when running "apt-get upgrade".

Reviewed by: brooks, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22371

4 years agoRegen after r355752.
trasz [Sat, 14 Dec 2019 13:32:37 +0000 (13:32 +0000)]
Regen after r355752.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22371

4 years agoFix definitions for linuxulator's sync_file_range(2).
trasz [Sat, 14 Dec 2019 13:30:43 +0000 (13:30 +0000)]
Fix definitions for linuxulator's sync_file_range(2).

Reviewed by: brooks, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22371

4 years agoAdd 'sesutil show' subcommand to show enclosure and its contents
trasz [Sat, 14 Dec 2019 10:58:06 +0000 (10:58 +0000)]
Add 'sesutil show' subcommand to show enclosure and its contents
in a user-friendly way.

Reviewed by: allanjude, bcr (manpages)
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D22567

4 years agoAdd -M option to nc(1), which makes it print the TCP connection
trasz [Sat, 14 Dec 2019 10:53:52 +0000 (10:53 +0000)]
Add -M option to nc(1), which makes it print the TCP connection
statistics obtained with stats(3) in JSON format to standard error.

Reviewed by: allanjude, thj, cem (earlier version)
Tested by: thj
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D21324

4 years agoDeprecate sranddev(3) API
cem [Sat, 14 Dec 2019 08:28:10 +0000 (08:28 +0000)]
Deprecate sranddev(3) API

It serves no useful purpose and wasn't as popular as its equally meritless
cousin, srandomdev(3).

Setting aside the problems with rand(3) in general, the problem with this
interface is that the seed isn't shared with the caller (other than by
attacking the output of the generator, which is trivial, but not a hallmark of
pleasant API design).  The (arguable) utility of rand(3) or random(3) is as a
semi-fast simulation generator which produces consistent results from a given
seed.  These are mutually at odd.  Furthermore, sometimes people got the
mistaken impression that a high quality random seed meant a weak generator like
rand(3) or random(3) could be used for things like cryptographic key
generation.  This is absolutely not so.

The API was never part of a standard and was not widely used in tree.  Existing
in-tree uses have all been removed.

Possible replacement in out of tree codebases:

char buf[3];
time_t t;

time(t);
strftime(buf, sizeof(buf), "%S", gmtime(&t));
srand(atoi(buf));

Relnotes: yes

4 years agouma dbg: flexible size for slab debug bitset too
rlibby [Sat, 14 Dec 2019 05:21:56 +0000 (05:21 +0000)]
uma dbg: flexible size for slab debug bitset too

Recently (r355315) the size of the struct uma_slab bitset field us_free
became dynamic instead of conservative.  Now, make the debug bitset
size dynamic too.  The debug bitset is INVARIANTS-only, so in fact we
don't care too much about the space savings that results from this, but
enabling minimally-sized slabs on INVARIANTS builds is still important
in order to be able to test new slab layouts effectively.

Reviewed by: jeff (previous version), markj (previous version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22759

4 years agopf: Make request_maxcount runtime adjustable
kp [Sat, 14 Dec 2019 02:06:07 +0000 (02:06 +0000)]
pf: Make request_maxcount runtime adjustable

There's no reason for this to be a tunable. It's perfectly safe to
change this at runtime.

Reviewed by: Lutz Donnerhacke
Differential Revision: https://reviews.freebsd.org/D22737

4 years agopfctl: Warn users when they run into kernel limits
kp [Sat, 14 Dec 2019 02:03:47 +0000 (02:03 +0000)]
pfctl: Warn users when they run into kernel limits

Warn users when they try to add/delete/modify more items than the kernel will
allow.

Reviewed by: allanjude (previous version), Lutz Donnerhacke
Differential Revision: https://reviews.freebsd.org/D22733

4 years agoRemove the useless return value from proc_set_cred
mjg [Sat, 14 Dec 2019 00:43:17 +0000 (00:43 +0000)]
Remove the useless return value from proc_set_cred

4 years agoAdd accessors for the Vendor Specific Extended Capability (VSEC)
scottl [Fri, 13 Dec 2019 23:46:59 +0000 (23:46 +0000)]
Add accessors for the Vendor Specific Extended Capability (VSEC)
Parse out the VSEC.  If the user invokes a second -c command line option,
do a hex dump of the vendor data.

Reviewed by: imp
MFC after: 3 days
Sponsored by: Intel
Differential Revision: http://reviews.freebsd.org/D22808

4 years agoExpand net epoch in the cxgbe TOE driver to satisfy assertions.
jhb [Fri, 13 Dec 2019 23:33:54 +0000 (23:33 +0000)]
Expand net epoch in the cxgbe TOE driver to satisfy assertions.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D22483

4 years agoMFV: r355716
jkim [Fri, 13 Dec 2019 23:28:52 +0000 (23:28 +0000)]
MFV: r355716

Merge ACPICA 20191213.

4 years agoInclude ofw_bus_if.h in SRCS only on systems configured with the FDT option.
ian [Fri, 13 Dec 2019 23:22:49 +0000 (23:22 +0000)]
Include ofw_bus_if.h in SRCS only on systems configured with the FDT option.

4 years agoBetter copyright advice
imp [Fri, 13 Dec 2019 22:32:05 +0000 (22:32 +0000)]
Better copyright advice

Document the common practices around copyrights with "all rights reserved" in
them as new copyright notices get added.

It's an open question qhether to point people at the fact that since the Berne
convention was ratified, All rights reserved is largely obsolete.
https://en.wikipedia.org/wiki/All_rights_reserved#Obsolescence has the
details. The committer's guide will be revised shortly, and it's likely that's a
better place for this discussion. If not, I'll add a blurb here.

Reviewed by: jhb@, brooks@
Differential Review: https://reviews.freebsd.org/D22800

4 years agozfs boot: fix a crash in a rarely taken path in fzap_lookup
avg [Fri, 13 Dec 2019 22:04:13 +0000 (22:04 +0000)]
zfs boot: fix a crash in a rarely taken path in fzap_lookup

Instead of passing NULL to fzap_name_equal and crashing, just return
ENOENT.  This happened when higher bits of a hash of the searched key
(its hash prefix) matched a hash prefix of some key in the ZAP, but the
full hash value of the searched key did not match any key in the ZAP.

I observerved this problem when loader tried to look up
"features_for_read" in a particular old pool that predates pool
features.

MFC after: 2 weeks
Sponsored by: Panzura

4 years agoBe consistent about checking return value from bus_delayed_attach_children.
imp [Fri, 13 Dec 2019 21:39:20 +0000 (21:39 +0000)]
Be consistent about checking return value from bus_delayed_attach_children.

Most places checked, but a couple last minute changes didn't. Make them all use
the return value.

Noticed by: rpokala@

4 years agoDon't use contractions. Fix the date.
imp [Fri, 13 Dec 2019 21:39:10 +0000 (21:39 +0000)]
Don't use contractions. Fix the date.

Contractions cause problems for translators, so s/aren't/are not/ in the one
place this slipped through.

While here, noticed I commited with the date I did the work, not today's
date. Fix that too.

Noticed by: bjk@