]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r343617, r343618:
Konstantin Belousov [Fri, 15 Feb 2019 09:49:09 +0000 (09:49 +0000)]
MFC r343617, r343618:
Make iflib a loadable module.

5 years agoMFC r343905:
Hans Petter Selasky [Fri, 15 Feb 2019 09:20:10 +0000 (09:20 +0000)]
MFC r343905:
Improve Bluetooth device discovery support for Android and Microsoft devices.

Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
project at github.com.

PR: 210089
Sponsored by: Mellanox Technologies

5 years agoMerge r343895:
Gleb Smirnoff [Fri, 15 Feb 2019 00:29:44 +0000 (00:29 +0000)]
Merge r343895:
  Allow some nesting of ng_iface(4) interfaces and add a configuration knob.

PR: 235500

5 years agoMFC r343530:
Alan Somers [Thu, 14 Feb 2019 20:33:35 +0000 (20:33 +0000)]
MFC r343530:

ifconfig: fix endianness bug displaying pfsync interfaces

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D19005

5 years agoMFC r300938, r342154
Alan Somers [Thu, 14 Feb 2019 20:31:05 +0000 (20:31 +0000)]
MFC r300938, r342154

r300938 by ngie:
Remove the sa(8) tests if MK_ACCT == no when "make delete-old" is run

sa(8) is conditionally installed based on MK_ACCT != no today

Sponsored by: EMC / Isilon Storage Division

r342154:
OptionalObsoleteFiles: Fix deleting usr/tests/usr.sbin/sa

It's a directory, not a file.

Reported by: ngie
X-MFC-With: 300938

5 years agoMFC r342153, r342172-r342173
Alan Somers [Thu, 14 Feb 2019 20:29:33 +0000 (20:29 +0000)]
MFC r342153, r342172-r342173

r342153:
Conditionally install /etc/rc.d/audit* based on ${MK_AUDIT}

/usr/sbin/audit(dist)?d are only installed if ${MK_AUDIT} == yes. Their
supporting scripts should only be installed in those instances as well.

Submitted by: ngie
Reviewed by: emaste
Pull Request: https://github.com/freebsd/freebsd/pull/242

r342172:
audit(4) tests: require /etc/rc.d/auditd

These tests should be skipped if /etc/rc.d/auditd is missing, which could be
the case if world was built with WITHOUT_AUDIT set.  Also, one test case
requires /etc/rc.d/accounting.

Submitted by: ngie
Pull Request: https://github.com/freebsd/freebsd/pull/240

r342173:
Conditionalize installtion audit(4) tests on MK_AUDIT

MK_AUDIT already controls auditd(8), praudit(1), etc.  It should also control
the audit test suite.

Submitted by: ngie
Pull Request: https://github.com/freebsd/freebsd/pull/240

5 years agoMFC r341390, r341392, r341667
Alan Somers [Thu, 14 Feb 2019 20:26:59 +0000 (20:26 +0000)]
MFC r341390, r341392, r341667

r341390:
Remove some dead code from the geli tests

This is detritus in the Makefile, leftover from 327662.

r341392:
Unbreak geli/gmirror testcases if their geom classes cannot be loaded

The problem with the logic prior to this commit was twofold:

1. The wrong set of idioms (TAP-compatible) were being applied to the ATF
   testcases when run, resulting in confusing ATF failure results on setup.
2. The cleanup subroutines were broken when the geom classes could not be
   loaded as they exited with 0 unexpectedly.

This commit changes the test code to source the class-specific configuration
(conf.sh) once globally, instead of sourcing it per testcase and per cleanup
subroutine, and to call the ATF-specific setup subroutine(s) inline in
the testcases.

The refactoring done is effectively a no-op for the TAP testcases, modulo
any refactoring done to create common code between the ATF and TAP
testcases.

This unbreaks the geli testcases converted to ATF in r327662 and r327683,
and the gmirror testcases added in r327780, respectively, when the geom
class could not be loaded.

tests/sys/geom/class/mirror/...
    While here, ignore errors when turning debug failpoint sysctl off, which
    could occur if the gmirror class was not loaded.

Submitted by: ngie
Pull Request: https://github.com/freebsd/freebsd/pull/241

r341667:
geom tests: Fix cleanup of ATF tests since r341392

r341392 changed common test cleanup routines in a way that allowed them to
be used by TAP tests as well as ATF tests.  However, a late change made
during code review resulted in cleanup being broken for ATF tests, which
source geom_subr.sh separately during the body and cleanup phases of the
test.  The result was that md(4) devices wouldn't get cleaned up.

X-MFC-With: 341392

5 years agoMFC r341598:
Alan Somers [Thu, 14 Feb 2019 20:24:33 +0000 (20:24 +0000)]
MFC r341598:

stat(2): clarify which syscalls modify file timestamps

The list of syscalls that modify st_atim, st_mtim, and st_ctim was quite out
of date and probably not accurate to begin with.  Update it, and make it
clear that the list is open-ended.

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

5 years agoMFC r340988:
Alan Somers [Thu, 14 Feb 2019 18:01:06 +0000 (18:01 +0000)]
MFC r340988:

vfs_aio.c: rename "physio" symbols to "bio".

aio has two paths: an asynchronous "physio" path and a synchronous path.
Confusingly, physio(9) isn't actually used by the "physio" path, and never
has been.  In fact, it may even be called by the synchronous path!  Rename
the "physio" path to the "bio" path to reflect what it actually does:
directly compose BIOs and send them to character devices.

5 years agoMFC r343850:
Konstantin Belousov [Thu, 14 Feb 2019 14:50:47 +0000 (14:50 +0000)]
MFC r343850:
contigmalloc: handle M_EXEC.

5 years agoMFC r343868:
Andriy Voskoboinyk [Thu, 14 Feb 2019 09:48:13 +0000 (09:48 +0000)]
MFC r343868:
Correct ypldap(8) install path in OptionalObsoleteFiles.inc

It's installed to /usr/sbin, not to /usr/bin.

While here, add missing manpages and /var/yp directory to the list.

5 years agoMFC r343930:
Guangyuan Yang [Thu, 14 Feb 2019 09:12:19 +0000 (09:12 +0000)]
MFC r343930:

Remove -R option which was added to sysctl(8) man page per r244106, but it is not implemented.

Submitted by: Alfonso Siciliano <alfix86@gmail.com>
Reviewed by: 0mp, imp
Differential Revision:  https://reviews.freebsd.org/D19012

5 years agoMFC r343591:
Cy Schubert [Thu, 14 Feb 2019 00:52:03 +0000 (00:52 +0000)]
MFC r343591:

Do not obtain an already held read lock. This causes a witness panic when
ipfs is invoked. This is the second of two panics resolving PR 235110.

PR: 235110
Reported by: David.Boyd49@twc.com

5 years agoMFC r339577:
Ben Widawsky [Wed, 13 Feb 2019 19:00:06 +0000 (19:00 +0000)]
MFC r339577:

acpi: Add an interface to obtain DSM information

The Device Specific Method (_DSM) is on optional object that defines
device specific controls. This will be useful for our power management
controller in upcoming patches. More information can be found in ACPI
spec 6.2 section 9.1.1

