kib [Fri, 13 Dec 2013 05:54:58 +0000 (05:54 +0000)]
MFC r259042:
Do not force to run atexit handlers, which text comes from a dso owning
the handle passed to __cxa_finalize() but which are registered by other
dso, when the process is inside exit(3).
This is a series of commits inspired on Google's gcc-4.2.1 for
Android that were taken from the gcc pre-4.3 under the GPLv2.
gcc: Backport fixes for -W parentheses in C++
This fixes GCC 19564.
gcc: merge rs6000 change from FSF pre-gcc43
Don't set MASK_PPC_GFXOPT for 8540 or 8548.
Merge vrp-tree fix from gcc-4.3
Fix missed conversion from / to >> (GCC PR32521)
Merge in GCCr120505 to include definition of TREE_OVERFLOW_P
gcc: warn about integer overflow in constant expressions in the C++ frontend.
gcc: Add a new option -Wvla to warn variable length array.
libcpp: preprocessor speedup patches from upstream gcc.
gcc: add femit-struct-debug support to reduce Reduce dwarf debug size
gcc: Fix postreload-gcse treatment of call-clobbered registers.
gcc: Record some previous commits in the ChangeLog.gcc43 file.
This brings m4 up to date with the version in head and fixes the eval
command when called with a 2nd and 3rd argument. The only differences
remaining are related to the updated flex and byacc in head.
mdf [Thu, 12 Dec 2013 02:04:59 +0000 (02:04 +0000)]
MFC r258658:
Fix a segfault / internal compiler error.
Among other causes, when gcc throws a warning before parsing any tokens,
the cur_token pointer is at the beginning of malloc'd memory.
Dereferencing cur_token[-1] can cause a segfault.
Code taken from OpenBSD
http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/gcc/libcpp/errors.c
which was a more complete fix than the one I originally coded.
pfg [Wed, 11 Dec 2013 19:25:38 +0000 (19:25 +0000)]
MFC r256448, r257029;
Make di_blocks unsigned in UFS1 as is the case already for UFS2.
Most of the code between UFS1 and UFS2 is shared so this change
is pretty safe. Not only this makes UFS1 and 2 consistent but it
also matches what NetBSD and MacOS X have for some years now.
UFS2: make di_extsize unsigned.
di_extsize is the EA size and as such it should be unsigned.
Adjust related types for consistency.
dim [Wed, 11 Dec 2013 07:43:30 +0000 (07:43 +0000)]
MFC r259111:
Use correct casts in gcc's emmintrin.h for the first arguments of the
following builtin functions:
* __builtin_ia32_pslldi128() takes __v4si instead of __v8hi
* __builtin_ia32_psllqi128() takes __v2di instead of __v8hi
* __builtin_ia32_psradi128() takes __v4si instead of __v8hi
This should fix the following errors when building the LINT kernel with
gcc:
sys/crypto/aesni/aesni_wrap.c:191: error: incompatible type for argument 1 of
'__builtin_ia32_psradi128'
sys/crypto/aesni/aesni_wrap.c:195: error: incompatible type for argument 1 of
'__builtin_ia32_pslldi128'
dim [Wed, 11 Dec 2013 07:34:34 +0000 (07:34 +0000)]
MFC r259100:
Pull in r196658 from upstream clang trunk:
CodeGen: Don't emit linkage on thunks that aren't emitted because they're
vararg.
This can happen when we're trying to emit a thunk with available_externally
linkage with optimization enabled but bail because it doesn't make sense for
vararg functions.
[LLVM] PR18098.
This should fix clang "Broken module found, compilation aborted" errors when
building the qt4-based dvbcut port.
rmacklem [Tue, 10 Dec 2013 22:03:59 +0000 (22:03 +0000)]
MFC: r257598
During code inspection, I spotted that there was a code path where
CLNT_CONTROL() would be called on "client" after it was
released via CLNT_RELEASE(). It was unlikely that this
code path gets executed and I have not heard of any problem
report caused by this bug. This patch fixes the code so that
this cannot happen.
dim [Tue, 10 Dec 2013 07:28:26 +0000 (07:28 +0000)]
MFC r259083:
For WARNS <= 3, change the clang warning flag -Wno-conversion to
-Wno-enum-conversion. In earlier clang versions (before 3.2), the
latter did not exist, and suppressing enum conversion warnings was
really the goal of this warning suppression flag.
This should enable the same kind of warning again as was fixed by
r259072 ("incompatible integer to pointer conversion passing 'Elf_Addr'
(aka 'unsigned int') to parameter of type 'void *'"), and which was only
emitted by gcc.
dim [Tue, 10 Dec 2013 07:25:25 +0000 (07:25 +0000)]
MFC r259053:
Pull in r196590 from upstream clang trunk (by rdivacky):
Move the body of GCCInstallationDetector ctor into an init() function
and call it from its only user. The linux toolchain. This saves quite
a lot of directory searching on other platforms.
See http://docs.freebsd.org/cgi/mid.cgi?51E6FAF5.3080802 for the
original discussion. With this fix, the search for gcc installations is
completely eliminated on FreeBSD.
imp [Sun, 8 Dec 2013 03:49:45 +0000 (03:49 +0000)]
MFC:
r246881 | ian | 2013-02-16 13:43:16 -0700 (Sat, 16 Feb 2013) | 4 lines
In _bus_dmamap_addseg(), the return value must be zero for error, or the size
actually added to the segment (possibly smaller than the requested size if
boundary crossings had to be avoided).
This fixes NFS root on Atmel platforms, and likely others.
imp [Sun, 8 Dec 2013 02:48:06 +0000 (02:48 +0000)]
4096 is 4MB, and macb doesn't even come close to working, so don't say
it is an altenative. It hasn't worked in quite some time. The die
hards can still try to use macb in the tree if they want...
imp [Fri, 6 Dec 2013 18:32:03 +0000 (18:32 +0000)]
Bump the maximum VM space from 3 * memory size to a fixed
256MB. That's all we have room for since we map the hardware registers
starting at 0xd0000000. This allows my 64MB AT91SAM9G20 to boot again
after the unmmaped I/O changes were MFC'd at r251897. Other
subplatforms may need similar treatment.
dim [Thu, 5 Dec 2013 21:51:53 +0000 (21:51 +0000)]
MFC r257109:
Add clang-CC and CC to list of hints allowing clang to identify its operating
mode as c++ instead of defaulting to c for the binary names CC and clang-CC.
This fixes builds that use cmake, which automatically sets CXX to
/usr/bin/CC by default.
dim [Thu, 5 Dec 2013 21:49:41 +0000 (21:49 +0000)]
MFC r255076:
Pull in r189672 from upstream llvm trunk:
InstCombine: Check for zero shift amounts before subtracting one
causing integer overflow.
PR17026. Also avoid undefined shifts and shift amounts larger than 64
bits (those are always undef because we can't represent integer types
that large).
This should fix assertion failures when building the emulators/xmame
port.
dim [Thu, 5 Dec 2013 21:46:29 +0000 (21:46 +0000)]
MFC r253802:
Pull in r186696 from upstream clang trunk:
This patch implements __get_cpuid_max() as an inline and __cpuid()
and __cpuid_count() as macros to be compatible with GCC's cpuid.h.
It also adds bit_<foo> constants for the various feature bits as
described in version 039 (May 2011) of Intel's SDM Volume 2 in the
description of the CPUID instruction. The list of bit_<foo>
constants is a bit exhaustive (GCC doesn't do near this many). More
bits could be added from a newer version of SDM if desired.
Patch by John Baldwin!
This should fix several ports which depend on this functionality being
available.
mav [Thu, 5 Dec 2013 20:12:02 +0000 (20:12 +0000)]
MFC r244280 (by pjd):
sbuf_trim() cannot be used on sbuf with drain function set.
This fixes panic when listing sysctls on INVARIANTS-enabled kernel while
having wbwd loaded.
This panic was not fatal, at worst one additional space was printed.
Also sbuf_trim() makes some sense even if drain function is set. The drain
function is called only when buffer is to be expanded. So we could still trim
existing buffer before drain is called. In this case it worked just fine - the
trailing space was correctly trimmed.
yongari [Thu, 5 Dec 2013 07:31:01 +0000 (07:31 +0000)]
MFC r253540:
5725 family of devices corrupts TSO packets when TSO DMA buffers
cross into regions which are within MSS bytes of a 4GB boundary.
If we encounter the condition, drop the packet.
yongari [Thu, 5 Dec 2013 07:29:25 +0000 (07:29 +0000)]
MFC r253483:
Add support for upcoming BCM5725 (ASIC 5762) controller. This is a
new 1Gb server controller chip that will be going into production
soon.
BCM5725 combines MAC with triple-speed PHY, a Network Controller
Sideband Interface (NC-SI) and on-chip memory buffer in a single
device. BCM5725 has an Application Processing Engine (APE) that is
capable of on-chip management and offloading features. BCM5725
supports high-precision clock, time stamp registers for
receive/transmit packets and programmable trigger inputs and
watchdog timeouts. These new features are not yet supported by
bge(4).
Many thanks to Broadcom for continuing to support FreeBSD!
yongari [Thu, 5 Dec 2013 07:20:03 +0000 (07:20 +0000)]
MFC r253480:
Setup the PCIE Fast Training Sequence (FTS) value to prevent
transmit hangs for 57766 and non Ax versions of 57765.
While here, correct definition of BGE_CHIPREV_57765_AX.
yongari [Thu, 5 Dec 2013 07:18:32 +0000 (07:18 +0000)]
MFC r253408:
Implement workaround for BCM5719/BCM5720 TX hang.
The read DMA request logic operation is based on having sufficient
available space in the transmit data buffer (TXMBUF) before a read
DMA can be requested. There are four read DMA channels that use
the TXMBUF, and the logic checks if the available free space in the
TXMBUF is large enough for all the data in the four Send Buffers
for which buffer descriptors have been fetched. The Enable_Request
signal is asserted only if the free TXMBUF space is larger than the
sum of the four DMA length registers. The power-up default value
of BGE_RDMA_LSO_CRPTEN_CTRL register bit 25 (bit 21 on BCM5720) is
zero, which selects the DMA length registers to connect to the
input of the adder block. The DMA length registers are
asynchronously reset following BCM5719/BCM5720 power-up, and due to
the lack of synchronous deassertion of the length registers reset
signal these resisters may contain uninitialized values following
the reset deassertion.
In the case of the failure the uninitialized DMA length register
values added up to more than the TXMBUF size, which prevented the
assertion of the Enable_Request signal and any subsequent read DMA
to start. This lockup condition is the root cause of failing to
generate any transmit traffic.
To workaround the issue, select alternate output of multiplexers
and transmit the first four Ethernet frames. This overwrites the
DMA length registers with valid values.
kib [Tue, 3 Dec 2013 20:06:58 +0000 (20:06 +0000)]
MFC r258663:
Use sysctl KERN_PROC_SIGTRAMP to retrieve the signal trampoline
location for the native amd64 ABI. This fixes unwinding over the
signal frame after trampoline was moved to the shared page.
jhb [Tue, 3 Dec 2013 16:07:56 +0000 (16:07 +0000)]
MFC 253471,253620,254430,254538:
Change mmap() to more optimally use superpages and provide support for
tweaking alignment of virtual mappings.
- Add a new address space allocation method (VMFS_OPTIMAL_SPACE) for
vm_map_find() that will try to alter the alignment of a mapping to match
any existing superpage mappings of the object being mapped. If no
suitable address range is found with the necessary alignment,
vm_map_find() will fall back to using the simple first-fit strategy
(VMFS_ANY_SPACE).
- Change mmap() without MAP_FIXED, shmat(), shm_map(), and the GEM mapping
ioctl to use VMFS_OPTIMAL_SPACE instead of VMFS_ANY_SPACE.
- MAP_ALIGNED(n) requests a mapping aligned on a boundary of (1 << n).
Requests for n >= number of bits in a pointer or less than the size of
a page fail with EINVAL. This matches the API provided by NetBSD.
- MAP_ALIGNED_SUPER is a special case of MAP_ALIGNED. It can be used
to optimize the chances of using large pages. By default it will align
the mapping on a large page boundary (the system is free to choose any
large page size to align to that seems best for the mapping request).
However, if the object being mapped is already using large pages, then
it will align the virtual mapping to match the existing large pages in
the object instead.
- Internally, VMFS_ALIGNED_SPACE is now renamed to VMFS_SUPER_SPACE, and
VMFS_ALIGNED_SPACE(n) is repurposed for specifying a specific alignment.
MAP_ALIGNED(n) maps to using VMFS_ALIGNED_SPACE(n), while
MAP_ALIGNED_SUPER maps to VMFS_SUPER_SPACE.
- mmap() of a device object now uses VMFS_OPTIMAL_SPACE rather than
explicitly using VMFS_SUPER_SPACE. All device objects are forced to
use a specific color on creation, so VMFS_OPTIMAL_SPACE is effectively
equivalent.
rodrigc [Mon, 2 Dec 2013 18:20:07 +0000 (18:20 +0000)]
MFC r258737
In keg_dtor(), print out the keg name in the "Freed UMA keg was not empty"
message printed to the console. This makes it easier to track down
the source of certain memory leaks.
bdrewery [Mon, 2 Dec 2013 10:59:41 +0000 (10:59 +0000)]
MFC r258347,r258349:
Support SNI in libfetch
SNI is Server Name Indentification which is a protocol for TLS that
indicates the host that is being connected to at the start of the
handshake. It allows to use Virtual Hosts on HTTPS.
delphij [Thu, 28 Nov 2013 22:08:41 +0000 (22:08 +0000)]
MFC r257879:
Fix typo in r256646: We want to generate lists of directories in
INDEX-OLD and INDEX-NEW and compare them, not generate the same
list of directories from INDEX-OLD twice...
Pointy hats to: cperciva & everybody who didn't proofread
EN-13:04 enough
Errata Notice: FreeBSD-EN-13:05.freebsd-update
emaste [Wed, 27 Nov 2013 16:08:33 +0000 (16:08 +0000)]
MFC r258135: x86: Allow users to change PSL_RF via ptrace(PT_SETREGS...)
Debuggers may need to change PSL_RF. Note that tf_eflags is already stored
in the signal context during signal handling and PSL_RF previously could
be modified via sigreturn, so this change should not provide any new
ability to userspace.
For background see the thread at:
http://lists.freebsd.org/pipermail/freebsd-i386/2007-September/005910.html
dim [Mon, 25 Nov 2013 22:58:12 +0000 (22:58 +0000)]
MFC r258350:
Pull in r191896 from upstream llvm trunk:
CaptureTracking: Plug a loophole in the "too many uses" heuristic.
The heuristic was added to avoid spending too much compile time in a
specially crafted test case (PR17461, PR16474) with many uses on a
select or bitcast instruction can still trigger the slow case. Add a
check for that case.
This only affects compile time, don't have a good way to test it.
This fixes the excessive compile time spent on a specific file of the
graphics/rawtherapee port.
delphij [Mon, 25 Nov 2013 20:01:34 +0000 (20:01 +0000)]
MFC r246482 (rrs) + r246581:
This fixes a out-of-order problem with several of the newer
drivers. The basic problem was that the driver was pulling
the mbuf off the drbr ring and then when sending with xmit(),
encounting a full transmit ring. Thus the lower layer xmit()
function would return an error, and the drivers would then
append the data back on to the ring. For TCP this is a
horrible scenario sure to bring on a fast-retransmit.
The fix is to use drbr_peek() to pull the data pointer but
not remove it from the ring. If it fails then we either call
the new drbr_putback or drbr_advance method. Advance moves
it forward (we do this sometimes when the xmit() function
frees the mbuf). When we succeed we always call advance.
The putback will always copy the mbuf back to the top of the
ring. Note that the putback *cannot* be used with a
drbr_dequeue() only with drbr_peek(). We most of the time,
in putback, would not need to copy it back since most likey
the mbuf is still the same, but sometimes xmit() functions
will change the mbuf via a pullup or other call. So the
optimial case for the single consumer is to always copy it
back. If we ever do a multiple_consumer (for lagg?) we
will need a test and atomic in the put back possibly a
seperate putback_mc() in the ring buf.
avg [Mon, 25 Nov 2013 15:39:50 +0000 (15:39 +0000)]
MFC r258353: zfs page_busy: fix the boundaries of the cleared range
This is a fix for a regression introduced in r246293.
vm_page_clear_dirty expects the range to have DEV_BSIZE aligned boundaries,
otherwise it extends them. Thus it can happen that the whole page is
marked clean while actually having some small dirty region(s).
This commit makes the range properly aligned and ensures that only
the clean data is marked as such.
It would interesting to evaluate how much benefit clearing with DEV_BSIZE
granularity produces. Perhaps instead we should clear the whole page
when it is completely overwritten and don't bother clearing any bits
if only a portion a page is written.
jhb [Thu, 21 Nov 2013 20:09:44 +0000 (20:09 +0000)]
MFC 226145,226147,226148,226150,226151,226153,226157,226158,226164,226246,
226262,226329,226344,226608:
Merge most "infrastructure" changes to kdump to make other MFC's to add
new decodings, etc. easier:
- Some of the #defines or enums for which we auto-generate naming
functions may be wider than int, so use intmax_t throughout.
- Auto-generate kdump_subr.h.
- Use a switch statement instead of a giant if-else.
- Remove a lot of (void) casts.
- Bring ioctlname() in line with all the other *name() functions, which
actually print the name (or the numeric value, if they can't figure out
the correct name) instead of just returning a pointer to it. Also, since
ioctl numbers are not and probably never will be unique, drop support for
using a switch statement instead of an if/else chain.
- Mostly WARNS=6 clean.
- Update mkioctls to still work with both kdump and truss.
gjb [Mon, 18 Nov 2013 17:06:33 +0000 (17:06 +0000)]
MFC r257942, r258101:
r257942:
Fix a few style nits.
r258101:
Since the doc/ toolchain conversion to docbook 5.0, JADETEX
is no longer a valid option, so remove 'WITHOUT_JADETEX=yes'
from PBUILD_FLAGS.
While here, also remove 'WITHOUT_X11=yes', since it will
cause a dependency conflict by requiring both print/ghostscript9
and print/ghostscript9-nox11.
Switch to OPTIONSNG format (WITHOUT_* -> OPTIONS_UNSET='FOO'),
and unset the FOP option, which requires Java (although it is
disabled by default). Also unset the 'IGOR' option, since
textproc/igor is a validation tool, not necessarily a dependency
of the doc/ build itself.
While here, reduce the line length of PBUILD_FLAGS.
gjb [Mon, 18 Nov 2013 17:03:11 +0000 (17:03 +0000)]
MFC r257805, r257806, r257807:
r257805:
Add a 'mini-memstick.img' release target, which will use the
'bootonly.iso' components to create a smaller memory stick image.
This is useful for system recovery, where a full memstick.img image
is not necessarily needed (or wanted). In addition, it is possible to
do bootonly-style installation, where the base.txz, kernel.txz, etc.
are fetched from a remote source.
Provide backwards-compatible target (mini-memstick), to keep in sync
with the targets documented in release/Makefile.
r257806:
Remove extra target from 'memstick' in r257805.
r257807:
Update release(7) to include 'mini-memstick' target.
mav [Sat, 16 Nov 2013 15:41:54 +0000 (15:41 +0000)]
MFC r254787:
Remove locking from taskqueue_member(). The list of threads is static
during the taskqueue life cycle, so there is no need to protect it,
taking quite congested lock several more times for each ZFS I/O.
mav [Sat, 16 Nov 2013 10:43:02 +0000 (10:43 +0000)]
MFC r253647:
Decode some bits defined in AHCI 1.3.1 Device Sleep Technical Proposal.
For now this is only conmetics to report HBA capabilities (Haswell?).
jhb [Fri, 15 Nov 2013 15:08:53 +0000 (15:08 +0000)]
MFC 256293:
Sanitize the %eflags returned by BIOS routines. Some BIOS routines enter
protected mode and may leave protected-mode-specific flags like PSL_NT set
when they return to real mode. This can cause a fault when BTX re-enters
protected mode after the BIOS mode returns.
jhb [Thu, 14 Nov 2013 21:31:58 +0000 (21:31 +0000)]
MFC 255498:
- Document the UQUAD sysctl variants.
- Clarify that exactly one of the "access" flags is required and
list the optional flags in a separate list. Prefer bundling
CTLFLAG_TUN into the access flag by not documenting it as an
optional flag to set.
jhb [Thu, 14 Nov 2013 21:27:13 +0000 (21:27 +0000)]
MFC 255497:
Fix an off-by-one error when populating mincore(2) entries for
skipped entries. lastvecindex references the last valid byte,
so the new bytes should come after it.
jhb [Wed, 13 Nov 2013 18:33:14 +0000 (18:33 +0000)]
MFC 255248:
Use an unsigned long when indexing into mfchashtbl[] and mf6ctable[]. This
matches the types used when computing hash indices and the type of the
maximum size of mfchashtbl[].
jhb [Wed, 13 Nov 2013 17:08:37 +0000 (17:08 +0000)]
MFC 254699,255030:
Use tvtohz() to convert a socket buffer timeout to a tick value rather
than using a home-rolled version. The home-rolled version could result
in shorter-than-requested sleeps.
dim [Tue, 12 Nov 2013 18:43:35 +0000 (18:43 +0000)]
MFC r253917:
After r253839, which modifies ld's behaviour to not automatically pull
in needed libraries, change libc++.so into a linker script, so it can
automatically pull in libcxxrt.so.
[Note to stable/9 users: the above statement about ld's behaviour is not
(yet) applicable to the version of ld in 9.x, but this change will help
when building C++ programs with libc++, in combination with the ports
version of ld.]
gjb [Fri, 8 Nov 2013 02:31:37 +0000 (02:31 +0000)]
Remove evaluation of OSVERSION < 500000.
I hope to never have to build a release from a stable/5 machine.
While here, remove hard-coded lang/perl5.10, which is better
evaluated during compile-time (especially since lang/perl5.10 does
not exist in the ports/ tree).
This is a direct commit to stable/9, as this file does not exist in
higher branches.
dim [Thu, 7 Nov 2013 20:54:52 +0000 (20:54 +0000)]
MFC r257658:
For C++ programs, don't emit any explicit dependency to libstdc++.a or
libc++.a during the early build stages (bootstrap-tools, build-tools,
cross-tools), since it is not possible to know in advance which C++
library is available on the host system.
Instead, just use the bootstrap compiler's built-in default. This
should eventually make it possible to build stable/9 on head, or on
stable/10, which ship without libstdc++ by default.
jhb [Wed, 6 Nov 2013 20:58:04 +0000 (20:58 +0000)]
MFC 254287: Some small cleanups to the fixes in r180340:
- Set NOTE_TRACKERR before running filt_proc(). If the knote did not
have NOTE_FORK set in fflags when registered, then the TRACKERR event
could miss being posted.
- Don't pass the pid in to filt_proc() for NOTE_FORK events. The special
handling for pids is done knote_fork() directly and no longer in
filt_proc().
jhb [Wed, 6 Nov 2013 19:33:25 +0000 (19:33 +0000)]
MFC 254072:
Don't emit a spurious EVFILT_PROC event with no fflags set on process exit
if NOTE_EXIT is not being monitored. The rationale is that a listener
should only get an event for exit() if they registered interest via
NOTE_EXIT. This matches the behavior on OS X.
- Don't save the exit status on process exit unless NOTE_EXIT is being
monitored.
- Add an internal EV_DROP flag that requests kqueue_scan() to free the
knote without signalling it to userland and use this when a process
exits but the fflags in the knote is zero.