]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 years agoRemove unnecessary #include.
Dag-Erling Smørgrav [Fri, 28 Sep 2012 12:29:25 +0000 (12:29 +0000)]
Remove unnecessary #include.

11 years agoChange queue overflow checks from DIAGNOSTIC+panic() to KASSERT() to make
Alexander Motin [Fri, 28 Sep 2012 12:13:34 +0000 (12:13 +0000)]
Change queue overflow checks from DIAGNOSTIC+panic() to KASSERT() to make
them enabled on HEAD by default. It is probably better to do single compare
then hunt for unexpected memory corruption.

11 years ago- Re-shuffle the <machine/pc/bios.h> headers to move all kernel-specific
John Baldwin [Fri, 28 Sep 2012 11:59:32 +0000 (11:59 +0000)]
- Re-shuffle the <machine/pc/bios.h> headers to move all kernel-specific
  bits under #ifdef _KERNEL but leave definitions for various structures
  defined by standards ($PIR table, SMAP entries, etc.) available to
  userland.
- Consolidate duplicate SMBIOS table structure definitions in ipmi(4)
  and smbios(4) in <machine/pc/bios.h> and make them available to
  userland.

MFC after: 2 weeks

11 years agoChange "only only" to "only" in portsnap(8).
Isabell Long [Fri, 28 Sep 2012 11:40:59 +0000 (11:40 +0000)]
Change "only only" to "only" in portsnap(8).

Spotted by: Ruslan Mahmatkhanov
Approved by: gabor (mentor, implicit)

11 years agoFix the mis-handling of the VV_TEXT on the nullfs vnodes.
Konstantin Belousov [Fri, 28 Sep 2012 11:25:02 +0000 (11:25 +0000)]
Fix the mis-handling of the VV_TEXT on the nullfs vnodes.

If you have a binary on a filesystem which is also mounted over by
nullfs, you could execute the binary from the lower filesystem, or
from the nullfs mount. When executed from lower filesystem, the lower
vnode gets VV_TEXT flag set, and the file cannot be modified while the
binary is active. But, if executed as the nullfs alias, only the
nullfs vnode gets VV_TEXT set, and you still can open the lower vnode
for write.

Add a set of VOPs for the VV_TEXT query, set and clear operations,
which are correctly bypassed to lower vnode.

Tested by: pho (previous version)
MFC after: 2 weeks

11 years agoAdd a note to portsnap(8) about the behaviour of the example cron command.
Isabell Long [Fri, 28 Sep 2012 11:11:42 +0000 (11:11 +0000)]
Add a note to portsnap(8) about the behaviour of the example cron command.

PR: docs/171759
Submitted by: Paul Hoffman (phoffman at proper dot com)
Approved by: cperciva, gabor (mentor)
MFC after: 3 days

11 years agoMake the loader a bit smarter, when it tries to open disk and the slice
Andrey V. Elsukov [Fri, 28 Sep 2012 10:49:41 +0000 (10:49 +0000)]
Make the loader a bit smarter, when it tries to open disk and the slice
number is not exactly specified. When the disk has MBR, also try to read
BSD label after ptable_getpart() call. When the disk has GPT, also set
d_partition to 255.  Mostly, this is how it worked before.

11 years agoRemove the topology lock from disk_gone(), it might be called with regular
Pawel Jakub Dawidek [Fri, 28 Sep 2012 08:22:51 +0000 (08:22 +0000)]
Remove the topology lock from disk_gone(), it might be called with regular
mutexes held and the topology lock is an sx lock.

The topology lock was there to protect traversing through the list of providers
of disk's geom, but it seems that disk's geom has always exactly one provider.

Change the code to call g_wither_provider() for this one provider, which is
safe to do without holding the topology lock and assert that there is indeed
only one provider.

Discussed with: ken
MFC after: 1 week

11 years agoMake sure that each va_start has one and only one matching va_end,
Kevin Lo [Fri, 28 Sep 2012 07:51:30 +0000 (07:51 +0000)]
Make sure that each va_start has one and only one matching va_end,
especially in error cases.

11 years agoEliminate a stale comment. It describes another use case for the pmap in
Alan Cox [Fri, 28 Sep 2012 05:30:59 +0000 (05:30 +0000)]
Eliminate a stale comment.  It describes another use case for the pmap in
Mach that doesn't exist in FreeBSD.

11 years agoSanitize varname argument in f_sysrc_find. This is as much for security as it
Devin Teske [Fri, 28 Sep 2012 01:39:25 +0000 (01:39 +0000)]
Sanitize varname argument in f_sysrc_find. This is as much for security as it
is for sanity.

Reviewed by: jilles
Approved by: adrian (co-mentor)

11 years agoFix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.
Matthew D Fleming [Thu, 27 Sep 2012 23:31:19 +0000 (23:31 +0000)]
Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.

Original code by: Gleb Kurtsou

11 years agoFix bin/ build with a 64-bit ino_t.
Matthew D Fleming [Thu, 27 Sep 2012 23:31:12 +0000 (23:31 +0000)]
Fix bin/ build with a 64-bit ino_t.

Original code by: Gleb Kurtsou

11 years agoFix sbin/ build with a 64-bit ino_t.
Matthew D Fleming [Thu, 27 Sep 2012 23:31:06 +0000 (23:31 +0000)]
Fix sbin/ build with a 64-bit ino_t.

Original code by: Gleb Kurtsou

11 years agoFix fsck_ffs build with a 64-bit ino_t.
Matthew D Fleming [Thu, 27 Sep 2012 23:30:58 +0000 (23:30 +0000)]
Fix fsck_ffs build with a 64-bit ino_t.

Original code by: Gleb Kurtsou

11 years agoFix up kernel sources to be ready for a 64-bit ino_t.
Matthew D Fleming [Thu, 27 Sep 2012 23:30:49 +0000 (23:30 +0000)]
Fix up kernel sources to be ready for a 64-bit ino_t.

Original code by: Gleb Kurtsou

