freebsd.git
9 years agoRemove duplicated -I.
obrien [Fri, 27 Feb 2015 22:20:07 +0000 (22:20 +0000)]
Remove duplicated -I.

9 years agoUpdate r279018 so it only applies to Clang version 3.5+ and not 3.4.[1-9].
obrien [Fri, 27 Feb 2015 22:18:33 +0000 (22:18 +0000)]
Update r279018 so it only applies to Clang version 3.5+ and not 3.4.[1-9].

9 years agoThese CTF tools do not use anything from libctf, so no need to link with it.
obrien [Fri, 27 Feb 2015 22:10:31 +0000 (22:10 +0000)]
These CTF tools do not use anything from libctf, so no need to link with it.

9 years agoFix I/O size calculation for pass(4) driver requests and add latency
ken [Fri, 27 Feb 2015 21:35:36 +0000 (21:35 +0000)]
Fix I/O size calculation for pass(4) driver requests and add latency
tracking.

It is important to subtract the residual from the requested
transfer size to see how much data was actually transferred.  With
tape drives in particular, it is common to request more data than is
returned.

Also, add I/O latency tracking for CAM requests issued by
cam_periph_runccb().

If the caller supplies a struct devstat, and the I/O is a SCSI or
ATA I/O, we will track the elapsed time to provide I/O latency
statistics for the request.

sys/cam/scsi/cam_periph.c:
In cam_periph_runccb(), subtract the residual when reporting I/O
totals to devstat(9) for SCSI and ATA passthrough requests.

In cam_periph_runccb(), grab the I/O start time and supply
the start time to devstat_end_transaction() so that it can
calculate the elapsed I/O time.

Sponsored by: Spectra Logic
MFC after: 1 week

9 years agoMake sched_random() return an unsigned number, and use uint32_t
imp [Fri, 27 Feb 2015 21:15:12 +0000 (21:15 +0000)]
Make sched_random() return an unsigned number, and use uint32_t
consistently. This also matches the per-cpu pointer declaration
anyway.

This changes the tweak we give to the load from -32..31 to be 0..31
which seems more inline with the rest of the code (- rnd and the -=
64). It should also provide the randomness we need, and may fix a
signedness bug in the old code (it isn't clear that the effect was
intentional as opposed to sloppy, and the right shift of a signed
value is undefined to boot).

This stores sched_balance() behavior when it used random().

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

9 years agoUse appropriate alternative to -msoft-float for clang-built PowerPC kernels.
nwhitehorn [Fri, 27 Feb 2015 20:32:50 +0000 (20:32 +0000)]
Use appropriate alternative to -msoft-float for clang-built PowerPC kernels.

9 years agoFix unitialized variable.
nwhitehorn [Fri, 27 Feb 2015 20:32:09 +0000 (20:32 +0000)]
Fix unitialized variable.

9 years agoAllow creating subclass of FDT simplebus
jchandra [Fri, 27 Feb 2015 20:11:02 +0000 (20:11 +0000)]
Allow creating subclass of FDT simplebus

Provide sys/dev/fdt/simplebus.h with the class declaration so that it
is possible to subclass FDT simplebus.

Differential Revision: https://reviews.freebsd.org/D1886
Reviewed by: nwhitehorn, imp

9 years agoFix typo. Note that this is mostly innocent, since libthr no longer
kib [Fri, 27 Feb 2015 19:23:01 +0000 (19:23 +0000)]
Fix typo.  Note that this is mostly innocent, since libthr no longer
interposes the symbol.

Noted by: rpaulo
MFC after: 3 days

9 years agoSet altroot if the user have specified it via -o altroot.
delphij [Fri, 27 Feb 2015 19:13:13 +0000 (19:13 +0000)]
Set altroot if the user have specified it via -o altroot.

MFC after: 2 weeks

9 years agoUse m_getjcl() instead of old mbuf(9) KPIs.
glebius [Fri, 27 Feb 2015 19:12:35 +0000 (19:12 +0000)]
Use m_getjcl() instead of old mbuf(9) KPIs.

Tested by: royger

9 years agoWhen a file is executed and the path starts with `/', AT_EXECPATH is set
jkim [Fri, 27 Feb 2015 19:05:23 +0000 (19:05 +0000)]
When a file is executed and the path starts with `/', AT_EXECPATH is set
without any translation.  If the file is a symbolic link, $ORIGIN may not be
expanded to the actual origin.  Use realpath(3) to properly expand $ORIGIN
to its absolute path.

Reviewed by: kib
MFC after: 1 week

9 years agoeui64_line(): plug memory leak.
pfg [Fri, 27 Feb 2015 18:13:06 +0000 (18:13 +0000)]
eui64_line(): plug memory leak.

CID: 978412
Reviewed by: brooks, delphij
CodeReview: https://reviews.freebsd.org/D1976

9 years agoThe VNASSERT in vflush() FORCECLOSE case is trying to panic early to
kib [Fri, 27 Feb 2015 16:43:50 +0000 (16:43 +0000)]
The VNASSERT in vflush() FORCECLOSE case is trying to panic early to
prevent errors from yanking devices out from under filesystems.  Only
care about special vnodes on devfs, special nodes on other kinds of
filesystems do not have special properties.

Sponsored by:  EMC / Isilon Storage Division
Submitted by:   Conrad Meyer
MFC after: 1 week

