Commit Graph

249975 Commits

Author SHA1 Message Date
Hans Petter Selasky
32f32669c3 Properly update AD field length in hccontrol(8).
While at it use strtol() instead of atoi() to support hexadecimal
numbers aswell as 10-base numbers.

Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245899
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-26 08:31:08 +00:00
Eric van Gyzen
ba0ced82ea Fix handling of NMIs from unknown sources (BMC, hypervisor)
Release kernels have no KDB backends enabled, so they discard an NMI
if it is not due to a hardware failure.  This includes NMIs from
IPMI BMCs and hypervisors.

Furthermore, the interaction of panic_on_nmi, kdb_on_nmi, and
debugger_on_panic is confusing.

Respond to all NMIs according to panic_on_nmi and debugger_on_panic.
Remove kdb_on_nmi.  Expand the meaning of panic_on_nmi by making
it a bitfield.  There are currently two bits: one for NMIs due to
hardware failure, and one for all others.  Leave room for more.

If panic_on_nmi and debugger_on_panic are both true, don't actually panic,
but directly enter the debugger, to allow someone to leave the debugger
and [hopefully] resume normal execution.

Reviewed by:	kib
MFC after:	2 weeks
Relnotes:	yes: machdep.kdb_on_nmi is gone; machdep.panic_on_nmi changed
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D24558
2020-04-26 00:41:29 +00:00
Pawel Jakub Dawidek
cb761bb2fb Avoid the GEOM topology lock recursion when we automatically expand a pool.
The steps to reproduce the problem:

	mdconfig -a -t swap -s 3g -u 0
	gpart create -s GPT md0
	gpart add -t freebsd-zfs -s 1g md0
	zpool create -o autoexpand=on foo md0p1
	gpart resize -i 1 -s 2g md0
2020-04-25 21:45:31 +00:00
Pawel Jakub Dawidek
cefbc0d19b Add g_topology_locked() macro that returns true if we already hold the GEOM
topology lock.
2020-04-25 21:41:09 +00:00
Dimitry Andric
61fbd61b59 Fix race between prebuilding libsbuf and libgeom
The latter needs the former, but with a multi-job build on a fast
machine, the race is sometimes lost. This leads to "ld: error: unable to
find library -lsbuf", when linking libgeom.so.

Submitted by:	kevans
MFC after:	3 days
2020-04-25 20:24:41 +00:00
Emmanuel Vadot
56005e4b71 release: arm64: rockpro64: Set hw.ncpu to 4
Since there is known issue with big.LITTLE set the number of CPU to 4
which is the number present in the LITTLE cluster.
2020-04-25 20:00:44 +00:00
Emmanuel Vadot
1dc1adf0a4 arm64: rockchip: rk805: Use a tailq for the attached regulator
Store the attached regulator in a tailq to later find them in ofw_map.
While here, do not attempt to attach a regulator without a name, a node
might exists but if it doesn't have a name the regulator is unused.

MFC after:	1 month
2020-04-25 15:34:48 +00:00
Conrad Meyer
1e72c52e23 libc: partially revert r326576
In r326576 ("use @@@ instead of @@ in __sym_default"), an earlier version of
the phabricator-discussed patch was inadvertently committed.  The commit
message claims that @@@ means that weak is not needed, but that was due to a
misunderstanding of the use of weak symbols in this context by the submitted
in the first draft of the patch; the description text was not updated to
match the discussion.  As discussed in phabricator, weak is needed for
symbol interposing because of the behavior of our rtld, and is widely used
elsewhere in libc.

This partial revert restores the approved version of the patch and permits
symbol interposing for openat.

Reported by:	Raymond Ramsden <rramsden AT isilon.com>
Reviewed by:	dim, emaste, kib (2017)
Discussed with:	kib (2020)
Differential Revision:	https://reviews.freebsd.org/D11653
2020-04-25 14:24:54 +00:00
Alexander V. Chernikov
454d389645 Fix LINT build #2 after r360292.
Pointyhat to: melifaro
2020-04-25 11:35:38 +00:00
Alexander V. Chernikov
ac99fd86d4 Fix LINT build broken by r360292. 2020-04-25 10:31:56 +00:00
Alexander V. Chernikov
57e70e4471 Fix userland build broken by r360292. 2020-04-25 09:25:06 +00:00
Michal Meloun
a3fc40936a Reorder initialization steps for given pin.
If pin is switched from fixed function to GPIO, it should have prepared
direction, pull-up/down and default value before function gets switched.
Otherwise we may produce unwanted glitch on output pin.
Right order of drive strength settings is questionable, but I think that
is slightly safer to do it also before function switch.

This fixes serial port corruption observed after DT 5.6 import.