11 years agolibc/fts: Use O_CLOEXEC for internal file descriptors.
Jilles Tjoelker [Thu, 27 Sep 2012 22:05:54 +0000 (22:05 +0000)]
libc/fts: Use O_CLOEXEC for internal file descriptors.

Because fts keeps internal file descriptors open across calls, making such
descriptors close-on-exec helps not only multi-threaded applications but
also single-threaded applications.

In particular, this prevents passing a temporary file descriptor for saving
the current directory to processes created via find -exec.

11 years agoEnsure that all cases that enqueue a netgraph item for delivery by a
Ryan Stone [Thu, 27 Sep 2012 20:12:51 +0000 (20:12 +0000)]
Ensure that all cases that enqueue a netgraph item for delivery by a
ngthread properly set the item's depth to 1.  In particular, prior to this
change if ng_snd_item failed to acquire a lock on a node, the item's depth
would not be set at all.  This fix ensures that the error code from rcvmsg/
rcvdata is properly passed back to the apply callback.  For example, this
fixes a bug where an error from rcvmsg/rcvdata would not previously
propagate back to a libnetgraph consumer when the message was queued.

Reviewed by: mav
MFC after: 1 month
Sponsored by: Sandvine Incorporated

11 years agoComplete revert of r239963:
Pedro F. Giffuni [Thu, 27 Sep 2012 20:06:37 +0000 (20:06 +0000)]
Complete revert of r239963:

The attempt to merge changes from the linux libtirpc caused
rpc.lockd to exit after startup under unclear conditions.

After many hours of selective experiments and inconsistent results
the conclusion is that it's better to just revert everything and
restart in a future time with a much smaller subset of the
changes.
____

MFC after: 3 days
Reported by: David Wolfskill
Tested by: David Wolfskill

11 years agoComplete revert of r239963:
Pedro F. Giffuni [Thu, 27 Sep 2012 19:10:25 +0000 (19:10 +0000)]
Complete revert of r239963:

The attempt to merge changes from the linux libtirpc caused
rpc.lockd to exit after startup under unclear conditions.

After many hours of selective experiments and inconsistent results
the conclusion is that it's better to just revert everything and
restart in a future time with a much smaller subset of the
changes.
____

MFC after: 3 days
Reported by: David Wolfskill
Tested by: David Wolfskill

11 years agoFix pseudo checksum calculation.
Max Khon [Thu, 27 Sep 2012 18:15:01 +0000 (18:15 +0000)]
Fix pseudo checksum calculation.

This fixes ipfilter w/ network controllers that implement only
partial rx csum offloading.

PR: 106438
Obtained from: upstream
MFC after: 1 week

11 years agosigaction(2),sigwait(2),sigwaitinfo(2): Remove [EFAULT] error condition.
Jilles Tjoelker [Thu, 27 Sep 2012 17:48:04 +0000 (17:48 +0000)]
sigaction(2),sigwait(2),sigwaitinfo(2): Remove [EFAULT] error condition.

Passing an invalid pointer results in undefined behaviour.

The wrappers in libthr access some of the data pointed to by the arguments
in userland, so that an invalid pointer will cause a signal and not an
[EFAULT] error return.

Furthermore, if the [EFAULT] error occurs when the kernel is writing, it is
not a proper error in the sense that the call still commits (changing the
signal disposition or accepting the signal).

MFC after: 1 week

11 years agoRevert r240931, as the previous comment was actually in sync with POSIX.
Pawel Jakub Dawidek [Thu, 27 Sep 2012 16:43:23 +0000 (16:43 +0000)]
Revert r240931, as the previous comment was actually in sync with POSIX.

I have to note that POSIX is simply stupid in how it describes O_EXEC/fexecve
and friends. Yes, not only inconsistent, but stupid.

In the open(2) description, O_RDONLY flag is described as:

O_RDONLY Open for reading only.

Taken from:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html

Note "for reading only". Not "for reading or executing"!

In the fexecve(2) description you can find:

The fexecve() function shall fail if:

[EBADF]
The fd argument is not a valid file descriptor open for executing.

Taken from:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html

As you can see the function shall fail if the file was not open with O_EXEC!

And yet, if you look closer you can find this mess in the exec.html:

Since execute permission is checked by fexecve(), the file description
fd need not have been opened with the O_EXEC flag.

Yes, O_EXEC flag doesn't have to be specified after all. You can open a file
with O_RDONLY and you still be able to fexecve(2) it.

11 years agoMake sure the "wMaxPacketSize" limitations are respected.
Hans Petter Selasky [Thu, 27 Sep 2012 15:45:24 +0000 (15:45 +0000)]
Make sure the "wMaxPacketSize" limitations are respected.

11 years agoMake sure we record NAK tokens in the TD structure for IN direction.
Hans Petter Selasky [Thu, 27 Sep 2012 15:23:38 +0000 (15:23 +0000)]
Make sure we record NAK tokens in the TD structure for IN direction.
Improve host channel disabling. Wait two times 125us for channel to be
disabled. The DWC OTG doesn't like when channels are re-used too early.

11 years agoKernel and modules have "set_vnet" linker set, where virtualized
Mikolaj Golub [Thu, 27 Sep 2012 14:55:15 +0000 (14:55 +0000)]
Kernel and modules have "set_vnet" linker set, where virtualized
global variables are placed. When a module is loaded by link_elf
linker its variables from "set_vnet" linker set are copied to the
kernel "set_vnet" ("modspace") and all references to these variables
inside the module are relocated accordingly.

The issue is when a module is loaded that has references to global
variables from another, previously loaded module: these references are
not relocated so an invalid address is used when the module tries to
access the variable. The example is V_layer3_chain, defined in ipfw
module and accessed from ipfw_nat.

The same issue is with DPCPU variables, which use "set_pcpu" linker
set.

Fix this making the link_elf linker on a module load recognize
"external" DPCPU/VNET variables defined in the previously loaded
modules and relocate them accordingly. For this set_pcpu_list and
set_vnet_list are used, where the addresses of modules' "set_pcpu" and
"set_vnet" linker sets are stored.

