]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoUpgrade to version 3.1.5
Stefan Eßer [Wed, 5 Aug 2020 15:20:07 +0000 (15:20 +0000)]
Upgrade to version 3.1.5

This version fixes some entries in the chinese message catalogs which could
lead to program crashes when used.

3 years agoMFOpenZFS: Add support for boot environment data to be stored in the label
Toomas Soome [Wed, 5 Aug 2020 14:32:20 +0000 (14:32 +0000)]
MFOpenZFS: Add support for boot environment data to be stored in the label

We are building new bootonce mechanism (previously zfs bootnext) and it is
based on this OpenZFS change. Since this patch is nicely self contained,
I am commiting it as is, and we can stack our changes.

Original patch description follows:

Modern bootloaders leverage data stored in the root filesystem to
enable some of their powerful features. GRUB specifically has a grubenv
file which can store large amounts of configuration data that can be
read and written at boot time and during normal operation. This allows
sysadmins to configure useful features like automated failover after
failed boot attempts. Unfortunately, due to the Copy-on-Write nature
of ZFS, the standard behavior of these tools cannot handle writing to
ZFS files safely at boot time. We need an alternative way to store
data that allows the bootloader to make changes to the data.

This work is very similar to work that was done on Illumos to enable
similar functionality in the FreeBSD bootloader. This patch is different
in that the data being stored is a raw grubenv file; this file can store
arbitrary variables and values, and the scripting provided by grub is
powerful enough that special structures are not required to implement
advanced behavior.

We repurpose the second padding area in each label to store the grubenv
file, protected by an embedded checksum. We add two ioctls to get and
set this data, and libzfs_core and libzfs functions to access them more
easily. There are no direct command line interfaces to these functions;
these will be added directly to the bootloader utilities.

Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #10009

Obtained from: OpenZFS
Sponsored by: Netflix, Klara Inc.

3 years agozfs_keys_nextboot array is missing ZPOOL_CONFIG_POOL_GUID and ZPOOL_CONFIG_GUID
Toomas Soome [Wed, 5 Aug 2020 14:08:44 +0000 (14:08 +0000)]
zfs_keys_nextboot array is missing ZPOOL_CONFIG_POOL_GUID and ZPOOL_CONFIG_GUID

As we do check the incomint nvlist, we either need to list all possible
keys or use wildcard.

PR: 248462
Reported by: larafercue@gmail.com
Sponsored by: Netflix, Klara Inc.

3 years agoAdd DDB_CTF to the arm64 and riscv kernel configs
Andrew Turner [Wed, 5 Aug 2020 11:54:51 +0000 (11:54 +0000)]
Add DDB_CTF to the arm64 and riscv kernel configs

This allows DTrace fbt probes to find arguments.

Sponsored by: Innovate UK

3 years agoSynchronize definitions in mbuf.d with values from mbuf.h
Andrey V. Elsukov [Wed, 5 Aug 2020 11:54:02 +0000 (11:54 +0000)]
Synchronize definitions in mbuf.d with values from mbuf.h

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

3 years agoenviron(7): Update the description and include some more environment variables
Gordon Bergling [Wed, 5 Aug 2020 11:41:41 +0000 (11:41 +0000)]
environ(7): Update the description and include some more environment variables

- Add a better introduction to the DESCRIPTION section
- Add a description for MANPATH and POSIXLY_CORRECT
- Asorted improvements for the usage of some macros

PR: 43823
Submitted by: Lyndon Nerenberg <lyndon at orthanc dot ab dot ca>
Reviewed by: 0mp, bcr
Approved by: 0mp, bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25912

3 years agoAdd m__getjcl SDT probe.
Andrey V. Elsukov [Wed, 5 Aug 2020 11:39:09 +0000 (11:39 +0000)]
Add m__getjcl SDT probe.

Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC

3 years agogpiokeys: add a basic manual page
Andriy Gapon [Wed, 5 Aug 2020 11:38:33 +0000 (11:38 +0000)]
gpiokeys: add a basic manual page

Reviewed by: manu, bjk, 0mp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25939

3 years agoFix SIGSEGV in ipfw(8) when NAT64 prefix length is omitted.
Andrey V. Elsukov [Wed, 5 Aug 2020 11:26:49 +0000 (11:26 +0000)]
Fix SIGSEGV in ipfw(8) when NAT64 prefix length is omitted.

Submitted by: Evgeniy Khramtsov <evgeniy at khramtsov org>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25734

3 years agoDo not describe portsnap(8) as a way to manage /usr/ports
Mateusz Piotrowski [Wed, 5 Aug 2020 11:26:14 +0000 (11:26 +0000)]
Do not describe portsnap(8) as a way to manage /usr/ports

3 years agoFix typo.
Andrey V. Elsukov [Wed, 5 Aug 2020 10:27:11 +0000 (10:27 +0000)]
Fix typo.

