Commit Graph

181752 Commits

Author SHA1 Message Date
Jeff Roberson
ef72505e6d - Convert the slab free item list from a linked array of indices to a
bitmap using sys/bitset.  This is much simpler, has lower space
   overhead and is cheaper in most cases.
 - Use a second bitmap for invariants asserts and improve the quality of
   the asserts as well as the number of erroneous conditions that we will
   catch.
 - Drastically simplify sizing code.  Special case refcnt zones since they
   will be going away.
 - Update stale comments.

Sponsored by:	EMC / Isilon Storage Division
2013-06-13 21:05:38 +00:00
Jeff Roberson
17a2737732 - Add a BIT_FFS() macro and use it to replace cpusetffs_obj()
Discussed with:	attilio
Sponsored by:	EMC / Isilon Storage Division
2013-06-13 20:46:03 +00:00
Ed Schouten
f5c2e46822 Bring the stdatomic for MIPS code slightly more in sync with the ARM version. 2013-06-13 18:47:28 +00:00
Ed Schouten
67ccda16de Add C11 atomic fallbacks for ARM.
Basically the situation is as follows:

- When using Clang + armv6, we should not need any intrinsics. It should
  support it, even though due to a target misconfiguration it does not.
  We should fix this in Clang.
- When using Clang + noarmv6, provide __atomic_* functions that disable
  interrupts.
- When using GCC + armv6, we can provide __sync_* intrinsics, similar to
  what we did for MIPS. As ARM and MIPS are quite similar, simply base
  this implementation on the one I did for MIPS.
- When using GCC + noarmv6, disable the interrupts, like we do for
  Clang.

This implementation still lacks functions for noarmv6 userspace. To be
done.
2013-06-13 18:46:49 +00:00
Ed Schouten
87d2d3599e Minor improvements to <stdatomic.h>.
- Define __SYNC_ATOMICS in case we're using the __sync_*() API. This is
  not used by <stdatomic.h> itself, but may be useful for some of the
  intrinsics code to determine whether it should build the
  machine-dependent intrinsic functions.

- Make is_lock_free() work in kernelspace. For now, assume atomics in
  kernelspace are always lock free. This is a quite reasonable
  assumption, as we surely shouldn't implement the atomic fallbacks for
  arbitrary sizes.
2013-06-13 18:40:45 +00:00
Simon J. Gerraty
ba10b444d0 Explain remedy for -J error from old make 2013-06-13 18:39:17 +00:00
Jung-uk Kim
05923b8d7c Add a missing comma. 2013-06-13 18:33:54 +00:00
Jung-uk Kim
85ccaa6a9f - Document GCC support for AMD Family 10h processors (amdfam10).
- Document Clang support for AMD Jaguar processors (btver2).
2013-06-13 18:31:09 +00:00
Jung-uk Kim
cd0e2d2a92 Add a new CPUTYPE supported by Clang 3.3 for AMD Jaguar processors (btver2). 2013-06-13 18:26:12 +00:00
Brooks Davis
aa5084e4ff Be more agressive about bootstrapping ctfmerge and ctfconvert so
builds from existing releases have a chance of working properly.

Sponsored by:	DARPA, AFRL
MFC after:	3 days
2013-06-13 18:26:04 +00:00
Ed Maste
e60c420fa3 Use portable string comparison
We support == in /bin/sh now, but it ought to be avoided, and my use of
it was accidental.
2013-06-13 13:05:08 +00:00
Konstantin Belousov
1d7466bca4 Fix two issues with the spin loops in the umtx(2) implementation.
- When looping, check for the pending suspension.  Otherwise, other
  usermode thread which races with the looping one, could try to
  prevent the process from stopping or exiting.

- Add missed checks for the faults from casuword*().  The code is
  structured in a way which makes the loops exit if the specified
  address is invalid, since both fuword() and casuword() return -1 on
  the fault.  But if the address is mapped readonly, the typical value
  read by fuword() is different from -1, while casuword() returns -1.
  Absent the checks for casuword() faults, this is interpreted as the
  race with other thread and causes non-interruptible spinning in the
  kernel.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2013-06-13 09:33:22 +00:00
Alexander Motin
967206bde7 Revert r251649:
ken@ noticed that with recently added d_gone() disk method GEOM already
holds reference on the periph, so we don't need another one.
2013-06-13 08:34:23 +00:00
Lawrence Stewart
8d992fa5ee Remove some duplicate code by making KHELP_DECLARE_MOD() a wrapper around
KHELP_DECLARE_MOD_UMA().

MFC after:	3 days
2013-06-13 08:07:42 +00:00
Gleb Smirnoff
93ecffe50b Improve locking strategy between keys hash and ID hash.
Before this change state creating sequence was:

1) lock wire key hash
2) link state's wire key
3) unlock wire key hash
4) lock stack key hash
5) link state's stack key
6) unlock stack key hash
7) lock ID hash
8) link into ID hash
9) unlock ID hash

What could happen here is that other thread finds the state via key
hash lookup after 6), locks ID hash and does some processing of the
state. When the thread creating state unblocks, it finds the state
it was inserting already non-virgin.

Now we perform proper interlocking between key hash locks and ID hash
lock:

1) lock wire & stack hashes
2) link state's keys
3) lock ID hash
4) unlock wire & stack hashes
5) link into ID hash
6) unlock ID hash

To achieve that, the following hacking was performed in pf_state_key_attach():

- Key hash mutex is marked with MTX_DUPOK.
- To avoid deadlock on 2 key hash mutexes, we lock them in order determined
  by their address value.
- pf_state_key_attach() had a magic to reuse a > FIN_WAIT_2 state. It unlinked
  the conflicting state synchronously. In theory this could require locking
  a third key hash, which we can't do now.
  Now we do not remove the state immediately, instead we leave this task to
  the purge thread. To avoid conflicts in a short period before state is
  purged, we push to the very end of the TAILQ.
- On success, before dropping key hash locks, pf_state_key_attach() locks
  ID hash and returns.

Tested by:	Ian FREISLICH <ianf clue.co.za>
2013-06-13 06:07:19 +00:00
Kevin Lo
85edd2e8f9 Remove unused variable sc_tx_bufsz.
The variable is initialized but not used.

Reviewed by:	yongari
2013-06-13 05:46:19 +00:00
Greg Lehey
13b01d1d47 Revert revision 251648. style(9) requires an empty line here.
Reported by:	mdf@
2013-06-13 04:11:21 +00:00
Pedro F. Giffuni
f744956b4a Relax some unnecessary unsigned type changes in ext2fs.
While the changes in r245820 are in line with the ext2 spec,
the code derived from UFS can use negative values so it is
better to relax some types to keep them as they were, and
somewhat more similar to UFS. While here clean some casts.

Some of the original types are still wrong and will require
more work.

Discussed with:	bde
MFC after:	3 days
2013-06-13 03:23:24 +00:00
Adrian Chadd
d9006e5951 Set the FreeBSD capability bit to indicate that LNA diversity is enabled.
This is true for the AR9485 and AR933x SoC.
2013-06-13 02:20:45 +00:00
Adrian Chadd
f4af8a6a62 Return HAL_ANT_VARIABLE for now, until it's unstubbed.
This is needed by the slow antenna diversity logic for the AR9485/AR9462
as it's only engaged if the TX diveristy is set to VARIABLE.
2013-06-13 02:19:53 +00:00
Kevin Lo
f08b3a501a Fix a typo: s/KLSI/CATC/ 2013-06-13 01:33:01 +00:00
Kevin Lo
988fb7a600 Add PF_IEEE80211 definition.
Reviewed by:	rpaulo
2013-06-13 01:29:54 +00:00
Ed Maste
580b4d185b Renumber clauses to reduce diffs to other versions
NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3,
so follow suit to make comparison easier.
2013-06-13 00:19:30 +00:00
Jeremie Le Hen
54f82841d5 Turn libc.so into an ld script rather than a symlink pointing to the
real shared object and libssp_nonshared.a.

This was the last showstopper that prevented from enabling SSP for ports
by default.  portmgr@ performed a buildworld which showed no significant
breakage with this patch.

Details:

On i386 for PIC objects, gcc uses the __stack_chk_fail_local hidden
symbol instead of calling __stack_chk_fail directly [1].  This happen
not only with our gcc-4.2.1 but also with the latest gcc-4.8.  If you
want the very nasty details, see [2].

OTOH the problem doesn't exist on other architectures.  It also doesn't
exist with Clang as the latter will somehow manage to create the
function in the object file at compile time (contrary to only
referencing it through a symbol that will be brought in at link time).

In a perfect world, when an object file is compiled with
-fstack-protector, it will be linked into a binary or a DSO with this
same flag as well, so GCC will add libssp_nonshared.a to the linker
command-line.  Unfortunately, we don't control softwares in ports and we
may have such broken DSO.  This is the whole point of this patch.

You can reproduce the problem on i386 by compiling a source file into an
object file with "-fstack-protector-all -fPIE" and linking it
into a binary without "-fstack-protector".

This ld script automatically proposes libssp_nonshared.a along with the
real libc DSO to the linker.  It is important to understand that the
object file contained in this library will be pulled in the resulting
binary _only if_ the linker notices one of its symbols is needed (i.e.
one of the SSP symbol is missing).

A theorical performance impact could be when compiling, but my testing
showed less than 0.1% of difference.

