]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
9 years agoMechanically convert cddl sun #ifdef's to illumos
smh [Sat, 17 Jan 2015 14:44:59 +0000 (14:44 +0000)]
Mechanically convert cddl sun #ifdef's to illumos

Since the upstream for cddl code is now illumos not sun, mechanically
convert all sun #ifdef's to illumos #ifdef's which have been used in all
newer code for some time.

Also do a manual pass to correct the use if #ifdef comments as per style(9)
as well as few uses of #if defined(__FreeBSD__) vs #ifndef illumos.

MFC after: 1 month
Sponsored by: Multiplay

9 years agoo Notify USB host about connection when operating in device mode.
br [Sat, 17 Jan 2015 12:31:26 +0000 (12:31 +0000)]
o Notify USB host about connection when operating in device mode.
  Required when communicating to Mac OS X USB host stack.
o Also don't set stall bit to TX pipe in device mode as seems Mac OS X
  don't clears it as it should.

Discussed with: hselasky@

9 years agoFix condition and really sort ports. Also add comment describing
ae [Sat, 17 Jan 2015 11:32:09 +0000 (11:32 +0000)]
Fix condition and really sort ports. Also add comment describing
the intent of this code.

Reported by: sbruno
MFC after: 1 week
Sponsored by: Yandex LLC

9 years agoloader: use correct types for parse_modmetadata
royger [Sat, 17 Jan 2015 08:09:07 +0000 (08:09 +0000)]
loader: use correct types for parse_modmetadata

Use the proper types in parse_modmetadata for the p_start and p_end
parameters. This was causing problems in the ARM 32bit loader.

Sponsored by: Citrix Systems R&D
Reported and Tested by: ian

9 years agoOops; correctly reload the CCA registers with the uncapped value
adrian [Sat, 17 Jan 2015 07:33:02 +0000 (07:33 +0000)]
Oops; correctly reload the CCA registers with the uncapped value
in prep for the next NF calibration pass.

Totally missing braces.  Damn you C.

Submitted by: Sascha Wildner <swildner@dragonflybsd.org>
MFC after: 1 week

9 years agoReturn an appropriate error code in the case of a missing property rather
nwhitehorn [Sat, 17 Jan 2015 07:01:51 +0000 (07:01 +0000)]
Return an appropriate error code in the case of a missing property rather
than random numbers.

MFC after: 1 week

9 years agoOverride the bt enable/disable methods for AR9462 (jupiter) and
adrian [Sat, 17 Jan 2015 06:43:30 +0000 (06:43 +0000)]
Override the bt enable/disable methods for AR9462 (jupiter) and
AR9565 (Aphrodite.)  These need to use the MCI routines, not
the legacy 2-wire / 3-wire bluetooth coexistence methods.

Tested:

* AR9462 (WB222); STA mode

9 years agoNeed to include opt_mca.h to test for DEV_MCA.
imp [Sat, 17 Jan 2015 02:17:59 +0000 (02:17 +0000)]
Need to include opt_mca.h to test for DEV_MCA.

9 years agoMove DEV_ entries scattered to their common section. Add DEV_PCI.
imp [Sat, 17 Jan 2015 02:17:57 +0000 (02:17 +0000)]
Move DEV_ entries scattered to their common section. Add DEV_PCI.

9 years agoThe sn driver isn't UCODE sourceless. While it is true there's an
imp [Sat, 17 Jan 2015 02:17:55 +0000 (02:17 +0000)]
The sn driver isn't UCODE sourceless. While it is true there's an
binary FPGA image that's in an include file in this directory, that
include file isn't actually used. It is only for certain Trump Cards
that we don't yet support. When support was anticipated for them, we
got permission to include the required FPGA image in our sources under
the BSDL, but didn't start actually including the file. This was done
to provide a public paper trail for this file.

9 years agoFix lib/libthr/tests/detach_test
ngie [Sat, 17 Jan 2015 00:58:24 +0000 (00:58 +0000)]
Fix lib/libthr/tests/detach_test

- Eliminate race with liberal use of sleep(3) [1]
- Fix NetBSD-specific implementation way of testing result from pthread_cancel
  by testing with `td` instead of `NULL` [2]

PR: 196738 [1]
PR: 191906 [2]

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

9 years agoUntil there's a full MCI implementation - just implement a placeholder
adrian [Sat, 17 Jan 2015 00:02:18 +0000 (00:02 +0000)]
Until there's a full MCI implementation - just implement a placeholder
MCI bluetooth coexistence method for WB222.

The rest of MCI requires a bunch more work, including adding a DMA buffer
for the MCI hardware to bounce messages in/out of and handling MCI
interrupts.  But the more important part here is telling the HAL
the btcoex is enabled and MCI is in use so it configures the correct
initial bluetooth parameters in the wireless NIC and configures
things like bluetooth traffic weights and such.

So, this at least gets the HAL to do some of the right things in
configuring the inital bluetooth coexistence stuff, but doesn't
actually do full btcoex.  That'll take.. some effort.

Tested:

* AR9462 (WB222), STA mode

9 years agoTie in the MCI bluetooth coexistence functions into the HAL.
adrian [Fri, 16 Jan 2015 23:48:28 +0000 (23:48 +0000)]
Tie in the MCI bluetooth coexistence functions into the HAL.

Tested:

* AR9462 (WB222)

9 years agoAdd bluetooth MCI coexistence HAL methods - used for AR9462 and AR9565 NICs.
adrian [Fri, 16 Jan 2015 23:47:42 +0000 (23:47 +0000)]
Add bluetooth MCI coexistence HAL methods - used for AR9462 and AR9565 NICs.

It's found, amongst other things, in the Acer Chromebook (Intel)
devices.

Tested:

* AR9462 (WB222)

Obtained from: Qualcomm Atheros

9 years agoUpdate buildinf.h to make SSLeay_version(3) little bit more useful.
jkim [Fri, 16 Jan 2015 22:11:02 +0000 (22:11 +0000)]
Update buildinf.h to make SSLeay_version(3) little bit more useful.

MFC after: 1 week