https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf

This patch had a minor modification changing ENOMEM to AE_NO_MEMORY
after it got review and approval but before committing.

Test Plan: Tested in my s0ix branch

Reviewed by: kib
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D17121

5 years agoMFC r340000:
Ben Widawsky [Wed, 13 Feb 2019 18:55:47 +0000 (18:55 +0000)]
MFC r340000:

linuxkpi: Add GFP flags needed for ttm drivers

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Requested by: bwidawsk
Approved by: emaste (mentor)

5 years agoMFC: r343372
Marius Strobl [Wed, 13 Feb 2019 16:02:52 +0000 (16:02 +0000)]
MFC: r343372

ixl(4): Fix handling data passed with ioctl from NVM update tool

From Krzysztof:

Ensure that the entire data buffer passed from the NVM update tool is copied in
to kernel space and copied back out to user space using copyin() and copyout().

PR: 234104
Submitted by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reported by: Finn <ixbug@riseup.net>
Differential Revision: https://reviews.freebsd.org/D18817

5 years agoMFC: r339459
Marius Strobl [Wed, 13 Feb 2019 15:30:06 +0000 (15:30 +0000)]
MFC: r339459

ixl/iavf(4): Fix GCC 6.4.0 build

Don't define redundant prototypes.

5 years agoMFC: r343622
Marius Strobl [Wed, 13 Feb 2019 15:27:17 +0000 (15:27 +0000)]
MFC: r343622

ix(4),ixv(4): Fix TSO offloads when TXCSUM is disabled

This patch and commit message are based on r340256 created by Jacob Keller:

The iflib stack does not disable TSO automatically when TXCSUM is
disabled, instead assuming that the driver will correctly handle TSOs
even when CSUM_IP is not set.

This results in iflib calling ixgbe_isc_txd_encap with packets which have
CSUM_IP_TSO, but do not have CSUM_IP or CSUM_IP_TCP set. Because of
this, ixgbe_tx_ctx_setup will not setup the IPv4 checksum offloading.

This results in bad TSO packets being sent if a user disables TXCSUM
without disabling TSO.

Fix this by updating the ixgbe_tx_ctx_setup function to check both
CSUM_IP and CSUM_IP_TSO when deciding whether to enable checksums.

Once this is corrected, another issue for TSO packets is revealed. The
driver sets IFLIB_NEED_ZERO_CSUM in order to enable a work around that
causes the ip->sum field to be zero'd. This is necessary for ix
hardware to correctly perform TSOs.

However, if TXCSUM is disabled, then the work around is not enabled, as
CSUM_IP will not be set when the iflib stack checks to see if it should
clear the sum field.

Fix this by adding IFLIB_TSO_INIT_IP to the iflib flags for the ix and
ixv interface files.

Once both of these changes are made, the ix and ixv drivers should
correctly offload TSO packets when TSO offload is enabled, regardless
of whether TXCSUM is enabled or disabled.

Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by: IntelNetworking
Differential Revision: https://reviews.freebsd.org/D18470

5 years agoMFC: r343621
Marius Strobl [Wed, 13 Feb 2019 15:19:31 +0000 (15:19 +0000)]
MFC: r343621

ix(4): Run {mod,msf,mbx,fdir,phy}_task in if_update_admin_status

From Piotr:

This patch introduces adapter->task_requests register responsible for
recording requests for mod_task, msf_task, mbx_task, fdir_task and
phy_task calls. Instead of enqueueing these tasks with
GROUPTASK_ENQUEUE, handlers will be called directly from
ixgbe_if_update_admin_status() while holding ctx lock.

SIOCGIFXMEDIA ioctl() call reads adapter->media list. The list is
deleted and rewritten in ixgbe_handle_msf() task without holding ctx
lock. This change is needed to maintain data coherency when sharing
adapter info via ioctl() calls.

Patch co-authored by Krzysztof Galazka <krzysztof.galazka@intel.com>.

PR: 221317
Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by: sbruno@, IntelNetworking
Differential Revision: https://reviews.freebsd.org/D18468

5 years agoMFC: r343934
Marius Strobl [Wed, 13 Feb 2019 14:39:16 +0000 (14:39 +0000)]
MFC: r343934

- Remove the redundant device disabled hint handling; ever since
  r241119 that's performed globally by device_attach(9).
- As for the EM-class of devices, em(4) supports multiple queues
  and MSI-X respectively only with 82574 devices. However, since
  the conversion to iflib(4), em(4) relies on the interrupt type
  fallback mechanism, i. e. MSI-X -> MSI -> INTx, of iflib(4) to
  figure out the interrupt type to use for the EM-class (as well
  as the IGB-class) of MACs. Moreover, despite the datasheet for
  82583V not mentioning any support of MSI-X, there actually are
  82583V devices out there that report a varying number of MSI-X
  messages as supported. The interrupt type fallback of iflib(4)
  is causing two failure modes depending on the actual number of
  MSI-X messages supported for such instances of 82583V:
  1) With only one MSI-X message supported, none is left for the
     RX/TX queues as that one message gets assigned to the admin
     interrupt. Worse, later on - which will be addressed with a
     separate fix - iflib(4) interprets that one messages as MSI
     or INTx to be set up, but fails to actually do so as it has
     previously called pci_alloc_msix(9). [1, 2]
  2) With more message supported, their distribution is okay but
     then em_if_msix_intr_assign() doesn't work for 82583V, with
     the interface being left in a non-working state, too. [3]
  Thus, let em_if_attach_pre() indicate to iflib(4) to try MSI-X
  with 82574 only, and at most MSI for the remainder of EM-class
  devices.
  While at it, remove "try_second_bar" as it's polarity inverted
  and not actually needed.
- Remove code from em_if_timer() that effectively is a NOP since
  the conversion to iflib(4) ("trigger" is no longer read).
  While at it, let the comment for em_if_timer() reflect reality
  after said conversion.
- Implement an ifdi_watchdog_reset method which only updates the
  em(4) "watchdog_events" counter but doesn't perform any reset,
  so that the em(4) "watchdog_timeouts" SYSCTL (iflib(4) doesn't
  provide a counterpart) reflects reality and these timeouts add
  to IFCOUNTER_OERRORS again after the iflib(4) conversion.
- Remove the "mbuf_defrag_fail" and "tx_dma_fail" SYSCTLS; since
  the iflib(4) conversion, associated counters are disconnected,
  but iflib(4) provides "mbuf_defrag_failed" and "tx_map_failed"
  respectively as equivalents.
- Move the description preceding lem_smartspeed() to the correct
  spot before em_reset() and bring back appropriate comments for
  {igb,em}_initialize_rss_mapping() and lem_smartspeed() lost in
  the iflib(4) conversion.
- Adapt some other function descriptions and INIT_DEBUGOUT() use
  to match reality after the iflib(4) conversion.
- Put the debugging message of em_enable_vectors_82574() (missed
  in r343578) under bootverbose, too.

PR: 219428 [1], 235246 [2], 235147 [3]
Reviewed by: erj (previous version)
Differential Revision: https://reviews.freebsd.org/D19108

