]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r332631:
asomers [Fri, 3 Aug 2018 14:01:32 +0000 (14:01 +0000)]
MFC r332631:

lio_listio: return EAGAIN instead of EIO when out of resources

This behavior is already documented by the man page, and suggested by POSIX.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D15099

5 years agoMFC r336763:
kib [Fri, 3 Aug 2018 11:36:37 +0000 (11:36 +0000)]
MFC r336763:
Add workarounds for several Ryzen erratas, on amd64.

5 years agoMFC r336922:
markj [Thu, 2 Aug 2018 15:16:59 +0000 (15:16 +0000)]
MFC r336922:
Remove a redundant check.

5 years agoMFC r336641: fix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check
avg [Thu, 2 Aug 2018 09:31:50 +0000 (09:31 +0000)]
MFC r336641: fix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check

5 years agoMFC r335934: remove unneeded inclusion of sys/interrupt.h from several files
avg [Thu, 2 Aug 2018 09:29:39 +0000 (09:29 +0000)]
MFC r335934: remove unneeded inclusion of sys/interrupt.h from several files

5 years agoMFC r337056:
hselasky [Thu, 2 Aug 2018 09:03:08 +0000 (09:03 +0000)]
MFC r337056:
Don't refer to non-existing atomic functions, even though not compiled,
in the LinuxKPI.

Found by: rpokala @
Sponsored by: Mellanox Technologies

5 years agoMFC r336453:
hselasky [Thu, 2 Aug 2018 09:02:19 +0000 (09:02 +0000)]
MFC r336453:
Use unspecified address family when connecting as a client in
libibverbs example utilities.

This allows connecting to both IPv4 and IPv6 and reverts
some FreeBSD only patches.

Sponsored by: Mellanox Technologies

5 years agoMFC r334786: x86: reorganize code that deals with unexpected NMI-s
avg [Thu, 2 Aug 2018 09:00:09 +0000 (09:00 +0000)]
MFC r334786: x86: reorganize code that deals with unexpected NMI-s

5 years agoMFC r334479: call AcpiLeaveSleepStatePrep after re-enabling interrupts
avg [Thu, 2 Aug 2018 08:58:33 +0000 (08:58 +0000)]
MFC r334479: call AcpiLeaveSleepStatePrep after re-enabling interrupts

5 years agoMFC r336452:
hselasky [Thu, 2 Aug 2018 08:57:40 +0000 (08:57 +0000)]
MFC r336452:
Add ability to parse sysfs paths under FreeBSD in libibumad.

Add the ability to to parse sysfs paths to sysctl nodes by replacing '/' with '.'

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r336451:
hselasky [Thu, 2 Aug 2018 08:56:27 +0000 (08:56 +0000)]
MFC r336451:
Update version information for the mlx5 and mlx5en(4) modules.

While at it bump some copyright dates.

Sponsored by: Mellanox Technologies

5 years agoMFC r336450:
hselasky [Thu, 2 Aug 2018 08:55:19 +0000 (08:55 +0000)]
MFC r336450:
Do not inline transmit headers and use HW VLAN tagging if supported by mlx5en(4).

Query the minimal inline mode supported by the card.
When creating a send queue, cache the queried mode and optimize the transmit
if no inlining is required.  In this case, we can avoid touching the headers
cache line and avoid dirtying several more lines by copying headers into
the send WQEs.  Also, if no inline headers are used, hardware assists in
the VLAN tag framing.

Submitted by: kib@, slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r336411:
hselasky [Thu, 2 Aug 2018 08:52:49 +0000 (08:52 +0000)]
MFC r336411:
Use a mbuf header instead of a mbuf cluster for debugging interrupts in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r336410:
hselasky [Thu, 2 Aug 2018 08:51:55 +0000 (08:51 +0000)]
MFC r336410:
Add module parameter to limit number of MSIX EQ vectors in mlx5en(4).

For setups having a large amount of PCI devices, it makes sense to limit the
number of MSIX vectors per PCI device, in order to avoid running out of IRQ
vectors.

Sponsored by: Mellanox Technologies

5 years agoMFC r336407:
hselasky [Thu, 2 Aug 2018 08:49:35 +0000 (08:49 +0000)]
MFC r336407:
Handle jumbo frames without requiring big clusters in mlx5en(4).

The scatter list is formed by the chunks of MCLBYTES each, and larger
than default packets are returned to the stack as the mbuf chain.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r336404:
hselasky [Thu, 2 Aug 2018 08:48:27 +0000 (08:48 +0000)]
MFC r336404:
Enable both receive and transmit pauseframes by default in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r336403:
hselasky [Thu, 2 Aug 2018 08:47:24 +0000 (08:47 +0000)]
MFC r336403:
Add context numbers for HW elements in mlx5en(4).

To access the data, set sysctl dev.mce.N.conf.debug_stats to 1.
This enables the sysctl node dev.mce.N.hw_ctx_debug.  Its content is
the mapping of each channel' number to used receive queue and associated
completion queue, set of the transmit queues numbers and corresponding
completion queues.

Trimmed example output:
channel 30 rq 188 cq 1085
channel 30 tc 0 sq 187 cq 1084
channel 31 rq 191 cq 1087
channel 31 tc 0 sq 190 cq 1086

Sponsored by: Mellanox Technologies

5 years agoMFC r336402:
hselasky [Thu, 2 Aug 2018 08:46:27 +0000 (08:46 +0000)]
MFC r336402:
Do not hint about 'trust both' mode when the mlx5en(4) hardware does not support it.

Sponsored by: Mellanox Technologies

5 years agoMFC r336401:
hselasky [Thu, 2 Aug 2018 08:45:32 +0000 (08:45 +0000)]
MFC r336401:
Correctly write atomic variable in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r336399:
hselasky [Thu, 2 Aug 2018 08:44:40 +0000 (08:44 +0000)]
MFC r336399:
Remove redundant call to mlx5_vsc_find_cap() in mlx5core.