9 years agoAllow the kern.osrelease and kern.osreldate sysctl values to be set in a
ian [Fri, 27 Feb 2015 16:28:55 +0000 (16:28 +0000)]
Allow the kern.osrelease and kern.osreldate sysctl values to be set in a
jail's creation parameters.  This allows the kernel version to be reliably
spoofed within the jail whether examined directly with sysctl or
indirectly with the uname -r and -K options.

The values can only be set at jail creation time, to eliminate the need
for any locking when accessing the values via sysctl.

The overridden values are inherited by nested jails (unless the config for
the nested jails also overrides the values).

There is no sanity or range checking, other than disallowing an empty
release string or a zero release date, by design.  The system
administrator is trusted to set sane values.  Setting values that are
newer than the actual running kernel will likely cause compatibility
problems.

Differential Revision: https://reviews.freebsd.org/D1948
Relnotes: yes

9 years agoDetect, report and use 8-bit bus if is available.
ian [Fri, 27 Feb 2015 15:47:30 +0000 (15:47 +0000)]
Detect, report and use 8-bit bus if is available.

Differential Revision: https://reviews.freebsd.org/D1921
Submitted by: Michal Meloun

9 years agoMMC: Signal HC capability to (e)MMC.
ian [Fri, 27 Feb 2015 15:14:25 +0000 (15:14 +0000)]
MMC: Signal HC capability to (e)MMC.

Summary:
For new eMMC chips, we must signal controller HC capability in OP_COND command.

Reviewers: imp, ian

Reviewed By: ian

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

9 years agoFix sched_ule on sparc64, gcc complains sched_random is not a correct
andrew [Fri, 27 Feb 2015 15:05:20 +0000 (15:05 +0000)]
Fix sched_ule on sparc64, gcc complains sched_random is not a correct
prototype.

Sponsored by: The FreeBSD Foundation

9 years agoRemove SMP support from the Wandboard-Solo and have it run as part of
andrew [Fri, 27 Feb 2015 12:40:44 +0000 (12:40 +0000)]
Remove SMP support from the Wandboard-Solo and have it run as part of
universe as a config with sched_ule but without SMP.

Sponsored by: The FreeBSD Foundation

9 years agosched_random is only called for SMP, only define it there.
andrew [Fri, 27 Feb 2015 12:38:24 +0000 (12:38 +0000)]
sched_random is only called for SMP, only define it there.

Sponsored by: The FreeBSD Foundation

9 years agoSince all generations of Intel CPUs have errata which causes hang on
kib [Fri, 27 Feb 2015 11:13:46 +0000 (11:13 +0000)]
Since all generations of Intel CPUs have errata which causes hang on
the cache line flush in the LAPIC page, keep direct map page covering
LAPIC mapped uncached.

To have the (incomplete) check for the LAPIC range in
pmap_invalidate_cache_range() working, lapic_paddr must be initialized
in x2APIC mode too.

Sponsored by: The FreeBSD Foundation
MFC after: 2 months

9 years agosfxge: expect required init_state on data path and in periodic calls
arybchik [Fri, 27 Feb 2015 07:39:09 +0000 (07:39 +0000)]
sfxge: expect required init_state on data path and in periodic calls

With the patch applied the number of instruction events is 1% less and
number of mispredicted branch events is 5% less under multistream TCP
traffic load close to line rate.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)

9 years agoFix kern/196290 - don't announce 11n HTINFO rates if the channel is
adrian [Fri, 27 Feb 2015 04:45:47 +0000 (04:45 +0000)]
Fix kern/196290 - don't announce 11n HTINFO rates if the channel is
configured as 11b.

This came up when debugging other issues surrounding scanning and
channel modes.

What's going on:

* The VAP comes up as an 11b VAP, but on an 11n capable NIC;
* .. it announces HTINFO and MCS rates;
* The AP thinks it's an 11n capable device and transmits 11n frames
  to the STA;
* But the STA is in 11b mode, and thus doesn't receive/ACK the frames.

It didn't happen for the ath(4) devices as the AR5416/AR9300 HALs
unconditionally enable MCS frame reception, even if the channel
mode is not 11n.  But the Intel NICs are configured in 11b/11a/11g
modes when doing those, even if 11n is enabled and available.

So, don't announce 11n capabilities if the VAP isn't on an 11n
channel when sending management assocation request / reassociation
request frames.

TODO:

* Lots more testing - 11n should be "upgraded" after association,
  and I just want to make sure I haven't broken 11n upgrade.
  I shouldn't have - this is only happening for /sending/ association
  requests, which APs aren't doing.

Tested:

* ath(4) APs (AR9331, AR7161+AR9280, AR934x)
* AR5416, STA mode
* Intel 5100, STA mode

PR: kern/196290

9 years agoCreate sched_rand() and move the LCG code into that. Call this when
imp [Fri, 27 Feb 2015 02:56:58 +0000 (02:56 +0000)]
Create sched_rand() and move the LCG code into that. Call this when
we need randomness in ULE. This removes random() call from the
rebalance interval code.

Submitted by: Harrison Grundy
Differential Revision: https://reviews.freebsd.org/D1968

9 years agoRemove an obsolete comment in devstat(3) about the accuracy of the
ken [Fri, 27 Feb 2015 02:44:12 +0000 (02:44 +0000)]
Remove an obsolete comment in devstat(3) about the accuracy of the
milliseconds per transaction (DSM_MS_PER_TRANSACTION) calculation.

The comment was accurate many years ago when the kernel didn't
record I/O times on a per-I/O basis, but now that we do collect
that information in most areas, it isn't correct.

The milliseconds per transaction values are correct, assuming the
I/O duration has been recorded.

Sponsored by: Spectra Logic
MFC after: 3 days

