]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoFix cache issues with bulk transfers
gonzo [Tue, 3 Nov 2015 05:25:06 +0000 (05:25 +0000)]
Fix cache issues with bulk transfers

- Use pmap_quick_enter_page/pmap_quick_remove_page to bounce non-cacheline
    aligned head and tail fragments
- Switch from static fragment size to configurable one, newer firmware
    passes cache line size as cache_line_size DTB parameter.

With these changes both RPi and RPi2 pass functinal part of vchiq_test

8 years agoRaspberry Pi firmware passes cache line size as a DTB parameter
gonzo [Tue, 3 Nov 2015 04:50:58 +0000 (04:50 +0000)]
Raspberry Pi firmware passes cache line size as a DTB parameter

- Add cache-line-size paramter to vchiq node
- Add cache_line_size DTB parameter referencing to
    .../vchiq/cache-line-size property

8 years agoHave elf_lookup() return an error if the specified non-weak symbol could
markj [Tue, 3 Nov 2015 03:29:35 +0000 (03:29 +0000)]
Have elf_lookup() return an error if the specified non-weak symbol could
not be found. Otherwise, relocations against such symbols will be silently
ignored instead of causing an error to be raised.

Reviewed by: kib
MFC after: 1 week

8 years agoUse 64-bit addresses for configuring inbound and outbound address windows.
jhibbits [Tue, 3 Nov 2015 00:54:14 +0000 (00:54 +0000)]
Use 64-bit addresses for configuring inbound and outbound address windows.

This allows using the full host and PCI ranges in the controller configuration.

8 years agosdl->sdl_len in sockaddr_dl can be longer than
hrs [Tue, 3 Nov 2015 00:46:06 +0000 (00:46 +0000)]
sdl->sdl_len in sockaddr_dl can be longer than
sizeof(struct sockaddr_dl).

8 years agoUse the correct space (PCI addresses) for the I/O and memory ranges.
jhibbits [Tue, 3 Nov 2015 00:21:23 +0000 (00:21 +0000)]
Use the correct space (PCI addresses) for the I/O and memory ranges.

PCIR_IOBASE/IOLIMIT/... all use PCI-space addresses, not host addresses.

8 years agoFix an alignment check that is wrong in half the busdma implementations.
ian [Mon, 2 Nov 2015 23:37:19 +0000 (23:37 +0000)]
Fix an alignment check that is wrong in half the busdma implementations.
This will enable the elimination of a workaround in the USB driver that
artifically allocates buffers twice as big as they need to be (which
actually saves memory for very small buffers on the buggy platforms).

When deciding how to allocate a dma buffer, armv4, armv6, mips, and
x86/iommu all correctly check for the tag alignment <= maxsize as enabling
simple uma/malloc based allocation.  Powerpc, sparc64, x86/bounce, and
arm64/bounce were all checking for alignment < maxsize; on those platforms
when alignment was equal to the max size it would fall back to page-based
allocators even for very small buffers.

This change makes all platforms use the <= check.  It should be noted that
on all platforms other than arm[v6] and mips, this check is relying on
undocumented behavior in malloc(9) that if you allocate a block of a given
size it will be aligned to the next larger power-of-2 boundary.  There is
nothing in the malloc(9) man page that makes that explicit promise (but the
busdma code has been relying on this behavior all along so I guess it works).

Arm and mips code uses the allocator in kern/subr_busdma_buffalloc.c, which
does explicitly implement this promise about size and alignment.  Other
platforms probably should switch to the aligned allocator.

8 years agoEliminate the last dregs of the old global arm_root_dma_tag.
ian [Mon, 2 Nov 2015 22:49:39 +0000 (22:49 +0000)]
Eliminate the last dregs of the old global arm_root_dma_tag.

In the old days, device drivers passed NULL for the parent tag when creating
a new tag, and on arm platforms that resulted in a global tag representing
overall platform constraints being substituted in the busdma code.  Now all
drivers use bus_get_dma_tag() and if there is a need to represent overall
platform constraints they will be inherited from a tag supplied by nexus or
some bus driver in the hierarchy.

The only arm platforms still relying on the old global-tag scheme were some
xscale boards with special PCI-bus constraints.  This change provides those
constraints through a tag supplied by the xscale PCI bus driver, and
eliminates the few remaining references to the old global var.

Reviewed by: cognet

8 years agoThe ops EL_SIGNAL, EL_EDITMODE, EL_UNBUFFERED, and EL_PREP_TERM all take
brooks [Mon, 2 Nov 2015 22:21:02 +0000 (22:21 +0000)]
The ops EL_SIGNAL, EL_EDITMODE, EL_UNBUFFERED, and EL_PREP_TERM all take
an int, not an int*.

Sponsored by: DARPA, AFRL
Discovered with: CHERI
Differential Revision: https://reviews.freebsd.org/D4071

8 years agoFix three flowtable bugs, a) one lookup issue, b) a two cleaner issue.
rrs [Mon, 2 Nov 2015 21:21:00 +0000 (21:21 +0000)]
Fix three flowtable bugs, a) one lookup issue, b) a two cleaner issue.
MFC after: 3 days
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D4014

8 years agoMake figpar(3) types/macros [more] unique (s/fp_/figpar_/gi)
dteske [Mon, 2 Nov 2015 20:03:59 +0000 (20:03 +0000)]
Make figpar(3) types/macros [more] unique (s/fp_/figpar_/gi)

8 years agoAdd support for branch instruction on armv7 with ptrace single step
zbb [Mon, 2 Nov 2015 16:56:34 +0000 (16:56 +0000)]
Add support for branch instruction on armv7 with ptrace single step

