]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMake the tests work without COMPAT_FREEBSD12 in kernel.
Jung-uk Kim [Wed, 4 Nov 2020 22:41:54 +0000 (22:41 +0000)]
Make the tests work without COMPAT_FREEBSD12 in kernel.

sysctl 'kern.cryptodevallowsoft' was renamed to 'kern.crypto.allow_soft' in
r359374 and the prevous one is only available in kernel built with
"options COMPAT_FREEBSD12".

3 years agoAdd regression tests for conditions and comments
Stefan Eßer [Wed, 4 Nov 2020 22:29:01 +0000 (22:29 +0000)]
Add regression tests for conditions and comments

Fix one case where #else was not corerctly processed and simplify the
conditions logic.

Fix parsing of day and month names in the locale specified in the calendar
file. The previous version would expect those names to match the locale of
the user.

Mention that comments are now correctly processed and that // is supported
in addition to /* ... */.

MFC after: 3 days

3 years agoatkbdc(4): Add quirk for "System76 lemur Pro" laptops.
Vladimir Kondratyev [Wed, 4 Nov 2020 21:52:10 +0000 (21:52 +0000)]
atkbdc(4): Add quirk for "System76 lemur Pro" laptops.

Currently atkbdc(4) assumes all coreboot BIOSes belonging to Chromebooks
and unconditionally sets a number of quirks to workaround known issues.

Exclude "System76" laptops from this set as they appeared to be a
traditional hardware ("lemur Pro" is a rebranded Clevo chassis) with
coreboot firmware on board. KBDC_QUIRK_KEEP_ACTIVATED quirk activated for
Chromebook platform makes keyboard on this devices inoperable.

"Purism Librem" laptops may require the same exclusion too.

PR: 250711
Reported by: nick.lott@gmail.com
MFC after: 2 weeks

3 years agoUnbreak buildworld after r367339.
Edward Tomasz Napierala [Wed, 4 Nov 2020 21:39:04 +0000 (21:39 +0000)]
Unbreak buildworld after r367339.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoBump __FreeBSD_version after rms changes
Mateusz Guzik [Wed, 4 Nov 2020 21:23:25 +0000 (21:23 +0000)]
Bump __FreeBSD_version after rms changes

3 years agozfs: use rms lock for teardown handling
Mateusz Guzik [Wed, 4 Nov 2020 21:22:41 +0000 (21:22 +0000)]
zfs: use rms lock for teardown handling

This deserializes otherwise non-contending operations.

The previous scheme of using 17 locks hashed by curthread runs into
conflicts very quickly.

3 years agozfs: macroify teardown handling
Mateusz Guzik [Wed, 4 Nov 2020 21:19:54 +0000 (21:19 +0000)]
zfs: macroify teardown handling

3 years agozfs: rename teardown inactive macros to mimick rrm convention
Mateusz Guzik [Wed, 4 Nov 2020 21:19:25 +0000 (21:19 +0000)]
zfs: rename teardown inactive macros to mimick rrm convention

3 years agozfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros
Mateusz Guzik [Wed, 4 Nov 2020 21:18:51 +0000 (21:18 +0000)]
zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros

They are expected to fail only in corner cases.

3 years agozfs: even up assert
Mateusz Guzik [Wed, 4 Nov 2020 21:18:27 +0000 (21:18 +0000)]
zfs: even up assert

3 years agorms: fixup concurrent writer handling and add more features
Mateusz Guzik [Wed, 4 Nov 2020 21:18:08 +0000 (21:18 +0000)]
rms: fixup concurrent writer handling and add more features

Previously the code had one wait channel for all pending writers.
This could result in a buggy scenario where after a writer switches
the lock mode form readers to writers goes off CPU, another writer
queues itself and then the last reader wakes up the latter instead
of the former.

Use a separate channel.

While here add features to reliably detect whether curthread has
the lock write-owned. This will be used by ZFS.

3 years agodtb/rockchip: Add rockpi-4 to the build
Emmanuel Vadot [Wed, 4 Nov 2020 20:15:14 +0000 (20:15 +0000)]
dtb/rockchip: Add rockpi-4 to the build

We boot on this board to add the dtb to the build.

Requested by: Daniel Engberg <daniel.engberg.lists@pyret.net>

3 years agoAdd linux_to_bsd_errtbl[], mapping Linux errnos to their BSD counterparts.
Edward Tomasz Napierala [Wed, 4 Nov 2020 19:54:18 +0000 (19:54 +0000)]
Add linux_to_bsd_errtbl[], mapping Linux errnos to their BSD counterparts.
This will be used by fuse(4).

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

3 years agoPlug minor memory leak in dwc3 USB2/USB3 controller.
Emmanuel Vadot [Wed, 4 Nov 2020 18:23:59 +0000 (18:23 +0000)]
Plug minor memory leak in dwc3 USB2/USB3 controller.

OF_getprop_alloc called earlier requires corresponding OF_prop_free to release allocated memory.

Submitted by: kjopek@gmail.com
Differential Revision: https://reviews.freebsd.org/D27085

3 years agoMake vector-related functions in libcxxrt's demangler static
Dimitry Andric [Wed, 4 Nov 2020 17:51:09 +0000 (17:51 +0000)]
Make vector-related functions in libcxxrt's demangler static

Follow-up to r367323 by re-adding static to a number of the functions
copied from elftc's libelftc_vstr.c. This was requested by upstream.

PR: 250702
MFC after: 3 days