Submitted by: Evgeniy Khramtsov <evgeniy at khramtsov org>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25932

3 years agoUpgrade to version 3.1.5
Stefan Eßer [Wed, 5 Aug 2020 10:07:43 +0000 (10:07 +0000)]
Upgrade to version 3.1.5

This version fixes a bug that only occurs when with chinese locale settings.

3 years agocache: don't ignore size passed to nchinittbl
Mateusz Guzik [Wed, 5 Aug 2020 09:38:02 +0000 (09:38 +0000)]
cache: don't ignore size passed to nchinittbl

3 years agoBump __FreeBSD_version after vaccess() change
Mateusz Guzik [Wed, 5 Aug 2020 09:27:53 +0000 (09:27 +0000)]
Bump __FreeBSD_version after vaccess() change

3 years agovfs: remove the obsolete privused argument from vaccess
Mateusz Guzik [Wed, 5 Aug 2020 09:27:03 +0000 (09:27 +0000)]
vfs: remove the obsolete privused argument from vaccess

This brings argument count down to 6, which is passable without the
stack on amd64.

3 years agocache: convert the hash from LIST to SLIST
Mateusz Guzik [Wed, 5 Aug 2020 09:25:59 +0000 (09:25 +0000)]
cache: convert the hash from LIST to SLIST

This reduces struct namecache by sizeof(void *).

Negative side is that we have to find the previous element (if any) when
removing an entry, but since we normally don't expect collisions it should be
fine.

Note this adds cache_get_hash calls which can be eliminated.

3 years agocache: reduce zone alignment to 8 bytes
Mateusz Guzik [Wed, 5 Aug 2020 09:24:38 +0000 (09:24 +0000)]
cache: reduce zone alignment to 8 bytes

It used to be sizeof of the given struct to accomodate for 32 bit mips
doing 64 bit loads, but the same can be achieved with requireing just
64 bit alignment.

While here reorder struct namecache so that most commonly used fields
are closer.

3 years agocache: convert ncnegnash into a macro
Mateusz Guzik [Wed, 5 Aug 2020 09:24:00 +0000 (09:24 +0000)]
cache: convert ncnegnash into a macro

It is a read-only var with value known at compilation time.

3 years agobsnmptools: make it print protocol errors to stderr instead of stdout
Eugene Grosbein [Wed, 5 Aug 2020 09:19:41 +0000 (09:19 +0000)]
bsnmptools: make it print protocol errors to stderr instead of stdout

Reviewed by: syrinx, bz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25911

3 years agoHandle delayed checksums if needed in NAT64.
Andrey V. Elsukov [Wed, 5 Aug 2020 09:16:35 +0000 (09:16 +0000)]
Handle delayed checksums if needed in NAT64.

Upper level protocols defer checksums calculation in hope we have
checksums offloading in a network card. CSUM_DELAY_DATA flag is used
to determine that checksum calculation was deferred. And IP output
routine checks for this flag before pass mbuf to lower layer. Forwarded
packets have not this flag.

NAT64 uses checksums adjustment when it translates IP headers.
In most cases NAT64 is used for forwarded packets, but in case when it
handles locally originated packets we need to finish checksum calculation
that was deferred to correctly adjust it.

Add check for presence of CSUM_DELAY_DATA flag and finish checksum
calculation before adjustment.

Reported and tested by: Evgeniy Khramtsov <evgeniy at khramtsov org>
MFC after: 1 week

3 years agoallwinner: clk: Fix nm clock calculation
Emmanuel Vadot [Wed, 5 Aug 2020 08:31:26 +0000 (08:31 +0000)]
allwinner: clk: Fix nm clock calculation

Use the right factor when finding the best frequency and compare the
absolute value of the result.

Submitted by: kibab
MFC after: 3 days

3 years agovfs: add a cheaper entry for mac_vnode_check_access
Mateusz Guzik [Wed, 5 Aug 2020 07:34:45 +0000 (07:34 +0000)]
vfs: add a cheaper entry for mac_vnode_check_access

3 years agovfs: tidy up namei entry point
Mateusz Guzik [Wed, 5 Aug 2020 07:33:39 +0000 (07:33 +0000)]
vfs: tidy up namei entry point

- predict for string copy errors
- reshuffle inititalistion of vars which are not needed

3 years agocache: cleanup lockless entry point
Mateusz Guzik [Wed, 5 Aug 2020 07:32:26 +0000 (07:32 +0000)]
cache: cleanup lockless entry point

- remove spurious bzero
- assert ni_lcf, it has to be set by namei by this point

3 years agocache: stop messing with cn_lkflags
Mateusz Guzik [Wed, 5 Aug 2020 07:30:57 +0000 (07:30 +0000)]
cache: stop messing with cn_lkflags

See r363882.

3 years agocache: stop messing with cn_flags
Mateusz Guzik [Wed, 5 Aug 2020 07:30:17 +0000 (07:30 +0000)]
cache: stop messing with cn_flags

