]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agofusefs: remove the vfs.fusefs.fix_broken_io sysctl
asomers [Mon, 13 May 2019 19:31:09 +0000 (19:31 +0000)]
fusefs: remove the vfs.fusefs.fix_broken_io sysctl

This looks like it may have been a workaround for a specific buggy FUSE
filesystem.  However, there's no information about what that bug may have
been, and the workaround is > 6.5 years old, so I consider the sysctl to be
unmaintainable.

Sponsored by: The FreeBSD Foundation

5 years agofusefs: reap dead sysctls
asomers [Mon, 13 May 2019 19:03:46 +0000 (19:03 +0000)]
fusefs: reap dead sysctls

Remove the "sync_unmount" and "init_backgrounded" sysctls and the associated
options from mount_fusefs.  Add no backwards-compatibility hidden options to
mount_fusefs because these options never had any effect, and are therefore
unlikely to be used.

Sponsored by: The FreeBSD Foundation

5 years agoMFHead @347527
asomers [Mon, 13 May 2019 18:25:55 +0000 (18:25 +0000)]
MFHead @347527

Sponsored by: The FreeBSD Foundation

5 years ago[skip ci] fusefs: remove an obsolete comment
asomers [Mon, 13 May 2019 15:39:54 +0000 (15:39 +0000)]
[skip ci] fusefs: remove an obsolete comment

Sponsored by: The FreeBSD Foundation

5 years agofusefs: enhance an SDT probe added in r346998
asomers [Mon, 13 May 2019 15:39:19 +0000 (15:39 +0000)]
fusefs: enhance an SDT probe added in r346998

Sponsored by: The FreeBSD Foundation

5 years agoDo not leak memory used for binary filter.
ae [Mon, 13 May 2019 14:07:02 +0000 (14:07 +0000)]
Do not leak memory used for binary filter.

5 years agoRework locking in BPF code to remove rwlock from fast path.
ae [Mon, 13 May 2019 13:45:28 +0000 (13:45 +0000)]
Rework locking in BPF code to remove rwlock from fast path.

On high packets rate the contention on rwlock in bpf_*tap*() functions
can lead to packets dropping. To avoid this, migrate this code to use
epoch(9) KPI and ConcurrencyKit's lists.

* all lists changed to use CK_LIST;
* reference counting added to bpf_if and bpf_d;
* now bpf_if references ifnet and releases this reference on destroy;
* each bpf_d descriptor references bpf_if when it is attached;
* new struct bpf_program_buffer introduced to keep BPF filter programs;
* bpf_program_buffer, bpf_d and bpf_if structures are freed by
  epoch_call();
* bpf_freelist and ifnet_departure event are no longer needed, thus
  both are removed;

Reviewed by: melifaro
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D20224

5 years agoRevert r347356 and r347371
manu [Mon, 13 May 2019 12:38:33 +0000 (12:38 +0000)]
Revert r347356 and r347371

passwd related files need to be tagged as config file so pkg update
will attempt merging them when we install a new package.
We should use CONFS for that.
Revert for now until I come up with a better version of this patch as
it breaks pkgbase for users.

5 years agoRevert r347402. After r347429 symlink is no longer needed.
ae [Mon, 13 May 2019 08:34:13 +0000 (08:34 +0000)]
Revert r347402. After r347429 symlink is no longer needed.

5 years agoCatch up with r347241.
markj [Mon, 13 May 2019 01:18:17 +0000 (01:18 +0000)]
Catch up with r347241.

MFC with: r347241

5 years agoAdd support for HiFive Unleashed -- the board with a multi-core RISC-V SoC
br [Sun, 12 May 2019 16:17:05 +0000 (16:17 +0000)]
Add support for HiFive Unleashed -- the board with a multi-core RISC-V SoC
from SiFive, Inc.

The first core on this SoC (hart 0) is a 64-bit microcontroller.

o Pick a hart to run boot process using hart lottery.
  This allows to exclude hart 0 from running the boot process.
  (BBL releases hart 0 after the main harts, so it never wins the lottery).
o Renumber CPUs early on boot.
  Exclude non-MMU cores. Store the original hart ID in struct pcpu. This
  allows to find out the correct destination for IPIs and remote sfence
  calls.

Thanks to SiFive, Inc for the board provided.

Reviewed by: markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D20225

5 years agofusefs: Report the number of available ops in kevent(2)
asomers [Sun, 12 May 2019 15:27:18 +0000 (15:27 +0000)]
fusefs: Report the number of available ops in kevent(2)

Just like /dev/devctl, /dev/fuse will now report the number of operations
available for immediate read in the kevent.data field during kevent(2).

Sponsored by: The FreeBSD Foundation

5 years agoarm: allwinner: aw_clk_nm: Don't reparent the clock if we didn't ask
manu [Sun, 12 May 2019 15:27:01 +0000 (15:27 +0000)]
arm: allwinner: aw_clk_nm: Don't reparent the clock if we didn't ask

When looking for the best frequency don't change the clock parent if the
clock wasn't configured to do that.

5 years agocache: fix a brainfart in r347505
mjg [Sun, 12 May 2019 07:56:01 +0000 (07:56 +0000)]
cache: fix a brainfart in r347505

If bumping over the counter goes over the limit we have to decrement it back.

Previous code would only bump the counter after adding the entry (thus allowing
the cache to go over the limit).

Sponsored by: The FreeBSD Foundation