3 years agoamd64: Make it easier to configure exception stack sizes
Mark Johnston [Wed, 4 Nov 2020 16:42:20 +0000 (16:42 +0000)]
amd64: Make it easier to configure exception stack sizes

The amd64 kernel handles certain types of exceptions on a dedicated
stack.  Currently the sizes of these stacks are all hard-coded to
PAGE_SIZE, but for at least NMI handling it can be useful to use larger
stacks.  Add constants to intr_machdep.h to make this easier to tweak.

No functional change intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27076

3 years agovmspace: Convert to refcount(9)
Mark Johnston [Wed, 4 Nov 2020 16:30:56 +0000 (16:30 +0000)]
vmspace: Convert to refcount(9)

This is mostly mechanical except for vmspace_exit().  There, use the new
refcount_release_if_last() to avoid switching to vmspace0 unless other
processes are sharing the vmspace.  In that case, upon switching to
vmspace0 we can unconditionally release the reference.

Remove the volatile qualifier from vm_refcnt now that accesses are
protected using refcount(9) KPIs.

Reviewed by: alc, kib, mmel
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27057

3 years agorefcount(9): Add refcount_release_if_last() and refcount_load()
Mark Johnston [Wed, 4 Nov 2020 16:30:30 +0000 (16:30 +0000)]
refcount(9): Add refcount_release_if_last() and refcount_load()

The former is intended for use in vmspace_exit().  The latter is to
encourage use of explicit loads rather than relying on the volatile
qualifier.  This works better with kernel sanitizers, which can
intercept atomic(9) calls, and makes tricky lockless code easier to read
by not forcing the reader to remember which variables are declared
volatile.

Reviewed by: kib, mjg, mmel
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27056

3 years agopmcstat: Fix a typo in the usage message
Mateusz Piotrowski [Wed, 4 Nov 2020 15:44:59 +0000 (15:44 +0000)]
pmcstat: Fix a typo in the usage message

Reviewed by: emaste
Approved by: emaste
Differential Revision: https://reviews.freebsd.org/D26082

3 years agoFix bad libbxo format strings in jls
Alex Richardson [Wed, 4 Nov 2020 14:31:52 +0000 (14:31 +0000)]
Fix bad libbxo format strings in jls

The existing format string for the empty case was trying to read varargs
values that weren't passed to xo_emit. This appears to work on x86 (since
the next argument is probably a pointer an empty string), but for CHERI
we can bound variadic arguments and detect a read past the end.

While touching these lines also use the libxo 'a' modifier to avoid having to
construct the libxo format string using asprintf.

Found by: CHERI
Reviewed By: allanjude
Differential Revision: https://reviews.freebsd.org/D26885

3 years agoacpi_video(4): mention that acpi_video should be loaded after any drm driver
Emmanuel Vadot [Wed, 4 Nov 2020 13:43:34 +0000 (13:43 +0000)]
acpi_video(4): mention that acpi_video should be loaded after any drm driver

When not adhering to this order, brightness sysctl's do not show up on some
laptop.

Submitted by:  driesm.michiels@gmail.com
Reviewed by: uqs
Differential Revision: https://reviews.freebsd.org/D26073

3 years agoarm64: implement bs_sr_<N>
Bjoern A. Zeeb [Wed, 4 Nov 2020 12:11:50 +0000 (12:11 +0000)]
arm64: implement bs_sr_<N>

Implement the bs_sr_<N> generic functions based on the generic
mips implementation calling the generic bs_w_<N> functions in a loop.

ral(4) (rt2860.c) panics in RAL_SET_REGION_4() because bs_sr_4()
is NULL.  It seems ral(4) and ti(4) might be the only consumers of
these functions I could find quickly so keeping them in C rather than asm.