9 years agoAdd a ${CP} alias for copying files in the build.
will [Fri, 16 Jan 2015 21:39:08 +0000 (21:39 +0000)]
Add a ${CP} alias for copying files in the build.

Some users build FreeBSD as non-root in Perforce workspaces.  By default,
Perforce sets files read-only unless they're explicitly being edited.
As a result, the -f argument must be used to cp in order to override the
read-only flag when copying source files to object directories.  Bare use of
'cp' should be avoided in the future.

Update all current users of 'cp' in the src tree.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: Spectra Logic

9 years agoDon't call abort on usage errors; print out the usage message instead
ngie [Fri, 16 Jan 2015 21:12:36 +0000 (21:12 +0000)]
Don't call abort on usage errors; print out the usage message instead

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

9 years agoDocument r277270, OpenSSL update to 1.0.1l.
gjb [Fri, 16 Jan 2015 21:08:04 +0000 (21:08 +0000)]
Document r277270, OpenSSL update to 1.0.1l.

Sponsored by: The FreeBSD Foundation

9 years agoMerge OpenSSL 1.0.1l.
jkim [Fri, 16 Jan 2015 21:03:23 +0000 (21:03 +0000)]
Merge OpenSSL 1.0.1l.

MFC after: 1 week
Relnotes: yes

9 years agoEnable the snoop control unit during MP startup, rather than relying on
ian [Fri, 16 Jan 2015 19:49:10 +0000 (19:49 +0000)]
Enable the snoop control unit during MP startup, rather than relying on
the bootloader to have done so.

Submitted by: Thomas Skibo <thomasskibo@sbcglobal.net>

9 years agoSome RSS issues discovered by Adrian, missing header, variable
jfv [Fri, 16 Jan 2015 19:11:58 +0000 (19:11 +0000)]
Some RSS issues discovered by Adrian, missing header, variable
names fat fingered, incorrect hash config setup. Thanks :)

MFC after: 1 week

9 years agocrunchide: Correct 64-bit section header offset
emaste [Fri, 16 Jan 2015 18:59:15 +0000 (18:59 +0000)]
crunchide: Correct 64-bit section header offset

For 64-bit binaries the Elf_Ehdr e_shoff is at offset 40, not 44.
Instead of using an incorrect hardcoded offset, let the compiler
figure it out for us with offsetof().

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

9 years agoPlug mutex leak.
glebius [Fri, 16 Jan 2015 18:51:26 +0000 (18:51 +0000)]
Plug mutex leak.

MFC after: 1 week
Sponsored by: Nginx, Inc.

9 years agoAdd two fake properties ("fdtbootcpu" and "fdtmemreserv") to the device
nwhitehorn [Fri, 16 Jan 2015 18:47:20 +0000 (18:47 +0000)]
Add two fake properties ("fdtbootcpu" and "fdtmemreserv") to the device
tree's /chosen node to provide out-of-band header fields of the FDT. This
emulation is not perfect without corresponding changes to ofw_fdt_nextprop(),
but is enough to enable lookup by memory-map-parsing code.

MFC after: 1 week

9 years agoInstead of iterating through all properties looking for a match, if asked
nwhitehorn [Fri, 16 Jan 2015 18:42:49 +0000 (18:42 +0000)]
Instead of iterating through all properties looking for a match, if asked
for a specific property, look it up directly.

MFC after: 1 week

9 years agoRevamp the default page clustering strategy that is used by the page fault
alc [Fri, 16 Jan 2015 18:17:09 +0000 (18:17 +0000)]
Revamp the default page clustering strategy that is used by the page fault
handler.  For roughly twenty years, the page fault handler has used the
same basic strategy: Fetch a fixed number of non-resident pages both ahead
and behind the virtual page that was faulted on.  Over the years,
alternative strategies have been implemented for optimizing the handling
of random and sequential access patterns, but the only change to the
default strategy has been to increase the number of pages read ahead to 7
and behind to 8.

The problem with the default page clustering strategy becomes apparent
when you look at how it behaves on the code section of an executable or
shared library.  (To simplify the following explanation, I'm going to
ignore the read that is performed to obtain the header and assume that no
pages are resident at the start of execution.)  Suppose that we have a
code section consisting of 32 pages.  Further, suppose that we access
pages 4, 28, and 16 in that order.  Under the default page clustering
strategy, we page fault three times and perform three I/O operations,
because the first and second page faults only read a truncated cluster of
12 pages.  In contrast, if we access pages 8, 24, and 16 in that order, we
only fault twice and perform two I/O operations, because the first and
second page faults read a full cluster of 16 pages.  In general, truncated
clusters are more common than full clusters.

To address this problem, this revision changes the default page clustering
strategy to align the start of the cluster to a page offset within the vm
object that is a multiple of the cluster size.  This results in many fewer
truncated clusters.  Returning to our example, if we now access pages 4,
28, and 16 in that order, the cluster that is read to satisfy the page
fault on page 28 will now include page 16.  So, the access to page 16 will
no longer page fault and perform an I/O operation.

Since the revised default page clustering strategy is typically reading
more pages at a time, we are likely to read a few more pages that are
never accessed.  However, for the various programs that we looked at,
including clang, emacs, firefox, and openjdk, the reduction in the number
of page faults and I/O operations far outweighed the increase in the
number of pages that are never accessed.  Moreover, the extra resident
pages allowed for many more superpage mappings.  For example, if we look
at the execution of clang during a buildworld, the number of (hard) page
faults on the code section drops by 26%, the number of superpage mappings
increases by about 29,000, but the number of never accessed pages only
increases from 30.38% to 33.66%.  Finally, this leads to a small but
measureable reduction in execution time.

In collaboration with: Emily Pettigrew <ejp1@rice.edu>
Differential Revision: https://reviews.freebsd.org/D1500
Reviewed by: jhb, kib
MFC after: 6 weeks

9 years agoMake netbooting work again by disabling BOOTP_NFSV3. Investigate why this
nwhitehorn [Fri, 16 Jan 2015 17:41:21 +0000 (17:41 +0000)]
Make netbooting work again by disabling BOOTP_NFSV3. Investigate why this
causes bad RPC errors later.