9 years agoMove PCI bus below simplebus for Broadcom XLP
jchandra [Fri, 27 Feb 2015 02:21:52 +0000 (02:21 +0000)]
Move PCI bus below simplebus for Broadcom XLP

This will enable us to do common allocation code for memory and
interrupts for SoC devices as well as PCI devices.

9 years agoHint out check for unsigned negative values.
pfg [Fri, 27 Feb 2015 01:59:29 +0000 (01:59 +0000)]
Hint out check for unsigned negative values.

On FreeBSD socklen_t is unsigned so the check negative len
in inet6_opt_append() is redundant and likely to be optimized
away by the compiler.

On other operating systems this is not necessarily so, and
in the future we may want to sign it so leave the check in
but place it in a secondary position as a subtle indication
that the bogus check is intentional.

Discussed with: rpaulo

CID: 1017783

9 years agoHide struct ifmultiaddr under _KERNEL, too.
glebius [Fri, 27 Feb 2015 01:15:23 +0000 (01:15 +0000)]
Hide struct ifmultiaddr under _KERNEL, too.

9 years agoImprove additional interrupt ACK for Broadcom XLP
jchandra [Fri, 27 Feb 2015 00:57:09 +0000 (00:57 +0000)]
Improve additional interrupt ACK for Broadcom XLP

Handling some interrupts in XLP (like PCIe and SATA) involves writing to
vendor specific registers as part of interrupt acknowledgement.

This was earlier done with xlp_establish_intr(), but a better solution
is to provide a function xlp_set_bus_ack() that can be used with
cpu_establish_hardintr(). This will allow platform initialization code to
setup these ACKs without changing the standrard drivers.