MFC after:	1 week
2020-04-25 09:17:49 +00:00
Alexander V. Chernikov
983066f05b Convert route caching to nexthop caching.
This change is build on top of nexthop objects introduced in r359823.

Nexthops are separate datastructures, containing all necessary information
 to perform packet forwarding such as gateway interface and mtu. Nexthops
 are shared among the routes, providing more pre-computed cache-efficient
 data while requiring less memory. Splitting the LPM code and the attached
 data solves multiple long-standing problems in the routing layer,
 drastically reduces the coupling with outher parts of the stack and allows
 to transparently introduce faster lookup algorithms.

Route caching was (re)introduced to minimise (slow) routing lookups, allowing
 for notably better performance for large TCP senders. Caching works by
 acquiring rtentry reference, which is protected by per-rtentry mutex.
 If the routing table is changed (checked by comparing the rtable generation id)
 or link goes down, cache record gets withdrawn.

Nexthops have the same reference counting interface, backed by refcount(9).
This change merely replaces rtentry with the actual forwarding nextop as a
 cached object, which is mostly mechanical. Other moving parts like cache
 cleanup on rtable change remains the same.

Differential Revision:	https://reviews.freebsd.org/D24340
2020-04-25 09:06:11 +00:00
Rick Macklem
e4a458bb1b Remove Mac OS/X macros that did nothing for FreeBSD.
The macros CAST_USER_ADDR_T() and CAST_DOWN() were used for the Mac OS/X
port. The first of these macros was a no-op for FreeBSD and the second
is no longer used.
This patch gets rid of them. It also deletes the "mbuf_t" typedef which
is no longer used in the FreeBSD code from nfskpiport.h

This patch should not change semantics.
2020-04-25 02:18:59 +00:00
Hans Petter Selasky
7b2f84db82 Put advertising data in correct place.
Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245848
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-25 00:57:48 +00:00
Kyle Evans
2b17527cea freebsd-update: rehash certs
With the inclusion of caroot bits, we'll need to also rehash on update as we
do in mergemaster/etcupdate.

If certctl's installed on the system, just unconditionally rehash. This
isn't an expensive operation, and we can refine it to compare
INDEX-{OLD,NEW} later if we really want to.

Reviewed by:	emaste, allanjude
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21805
2020-04-25 00:14:17 +00:00
John Baldwin
88901af835 Don't indirect user pointers directly in two 802.11s ioctls.
IEEE80211_MESH_RTCMD_ADD was invoking memcmp() to validate the
supplied address directly on the user pointer rather than first doing
a copyin() and validating the copied value.

IEEE80211_MESH_RTCMD_DELETE was passing the user pointer directly to
ieee80211_mesh_rt_del() rather than copying the user buffer into a
temporary kernel buffer.

Reviewed by:	brooks, kib
Obtained from:	CheriBSD
MFC after:	2 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24562
2020-04-24 22:10:02 +00:00
Mateusz Piotrowski
5dcf0083fc Fix a typo
Reported by:	pstef
MFC after:	2 days
2020-04-24 22:04:14 +00:00
Mateusz Piotrowski
beb71006e7 Fix invalid use of macros and two typos
It turns out that currently mandoc(1) is not handling Fl in Ss
correctly (maybe it never was). Let's just replace "Fl S \&Ss ..."
with "-S ...". After all, this subsection title is stylized anyway, so Fl
is not that helpful.

MFC after:	2 weeks
2020-04-24 22:02:22 +00:00
Mark Johnston
06459adc89 Fix a race in pmap_emulate_modified().
pmap_emulate_modify() was assuming that no changes to the pmap could
take place between the TLB signaling the fault and
pmap_emulate_modify()'s acquisition of the pmap lock, but that's clearly
not even true in the uniprocessor case, nevermind the SMP case.

Submitted by:	Nathaniel Filardo <nwf20@cl.cam.ac.uk>
Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D24523
2020-04-24 21:21:49 +00:00
Mark Johnston
117d10f3c1 Fix a race between _pmap_unwire_ptp() and MipsDoTLBMiss().
MipsDoTLBMiss() will load a segmap entry or pde, check that it isn't
zero, and then chase that pointer to a physical page. If that page has
been freed in the interim, it will read garbage and go on to populate
the TLB with it.

This can happen because pmap_unwire_ptp zeros out the pde and
vm_page_free_zero()s the ptp (or, recursively, zeros out the segmap
entry and vm_page_free_zero()s the pdp) without interlocking against
MipsDoTLBMiss(). The pmap is locked, and pvh_global_lock may or may not
be held, but this is not enough. Solve this issue by inserting TLB
shootdowns within _pmap_unwire_ptp(); as MipsDoTLBMiss() runs with IRQs
deferred, the IPIs involved in TLB shootdown are sufficient to ensure
that MipsDoTLBMiss() sees either a zero segmap entry / pde or a non-zero
entry and the pointed-to page still not freed.