Sponsored by: Mellanox Technologies

5 years agoMFC r336398:
hselasky [Thu, 2 Aug 2018 08:43:54 +0000 (08:43 +0000)]
MFC r336398:
Make sure the state variable is set atomically instead of using a mutex in mlx5core.

Device detach and setting error state may deadlock over the interface mutex
like this:

a) Detach code in mlx5en waits until error state is set while the interface
mutex is locked.
b) The set error handler needs to lock the interface mutex before it can
set the error state.

The solution is to use atomics to set the error state.

Sponsored by: Mellanox Technologies

5 years agoMFC r336397:
hselasky [Thu, 2 Aug 2018 08:42:40 +0000 (08:42 +0000)]
MFC r336397:
Refactor access to CR-space into using VSC APIs in mlx5core.

Remove no longer used files and APIs.

Sponsored by: Mellanox Technologies

5 years agoMFC r336396:
hselasky [Thu, 2 Aug 2018 08:40:46 +0000 (08:40 +0000)]
MFC r336396:
Remove redundant newline character in mlx5core.

Sponsored by: Mellanox Technologies

5 years agoMFC r336395:
hselasky [Thu, 2 Aug 2018 08:39:48 +0000 (08:39 +0000)]
MFC r336395:
Update version information for the mlx5ib module.

Sponsored by: Mellanox Technologies

5 years agoMFC r336394:
hselasky [Thu, 2 Aug 2018 08:38:37 +0000 (08:38 +0000)]
MFC r336394:
Don't pass unsupported events to ibcore from mlx5ib.

Sponsored by: Mellanox Technologies

5 years agoMFC r336393:
hselasky [Thu, 2 Aug 2018 08:37:44 +0000 (08:37 +0000)]
MFC r336393:
Use static device naming instead of dynamic one in mlx5ib.

When resetting mlx5core instances it can happen that the order of attach and
detach for mlx5ib instances is changed. Take the unit number for mlx5_%d from
the parent PCI device, similarly to what is done in mlx5en(4), so that there
is a direct relationship between mce<N> and mlx5_<N>.

Sponsored by: Mellanox Technologies

5 years agoMFC r336392:
hselasky [Thu, 2 Aug 2018 08:36:51 +0000 (08:36 +0000)]
MFC r336392:
Implement support for Differentiated Service Code Point, DSCP, in mlx5en(4).

The DSCP feature is controlled using a set of sysctl(8) fields under
the qos sysctl directory entry for mlx5en(4).

For Routable RoCE QPs, the DSCP should be set in the QP's address path.
The DSCP's value is derived from the traffic class.

Linux commit:
ed88451e1f2d400fd6a743d0a481631cf9f97550

Sponsored by: Mellanox Technologies

5 years agoMFC r336964:
hselasky [Thu, 2 Aug 2018 08:35:32 +0000 (08:35 +0000)]
MFC r336964:
Only NULL check the VNET pointer when VIMAGE is enabled in ibcore.
Else a NULL VNET pointer should be ignored. This fixes address resolving
when VIMAGE is disabled.

Sponsored by: Mellanox Technologies

5 years agoMFC r336391:
hselasky [Thu, 2 Aug 2018 08:33:51 +0000 (08:33 +0000)]
MFC r336391:
Use __FBSDID() for RCS tags in ibcore.

Sponsored by: Mellanox Technologies

5 years agoMFC r336389:
hselasky [Thu, 2 Aug 2018 08:31:34 +0000 (08:31 +0000)]
MFC r336389:
Add support for IPv6 multicast in ibcore.

This change allows us to join IPv6 multicast networks.

Sponsored by: Mellanox Technologies

5 years agoMFC r336388:
hselasky [Thu, 2 Aug 2018 08:30:44 +0000 (08:30 +0000)]
MFC r336388:
Add support for RoCEv2 multicast in ibcore.

When creating address handle from multicast GID, set MAC according to
the appropriate formula instead of searching for it in the GID table:
- For IPv4 multicast GID use ip_eth_mc_map().
- For IPv6 multicast GID use ipv6_eth_mc_map().

Linux commit:
9636a56fa864464896bf7d1272c701f2b9a57737

Sponsored by: Mellanox Technologies

5 years agoMFC r336387:
hselasky [Thu, 2 Aug 2018 08:29:40 +0000 (08:29 +0000)]
MFC r336387:
Honor return status of ib_init_ah_from_mcmember() in ibcore.

The return status of ib_init_ah_from_mcmember() is ignored by
cma_ib_mc_handler().  Honor it and return error event if ah attribute
initialization failed.

Linux commit:
6d337179f28cc50ddd7e224f677b4cda70b275fc

Sponsored by: Mellanox Technologies

5 years agoMFC r336386:
hselasky [Thu, 2 Aug 2018 08:28:49 +0000 (08:28 +0000)]
MFC r336386:
Honor port_num while resolving GID for IB link layer in ibcore.

ah_attr contains the port number to which cm_id is bound. However, while
searching for GID table for matching GID entry, the port number is
ignored.

This could cause the wrong GID to be used when the ah_attr is converted to
an AH.

Linux commit:
563c4ba3bd2b8b0b21c65669ec2226b1cfa1138b

Sponsored by: Mellanox Technologies

5 years agoMFC r336385:
hselasky [Thu, 2 Aug 2018 08:27:49 +0000 (08:27 +0000)]
MFC r336385:
Set IPv4 TOS and IPv6 traffic class field for RoCEv2 traffic in ibcore.

The current implementation assumes a static mapping between
the TOS bits and the priority code point, PCP bits.

Sponsored by: Mellanox Technologies

