]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFV r330591: 8984 fix for 6764 breaks ACL inheritance
Andriy Gapon [Wed, 7 Mar 2018 13:49:26 +0000 (13:49 +0000)]
MFV r330591: 8984 fix for 6764 breaks ACL inheritance

illumos/illumos-gate@e9bacc6d1a71ea3f7082038b2868de8c4dd98bdc
https://github.com/illumos/illumos-gate/commit/e9bacc6d1a71ea3f7082038b2868de8c4dd98bdc

https://www.illumos.org/issues/8984
  Consider a directory configured as:
  drwx-ws---+ 2 henson cpp 3 Jan 23 12:35 dropbox/
  user:henson:rwxpdDaARWcC--:f-i----:allow
  owner@:--------------:f-i----:allow
  group@:--------------:f-i----:allow
  everyone@:--------------:f-i----:allow
  owner@:rwxpdDaARWcC--:-di----:allow
  group:cpp:-wx-----------:-------:allow
  owner@:rwxpdDaARWcC--:-------:allow
  A new file created in this directory ends up looking like:
  rw-r--r-+ 1 astudent cpp 0 Jan 23 12:39 testfile
  user:henson:rw-pdDaARWcC--:------I:allow
  owner@:--------------:------I:allow
  group@:--------------:------I:allow
  everyone@:--------------:------I:allow
  owner@:rw-p--aARWcCos:-------:allow
  group@:r-----a-R-c--s:-------:allow
  everyone@:r-----a-R-c--s:-------:allow
  with extraneous group@ and everyone@ entries allowing read access that
  shouldn't exist.
  Per Albert Lee on the zfs mailing list:
  "aclinherit=passthrough/passthrough-x should still
  ignore the requested mode when an inheritable ACE for owner@ group@,
  or everyone@ is present in the parent directory.
  It appears there was an oversight in my fix for
  https://www.illumos.org/issues/6764 which made calling zfs_acl_chmod
  from zfs_acl_inherit unconditional. I think the parent ACL check for
  aclinherit=passthrough needs to be reintroduced in zfs_acl_inherit."
  We have a large number of faculty who use dropbox directories like the example
  to have students submit projects. All of these directories are now allowing

Reviewed by: Sam Zaydel <szaydel@racktopsystems.com>
Reviewed by: Paul B. Henson <henson@acm.org>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Dominik Hassler <hadfl@omniosce.org>

PR: 216886
MFC after: 2 weeks

6 years ago8984 fix for 6764 breaks ACL inheritance
Andriy Gapon [Wed, 7 Mar 2018 13:47:01 +0000 (13:47 +0000)]
8984 fix for 6764 breaks ACL inheritance

illumos/illumos-gate@e9bacc6d1a71ea3f7082038b2868de8c4dd98bdc
https://github.com/illumos/illumos-gate/commit/e9bacc6d1a71ea3f7082038b2868de8c4dd98bdc

https://www.illumos.org/issues/8984
  Consider a directory configured as:
  drwx-ws---+ 2 henson cpp 3 Jan 23 12:35 dropbox/
  user:henson:rwxpdDaARWcC--:f-i----:allow
  owner@:--------------:f-i----:allow
  group@:--------------:f-i----:allow
  everyone@:--------------:f-i----:allow
  owner@:rwxpdDaARWcC--:-di----:allow
  group:cpp:-wx-----------:-------:allow
  owner@:rwxpdDaARWcC--:-------:allow
  A new file created in this directory ends up looking like:
  rw-r--r-+ 1 astudent cpp 0 Jan 23 12:39 testfile
  user:henson:rw-pdDaARWcC--:------I:allow
  owner@:--------------:------I:allow
  group@:--------------:------I:allow
  everyone@:--------------:------I:allow
  owner@:rw-p--aARWcCos:-------:allow
  group@:r-----a-R-c--s:-------:allow
  everyone@:r-----a-R-c--s:-------:allow
  with extraneous group@ and everyone@ entries allowing read access that
  shouldn't exist.
  Per Albert Lee on the zfs mailing list:
  "aclinherit=passthrough/passthrough-x should still
  ignore the requested mode when an inheritable ACE for owner@ group@,
  or everyone@ is present in the parent directory.
  It appears there was an oversight in my fix for
  https://www.illumos.org/issues/6764 which made calling zfs_acl_chmod
  from zfs_acl_inherit unconditional. I think the parent ACL check for
  aclinherit=passthrough needs to be reintroduced in zfs_acl_inherit."
  We have a large number of faculty who use dropbox directories like the example
  to have students submit projects. All of these directories are now allowing

Reviewed by: Sam Zaydel <szaydel@racktopsystems.com>
Reviewed by: Paul B. Henson <henson@acm.org>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Dominik Hassler <hadfl@omniosce.org>

6 years agoMake sure VNET is set when calling sa6_recoverscope() in ibcore.
Hans Petter Selasky [Wed, 7 Mar 2018 13:32:52 +0000 (13:32 +0000)]
Make sure VNET is set when calling sa6_recoverscope() in ibcore.