9 years agoAdd casting to make atomic ops work for pointers. (Apparently nobody has
ian [Thu, 26 Feb 2015 23:05:46 +0000 (23:05 +0000)]
Add casting to make atomic ops work for pointers.  (Apparently nobody has
ever done atomic ops on pointers before now on arm).

Submitted by: Svatopluk Kraus <onwahe@gmail.com>

9 years agoAdd FreeBSD stable/10 version checks for the availability of the
ken [Thu, 26 Feb 2015 22:22:06 +0000 (22:22 +0000)]
Add FreeBSD stable/10 version checks for the availability of the
CDAI_FLAG_NONE advanced information CCB flag.

Support for the flag was merged to stable/10 in r279329, and the
__FreeBSD_version in stable/10 was bumped to 1001510.

Check for that version in the mps(4) and mpr(4) drivers when determining
whether to use the flag.

Sponsored by: Spectra Logic
MFC after: 3 days

9 years agoFix unitialized variable that broke sh on PowerPC starting with r278826.
nwhitehorn [Thu, 26 Feb 2015 20:59:18 +0000 (20:59 +0000)]
Fix unitialized variable that broke sh on PowerPC starting with r278826.

9 years agoSupport CROSS_BINUTILS_PREFIX with in-tree compiler
emaste [Thu, 26 Feb 2015 20:02:29 +0000 (20:02 +0000)]
Support CROSS_BINUTILS_PREFIX with in-tree compiler

Reviewed by: bapt, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D1974

9 years agoUse pthread_mutex_trylock(3) to implement mtx_trylock(3).
kib [Thu, 26 Feb 2015 16:39:57 +0000 (16:39 +0000)]
Use pthread_mutex_trylock(3) to implement mtx_trylock(3).

Noted and tested by: Vineela <vineela_17@yahoo.com>
PR: 198050
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 years agoxen/intr: fix fallout from r278854
royger [Thu, 26 Feb 2015 16:05:09 +0000 (16:05 +0000)]
xen/intr: fix fallout from r278854

r278854 introduced a race in the event channel handling code. We must make
sure that the pending bit is cleared before executing the filter, or else we
might miss other events that would be injected after the filter has ran but
before the pending bit is cleared.

While there also mask event channels while FreeBSD executes the ithread
bound to that event channel. This refrains Xen from injecting more
interrupts while the ithread has not finished it's work.

Sponsored by: Citrix Systems R&D
Reported by: sbruno, robak
Tested by: robak

9 years agoWhen gpart(8) is trying automatically determine the first available
ae [Thu, 26 Feb 2015 15:59:45 +0000 (15:59 +0000)]
When gpart(8) is trying automatically determine the first available
block of free space after existing partition, take into account
provider's stripeoffset, since the result will be adjusted to this
value.

PR: 197989
MFC after: 1 week

9 years agoUse LIBADD.
trasz [Thu, 26 Feb 2015 15:48:20 +0000 (15:48 +0000)]
Use LIBADD.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoMake the uefikeys script output slightly more obvious.
trasz [Thu, 26 Feb 2015 14:22:27 +0000 (14:22 +0000)]
Make the uefikeys script output slightly more obvious.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoFor some uniformity move ahci_ch_init() call under the lock.
mav [Thu, 26 Feb 2015 12:51:05 +0000 (12:51 +0000)]
For some uniformity move ahci_ch_init() call under the lock.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

9 years agoImplements EOI suppression mode, where LAPIC on EOI command for
kib [Thu, 26 Feb 2015 11:02:40 +0000 (11:02 +0000)]
Implements EOI suppression mode, where LAPIC on EOI command for
level-triggered interrupt does not broadcast the EOI message to all
APICs in the system.  Instead, interrupt handler must follow LAPIC EOI
with IOAPIC EOI.  For modern IOAPICs, the later is done by writing to
EOIR register.  Otherwise, Intel provided Linux with a trick of
temporary switching the pin config to edge and then back to level.

Detect presence of EOIR register by reading IO-APIC version.  The
summary table in the comments was taken from the Linux kernel.  For
Intel, newer IO-APICs are only briefly documented as part of the
ICH/PCH datasheet.  According to the BKDG and chipset documentation,
AMD LAPICs do not provide EOI suppression, althought IO-APICs do
declare version 0x21 and implement EOIR.

The trick to temporary switch pin to edge mode to clear IRR was tested
on modern chipset, by pretending that EOIR is not present, i.e. by
forcing io_haseoi to zero.

Tunable hw.lapic_eoi_suppression disables the optimization.

Reviewed by: neel
Tested by: pho
Review: https://reviews.freebsd.org/D1943
Sponsored by: The FreeBSD Foundation
MFC after: 2 months

9 years agoCheck that the pointer to the thread return value is not NULL before
kib [Thu, 26 Feb 2015 09:42:03 +0000 (09:42 +0000)]
Check that the pointer to the thread return value is not NULL before
dereferencing. NULL is allowed by C11 and must be handled.

Reported and tested by: Vineela <vineela_17@yahoo.com>
PR: 198038
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 years agoAdd key/cert generation script for uefisign(8).
trasz [Thu, 26 Feb 2015 09:31:25 +0000 (09:31 +0000)]
Add key/cert generation script for uefisign(8).

(Forgot about Relnotes in the commit that added uefisign(8), so set it here.)

MFC after: 1 month
Relnotes: yes
Sponsored by: The FreeBSD Foundation

9 years agoAdd uefisign(8) reference to uefi(8) manual page.
trasz [Thu, 26 Feb 2015 09:16:36 +0000 (09:16 +0000)]
Add uefisign(8) reference to uefi(8) manual page.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoAdd uefisign(8), UEFI Secure Boot signing utility.
trasz [Thu, 26 Feb 2015 09:15:24 +0000 (09:15 +0000)]
Add uefisign(8), UEFI Secure Boot signing utility.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoAdd missing error check.
trasz [Thu, 26 Feb 2015 09:08:48 +0000 (09:08 +0000)]
Add missing error check.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoFix a number of -Wcast-qual warnings under sys/arm. No functional
dim [Thu, 26 Feb 2015 07:47:35 +0000 (07:47 +0000)]
Fix a number of -Wcast-qual warnings under sys/arm.  No functional
change.

Submitted by: andrew
MFC after: 3 days

9 years agoIn sys/arm/ti/am335x/am335x_rtc.c, fix a clang 3.6.0 warning about
dim [Thu, 26 Feb 2015 07:45:40 +0000 (07:45 +0000)]
In sys/arm/ti/am335x/am335x_rtc.c, fix a clang 3.6.0 warning about
am33x_rtc_softc::sc_irq_res (which is an array) never being NULL.

Submitted by: andrew
MFC after: 3 days

9 years agoSince newer versions of compiler-rt require unwind.h, and we want to use
dim [Thu, 26 Feb 2015 07:42:16 +0000 (07:42 +0000)]
Since newer versions of compiler-rt require unwind.h, and we want to use
the copy in libcxxrt for it, fix the arm-specific header to define the
_Unwind_Action type.

Submitted by: andrew
MFC after: 3 days

9 years agoMake libcxxrt's parsing of DWARF exception handling tables work on
dim [Thu, 26 Feb 2015 07:20:05 +0000 (07:20 +0000)]
Make libcxxrt's parsing of DWARF exception handling tables work on
architectures with strict alignment, by using memcpy() instead of
directly reading fields.

Reported by: Daisuke Aoyama <aoyama@peach.ne.jp>
Reviewed by: imp, bapt
Tested by: bapt
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D1967

9 years agoRemove run-time allocation of XLP IRQs
jchandra [Thu, 26 Feb 2015 02:22:47 +0000 (02:22 +0000)]
Remove run-time allocation of XLP IRQs

Follow the same static IRQ to Interrupt Table Entry mapping as the other
OS supported on XLP.

9 years agoAdd netlogic,xlp-pic as interrupt controller for XLP
jchandra [Thu, 26 Feb 2015 02:05:45 +0000 (02:05 +0000)]
Add netlogic,xlp-pic as interrupt controller for XLP

Add an empty driver for netlogic,xlp-pic to ensure that the device tree
is correct and has an interrupt controller.

9 years agoFix up interrupt definitions for Broadcom XLP
jchandra [Thu, 26 Feb 2015 01:53:24 +0000 (01:53 +0000)]
Fix up interrupt definitions for Broadcom XLP

Gather all the IRQ definitions to interrupt.h. Earlier these were in xlp.h
and pic.h.  Update the definition of XLP_IRQ_IS_PICINTR to check for last
irq as well.

9 years agoGNU nm: Avoid NULL dereference
emaste [Wed, 25 Feb 2015 22:12:37 +0000 (22:12 +0000)]
GNU nm: Avoid NULL dereference

bfd_dwarf2_find_line() calls find_line() with NULL functionname_ptr,
which resulted in a crash on certain ELF objects.

This change was implemented independently from upstream binutils, but
I have checked that the crash does not happen there.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

9 years agoRemove taskqueue_start_threads_pinned(); there's noa generic cpuset version of this.
adrian [Wed, 25 Feb 2015 21:59:03 +0000 (21:59 +0000)]
Remove taskqueue_start_threads_pinned(); there's noa generic cpuset version of this.

Sponsored by: Norse Corp, Inc.

9 years agoMigrate using CPU_ZERO() + CPU_SET() -> CPU_SETOF().
adrian [Wed, 25 Feb 2015 21:44:53 +0000 (21:44 +0000)]
Migrate using CPU_ZERO() + CPU_SET() -> CPU_SETOF().

Tested:

* ixgbe, igb, RSS enabled

Submitted by: jhb
Sponsored by: Norse Corp, Inc.

9 years agonm: avoid crash in print_lineno if func->name is NULL
emaste [Wed, 25 Feb 2015 21:43:09 +0000 (21:43 +0000)]
nm: avoid crash in print_lineno if func->name is NULL

This can occur when DW_AT_specification is used to refer to another DIE
that provides the actual DW_AT_name string. For example:

< 3><0x00000086> DW_TAG_subprogram
                   DW_AT_name              PrettyStackTraceEntry
...
< 1><0x00002cf4> DW_TAG_subprogram
                   DW_AT_specification     <0x00000086>

We will need to add support for DW_AT_specification, but in the interim
we should not segfault.

Obtained from: Elftoolchain (r3170)
Sponsored by: The FreeBSD Foundation

9 years agoUpdate to upstream version 2.10
hselasky [Wed, 25 Feb 2015 21:10:03 +0000 (21:10 +0000)]
Update to upstream version 2.10

The most notable new feature is support for definition files.

Obtained from: http://dotat.at/prog/unifdef
MFC after: 1 week

9 years agoExplicitly crypt_set_format("des") and bail out if we
delphij [Wed, 25 Feb 2015 20:47:25 +0000 (20:47 +0000)]
Explicitly crypt_set_format("des") and bail out if we
can't.  This would prevent problem when we changed the
default crypt(3) algorithm or removed it in the future.

PR: bin/189958
MFC after: 1 month

9 years agoFix "netstat -hdw 1" output.
marcel [Wed, 25 Feb 2015 17:06:27 +0000 (17:06 +0000)]
Fix "netstat -hdw 1" output.

Reported by: np@

9 years agoFor now, disable x2APIC mode when Xen is detected, even if CPU
kib [Wed, 25 Feb 2015 16:44:07 +0000 (16:44 +0000)]
For now, disable x2APIC mode when Xen is detected, even if CPU
declares support for it.  Newer versions of Xen works fine with x2APIC
code, but e.g. Xen 4.2 delivers GPF on the LAPIC MSR write, despite
x2APIC mode being known to hypervisor.

Discussed with: royger
Sponsored by: The FreeBSD Foundation

9 years agoPropagate errors from _thr_umutex_unlock2 through mutex_unlock_common.
kib [Wed, 25 Feb 2015 16:18:26 +0000 (16:18 +0000)]
Propagate errors from _thr_umutex_unlock2 through mutex_unlock_common.

Errors from _thr_umutex_unlock2 should "never happen" in normal
circumstances.  If they do, however, return them to the application
so it can fail early and loudly.  Hiding the errors will only delay
the inevitable failure, making it harder to find and diagnose.

Submitted by: Eric van Gyzen <eric_van_gyzen@dell.com>
Obtained from: Dell Inc.
PR: 198914
MFC after: 1 week

9 years agoWhen failing to claim ownership of a umtx_pi, restore the umutex owner
kib [Wed, 25 Feb 2015 16:17:16 +0000 (16:17 +0000)]
When failing to claim ownership of a umtx_pi, restore the umutex owner
to its previous, unowned state.  This avoids compounding an existing
problem of inconsistent ownership.

Submitted by: Eric van Gyzen <eric_van_gyzen@dell.com>
Obtained from: Dell Inc.
PR: 198914
MFC after: 1 week

9 years agoWhen unlocking a contested PI pthread mutex, if the queue of waiters
kib [Wed, 25 Feb 2015 16:12:56 +0000 (16:12 +0000)]
When unlocking a contested PI pthread mutex, if the queue of waiters
is empty, look up the umtx_pi and disown it if the current thread owns it.
This can happen if a signal or timeout removed the last waiter from
the queue, but there is still a thread in do_lock_pi() holding a reference
on the umtx_pi.  The unlocking thread might not own the umtx_pi in this case,
but if it does, it must disown it to keep the ownership consistent between
the umtx_pi and the umutex.

Submitted by: Eric van Gyzen <eric_van_gyzen@dell.com>
with advice from: Elliott Rabe and Jim Muchow, also at Dell Inc.
Obtained from: Dell Inc.
PR: 198914

9 years agoFix a special case in ip_fragment() to produce a more sensible chain
hselasky [Wed, 25 Feb 2015 13:58:43 +0000 (13:58 +0000)]
Fix a special case in ip_fragment() to produce a more sensible chain
of packets. When the data payload length excluding any headers, of an
outgoing IPv4 packet exceeds PAGE_SIZE bytes, a special case in
ip_fragment() can kick in to optimise the outgoing payload(s). The
code which was added in r98849 as part of zero copy socket support
assumes that the beginning of any MTU sized payload is aligned to
where a MBUF's "m_data" pointer points. This is not always the case
and can sometimes cause large IPv4 packets, as part of ping replies,
to be split more than needed.

Instead of iterating the MBUFs to figure out how much data is in the
current chain, use the value already in the "m_pkthdr.len" field of
the first MBUF in the chain.

Reviewed by: ken @
Differential Revision: https://reviews.freebsd.org/D1893
MFC after: 2 weeks
Sponsored by: Mellanox Technologies

9 years agoReplace constant with proper sizeof().
mav [Wed, 25 Feb 2015 10:18:11 +0000 (10:18 +0000)]
Replace constant with proper sizeof().

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

9 years agoFix memory leak on incorrect initiator portal.
mav [Wed, 25 Feb 2015 10:10:40 +0000 (10:10 +0000)]
Fix memory leak on incorrect initiator portal.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 3 days

9 years agoAdd checks for malloc() failures.
mav [Wed, 25 Feb 2015 10:07:39 +0000 (10:07 +0000)]
Add checks for malloc() failures.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 3 days

9 years agoFix potential NULL dereference.
mav [Wed, 25 Feb 2015 09:57:05 +0000 (09:57 +0000)]
Fix potential NULL dereference.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

9 years agoAdd ugen keyword to USB pnpinfo. Remove extra space from existing pnpinfo.
hselasky [Wed, 25 Feb 2015 08:35:00 +0000 (08:35 +0000)]
Add ugen keyword to USB pnpinfo. Remove extra space from existing pnpinfo.

PR: 198015
PR: 198019
PR: 198026
MFC after: 1 week

9 years agoAdjust wording slightly to emphasize that random(3) should not be used for
cperciva [Wed, 25 Feb 2015 07:49:15 +0000 (07:49 +0000)]
Adjust wording slightly to emphasize that random(3) should not be used for
any applications which need unpredictable random numbers, not merely those
which are cryptographic in nature.

If you work for a lottery and you're using random(3) to select the winning
numbers, please let me know.

9 years agosfxge: add to config files
arybchik [Wed, 25 Feb 2015 06:20:42 +0000 (06:20 +0000)]
sfxge: add to config files

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)

