]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoMerge from head
Baptiste Daroussin [Sun, 1 Nov 2015 21:17:38 +0000 (21:17 +0000)]
Merge from head

8 years agolocales: Fix eucJP sorting (broken upstream?)
Baptiste Daroussin [Sun, 1 Nov 2015 21:02:30 +0000 (21:02 +0000)]
locales: Fix eucJP sorting (broken upstream?)

Sorting eucJP text with "sort" resulted in an illegal sequence while
"gsort" worked.  This was traced back to mbrtowc handling which was
broken for eucJP (probably eucCN, eucKR, and eucTW as well).  This
small fix took hours to figure out.  The OR operation to build the
wide character requires an unsigned character to work correctly.  The
euc wcrtowc conversion is probably broken upstream in Illumos as well.

Triggered by: misc/freebsd-doc-ja in ports (encoded in eucJP)

Submitted by: marino
Obtained from: DragonflyBSD

8 years agoFix lladdr change propagation for on vlans on top of it.
Alexander V. Chernikov [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
Jean-Sébastien Pédron [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
Kristof Provost [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.
Michal Meloun [Sun, 1 Nov 2015 16:54:55 +0000 (16:54 +0000)]
Install myself as src committer.

Approved by: kib (mentor)

8 years agolibc: Fix (and improve) nl_langinfo (CODESET)
Baptiste Daroussin [Sun, 1 Nov 2015 12:00:55 +0000 (12:00 +0000)]
libc: Fix (and improve) nl_langinfo (CODESET)

The output of "locale charmap" is identical to the result of
nl_langinfo (CODESET) for any given locale.  The logic for returning the
codeset was very simplistic.  It just returned portion of the locale name
after the period (e.g. en_FR.ISO8859-1 returned "ISO8859-1").

When softlinks were added to locales, this broke.  e.g.:
   en_US returned ""
   en_FR.UTF8 returned "UTF8"
   en_FR.UTF-8 returned "UTF-8"
   zh_Hant_HK.Big5HKSCS returned "Big5HKSCS"
   zh_Hant_TW.Big5 returned "Big5"
   es_ES@euro returned ""

In order to fix this properly, the named locale cannot be used to
determine the encoding.  This information was almost available in the
rune data.  Unfortunately, all the single byte encodings were listed
as "NONE" encoding.

So I adjusted localedef tool to provide more information about the
encoding.  For example, instead of "NONE", the LC_CTYPE used by
fr_FR.ISO8859-15 is now encoded as "NONE:ISO8859-15".  The locale
handlers now check if the first four characters of the encoding is
"NONE" and if so, treats it as a single-byte encoding.

The nl_langinfo handling of CODESET was adjusting accordingly.  Now the
following is returned:
   en_US returns "ISO8859-1"
   fr_FR.UTF8 returns "UTF-8"
   fr_FR.UTF-8 returns "UTF-8"
   zh_Hant_HK.Big5HKSCS returns "Big5"
   zh_Hant_TW.Big5 returns "Big5"
   es_ES@euro returns "ISO8859-15"

as before, "C" and "POSIX" locales return "US-ASCII".  This is a big
improvement.  The result of nl_langinfo can never be a zero-length
string and it will always exclusively one of the values of the
character maps of /usr/src/tools/tools/locale/etc/final-maps.

Submitted by: marino
Obtained from: DragonflyBSD

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

8 years agoAddition to prev. commit.
Andrey A. Chernov [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).
Andrey A. Chernov [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
Conrad Meyer [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
Jean-Sébastien Pédron [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 Turner [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'
Baptiste Daroussin [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
Warner Losh [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 *
Warner Losh [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.
Warner Losh [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.
Justin Hibbits [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.
Bryan Drewery [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 Chadd [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 Chadd [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 Chadd [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 Chadd [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 Chadd [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 Chadd [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 Chadd [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 Chadd [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 Chadd [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 Chadd [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.
Bryan Drewery [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.
Jung-uk Kim [Fri, 30 Oct 2015 20:51:33 +0000 (20:51 +0000)]
Merge OpenSSL 1.0.2d.

8 years agoMinor (and incomplete) style cleanup.
Konstantin Belousov [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
Ed Maste [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.
Konstantin Belousov [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
Konstantin Belousov [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
Simon J. Gerraty [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.
Sean Bruno [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
Jim Harris [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
Jim Harris [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
Edward Tomasz Napierala [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
Edward Tomasz Napierala [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
Hans Petter Selasky [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
Zbigniew Bodek [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
Zbigniew Bodek [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
Andriy Gapon [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
Enji Cooper [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.
Konstantin Belousov [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 Schouten [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
Enji Cooper [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
Enji Cooper [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+
Enji Cooper [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
Enji Cooper [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
Enji Cooper [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
Enji Cooper [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
Enji Cooper [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
Enji Cooper [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
Enji Cooper [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.
Oleksandr Tymoshenko [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
Navdeep Parhar [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
Xin LI [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().
Xin LI [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
Oleksandr Tymoshenko [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.
Bryan Drewery [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.
Bryan Drewery [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).
Bryan Drewery [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
Oleksandr Tymoshenko [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.
Svatopluk Kraus [Thu, 29 Oct 2015 21:40:32 +0000 (21:40 +0000)]
Install myself as src committer.

Approved by: kib (mentor)

8 years agoSet the proper direction to check for policies in this one case.
George V. Neville-Neil [Thu, 29 Oct 2015 21:26:32 +0000 (21:26 +0000)]
Set the proper direction to check for policies in this one case.

Pointed out by: eri
Sponsored by: Rubicon Communications (Netgate)

8 years agoUse movw instead of movl (or plain mov) when moving segment registers
John Baldwin [Thu, 29 Oct 2015 21:25:46 +0000 (21:25 +0000)]
Use movw instead of movl (or plain mov) when moving segment registers
into memory.  This is a nop on clang's assembler, but some assemblers
complain if the size suffix is incorrect.

Submitted by: bde

8 years agoIgnore per-mdN settings in mdconfig[2] startup
Devin Teske [Thu, 29 Oct 2015 21:12:57 +0000 (21:12 +0000)]
Ignore per-mdN settings in mdconfig[2] startup

PR: base/189696
Submitted by: ganael.laplanche@martymac.org
MFC after: 3 days
X-MFC-to: stable/10 stable/9

8 years agoAdd myself (jtl) and my mentor to the committers-src.dot file.
Jonathan T. Looney [Thu, 29 Oct 2015 21:00:11 +0000 (21:00 +0000)]
Add myself (jtl) and my mentor to the committers-src.dot file.

Approved by: gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D4029

8 years agopf: Fix IPv6 checksums with route-to.
Kristof Provost [Thu, 29 Oct 2015 20:45:53 +0000 (20:45 +0000)]
pf: Fix IPv6 checksums with route-to.

When using route-to (or reply-to) pf sends the packet directly to the output
interface. If that interface doesn't support checksum offloading the checksum
has to be calculated in software.
That was already done in the IPv4 case, but not for the IPv6 case. As a result
we'd emit packets with pseudo-header checksums (i.e. incorrect checksums).

This issue was exposed by the changes in r289316 when pf stopped performing full
checksum calculations for all packets.

Submitted by: Luoqi Chen
MFC after: 1 week

8 years agoRemove some unneeded code.
Alexander Motin [Thu, 29 Oct 2015 20:43:13 +0000 (20:43 +0000)]
Remove some unneeded code.

8 years agoRemove reset delays for which I see neither explanation nor need.
Alexander Motin [Thu, 29 Oct 2015 20:34:01 +0000 (20:34 +0000)]
Remove reset delays for which I see neither explanation nor need.

8 years agontb: Revert r290130 now that r290156 has landed
Conrad Meyer [Thu, 29 Oct 2015 19:35:01 +0000 (19:35 +0000)]
ntb: Revert r290130 now that r290156 has landed

Nagged by: vangyzen
Sponsored by: EMC / Isilon Storage Division

8 years agoCheck archive_entry_new() result.
Bryan Drewery [Thu, 29 Oct 2015 19:28:21 +0000 (19:28 +0000)]
Check archive_entry_new() result.

Coverity CID: 1331341

8 years agopmap_change_attr: Only fixup DMAP for DMAPed ranges
Conrad Meyer [Thu, 29 Oct 2015 19:07:00 +0000 (19:07 +0000)]
pmap_change_attr: Only fixup DMAP for DMAPed ranges

pmap_change_attr must change the memory type of both the requested KVA
and the corresponding DMAP mappings (if such mappings exist), to satisfy
an Intel requirement that two or more mappings to the same physical
pages must have the same memory type.

However, not all kernel mapped pages have corresponding DMAP mappings --
for example, 64-bit BARs.  Skip fixing up the DMAP for out-of-bounds
addresses.

Submitted by: Steve Wahl <steve_wahl@dell.com>
Reviewed by: alc, jhb
Sponsored by: Dell Compellent
Differential Revision: https://reviews.freebsd.org/D4030

8 years agogetnewbuf: Initialize bp to avoid uninitialized pointer dereference and brelse().
Bryan Drewery [Thu, 29 Oct 2015 19:02:24 +0000 (19:02 +0000)]
getnewbuf: Initialize bp to avoid uninitialized pointer dereference and brelse().

This came in recently in r289279.

Coverity CID: 1331561

8 years agoAvoid passing an uninitialized 'i'. Currently nothing was depending on it
Bryan Drewery [Thu, 29 Oct 2015 18:58:18 +0000 (18:58 +0000)]
Avoid passing an uninitialized 'i'.  Currently nothing was depending on it
anyhow.

Coverity CID: 1331562

8 years agoFix unlikely memory leak.
Bryan Drewery [Thu, 29 Oct 2015 18:29:28 +0000 (18:29 +0000)]
Fix unlikely memory leak.

It is unlikely since the first check in the function is that dir[0] is '/',
but later code changes may make it real.

Coverity CID: 1332104

8 years agoPC Card and Cardbus are now in extended maintenance mode. No need to
Warner Losh [Thu, 29 Oct 2015 16:50:28 +0000 (16:50 +0000)]
PC Card and Cardbus are now in extended maintenance mode. No need to
have them cluttering up MAINTAINERS.

8 years agoFix and improve error masking and reporting.
Alexander Motin [Thu, 29 Oct 2015 16:48:12 +0000 (16:48 +0000)]
Fix and improve error masking and reporting.

8 years agoUpdate for LINUX32 rename. The assembler didn't complain about undefined
John Baldwin [Thu, 29 Oct 2015 15:20:47 +0000 (15:20 +0000)]
Update for LINUX32 rename.  The assembler didn't complain about undefined
symbols but just used 0 after the rename.

8 years agoFix build with DEBUG defined.
John Baldwin [Thu, 29 Oct 2015 15:16:47 +0000 (15:16 +0000)]
Fix build with DEBUG defined.

Reported by: hselasky

8 years agoAdd missing NULL check in physio().
Hans Petter Selasky [Thu, 29 Oct 2015 13:53:37 +0000 (13:53 +0000)]
Add missing NULL check in physio().

When destroying a character device the si_devsw field is set to NULL
before all references are gone, to indicate the character device is
going away. This can cause a NULL-dereference fault inside physio().

The callers of physio() should own a thread reference on the cdev and
if si_devsw is seen as non-NULL, it is usable during the execution of
the function. Else an ENXIO error code is returned.

Reviewed by: kib
MFC after: 2 weeks

8 years agoSome minor additions to r290138,
Alexander Motin [Thu, 29 Oct 2015 10:31:44 +0000 (10:31 +0000)]
Some minor additions to r290138,

8 years agoSome updates to isp(4) manual page.
Alexander Motin [Thu, 29 Oct 2015 09:50:48 +0000 (09:50 +0000)]
Some updates to isp(4) manual page.

8 years agoAdd myself to MAINTAINERS.
Hans Petter Selasky [Thu, 29 Oct 2015 08:45:56 +0000 (08:45 +0000)]
Add myself to MAINTAINERS.

8 years agoFinish process of moving the LinuxKPI module into the default kernel build.
Hans Petter Selasky [Thu, 29 Oct 2015 08:28:39 +0000 (08:28 +0000)]
Finish process of moving the LinuxKPI module into the default kernel build.

- Move all files related to the LinuxKPI into sys/compat/linuxkpi and
  its subfolders.
- Update sys/conf/files and some Makefiles to use new file locations.
- Added description of COMPAT_LINUXKPI to sys/conf/NOTES which in turn
  adds the LinuxKPI to all LINT builds.
- The LinuxKPI can be added to the kernel by setting the
  COMPAT_LINUXKPI option. The OFED kernel option no longer builds the
  LinuxKPI into the kernel. This was done to keep the build rules for
  the LinuxKPI in sys/conf/files simple.
- Extend the LinuxKPI module to include support for USB by moving the
  Linux USB compat from usb.ko to linuxkpi.ko.
- Bump the FreeBSD_version.
- A universe kernel build has been done.

Reviewed by: np @ (cxgb and cxgbe related changes only)
Sponsored by: Mellanox Technologies

8 years agoRemove the static function declaration.
Kevin Lo [Thu, 29 Oct 2015 04:51:27 +0000 (04:51 +0000)]
Remove the static function declaration.

8 years ago- Add a missing prototype
Kevin Lo [Thu, 29 Oct 2015 04:21:34 +0000 (04:21 +0000)]
- Add a missing prototype
- Fix typos

8 years agoioat_test: Handled forced hardware resets gracefully
Conrad Meyer [Thu, 29 Oct 2015 04:16:52 +0000 (04:16 +0000)]
ioat_test: Handled forced hardware resets gracefully

Sponsored by: EMC / Isilon Storage Division

8 years agoioat: Drain/quiesce the device less racily
Conrad Meyer [Thu, 29 Oct 2015 04:16:39 +0000 (04:16 +0000)]
ioat: Drain/quiesce the device less racily

On detach and during a forced HW reset.

Sponsored by: EMC / Isilon Storage Division

8 years agontb: Do not attempt to set write-combining on MWs
Conrad Meyer [Thu, 29 Oct 2015 04:16:28 +0000 (04:16 +0000)]
ntb: Do not attempt to set write-combining on MWs

AMD64 pmap assumes ranges will be in the DMAP, which isn't necessarily
true for NTB memory windows (especially 64-bit BARs).

Suggested by: pmap_change_attr_locked -> kassert_panic
Sponsored by: EMC / Isilon Storage Division

8 years agoioatcontrol(8): Add and document "raw" testing mode
Conrad Meyer [Thu, 29 Oct 2015 04:16:16 +0000 (04:16 +0000)]
ioatcontrol(8): Add and document "raw" testing mode

Allows DMA from/to arbitrary KVA or physical address.  /dev/ioat_test
must be enabled by root and is only R/W root, so this is approximately
as dangerous as /dev/mem and /dev/kmem.

Sponsored by: EMC / Isilon Storage Division

8 years agoAdd MLINKS for if_otus(4), if_rsu(4) and if_urtwn(4).
Kevin Lo [Thu, 29 Oct 2015 03:28:28 +0000 (03:28 +0000)]
Add MLINKS for if_otus(4), if_rsu(4) and if_urtwn(4).

8 years agoXref otus(4).
Kevin Lo [Thu, 29 Oct 2015 03:22:27 +0000 (03:22 +0000)]
Xref otus(4).

8 years agoFix regression from using .USEBEFORE in _SUBDIR in r289705.
Bryan Drewery [Thu, 29 Oct 2015 00:41:03 +0000 (00:41 +0000)]
Fix regression from using .USEBEFORE in _SUBDIR in r289705.

Using .USEBEFORE had the unintended side-effect of changing the directory for
the real target ran in the current directory.  For example this meant that
the 'make clean' would run in one of the SUBDIR.

Sponsored by: EMC / Isilon Storage Division
Pointyhat to: bdrewery

8 years agoOops - use the wrong array offset.
Adrian Chadd [Wed, 28 Oct 2015 23:39:33 +0000 (23:39 +0000)]
Oops - use the wrong array offset.

8 years agoCalculate the correct amount of bytes that are in-flight for a connection as
Hiren Panchasara [Wed, 28 Oct 2015 22:57:51 +0000 (22:57 +0000)]
Calculate the correct amount of bytes that are in-flight for a connection as
suggested by RFC 6675.

Currently differnt places in the stack tries to guess this in suboptimal ways.
The main problem is that current calculations don't take sacked bytes into
account. Sacked bytes are the bytes receiver acked via SACK option. This is
suboptimal because it assumes that network has more outstanding (unacked) bytes
than the actual value and thus sends less data by setting congestion window
lower than what's possible which in turn may cause slower recovery from losses.

As an example, one of the current calculations looks something like this:
snd_nxt - snd_fack + sackhint.sack_bytes_rexmit
New proposal from RFC 6675 is:
snd_max - snd_una - sackhint.sacked_bytes + sackhint.sack_bytes_rexmit
which takes sacked bytes into account which is a new addition to the sackhint
struct. Only thing we are missing from RFC 6675 is isLost() i.e. segment being
considered lost and thus adjusting pipe based on that which makes this
calculation a bit on conservative side.

The approach is very simple. We already process each ack with sack info in
tcp_sack_doack() and extract sack blocks/holes out of it. We'd now also track
this new variable sacked_bytes which keeps track of total sacked bytes reported.

One downside to this approach is that we may get incorrect count of sacked_bytes
if the other end decides to drop sack info in the ack because of memory pressure
or some other reasons. But in this (not very likely) case also the pipe
calculation would be conservative which is okay as opposed to being aggressive
in sending packets into the network.

Next step is to use this more accurate pipe estimation to drive congestion
window adjustments.

In collaboration with: rrs
Reviewed by: jason_eggnet dot com, rrs
MFC after: 2 weeks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D3971