Else panic will occur when VIMAGE is enabled.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoDefine values instead of using hardcoding.
Hans Petter Selasky [Wed, 7 Mar 2018 13:30:38 +0000 (13:30 +0000)]
Define values instead of using hardcoding.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoRecover IPv6 scope ID for multicast link-local addresses as well as
Hans Petter Selasky [Wed, 7 Mar 2018 13:28:12 +0000 (13:28 +0000)]
Recover IPv6 scope ID for multicast link-local addresses as well as
unicast link-local addresses.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoEmbed the IPv6 scope ID before calling rtalloc1() in ibcore.
Hans Petter Selasky [Wed, 7 Mar 2018 13:25:40 +0000 (13:25 +0000)]
Embed the IPv6 scope ID before calling rtalloc1() in ibcore.
Else rtalloc1() will resolve to the loopback interface.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoCreate macros for the ACPI interrupt cross references. This is considered a
Andrew Turner [Wed, 7 Mar 2018 13:16:03 +0000 (13:16 +0000)]
Create macros for the ACPI interrupt cross references. This is considered a
band aid until a better solution to find the correct interrupt controller
can be found.

While here fix one place in the GICv3 ITS driver where the offset wasn't
correctly applied.

Sponsored by: DARPA, AFRL
Sponsored by: Cavium (Hardware)

6 years agoAdd IB_SPEED_HDR definition in ibcore.
Hans Petter Selasky [Wed, 7 Mar 2018 13:01:00 +0000 (13:01 +0000)]
Add IB_SPEED_HDR definition in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoMake sure the IPv6 scope ID gets properly masked in ibcore.
Hans Petter Selasky [Wed, 7 Mar 2018 12:58:51 +0000 (12:58 +0000)]
Make sure the IPv6 scope ID gets properly masked in ibcore.

When exchanging CM messages the IPv6 scope ID should be ignored
for link local addresses when doing comparisons. Make sure the
scope ID is always set to zero for link local addresses.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoFix for use-after-free when using delayed work structures in ibcore.
Hans Petter Selasky [Wed, 7 Mar 2018 12:56:04 +0000 (12:56 +0000)]
Fix for use-after-free when using delayed work structures in ibcore.

It is not enough to cancel delayed work structures before freeing.
Always cancel delayed work synchronously before freeing!

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd an acpi attachment to the pci_host_generic driver and have the ACPI
Andrew Turner [Wed, 7 Mar 2018 10:47:27 +0000 (10:47 +0000)]
Add an acpi attachment to the pci_host_generic driver and have the ACPI
bus provide it with its needed memory resources.

This allows us to use PCIe on the ThunderX2 and, with a previous version
of the patch, on the SoftIron 3000 with ACPI.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Sponsored by: DARPA, AFRL
Sponsored by: Cavium (Hardware)
Differential Revision: https://reviews.freebsd.org/D8767

6 years agoRestrict the arm64 DMAP region to the 1G blocks where we have at least
Andrew Turner [Wed, 7 Mar 2018 09:58:36 +0000 (09:58 +0000)]
Restrict the arm64 DMAP region to the 1G blocks where we have at least
one physical page. This is in preparation for limiting it further as this
is needed on some hardware, however testing has shown issues with further
restricting the DMAP and ACPI.

Sponsored by: DARPA, AFRL
Sponsored by: Cavium (Hardware)

6 years agopsm.4: remove useless information
Eitan Adler [Wed, 7 Mar 2018 09:40:41 +0000 (09:40 +0000)]
psm.4: remove useless information

Obtained from: DragonflyBSD (f49f67c528ec63f5524da5c11e060a0e67866242)
MFC After: 1 week

6 years agodes_crypt.3: Fix typo.
Eitan Adler [Wed, 7 Mar 2018 09:31:27 +0000 (09:31 +0000)]
des_crypt.3: Fix typo.

Obtained from: DragonflyBSD (a78d083cf561cf325e8f1a151251b8901159e2ce)
MFC After: 3 days

6 years agolualoader: Only loadelf before boot/autoboot if no kernel loaded
Kyle Evans [Wed, 7 Mar 2018 04:11:14 +0000 (04:11 +0000)]
lualoader: Only loadelf before boot/autoboot if no kernel loaded

Back when I "fixed" the loading of kernel/modules to be deferred until
booting, I inadvertently broke the ability to manually load a set of kernels
and modules in case of something bad having happened. lualoader would
instead happily load whatever is specified in loader.conf(5) and go about
the boot, leading to a panic loop as you try to rediscover a way to stop the
panicky efirt module from loading and fail miserably.

Reported by: me, sadly

6 years agog_part_gpt: Fix memory leak in error path
Conrad Meyer [Wed, 7 Mar 2018 01:55:50 +0000 (01:55 +0000)]
g_part_gpt: Fix memory leak in error path

If g_part_gpt_read() encountered a disk with bad primary and secondary
tables, it could leak memory.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agochflags: Add SIGINFO support.
Bryan Drewery [Wed, 7 Mar 2018 01:55:38 +0000 (01:55 +0000)]
chflags: Add SIGINFO support.

This is copied from chmod r311668.

MFC after: 2 weeks

6 years agoBump dwatch(1) internal version from 1.0-beta-91 to 1.0
Devin Teske [Tue, 6 Mar 2018 23:58:53 +0000 (23:58 +0000)]
Bump dwatch(1) internal version from 1.0-beta-91 to 1.0