Note, archs that use link_elf_obj (amd64) were not affected by this
issue.

Reviewed by: jhb, julian, zec (initial version)
MFC after: 1 month

11 years agoRemove useless NULL checks after M_WAITOK allocations.
Edward Tomasz Napierala [Thu, 27 Sep 2012 10:51:38 +0000 (10:51 +0000)]
Remove useless NULL checks after M_WAITOK allocations.

11 years agoFix zillions of style(9) and spacing bugs introduced by r240981.
Gleb Smirnoff [Thu, 27 Sep 2012 10:46:22 +0000 (10:46 +0000)]
Fix zillions of style(9) and spacing bugs introduced by r240981.

Pointy hat to: sobomax

11 years agoFix several build failures for !COMPAT_FREEBSD32 and
Gleb Smirnoff [Thu, 27 Sep 2012 10:30:11 +0000 (10:30 +0000)]
Fix several build failures for !COMPAT_FREEBSD32 and
!COMPAT_FREEBSD* kernels introduced by r240981.

Pointy hat to: sobomax

11 years agoFix bug in TCP_KEEPCNT setting, which slipped in in the last round
Gleb Smirnoff [Thu, 27 Sep 2012 07:13:21 +0000 (07:13 +0000)]
Fix bug in TCP_KEEPCNT setting, which slipped in in the last round
of reviewing of r231025.

Unlike other options from this family TCP_KEEPCNT doesn't specify
time interval, but a count, thus parameter supplied doesn't need
to be multiplied by hz.

Reported & tested by: amdmi3

11 years agoTrack the last ANI TX/RX sample correctly.
Adrian Chadd [Thu, 27 Sep 2012 06:05:54 +0000 (06:05 +0000)]
Track the last ANI TX/RX sample correctly.

This doesn't specifically fix the issue(s) i'm seeing in this 2GHz
environment (where setting/increasing spur immunity causes OFDM restart
errors to skyrocket through the roof; but leaving it at 0 would leave
the environment cleaner..)

Pointy-hat-to: me, for committing this broken code in the first place.

11 years agoImplementing pmap_kextract(va) as pmap_extract(kernel_pmap, va) is
Alan Cox [Thu, 27 Sep 2012 05:39:42 +0000 (05:39 +0000)]
Implementing pmap_kextract(va) as pmap_extract(kernel_pmap, va) is
problematic because some callers to pmap_kextract() expect its
implementation to be lock-less.  In particular, uma_dbg_alloc() implicitly
requires this.  Otherwise, lock-order reversals occur between pmap locks and
UMA zone locks.  So, this change introduces a lock-less implementation of
pmap_kextract().

Disable recursion on the pvh global lock in the new armv6 pmap.  While
recursion on this locks occurs in the old arm pmap, it thankfully doesn't
occur in the armv6 pmap.

Tested by: jmg

11 years agoInitialize the num variable to avoid uninitialized data.
Kevin Lo [Thu, 27 Sep 2012 05:26:29 +0000 (05:26 +0000)]
Initialize the num variable to avoid uninitialized data.
This fixes the bug introduced by r238378.

Reviewed by: pfg

11 years agoAdd 32-bit ABI compat shims. Those are necessary for i386 binary-only
Maxim Sobolev [Thu, 27 Sep 2012 04:28:55 +0000 (04:28 +0000)]
Add 32-bit ABI compat shims. Those are necessary for i386 binary-only
tools like sysutils/hpacucli (HP P4xx RAID controller management
suite) working on amd64 systems.

PR: 139271
Submitted by: Kazumi MORINAGA, Eugene Grosbein
MFC after: 1 week

11 years agoatrun: Do not assume that MAXLOGNAME <= 100.
Jilles Tjoelker [Wed, 26 Sep 2012 20:47:39 +0000 (20:47 +0000)]
atrun: Do not assume that MAXLOGNAME <= 100.

The reserved space for fmt was exactly sufficient for a two-digit value of
MAXLOGNAME - 1.

PR: bin/171815
Submitted by: Jeremy Huddleston Sequoia
MFC after: 1 week

11 years agofind: Do not pass fd to save current directory to child processes.
Jilles Tjoelker [Wed, 26 Sep 2012 20:16:15 +0000 (20:16 +0000)]
find: Do not pass fd to save current directory to child processes.

This removes one of the two wrongly passed file descriptors. The other one
appears to be from fts(3).

MFC after: 1 week

11 years ago- In the bridge_enqueue() do success/error accounting for
Gleb Smirnoff [Wed, 26 Sep 2012 20:09:48 +0000 (20:09 +0000)]
- In the bridge_enqueue() do success/error accounting for
  each fragment, not only once.
- In the GRAB_OUR_PACKETS() macro do increase if_ibytes.

11 years ago- Make C11 atomic macros usable in expressions:
Tijl Coosemans [Wed, 26 Sep 2012 19:49:22 +0000 (19:49 +0000)]
- Make C11 atomic macros usable in expressions:
  - Replace do-while statements with void expressions.
  - Wrap __asm statements in statement expressions.
- Make the macros function-like:
  - Evaluate all arguments exactly once.
  - Make sure there's a sequence point between evaluation of the arguments
    and the function body. Arguments should be evaluated before any memory
    barriers.
- Fix use of __atomic_is_lock_free built-in. It requires the address of
  an atomic variable as second argument. Use this built-in on clang as
  well because clang's __c11_atomic_is_lock_free only takes the size of the
  variable into account.
- In atomic_exchange_explicit put the barrier before instead of after the
  __sync_lock_test_and_set call.

Reviewed by: theraven

11 years agoMake sure the DWC OTG host mode channels are given enough time to disable.
Hans Petter Selasky [Wed, 26 Sep 2012 18:59:20 +0000 (18:59 +0000)]
Make sure the DWC OTG host mode channels are given enough time to disable.

