]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMerge ^/head r357350 through r357367.
Dimitry Andric [Sat, 1 Feb 2020 17:03:31 +0000 (17:03 +0000)]
Merge ^/head r357350 through r357367.

4 years agoFix new clang 10.0.0 warnings about converting the result of shift
Dimitry Andric [Sat, 1 Feb 2020 17:02:26 +0000 (17:02 +0000)]
Fix new clang 10.0.0 warnings about converting the result of shift
operations to a boolean in tpm(4):

  sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context]
  WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
^
  sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 'TPM_CRB_CTRL_CANCEL_CMD'
  #define TPM_CRB_CTRL_CANCEL_CMD         BIT(0)
  ^
  sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT'
  #define BIT(x) (1 << (x))
    ^

In this case, the intent was to clear the zeroth bit, and leave the rest
unaffected.  Therefore, the ~ operator should be used instead.

Noticed by: cem
MFC after: 3 days

4 years agoRevert r357349, since the clang 10.0.0 warning was actually correct, and
Dimitry Andric [Sat, 1 Feb 2020 16:57:04 +0000 (16:57 +0000)]
Revert r357349, since the clang 10.0.0 warning was actually correct, and
the ! operator should have been a ~ instead:

  Merge r357348 from the clang 10.0.0 import branch:

  Disable new clang 10.0.0 warnings about converting the result of
  shift operations to a boolean in tpm(4):

  sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context]
  WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
^
  sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 'TPM_CRB_CTRL_CANCEL_CMD'
  #define TPM_CRB_CTRL_CANCEL_CMD         BIT(0)
  ^
  sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT'
  #define BIT(x) (1 << (x))
    ^

  Such warnings can be useful in C++ contexts, but not so much in kernel
  drivers, where this type of bit twiddling is commonplace.  So disable
  it for this case.

Noticed by: cem
MFC after: 3 days

4 years agotests: epair: Don't fail if the if_epair module is already loaded
Kristof Provost [Sat, 1 Feb 2020 11:31:45 +0000 (11:31 +0000)]
tests: epair: Don't fail if the if_epair module is already loaded

kldload() returns an error (EEXIST) if the module is already loaded.
That's not a problem for us, so ignore that error.

While here also clean up include statements.

MFC after: 3 days
X-MFC-With: r357234

4 years agobridge.4: Remove notes about FreeBSD 6.2-7.2
Mateusz Piotrowski [Sat, 1 Feb 2020 10:25:13 +0000 (10:25 +0000)]
bridge.4: Remove notes about FreeBSD 6.2-7.2

Reported by: Mateusz Kwiatkowski
Reviewed by: brueffer
Approved by: bcr (mentor)
Differential Revision:  https://reviews.freebsd.org/D23393

4 years agoThe error variable is not really needed. Remove it.
Pawel Jakub Dawidek [Sat, 1 Feb 2020 10:15:23 +0000 (10:15 +0000)]
The error variable is not really needed. Remove it.

4 years agoRestore previous usage presentation (without "pwait: " prefix).
Pawel Jakub Dawidek [Sat, 1 Feb 2020 09:13:11 +0000 (09:13 +0000)]
Restore previous usage presentation (without "pwait: " prefix).

Pointed out by: jilles

4 years agovfs: replace VOP_MARKATIME with VOP_MMAPPED
Mateusz Guzik [Sat, 1 Feb 2020 06:46:55 +0000 (06:46 +0000)]
vfs: replace VOP_MARKATIME with VOP_MMAPPED

The routine is only provided by ufs and is only used on mmap and exec.

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

4 years agoufs: drop ufs_markatime from ufs_fifoops
Mateusz Guzik [Sat, 1 Feb 2020 06:41:44 +0000 (06:41 +0000)]
ufs: drop ufs_markatime from ufs_fifoops

The routine is only called on mmap and exec, both of which are invalid for
this type.

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

4 years agovfs: save on atomics on the root vnode for absolute lookups
Mateusz Guzik [Sat, 1 Feb 2020 06:40:35 +0000 (06:40 +0000)]
vfs: save on atomics on the root vnode for absolute lookups

There are 2 back-to-back atomics on the vnode, but we can check upfront if one
is sufficient. Similarly we can handle relative lookups where current working
directory == root directory.

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

4 years agovfs: add vrefactn
Mateusz Guzik [Sat, 1 Feb 2020 06:39:49 +0000 (06:39 +0000)]
vfs: add vrefactn

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

4 years agozfs: ZFS_WLOCK_TEARDOWN_INACTIVE_WLOCKED -> ZFS_TEARDOWN_INACTIVE_WLOCKED
Mateusz Guzik [Sat, 1 Feb 2020 06:39:10 +0000 (06:39 +0000)]
zfs: ZFS_WLOCK_TEARDOWN_INACTIVE_WLOCKED -> ZFS_TEARDOWN_INACTIVE_WLOCKED

Fix up the argument used in one case as well.

4 years agovlan: Fix panic when vnet jail with a vlan interface is destroyed
Kristof Provost [Fri, 31 Jan 2020 22:54:44 +0000 (22:54 +0000)]
vlan: Fix panic when vnet jail with a vlan interface is destroyed

During vnet cleanup vnet_if_uninit() checks that no more interfaces remain in
the vnet. Any interface borrowed from another vnet is returned by
vnet_if_return(). Other interfaces (i.e. cloned interfaces) should have been
destroyed by their cloner at this point.

The if_vlan VNET_SYSUNINIT had priority SI_ORDER_FIRST, which means it had
equal priority as vnet_if_uninit(). In other words: it was possible for it to
be called *after* vnet_if_uninit(), which would lead to assertion failures.

Set the priority to SI_ORDER_ANY, like other cloners to ensure that vlan
interfaces are destroyed before we enter vnet_if_uninit().

The sys/net/if_vlan test provoked this.

4 years agoAdd two missing fences with comments describing them. These were found by
Jeff Roberson [Fri, 31 Jan 2020 22:21:15 +0000 (22:21 +0000)]
Add two missing fences with comments describing them.  These were found by
inspection and after a lengthy discussion with jhb and kib.  They have not
produced test failures.

Don't pointer chase through cpu0's smr.  Use cpu correct smr even when not
in a critical section to reduce the likelihood of false sharing.