9 years agoVerify that section header offset is not past EOF
emaste [Fri, 16 Jan 2015 15:16:19 +0000 (15:16 +0000)]
Verify that section header offset is not past EOF

MFC After: 1 week
Sponsored by: The FreeBSD Foundation

9 years agoDon't count status as sent until CTIO completes successfully.
mav [Fri, 16 Jan 2015 12:35:55 +0000 (12:35 +0000)]
Don't count status as sent until CTIO completes successfully.

If we aggregated status sending with data move and got error, allow status
to be updated and resent again separately.  Without this command may stuck
without status sent at all.

MFC after: 2 weeks

9 years agoAdd more USB device IDs.
hselasky [Fri, 16 Jan 2015 12:16:21 +0000 (12:16 +0000)]
Add more USB device IDs.

Submitted by: max.n.boyarov@gmail.com
PR: 196362
MFC after: 1 week

9 years agoAdd more USB request definitions. The values are described in section
hselasky [Fri, 16 Jan 2015 12:11:01 +0000 (12:11 +0000)]
Add more USB request definitions. The values are described in section
9.4.11 and 9.4.12 of the "Universal Serial Bus 3.0 Specification"

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week

9 years agoEliminate incorrect IPv6 mask guessing:
melifaro [Fri, 16 Jan 2015 11:17:30 +0000 (11:17 +0000)]
Eliminate incorrect IPv6 mask guessing:
RFC 2374 concept of 'IPv6 Aggregatable Global Unicast Address Format' was
deprecated by RFC 3587 12 years ago.

Before:

15:06 [1] edge# netstat -rn6 | grep 2a02:6b8::
2a02:6b8::/32                     2a02:978:2::1                 UGS         em0
15:06 [1] edge# route -6n get 2a02:6b8::
route: writing to routing socket: No such process

After:
15:07 [1] edge# /usr/obj/usr/src/sbin/route/route -n6 get 2a02:6b8::
   route to: 2a02:6b8::
destination: 2a02:6b8::
       mask: ffff:ffff::
    gateway: 2a02:978:2::1
        fib: 0
  interface: em0
      flags: <UP,GATEWAY,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0

MFC after: 2 weeks

9 years agoUse ipfw runtime lock only when real modification is required.
melifaro [Fri, 16 Jan 2015 10:49:27 +0000 (10:49 +0000)]
Use ipfw runtime lock only when real modification is required.

9 years agoEliminate illumos whole disk special case when searching for a ZFS vdev
smh [Fri, 16 Jan 2015 10:44:39 +0000 (10:44 +0000)]
Eliminate illumos whole disk special case when searching for a ZFS vdev

This special case prevented locating vdevs which start with c[0-9] e.g.
gptid/c6cde092-504b-11e4-ba52-c45444453598 hence it was impossible to
online a vdev via its path.

Submitted by: Peter Xu <xzpeter@gmail.com>
MFC after: 2 weeks
Sponsored by: Multiplay

9 years agoEliminate SIOCGIFADDR handling in bpf.
melifaro [Fri, 16 Jan 2015 10:09:28 +0000 (10:09 +0000)]
Eliminate SIOCGIFADDR handling in bpf.

Quoting 19 years bpf.4 manual from bpf-1.2a1:
"
(SIOCGIFADDR is obsolete under BSD systems.  SIOCGIFCONF should be
 used to query link-level addresses.)
"
* SIOCGIFADDR was not imported in NetBSD (bpf.c 1.36) and OpenBSD.
* Last bits (e.g. manpage claiming SIOCGIFADDR exists) was cleaned
  from NetBSD via kern/21513 5 years ago,
  from OpenBSD via documentation/6352 5 years ago.

9 years agoIf PAM_RHOST is non-NULL, pass it in the Calling-Station-ID attribute of
des [Fri, 16 Jan 2015 09:07:31 +0000 (09:07 +0000)]
If PAM_RHOST is non-NULL, pass it in the Calling-Station-ID attribute of
the RADIUS access request.

MFC after: 1 week

9 years agoFor sigaction(2), ignore possible garbage in sa_flags for sa_handler
kib [Fri, 16 Jan 2015 07:06:58 +0000 (07:06 +0000)]
For sigaction(2), ignore possible garbage in sa_flags for sa_handler
== SIG_DFL or SIG_IGN.  Sloppy code does not fully initialize struct
sigaction for such cases, and being too demanding in the case of
default handler does not catch anything.

Reported and tested by: Alex Tutubalin <lexa@lexa.ru>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 years agoAlways enable I/O, memory and dma cycles. Some BIOSes don't enable
imp [Fri, 16 Jan 2015 06:19:52 +0000 (06:19 +0000)]
Always enable I/O, memory and dma cycles. Some BIOSes don't enable
them, sometimes they are reset for power state transitions or during
whatever happens while suspended. Also, it is good practice to always
do this.

9 years agoMove the suspsned and resume functions to the bus attachment. They
imp [Fri, 16 Jan 2015 06:19:39 +0000 (06:19 +0000)]
Move the suspsned and resume functions to the bus attachment. They
were accessing PCI config registers, which won't work for the ISA
version.

9 years agoSuspend and resume were the only two functions not to follow the brdev
imp [Fri, 16 Jan 2015 06:19:24 +0000 (06:19 +0000)]
Suspend and resume were the only two functions not to follow the brdev
convention here, so fix that.