6 years agoIntroduce dwatch(1) as a tool for making DTrace more useful
Devin Teske [Tue, 6 Mar 2018 23:44:19 +0000 (23:44 +0000)]
Introduce dwatch(1) as a tool for making DTrace more useful

Reviewed by: markj, gnn, bdrewery (earlier version)
Relnotes: yes
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/D10006

6 years ago[ig4] Add support for i2c controllers on Skylake and Kaby Lake
Oleksandr Tymoshenko [Tue, 6 Mar 2018 23:39:43 +0000 (23:39 +0000)]
[ig4] Add support for i2c controllers on Skylake and Kaby Lake

This was tested by Ben on  HP Chromebook 13 G1 with a
Skylake CPU and Sunrise Point-LP I2C controller and by me on
Minnowboard Turbot with Atom E3826 (formerly Bay Trail)

Submitted by: Ben Pye <ben@curlybracket.co.uk>
Reviewed by: gonzo
Obtained from: DragonflyBSD (a4549657 by Imre Vadász)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13654

6 years agoaw_usbphy: Move later to SUPPORTDEV pass
Kyle Evans [Tue, 6 Mar 2018 22:45:45 +0000 (22:45 +0000)]
aw_usbphy: Move later to SUPPORTDEV pass

vbus-supply properties may be specified for each PHY. These properties
reference a regulator that we must turn on/off as we turn the PHY on/off.
However, if the usbphy comes up before the regulator in question (as is the
case with GPIO-controlled regulators), then we will fail to grab a handle to
the regulator and control it as the PHY power state changes.

Fix it by just attaching the usbphy driver later. We don't really need it at
RESOURCE, we just need it to be before DEFAULT when ehci/ohci attach. In
particular, this fixes the USB NIC on a board that we don't yet supported-
without this, it will not power on and if_ure cannot attach.

Tested on: various boards [manu]
Tested on: OrangePi R1 [Rap2 (irc)]
Reported by: Rap2 (irc, "Cannot find USB NIC")

6 years agoAdd example devd.conf(5) entry for notifying init(8) about new USB ttys.
Edward Tomasz Napierala [Tue, 6 Mar 2018 21:05:34 +0000 (21:05 +0000)]
Add example devd.conf(5) entry for notifying init(8) about new USB ttys.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agopsm(4): Initialize variables before use
Conrad Meyer [Tue, 6 Mar 2018 20:31:14 +0000 (20:31 +0000)]
psm(4): Initialize variables before use

dxp/dyp could have been used uninitialized in the subsequent debugging log
invocation.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agoRemove reference to unimplemented fuiword, etc.
Brooks Davis [Tue, 6 Mar 2018 18:28:55 +0000 (18:28 +0000)]
Remove reference to unimplemented fuiword, etc.

We don't support Harvard architectures.

6 years agoFix use of unitialized variables.
Nathan Whitehorn [Tue, 6 Mar 2018 15:52:43 +0000 (15:52 +0000)]
Fix use of unitialized variables.

6 years agoUnbreak amd64 FBT after r330539.
Mark Johnston [Tue, 6 Mar 2018 15:51:59 +0000 (15:51 +0000)]
Unbreak amd64 FBT after r330539.

X-MFC with: r330539

6 years agoUpdate the diskless manpage
Rodrigo Osorio [Tue, 6 Mar 2018 14:31:15 +0000 (14:31 +0000)]
Update the diskless manpage

According with /etc/rc.initdiskless the default mfs allocation
is now 5Mb (10240 x 512 bytes sectors)

Submitted by: rodrigo
Reviewed by: bcr
Approved by: manpages (bcr)
Differential Revision: https://reviews.freebsd.org/D14592

6 years agoamd64: Protect the kernel text, data, and BSS by setting the RW/NX bits
Jonathan T. Looney [Tue, 6 Mar 2018 14:28:37 +0000 (14:28 +0000)]
amd64: Protect the kernel text, data, and BSS by setting the RW/NX bits
correctly for the data contained on each memory page.

There are several components to this change:
 * Add a variable to indicate the start of the R/W portion of the
   initial memory.
 * Stop detecting NX bit support for each AP.  Instead, use the value
   from the BSP and, if supported, activate the feature on the other
   APs just before loading the correct page table.  (Functionally, we
   already assume that the BSP and all APs had the same support or
   lack of support for the NX bit.)
 * Set the RW and NX bits correctly for the kernel text, data, and
   BSS (subject to some caveats below).
 * Ensure DDB can write to memory when necessary (such as to set a
   breakpoint).
 * Ensure GDB can write to memory when necessary (such as to set a
   breakpoint).  For this purpose, add new MD functions gdb_begin_write()
   and gdb_end_write() which the GDB support code can call before and
   after writing to memory.

This change is not comprehensive:
 * It doesn't do anything to protect modules.
 * It doesn't do anything for kernel memory allocated after the kernel
   starts running.
 * In order to avoid excessive memory inefficiency, it may let multiple
   types of data share a 2M page, and assigns the most permissions
   needed for data on that page.

Reviewed by: jhb, kib
Discussed with: emaste
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14282

6 years agoNudge lld to break the kernel read-only and read-write sections into
Jonathan T. Looney [Tue, 6 Mar 2018 14:18:45 +0000 (14:18 +0000)]
Nudge lld to break the kernel read-only and read-write sections into
separate 2M pages.  The binutils default for max-page-size and
common-page-size used to produce this result.  By setting these
values, we can nudge lld to also separate these sections into separate
2M pages.

