]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years ago[net80211] don't abort a background scan upon reception of a single packet.
adrian [Fri, 28 Oct 2016 02:09:45 +0000 (02:09 +0000)]
[net80211] don't abort a background scan upon reception of a single packet.

Full offload drivers don't need this behaviour - they do it in firmware.

7 years agolibunwind: consistently add \n to log and trace messages
emaste [Fri, 28 Oct 2016 00:04:04 +0000 (00:04 +0000)]
libunwind: consistently add \n to log and trace messages

Previously most messages included a newline in the string, but a few of
them were missing. Fix these and simplify by just adding the newline in
the _LIBUNWIND_LOG macro itself.

While here correct 'libuwind' typo (missing 'n').

Upstream LLVM libunwind commits r280086 and r280103.

7 years agoAdd powerd(8) support for several families of AMD CPUs.
jhb [Thu, 27 Oct 2016 21:31:56 +0000 (21:31 +0000)]
Add powerd(8) support for several families of AMD CPUs.

Use the same logic to calculate the nominal CPU frequency from the P-state
MSRs on family 0x12, 0x15, and 0x16 CPUs as is used for family 0x10.
Family 0x14 was included in the original patch in the PR but I left that
out as the BIOS writer's guide for family 0x14 CPUs show a different layout
for the relevant MSR and include a different formulate for calculating the
frequency.

While here, simplify a few expressions and print out the family of
unsupported CPUs in hex rather than decimal.

PR: 212020
Submitted by: Anthony Jenkins <Scoobi_doo@yahoo.com>
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D7587

7 years agoMFamd64: Add bounds checks on addresses used with /dev/mem.
jhb [Thu, 27 Oct 2016 21:23:14 +0000 (21:23 +0000)]
MFamd64: Add bounds checks on addresses used with /dev/mem.

Reject attempts to read from or memory map offsets in /dev/mem that are
beyond the maximum-supported physical address of the current CPU.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D7408

7 years agoRevert r307823 (Use upstream suffixes for LLVM IR) for now. It causes a
dim [Thu, 27 Oct 2016 18:46:52 +0000 (18:46 +0000)]
Revert r307823 (Use upstream suffixes for LLVM IR) for now.  It causes a
number of ports to fail, which use bmake, and use .ll file extensions
(usually for for C++-based lex input).

Reported by: antoine

7 years agolibgcc_eh/libgcc_s: apply hidden visibility only to static libs
emaste [Thu, 27 Oct 2016 14:21:54 +0000 (14:21 +0000)]
libgcc_eh/libgcc_s: apply hidden visibility only to static libs

7 years agoVarious fixes for ptnet/ptnetmap (passthrough of netmap ports). In detail:
luigi [Thu, 27 Oct 2016 09:46:22 +0000 (09:46 +0000)]
Various fixes for ptnet/ptnetmap (passthrough of netmap ports). In detail:
- use PCI_VENDOR and PCI_DEVICE ids from a publicly allocated range
  (thanks to RedHat)
- export memory pool information through PCI registers
- improve mechanism for configuring passthrough on different hypervisors
Code is from Vincenzo Maffione as a follow up to his GSOC work.

7 years ago3746 ZRLs are racy
avg [Thu, 27 Oct 2016 07:38:07 +0000 (07:38 +0000)]
3746 ZRLs are racy

illumos/illumos-gate@260af64db74a52d64de8c6c5f67dd0a71d228ca5
https://github.com/illumos/illumos-gate/commit/260af64db74a52d64de8c6c5f67dd0a71d228ca5

https://www.illumos.org/issues/3746
  From the original change log:
  It was possible for a reference to be added even with the lock held, and
  for references added just after a lock release to be lost.
  This bug was also independently found and reported in wesunsolve.net
  issues 6985013 6995524.
  In zrl_add(), always use an atomic operation to update the refcount.
  The mutex in the ZRL only guarantees that wakeups occur for waiters on the
  lock. It offers no protection against concurrent updates of the refcount.
  The only refcount transition that is safe to perform without an atomic
  operation is from ZRL_LOCKED back to 0, since this can only be performed
  by the thread which has the ZRL locked.

Authored by: Will Andrews <will@freebsd.org>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Reviewed by: Pavel Zakharov <pavel.zakha@gmail.com>
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Reviewed by: Justin T. Gibbs <gibbs@scsiguy.com>
Approved by: Matt Ahrens <mahrens@delphix.com>
Author: Youzhong Yang <yyang@mathworks.com>
PR: 204037
MFC after: 1 week

7 years agohyperv/hn: NVS inclusion cleanup and forward declare functions.
sephe [Thu, 27 Oct 2016 05:33:48 +0000 (05:33 +0000)]
hyperv/hn: NVS inclusion cleanup and forward declare functions.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8347

7 years agohyperv/hn: Move send context to NVS domain.
sephe [Thu, 27 Oct 2016 05:26:04 +0000 (05:26 +0000)]
hyperv/hn: Move send context to NVS domain.

Since all sends are encapsulated in NVS messages.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8346