11 years agoMerge similar fixes from 223198 from igb to ixgbe:
John Baldwin [Wed, 26 Sep 2012 18:11:43 +0000 (18:11 +0000)]
Merge similar fixes from 223198 from igb to ixgbe:
- Use a dedicated task to handle deferred transmits from the if_transmit
  method instead of reusing the existing per-queue interrupt task.
  Reusing the per-queue interrupt task could result in both an interrupt
  thread and the taskqueue thread trying to handle received packets on a
  single queue resulting in out-of-order packet processing and lock
  contention.
- Don't define ixgbe_start() at all where if_transmit is used.

Tested by: Vijay Singh
Reviewed by: jfv
MFC after: 2 weeks

11 years ago - Allow cross-architecture builds with 'generate-release.sh', which
Glen Barber [Wed, 26 Sep 2012 18:04:16 +0000 (18:04 +0000)]
 - Allow cross-architecture builds with 'generate-release.sh', which
   is set by specifying '-a <arch>'.  (Only supported for i386 on amd64
   and powerpc on powerpc64 currently).
 - Change how textproc/docproj is installed:
   o Attempt to install from pkg(8);
   o Fall back to pkg_add(1) if pkg(8) installation is not
     successful;
   o Fall back to installing from ports as last resort.
 - Ensure the script is run by root[1].
 - Get OSVERSION from param.h[1].

Provided by: glebius [1]
Reviewed by: nwhitehorn, kensmith
Approved by: kensmith
MFC After: 2 weeks
X-Needs-MFC: r240586, r240587, r240588

11 years agoAdd a COMPILER_FEATURES variable that is set in bsd.compiler.mk.
Brooks Davis [Wed, 26 Sep 2012 17:25:15 +0000 (17:25 +0000)]
Add a COMPILER_FEATURES variable that is set in bsd.compiler.mk.

When the compiler is clang add c++11 to COMPILER_FEATURES.

When the compiler supports c++11, default to building libc++.  This will
not impact the compliation of programs, but will make it easier for
users with clang compiled systems to test libc++ by passing -stdlib=libc++
to their c++ compliations.

11 years agoCreate led(4) device nodes mapped to isci(4) SGPIO locate LEDs.
Jim Harris [Wed, 26 Sep 2012 16:46:44 +0000 (16:46 +0000)]
Create led(4) device nodes mapped to isci(4) SGPIO locate LEDs.

Device nodes are in the format /dev/led/isci.busX.portY.locate.

Sponsored by: Intel
Requested by: Paul Maulberger <paul dot maulberger at gmx dot de>
MFC after: 1 week

11 years agoRemove FreeBSD 4.x compat shims. Verified by md5.
John Baldwin [Wed, 26 Sep 2012 14:17:14 +0000 (14:17 +0000)]
Remove FreeBSD 4.x compat shims.  Verified by md5.

11 years agoGrab the mfi_config_lock while performing a MFI_DCMD_CFG_FOREIGN_IMPORT
John Baldwin [Wed, 26 Sep 2012 14:14:06 +0000 (14:14 +0000)]
Grab the mfi_config_lock while performing a MFI_DCMD_CFG_FOREIGN_IMPORT
request on behalf of a user utility.

Submitted by: Steven Hartland  killing multiplay co uk
MFC after: 1 week

11 years agoCreate the new initarm_ functions to reduce the diff to the other FDT
Andrew Turner [Wed, 26 Sep 2012 10:07:53 +0000 (10:07 +0000)]
Create the new initarm_ functions to reduce the diff to the other FDT
versions of initarm

11 years agoMerge recent vendor changes in ZFS.
Martin Matuska [Wed, 26 Sep 2012 09:37:58 +0000 (09:37 +0000)]
Merge recent vendor changes in ZFS.

Illumos issued covered:
2811 missing implementation: zfs send -r
3139 zdb dies when it tries to determine path of unlinked file
3189 kernel panic in ZFS test suite during hotspare_onoffline_004_neg
3208 moving zpool cross-endian results in incorrect user/group accounting

References:
  https://www.illumos.org/issues/ + [issue_id]

Obtained from: illumos (vendor/illumos, vendor/illumos-sys)
MFC after: 2 weeks

11 years agoTeach getent(1) to look up a hostname and find IPv6 addresses.
Kevin Lo [Wed, 26 Sep 2012 09:29:48 +0000 (09:29 +0000)]
Teach getent(1) to look up a hostname and find IPv6 addresses.

PR: bin/161548
Submitted by: matthew

11 years agoUse arm_dump_avail_init to build the dump_avail array
Andrew Turner [Wed, 26 Sep 2012 09:27:38 +0000 (09:27 +0000)]
Use arm_dump_avail_init to build the dump_avail array

11 years agoStart to clean up the lpc initarm as it also uses FDT.
Andrew Turner [Wed, 26 Sep 2012 09:25:31 +0000 (09:25 +0000)]
Start to clean up the lpc initarm as it also uses FDT.

11 years agoMake the updates of the tid ring buffer' head and tail pointers
Konstantin Belousov [Wed, 26 Sep 2012 09:25:11 +0000 (09:25 +0000)]
Make the updates of the tid ring buffer' head and tail pointers
explicit by moving them into separate statements from the buffer
element accesses.

Requested by: jhb
MFC after: 3 days