5 years agoseqc: fix sed-introduced typos (seqcuence -> sequence)
mjg [Sun, 12 May 2019 07:13:25 +0000 (07:13 +0000)]
seqc: fix sed-introduced typos (seqcuence -> sequence)

Sponsored by: The FreeBSD Foundation

5 years agoamd64: tidy up pagezero*/pagecopy (movq -> movl)
mjg [Sun, 12 May 2019 07:11:44 +0000 (07:11 +0000)]
amd64: tidy up pagezero*/pagecopy (movq -> movl)

Sponsored by: The FreeBSD Foundation

5 years agocache: bump numcache on entry, while here fix lnumcache type
mjg [Sun, 12 May 2019 06:59:22 +0000 (06:59 +0000)]
cache: bump numcache on entry, while here fix lnumcache type

Sponsored by: The FreeBSD Foundation

5 years agoamd64: fixup MEMMOVE comment (10 -> r10)
mjg [Sun, 12 May 2019 06:42:17 +0000 (06:42 +0000)]
amd64: fixup MEMMOVE comment (10 -> r10)

Sponsored by: The FreeBSD Foundation

5 years agocache: push sdt probes in cache_zap_locked to code doing the work
mjg [Sun, 12 May 2019 06:39:30 +0000 (06:39 +0000)]
cache: push sdt probes in cache_zap_locked to code doing the work

Avoids branching to check which probe to evaluate. Very same check was
being done later to do the actual work.

Sponsored by: The FreeBSD Foundation

5 years agox86: store pending bitmapped IPIs in per-cpu areas
mjg [Sun, 12 May 2019 06:36:54 +0000 (06:36 +0000)]
x86: store pending bitmapped IPIs in per-cpu areas

This gets rid of the global cpu_ipi_pending array.

While replace cmpset with fcmpset in the delivery code and opportunistically
check if given IPI is already pending.

Sponsored by: The FreeBSD Foundation

5 years agoamd64: stop re-reading curpc in suword
mjg [Sun, 12 May 2019 06:34:58 +0000 (06:34 +0000)]
amd64: stop re-reading curpc in suword

Plugs re-reads missed in r341719

Sponsored by: The FreeBSD Foundation

5 years agorandom(4): depessimize arc4random
mjg [Sun, 12 May 2019 06:32:46 +0000 (06:32 +0000)]
random(4): depessimize arc4random

- __predict_false reseeding on entry as it is almost never true.
- don't blindly atomic_cmpset as on x86 it ends up dirtying the cacheline.
it almost ever succeeds per above
- fetch the timestamp prior to getting the cpu number

Reviewed by: cem
Approved by: secteam (delphij)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20242

5 years agofusefs: support kqueue for /dev/fuse
asomers [Sat, 11 May 2019 22:58:25 +0000 (22:58 +0000)]
fusefs: support kqueue for /dev/fuse

/dev/fuse was already pollable with poll and select.  Add support for
kqueue, too.  And add tests for polling with poll, select, and kqueue.

Sponsored by: The FreeBSD Foundation

5 years agoFactor code into two new functions in preparation for a future commit.
rmacklem [Sat, 11 May 2019 22:41:58 +0000 (22:41 +0000)]
Factor code into two new functions in preparation for a future commit.

Factor code into two functions.
read_exportfile() a functon  which reads the exports file(s) and calls
get_exportlist_one() to process each of them.
delete_export() a function which deletes the exports in the kernel for a file
system.
The contents of these functions is just the same code as was used to do the
operations, moved into separate functions. As such, there is no semantic change.
This is being done in preparation for a future commit that will add an
option to do incremental changes of kernel exports upon receiving SIGHUP.

MFC after: 1 month

5 years agoCorrect a handful of typos.
schweikh [Sat, 11 May 2019 19:31:54 +0000 (19:31 +0000)]
Correct a handful of typos.

5 years agoSupport the use of the ipsec kld.
cy [Sat, 11 May 2019 17:59:13 +0000 (17:59 +0000)]
Support the use of the ipsec kld.

X-MFC with: r347410

5 years agoA new parameter to blist_alloc specifies an upper bound on the size of
dougm [Sat, 11 May 2019 16:15:13 +0000 (16:15 +0000)]
A new parameter to blist_alloc specifies an upper bound on the size of
the allocation request, so that the blocks allocated are from the next
set of free blocks big enough to satisfy the minimum requirements of
the request, and the number of blocks allocated are as many as
possible, up to the specified maximum. The implementation of
swp_pager_getswapspace uses this parameter to ask for a number of
blocks between the new halved request size and the previous failed
request size. Thus a request for 32 blocks may fail, but instead of
getting only 16 blocks instead, the caller asks for 16 to 31 next, and
might get 19 or 27, which is closer to what they originally wanted.

I expect this to lead to bigger block allocations and less block
fragmentation, at least in some cases.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20001

5 years agorevert r346588 for now
jhibbits [Sat, 11 May 2019 15:17:42 +0000 (15:17 +0000)]
revert r346588 for now

The rewrite of strcmp in assembly uses an instruction added in PowerISA
2.05, making it SIGILL on CPUs older than the POWER6, such as the PPC970 in
the PowerMac G5.  Revert this until we get clang+lld, or retire the in-tree
binutils in favor of newer binutils with IFUNC support, whichever comes
first.

5 years agotwsi: Calculate the clock param based on the bus frequency
manu [Sat, 11 May 2019 15:03:51 +0000 (15:03 +0000)]
twsi: Calculate the clock param based on the bus frequency