7 years agohyperv/hn: Move hn_softc to if_hnvar.h
sephe [Thu, 27 Oct 2016 05:13:00 +0000 (05:13 +0000)]
hyperv/hn: Move hn_softc to if_hnvar.h

While I'm here, use consistent macro names.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8345

7 years agohyperv/hn: Shuffle chimney sending buffer alloc/free around.
sephe [Thu, 27 Oct 2016 05:04:54 +0000 (05:04 +0000)]
hyperv/hn: Shuffle chimney sending buffer alloc/free around.

This paves way for more chimney sending buffer reorganization.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8343

7 years agohyperv/hn: Define empty packet filter.
sephe [Thu, 27 Oct 2016 04:55:19 +0000 (04:55 +0000)]
hyperv/hn: Define empty packet filter.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8342

7 years agohyperv/hn: Move %b format string for capabilities near their definition.
sephe [Thu, 27 Oct 2016 04:42:39 +0000 (04:42 +0000)]
hyperv/hn: Move %b format string for capabilities near their definition.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8341

7 years agohyperv/hn: Nuke unnecessary M_NETVSC
sephe [Thu, 27 Oct 2016 04:28:01 +0000 (04:28 +0000)]
hyperv/hn: Nuke unnecessary M_NETVSC

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8340

7 years agoAdd support for Allwinner Consumer IR interface.
ganbold [Thu, 27 Oct 2016 04:26:33 +0000 (04:26 +0000)]
Add support for Allwinner Consumer IR interface.
RX is supported now and the driver is using evdev framework.
It was tested on Cubieboard2 (A20 SoC) using lirc
with dfrobot's IR remote controller.

7 years agohyperv/hn: Properly configure RSS according to RSS capabilities
sephe [Thu, 27 Oct 2016 03:43:27 +0000 (03:43 +0000)]
hyperv/hn: Properly configure RSS according to RSS capabilities

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8338

7 years agoDisable CLKREQ for ASPM since re(4) doesn't implement link level power saving.
kevlo [Thu, 27 Oct 2016 02:20:13 +0000 (02:20 +0000)]
Disable CLKREQ for ASPM since re(4) doesn't implement link level power saving.

Reviewed by:  yongari

7 years agoRemove excess CTLFLAG_VNET
bdrewery [Wed, 26 Oct 2016 23:40:07 +0000 (23:40 +0000)]
Remove excess CTLFLAG_VNET

Sponsored by: Dell EMC Isilon

7 years agoThe UFS/FFS filesystem checks directory link counts when doing
mckusick [Wed, 26 Oct 2016 20:28:23 +0000 (20:28 +0000)]
The UFS/FFS filesystem checks directory link counts when doing
directory create and delete operations. If it ever finds a directory
with a link count less than 2, it panics. Thus, an rm -rf that
encounters a directory with a link count below 2 causes a kernel
panic. The proposed fix is to return the error EINVAL rather than
panicing. The effect is that the requested operation is not done,
but the system continues to run. At a more convenient later time,
the filesystem can be unmounted and cleaned (with fsck or journal
run). Once cleaned, the operation can be rerun to successful
completion.

This fix takes that approach. The panic message has been converted
into a uprintf(9) to provide the user with the inode number and
filesystem mount point of the offending directory and EINVAL is
returned for the operation.

The long (three year) delay in fixing this problem occurred because
the bug was misclassified when originally assigned and only this week
was found during a sweep of old unresolved bug reports.

PR:          180894
Reviewed by: kib
MFC after:   2 weeks

7 years agoPrefer ACFLAGS over CFLAGS for compiling aarch64 assembly files.
jkim [Wed, 26 Oct 2016 20:12:30 +0000 (20:12 +0000)]
Prefer ACFLAGS over CFLAGS for compiling aarch64 assembly files.

7 years agoBuild OpenSSL assembly sources for aarch64. Tested with ThunderX by andrew.
jkim [Wed, 26 Oct 2016 20:02:22 +0000 (20:02 +0000)]
Build OpenSSL assembly sources for aarch64.  Tested with ThunderX by andrew.

7 years agoEnable EFER_NXE properly on APs.
jhb [Wed, 26 Oct 2016 18:47:47 +0000 (18:47 +0000)]
Enable EFER_NXE properly on APs.

EFER_NXE is set in the EFER MSR by initializecpu() and must be set on all
CPUs in the system.  When PG_NX support was added to PAE on i386, the
block to enable EFER_NXE was placed in a section of initializecpu() that
only runs if 'cpu == CPU_686'.  During early boot, locore does an
initial pass to set cpu that sets it to CPU_686 on all CPUs later than
a Pentium.  Later, printcpuinfo() adjusts the 'cpu' variable on
PII and later CPUs to one of CPU_PII, CPU_PIII, or CPU_P4.  However,
printcpuinfo() is called after initializecpu() on the BSP, so the BSP
would enable EFER_NXE and pg_nx.  The APs execute initializecpu() much
later after printcpuinfo() has run.  The end result on a modern CPU was
that cpu was set to CPU_PIII when the APs invoked initializecpu(), so
they did not enable EFER_NXE.  As a result, the APs would fault when
trying to access any pages marked with PG_NX set.

