Ed Schouten [Fri, 5 Sep 2014 05:36:32 +0000 (05:36 +0000)]
Roll back r271012 even more aggressively.
I've looked at the GCC sources and I now understand what's going wrong.
THe C11 keywords are simply nonexistent when using C++ mode. They are
marked as C-only in the parser. This is absolutely impractical for
multiple reasons:
- The C11 keywords do not conflict with C++ naming rules. They all start
with _[A-Z]. There is no reason to make them C-only.
- It makes it practically impossible for people to use these keywords in
C header files and expect them to work from within C++ sources.
As I said in my previous commit message: GCC is by far the weirdest
compiler that I've ever used.
Ed Schouten [Fri, 5 Sep 2014 05:20:52 +0000 (05:20 +0000)]
Partially revert r271012.
Incredibly weird: GCC 4.7/4.9 do support the _Noreturn and _Thread_local
keywords, but not during bootstrapping. GCC is by far the weirdest
compiler that I've ever used.
The legacy USB circuit tends to give trouble on MacBook.
While the original report covered MacBook, extend the fix
preemptively for the newer MacBookPro too.
use a straight buffer instead of an iov w/ 1 segment... The aesni
driver when it hits a mbuf/iov buffer, it mallocs and copies the data
for processing.. This improves perf by ~8-10% on my machine...
I have thoughts of fixing AES-NI so that it can better handle segmented
buffers, which should help improve IPSEC performance, but that is for
the future...
Warner Losh [Thu, 4 Sep 2014 22:22:53 +0000 (22:22 +0000)]
Separate out PCI attachment from the main AHCI driver. Move checks of
PCI IDs into quirks, which mostly fit (though you'd get no argument
from me that AHCI_Q_SATA1_UNIT0 is oddly specific). Set these quirks
in the PCI attachment. Make some shared functions public so that PCI
and possibly other bus attachments can use them.
The split isn't perfect yet, but it is functional. The split will be
perfected as other bus attachments for AHCI are written.
Sean Bruno [Thu, 4 Sep 2014 21:31:25 +0000 (21:31 +0000)]
Allow multiple image activators to run on the same execution by changing
imgp->interpreted to a bitmask instead of, functionally, a bool. Each
imgactivator now requires its own flag in interpreted to indicate whether
or not it has already examined argv[0].
Change imgp->interpreted to an unsigned char to add one extra bit for
future use.
With this change, one can execute a shell script from a 64bit host native
make and still get the binmisc image activator to fire for the script
interpreter. Prior to this, execution would fail.
Warner Losh [Thu, 4 Sep 2014 21:28:25 +0000 (21:28 +0000)]
Delete old arm dts tree. This was created by cherry picking from a
full vendor tree. This worked great until it was time to update, but
now it is time to update. Hit the rest button by removing this branch
and re-adding it by a full copy of whatever is in the vendor tree.
Warner Losh [Thu, 4 Sep 2014 21:26:34 +0000 (21:26 +0000)]
Properly trim the vendor tree to include only those files that we want
merged into FreeBSD. Cherry picking from a full vendor tree was too
hard and lead to undestirable svn results.
Note: We only tim the dts* files, we don't trim the dt-bindings tree,
since having all of them causes no problems and the benefit to
trimming there is far out weighed by the cost of doing the trim each
time.
John Baldwin [Thu, 4 Sep 2014 19:09:08 +0000 (19:09 +0000)]
In tcp_input(), don't acquire the pcbinfo global write lock for SYN
packets targeting a listening socket. Permit to reduce TCP input
processing starvation in context of high SYN load (e.g. short-lived TCP
connections or SYN flood).
Ian Lepore [Thu, 4 Sep 2014 14:57:04 +0000 (14:57 +0000)]
Implement the same public interface in imx51 and imx6 iomux; use the common
header file for both. Remove some unused code from imx51_iomux. The iomux
drivers are required, not optional, adjust the files.* entries accordingly.
Revert r269814: blkfront: add support for unmapped IO
Current busdma code for unmapped bios will not properly align the segment
size, causing corruption on blkfront devices. Revert the commit until
busdma code is fixed.
John Baldwin [Thu, 4 Sep 2014 14:26:25 +0000 (14:26 +0000)]
Merge the amd64 and i386 identcpu.c into a single x86 implementation.
This brings the structured extended features mask and VT-x reporting to
i386 and Intel cache and TLB info (under bootverbose) to amd64.
Improve r265338. When inserting mbufs into TCP reassembly queue,
try to collapse adjacent pieces using m_catpkt(). In best case
scenario it copies data and frees mbufs, making mbuf exhaustion
attack harder.
Suggested by: Jonathan Looney <jonlooney gmail.com>
Security: Hardens against remote mbuf exhaustion attack.
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
Systems with lots of geom providers can end up with a kern.geom.confxml
value too large for the buffer allocated. Work around this by retrying
a few times with larger buffer sizes.
Ian Lepore [Thu, 4 Sep 2014 03:04:37 +0000 (03:04 +0000)]
The imx5x and imx6 chips have an onboard IOMUX device which also contains a
few "general purpose registers" whose values control chip behavior in ways
that have nothing to do with IO pin mux control. Define a simple API that
other soc-specific code can use to read and write the registers, and provide
the imx51 implementation of them.
John Baldwin [Thu, 4 Sep 2014 02:25:59 +0000 (02:25 +0000)]
- Move blacklists of broken TSCs out of the printcpuinfo() function
and into the TSC probe routine.
- Initialize cpu_exthigh once in finishidentcpu() which is called
before printcpuinfo() (and matches the behavior on amd64).
John Baldwin [Thu, 4 Sep 2014 01:46:06 +0000 (01:46 +0000)]
- Move prototypes for various functions into out of C files and into
<machine/md_var.h>.
- Move some CPU-related variables out of i386/i386/identcpu.c to
initcpu.c to match amd64.
- Move the declaration of has_f00f_hack out of identcpu.c to machdep.c.
- Remove a misleading comment from i386/i386/initcpu.c (locore zeros
the BSS before it calls identify_cpu()) and remove explicit zero
assignments to reduce the diff with amd64.
Do not blindly announce 1000baseT half-duplex capability in
autonegotiation. Some controllers like cgem(4) do not support
half-duplex at gigabit speeds.
Warner Losh [Wed, 3 Sep 2014 21:59:07 +0000 (21:59 +0000)]
Create a /boot/dtb directory to house DTB blobs. The flattened device
tree support includes a device tree source compiler dtc(8) which
converts .dts files into .dtb files. /boot/loader will load dtb files
from this directory by default, allowing for fewer differences between
images for different SoCs. Compiled dts files will wind up here
eventually as an alternative to embedding them into the kernel.
Document this in hier(7), as well as add missing entries for
/boot/firmware and /boot/zfs, though the latter two should only be
considered place holders if someone wants to make them better.
Ian Lepore [Wed, 3 Sep 2014 19:37:41 +0000 (19:37 +0000)]
Remove DIAGNOSTIC from the kernel config of low-end arm systems. Sanity
checks such as vmem_check() can make a low-end system go completely
unresponsive for as much as 3 seconds out of every 10.
John Baldwin [Wed, 3 Sep 2014 19:01:34 +0000 (19:01 +0000)]
Always seek back to the beginning of a regular directory, even if the
previous seek location was 0. Without this, readdir() would see
dd_loc of zero and call getdirentries() which would start reading
entries at the current seek location of the directory ignoring the
first batch of entries. Also, rewinddir() should always seek so that
it reads the directory from the beginning to get updated entries.
PR: 192935
Reported by: iron@mail.ua
MFC after: 3 days
Ed Maste [Wed, 3 Sep 2014 18:51:33 +0000 (18:51 +0000)]
Avoid ./ in zoneinfo entries in METALOG
Use of "find ." resulted in METALOG entries with an extra ./ -- e.g.,
./usr/share/zoneinfo/./America/Toronto. Avoid this by using globbing
via "find *" instead.
Ian Lepore [Wed, 3 Sep 2014 17:51:03 +0000 (17:51 +0000)]
Fixes and enhancements for the if_cgem driver...
- miibus fixes as suggested by Yonghyeon Pyun.
- enable VLAN MTU support.
- fix a few WITNESS complaints in cgem_attach().
- have cgem_attach() properly init the ifnet struct before calling
mii_attach() to fix panic when using e1000phy.
- fix ethernet address changing.
- fix transmit queue overflow handling.
- tweak receive queue handling to reduce receive overflows.
- bring out MAC statistic counters to sysctls.
- add e1000phy to config file.
- implement receive hang work-around described in reference guide.
- change device name from if_cgem to cgem to be consistent with other
interfaces.
John Baldwin [Wed, 3 Sep 2014 17:26:46 +0000 (17:26 +0000)]
Import a hackish tool I use to examine the skew of the TSC across
CPUs in a system. The tool queries the kernel for its set of CPUs
and compares TSC values on each of the additional CPUs to the first
CPU in turn. It then outputs a table of simple statistics.
Sean Bruno [Wed, 3 Sep 2014 15:32:38 +0000 (15:32 +0000)]
Do not direct commit to contrib/llvm. Make the change a patch file instead.
Reverts 271025 but still functionally patches it. Original intent is still
the same. Pointed out by rdivacky.
MFV: Only emit movw on ARMv6T2
Building for the FreeBSD default target ARMv6 was emitting movw ASM on certain
test cases (found building qmake4/5 for ARM). Don't do that, moreover, the AS
in base doesn't understand this instruction for this target. One would need
to use --integrated-as to get this to build if desired.
Sean Bruno [Wed, 3 Sep 2014 14:16:50 +0000 (14:16 +0000)]
MFV: Only emit movw on ARMv6T2
Building for the FreeBSD default target ARMv6 was emitting movw ASM on certain
test cases (found building qmake4/5 for ARM). Don't do that, moreover, the AS
in base doesn't understand this instruction for this target. One would need
to use --integrated-as to get this to build if desired.
* Unconditionally turn on SIOCGI2C probing for all interfaces
on "ifconfig -v". I've seen no measurable timing difference
for doing additional SIOCGI2C call for system with 4k vlans.
* Determine appropriate handler (SFP/QSFP) by reading identification
byte (which is the same for both SFF-8472 and SFF-8436) instead
of checking driver name.
Ed Schouten [Wed, 3 Sep 2014 09:35:38 +0000 (09:35 +0000)]
Leave the C11 keywords alone when we have a recent version of GCC.
As GCC also gained support for the C11 keywords over time, we can patch
up <sys/cdefs.h> to not define these anymore. This has the advantage
that error messages for static assertions are printed natively and that
_Alignas() will work with even a type outside of C11 mode.
All C11 keywords are supported with GCC 4.7 and higher, with the
exception of _Thread_local and _Generic. These are only supported as of
GCC 4.9.
Right now, thread_single(SINGLE_EXIT) returns after the p_numthreads
reaches 1. The p_numthreads counter is decremented in thread_exit() by
a call to thread_unlink(). This means that the exiting threads may
still execute on other CPUs when thread_single(SINGLE_EXIT) returns.
As result, vmspace could be destroyed while paging structures are
still used on other CPUs by exiting threads.
Delay the return from thread_single(SINGLE_EXIT) until all threads are
really destroyed by thread_stash() after the last switch out. The
p_exitthreads counter already provides the required mechanism, move
the wait from the thread_wait() (which is called from wait(2) code)
into thread_single().
Reported by: many (as "panic: pmap active <addr>")
Reviewed by: alc, jhb
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Ed Schouten [Wed, 3 Sep 2014 06:34:16 +0000 (06:34 +0000)]
Partially revert r270964. Don't test for C++11 to define _Thread_local.
In addition to Clang 3.3, it turns out that GCC 4.7 in Ports also does
not support the _Thread_local keyword. Let's document this in a bit more
detail.
Warner Losh [Wed, 3 Sep 2014 00:32:19 +0000 (00:32 +0000)]
Invoke make_dtb with MACHINE defined for enhanced cross building
friendliness. This should restore old-fashioned kernel building in a
cross environment, though this has only had limited testing.
Mark Johnston [Tue, 2 Sep 2014 23:43:06 +0000 (23:43 +0000)]
Define _DTRACE_VERSION in sdt.h rather than setting it manually. This is
similar to what illumos does, and makes it easier to enable USDT probes
in third-party software that doesn't make use of the system makefiles.
Ed Maste [Tue, 2 Sep 2014 19:05:34 +0000 (19:05 +0000)]
Allow standalone debug for non-default ${PROG} targets
This allows WITH_DEBUG_FILES to produce standalone debug for the ELF
runtime linker.
We previously disabled standalone debug files for bsd.prog.mk consumers
that included a non-default ${PROG} target, but this is not required.
Consumers that do not support standalone debug are still handled by
disabling it for statically linked binaries, and for those that specify
a non-default binary format.
Fix for WITNESS warning while doing xpt_rescan.
This happen when converting any JBOD to RAID or creating
any new RAID from Unconfigured Drives.
Without this fix, user may see below call trace if WITNESS is enabled.
witness_warn() at witness_warn+0x4b5/frame 0xfffffe011f929a00
uma_zalloc_arg() at uma_zalloc_arg+0x3b/frame 0xfffffe011f929a70
malloc() at malloc+0x192/frame 0xfffffe011f929ac0
mrsas_bus_scan_sim() at mrsas_bus_scan_sim+0x32/frame 0xfffffe011f929af0
mrsas_aen_handler() at mrsas_aen_handler+0x11c/frame 0xfffffe011f929b20
taskqueue_run_locked() at taskqueue_run_locked+0xf0/frame 0xfffffe011f929b80
taskqueue_thread_loop() at taskqueue_thread_loop+0x9b/frame 0xfffffe011f929bb0
fork_exit() at fork_exit+0x84/frame 0xfffffe011f929bf0
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe011f929bf0
Submitted by: kadesai
Reviewed by: ambrisko
MFC after: 3 days
Warner Losh [Tue, 2 Sep 2014 16:38:00 +0000 (16:38 +0000)]
The proper compatibility string for the AHCI device is
allwinner,sun4i-ahci, so use that instead of the older string which
had become FreeBSD specific.
Ed Schouten [Tue, 2 Sep 2014 11:16:44 +0000 (11:16 +0000)]
Clean up <sys/cdefs.h> slightly.
- Remove c++0x hack from <sys/cdefs.h> that was needed when Clang did
not fully implement C++11. We can now safely test against C++11 to
check whether thread_local is available, like we do for all other
C++11 keywords.
- Don't use __clang__ to test for thread safety annotation presence. It
turns out we have a proper attribute for this.
Ian Lepore [Tue, 2 Sep 2014 03:23:05 +0000 (03:23 +0000)]
Create an interface for drivers to enable or disable their clocks as listed
in the clocks=<...> properties of their FDT data. The clock properties
consist of 2-cell tuples, each containing a clock device node reference and
a clock number. A clock device driver can register itself as providing
this interface, then other drivers can turn the FDT clock node reference
into the corresponding device_t so that they can use the interface to query
and manipulate their clocks.
This provides convenience functions to enable or disable all the clocks
listed in the properties for a device, so most drivers will be able to
manage their clocks with a single call to fdt_clock_enable_all(dev).
Ian Lepore [Tue, 2 Sep 2014 02:56:43 +0000 (02:56 +0000)]
The anatop driver controls power and PLLs and needs to be available before
just about anything else (other than octop which provides it config info),
so make it an EARLY_DRIVER_MODULE().
Ian Lepore [Tue, 2 Sep 2014 02:54:55 +0000 (02:54 +0000)]
The ocotp driver provides access to registers containing chip configuration
data that is needed by other drivers, so make it an EARLY_DRIVER_MODULE()
that loads before just about anything else.
Fix a bug where command line arguments could be misprocessed if getopts is
used prior to f_dialog_init() -- e.g., in a script that sets
DIALOG_SELF_INITIALIZE to NULL, preventing f_dialog_init() from being run
automaticaly when `dialog.subr' is included. Caused by sub-shell processing
of arguments inheriting prior value of $OPTIND, used by getopts. Solved by
unsetting OPTIND prior to [re-]processing of positional arguments.
Ian Lepore [Mon, 1 Sep 2014 22:40:31 +0000 (22:40 +0000)]
Create a mechanism for looking up a device_t associated with an ofw/fdt
xref handle, and for registering that association. Also use the same data
for faster translations between node and xref handles.
Now when fdt properties contain &othernode references, a driver can find
the device instance that corresponds to &othernode, and thus can use
interfaces provided by that instance.
Add bsearch_b to the libc map and the stdlib header.
bsearch_b is the Apple blocks enabled version of bsearch(3).
This was added to libc in Revision 264042 but the commit
missed the declaration required to make use of it.
While here move some other block-related functions to the
BSD_VISIBLE block as these are non-standard.
Ed Schouten [Mon, 1 Sep 2014 20:18:09 +0000 (20:18 +0000)]
Add -Wthread-safety to WARNS=6.
While there, add a NO_WTHREAD_SAFETY flag that can be used to disable
this specific warning flag. Disable it for auditdistd. We can easily
patch up auditdistd to have the right annotations to build, but as
auditdistd is intended to be portable across other operating systems,
it's not worth the effort.
Steve Kargl [Mon, 1 Sep 2014 18:57:13 +0000 (18:57 +0000)]
According to the ISO C standard, lgamma(-integer) returns
inf and raises the divided-by-zero exception. Compilers
constant fold one/zero to inf but do not raise the exception.
Introduce a volatile vzero to prevent the constant folding.
Move the declaration of zero into the main declaration block.