Reviewed by: jhb, kib
Discussed with: emaste
Sponsored by: Netflix
Differential Revision: D14282

6 years agoAdd mapping for several ethernet types used by Linux to FreeBSD
Andrey V. Elsukov [Tue, 6 Mar 2018 12:58:00 +0000 (12:58 +0000)]
Add mapping for several ethernet types used by Linux to FreeBSD
ethernet types.

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

6 years agoDefine ethernet type 0x88A8 as ETHERTYPE_QINQ.
Andrey V. Elsukov [Tue, 6 Mar 2018 12:01:31 +0000 (12:01 +0000)]
Define ethernet type 0x88A8 as ETHERTYPE_QINQ.

Reviewed by: kp
Obtained from: OpenBSD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14593

6 years agoBuild the ds1672 driver as a module. Add a detach() to unregister the rtc.
Ian Lepore [Tue, 6 Mar 2018 02:30:34 +0000 (02:30 +0000)]
Build the ds1672 driver as a module.  Add a detach() to unregister the rtc.

6 years agoFix a paste-o that broke the build. There is no softc pointer here, just
Ian Lepore [Tue, 6 Mar 2018 02:21:41 +0000 (02:21 +0000)]
Fix a paste-o that broke the build.  There is no softc pointer here, just
use the dev arg.

Reported by: Jonathan Looney <jonlooney@gmail.com>
Pointy hat: ian@

6 years agoUse umtx_copyin_umtx_time32() in __umtx_op_lock_umutex_compat32().
Brooks Davis [Tue, 6 Mar 2018 01:52:04 +0000 (01:52 +0000)]
Use umtx_copyin_umtx_time32() in __umtx_op_lock_umutex_compat32().

Non-NULL timeouts where copied in improperly and could produce failures
due to incompatible data structures.

Reviewed by: kib
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14587

6 years agoMove softfloat symbol map entries to softfloat/Symbol.map.
John Baldwin [Mon, 5 Mar 2018 20:51:23 +0000 (20:51 +0000)]
Move softfloat symbol map entries to softfloat/Symbol.map.

The arm, mips, and riscv MD Symbol.map files listed some (but not all)
of the softfloat symbols that were actually defined in softfloat.c.

While here, also remove entries for __fixuns[sd]fsi which are provided
by libcompiler_rt and not by libc.

Sponsored by: DARPA / AFRL

6 years agoMFV: zstd: FIO_addFInfo: Fully initialize output 'total' struct
Conrad Meyer [Mon, 5 Mar 2018 20:03:45 +0000 (20:03 +0000)]
MFV: zstd: FIO_addFInfo: Fully initialize output 'total' struct

Silence a Coverity warning about 'windowSize' being uninitialized.
(Yes, nothing that calls this routine actually uses the windowSize
value.  Still, appeasing Coverity is pretty harmless in this case.)

Reported by: Coverity
Reviewed by: Yann Collet
Obtained from: zstd 606374269cf3485972c90b993fbb84dc20da032f
Sponsored by: Dell EMC Isilon

6 years agoRegen after r330517.
Brooks Davis [Mon, 5 Mar 2018 17:02:50 +0000 (17:02 +0000)]
Regen after r330517.

6 years agoRemove remenants of 1990s efforts to let us run Net/OpenBSD binaries.
Brooks Davis [Mon, 5 Mar 2018 17:02:16 +0000 (17:02 +0000)]
Remove remenants of 1990s efforts to let us run Net/OpenBSD binaries.

No functional change (comments change in some generated files.)

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

6 years agospray: fix the spelling in an output string
Alan Somers [Mon, 5 Mar 2018 16:13:29 +0000 (16:13 +0000)]
spray: fix the spelling in an output string

MFC after: 3 weeks

6 years agorpc.sprayd: raise WARNS to 6
Alan Somers [Mon, 5 Mar 2018 16:11:07 +0000 (16:11 +0000)]
rpc.sprayd: raise WARNS to 6

MFC after: 3 weeks

6 years agoWe shouldn't need to execute code in the recursive page table mappings;
Jonathan T. Looney [Mon, 5 Mar 2018 15:12:35 +0000 (15:12 +0000)]
We shouldn't need to execute code in the recursive page table mappings;
therefore, it should be safe to set the NX bit on the PML4E for the
recursive page table mappings.  According to the Intel docs, the effect
of the NX bit should propogate to any page reached through a PML4E which
has the NX bit set.

Reviewed by: kib, markj
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14333

6 years agoPrior to r329071, pmap_bootstrap() used pmap_kmem_choose() to round the
Jonathan T. Looney [Mon, 5 Mar 2018 15:10:17 +0000 (15:10 +0000)]
Prior to r329071, pmap_bootstrap() used pmap_kmem_choose() to round the
first available virtual address to a 2MB boundary. After r329071,
create_pagetables() rounds firstaddr up to a 2MB boundary. This ensures
the kernel is mapped in super-pages, which is the point of the logic
in pmap_kmem_choose(). Therefore, it is no longer necessary for
pmap_bootstrap() to round up to the 2MB boundary again.

As pmap_bootstrap() was the only user of pmap_kmem_choose(), we can
delete pmap_kmem_choose().