11 years agoUpdate vendor/illumos/dist and vendor-sys/illumos/dist
Martin Matuska [Wed, 26 Sep 2012 08:57:12 +0000 (08:57 +0000)]
Update vendor/illumos/dist and vendor-sys/illumos/dist
to illumos-gate 13836:37bf491c434c
(illumos ZFS issues #2678, #2811, #3139, #3189, #3208)

11 years agoFix panic in CTL caused by trying to free invalid pointers passed
Edward Tomasz Napierala [Wed, 26 Sep 2012 07:09:15 +0000 (07:09 +0000)]
Fix panic in CTL caused by trying to free invalid pointers passed
by the userland process via the IOCTL interface.

Reviewed by: ken@

11 years agoMap the non-QoS TID to the voice queue, in order to ensure important
Adrian Chadd [Wed, 26 Sep 2012 03:45:42 +0000 (03:45 +0000)]
Map the non-QoS TID to the voice queue, in order to ensure important
things like EAPOL frames make it out.

After a whole bunch of hacking/testing, I discovered that they weren't
being early-dropped by the stack (but I should look at ensuring that
later..) but were even making to the hardware transmit queue.
They were mostly even being received by the remote end.  However, the
remote end was completely ignoring them.

This didn't happen under 150-170MBit TCP tests as I'm guessing the TX
queue stayed very busy and the STA didn't do any scanning. However, when
doing 100Mbit/s of TCP traffic, the STA would do background scanning -
which involves it coming in and out of powersave mode with the AP.

Now, this is a total and utter hack around the real problems, which are:

* I need to implement proper power save handling and integrate it into
  the filtered frames support, so the driver/stack doesn't send frames
  whilst the station is actually in sleep;

* .. but frames were actually making it to the STA (macbook pro) and
  the AP did receive an ACK; but a tcpdump on the receiving side showed
  the EAPOL frame never made it. So the stack was dropping it for
  some reason;

* Importantly - the EAPOL frames are currently going into the non-QoS
  TID, which maps to the BE queue and is susceptible to that queue being
  busy doing other things, but;

* There's other traffic going on in the non-QoS TID from other contexts
  when scanning is going on and it's possible there's some races causing
  sequence number/IV issues, but;

* Importantly importantlly, I think the interaction with TID 16 multicast
  traffic in power save mode is causing issues - since I -believe- the
  sequence number space being used by the EAPOL frames on TID 16 overlaps
  with the multicast frames that have sequence numbers allocated and
  are then stuffed on the cabq.  Since with EAPOL frames being in TID 16
  and queued to the BE queue, it's going to be waiting to be serviced
  with all of the aggregate traffic going on - and if the CABQ gets
  emptied beforehand, those TID 16 multicast frames with sequence numbers
  will go out beforehand.

Now, there's quite likely a bunch of "stuff happening slightly out of
sequence" going on due to the nature of the TX path (read: lots of
overlapping and concurrent ath_start() and ath_raw_xmit() calls going
on, sigh) but I thought I had caught them all and stuffed each TID TX
behind a lock (that lasted as long as it needed to in order to get
the frame onto the relevant destination queue - thus keeping things
in order.)

Unfortunately the last problem is the big one and I'm going to stare at
it some more.  If it _is_

So this is a work around for now to ensure that EAPOL frames actually
make it out before any other stuff in the non-QoS TID and HOPEFULLY
before the CABQ gets active.

I'm now going to spend a little time in the TX path figuring out exactly
why the sender is rejecting things. There's two (well, three if you count
EAPOL contents invalid) possibilities:

* The sequence number is out of order (ie, something else like the multicast
  traffic on CABQ) is going out first on TID 16;
* The CCMP IV is out of order (similar to above - but less likely,  as the
  TX key for multicast traffic is different to unicast traffic);
* EAPOL contents strangely invalid.

AP: Ubiquiti RSPRO, AR9160/AR9220 NICs
STA: Macbook Pro, Broadcom 11n NIC

11 years agoCorrect misspelling in debug output.
Ed Maste [Wed, 26 Sep 2012 01:09:19 +0000 (01:09 +0000)]
Correct misspelling in debug output.

11 years agoAdd regression test for kern/172075.
Ed Maste [Wed, 26 Sep 2012 00:25:09 +0000 (00:25 +0000)]
Add regression test for kern/172075.

Sponsored by: ADARA Networks
PR: kern/172075

11 years agoRevert part of an earlier patch attempt that snuck in with r240938.
Ed Maste [Tue, 25 Sep 2012 23:41:45 +0000 (23:41 +0000)]
Revert part of an earlier patch attempt that snuck in with r240938.

11 years agoFix freebsd32_kmq_timedreceive() and freebsd32_kmq_timedsend() to use
Pawel Jakub Dawidek [Tue, 25 Sep 2012 22:15:59 +0000 (22:15 +0000)]
Fix freebsd32_kmq_timedreceive() and freebsd32_kmq_timedsend() to use
getmq_read() and getmq_write() respectively, just like sys_kmq_timedreceive()
and sys_kmq_timedsend().

Sponsored by: FreeBSD Foundation
MFC after: 2 weeks

11 years agoAdd more SPI flash IDs.
Aleksandr Rybalko [Tue, 25 Sep 2012 22:12:07 +0000 (22:12 +0000)]
Add more SPI flash IDs.

Submitted by: Luiz Otavio O Souza.
Submitted by: ZRouter.org project.
Approved by: adrian (menthor)

11 years agoAvoid INVARIANTS panic destroying an in-use tap(4)
Ed Maste [Tue, 25 Sep 2012 22:10:14 +0000 (22:10 +0000)]
Avoid INVARIANTS panic destroying an in-use tap(4)

The requirement (implied by the KASSERT in tap_destroy) that the tap is
closed isn't valid; destroy_dev will block in devdrn while other threads
are in d_* functions.

Note: if_tun had the same issue, addressed in SVN revisions r186391,
r186483 and r186497.  The use of the condvar there appears to be
redundant with the functionality provided by destroy_dev.

Sponsored by: ADARA Networks
Reviewed by: dwhite
MFC after: 2 weeks

11 years agovn_write() always expects FOF_OFFSET flag, which is asserted at the begining,
Pawel Jakub Dawidek [Tue, 25 Sep 2012 21:31:17 +0000 (21:31 +0000)]
vn_write() always expects FOF_OFFSET flag, which is asserted at the begining,
so there is no need to check for it.

Sponsored by: FreeBSD Foundation
MFC after: 2 weeks

11 years agoRemove an incorrect comment
Ed Maste [Tue, 25 Sep 2012 21:19:17 +0000 (21:19 +0000)]
Remove an incorrect comment