When booting a 2 CPU PAE kernel in bhyve this manifested as a hang before
single user mode.  The attempt to execute /bin/init tried to copy out
the exec strings (argv, etc.) to a non-executable mapping while running
on the AP.  The instruction kept faulting due to invalid bits in the PTE
in an infinite loop.

Fix this by moving the code to enable EFER_NXE out of the switch statement
on 'cpu' and always doing it if 'amd_feature' supports AMDID_NX.

MFC after: 2 weeks

7 years agoCorrect definition of 'struct sigcontext' on MIPS.
jhb [Wed, 26 Oct 2016 17:37:08 +0000 (17:37 +0000)]
Correct definition of 'struct sigcontext' on MIPS.

Add missing fields ('sr' and 'mc_tls') to 'struct sigcontext'.

The kernel doesn't use 'struct sigcontext' but instead uses 'ucontext_t'
which includes 'mcontext_t' in 'struct sigframe' to build the signal frame.
As a result, this change is not an ABI change but simply making
'struct sigcontext' correct.  Note that 'struct sigcontext' is only used
for "Traditional BSD style" signal handlers.

While here, rename the 'xxx' field to '__spare__' to match 'mcontext_t'.

Sponsored by: DARPA, AFRL

7 years agostrings: fix exit status if a file before the last one fails
emaste [Wed, 26 Oct 2016 17:07:53 +0000 (17:07 +0000)]
strings: fix exit status if a file before the last one fails

Previously a command like "strings f1 f2 f3" reported the exit status
based only on processing the last file.

As with GNU strings, report an error exit status if an error was
encountered processing any of the files. While here simplify the
exit status handling to just success (0) / failure (1).

Reviewed by: brooks
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8334

7 years agoUse the new fdt_intr.h constants in the Allwinner NMI driver.
andrew [Wed, 26 Oct 2016 16:03:26 +0000 (16:03 +0000)]
Use the new fdt_intr.h constants in the Allwinner NMI driver.

Sponsored by: DARPA, AFRL

7 years agoAllow config to be compiled from another source directory, such as one
marcel [Wed, 26 Oct 2016 15:58:41 +0000 (15:58 +0000)]
Allow config to be compiled from another source directory, such as one
for building tools. This boils down to replacing ${.CURDIR} with
${SRCDIR}, where the latter is the directory in which this makefile
lives.

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

7 years agoRemove an extraneous call to soisconnected() in syncache_socket(),
jch [Wed, 26 Oct 2016 15:19:18 +0000 (15:19 +0000)]
Remove an extraneous call to soisconnected() in syncache_socket(),
introduced with r261242.  The useful and expected soisconnected()
call is done in tcp_do_segment().

Has been found as part of unrelated PR:212920 investigation.

Improve slightly (~2%) the maximum number of TCP accept per second.

Tested by: kevin.bowling_kev009.com, jch
Approved by: gnn, hiren
MFC after: 1 week
Sponsored by: Verisign, Inc
Differential Revision: https://reviews.freebsd.org/D8072

7 years agoPull the common FDT interrupt values into a new header rather than be magic
andrew [Wed, 26 Oct 2016 15:18:08 +0000 (15:18 +0000)]
Pull the common FDT interrupt values into a new header rather than be magic
numbers.

Sponsored by: DARPA, AFRL

7 years agoUse uint32_t instead of u_long as a storage for breakpoint instruction
br [Wed, 26 Oct 2016 14:26:45 +0000 (14:26 +0000)]
Use uint32_t instead of u_long as a storage for breakpoint instruction
to copy. All the platforms breakpoints fits this fine.

This fixes operation on big-endian MIPS64 where we were coping
zeroes instead of real instruction.

Reviewed by: rpaulo
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision: https://reviews.freebsd.org/D8250

7 years agoDefine the Allwinner PLL FDT constants in the file that uses them rather
andrew [Wed, 26 Oct 2016 14:09:30 +0000 (14:09 +0000)]
Define the Allwinner PLL FDT constants in the file that uses them rather
than including a file from under sys/gnu.

Sponsored by: DARPA, AFRL

7 years agoStop including a possibly GPLd header from the GPIO code. Add the only
andrew [Wed, 26 Oct 2016 12:41:44 +0000 (12:41 +0000)]
Stop including a possibly GPLd header from the GPIO code. Add the only
needed macro to ofw_gpiobus.c.

Reported by: emaste
Sponsored by: DARPA, AFRL

7 years agoOnly release CPUs when they exist.
andrew [Wed, 26 Oct 2016 12:30:53 +0000 (12:30 +0000)]
Only release CPUs when they exist.

MFC after: 1 week
Sponsored by: DARPA, AFRL

7 years agoUse nitems to get the correct number of registers to read when dumping
andrew [Wed, 26 Oct 2016 12:29:56 +0000 (12:29 +0000)]
Use nitems to get the correct number of registers to read when dumping
them. Previously this would walk past the end of the array and print
whatever happened to be after the trapframe struct.