Reviewed by: kib
MFC after: 2 weeks
X-MFC-with: r329071
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14355

6 years agoOptimize ibcore RoCE address handle creation from user-space.
Hans Petter Selasky [Mon, 5 Mar 2018 14:34:52 +0000 (14:34 +0000)]
Optimize ibcore RoCE address handle creation from user-space.

Creating a UD address handle from user-space or from the kernel-space,
when the link layer is ethernet, requires resolving the remote L3
address into a L2 address. Doing this from the kernel is easy because
the required ARP(IPv4) and ND6(IPv6) address resolving APIs are readily
available. In userspace such an interface does not exist and kernel
help is required.

It should be noted that in an IP-based GID environment, the GID itself
does not contain all the information needed to resolve the destination
IP address. For example information like VLAN ID and SCOPE ID, is not
part of the GID and must be fetched from the GID attributes. Therefore
a source GID should always be referred to as a GID index. Instead of
going through various racy steps to obtain information about the
GID attributes from user-space, this is now all done by the kernel.

This patch optimises the L3 to L2 address resolving using the existing
create address handle uverbs interface, retrieving back the L2 address
as an additional user-space information structure.

This commit combines the following Linux upstream commits:

IB/core: Let create_ah return extended response to user
IB/core: Change ib_resolve_eth_dmac to use it in create AH
IB/mlx5: Make create/destroy_ah available to userspace
IB/mlx5: Use kernel driver to help userspace create ah
IB/mlx5: Report that device has udata response in create_ah

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoGet correct network device when accepting incoming RDMA connections in ibcore.
Hans Petter Selasky [Mon, 5 Mar 2018 14:24:30 +0000 (14:24 +0000)]
Get correct network device when accepting incoming RDMA connections in ibcore.

This patch ensures the GID index is always used as a basis of resolving
incoming RDMA connections, as compared to the GID value itself.

Background:
On a per infiniband port basis, the GID identifier is not a unique identifier!
This assumption falls apart when VLAN ID, IPv6 scope ID and RoCE type,
as supported by RoCE v2, is taken into account. This additional
information is stored in the so-called GID attributes and is needed to
correctly identify the destination network interface for an incoming
connection.

Different VLANs are allowed to define the same IPv4 addresses and especially
for the default IPv6 link-local addresses or when using so-called containers
or jails, this is true.

The VNET information for the destination network interface is needed in
order to perform the L2 address lookup in the right Virtual Network Stack
context.

Consequently old functions previously used by RoCE v1, like
rdma_addr_find_smac_by_sgid() are impossible to support, because
there can be multiple identical GIDs associated with the same
infiniband port, and the answer to such a request becomes undefined.
This function has been removed.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoPass valid if_index to rdma_addr_find_l2_eth_by_grh() in ibcore when possible.
Hans Petter Selasky [Mon, 5 Mar 2018 14:22:36 +0000 (14:22 +0000)]
Pass valid if_index to rdma_addr_find_l2_eth_by_grh() in ibcore when possible.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd support for loopback in ibcore.
Hans Petter Selasky [Mon, 5 Mar 2018 13:57:37 +0000 (13:57 +0000)]
Add support for loopback in ibcore.

Implement the missing pieces in addr_resolve() to support loopback
addresses. IB core will test for the IFF_LOOPBACK flag in the network
interface and treat these devices in a special way.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoMake sure to register the VLAN GIDs using the VLAN network interface
Hans Petter Selasky [Mon, 5 Mar 2018 12:39:34 +0000 (12:39 +0000)]
Make sure to register the VLAN GIDs using the VLAN network interface
and not the parent one in ibcore. Else looking up the VLAN GIDs will
fail for VLAN IPs.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoNeed to check for IPv6 linklocal address inside rdma_resolve_addr() in ibcore.
Hans Petter Selasky [Mon, 5 Mar 2018 12:04:34 +0000 (12:04 +0000)]
Need to check for IPv6 linklocal address inside rdma_resolve_addr() in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoMap type of service, TOS, to IB or VLAN service level 1:1 in ibcore.
Hans Petter Selasky [Mon, 5 Mar 2018 11:59:54 +0000 (11:59 +0000)]
Map type of service, TOS, to IB or VLAN service level 1:1 in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoSelect RoCEv2 by default in ibcore.
Hans Petter Selasky [Mon, 5 Mar 2018 11:58:37 +0000 (11:58 +0000)]
Select RoCEv2 by default in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoMake deletion of RoCE GID entries synchronous in ibcore.
Hans Petter Selasky [Mon, 5 Mar 2018 11:57:26 +0000 (11:57 +0000)]
Make deletion of RoCE GID entries synchronous in ibcore.

When a network device is departing, the RoCE GID entries should be
cleared before the default L2 link layer address is freed. Else a NULL
pointer access may happen.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd support for IPv6 link local GIDs equal to the default GID for
Hans Petter Selasky [Mon, 5 Mar 2018 11:55:29 +0000 (11:55 +0000)]
Add support for IPv6 link local GIDs equal to the default GID for
VLANs in ibcore.

IPv6 link local addresses are usually derived from the netdev MAC
address. This is applicable to VLAN devices and its lower netdevice as
well. In such cases the IPv6 link local address is a duplicate of the
default GID.