5 years agoMFC: r343369
Marius Strobl [Wed, 13 Feb 2019 14:36:24 +0000 (14:36 +0000)]
MFC: r343369

intel iflib drivers: correct initialization of tx_cidx_processed

From Jake:

In r341156 ("Fix first-packet completion", 2018-11-28) a hack to work
around a delta calculation determining how many descriptors were used
was added to ixl_isc_tx_credits_update_dwb.

The same fix was also applied to the em and igb drivers in r340310, and
to ix in r341156.

The hack checked the case where prev and cur were equal, and then added
one. This works, because by the time we do the delta check, we already
know there is at least one packet available, so the delta should be at
least one.

However, it's not a complete fix, and as indicated by the comment is
really a hack to work around the real bug.

The real problem is that the first time that we transmit a packet,
tx_cidx_processed will be set to point to the start of the ring.
Ultimately, the credits_update function expects it to point to the
*last* descriptor that was processed. Since we haven't yet processed any
descriptors, pointing it to 0 results in this incorrect calculation.

Fix the initialization code to have it point to the end of the ring
instead. One way to think about this, is that we are setting the value
to be one prior to the first available descriptor.

Doing so, corrects the delta calculation in all cases. The original fix
only works if the first packet has exactly one descriptor. Otherwise, we
will report 1 less than the correct value.

As part of this fix, also update the MPASS assertions to match the real
expectations. First, ensure that prev is not equal to cur, since this
should never happen. Second, remove the assertion about prev==0 || delta
!= 0. It looks like that originated from when the em driver was
converted to iflib. It seems like it was supposed to ensure that delta
was non-zero. However, because we originally returned 0 delta for the
first calculation, the "prev == 0" was tacked on.

Instead, replace this with a check that delta is greater than zero,
after the correction necessary when the ring pointers wrap around.

This new solution should fix the same bug as r341156 did, but in a more
robust way.

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: shurd@
Differential Revision: https://reviews.freebsd.org/D18545

5 years agoMFC r342945, r342947, r343020
Lars Engels [Wed, 13 Feb 2019 14:32:14 +0000 (14:32 +0000)]
MFC r342945, r342947, r343020

Add `bluetooth-config` script to simplify setting up bluetooth connections to
devices like mice, keyboards, bt-audio, ...

This script currently allows scanning for nearby devices, adds one to
/etc/bluetooth/hosts, adds an entry to hcsecd's conf and if it is a HID, add an
entry to bthidd's configs, as well.

Submitted by:   erdgeist <erdgeist at erdgeist.org>
Approved by:    bapt
MFC after:      2 weeks
Differential Revision:  D3778
Reviewers:      bapt, emax

5 years agoMFC: r343203
Marius Strobl [Wed, 13 Feb 2019 14:27:59 +0000 (14:27 +0000)]
MFC: r343203

ixgbe: this statement may fall through warnings with gcc

The recent gcc versions (7 and 8 at least) can check for switch case
statements for fall through (implicit-fallthrough). When fall through
is intentional, the default method for warning suppression is to place
comment /* FALLTHROUGH */ exactly before next case statement.

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

5 years agoMFC: r342749
Marius Strobl [Wed, 13 Feb 2019 13:09:16 +0000 (13:09 +0000)]
MFC: r342749

mp_ring: avoid items offset difference between iflib and mp_ring
on architectures without 64-bit atomics

Reported by: Augustin Cavalier <waddlesplash@gmail.com>

5 years agoMFC r343871:
Andriy Voskoboinyk [Wed, 13 Feb 2019 09:28:48 +0000 (09:28 +0000)]
MFC r343871:
recoverdisk(1): fclose() file supplied via '-r readlist' parameter when
it's no longer needed

PR: 204952
Reported by: David Binderman <dcb314@hotmail.com>

5 years agoMFC r343579
Vincenzo Maffione [Wed, 13 Feb 2019 09:03:23 +0000 (09:03 +0000)]
MFC r343579

netmap: fix lock order reversal related to kqueue usage

When using poll(), select() or kevent() on netmap file descriptors,
netmap executes the equivalent of NIOCTXSYNC and NIOCRXSYNC commands,
before collecting the events that are ready. In other words, the
poll/kevent callback has side effects. This is done to avoid the
overhead of two system call per iteration (e.g., poll() + ioctl(NIOC*XSYNC)).

When the kqueue subsystem invokes the kqueue(9) f_event callback
(netmap_knrw), it holds the lock of the struct knlist object associated
to the netmap port (the lock is provided at initialization, by calling
knlist_init_mtx).
However, netmap_knrw() may need to wake up another netmap port (or even
the same one), which means that it may need to call knote().
Since knote() needs the lock of the struct knlist object associated to
the to-be-wake-up netmap port, it is possible to have a lock order reversal
problem (AB/BA deadlock).

This change prevents the deadlock by executing the knote() call in a
per-selinfo taskqueue, where it is possible to hold a mutex.

Reviewed by:    aleksandr.fedorov_itglobal.com
Differential Revision:  https://reviews.freebsd.org/D18956

5 years agoMFC r343586: Remove BIO_ORDERED flag from BIO_FLUSH sent by ZFS.
Alexander Motin [Wed, 13 Feb 2019 00:39:03 +0000 (00:39 +0000)]
MFC r343586: Remove BIO_ORDERED flag from BIO_FLUSH sent by ZFS.

In all cases where ZFS sends BIO_FLUSH, it first waits for all related
writes to complete, so its BIO_FLUSH does not care about strict ordering.
Removal of one makes life much easier at least for NVMe driver, which
hardware has no concept of request ordering, relying completely on software.

5 years agoMFC r343582,r343588:Relax BIO_FLUSH ordering in da(4), respecting BIO_ORDERED.
Alexander Motin [Wed, 13 Feb 2019 00:37:16 +0000 (00:37 +0000)]
MFC r343582,r343588:Relax BIO_FLUSH ordering in da(4), respecting BIO_ORDERED.

r212160 tightened this from always using MSG_SIMPLE_Q_TAG to always
MSG_ORDERED_Q_TAG.  Since it also marked all BIO_FLUSH requests with
BIO_ORDERED, this commit changes nothing immediately, but it returns
BIO_FLUSH callers ability to actually specify ordering they really
need, alike to other request types.

5 years agoMFC r343585: Only sort requests of types that have concept of offset.
Alexander Motin [Wed, 13 Feb 2019 00:33:01 +0000 (00:33 +0000)]
MFC r343585: Only sort requests of types that have concept of offset.

Other types, such as BIO_FLUSH or BIO_ZONE, or especially new/unknown ones,
may imply some degree of ordering even if strict ordering is not requested
explicitly.

5 years agoRevert the r343077 MFC after it was reverted in -current.
Warner Losh [Tue, 12 Feb 2019 20:12:41 +0000 (20:12 +0000)]
Revert the r343077 MFC after it was reverted in -current.

Approved by: core@