Reported by: Steve Wheeler (https://redmine.pfsense.org/issues/11021)
Reviewed by: mmel
MFC after: 3 days

3 years agonet80211: fix a typo
Bjoern A. Zeeb [Wed, 4 Nov 2020 12:07:33 +0000 (12:07 +0000)]
net80211: fix a typo

Correct a typo referring to the wrong flags in a comment.
No functional changes.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

3 years agoAdd the pmap.h changes missed in r367320
Andrew Turner [Wed, 4 Nov 2020 11:48:08 +0000 (11:48 +0000)]
Add the pmap.h changes missed in r367320

Reported by: bz
Sponsored by: Innovate UK

3 years agoTurn on WITH_LLVM_CXXFILT by default
Dimitry Andric [Wed, 4 Nov 2020 11:23:19 +0000 (11:23 +0000)]
Turn on WITH_LLVM_CXXFILT by default

LLVM's demangler supports more modern C++ constructs such as lambdas and
unnamed types, and is actively maintained. The command line tool is
usable as a drop-in replacement for GNU c++filt, or elftoolchain's
cxxfilt. The latter is still available by using WITHOUT_LLVM_CXXFILT, if
needed.

PR: 250702
MFC after: 2 weeks

3 years agoUpdate libcxxrt's private copy of elftoolchain demangler
Dimitry Andric [Wed, 4 Nov 2020 11:13:36 +0000 (11:13 +0000)]
Update libcxxrt's private copy of elftoolchain demangler

This updates the private copy of libelftc_dem_gnu3.c in libcxxrt with
the most recent version from upstream r3877. Similar to r367322, this
fixes a number of possible assertions, and allows it to correctly
demangle several names that it could not handle before.

PR: 250702
MFC after: 3 days

3 years agoMerge elftoolchain r3877 (by jkoshy):
Dimitry Andric [Wed, 4 Nov 2020 11:02:05 +0000 (11:02 +0000)]
Merge elftoolchain r3877 (by jkoshy):

  Incorporate fixes from Dimitry Andric:

  - Use a BUFFER_GROW() macro to avoid rounding errors in capacity
    calculations.
  - Fix a bug introduced in [r3531].
  - Fix handling of nested template parameters.

  Ticket: #581

This should fix a number of assertions on elftoolchain's cxxfilt, and
allow it to correctly demangle several names that it could not handle
before.

Obtained from: https://sourceforge.net/p/elftoolchain/code/3877/
PR: 250702
MFC after: 3 days

3 years agoFix a typo
Mateusz Piotrowski [Wed, 4 Nov 2020 10:38:25 +0000 (10:38 +0000)]
Fix a typo

3 years agoAllow the creation of 3 level page tables on arm64
Andrew Turner [Wed, 4 Nov 2020 10:21:30 +0000 (10:21 +0000)]
Allow the creation of 3 level page tables on arm64

The stage 2 arm64 page tables may need to start at a lower level. This
is because we may only be able to map a limited IPA range and trying
to use a full 4 levels will cause the CPU to fault in an unrecoverable
way.

To simplify the code we still allocate the full 4 levels, however level 0
will only ever be used to find the level 1 table used as the base. Handle
this by creating a dummy entry in the level 0 table to point to the level 1
table.

Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D26066

3 years agoRemove unnecessary __DECONST().
John Baldwin [Tue, 3 Nov 2020 22:53:23 +0000 (22:53 +0000)]
Remove unnecessary __DECONST().

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27063

3 years agoReplace some K&R function definitions with ANSI C.
John Baldwin [Tue, 3 Nov 2020 22:32:30 +0000 (22:32 +0000)]
Replace some K&R function definitions with ANSI C.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27062

3 years agoConsistently use C99 fixed-width types in the in-kernel crypto code.
John Baldwin [Tue, 3 Nov 2020 22:27:54 +0000 (22:27 +0000)]
Consistently use C99 fixed-width types in the in-kernel crypto code.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27061

3 years agoUpdate man-page to document changes made to the calendar program.
Stefan Eßer [Tue, 3 Nov 2020 22:13:16 +0000 (22:13 +0000)]
Update man-page to document changes made to the calendar program.

MFC after: 3 days

3 years agoStyle, not functional changes:
Gleb Smirnoff [Tue, 3 Nov 2020 22:04:32 +0000 (22:04 +0000)]
Style, not functional changes:
- Improve spelling of a false check [1]
- A missing line from r367150.

Submitted by: kib

3 years agoAlways return MMC errors from mmc_handle_reply()
Ilya Bakulin [Tue, 3 Nov 2020 21:38:59 +0000 (21:38 +0000)]
Always return MMC errors from mmc_handle_reply()

There are two ways to propagate the error in MMCCAM:
 * Using cmd.error which is set by the peripheral driver;
 * Using CCB status which is... also set by the driver.

The problem is that those two error conditions don't necessarily match.
This leads to the confusion when handling the MMC reply. So enforce the consistency
by panicking if request is marked as completed successfully but MMC-level error
is present (this hints to the programming error).

Reviewed by: manu
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D26925

3 years agoAdd WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt
Dimitry Andric [Tue, 3 Nov 2020 19:57:28 +0000 (19:57 +0000)]
Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt

Since elftoolchain's cxxfilt is rather far behind on features, and we
ran into several bugs, add an option to use llvm-cxxfilt as an drop-in
replacement.

It supports the same options as elftoolchain cxxfilt, though it doesn't
have support for old ARM (C++ Annotated Reference Manual, not the CPU)
and GNU v2 manglings. But these are irrelevant in 2020.

Note: as we already compile the required libraries as part of libllvm,
this will not add any significant build time either.

PR: 250702
Reviewed by: emaste, yuri
Differential Revision: https://reviews.freebsd.org/D27071
MFC after: 2 weeks

3 years agolinux(4): Improve netlink diagnostics
Conrad Meyer [Tue, 3 Nov 2020 19:50:42 +0000 (19:50 +0000)]
linux(4): Improve netlink diagnostics

Add some missing netlink_family definitions and produce vaguely
human-readable error messages for those definitions, like we used to do for
just ROUTE and KOBJECT_UEVENTS.

Additionally, if we know it's a netfilter socket but didn't find it in the
table, fall back to printing that instead of the generic handler ("socket
domain 16, ...").

No change to the emulator correctness, just mildly improved diagnostics for
gaps.

3 years agosysvshm: pass relevant uap members as arguments
Brooks Davis [Tue, 3 Nov 2020 19:14:03 +0000 (19:14 +0000)]
sysvshm: pass relevant uap members as arguments

Alter shmget_allocate_segment and shmget_existing to take the values
they want from struct shmget_args rather than passing the struct
around.  In general, uap structures should only be the interface to
sys_<foo> functions.

This makes on small functional change and records the allocated space
rather than the requested space.  If this turns out to be a problem (e.g.
if software tries to find undersized segments by exact size rather than
using keys), we can correct that easily.

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27077

3 years agoMake linux_errtbl[] static.
Edward Tomasz Napierala [Tue, 3 Nov 2020 19:12:33 +0000 (19:12 +0000)]
Make linux_errtbl[] static.

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

3 years agobuild.7: Mention etcupdate(8) alongside mergemaster(8)
Mateusz Piotrowski [Tue, 3 Nov 2020 18:13:42 +0000 (18:13 +0000)]
build.7: Mention etcupdate(8) alongside mergemaster(8)

MFC after: 3 days

3 years agoFix a typo in the description of WITH_DEBUG_PORTS
Mateusz Piotrowski [Tue, 3 Nov 2020 18:02:02 +0000 (18:02 +0000)]
Fix a typo in the description of WITH_DEBUG_PORTS

For each origin listed in WITH_DEBUG_PORTS, the ports framework sets
WITH_DEBUG instead of WITH_DEBUG_PORTS.

MFC after: 3 days

3 years agoFix rookie mistake - it's nitems(), not sizeof().
Edward Tomasz Napierala [Tue, 3 Nov 2020 14:44:33 +0000 (14:44 +0000)]
Fix rookie mistake - it's nitems(), not sizeof().

Reported by: xtouqh_icloud.com
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoif_media.c SIOCGMEDIAX handler: improve loop
Konstantin Belousov [Tue, 3 Nov 2020 14:33:04 +0000 (14:33 +0000)]
if_media.c SIOCGMEDIAX handler: improve loop

Stop advancing counter past the current iteration number at the start
of iteration.  This removes the need of subtracting one when
calculating index for copyout, and arguably fixes off-by-one reporting
of copied out elements when copyout failed.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies / NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27073

3 years agoDocument how to set ports options via make.conf(5)
Mateusz Piotrowski [Tue, 3 Nov 2020 13:26:00 +0000 (13:26 +0000)]
Document how to set ports options via make.conf(5)

This patch is based on:
- https://lists.freebsd.org/pipermail/freebsd-ports-announce/2013-June/000062.html
- current content of /usr/ports/Mk/bsd.options.mk

PR: 194306
Reported by: Daan K. <daanknip__hotmail_com>
MFC after: 2 weeks

3 years agoReplace literal uses of /usr/local with a variable
Stefan Eßer [Tue, 3 Nov 2020 12:29:10 +0000 (12:29 +0000)]
Replace literal uses of /usr/local with a variable

The variable defaults to "/usr/local", unless sysctl returns some other
value for "user.localbase".

The value of user.localbase defaults to _PATH_LOCALBASE as defined in
paths.h and thus this commit has no immediate effect.

The purpose of this change is to make /etc/defaults/rc.conf automatically
use the value of _PATH_LOCALBASE when not set to the default value.

Reviewed by: imp, scottl
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D27014

3 years agoConsistently print calendar dates in the locale of the user
Stefan Eßer [Tue, 3 Nov 2020 12:15:08 +0000 (12:15 +0000)]
Consistently print calendar dates in the locale of the user

Calendar files that specify LANG=... to specify their character encoding did
also set the date format defined for that locale, resulting in output like:

Nov  4  Gabriel Faure dies from pneumonia in Paris, France, 1924
 4 nov.  N'oubliez pas les Charles !

After this commit the output is always printed in a consistent format
according to the user's current locale, e.g.:

Nov  4  Gabriel Faure dies from pneumonia in Paris, France, 1924
Nov  4  N'oubliez pas les Charles !

I'll open a review asking for opinions whether this format change should
be merged to -STABLE.

Relnotes: yes

3 years agoCheck that #ifdef, #ifndef, and #undef are used with a single name
Stefan Eßer [Tue, 3 Nov 2020 11:37:19 +0000 (11:37 +0000)]
Check that #ifdef, #ifndef, and #undef are used with a single name

This restores the parameter validation that has been peformed by cpp
for defining and testing of names used in conditions.

MFC after: 3 days

3 years agorc.d/zfs: Add shutdown to KEYWORDS
Mateusz Piotrowski [Tue, 3 Nov 2020 10:02:52 +0000 (10:02 +0000)]
rc.d/zfs: Add shutdown to KEYWORDS

The problem is that Without walling /etc/rc.d/zfs on shutdown, resources
associated with ZFS mounts are not freed and the jails will remain in dying
state. In addition, the dataset is now in a dangling state, as the jail it
is attached to is dying.

A known workaround for jails was to add the following lines
to /etc/jail.conf, to make sure that "service zfs stop" is run
when the jail is stopped:

    exec.stop = "/bin/sh /etc/rc.shutdown";
    exec.stop += "/usr/sbin/service zfs stop || /usr/bin/true";

While the workaround seems to be okay-ish for the jail situation, it is
still unclean. However, for physical hosts this may wreak havoc with the
pool if shared spares are used, as "zfs unshare" is never invoked on
shutdown.

PR: 147444
Submitted by: Markus Stoff <markus__stoffdv_at>
Reported by: Mykah <mburkhardt__exavault_com>
Reviewed by: cy
Approved by: cy (src)
MFC after: 1 week
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27039

3 years agolinux(4) prctl(2): Implement PR_[GS]ET_DUMPABLE
Conrad Meyer [Tue, 3 Nov 2020 02:10:54 +0000 (02:10 +0000)]
linux(4) prctl(2): Implement PR_[GS]ET_DUMPABLE

Proxy the flag to the roughly analogous FreeBSD procctl 'TRACE'.

TRACE-disabled processes are not coredumped, and Linux !DUMPABLE processes
can not be ptraced.  There are some additional semantics around ownership of
files in the /proc/[pid] pseudo-filesystem, which we do not attempt to
emulate correctly at this time.

Reviewed by: markj (earlier version)
Differential Revision: https://reviews.freebsd.org/D27015

3 years agolinux(4): Emulate Linux SOL_SOCKET:SO_PASSCRED
Conrad Meyer [Tue, 3 Nov 2020 01:19:13 +0000 (01:19 +0000)]
linux(4): Emulate Linux SOL_SOCKET:SO_PASSCRED

This is required by some major linux applications, such as Chrome and
Firefox.  (As well as Electron-using applications, which are essentially
a bundled version of Chrome.)

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D27012

3 years agounix(4): Add SOL_LOCAL:LOCAL_CREDS_PERSISTENT
Conrad Meyer [Tue, 3 Nov 2020 01:17:45 +0000 (01:17 +0000)]
unix(4): Add SOL_LOCAL:LOCAL_CREDS_PERSISTENT

This option is intended to be semantically identical to Linux's
SOL_SOCKET:SO_PASSCRED.  For now, it is mutually exclusive with the
pre-existing sockopt SOL_LOCAL:LOCAL_CREDS.

Reviewed by: markj (penultimate version)
Differential Revision: https://reviews.freebsd.org/D27011

3 years agolinux(4): style: Eliminate dead 'break' after 'return'
Conrad Meyer [Tue, 3 Nov 2020 01:10:27 +0000 (01:10 +0000)]
linux(4): style: Eliminate dead 'break' after 'return'

No functional change.

3 years agoifconfig: properly detect invalid mediaopt keywords.
Konstantin Belousov [Mon, 2 Nov 2020 21:47:34 +0000 (21:47 +0000)]
ifconfig: properly detect invalid mediaopt keywords.

When invalid keyword is specified, ifconfig(8) is silent about it,
instead random request is sent to the driver.

Before the patch:
root@r-freeb43:~ # ifconfig mce0 mediaopt -txpause,-rxpause
ifconfig: SIOCSIFMEDIA (media): Device not configured

After:
root@r-freeb43:~ # ifconfig mce0 mediaopt -txpause,-rxpause
ifconfig: unknown option: -txpause

Reviewed by: hselasky, kp
Sponsored by: Mellanox Technologies / NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27060

3 years agorelease: Add an image for CI
Emmanuel Vadot [Mon, 2 Nov 2020 21:10:49 +0000 (21:10 +0000)]
release: Add an image for CI

A lot of projects CI can't do FreeBSD tests currently.
The main reason is that the project CI infrastructure is runned on Linux
and that our images aren't modifiable from a Linux hosts.
Add a basic image specific for this case (called BASIC-CI for a lack of a
better name).
The image have no package pre-installed.
It only have a few modification to have dhcp client runned on the default
interface and sshd started with option to be able to log on without a password
as root.

Sponsored by: The FreeBSD Foundation

Reviewed by: re (gjb@)
Differential Revision: https://reviews.freebsd.org/D25598

3 years agoAdd routines for ARM System MMU (SMMU) pmap management.
Ruslan Bukin [Mon, 2 Nov 2020 19:56:15 +0000 (19:56 +0000)]
Add routines for ARM System MMU (SMMU) pmap management.

Reviewed by: markj
Discussed with: kib
Sponsored by: DARPA, Innovate UK
Differential Revision: https://reviews.freebsd.org/D26877

3 years agoTidy up the #includes. Recent changes, such as the introduction of
Alan Cox [Mon, 2 Nov 2020 19:20:06 +0000 (19:20 +0000)]
Tidy up the #includes.  Recent changes, such as the introduction of
VM_ALLOC_WAITOK and vm_page_unwire_noq(), have eliminated the need for
many of the #includes.

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

3 years agoRe-arrange some of the code to separate writable user tree variables from
Stefan Eßer [Mon, 2 Nov 2020 18:48:06 +0000 (18:48 +0000)]
Re-arrange some of the code to separate writable user tree variables from
R/O variables.

While here fix some nearby style. No functional change intended.

MFC after: 1 month

3 years agolinux(4): Quiesce unrecognized ioctl warning for F2FS query
Conrad Meyer [Mon, 2 Nov 2020 18:45:43 +0000 (18:45 +0000)]
linux(4): Quiesce unrecognized ioctl warning for F2FS query

On Linux, sqlite probes for underlying F2FS filesystems that support
certain kinds of atomic update with this ioctl.  The expected result on
non-F2FS filesystem (i.e., all FreeBSD filesystems) is any error value.

Minimally implement the ioctl and avoid the warning message.

(This shows up in Linux Chrome, which embeds sqlite.)

Reviewed by: emaste, trasz
Differential Revision: https://reviews.freebsd.org/D27050

3 years agolinux(4): Deduplicate ioctl range construction with a helper macro
Conrad Meyer [Mon, 2 Nov 2020 18:45:15 +0000 (18:45 +0000)]
linux(4): Deduplicate ioctl range construction with a helper macro

No functional change.

Reviewed by: emaste, trasz
Differential Revision: https://reviews.freebsd.org/D27049

3 years agopkgbase: Add incremental packages
Emmanuel Vadot [Mon, 2 Nov 2020 18:23:50 +0000 (18:23 +0000)]
pkgbase: Add incremental packages

This adds a new target update-packages which will create the new packages
compared to the last run.

This is how to use it:
At this point we cut a release
$ make buildworld ...
$ make buildkernel
$ make packages

    There is now a PKG_VERSION directory with latest link pointing to it
    Distribute the packages to server

$ something something that update the source tree
$ make buildworld ...
$ make buildkernel
$ make update-packages
You know have a PKG_VERSION directory in the REPODIR and latest link pointing to it.
In PKG_VERSION dir only the packages which differs from the latest run are
named PKG_VERSION, otherwise the old packages are there.

The process is :
Build the new packages in the PKG_VERSION directory
Compare the internal data with the PKG_VERSION_FROM version. The comparison is done
by checking the internal hash of the packages.
By default PKG_VERSION_FROM is set to what the latest link points to.
If the old and new version matches, we rm the new package and cp the old one.

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

3 years agozfs: zstd: short-circuit cleaning buffers if none exist
Mateusz Guzik [Mon, 2 Nov 2020 17:39:59 +0000 (17:39 +0000)]
zfs: zstd: short-circuit cleaning buffers if none exist

This avoids a barrage of locking every minute.

3 years agomalloc: prefix zones with malloc-
Mateusz Guzik [Mon, 2 Nov 2020 17:39:15 +0000 (17:39 +0000)]
malloc: prefix zones with malloc-

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D27038

3 years agomalloc: export kernel zones instead of relying on them being power-of-2
Mateusz Guzik [Mon, 2 Nov 2020 17:38:08 +0000 (17:38 +0000)]
malloc: export kernel zones instead of relying on them being power-of-2

Reviewed by: markj (previous version)
Differential Revision: https://reviews.freebsd.org/D27026

3 years ago[libnetmap] Fix 32 bit compilation under gcc-6.4
Adrian Chadd [Mon, 2 Nov 2020 15:01:37 +0000 (15:01 +0000)]
[libnetmap] Fix 32 bit compilation under gcc-6.4

Use uintptr_t to cast a uint64_t to a pointer type.
Yeah, it isn't technically correct for platforms with pointers
> 64 bits, but it's fine here.

This fixes 32 bit compat library builds on amd64 and also
mips32 builds.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D26790

3 years agoFix for referencing file via its vnode in ibore.
Hans Petter Selasky [Mon, 2 Nov 2020 10:44:29 +0000 (10:44 +0000)]
Fix for referencing file via its vnode in ibore.

Use the native vnode lookup functions, instead of going via the LinuxKPI,
because the file referenced is typically created outside the LinuxKPI, and
the LinuxKPI's fdget() can only resolve file descriptor numbers which
were created by itself.

The vnode pointer is used as an identifier to identify XRCD handles which
are sharing resources.

This patch fixes the so-called XRCD support in ibcore for FreeBSD.
Refer to ibv_open_xrcd(3) for more information how the file descriptor
argument is used.

Reviewed by: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoImprove loading of multipage aligned buffers.
Michal Meloun [Mon, 2 Nov 2020 08:26:19 +0000 (08:26 +0000)]
Improve loading of multipage aligned buffers.

The multipage alignment requirements is incompatible with many aspects
of actual busdma code. Multi-page alignment requests are incompatible
with many aspects of current busdma code. Mainly with partially bounced
buffer segments and per-page loop in bus_dmamap_load_buffer(). Because
proper implementation would be a major restructuring of the code, add
the fix only for already known uses and do KASSERT for all other cases.

For this reason, bus_dmamap_load_buffer () should take the memory allocated
by bus_dmam_alloc () as one segment bypassing per page segmentation. We can
do this because it is guaranteed that the memory is physically continuous.

Reviewed by: bz
Tested by:  imp, mv, daniel.engberg.lists_pyret.net, kjopek_gmail.com
Differential Revision: https://reviews.freebsd.org/D26735

3 years agolinux(4): Disambiguate identical ioctl errors in distinct paths
Conrad Meyer [Mon, 2 Nov 2020 06:16:11 +0000 (06:16 +0000)]
linux(4): Disambiguate identical ioctl errors in distinct paths

And stop truncating the full ioctl number in the error message.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D27048

3 years agoAdd icc (Isochronous Command Completion) ccb_ataio field.
Alexander Motin [Mon, 2 Nov 2020 01:01:41 +0000 (01:01 +0000)]
Add icc (Isochronous Command Completion) ccb_ataio field.

MFC after: 1 week

3 years agoifconfig.8: Improve formatting of -f in synopsis
Mateusz Piotrowski [Sun, 1 Nov 2020 22:50:21 +0000 (22:50 +0000)]
ifconfig.8: Improve formatting of -f in synopsis

MFC after: 3 days

3 years agoRemove Tn macros from ifconfig.8
Mateusz Piotrowski [Sun, 1 Nov 2020 22:46:43 +0000 (22:46 +0000)]
Remove Tn macros from ifconfig.8

MFC after: 3 days

3 years ago[ctld] Fix compilation under gcc-6.4
Adrian Chadd [Sun, 1 Nov 2020 21:18:21 +0000 (21:18 +0000)]
[ctld] Fix compilation under gcc-6.4

* remove dup yylex symbol; already defined in a header file
* uint64_t is always >= 0

Reviewed by: cem, imp
Differential Revision: https://reviews.freebsd.org/D27046

3 years agoDo not document default locations of the OpenBSD and NetBSD ports trees
Mateusz Piotrowski [Sun, 1 Nov 2020 20:54:02 +0000 (20:54 +0000)]
Do not document default locations of the OpenBSD and NetBSD ports trees

Our own Ports Collection is not targeting those systems at the moment,
so let's stop documenting bits specific to OpenBSD and NetBSD in the ports
documentation. Especially, that it might bit rot one day.

MFC after: 1 week

3 years agoFix psoition reporting for calendar data file in system directory
Stefan Eßer [Sun, 1 Nov 2020 20:38:35 +0000 (20:38 +0000)]
Fix psoition reporting for calendar data file in system directory

MFC after: 3 days

3 years agoFix year in 2 most recent entries (2010 -> 2020)
Stefan Eßer [Sun, 1 Nov 2020 19:13:55 +0000 (19:13 +0000)]
Fix year in 2 most recent entries (2010 -> 2020)

Reported by: mack@macktronics.com (Dan Mack)

3 years agoDocument how to use sudo for SU_CMD
Mateusz Piotrowski [Sun, 1 Nov 2020 17:27:48 +0000 (17:27 +0000)]
Document how to use sudo for SU_CMD

It is rather common for the ports users to replace su(1) with sudo(8)
within the SU_CMD variable. Let's document it in the manual page (so far
it's been hidden in a comment within bsd.commands.mk).

MFC after: 2 weeks

3 years agonet/if_media.c: improve IFMEDIA_DEBUG output.
Konstantin Belousov [Sun, 1 Nov 2020 16:38:30 +0000 (16:38 +0000)]
net/if_media.c: improve IFMEDIA_DEBUG output.

Use consistent output format for hex.
Print both media and mask where relevant.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27034

3 years agoCleanup of net/if_media.c: simplify cleanup loop in ifmedia_removeall().
Konstantin Belousov [Sun, 1 Nov 2020 16:36:21 +0000 (16:36 +0000)]
Cleanup of net/if_media.c: simplify cleanup loop in ifmedia_removeall().

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27034

3 years agoCleanup of net/if_media.c: some style.
Konstantin Belousov [Sun, 1 Nov 2020 16:30:17 +0000 (16:30 +0000)]
Cleanup of net/if_media.c: some style.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27034

3 years agoCleanup of net/if_media.c: switch to ANSI C function definitions.
Konstantin Belousov [Sun, 1 Nov 2020 16:25:35 +0000 (16:25 +0000)]
Cleanup of net/if_media.c: switch to ANSI C function definitions.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27034

3 years ago[iscsictl] Fix compile issues that creep up with gcc-6.4
Adrian Chadd [Sun, 1 Nov 2020 15:57:14 +0000 (15:57 +0000)]
[iscsictl] Fix compile issues that creep up with gcc-6.4

This fixes two warnings:

* double-definition of a symbol in a yacc header
* Comparison of an unsigned int being >= 0; that's always
  going to be true.

Reviewed by: imp, rscheff
Differential Revision: https://reviews.freebsd.org/D27036

3 years agoMake sysctl user.local a tunable that can be written at run-time
Stefan Eßer [Sat, 31 Oct 2020 23:48:41 +0000 (23:48 +0000)]
Make sysctl user.local a tunable that can be written at run-time

This sysctl value had been provided as a read-only variable that is
compiled into the C library based on the value of _PATH_LOCALBASE in
paths.h.

After this change, the value is compiled into the kernel as an empty
string, which is translated to _PATH_LOCALBASE by the C library.

This empty string can be overridden at boot time or by a privileged
user at run time and will then be returned by sysctl.

When set to an empty string, the value returned by sysctl reverts to
_PATH_LOCALBASE.

This update does not change the behavior on any system that does
not modify the default value of user.localbase.

I consider this change as experimental and would prefer if the run-time
write permission was reconsidered and the sysctl variable defined with
CLFLAG_RDTUN instead to restrict it to be set at boot time.

MFC after: 1 month

3 years agoacpi_dock(4): Add ACPI_PNP_INFO
Vladimir Kondratyev [Sat, 31 Oct 2020 22:20:42 +0000 (22:20 +0000)]
acpi_dock(4): Add ACPI_PNP_INFO

MFC after: 2 weeks

3 years agoacpi_wmi(4): Add ACPI_PNP_INFO
Vladimir Kondratyev [Sat, 31 Oct 2020 22:19:39 +0000 (22:19 +0000)]
acpi_wmi(4): Add ACPI_PNP_INFO

MFC after: 2 weeks

3 years agoAdd plug and play information macroses for ACPI and I2C buses.
Vladimir Kondratyev [Sat, 31 Oct 2020 22:15:59 +0000 (22:15 +0000)]
Add plug and play information macroses for ACPI and I2C buses.

Matching table format is compatible with ACPI_ID_PROBE bus method.

Note that while ACPI_ID_PROBE matches against _HID and all _CIDs, current
acpi_pnpinfo_str() exports only _HID and first _CID.  That means second
and further _CIDs should be added to both acpi_pnpinfo_str() and
ACPICOMPAT_PNP_INFO if device matching against them is required.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26824

3 years agoFix 32-bit build after r367209
Brandon Bergren [Sat, 31 Oct 2020 22:14:37 +0000 (22:14 +0000)]
Fix 32-bit build after r367209

Fix build on systems with a 32-bit size_t.

Since it's being passed as a pointer, a 64-bit write to it will overflow.

MFC with: r367209

3 years agodevmatch(8): Respect mask field when matching strings of Z type.
Vladimir Kondratyev [Sat, 31 Oct 2020 22:04:13 +0000 (22:04 +0000)]
devmatch(8): Respect mask field when matching strings of Z type.

While here, add debug output for this action.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26823

3 years agoImplement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).
Hans Petter Selasky [Sat, 31 Oct 2020 21:53:23 +0000 (21:53 +0000)]
Implement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).