11 years agoWe cannot open file for reading and executing (O_RDONLY | O_EXEC).
Pawel Jakub Dawidek [Tue, 25 Sep 2012 21:11:40 +0000 (21:11 +0000)]
We cannot open file for reading and executing (O_RDONLY | O_EXEC).
Well, in theory we can pass those two flags, because O_RDONLY is 0,
but we won't be able to read from a descriptor opened with O_EXEC.

Update the comment.

Sponsored by: FreeBSD Foundation
MFC after: 2 weeks

11 years agoRequire CAP_DELETE on directory descriptor for unlinkat(2).
Pawel Jakub Dawidek [Tue, 25 Sep 2012 21:00:36 +0000 (21:00 +0000)]
Require CAP_DELETE on directory descriptor for unlinkat(2).

Sponsored by: FreeBSD Foundation
MFC after: 2 weeks

11 years agoRequire CAP_CREATE on directory descriptor for symlinkat(2).
Pawel Jakub Dawidek [Tue, 25 Sep 2012 20:59:12 +0000 (20:59 +0000)]
Require CAP_CREATE on directory descriptor for symlinkat(2).

Sponsored by: FreeBSD Foundation
MFC after: 2 weeks

11 years agoRequire CAP_CREATE on directory descriptor for linkat(2).
Pawel Jakub Dawidek [Tue, 25 Sep 2012 20:58:15 +0000 (20:58 +0000)]
Require CAP_CREATE on directory descriptor for linkat(2).

Sponsored by: FreeBSD Foundation
MFC after: 2 weeks

11 years agoO_EXEC flag is not part of the O_ACCMODE mask, check it separately.
Pawel Jakub Dawidek [Tue, 25 Sep 2012 20:48:49 +0000 (20:48 +0000)]
O_EXEC flag is not part of the O_ACCMODE mask, check it separately.
If O_EXEC is provided don't require CAP_READ/CAP_WRITE, as O_EXEC
is mutually exclusive to O_RDONLY/O_WRONLY/O_RDWR.

Without this change CAP_FEXECVE capability right is not enforced.

Sponsored by: FreeBSD Foundation
MFC after: 3 days

11 years agoOops - don't do the clrdmask check in ath_tx_xmit_normal() - the wrong
Adrian Chadd [Tue, 25 Sep 2012 20:41:43 +0000 (20:41 +0000)]
Oops - don't do the clrdmask check in ath_tx_xmit_normal() - the wrong
lock may be held.

Kim reported that the TID lock wasn't held when ath_tx_update_clrdmask()
was called. Well, the underlying hardware TXQ for that TID.

I'm betting it's the cabq stuff. ath_tx_xmit_normal() can be called
for both real and software cabq.  For software cabq, the real destination
txq is different to the txq. So, the lock check will fail.

Reported by: Kim Culhan <w8hdkim@gmail.com>

11 years agoChange the module name for the I/O provider to "kernel" from
George V. Neville-Neil [Tue, 25 Sep 2012 19:16:28 +0000 (19:16 +0000)]
Change the module name for the I/O provider to "kernel" from
"genunix"  This will requires us to modify externally created
DTrace scripts but makes logical sense for FreeBSD.

Requested by: rpaulo
MFC after: 2 weeks

11 years agoSome aac(4) adapters will always report that a direct access device is
Ryan Stone [Tue, 25 Sep 2012 19:12:12 +0000 (19:12 +0000)]
Some aac(4) adapters will always report that a direct access device is
offline in response to a INQUIRY command that does not retreive vital
product data(I personally have observed the behaviour on an Adaptec 2405
and a 5805).  Force the peripheral qualifier to "connected" so that upper
layers correctly recognize that a disk is present.

This bug was uncovered by r216236.  Prior to that fix, aac(4) was
accidentally clearing the peripheral qualifier for all inquiry commands.

This fixes an issue where passthrough devices were not created for
disks behind aac(4) controllers suffering from the bug.  I have
verified that if a disk is not present that we still properly detect
that and not create the passthrough device.

Sponsored by: Sandvine Incorporated
MFC after: 1 week

11 years agoAdd optional entropy harvesting for software interrupts in swi_sched()
John Baldwin [Tue, 25 Sep 2012 14:55:46 +0000 (14:55 +0000)]
Add optional entropy harvesting for software interrupts in swi_sched()
as controlled by kern.random.sys.harvest.swi.  SWI harvesting feeds into
the interrupt FIFO and each event is estimated as providing a single bit of
entropy.

Reviewed by: markm, obrien
MFC after: 2 weeks

11 years agoFix panic introduced by me in r240835, when zero weight
Gleb Smirnoff [Tue, 25 Sep 2012 12:45:41 +0000 (12:45 +0000)]
Fix panic introduced by me in r240835, when zero weight
was passed to wtab_alloc().

Reported by: Kim Culhan <w8hdkim gmail.com>

11 years agoReduce delays in several wait loops from 10ms to 10us, same is it is done
Alexander Motin [Tue, 25 Sep 2012 10:52:49 +0000 (10:52 +0000)]
Reduce delays in several wait loops from 10ms to 10us, same is it is done
in Linux. This substantially increases graphics performance on Ivy Bridge.

Submitted by: avg@
Reviewed by: kib@

11 years agoCall ath_tx_tid_unsched() after the node has been flushed, so the
Adrian Chadd [Tue, 25 Sep 2012 05:56:59 +0000 (05:56 +0000)]
Call ath_tx_tid_unsched() after the node has been flushed, so the
state can be printed correctly.

11 years agoEliminate an unused declaration.
Alan Cox [Tue, 25 Sep 2012 03:59:10 +0000 (03:59 +0000)]
Eliminate an unused declaration.

11 years agoAttila Bogar reported a bug in mountd when multiple export
Rick Macklem [Mon, 24 Sep 2012 23:57:16 +0000 (23:57 +0000)]
Attila Bogar reported a bug in mountd when multiple export
entries with different security flavors are in the exports(5)
file. For that case, mountd replies with the security flavors
of the last entry and not the correct one for the client host.
This patch fixes that by storing separate copies of the flavors
for each host/net case, plus a default one for the case where
no hosts/nets are specified on an entry in the exports(5) file.
Unlike the patch in the PR, it replies with the security flavors
for the entry instead of merging the security flavors for all
the entries and replying with that.