This removes flag setting/unsetting carried over from regular lookup.
Flags still get for compatibility when falling back.

Note .. and . handling can get partially folded together.

3 years agovfs: prefill nameidata with garbage on debug kernels
Mateusz Guzik [Wed, 5 Aug 2020 07:28:51 +0000 (07:28 +0000)]
vfs: prefill nameidata with garbage on debug kernels

3 years agoAppease gcc's -Wparentheses (and -Werror)
Li-Wen Hsu [Wed, 5 Aug 2020 05:58:25 +0000 (05:58 +0000)]
Appease gcc's -Wparentheses (and -Werror)

Sponsored by: The FreeBSD Foundation

3 years agoufs: only pass LK_ADAPTIVE if LK_NODDLKTREAT is set
Mateusz Guzik [Tue, 4 Aug 2020 23:09:15 +0000 (23:09 +0000)]
ufs: only pass LK_ADAPTIVE if LK_NODDLKTREAT is set

This restores the pre-adaptive spinning state for SU which livelocks
otherwise. Note this is a bug in SU.

Reported by: pho

3 years agovfs: support lockless dotdot lookup
Mateusz Guzik [Tue, 4 Aug 2020 23:07:42 +0000 (23:07 +0000)]
vfs: support lockless dotdot lookup

Tested by: pho

3 years agocache: add NCF_WIP flag
Mateusz Guzik [Tue, 4 Aug 2020 23:07:00 +0000 (23:07 +0000)]
cache: add NCF_WIP flag

This allows making half-constructed entries visible to the lockless lookup,
which now can check for either "not yet fully constructed" and "no longer valid"
state.

This will be used for .. lookup.

3 years agocache: add cache_purge_vgone
Mateusz Guzik [Tue, 4 Aug 2020 23:04:29 +0000 (23:04 +0000)]
cache: add cache_purge_vgone

cache_purge locklessly checks whether the vnode at hand has any namecache
entries. This can race with a concurrent purge which managed to remove
the last entry, but may not be done touching the vnode.

Make sure we observe the relevant vnode lock as not taken before proceeding
with vgone.

Paired with the fact that doomed vnodes cannnot receive entries this restores
the invariant that there are no namecache-related writing users past cache_purge
in vgone.

Reported by: pho

3 years agomtx: add mtx_wait_unlocked
Mateusz Guzik [Tue, 4 Aug 2020 23:00:00 +0000 (23:00 +0000)]
mtx: add mtx_wait_unlocked

3 years agoMinor cleanups in mmc_xpt.c
Ilya Bakulin [Tue, 4 Aug 2020 21:58:43 +0000 (21:58 +0000)]
Minor cleanups in mmc_xpt.c

 * Downgrade some CAM debug messages from _INFO to _DEBUG level;
 * Add KASSERT for the case when we suspect incorrect CAM SIM initialization (using cam_sim_alloc() instead of cam_sim_alloc_dev());
 * Use waiting version of xpt_alloc_ccb(), we are not in hurry;
 * With the waiting version we cannot get NULL return, so remove the NULL check;
 * In some csses, the name of mmcprobe_done has been written as mmc_probedone();
 * Send AC_LOST_DEVICE if we, well, lost the device;
 * Misc style(9) fixes.

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

3 years agomakesyscalls.lua: improve syscall ordering validation
Kyle Evans [Tue, 4 Aug 2020 21:49:13 +0000 (21:49 +0000)]
makesyscalls.lua: improve syscall ordering validation

There were two separate issues here:

1.) #if/#else wasn't taken into account at all for maxsyscall figures, but
2.) We didn't validate contiguous syscall numbers anyways...

This kind of inconsistency is bad as we don't currently ensure explicit
indexing of, e.g., the sysent array if one syscall is unimplemented/missing.
This could be fixed and might be more robust, but it's also good to have the
"documentation" that comes from being explicit as to what the missing
syscalls are.

The new version looks much like the awk version; stash off the current
'last highest syscall seen' if we hit an #if, restore to that if we hit an
#else, and make sure that we're explicitly always defining the next syscall.

The logic at the tail end of process_syscall_def that moves maxsyscall has
been 'cleaned up' a little since we're now ensuring that it's monotonically
increasing earlier in the function. At the moment I think it's unlikely we'd
see range-definitions that are not UNIMPL, but there's no reason to
specifically handle that case for bumping maxsyscall there.

This change was provoked by reading the commit message for r363832 and
realizing that this validation hadn't been included in the initial rewrite
to lua.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D25945

3 years agoSkip sbin/route tests if jail not installed (WITHOUT_JAIL).
Olivier Cochard [Tue, 4 Aug 2020 21:34:13 +0000 (21:34 +0000)]
Skip sbin/route tests if jail not installed (WITHOUT_JAIL).

Approved by: kp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25935

3 years agodevinfo: add man page links
Eric van Gyzen [Tue, 4 Aug 2020 21:09:36 +0000 (21:09 +0000)]
devinfo: add man page links

Add man page links for all functions in devinfo(3).

Reported by: vim
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

3 years agodevinfo: fix memory leak on error paths
Eric van Gyzen [Tue, 4 Aug 2020 21:05:53 +0000 (21:05 +0000)]
devinfo: fix memory leak on error paths

Refactor to create devinfo_free_dev().  Call it to plug a memory leak
on two error paths in devinfo_init_devices().

Reported by: Coverity
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

3 years agoRemove unneeded cast to struct iommu_domain *.
Ruslan Bukin [Tue, 4 Aug 2020 20:54:12 +0000 (20:54 +0000)]
Remove unneeded cast to struct iommu_domain *.

Sponsored by: DARPA, AFRL

3 years agoAdd a few macroses for conversion between DMAR unit, domain, ctx
Ruslan Bukin [Tue, 4 Aug 2020 20:51:05 +0000 (20:51 +0000)]
Add a few macroses for conversion between DMAR unit, domain, ctx
and IOMMU unit, domain, ctx.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D25926

3 years agorms: fix typo: bitmamp -> bitmap
Mateusz Guzik [Tue, 4 Aug 2020 20:31:03 +0000 (20:31 +0000)]
rms: fix typo: bitmamp -> bitmap

Reported by: kib

3 years agommccam: Hold the periph during init
Emmanuel Vadot [Tue, 4 Aug 2020 20:04:00 +0000 (20:04 +0000)]
mmccam: Hold the periph during init

We need to sleep during this routine so acquire the cam hold too.

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

3 years agommcam: Use a static length sbuf buffer
Emmanuel Vadot [Tue, 4 Aug 2020 20:02:23 +0000 (20:02 +0000)]
mmcam: Use a static length sbuf buffer

We cannot sleep during cam proto_announce and sbuf sleeps so use
a static length buffer like nvme(4)

Reviewed by: kibab
Differential Revision: https://reviews.freebsd.org/D25949

3 years agommccam: mmc_xpt: We're only interested about losing the device
Emmanuel Vadot [Tue, 4 Aug 2020 20:00:21 +0000 (20:00 +0000)]
mmccam: mmc_xpt: We're only interested about losing the device

Remove all the uneeded printfs

Reviewed by: imp, kibab
Differential Revision: https://reviews.freebsd.org/D25948

3 years agocache: factor away failed vexec handling
Mateusz Guzik [Tue, 4 Aug 2020 19:55:26 +0000 (19:55 +0000)]
cache: factor away failed vexec handling

3 years agocache: assorted tidy ups
Mateusz Guzik [Tue, 4 Aug 2020 19:55:00 +0000 (19:55 +0000)]
cache: assorted tidy ups

3 years agocache: factor away lockless dot lookup and add missing stat + sdt probe
Mateusz Guzik [Tue, 4 Aug 2020 19:54:37 +0000 (19:54 +0000)]
cache: factor away lockless dot lookup and add missing stat + sdt probe

3 years agovfs: add vfs_op_thread_enter/exit _crit variants
Mateusz Guzik [Tue, 4 Aug 2020 19:54:10 +0000 (19:54 +0000)]
vfs: add vfs_op_thread_enter/exit _crit variants

and employ them in the namecache. Eliminates all spurious checks for preemption.

3 years agocache: add missing numcache detrement on insertion failure
Mateusz Guzik [Tue, 4 Aug 2020 19:52:52 +0000 (19:52 +0000)]
cache: add missing numcache detrement on insertion failure

3 years agorms: add a comment explaining performance deficiencies of write locking
Mateusz Guzik [Tue, 4 Aug 2020 19:52:16 +0000 (19:52 +0000)]
rms: add a comment explaining performance deficiencies of write locking

3 years agoImport DTS files for arm, arm64, riscv from Linux 5.8
Emmanuel Vadot [Tue, 4 Aug 2020 19:44:43 +0000 (19:44 +0000)]
Import DTS files for arm, arm64, riscv from Linux 5.8

MFC after: 2 months

3 years agoRemove extra memset() left after r342388.
Alexander Motin [Tue, 4 Aug 2020 19:27:03 +0000 (19:27 +0000)]
Remove extra memset() left after r342388.

This memset() wiped MPI2_FUNCTION_SCSI_TASK_MGMT set by mprsas_alloc_tm(),
that broke target reset on device removal, making later re-insertion into
the same slot impossible, since firmware was still waiting for the driver
to finish with the removed device.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

3 years agoImport DTS from Linux 5.8
Emmanuel Vadot [Tue, 4 Aug 2020 19:05:45 +0000 (19:05 +0000)]
Import DTS from Linux 5.8