4 years agomake all is needed to generate .depend.*
Bryan Drewery [Fri, 31 Jan 2020 21:08:33 +0000 (21:08 +0000)]
make all is needed to generate .depend.*

PR: 241746
X-MFC-With: r357043
MFC after: 1 week

4 years agosmrstress: Add 'publishing' fences to operations on smrs_current.
Konstantin Belousov [Fri, 31 Jan 2020 20:30:50 +0000 (20:30 +0000)]
smrstress: Add 'publishing' fences to operations on smrs_current.

Reported and tested by: andrew
Reviewed by: jeff
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D23440

4 years agoMerge ^/head r357270 through r357349.
Dimitry Andric [Fri, 31 Jan 2020 19:40:40 +0000 (19:40 +0000)]
Merge ^/head r357270 through r357349.

4 years agoMerge r357348 from the clang 10.0.0 import branch:
Dimitry Andric [Fri, 31 Jan 2020 19:36:14 +0000 (19:36 +0000)]
Merge r357348 from the clang 10.0.0 import branch:

Disable new clang 10.0.0 warnings about converting the result of shift
operations to a boolean in tpm(4):

sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context]
        WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
                                      ^
sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 'TPM_CRB_CTRL_CANCEL_CMD'
#define TPM_CRB_CTRL_CANCEL_CMD         BIT(0)
                                        ^
sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT'
#define BIT(x) (1 << (x))
                  ^

Such warnings can be useful in C++ contexts, but not so much in kernel
drivers, where this type of bit twiddling is commonplace.  So disable it
for this case.

MFC after: 3 days

4 years agoDisable new clang 10.0.0 warnings about converting the result of shift
Dimitry Andric [Fri, 31 Jan 2020 19:35:21 +0000 (19:35 +0000)]
Disable new clang 10.0.0 warnings about converting the result of shift
operations to a boolean in tpm(4):

sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context]
        WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
                                      ^
sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 'TPM_CRB_CTRL_CANCEL_CMD'
#define TPM_CRB_CTRL_CANCEL_CMD         BIT(0)
                                        ^
sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT'
#define BIT(x) (1 << (x))
                  ^

Such warnings can be useful in C++ contexts, but not so much in kernel
drivers, where this type of bit twiddling is commonplace.  So disable it
for this case.

MFC after: 3 days

4 years agoMerge r357345 from the clang1000-import branch:
Dimitry Andric [Fri, 31 Jan 2020 19:06:49 +0000 (19:06 +0000)]
Merge r357345 from the clang1000-import branch:

Disable new clang 10.0.0 warnings about misleading indentation in flex.

As this is contributed code with very messy indentation, which will
almost certainly never be upgraded, just disable the warning.

MFC after: 3 days

4 years agoMerge r357342 from the clang1000-import branch:
Dimitry Andric [Fri, 31 Jan 2020 19:06:01 +0000 (19:06 +0000)]
Merge r357342 from the clang1000-import branch:

Work around two -Werror warning issues in googletest, which have been
solved upstream in the mean time.

The first issue is because one of googletest's generated headers contain
classes with a user-declared copy assignment operator, but rely on the
generation by the compiler of an implicit copy constructor, which is now
deprecated:

/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-param-util-generated.h:5284:8: error: definition of implicit copy constructor for 'CartesianProductHolder3<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
  void operator=(const CartesianProductHolder3& other);
       ^
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/gtest-param-test.h:1277:10: note: in implicit copy constructor for 'testing::internal::CartesianProductHolder3<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' first required here
  return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
         ^
/usr/src/tests/sys/fs/fusefs/io.cc:534:2: note: in instantiation of function template specialization 'testing::Combine<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' requested here
        Combine(Bool(),                                 /* async read */
        ^

For now, silence the warning using -Wno-deprecated-copy.

The second issue is because one of the googlemock test programs attempts
to use "unsigned wchar_t" and "signed wchar_t", which are non-standard
and at best, hazily defined:

contrib/googletest/googlemock/test/gmock-actions_test.cc:111:37: error: 'wchar_t' cannot be signed or unsigned [-Wsigned-unsigned-wchar]
  EXPECT_EQ(0U, BuiltInDefaultValue<unsigned wchar_t>::Get());
                                    ^
contrib/googletest/googlemock/test/gmock-actions_test.cc:112:36: error: 'wchar_t' cannot be signed or unsigned [-Wsigned-unsigned-wchar]
  EXPECT_EQ(0, BuiltInDefaultValue<signed wchar_t>::Get());
                                   ^

For now, silence the warning using -Wno-signed-unsigned-wchar.

MFC after: 3 days

4 years agoDisable new clang 10.0.0 warnings about misleading indentation in flex.
Dimitry Andric [Fri, 31 Jan 2020 19:02:53 +0000 (19:02 +0000)]
Disable new clang 10.0.0 warnings about misleading indentation in flex.

As this is contributed code with very messy indentation, which will
almost certainly never be upgraded, just disable the warning.

MFC after: 3 days

4 years agoAdd stricter checks on user changes to SSTATUS.
John Baldwin [Fri, 31 Jan 2020 19:00:48 +0000 (19:00 +0000)]
Add stricter checks on user changes to SSTATUS.

Rather than trying to blacklist which bits userland can't write to via
sigreturn() or setcontext(), only permit changes to whitelisted bits.

- Permit arbitrary writes to bits in the user-writable USTATUS
  register that shadows SSTATUS.

- Ignore changes in write-only bits maintained by the CPU.

- Ignore the user-supplied value of the FS field used to track
  floating point state and instead set it to a value matching the
  actions taken by set_fpcontext().

Discussed with: mhorne
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23338

4 years agoservices: Add PROFInet and EtherCAT.
Pedro F. Giffuni [Fri, 31 Jan 2020 18:55:21 +0000 (18:55 +0000)]
services: Add PROFInet and EtherCAT.

Both are used in industrial networks.

MFC after: 1 week

4 years agoWork around two -Werror warning issues in googletest, which have been
Dimitry Andric [Fri, 31 Jan 2020 18:26:23 +0000 (18:26 +0000)]
Work around two -Werror warning issues in googletest, which have been
solved upstream in the mean time.

The first issue is because one of googletest's generated headers contain
classes with a user-declared copy assignment operator, but rely on the
generation by the compiler of an implicit copy constructor, which is now
deprecated:

/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-param-util-generated.h:5284:8: error: definition of implicit copy constructor for 'CartesianProductHolder3<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
  void operator=(const CartesianProductHolder3& other);
       ^
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/gtest-param-test.h:1277:10: note: in implicit copy constructor for 'testing::internal::CartesianProductHolder3<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' first required here
  return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
         ^
/usr/src/tests/sys/fs/fusefs/io.cc:534:2: note: in instantiation of function template specialization 'testing::Combine<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' requested here
        Combine(Bool(),                                 /* async read */
        ^

For now, silence the warning using -Wno-deprecated-copy.

The second issue is because one of the googlemock test programs attempts
to use "unsigned wchar_t" and "signed wchar_t", which are non-standard
and at best, hazily defined:

contrib/googletest/googlemock/test/gmock-actions_test.cc:111:37: error: 'wchar_t' cannot be signed or unsigned [-Wsigned-unsigned-wchar]
  EXPECT_EQ(0U, BuiltInDefaultValue<unsigned wchar_t>::Get());
                                    ^
contrib/googletest/googlemock/test/gmock-actions_test.cc:112:36: error: 'wchar_t' cannot be signed or unsigned [-Wsigned-unsigned-wchar]
  EXPECT_EQ(0, BuiltInDefaultValue<signed wchar_t>::Get());
                                   ^

For now, silence the warning using -Wno-signed-unsigned-wchar.

MFC after: 3 days

4 years agoregen src.conf.5 after r357338 BSD_CRTBEGIN retirement
Ed Maste [Fri, 31 Jan 2020 18:26:13 +0000 (18:26 +0000)]
regen src.conf.5 after r357338 BSD_CRTBEGIN retirement

4 years agoMerge r357339 from the clang1000-import branch:
Dimitry Andric [Fri, 31 Jan 2020 18:13:00 +0000 (18:13 +0000)]
Merge r357339 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in bsnmpd:

usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1661:4: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                        return (-1);
                        ^
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1658:5: note: previous statement is here
                } else
                  ^

The intent was to group the return statement with the previous syslog()
call.

MFC after: 3 days

4 years agoFix the following -Werror warning from clang 10.0.0 in bsnmpd:
Dimitry Andric [Fri, 31 Jan 2020 18:09:27 +0000 (18:09 +0000)]
Fix the following -Werror warning from clang 10.0.0 in bsnmpd:

usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1661:4: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                        return (-1);
                        ^
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1658:5: note: previous statement is here
                } else
                  ^