5 years agoMFC r342946: Remove accessing remote node and domain objects
Ram Kishore Vegesna [Tue, 12 Feb 2019 17:07:15 +0000 (17:07 +0000)]
MFC r342946: Remove accessing remote node and domain objects
while processing cam actions.
  Issue:
    ocs_fc(4) driver panics. It's induced by setting the port_state
  sysctl to offline, then online, then offline, then online, and so
  forth and so on in rapid succession.

  Reason:
    While we set the port_state to online fc discovery will start and OS
  is enumerating the target discs by calling ocs_action(),  then set the
  port state to "offline" which deletes domain/sport/nodes.

    In ocs_action()->XPT_GET_TRAN_SETTINGS we are accessing the remote
  node which can be invalid to get the wwpn, wwnn and port.

  Fix:
    Removed accessing of remote node and domain in some ocs_action() cases.
    Populated the required values from ocs_fcport.
    This removes the dependency of node and domain structures while
  processing XPT_PATH_INQ and XPT_GET_TRAN_SETTINGS.
     We will invalidate the target entries after the device lost
  timeout(30 seconds).

Approved by:ken,mav

5 years agoMFC 343548:
Dmitry Morozovsky [Tue, 12 Feb 2019 13:58:16 +0000 (13:58 +0000)]
MFC 343548:

  Allow dashes as a valid character in UFS labels.

5 years agoMFC r343772, r343867
Vincenzo Maffione [Tue, 12 Feb 2019 09:07:46 +0000 (09:07 +0000)]
MFC r343772, r343867

netmap: refactor logging macros and pipes

Changelist:
    - Replace ND, D and RD macros with nm_prdis, nm_prinf, nm_prerr
      and nm_prlim, to avoid possible naming conflicts.
    - Add netmap_krings_mode_commit() helper function and use that
      to reduce code duplication.
    - Refactor pipes control code to export some functions that
      can be reused by the veth driver (on Linux) and epair(4).
    - Add check to reject API requests with version less than 11.
    - Small code refactoring for the null adapter.

5 years agoMFC r343870:
Andriy Voskoboinyk [Tue, 12 Feb 2019 07:03:37 +0000 (07:03 +0000)]
MFC r343870:
ipcs(1): drop obsolete error checking

This code is unreachable since r77551.

PR: 201728

5 years agoMFC r342904:
Enji Cooper [Tue, 12 Feb 2019 03:12:19 +0000 (03:12 +0000)]
MFC r342904:

route(8): clarify -prefixlen description

Try to reword -prefixlen section to more clearly and accurately describe how
the -prefixlen modifier works.

While here, fix a word that igor considered a typo: aggregatable addresses is a
valid technical term per RFC-2374, however, it was superseded by the term
"aggregator" in RFC-3587.

Approved by: jtl (mentor)
Differential Revision: https://reviews.freebsd.org/D19155

5 years agoMFC r343444:
Enji Cooper [Tue, 12 Feb 2019 02:57:28 +0000 (02:57 +0000)]
MFC r343444:

Document that `sendfile` will return an invalid value for `sbytes` if provided an invalid address

This is meant to clarify the fact that the system call will not fail
with -1/EFAULT, as one might expect, when reading the sendfile(2)
manpage today.

While here, pet the mandoc linter, when dealing with the section that
describes valid values for `flags`.

PR: 232210
Approved by: jtl (mentor)
Differential Revision: https://reviews.freebsd.org/D19151

5 years agoMFC r343562, r343563: Reimplement BIO_ORDERED handling in nvd(4).
Alexander Motin [Tue, 12 Feb 2019 00:53:14 +0000 (00:53 +0000)]
MFC r343562, r343563: Reimplement BIO_ORDERED handling in nvd(4).

This fixes BIO_ORDERED semantics while also improving performance by:
 - sleeping also before BIO_ORDERED bio, as defined, not only after;
 - not queueing BIO_ORDERED bio to taskqueue if no other bios running;
 - waking up sleeping taskqueue explicitly rather then rely on polling.

On Samsung SSD 970 PRO this shows sync write latency, measured with
`diskinfo -wS`, reduction from ~2ms to ~1.1ms by not sleeping without
reason till next HZ tick.

On the same device ZFS pool with 8 ZVOLs synchronously writing 4KB blocks
shows ~950 IOPS instead of ~750 IOPS before.  I suspect ZFS does not need
BIO_ORDERED on BIO_FLUSH at all, but that will be next question.

5 years agoMFC r343919:
Patrick Kelsey [Tue, 12 Feb 2019 00:00:32 +0000 (00:00 +0000)]
MFC r343919:
Fix em(4) interrupt routing

When configured with more tx queues than rx queues,
em_if_msix_intr_assign() was incorrectly routing the tx event
interrupts.

Reviewed by: erj, marius
Differential Revision: https://reviews.freebsd.org/D19070

5 years agoMFC r343535:
Patrick Kelsey [Mon, 11 Feb 2019 23:35:34 +0000 (23:35 +0000)]
MFC r343535:
Speed up non-status operations applied to a single interface

When performing a non-status operation on a single interface, it is
not necessary for ifconfig to build a list of all addresses in the
system, sort them, then iterate through them looking for the entry for
the single interface of interest. Doing so becomes increasingly
expensive as the number of interfaces in the system grows (e.g., in a
system with 1000+ vlan(4) interfaces).

Reviewed by: ae, kp
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18919

5 years agoMFC r343534:
Patrick Kelsey [Mon, 11 Feb 2019 23:33:16 +0000 (23:33 +0000)]
MFC r343534:
Don't re-evaluate ALTQ kernel configuration due to events on non-ALTQ interfaces

Re-evaluating the ALTQ kernel configuration can be expensive,
particularly when there are a large number (hundreds or thousands) of
queues, and is wholly unnecessary in response to events on interfaces
that do not support ALTQ as such interfaces cannot be part of an ALTQ
configuration.

Reviewed by: kp
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18918

5 years agoMFC r343995:
Patrick Kelsey [Mon, 11 Feb 2019 23:30:30 +0000 (23:30 +0000)]
MFC r343995:
Reduce the time it takes the kernel to install a new PF config containing a large number of queues

In general, the time savings come from separating the active and
inactive queues lists into separate interface and non-interface queue
lists, and changing the rule and queue tag management from list-based
to hash-bashed.

In HFSC, a linear scan of the class table during each queue destroy
was also eliminated.

There are now two new tunables to control the hash size used for each
tag set (default for each is 128):

net.pf.queue_tag_hashsize
net.pf.rule_tag_hashsize

Reviewed by: kp
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D19131

MFC r343996:
Place pf_altq_get_nth_active() under the ALTQ ifdef

5 years agoMFC r343291:
Patrick Kelsey [Mon, 11 Feb 2019 23:24:39 +0000 (23:24 +0000)]
MFC r343291:
Convert vmx(4) to being an iflib driver.

Also, expose IFLIB_MAX_RX_SEGS to iflib drivers and add
iflib_dma_alloc_align() to the iflib API.

Performance is generally better with the tunable/sysctl
dev.vmx.<index>.iflib.tx_abdicate=1.

Reviewed by: shurd
Relnotes: yes
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18761

MFC r343301:
Add missing dependency to vmxnet3 Makefile and clean it up a bit otherwise.