9 years agosfxge: use tab to indent instead of spaces
arybchik [Wed, 25 Feb 2015 06:19:23 +0000 (06:19 +0000)]
sfxge: use tab to indent instead of spaces

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)

9 years agosfxge: correct limit for number of Rx queues
arybchik [Wed, 25 Feb 2015 06:19:00 +0000 (06:19 +0000)]
sfxge: correct limit for number of Rx queues

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)

9 years agoFix integer overflow in IGMP protocol.
delphij [Wed, 25 Feb 2015 05:42:59 +0000 (05:42 +0000)]
Fix integer overflow in IGMP protocol.

Security: FreeBSD-SA-15:04.igmp
Security: CVE-2015-1414
Found by: Mateusz Kocielski, Logicaltrust
Analyzed by: Marek Kroemeke, Mateusz Kocielski (shm@NetBSD.org) and
22733db72ab3ed94b5f8a1ffcde850251fe6f466
Submited by: Mariusz Zaborski <oshogbo@FreeBSD.org>
Reviewed by: bms

9 years agoFix several problems found by Coverity.
ken [Wed, 25 Feb 2015 04:30:23 +0000 (04:30 +0000)]
Fix several problems found by Coverity.

lib/libmt/mtlib.c:
In mt_start_element(), make sure we don't overflow the
cur_sb array.  CID 1271325