Instead of precalculating the different speed, respect the bus frequency
and calculate the clock register parameter based on it.
If the platform didn't register the core clk, fallback on the precomputed
values (This is likely do be the case on Marvell boards).

5 years agoallwinner: clk: sun8i_r: Correct resets
manu [Sat, 11 May 2019 15:02:55 +0000 (15:02 +0000)]
allwinner: clk: sun8i_r: Correct resets

The i2c reset wasn't defined and some bits where wrong, correct them.

5 years agoallwinner: clk: prediv_mux: Init the current parent
manu [Sat, 11 May 2019 15:02:20 +0000 (15:02 +0000)]
allwinner: clk: prediv_mux: Init the current parent

Do not init the first parent but read the clock register to find
it's current parent and init this one.

5 years agoUpdate leap-seconds to leap-seconds.3757622400.
delphij [Sat, 11 May 2019 14:22:21 +0000 (14:22 +0000)]
Update leap-seconds to leap-seconds.3757622400.

As per https://datacenter.iers.org/data/latestVersion/16_BULLETIN_C16.txt:

     INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)

SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE

SERVICE DE LA ROTATION TERRESTRE DE L'IERS
OBSERVATOIRE DE PARIS
61, Av. de l'Observatoire 75014 PARIS (France)
Tel.      : +33 1 40 51 23 35
e-mail    : services.iers@obspm.fr
http://hpiers.obspm.fr/eop-pc

                                              Paris, 07 January 2019

                                              Bulletin C 57

                                              To authorities responsible
                                              for the measurement and
                                              distribution of time

                          INFORMATION ON UTC - TAI

 NO leap second will be introduced at the end of June 2019.
 The difference between Coordinated Universal Time UTC and the
 International Atomic Time TAI is :

     from 2017 January 1, 0h UTC, until further notice : UTC-TAI = -37 s

 Leap seconds can be introduced in UTC at the end of the months of December
 or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
 six months, either to announce a time step in UTC, or to confirm that there
 will be no time step at the next possible date.

                                            Christian BIZOUARD
                                            Director
                                            Earth Orientation Center of IERS
    Observatoire de Paris, France

Requested by: rgrimes
Obtained from: ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.3757622400
MFC after: 3 days

5 years agoCallers of swp_pager_getswapspace get either as many blocks as they
dougm [Sat, 11 May 2019 10:16:43 +0000 (10:16 +0000)]
Callers of swp_pager_getswapspace get either as many blocks as they
requested, or none, and in the latter case it is up to them to pick a
smaller request to make - which they always do by halving the failed
request. This change to swp_pager_getswapspace leaves the task of
downsizing the request to the function and not its caller. It still
does so by halving the original request.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20228

5 years agoWhen bitpos can't be implemented with an inline ffs* instruction,
dougm [Sat, 11 May 2019 09:09:10 +0000 (09:09 +0000)]
When bitpos can't be implemented with an inline ffs* instruction,
change the binary search so that it does not depend on a single bit
only being set in the bitmask. Use bitpos more generally, and avoid
some clearing of bits to accommodate its current behavior.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20237

5 years agotuntap: Improve style
kevans [Sat, 11 May 2019 04:18:06 +0000 (04:18 +0000)]
tuntap: Improve style

No functional change.

tun_flags of the tuntap_driver was renamed to ident_flags to reflect the
fact that it's a subset of the tun_flags that identifies a tuntap device.
This maps more easily (visually) to the TUN_DRIVER_IDENT_MASK that masks off
the bits of tun_flags that are applicable to tuntap driver ident. This is a
purely cosmetic change.

5 years agoRevert r347469.
dougm [Sat, 11 May 2019 02:13:52 +0000 (02:13 +0000)]
Revert r347469.

Approved by: kib (mentor)

5 years agoFactor out some exportlist list operations into separate functions.
rmacklem [Fri, 10 May 2019 23:52:17 +0000 (23:52 +0000)]
Factor out some exportlist list operations into separate functions.

This patch moves the code that removes and frees all exportlist elements
out into a separate function called free_exports().
It does the same for the insertion of a new exportlist entry into a list.
It also adds a second argument to ex_search() for the list to use.
None of these changes have any semantic effect. They are being done to
prepare the code for future patches that convert the single linked list
for the exportlist to a hash table of lists and a patch that will do
incremental changes of exports in the kernel.
And it fixes the argument for SLIST_HEAD_INITIALIZER() to be a pointer,
which doesn't really matter, since SLIST_HEAD_INITIALIZER() doesn't use
the argument.

MFC after: 1 month

5 years agonetdump: Ref the interface we're attached to
cem [Fri, 10 May 2019 23:12:59 +0000 (23:12 +0000)]
netdump: Ref the interface we're attached to

Serialize netdump configuration / deconfiguration, and discard our
configuration when the affiliated interface goes away by monitoring
ifnet_departure_event.