MFC r343688:
Fix interrupt index configuration when using MSI interrupts.

When in MSI mode, the device was only being configured with one
interrupt index, but it needs two - one for the actual interrupt and
one to park the tx queue at.

Also clarified comments relating to interrupt index assignment.

Reported by: Yuri Pankov <yuripv@yuripv.net>

5 years agoMFC r343287:
Patrick Kelsey [Mon, 11 Feb 2019 23:13:38 +0000 (23:13 +0000)]
MFC r343287:
Reduce pf.conf parsing cost for configs that define N queues from O(N^2) to O(N)

The number of syscalls made during parsing of any config that
defines tables is also reduced, and incorrect warnings that HFSC
parent queue bandwidths were smaller than the sum of their child
bandwidths have been fixed.

Reviewed by: kp
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18759

MFC r343296:
Remove unused function gsc_destroy()

gsc_destroy() is no longer needed as of r343287.

MFC r344025:
Fix the fix added in r343287 for spurious HFSC bandwidth check errors

The logic added in r343287 to avoid false-positive
sum-of-child-bandwidth check errors for HFSC queues has a bug in it
that causes the upperlimit service curve of an HFSC queue to be pulled
down to its parent's linkshare service curve if it happens to be above
it.

Upon further inspection/reflection, this generic
sum-of-child-bandwidths check does not need to be fixed for HFSC - it
needs to be skipped.  For HFSC, the equivalent check is to ensure the
sum of child linkshare service curves are at or below the parent's
linkshare service curve, and this check is already being performed by
eval_pfqueue_hfsc().

This commit reverts the affected parts of r343287 and adds new logic
to skip the generic sum-of-child-bandwidths check for HFSC.

Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D19124

5 years agoMFC r343520:
Kristof Provost [Mon, 11 Feb 2019 19:08:01 +0000 (19:08 +0000)]
MFC r343520:

pfctl: Point users to net.pf.request_maxcount if large requests are rejected

The kernel will reject very large tables to avoid resource exhaustion
attacks. Some users run into this limit with legitimate table
configurations.

The error message in this case was not very clear:

  pf.conf:1: cannot define table nets: Invalid argument
  pfctl: Syntax error in config file: pf rules not loaded

If a table definition fails we now check the request_maxcount sysctl,
and if we've tried to create more than that point the user at
net.pf.request_maxcount:

  pf.conf:1: cannot define table nets: too many elements.
  Consider increasing net.pf.request_maxcount.
  pfctl: Syntax error in config file: pf rules not loaded

PR: 235076

5 years agoMFC r343921:
Benedict Reuschling [Mon, 11 Feb 2019 17:47:22 +0000 (17:47 +0000)]
MFC r343921:
Add an example to pw.8 about how to add an existing user to a group.

Instead of using pw to modify group membership, users often edit
/etc/group by hand, which is discouraged.  Provide an example of
adding a user to the wheel group, which is a common use case.
I'm using a different user here as in the previous example as that
deleted the user (although the examples don't necessarily have to
be followed in order).

Reviewed by: rgrimes,0mp
Approved by: 0mp
Differential Revision: https://reviews.freebsd.org/D19123

5 years agoMFC r339877-r339879,r343564-r343566,r343580,r343754:
Konstantin Belousov [Mon, 11 Feb 2019 15:02:02 +0000 (15:02 +0000)]
MFC r339877-r339879,r343564-r343566,r343580,r343754:
Untangle jemalloc and mutexes initialization.

The merge includes required warnings cleanup by arichardson, both to
avoid conflicts and to make rtld_malloc.c compilable with the libthr
WARNS settings.

5 years agoMFC r343727: Use switch instead of chained if/else to improve readability.
Alexander Motin [Mon, 11 Feb 2019 14:50:33 +0000 (14:50 +0000)]
MFC r343727: Use switch instead of chained if/else to improve readability.

Submitted by:   Ryan Moeller <ryan@freqlabs.com>
Sponsored by:   iXsystems, Inc.

5 years agoMFC r343728: Check element type before setting LEDs.
Alexander Motin [Mon, 11 Feb 2019 14:48:45 +0000 (14:48 +0000)]
MFC r343728: Check element type before setting LEDs.

With r319610, sesutil started twiddling the bits of every SES device.
Not everything is a disk slot, there are also fan controllers, temperature
sensors, even power supplies, among other things controlled by SES.

Add a type check to make sure we are only operating on device slot and array
device slot elements.  Other type elements will be skipped, but it would be
simple to add additional cases for controlling the ident LEDs of other
element types (which are not necessarily the same bits).

Rather than doing raw bit manipulation of an unstructured byte array using
unnamed numeric constants, leverage existing code abstractions.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Sponsored by: iXsystems, Inc.

5 years agoMFC r343745, r343752: Add missed tunables/sysctls for some new vdev variables.
Alexander Motin [Mon, 11 Feb 2019 14:46:59 +0000 (14:46 +0000)]
MFC r343745, r343752: Add missed tunables/sysctls for some new vdev variables.

While there, make few existing sysctls writeable, since there is no reason
not to.

5 years agoMFC r343560:
Oleksandr Tymoshenko [Mon, 11 Feb 2019 08:55:38 +0000 (08:55 +0000)]
MFC r343560:

calendar(1): Fix Aschermittwoch date for Austrian calendar

PR: 165516
Submitted by: jhs@berklix.com

5 years agoMFC r343209:
Oleksandr Tymoshenko [Mon, 11 Feb 2019 08:52:48 +0000 (08:52 +0000)]
MFC r343209:

[smbfs] Allow semicolon in mounts that support long names

Semicolon is a legal character in long names but not in 8.3 format.
Move it to respective character set.

PR: 140068
Submitted by: tom@uffner.com

5 years agoMFC r343204:
Oleksandr Tymoshenko [Mon, 11 Feb 2019 08:49:56 +0000 (08:49 +0000)]
MFC r343204:

[ifconfig] Print more WPS attributes in verbose "list scan" output

- Move WPS related defines to dedicated file
- Add handlers for more WPS attributes

PR: 217317
Submitted by: J.R. Oldroyd <fbsd@opal.com>

5 years agoMFC r343890:
Konstantin Belousov [Mon, 11 Feb 2019 07:09:02 +0000 (07:09 +0000)]
MFC r343890:
do_execve(): lock vnode when needed.

5 years agoMFC r343815:
Andriy Voskoboinyk [Mon, 11 Feb 2019 00:31:58 +0000 (00:31 +0000)]
MFC r343815:
iwn(4): plug initialization path vs interrupt handler races

There are few places in interrupt handler where the driver
lock is dropped; ensure that device is still running before
processing remaining ring entries.

PR: 192641

5 years agoMFC r342910:
Pedro F. Giffuni [Sun, 10 Feb 2019 23:45:14 +0000 (23:45 +0000)]
MFC r342910:
grep(1) outputs NOT-matched lines with multi-byte characters

PR: 113343