usr.bin/mt/mt.c:
In main(), bzero the mt_com structure so that we aren't
using any uninitialized stack variables.  CID 1271319

In mt_param(), only allow one -s and one -p argument.  This
will prevent a memory leak caused by overwriting the
param_name and/or param_value variables.  CID 1271320 and
CID 1271322

To make things simpler in mt_param(), make sure there
there is only one exit path for the function.  Make sure
the arguments are explicitly freed.

Sponsored by: Spectra Logic
Pointed out by: emaste
MFC after: 1 month

9 years agoAdd a CLOUDPACKAGE variable to contain a list of targets for
gjb [Tue, 24 Feb 2015 22:27:02 +0000 (22:27 +0000)]
Add a CLOUDPACKAGE variable to contain a list of targets for
post-install packaging cloud provider images.

Add a 'gce-package.sh' script to generate the final output
image ready for upload to the GCE platform.  Right now, this
is the only image that has a specific output format (GNU-tar),
and this implementation is expected to be temporary.

This is not directly connected to the other release targets.

MFC after: 1 week
X-MFC-with: r279249, r279250
Sponsored by: The FreeBSD Foundation

9 years agoFix a race condition by allowing up to 5 seconds of difference between the time stamps.
brd [Tue, 24 Feb 2015 22:22:06 +0000 (22:22 +0000)]
Fix a race condition by allowing up to 5 seconds of difference between the time stamps.

PR: 197861
Approved by: will

9 years agoChange uses of taskqueue_start_threads_pinned() -> taskqueue_start_threads_cpuset()
adrian [Tue, 24 Feb 2015 22:17:12 +0000 (22:17 +0000)]
Change uses of taskqueue_start_threads_pinned() -> taskqueue_start_threads_cpuset()

Differential Revision: https://reviews.freebsd.org/D1897
Reviewed by: jfv

9 years ago- Updated all files with 2015 Avago copyright, and updated LSI's copyright
slm [Tue, 24 Feb 2015 22:07:42 +0000 (22:07 +0000)]
- Updated all files with 2015 Avago copyright, and updated LSI's copyright
  dates.

- Changed all of the PCI device strings from LSI to Avago Technologies (LSI).

- Added a sysctl variable to control how StartStopUnit behavior works. User can
  select to spin down disks based on if disk is SSD or HDD.

- Inquiry data is required to tell if a disk will support SSU at shutdown or
  not. Due to the addition of mpssas_async, which gets Advanced Info but not
  Inquiry data, the setting of supports_SSU was moved to the
  mpssas_scsiio_complete function, which snoops for any Inquiry commands. And,
  since disks are shutdown as a target and not a LUN, this process was
  simplified by basing it on targets and not LUNs.

