kib [Sun, 27 Mar 2016 08:21:17 +0000 (08:21 +0000)]
Split the global taskqueue used to process all UFS trim completions,
into per-mount taskqueue with the private taskqueue processing thread.
This allows to drain the taskqueue on unmount, to ensure that all
TRIMs are finished before mount structures are freed.
But just draining the taskqueue where TRIM biodone geom-up completions
are processed is not enough, since ffs_blkfree(), called by the task,
might result in more writes. Count inflight delayed blkfree's and
pause() unmount until the counter drains as well.
Reported by: Nick Evans <nevans@talkpoint.com>
Tested by: Nick Evans <nevans@talkpoint.com>, pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
dim [Sun, 27 Mar 2016 00:37:54 +0000 (00:37 +0000)]
Compile libcxxrt as C++11, since it is only really used in combination
with libc++, which is also C++11. Also change one _Static_assert (which
is really C11) back into static_assert, like upstream.
This should help when compiling libcxxrt with newer versions of gcc,
which refuse to recognize any form of static assertions, if not
compiling for C++11 or higher.
While here, add -nostdinc++ to CFLAGS, to prevent picking up any C++
headers outside the source tree.
np [Sat, 26 Mar 2016 23:39:53 +0000 (23:39 +0000)]
Plug leak in m_unshare.
m_unshare passes on the source mbuf's flags as-is to m_getcl and this
results in a leak if the flags include M_NOFREE. The fix is to clear
the bits not listed in M_COPYALL before calling m_getcl. M_RDONLY
should probably be filtered out too but that's outside the scope of this
fix.
Add assertions in the zone_mbuf and zone_pack ctors to catch similar
bugs.
Update netmap_get_mbuf to not pass M_NOFREE to m_getcl. It's not clear
what the original code was trying to do but it's likely incorrect.
Updated code is no different functionally but it avoids the newly added
assertions.
mmel [Sat, 26 Mar 2016 12:19:27 +0000 (12:19 +0000)]
ARM: Fix bug introduced in r297286.
- don't put command line without guard to kernel environment.
- kernel environment delivered from ubldr must have absolute precedence.
mmel [Sat, 26 Mar 2016 06:59:01 +0000 (06:59 +0000)]
ARM: Parse command line delivered by U-Boot:
- in atags
- in DT blob (by using 'fdt chosen' U-Boot command)
The command line must start with guard's string 'FreeBSD:' and can contain
list of comma separated kenv strings. Also, boot modifier strings from
boot.h are recognised and parsed into boothowto.
The command line must be passed from U-Boot by setting of bootargs variable:
'setenv bootargs FreeBSD:boot_single=1,vfs.root.mountfrom=ufs:/dev/ada0s1a'
followed by 'fdt chosen' (only for DT based boot)
mmel [Sat, 26 Mar 2016 06:57:36 +0000 (06:57 +0000)]
ARM: Fix ATAG handling in LINUX_BOOT_API:
- Don't convert atags address passed from U-Boot. It's real physical
address (and we have 1:1 mapping).
- Size of tags is encoded in words, not in bytes
mmel [Sat, 26 Mar 2016 06:55:55 +0000 (06:55 +0000)]
ARM: Teach LINUX_BOOT_ABI to recognize DT blob.
This allow us to boot FreeBSD kernel (using uImage encapsulation) directly
from U-boot using 'bootm' command or by Android fastboot loader.
For now, kernel uImage must be marked as Linux, but we can add support for
FreeBSD into U-Boot later.
bdrewery [Fri, 25 Mar 2016 19:12:41 +0000 (19:12 +0000)]
Update flags for external GCC.
- The -L WORLDTMP/usr/lib is not needed as GCC is already adding in
-L =/usr/lib internally with --sysroot. It does not do this for
header include paths though, thus passing -isystem =/usr/include is
still needed.
For the forced libc++ usage:
- Use -isystem rather than -I for libc++ headers.
- Use -std=c++11 rather than gnu++11.
- Use -nostdinc++ to ensure GCC's headers don't leak in.
bdrewery [Fri, 25 Mar 2016 19:12:38 +0000 (19:12 +0000)]
Build libcompat (lib32) with a --sysroot pointing into its stage directory.
This overrides the cross-compiler's default sysroot to use the WORLD32's
sysroot for building the lib32 libraries. Previously the cross-compiler
would default the sysroot to the 64bit WORLDTMP and -B/-L/-isystem flags
were used to build using the lib32 files. This leads to multiple issues
discussed later. Some extra headers are now needed to be staged since the
64bit WORLDTMP is not referenced at all for headers. The 64bit WORLDTMP
is still used via PATH for build tools. Overriding the default
target/arch is retained in the CC/CXX overrides.
This allows reverting the LDSCRIPT rewriting in installworld from r296921 and
r235122, thus allowing read-only objdirs to work for installing again.
This removes the need for _LDSCRIPTROOT.
This allows progressing the change to always use --sysroot for the build
rather than only relying on the cross-compiler's default sysroot. The
work for that is in D3970 and needed to resolve WITHOUT_CROSS_COMPILER
not using a --sysroot [1].
bdrewery [Fri, 25 Mar 2016 19:12:13 +0000 (19:12 +0000)]
LIBRARIES_ONLY should only be defined during install32.
r245561 added it to prevent extra files from being installed during
the install32 phase (to prevent duplicates in the meta log with -DNO_ROOT).
The flag should not be passed during build32 though since it may
prevent staging of includes during the 'make includes' phase on
library directories.
bdrewery [Thu, 24 Mar 2016 21:48:01 +0000 (21:48 +0000)]
Explicit 'make obj' for library dirs in build32 is not needed.
In r138291 some directories were explicitly made to run 'make obj',
but each target in 'make libraries' already runs 'make obj' for
each library since r161580.
ed [Thu, 24 Mar 2016 21:47:15 +0000 (21:47 +0000)]
Replace the CloudABI system call table by a machine generated version.
The type definitions and constants that were used by COMPAT_CLOUDABI64
are a literal copy of some headers stored inside of CloudABI's C
library, cloudlibc. What is annoying is that we can't make use of
cloudlibc's system call list, as the format is completely different and
doesn't provide enough information. It had to be synced in manually.
We recently decided to solve this (and some other problems) by moving
the ABI definitions into a separate file:
This file is processed by a pile of Python scripts to generate the
header files like before, documentation (markdown), but in our case more
importantly: a FreeBSD system call table.
This change discards the old files in sys/contrib/cloudabi and replaces
them by the latest copies, which requires some minor changes here and
there. Because cloudabi.txt also enforces consistent names of the system
call arguments, we have to patch up a small number of system call
implementations to use the new argument names.
The new header files can also be included directly in FreeBSD kernel
space without needing any includes/defines, so we can now remove
cloudabi_syscalldefs.h and cloudabi64_syscalldefs.h. Patch up the
sources to include the definitions directly from sys/contrib/cloudabi
instead.
dim [Thu, 24 Mar 2016 20:55:23 +0000 (20:55 +0000)]
Pull in r264335 from upstream llvm trunk:
Add <atomic> to ThreadPool.h, since std::atomic is used
Summary:
Apparently, when compiling with gcc 5.3.2 for powerpc64, the order of
headers is such that it gets an error about std::atomic<> use in
ThreadPool.h, since this header is not included explicitly. See also:
https://llvm.org/bugs/show_bug.cgi?id=27058
Fix this by including <atomic>. Patch by Bryan Drewery.
emaste [Thu, 24 Mar 2016 20:13:17 +0000 (20:13 +0000)]
elfcopy: overhaul of LMA handling
Merge ELF Tool Chain r3434:
Previously, elfcopy defines:
VMA: section virtual address
LMA: PHDR(p_vaddr)
While binutils(libbfd) defines:
VMA: section virtual address and PHDR(p_vaddr).
LMA: PHDR(p_paddr)
For elfcopy, p_paddr is considered not meaningful and is always set
to the same value as p_vaddr.
elfcopy was implemented that way because I thought p_paddr is not
used/meaningful according to the ELF ABI. However it turned out
p_paddr is at least used in some ELF files, e.g. the FreeBSD kernel.
This change made elfcopy treat p_paddr as LMA, same as libbfd.
(However, some VMA/LMA related command line option still need tweaking
to make them compatible with binutils objcopy. This will be improved
later)
bz [Thu, 24 Mar 2016 11:40:10 +0000 (11:40 +0000)]
Fix compile errors after r297225:
- properly V_irtualise variable access unbreaking VIMAGE kernels.
- remove the volatile from the function return type to make architecture
using gcc happy [-Wreturn-type]
"type qualifiers ignored on function return type"
I am not entirely happy with this solution putting the u_int there
but it will do for now.
mav [Thu, 24 Mar 2016 10:10:41 +0000 (10:10 +0000)]
Unify ignoring EEXIST from zvol_create_minor().
This fixes creation of zvol devices for snapshots during zfs receive,
that previously failed with "ZFS WARNING: Unable to create ZVOL" message.
This solution is not perfect, but IMHO better then it was before.
kib [Thu, 24 Mar 2016 09:56:53 +0000 (09:56 +0000)]
Handle the driver KPI change from r292373. Ensure that managed device
pagers fault routines always return with a result page, be it the
proper and valid result page, or initially passed freshly allocated
placeholder. Do not free the passed in page until we are able to
provide the replacement, and do not assign NULL to *mres.
Reported and tested by: dumbbell
Reviewed by: royger (who also verified that Xen code is safe)
Sponsored by: The FreeBSD Foundation
skra [Thu, 24 Mar 2016 09:55:11 +0000 (09:55 +0000)]
Generalize IPI support for ARM intrng and use it for interrupt
controller IPI provider.
New struct intr_ipi is defined which keeps all info about an IPI:
its name, counter, send and dispatch methods. Generic intr_ipi_setup(),
intr_ipi_send() and intr_ipi_dispatch() functions are implemented.
An IPI provider must implement two functions:
(1) an intr_ipi_send_t function which is able to send an IPI,
(2) a setup function which initializes itself for an IPI and
calls intr_ipi_setup() with appropriate arguments.
gnn [Thu, 24 Mar 2016 07:54:56 +0000 (07:54 +0000)]
FreeBSD previously provided route caching for TCP (and UDP). Re-add
route caching for TCP, with some improvements. In particular, invalidate
the route cache if a new route is added, which might be a better match.
The cache is automatically invalidated if the old route is deleted.
Submitted by: Mike Karels
Reviewed by: gnn
Differential Revision: https://reviews.freebsd.org/D4306
bdrewery [Thu, 24 Mar 2016 04:40:07 +0000 (04:40 +0000)]
Pass the expected struct radix_node_head * to vfs_free_netcred.
No functional change.
struct radix_node_head's first element is rh so this was already
referring to the same address. It was likely an unintended
s/rnh/&rnh->rh/ change from r294706 as all other rnh_walktree() callers
pass the expected struct radix_node_head * rather than obscurely passing
the address of their first element.
sephe [Thu, 24 Mar 2016 02:15:23 +0000 (02:15 +0000)]
hyperv/vmbus: Create per-cpu fast taskqueue for msg handling
Using one taskqueue does not work, since the EOM MSR must be written
on the msg's owner CPU.
Noticed by: Jun Su <junsu microsoft com>
Discussed with: Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
sephe [Thu, 24 Mar 2016 00:40:41 +0000 (00:40 +0000)]
hyperv/vmbus: use a better retry method in hv_vmbus_post_message()
Most often, hv_vmbus_post_message() doesn't fail. However, it fails
intermittently when GPADLs of large shared memory is to be established
with the host, e.g. on the hn(4) attach path: a GPADL of 15MB sendbuf
is created, for which lots of messages will be flooded to the host.
The host side tries to throttle the message rate by returning
HV_STATUS_INSUFFICIENT_BUFFERS.
Before this commit, we do several retries for failed messages, but the
delay between each retry is pretty/too low, which will cause sporadic
message posting failure. We now use large delay (>=1ms) between each
retry to fix the message posting failure.
Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5715
jhb [Thu, 24 Mar 2016 00:24:07 +0000 (00:24 +0000)]
Enable interrupts on the BSP once all PICs are initialized.
This moves the enabling of interrupts slightly earlier (the old location
was still before devices were enumerated and probed) and does it in the
interrupt code (rather than in the device configuration code). This
also avoids tripping over an assertion on the first TLB shootdown with
earlier AP startup.
jmcneill [Wed, 23 Mar 2016 19:26:53 +0000 (19:26 +0000)]
Fix support for fixed factor clocks.
- Use a different device description for fixed and fixed factor clocks.
- Fix a bug where the "clock-div" property was stored in the "mult" field
of the clock definition.
- Get the fixed factor parent clock by index instead of by name, as a
clock-names property is not required to be present here.
Reviewed by: mmel, adrian (mentor)
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D5703
jmcneill [Wed, 23 Mar 2016 19:24:09 +0000 (19:24 +0000)]
clk_parse_ofw_out_names is supposed to return a list of indices when the
clock-indices property is present, so change the "uint32_t *indices" parameter
to "uint32_t **indices" to allow this.
Reviewed by: mmel, adrian (mentor)
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D5702
dim [Wed, 23 Mar 2016 19:17:12 +0000 (19:17 +0000)]
For C++, expose long long types and functions (lldiv_t, llabs, lldiv,
etc) in stdlib.h. These will be needed for newer versions of libc++,
which uses them for defining overloaded versions of abs() and div().
trasz [Wed, 23 Mar 2016 12:13:53 +0000 (12:13 +0000)]
Make the autofs(5) -hosts map more robust, primarily to make it correctly
handle NFS shares containing whitespace. This also adds the -E parameter
to showmount(8).
Reviewed by: emaste@, jhibbits@, wblock@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5649
bdrewery [Tue, 22 Mar 2016 22:41:14 +0000 (22:41 +0000)]
Handle copyin failures.
Skip the log entry as there is nothing good to write out. Don't fail
the syscall though since it already succeeded. There's no reason
filemon's tracing failure should fail the already-succeeded syscall.
Record the error for later to return from close(2) on the filemon devfs
file descriptor.
bdrewery [Tue, 22 Mar 2016 22:41:03 +0000 (22:41 +0000)]
Follow-up r297156: Close the log in filemon_dtr rather than in the last reference.
If the tracer has decided to the close the log then it should be fully
written, not getting more entries, when close(2) returns. This was
a regression in r297156 in that it allowed a traced process to continue
a traced syscall and add more entries to the log while the tracer had
already closed its fd or exited. This was only really part of the
daemonized process case which is abnormal.
np [Tue, 22 Mar 2016 18:56:23 +0000 (18:56 +0000)]
cxgbe(4): Be consistent and call ETHER_BPF_MTAP before writing anything
to the descriptor ring no matter what path the frame takes within the
driver's tx.
jtl [Tue, 22 Mar 2016 15:55:17 +0000 (15:55 +0000)]
to_flags is currently a 64-bit integer; however, we only use 7 bits.
Furthermore, there is no reason this needs to be a 64-bit integer
for the forseeable future.
Also, there is an inconsistency between to_flags and the mask in
tcp_addoptions(). Before r195654, to_flags was a u_long and the mask in
tcp_addoptions() was a u_int. r195654 changed to_flags to be a u_int64_t
but left the mask in tcp_addoptions() as a u_int, meaning that these
variables will only be the same width on platforms with 64-bit integers.
Convert both to_flags and the mask in tcp_addoptions() to be explicitly
32-bit variables. This may save a few cycles on 32-bit platforms, and
avoids unnecessarily mixing types.
bz [Tue, 22 Mar 2016 15:43:47 +0000 (15:43 +0000)]
Mfp4 @180378:
Factor out nd6 and in6_attach initialization to their own files.
Also move destruction into those files though still called from
the central initialization.
Sponsored by: CK Software GmbH
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: gnn
Differential Revision: https://reviews.freebsd.org/D5033
trasz [Tue, 22 Mar 2016 13:46:01 +0000 (13:46 +0000)]
Wait for root mount tokens before showing the root mount prompt.
This restores the pre-r290196 behaviour, eliminating the need to manually
press '.' a couple of times to get USB to finish probing.
Note that there's still something wrong with the console (character
echoing doesn't quite work), and there's also a reported problem with
BHyVe, but those two don't seem related to the problem above.
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
gnn [Tue, 22 Mar 2016 13:16:52 +0000 (13:16 +0000)]
Add an mbuf provider to DTrace.
The mbuf provider is made up of a set of Statically Defined Tracepoints
which help us look into mbufs as they are allocated and freed. This can be
used to inspect the buffers or for a simplified mbuf leak detector.
tuexen [Tue, 22 Mar 2016 12:40:09 +0000 (12:40 +0000)]
Support checksum offloading for TCP/IPV6 and UDP/IPV6.
Support SCTP checksum offloading for SCTP/IPV6.
Support SCTP checksum offloading on all controllers except 82575.
bz [Tue, 22 Mar 2016 12:12:01 +0000 (12:12 +0000)]
Adding pci_host_generic unconditionally breaks ARM boards with a PCI(e) interface.
Make it a device option to be included in the kernel configs that request this file.
kib [Tue, 22 Mar 2016 10:51:42 +0000 (10:51 +0000)]
Apparently there are some popular programs around which assume that it
is safe to call pthread_mutex_init() on the same shared mutex several
times. POSIX claims that the behaviour in this case is undefined.
Make this working by only allowing one caller to initialize the mutex.
Other callers either see already completed initialization and do
nothing, or busy-loop yielding while designated initializer finishes.
Also make the API requirements loose by initializing mutexes on other
pthread_mutex*() calls if they see uninitialized shared mutex.
Only mutexes provide the hack for now, but it could be also
implemented for other process shared primitives from libthr.
Reported and tested by: "Oleg V. Nauman" <oleg@opentransfer.com>
Sponsored by: The FreeBSD Foundation
andrew [Tue, 22 Mar 2016 08:36:25 +0000 (08:36 +0000)]
Use the saved program state register to detect when an exception frame is
from userpsace. Previously we could have triggered a panic by trying to
jump to a kernel address from userland as the trap handling code thought we
received an ast in kernel mode.
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation