]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMerge ^/head r343712 through r343806.
dim [Tue, 5 Feb 2019 19:50:46 +0000 (19:50 +0000)]
Merge ^/head r343712 through r343806.

5 years agoMerge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
dim [Tue, 5 Feb 2019 19:48:24 +0000 (19:48 +0000)]
Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r353167, resolve conflicts, and bump version numbers.

5 years agoUse NLDT to get number of LDTs on i386
dim [Mon, 4 Feb 2019 17:53:29 +0000 (17:53 +0000)]
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
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D19074

5 years agoMerge ^/head r343571 through r343711.
dim [Sun, 3 Feb 2019 11:41:43 +0000 (11:41 +0000)]
Merge ^/head r343571 through r343711.

5 years agoTeach pfil_ioctl() about VIMAGE.
glebius [Sun, 3 Feb 2019 08:28:02 +0000 (08:28 +0000)]
Teach pfil_ioctl() about VIMAGE.

Submitted by: gallatin

5 years agoReduce log spam from rpc.statd
dfr [Sun, 3 Feb 2019 08:15:26 +0000 (08:15 +0000)]
Reduce log spam from rpc.statd

This only reports failed attempts to contact hosts on the first attempt.

5 years agonew_kmem_alloc(9) is a Solaris/illumos malloc(9). FreeBSD and NetBSD
cy [Sun, 3 Feb 2019 05:26:10 +0000 (05:26 +0000)]
new_kmem_alloc(9) is a Solaris/illumos malloc(9). FreeBSD and NetBSD
never get here, however a test for SOLARIS, as redundant as this test is,
serves to document that this is the illumos definition. This should help
those who come after me to follow the code more easily.

MFC after: 1 month

5 years agoKernel module shim sources have no business being in the userland
cy [Sun, 3 Feb 2019 05:26:07 +0000 (05:26 +0000)]
Kernel module shim sources have no business being in the userland
build directory, especially those for other operating systems.
The kernel module shims for other operating systems are hereby removed.
The kernel module shim for FreeBSD, mlfk_ipl.c, is already in
sys/contrib/ipfilter/netinet. The one here is never used and should
not be in the userland build directory either.

mlfk_rule.c isn't used either however we will keep it in case someone
wishes to use this shim to load rules via a kernel module, handy for
embedded. In that case it should be copied to
sys/contrib/ipfilter/netinet and a Makefile created to employ it.
(Probably a useful documentation project when time permits.)

MFC after: 1 month

5 years agoRemove a reference to HP-UX in a comment.
cy [Sun, 3 Feb 2019 05:26:04 +0000 (05:26 +0000)]
Remove a reference to HP-UX in a comment.

MFC after: 1 month

5 years agoRemove a redundant ip_compat.h, originally merged from upstream.
cy [Sun, 3 Feb 2019 05:26:01 +0000 (05:26 +0000)]
Remove a redundant ip_compat.h, originally merged from upstream.

MFC after: 1 month

5 years agoipfilter #ifdef cleanup.
cy [Sun, 3 Feb 2019 05:25:49 +0000 (05:25 +0000)]
ipfilter #ifdef cleanup.

Remove #ifdefs for ancient and irrelevant operating systems from
ipfilter.

When ipfilter was written the UNIX and UNIX-like systems in use
were diverse and plentiful. IRIX, Tru64 (OSF/1) don't exist any
more. OpenBSD removed ipfilter shortly after the first time the
ipfilter license terms changed in the early 2000's. ipfilter on AIX,
HP/UX, and Linux never really caught on. Removal of code for operating
systems that ipfilter will never run on again will simplify the code
making it easier to fix bugs, complete partially implemented features,
and extend ipfilter.

Unsupported previous version FreeBSD code and some older NetBSD code
has also been removed.

What remains is supported FreeBSD, NetBSD, and illumos. FreeBSD and
NetBSD have collaborated exchanging patches, while illumos has expressed
willingness to have their ipfilter updated to 5.1.2, provided their
zone-specific updates to their ipfilter are merged (which are of interest
to FreeBSD to allow control of ipfilters in jails from the global zone).

Reviewed by: glebius@
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19006

5 years agoifconfig(8): actually, non-11n rates should be divided by 2...
avos [Sun, 3 Feb 2019 04:41:00 +0000 (04:41 +0000)]
ifconfig(8): actually, non-11n rates should be divided by 2...

MFC after: 1 week
MFC with: 343698

5 years agonet80211(4): do not setup Tx parameters for unsupported modes.
avos [Sun, 3 Feb 2019 04:31:50 +0000 (04:31 +0000)]
net80211(4): do not setup Tx parameters for unsupported modes.

That should shorten 'ifconfig <wlan> list txparam' output since
unsupported modes will not be shown.

Checked with RTL8188EE, STA mode.

MFC after: 2 weeks

5 years agoifconfig(8): display management / multicast wlan(4) rates properly
avos [Sun, 3 Feb 2019 03:02:59 +0000 (03:02 +0000)]
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
MFC after: 1 week

5 years agonet80211(4): fix rate check when 'roaming' ifconfig(8) option is set to 'auto'
avos [Sun, 3 Feb 2019 02:32:13 +0000 (02:32 +0000)]
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.

Tested with RTL8188CUS, HOSTAP mode + RTL8821AU, STA mode.

MFC after: 3 days

5 years agonet80211(4): do not setup roaming parameters for unsupported modes.
avos [Sun, 3 Feb 2019 01:32:02 +0000 (01:32 +0000)]
net80211(4): do not setup roaming parameters for unsupported modes.

ifconfig(8) prints per-mode parameters if they are non-zero; since
we have 13 possible modes with 3...5 typically supported this change
should greatly reduce amount of information for 'ifconfig <wlan> list roam'
command.

While here ensure that sta_roam_check() will not use roaming parameters
for unsupported modes (it should not).

This change effectively reverts r188776.

MFC after: 2 weeks

5 years agoifconfig(8): interpret VHT rates correctly for 'list roam / txparam' options
avos [Sun, 3 Feb 2019 00:18:29 +0000 (00:18 +0000)]
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.

MFC after: 5 days

5 years agonetmap: upgrade sync-kloop support
vmaffione [Sat, 2 Feb 2019 22:39:29 +0000 (22:39 +0000)]
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.

MFC after: 5 days

5 years agoFix interrupt index configuratoin when using MSI interrupts.
pkelsey [Sat, 2 Feb 2019 21:14:53 +0000 (21:14 +0000)]
Fix interrupt index configuratoin 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>
MFC after: 1 day

5 years agoDrop unused M_80211_COM malloc(9) type.
avos [Sat, 2 Feb 2019 16:23:45 +0000 (16:23 +0000)]
Drop unused M_80211_COM malloc(9) type.

It is not used since r287197.

MFC after: 3 days

5 years agoDo not acquire IEEE80211_LOCK twice in cac_timeout(); reuse
avos [Sat, 2 Feb 2019 16:21:23 +0000 (16:21 +0000)]
Do not acquire IEEE80211_LOCK twice in cac_timeout(); reuse
locked function instead.

It is externally visible since r257065.

MFC after: 5 days

5 years agosys/dev/wtap: Check return value from malloc(..., M_NOWAIT) and
avos [Sat, 2 Feb 2019 16:15:46 +0000 (16:15 +0000)]
sys/dev/wtap: Check return value from malloc(..., M_NOWAIT) and
drop unneeded cast.

MFC after: 3 days

5 years agorun(4): fix allocated memory type for ieee80211_node(4).
avos [Sat, 2 Feb 2019 16:07:56 +0000 (16:07 +0000)]
run(4): fix allocated memory type for ieee80211_node(4).

PR: 177366
MFC after: 3 days

5 years agorun(4): revert previous commit; there were no compiler warning
avos [Sat, 2 Feb 2019 16:06:06 +0000 (16:06 +0000)]
run(4): revert previous commit; there were no compiler warning
(at least, from clang(1)).

5 years agorun(4): fix allocated memory type and -Wincompatible-pointer-types
avos [Sat, 2 Feb 2019 16:01:16 +0000 (16:01 +0000)]
run(4): fix allocated memory type and -Wincompatible-pointer-types
compiler warning.

PR: 177366
MFC after: 3 days

5 years agoReturn PFIL_CONSUMED if packet was consumed. While here gather all
glebius [Sat, 2 Feb 2019 05:49:05 +0000 (05:49 +0000)]
Return PFIL_CONSUMED if packet was consumed.  While here gather all
the identical endings of pf_check_*() into single function.

PR: 235411

5 years agopowerpc/powernv: Add a driver for the POWER9 XIVE interrupt controller
jhibbits [Sat, 2 Feb 2019 04:15:16 +0000 (04:15 +0000)]
powerpc/powernv: Add a driver for the POWER9 XIVE interrupt controller

The XIVE (External Interrupt Virtualization Engine) is a new interrupt
controller present in IBM's POWER9 processor.  It's a very powerful,
very complex device using queues and shared memory to improve interrupt
dispatch performance in a virtualized environment.

This yields a ~10% performance improvment over the XICS emulation mode,
measured in both buildworld, and 'dd' from nvme to /dev/null.

Currently, this only supports native access.

MFC after: 1 month

5 years agoFix integer math overflow in UMA hash_alloc().
mav [Sat, 2 Feb 2019 04:11:59 +0000 (04:11 +0000)]
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.

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

5 years agortld: pacify -Wmaybe-uninitialized from gcc6
vangyzen [Fri, 1 Feb 2019 23:16:59 +0000 (23:16 +0000)]
rtld: pacify -Wmaybe-uninitialized from gcc6

Sponsored by: Dell EMC Isilon

5 years agolibm: squelch -Woverflow from gcc6
vangyzen [Fri, 1 Feb 2019 23:15:54 +0000 (23:15 +0000)]
libm: squelch -Woverflow from gcc6

Sponsored by: Dell EMC Isilon

5 years agoqlnxr(4), qlnxe(4): Unbreak gcc build
cem [Fri, 1 Feb 2019 23:04:45 +0000 (23:04 +0000)]
qlnxr(4), qlnxe(4): Unbreak gcc build

Remove redundant definitions and conditionalize Clang-specific CFLAGS.

Sponsored by: Dell EMC Isilon

5 years agoreadelf: decode FreeBSD note types
emaste [Fri, 1 Feb 2019 22:24:14 +0000 (22:24 +0000)]
readelf: decode FreeBSD note types

Decode NT_FREEBSD_ABI_TAG, NT_FREEBSD_ARCH_TAG, and NT_FREEBSD_FEATURE_CTL.

Reviewed by: brooks, kib (earlier)
MFC after: 2 weeks
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19054

5 years agoDisable boot-time memory test on i386 be default.
kib [Fri, 1 Feb 2019 21:09:36 +0000 (21:09 +0000)]
Disable boot-time memory test on i386 be default.

With the current 24G memory limit for GENERIC, the boot time test
causes quite visible delay, amplified by the default
debug.late_console = 0.

The comment text is copied from the same setting explanation for
amd64.

Suggested by: bde
Discussed with: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 2 months

5 years agox86: correctly limit max memory resource address..
kib [Fri, 1 Feb 2019 20:46:47 +0000 (20:46 +0000)]
x86: correctly limit max memory resource address..

CPU and buses can manage up to the limit reported by cpu_maxphyaddr,
so set mem_rman to the value returned by cpu_getmaxphyaddr().  For the
PAE mode, it was missed both when rman_res_t was increased to
uintmax_t, and from the PAE merge commit.

When importing smaps or dump_avail chunks into memory rman, do not
blindly ignore resources which ends above the limit, chomp them
instead if start is below the limit.  The same change was already done
to i386 add_physmap_entry().

Based on the submission by: bde
MFC after: 2 months

5 years agocxgbe(4): Improved error reporting and diagnostics.
np [Fri, 1 Feb 2019 20:42:49 +0000 (20:42 +0000)]
cxgbe(4): Improved error reporting and diagnostics.

"slow" interrupt handler:
- Expand the list of INT_CAUSE registers known to the driver.
- Add decode information for many more bits but decouple it from the
  rest of intr_info so that it is entirely optional.
- Call t4_fatal_err exactly once, and from the top level PL intr handler.

t4_fatal_err:
- Use t4_shutdown_adapter from the common code to stop the adapter.
- Stop servicing slow interrupts after the first fatal one.

Driver/firmware interaction:
- CH_DUMP_MBOX: note whether the mailbox being dumped is a command or a
  reply or something else.
- Log the raw value of pcie_fw for some errors.
- Use correct log levels (debug vs. error).

Sponsored by: Chelsio Communications

5 years agoreadelf: use table-based DT_FLAGS and DT_FLAGS_1 decoding
emaste [Fri, 1 Feb 2019 20:28:15 +0000 (20:28 +0000)]
readelf: use table-based DT_FLAGS and DT_FLAGS_1 decoding

Fewer lines of code and more maintainable.

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

5 years agoFix function keys for syscons in cons25 mode (vidcontrol -T cons25).
bde [Fri, 1 Feb 2019 16:07:49 +0000 (16:07 +0000)]
Fix function keys for syscons in cons25 mode (vidcontrol -T cons25).

kbd(4) (but only documented in atkbd(4)) maintains a table of strings
for 96 function keys.  Using teken broke this 9+ years ago for the
most usable first 12 function keys and for 10 cursor keys, by supplying
its own non-programmable strings so that the keyboard driver's strings
are not used.

Fix this by supplying NULL in the teken layer for syscons in cons25 mode
so that the the strings are found in the kbd(4) layer.

vt needs more changes to use kbd(4)'s tables.  Teken's cons25 table is
still needed to supply nonempty strings for vt in cons25 mode.

Keep using teken's xterm tables for both syscons and vt in xterm mode.
Function keys should at least default to xterm values in xterm mode,
and kbd(4) doesn't support this.

teken_set_cons25() sets a sticky flag to ask for the fix, and space is
reserved for another new flag.  vt should set this flag when it uses
kbd(4)'s tables.

PR: 226553 (for vt)

5 years agoWhen handling SYN-ACK segments in the SYN-RCVD state, set tp->snd_wnd
tuexen [Fri, 1 Feb 2019 12:33:00 +0000 (12:33 +0000)]
When handling SYN-ACK segments in the SYN-RCVD state, set tp->snd_wnd
consistently.

This inconsistency was observed when working on the bug reported in
PR 235256, although it does not fix the reported issue. The fix for
the PR will be a separate commit.

PR: 235256
Reviewed by: rrs@, Richard Scheffenegger
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D19033

5 years agoRepair siftr(4): PFIL_IN and PFIL_OUT are defines of some value, relying
glebius [Fri, 1 Feb 2019 08:10:26 +0000 (08:10 +0000)]
Repair siftr(4): PFIL_IN and PFIL_OUT are defines of some value, relying
on them having particular values can break things.

5 years agoUnbreak call to ipf_check(): it expects the out parameter to be 0 or 1.
glebius [Fri, 1 Feb 2019 07:48:37 +0000 (07:48 +0000)]
Unbreak call to ipf_check(): it expects the out parameter to be 0 or 1.