Tested by: attila.bogar at linguamatics.com
PR: kern/164933
MFC after: 2 weeks

11 years agoUse CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE to report missing targets or
Jim Harris [Mon, 24 Sep 2012 21:45:41 +0000 (21:45 +0000)]
Use CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE to report missing targets or
LUNs respectively.  This removes a huge number of error messages
from CAM during bus scans.

Copied almost verbatim from mav's commit r237460.

Submitted by: Mike Tancsa <mike at sentex dot net>
MFC after: 3 days

11 years agoSpecify MTX_RECURSE for the controller's io_lock. Without it, tws(4)
Jim Harris [Mon, 24 Sep 2012 21:40:22 +0000 (21:40 +0000)]
Specify MTX_RECURSE for the controller's io_lock.  Without it, tws(4)
immediately panics on boot with INVARIANTS enabled.  The driver already
clearly expects to be able to recurse on this mutex - the main I/O
is always recursing on this lock.

Reported and tested by:  Mike Tancsa <mike at sentex dot net>
MFC after: 1 week

11 years agoMigrate the ath(4) KTR logging to use an ATH_KTR() macro.
Adrian Chadd [Mon, 24 Sep 2012 20:35:56 +0000 (20:35 +0000)]
Migrate the ath(4) KTR logging to use an ATH_KTR() macro.

This should eventually be unified with ATH_DEBUG() so I can get both
from one macro; that may take some time.

Add some new probes for TX and TX completion.

11 years agoDebugging output fixes:
Adrian Chadd [Mon, 24 Sep 2012 19:48:41 +0000 (19:48 +0000)]
Debugging output fixes:

* use the correct frame status - although the completion descriptor is
  the _last_ in the frame/aggregate, the status is currently stored in
  the _first_ buffer.

* Print out ath_buf specific fields once, not per descriptor in an ath_buf.

11 years agoWhitespace fixes
Alexander V. Chernikov [Mon, 24 Sep 2012 17:34:30 +0000 (17:34 +0000)]
Whitespace fixes

MFC after: 2 weeks

11 years agoPermit table to be used as IPv6 address.
Alexander V. Chernikov [Mon, 24 Sep 2012 17:31:08 +0000 (17:31 +0000)]
Permit table to be used as IPv6 address.

Reported by: Serhiy Popov <sergiuspso@ukr.net>
MFC after: 2 weeks

11 years agoMake sure moused is exiting as quick as possible after that the
Hans Petter Selasky [Mon, 24 Sep 2012 17:13:33 +0000 (17:13 +0000)]
Make sure moused is exiting as quick as possible after that the
umsX character device returns a read error. Update devd.conf rules
to use "DEVFS" events which are generated after that the umsX
character device node has been created/destroyed, and then there
should be no need for moused to wait up to 10 seconds for umsX to
be ready. Opening umsX should not fail except if the kernel is low
on memory. In that case the user can replug the USB mouse or use
"usbconfig" to reset the device. In case of USB mouse devices,
moused should neither retry to open its character device,
once the first read error has happened. This is an indication
of device detach.

MFC after: 1 week

11 years agoDWC OTG host mode improvements:
Hans Petter Selasky [Mon, 24 Sep 2012 16:34:13 +0000 (16:34 +0000)]
DWC OTG host mode improvements:
 - Make HSIC selection dynamic.
 - Make LOW speed USB devices work through HIGH speed USB HUB.

11 years agoMinor man page cleanup -- fix grammar, markup fixes, and start each
Benjamin Kaduk [Mon, 24 Sep 2012 15:02:31 +0000 (15:02 +0000)]
Minor man page cleanup -- fix grammar, markup fixes, and start each
sentence on a new line.

Approved by: hrs (mentor)

11 years agoDocument ipv6 hook, present there for ages.
Alexander Motin [Mon, 24 Sep 2012 08:32:19 +0000 (08:32 +0000)]
Document ipv6 hook, present there for ages.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>

11 years agoFix panic caused by wrong pointer dereference, left after pin sense rewrite
Alexander Motin [Mon, 24 Sep 2012 08:23:05 +0000 (08:23 +0000)]
Fix panic caused by wrong pointer dereference, left after pin sense rewrite
at r230551.

Also while there, make sense polling use reported for each node separately
instead of reporting accumulated total status.

Submitted by: Barbara <barbara.freebsd@gmail.com> (1)
MFC after: 3 days

11 years agoPrepare for software retransmission of non-aggregate frames but ensure
Adrian Chadd [Mon, 24 Sep 2012 06:42:20 +0000 (06:42 +0000)]
Prepare for software retransmission of non-aggregate frames but ensure
it's disabled.

The previous commit to enable CLRDMASK setting didn't do it at all
correctly for non-aggregate sessions - so the CLRDMASK bit would be
cleared and never re-set.

* move ath_tx_update_clrdmask() to be called by functions that setup
  descriptors and queue frames to the hardware, rather than scattered
  everywhere.

* Force CLRDMASK to be set on all non-aggregate session frames being
  transmitted.

* Use ath_tx_normal_comp() now on non-aggregate sessoin frames
  that are queued via ath_tx_xmit_normal().  That way the TID hwq is
  updated and they can trigger (eventual) filter frame queue resets
  and software retransmits.

There's still a bit more work to do in this area to reverse the silly
short-sightedness on my part, however it's likely going to be better
to fix this now than just reverting the patch.

Thanks to people on the freebsd-wireless@ mailing list for promptly
pointing this out.

11 years agoIn (eventual) preparation for supporting disabling the whole 11n/software
Adrian Chadd [Mon, 24 Sep 2012 06:00:51 +0000 (06:00 +0000)]
In (eventual) preparation for supporting disabling the whole 11n/software
retry path - add some code to make it obvious (to me!) how to disable
the software tx path.