Previous code supported only "continuous" code without any kind of
branch instructions. To change that, new function was implemented
which parses current instruction and returns an addres where
the jump might happen (alternative addr).
mdthread structure was extended to support two breakpoints
(one directly below current instruction and the second placed
at the alternative location).
One of them must trigger regardless the instruction has or has not been
executed due to condition field.
Upon cleanup, both software breakpoints are removed.

This implementation parses only the most common instructions
that are present in the code (like 99.99% of all), but there
is a chance there are some left, not covered by the parsing routine.
Parsing is done only for 32-bit instruction, no Thumb nor Thumb-2
support is provided.

Reviewed by:   kib
Submitted by:  Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4021

8 years agoMake the arm64_cpu driver quiet as it adds no new information.
andrew [Mon, 2 Nov 2015 16:43:26 +0000 (16:43 +0000)]
Make the arm64_cpu driver quiet as it adds no new information.
Only report the register used to start each cpu in bootverbose.

Sponsored by: ABT Systems Ltd

8 years agoAdd testcases for -t ffs -o version=[12]
ngie [Mon, 2 Nov 2015 11:06:51 +0000 (11:06 +0000)]
Add testcases for -t ffs -o version=[12]

Verify the filesystem type using dumpfs. Add preliminary support
for NetBSD (needs to be validated)

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

8 years agoSync minor whitespace / type changes in ffs_csum_swap and ffs_sb_swap with
ngie [Mon, 2 Nov 2015 10:09:09 +0000 (10:09 +0000)]
Sync minor whitespace / type changes in ffs_csum_swap and ffs_sb_swap with
src/sys/ufs/ffs/ffs_bswap.c@1.39

Obtained from: NetBSD
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoClean up mtree keyword support a slight bit and add a few more default keywords
ngie [Mon, 2 Nov 2015 10:08:00 +0000 (10:08 +0000)]
Clean up mtree keyword support a slight bit and add a few more default keywords

- Parameterize the mtree keywords as $DEFAULT_MTREE_KEYWORDS
- Test with the extra mtree keywords, `mode,gid,uid`.
- Add a note about mtrees with time support not working with makefs right now

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

8 years agozfs: allow the lookup of extended attributes of an unlinked file
avg [Mon, 2 Nov 2015 10:07:21 +0000 (10:07 +0000)]
zfs: allow the lookup of extended attributes of an unlinked file

That's required for extattr_get_fd(2) and the like to work properly.

PR: 203201
MFC after: 17 days

8 years agoAdd testcases for -t cd9660 -o isolevel=[1-3]
ngie [Mon, 2 Nov 2015 09:16:51 +0000 (09:16 +0000)]
Add testcases for -t cd9660 -o isolevel=[1-3]

-- -o isolevel=1 currently fails because of path comparison issues,
   so mark it as an expected failure.
-- -o isolevel=3 is not implemented, so expect it to fail as an out
   of bounds value [*].

PR: 203645
MFC after: 1 week
X-MFC with: r290264
Sponsored by: EMC / Isilon Storage Division

8 years agoLimit isoLevel to 1 and 2 to avoid segfaulting when isoLevel is set to 3 by
ngie [Mon, 2 Nov 2015 08:43:15 +0000 (08:43 +0000)]
Limit isoLevel to 1 and 2 to avoid segfaulting when isoLevel is set to 3 by
dereferencing a NULL function pointer

Add some asserts to ensure that isolevel is always either 1 or 2.

PR: 203645
Reported by: Thomas Schmitt <scdbackup@gmx.net>
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoFix spelling of `isolevel` cd9660 option
ngie [Mon, 2 Nov 2015 07:46:47 +0000 (07:46 +0000)]
Fix spelling of `isolevel` cd9660 option

MFC after: 1 week
X-MFC with: r290260
Sponsored by: EMC / Isilon Storage Division

8 years agoBump .Dd for r290259 and r290260
ngie [Mon, 2 Nov 2015 07:42:42 +0000 (07:42 +0000)]
Bump .Dd for r290259 and r290260

8 years agoDocument undocumented long options for -t cd9660
ngie [Mon, 2 Nov 2015 07:40:18 +0000 (07:40 +0000)]
Document undocumented long options for -t cd9660

Note which options have been implemented and which options haven't
been implemented

Submitted as the following NetBSD PRs: bin/50390 and bin/50392

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

8 years agoSync makefs(8) content a bit with src/usr.sbin/makefs/makefs.8@1.53
ngie [Mon, 2 Nov 2015 07:36:42 +0000 (07:36 +0000)]
Sync makefs(8) content a bit with src/usr.sbin/makefs/makefs.8@1.53

Sections involving unimplemented filesystems (chfs, msdosfs, udf, v7fs) and
options have been omitted.

MFC after: 1 week
Obtained from: NetBSD
Sponsored by: EMC / Isilon Storage Division

8 years agomips: rate limit the trap handler output; add pid/tid/program name.
adrian [Mon, 2 Nov 2015 03:36:15 +0000 (03:36 +0000)]
mips: rate limit the trap handler output; add pid/tid/program name.

I discovered that we're logging each trap, which gets pretty spendy;
and there wasn't any further information on the pid/tid/progname involved.

I originally noticed this because I don't attach anything to /dev/log and so
the log() output stays going to the kernel.  That's an oops on my part, but
I'm glad I did it.

This commit adds the following:

* a rate limiter, which could do with some eyeballs/ideas on how to
  make it more predictable on SMP;
* log pid, tid, progname (comm) as part of the output.

I now get output like this:

Unaligned Load Word: pid=621 (pmcstat), tid=100060, pc=0xffffffff803ae898, badvaddr=0x40a10055
Unaligned Load Word: pid=621 (pmcstat), tid=100060, pc=0xffffffff803ae898, badvaddr=0x40a10051
Unaligned Load Word: pid=621 (pmcstat), tid=100060, pc=0xffffffff803ae898, badvaddr=0x40a1004d
Unaligned Load Word: pid=602 (login), tid=100042, pc=0xffffffff803ae898, badvaddr=0x401159
Unaligned Load Word: pid=602 (login), tid=100042, pc=0xffffffff803ae898, badvaddr=0x401155
Unaligned Load Word: pid=602 (login), tid=100042, pc=0xffffffff803ae898, badvaddr=0x401151

.. which makes it much easier to start figuring out what/where to fix.

The pc looks suss (it looks like it's in kernel space); I'll dig into that one next.

Tested:

* AR9331 SoC (Carambola2)

8 years agoDefine `fhard` in pps_event(..) only when PPS_SYNC is defined to mute
ngie [Mon, 2 Nov 2015 03:14:37 +0000 (03:14 +0000)]
Define `fhard` in pps_event(..) only when PPS_SYNC is defined to mute
an -Wunused-but-set-variable warning

Reported by: FreeBSD_HEAD_amd64_gcc4.9 jenkins job
Sponsored by: EMC / Isilon Storage Division

8 years agoDefine `compress` in `__elfN(coredump)` when #ifdef GZIO is true to mute
ngie [Mon, 2 Nov 2015 01:47:26 +0000 (01:47 +0000)]
Define `compress` in `__elfN(coredump)` when #ifdef GZIO is true to mute
an -Wunused-but-set-variable warning

Reported by: FreeBSD_HEAD_amd64_gcc4.9 jenkins job
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd _test suffix to multiple tests in lib/libc to conform to the design noted
ngie [Mon, 2 Nov 2015 01:29:01 +0000 (01:29 +0000)]
Add _test suffix to multiple tests in lib/libc to conform to the design noted
in the FreeBSD Test Suite wiki

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove unused variable (SRCDIR)
ngie [Mon, 2 Nov 2015 01:23:04 +0000 (01:23 +0000)]
Remove unused variable (SRCDIR)

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove unnecessary `if (x)` tests before calling `free(x)`; free(3)
ngie [Mon, 2 Nov 2015 01:22:06 +0000 (01:22 +0000)]
Remove unnecessary `if (x)` tests before calling `free(x)`; free(3)
already employs this check

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoRename etc/periodic/daily/430.status-rwho to periodic/daily/430.status-uptime
ngie [Mon, 2 Nov 2015 01:05:34 +0000 (01:05 +0000)]
Rename etc/periodic/daily/430.status-rwho to periodic/daily/430.status-uptime

The command was checking local/remote system uptime, so rename the script to
match its function and to avoid confusion

The controlling variable in /etc/periodic.conf has been renamed from
daily_status_rwho_enable to daily_status_uptime_enable.

MFC after: 3 days
Reported by: Peter Jeremy <peter@rulingia.com>
Relnotes: yes
Sponsored by: EMC / Isilon Storage Division

8 years agoUse nitems(x) instead of sizeof(x)/sizeof(x[0])
ngie [Mon, 2 Nov 2015 00:42:31 +0000 (00:42 +0000)]
Use nitems(x) instead of sizeof(x)/sizeof(x[0])

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

8 years agoConditionally install (if_)?(otus|rsu).4, otusfw.4, rsufw.4, and urtwn.4 if
ngie [Mon, 2 Nov 2015 00:39:28 +0000 (00:39 +0000)]
Conditionally install (if_)?(otus|rsu).4, otusfw.4, rsufw.4, and urtwn.4 if
MK_USB != no

Add the manpages to OptionalObsoleteFiles.inc

As a side-effect, this also fixes installworld with MK_USB == no

X-MFC with: r290128
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd mailbox tag/structure for touchscreen buffer address property
gonzo [Sun, 1 Nov 2015 23:50:07 +0000 (23:50 +0000)]
Add mailbox tag/structure for touchscreen buffer address property

8 years agoSynchronize with latest upstream VCHI code:
gonzo [Sun, 1 Nov 2015 22:17:39 +0000 (22:17 +0000)]
Synchronize with latest upstream VCHI code:

- Add LIB_VERSION ioctl
- Add CLOSE_DELIVERED ioctl
- Bump code version

Upstream version: 3782f2ad42c08f4d32f64138f8be7341afc380f5

8 years agosh: Avoid copying argv for simple commands.
jilles [Sun, 1 Nov 2015 22:07:40 +0000 (22:07 +0000)]
sh: Avoid copying argv for simple commands.

Add dummy entries before and after so arglist's array is directly usable as
argv.

8 years agoTreat synchronous VFP exception just like aynchronous: as an FP exception,
gonzo [Sun, 1 Nov 2015 21:59:56 +0000 (21:59 +0000)]
Treat synchronous VFP exception just like aynchronous: as an FP exception,
not as illegal instruction

8 years agoFix lladdr change propagation for on vlans on top of it.
melifaro [Sun, 1 Nov 2015 19:59:04 +0000 (19:59 +0000)]
Fix lladdr change propagation for on vlans on top of it.
Fix lladdr update when setting mac address manually.
Fix lladdr_event for slave ports addition.

MFC after: 4 weeks
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D4004

8 years agodrm/i915: Reduce diff with Linux 3.8
dumbbell [Sun, 1 Nov 2015 19:55:32 +0000 (19:55 +0000)]
drm/i915: Reduce diff with Linux 3.8

There is no functional change. The goal is to ease the future update to
Linux 3.8's i915 driver.

MFC after: 2 months

8 years agopfctl: Fix uninitialised veriable
kp [Sun, 1 Nov 2015 17:20:17 +0000 (17:20 +0000)]
pfctl: Fix uninitialised veriable

In pfctl_set_debug() we used 'level' without ever initialising it.
We correctly parsed the option, but them failed to actually assign the parsed
value to 'level' before performing to ioctl() to configure the debug level.

PR: 202996
Submitted by: Andrej Kolontai

8 years agoInstall myself as src committer.
mmel [Sun, 1 Nov 2015 16:54:55 +0000 (16:54 +0000)]
Install myself as src committer.

Approved by: kib (mentor)
> Description of fields to fill in above:                     76 columns --|
> PR:                       If a GNATS PR is affected by the change.
> Submitted by:             If someone else sent in the change.
> Reviewed by:              If someone else reviewed your modification.
> Approved by:              If you needed approval for this commit.
> Obtained from:            If the change is from a third party.
> MFC after:                N [day[s]|week[s]|month[s]].  Request a reminder email.
> MFH:                      Ports tree branch name.  Request approval for merge.
> Relnotes:                 Set to 'yes' for mention in release notes.
> Security:                 Vulnerability reference (one per line) or description.
> Sponsored by:             If the change was sponsored by an organization.
> Differential Revision:    https://reviews.freebsd.org/D### (*full* phabric URL needed).
> Empty fields above will be automatically removed.

M    share/misc/committers-src.dot

8 years agoMicrooptimize.
ache [Sun, 1 Nov 2015 08:40:15 +0000 (08:40 +0000)]
Microoptimize.

8 years agoAddition to prev. commit.
ache [Sun, 1 Nov 2015 06:47:05 +0000 (06:47 +0000)]
Addition to prev. commit.
In some edge cases fp->_p can be changed in _sseek(), recalculate.

PR:     204156
MFC after:      1 week

8 years agoDon't seek to the end if write buffer is empty (in append modes).
ache [Sun, 1 Nov 2015 06:15:14 +0000 (06:15 +0000)]
Don't seek to the end if write buffer is empty (in append modes).

PR:             204156
MFC after:      1 week

8 years agoioat: Handle channel-fatal HW errors safely
cem [Sat, 31 Oct 2015 20:38:06 +0000 (20:38 +0000)]
ioat: Handle channel-fatal HW errors safely

Certain invalid operations trigger hardware error conditions.  Error
conditions that only halt one channel can be detected and recovered by
resetting the channel.  Error conditions that halt the whole device are
generally not recoverable.

Add a sysctl to inject channel-fatal HW errors,
'dev.ioat.<N>.force_hw_error=1'.

When a halt due to a channel error is detected, ioat(4) blocks new
operations from being queued on the channel, completes any outstanding
operations with an error status, and resets the channel before allowing
new operations to be queued again.

Update ioat.4 to document error recovery;  document blockfill introduced
in r290021 while we are here;  document ioat_put_dmaengine() added in
r289907;  document DMA_NO_WAIT added in r289982.

Sponsored by: EMC / Isilon Storage Division

8 years agodrm/i915: Reduce diff with Linux 3.8
dumbbell [Sat, 31 Oct 2015 15:09:31 +0000 (15:09 +0000)]
drm/i915: Reduce diff with Linux 3.8

There is no functional change. The goal is to ease the future update to
Linux 3.8's i915 driver.

MFC after: 2 months

8 years agoWe have long double on arm64, and the tests pass so enable them.
andrew [Sat, 31 Oct 2015 10:16:44 +0000 (10:16 +0000)]
We have long double on arm64, and the tests pass so enable them.

Sponsored by: ABT Systems Ltd

8 years agonewsyslog: treat 'c' flag in the config as 'C'
bapt [Sat, 31 Oct 2015 09:45:11 +0000 (09:45 +0000)]
newsyslog: treat 'c' flag in the config as 'C'

When -C was introduced in r114137 the plan was to have -C and -c being used for
"create" due to a typo in FreeBSD <= 4.8 a temporary compatibility hack has been
added to make -c being like -G aka GLOB and a warning was issued for the user to
be aware of the futur change for -c.

12 years later it is more than time to remove that hack and finish the what was
intent in r114137

Submitted by: Alexandre Perrin <alex@kaworu.ch>
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D4000

8 years agoThe error classification from lower layers is a poor indicator of
imp [Sat, 31 Oct 2015 04:53:07 +0000 (04:53 +0000)]
The error classification from lower layers is a poor indicator of
whether an error is recoverable. Always re-dirty the buffer on errors
from write requests. The invalidation we used to do for errors not EIO
doesn't need to be done for a device that's really gone, since that's
done in a different path.

Reviewed by: mckusick@, kib@

8 years agoRather than using the #define for path names, indirect through a char *
imp [Sat, 31 Oct 2015 04:39:55 +0000 (04:39 +0000)]
Rather than using the #define for path names, indirect through a char *
variable that could change for different executable types detected.

8 years agoMove all the paths into a new path.h to centralize them.
imp [Sat, 31 Oct 2015 04:39:28 +0000 (04:39 +0000)]
Move all the paths into a new path.h to centralize them.

8 years agoPrint unsigned memory sizes, to handle >2GB RAM on 32-bit powerpc.
jhibbits [Sat, 31 Oct 2015 02:08:39 +0000 (02:08 +0000)]
Print unsigned memory sizes, to handle >2GB RAM on 32-bit powerpc.

Sponsored by: Alex Perez/Intertial Computing

8 years agoDon't hide stderr when checking ${CC} --version.
bdrewery [Sat, 31 Oct 2015 02:07:30 +0000 (02:07 +0000)]
Don't hide stderr when checking ${CC} --version.

This can have important debugging information such as 'cc: not found' or
'ccache: error: Could not find compiler "cc" in PATH'.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agomips: do mips_sync() on sync operations to uncachable memory.
adrian [Sat, 31 Oct 2015 00:29:26 +0000 (00:29 +0000)]
mips: do mips_sync() on sync operations to uncachable memory.

mips24k/mips74k document that we need an explicit SYNC so to order
things correctly, even with access to uncachable memory.
We were doing calls to SYNC in the cache ops (inv, wbinv) but we
weren't doing it for uncachable memory.

8 years agomips74k: use cache-writeback for memory, not writethrough.
adrian [Sat, 31 Oct 2015 00:04:44 +0000 (00:04 +0000)]
mips74k: use cache-writeback for memory, not writethrough.

When I ported this code from netbsd I was .. slightly mips74k greener.
I used writethrough because (a) it's what netbsd did, and (b) if I used
writethrough then things "didn't work."

Fast-forward a couple years, more MIPS hacking and a whole lot more
understanding of the bus APIs (the last few commits notwithstanding;
it's been a long week, ok?) and I have this working for arge,
argemdio, spi and ath.  Hans has it working for USB.  The ath barrier
code will come in a later commit.

This gets the routing throughput up from 220mbit -> 337mbit.
I'm sure the bridging throughput will be similarly improved.

Tested:

* QCA955x SoC, routing workload.

8 years agoarge_mdio: fix barriers; correctly check MII indicator register.
adrian [Fri, 30 Oct 2015 23:59:52 +0000 (23:59 +0000)]
arge_mdio: fix barriers; correctly check MII indicator register.

* use barriers in a slightly better fashion.  You can blame this
  glass of whiskey on putting barriers in the wrong spot.  Grr adrian.

* steal/rewrite the mdio busy check from ag7100 from openwrt and
  refactor the existing code out.  This is .. more correct.

This seems to fix the boot-to-boot variation that I've been seeing
and it quietens the switch port status flapping.

Tested:

* QCA9558 SoC (AP135.)

Obtained from: Linux OpenWRT

8 years agoarge: fix barrier macro.
adrian [Fri, 30 Oct 2015 23:57:20 +0000 (23:57 +0000)]
arge: fix barrier macro.

8 years agoarge: attempt to close a transmit race by only enabling the descriptor at the end...
adrian [Fri, 30 Oct 2015 23:18:02 +0000 (23:18 +0000)]
arge: attempt to close a transmit race by only enabling the descriptor at the end of setup.

This driver and the linux ag71xx driver both treat the transmit ring
as a circular linked list of descriptors.  There's no "end" pointer
that is ever NULL - instead, it expects the MAC to hit a finished
descriptor (ARGE_DESC_EMPTY) and stop.

Now, since it's a circular buffer, we may end up with the hardware
hitting the beginning of our multi-descriptor frame before we've finished
setting it up. It then DMA's it in, starts sending it, and we finish
writing out the new descriptor.  The hardware may then write its
completion for the next descriptor out; then we do, and when we next
read it it'll show up as "not done" and transmit completion stops.

This unfortunately manifests itself as the transmit queue always
being active and a massive TX interrupt storm.  We need to actively
ACK packets back from the transmit engine and if we don't (eg because
we think the transmit isn't finished but it is) then the unit will
just keep generating interrupts.

I hit this finally with the below testing setup.  This fixed it for me.

Strictly speaking I should put in a sync in between writing out all of
the descriptors and writing out that final descriptor.

Tested:

* QCA9558 SoC (AP135 reference board) w/ arge1 + vlans acting as a
  router, and iperf -d (tcp, bidirectional traffic.)

Obtained from: Linux OpenWRT (ag71xx_main.c.)

8 years agoarge: just use 1U since it's a 32 bit unsigned destination value.
adrian [Fri, 30 Oct 2015 23:09:08 +0000 (23:09 +0000)]
arge: just use 1U since it's a 32 bit unsigned destination value.

8 years agoarge: do an explicit flush between updating the TX ring and starting transmit.
adrian [Fri, 30 Oct 2015 23:07:32 +0000 (23:07 +0000)]
arge: do an explicit flush between updating the TX ring and starting transmit.

The MIPS busdma sync operations currently are a big no-op on coherent memory.
This isn't strictly correct behaviour as we need a SYNC in here to ensure that
the writes have finished and are visible in main memory before the MMIO accesses
occur.  This will have to be addressed in a later commit.

But, before that happens, let's at least do a flush here to make things
more "correct".

This is required for even remotely sensible behaviour on mips74k with
write-through memory enabled.

8 years agoarge_mdio: add explicit read barriers for MDIO_READs.
adrian [Fri, 30 Oct 2015 23:00:47 +0000 (23:00 +0000)]
arge_mdio: add explicit read barriers for MDIO_READs.

The mips74k programmers guide notes that reads can be re-ordered, even
uncached ones, so we need an explicit SYNC between them.

Yes, this is a case of a driver author actively doing a bus barrier
operation.

This ends up being necessary when the mips74k core is run in write-back
mode rather than write-through mode.  That's coming in an upcoming
commit.

Tested:

* mips74k, QCA9558 SoC (AP135 reference board), arge<->arge interface
  routing traffic tests.

8 years agoarge: ensure there's enough space in the TX ring before attempting to
adrian [Fri, 30 Oct 2015 22:55:41 +0000 (22:55 +0000)]
arge: ensure there's enough space in the TX ring before attempting to
send frames.

This matches the other check for space.

"enough" is a misnomer, for "reasons".  The biggest reason is that
the TX ring is actually a circular linked list, with no head/tail pointers.
This is just a bit more headroom between head/tail so we have time to
schedule frames before we hit where the hardware is at.

Ideally this would be tunable and a little larger.

8 years agoarge: do a read-after-write on all arge register writes, not just MDIO writes.
adrian [Fri, 30 Oct 2015 22:53:30 +0000 (22:53 +0000)]
arge: do a read-after-write on all arge register writes, not just MDIO writes.

This flushes out the write to the system before anything continues.

The mips74k guide, chapter 3.3.3 (write gathering) notes that writes
can be buffered in FIFOs - even uncached ones - so we can't guarantee
the device has felt its effects.  Now, since we're all lazy driver
authors and don't pepper read/write barriers everywhere, fake it here.

tested:

* mips74k - QCA9558 SoC (AP135 reference board)

8 years agoRemove unneeded _RECURSING_PROGS check.
bdrewery [Fri, 30 Oct 2015 21:23:14 +0000 (21:23 +0000)]
Remove unneeded _RECURSING_PROGS check.

It is definitely not needed after r288158, and is a private variable as well
that should not be checked here.

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

8 years agoMerge OpenSSL 1.0.2d.
jkim [Fri, 30 Oct 2015 20:51:33 +0000 (20:51 +0000)]
Merge OpenSSL 1.0.2d.

8 years agoMinor (and incomplete) style cleanup.
kib [Fri, 30 Oct 2015 20:47:42 +0000 (20:47 +0000)]
Minor (and incomplete) style cleanup.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoUpdate ls -l tests to use mtime, not birthtime
emaste [Fri, 30 Oct 2015 20:14:32 +0000 (20:14 +0000)]
Update ls -l tests to use mtime, not birthtime

PR: 204155
Reviewed by: ngie, rodrigc
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D4040

8 years agoAlso mark compat32 umtx op table as constant.
kib [Fri, 30 Oct 2015 19:32:30 +0000 (19:32 +0000)]
Also mark compat32 umtx op table as constant.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoUse C99 array initialization, which also makes the code
kib [Fri, 30 Oct 2015 19:20:40 +0000 (19:20 +0000)]
Use C99 array initialization, which also makes the code
self-documented, and eases addition of new ops.

For the similar reasons, eliminate UMTX_OP_MAX.  nitems() handles the
only use of the symbol.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoDo not FALLTHROUGH for SIOC{ADD,DEL}MULTI
sjg [Fri, 30 Oct 2015 17:12:15 +0000 (17:12 +0000)]
Do not FALLTHROUGH for SIOC{ADD,DEL}MULTI

ifmedia_ioctl() returns EINVAL

Differential Revision: 3897
Submitted by: aronen@juniper.net
Reviewed by: marcel

8 years agoNot all targets support by clang have a tested or enabled ubsan yet.
sbruno [Fri, 30 Oct 2015 17:05:52 +0000 (17:05 +0000)]
Not all targets support by clang have a tested or enabled ubsan yet.

Only enable h_raw on x86 targets for today so that a buildworld runs to
completion for clang enabled targets that are not x86.  This should be
removed when validation of the sanitizer has occured for all targets
supported by FreeBSD and clang.

8 years agonvd, nvme: report stripesize through GEOM disk layer
jimharris [Fri, 30 Oct 2015 16:35:18 +0000 (16:35 +0000)]
nvd, nvme: report stripesize through GEOM disk layer

MFC after: 3 days
Sponsored by: Intel

8 years agonvme: fix race condition in split bio completion path
jimharris [Fri, 30 Oct 2015 16:06:34 +0000 (16:06 +0000)]
nvme: fix race condition in split bio completion path

Fixes race condition observed under following circumstances:

1) I/O split on 128KB boundary with Intel NVMe controller.
   Current Intel controllers produce better latency when
   I/Os do not span a 128KB boundary - even if the I/O size
   itself is less than 128KB.
2) Per-CPU I/O queues are enabled.
3) Child I/Os are submitted on different submission queues.
4) Interrupts for child I/O completions occur almost
   simultaneously.