3 years agoDisable errors for -Wsystem-headers for GCC on aarch64.
John Baldwin [Tue, 4 Aug 2020 18:24:46 +0000 (18:24 +0000)]
Disable errors for -Wsystem-headers for GCC on aarch64.

GCC's own arm_neon.h triggers multiple warnings on both GCC 6 and
GCC 9.

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

3 years agold.bfd requires an explicit emulation for MIPS for ld -r.
John Baldwin [Tue, 4 Aug 2020 18:23:32 +0000 (18:23 +0000)]
ld.bfd requires an explicit emulation for MIPS for ld -r.

Unlike lld, ld.bfd doesn't infer the emulation from the first object
file, but assumes its compiled in default for ld -r.

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

3 years agoDisable errors for -Wredundant-decls for GCC 6+.
John Baldwin [Tue, 4 Aug 2020 18:20:39 +0000 (18:20 +0000)]
Disable errors for -Wredundant-decls for GCC 6+.

GCC triggers warnings for this that clang does not for duplicate
declarations of yylex().

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

3 years agoTurn off errors for -Wmaybe-uninitialized in GCC 6+.
John Baldwin [Tue, 4 Aug 2020 18:19:29 +0000 (18:19 +0000)]
Turn off errors for -Wmaybe-uninitialized in GCC 6+.

Recent changes to <sys/tree.h> trigger this warning and seem like a
false positive.

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

3 years agolinuxkpi: Add time_after32 and time_before32
Emmanuel Vadot [Tue, 4 Aug 2020 15:27:32 +0000 (15:27 +0000)]
linuxkpi: Add time_after32 and time_before32

This compare two 32 bits times

Sponsored by: The FreeBSD Foundation
Reviewed by: kib, hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25700

3 years agolinuxkpi: Add clear_bit_unlock
Emmanuel Vadot [Tue, 4 Aug 2020 15:25:22 +0000 (15:25 +0000)]
linuxkpi: Add clear_bit_unlock

This calls clear_bit and adds a memory barrier.

Sponsored by: The FreeBSD Foundation

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25943

3 years agoRemove an incorrect assertion from in6p_lookup_mcast_ifp().
Mark Johnston [Tue, 4 Aug 2020 15:00:02 +0000 (15:00 +0000)]
Remove an incorrect assertion from in6p_lookup_mcast_ifp().

The socket may be bound to an IPv4-mapped IPv6 address.  However, the
inp address is not relevant to the JOIN_GROUP or LEAVE_GROUP operations.

While here remove an unnecessary check for inp == NULL.

Reported by: syzbot+d01ab3d5e6c1516a393c@syzkaller.appspotmail.com
Reviewed by: hselasky
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25888

3 years agoRemove most lingering references to the page lock in comments.
Mark Johnston [Tue, 4 Aug 2020 14:59:43 +0000 (14:59 +0000)]
Remove most lingering references to the page lock in comments.

Finish updating comments to reflect new locking protocols introduced
over the past year.  In particular, vm_page_lock is now effectively
unused.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25868

3 years agoRe-apply r363564.
Emmanuel Vadot [Tue, 4 Aug 2020 14:53:41 +0000 (14:53 +0000)]
Re-apply r363564.

We now have linux/sizes.h in the tree.

3 years agopkgbase: Remove the last users of the FreeBSD-example package
Emmanuel Vadot [Tue, 4 Aug 2020 14:48:45 +0000 (14:48 +0000)]
pkgbase: Remove the last users of the FreeBSD-example package

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

3 years agolinuxkpi: Add nested variant of mutex_lock_interruptible
Emmanuel Vadot [Tue, 4 Aug 2020 14:45:22 +0000 (14:45 +0000)]
linuxkpi: Add nested variant of mutex_lock_interruptible

We don't do anything with the _nesteds variant so just call mutex_lock_interruptible

Sponsoredby: The FreeBSD Foundation
Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25944

3 years agolinuxkpi: Add kref_put_lock
Emmanuel Vadot [Tue, 4 Aug 2020 14:44:16 +0000 (14:44 +0000)]
linuxkpi: Add kref_put_lock

Same as kref_put but in addition to calling the rel function it will
acquire the lock first.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D25942

3 years agolinuxkpi: Add linux/sizes.h
Emmanuel Vadot [Tue, 4 Aug 2020 14:42:38 +0000 (14:42 +0000)]
linuxkpi: Add linux/sizes.h

This file contain some defines for common sizes.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25941

3 years agoRemove free_domain() and uma_zfree_domain().
Mark Johnston [Tue, 4 Aug 2020 13:58:36 +0000 (13:58 +0000)]
Remove free_domain() and uma_zfree_domain().

These functions were introduced before UMA started ensuring that freed
memory gets placed in domain-local caches.  They no longer serve any
purpose since UMA now provides their functionality by default.  Remove
them to simplyify the kernel memory allocator interfaces a bit.

Reviewed by: cem, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25937