5 years agoMFC r343471:
Mariusz Zaborski [Sun, 10 Feb 2019 22:33:41 +0000 (22:33 +0000)]
MFC r343471:
  libcasper: do not run registered exit functions

  Casper library should not use exit(3) function because before setting it up
  applications may register it. Casper doesn't depend on any registered exit
  function, so it safe to change this.

  Reported by:  jceel
  MFC after:    2 weeks

5 years agoMFC r343470:
Mariusz Zaborski [Sun, 10 Feb 2019 22:31:41 +0000 (22:31 +0000)]
MFC r343470:
  zfs: allow to change cache flush sysctl

  There is no reason for this variable to be tunable.
  This variable is used as a barrier in few places.

  Discussed with:       pjd
  MFC after:    2 weeks
  Sponsored by: Fudo Security

5 years agoMFC r343474:
Andriy Voskoboinyk [Sun, 10 Feb 2019 20:59:35 +0000 (20:59 +0000)]
MFC r343474:
Remove 2GHz channel list copies from wireless drivers.

Wrap ieee80211_add_channel_list_2ghz into another function
which supplies default (1-14) channel list to it and drop
its copies from drivers.

5 years agoMFC r343698, r343700:
Andriy Voskoboinyk [Sun, 10 Feb 2019 20:42:06 +0000 (20:42 +0000)]
MFC r343698, r343700:
ifconfig(8): display management / multicast wlan(4) rates properly

For 11n / 11ac we are still using non-11n rates for management and
multicast traffic by default; check 'MCS rate' bit to determine how
to print them correctly.

PR: 161035

5 years agoMFC r343837:
Andriy Voskoboinyk [Sun, 10 Feb 2019 20:25:15 +0000 (20:25 +0000)]
MFC r343837:
net80211(4): validate supplied roam:rate values from ifconfig(8)

5 years agoMFC r343724:
Konstantin Belousov [Sun, 10 Feb 2019 05:40:28 +0000 (05:40 +0000)]
MFC r343724:
Do not call PHOLD() while owning the allproc_lock sx.

5 years agoMFC r343480,343482: Silence Clang Scan warning about unsafe use of strcpy.
Stefan Eßer [Sat, 9 Feb 2019 14:44:17 +0000 (14:44 +0000)]
MFC r343480,343482: Silence Clang Scan warning about unsafe use of strcpy.

Replace strcpy() by memcpy to the previously allocated range of known size.

5 years agoAdd notes regarding the deprecation and removal of timed and timedc in
Stefan Eßer [Sat, 9 Feb 2019 14:33:43 +0000 (14:33 +0000)]
Add notes regarding the deprecation and removal of timed and timedc in
-CURRENT to binaries and man-pages.

This is a direct commit to -STABLE, since the removal from -CURRENT has
already been done.

5 years agoMFC r343479: Fix potential buffer overflow and undefined behavior.
Stefan Eßer [Sat, 9 Feb 2019 14:21:29 +0000 (14:21 +0000)]
MFC r343479: Fix potential buffer overflow and undefined behavior.

The buffer allocated in read_chat() could be 1 element too short, if the
chatstr parameter passed in is 1 or 3 charachters long (e.g. "a" or "a b").
The allocation of the pointer array does not account for the terminating
NULL pointer in that case.

Overlapping source and destination strings are undefined in strcpy().
Instead of moving a string to the left by one character just increment the
char pointer before it is assigned to the results array.

5 years agoMFC r343408: Silence Clang Scan warnings regarding unsafe use of strcp().
Stefan Eßer [Sat, 9 Feb 2019 14:19:09 +0000 (14:19 +0000)]
MFC r343408: Silence Clang Scan warnings regarding unsafe use of strcp().

While these warnings are false positives, the use of strdup() instead of
malloc() and strcpy() simplifies and clarifies the code.

A bogus assignment to a variable (whose previous value may be required in
a later block) has also been removed.

5 years agoMFC r343339: Silence Clang Scan warning about use of unitialized variable.
Stefan Eßer [Sat, 9 Feb 2019 14:13:49 +0000 (14:13 +0000)]
MFC r343339: Silence Clang Scan warning about use of unitialized variable.

The logic is changed to depend on actual "beep" parameters instead of on a
flag that may be set for invalid parameters.

An embedded literal escape character is replaced by "\e".

5 years agoMFC r343303: Silence a CI warning regarding the use of strcpy().
Stefan Eßer [Sat, 9 Feb 2019 14:07:04 +0000 (14:07 +0000)]
MFC r343303: Silence a CI warning regarding the use of strcpy().

While this is a false positive (a sufficiently large buffer has been
allocated in the line above), the use of strdup() simplifies and clarifies
the code.

5 years agoMFC r342592:
Dimitry Andric [Sat, 9 Feb 2019 12:01:10 +0000 (12:01 +0000)]
MFC r342592:

Pull in r342397 from upstream llvm trunk (by Amara Emerson):

  Revert "Revert r342183 "[DAGCombine] Fix crash when store merging
  created an extract_subvector with invalid index.""

  Fixed the assertion failure.

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

This fixes 'Assertion failed: ((VT.getVectorNumElements() +
N2C->getZExtValue() <= N1.getValueType().getVectorNumElements()) &&
"Extract subvector overflow!"), function getNode' when building the
multimedia/aom port (with AVX2 enabled).

Reported by: jbeich
PR: 234480

5 years agoMFC: r343753
Marius Strobl [Sat, 9 Feb 2019 11:51:59 +0000 (11:51 +0000)]
MFC: r343753

o As illustrated by e. g. figure 7-14 of the Intel 82599 10 GbE
  controller datasheet revision 3.3, in the context of Ethernet
  MACs the control data describing the packet buffers typically
  are named "descriptors". Each of these descriptors references
  one buffer, multiple of which a packet can be composed of.
  By contrast, in comments, messages and the names of structure
  members, iflib(4) refers to DMA resources employed for RX and
  TX buffers (rather than control data) as "desc(riptors)".
  This odd naming convention of iflib(4) made reviewing r343085
  and identifying wrong and missing bus_dmamap_sync(9) calls in
  particular way harder than it already is. This convention may
  also explain why the netmap(4) part of iflib(4) pairs the DMA
  tags for control data with DMA maps of buffers and vice versa
  in calls to bus_dma(9) functions.
  Therefore, change iflib(4) to refer to buf(fers) when buffers
  and not the usual understanding of descriptors is meant. This
  change does not include corrections to the DMA resources used
  in the netmap(4) parts. However, it revises error messages to
  state which kind of allocation/creation failed. Specifically,
  the "Unable to allocate tx_buffer (map) memory" copy & pasted
  inappropriately on several occasions was replaced with proper
  messages.
o Enhance some other error messages to indicate which half - RX
  or TX - they apply to instead of using identical text in both
  cases and generally canonicalize them.
o Correct the descriptions of iflib_{r,t}xsd_alloc() to reflect
  reality; current code doesn't use {r,t}x_buffer structures.
o In iflib_queues_alloc():
  - Remove redundant BUS_DMA_NOWAIT of iflib_dma_alloc() calls,
  - change the M_WAITOK from malloc(9) calls into M_NOWAIT. The
    return values are already checked, deferred DMA allocations
    not being an option at this point, BUS_DMA_NOWAIT has to be
    used anyway and prior malloc(9) calls in this function also
    specify M_NOWAIT.