Submitted by: pedro martelletto <pedro@ambientworks.net>
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoFix 32-bit build after r367229.
Brandon Bergren [Sat, 31 Oct 2020 21:11:34 +0000 (21:11 +0000)]
Fix 32-bit build after r367229.

The use of atomic_sub_64() in zfs_zstd.c was breaking the 32-bit build on
platforms without native 64-bit atomics due to atomic_sub_64() not being
available, and no fallback being provided in _STANDALONE.

Provide a standalone stub to match atomic_add_64() using simple math.

While this is not actually atomic, it does not matter in libsa context,
since it always runs single-threaded and does not run under a scheduler.

Reviewed by: mjg (in email)

3 years agoacpi_video(4): Put display device in to D3 state on "Display off" event.
Vladimir Kondratyev [Sat, 31 Oct 2020 20:28:13 +0000 (20:28 +0000)]
acpi_video(4):  Put display device in to D3 state on "Display off" event.

As required by ACPI specs 6.3, appendix A.6, table B-8.

3 years agoacpi_video(4): Add evdev support for reporting of video events.
Vladimir Kondratyev [Sat, 31 Oct 2020 20:25:55 +0000 (20:25 +0000)]
acpi_video(4): Add evdev support for reporting of video events.

3 years agoacpi(9): Add EVENTHANDLERs for video and AC adapter events.
Vladimir Kondratyev [Sat, 31 Oct 2020 20:14:28 +0000 (20:14 +0000)]
acpi(9): Add EVENTHANDLERs for video and AC adapter events.