5 years agoMFC r336384:
hselasky [Thu, 2 Aug 2018 08:26:56 +0000 (08:26 +0000)]
MFC r336384:
Fix for loopback detection in address resolve logic in ibcore.

When a loopback address is detected use the network interface which
has the loopback flag set to trigger loopback logic in address resolve.

Sponsored by: Mellanox Technologies

5 years agoMFC r336383:
hselasky [Thu, 2 Aug 2018 08:25:48 +0000 (08:25 +0000)]
MFC r336383:
Check port number supplied by user verbs cmds in ibcore.

The ib_uverbs_create_ah() ind ib_uverbs_modify_qp() calls receive
the port number from user input as part of its attributes and assumes
it is valid. Down on the stack, that parameter is used to access kernel
data structures.  If the value is invalid, the kernel accesses memory
it should not.  To prevent this, verify the port number before using it.

Linux commit:
5ecce4c9b17bed4dc9cb58bfb10447307569b77b
a62ab66b13a0f9bcb17b7b761f6670941ed5cd62
5a7a88f1b488e4ee49eb3d5b82612d4d9ffdf2c3

Sponsored by: Mellanox Technologies

5 years agoMFC r336382:
hselasky [Thu, 2 Aug 2018 08:24:45 +0000 (08:24 +0000)]
MFC r336382:
Depend on IPv6 stack to resolve link local address for RoCEv2 in ibcore.

RoCEv1 does not use the IPv6 stack to resolve the link local DGID since it
uses GID address. It forms the DMAC directly from the DGID.

Linux commit:
56d0a7d9a0f045ee27a001762deac28c7d28e2e4

Sponsored by: Mellanox Technologies

5 years agoMFC r336381:
hselasky [Thu, 2 Aug 2018 08:23:54 +0000 (08:23 +0000)]
MFC r336381:
Fix kernel crash during fail to initialize device in ibcore.

This patch fixes the kernel crash that occurs during ib_dealloc_device()
called due to provider driver fails with an error after
ib_alloc_device() and before it can register using ib_register_device().

This crashed seen in tha lab as below which can occur with any IB device
which fails to perform its device initialization before invoking
ib_register_device().

This patch avoids touching cache and port immutable structures if device
is not yet initialized.
It also releases related memory when cache and port immutable data
structure initialization fails during register_device() state.

Linux commit:
4be3a4fa51f432ef045546d16f25c68a1ab525b9

Sponsored by: Mellanox Technologies

5 years agoMFC r336380:
hselasky [Thu, 2 Aug 2018 08:22:53 +0000 (08:22 +0000)]
MFC r336380:
Check AF family prior resolving address and introduce safer rdma_addr_size() variants in ibcore.

Garbage supplied by user will cause to UCMA module provide zero
memory size for memcpy(), because it wasn't checked, it will
produce unpredictable results in rdma_resolve_addr().

There are several places in the ucma ABI where userspace can pass in a
sockaddr but set the address family to AF_IB.  When that happens,
rdma_addr_size() will return a size bigger than sizeof struct sockaddr_in6,
and the ucma kernel code might end up copying past the end of a buffer
not sized for a struct sockaddr_ib.

Fix this by introducing new variants
    int rdma_addr_size_in6(struct sockaddr_in6 *addr);
    int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr);

that are type-safe for the types used in the ucma ABI and return 0 if the
size computed is bigger than the size of the type passed in.  We can use
these new variants to check what size userspace has passed in before
copying any addresses.

Linux commit:
2975d5de6428ff6d9317e9948f0968f7d42e5d74
09abfe7b5b2f442a85f4c4d59ecf582ad76088d7
84652aefb347297aa08e91e283adf7b18f77c2d5

Sponsored by: Mellanox Technologies

5 years agoMFC r336379:
hselasky [Thu, 2 Aug 2018 08:21:55 +0000 (08:21 +0000)]
MFC r336379:
Check for a cm_id->device in all user calls that need it in ibcore.

This was done by auditing all callers of ucma_get_ctx and switching the
ones that unconditionally touch ->device to ucma_get_ctx_dev. This covers
a little less than  half of the call sites.

The 11 remaining call sites to ucma_get_ctx() were manually audited.

Linux commit:
4b658d1bbc16605330694bb3ef2570c465ef383d
8b77586bd8fe600d97f922c79f7222c46f37c118

Sponsored by: Mellanox Technologies

5 years agoMFC r336377:
hselasky [Thu, 2 Aug 2018 08:21:04 +0000 (08:21 +0000)]
MFC r336377:
Fix kernel panic while using XRC_TGT QP type in ibcore.

Attempt to modify XRC_TGT QP type from the user space (ibv_xsrq_pingpong
invocation) will trigger the following kernel panic. It is caused by the
fact that such QPs missed uobject initialization.

Linux commit:
f45765872e7aae7b81feb3044aaf9886b21885ef

Sponsored by: Mellanox Technologies

5 years agoMFC r336376:
hselasky [Thu, 2 Aug 2018 08:20:11 +0000 (08:20 +0000)]
MFC r336376:
Fix NULL pointer dereference during device removal in ibcore.

As part of ib_uverbs_remove_one which might be triggered upon
reset flow, we trigger IB_EVENT_DEVICE_FATAL event to userspace
application.
If device was removed after uverbs fd was opened but before
ib_uverbs_get_context was called, the event file will be accessed
before it was allocated, result in NULL pointer dereference:

Linux commit:
870201f95fcbd19538aef630393fe9d583eff82e

Sponsored by: Mellanox Technologies

5 years agoMFC r336375:
hselasky [Thu, 2 Aug 2018 08:19:08 +0000 (08:19 +0000)]
MFC r336375:
Fix access to non-initialized CM_ID object in ibcore.

The attempt to join multicast group without ensuring that CMA device
exists will lead to the following crash reported by syzkaller.