Reviewed by: shurd
Differential Revision: https://reviews.freebsd.org/D19067

5 years agoMFC: r343288
Marius Strobl [Sat, 9 Feb 2019 11:49:07 +0000 (11:49 +0000)]
MFC: r343288

Fix various resource leaks that can occur in the error paths of
iflib_device_register() and iflib_pseudo_register().

Reviewed by: shurd
Differential Revision: https://reviews.freebsd.org/D18760

5 years agoMFC r342908:
Andrey V. Elsukov [Sat, 9 Feb 2019 11:05:03 +0000 (11:05 +0000)]
MFC r342908:
  Reduce the size of struct ip_fw_args from 240 to 128 bytes on amd64.
  And refactor the code to avoid unneeded initialization to reduce overhead
  of per-packet processing.

  ipfw(4) can be invoked by pfil(9) framework for each packet several times.
  Each call uses on-stack variable of type struct ip_fw_args to keep the
  state of ipfw(4) processing. Currently this variable has 240 bytes size
  on amd64.  Each time ipfw(4) does bzero() on it, and then it initializes
  some fields.

  glebius@ has reported that they at Netflix discovered, that initialization
  of this variable produces significant overhead on packet processing.
  After patching I managed to increase performance of packet processing on
  simple routing with ipfw(4) firewalling to about 11% from 9.8Mpps up to
  11Mpps (Xeon E5-2660 v4@ + Mellanox 100G card).

  Introduced new field flags, it is used to keep track of what fields was
  initialized. Some fields were moved into the anonymous union, to reduce
  the size. They all are mutually exclusive. dummypar field was unused, and
  therefore it is removed.  The hopstore6 field type was changed from
  sockaddr_in6 to a bit smaller struct ip_fw_nh6. And now the size of struct
  ip_fw_args is 128 bytes.

  ipfw_chk() was modified to properly handle ip_fw_args.flags instead of
  rely on checking for NULL pointers.

  Reviewed by: gallatin
  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D18690

MFC r342909:
  Fix the build with INVARIANTS.

MFC r343551:
  Fix the bug introduced in r342908, that causes problems with dynamic
  handling for protocols without ports numbers.

  Since port numbers were uninitialized for protocols like ICMP/ICMPv6,
  ipfw_chk() used some non-zero values to create dynamic states, and due
  this it failed to match replies with created states.

  Reported by: Oliver Hartmann, Boris Lytochkin

5 years agoMFC r343673: Fix integer math overflow in UMA hash_alloc().
Alexander Motin [Sat, 9 Feb 2019 02:09:29 +0000 (02:09 +0000)]
MFC r343673: Fix integer math overflow in UMA hash_alloc().

512GB of ZFS ABD ARC means abd_chunk zone of 128M 4KB items.  To manage
them UMA tries to allocate 2GB hash table, which size does not fit into
the int variable, causing later allocation failure, which makes ARC shrink
back below the 512GB, not letting it to use more RAM.  With this change I
easily reached >700GB ARC size on 768GB RAM machine.

Sponsored by: iXsystems, Inc.

5 years agoMFC r343626:
Mark Johnston [Fri, 8 Feb 2019 16:38:30 +0000 (16:38 +0000)]
MFC r343626:
Prevent some kobj memory allocation failures from panicking the system.

5 years agoMFC r343604:
Andriy Voskoboinyk [Fri, 8 Feb 2019 14:27:25 +0000 (14:27 +0000)]
MFC r343604:
bwn(4): reuse ieee80211_tx_complete function

5 years agoMFC r343603:
Andriy Voskoboinyk [Fri, 8 Feb 2019 13:57:28 +0000 (13:57 +0000)]
MFC r343603:
ipw(4): reuse ieee80211_tx_complete function

This should partially fix 'netstat -b -I wlan0' output

5 years agoMFC r343572:
Hans Petter Selasky [Fri, 8 Feb 2019 10:25:42 +0000 (10:25 +0000)]
MFC r343572:
Add support for Audio Sink and Audio Source profiles to sdpd(8).

This allows user-space programs like virtual_oss(8) to act
as a Bluetooth speaker device.

Sponsored by: Mellanox Technologies

5 years agoMFC r343683:
Andriy Voskoboinyk [Fri, 8 Feb 2019 04:48:12 +0000 (04:48 +0000)]
MFC r343683:
Do not acquire IEEE80211_LOCK twice in cac_timeout(); reuse
locked function instead.

It is externally visible since r257065.

5 years agoMFC r343690:
Andriy Voskoboinyk [Fri, 8 Feb 2019 04:36:30 +0000 (04:36 +0000)]
MFC r343690:
ifconfig(8): interpret VHT rates correctly for 'list roam / txparam' options

They are represented via MCS rate index, not as a 'speed in MBps' * 2.

5 years agoMFC r343417:
Andriy Voskoboinyk [Fri, 8 Feb 2019 04:32:41 +0000 (04:32 +0000)]
MFC r343417:
net80211: reuse TICKS_2_MSEC / MSEC_2_TICKS macros from sys/time.h

Replace in-place implementation with system-wide one; since it
guarantees non-zero result drop all less-than-one checks from
drivers and net80211.

5 years agoMFC r343808:
Konstantin Belousov [Fri, 8 Feb 2019 03:25:38 +0000 (03:25 +0000)]
MFC r343808:
Remove pointless initial value for i386 vm.pmap.pat_works sysctl definition.

5 years agoMFC r343633:
Bryan Drewery [Thu, 7 Feb 2019 22:49:49 +0000 (22:49 +0000)]
MFC r343633:

  Shar files may be seen as binary by grep.

5 years agoMFC r343689
Vincenzo Maffione [Thu, 7 Feb 2019 10:44:03 +0000 (10:44 +0000)]
MFC r343689

netmap: upgrade sync-kloop support

Add SYNC_KLOOP_MODE option, and add support for direct mode, where application
executes the TXSYNC and RXSYNC in the context of the ioeventfd wake up callback.

5 years agoMFC: r343578 (partial)
Marius Strobl [Thu, 7 Feb 2019 10:30:11 +0000 (10:30 +0000)]
MFC: r343578 (partial)

- Stop iflib(4) from leaking MSI messages on detachment by calling
  bus_teardown_intr(9) before pci_release_msi(9).
- Ensure that iflib(4) and associated drivers pass correct RIDs to
  bus_release_resource(9) by obtaining the RIDs via rman_get_rid(9)
  on the corresponding resources instead of using the RIDs initially
  passed to bus_alloc_resource_any(9) as the latter function may
  change those RIDs. Solely em(4) for the ioport resource (but not
  others) and bnxt(4) were using the correct RIDs by caching the ones
  returned by bus_alloc_resource_any(9).
- Change the logic of iflib_msix_init() around to only map the MSI-X
  BAR if MSI-X is actually supported, i. e. pci_msix_count(9) returns
  > 0. Otherwise the "Unable to map MSIX table " message triggers for
  devices that simply don't support MSI-X and the user may think that
  something is wrong while in fact everything works as expected.