They are required for coming ACPI support in LinuxKPI.

Reviewed by: hselasky, manu (as part of D26603)

3 years agoacpi: Tweak _DSM method evaluation helpers.
Vladimir Kondratyev [Sat, 31 Oct 2020 19:47:34 +0000 (19:47 +0000)]
acpi: Tweak _DSM method evaluation helpers.

- Use ACPI style for _DSM evaluation helper parameter types.
- Constify UUID parameter.
- Increase size of returned DSM function bitmap by acpi_DSMQuery() up to 64
  items. Old limit of 8 functions is not sufficient for JEDEC JESD245 NVDIMMs.
- Add new acpi_EvaluateDSMTyped() helper which performs additional return
  value type check as compared with acpi_EvaluateDSM().
- Reimplement acpi_EvaluateDSM() on top of the acpi_EvaluateDSMTyped() call.

Reviewed by: scottph, manu
Differential Revision: https://reviews.freebsd.org/D26602

3 years agoig4(4): Add PCI IDs for Intel Comit Lake I2C controllers.
Vladimir Kondratyev [Sat, 31 Oct 2020 19:30:23 +0000 (19:30 +0000)]
ig4(4): Add PCI IDs for Intel Comit Lake I2C controllers.

MFC after: 2 weeks

3 years agozfs: zstd: track allocator statistics
Mateusz Guzik [Sat, 31 Oct 2020 19:07:32 +0000 (19:07 +0000)]
zfs: zstd: track allocator statistics