Now that link local IPv6 addresses based GIDs are supported, allow
adding such GID entries in the GID table.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoDo not add RoCEv2 default GID in ibcore when IPv6 is disabled to honor the
Hans Petter Selasky [Mon, 5 Mar 2018 11:52:39 +0000 (11:52 +0000)]
Do not add RoCEv2 default GID in ibcore when IPv6 is disabled to honor the
networking stack's IPv6 disabled setting. Else the offload HCA can start using
IPv6 packets for QPs.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd missing FreeBSD tags and SVN properties to ibcore.
Hans Petter Selasky [Mon, 5 Mar 2018 11:49:45 +0000 (11:49 +0000)]
Add missing FreeBSD tags and SVN properties to ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoRegister each GICv3 ITS driver with a useful cross reference. We currently
Andrew Turner [Mon, 5 Mar 2018 10:11:30 +0000 (10:11 +0000)]
Register each GICv3 ITS driver with a useful cross reference. We currently
only use the first driver, however this may change in the future and
hardware exists with multiple ITS devices.

Sponsored by: DARPA, AFRL
Sponsored by: Cavium (Hardware)

6 years agoIn the ACPI GICv3 attach function call device_get_children to get the list
Andrew Turner [Mon, 5 Mar 2018 10:09:18 +0000 (10:09 +0000)]
In the ACPI GICv3 attach function call device_get_children to get the list
of children. We expect this to be populated when configuring the secondary
cores.

Sponsored by: DARPA, AFRL
Sponsored by: Cavium (Hardware)

6 years ago- Remove extra NULL check before free().
Hiroki Sato [Mon, 5 Mar 2018 03:38:31 +0000 (03:38 +0000)]
- Remove extra NULL check before free().
- Fix null pointer dereference in netbuffree() and use netbuffree()
  where applicable.

6 years agoPartially back out changes in r327464. stdlib.h is used when
Hiroki Sato [Mon, 5 Mar 2018 03:34:01 +0000 (03:34 +0000)]
Partially back out changes in r327464.  stdlib.h is used when
RPCBIND_DEBUG is enabled.

6 years agoSwitch imx_gpio to attach at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE.
Ian Lepore [Mon, 5 Mar 2018 02:32:23 +0000 (02:32 +0000)]
Switch imx_gpio to attach at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE.
Pretty much any other device might need to manipulate a gpio pin during its
probe or attach routines, so these devices must be available as early as
possible.

The gpio device is an interrupt controller, but I didn't choose the
INTERRUPT pass for that reason (it works fine as an interrupt controller as
long as it attaches any time before interrupts are enabled).  That just
looked like the right place in the passes to ensure that it attaches before
any type of device that might need gpio pin manipulations.

6 years agoMove the new AMD-Vi IVHD [ACPI_IVRS_HARDWARE_NEW]definitions added in r329360 in...
Anish Gupta [Mon, 5 Mar 2018 02:28:25 +0000 (02:28 +0000)]
Move the new AMD-Vi IVHD [ACPI_IVRS_HARDWARE_NEW]definitions added in r329360 in contrib ACPI to local files till ACPI code adds new definitions reported by jkim.
Rename ACPI_IVRS_HARDWARE_NEW to ACPI_IVRS_HARDWARE_EFRSUP, since new definitions add Extended Feature Register support.  Use IvrsType to distinguish three types of IVHD - 0x10(legacy), 0x11 and 0x40(with EFR). IVHD 0x40 is also called mixed type since it supports HID device entries.
Fix 2 coverity bugs reported by cem.

Reported by:jkim, cem
Approved by:grehan
Differential Revision://reviews.freebsd.org/D14501

6 years agoDefer attaching the spibus until timers and interrupts are working. The
Ian Lepore [Mon, 5 Mar 2018 02:13:28 +0000 (02:13 +0000)]
Defer attaching the spibus until timers and interrupts are working.  The
driver requires interrupts to do transfers, and the drivers for the SPI
devices on the bus quite reasonably expect to be able to do IO while probing
and attaching.

6 years agoDo not stop the loop that configures gpio chipselect pins on the first
Ian Lepore [Mon, 5 Mar 2018 02:08:33 +0000 (02:08 +0000)]
Do not stop the loop that configures gpio chipselect pins on the first
error, just ignore pins that don't configure and keep setting up the ones
that do.  (But when bootverbose is on, whine about the errors.)

6 years agochflags: Add -x option to not traverse mount points.
Bryan Drewery [Mon, 5 Mar 2018 01:56:07 +0000 (01:56 +0000)]
chflags: Add -x option to not traverse mount points.

MFC after: 2 weeks

6 years agolualoader: Use FILESDIR instead of BINDIR
Kyle Evans [Mon, 5 Mar 2018 01:18:32 +0000 (01:18 +0000)]
lualoader: Use FILESDIR instead of BINDIR

Minor nit: We're not installing binaries, we're installing scripts/files
that are documented to be installed based on FILESDIR.

6 years agolualoader: Add note about importance of including the cli module early
Kyle Evans [Mon, 5 Mar 2018 00:59:55 +0000 (00:59 +0000)]
lualoader: Add note about importance of including the cli module early

6 years agoSwitch to the new bcd_clocktime conversion routines, and add calls to the
Ian Lepore [Mon, 5 Mar 2018 00:43:53 +0000 (00:43 +0000)]
Switch to the new bcd_clocktime conversion routines, and add calls to the
new clock_dbgprint_xxx() functions.