Pointy hat to: glebius
Reported by: cy

5 years agoRevert r343634:
araujo [Fri, 1 Feb 2019 03:09:11 +0000 (03:09 +0000)]
Revert r343634:
Mostly a cosmetic change to replace strlen with strnlen.

Requested by: kib and imp

5 years agoHopefully fix compilation by other compilers.
glebius [Fri, 1 Feb 2019 00:34:18 +0000 (00:34 +0000)]
Hopefully fix compilation by other compilers.

5 years agoFix build without INET6.
glebius [Fri, 1 Feb 2019 00:33:17 +0000 (00:33 +0000)]
Fix build without INET6.

5 years agoMostly a cosmetic change to replace strlen with strnlen.
araujo [Thu, 31 Jan 2019 23:32:19 +0000 (23:32 +0000)]
Mostly a cosmetic change to replace strlen with strnlen.

Obtained from: Project ACRN
MFC after: 2 weeks

5 years agoShar files may be seen as binary by grep.
bdrewery [Thu, 31 Jan 2019 23:21:18 +0000 (23:21 +0000)]
Shar files may be seen as binary by grep.

Suggest using -a to egrep to properly see executed commands.

This is a minor improvement to the manpage.  A better improvement
would be removal or gigantic warnings.

Sponsored by: Dell EMC
MFC after: 1 week

5 years agoRemove iBCS2: also remove xenix syscall function support.
brooks [Thu, 31 Jan 2019 23:01:12 +0000 (23:01 +0000)]
Remove iBCS2: also remove xenix syscall function support.

Missed in r342243.

5 years agoNew pfil(9) KPI together with newborn pfil API and control utility.
glebius [Thu, 31 Jan 2019 23:01:03 +0000 (23:01 +0000)]
New pfil(9) KPI together with newborn pfil API and control utility.

The KPI have been reviewed and cleansed of features that were planned
back 20 years ago and never implemented.  The pfil(9) internals have
been made opaque to protocols with only returned types and function
declarations exposed. The KPI is made more strict, but at the same time
more extensible, as kernel uses same command structures that userland
ioctl uses.

In nutshell [KA]PI is about declaring filtering points, declaring
filters and linking and unlinking them together.

New [KA]PI makes it possible to reconfigure pfil(9) configuration:
change order of hooks, rehook filter from one filtering point to a
different one, disconnect a hook on output leaving it on input only,
prepend/append a filter to existing list of filters.

Now it possible for a single packet filter to provide multiple rulesets
that may be linked to different points. Think of per-interface ACLs in
Cisco or Juniper. None of existing packet filters yet support that,
however limited usage is already possible, e.g. default ruleset can
be moved to single interface, as soon as interface would pride their
filtering points.

Another future feature is possiblity to create pfil heads, that provide
not an mbuf pointer but just a memory pointer with length. That would
allow filtering at very early stages of a packet lifecycle, e.g. when
packet has just been received by a NIC and no mbuf was yet allocated.

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

5 years agoRegen after r342190.
brooks [Thu, 31 Jan 2019 22:58:17 +0000 (22:58 +0000)]
Regen after r342190.

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

5 years agonvdimm: only enumerate present nvdimm devices
kib [Thu, 31 Jan 2019 22:47:04 +0000 (22:47 +0000)]
nvdimm: only enumerate present nvdimm devices

Not all child devices of the NVDIMM root device represent DIMM devices
which are present in the system. The spec says (ACPI 6.2, sec 9.20.2):

    For each NVDIMM present or intended to be supported by platform,
    platform firmware also exposes an NVDIMM device ... under the
    NVDIMM root device.

Present NVDIMM devices are found by walking all of the NFIT table's
SPA ranges, then walking the NVDIMM regions mentioned by those SPA
ranges.

A set of NFIT walking helper functions are introduced to avoid the
need to splat the enumeration logic across several disparate
callbacks.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Sponsored by: Intel Corporation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18439

5 years agonvdimm: enumerate NVDIMM SPA ranges from the root device
kib [Thu, 31 Jan 2019 22:43:20 +0000 (22:43 +0000)]
nvdimm: enumerate NVDIMM SPA ranges from the root device

Move the enumeration of NVDIMM SPA ranges from the spa GEOM class
initializer into the NVDIMM root device. This will be necessary for a
later change where NVDIMM namespaces require NVDIMM device enumeration
to be reliably ordered before SPA enumeration.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Sponsored by: Intel Corporation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18734

5 years agoAdd new m_ext type for data for M_NOFREE mbufs, which doesn't actually do
glebius [Thu, 31 Jan 2019 22:37:28 +0000 (22:37 +0000)]
Add new m_ext type for data for M_NOFREE mbufs, which doesn't actually do
anything except several assertions.  This type is going to be used for
temporary on stack mbufs, that point into data in receive ring of a NIC,
that shall not be freed.  Such mbuf can not be stored or reallocated, its
life time is current context.

5 years agoPrevent some kobj memory allocation failures from panicking the system.
markj [Thu, 31 Jan 2019 22:27:39 +0000 (22:27 +0000)]
Prevent some kobj memory allocation failures from panicking the system.