9 years agoBack out the refactor. It turns out to cause interrupt storms on
imp [Fri, 16 Jan 2015 06:19:08 +0000 (06:19 +0000)]
Back out the refactor. It turns out to cause interrupt storms on
resume sometimes (but not others). On powerup, other wierd issues show
up (sometimes the card comes up, but with really bogus pci config
space stuff. There may be more, but given my experience of historical
fussiness, stick to what works and make more minimal changes to that.

9 years agoAdd back a couple PC Card devices to amd64. There's only a couple of
imp [Fri, 16 Jan 2015 06:19:05 +0000 (06:19 +0000)]
Add back a couple PC Card devices to amd64. There's only a couple of
them that were popular enough, so this doesn't adversly affect build
times.

9 years agoBuild cxgbe(4) on powerpc64 too.
np [Fri, 16 Jan 2015 03:39:38 +0000 (03:39 +0000)]
Build cxgbe(4) on powerpc64 too.

9 years agoUse parentheses instead of close proximity to ensure layer + 1 is evaluated
np [Fri, 16 Jan 2015 02:20:24 +0000 (02:20 +0000)]
Use parentheses instead of close proximity to ensure layer + 1 is evaluated
before the rest of the expression.

9 years agoCheck the right value correctly.
adrian [Fri, 16 Jan 2015 01:52:26 +0000 (01:52 +0000)]
Check the right value correctly.

Thanks to clang for pointing out this silliness.

9 years agoPlug cxgbe(4) back into !powerpc && !arm builds, instead of building it
np [Fri, 16 Jan 2015 01:39:24 +0000 (01:39 +0000)]
Plug cxgbe(4) back into !powerpc && !arm builds, instead of building it
on amd64 only.

9 years agoAllow cxgbe(4) to be built on i386. Driver attach will succeed only on a subset
np [Fri, 16 Jan 2015 01:32:40 +0000 (01:32 +0000)]
Allow cxgbe(4) to be built on i386.  Driver attach will succeed only on a subset
of i386 systems.

9 years agoMake cxgbe(4) buildable with the gcc in base.
np [Fri, 16 Jan 2015 01:28:28 +0000 (01:28 +0000)]
Make cxgbe(4) buildable with the gcc in base.

9 years agoAdd needed bits to the Makefile, and the Mt to the emails.
jfv [Thu, 15 Jan 2015 22:17:11 +0000 (22:17 +0000)]
Add needed bits to the Makefile, and the Mt to the emails.
Thanks to Nathan and Baptiste for the corrections :)

MFC after: 1 week

9 years agoFirst draft man pages for ixl and ixlv drivers.
jfv [Thu, 15 Jan 2015 21:47:02 +0000 (21:47 +0000)]
First draft man pages for ixl and ixlv drivers.

MFC after: 1 week

9 years agoImport libc++ trunk r224926. This fixes a number of bugs, completes
dim [Thu, 15 Jan 2015 21:17:36 +0000 (21:17 +0000)]
Import libc++ trunk r224926.  This fixes a number of bugs, completes
C++14 support[1], adds more C++1z features[2], and fixes the following
LWG issues[3]:

1450: Contradiction in regex_constants
2003: String exception inconsistency in erase.
2075: Progress guarantees, lock-free property, and scheduling
      assumptions
2104: unique_lock move-assignment should not be noexcept
2112: User-defined classes that cannot be derived from
2132: std::function ambiguity
2135: Unclear requirement for exceptions thrown in
      condition_variable::wait()
2142: packaged_task::operator() synchronization too broad?
2182: Container::[const_]reference types are misleadingly specified
2186: Incomplete action on async/launch::deferred
2188: Reverse iterator does not fully support targets that overload
      operator&
2193: Default constructors for standard library containers are explicit
2205: Problematic postconditions of regex_match and regex_search
2213: Return value of std::regex_replace
2240: Probable misuse of term "function scope" in [thread.condition]
2252: Strong guarantee on vector::push_back() still broken with C++11?
2257: Simplify container requirements with the new algorithms
2258: a.erase(q1, q2) unable to directly return q2
2263: Comparing iterators and allocator pointers with different
      const-character
2268: Setting a default argument in the declaration of a member
      function assign of std::basic_string
2271: regex_traits::lookup_classname specification unclear
2272: quoted should use char_traits::eq for character comparison
2278: User-defined literals for Standard Library types
2280: begin / end for arrays should be constexpr and noexcept
2285: make_reverse_iterator
2288: Inconsistent requirements for shared mutexes
2291: std::hash is vulnerable to collision DoS attack
2293: Wrong facet used by num_put::do_put
2299: Effects of inaccessible key_compare::is_transparent type are not
      clear
2301: Why is std::tie not constexpr?
2304: Complexity of count in unordered associative containers
2306: match_results::reference should be value_type&, not const
      value_type&
2308: Clarify container destructor requirements w.r.t. std::array
2313: tuple_size should always derive from integral_constant<size_t, N>
2314: apply() should return decltype(auto) and use decay_t before
      tuple_size
2315: weak_ptr should be movable
2316: weak_ptr::lock() should be atomic
2317: The type property queries should be UnaryTypeTraits returning
      size_t
2320: select_on_container_copy_construction() takes allocators, not
      containers
2322: Associative(initializer_list, stuff) constructors are
      underspecified
2323: vector::resize(n, t)'s specification should be simplified
2324: Insert iterator constructors should use addressof()
2329: regex_match()/regex_search() with match_results should forbid
      temporary strings
2330: regex("meow", regex::icase) is technically forbidden but should
      be permitted
2332: regex_iterator/regex_token_iterator should forbid temporary
      regexes
2339: Wording issue in nth_element
2341: Inconsistency between basic_ostream::seekp(pos) and
      basic_ostream::seekp(off, dir)
2344: quoted()'s interaction with padding is unclear
2346: integral_constant's member functions should be marked noexcept
2350: min, max, and minmax should be constexpr
2356: Stability of erasure in unordered associative containers
2357: Remaining "Assignable" requirement
2359: How does regex_constants::nosubs affect basic_regex::mark_count()?
2360: reverse_iterator::operator*() is unimplementable

[1] http://libcxx.llvm.org/cxx1y_status.html
[2] http://libcxx.llvm.org/cxx1z_status.html
[3] http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html

Exp-run: antoine
MFC after: 1 month

9 years agoEvaluate running userland/kernel version in daily
gjb [Thu, 15 Jan 2015 19:52:19 +0000 (19:52 +0000)]
Evaluate running userland/kernel version in daily
periodic(8) run, taken from uname(1) '-U' and '-K'
flags.

Reviewed by: allanjude, dvl
Differential Revision: https://reviews.freebsd.org/D1541
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

9 years agoloader: implement multiboot support for Xen Dom0
royger [Thu, 15 Jan 2015 16:27:20 +0000 (16:27 +0000)]
loader: implement multiboot support for Xen Dom0