3 years agoiovctl.conf(5): Use Lk macro for the URL of the UCL website
Gordon Bergling [Tue, 4 Aug 2020 11:13:13 +0000 (11:13 +0000)]
iovctl.conf(5): Use Lk macro for the URL of the UCL website

PR: 248334
Reported by: chuck at tuffli dot net
Reviewed by: bcr, 0mp
Approved by: bcr, 0mp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25891

3 years agodirectory(3): Add an ERRORS section
Gordon Bergling [Tue, 4 Aug 2020 08:46:28 +0000 (08:46 +0000)]
directory(3): Add an ERRORS section

- Add an ERRORS section for opendir(3) and closedir(3)
- Document also the errors of readdir(3), readdir_r(3) and telldir(3)
- Convert the code sample into an EXAMPLES section

PR: 75711

Submitted by: abc <abc at ai1 dot anchorage dot mtaonline dot net>
Reviewed by: 0mp, bcr, jilles
Approved by: 0mp, bcr, jilles
Obtained from: partial from OpenBSD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25892

3 years agoEnsure libregex is built in time for googletest
Kyle Evans [Tue, 4 Aug 2020 03:43:28 +0000 (03:43 +0000)]
Ensure libregex is built in time for googletest

In lib/Makefile, we document the dependency with SUBDIR_DEPEND

For buildworld orchestration, just prebuild libregex if GOOGLETEST is
enabled. googletest will get built in a later pass.

3 years agobsdgrep: switch to libregex for GNU_GREP_COMPAT
Kyle Evans [Tue, 4 Aug 2020 02:47:24 +0000 (02:47 +0000)]
bsdgrep: switch to libregex for GNU_GREP_COMPAT

libregex is incomplete, but it's a bit less buggy than the in-base
libgnuregex and mostly OK.

While here, rename -DIWTH_GNU -> -DWITH_GNU_COMPAT; the option implies
that we're compatible with the GNU counterpart, not that we're including GNU
anything.

3 years agoRe-enable disabled googletest-port-test tests after r363820
Kyle Evans [Tue, 4 Aug 2020 02:20:15 +0000 (02:20 +0000)]
Re-enable disabled googletest-port-test tests after r363820

gtest now links against libregex here, and the tests pass locally.

PR: 248452

3 years agogtest: link against libregex for GNU extensions
Kyle Evans [Tue, 4 Aug 2020 02:18:24 +0000 (02:18 +0000)]
gtest: link against libregex for GNU extensions

gtest tests want to use \w ([[:alnum:]]) at the very least, which was
causing them to fail after r363679.

Start linking against libregex so that this shorthand is implemented.

PR: 248452

3 years agolibregex: disable some of the unimplemented test cases for now
Kyle Evans [Tue, 4 Aug 2020 02:16:43 +0000 (02:16 +0000)]
libregex: disable some of the unimplemented test cases for now

This should allow the tests to actually pass. Future work will uncomment the
unimplemented tests as they're implemented.

3 years agolibregex: Implement a subset of the GNU extensions
Kyle Evans [Tue, 4 Aug 2020 02:14:51 +0000 (02:14 +0000)]
libregex: Implement a subset of the GNU extensions

The entire patch-set is not yet mature enough for commit, but this usable
subset is generally enough for googletest to be happy with and mostly map to
some existing concepts, so they're not as invasive.

The specific changes included here are:

- Branching in BREs with \|
- \w and \W for [[:alnum:]] and [^[:alnum:]] respectively
- \s and \S for [[:space:]] and [^[:space:]] respectively
- Additional quantifiers in BREs, \? and \+ (self-explanatory)

There's some #ifdef'd out work for allowing empty branches as a match-all.
This is a feature that's under assessment... future work will determine
how standard this behavior is and act accordingly.

3 years agoregex(3): belatedly document REG_POSIX from r363734
Kyle Evans [Tue, 4 Aug 2020 02:06:49 +0000 (02:06 +0000)]
regex(3): belatedly document REG_POSIX from r363734

My original patch included this documented, but it appears that I failed to
include the manpage update. Do so now.

3 years agoAdd SOL_LOCAL symbolic constant for unix socket option level.
Konstantin Belousov [Mon, 3 Aug 2020 22:13:02 +0000 (22:13 +0000)]
Add SOL_LOCAL symbolic constant for unix socket option level.

The constant seems to exists on MacOS X >= 10.8.

Requested by: swills
Reviewed by: allanjude, kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25933

3 years agoSome function had the blank lines, others didn't. Most of the ones that didn't
Warner Losh [Mon, 3 Aug 2020 22:12:18 +0000 (22:12 +0000)]
Some function had the blank lines, others didn't. Most of the ones that didn't
were newer, so remove this now-optional blank line everywhere.

3 years agoConnect the tests provided with the new bc and dc
Stefan Eßer [Mon, 3 Aug 2020 20:26:04 +0000 (20:26 +0000)]
Connect the tests provided with the new bc and dc