The intent was to group the return statement with the previous syslog()
call.

MFC after: 3 days

4 years agoretire BSD_CRTBEGIN option
Ed Maste [Fri, 31 Jan 2020 18:04:04 +0000 (18:04 +0000)]
retire BSD_CRTBEGIN option

BSD crt is currently used on all architectures (other than sparc64).
Remove the option and use BSD crt everywhere as part of the GCC 4.2.1
retirement plan.

https://lists.freebsd.org/pipermail/freebsd-arch/2020-January/019823.html

PR: 239851
Reviewed by: andrew, brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23122

4 years agoFix 64-bit value of SSTATUS_SD to use an unsigned long.
John Baldwin [Fri, 31 Jan 2020 17:49:15 +0000 (17:49 +0000)]
Fix 64-bit value of SSTATUS_SD to use an unsigned long.

While here, fix MSTATUS_SD to match SSTATUS_SD.

Reviewed by: mhorne
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23434

4 years agohwpstate(4): Ignore CurPstateLimit by default
Conrad Meyer [Fri, 31 Jan 2020 17:40:41 +0000 (17:40 +0000)]
hwpstate(4): Ignore CurPstateLimit by default

Add a sysctl knob to allow users to re-enable it, and document the knob and
default in cpufreq.4.  (While here, add a few unrelated updates to
cpufreq.4.)

It seems that the register value in some hardware simply reflects the
configured P-state.  This results in an inadvertent and unintended outcome
where the P-state can only walk down, and then the driver becomes "stuck" in
the slowest possible P-state.

The Linux driver never consults this register, so that's some evidence that
ignoring the contents are relatively harmless.

PR: 234733
Reported by: sigsys AT gmail.com, Erich Dollanksy <freebsd.ed.lists AT
sumeritec.com>

4 years agoRPI3: Add RPi4 firmware files to the FAT partition
Kyle Evans [Fri, 31 Jan 2020 15:56:08 +0000 (15:56 +0000)]
RPI3: Add RPi4 firmware files to the FAT partition

I've discovered I have this local diff that never got committed -- this
should have been a part of r355424.

Reproted by: Klaus Küchemann <maciphone2@googlemail.com>

4 years agoReimplement stack capture of running threads on i386 and amd64.
Mark Johnston [Fri, 31 Jan 2020 15:43:33 +0000 (15:43 +0000)]
Reimplement stack capture of running threads on i386 and amd64.

After r355784 the td_oncpu field is no longer synchronized by the thread
lock, so the stack capture interrupt cannot be delievered precisely.
Fix this using a loop which drops the thread lock and restarts if the
wrong thread was sampled from the stack capture interrupt handler.

Change the implementation to use a regular interrupt instead of an NMI.
Now that we drop the thread lock, there is no advantage to the latter.

Simplify the KPIs.  Remove stack_save_td_running() and add a return
value to stack_save_td().  On platforms that do not support stack
capture of running threads, stack_save_td() returns EOPNOTSUPP.  If the
target thread is running in user mode, stack_save_td() returns EBUSY.

Reviewed by: kib
Reported by: mjg, pho
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23355

4 years agoCall the MAPTI command earlier in the ITS driver
Andrew Turner [Fri, 31 Jan 2020 11:33:11 +0000 (11:33 +0000)]
Call the MAPTI command earlier in the ITS driver

The GICv3 Software Overview suggests when allocating a new MSI/MSI-X
interrupt we need to call MAPD followed by MAPTI. Unfortunately the code
would place a MOVI command between these. This is invalid as it needs
values set by the MAPTI to be present.

Re-order so we allocate a temporary CPU for the interrupt, then use the
MAPTI command to assign the MSI to it.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