Implement a subset of the multiboot specification in order to boot Xen
and a FreeBSD Dom0 from the FreeBSD bootloader. This multiboot
implementation is tailored to boot Xen and FreeBSD Dom0, and it will
most surely fail to boot any other multiboot compilant kernel.

In order to detect and boot the Xen microkernel, two new file formats
are added to the bootloader, multiboot and multiboot_obj. Multiboot
support must be tested before regular ELF support, since Xen is a
multiboot kernel that also uses ELF. After a multiboot kernel is
detected, all the other loaded kernels/modules are parsed by the
multiboot_obj format.

The layout of the loaded objects in memory is the following; first the
Xen kernel is loaded as a 32bit ELF into memory (Xen will switch to
long mode by itself), after that the FreeBSD kernel is loaded as a RAW
file (Xen will parse and load it using it's internal ELF loader), and
finally the metadata and the modules are loaded using the native
FreeBSD way. After everything is loaded we jump into Xen's entry point
using a small trampoline. The order of the multiboot modules passed to
Xen is the following, the first module is the RAW FreeBSD kernel, and
the second module is the metadata and the FreeBSD modules.

Since Xen will relocate the memory position of the second
multiboot module (the one that contains the metadata and native
FreeBSD modules), we need to stash the original modulep address inside
of the metadata itself in order to recalculate its position once
booted. This also means the metadata must come before the loaded
modules, so after loading the FreeBSD kernel a portion of memory is
reserved in order to place the metadata before booting.

In order to tell the loader to boot Xen and then the FreeBSD kernel the
following has to be added to the /boot/loader.conf file:

xen_cmdline="dom0_mem=1024M dom0_max_vcpus=2 dom0pvh=1 console=com1,vga"
xen_kernel="/boot/xen"

The first argument contains the command line that will be passed to the Xen
kernel, while the second argument is the path to the Xen kernel itself. This
can also be done manually from the loader command line, by for example
typing the following set of commands:

OK unload
OK load /boot/xen dom0_mem=1024M dom0_max_vcpus=2 dom0pvh=1 console=com1,vga
OK load kernel
OK load zfs
OK load if_tap
OK load ...
OK boot

Sponsored by: Citrix Systems R&D
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D517

For the Forth bits:
Submitted by: Julien Grall <julien.grall AT citrix.com>

9 years agoSound: fix typos in user visible messages etc.
bapt [Thu, 15 Jan 2015 16:09:35 +0000 (16:09 +0000)]
Sound: fix typos in user visible messages etc.

Submitted by: Sascha Wildner <saw@online.de>
Obtained from: DragonFly
MFC after: 3 days

9 years agoMajor callout subsystem cleanup and rewrite:
hselasky [Thu, 15 Jan 2015 15:32:30 +0000 (15:32 +0000)]
Major callout subsystem cleanup and rewrite:
- Close a migration race where callout_reset() failed to set the
  CALLOUT_ACTIVE flag.
- Callout callback functions are now allowed to be protected by
  spinlocks.
- Switching the callout CPU number cannot always be done on a
  per-callout basis. See the updated timeout(9) manual page for more
  information.
- The timeout(9) manual page has been updated to reflect how all the
  functions inside the callout API are working. The manual page has
  been made function oriented to make it easier to deduce how each of
  the functions making up the callout API are working without having
  to first read the whole manual page. Group all functions into a
  handful of sections which should give a quick top-level overview
  when the different functions should be used.
- The CALLOUT_SHAREDLOCK flag and its functionality has been removed
  to reduce the complexity in the callout code and to avoid problems
  about atomically stopping callouts via callout_stop(). If someone
  needs it, it can be re-added. From my quick grep there are no
  CALLOUT_SHAREDLOCK clients in the kernel.
- A new callout API function named "callout_drain_async()" has been
  added. See the updated timeout(9) manual page for a complete
  description.
- Update the callout clients in the "kern/" folder to use the callout
  API properly, like cv_timedwait(). Previously there was some custom
  sleepqueue code in the callout subsystem, which has been removed,
  because we now allow callouts to be protected by spinlocks. This
  allows us to tear down the callout like done with regular mutexes,
  and a "td_slpmutex" has been added to "struct thread" to atomically
  teardown the "td_slpcallout". Further the "TDF_TIMOFAIL" and
  "SWT_SLEEPQTIMO" states can now be completely removed. Currently
  they are marked as available and will be cleaned up in a follow up
  commit.
- Bump the __FreeBSD_version to indicate kernel modules need
  recompilation.
- There has been several reports that this patch "seems to squash a
  serious bug leading to a callout timeout and panic".

Kernel build testing: all architectures were built
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D1438
Sponsored by: Mellanox Technologies
Reviewed by: jhb, adrian, sbruno and emaste

9 years agoFix compilation for 32-bit architectures.
hselasky [Thu, 15 Jan 2015 14:47:48 +0000 (14:47 +0000)]
Fix compilation for 32-bit architectures.

PR: 196580
Sponsored by: Mellanox Technologies
MFC after: 3 days

9 years agofcntl F_O{GET,SET}LK take pointer as the arg, handle them properly for
kib [Thu, 15 Jan 2015 10:43:58 +0000 (10:43 +0000)]
fcntl F_O{GET,SET}LK take pointer as the arg, handle them properly for
compat32.

Reported and tested by: Alex Tutubalin <lexa@lexa.ru>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 years agoFix cpsw(4) after r277203 which folded 'struct m_hdr' into 'struct mbuf'.
bz [Thu, 15 Jan 2015 02:22:52 +0000 (02:22 +0000)]
Fix cpsw(4) after r277203 which folded 'struct m_hdr' into 'struct mbuf'.
While in theory this should have been a transparent change (and was for all
other drivers), cpsw(4) never used the proper accessor macros in a few
places but spelt the indirect m_hdr.mh_* out itself.  Convert those to
use m_len and m_data and unbreak the driver build.

9 years agoFix the PMIC node name to match the PMIC i2c address.
loos [Thu, 15 Jan 2015 01:20:56 +0000 (01:20 +0000)]
Fix the PMIC node name to match the PMIC i2c address.

Remove an extra blank line.

No functional changes.

MFC after: 3 days

9 years agoFix the C -> K temperature conversion for the dev.cpu.0.temperature sysctl.
loos [Thu, 15 Jan 2015 01:05:05 +0000 (01:05 +0000)]
Fix the C -> K temperature conversion for the dev.cpu.0.temperature sysctl.

Previous code was discarding the last digit.

Remove the unused temperature conversion macros.

9 years agoCatch a few cases where we need to release memory resources on errors.
loos [Thu, 15 Jan 2015 00:48:53 +0000 (00:48 +0000)]
Catch a few cases where we need to release memory resources on errors.

Place parentheses around variables in macros.

MFC after: 3 days

9 years agoReserve and ignore the a new module metadata type MDT_PNP_INFO for
imp [Thu, 15 Jan 2015 00:46:30 +0000 (00:46 +0000)]
Reserve and ignore the a new module metadata type MDT_PNP_INFO for
associating an optional PNP hint table with this module. In the
future, when these are added, these changes will silently ignore the
new type they would otherwise warn about. It will always be safe to
ignore this data. Get this into the builds today for some future
proofing.

MFC After: 3 days

9 years agoNew MINIMAL kernel config. The goal with this configuration is to
imp [Thu, 15 Jan 2015 00:42:06 +0000 (00:42 +0000)]
New MINIMAL kernel config. The goal with this configuration is to
only compile in those options in GENERIC that cannot be loaded as
modules. ufs is still included because many of its options aren't
present in the kernel module. There's some other exceptions documented
in the file. This is part of some work to get more things
automatically loading in the hopes of obsoleting GENERIC one day.

9 years agoIn order to support ongoing work to implement variable-size mbufs, and
rwatson [Wed, 14 Jan 2015 23:44:00 +0000 (23:44 +0000)]
In order to support ongoing work to implement variable-size mbufs, and
more generally make it easier to extend 'struct mbuf in the future', make
a number of changes to the data structure:

- As we anticipate embedding mbufs headers within variable-size regions of
  memory in the future, change the definitions of byte arrays embedded in
  mbufs to be of size [0] rather than [MLEN] and [MHLEN].  In fact, the
  cxgbe driver already uses 'struct mbuf' on the front of other storage
  sizes, but we would like the global mbuf allocator do be able to do this
  as well.

- Fold 'struct m_hdr' into 'struct mbuf' itself, eliminating a set of
  macros that aliased 'mh_foo' field names to 'm_foo' names such as
  'm_next'.  These present a particular problem as we would like to add
  new mbuf-header fields -- e.g., 'm_size' -- that, if similarly named via
  macros, would introduce collisions with many other variable names in the
  kernel.

- Rename 'struct m_ext' to 'struct struct_m_ext' so that we can add
  compile-time assertions without bumping into the still-extant 'm_ext'
  macro.

- Remove the MSIZE compile-time assertion for 'struct mbuf', but add new
  assertions for alignment of embedded data arrays (64-bit alignment even
  on 32-bit platforms), and for the sizes the mbuf header, packet header,
  and m_ext structure.

- Document that these assertions exist in comments in mbuf.h.

This change is not intended to cause (non-trivial) behavioural
differences, but is a precursor to further mbuf-allocator work.

Differential Revision: https://reviews.freebsd.org/D1483
Reviewed by: bz, gnn, np, glebius ("go ahead, I trust you")
Sponsored by: EMC / Isilon Storage Division

9 years agontpd tries to bind to IPv6 interfaces in 'tentative' state and fails as IPv6 is
hiren [Wed, 14 Jan 2015 23:34:00 +0000 (23:34 +0000)]
ntpd tries to bind to IPv6 interfaces in 'tentative' state and fails as IPv6 is
actually disabled. Fix it by making ntpd ignore such interfaces.

Submitted by: ume
Reviewed by: bz, gnn
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D1527

9 years agoRemove the <netinet/ip_compat.h> include from one of the newly added
dim [Wed, 14 Jan 2015 22:37:11 +0000 (22:37 +0000)]
Remove the <netinet/ip_compat.h> include from one of the newly added
sanitizer sources.  It is apparently unnecessary, and causes trouble for
people using WITHOUT_IPFILTER.

Reported by: Pawel Biernacki <pawel.biernacki@gmail.com>, Kurt Lidl <lidl@pix.net>

9 years agoAvoid race with "dev_rel()" when using the recently added
hselasky [Wed, 14 Jan 2015 22:07:13 +0000 (22:07 +0000)]
Avoid race with "dev_rel()" when using the recently added
"delist_dev()" function. Make sure the character device structure
doesn't go away until the end of the "destroy_dev()" function due to
concurrently running cleanup code inside "devfs_populate()".

MFC after: 1 week
Reported by: dchagin@

9 years agoFix overflow bug from r248577, turning 30s TRIM timeout into ~4s.
mav [Wed, 14 Jan 2015 16:22:00 +0000 (16:22 +0000)]
Fix overflow bug from r248577, turning 30s TRIM timeout into ~4s.

MFC after: 2 weeks

9 years agoelfcopy: Avoid divide-by-0 on section alignment 0
emaste [Wed, 14 Jan 2015 14:49:58 +0000 (14:49 +0000)]
elfcopy: Avoid divide-by-0 on section alignment 0

According to ELF ABI, alignment 0 and 1 has the same meaning: the
section has no alignment constraints.

PR: 196715
Sponsored by: The FreeBSD Foundation

9 years agoAdd a kernel function to delist our kernel character devices, so that
hselasky [Wed, 14 Jan 2015 14:04:29 +0000 (14:04 +0000)]
Add a kernel function to delist our kernel character devices, so that
the device name can be re-used right away in case we are destroying
the character devices in the background.

MFC after: 4 days
Reported by: dchagin@

9 years agoMake sure CAP_BINDAT and CAP_CONNECTAT are part of CAP_ALL0.
ed [Wed, 14 Jan 2015 13:03:03 +0000 (13:03 +0000)]
Make sure CAP_BINDAT and CAP_CONNECTAT are part of CAP_ALL0.

This makes sure that file descriptors of opened directories will
actually get these capabilities. Without this change, bindat() and
connectat() don't seem to work for me.

MFC after: 2 weeks
Reviewed by: rwatson, pjd

9 years agoUpdate the hwpmc driver to have the new type HASWELL_XEON. Also
rrs [Wed, 14 Jan 2015 12:46:58 +0000 (12:46 +0000)]
Update the hwpmc driver to have the new type HASWELL_XEON. Also
go back through HASWELL, IVY_BRIDGE, IVY_BRIDGE_XEON and SANDY_BRIDGE
to straighten out all the missing PMCs. We also add a new pmc tool
pmcstudy, this allows one to run the various formulas from
the documents "Using Intel Vtune Amplifier XE on XXX Generation platforms" for
IB/SB and Haswell. The tool also allows one to postulate your own
formulas with any of the various PMC's. At some point I will enahance
this to work with Brendan Gregg's flame-graphs so we can flamegraph
various PMC interactions. Note the manual page also needs some
work (lots of work) but gnn has committed to help me with that ;-)
Reviewed by: gnn
MFC after:1 month
Sponsored by: Netflix Inc.