This applies:
commit c4ede65bdfca11b532403620bbf0d6e33f0c1c1d
Author: Mateusz Guzik <mjguzik@gmail.com>
Date:   Fri Oct 30 23:26:10 2020 +0100

    zstd: track allocator statistics

    Note that this only tracks sizes as requested by the caller.
    Actual allocated space will almost always be bigger (e.g., rounded up to
    the next power of 2 or page size). Additionally the allocated buffer may
    be holding other areas hostage. Nonetheless, this is a starting point
    for tracking memory usage in zstd.

from openzfs

3 years agoMention the more strict consistency checks performed by calendar(), which
Stefan Eßer [Sat, 31 Oct 2020 16:39:27 +0000 (16:39 +0000)]
Mention the more strict consistency checks performed by calendar(), which
can make the program abort with an error message on previously accepted
but malformed input files.

3 years agoreadelf: Add -z decompression support
Ed Maste [Sat, 31 Oct 2020 15:27:45 +0000 (15:27 +0000)]
readelf: Add -z decompression support

Compatible with GNU readelf, -z decompresses sections displayed by
-x or -p.

ELF Tool Chain ticket #555
https://sourceforge.net/p/elftoolchain/tickets/555/

Submitted by: Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by: markj
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision:    https://reviews.freebsd.org/D26909