Submitted by:	Nathaniel Filardo <nwf20@cl.cam.ac.uk>
Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D24491
2020-04-24 21:21:23 +00:00
Mark Johnston
b6fd3860b5 Fix handling of 1GB mappings in the arm64 minidump code.
For such mappings we need to dump 512 page table pages, not one, and
they need to be included in the pmap size recorded in the minidump
header.

MFC after:	2 weeks
Sponsored by:	Juniper Networks, Klara Inc.
2020-04-24 18:47:57 +00:00
Mark Johnston
1d6638472b Remove an obsolete TODO comment from several minidump implementations.
The comment referenced a non-existent function, and these minidump
implementations already buffer discontiguous physical data pages by
mapping them into a single VA range that gets passed to the dump device,
so there is no real advantage in batching calls to blk_write().

The RISC-V and MIPS minidump implementations still write a page at a
time and so would benefit from some form of batching.

MFC after:	2 weeks
Sponsored by:	Juniper Networks, Klara Inc.
2020-04-24 18:47:42 +00:00
Emmanuel Vadot
b407a449ac Add PINE64 ROCK64 config for generation of release images 2020-04-24 16:33:07 +00:00
Emmanuel Vadot
0edb2e1d0c Add PINE64 ROCKPro64 config for generation of release images
Submitted by:	Daniel Engberg
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D22538
2020-04-24 16:32:25 +00:00
Emmanuel Vadot
38e4df107d Add support for generating release images using GPT for ARM
Submitted by:	Daniel Engberg (Original version)
Differential Revision:	https://reviews.freebsd.org/D22537
2020-04-24 16:31:27 +00:00
Alexander Motin
e4e0417440 Map family 0x5F (Denverton) to goldmont.
According to the 325462-071US document, they should be the same.

MFC after:	1 week
2020-04-24 16:05:35 +00:00
Alexander Motin
bbdddb8014 Add family 0x5F (Denverton) to PMC_CPU_INTEL_ATOM_GOLDMONT.
According to the 325462-071US document, they should be the same.

MFC after:	1 week
2020-04-24 15:09:30 +00:00
Hans Petter Selasky
f75d5ee735 Rename two commands to match the Bluetooth specification in hccontrol(8).
Fix some bad spelling while at it.

Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245868
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-24 14:53:55 +00:00
Mark Johnston
5c17092568 Stop setting PG_U in bootstrap mappings.
These mappings are never visible to userspace as they get replaced when
the amd64 pmap is bootstrapped, but there is no need to set PG_U in the
first place.

Reviewed by:	alc, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24547
2020-04-24 13:53:40 +00:00
Kyle Evans
277cd3983e UPDATING: Fix the date of the closefrom(2) entry
Apologies; my internal calendar says it's still February, but that doesn't
seem to match reality where we've apparently advanced two months.
2020-04-24 12:57:03 +00:00
Kyle Evans
679c46f019 UPDATING: add a note about closefrom(2) marked COMPAT12
Some of the consumers in-base may make it enticing enough to ensure that
COMPAT_FREEBSD12, which is notably a fairly light option at the moment, is
included in custom kernel configs.

Suggested by:	netchild
Casualty:	mail jail
2020-04-24 12:54:35 +00:00
Andrew Turner
ed97f6b30f Remove PCI_IO_WINDOW_OFFSET from the pci host generic fdt attachment.
It doesn't seem to be needed, and breaks booting under bhyve/arm64.

Discussed with:	br
MFC after:	2 weeks
Sponsored by:	Innovate UK
2020-04-24 11:03:15 +00:00
Andriy Gapon
a481fc9129 ccp: add a new hardware ID, found on AMD Ryzen 3 3200U
pciconf reports the device as:
Family 17h (Models 10h-1fh) Platform Security Processor

dmesg:
ccp0: <AMD CCP-5a> mem 0xfe500000-0xfe5fffff,0xfe68c000-0xfe68dfff at device 0.2 on pci4
crypto: assign ccp0 driver id 1, flags 0x1000000

MFC after:	1 week
2020-04-24 10:20:54 +00:00
Andrew Turner
a2e2311a40 Build the arm64 loader with -ffixed-x18
This stops the compiler from using the x18 register. Some UEFI
implementations assume this will be preserved when calling the Boot
Services.

MFC after:	2 weeks
Sponsored by:	Innovate UK
2020-04-24 10:03:11 +00:00
Andriy Gapon
295e8e956f acpi_video: fix a crash in detach with an LCD output
The crash happened because of a video output object was removed from a
wrong container, crt_units instead of lcd_units.