11 years agoRevert r240850 and remove redundant NULL check before free(3).
Kevin Lo [Mon, 24 Sep 2012 05:24:10 +0000 (05:24 +0000)]
Revert r240850 and remove redundant NULL check before free(3).
free(3) handles NULL parameter fine.

Reviewed by: kib, Garrett Cooper

11 years agoPartial revert of r239963:
Pedro F. Giffuni [Mon, 24 Sep 2012 03:14:17 +0000 (03:14 +0000)]
Partial revert of r239963:

The following change caused rpc.lockd to exit after startup:
____

libtirpc: be sure to free cl_netid and cl_tp

When creating a client with clnt_tli_create, it uses strdup to copy
strings for these fields if nconf is passed in. clnt_dg_destroy frees
these strings already. Make sure clnt_vc_destroy frees them in the
same way.
____

MFC after: 3 days
Reported by: David Wolfskill
Tested by: David Wolfskill

11 years agoThis patch fixes a nit in the em, lem, and igb driver statistics. Increment
Sean Bruno [Sun, 23 Sep 2012 22:53:39 +0000 (22:53 +0000)]
This patch fixes a nit in the em, lem, and igb driver statistics.  Increment
adapter->dropped_pkts instead of if_ierrors because if_ierrors is
overwritten by hw stats collection.

Submitted by: Andrew Boyer <aboyer@averesystems.com>
Reviewed by: Jack F Vogel <jfv@freebsd.org>
MFC after: 2 weeks

11 years agoIt is possible to recursively destroy snapshots even if the snapshot
Pawel Jakub Dawidek [Sun, 23 Sep 2012 20:12:10 +0000 (20:12 +0000)]
It is possible to recursively destroy snapshots even if the snapshot
doesn't exist on a dataset we are starting from. For example if we
have the following configuration:

tank
tank/foo
tank/foo@snap
tank/bar
tank/bar@snap

We can execute:

# zfs destroy -t tank@snap

eventhough tank@snap doesn't exit.

Unfortunately it is not possible to do the same with recursive rename:

# zfs rename -r tank@snap tank@pans
cannot open 'tank@snap': dataset does not exist

...until now. This change allows to recursively rename snapshots even if
snapshot doesn't exist on the starting dataset.

Sponsored by: rsync.net
MFC after: 2 weeks

11 years agoClean up the bcm2835 initarm. It is now identical to the other ARMv6 copies
Andrew Turner [Sun, 23 Sep 2012 19:48:29 +0000 (19:48 +0000)]
Clean up the bcm2835 initarm. It is now identical to the other ARMv6 copies

Tested by: Alexander Yerenkow

11 years agoAdd TRIM support.
Pawel Jakub Dawidek [Sun, 23 Sep 2012 19:40:58 +0000 (19:40 +0000)]
Add TRIM support.

The code builds a map of regions that were freed. On every write the
code consults the map and eventually removes ranges that were freed
before, but are now overwritten.

Freed blocks are not TRIMed immediately. There is a tunable that defines
how many txg we should wait with TRIMming freed blocks (64 by default).

There is a low priority thread that TRIMs ranges when the time comes.
During TRIM we keep in-flight ranges on a list to detect colliding
writes - we have to delay writes that collide with in-flight TRIMs in
case something will be reordered and write will reached the disk before
the TRIM. We don't have to do the same for in-flight writes, as
colliding writes just remove ranges to TRIM.

Sponsored by: multiplay.co.uk

This work includes some important fixes and some improvements obtained
from the zfsonlinux project, including TRIMming entire vdevs on pool
create/add/attach and on pool import for spare and cache vdevs.

Obtained from: zfsonlinux
Submitted by: Etienne Dechamps <etienne.dechamps@ovh.net>

11 years ago* ld80/s_expl.c:
Steve Kargl [Sun, 23 Sep 2012 18:32:03 +0000 (18:32 +0000)]
* ld80/s_expl.c:
  . Fix the threshold for expl(x) where |x| is small.
  . Also update the previously incorrect comment to match the
    new threshold.

* ld128/s_expl.c:
  . Re-order logic in exceptional cases to match the logic used in
    other long double functions.
  . Fix the threshold for expl(x) where is |x| is small.
  . Also update the previously incorrect comment to match the
    new threshold.

Submitted by: bde
Approved by: das (mentor)

11 years agoFix whitespace issue.
Steve Kargl [Sun, 23 Sep 2012 18:13:46 +0000 (18:13 +0000)]
Fix whitespace issue.

Approved by: das (mentor, implicit)

11 years ago* ld80/s_expl.c:
Steve Kargl [Sun, 23 Sep 2012 18:06:27 +0000 (18:06 +0000)]
* ld80/s_expl.c:
  . Guard a comment from reformatting by indent(1).
  . Re-order variables in declarations to alphabetical order.
  . Remove a banal comment.

* ld128/s_expl.c:
  . Add a comment to point to ld80/s_expl.c for implementation details.
  . Move the #define of INTERVAL to reduce the diff with ld80/s_expl.c.
  . twom10000 does not need to be volatile, so move its declaration.
  . Re-order variables in declarations to alphabetical order.
  . Add a comment that describes the argument reduction.
  . Remove the same banal comment found in ld80/s_expl.c.

Reviewed by: bde
Approved by: das (mentor)

11 years agoAlways use RC_CONFS when set, even if NULL. Previously only used if non-NULL.
Devin Teske [Sun, 23 Sep 2012 17:47:01 +0000 (17:47 +0000)]
Always use RC_CONFS when set, even if NULL. Previously only used if non-NULL.

Reviewed by: jilles, adrian (co-mentor)
Approved by: adrian (co-mentor)

11 years agoAddress a race condition that was introduced in r238212. Unless the page
Alan Cox [Sun, 23 Sep 2012 17:42:39 +0000 (17:42 +0000)]
Address a race condition that was introduced in r238212.  Unless the page
queues lock is acquired before the page lock is released, there is no
guarantee that the page will still be in that same page queue when
vm_page_requeue() is called.

Reported by: pho
In collaboration with: kib
MFC after: 3 days