6 years agolockmgr: save on sleepq when cmpset fails
Mateusz Guzik [Mon, 5 Mar 2018 00:30:07 +0000 (00:30 +0000)]
lockmgr: save on sleepq when cmpset fails

6 years agoSwitch to the new bcd_clocktime conversion routines, and add calls to the
Ian Lepore [Mon, 5 Mar 2018 00:15:56 +0000 (00:15 +0000)]
Switch to the new bcd_clocktime conversion routines, and add calls to the
new clock_dbgprint_xxx() functions.

6 years agoSwitch to the new bcd_clocktime conversion routines, and add calls to the
Ian Lepore [Sun, 4 Mar 2018 23:39:40 +0000 (23:39 +0000)]
Switch to the new bcd_clocktime conversion routines, and add calls to the
new clock_dbgprint_xxx() functions.

6 years agolockmgr: whack unused lockmgr_note_exclusive_upgrade
Mateusz Guzik [Sun, 4 Mar 2018 22:14:20 +0000 (22:14 +0000)]
lockmgr: whack unused lockmgr_note_exclusive_upgrade

6 years agomtx: tidy up recursion handling in thread lock
Mateusz Guzik [Sun, 4 Mar 2018 22:01:23 +0000 (22:01 +0000)]
mtx: tidy up recursion handling in thread lock

Normally after grabbing the lock it has to be verified we got the right one
to begin with. However, if we are recursing, it must not change thus the
check can be avoided. In particular this avoids a lock read for non-recursing
case which found out the lock was changed.

While here avoid an irq trip of this happens.

Tested by: pho (previous version)

6 years agoThe year is stored in a single byte in sram, in binary format, as a count
Ian Lepore [Sun, 4 Mar 2018 21:58:32 +0000 (21:58 +0000)]
The year is stored in a single byte in sram, in binary format, as a count
of years since the century, so strip the century out when converting to or
from bcd_clocktime format (the conversion routines will infer century by
pivoting on 70).

6 years agosx: don't do an atomic op in upgrade if it cananot succeed
Mateusz Guzik [Sun, 4 Mar 2018 21:41:05 +0000 (21:41 +0000)]
sx: don't do an atomic op in upgrade if it cananot succeed

The code already pays the cost of reading the lock to obtain the waiters
flag. Checking whether there is more than one reader is not a problem and
avoids dirtying the line.

This also fixes a small corner case: if waiters were to show up between
reading the flag and upgrading the lock, the operation would fail even
though it should not. No correctness change here though.

6 years agolocks: fix a corner case in r327399
Mateusz Guzik [Sun, 4 Mar 2018 21:38:30 +0000 (21:38 +0000)]
locks: fix a corner case in r327399

If there were exactly rowner_retries/asx_retries (by default: 10) transitions
between read and write state and the waiters still did not get the lock, the
next owner -> reader transition would result in the code correctly falling
back to turnstile/sleepq where it would incorrectly think it was waiting
for a writer and decide to leave turnstile/sleepq to loop back. From this
point it would take ts/sq trips until the lock gets released.

The bug sometimes manifested itself in stalls during -j 128 package builds.

Refactor the code to fix the bug, while here remove some of the gratituous
differences between rw and sx locks.

6 years agoRemove redundant test from r330410.
Konstantin Belousov [Sun, 4 Mar 2018 21:15:31 +0000 (21:15 +0000)]
Remove redundant test from r330410.

If the input slist is non-empty, counter cannot be zero after freeing.

Noted by: mjg
MFC after: 2 weeks

6 years agoBuild iicbus/rtc8583 as a module.
Ian Lepore [Sun, 4 Mar 2018 21:06:21 +0000 (21:06 +0000)]
Build iicbus/rtc8583 as a module.

6 years agoConvert to the new(ish) bcd_clocktime conversion functions, add calls to
Ian Lepore [Sun, 4 Mar 2018 21:04:30 +0000 (21:04 +0000)]
Convert to the new(ish) bcd_clocktime conversion functions, add calls to
the new debug output functions, and when setting the clock, propagate the
timespec nsecs to the 1/100ths register.

6 years agoUnify bulk free operations in several pmaps.
Konstantin Belousov [Sun, 4 Mar 2018 20:53:20 +0000 (20:53 +0000)]
Unify bulk free operations in several pmaps.

Submitted by: Yoshihiro Ota
Reviewed by: markj
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D13485

6 years agoRefer to SysV IPC permissions as numeric constants.
Brooks Davis [Sun, 4 Mar 2018 20:06:02 +0000 (20:06 +0000)]
Refer to SysV IPC permissions as numeric constants.

POSIX defines no macros for these permissions.

Also remove unneeded headers from synopsis.

PR: 225905
Reviewed by: wblock
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14461

6 years agoProperly wrap the BUILD_BUG() function macro in the LinuxKPI.
Hans Petter Selasky [Sun, 4 Mar 2018 19:42:50 +0000 (19:42 +0000)]
Properly wrap the BUILD_BUG() function macro in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd calls to the new clock_dbgprint_xxx() functions. Also, stop applying
Ian Lepore [Sun, 4 Mar 2018 19:32:52 +0000 (19:32 +0000)]
Add calls to the new clock_dbgprint_xxx() functions.  Also, stop applying
a local .5 second adjustment to the time, since that is now done by the
code in subr_rtc.c.