MFC after: 1 week
Sponsored by: DARPA, AFRL

7 years agoThe only consumer of pll1 is the CPU clock, we don't need to set it glitch free.
manu [Wed, 26 Oct 2016 08:47:35 +0000 (08:47 +0000)]
The only consumer of pll1 is the CPU clock, we don't need to set it glitch free.

Reported by: jmcneill
MFC after: 1 week

7 years agoLIBSTAND goes last, so put it last here too.
imp [Wed, 26 Oct 2016 05:26:59 +0000 (05:26 +0000)]
LIBSTAND goes last, so put it last here too.

7 years agoBack out the move to the loader script from -N. This should fix the
imp [Wed, 26 Oct 2016 05:26:58 +0000 (05:26 +0000)]
Back out the move to the loader script from -N. This should fix the
crypto-using boot problems.

7 years agohyperv/vmbus: Implement vmbus_chan_printf.
sephe [Wed, 26 Oct 2016 05:06:23 +0000 (05:06 +0000)]
hyperv/vmbus: Implement vmbus_chan_printf.

And use it for vmbus channel logging, which can log the channel
owner's name properly, instead of vmbus0.

Submitted by: QianYue You <t-youqi microsoft com>
MFC after: 1 week
Sponsored by: Microsoft

7 years agohyperv/vmbus: Add missing white space.
sephe [Wed, 26 Oct 2016 04:26:17 +0000 (04:26 +0000)]
hyperv/vmbus: Add missing white space.

Submitted by: QianYue You <t-youqi microsoft com>
MFC after: 1 week
Sponsored by: Microsoft

7 years agoFix two backwards tests.
imp [Tue, 25 Oct 2016 19:04:44 +0000 (19:04 +0000)]
Fix two backwards tests.

CID: 13652271365228

7 years agoAdd it to the right place
imp [Tue, 25 Oct 2016 19:04:42 +0000 (19:04 +0000)]
Add it to the right place

7 years agoAdd missing file
imp [Tue, 25 Oct 2016 18:57:25 +0000 (18:57 +0000)]
Add missing file

7 years agoUse binary and (&) instead of logical to extract the mask of a capability.
jhb [Tue, 25 Oct 2016 18:45:14 +0000 (18:45 +0000)]
Use binary and (&) instead of logical to extract the mask of a capability.

CID: 1365227
Submitted by: cem