Reviewed by: markj, with input from vangyzen@ (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20206

5 years agoDon't use _Generic, as many systems don't know about it. Go back to a lo-tech switch...
dougm [Fri, 10 May 2019 23:12:37 +0000 (23:12 +0000)]
Don't use _Generic, as many systems don't know about it.  Go back to a lo-tech switch statement.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20235

5 years agonetdump: Fix boot-time configuration typo
cem [Fri, 10 May 2019 23:10:22 +0000 (23:10 +0000)]
netdump: Fix boot-time configuration typo

Boot-time netdump configuration is much more useful if one can configure the
client and gateway addresses.  Fix trivial typo.

(Long-standing bug, I believe it dates to the original netdump commit.)

Spotted by: one of vangyzen@ or markj@
Sponsored by: Dell EMC Isilon

5 years agoImplement linux_pci_unregister_drm_driver in linuxkpi so that drm drivers
johalun [Fri, 10 May 2019 23:10:22 +0000 (23:10 +0000)]
Implement linux_pci_unregister_drm_driver in linuxkpi so that drm drivers
can be unloaded.

This patch is a part of D19565.

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoWhen bitpos can't be implemented with an inline ffs* instruction,
dougm [Fri, 10 May 2019 22:49:01 +0000 (22:49 +0000)]
When bitpos can't be implemented with an inline ffs* instruction,
change the binary search so that it does not depend on a single bit
only being set in the bitmask. Use bitpos more generally, and avoid
some clearing of bits to accommodate its current behavior.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20232

5 years agoAdd a (q)uit option to the subr_blist test program.
dougm [Fri, 10 May 2019 22:02:29 +0000 (22:02 +0000)]
Add a (q)uit option to the subr_blist test program.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20234

5 years agonetdump: Don't store sensitive key data we don't need
cem [Fri, 10 May 2019 21:55:11 +0000 (21:55 +0000)]
netdump: Don't store sensitive key data we don't need

Prior to this revision, struct diocskerneldump_arg (and struct netdump_conf
with embedded diocskerneldump_arg before r347192), were copied in their
entirety to the global 'nd_conf' variable.  Also prior to this revision,
de-configuring netdump would *not* remove the the key material from global
nd_conf.

As part of Encrypted Kernel Crash Dumps (EKCD), which was developed
contemporaneously with netdump but happened to land first, the
diocskerneldump_arg structure will contain sensitive key material
(kda_key[]) when encrypted dumps are configured.

Netdump doesn't have any use for the key data -- encryption is handled in
the core dumper code -- so in this revision, we no longer store it.

Unfortunately, I think this leak dates to the initial import of netdump in
r333283; so it's present in FreeBSD 12.0.

Fortunately, the impact *seems* relatively minor.  Any new *netdump*
configuration would overwrite the key material; for active encrypted netdump
configurations, the key data stored was just a duplicate of the key material
already in the core dumper code; and no user interface (other than
/dev/kmem) actually exposed the leaked material to userspace.

Reviewed by: markj, rpokala (earlier commit message)
MFC after: 2 weeks
Security: yes (minor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20233

5 years agoFix regression from r347375: do not panic when sending an IP multicast
glebius [Fri, 10 May 2019 21:51:17 +0000 (21:51 +0000)]
Fix regression from r347375: do not panic when sending an IP multicast
packet from an interface that doesn't have IPv4 address.

Reported by: Michael Butler <imb protected-networks.net>

5 years agoApply r280991 to ip6_fragment.
jhb [Fri, 10 May 2019 20:15:40 +0000 (20:15 +0000)]
Apply r280991 to ip6_fragment.

This uses m_dup_pkthdr() to copy all of the metadata about a packet to
each of its fragments including VLAN tags, mbuf tags, etc. instead of
hand-copying a few fields.

Reviewed by: bz
MFC after: 1 month
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20117

5 years agoReplace the expression "-mask & ~mask" with a function call that does
dougm [Fri, 10 May 2019 19:55:29 +0000 (19:55 +0000)]
Replace the expression "-mask & ~mask" with a function call that does
the same thing, but is commented so that it might be better
understood.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20231

5 years agopowerpc: Initialize the Hardware Interrupt Offset Register (HIOR) earlier for ppc970
jhibbits [Fri, 10 May 2019 19:36:14 +0000 (19:36 +0000)]
powerpc: Initialize the Hardware Interrupt Offset Register (HIOR) earlier for ppc970

Since we now have a much larger KVA on powerpc64, it's possible to get SLB
traps earlier in boot, possibly even before the HIOR is properly configured
for us.  Move the HIOR setup to immediately after reset, so that we use our
exception handlers instead of Open Firmware's.

PR: 233863
Submitted by: Mark Millard (partial)
Reported by: Mark Millard
MFC after: 2 weeks

5 years agoblist_next_leaf_alloc walks over all the meta-nodes between one leaf
dougm [Fri, 10 May 2019 18:25:06 +0000 (18:25 +0000)]
blist_next_leaf_alloc walks over all the meta-nodes between one leaf
and the next one, and if blocks are allocated from the next leaf, it
walks back toward where it started, as long as there are interleaving
meta-nodes to be updated on account of the last free blocks under
those meta-nodes being allocated. Only if the walk goes all the way
back to the starting point must we calculate the position of the
meta-node that is the least-comment parent of one leaf and the next,
and update a bit in that meta-node to indicate the allocation of its
last free block.

There's no need to start calculating the position of that least-common
parent until the walk back reaches the original starting point, and
there's no need for a calculation that updates 'radius' to tell us
when we've walked back to the beginning, since comparing scan to next
suffices for that.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20229

5 years agoReplace panic() with KASSERT() and provide more useful information when failure happens.
dougm [Fri, 10 May 2019 18:22:40 +0000 (18:22 +0000)]
Replace panic() with KASSERT() and provide more useful information when failure happens.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20226

5 years agofusefs: fix intermittency in the interrupt tests
asomers [Fri, 10 May 2019 18:18:41 +0000 (18:18 +0000)]
fusefs: fix intermittency in the interrupt tests

* In the fatal_signal test, wait for the daemon to receive FUSE_INTERRUPT
  before exiting.
* Explicitly disable restarting syscalls after SIGUSR2.  This fixes
  intermittency in the priority test.  I don't know why, but sometimes that
  test's mkdir would be restarted, and sometimes it would return EINTR.
  ERESTART should be the default.
* Remove a useless copy/pasted sleep in the priority test.

Sponsored by: The FreeBSD Foundation

5 years agofusefs: debugability improvements in the tests
asomers [Fri, 10 May 2019 18:14:39 +0000 (18:14 +0000)]
fusefs: debugability improvements in the tests

Fix a mislocated statement from r347431, and add more detail for FUSE_MKDIR

Sponsored by: The FreeBSD Foundation

5 years agoFix build race with machine links and genoffset.o.
bdrewery [Fri, 10 May 2019 18:09:27 +0000 (18:09 +0000)]
Fix build race with machine links and genoffset.o.

Generate the ilinks for all dependency objects not just the ones
in the CLEAN list.

Possibly related to r345351

Reported by: kmoore
MFC after: 2 weeks
X-MFC-with: r345351
Sponsored by: Dell EMC Isilon

5 years agoFix build issue with clang 8.0.1
luporl [Fri, 10 May 2019 17:05:40 +0000 (17:05 +0000)]
Fix build issue with clang 8.0.1

The algorithm header is needed to use std::remove_if

5 years agofusefs: fix intermittency in the Destroy.ok test
asomers [Fri, 10 May 2019 16:58:05 +0000 (16:58 +0000)]
fusefs: fix intermittency in the Destroy.ok test

The handler for FUSE_DESTROY must shut down the daemon.

Sponsored by: The FreeBSD Foundation

5 years agoarm64: rockchip: Don't always put PLL to normal mode
manu [Fri, 10 May 2019 16:45:17 +0000 (16:45 +0000)]
arm64: rockchip: Don't always put PLL to normal mode

We used to put every PLL in normal mode (meaning that the output would
be the result of the PLL configuration) instead of slow mode (the output
is equal to the external oscillator frequency, 24-26Mhz) but this doesn't
work for most of the PLLs as when we put them into normal mode the registers
configuring the output frequency haven't been set.
Add a normal_mode member in clk_pll_def/clk_pll_sc struct and if it's true
we then set the PLL to normal mode.
For now only set it to the LPLL and BPLL (Little cluster PLL and Big cluster
PLL respectively).

Reviewed by: ganbold
Differential Revision: https://reviews.freebsd.org/D20174

5 years agoefibootmgr: Do not add the new boot entry in dry-run is specified
manu [Fri, 10 May 2019 16:44:35 +0000 (16:44 +0000)]
efibootmgr: Do not add the new boot entry in dry-run is specified

While here fix a typo.

Sponsored-by: Ampere Computing, LLC
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D20212

5 years agoahci: Check if bus is cache-coherent
manu [Fri, 10 May 2019 16:43:53 +0000 (16:43 +0000)]
ahci: Check if bus is cache-coherent

We do this for FDT systems but not for ACPI ones.
Check the presence of the _CCA attribute.

Sponsored by: Ampere Computing, LLC
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D20144

5 years agoAtomically update the global gMsgId in libnetgraph.
markj [Fri, 10 May 2019 16:43:47 +0000 (16:43 +0000)]
Atomically update the global gMsgId in libnetgraph.

Otherwise concurrently running threads may inadvertently use the same
token for different messages.

Preserve the behaviour of disallowing negative message tokens, but allow
a message token value of zero since this simplifies the code a bit and
tokens are documented to be non-negative.

PR: 234442
Reported and tested by: eugen
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

5 years agofusefs: return ENOTCONN instead of EIO if the daemon dies suddenly
asomers [Fri, 10 May 2019 16:41:33 +0000 (16:41 +0000)]
fusefs: return ENOTCONN instead of EIO if the daemon dies suddenly

If the daemon dies, return ENOTCONN for all operations that have already
been sent to the daemon, as well as any new ones.

Sponsored by: The FreeBSD Foundation

5 years agofusefs: minor optimization to interrupted fuse operations
asomers [Fri, 10 May 2019 16:31:51 +0000 (16:31 +0000)]
fusefs: minor optimization to interrupted fuse operations

If the daemon is known to ignore FUSE_INTERRUPT, then we may as well block
all signals while waiting for a response.

Sponsored by: The FreeBSD Foundation

5 years agoA major change to subr_blist.c failed to update all the comments about
dougm [Fri, 10 May 2019 16:01:25 +0000 (16:01 +0000)]
A major change to subr_blist.c failed to update all the comments about
changes to struct fields. Update those now.

Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20227

5 years agofusefs: fix intermittency in the Interrupt.already_complete test
asomers [Fri, 10 May 2019 15:55:30 +0000 (15:55 +0000)]
fusefs: fix intermittency in the Interrupt.already_complete test

Sponsored by: The FreeBSD Foundation

5 years agofusefs: fix running multiple daemons concurrently
asomers [Fri, 10 May 2019 15:02:29 +0000 (15:02 +0000)]
fusefs: fix running multiple daemons concurrently

When a FUSE daemon dies or closes /dev/fuse, all of that daemon's pending
requests must be terminated.  Previously that was done in /dev/fuse's
.d_close method.  However, d_close only gets called on the *last* close of
the device.  That means that if multiple daemons were running concurrently,
all but the last daemon to close would leave their I/O hanging around.  The
problem was easily visible just by running "kyua -v parallelism=2 test" in
fusefs's test directory.

Fix this bug by terminating a daemon's pending I/O during /dev/fuse's
cdvpriv dtor method instead.  That method runs on every close of a file.

Also, fix some potential races in the tests:
* Clear SA_RESTART when registering the daemon's signal handler so read(2)
  will return EINTR.
* Wait for the daemon to die before unmounting the mountpoint, so we won't
  see an unwanted FUSE_DESTROY operation in the mock file system.

Sponsored by: The FreeBSD Foundation

5 years agoBind TCP HPTS (pacer) threads to NUMA domains
gallatin [Fri, 10 May 2019 13:41:19 +0000 (13:41 +0000)]
Bind TCP HPTS (pacer) threads to NUMA domains

Bind the TCP pacer threads to NUMA domains and build per-domain
pacer-thread lookup tables. These tables allow us to use the
inpcb's NUMA domain information to match an inpcb with a pacer
thread on the same domain.

The motivation for this is to keep the TCP connection local to a
NUMA domain as much as possible.

Thanks to jhb for pre-reviewing an earlier version of the patch.

Reviewed by: rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20134

5 years agoifconfig(8): Add kld mappings for ipsec/enc
kevans [Fri, 10 May 2019 13:18:22 +0000 (13:18 +0000)]
ifconfig(8): Add kld mappings for ipsec/enc

Additionally, providing mappings makes the comparison for already loaded
modules a little more strict. This should have been done at initial
introduction, but there was no real reason- however, it proves necessary for
enc which has a standard enc -> if_enc mapping but there also exists an
'enc' module that's actually CAM. The mapping lets us unambiguously
determine the correct module.

Discussed with: ae
MFC after: 4 days

5 years agoRISC-V ISA does not specify how to manage physical memory attributes (PMA).
br [Fri, 10 May 2019 11:21:57 +0000 (11:21 +0000)]
RISC-V ISA does not specify how to manage physical memory attributes (PMA).
So do nothing in pmap_page_set_memattr() and don't panic.

Reviewed by: markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D20209

5 years agoTry to unbreak the build after r347425.
trasz [Fri, 10 May 2019 08:16:29 +0000 (08:16 +0000)]
Try to unbreak the build after r347425.

MFC after: 2 weeks

5 years agoAdd simple regression tests for tree(3). Those are ATF-ified versions
trasz [Fri, 10 May 2019 07:46:14 +0000 (07:46 +0000)]
Add simple regression tests for tree(3).  Those are ATF-ified versions
of OpenBSD's regress/sys/sys/tree/.

Reviewed by: ngie
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D20186

5 years agoAvoid returning a NULL pointer from the Intel hw PRNG ifunc resolver.
markj [Fri, 10 May 2019 04:28:17 +0000 (04:28 +0000)]
Avoid returning a NULL pointer from the Intel hw PRNG ifunc resolver.

DTrace expects kernel function symbols of a non-zero size to have an
implementation, which is a reasonable invariant to preserve.

Reported and tested by: ler
Reviewed by: cem, kib
Approved by: so (delphij)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20218

5 years agoAllow dcons(4) to be unloaded when loaded as a module.
ian [Fri, 10 May 2019 02:30:16 +0000 (02:30 +0000)]
Allow dcons(4) to be unloaded when loaded as a module.

When the module is unloaded, the tty devices are destroyed.  That requires
implementing the tsw_free callback to avoid a panic.  This driver requires
no particular cleanup to be done from the callback, but the module itself
must remain in memory until the deferred tsw_free callbacks are invoked.
These changes implement that by incrementing a reference count variable in
the detach routine, and decrementing it in the tsw_free callback.  The
MOD_UNLOAD event handler doesn't return until the count drops to zero.

PR: 237758

5 years agoiflib: use default ntxd and nrxd when user value is not power of 2
erj [Fri, 10 May 2019 00:41:42 +0000 (00:41 +0000)]
iflib: use default ntxd and nrxd when user value is not power of 2

From Jake:
A user may set a sysctl to override the default number of Tx or Rx
descriptors. However, certain calculations in the iflib core expect the
number of descriptors to be a power of 2.

Update _iflib_assert to verify that all of the shared context parameters
for the number of descriptors are powers of 2.

Modify iflib_reset_qvalues to check that the provided isc_nrxd value is
a power of 2. If it's not, print a warning message and then use the
default value.

An alternative might be to try rounding the number down instead.
However, this creates problems in case the rounded down value is below
the minimum value that the driver would support.

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: marius@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D19880

5 years agoRefactor tests/sys/opencrypto/runtests
ngie [Fri, 10 May 2019 00:03:32 +0000 (00:03 +0000)]
Refactor tests/sys/opencrypto/runtests

* Convert from plain to TAP for slightly improved introspection when skipping
  the tests due to requirements not being met.
* Test for the net/py-dpkt (origin) package being required when running the
  tests, instead of relying on a copy of the dpkt.py module from 2014. This
  enables the tests to work with py3. Subsequently, remove
  `tests/sys/opencrypto/dpkt.py(c)?` via `make delete-old`.
* Parameterize out `python2` as `$PYTHON`.

PR: 237403
MFC after: 1 week

5 years agoMFV: r347413
jkim [Thu, 9 May 2019 23:03:10 +0000 (23:03 +0000)]
MFV: r347413

Import ACPICA 20190509.

5 years agoRemove IPSEC from GENERIC due to performance issues
gallatin [Thu, 9 May 2019 22:38:15 +0000 (22:38 +0000)]
Remove IPSEC from GENERIC due to performance issues

Having IPSEC compiled into the kernel imposes a non-trivial
performance penalty on multi-threaded workloads due to IPSEC
refcounting. In my benchmarks of multi-threaded UDP
transmit (connected sockets), I've seen a roughly 20% performance
penalty when the IPSEC option is included in the kernel (16.8Mpps
vs 13.8Mpps with 32 senders on a 14 core / 28 HTT Xeon
2697v3)). This is largely due to key_addref() incrementing and
decrementing an atomic reference count on the default
policy. This cause all CPUs to stall on the same cacheline, as it
bounces between different CPUs.

Given that relatively few users use ipsec, and that it can be
loaded as a module, it seems reasonable to ask those users to
load the ipsec module so as to avoid imposing this penalty on the
GENERIC kernel. Its my hope that this will make FreeBSD look
better in "out of the box" benchmark comparisons with other
operating systems.

Many thanks to ae for fixing auto-loading of ipsec.ko when
ifconfig tries to configure ipsec, and to cy for volunteering
to ensure the the racoon ports will load the ipsec.ko module

Reviewed by: cem, cy, delphij, gnn, jhb, jpaetzel
Differential Revision: https://reviews.freebsd.org/D20163

5 years agolibsecureboot: make it easier to customize trust anchors
sjg [Thu, 9 May 2019 22:25:12 +0000 (22:25 +0000)]
libsecureboot: make it easier to customize trust anchors

Avoid making hash self-tests depend on X.509 certs.
Include OpenPGP keys in trust store count.

Reviewed by: stevek
MFC after: 1 week
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D20208

5 years agoDon't use C++ style comments.
tuexen [Thu, 9 May 2019 21:00:15 +0000 (21:00 +0000)]
Don't use C++ style comments.

These where introduced in r347382.
Reported by: ngie@

5 years agonfsd.8: Fix mandoc -Tlint and igor warnings
0mp [Thu, 9 May 2019 19:03:52 +0000 (19:03 +0000)]
nfsd.8: Fix mandoc -Tlint and igor warnings

- Remove Tn macros
- Refernce sysctl(8) instead of sysctl(1)
- Start new sentences on new lines
- Capitalize NFS where needed
- Use Fx for FreeBSD
- Remove a list block (Bl) that was added to the manual page
  by accident in r335174

Reviewed by: bcr
Approved by: doc (bcr)
Differential Revision: https://reviews.freebsd.org/D20215

5 years agotuntap: Don't down tap interfaces if LINK0 is set
kevans [Thu, 9 May 2019 18:54:29 +0000 (18:54 +0000)]
tuntap: Don't down tap interfaces if LINK0 is set

5 years agofusefs: shorten and consolidate sleeps
asomers [Thu, 9 May 2019 18:23:09 +0000 (18:23 +0000)]
fusefs: shorten and consolidate sleeps

Some fusefs tests must sleep because they deliberately trigger a race, or
because they're testing the cache timeout functionality.  Consolidate the
sleep interval in a single place so it will be easy to adjust.  Shorten it
from either 500ms or 250ms to 100ms.  From experiment I find that 10ms works
every time, so 100ms should be fairly safe.

Sponsored by: The FreeBSD Foundation

5 years agoAdd if_ipsec.ko symlink to ipsec.ko kernel module.
ae [Thu, 9 May 2019 18:06:11 +0000 (18:06 +0000)]
Add if_ipsec.ko symlink to ipsec.ko kernel module.

This add ability to automatically load ipsec kernel module, when
if_ipsec(4) virtual interface is created using ifconfig(8).

Reviewed by: gallatin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20169

5 years agofusefs: eliminate some sleeps in the Interrupt tests
asomers [Thu, 9 May 2019 17:57:04 +0000 (17:57 +0000)]
fusefs: eliminate some sleeps in the Interrupt tests

Replace some sleeps with semaphore operations.  Not all sleeps can be
replaced, though.  Some are trying to lose a race.

Sponsored by: The FreeBSD Foundation

5 years agofusefs: create sockets with FUSE_MKNOD, not FUSE_CREATE
asomers [Thu, 9 May 2019 16:25:01 +0000 (16:25 +0000)]
fusefs: create sockets with FUSE_MKNOD, not FUSE_CREATE

libfuse expects sockets to be created with FUSE_MKNOD, not FUSE_CREATE,
because that's how Linux does it.  My first attempt at creating sockets
(r346894) used FUSE_CREATE because FreeBSD uses VOP_CREATE for this purpose.
There are no backwards-compatibility concerns with this change, because
socket support hasn't yet been merged to head.

Sponsored by: The FreeBSD Foundation

5 years agotuntap: Properly detach tap ifp
kevans [Thu, 9 May 2019 14:06:24 +0000 (14:06 +0000)]
tuntap: Properly detach tap ifp

5 years agoloader: use DPRINTF in biosdisk.c and define safe DPRINTF
tsoome [Thu, 9 May 2019 13:12:43 +0000 (13:12 +0000)]
loader: use DPRINTF in biosdisk.c and define safe DPRINTF

r345066 did miss biosdisk.c.

Also define DPRINTF as ((void)0) for case we do not want debug printouts.

MFC after: 1 week

5 years agoifconfig(8): Partial revert of r347241
kevans [Thu, 9 May 2019 12:58:33 +0000 (12:58 +0000)]
ifconfig(8): Partial revert of r347241

r347241 introduced an ifname <-> kld mapping table, mostly so tun/tap/vmnet
can autoload the correct module on use. It also inadvertently made bogus
some previously valid uses of sizeof().

Revert back to ifkind on the stack for simplicity sake. This reduces the
diff from the previous version of ifmaybeload for easiser auditing.

5 years agoloader: no-TERM_EMU is broken now
tsoome [Thu, 9 May 2019 12:14:52 +0000 (12:14 +0000)]
loader: no-TERM_EMU is broken now

If TERM_EMU is not defined, we do not have curx variable. Use conout mode
for efi and expose get_pos() for i386.

5 years ago- Merge r338254 from cxgbe(4):
marius [Thu, 9 May 2019 11:34:46 +0000 (11:34 +0000)]
- Merge r338254 from cxgbe(4):
  Use fcmpset instead of cmpset when appropriate.
- Revert r277226 of cxgbe(4), obsolete since r334320.

5 years agoloader: ptable_print() needs two tabs sometimes
tsoome [Thu, 9 May 2019 11:04:10 +0000 (11:04 +0000)]
loader: ptable_print() needs two tabs sometimes

Since the partition/slice names do vary in length, check the length
of the fixed part of the line against 3 * 8, if the lenth is less than
3 tab stops, print out extra tab.

use snprintf() instead of sprintf.

5 years agoloader: implement proper 8 char tab stops
tsoome [Thu, 9 May 2019 10:37:57 +0000 (10:37 +0000)]
loader: implement proper 8 char tab stops

The current console code is printing out 8 spaces for tab, calculate
the amount of spaces based on tab stops.

5 years agoFix memory leak of PCI BUS structure in the LinuxKPI.
hselasky [Thu, 9 May 2019 10:23:42 +0000 (10:23 +0000)]
Fix memory leak of PCI BUS structure in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix regression issue after r346645 in the LinuxKPI.
hselasky [Thu, 9 May 2019 09:45:19 +0000 (09:45 +0000)]
Fix regression issue after r346645 in the LinuxKPI.
Make sure LinuxKPI PCI devices get a default BUSDMA tag.

Found by: Thomas Laus <lausts@acm.org>
Sponsored by: Mellanox Technologies

5 years agoIn mld_v2_cancel_link_timers() check number of references and disconnect
ae [Thu, 9 May 2019 07:57:33 +0000 (07:57 +0000)]
In mld_v2_cancel_link_timers() check number of references and disconnect
inm before releasing the last reference. This fixes possible panics and
assertion.

PR: 237329
Reviewed by: mmacy
MFC after: 2 weeks

5 years agoReceiver side DSACK implemenation.
tuexen [Thu, 9 May 2019 07:34:15 +0000 (07:34 +0000)]
Receiver side DSACK implemenation.

This adds initial support for RFC 2883.

Submitted by: Richard Scheffenegger
Reviewed by: rrs@
Differential Revision: https://reviews.freebsd.org/D19334

5 years agoPrevent cwnd to collapse down to 1 MSS after exiting recovery.
tuexen [Thu, 9 May 2019 07:11:08 +0000 (07:11 +0000)]
Prevent cwnd to collapse down to 1 MSS after exiting recovery.

This is descrined in RFC 6582, which updates RFC 3782.

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

5 years agofusefs: clear a dir's attr cache when its contents change
asomers [Thu, 9 May 2019 01:16:34 +0000 (01:16 +0000)]
fusefs: clear a dir's attr cache when its contents change

Any change to a directory's contents should cause its mtime and ctime to be
updated by the FUSE daemon.  Clear its attribute cache so we'll get the new
attributs the next time that they're needed.  This affects the following
VOPs: VOP_CREATE, VOP_LINK, VOP_MKDIR, VOP_MKNOD, VOP_REMOVE, VOP_RMDIR, and
VOP_SYMLINK

Reported by: pjdfstest
Sponsored by: The FreeBSD Foundation

5 years agoExistense of PCB route caching doesn't allow us to use new fast route
glebius [Wed, 8 May 2019 23:39:24 +0000 (23:39 +0000)]
Existense of PCB route caching doesn't allow us to use new fast route
lookup KPI in ip_output() like it is already used in ip_forward().
However, when there is no PCB provided we can use fast KPI, gaining
performance advantage.

Typical case when ip_output() is called without a PCB pointer is a
sendto(2) on a not connected UDP socket. In practice DNS servers do
this.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D19804

5 years agofusefs: fix a permission handling bug during VOP_RENAME
asomers [Wed, 8 May 2019 22:28:13 +0000 (22:28 +0000)]
fusefs: fix a permission handling bug during VOP_RENAME

If the file to be renamed is a directory and it's going to get a new parent,
then the user must have write permissions to that directory, because the
".." dirent must be changed.

Reported by: pjdfstest
Sponsored by: The FreeBSD Foundation

5 years agoetc/Makefile: Remove empty newline
manu [Wed, 8 May 2019 21:26:11 +0000 (21:26 +0000)]
etc/Makefile: Remove empty newline

This was commited accidently in r347356 and cause distribution with
NO_ROOT set to fail.

Reported by: ci, kib
MFC after: 2 weeks
X-MFC-With: r347356

5 years agoBump EC2 AMI filesystem size up to 4000 MB.
cperciva [Wed, 8 May 2019 21:03:03 +0000 (21:03 +0000)]
Bump EC2 AMI filesystem size up to 4000 MB.

AMIs have been breaking for the past month due to insufficient disk space.

Due to the small amount of overhead in the disk image, the EC2 AMIs end
up with the same (4GB) minimum disk size.

Reported by: Michal Krawczyk