Linux commit:
7688f2c3bbf55e52388e37ac5d63ca471a7712e1

Sponsored by: Mellanox Technologies

5 years agoMFC r336374:
hselasky [Thu, 2 Aug 2018 08:18:11 +0000 (08:18 +0000)]
MFC r336374:
Avoid that ib_drain_qp() triggers an out-of-bounds stack access in ibcore.

Linux commit:
a1ae7d0345edd593d6725d3218434d903a0af95d

Sponsored by: Mellanox Technologies

5 years agoMFC r336373:
hselasky [Thu, 2 Aug 2018 08:17:09 +0000 (08:17 +0000)]
MFC r336373:
Ensure that CM_ID exists prior to access it in ibcore.

Prior to access UCMA commands, the context should be initialized
and connected to CM_ID with ucma_create_id(). In case user skips
this step, he can provide non-valid ctx without CM_ID and cause
to multiple NULL dereferences.

Also there are situations where the create_id can be raced with
other user access, ensure that the context is only shared to
other threads once it is fully initialized to avoid the races.

Linux commit:
e8980d67d6017c8eee8f9c35f782c4bd68e004c9

Sponsored by: Mellanox Technologies

5 years agoMFC r336372:
hselasky [Thu, 2 Aug 2018 08:15:05 +0000 (08:15 +0000)]
MFC r336372:
Add support for prio-tagged traffic for RDMA in ibcore.

When receiving a PCP change all GID entries are reloaded.
This ensures the relevant GID entries use prio tagging,
by setting VLAN present and VLAN ID to zero.

The priority for prio tagged traffic is set using the regular
rdma_set_service_type() function.

Fake the real network device to have a VLAN ID of zero
when prio tagging is enabled. This is logic is hidden inside
the rdma_vlan_dev_vlan_id() function which must always be used
to retrieve the VLAN ID throughout all of ibcore and the
infiniband network drivers.

The VLAN presence information then propagates through all
of ibcore and so incoming connections will have the VLAN
bit set. The incoming VLAN ID is then checked against the
return value of rdma_vlan_dev_vlan_id().

Sponsored by: Mellanox Technologies

5 years agoMFC r336371:
hselasky [Thu, 2 Aug 2018 08:14:00 +0000 (08:14 +0000)]
MFC r336371:
Set default GID type as RoCE when resolving RoCE route in ibcore.

cma_iboe_set_mgid() is updated to reflect the RoCEv2 GID check.

Linux commit:
5c181bda77f409d89ad513528eccac5f3a416474

Sponsored by: Mellanox Technologies

5 years agoMFC r336370:
hselasky [Thu, 2 Aug 2018 08:12:52 +0000 (08:12 +0000)]
MFC r336370:
Set RoCEv2 MGID according to spec in ibcore.

RoCEv2 Annex states that for RoCEv2 over IPv4, the corresponding
IPv4 address is encoded into the GID according to the following rule:
GID= :ffff:<IPv4 address>

Remove the 0xff0e prefix for RoCEv2 packets with IPv4 and leave it
zeroed and change rdma_is_multicast_addr() to consider the new logic.

Linux commit:
be1d325a335840a86c133a56c6a911c368bac0fd
1c3aea2bc8f0b2e5b57375ead40457ff75a3a2ec

Sponsored by: Mellanox Technologies

5 years agoMFC r336369:
hselasky [Thu, 2 Aug 2018 08:12:01 +0000 (08:12 +0000)]
MFC r336369:
For multicast functions in ibcore, verify that LIDs are multicast LIDs.

The Infiniband spec defines "A multicast address is defined by a
MGID and a MLID" (section 10.5).

Add check to verify that the MLID value is in the correct address
range.

RoCE Annex (A16.9.10/11) declares that during attach (detach) QP to a
multicast group, if the QP is associated with a RoCE port, the
multicast group MLID is unused and is ignored.

During attach or detach multicast, when the QP is associated with a
port, it is enough to check the port's link layer and validate the
LID only if it is Infiniband. Otherwise, avoid validating the
multicast LID.

Linux commit:
8561eae60ff9417a50fa1fb2b83ae950dc5c1e21
5236333592244557a19694a51337df6ac018f0a7

Sponsored by: Mellanox Technologies

5 years agoMFC r336368:
hselasky [Thu, 2 Aug 2018 08:10:54 +0000 (08:10 +0000)]
MFC r336368:
Fix for RDMA loopback over VLAN in ibcore.

Implement a more generic solution for detecting loopback.
The problem was that the default netdevice was resolved
for loopback also when VLAN was used. Use real network
device instead of loopback device for bound device
interface.

How to test:
ucmatose -b 127.0.0.1 -p 20090
ucmatose -s 5.6.5.1 -p 20090

Note that RDMA treats the IPv4 and IPv6 loopback
addresses like any address.

Sponsored by: Mellanox Technologies

5 years agoMFC r336367:
hselasky [Thu, 2 Aug 2018 08:10:06 +0000 (08:10 +0000)]
MFC r336367:
Add native FreeBSD support for multicast in ibcore.

This change adds support for registering multicast addresses,
both IPv4 and IPv6.

Sponsored by: Mellanox Technologies

5 years agoMFC r336366:
hselasky [Thu, 2 Aug 2018 08:08:02 +0000 (08:08 +0000)]
MFC r336366:
If the MGID/MLID pair is not on the list return an error in ibcore.

A list of MGID/MLID pairs is built when doing a multicast attach.  When
the multicast detach is called, the list is searched, and regardless of
the search outcome, the driver detach is called.

If an MGID/MLID pair is not on the list, driver detach should not be
called, and an error should be returned.  Calling the driver without
removing an MGID/MLID pair from the list can leave the core and driver
out of sync.