9 years agoClean some dead code.
glebius [Wed, 14 Jan 2015 12:46:38 +0000 (12:46 +0000)]
Clean some dead code.

9 years agoMention /net in hier(7).
trasz [Wed, 14 Jan 2015 11:53:41 +0000 (11:53 +0000)]
Mention /net in hier(7).

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoImprove wording.
trasz [Wed, 14 Jan 2015 11:26:03 +0000 (11:26 +0000)]
Improve wording.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoUse newly added GEOM notifications to discard autofs caches.
trasz [Wed, 14 Jan 2015 11:18:45 +0000 (11:18 +0000)]
Use newly added GEOM notifications to discard autofs caches.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoAdd devd(8) notifications for creation and destruction of GEOM devices.
trasz [Wed, 14 Jan 2015 11:15:57 +0000 (11:15 +0000)]
Add devd(8) notifications for creation and destruction of GEOM devices.

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

9 years agoReimplement TRIM throttling added in r248577.
mav [Wed, 14 Jan 2015 09:39:57 +0000 (09:39 +0000)]
Reimplement TRIM throttling added in r248577.

Previous throttling implementation approached problem from the wrong side.
It significantly limited useful delaying of TRIM requests and aggregation
potential, while not so much controlled TRIM burstiness under heavy load.