- Added a sysctl variable that sets the amount of time to retry after sending a
  failed SATA ID command. This helps with some bad disks and large disks that
  require a lot of time to spin up. Part of this change was to add a callout to
  handle timeouts with the SATA ID command. The callout function is called
  mpssas_ata_id_timeout(). (Fixes PR 191348)

- Changed the way resets work by allowing I/O to continue to devices that are
  not currently under a reset condition. This uses devq's instead of simq's and
  makes use of the MPSSAS_TARGET_INRESET flag. This change also adds a function
  called mpssas_prepare_tm().

- Some changes were made to reduce code duplication when getting a SAS address
  for a SATA disk.

- Fixed some formatting and whitespace.

- Bump version of mps driver to 20.00.00.00-fbsd

PR: 191348
Reviewed by: ken, scottl
Approved by: ken, scottl
MFC after: 2 weeks

9 years agoNew pmap implementation for 64-bit PowerPC processors. The main focus of
nwhitehorn [Tue, 24 Feb 2015 21:37:20 +0000 (21:37 +0000)]
New pmap implementation for 64-bit PowerPC processors. The main focus of
this change is to improve concurrency:
- Drop global state stored in the shadow overflow page table (and all other
  global state)
- Remove all global locks
- Use per-PTE lock bits to allow parallel page insertion
- Reconstruct state when requested for evicted PTEs instead of buffering
  it during overflow

This drops total wall time for make buildworld on a 32-thread POWER8 system
by a factor of two and system time by a factor of three, providing performance
20% better than similarly clocked Core i7 Xeons per-core. Performance on
smaller SMP systems, where PMAP lock contention was not as much of an issue,
is nearly unchanged.

Tested on: POWER8, POWER5+, G5 UP, G5 SMP (64-bit and 32-bit kernels)
Merged from: user/nwhitehorn/ppc64-pmap-rework
Looked over by: jhibbits, andreast
MFC after: 3 months
Relnotes: yes
Sponsored by: FreeBSD Foundation

9 years agocxgbe(4): allow tx hardware checksumming on the netmap interface.
np [Tue, 24 Feb 2015 21:31:13 +0000 (21:31 +0000)]
cxgbe(4): allow tx hardware checksumming on the netmap interface.

It is disabled by default but users can set IFCAP_TXCSUM on the
netmap ifnet (ifconfig ncxl0 txcsum) to override netmap and force
the hardware to calculate and insert proper IP and L4 checksums in
outbound frames.

MFC after: 2 weeks

9 years agoRemove a stale comment.
gjb [Tue, 24 Feb 2015 21:16:57 +0000 (21:16 +0000)]
Remove a stale comment.

MFC after: 1 week
X-MFC-with: r279249
Sponsored by: The FreeBSD Foundation

9 years agoAdd 'cloudware-install' target to handle copying cloud
gjb [Tue, 24 Feb 2015 21:06:25 +0000 (21:06 +0000)]
Add 'cloudware-install' target to handle copying cloud
disk images to a directory within DESTDIR.

Add CLOUDINSTALL variable to automatically generate the
actual list of install targets.  While here, rename the
cloud-specific names from 'vm-' to 'cw-' to avoid naming
collisions.

Add AZURE_DISK, GCE_DISK, and OPENSTACK_DISK output file
variables.

Add 'cloudware-install' to the 'install' target.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

9 years agoUnconditionally install debug directory hierarchy
emaste [Tue, 24 Feb 2015 19:27:51 +0000 (19:27 +0000)]
Unconditionally install debug directory hierarchy

This avoids various failure modes (e.g., when building and installing a
single binary with debug data on a system that otherwise does not have
it enabled).

It is also consistent with the way other directory hierarchies are
handled (e.g. share/man).

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D1962

9 years agoIf sys.mk were found via the magic path .../share/mk
sjg [Tue, 24 Feb 2015 19:03:31 +0000 (19:03 +0000)]
If sys.mk were found via the magic path .../share/mk
replace it with the absolute path of .PARSEDIR, so that sub-makes
launched from objdirs (eg kernel) can still find the correct mk files.

Reviewed by: obrien

9 years agocxgbe(4): set up congestion management for netmap rx queues.
np [Tue, 24 Feb 2015 18:40:10 +0000 (18:40 +0000)]
cxgbe(4): set up congestion management for netmap rx queues.

The hw.cxgbe.cong_drop knob controls the response of the chip when
netmap queues are congested.

9 years agocxgbe(4): do not set the netmap rxq interrupts on a hair-trigger.
np [Tue, 24 Feb 2015 18:32:17 +0000 (18:32 +0000)]
cxgbe(4): do not set the netmap rxq interrupts on a hair-trigger.

MFC after: 2 weeks

9 years agocxgbe(4): wait for the hardware to catch up before destroying a netmap txq.
np [Tue, 24 Feb 2015 18:22:24 +0000 (18:22 +0000)]
cxgbe(4): wait for the hardware to catch up before destroying a netmap txq.

MFC after: 2 weeks

9 years agocxgbe(4): request an automatic tx update when a netmap txq idles.
np [Tue, 24 Feb 2015 18:19:25 +0000 (18:19 +0000)]
cxgbe(4): request an automatic tx update when a netmap txq idles.

MFC after: 2 weeks

9 years agoPass macro arguments properly.
hselasky [Tue, 24 Feb 2015 17:36:44 +0000 (17:36 +0000)]
Pass macro arguments properly.