Linux commit:
20c7840a77ddcb2ed2fbd66e8197db2868495751

Sponsored by: Mellanox Technologies

5 years agoMFC r336365:
hselasky [Thu, 2 Aug 2018 08:07:10 +0000 (08:07 +0000)]
MFC r336365:
Add lock to multicast handlers in ibcore.

When two handlers used the same object in the old schema, we blocked
the process in the kernel. The new schema just returns -EBUSY. This
could lead to different behaviour in applications between the old
schema and the new schema. In most cases, using such handlers
concurrently could lead to crashing the process. For example, if
thread A destroys a QP and thread B modifies it, we could have the
destruction happens before the modification. In this case, we are
accessing freed memory which could lead to crashing the process.
This is true for most cases. However, attaching and detaching
a multicast address from QP concurrently is safe. Therefore, we
preserve the original behaviour by adding a lock there.

Linux commit:
f48b726920d96dcd1860df06143bdea7d6d7dcc3

Sponsored by: Mellanox Technologies

5 years agoMFC r336364:
hselasky [Thu, 2 Aug 2018 08:06:17 +0000 (08:06 +0000)]
MFC r336364:
Only update source address when resolving is successful in ibcore.

When resolving an IP address in ibcore, only update the source address
upon normal completion. The ibcore address resolve function does not
care about the scope ID value of the IPv6 link-local addresses and expects
this information has already been extracted into the bound_dev_if field.
Because the same IPv6 link-local address can exist on multiple interfaces
the ibcore address resolver gets confused and returns ENETUNREACH.

Instead of updating both source address and bound_dev_if just keep the
address set to any address until resolving completes. For the sake of code
symmetry a similar change has been applied to the IPv4 address resolve path.

Sponsored by: Mellanox Technologies

5 years agoMFC r336363:
hselasky [Thu, 2 Aug 2018 08:05:20 +0000 (08:05 +0000)]
MFC r336363:
Process address resolve requests at least one time per second in ibcore.

When setting a large address resolve timeout it was observed that the
address resolving would succeed at the timeout and not when the address
was available. Make sure the address resolving requests are processed no
slower than one time every second.

While at it use "int" for jiffies instead of "unsigned long" to match
FreeBSD ticks.

Sponsored by: Mellanox Technologies

5 years agoMFC r335094 and r335123:
hselasky [Thu, 2 Aug 2018 08:04:21 +0000 (08:04 +0000)]
MFC r335094 and r335123:
Revert r335094 and properly fix OFED build after r335053.

Sponsored by: Mellanox Technologies

5 years agoMFC: r336357
rmacklem [Thu, 2 Aug 2018 03:13:59 +0000 (03:13 +0000)]
MFC: r336357
Modify the reasons for not issuing a delegation in the NFSv4.1 server.

The ESXi NFSv4.1 client will generate warning messages when the reason for
not issuing a delegation is two. Two refers to a resource limit and I do
not see why it would be considered invalid. However it probably was not the
best choice of reason for not issuing a delegation.
This patch changes the reasons used to ones that the ESXi client doesn't
complain about. This change does not affect the FreeBSD client and does
not appear to affect behaviour of the Linux NFSv4.1 client.
RFC5661 defines these "reasons" but does not give any guidance w.r.t. which
ones are more appropriate to return to a client.

5 years agoMFC 333416: Report TRAP_BRKPT for breakpoint traps on sparc64.
jhb [Wed, 1 Aug 2018 20:38:01 +0000 (20:38 +0000)]
MFC 333416: Report TRAP_BRKPT for breakpoint traps on sparc64.

5 years agoMFC 332782:
jhb [Wed, 1 Aug 2018 17:40:17 +0000 (17:40 +0000)]
MFC 332782:
Simplify the code to allocate stack for auxv, argv[], and environment vectors.

Remove auxarg_size as it was only used once right after a confusing
assignment in each of the variants of exec_copyout_strings().

5 years agoMFC 330823,332335: Cosmetic cleanups to some Linuxulator files.
jhb [Wed, 1 Aug 2018 00:41:02 +0000 (00:41 +0000)]
MFC 330823,332335: Cosmetic cleanups to some Linuxulator files.

330823:
Apply some style(9) to Linuxulator linux_sysvec.c comments

332335:
linuxulator: add else case braces to reduce diffs between archs

5 years agoMFC: r336215
rmacklem [Tue, 31 Jul 2018 20:57:31 +0000 (20:57 +0000)]
MFC: r336215
Ignore the cookie verifier for NFSv4.1 when the cookie is 0.

RFC5661 states that the cookie verifier should be 0 when the cookie is 0.
However, the wording is somewhat unclear and a recent discussion on the
nfsv4@ietf.org mailing list indicated that the NFSv4 server should ignore
the cookie verifier's value when the dirctory offset cookie is 0.
This patch deletes the check for this that would return NFSERR_BAD_COOKIE
when the verifier was not 0.
This was found during testing of the ESXi client against the NFSv4.1 server.

5 years agoMFC r336662,r336682
rpokala [Tue, 31 Jul 2018 16:08:38 +0000 (16:08 +0000)]
MFC r336662,r336682

r336662: Deprecate jedec_ts(4) and point users to jedec_dimm(4) instead

jedec_dimm(4) is a superset of the functionality of jedec_ts(4). Mark
jedec_ts(4) as removed in FreeBSD 12, and include a pointer to the migration
instructions in the jedec_dimm(4) manpage, in both the jedec_ts(4) code and
the jedec_ts(4) manpage. Add a note to the jedec_dimm(4) manpage about the
fact that it is a superset of jedec_ts(4).

r336682: Update .Dd in light of r336662.

5 years agoMFC r336721, r336750 [1]:
gjb [Tue, 31 Jul 2018 13:32:36 +0000 (13:32 +0000)]
MFC r336721, r336750 [1]:

 r336721 (manu):
  Add OL_DIR forgot in r336600.

 r336750:
  Fix OL_DIR definition following r336721.