With this change random 4K write benchmarks (probably the worst case for
TRIM) show me IOPS increase by 20%, average latency reduction by 30%, peak
TRIM bursts reduction by 3 times and same peak TRIM map size (memory usage).

Also the new logic does not force map size down so heavily, really allowing
to keep deleted data for 32 TXG or 30 seconds under moderate load.  It was
practically impossible with old throttling logic, which pushed map down to
only 64 segments.

Reviewed by: smh
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

9 years agoFix typo (missing comma).
neel [Wed, 14 Jan 2015 07:18:51 +0000 (07:18 +0000)]
Fix typo (missing comma).

MFC after: 3 days

9 years agoMake use of the new Altivec ptrace support, to save the Altivec registers in
jhibbits [Wed, 14 Jan 2015 07:02:21 +0000 (07:02 +0000)]
Make use of the new Altivec ptrace support, to save the Altivec registers in
gcore.

MFC after: 2 weeks
Relnotes: yes

9 years agoAdd Altivec/VMX register support to ptrace.
jhibbits [Wed, 14 Jan 2015 07:01:21 +0000 (07:01 +0000)]
Add Altivec/VMX register support to ptrace.

MFC after: 2 weeks
Relnotes: yes

9 years agoFix spelling.
hselasky [Wed, 14 Jan 2015 06:46:25 +0000 (06:46 +0000)]
Fix spelling.

9 years agoVarious interrelated fixes to make suspend / resume work better. We now
imp [Wed, 14 Jan 2015 05:41:33 +0000 (05:41 +0000)]
Various interrelated fixes to make suspend / resume work better. We now
can suspend / resume and unload / load cbb and cardbus without errors
on my Lenovo T400, which wasn't possible before. Cards suspending
and resuming in the CardBus slot not yet tested.
o Enable memory cycles to the bridge early (as part of the new
  cbb_pci_bridge_init). This fixes the Bad VCC errors which were
  caused by the code accessing the device registers with this
  cleared. The suspend / resume process clears it.
o Refactor suspend / resume into bus specific code (though the ISA
  code is just stubbed). This isn't strictly necessary, but makes
  the initializaiton code more uniform and should be more bullet
  proof in the face of variant behavior among cardbus bridges.
o Fixup comments in the power-up sequence to reflect reality. These
  comments were written for one regime of power-up, but not updated
  as things were revised.
o Add a paranoid small delay (100ms) to cover noisy cards powering
  down.
o Fix some debugging prints to be easier to grep from dmesg.

Sponsored by: Netflix

9 years agoAdd a rather obnoxious warning if you don't have NEW_PCIB defined
imp [Wed, 14 Jan 2015 05:41:31 +0000 (05:41 +0000)]
Add a rather obnoxious warning if you don't have NEW_PCIB defined
since it's a total crap shoot if things will work.

9 years agoOn x86 force NEW_PCIB, since that's the default. While this option
imp [Wed, 14 Jan 2015 05:41:28 +0000 (05:41 +0000)]
On x86 force NEW_PCIB, since that's the default. While this option
would be picked up for kernel builds, it isn't picked up for
old-fashioned builds. Without this option, PCI bus numbers are busted
for modules build iteratively.

9 years agoRemove the prison flags PR_IP4_DISABLE and PR_IP6_DISABLE, which have been
jamie [Wed, 14 Jan 2015 04:50:28 +0000 (04:50 +0000)]
Remove the prison flags PR_IP4_DISABLE and PR_IP6_DISABLE, which have been
write-only for as long as they've existed.

9 years agoDon't set prison's pr_ip4s or pr_ip6s to -1.
jamie [Wed, 14 Jan 2015 03:52:41 +0000 (03:52 +0000)]
Don't set prison's pr_ip4s or pr_ip6s to -1.

PR: 196474
MFC after: 3 days