5) ithread for child I/O A increments bio_inbed, then
   immediately is preempted (rendezvous IPI, higher priority
   interrupt).
6) ithread for child I/O B increments bio_inbed, then completes
   parent bio since all children are now completed.
7) parent bio is freed, and immediately reallocated for a VFS
   or gpart bio (including setting bio_children to 1 and
   clearing bio_driver1).
8) ithread for child I/O A resumes processing.  bio_children
   for what it thinks is the parent bio is set to 1, so it
   thinks it needs to complete the parent bio.

Result is either calling a NULL callback function, or double freeing
the bio to its uma zone.

PR: 203746
Reported by: Drew Gallatin <gallatin@netflix.com>,
Marc Goroff <mgoroff@quorum.net>
Tested by: Drew Gallatin <gallatin@netflix.com>
MFC after: 3 days
Sponsored by: Intel

8 years agoAfter r290196, the kernel won't wait for stuff like gmirror nodes
trasz [Fri, 30 Oct 2015 15:52:10 +0000 (15:52 +0000)]
After r290196, the kernel won't wait for stuff like gmirror nodes
if they are not required for mounting rootfs.  However, it's possible
that some setups try to mount them in mountcritlocal (ie from fstab).

Export the list of current root mount holds using a new sysctl,
vfs.root_mount_hold, and make mountcritlocal retry if "mount -a" fails
and the list is not empty.

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