- Put some (mostly redundant) debug messages emitted by iflib(4)
  and em(4) during attachment under bootverbose. The non-verbose
  output of em(4) seen during attachment now is close to the one
  prior to the conversion to iflib(4).
- Replace various variants of spelling "MSI-X" (several in messages)
  with "MSI-X" as used in the PCI specifications.
- Remove some trailing whitespace from messages emitted by iflib(4)
  and change them to consistently start with uppercase.
- Remove some obsolete comments about releasing interrupts from
  drivers and correct a few others.

Reviewed by: erj, Jacob Keller, shurd
Differential Revision: https://reviews.freebsd.org/D18980

5 years agoMFC r343748:
Dimitry Andric [Thu, 7 Feb 2019 06:55:26 +0000 (06:55 +0000)]
MFC r343748:

Use NLDT to get number of LDTs on i386

Compiling a GENERIC kernel for i386 with clang 8.0 results in the
following warning:

/usr/src/sys/i386/i386/sys_machdep.c:542:40: error: 'sizeof ((ldt))' will return the size of the pointer, not the array itself [-Werror,-Wsizeof-pointer-div]
        nldt = pldt != NULL ? pldt->ldt_len : nitems(ldt);
                                              ^~~~~~~~~~~
/usr/src/sys/sys/param.h:299:32: note: expanded from macro 'nitems'
#define nitems(x)       (sizeof((x)) / sizeof((x)[0]))
                         ~~~~~~~~~~~ ^

Indeed, 'ldt' is declared as 'union descriptor *', so nitems() is not
the right way to determine the number of LDTs.  Instead, the NLDT define
from sys/x86/include/segments.h should be used.

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

5 years agoMFC r343757:
Konstantin Belousov [Thu, 7 Feb 2019 01:54:34 +0000 (01:54 +0000)]
MFC r343757:
Update CPUID bits definitions and CPU identification based on changes
in SDM rev. 069.

5 years agoMFC r343629:
Konstantin Belousov [Thu, 7 Feb 2019 01:51:52 +0000 (01:51 +0000)]
MFC r343629:
nvdimm: only enumerate present nvdimm devices

5 years agoMFC r343628:
Konstantin Belousov [Thu, 7 Feb 2019 01:49:59 +0000 (01:49 +0000)]
MFC r343628:
nvdimm: enumerate NVDIMM SPA ranges from the root device

5 years agoMFC r343719:
Mark Johnston [Wed, 6 Feb 2019 18:43:30 +0000 (18:43 +0000)]
MFC r343719:
Fix a race in vm_page_dequeue_deferred().

5 years agoMFC r343584:
Hans Petter Selasky [Wed, 6 Feb 2019 18:02:43 +0000 (18:02 +0000)]
MFC r343584:
Export vendor specific USB MIDI device list to PnP info.

Sponsored by: Mellanox Technologies

5 years agoMFC r343549
Vincenzo Maffione [Wed, 6 Feb 2019 09:59:20 +0000 (09:59 +0000)]
MFC r343549

netmap: add notifications on kloop stop

On sync-kloop stop, send a wake-up signal to the kloop, so that
waiting for the timeout is not needed.
Also, improve logging in netmap_freebsd.c.

5 years agoMFC r343346
Vincenzo Maffione [Wed, 6 Feb 2019 09:23:39 +0000 (09:23 +0000)]
MFC r343346

netmap: improvements to the netmap kloop (CSB mode)

Changelist:
    - Add the proper memory barriers in the kloop ring processing
      functions.
    - Fix memory barriers usage in the user helpers (nm_sync_kloop_appl_write,
      nm_sync_kloop_appl_read).
    - Fix nm_kr_txempty() helper to look at rhead rather than rcur. This
      is important since the kloop can read a value of rcur which is ahead
      of the value of rhead (see explanation in nm_sync_kloop_appl_write)
    - Remove obsolete ptnetmap_guest_write_kring_csb() and
      ptnet_guest_read_kring_csb(), and update if_ptnet(4) to use those.
    - Prepare in advance the arguments for netmap_sync_kloop_[tr]x_ring(),
      to make the kloop faster.
    - Provide kernel and user implementation for nm_ldld_barrier() and
      nm_ldst_barrier()

5 years agoMFC r343344
Vincenzo Maffione [Wed, 6 Feb 2019 09:21:44 +0000 (09:21 +0000)]
MFC r343344

netmap: fix knote() argument to match the mutex state

The nm_os_selwakeup function needs to call knote() to wake up kqueue(9)
users. However, this function can be called from different code paths,
with different lock requirements.
This patch fixes the knote() call argument to match the relavant lock state.
Also, comments have been updated to reflect current code.

PR:     https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219846
Reported by:    Aleksandr Fedorov <aleksandr.fedorov@itglobal.com>
Reviewed by:    markj
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D18876

5 years agoMFC r343682:
Andriy Voskoboinyk [Wed, 6 Feb 2019 02:35:56 +0000 (02:35 +0000)]
MFC r343682:
sys/dev/wtap: Check return value from malloc(..., M_NOWAIT) and
drop unneeded cast.

5 years agoMFC r343577:
Andriy Voskoboinyk [Wed, 6 Feb 2019 02:30:14 +0000 (02:30 +0000)]
MFC r343577:
rsu(4): add support for ifconfig(8) 'maxretry' option

5 years agoMFC r343681:
Andriy Voskoboinyk [Wed, 6 Feb 2019 02:18:11 +0000 (02:18 +0000)]
MFC r343681:
run(4): fix allocated memory type for ieee80211_node(4)

PR: 177366

5 years agoMFC r343574:
Andriy Voskoboinyk [Wed, 6 Feb 2019 02:06:00 +0000 (02:06 +0000)]
MFC r343574:
Fix compilation with 'option NDISAPI + device ndis' and
without 'device pccard' in the kernel config file.

PR: 171532
Reported by: Robert Bonomi <bonomi@host128.r-bonomi.com>

5 years agoMFC r343697:
Andriy Voskoboinyk [Wed, 6 Feb 2019 01:53:01 +0000 (01:53 +0000)]
MFC r343697:
net80211(4): fix rate check when 'roaming' ifconfig(8) option is set to 'auto'

Do not try to clear 'basic rate' bit from roamRate; it cannot be here and,
actually, this operation clears 'MCS rate' bit instead, breaking comparison
for 11n / 11ac modes.

5 years agoMFC r343684:
Andriy Voskoboinyk [Wed, 6 Feb 2019 01:47:22 +0000 (01:47 +0000)]
MFC r343684:
Drop unused M_80211_COM malloc(9) type.

It is not used since r287197.

5 years agoMFC r343542:
Andriy Voskoboinyk [Wed, 6 Feb 2019 01:42:26 +0000 (01:42 +0000)]
MFC r343542:
upgt(4): unbreak build with UPGT_DEBUG

5 years agoMFC r343784:
Mark Johnston [Tue, 5 Feb 2019 17:56:22 +0000 (17:56 +0000)]
MFC r343784:
Avoid leaking fp references when truncating SCM_RIGHTS control messages.

Approved by: so
Security: CVE-2019-5596