6 years agoAdd calls to the new clock_dbgprint_xxx() functions.
Ian Lepore [Sun, 4 Mar 2018 19:26:47 +0000 (19:26 +0000)]
Add calls to the new clock_dbgprint_xxx() functions.

6 years agoOops, fix a paste-o.
Ian Lepore [Sun, 4 Mar 2018 19:25:54 +0000 (19:25 +0000)]
Oops, fix a paste-o.

6 years agoAdd calls to the new clock_dbgprint_xxx() functions.
Ian Lepore [Sun, 4 Mar 2018 19:23:48 +0000 (19:23 +0000)]
Add calls to the new clock_dbgprint_xxx() functions.

6 years agoAdd calls to the new clock_dbgprint_xxx() functions.
Ian Lepore [Sun, 4 Mar 2018 19:20:11 +0000 (19:20 +0000)]
Add calls to the new clock_dbgprint_xxx() functions.

6 years agolockmgr: start decomposing the main routine
Mateusz Guzik [Sun, 4 Mar 2018 19:12:54 +0000 (19:12 +0000)]
lockmgr: start decomposing the main routine

The main routine takes 8 args, 3 of which are almost the same for most uses.
This in particular pushes it above the limit of 6 arguments passable through
registers on amd64 making it impossible to tail call.

This is a prerequisite for further cleanups.

Tested by: pho

6 years agoStub kernel_param_lock() and kernel_param_unlock() in the LinuxKPI.
Hans Petter Selasky [Sun, 4 Mar 2018 19:10:30 +0000 (19:10 +0000)]
Stub kernel_param_lock() and kernel_param_unlock() in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement wait_event_lock_irq() macro function in the LinuxKPI.
Hans Petter Selasky [Sun, 4 Mar 2018 19:07:10 +0000 (19:07 +0000)]
Implement wait_event_lock_irq() macro function in the LinuxKPI.

MFC after: 1 week
Requested by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoFix a paste-o: use the IICBUS version constants, not IICBB bitbang driver's.
Ian Lepore [Sun, 4 Mar 2018 18:58:24 +0000 (18:58 +0000)]
Fix a paste-o: use the IICBUS version constants, not IICBB bitbang driver's.

6 years agoKeep the old SLAB_DESTROY_BY_RCU macro definition around in the LinuxKPI
Hans Petter Selasky [Sun, 4 Mar 2018 18:53:41 +0000 (18:53 +0000)]
Keep the old SLAB_DESTROY_BY_RCU macro definition around in the LinuxKPI
to avoid compilation breakage in external kernel modules.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoImplement DEFINE_WAIT_FUNC() function macro and default_wake_function()
Hans Petter Selasky [Sun, 4 Mar 2018 18:51:43 +0000 (18:51 +0000)]
Implement DEFINE_WAIT_FUNC() function macro and default_wake_function()
in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement pr_err_ratelimited() function macro in the LinuxKPI.
Hans Petter Selasky [Sun, 4 Mar 2018 18:27:50 +0000 (18:27 +0000)]
Implement pr_err_ratelimited() function macro in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement __MODULE_STRING() function macro in the LinuxKPI.
Hans Petter Selasky [Sun, 4 Mar 2018 18:21:21 +0000 (18:21 +0000)]
Implement __MODULE_STRING() function macro in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement BUILD_BUG() function macro in the LinuxKPI.
Hans Petter Selasky [Sun, 4 Mar 2018 18:19:44 +0000 (18:19 +0000)]
Implement BUILD_BUG() function macro in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement writel_relaxed() in the LinuxKPI.
Hans Petter Selasky [Sun, 4 Mar 2018 18:17:54 +0000 (18:17 +0000)]
Implement writel_relaxed() in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoDefine noinline and __maybe_unused macros in the LinuxKPI.
Hans Petter Selasky [Sun, 4 Mar 2018 18:13:31 +0000 (18:13 +0000)]
Define noinline and __maybe_unused macros in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement for_each_clear_bit() function macro in the LinuxKPI.
Hans Petter Selasky [Sun, 4 Mar 2018 18:10:18 +0000 (18:10 +0000)]
Implement for_each_clear_bit() function macro in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement GENMASK_ULL() function macro in the LinuxKPI.
Hans Petter Selasky [Sun, 4 Mar 2018 18:08:21 +0000 (18:08 +0000)]
Implement GENMASK_ULL() function macro in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoRename the SLAB_DESTROY_BY_RCU flag into SLAB_TYPESAFE_BY_RCU in the LinuxKPI
Hans Petter Selasky [Sun, 4 Mar 2018 18:04:37 +0000 (18:04 +0000)]
Rename the SLAB_DESTROY_BY_RCU flag into SLAB_TYPESAFE_BY_RCU in the LinuxKPI
to be compatible with Linux.

MFC after: 1 week
Requested by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoopen.3: Use .Fa where appropriate
Eitan Adler [Sun, 4 Mar 2018 18:00:32 +0000 (18:00 +0000)]
open.3: Use .Fa where appropriate

Obtained From: DragonFlyBSD (78732326a796ca521f3c0fe33c6fc9c695742ede)