4 years agovfs: revert the overzealous assert added in r357285 to vgone
Mateusz Guzik [Fri, 31 Jan 2020 11:31:14 +0000 (11:31 +0000)]
vfs: revert the overzealous assert added in r357285 to vgone

The intent was to make it more likely to catch filesystems with custom
need_inactive routines which fail to call vn_need_pageq_flush (or do an
equivalent).

One immediate case which is missed is vgone from called by inactive itself.

A better assertion may land later. The routine is not added to vputx because
it is of no use to tmpfs et al.

Reported by: syzbot+5f697ec11f89b60941db@syzkaller.appspotmail.com

4 years agoRevert r357293.
Hans Petter Selasky [Fri, 31 Jan 2020 10:51:13 +0000 (10:51 +0000)]
Revert r357293.
The netisr uses rm_ locks not rms_ locks as noted by jeff@ .

Sponsored by: Mellanox Technologies

4 years agoWiden EPOCH(9) usage in mlx4en(4).
Hans Petter Selasky [Fri, 31 Jan 2020 10:41:47 +0000 (10:41 +0000)]
Widen EPOCH(9) usage in mlx4en(4).

Make sure all receive completion callbacks are covered by the network
EPOCH(9), because this is required when calling if_input() and
ether_input() after r357012.

Convert some spaces to tabs while at it.

Sponsored by: Mellanox Technologies

4 years agoOnly create one ITS configuration table
Andrew Turner [Fri, 31 Jan 2020 10:30:13 +0000 (10:30 +0000)]
Only create one ITS configuration table

When there are multiple ITS devices in the system we would allocate a
configuration table for each, however only one table is needed as all the
ITS devices share this.

Allocate a table only when the global table is unset.

While here fix the type of this to be a pointer to a uint8_t array as the
entries are all 8 bits wide.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

4 years agoIgnore the SMMUv3 and PMCG interrupt controller in the IORT tables
Andrew Turner [Fri, 31 Jan 2020 09:51:38 +0000 (09:51 +0000)]
Ignore the SMMUv3 and PMCG interrupt controller in the IORT tables

When mapping MSI/MSI-X interrupts throught he Arm IORT ACPI tables we may
need to ignore an interrupt controller even if it is within the bounds the
entry describes. When the SMMUv3 is not using GSIV (non-MSI/MSI-X)
interrupts we need to read the defined field. The Performance Monitoring
Counter Group always ignores the first table entry.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

4 years agozfs: convert z_teardown_inactive_lock to sleepable read-mostly lock
Mateusz Guzik [Fri, 31 Jan 2020 08:38:38 +0000 (08:38 +0000)]
zfs: convert z_teardown_inactive_lock to sleepable read-mostly lock

This eliminates a global serialisation point. It only gets write locked
on unmount.

Sample result doing an incremental -j 40 build:
before: 173.30s user 458.97s system 2595% cpu 24.358 total
after:  168.58s user 254.92s system 2211% cpu 19.147 total

4 years agozfs: provide macros to handle z_teardown_inactive_lock
Mateusz Guzik [Fri, 31 Jan 2020 08:37:35 +0000 (08:37 +0000)]
zfs: provide macros to handle z_teardown_inactive_lock

4 years agoAdd rms_try_rlock and rms_wowned.
Mateusz Guzik [Fri, 31 Jan 2020 08:36:49 +0000 (08:36 +0000)]
Add rms_try_rlock and rms_wowned.

4 years agoRemove an overzealous assert from rms_runlock.
Mateusz Guzik [Fri, 31 Jan 2020 08:36:23 +0000 (08:36 +0000)]
Remove an overzealous assert from rms_runlock.

4 years agoFix NOINET builds.
Navdeep Parhar [Fri, 31 Jan 2020 02:23:48 +0000 (02:23 +0000)]
Fix NOINET builds.

4 years agoImplement a simple UMA SMR stress testing tool.
Jeff Roberson [Fri, 31 Jan 2020 02:18:56 +0000 (02:18 +0000)]
Implement a simple UMA SMR stress testing tool.

4 years agoDon't use "All rights reserved" in new copyrights.
Jeff Roberson [Fri, 31 Jan 2020 02:08:09 +0000 (02:08 +0000)]
Don't use "All rights reserved" in new copyrights.

Requested by: rgrimes

4 years agoFix LINT build with MEMGUARD.
Jeff Roberson [Fri, 31 Jan 2020 02:03:22 +0000 (02:03 +0000)]
Fix LINT build with MEMGUARD.

4 years agoImplement a safe memory reclamation feature that is tightly coupled with UMA.
Jeff Roberson [Fri, 31 Jan 2020 00:49:51 +0000 (00:49 +0000)]
Implement a safe memory reclamation feature that is tightly coupled with UMA.

This is in the same family of algorithms as Epoch/QSBR/RCU/PARSEC but is
a unique algorithm.  This has 3x the performance of epoch in a write heavy
workload with less than half of the read side cost.  The memory overhead
is significantly lessened by limiting the free-to-use latency.  A synthetic
test uses 1/20th of the memory vs Epoch.  There is significant further
discussion in the comments and code review.

This code should be considered experimental.  I will write a man page after
it has settled.  After further validation the VM will begin using this
feature to permit lockless page lookups.

Both markj and cperciva tested on arm64 at large core counts to verify
fences on weaker ordering architectures.  I will commit a stress testing
tool in a follow-up.

Reviewed by: mmacy, markj, rlibby, hselasky
Discussed with: sbahara
Differential Revision: https://reviews.freebsd.org/D22586

4 years agoTrim duplicate CSR swaps from user exceptions.
John Baldwin [Thu, 30 Jan 2020 22:19:48 +0000 (22:19 +0000)]
Trim duplicate CSR swaps from user exceptions.

The stack pointer is swapped with the sscratch CSR just before the
jump to cpu_exception_handler_user where the first instruction swaps
it again.  The two swaps together are a no-op, but the csr swap
instructions can be expensive (e.g. on Bluespec RISC-V cores csr swap
instructions force a full pipeline stall).

Reported by: jrtc27
Reviewed by: br
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23394

