]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
9 years agoFix typo: s/_maske/_mask/
gjb [Thu, 4 Sep 2014 02:06:33 +0000 (02:06 +0000)]
Fix typo: s/_maske/_mask/

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

9 years agoRemove trailing whitespace.
jhb [Thu, 4 Sep 2014 01:56:15 +0000 (01:56 +0000)]
Remove trailing whitespace.

9 years ago- Move prototypes for various functions into out of C files and into
jhb [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.

9 years agoPlug a hypothetical use after free in sysctl kern.proc.groups.
mjg [Thu, 4 Sep 2014 01:21:33 +0000 (01:21 +0000)]
Plug a hypothetical use after free in sysctl kern.proc.groups.

MFC after: 1 week

9 years agoDo not blindly announce 1000baseT half-duplex capability in
yongari [Thu, 4 Sep 2014 01:04:37 +0000 (01:04 +0000)]
Do not blindly announce 1000baseT half-duplex capability in
autonegotiation.  Some controllers like cgem(4) do not support
half-duplex at gigabit speeds.

9 years agoAdd KASSERTs to catch the case where a developer may have forgotten to
benno [Thu, 4 Sep 2014 00:10:06 +0000 (00:10 +0000)]
Add KASSERTs to catch the case where a developer may have forgotten to
set bo_bsize on a bufobj.

This is a slight modification of the patch provided.

PR: 193146
Submitted by: Conrad Meyer <conrad.meyer@isilon.com>
Sponsored by: EMC Isilon Storage Division

9 years agoCreate a /boot/dtb directory to house DTB blobs. The flattened device
imp [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.

9 years agoAdd a function to get the frequency of the AHB bus. Another stopgap
ian [Wed, 3 Sep 2014 21:45:39 +0000 (21:45 +0000)]
Add a function to get the frequency of the AHB bus.  Another stopgap
function until we have full clock support for imx6.

9 years agoWhen built with FDT support, add /boot/dtb to the list of search directories.
ian [Wed, 3 Sep 2014 21:25:36 +0000 (21:25 +0000)]
When built with FDT support, add /boot/dtb to the list of search directories.

9 years agoActually save and restore FPU state on APs during suspend and resume.
jhb [Wed, 3 Sep 2014 21:17:09 +0000 (21:17 +0000)]
Actually save and restore FPU state on APs during suspend and resume.

Committed from: Atom-based HP netbook after resuming in X

9 years agoRemove DIAGNOSTIC from the kernel config of low-end arm systems. Sanity
ian [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.

9 years agoNote that script(1) consumes filemon(4).
obrien [Wed, 3 Sep 2014 19:06:08 +0000 (19:06 +0000)]
Note that script(1) consumes filemon(4).

9 years agoAlways seek back to the beginning of a regular directory, even if the
jhb [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

9 years agoAvoid ./ in zoneinfo entries in METALOG
emaste [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.

Reviewed by: brooks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D719

9 years agoFixes and enhancements for the if_cgem driver...
ian [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.

Submitted by: Thomas Skibo <ThomasSkibo@sbcglobal.net>
Reviewed by: wkoszek, Yonghyeon PYUN <pyunyh@gmail.com>

9 years agoUse sh -c '...' to launch the dtb build scripts with env stuff prepended,
ian [Wed, 3 Sep 2014 17:32:17 +0000 (17:32 +0000)]
Use sh -c '...' to launch the dtb build scripts with env stuff prepended,
otherwise it tries to treat the env var stuff as a script file name.

9 years agoImport a hackish tool I use to examine the skew of the TSC across
jhb [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.

9 years agoUpdate the autofs(5) manual to reflect it first appeared in
gjb [Wed, 3 Sep 2014 17:15:12 +0000 (17:15 +0000)]
Update the autofs(5) manual to reflect it first appeared in
FreeBSD 10.1-RELEASE.

Submitted by: dhw
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

9 years agoApparently, the patch commited in svn r271029 doesn't actually do anyting,
sbruno [Wed, 3 Sep 2014 15:48:07 +0000 (15:48 +0000)]
Apparently, the patch commited in svn r271029 doesn't actually do anyting,
so we still need to modify the code in place. Pointed out by emaste.

MFC after: 2 days
Relnotes: yes

9 years agoDo not direct commit to contrib/llvm. Make the change a patch file instead.
sbruno [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.

http://llvm.org/viewvc/llvm-project?view=revision&revision=216989

Submitted by: ian
Reviewed by: dim
Obtained from: llvm.org
MFC after: 2 days
Relnotes: yes

9 years agoUse better type for i.
pjd [Wed, 3 Sep 2014 15:08:33 +0000 (15:08 +0000)]
Use better type for i.

9 years agoDeclare i.
pjd [Wed, 3 Sep 2014 15:06:47 +0000 (15:06 +0000)]
Declare i.

Reported by: sbruno

9 years agoFix descriptors leak in case of nvlist_xunpack() failure.
pjd [Wed, 3 Sep 2014 14:44:23 +0000 (14:44 +0000)]
Fix descriptors leak in case of nvlist_xunpack() failure.

Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org>

9 years agoMFV: Only emit movw on ARMv6T2
sbruno [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.

http://llvm.org/viewvc/llvm-project?view=revision&revision=216989

Submitted by: ian
Reviewed by: dim
Obtained from: llvm.org
MFC after: 2 days

9 years agoFix spelling.
hselasky [Wed, 3 Sep 2014 13:15:16 +0000 (13:15 +0000)]
Fix spelling.

PR: 193279
MFC after: 1 week

9 years agoAdd new quirk.
hselasky [Wed, 3 Sep 2014 11:46:43 +0000 (11:46 +0000)]
Add new quirk.

PR: 193279
MFC after: 1 week

9 years ago* Unconditionally turn on SIOCGI2C probing for all interfaces
melifaro [Wed, 3 Sep 2014 11:07:49 +0000 (11:07 +0000)]
* 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.

MFC with: r270064
Sponsored by: Yandex LLC

9 years agoRemove always false comparison.
glebius [Wed, 3 Sep 2014 09:58:59 +0000 (09:58 +0000)]
Remove always false comparison.

Sponsored by: Nginx, Inc.

9 years agoLeave the C11 keywords alone when we have a recent version of GCC.
ed [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.

9 years agoStyle.
kib [Wed, 3 Sep 2014 08:40:16 +0000 (08:40 +0000)]
Style.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 years agoRetire thread_unthread(), it has only one caller. Update comment in
kib [Wed, 3 Sep 2014 08:35:42 +0000 (08:35 +0000)]
Retire thread_unthread(), it has only one caller.  Update comment in
the block of code before the previous call to thread_unthread().

Discussed with: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 years agoClean up unused CSUM_FRAGMENT.
glebius [Wed, 3 Sep 2014 08:30:18 +0000 (08:30 +0000)]
Clean up unused CSUM_FRAGMENT.

Sponsored by: Nginx, Inc.

9 years agoUse CSUM_BITS instead of incorrect copy.
glebius [Wed, 3 Sep 2014 08:28:16 +0000 (08:28 +0000)]
Use CSUM_BITS instead of incorrect copy.

Sponsored by: Nginx, Inc.

9 years agoRight now, thread_single(SINGLE_EXIT) returns after the p_numthreads
kib [Wed, 3 Sep 2014 08:18:07 +0000 (08:18 +0000)]
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

9 years agoFix dereference after NULL check.
glebius [Wed, 3 Sep 2014 08:14:07 +0000 (08:14 +0000)]
Fix dereference after NULL check.

CID: 1234607
Sponsored by: Nginx, Inc.

9 years agoPartially revert r270964. Don't test for C++11 to define _Thread_local.
ed [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.

Reported by: antoine@

9 years agoFix up proc_realparent to always return correct process.
mjg [Wed, 3 Sep 2014 06:25:34 +0000 (06:25 +0000)]
Fix up proc_realparent to always return correct process.

Prior to the change it would always return initproc for non-traced processes.

This fixes ps apparently always returning 1 as ppid.

Pointy hat: mjg
Reported by: many
MFC after: 1 week

9 years agoFix logical error.
hselasky [Wed, 3 Sep 2014 05:14:50 +0000 (05:14 +0000)]
Fix logical error.

MFC after: 3 days

9 years agoInvoke make_dtb with MACHINE defined for enhanced cross building
imp [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.

Sponsored by: Netflix

9 years agoDefine _DTRACE_VERSION in sdt.h rather than setting it manually. This is
markj [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.

9 years agoFix regression introduced by SVN r270954. Correct way to reset getopts
dteske [Tue, 2 Sep 2014 22:59:40 +0000 (22:59 +0000)]
Fix regression introduced by SVN r270954. Correct way to reset getopts
is to set OPTIND to 1, not unset it (which causes an error).

Thanks to: jilles

9 years agoAllow standalone debug for non-default ${PROG} targets
emaste [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.

Sponsored by: DARPA, AFRL

9 years agoUse callout(9) instead of timeout(9).
jhb [Tue, 2 Sep 2014 18:57:19 +0000 (18:57 +0000)]
Use callout(9) instead of timeout(9).

Tested by: danfe

9 years agoFix for WITNESS warning while doing xpt_rescan.
kadesai [Tue, 2 Sep 2014 18:32:41 +0000 (18:32 +0000)]
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

9 years agoFix typo in a comment.
rpaulo [Tue, 2 Sep 2014 18:21:19 +0000 (18:21 +0000)]
Fix typo in a comment.

9 years agoThe proper compatibility string for the AHCI device is
imp [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.

9 years agoClean up <sys/cdefs.h> slightly.
ed [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.

9 years agoUpdate a comment to reflect the changes in r213408.
alc [Tue, 2 Sep 2014 04:11:20 +0000 (04:11 +0000)]
Update a comment to reflect the changes in r213408.

MFC after: 5 days

9 years agoFix typo.
ian [Tue, 2 Sep 2014 03:51:12 +0000 (03:51 +0000)]
Fix typo.

Pointy hat: ian

9 years agoUse OF_xref_from_device(), not OF_xref_from_node(). Also, use bzero()
ian [Tue, 2 Sep 2014 03:46:24 +0000 (03:46 +0000)]
Use OF_xref_from_device(), not OF_xref_from_node().  Also, use bzero()
rather than memset().

9 years agoAdd OF_xref_from_device() so that there's no need to have an intermediate
ian [Tue, 2 Sep 2014 03:45:01 +0000 (03:45 +0000)]
Add OF_xref_from_device() so that there's no need to have an intermediate
call to ofw_bus_get_node() to lookup info that's already in the xreflist.

9 years agoCreate an interface for drivers to enable or disable their clocks as listed
ian [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).

9 years agoThe anatop driver controls power and PLLs and needs to be available before
ian [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().

9 years agoThe ocotp driver provides access to registers containing chip configuration
ian [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.

9 years agoFix a bug where command line arguments could be misprocessed if getopts is
dteske [Mon, 1 Sep 2014 22:53:47 +0000 (22:53 +0000)]
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.

9 years agoCreate a mechanism for looking up a device_t associated with an ofw/fdt
ian [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.

Reviewed by: nwhitehorn

9 years agoAdd bsearch_b to the libc map and the stdlib header.
pfg [Mon, 1 Sep 2014 22:25:42 +0000 (22:25 +0000)]
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.

Phabric: D638
Reviewed by: theraven, wollman

9 years agoAdd -Wthread-safety to WARNS=6.
ed [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.

Approved by: brueffer@

9 years agoAdd lock annotations to libcuse.
ed [Mon, 1 Sep 2014 19:56:28 +0000 (19:56 +0000)]
Add lock annotations to libcuse.

- Add annotations to the lock/unlock function to indicate that the
  function is allowed to lock and unlock the underlying pthread mutex.

- Add __guarded_by() annotations to the global variables.

Approved by: hselasky@

9 years agosdhci.h has grown a dependency on sysctl.h, include the latter where needed.
ian [Mon, 1 Sep 2014 19:20:34 +0000 (19:20 +0000)]
sdhci.h has grown a dependency on sysctl.h, include the latter where needed.

9 years agoAccording to the ISO C standard, lgamma(-integer) returns
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.

While here, fix a nearby disordering of 'lx,ix'

Discussed with: bde

9 years agoRename OF_xref_phandle() to OF_node_from_xref() and add a new function
ian [Mon, 1 Sep 2014 18:51:01 +0000 (18:51 +0000)]
Rename OF_xref_phandle() to OF_node_from_xref() and add a new function
that provides the inverse translation, OF_xref_from_node().

Discussed with: nwhitehorn

9 years agoAdd lock annotations to the threading API used by hastd.
ed [Mon, 1 Sep 2014 18:37:17 +0000 (18:37 +0000)]
Add lock annotations to the threading API used by hastd.

Approved by: pjd@

9 years agoAdd lock annotations to the header files of our threading libraries.
ed [Mon, 1 Sep 2014 18:34:30 +0000 (18:34 +0000)]
Add lock annotations to the header files of our threading libraries.

This change extends all of the functions present in the <pthread.h> and
<threads.h> headers to have lock annotations. This will allow Clang to
warn about the following:

- Locking a function twice,
- Unlocking a function without a mutex being locked,
- Forgetting to unlock a mutex before returning,
- Destroying or reinitializing a mutex that is currenty locked,
- Using an unlocked mutex in combination with a condition variable.

Enabling these annotations already allowed me to catch a bug in one of
our userspace tools (r270749).

9 years agoEnable lock annotations on HEAD when using Clang.
ed [Mon, 1 Sep 2014 18:28:11 +0000 (18:28 +0000)]
Enable lock annotations on HEAD when using Clang.

MFC after: never

9 years agoAdd lock annotations to <sys/cdefs.h>.
ed [Mon, 1 Sep 2014 18:27:04 +0000 (18:27 +0000)]
Add lock annotations to <sys/cdefs.h>.

Clang has support for annotating mutexes and code that uses mutexes to
validate certain aspects of thread safety:

- Whether acquiring/releasing locks is done properly (e.g., whether you
  unlock a mutex before leaving a function).
- Whether a lock is held while reading/writing data from/to memory.

Analysis is performed at the function level. Functions can be annotated
to indicate they:

- (try to) pick up a lock,
- release a lock,
- can only be called when (not) holding a lock,
- assert that a lock is held.

Variables and structure members can be annotated to indicate that they
are guarded by a certain lock. In C++, these annotations can refer
to both global variables, but also other class/structure members. In C,
it is only possible to refer to global variables.

This change adds wrappers for the annotations used by Clang to
<sys/cdefs.h>. They currently have no effect, but this is on purpose.
This change will be merged back to FreeBSD 9 and 10, which means we can
safely experiment with these annotations on HEAD without making it
harder to port changes back.

Reviewed by: announced on arch@ and toolchain@
MFC after: 3 weeks

9 years agoAdd vt(4) support to the console initialisation script, specifically:
se [Mon, 1 Sep 2014 16:51:57 +0000 (16:51 +0000)]
Add vt(4) support to the console initialisation script, specifically:

- Identify the console driver used and print syscons or vt as appropriate.

- If vt is used and a keymap could not be loaded, then try to replace the
  keymap name configured in rc.conf based on a replacement list in this
  script. Warn about the fact, that a syscons keyname is configured and
  report the replacement used under vt.

- If no replacement keymap is found, no keymap is loaded and a warning
  is displayed, which points at the conversion script and allows the
  conversion of keymaps not part of the official distribution.

This patch has been sent to the -hackers list for review, but no comment
has been received, yet. It is tested to work under syscons and vt on my
system (on vt with either the syscons or vt keymap file name in rc.conf).

MFC after: 3 days

9 years agoFinal patches to the tools used to convert syscons keymaps for use with
se [Mon, 1 Sep 2014 16:26:57 +0000 (16:26 +0000)]
Final patches to the tools used to convert syscons keymaps for use with
vt.

MFC after: 3 days

9 years agoAdd references to vt(4) to further man-pages.
se [Mon, 1 Sep 2014 16:25:08 +0000 (16:25 +0000)]
Add references to vt(4) to further man-pages.

MFC after: 3 days

9 years agoFix a tab that somehow became 8 spaces.
kargl [Mon, 1 Sep 2014 16:24:25 +0000 (16:24 +0000)]
Fix a tab that somehow became 8 spaces.

Remove parentheses in a return statement to be consistent with the
rest of the file.

Rename sin_pi() in the float version to sin_pif().

Remove large comment that precedes sin_pif().  The comment
duplicates a comment in e_lgamma_r.c where the algorithm
is documented.

Requested by: bde

9 years agoFix typo (by -> be).
se [Mon, 1 Sep 2014 16:12:29 +0000 (16:12 +0000)]
Fix typo (by -> be).

MFC after: 3 days

9 years agoDo not generate unwind info in asm functions if _STANDALONE is defined.
ian [Mon, 1 Sep 2014 14:57:04 +0000 (14:57 +0000)]
Do not generate unwind info in asm functions if _STANDALONE is defined.
The .fnend op causes the assembler to emit RELOC references to unwind
support functions that don't exist in libstand.

9 years agoMake SOCK_RAW sockets to be truly raw, not modifying received and sent
glebius [Mon, 1 Sep 2014 14:04:51 +0000 (14:04 +0000)]
Make SOCK_RAW sockets to be truly raw, not modifying received and sent
packets at all. Swapping byte order on SOCK_RAW was actually a bug, an
artifact from the BSD network stack, that used to convert a packet to
native byte order once it is received by kernel.

Other operating systems didn't follow this, and later other BSD
descendants fixed this, leaving us alone with the bug. Now it is
clear that we should fix the bug.

In collaboration with: Olivier Cochard-LabbĂ© <olivier cochard.me>
See also: https://wiki.freebsd.org/SOCK_RAW
Sponsored by: Nginx, Inc.

9 years agoExplicitly free packet on PF_DROP, otherwise a "quick" rule with
glebius [Mon, 1 Sep 2014 13:00:45 +0000 (13:00 +0000)]
Explicitly free packet on PF_DROP, otherwise a "quick" rule with
"route-to" may still forward it.

PR: 177808
Submitted by: Kajetan Staszkiewicz <kajetan.staszkiewicz innogames.de>
Sponsored by: InnoGames GmbH

9 years agoAdd the reverse part to rule #9. Also change its description in the
ae [Mon, 1 Sep 2014 09:30:34 +0000 (09:30 +0000)]
Add the reverse part to rule #9. Also change its description in the
netstat(8) output.

MFC after: 1 week

9 years agoResync comments about scbus and pass for life after AHCI joined CAM.
imp [Mon, 1 Sep 2014 03:49:21 +0000 (03:49 +0000)]
Resync comments about scbus and pass for life after AHCI joined CAM.

Sponsored by: Netflix

9 years agoCompute sin(pi*x) without actually doing the pi*x multiplication.
kargl [Sun, 31 Aug 2014 21:38:03 +0000 (21:38 +0000)]
Compute sin(pi*x) without actually doing the pi*x multiplication.
sin_pi(x) is only called for x < 0 and |x| < 2**(p-1) where p is
the precision of x.  The new argument reduction is an optimization
compared to the old code, and it removes a chunk of dead code.
Accuracy tests in the intervals (-21,-20), (-20,-19), ... (-1,0)
show no differences between the old and new code.

Obtained from: bde

9 years ago- Nuke unused sdhci_softc.
marius [Sun, 31 Aug 2014 17:56:54 +0000 (17:56 +0000)]
- Nuke unused sdhci_softc.
- Static'ize sdhci_debug local to sdhci.c.
- Const'ify PCI device description strings.
- Nuke redundant resource ID members from sdhci_pci_softc.
- Nuke unused hw.sdhci_pci.debug tunable.
- Add support for using MSI instead of INTx, controllable via the tunable
  hw.sdhci.enable_msi (defaulting to on) and tested with a RICOH R5CE823 SD
  controller.
- Use NULL instead of 0 for pointers.

MFC after: 3 days

9 years agoGIC (Cortex A's interrupt controller) supports up to 1020 IRQs.
br [Sun, 31 Aug 2014 17:40:19 +0000 (17:40 +0000)]
GIC (Cortex A's interrupt controller) supports up to 1020 IRQs.

9 years agoAutomatically prefault a limited number of mappings to resident pages in
alc [Sun, 31 Aug 2014 17:38:41 +0000 (17:38 +0000)]
Automatically prefault a limited number of mappings to resident pages in
shmat(2), just like mmap(2).

MFC after: 5 days
Sponsored by: EMC / Isilon Storage Division

9 years agoIn ARM asm code, ensure that every ENTRY(foo) has a matching END(foo).
ian [Sun, 31 Aug 2014 17:21:51 +0000 (17:21 +0000)]
In ARM asm code, ensure that every ENTRY(foo) has a matching END(foo).
The EABI unwind info requires a .fnend for every .fnstart, and newer
binutils will complain about seeing two .fnstart in a row.  This change
allows newer tools to compile our code.

Reported by: bapt
Reviewed by: imp

9 years agoPut option FDT into the base IMX6 config and remove it from the config
ian [Sun, 31 Aug 2014 15:25:40 +0000 (15:25 +0000)]
Put option FDT into the base IMX6 config and remove it from the config
of boards based on IMX6.

9 years agoThe Marvell PJ4B cpu family is armv7, not armv6.
ian [Sun, 31 Aug 2014 15:23:49 +0000 (15:23 +0000)]
The Marvell PJ4B cpu family is armv7, not armv6.

9 years agoToss fields so that no padding field is required to achieve alignment.
glebius [Sun, 31 Aug 2014 13:30:54 +0000 (13:30 +0000)]
Toss fields so that no padding field is required to achieve alignment.

9 years agoIt is actually possible to have if_t a typedef to non-void type,
glebius [Sun, 31 Aug 2014 12:48:13 +0000 (12:48 +0000)]
It is actually possible to have if_t a typedef to non-void type,
and keep both converted to drvapi and non-converted drivers
compilable.

o Make if_t typedef to struct ifnet *.
o Remove shim functions.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.

9 years agoProvide pointer from struct ifnet to struct netmap_adapter,
glebius [Sun, 31 Aug 2014 11:33:19 +0000 (11:33 +0000)]
Provide pointer from struct ifnet to struct netmap_adapter,
instead of abusing spare field.

9 years agoFix character case in examples for "camcontrol security" - should be
gavin [Sun, 31 Aug 2014 10:28:31 +0000 (10:28 +0000)]
Fix character case in examples for "camcontrol security" - should be
"-U user" not "-u user".

PR: 193179
Submitted by: milios ccsys com
MFC after: 3 days

9 years agoMove the restored #ifdef i386 test back inside the #ifdef _KERNEL block
peter [Sun, 31 Aug 2014 09:05:02 +0000 (09:05 +0000)]
Move the restored #ifdef i386 test back inside the #ifdef _KERNEL block
where it originally was.

9 years agoo Remove struct if_data from struct ifnet. Now it is merely API structure
glebius [Sun, 31 Aug 2014 06:46:21 +0000 (06:46 +0000)]
o Remove struct if_data from struct ifnet. Now it is merely API structure
  for route(4) socket and ifmib(4) sysctl.
o Move fields from if_data to ifnet, but keep all statistic counters
  separate, since they should disappear later.
o Provide function if_data_copy() to fill if_data, utilize it in routing
  socket and ifmib handler.
o Provide overridable ifnet(9) method to fetch counters. If no provided,
  if_get_counters_compat() would be used, that returns old counters.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.

9 years agoUse macros instead of referencing struct if_data that resides in ifnet.
glebius [Sun, 31 Aug 2014 06:30:50 +0000 (06:30 +0000)]
Use macros instead of referencing struct if_data that resides in ifnet.

Sponsored by: Nginx, Inc.

9 years agoRemove ability to write to struct if_data residing in struct ifnet
glebius [Sun, 31 Aug 2014 06:23:54 +0000 (06:23 +0000)]
Remove ability to write to struct if_data residing in struct ifnet
via net.link.generic.IFMIB_IFDATA.*.IFDATA_GENERAL sysctl. Reasons
for removal are:
- No code in tree uses this possibility.
- The documentation ifmib(4) doesn't say that such possibility
  exist. The example provided in manual page only reads data.
- On many interfaces the feature simply doesn't work, since they
  do accounting in hardware, and overwrite if_data on tick.

Sponsored by: Nginx, Inc.

9 years agoAllow the make_dtb script to work outside of a "make buildkernel" context
ian [Sat, 30 Aug 2014 22:39:15 +0000 (22:39 +0000)]
Allow the make_dtb script to work outside of a "make buildkernel" context
by setting MACHINE from uname -m if it's not set already.

Reviewed by: imp, tuexen

9 years agoFix the handling of MMU type in the AP entry code. The ARM_MMU_V6/V7
ian [Sat, 30 Aug 2014 22:21:57 +0000 (22:21 +0000)]
Fix the handling of MMU type in the AP entry code.  The ARM_MMU_V6/V7
symbols are always #defined to 0 or 1, so use #if SYM not #if defined(SYM).
Also, it helps if you include the header file that defines the symbols.

9 years agoEnsure that ZFS ARC free memory checks include cached pages
smh [Sat, 30 Aug 2014 21:44:32 +0000 (21:44 +0000)]
Ensure that ZFS ARC free memory checks include cached pages

Also restore kmem_used() check for i386 as it has KVA limits that the raw
page counts above don't consider

PR: 187594
Reviewed by: peter
X-MFC-With: r270759
Review: D700
Sponsored by: Multiplay

9 years agoEnable SCTP support. It runs perfectly fine on a Wandboard quad.
tuexen [Sat, 30 Aug 2014 20:18:47 +0000 (20:18 +0000)]
Enable SCTP support. It runs perfectly fine on a Wandboard quad.

MFC after: 3 days

9 years agoRemove FDT option, since it is in every file, which includes this one.
tuexen [Sat, 30 Aug 2014 20:00:18 +0000 (20:00 +0000)]
Remove FDT option, since it is in every file, which includes this one.

9 years agoThe "SUB" instruction used in getcc() actually does 'x -= y' so use the
neel [Sat, 30 Aug 2014 19:59:42 +0000 (19:59 +0000)]
The "SUB" instruction used in getcc() actually does 'x -= y' so use the
proper constraint for 'x'. The "+r" constraint indicates that 'x' is an
input and output register operand.

While here generate code for different variants of getcc() using a macro
GETCC(sz) where 'sz' indicates the operand size.

Update the status bits in %rflags when emulating AND and OR opcodes.

Reviewed by: grehan

9 years agoUse define from if_var.h to access a field inside struct if_data,
glebius [Sat, 30 Aug 2014 19:55:54 +0000 (19:55 +0000)]
Use define from if_var.h to access a field inside struct if_data,
that resides in struct ifnet.

Sponsored by: Nginx, Inc.

9 years agoSet the 'inst_length' to '0' early on before any error conditions are detected
neel [Sat, 30 Aug 2014 18:35:16 +0000 (18:35 +0000)]
Set the 'inst_length' to '0' early on before any error conditions are detected
in the emulation of the task switch. If any exceptions are triggered then the
guest %rip should point to instruction that caused the task switch as opposed
to the one after it.

9 years agoReplace cvsweb link wihg svnweb URL in bktr(4) release notes.
gavin [Sat, 30 Aug 2014 18:01:45 +0000 (18:01 +0000)]
Replace cvsweb link wihg svnweb URL in bktr(4) release notes.