[1] These commits were stated to have been merged in
    r336726, however are not present in context nor
    svn:mergeinfo.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r336683:
kib [Tue, 31 Jul 2018 10:18:30 +0000 (10:18 +0000)]
MFC r336683:
Extend ranges of the critical sections to ensure that context switch
code never sees FPU pcb flags not consistent with the hardware state.

5 years agoRevert r335693, r335694, r335695 by eadler.
markj [Tue, 31 Jul 2018 00:37:25 +0000 (00:37 +0000)]
Revert r335693, r335694, r335695 by eadler.

They cause mail(1) to crash in certain scenarios.

PR: 230196
Reported by: Pete French <petefrench@ingresso.co.uk>

5 years agoMFC r335526: Let -s actually work.
kevans [Mon, 30 Jul 2018 21:29:26 +0000 (21:29 +0000)]
MFC r335526: Let -s actually work.

5 years agoMFC r307967,324082,325955: config(8) fixes
kevans [Mon, 30 Jul 2018 21:24:27 +0000 (21:24 +0000)]
MFC r307967,324082,325955: config(8) fixes

r307967: Allow config to be compiled from another source directory, such as
one for building tools. This boils down to replacing ${.CURDIR} with
${SRCDIR}, where the latter is the directory in which this makefile
lives.

Also allow overriding where file2c comes from using ${FILE2C}.

r324082: Typo in filename in comment.

r325955: Fix 'local' to not look in the source tree for the file.

Usually 'local' is used along with other rules such as 'no-implicit-rule' or
'dependency' which avoids this problem.  It's possible to need to use
'local' while relying on the default rules though for a file which is not in
the source tree nor generated in the kernel.

5 years agoAs part of r336741, BOOTFILES needs special handling when
gjb [Mon, 30 Jul 2018 20:59:58 +0000 (20:59 +0000)]
As part of r336741, BOOTFILES needs special handling when
cross building on stable/11, where the path should be:

 /usr/obj/TARGET.TARGET_ARCH/[...]

The change in r336741, which was a direct commit to stable/11
was not complete enough to evaluate where BOOTFILES should be.

This, as was r336741, is a direct commit to stable/11.

Tested with: stable/11 BANANAPI build
Sponsored by: The FreeBSD Foundation

5 years agoMFC: r335866
rmacklem [Mon, 30 Jul 2018 19:23:52 +0000 (19:23 +0000)]
MFC: r335866
Fix the server side krpc so that the kernel nfsd threads terminate.

Occationally the kernel nfsd threads would not terminate when a SIGKILL
was posted for the kernel process (called nfsd (slave)). When this occurred,
the thread associated with the process (called "ismaster") had returned from
svc_run_internal() and was sleeping waiting for the other threads to terminate.
The other threads (created by kthread_start()) were still in svc_run_internal()
handling NFS RPCs.
The only way this could occur is for the "ismaster" thread to return from
svc_run_internal() without having called svc_exit().
There was only one place in the code where this could happen and this patch
stops that from happening.
Since the problem is intermittent, I cannot be sure if this has fixed the
problem, but I have not seen an occurrence of the problem with this patch
applied.

5 years agoMFC r335459: acpidump.8: include NFIT in the man page list of tables
emaste [Mon, 30 Jul 2018 17:49:47 +0000 (17:49 +0000)]
MFC r335459: acpidump.8: include NFIT in the man page list of tables