9 years agoDo not remap Open Firmware mappings covered by the direct map. It's
nwhitehorn [Wed, 14 Jan 2015 02:18:29 +0000 (02:18 +0000)]
Do not remap Open Firmware mappings covered by the direct map. It's
pointless and wastes resources.

MFC after: 1 week

9 years agoCorrect cpu type, it was rather Cortex A12 R0.
ganbold [Wed, 14 Jan 2015 01:23:50 +0000 (01:23 +0000)]
Correct cpu type, it was rather Cortex A12 R0.

Approved by:    stas (mentor)

9 years agoCleanup some bogus code in the RSS config, and add the include
jfv [Tue, 13 Jan 2015 22:13:30 +0000 (22:13 +0000)]
Cleanup some bogus code in the RSS config, and add the include
for the rss option file. And bump the version.

MFC after: 1 week

9 years ago'struct vm_exception' was intended to be used only as the collateral for the
neel [Tue, 13 Jan 2015 22:00:47 +0000 (22:00 +0000)]
'struct vm_exception' was intended to be used only as the collateral for the
VM_INJECT_EXCEPTION ioctl. However it morphed into other uses like keeping
track pending exceptions for a vcpu. This in turn causes confusion because
some fields in 'struct vm_exception' like 'vcpuid' make sense only in the
ioctl context. It also makes it harder to add or remove structure fields.

Fix this by using 'struct vm_exception' only to communicate information
from userspace to vmm.ko when injecting an exception.

Also, add a field 'restart_instruction' to 'struct vm_exception'. This
field is set to '1' for exceptions where the faulting instruction is
restarted after the exception is handled.

MFC after:      1 week

9 years agoSince the merge of file 5.21 in r276415 and r276416, stable/9 and
dim [Tue, 13 Jan 2015 20:37:57 +0000 (20:37 +0000)]
Since the merge of file 5.21 in r276415 and r276416, stable/9 and
stable/10 cannot be built from FreeBSD 8.x.  This is because the
build-tools stage requires libmagic, but lib/libmagic/config.h was
generated on head, and it now enables using the xlocale.h APIs, which
are not supported on 8.x (and on 9.x before __FreeBSD_version 900506).

See also the start of this thread on -stable:
https://lists.freebsd.org/pipermail/freebsd-stable/2015-January/081521.html

To fix this, conditionalize the use of xlocale.h APIs to make
bootstrapping from older FreeBSD versions work correctly.

Reviewed by: delphij
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D1518

9 years agoConnect libclang_rt to the build, for specific architectures. This
dim [Tue, 13 Jan 2015 19:54:47 +0000 (19:54 +0000)]
Connect libclang_rt to the build, for specific architectures.  This
contains the libraries for Address Sanitizer (asan), Undefined Behavior
Sanitizer (ubsan) and Profile Guided Optimization.

ASan is a fast memory error detector. It can detect the following types
of bugs:

    Out-of-bounds accesses to heap, stack and globals
    Use-after-free
    Use-after-return (to some extent)
    Double-free, invalid free
    Memory leaks (experimental)

Typical slowdown introduced by AddressSanitizer is 2x.

UBSan is a fast and compatible undefined behavior checker. It enables a
number of undefined behavior checks that have small runtime cost and no
impact on address space layout or ABI.

PLEASE NOTE: the sanitizers still have some rough edges on FreeBSD,
particularly on i386.  These will hopefully be smoothed out in the
coming time.

Differential Revision: https://reviews.freebsd.org/D1505

9 years agoComplete the RX side RSS code: parse the encoded portion of the RX
jfv [Tue, 13 Jan 2015 18:56:29 +0000 (18:56 +0000)]
Complete the RX side RSS code: parse the encoded portion of the RX
descriptor to determine the correct hash type.

MFC after:1 week

9 years agoResolve a special case deadlock: When two or more threads are
hselasky [Tue, 13 Jan 2015 16:37:43 +0000 (16:37 +0000)]
Resolve a special case deadlock: When two or more threads are
simultaneously detaching kernel drivers on the same USB device we can
get stuck in the "usb_wait_pending_ref_locked()" function because the
conditions needed for allowing detach are not met. The "destroy_dev()"
function waits for all system calls involving the given character
device to return. Character device system calls may lock the USB
enumeration lock, which is also held when "destroy_dev()" is
called. This can sometimes lead to a deadlock not noticed by
WITNESS. The current solution is to ensure the calling thread is the
only one holding the USB enumeration lock and prevent other threads
from getting refs while a USB device detach is ongoing. This turned
out not to be sufficient. To solve this deadlock we could use
"destroy_dev_sched()" to schedule the device destruction in the
background, but then we don't know when it is safe to free() the
private data of the character device. Instead a callback function is
executed by the USB explore process to kill off any leftover USB
character devices synchronously after the USB device explore code is
finished and the USB enumeration lock is no longer locked. This makes
porting easier and also ensures us that character devices must
eventually go away after a USB device detach.

While at it ensure that "flag_iserror" is only written when "priv_mtx"
is locked, which is protecting it.

MFC after: 5 days

9 years agocxgbe/iw_cxgbe: fix whitespace nit in r277102.
np [Tue, 13 Jan 2015 16:18:31 +0000 (16:18 +0000)]
cxgbe/iw_cxgbe: fix whitespace nit in r277102.

Reported by: stefanf@

9 years agoAdd new USB template to the USB bootloader module.
hselasky [Tue, 13 Jan 2015 16:06:38 +0000 (16:06 +0000)]
Add new USB template to the USB bootloader module.

9 years agolibdwarf: add missing break
emaste [Tue, 13 Jan 2015 15:18:54 +0000 (15:18 +0000)]
libdwarf: add missing break

Reported by: Coverity
CID: 1193315
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

9 years agoRename Exynos UART driver. No functional change.
br [Tue, 13 Jan 2015 15:04:28 +0000 (15:04 +0000)]
Rename Exynos UART driver. No functional change.

Submitted by: Michal Meloun <meloun@miracle.cz>

9 years agoAdd new USB template to the USB template module.
hselasky [Tue, 13 Jan 2015 14:26:05 +0000 (14:26 +0000)]
Add new USB template to the USB template module.