MFC after:	1 week
2020-04-24 09:32:20 +00:00
Hans Petter Selasky
c3f60abc30 Add support for LE advertising to hccontrol(8).
Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245848
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-24 08:07:59 +00:00
Andriy Gapon
36b9e62831 acpi_iicbus: set device description in the probe method
Kernel prints the device announcement before the attach method is
called, so if the correct description is not set by the probe method,
then the announcement would have an incorrect one.

MFC after:	1 week
2020-04-24 07:55:39 +00:00
Andriy Gapon
7a451e61ab ig4: ensure that drivers always attach in correct order
Use DRIVER_MODULE_ORDERED(SI_ORDER_ANY) so that ig4's ACPI attachment
happens after iicbus and acpi_iicbus drivers are registered.

I have seen a problem where iicbus attached under ig4 instead of
acpi_iicbus when ig4.ko was loaded with kldload.  I believe that that
happened because ig4 driver was a first driver to register, it attached
and created an iicbus child.  Then iicbus driver was registered and,
since it was the only driver that could attach to the iicbus child
device, it did exactly that.  After that acpi_iicbus driver was
registered.  It would be able to attach to the iicbus device, but it was
already attached, so nothing happened.

MFC after:	2 weeks
2020-04-24 07:49:21 +00:00
Philip Paeps
dd5f96c48d Import tzdata 2020a
Changes: https://github.com/eggert/tz/blob/2020a/NEWS

MFC after:	3 days
2020-04-24 05:05:58 +00:00
Philip Paeps
545922d605 Import tzdata 2020a 2020-04-24 04:53:23 +00:00
Kyle Evans
2c9c433e17 sysent: re-roll after 360236 (AUE_CLOSERANGE used) 2020-04-24 01:30:33 +00:00
Kyle Evans
3e6b82913d close_range(2): use newly assigned AUE_CLOSERANGE 2020-04-24 01:30:00 +00:00
Kyle Evans
ca9cba33a5 bsm: add AUE_CLOSERANGE
AUE_CLOSERANGE has been accepted upstream as 43265; AUE_REALPATHAT has now
been upstreamed.
2020-04-24 01:27:25 +00:00
Eric van Gyzen
c5ad81420c Update jemalloc to version 5.2.1
Revert r354606 to restore r354605.

Apply one line from jemalloc commit d01b425e5d1e1 in hash_x86_128()
to fix the build with gcc, which only allows a fallthrough attribute
to appear before a case or default label.

Submitted by:	jasone in r354605
Discussed with:	jasone
Reviewed by:	bdrewery
MFC after:	never, due to gcc 4.2.1
Relnotes:	yes
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D24522
2020-04-23 23:57:43 +00:00
Navdeep Parhar
55eae197fc cxgbe/crypto: Fix the key size in a couple of places to catch up with
the recent OCF refactor.

Sponsored by:	Chelsio Communications
2020-04-23 23:54:23 +00:00
Kristof Provost
36dcd97de3 libc: Shortcut if_indextoname() if index == 0
If the index we're trying to convert is 0 we can avoid a potentially
expensive call to getifaddrs(). No interface has an ifindex of zero, so
we can handle this as an error: set the errno to ENXIO and return NULL.

Submitted by:	Nick Rogers
Reviewed by:	lutz at donnerhacke.de
MFC after:	2 weeks
Sponsored by:	RG Nets
Differential Revision:	https://reviews.freebsd.org/D24524
2020-04-23 21:16:51 +00:00
Allan Jude
9d433cb875 trim(8): candelete() returns wrong results because fd is opened O_WRONLY
This was discovered while using trim(8) to test bhyve trim

Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D24371
2020-04-23 20:14:59 +00:00
Allan Jude
22769bbe30 Add VIRTIO_BLK_T_DISCARD (TRIM) support to the bhyve virtio-blk backend
This will advertise support for TRIM to the guest virtio-blk driver and
perform the DIOCGDELETE ioctl on the backing storage if it supports it.

Thanks to Jason King and others at Joyent and illumos for expanding on
my original patch, adding improvements including better error handling
and making sure to following the virtio spec.

Submitted by:	Jason King <jason.king@joyent.com> (improvements)
Reviewed by:	jhb
Obtained from:	illumos-joyent (improvements)
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D21707
2020-04-23 19:20:58 +00:00
Emmanuel Vadot
fb0d255111 arm64: rockchip: Fix TSADC on RK3328
The TSADC familiy is a little bit more complex than V2 and V3.
Early revision do not use syscon and do not use qsel (RK3288).
Next revision still do not use syscon but uses qsel (RK3328).
Final revision use both.

Submitted by:	peterj
MFC after:	1 month
2020-04-23 19:16:20 +00:00