Parts of the kobj(9) KPI assume a non-sleepable context for the purpose
of internal memory allocations, but currently have no way to signal an
allocation failure to the caller, so they just panic in this case.  This
can occur even when kobj_create() is called with M_WAITOK.  Fix some
instances of the problem by plumbing wait flags from kobj_create() through
internal subroutines.  Change kobj_class_compile() to assume a sleepable
context when called externally, since all existing callers use it in a
sleepable context.

To fix the problem fully the kobj_init() KPI must be changed.

Reported and tested by: pho
Reviewed by: kib (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19023

5 years agoix(4),ixv(4): Fix TSO offloads when TXCSUM is disabled
erj [Thu, 31 Jan 2019 21:53:03 +0000 (21:53 +0000)]
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
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18470

5 years agoix(4): Run {mod,msf,mbx,fdir,phy}_task in if_update_admin_status
erj [Thu, 31 Jan 2019 21:44:33 +0000 (21:44 +0000)]
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
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18468

5 years agoDon't set IFCAP_TXRTLMT during lagg_clone_create().
jhb [Thu, 31 Jan 2019 21:35:37 +0000 (21:35 +0000)]
Don't set IFCAP_TXRTLMT during lagg_clone_create().

lagg_capabilities() will set the capability once interfaces supporting
the feature are added to the lagg.  Setting it on a lagg without any
interfaces is pointless as the if_snd_tag_alloc call will always fail
in that case.

Reviewed by: hselasky, gallatin
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19040

5 years agoRevert r316461: Remove "IPFW static rules" rmlock, and use pfil's global lock.
glebius [Thu, 31 Jan 2019 21:04:50 +0000 (21:04 +0000)]
Revert r316461: Remove "IPFW static rules" rmlock, and use pfil's global lock.

The pfil(9) system is about to be converted to epoch(9) synchronization, so
we need [temporarily] go back with ipfw internal locking.

Discussed with: ae

5 years agoMake iflib a loadable module: add seemingly missed header.
kib [Thu, 31 Jan 2019 20:04:18 +0000 (20:04 +0000)]
Make iflib a loadable module: add seemingly missed header.

Reported by: CI (i.e. it is not reproducable in my local builds)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

5 years agoMake iflib a loadable module.
kib [Thu, 31 Jan 2019 19:05:56 +0000 (19:05 +0000)]
Make iflib a loadable module.

iflib is already a module, but it is unconditionally compiled into the
kernel.  There are drivers which do not need iflib(4), and there are
situations where somebody might not want iflib in kernel because of
using the corresponding driver as module.

Reviewed by: marius
Discussed with: erj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D19041

5 years agoIn zone_alloc_bucket() max argument was calculated based on uz_count.
glebius [Thu, 31 Jan 2019 17:52:48 +0000 (17:52 +0000)]
In zone_alloc_bucket() max argument was calculated based on uz_count.
Then bucket_alloc() also selects bucket size based on uz_count. However,
since zone lock is dropped, uz_count may reduce. In this case max may
be greater than ub_entries and that would yield into writing beyond end
of the allocation.

Reported by: pho

5 years agoreadelf: dump elf note data
emaste [Thu, 31 Jan 2019 17:04:55 +0000 (17:04 +0000)]
readelf: dump elf note data

Output format is compatible with GNU readelf's handling of unknown note
types (modulo a GNU char signedness bug); future changes will add type-
specific decoding.

Reviewed by: kib
MFC after: 1 week
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

5 years agoelfdump: use designated array initialization for note types
emaste [Thu, 31 Jan 2019 16:49:06 +0000 (16:49 +0000)]
elfdump: use designated array initialization for note types

This ensures the note type name is in the correct slot.

PR: 228290
Submitted by: kib
MFC with: 343610
Sponsored by: The FreeBSD Foundation

5 years agoelfdump: fix build after r343610
emaste [Thu, 31 Jan 2019 16:21:09 +0000 (16:21 +0000)]
elfdump: fix build after r343610

One patch hunk did not survive the trip from git to svn.

PR: 228290
MFC with: r343610

5 years agoelfdump: include note type names
emaste [Thu, 31 Jan 2019 16:19:04 +0000 (16:19 +0000)]
elfdump: include note type names

Based on a patch submitted by Dan McGregor.

PR: 228290
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoelfdump: whitespace fixup in advance of other changes
emaste [Thu, 31 Jan 2019 16:11:15 +0000 (16:11 +0000)]
elfdump: whitespace fixup in advance of other changes

5 years agoregen src.conf.5 after r343606
emaste [Thu, 31 Jan 2019 15:50:11 +0000 (15:50 +0000)]
regen src.conf.5 after r343606

5 years agoReserve a bit in the FreeBSD feature control note for marking the
kib [Thu, 31 Jan 2019 15:44:49 +0000 (15:44 +0000)]
Reserve a bit in the FreeBSD feature control note for marking the
image as not compatible with ASLR.

Requested by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D5603

5 years agoEnable lld as the system linker by default on i386
emaste [Thu, 31 Jan 2019 15:07:32 +0000 (15:07 +0000)]
Enable lld as the system linker by default on i386

The migration to LLVM's lld linker has been in progress for quite some
time - I opened an LLVM tracking bug (23214) in April 2015 to track
issues using lld as FreeBSD's linker, and requested the first exp-run
using lld as /usr/bin/ld in November 2016.

In 12.0 LLD is the system linker on amd64, arm64, and armv7.  i386 was
not switched initially as there were additional ports failures not found
on amd64.  Those have largely been addressed now, although there are a
small number of issues that are still being worked on.  In some of these
cases having lld as the system linker makes it easier for developers and
third parties to investigate failures.

Thanks to antoine@ for handling the exp-runs and to everyone in the
FreeBSD and LLVM communites who have fixed issues with lld to get us to
this point.

PR: 214864
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

5 years agobwn(4): reuse ieee80211_tx_complete function.
avos [Thu, 31 Jan 2019 11:12:31 +0000 (11:12 +0000)]
bwn(4): reuse ieee80211_tx_complete function.

MFC after: 1 week

5 years agoipw(4): reuse ieee80211_tx_complete function
avos [Thu, 31 Jan 2019 10:44:00 +0000 (10:44 +0000)]
ipw(4): reuse ieee80211_tx_complete function

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

MFC after: 1 week

5 years agoinstall(1): Fix relative path calculation with partial common dest/src
kevans [Thu, 31 Jan 2019 05:20:11 +0000 (05:20 +0000)]
install(1): Fix relative path calculation with partial common dest/src

For example, from the referenced PR [1]:

$ mkdir /tmp/lib/ /tmp/libexec
$ touch /tmp/lib/foo.so
$ install -lrs /tmp/lib/foo.so /tmp/libexec/

The common path identification bits terminate src at /tmp/lib/ and the
destination at /tmp/libe. The subsequent backtracking is then incorrect, as
it traverses the destination and backtraces exactly one level while eating
the 'libexec' because it was previously (falsely) identified as common with
'lib'.

The obvious fix would be to make sure we've actually terminated just after
directory separators and rewind a character if we haven't. In the above
example, we would end up rewinding to /tmp/ and subsequently doing the right
thing.

Test case added.

PR: 235330 [1]
MFC after: 1 week

5 years agoDocument the instance context pointer.
cy [Thu, 31 Jan 2019 04:16:52 +0000 (04:16 +0000)]
Document the instance context pointer.

MFC after: 3 days

5 years agolibc/tests: Add test case for jemalloc/libthr bug fixed in r343566
kevans [Thu, 31 Jan 2019 02:49:24 +0000 (02:49 +0000)]
libc/tests: Add test case for jemalloc/libthr bug fixed in r343566

Submitted by: Andrew Gierth (original reproducer; kevans massaged for atf)
Reviewed by: kib
MFC after: 2 weeks
X-MFC-with: r343566 (or after)
Differential Revision: https://reviews.freebsd.org/D19027

5 years agoAdd RDMA (iWARP and RoCEv1) support
davidcs [Thu, 31 Jan 2019 00:09:38 +0000 (00:09 +0000)]
Add RDMA (iWARP and RoCEv1) support

David Somayajulu (davidcs): Overall RDMA Driver infrastructure and iWARP
Anand Khoje (akhoje@marvell.com): RoCEv1 verbs implementation

MFC after:5 days

5 years agoreadelf: fix i386 build
emaste [Wed, 30 Jan 2019 21:46:12 +0000 (21:46 +0000)]
readelf: fix i386 build

Use %jx and (uintmax_t) cast.

PR: 232983
MFC with: r343592
Sponsored by: The FreeBSD Foundation

5 years agoreadelf: decode flag bits in DT_FLAGS/DT_FLAGS_1
emaste [Wed, 30 Jan 2019 20:44:51 +0000 (20:44 +0000)]
readelf: decode flag bits in DT_FLAGS/DT_FLAGS_1

Decode d_val when the tag is DT_FLAGS or DT_FLAGS_1 based on the
information at:

https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-42444.html

PR: 232983
Submitted by: Bora Ozarslan borako.ozarslan@gmail.com
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18784

5 years agoDo not obtain an already held read lock. This causes a witness panic when
cy [Wed, 30 Jan 2019 20:23:16 +0000 (20:23 +0000)]
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
MFC after: 2 weeks

5 years agoWhen copying a NAT rule struct to userland for save by ipfs, use the
cy [Wed, 30 Jan 2019 20:22:33 +0000 (20:22 +0000)]
When copying a NAT rule struct to userland for save by ipfs, use the
length of the struct in memmove() rather than an unintialized variable.
This fixes the first of two kernel page faults when ipfs is invoked.

PR: 235110
Reported by: David.Boyd49@twc.com
MFC after: 2 weeks

5 years agofreebsd-update: regenerate man page database after update
emaste [Wed, 30 Jan 2019 19:19:14 +0000 (19:19 +0000)]
freebsd-update: regenerate man page database after update

These are currently not reproducible because they're built by the
makewhatis on the freebsd-update build host, not the one in the tree.
Regenerate after update, and later we can avoid including it in
freebsd-update data.

PR: 214545, 217389
Reviewed by: delphij
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10482

5 years agoRemove stale now comment, forgotten in r343582.
mav [Wed, 30 Jan 2019 18:56:45 +0000 (18:56 +0000)]
Remove stale now comment, forgotten in r343582.

MFC after: 2 weeks

5 years agoAdd a simple port filter to SIFTR.
brooks [Wed, 30 Jan 2019 17:44:30 +0000 (17:44 +0000)]
Add a simple port filter to SIFTR.

SIFTR does not allow any kind of filtering, but captures every packet
processed by the TCP stack.
Often, only a specific session or service is of interest, and doing the
filtering in post-processing of the log adds to the overhead of SIFTR.

This adds a new sysctl net.inet.siftr.port_filter. When set to zero, all
packets get captured as previously. If set to any other value, only
packets where either the source or the destination ports match, are
captured in the log file.

Submitted by: Richard Scheffenegger
Reviewed by: Cheng Cui
Differential Revision: https://reviews.freebsd.org/D18897

5 years agoRemove BIO_ORDERED flag from BIO_FLUSH sent by ZFS.
mav [Wed, 30 Jan 2019 17:39:44 +0000 (17:39 +0000)]
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.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

5 years agoOnly sort requests of types that have concept of offset.
mav [Wed, 30 Jan 2019 17:24:50 +0000 (17:24 +0000)]
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.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

5 years agoExport vendor specific USB MIDI device list to PnP info.
hselasky [Wed, 30 Jan 2019 17:11:08 +0000 (17:11 +0000)]
Export vendor specific USB MIDI device list to PnP info.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoRemove unecessary "All rights reserved" from files under my or Panasas's
rpokala [Wed, 30 Jan 2019 16:55:00 +0000 (16:55 +0000)]
Remove unecessary "All rights reserved" from files under my or Panasas's
copyright.

When all member nations of the Buenos Aires Convention adopted the Berne
Convention, the phrase "All rights reserved" became unnecessary to assert
copyright. Remove it from files under my or Panasas's copyright. The files
related to jedec_dimm(4) also bear avg@'s copyright; he has approved this
change.

Approved by: avg
Sponsored by: Panasas

5 years agoRelax BIO_FLUSH ordering in da(4), respecting BIO_ORDERED.
mav [Wed, 30 Jan 2019 16:50:53 +0000 (16:50 +0000)]
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.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

5 years agoRemove duplicate declarations.
kib [Wed, 30 Jan 2019 16:29:15 +0000 (16:29 +0000)]
Remove duplicate declarations.

Submitted by: bde
MFC after: 2 months

5 years agoRename rtld-elf/malloc.c to rtld-elf/rtld_malloc.c.
kib [Wed, 30 Jan 2019 16:28:27 +0000 (16:28 +0000)]
Rename rtld-elf/malloc.c to rtld-elf/rtld_malloc.c.

Then malloc.c file name is too generic to use it for libthr.a.

Sponsored by: The FreeBSD Foundation
MFC after: 13 days

5 years agonetmap: fix lock order reversal related to kqueue usage
vmaffione [Wed, 30 Jan 2019 15:51:55 +0000 (15:51 +0000)]
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
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18956

5 years ago- Stop iflib(4) from leaking MSI messages on detachment by calling
marius [Wed, 30 Jan 2019 13:21:26 +0000 (13:21 +0000)]
- 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 agorsu(4): add support for ifconfig(8) 'maxretry' option.
avos [Wed, 30 Jan 2019 13:19:05 +0000 (13:19 +0000)]
rsu(4): add support for ifconfig(8) 'maxretry' option.

Tested with Asus USB-N10, STA mode; maxretry 0 / 1 / 6 / 12
Checked with RTL8188EE, MONITOR mode.

MFC after: 1 week

5 years agondiscvt(8): abort if no IDs were found during conversion.
avos [Wed, 30 Jan 2019 12:32:47 +0000 (12:32 +0000)]
ndiscvt(8): abort if no IDs were found during conversion.

Checked with Broadcom driver mentioned in PR 179285.

PR: 69268
Submitted by: <darius@dons.net.au>
MFC after: 5 days

5 years agoFix compilation with 'option NDISAPI + device ndis' and
avos [Wed, 30 Jan 2019 11:40:12 +0000 (11:40 +0000)]
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>
MFC after: 1 week

5 years agoxen: introduce a new way to setup event channel upcall
royger [Wed, 30 Jan 2019 11:34:52 +0000 (11:34 +0000)]
xen: introduce a new way to setup event channel upcall

The main differences with the currently implemented method are:

 - Requires a local APIC EOI, since it doesn't bypass the local APIC
   as the previous method used to do.
 - Can be set to use different IDT vectors on each vCPU. Note that
   FreeBSD doesn't make use of this feature since the event channel
   IDT vector is reserved system wide.

Note that the old method of setting the event channel upcall is
not removed, and will be used as a fallback if this newly introduced
method is not available.

MFC after: 1 month
Sponsored by: Citrix Systems R&D

5 years agoAdd support for Audio Sink and Audio Source profiles to sdpd(8).
hselasky [Wed, 30 Jan 2019 09:44:54 +0000 (09:44 +0000)]
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.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoMerge ^/head r343320 through r343570.
dim [Wed, 30 Jan 2019 07:10:33 +0000 (07:10 +0000)]
Merge ^/head r343320 through r343570.

5 years agoPull in r352407 from upstream lld trunk (by Rui Ueyama):
dim [Wed, 30 Jan 2019 07:09:01 +0000 (07:09 +0000)]
Pull in r352407 from upstream lld trunk (by Rui Ueyama):

  Refactoring. NFC.

Pull in r352435 from upstream lld trunk (by Rui Ueyama):

  Attempt to fix build failure with GCC 5.4.

Pull in r352482 from upstream lld trunk (by George Rimar):

  [ELF] - Remove dead `readBfdName` declaration. NFC.

  `readBfdName` was removed recently.

Pull in r352606 from upstream lld trunk (by me):

  Recognize FreeBSD specific BFD names in OUTPUT_FORMAT

  Summary:
  After rLLD344952 ("Add OUTPUT_FORMAT linker script directive
  support"), using BFD names such as `elf64-x86-64-freebsd` the
  `OUTPUT_FORMAT` linker script command does not work anymore,
  resulting in errors like:

  ```
  ld: error: /home/dim/src/clang800-import/stand/efi/loader/arch/amd64/ldscript.amd64:2: unknown output format name: elf64-x86-64-freebsd
  >>> OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd")
  >>>               ^
  ```

  To fix this, recognize a `-freebsd` suffix in BFD names, and also set
  `Configuration::OSABI` to `ELFOSABI_FREEBSD` for those cases.

  Add and/or update several test cases to check for the correct results
  of these new `OUTPUT_FORMAT` arguments.

  Reviewers: ruiu, atanasyan, grimar, hokein, emaste, espindola

  Reviewed By: ruiu

  Subscribers: nemanjai, javed.absar, arichardson, krytarowski, kristof.beyls, kbarton, llvm-commits

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

5 years agocxgbe/iw_cxgbe: Fix an address calculation in the memory registration code that
np [Wed, 30 Jan 2019 05:39:47 +0000 (05:39 +0000)]
cxgbe/iw_cxgbe: Fix an address calculation in the memory registration code that
was added in r342266.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

5 years agoi386: Merge PAE and non-PAE pmaps into same kernel.
kib [Wed, 30 Jan 2019 02:07:13 +0000 (02:07 +0000)]
i386: Merge PAE and non-PAE pmaps into same kernel.

Effectively all i386 kernels now have two pmaps compiled in: one
managing PAE pagetables, and another non-PAE. The implementation is
selected at cold time depending on the CPU features. The vm_paddr_t is
always 64bit now. As result, nx bit can be used on all capable CPUs.

Option PAE only affects the bus_addr_t: it is still 32bit for non-PAE
configs, for drivers compatibility. Kernel layout, esp. max kernel
address, low memory PDEs and max user address (same as trampoline
start) are now same for PAE and for non-PAE regardless of the type of
page tables used.

Non-PAE kernel (when using PAE pagetables) can handle physical memory
up to 24G now, larger memory requires re-tuning the KVA consumers and
instead the code caps the maximum at 24G. Unfortunately, a lot of
drivers do not use busdma(9) properly so by default even 4G barrier is
not easy. There are two tunables added: hw.above4g_allow and
hw.above24g_allow, the first one is kept enabled for now to evaluate
the status on HEAD, second is only for dev use.

i386 now creates three freelists if there is any memory above 4G, to
allow proper bounce pages allocation. Also, VM_KMEM_SIZE_SCALE changed
from 3 to 1.

The PAE_TABLES kernel config option is retired.

In collaboarion with: pho
Discussed with: emaste
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18894

5 years agoUntangle jemalloc and mutexes initialization.
kib [Tue, 29 Jan 2019 22:46:44 +0000 (22:46 +0000)]
Untangle jemalloc and mutexes initialization.

The need to use libc malloc(3) from some places in libthr always
caused issues.  For instance, per-thread key allocation was switched to
use plain mmap(2) to get storage, because some third party mallocs
used keys for implementation of calloc(3).

Even more important, libthr calls calloc(3) during initialization of
pthread mutexes, and jemalloc uses pthread mutexes.  Jemalloc provides
some way to both postpone the initialization, and to make
initialization to use specialized allocator, but this is very fragile
and often breaks.  See the referenced PR for another example.

Add the small malloc implementation used by rtld, to libthr. Use it in
thr_spec.c and for mutexes initialization. This avoids the issues with
mutual dependencies between malloc and libthr in principle.  The
drawback is that some more allocations are not interceptable for
alternate malloc implementations.  There should be not too much memory
use from this allocator, and the alternative, direct use of mmap(2) is
obviously worse.

PR: 235211
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18988

5 years agoAdd header file missed in r343564.
kib [Tue, 29 Jan 2019 22:45:24 +0000 (22:45 +0000)]
Add header file missed in r343564.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18988