The tests compare the command output (including of error cases) with the
expected output and exit code.

Not all tests are executed, since some expect to have a known good bc and
dc binary installed and compare results of large amounts of generated data
being processed by both versions to test for regressions.

3 years agoUpgrade to version 3.1.4
Stefan Eßer [Mon, 3 Aug 2020 19:20:26 +0000 (19:20 +0000)]
Upgrade to version 3.1.4

This version omits the printing of a copyright header in interactive mode
and the dc command now exits after execution of the commands passed via -e
or -f instead of switching to interactive mode. To pass further commands
via STDIN when dc has been invoked with -e or -f, add "-f -" to the
parameter list.

3 years agoUpgrade to version 3.1.4
Stefan Eßer [Mon, 3 Aug 2020 19:18:38 +0000 (19:18 +0000)]
Upgrade to version 3.1.4

This version omits the printing of a copyright header in interactive mode
and the dc command now exits after execution of the commands passed via -e
or -f instead of switching to interactive mode. To pass further commands
via STDIN when dc has been invoked with -e or -f, add "-f -" to the
parameter list.

3 years agoImport version 3.1.4
Stefan Eßer [Mon, 3 Aug 2020 18:55:39 +0000 (18:55 +0000)]
Import version 3.1.4

This version makes dc exit after processing all commands passed via -e or -f
instead of waiting for more input on STDIN (add "-f -" to the command line
to emulate the behavior of versionm 3.1.3 and earlier, if desired).

The version and copyright message are no longer printed for interactive
sessions as was the case with the prior implementation in the FreeBSD base
system.

Obtained from: https://git.yzena.com/gavin/bc

3 years agoAllow bootstrapping mtree on Linux systems
Alex Richardson [Mon, 3 Aug 2020 18:08:10 +0000 (18:08 +0000)]
Allow bootstrapping mtree on Linux systems

Linux glibc has a dummy lchmod that always fails and emitting a linker
warning when used. Don't fail the build due to that warning when
bootstrapping by setting LD_FATAL_WARNINGS=no.

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

3 years agoAllow building setmode.c on Linux/macOS
Alex Richardson [Mon, 3 Aug 2020 18:08:04 +0000 (18:08 +0000)]
Allow building setmode.c on Linux/macOS

We bootstrap this file to allow compiling FreeBSD on Linux systems since
some boostrap tools use setmode(). Unfortunately, glibc's sys/stat.h
declares a non-static getumask() function (which is unimplemented!) and
that conflicts with the local getumask() function. To work around this
simply use a different name here.

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

3 years agoPass the full CFLAGS to cpp for MKlib_gen.sh.
John Baldwin [Mon, 3 Aug 2020 17:53:15 +0000 (17:53 +0000)]
Pass the full CFLAGS to cpp for MKlib_gen.sh.

GCC's cpp was exiting immediately when it failed to find requested
includes (<ncurses_cfg.h> and <ncurses_defs.h>).  clang-cpp emitted an
error for the missing header files but continued processing the file
(thus not honoring any macros defined in the missing headers).

Arguably, the awk script is buggy since it doesn't check the return
value of the command it executes.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D25731

3 years agoAdd a GPIO driver for the Raspberry Pi firmware GPIOs
Andrew Turner [Mon, 3 Aug 2020 17:18:12 +0000 (17:18 +0000)]
Add a GPIO driver for the Raspberry Pi firmware GPIOs

These exist on the Raspberry Pi 3 and 4 and control and external IO
expander.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25858

3 years agoProvide more correct description for sysctl kern.smp.cores.
Konstantin Belousov [Mon, 3 Aug 2020 17:17:17 +0000 (17:17 +0000)]
Provide more correct description for sysctl kern.smp.cores.

Reported by: dewayne@heuristicsystems.com.au
PR: 248454
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoAllow the Raspberry Pi firmware driver to be a bus
Andrew Turner [Mon, 3 Aug 2020 16:43:40 +0000 (16:43 +0000)]
Allow the Raspberry Pi firmware driver to be a bus

There are child nodes in the device tree, e.g. the Raspberry Pi firmware
GPIO device. Add support for this to be a bus so we can attach these
children.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25848

3 years agoAllow child classes of simplebus to call attach directly
Andrew Turner [Mon, 3 Aug 2020 16:26:10 +0000 (16:26 +0000)]
Allow child classes of simplebus to call attach directly

Reduce code duplication when a bus is subclassed from simplebus by allowing
them to call simplebus_attach directly. This is useful when the child bus
will just implement the same calls.

As not all children will expect to have a ranges property, e.g. the
Raspberry Pi firmware, allow this property to be missing.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25925

3 years agoDo not mention portsnap(8) in ports.7
Mateusz Piotrowski [Mon, 3 Aug 2020 13:12:07 +0000 (13:12 +0000)]
Do not mention portsnap(8) in ports.7