3 years agoImprove calendar file parsing and consistency tests
Stefan Eßer [Sat, 31 Oct 2020 15:11:24 +0000 (15:11 +0000)]
Improve calendar file parsing and consistency tests

Add line number information to more warning and error messages.
Detect #else and #endif without corresponing #ifdef/#ifndef as error.
Detect missing #endif at end of file and print warning but continue.

Support for #undef has been added to reverse the effect of a prior #define.
It is no error if the argument value has not been defined before.

These changes may cause error aborts on malformed input files (e.g. with
spurious #else or #endif), but no such errors exist in the calendar files
in the FreeBSD base system and the calendar-data port and all tests pass.

More tests will be added in a follow-up commit to detect regressions that
might affect the newly added features.

This commit ends a series of updates that enhance the pre-processor and
make it behave much more like prior versions of the calendar progarm that
called cpp to pre-process the data files.

MFC after: 3 days
Relnotes: yes

3 years agoAdd file names and line numbers to debug messages
Stefan Eßer [Sat, 31 Oct 2020 13:55:10 +0000 (13:55 +0000)]
Add file names and line numbers to debug messages

MFC after: 3 days

3 years agoAdd file names and line numbers to calendar format error messages
Stefan Eßer [Sat, 31 Oct 2020 13:32:08 +0000 (13:32 +0000)]
Add file names and line numbers to calendar format error messages

Without file name and line number it is very cumbersum to identify the
locations of errors in calendar files.

MFC after: 3 days

3 years agoFix reversed condition after attempted style fix in r367196
Stefan Eßer [Sat, 31 Oct 2020 12:10:43 +0000 (12:10 +0000)]
Fix reversed condition after attempted style fix in r367196

Reported by: xtouqh@hotmail.com
MFC after: 3 days