8 years agoMake root mount wait mechanism smarter, by making it wait only if the root
trasz [Fri, 30 Oct 2015 15:35:04 +0000 (15:35 +0000)]
Make root mount wait mechanism smarter, by making it wait only if the root
device doesn't yet exist.

Reviewed by: kib@, marcel@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3709

8 years agoReduce the DWC OTG interrupt load by not reading all the host channel
hselasky [Fri, 30 Oct 2015 14:50:29 +0000 (14:50 +0000)]
Reduce the DWC OTG interrupt load by not reading all the host channel
status registers for every interrupt. Check a common host channel
status interrupt register first, then conditionally read the
individual host channel status registers.

Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after: 1 week

8 years agoUse PCB/LR from PCB rather from stack on armv7-gdb
zbb [Fri, 30 Oct 2015 12:37:40 +0000 (12:37 +0000)]
Use PCB/LR from PCB rather from stack on armv7-gdb

The kernel dump does not store these values on the stack.
Use PCB structure to resolve PC and LR properly.

Submitted by:  Wojciech Macek <wma@semihalf.com>
Reviewed by:   jhb, kib
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4013

8 years agoWorkaround KGDB issues on ARM by ignoring ARM EABI version higher than 5
zbb [Fri, 30 Oct 2015 12:21:37 +0000 (12:21 +0000)]
Workaround KGDB issues on ARM by ignoring ARM EABI version higher than 5