As we are moving away from portsnap,
let's not recommend it in the manual page.

Reviewed by: bcr (manpages), mat (portmgr)
Differential Revision: https://reviews.freebsd.org/D25847

3 years agoDisable tests failing after r363679
Li-Wen Hsu [Mon, 3 Aug 2020 12:51:14 +0000 (12:51 +0000)]
Disable tests failing after r363679

PR: 248452
Sponsored by: The FreeBSD Foundation

3 years agolibc: Provide sub fp(s|g)etmask() implementations for RISC-V
Kristof Provost [Mon, 3 Aug 2020 12:48:51 +0000 (12:48 +0000)]
libc: Provide sub fp(s|g)etmask() implementations for RISC-V

RISC-V doesn't support floating-point exceptions.

RISC-V Instruction Set Manual: Volume I: User-Level ISA, 11.2 Floating-Point
Control and Status Register: "As allowed by the standard, we do not support
traps on floating-point exceptions in the base ISA, but instead require
explicit checks of the flags in software. We considered adding branches
controlled directly by the contents of the floating-point accrued exception
flags, but ultimately chose to omit these instructions to keep the ISA simple."

We still need these functions, because some applications (notably Perl) call
them, but we cannot provide a meaningful implementation.

Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D25740

3 years agoHandle Raspberry Pi 4 xhci firmware loading.
Andrew Turner [Mon, 3 Aug 2020 10:19:50 +0000 (10:19 +0000)]
Handle Raspberry Pi 4 xhci firmware loading.

The newer hardware revisions of the Raspberry Pi 4 removed the ability of
the VIA VL805 xhci controller to load its own firmware. Instead the
firmware must be installed at the appropriate time by the VideoCore
coprocessor.

Submitted by: Robert Crowston <crowston_protonmail.com>
Differential Revision: https://reviews.freebsd.org/D25261

3 years agovt(4): CONS_HISTORY/CONS_CLRHIST should operate on issuing terminal
Jason A. Harmening [Sun, 2 Aug 2020 20:18:37 +0000 (20:18 +0000)]
vt(4): CONS_HISTORY/CONS_CLRHIST should operate on issuing terminal

Currently the CONS_HISTORY and CONS_CLRHIST ioctls modify the state of the
active terminal instead of the terminal against which the ioctl was issued.
Because of the way vidcontrol(1) works, these are the same in most cases.
But a poorly-timed window switch can make them differ. This is reproducible
by issuing e.g. 'vidcontrol -s 2 && vidcontrol -C' to switch from vty 1 to
vty 2; teken will reset the cursor position on vty 1 but vt(4) will clear
the history buffer of vty 2, producing an interesting state of affairs.

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

3 years agoBump __FreeBSD_version after vnode layout changes
Mateusz Guzik [Sun, 2 Aug 2020 20:03:23 +0000 (20:03 +0000)]
Bump __FreeBSD_version after vnode layout changes

3 years agovfs: store precomputed namecache hash in the vnode
Mateusz Guzik [Sun, 2 Aug 2020 20:02:06 +0000 (20:02 +0000)]
vfs: store precomputed namecache hash in the vnode

This significantly speeds up path lookup, Cascade Lake doing access(2) on ufs
on /usr/obj/usr/src/amd64.amd64/sys/GENERIC/vnode_if.c, ops/s:
before: 2535298
after: 2797621

Over +10%.

The reversed order of computation here does not seem to matter for hash
distribution.

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

3 years agovfs: shorten v_iflag and v_vflag
Mateusz Guzik [Sun, 2 Aug 2020 20:00:43 +0000 (20:00 +0000)]
vfs: shorten v_iflag and v_vflag

While here renumber VI_* flags to remove the gaps.

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

3 years agovfs: move namecache initialisation into cache_vnode_init
Mateusz Guzik [Sun, 2 Aug 2020 19:42:06 +0000 (19:42 +0000)]
vfs: move namecache initialisation into cache_vnode_init

3 years agocore(5) appeared in Version 1 AT&T UNIX
Mateusz Piotrowski [Sun, 2 Aug 2020 16:59:14 +0000 (16:59 +0000)]
core(5) appeared in Version 1 AT&T UNIX

Based on the scans of manual pages available at
https://www.bell-labs.com/usr/dmr/www/man51.pdf,
which are a part of the following collection:
https://www.bell-labs.com/usr/dmr/www/1stEdman.html.

Obtained from: NetBSD
Differential Revision: https://reviews.freebsd.org/D25849

3 years agoDocument automatic handling of font height for BDF files
Mateusz Piotrowski [Sun, 2 Aug 2020 16:41:36 +0000 (16:41 +0000)]
Document automatic handling of font height for BDF files

PR: 248395
Submitted by: Dmitry Wagin <dmitry.wagin@ya.ru>
Reviewed by: bcr, emaste, tsoome
Differential Revision: https://reviews.freebsd.org/D25907