4 years agoRemove duplicated empty lines from kern/*.c
Mateusz Guzik [Thu, 30 Jan 2020 20:05:05 +0000 (20:05 +0000)]
Remove duplicated empty lines from kern/*.c

No functional changes.

4 years agoTidy up 2 comments in smp_rendezvous_cpus.
Mateusz Guzik [Thu, 30 Jan 2020 20:02:14 +0000 (20:02 +0000)]
Tidy up 2 comments in smp_rendezvous_cpus.

4 years agoamd64: sync up libc memcmp with the kernel version (r357309)
Mateusz Guzik [Thu, 30 Jan 2020 19:57:05 +0000 (19:57 +0000)]
amd64: sync up libc memcmp with the kernel version (r357309)

4 years agoamd64: speed up failing case for memcmp
Mateusz Guzik [Thu, 30 Jan 2020 19:56:22 +0000 (19:56 +0000)]
amd64: speed up failing case for memcmp

Instead of branching on up to 8 bytes, drop the size to 4.

Assorted clean ups while here.

Validated with glibc test suite.

4 years agoAssert that smp_rendezvous_cpus is called with interrupts enabled.
Mateusz Guzik [Thu, 30 Jan 2020 19:38:51 +0000 (19:38 +0000)]
Assert that smp_rendezvous_cpus is called with interrupts enabled.

4 years agovfs: keep the mount point referenced across sys_quotactl
Mateusz Guzik [Thu, 30 Jan 2020 19:38:12 +0000 (19:38 +0000)]
vfs: keep the mount point referenced across sys_quotactl

Otherwise we risk running into use-after-free.

In particular this codepath ends up dropping all protection before
suspending writes:

ufs_quotactl -> quotaoff_inchange -> vfs_write_suspend_umnt

Reported by: pho

4 years agoFix a bug in r357199.
Konstantin Belousov [Thu, 30 Jan 2020 19:34:37 +0000 (19:34 +0000)]
Fix a bug in r357199.

Around a generic call to null_nodeget(), there is nothing that would
prevent the unmount of the nullfs mp until we process to the
insmntque1() point.  Calculate the VV_ROOT flag after insmntque1() to
not access mp->mnt_data before we have an exclusively locked vnode
from this mount point on the mp vnode list.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoRemove unused fields from struct pcb.
John Baldwin [Thu, 30 Jan 2020 19:15:27 +0000 (19:15 +0000)]
Remove unused fields from struct pcb.

cpu_switch/throw() and savectx() do not save or restore any values in
these fields which mostly held non-callee-save registers.

makectx() copied these fields from kdb_frame, but they weren't used
except for PC_REGS using pcb_sepc.  Change PC_REGS to use
kdb_frame->tf_sepc directly instead.

Reviewed by: br
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23395

4 years agoShift the ITS processor ID after reading it.
Andrew Turner [Thu, 30 Jan 2020 18:49:19 +0000 (18:49 +0000)]
Shift the ITS processor ID after reading it.

When using the processor ID value we mask off the low and high bits that
should be zero. Unfortunatly we don't shift the ID value so it won't be
affected. Add the shift when reading the ID as this will need to align
with the address based target value.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

4 years agoFix an indentation bug in r357169.
Brooks Davis [Thu, 30 Jan 2020 18:34:08 +0000 (18:34 +0000)]
Fix an indentation bug in r357169.

4 years agoFix use of an uninitialized variable.
John Baldwin [Thu, 30 Jan 2020 18:28:02 +0000 (18:28 +0000)]
Fix use of an uninitialized variable.

ctx (and thus ctx.flags) is stack garbage at the start of this
function, so initialize ctx.flags to an explicit value instead of
using binary operations on the garbage.

Reported by: gcc9
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D23368

4 years agocontrib/apr: Rip out bogus [CS]PRNG implementation
Conrad Meyer [Thu, 30 Jan 2020 18:12:41 +0000 (18:12 +0000)]
contrib/apr: Rip out bogus [CS]PRNG implementation

This construction used some relatively slow design involving SHA2; even if
it were fed real entropy (unclear; external to the design), it did not
handle fork in a safe way, and it was difficult to audit for correctness.
So just rip it out and use the very simple and known-correct arc4random(3)
interface in its place.

4 years agoaic7xxx(4): Fix unintended sign extension in ahd_inq()
Conrad Meyer [Thu, 30 Jan 2020 18:12:24 +0000 (18:12 +0000)]
aic7xxx(4): Fix unintended sign extension in ahd_inq()

ahd_inb() returns type uint8_t.  The shift left by untyped 24 implicitly
promotes the result to type (signed) int.  Then the binary OR with uint64_t
values sign-extends the integer.  If bit 31 of the read value happened to be
set, the 64-bit result would have all upper 32 bits set to 1 due to OR.  This
is clearly not intended.

Reported by: Coverity
CID: 980473 (old one!)

4 years agocontrib/apr: Remove scope leak UB
Conrad Meyer [Thu, 30 Jan 2020 17:50:51 +0000 (17:50 +0000)]
contrib/apr: Remove scope leak UB

In apr_vformatter, the variable buf was declared inside a limited scope
region, but a pointer to it is leaked outside of that region and used
later.  This is undefined behavior.  Fix by moving the buf variable to
function scope.

Reported by: Coverity
CID: 1192541

4 years agoAdd missing mutex unlock in failure case.
Hans Petter Selasky [Thu, 30 Jan 2020 17:30:04 +0000 (17:30 +0000)]
Add missing mutex unlock in failure case.

Differential Revision: https://reviews.freebsd.org/D23430
Submitted by: cem
Reported by: Coverity
Coverity CID: 1368773
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoWiden EPOCH(9) usage in mlx5en(4).
Hans Petter Selasky [Thu, 30 Jan 2020 12:35:13 +0000 (12:35 +0000)]
Widen EPOCH(9) usage in mlx5en(4).

Make completion event path mostly lockless using EPOCH(9).

Implement a mechanism using EPOCH(9) which allows us to make
the callback path for completion events mostly lockless.

Simplify draining callback events using epoch_wait().

While at it make sure all receive completion callbacks are
covered by the network EPOCH(9), because this is required
when calling if_input() and ether_input() after r357012.

Sponsored by: Mellanox Technologies

4 years agoWiden EPOCH(9) usage in netisr.
Hans Petter Selasky [Thu, 30 Jan 2020 12:04:02 +0000 (12:04 +0000)]
Widen EPOCH(9) usage in netisr.

Software interrupt handlers are allowed to sleep. In swi_net() there
is a read lock behind NETISR_RLOCK() which in turn ends up calling
msleep() which means the whole of swi_net() cannot be protected by an
EPOCH(9) section. By default the NETISR_LOCKING feature is disabled.

This issue was introduced by r357004. This is a preparation step for
replacing the functionality provided by r357004.

Found by: kib@
Sponsored by: Mellanox Technologies

4 years agoacpi_ibm: add support for ThinkPad PrivacyGuard
Philip Paeps [Thu, 30 Jan 2020 10:40:38 +0000 (10:40 +0000)]
acpi_ibm: add support for ThinkPad PrivacyGuard

ThinkPad PrivacyGuard is a built-in toggleable privacy filter that
restricts viewing angles when on. It is an available on some new
ThinkPad models such as the X1 Carbon 7th gen (as an optional HW
upgrade).

The privacy filter can be enabled/disabled via an ACPI call. This commit
adds a sysctl under dev.acpi_ibm that allows for getting and setting the
PrivacyGuard state.

Submitted by:   Kamila Součková <kamila@ksp.sk>
Reviewed By:    cem, philip
MFC after:      3  days
Differential Revision: https://reviews.freebsd.org/D23370

4 years agoWiden EPOCH(9) usage in PCI WLAN drivers.
Hans Petter Selasky [Thu, 30 Jan 2020 10:28:01 +0000 (10:28 +0000)]
Widen EPOCH(9) usage in PCI WLAN drivers.

Make sure all occurrences of ieee80211_input_xxx() in sys/dev are
covered by a network epoch section. Do not depend on the interrupt
handler nor any taskqueues being in a network epoch section.

This patch should unbreak the PCI WLAN drivers after r357004.

Pointy hat: glebius@
Sponsored by: Mellanox Technologies

4 years agoWiden EPOCH(9) usage in USB WLAN drivers.
Hans Petter Selasky [Thu, 30 Jan 2020 09:41:48 +0000 (09:41 +0000)]
Widen EPOCH(9) usage in USB WLAN drivers.

This patch should unbreak the USB WLAN drivers after r357004.

Pointy hat: glebius@
Sponsored by: Mellanox Technologies

4 years agovfs: remove the never set VDESC_NOMAP_VPP flag
Mateusz Guzik [Thu, 30 Jan 2020 08:56:22 +0000 (08:56 +0000)]
vfs: remove the never set VDESC_NOMAP_VPP flag

4 years agoufs: add the missing vn_need_pageq_flush call to ufs_need_inactive
Mateusz Guzik [Thu, 30 Jan 2020 05:37:35 +0000 (05:37 +0000)]
ufs: add the missing vn_need_pageq_flush call to ufs_need_inactive

4 years agovfs: assert that doomed vnodes don't need to call vm_object_page_clean
Mateusz Guzik [Thu, 30 Jan 2020 04:59:08 +0000 (04:59 +0000)]
vfs: assert that doomed vnodes don't need to call vm_object_page_clean

... after the optional inactive processing.

4 years agostdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite
Kyle Evans [Thu, 30 Jan 2020 03:31:16 +0000 (03:31 +0000)]
stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite

fflush_unlocked is currently desired in ports by sysutils/metalog, and
redefined as the locked fflush.

fputc_unlocked, fputs_unlocked, fread_unlocked, and fwrite_unlocked are
currently desired in ports by devel/elfutils, and redefined as the locked
fputs, fread, and fwrite respectively.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D23336

4 years agopkgbase: generate dependencies in generate-ucl.sh
Kyle Evans [Thu, 30 Jan 2020 03:01:00 +0000 (03:01 +0000)]
pkgbase: generate dependencies in generate-ucl.sh

This cuts out a large chunk of duplicated *.ucl files that just needed
dependencies tacked on, and gives generate-ucl.sh some leeway in case a
future pkg may need more than one dependency.

Run-through to determine which ones could simply be removed done with for i
in *.ucl; do diff -U3 template.ucl ${i}; done | less and inspecting for any
differences beyond just adding deps at the end. The remaining ucl files are
basically all differently-licensed, require scripts, or are marked vital.

I've opted to remove %PKGDEPS% entirely without regard for third-party ucl,
as pkgbase is not yet considered production. However, I do not hold a strong
position on this and there is approximately 0 chance it will return.

clibs should have been added previously in generate-ucl.sh as one that
doesn't have any dependencies, but do so now that we would otherwise be
tacking on the runtime dependency.

Reviewed by: manu, bapt (earlier version)
Differential Revision: https://reviews.freebsd.org/D23415

4 years agozfs: fix spurious lock contention during path lookup
Mateusz Guzik [Thu, 30 Jan 2020 02:16:17 +0000 (02:16 +0000)]
zfs: fix spurious lock contention during path lookup

ZFS tracks if anything denies VEXEC to allow for a quick check for the
common case of path traversal. Use it.

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

4 years agozfs: use VOP_NEED_INACTIVE
Mateusz Guzik [Thu, 30 Jan 2020 02:14:10 +0000 (02:14 +0000)]
zfs: use VOP_NEED_INACTIVE

Big thanks to Greg V for testing previous verions of the patch.

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

4 years agovfs: unlazy before dooming the vnode
Mateusz Guzik [Thu, 30 Jan 2020 02:12:52 +0000 (02:12 +0000)]
vfs: unlazy before dooming the vnode

With this change having the listmtx lock held postpones dooming the vnode.
Use this fact to simplify iteration over the lazy list. It also allows
filters to safely access ->v_data.

Reviewed by: kib (early version)
Differential Revision: https://reviews.freebsd.org/D23397

4 years agoFix text format definition for kern.maxvnodes, vfs.wantfreevnodes. This
Gleb Smirnoff [Thu, 30 Jan 2020 00:18:00 +0000 (00:18 +0000)]
Fix text format definition for kern.maxvnodes, vfs.wantfreevnodes.  This
is a regression from r356642, r356645.

4 years agoFix missing NET_EPOCH_ENTER() when compiled with TCP_OFFLOAD.
Gleb Smirnoff [Wed, 29 Jan 2020 22:48:18 +0000 (22:48 +0000)]
Fix missing NET_EPOCH_ENTER() when compiled with TCP_OFFLOAD.

Reported by: Coverity
CID: 1413162

4 years agomodules: adding some missing opt_* dependencies
Kyle Evans [Wed, 29 Jan 2020 22:43:56 +0000 (22:43 +0000)]
modules: adding some missing opt_* dependencies

if_vlan grew a dependency on opt_inet6.h in r356993
if_lagg and if_vlan both grew a dependency on opt_kern_tls.h in r351522

This is needed for standalone module builds of these guys.

4 years agoconfig.mk: #define MAC as well
Kyle Evans [Wed, 29 Jan 2020 22:40:13 +0000 (22:40 +0000)]
config.mk: #define MAC as well

MAC is also almost universally a default; every GENERIC includes it, and
it's std.armv[67]. mips is again the oddball here with it only being
included in ERL/OCTEON1.

The only module currently working around this one is mac_veriexec, but it
looks like nothing it builds actually uses the MAC definition. Downstream
consumers enabling MAC in mips using mac_veriexec may be advised to do
something differently here in config.mk.

4 years agoRevert r357246
Conrad Meyer [Wed, 29 Jan 2020 22:37:01 +0000 (22:37 +0000)]
Revert r357246

I have no idea what this code is trying to do, leave it be.

Reported by: lwhsu

4 years agoMerge r357271 from the clang1000-import branch:
Dimitry Andric [Wed, 29 Jan 2020 21:41:45 +0000 (21:41 +0000)]
Merge r357271 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in bsnmpd:

usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c:1235:43: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
                            begemotBridgeStpPortEnable_enabled ||
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

Work around it by casting the enum values to the type of val->v.integer.

MFC after: 3 days

4 years agoFix the following -Werror warning from clang 10.0.0 in bsnmpd:
Dimitry Andric [Wed, 29 Jan 2020 21:40:35 +0000 (21:40 +0000)]
Fix the following -Werror warning from clang 10.0.0 in bsnmpd:

usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c:1235:43: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
                            begemotBridgeStpPortEnable_enabled ||
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

Work around it by casting the enum values to the type of val->v.integer.

MFC after: 3 days

4 years agoMerge ^/head r357179 through r357269.
Dimitry Andric [Wed, 29 Jan 2020 21:09:36 +0000 (21:09 +0000)]
Merge ^/head r357179 through r357269.

4 years agoMerge r357267 from the clang1000-import branch:
Dimitry Andric [Wed, 29 Jan 2020 21:07:46 +0000 (21:07 +0000)]
Merge r357267 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in tip:

usr.bin/tip/tip/tip.c:428:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        if (gch == EOF)
                        ^
usr.bin/tip/tip/tip.c:426:5: note: previous statement is here
                } else if (!cumode && gch == character(value(FORCE)))
                  ^

The intent was to have the EOF check grouped with the getchar() call
just above it.  This was accidentally introduced in r354624.

MFC after: 3 days

4 years agoMerge r357260 from the clang1000-import branch:
Dimitry Andric [Wed, 29 Jan 2020 21:06:22 +0000 (21:06 +0000)]
Merge r357260 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in procstat:

usr.bin/procstat/procstat_sigs.c:79:3: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                xo_close_container(name);
                ^
usr.bin/procstat/procstat_sigs.c:77:4: note: previous statement is here
        } else
          ^

The intent was to group the xo_close_container() call to the previous
snprintf() call.

MFC after: 3 days

4 years agoFix the following -Werror warning from clang 10.0.0 in tip:
Dimitry Andric [Wed, 29 Jan 2020 20:56:31 +0000 (20:56 +0000)]
Fix the following -Werror warning from clang 10.0.0 in tip:

usr.bin/tip/tip/tip.c:428:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        if (gch == EOF)
                        ^
usr.bin/tip/tip/tip.c:426:5: note: previous statement is here
                } else if (!cumode && gch == character(value(FORCE)))
                  ^

The intent was to have the EOF check grouped with the getchar() call
just above it.  This was accidentally introduced in r354624.

MFC after: 3 days

4 years agomips: unbreak module builds after r357265
Kyle Evans [Wed, 29 Jan 2020 18:54:21 +0000 (18:54 +0000)]
mips: unbreak module builds after r357265

Touch opt_global.h to make sure it exists...

Pointy hat: kevans

4 years agokmod build: start generating opt_global.h, include it
Kyle Evans [Wed, 29 Jan 2020 18:50:55 +0000 (18:50 +0000)]
kmod build: start generating opt_global.h, include it

For untied module builds, we'll generate opt_foo headers if they're included
in SRCS. However, options that would normally be represented in opt_global.h
aren't properly represented.

Start generating opt_global.h with #define VIMAGE for !mips since it's
almost universally a project default and right now kmods must hack it in
themselves in order to be properly compiled for the default kernel. For
example, ^/sys/modules/pf/Makefile

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

4 years agopkgbase: fix caroot packaging and add post-install script
Kyle Evans [Wed, 29 Jan 2020 18:47:08 +0000 (18:47 +0000)]
pkgbase: fix caroot packaging and add post-install script

The original intention for caroot was to be packaged separately, perhaps so
that users can have a more/less conservative upgrade policy for this
separated from the rest of base.

secure/caroot/Makefile doesn't have anything interesting to package, but its
subdirectories might. Move the PACKAGE= to Makefile.inc so both blacklisted
and trusted get packaged consistently into the correct one rather than the
default -utilities. Also tag the directories for package=caroot, as they
could also be empty; blacklisted is empty by default, but trusted is not.

Add a post-install script to do certctl rehash, along with a note should we
eventually come up with a way to detect that files have been added or
removed that requires a rehash.

-caroot gets a dependency on -utilities, as that's where we provide certctl
at the moment. We can perhaps reconsider this and put certctl into this
package in the future, but there are some bits within -utilities that
unconditionally invoke certctl so let's hold off for now.

Reviewed by: manu (earlier version, before -utilities dep added)
Differential Revision: https://reviews.freebsd.org/D23352

4 years agoPlug parent iface refcount leak on <ifname>.X vlan creation.
Alexander V. Chernikov [Wed, 29 Jan 2020 18:41:35 +0000 (18:41 +0000)]
Plug parent iface refcount leak on <ifname>.X vlan creation.

PR: kern/242270
Submitted by: Andrew Boyer <aboyer at pensando.io>
MFC after: 2 weeks

4 years ago[PPC64] Fix NUMA on POWER8
Leandro Lupori [Wed, 29 Jan 2020 18:13:44 +0000 (18:13 +0000)]
[PPC64] Fix NUMA on POWER8

On some POWER8 machines, 'ibm,associativity' property may have 6
cells, which would overflow the 5 cells buffer being used.
There was also an issue with the "check if node is root" part,
that have been fixed too.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D23414

4 years agoAdd myself (alfredo) to committers-src.dot and calendar.freebsd
Alfredo Dal'Ava Junior [Wed, 29 Jan 2020 17:39:38 +0000 (17:39 +0000)]
Add myself (alfredo) to committers-src.dot and calendar.freebsd

Approved by: jhibbits (mentor)

4 years agoFix the following -Werror warning from clang 10.0.0 in procstat:
Dimitry Andric [Wed, 29 Jan 2020 17:01:02 +0000 (17:01 +0000)]
Fix the following -Werror warning from clang 10.0.0 in procstat:

usr.bin/procstat/procstat_sigs.c:79:3: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                xo_close_container(name);
                ^
usr.bin/procstat/procstat_sigs.c:77:4: note: previous statement is here
        } else
          ^

The intent was to group the xo_close_container() call to the previous
snprintf() call.

MFC after: 3 days

4 years agoRevert upstream lld r371957 (git commit 06bb7dfbd) by Fangrui Song:
Dimitry Andric [Wed, 29 Jan 2020 16:57:55 +0000 (16:57 +0000)]
Revert upstream lld r371957 (git commit 06bb7dfbd) by Fangrui Song:

  [ELF] Map the ELF header at imageBase

  If there is no readonly section, we map:

  * The ELF header at imageBase+maxPageSize
  * Program headers at imageBase+maxPageSize+sizeof(Ehdr)
  * The first section .text at imageBase+maxPageSize+sizeof(Ehdr)+sizeof(program headers)

  Due to the interaction between Writer<ELFT>::fixSectionAlignments and
  LinkerScript::allocateHeaders,
  `alignDown(p_vaddr(R PT_LOAD)) = alignDown(p_vaddr(RX PT_LOAD))`.
  The RX PT_LOAD will override the R PT_LOAD at runtime, which is not ideal:

  ```
  // PHDR at 0x401034, should be 0x400034
    PHDR           0x000034 0x00401034 0x00401034 0x000a0 0x000a0 R   0x4
  // R PT_LOAD contains just Ehdr and program headers.
  // At 0x401000, should be 0x400000
    LOAD           0x000000 0x00401000 0x00401000 0x000d4 0x000d4 R   0x1000
    LOAD           0x0000d4 0x004010d4 0x004010d4 0x00001 0x00001 R E 0x1000
  ```

  * createPhdrs allocates the headers to the R PT_LOAD.
  * fixSectionAlignments assigns `imageBase+maxPageSize+sizeof(Ehdr)+sizeof(program headers)` (formula: `alignTo(dot, maxPageSize) + dot % config->maxPageSize`) to addrExpr of .text
  * allocateHeaders computes the minimum address among SHF_ALLOC sections, i.e. addr(.text)
  * allocateHeaders sets address of ELF header to `addr(.text)-sizeof(Ehdr)-sizeof(program headers) = imageBase+maxPageSize`

  The main observation is that when the SECTIONS command is not used, we
  don't have to call allocateHeaders. This requires an assumption that
  the presence of PT_PHDR and addresses of headers can be decided
  regardless of address information.

  This may seem natural because dot is not manipulated by a linker script.
  The other thing is that we have to drop the special rule for -T<section>
  in `getInitialDot`. If -Ttext is smaller than the image base, the headers
  will not be allocated with the old behavior (allocateHeaders is called)
  but always allocated with the new behavior.

  The behavior change is not a problem. Whether and where headers are
  allocated can vary among linkers, or ld.bfd across different versions
  (--enable-separate-code or not). It is thus advised to use a linker
  script with the PHDRS command to have a consistent behavior across
  linkers. If PT_PHDR is needed, an explicit --image-base can be a simpler
  alternative.

  Differential Revision: https://reviews.llvm.org/D67325

  llvm-svn: 371957

This causes "ld: error: output file too large: 18446744073707016908
bytes" when linking our loader_4th and loader_lua.  Clearly, something
is wrong when using -Ttext 0x0: I will file an upstream bug report for
this.

4 years agoAdd driver for Xilinx XDMA PCIe Bridge found in the U.S. Government
Ruslan Bukin [Wed, 29 Jan 2020 16:52:12 +0000 (16:52 +0000)]
Add driver for Xilinx XDMA PCIe Bridge found in the U.S. Government
Furnished Equipment (GFE) riscv cores.

GFE cores are synthesized on the Xilinx Virtex UltraScale+ FPGA VCU118
Evaluation Kit.

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D23337

4 years agopkgbase: kill off clibs.ucl and docs.ucl
Kyle Evans [Wed, 29 Jan 2020 16:24:16 +0000 (16:24 +0000)]
pkgbase: kill off clibs.ucl and docs.ucl

These are just direct copies of the template. If they don't exist but are
attempted to be used, generate-ucl.sh will simply fallback to the template
anyways. Let it do so to reduce potential maintenance burden.

4 years agocgem: Add another compat string for the SiFive fu540
Mitchell Horne [Wed, 29 Jan 2020 15:58:19 +0000 (15:58 +0000)]
cgem: Add another compat string for the SiFive fu540

Newer device trees use "sifive,fu540-c000-gem" instead of "cdns,macb".

Reviewed by: br, kp
Differential Revision: https://reviews.freebsd.org/D23407

4 years agoFix definition of SSTATUS_SD
Mitchell Horne [Wed, 29 Jan 2020 15:50:48 +0000 (15:50 +0000)]
Fix definition of SSTATUS_SD

The SD bit is defined as the MSB of the sstatus register, meaning its
position will vary depending on the CSR's length. Previously, there were
two (unused) defines for this, for the 32 and 64-bit cases, but their
definitions were swapped.

Consolidate these into one define: SSTATUS_SD, and make the definition
dependent on the value of __riscv_xlen.

Reviewed by: br
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D23402