To make KGDB working, it needs to understand kernel ELF image.
By default it is compiled using EABI_5, which is not supported
on the gdb-6. As a workaround, treat these images as EABI_2 because
they share a lot of things in common.

This workaround does not guarantee ALL funtionalities
to work.

Submitted by:  Wojciech Macek <wma@semihalf.com>
Reviewed by:   jhb
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4012

8 years agol2arc: do not call trim_map_free() for blocks with zero b_asize
avg [Fri, 30 Oct 2015 12:00:34 +0000 (12:00 +0000)]
l2arc: do not call trim_map_free() for blocks with zero b_asize

b_asize can be zero if the block is compressed into an empty block
(ZIO_COMPRESS_EMPTY) and the trim code asserts that meaningless
zero-sized trimming is not attempted.
The logic for calling trim_map_free() is extracted into a new function
l2arc_trim() to minimize code duplication.

PR: 203473
Reported by: Willem Jan Withagen <wjw@digiware.nl>
Tested by: Willem Jan Withagen <wjw@digiware.nl>
MFC after: 11 days

8 years agoFix compiler warnings with open_to_operation.c
ngie [Fri, 30 Oct 2015 10:09:04 +0000 (10:09 +0000)]
Fix compiler warnings with open_to_operation.c

Other sidenotes:
- Remove unused variables with main(..)
- Convert errx/exit with -1 to errx/exit with 1
- Fix a bogus test in try_directory_open
  (expected_errno == expected_errno -> errno == expected_errno) [*]