[1] For 32-bit code gcc saves the PIC register setup by using
    __stack_chk_fail_local hidden function instead of calling
    __stack_chk_fail directly.  See comment line 19460 in:
    src/contrib/gcc/config/i386/i386.c

[2] When compiling a source file to an object file, if you use something
    which is external to the compilation unit, GCC doesn't know yet if
    this symbol will be inside or outside the DSO.  So it expects the
    worst case and routes the symbol through the GOT, which means
    additional space and extra relocation for rtld(1).

    Declaring a symbol has hidden tells GCC to use the optimal route (no
    GOT), but on the other hand this means the symbol has to be provided
    in the same DSO (namely libssp_nonshared.a).

    On i386, GCC actually uses an hidden symbol for SSP in PIC objects
    to save PIC register setup, as said in [1].

PR:		ports/138228
PR:		ports/168010
Reviewed by:	kib, kan
2013-06-12 21:12:05 +00:00
Ed Maste
8d56b202dd Handle DW_TAG_unspecified_type
2011-11-14  Jim Ingham  <jingham@apple.com>

        * dwarf2read.c (read_type_die): Handle DW_TAG_unspecified_type.
        (read_tag_unspecified_type): New function, add a type for the
        DW_TAG_unspecified_type die.

Obtained from:	Apple, gdb-1752
2013-06-12 20:11:49 +00:00
Ed Maste
513f8c0cb8 Handle DW_TAG_rvalue_reference_type
2012-05-21  Jim Ingham <jingham@apple.com>

      * dwarf2read.c (process_die): Handle DW_TAG_rvalue_reference_type.
      (read_type_die): Ditto.
      (dwarf_tag_name): Ditto.

      * elf/dwarf2.h: Add DW_TAG_rvalue_reference_type.

Obtained from:	Apple, gdb-1820
2013-06-12 20:05:19 +00:00
Alexander Motin
2c3ba49168 Fix build after r251654. 2013-06-12 19:21:23 +00:00
Dimitry Andric
284c197886 Upgrade our copy of llvm/clang to 3.3 release.
Release notes are still in the works, these will follow soon.

MFC after:	1 month
2013-06-12 18:48:53 +00:00
Alexander Motin
9cf417295d Replicate r242422 from ata(4) to mvs(4):
Only four specific ATA PIO commands transfer several sectors per DRQ block
(interrupt).  All other ATA PIO commands transfer one sector or 512 bytes
at one time.  Hardcode these exceptions in mvs(4) with ATA_CAM option.
This fixes timeout of READ LOG EXT command used by `smartctl -x /dev/adaX`.
Also it fixes timeout of DOWNLOAD_MICROCODE on `camcontrol fwdownload`.
2013-06-12 18:08:11 +00:00
Chris Rees
c45506efd1 Clean up swapfile memory disk on shutdown
Make the md unit number configurable so that it can be predicted

PR:		bin/168544
Submitted by:	wblock (based on)
Approved by:	kevlo
2013-06-12 16:44:17 +00:00
Alexander Motin
3c2305c3a5 Use CAM_DIR_NONE for requests without data.
Wrong values there confuse some drivers.

MFC after:	1 week
2013-06-12 16:13:05 +00:00
Pedro F. Giffuni
77b193c249 Turn DIAGNOSTICs to INVARIANTS in ext2fs.
This is done to be consistent with what other filesystems and
particularly ffs already does (see r173464).

MFC after:	5 days
2013-06-12 15:24:48 +00:00
Adrian Chadd
a987ae075f Tie in the LNA diversity configuration functions into the HAL. 2013-06-12 15:23:17 +00:00
Adrian Chadd
de98311f50 Set the antenna "config group" field.
The reference HAL pushes a config group parameter to the driver layer
to inform it which particular chip behaviour to implement.

This particular value tags it as an AR9285.
2013-06-12 15:18:10 +00:00
Adrian Chadd
216ca2346f Migrate the LNA mixing diversity machinery from the AR9285 HAL to the driver.
The AR9485 chip and AR933x SoC both implement LNA diversity.
There are a few extra things that need to happen before this can be
flipped on for those chips (mostly to do with setting up the different
bias values and LNA1/LNA2 RSSI differences) but the first stage is
putting this code into the driver layer so it can be reused.

This has the added benefit of making it easier to expose configuration
options and diagnostic information via the ioctl API.  That's not yet
being done but it sure would be nice to do so.

Tested:

* AR9285, with LNA diversity enabled
* AR9285, with LNA diversity disabled in EEPROM
2013-06-12 14:52:57 +00:00
Alexander Motin
ccba710262 Make CAM return and GEOM DISK pass through new GEOM::lunid attribute.
SPC-4 specification states that serial number may be property of device,
but not a specific logical unit.  People reported about FC storages using
serial number in that way, making it unusable for purposes of LUN multipath
detection.  SPC-4 states that designators associated with logical unit from
the VPD page 83h "Device Identification" should be used for that purpose.
Report first of them in the new attribute in such preference order: NAA,
EUI-64, T10 and SCSI name string.

While there, make GEOM DISK properly report GEOM::ident in XML output also
using d_getattr() method, if available.  This fixes serial numbers reporting
for SCSI disks in `geom disk list` output and confxml.

Discussed with:	gibbs, ken
Sponsored by:	iXsystems, Inc.
MFC after:	2 weeks
2013-06-12 13:36:20 +00:00
Glen Barber
62fed16cb9 Add new script to run release builds. The script is heavily based upon
the release/generate-release.sh script by nwhitehorn.

This script can use optional configuration file to override defaults,
making running multiple serialzied builds with different specific
configurations or architecture-specific tunings quite easy.

Sample overrideable options are included in the release.conf.sample
file.

Approved by:	kib (mentor)
MFC After:	2 weeks
X-MFC-To:	stable/9 only
2013-06-12 13:15:28 +00:00
Alexander Motin
ce4bc82d19 Use direct custom implementations instead of g_handleattr() for CFI and NAND
d_getattr().  Since these drivers use disk(9) KPI and not directly GEOM, use
of that function means KPI layering violation, causing extra g_io_deliver()
call for the request.
2013-06-12 12:51:43 +00:00
Nathan Whitehorn
9e4062edd3 Add missing copyright notice. 2013-06-12 12:38:12 +00:00
Alexander Motin
7912f917ca Acquire periph reference when handling d_getattr() method call.
While GEOM in general has provider opened while sending BIO_GETATTR,
GEOM DISK does not really need to open disk to read medium-unrelated
attributes for own use.

Proposed by:	ken
2013-06-12 09:07:15 +00:00
Greg Lehey
33d6ebecd5 style(9)
MFC after:	2 weeks
2013-06-12 07:53:59 +00:00
Greg Lehey
90c72ba909 Handle some expression regressions.
Explicitly use GNU cpp for preprocessing.
Remove explicit debugging code.
Change some variable names to be less confusing.
Improve some comments.
Improve indentation.

PR:		162211
		168785
MFC after:	2 weeks
2013-06-12 07:52:49 +00:00
Xin LI
9625321547 MFV r251644:
Poor ZFS send / receive performance due to snapshot
hold / release processing (by smh@)

Illumos ZFS issues:
  3740 Poor ZFS send / receive performance due to snapshot
       hold / release processing

MFC after:      2 weeks
2013-06-12 07:07:06 +00:00
Xin LI
03ce21f2d0 Update vendor/illumos/dist and vendor-sys/illumos/dist
to illumos-gate 14052:1a272fe1337b

Illumos ZFS issues:
  3740 Poor ZFS send / receive performance due to snapshot
       hold / release processing
2013-06-12 06:56:15 +00:00
Adrian Chadd
9ae49f268a Remove the AR9285 specific structure for LNA diversity and use the HAL.
The AR9300 HAL update included the LNA diversity configuration information
so it can be used in the AR9485 configuration code.
2013-06-12 06:01:53 +00:00
Eitan Adler
6a5335f59c Merge latest NetBSD changes.
This adds some new NetBSD releases and makes some simple formatting changes.

With this commit NetBSD and FreeBSD should have identical files.
DragonflyFBSD has the version immediately prior to this commit.

When committing to this file please try to coordinate with all three groups.

Submitted by:	Alan Barrett <apb@cequrux.com>
2013-06-11 21:47:16 +00:00
Jilles Tjoelker
67dff1b140 pthread_testcancel(3): Update list of cancellation points.
This should be a fairly complete list of cancellation points in libc, libthr
and librt, including standard as well as non-standard functions.
2013-06-11 21:40:20 +00:00
Navdeep Parhar
f81cb396de cxgbe/tom: Allow caller to select the queue (control or data) used to
send the CPL_SET_TCB_FIELD request in t4_set_tcb_field().

MFC after:	1 week
2013-06-11 21:20:23 +00:00
John Baldwin
608203fd94 Borrow the algorithm from kvm_getprocs() to fix procstat_getprocs() to
handle the case where the process tables grows in between the calls to
fetch the size and fetch the table.

MFC after:	1 week
2013-06-11 20:00:49 +00:00
Xin LI
ed8fd1989f MFV r251626:
ZFS event processing should work on R/O root filesystems

Illumos ZFS issues:
  3749 zfs event processing should work on R/O root filesystems

MFC after:      2 weeks
2013-06-11 19:35:44 +00:00