Was missed in r321298 [MFC'd in r322461].

Reported by: Ben Widawsky (in review D15931)
Sponsored by: The FreeBSD Foundation

5 years agoMFC r334318:
slavash [Mon, 30 Jul 2018 12:51:57 +0000 (12:51 +0000)]
MFC r334318:

Vendor import two upstream commits:
c1bb8784abd3ca978e376b0d10e324db0491237b
9c4af7213cc2543a1f5586d8f2c19f86aa0cbe72

Approved by:    hselasky (mentor), kib (mentor)
Sponsored by:   Mellanox Technologies

5 years agoMFC: r334966
rmacklem [Mon, 30 Jul 2018 12:10:23 +0000 (12:10 +0000)]
MFC: r334966
Add a couple of safety belt checks to the NFSv4.1 client related to sessions.

There were a couple of cases in newnfs_request() that it assumed that it
was an NFSv4.1 mount with a session. This should always be the case when
a Sequence operation is in the reply or the server replies NFSERR_BADSESSION.
However, if a server was broken and sent an erroneous reply, these safety
belt checks should avoid trouble.
The one check required a small tweak to nfsmnt_mdssession() so that it
returns NULL when there is no session instead of the offset of the field
in the structure (0x8 for i386).
This patch should have no effect on normal operation of the client.
Found by inspection during pNFS server development.

5 years agoMFC r336632:
hselasky [Mon, 30 Jul 2018 09:25:56 +0000 (09:25 +0000)]
MFC r336632:
Update modify counter when setting a mixer control.

PR: 229969

5 years agoMFC r335700:
hselasky [Mon, 30 Jul 2018 09:20:17 +0000 (09:20 +0000)]
MFC r335700:
Improve the kernel's USB descriptor reading function.
Some USB devices does not allow a partial descriptor readout.

Found by: bz@
Sponsored by: Mellanox Technologies

5 years agoMFC r335669:
hselasky [Mon, 30 Jul 2018 09:15:09 +0000 (09:15 +0000)]
MFC r335669:
Improve the userspace USB string reading function in LibUSB.
Some USB devices does not allow a partial descriptor readout.

Found by: bz @
Sponsored by: Mellanox Technologies

5 years agoMFC r336664: lld: fix addends with partial linking
emaste [Mon, 30 Jul 2018 00:08:36 +0000 (00:08 +0000)]
MFC r336664: lld: fix addends with partial linking

[ELF] Update addends in non-allocatable sections for REL targets when
creating a relocatable output.

LLVM PR: 37735
LLVM Differential Revision: https://reviews.llvm.org/D48929

PR: 225128, 228753
Obtained from: LLVM r336799 by Igor Kudrin

5 years agoMFC r336614:
markj [Sun, 29 Jul 2018 19:12:06 +0000 (19:12 +0000)]
MFC r336614:
Add a regression test for PR 131876.

PR: 131876

5 years agoMFC r336591:
markj [Sun, 29 Jul 2018 19:11:21 +0000 (19:11 +0000)]
MFC r336591:
Disable optimization of the libproc test program.

5 years agoMFC r335631:
eadler [Sun, 29 Jul 2018 05:14:26 +0000 (05:14 +0000)]
MFC r335631:

Always initialize the ignore local variable.
PR: 229235

5 years agoMFC: r334492
rmacklem [Sat, 28 Jul 2018 20:29:05 +0000 (20:29 +0000)]
MFC: r334492
Add the BindConnectiontoSession operation to the NFSv4.1 server.

Under some fairly unusual circumstances, the Linux NFSv4.1 client is
doing a BindConnectiontoSession operation for TCP connections.
It is also used by the ESXi6.5 NFSv4.1 client.
This patch adds this operation to the NFSv4.1 server.

PR: 226493

5 years agoMFC r335629:
eadler [Sat, 28 Jul 2018 07:37:01 +0000 (07:37 +0000)]
MFC r335629:

vt: add option to ignore NO_VGA flag in ACPI

To workaround buggy firmware that sets this flag when there's actually
a VGA present.

Ref D16003
PR: 229235

5 years agoMFC r308296 (by scottl):
mav [Fri, 27 Jul 2018 18:26:38 +0000 (18:26 +0000)]
MFC r308296 (by scottl):
asc/ascq 44/0 is typically a non-transient, permanent error (at least until
the components are reset).  Therefore retries are pointless.  This is very
visible in SATL systems, for example an LSI SAS controller and a SATA HDD/SSD.

5 years agoMFC r327400 (by eadler):
dim [Fri, 27 Jul 2018 17:39:36 +0000 (17:39 +0000)]
MFC r327400 (by eadler):

cacos(3): correct spelling of 'I'

In some cases we had 'i' instead of 'I'.

PR: 195517
Submitted by: stephen

MFC r329259 (by eadler):

msun: signed overflow in atan2

As a component of atan2(y, x), the case of x == 1.0 is farmed out to
atan(y). The current implementation of this comparison is vulnerable
to signed integer underflow (that is, undefined behavior), and it's
performed in a somewhat more complicated way than it need be. Change
it to not be quite so cute, rather directly comparing the high/low
bits of x to the specific IEEE-754 bit pattern that encodes 1.0.

Note that while there are three different e_atan* files in the
relevant directory, only this one needs fixing. e_atan2f.c already
compares against the full bit pattern encoding 1.0f, while
e_atan2l.cuses bitwise-ands/ors/nots and so doesn't require a change.

Closes #130

Submitted by: Jeff Walden (@jswalden github PR #130)
Reviewed by: bde

MFC r334721 (by cem):

clog.3, complex.3: Fix typos and igor style issues

PR: 228783
Reported by: Karsten <freebsd-bugzilla AT kkoenig.net>

MFC r336299 (by mmacy):

msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd

This corresponds to the latest status (hasn't changed in 9+
years) from openbsd of ld80/ld128 powl, and source cpowf, cpow,
cpowl (the complex power functions for float complex, double
complex, and long double complex) which are required for C99
compliance and were missing from FreeBSD. Also required for
some numerical codes using complex numbered Hamiltonians.

Thanks to jhb for tracking down the issue with making
weak_reference compile on powerpc.

When asked to review, bde said "I don't like it" - but
provided no actionable feedback or superior implementations.

Discussed with: jhb
Submitted by: jmd
Differential Revision: https://reviews.freebsd.org/D15919

MFC r336563:

Recommit r336497: Fix powl, cpow, cpowf, and cpowl imports from OpenBSD

This is a follow-up to r336299.

* lib/msun/Makefile:
  . Remove polevll.c

* lib/msun/ld80/e_powl.c:
  . Copy contents of polevll.c to here.  This is the only consumer of
    these functions.  Make functions 'static inline'.
  . Make reducl a 'static inline' function.

* lib/msun/man/exp.3:
  . Remove BUGS section that no longer applies.

* lib/msun/src/math_private.h:
  . Remove prototypes of __p1evll() and __polevll()

* lib/msun/src/s_cpow.c:
* lib/msun/src/s_cpowf.c:
* lib/msun/src/s_cpowl.c
  . Include math_private.h.
  . Use the CMPLX macro from either C99 or math_private.h (depends on
    compiler support) instead of the problematic use of complex I.

Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
PR: 229876

5 years agoMFC r336556:
markj [Fri, 27 Jul 2018 15:49:12 +0000 (15:49 +0000)]
MFC r336556:
Initialize the L3 page's wire count correctly after a L2 entry demotion.

5 years agoMFC r336236: Detect and handle invalid number of FATs.
delphij [Fri, 27 Jul 2018 05:40:03 +0000 (05:40 +0000)]
MFC r336236: Detect and handle invalid number of FATs.

5 years agoMFC r336504, r336507:
markj [Thu, 26 Jul 2018 19:00:30 +0000 (19:00 +0000)]
MFC r336504, r336507:
Provide the full module path to preload_delete_name().

5 years agoFollowing r336726, explicitly invoke the 'obj' target when
gjb [Thu, 26 Jul 2018 16:08:34 +0000 (16:08 +0000)]
Following r336726, explicitly invoke the 'obj' target when
setting BOOTFILES.  On stable/11, without this change, the
.OBJDIR expands to /usr/src/stand instead /usr/obj/<foo>.

This is a piece of duct tape for now until I figure out why
the correct directory is not being located.

This is a direct commit to stable/11.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r336598-r336600, r336721
manu [Wed, 25 Jul 2018 21:52:49 +0000 (21:52 +0000)]
MFC r336598-r336600, r336721

r336598:
release: Uniform release arm image size

Create a 50m fat16 for all boards.

Reviewed by: gjb
Differential Revision: https://reviews.freebsd.org/D16238

r336599:
release: Add arm_install_boot to install the commit boot bits

This reduce the per-board arm_install_uboot to just install u-boot.
While here remove the installation of rpi.dtb and rpi2.dtb as we load
them from the UFS partition via ubldr.

Reviewed by: gjb, imp (older version)
Differential Revision: https://reviews.freebsd.org/D16239

r336600:
release: Add rpi firmware dtb and mmc overlays for RPI-B and RPI2

This is needed with new u-boot that uses the rpi-firmware dtbs.

Reviewed by: gjb
Differential Revision: https://reviews.freebsd.org/D16240

r336721:
release: Add OL_DIR forgot in r336600

Reviewed by: gjb
Differential Revision: https://reviews.freebsd.org/D16439

Approved by: gjb (for insta-mfc of r336721)

5 years agoMFC r336460:
markj [Wed, 25 Jul 2018 15:40:27 +0000 (15:40 +0000)]
MFC r336460:
Port r324665 and r325285 to arm64.

5 years agoMFC r336188:
araujo [Wed, 25 Jul 2018 04:33:56 +0000 (04:33 +0000)]
MFC r336188:

Improve bhyve exit(3) error code.

The bhyve(8) exit status indicates how the VM was terminated:

0 rebooted
1 powered off
2 halted
3 triple fault

The problem is when we have wrappers around bhyve that parses the exit
error code and gets an exit(1) for an error but interprets it as "powered off".
So to mitigate this issue and makes it less error prone for third part
applications, I have added a new exit code 4 that is "exited due to an error".

For now the bhyve(8) exit status are:
0 rebooted
1 powered off
2 halted
3 triple fault
4 exited due to an error

Reviewed by: @jhb
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D16161

5 years agocxgbe/iw_cxgbe: Do not call soaccept twice on the same socket.
np [Tue, 24 Jul 2018 13:13:30 +0000 (13:13 +0000)]
cxgbe/iw_cxgbe: Do not call soaccept twice on the same socket.

This is a direct commit to stable/11.

Reported by: Sai Tallamraju @ Netapp
Sponsored by: Chelsio Communications

5 years agoMFC r336156:
delphij [Tue, 24 Jul 2018 05:09:50 +0000 (05:09 +0000)]
MFC r336156:

Use endian.h le32dec() instead of rolling our own.

Suggested by: phk
Reviewed by: imp, pfg
Differential Revision: https://reviews.freebsd.org/D16192

5 years agoMFC r336457:
dab [Mon, 23 Jul 2018 18:35:58 +0000 (18:35 +0000)]
MFC r336457:

Make the definition of struct kevent in event.h match what the man page for kevent(2) says.

This is a trivial comment-only fix. The man page for kevent(2) gives
the definition of struct kevent, including a comment on each
field. The actual definition in sys/event.h omitted the comments on
some fields. Add the comments in. Not only does this make the man page
and include file agree, but the comments are useful in and of
themselves.

Sponsored by: Dell EMC

5 years agoMFC: 336426
dexuan [Mon, 23 Jul 2018 17:35:20 +0000 (17:35 +0000)]
MFC: 336426

    r336426
        hyperv/hn: Fix panic in hypervisor code upon device detach event

        Submitted by:       hselasky
        Reviewed by:        dexuan
        Differential Revision:      https://reviews.freebsd.org/D16139

5 years agoMFC r336498:
kib [Sun, 22 Jul 2018 21:39:27 +0000 (21:39 +0000)]
MFC r336498:
When reporting an error, print the errno value.

5 years agoMFC r336273:
kp [Sat, 21 Jul 2018 07:50:46 +0000 (07:50 +0000)]
MFC r336273:

pf: Fix panic on vnet jail shutdown with synproxy

When shutting down a vnet jail pf_shutdown() clears the remaining states, which
through pf_clear_states() calls pf_unlink_state().
For synproxy states pf_unlink_state() will send a TCP RST, which eventually
tries to schedule the pf swi in pf_send(). This means we can't remove the
software interrupt until after pf_shutdown().

5 years agoMFC r336275:
kp [Sat, 21 Jul 2018 07:00:21 +0000 (07:00 +0000)]
MFC r336275:

pf: Fix synproxy

Synproxy was accidentally broken by r335569. The 'return (action)' must be
executed for every non-PF_PASS result, but the error packet (TCP RST or ICMP
error) should only be sent if the packet was dropped (i.e. PF_DROP) and the
return flag is set.

PR: 229477
Submitted by: Andre Albsmeier <mail AT fbsd.e4m.org>

5 years agoMFC r336417:
markj [Fri, 20 Jul 2018 15:31:51 +0000 (15:31 +0000)]
MFC r336417:
Add a FALLTHROUGH comment to kvprintf().

5 years agoMFC r335784, r335971:
markj [Thu, 19 Jul 2018 22:53:23 +0000 (22:53 +0000)]
MFC r335784, r335971:
Invalidate the mapping before updating its physical address.

5 years agoMFC r336225:
markj [Thu, 19 Jul 2018 22:45:49 +0000 (22:45 +0000)]
MFC r336225:
Add PCI IDs for AMD X370 AHCI and XHCI.