- Fix some warnings related to discarded qualifiers
- Remove a bogus else-statement at the end of check_mmap_exec(..) in the
  successful case. mmap(2), POSIX, Linux, etc all don't state what the
  behavior is when mixing O_WRONLY + PROT_EXEC, so assume success for now to
  get the test program to pass again.

PR: 201286 [*]
MFC after: 1 week
Submitted by: David Binderman <dcb314@hotmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoThe prefix for CLFLUSHOPT is 0x66. It was right on amd64.
kib [Fri, 30 Oct 2015 09:53:33 +0000 (09:53 +0000)]
The prefix for CLFLUSHOPT is 0x66.  It was right on amd64.

Sponsored by: The FreeBSD Foundation

8 years agoMake truss work for CloudABI processes on aarch64.
ed [Fri, 30 Oct 2015 08:11:37 +0000 (08:11 +0000)]
Make truss work for CloudABI processes on aarch64.

This change copies over amd64-cloudabi64.c to aarch64-cloudabi.c and
adjusts it to fetch the proper registers on aarch64. To reduce the
amount of shared code, the errno conversion function is moved into a
separate source file.

Reviewed by: jhb, andrew
Differential Revision: https://reviews.freebsd.org/D4023

8 years agoDisable h_raw/h_read with gcc
ngie [Fri, 30 Oct 2015 08:06:24 +0000 (08:06 +0000)]
Disable h_raw/h_read with gcc

I forgot that these testcases fail with gcc 4.2.1; add a note to that effect

MFC after: never
Sponsored by: EMC / Isilon Storage Division

8 years agoFix a set but not used variable warning flagged by gcc 4.9 with
ngie [Fri, 30 Oct 2015 08:01:53 +0000 (08:01 +0000)]
Fix a set but not used variable warning flagged by gcc 4.9 with
lib/libc/ssp/h_readlink

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years ago- Re-enable h_raw with clang 3.7.0+
ngie [Fri, 30 Oct 2015 07:48:03 +0000 (07:48 +0000)]
- Re-enable h_raw with clang 3.7.0+
- Fix the compiler check to allow the test to be compiled for gcc

PR: 196430
MFC after: never
Sponsored by: EMC / Isilon Storage Division

8 years agoFix rtsold's usage message
ngie [Fri, 30 Oct 2015 07:36:43 +0000 (07:36 +0000)]
Fix rtsold's usage message

- Remove -a from the usage message example dealing with specific
  interfaces. -a only makes sense when not specifying an interface,
  such that it's to be run on all interfaces