MFC after: 1 week

9 years agoFix order of arguments in the TRACEBUF_INITIALIZER macro so that we
hselasky [Tue, 24 Feb 2015 17:29:04 +0000 (17:29 +0000)]
Fix order of arguments in the TRACEBUF_INITIALIZER macro so that we
can define QUEUE_MACRO_DEBUG to debug list problems.

MFC after: 1 week

9 years agomsun: drop unnecessary checks (part 2).
pfg [Tue, 24 Feb 2015 16:45:16 +0000 (16:45 +0000)]
msun: drop unnecessary checks (part 2).

Drop an unnecessary check in some calculations. The check
would have Coverity falsely conclude that a variable could
be left undefined.

9 years agoEnable 'receive timeout' interrupt allowing us to not
br [Tue, 24 Feb 2015 15:35:26 +0000 (15:35 +0000)]
Enable 'receive timeout' interrupt allowing us to not
loose 'rx buffer full' event.

This fixes operation on ARMv8 Foundation Model.

Sponsored by: DARPA, AFRL

9 years agoKeep a reference on the coredump vnode for vn_fullpath() call. Do it
kib [Tue, 24 Feb 2015 13:07:31 +0000 (13:07 +0000)]
Keep a reference on the coredump vnode for vn_fullpath() call.  Do it
by moving vn_close() after the point where notification is sent.

Reported by: sbruno
Tested by: pho, sbruno
Sponsored by: The FreeBSD Foundation

9 years agoChange struct attribute to avoid aligned operations mismatch
zbb [Tue, 24 Feb 2015 12:57:03 +0000 (12:57 +0000)]
Change struct attribute to avoid aligned operations mismatch

Previous __alignment(4) allowed compiler to assume that operations are
performed on aligned region. On ARM processor, this led to alignment fault
as shown below:
trapframe: 0xda9e5b10
FSR=00000001, FAR=a67b680e, spsr=60000113
r0 =00000000, r1 =00000068, r2 =0000007c, r3 =00000000
r4 =a67b6826, r5 =a67b680e, r6 =00000014, r7 =00000068
r8 =00000068, r9 =da9e5bd0, r10=00000011, r11=da9e5c10
r12=da9e5be0, ssp=da9e5b60, slr=a054f164, pc =a054f2cc
<...>
udp_input+0x264: ldmia r5, {r0-r3, r6}
udp_input+0x268: stmia r12, {r0-r3, r6}

This was due to instructions which do not support unaligned access,
whereas for __alignment(2) compiler replaced ldmia/stmia with some
logically equivalent memcpy operations.
In fact, the assumption that 'struct ip' is always 4-byte aligned
is definitely false, as we have no impact on data alignment of packet
stream received.

Another possible solution would be to explicitely perform memcpy()
on objects of 'struct ip' type, which, however, would suffer from
performance drop, and be merely a problem hiding.

Please, note that this has nothing to do with
ARM32_DISABLE_ALIGNMENT_FAULTS option, but is related strictly to
compiler behaviour.

Submitted by:  Wojciech Macek <wma@semihalf.com>
Reviewed by:   glebius, ian
Obtained from: Semihalf

9 years agoFix endianness on FDT read in ARM GIC
zbb [Tue, 24 Feb 2015 12:31:08 +0000 (12:31 +0000)]
Fix endianness on FDT read in ARM GIC

Submitted by:  Jakub Palider <jpa@semihalf.com>
Reviewed by:   ian, nwhitehorn
Obtained from: Semihalf

9 years agoFix possible memory leak and several races in the IPsec policy management
ae [Tue, 24 Feb 2015 10:35:07 +0000 (10:35 +0000)]
Fix possible memory leak and several races in the IPsec policy management
code.

Resurrect the state field in the struct secpolicy, it has
IPSEC_SPSTATE_ALIVE value when security policy linked in the chain,
and IPSEC_SPSTATE_DEAD value in all other cases. This field protects
from trying to unlink one security policy several times from the different
threads.

Take additional reference in the key_flush_spd() to be sure that policy
won't be freed from the different thread while we are sending SPDEXPIRE message.

Add KEY_FREESP() call to the key_unlink() to release additional reference
that we take when use key_getsp*() functions.

Differential Revision: https://reviews.freebsd.org/D1914
Tested by: Emeric POUPON <emeric.poupon at stormshield dot eu>
Reviewed by: hrs
Sponsored by: Yandex LLC

9 years agoEnsure that the XHCI driver will refresh the control endpoint settings
hselasky [Tue, 24 Feb 2015 08:53:47 +0000 (08:53 +0000)]
Ensure that the XHCI driver will refresh the control endpoint settings
when re-enumerating a FULL speed device. Else the wrong max packet
setting might be used when trying to re-enumerate a FULL speed device.

MFC after: 3 days

9 years agoAdd native netmap support to ixl.
luigi [Tue, 24 Feb 2015 06:20:50 +0000 (06:20 +0000)]
Add native netmap support to ixl.
Preliminary tests indicate 32 Mpps on tx, 24 Mpps on rx
with source and receiver on two different ports of the same 40G card.
Optimizations are likely possible.
The code follows closely the one for ixgbe so i do not
expect stability issues.

Hardware kindly supplied by Intel.

Reviewed by: Jack Vogel
MFC after: 1 week

9 years agosfxge: add put-list high watermark
arybchik [Tue, 24 Feb 2015 06:09:31 +0000 (06:09 +0000)]
sfxge: add put-list high watermark

It is interesting to know how long put-list grows.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)