7 years agoChange fs image name so it will not be regenerated (we
br [Tue, 25 Oct 2016 18:43:36 +0000 (18:43 +0000)]
Change fs image name so it will not be regenerated (we
have both big and little-endian images in tree).
Also we don't known the endianness of the platform the
image was generated on.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

7 years agouhso(4): Fix a null pointer dereference
cem [Tue, 25 Oct 2016 18:36:15 +0000 (18:36 +0000)]
uhso(4): Fix a null pointer dereference

The directly following m_defrag() call can wait, so there is no reason this
call can't as well.

Reported by: Coverity
CID: 1353551
Sponsored by: Dell EMC Isilon

7 years agoAdd MULTIDELAY support to the am335x dmtimer. This will be useful for
andrew [Tue, 25 Oct 2016 18:01:19 +0000 (18:01 +0000)]
Add MULTIDELAY support to the am335x dmtimer. This will be useful for
testing Cortex-A8 support in GENERIC.

Sponsored by: ABT Systems Ltd

7 years agoRemove the need for the delay to be zero when MULTIDELAY is undefined,
andrew [Tue, 25 Oct 2016 17:57:31 +0000 (17:57 +0000)]
Remove the need for the delay to be zero when MULTIDELAY is undefined,
it may be useful to only enable this in some configs.

Sponsored by: ABT Systems Ltd

7 years agoReally make WITHOUT_FORTH (MK_FORTH==no) work. The recent inclusion of
imp [Tue, 25 Oct 2016 17:31:57 +0000 (17:31 +0000)]
Really make WITHOUT_FORTH (MK_FORTH==no) work. The recent inclusion of
FICL definitions not in ficl/ficl32 files broke this generally. This
makes that stuff conditional on BOOT_FORTH. Also, move definitions
related to the architecture (FICL_CPUARCH and friends) into
Makefile.ficl that all parts of the tree that include files with ficl
need to include (but only if MK_FORTH == yes). In addition, had to fix
library ordering issue with LIBSTAND to keep it last. Without boot
forth, there's no references to memset to bring in memset.o from
libstand.a to satisfy libgeliboot.a's use of it. Listing libstand last
solves this issue (and it's the proper place for libstand to boot).

7 years agoFix unchecked array reference in the VGA device emulation code.
glebius [Tue, 25 Oct 2016 17:13:58 +0000 (17:13 +0000)]
Fix unchecked array reference in the VGA device emulation code.

Submitted by:   Ilja Van Sprundel <ivansprundel@ioactive.com>
Patch by: tychon
Security:       SA-16:32

7 years agoThe argument validation in r296956 was not enough to close all possible
glebius [Tue, 25 Oct 2016 17:13:46 +0000 (17:13 +0000)]
The argument validation in r296956 was not enough to close all possible
overflows in sysarch(2).

Submitted by: Kun Yang <kun.yang chaitin.com>
Patch by: kib
Security: SA-16:15

7 years agoRemove armadaxp_idcache_wbinv_all, it's a static function in the ELF
andrew [Tue, 25 Oct 2016 16:33:05 +0000 (16:33 +0000)]
Remove armadaxp_idcache_wbinv_all, it's a static function in the ELF
trampoline and not used outside this.

Sponsored by: ABT Systems Ltd

7 years agoBe more precise when including headers so that we're less likely to
marcel [Tue, 25 Oct 2016 16:29:15 +0000 (16:29 +0000)]
Be more precise when including headers so that we're less likely to
depend on namespace pollution and as such become more portable. This
means including headers like <sys/types.h> or <stdlib.h>, but also
making sure we include system/host headers before local headers.

While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR
on Linux.

With this, makefs is ready for compilation on macOS and Linux.

7 years agoCheck m_getcl() return value.
glebius [Tue, 25 Oct 2016 16:28:30 +0000 (16:28 +0000)]
Check m_getcl() return value.

CID: 611376

7 years agoRemove arm11x6_setttb and armv7_setttb as they are unused. While here
andrew [Tue, 25 Oct 2016 16:25:06 +0000 (16:25 +0000)]
Remove arm11x6_setttb and armv7_setttb as they are unused. While here
remove unneeded code from the ARMv7 cpu assembly code.

Sponsored by: ABT Systems Ltd

7 years agoAllow building makefs(8) from another Makefile (such as one in
marcel [Tue, 25 Oct 2016 16:21:38 +0000 (16:21 +0000)]
Allow building makefs(8) from another Makefile (such as one in
a seperate directory hierarchy used to build tools). This boils
down to replacing the use of ${.CURDIR} with either ${SRCDIR}
or ${SRCTOP}. SRCDIR is defined as the directory in which the
Makefile lives that bmake(1) is currently reading. Use SRCTOP
when reaching outside of makefs's directory.

7 years agoallwinner A10 Pll1 allow changing freq
manu [Tue, 25 Oct 2016 15:21:08 +0000 (15:21 +0000)]
allwinner A10 Pll1 allow changing freq

PLL1 is used by the cpu core, allowing changing freq is needed for cpufreq.
The factors table contains all the frequencies in the operating point table
present in the DTS.

MFC after: 1 week

7 years agoaccept4 actually expect SOCK_NONBLOCK and not O_NONBLOCK
bapt [Tue, 25 Oct 2016 15:20:06 +0000 (15:20 +0000)]
accept4 actually expect SOCK_NONBLOCK and not O_NONBLOCK

Reported by: jhb
Pointyhat to: bapt

7 years agoAdd better comment...
imp [Tue, 25 Oct 2016 14:42:09 +0000 (14:42 +0000)]
Add better comment...

7 years agoCreate a new PSCI error code and use it to signal that starting the CPU is
andrew [Tue, 25 Oct 2016 14:18:27 +0000 (14:18 +0000)]
Create a new PSCI error code and use it to signal that starting the CPU is
impossible as the PSCI firmware is missing.

Sponsored by: ABT Systmes Ltd

7 years agoImport the Cortex String memcpy and memmove into the kernel. On ThunderX
andrew [Tue, 25 Oct 2016 14:04:35 +0000 (14:04 +0000)]
Import the Cortex String memcpy and memmove into the kernel. On ThunderX
these show a 9-10% reduction in user and system time for a buildworld -j48.

Obtained from: ABT Systems Ltd
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

7 years agoFix the build on both arm64 and when WITHOUT_FORTH is defined.
andrew [Tue, 25 Oct 2016 14:01:13 +0000 (14:01 +0000)]
Fix the build on both arm64 and when WITHOUT_FORTH is defined.

 * On arm64 we need to use the ${MACHINE_CPUARCH} subdirectory.
 * env.c is only needed when using forth so only build it there.

Sponsored by: ABT Systems Ltd

7 years agoUpdate the armv6 tlb handling functions to detect if it is running on
andrew [Tue, 25 Oct 2016 13:45:59 +0000 (13:45 +0000)]
Update the armv6 tlb handling functions to detect if it is running on
hardware that supports the mp extensions. If so it should use the broadcast
tlb invalidate instructions as other CPUs or devices may need to know about
the invalidation.

To simplify the code have the compiler optimise out the else case when not
builing for Cortex-A8.

Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D8092

7 years agofix up r307903, use correct max address definition
avg [Tue, 25 Oct 2016 10:59:21 +0000 (10:59 +0000)]
fix up r307903, use correct max address definition

MFC after: 1 week
X-MFC with: r307903

7 years agovmm/svm: iopm_bitmap and msr_bitmap must be contiguous in physical memory
avg [Tue, 25 Oct 2016 10:34:14 +0000 (10:34 +0000)]
vmm/svm: iopm_bitmap and msr_bitmap must be contiguous in physical memory

To achieve that the whole svm_softc is allocated with contigmalloc now.
It would be more effient to de-embed those arrays and allocate only them
with contigmalloc.

Previously, if malloc(9) used non-contiguous pages for the arrays, then
random bits in physical pages next to the first page would be used to
determine permissions for I/O port and MSR accesses.  That could result
in a guest dangerously modifying the host hardware configuration.

One example is that sometimes NMI watchdog driver in a Linux guest
would be able to configure a performance counter on a host system.
The counter would generate an interrupt and if hwpmc(4) driver is loaded
on the host, then the interrupt would be delivered as an NMI.

Discussed with: jhb
Reviewed by: grehan
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8321

7 years agoMake the USB attach strings in dmesg include product name.
trasz [Tue, 25 Oct 2016 07:48:19 +0000 (07:48 +0000)]
Make the USB attach strings in dmesg include product name.

Note to self: MFC this to 9 and 8.

Reviewed by: hselasky@, imp@
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D8259

7 years agoFreeBSD tcp stack used to inform respective congestion control module about the
hiren [Tue, 25 Oct 2016 05:45:47 +0000 (05:45 +0000)]
FreeBSD tcp stack used to inform respective congestion control module about the
loss event but not use or obay the recommendations i.e. values set by it in some
cases.

Here is an attempt to solve that confusion by following relevant RFCs/drafts.
Stack only sets congestion window/slow start threshold values when there is no
CC module availalbe to take that action. All CC modules are inspected and
updated when needed to take appropriate action on loss.

tcp_stacks/fastpath module has been updated to adapt these changes.

Note: Probably, the most significant change would be to not bring congestion
window down to 1MSS on a loss signaled by 3-duplicate acks and letting
respective CC decide that value.

In collaboration with: Matt Macy <mmacy at nextbsd dot org>
Discussed on: transport@ mailing list
Reviewed by: jtl
MFC after: 1 month
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D8225

7 years agoUndo r307899. It needs a bit more work and proper commit log.
hiren [Tue, 25 Oct 2016 05:07:51 +0000 (05:07 +0000)]
Undo r307899. It needs a bit more work and proper commit log.

7 years agoIn Collaboration with: Matt Macy <mmacy at nextbsd dot com>
hiren [Tue, 25 Oct 2016 05:03:33 +0000 (05:03 +0000)]
In Collaboration with:     Matt Macy <mmacy at nextbsd dot com>
Reviewed by:     jtl
Sponsored by:     Limelight Networks
Differential Revision:     https://reviews.freebsd.org/D8225

7 years agoUse proper if_getdrvflags() API.
bdrewery [Tue, 25 Oct 2016 03:55:56 +0000 (03:55 +0000)]
Use proper if_getdrvflags() API.

This is a NOP.

Sponsored by: Dell EMC Isilon

7 years agohyperv/hn: Set baudrate properly
sephe [Tue, 25 Oct 2016 01:41:39 +0000 (01:41 +0000)]
hyperv/hn: Set baudrate properly

PR: 208931
Submitted by: Eugene Grosbein <ports grosbein net>
Reported by: Eugene Grosbein <ports grosbein net>
MFC after: 1 week
Sponsored by: Microsoft

7 years agoFix a typo which broke the build for powerpc.
jhibbits [Tue, 25 Oct 2016 01:32:35 +0000 (01:32 +0000)]
Fix a typo which broke the build for powerpc.

It's spelled LIBC_SRCTOP not LIBC_SRC.

Pointy-hat to: jhibbits
Reported by: kib

7 years agoFix the man page to reflect the change done by r307890 to mountd.c
rmacklem [Tue, 25 Oct 2016 00:59:23 +0000 (00:59 +0000)]
Fix the man page to reflect the change done by r307890 to mountd.c
so that the "-n" option uses the sysctl for the new NFS server.
This is a content change.

PR: 213450
Submitted by: rs@bytecamp.net
MFC after: 2 weeks

7 years agomountd(8) was erroneously setting the sysctl for the old NFS server
rmacklem [Tue, 25 Oct 2016 00:52:42 +0000 (00:52 +0000)]
mountd(8) was erroneously setting the sysctl for the old NFS server
when the new/default NFS server was running, for the "-n" option.

This patch fixes the problem for head and stable/11. For stable/10 the
patch will need to be modified when MFC'd, since the stable/10 mountd.c
handles both old and new NFS servers.
Since the new NFS server uses vfs.nfsd.nfs_privport == 0 by default,
there wouldn't have been many users affected by the code not setting
it to 0 when the "-n" option was specified.

PR: 213450
Submitted by: rs@bytecamp.net
MFC after: 2 weeks

7 years agoEnable driver for SY8106A Buck Regulator.
jmcneill [Mon, 24 Oct 2016 22:35:45 +0000 (22:35 +0000)]
Enable driver for SY8106A Buck Regulator.

7 years agoDefer cpufreq updates from intr handler to the taskqueue_thread queue.
jmcneill [Mon, 24 Oct 2016 22:35:12 +0000 (22:35 +0000)]
Defer cpufreq updates from intr handler to the taskqueue_thread queue.

7 years agoFix ip_output() on point-to-point links
rstone [Mon, 24 Oct 2016 22:11:33 +0000 (22:11 +0000)]
Fix ip_output() on point-to-point links

In r304435, ip_output() was changed to use the result of the route
lookup to decide whether the outgoing packet was a broadcast or
not.  This introduced a regression on interfaces where
IFF_BROADCAST was not set (e.g. point-to-point links), as the
algorithm could incorrectly treat the destination address as a
broadcast address, and ip_output() would subsequently drop the
packet as broadcasting on a non-IFF_BROADCAST interface is not
allowed.

Differential Revision: https://reviews.freebsd.org/D8303
Reviewed by: jtl
Reported by: ambrisko
MFC after: 2 weeks
X-MFC-With: r304435
Sponsored by: Dell EMC Isilon

7 years agoBelatedly revert r303119, which was determined to not be
gjb [Mon, 24 Oct 2016 21:16:21 +0000 (21:16 +0000)]
Belatedly revert r303119, which was determined to not be
needed.

Sponsored by: The FreeBSD Foundation

7 years agoAdd needed cpu-supply property for cpufreq.
manu [Mon, 24 Oct 2016 21:09:48 +0000 (21:09 +0000)]
Add needed cpu-supply property for cpufreq.

Patch is merged upstream, in the meantime add it in our DTS.

7 years agoFix a regression introduced in SVN r256678 that breaks USM header parsing
syrinx [Mon, 24 Oct 2016 21:05:23 +0000 (21:05 +0000)]
Fix a regression introduced in SVN r256678 that breaks USM header parsing

Reviewed by: bz@

7 years agokrping: Allow the underlying ib_device to handle DMA mappings.
np [Mon, 24 Oct 2016 20:53:44 +0000 (20:53 +0000)]
krping: Allow the underlying ib_device to handle DMA mappings.

Submitted by: Vijay Singh @ Netapp

7 years agoFollow-up to r307866:
kib [Mon, 24 Oct 2016 20:47:46 +0000 (20:47 +0000)]
Follow-up to r307866:
- Make !KDB config buildable.
- Simplify interface to nmi_handle_intr() by evaluating panic_on_nmi
  in one place, namely nmi_call_kdb().  This allows to remove do_panic
  argument from the functions, and to remove i386/amd64 duplication of
  the variable and sysctl definitions.  Note that now NMI causes
  panic(9) instead of trap_fatal() reporting and then panic(9),
  consistently for NMIs delivered while CPU operated in ring 0 and 3.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoPreliminary support for EFI in boot loader. Define efi-boot forth
imp [Mon, 24 Oct 2016 20:36:54 +0000 (20:36 +0000)]
Preliminary support for EFI in boot loader. Define efi-boot forth
environment variable to allow conditional compilation based on EFI
being present or not. Provide efi-setenv, efi-getenv, and
efi-unsetenv, though those need improvement. Move the efi definition
to libefi (but include a reference so they get included).

7 years agoallwinner: Add support for P2WI in RSB driver
manu [Mon, 24 Oct 2016 20:33:42 +0000 (20:33 +0000)]
allwinner: Add support for P2WI in RSB driver

Push-Pull Two Wire interface is a almost compatible iic like bus used
in sun6i SoC. It's only use is to communicate with the power management IC.

Reviewed by: jmcneill
MFC after: 1 week
Relnotes: yes

7 years agocxgbe(4): Fix bug in the calculation of the number of physically
np [Mon, 24 Oct 2016 19:09:56 +0000 (19:09 +0000)]
cxgbe(4): Fix bug in the calculation of the number of physically
contiguous regions in an mbuf chain.

If the payload of an mbuf ends at a page boundary count_mbuf_nsegs would
incorrectly consider the next mbuf's payload physically contiguous based
solely on a KVA comparison.

MFC after: 1 week
Sponsored by: Chelsio Communications

7 years agoInclude <sys/types.h> explicitly instead of depending on that
marcel [Mon, 24 Oct 2016 18:12:57 +0000 (18:12 +0000)]
Include <sys/types.h> explicitly instead of depending on that
header being included by <sys/param.h>. When compiled as part
of makefs(8) and on macOS or Linux, <sys/param.h> is not our
own.

7 years agoInclude <stdarg.h> instead of <machine/stdarg.h> when compiled as
marcel [Mon, 24 Oct 2016 18:03:04 +0000 (18:03 +0000)]
Include <stdarg.h> instead of <machine/stdarg.h> when compiled as
part of libsbuf. The former is the standard header, and allows us
to compile libsbuf on macOS/linux.

7 years agoDetect clang on macOS. The version string is slightly different.
marcel [Mon, 24 Oct 2016 17:59:25 +0000 (17:59 +0000)]
Detect clang on macOS. The version string is slightly different.

7 years agoInclude "util.h", not <util.h>. The header is in the same directory
marcel [Mon, 24 Oct 2016 17:57:46 +0000 (17:57 +0000)]
Include "util.h", not <util.h>. The header is in the same directory
as the C file. There may be a <util.h> on the host when compiling
on macOS or Linux, causing conflicts.

7 years agoWhen compiling on macOS or Linux, __dead can be defined already.
marcel [Mon, 24 Oct 2016 17:56:08 +0000 (17:56 +0000)]
When compiling on macOS or Linux, __dead can be defined already.
Conditionally define __dead.

7 years agoFix typo.
kib [Mon, 24 Oct 2016 17:37:21 +0000 (17:37 +0000)]
Fix typo.

Submitted by: alc
MFC after: 3 days

7 years agoHandle broadcast NMIs.
kib [Mon, 24 Oct 2016 16:40:27 +0000 (16:40 +0000)]
Handle broadcast NMIs.

On several Intel chipsets, diagnostic NMIs sent from BMC or NMIs
reporting hardware errors are broadcasted to all CPUs.

When kernel is configured to enter kdb on NMI, the outcome is
problematic, because each CPU tries to enter kdb.  All CPUs are
executing NMI handlers, which set the latches disabling the nested NMI
delivery; this means that stop_cpus_hard(), used by kdb_enter() to
stop other cpus by broadcasting IPI_STOP_HARD NMI, cannot work.  One
indication of this is the harmless but annoying diagnostic "timeout
stopping cpus".

Much more harming behaviour is that because all CPUs try to enter kdb,
and if ddb is used as debugger, all CPUs issue prompt on console and
race for the input, not to mention the simultaneous use of the ddb
shared state.

Try to fix this by introducing a pseudo-lock for simultaneous attempts
to handle NMIs.  If one core happens to enter NMI trap handler, other
cores see it and simulate reception of the IPI_STOP_HARD.  More,
generic_stop_cpus() avoids sending IPI_STOP_HARD and avoids waiting
for the acknowledgement, relying on the nmi handler on other cores
suspending and then restarting the CPU.

Since it is impossible to detect at runtime whether some stray NMI is
broadcast or unicast, add a knob for administrator (really developer)
to configure debugging NMI handling mode.

The updated patch was debugged with the help from Andrey Gapon (avg)
and discussed with him.

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

7 years agoloader should boot pre-feature flags pools.
tsoome [Mon, 24 Oct 2016 16:28:54 +0000 (16:28 +0000)]
loader should boot pre-feature flags pools.

The feature flags chek is missing the corner case where we have valid pool
version, but feature flags are not enabled - as for example plain v28 pool.

This update does fix the boot support for such pools.

Reviewed by: avg, allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D8331

7 years agoMove the LLVM-based libgcc_s to /lib
emaste [Mon, 24 Oct 2016 14:56:13 +0000 (14:56 +0000)]
Move the LLVM-based libgcc_s to /lib

When enabled, it should install in the same location as the existing
library.

Reported by: antoine

7 years agoSet SHLIBDIR before .including src.opts.mk in libcapser services
emaste [Mon, 24 Oct 2016 14:37:18 +0000 (14:37 +0000)]
Set SHLIBDIR before .including src.opts.mk in libcapser services

bsd.own.mk (included from src.opts.mk) sets SHLIBDIR?=${LIBDIR}, so
SHLIBDIR must be set before including either one of them.

MFC with: 305626
Sponsored by: The FreeBSD Foundation

7 years agoRevert 307822
manu [Mon, 24 Oct 2016 14:24:12 +0000 (14:24 +0000)]
Revert 307822

P2WI is almost compatible with RSB which we already support.
I'll add support for P2WI in aw_rsb instead.

Discussed with:  jmcneill

7 years agoMFV r307859:
mm [Mon, 24 Oct 2016 14:08:05 +0000 (14:08 +0000)]
MFV r307859:
Update libarchive to 3.2.2

7 years agoIncrease CACHE_LINE_SHIFT to 7 as cache lines are 128 bytes on ThunderX.
andrew [Mon, 24 Oct 2016 13:44:24 +0000 (13:44 +0000)]
Increase CACHE_LINE_SHIFT to 7 as cache lines are 128 bytes on ThunderX.

MFC after: 1 week
Sponsored by: ABT Systems Ltd

7 years agoFix panic after ZVOL renamed to name invalid for DEVFS.
mav [Mon, 24 Oct 2016 12:24:24 +0000 (12:24 +0000)]
Fix panic after ZVOL renamed to name invalid for DEVFS.

MFC after: 2 weeks

7 years agohyperv/ic: Rework framework/message version negotiation.
sephe [Mon, 24 Oct 2016 05:36:19 +0000 (05:36 +0000)]
hyperv/ic: Rework framework/message version negotiation.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Modified by: sephe
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8280

7 years agohyperv/hn: Nuke unused forward declaration.
sephe [Mon, 24 Oct 2016 05:20:02 +0000 (05:20 +0000)]
hyperv/hn: Nuke unused forward declaration.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8314