- Fix the pidfile option (it's -p, not -P)
- Change `interfaces` to `interface` to match the manpage

MFC after: 3 days
PR: 173744
Sponsored by: EMC / Isilon Storage Division

8 years agoUnbreak bsd.progs.mk with PROGS (but not PROGS_CXX) and when invoking the
ngie [Fri, 30 Oct 2015 06:07:41 +0000 (06:07 +0000)]
Unbreak bsd.progs.mk with PROGS (but not PROGS_CXX) and when invoking the
"one of many" targets, e.g. `make hello_world`, where hello_world is a C
program

Tested with: PROGS and PROGS_CXX
MFC after: 1 week
X-MFC with: r289289
Sponsored by: EMC / Isilon Storage Division

8 years agoFollow up to roundup feature addition in r289203
ngie [Fri, 30 Oct 2015 05:55:56 +0000 (05:55 +0000)]
Follow up to roundup feature addition in r289203

- Rename -r to -R to avoid the clash with makefs -r in NetBSD
- Note that -R is an FFS-specific option because it's not implemented
  in cd9660 today
- Rename the roundup variable to "roundup-size" in the manpage and help
  text for consistency with other variables.
- Bump .Dd (missed in r289203)

PR: 203707
MFC after: 1 week
X-MFC with: r289203
Differential Revision: https://reviews.freebsd.org/D3959
Reviewed by: adrian (earlier patch), emaste
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove a set but unused variable in __getgroupmembership to fix a gcc 4.9+ warning
ngie [Fri, 30 Oct 2015 05:50:05 +0000 (05:50 +0000)]
Remove a set but unused variable in __getgroupmembership to fix a gcc 4.9+ warning

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

8 years agoFix GOST engine cipher linkage by adding e_gost_err.c to SRCS so it
ngie [Fri, 30 Oct 2015 05:33:38 +0000 (05:33 +0000)]
Fix GOST engine cipher linkage by adding e_gost_err.c to SRCS so it
picks up undefined symbols, like "ERR_load_GOST_strings"

MFC after: 3 days
PR: 184805
Submitted by: Ivan IvanZhdanov <ivan.zhdanov@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoIntegrate contrib/netbsd-tests/lib/libc/rpc into the FreeBSD test suite
ngie [Fri, 30 Oct 2015 03:28:00 +0000 (03:28 +0000)]
Integrate contrib/netbsd-tests/lib/libc/rpc into the FreeBSD test suite
as lib/libc/rpc

This testcase requires rpcbind be up in running; otherwise the testcases
will time out and be skipped

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

8 years agoFix BULK read transfer if destination buffer is not cache line-aligned.
gonzo [Fri, 30 Oct 2015 01:19:04 +0000 (01:19 +0000)]
Fix BULK read transfer if destination buffer is not cache line-aligned.

We can't use copyout because destination memory is userland address
in another process but we have reference to respective page so map
the page into kernel address space and copy fragments there

8 years agocxgbe/tom: decide whether to shove segments or not only if there is
np [Fri, 30 Oct 2015 01:18:07 +0000 (01:18 +0000)]
cxgbe/tom: decide whether to shove segments or not only if there is
payload to transmit.

MFC after: 1 week

8 years agoIn pw_userlock, set 'name' to NULL when we encounter an all number string
delphij [Fri, 30 Oct 2015 00:46:52 +0000 (00:46 +0000)]
In pw_userlock, set 'name' to NULL when we encounter an all number string
because it is also used as an indicator of whether a name or an UID is
being used and we may have undefined results as 'name' may contain
uninitialized stack contents.

MFC after: 2 weeks

8 years agoUse strlcpy().
delphij [Fri, 30 Oct 2015 00:33:03 +0000 (00:33 +0000)]
Use strlcpy().

MFC after: 2 weeks

8 years agoFix framebuffer compatibility with new RPi firmware. Framebuffer driver
gonzo [Fri, 30 Oct 2015 00:24:37 +0000 (00:24 +0000)]
Fix framebuffer compatibility with new RPi firmware. Framebuffer driver
receives video memory address from VideoCore through property mailbox
channel. Older versions of firmware (and the one that is currently part
of sysutils/u-boot-rpi and sysutils/u-boot-rpi2) returned real physical
address, newer one returns VideoCore bus address, so we need to convert
it to actual physical address. this version works with both older and
newer interface.

8 years agoRemove unneeded NULL as this is initialized with M_ZERO.
bdrewery [Thu, 29 Oct 2015 23:56:34 +0000 (23:56 +0000)]
Remove unneeded NULL as this is initialized with M_ZERO.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoUse memmove(3) to avoid overlapping copy.
bdrewery [Thu, 29 Oct 2015 23:06:33 +0000 (23:06 +0000)]
Use memmove(3) to avoid overlapping copy.

Reported by: valgrind
MFC after: 2 weeks
X-MFC-With: r290168

8 years agoFix several memory leaks, and crashes, in iconvlist(3).
bdrewery [Thu, 29 Oct 2015 23:02:34 +0000 (23:02 +0000)]
Fix several memory leaks, and crashes, in iconvlist(3).

- Both curitem and curitem (via the names list) was always leaked.
- malloc(3) failures lead to some leaks.
- __bsd___iconv_get_list() failure lead to a crash since its error was not
  handles and __bsd___iconv_free_list() is not NULL-safe.

I have slightly refactored this to avoid extra malloc and free logic in cases
of malloc(3) failing.

There are still bad assumptions here that I did not deal with.  One of which is
that the data will always have a '/' so the strchr(3) will not return NULL.

Coverity CID: 1130055 1130054 1130053

8 years agoFix LEAVE_HYP macro: spsr is not guaranteed to contain valid value at this
gonzo [Thu, 29 Oct 2015 22:12:03 +0000 (22:12 +0000)]
Fix LEAVE_HYP macro: spsr is not guaranteed to contain valid value at this
point, e.g. on RaspberryPi 2 when control is passed from loader to kernel
it contains garbage. So we use cpsr as a base for new cpsr value: if we
have reached this point it means current value is OK

Reviewed by: andrew

8 years agoInstall myself as src committer.
skra [Thu, 29 Oct 2015 21:40:32 +0000 (21:40 +0000)]
Install myself as src committer.

Approved by: kib (mentor)