]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 years agoBring over my initial work from the net80211 TX locking branch.
adrian [Fri, 8 Mar 2013 20:23:55 +0000 (20:23 +0000)]
Bring over my initial work from the net80211 TX locking branch.

This patchset implements a new TX lock, covering both the per-VAP (and
thus per-node) TX locking and the serialisation through to the underlying
physical device.

This implements the hard requirement that frames to the underlying physical
device are scheduled to the underlying device in the same order that they
are processed at the VAP layer.  This includes adding extra encapsulation
state (such as sequence numbers and CCMP IV numbers.)  Any order mismatch
here will result in dropped packets at the receiver.

There are multiple transmit contexts from the upper protocol layers as well
as the "raw" interface via the management and BPF transmit paths.
All of these need to be correctly serialised or bad behaviour will result
under load.

The specifics:

* add a new TX IC lock - it will eventually just be used for serialisation
  to the underlying physical device but for now it's used for both the
  VAP encapsulation/serialisation and the physical device dispatch.

  This lock is specifically non-recursive.

* Methodize the parent transmit, vap transmit and ic_raw_xmit function
  pointers; use lock assertions in the parent/vap transmit routines.

* Add a lock assertion in ieee80211_encap() - the TX lock must be held
  here to guarantee sensible behaviour.

* Refactor out the packet sending code from ieee80211_start() - now
  ieee80211_start() is just a loop over the ifnet queue and it dispatches
  each VAP packet send through ieee80211_start_pkt().

  Yes, I will likely rename ieee80211_start_pkt() to something that
  better reflects its status as a VAP packet transmit path.  More on
  that later.

* Add locking around the management and BAR TX sending - to ensure that
  encapsulation and TX are done hand-in-hand.

* Add locking in the mesh code - again, to ensure that encapsulation
  and mesh transmit are done hand-in-hand.

* Add locking around the power save queue and ageq handling, when
  dispatching to the parent interface.

* Add locking around the WDS handoff.

* Add a note in the mesh dispatch code that the TX path needs to be
  re-thought-out - right now it's doing a direct parent device transmit
  rather than going via the vap layer.  It may "work", but it's likely
  incorrect (as it bypasses any possible per-node power save and
  aggregation handling.)

Why not a per-VAP or per-node lock?

Because in order to ensure per-VAP ordering, we'd have to hold the
VAP lock across parent->if_transmit().  There are a few problems
with this:

* There's some state being setup during each driver transmit - specifically,
  the encryption encap / CCMP IV setup.  That should eventually be dragged
  back into the encapsulation phase but for now it lives in the driver TX path.
  This should be locked.

* Two drivers (ath, iwn) re-use the node->ni_txseqs array in order to
  allocate sequence numbers when doing transmit aggregation.  This should
  also be locked.

* Drivers may have multiple frames queued already - so when one calls
  if_transmit(), it may end up dispatching multiple frames for different
  VAPs/nodes, each needing a different lock when handling that particular
  end destination.

So to be "correct" locking-wise, we'd end up needing to grab a VAP or
node lock inside the driver TX path when setting up crypto / AMPDU sequence
numbers, and we may already _have_ a TX lock held - mostly for the same
destination vap/node, but sometimes it'll be for others.  That could lead
to LORs and thus deadlocks.

So for now, I'm sticking with an IC TX lock.  It has the advantage of
papering over the above and it also has the added advantage that I can
assert that it's being held when doing a parent device transmit.
I'll look at splitting the locks out a bit more later on.

General outstanding net80211 TX path issues / TODO:

* Look into separating out the VAP serialisation and the IC handoff.
  It's going to be tricky as parent->if_transmit() doesn't give me the
  opportunity to split queuing from driver dispatch.  See above.

* Work with monthadar to fix up the mesh transmit path so it doesn't go via
  the parent interface when retransmitting frames.

* Push the encryption handling back into the driver, if it's at all
  architectually sane to do so.  I know it's possible - it's what mac80211
  in Linux does.

* Make ieee80211_raw_xmit() queue a frame into VAP or parent queue rather
  than doing a short-cut direct into the driver.  There are QoS issues
  here - you do want your management frames to be encapsulated and pushed
  onto the stack sooner than the (large, bursty) amount of data frames
  that are queued.  But there has to be a saner way to do this.

* Fragments are still broken - drivers need to be upgraded to an if_transmit()
  implementation and then fragmentation handling needs to be properly fixed.

Tested:

* STA - AR5416, AR9280, Intel 5300 abgn wifi
* Hostap - AR5416, AR9160, AR9280
* Mesh - some testing by monthadar@, more to come.

11 years agoAdd legacy support to geom raid to create a /dev/arX device for support
sbruno [Fri, 8 Mar 2013 20:07:32 +0000 (20:07 +0000)]
Add legacy support to geom raid to create a /dev/arX device for support
of upgrading older machines using ataraid(4) to newer releases.

This optional parameter is controlled via kern.geom.raid.legacy_aliases
and will create a /dev/ar0 device that will point at /dev/raid/r0 for
example.

Tested on Dell SC 1425 DDF-1 format software raid controllers installing from
stable/7 and upgrading to stable/9 without having to adjust /etc/fstab

Reviewed by: mav
Obtained from: Yahoo!
MFC after: 2 Weeks

11 years agoImport Linux commit a1b7736dac5f2d5876e68c47a0fce3f423840070
dumbbell [Fri, 8 Mar 2013 18:15:07 +0000 (18:15 +0000)]
Import Linux commit a1b7736dac5f2d5876e68c47a0fce3f423840070
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date:   Wed Feb 1 11:38:22 2012 +0100

    drm drm_fb_helper: destroy modes

    drm_setup_crtcs allocated modes using drm_mode_duplicate. Free
    them in drm_fb_helper_crtc_free.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Discussed with: Konstantin Belousov (kib@)

11 years agodrm: Fix a call to free(9) with an incorrect malloc type
dumbbell [Fri, 8 Mar 2013 18:11:02 +0000 (18:11 +0000)]
drm: Fix a call to free(9) with an incorrect malloc type

While here, the call to free(9) is moved to drm_global.c, near the
initial malloc(9).

Reviewed by: Konstantin Belousov (kib@)

11 years agoEliminate excessive $FreeBSD$ headers.
delphij [Fri, 8 Mar 2013 18:08:12 +0000 (18:08 +0000)]
Eliminate excessive $FreeBSD$ headers.

Noticed by: jmallett

11 years agog_label_ntfs_taste: Abort taste is recsize == 0
dumbbell [Fri, 8 Mar 2013 18:07:43 +0000 (18:07 +0000)]
g_label_ntfs_taste: Abort taste is recsize == 0

This will avoid a 0-byte read (in g_read_data()) leading to a panic, if
previously read data are erroneous.

Suggested by: John-Mark Gurney <jmg@funkthat.com>

11 years agoMerge r247814 from x86 modulo whitespace bug:
marius [Fri, 8 Mar 2013 13:11:45 +0000 (13:11 +0000)]
Merge r247814 from x86 modulo whitespace bug:

Turn on the CTL disable tunable by default.

This will allow GENERIC configurations to boot on small memory boxes, but
not require end users who want to use CTL to recompile their kernel.  They
can simply set kern.cam.ctl.disable=0 in loader.conf.

11 years agoFix bootstrapping pkgng by not appending "/latest/" to PACKAGESITE.
bapt [Fri, 8 Mar 2013 10:43:03 +0000 (10:43 +0000)]
Fix bootstrapping pkgng by not appending "/latest/" to PACKAGESITE.

Reporter by : Alexander Yerenkow (via irc)

11 years agoMove the callout subsystem initialization to its own SYSINIT()
andre [Fri, 8 Mar 2013 10:37:17 +0000 (10:37 +0000)]
Move the callout subsystem initialization to its own SYSINIT()
from being indirectly called via cpu_startup()+vm_ksubmap_init().
The boot order position remains the same at SI_SUB_CPU.

Allocation of the callout array is changed to stardard kernel malloc
from a slightly obscure direct kernel_map allocation.

kern_timeout_callwheel_alloc() is renamed to callout_callwheel_init()
to better describe its purpose.
kern_timeout_callwheel_init() is removed simplifying the per-cpu
initialization.

Reviewed by: davide

11 years agoMove the auto-sizing of the callout array from init_param2() to
andre [Fri, 8 Mar 2013 10:14:58 +0000 (10:14 +0000)]
Move the auto-sizing of the callout array from init_param2() to
kern_timeout_callwheel_alloc() where it is actually used.

This is a mechanical move and no tuning parameters are changed.

The pre-allocated callout array is only used for legacy timeout(9)
calls and is only allocated and active on cpu0.  Eventually all
remaining users of timeout(9) should switch to the callout_* API.

Reviewed by: davide

11 years agoThis file is specific to arm11x6 processors, so tell the
kientzle [Fri, 8 Mar 2013 03:29:05 +0000 (03:29 +0000)]
This file is specific to arm11x6 processors, so tell the
assembler it's okay to use arm11x6 instructions.

11 years agoAdd arm bits to truss.
cognet [Thu, 7 Mar 2013 23:44:35 +0000 (23:44 +0000)]
Add arm bits to truss.

11 years agoFix GCC build:
obrien [Thu, 7 Mar 2013 22:54:28 +0000 (22:54 +0000)]
Fix GCC build:
/usr/src/sys/modules/nvme/../../dev/nvme/nvme.c:211: warning: format '%qx' expects type 'long unsigned int', but argument 9 has type 'long long unsigned int' [-Wformat]

11 years agoFix error in r247960: actually assign the basename to match.iim_file.
dim [Thu, 7 Mar 2013 22:43:50 +0000 (22:43 +0000)]
Fix error in r247960: actually assign the basename to match.iim_file.

Pointed out by: avg
Pointy hat to: dim
MFC after: 1 week
X-MFC-With: r247960

11 years agoSupport the FAT16 partition type in gpart(8)
gavin [Thu, 7 Mar 2013 22:32:41 +0000 (22:32 +0000)]
Support the FAT16 partition type in gpart(8)

PR: kern/174714
Submitted by: 4721 at hushmail dot com
MFC after: 1 week

11 years agoMake ctfconvert work correctly on clang-compiled object files. Clang
dim [Thu, 7 Mar 2013 22:16:35 +0000 (22:16 +0000)]
Make ctfconvert work correctly on clang-compiled object files.  Clang
puts the full original source filename in the STT_FILE entry of the ELF
symbol table, while gcc saves only the basename.

Since the DWARF DW_AT_name attribute contains the full source filename,
both for clang and gcc, ctfconvert takes just the basename of it, for
matching with the STT_FILE entry.  So when attempting to match with such
an entry, use its basename, if necessary.

Reported by: avg
MFC after: 1 week

11 years agoMake c99(1) invoke /usr/bin/cc with argv[0] set to "/usr/bin/cc" instead
dim [Thu, 7 Mar 2013 21:37:23 +0000 (21:37 +0000)]
Make c99(1) invoke /usr/bin/cc with argv[0] set to "/usr/bin/cc" instead
of just "cc", since there is no reason to cause additional path searches
in this case.

MFC after: 3 days

11 years agoMake c89(1) invoke /usr/bin/cc with argv[0] also set to /usr/bin/cc,
dim [Thu, 7 Mar 2013 21:34:16 +0000 (21:34 +0000)]
Make c89(1) invoke /usr/bin/cc with argv[0] also set to /usr/bin/cc,
similar to what c99(1) does, to prevent "c89: illegal option -- 1"
messages, when clang is /usr/bin/cc.

Reported by: tijl
MFC after: 3 days

11 years agoNow that stable/7 is EOL, stop building INDEX-7.
cperciva [Thu, 7 Mar 2013 20:48:36 +0000 (20:48 +0000)]
Now that stable/7 is EOL, stop building INDEX-7.

MFC after: 1 week

11 years agoCleanup gr_add() so it does not leak mem
db [Thu, 7 Mar 2013 19:00:00 +0000 (19:00 +0000)]
Cleanup gr_add() so it does not leak mem
This is part of ongoing work on sbin/pw

M    libutil.h
M    gr_util.c

Approved by: theraven

11 years agoFix panic when Secondary_Element_Count == 1 and Secondary_Element_Seq
mav [Thu, 7 Mar 2013 18:55:37 +0000 (18:55 +0000)]
Fix panic when Secondary_Element_Count == 1 and Secondary_Element_Seq
is not set (255).

Reported by: sbruno
MFC after: 1 week

11 years agoFix off-by-one error in nanoseconds validation.
mav [Thu, 7 Mar 2013 16:50:07 +0000 (16:50 +0000)]
Fix off-by-one error in nanoseconds validation.

Submitted by: bde

11 years agoPartially revert r247892 and r247904 since our strnvis() does not
des [Thu, 7 Mar 2013 14:38:43 +0000 (14:38 +0000)]
Partially revert r247892 and r247904 since our strnvis() does not
behave the way OpenSSH expects.

11 years agoThe ZyXEL ZyAIR G-202 is also supported by zyd(4)
gavin [Thu, 7 Mar 2013 13:26:54 +0000 (13:26 +0000)]
The ZyXEL ZyAIR G-202 is also supported by zyd(4)

MFC after: 1 week

11 years agoCorrect two spelling mistakes in a comment.
gavin [Thu, 7 Mar 2013 13:24:49 +0000 (13:24 +0000)]
Correct two spelling mistakes in a comment.

11 years agoSuggest using the https: protocol not the svn: protocol to retrieve the
gavin [Thu, 7 Mar 2013 13:24:16 +0000 (13:24 +0000)]
Suggest using the https: protocol not the svn: protocol to retrieve the
various repositories.

11 years agoAdd __clzsi2 and ctzsi2. They are required on ARMv4 and ARMv5 to implement
andrew [Thu, 7 Mar 2013 09:18:52 +0000 (09:18 +0000)]
Add __clzsi2 and ctzsi2. They are required on ARMv4 and ARMv5 to implement
a number of builtin functions.

11 years agoAdd quirks to enable headphones redirection on number of Lenovo
glebius [Thu, 7 Mar 2013 08:00:04 +0000 (08:00 +0000)]
Add quirks to enable headphones redirection on number of Lenovo
laptops, namely X1, X1 Carbon, T420, T520.

PR: misc/176656
Submitted by: Hiren Panchasar <hiren.panchasara gmail.com>
Tested by: glebius, X1 Carbon
Tested by: osa, X1
Tested by: Hiren Panchasar, T420
Tested by: sbruno, T520
Reviewed by: mav
Sponsored by: Nginx, Inc.

11 years agoPlug a memory leak.
glebius [Thu, 7 Mar 2013 07:54:50 +0000 (07:54 +0000)]
Plug a memory leak.

Reviewed by: mav
Sponsored by: Nginx, Inc.

11 years agoThe hashmask returned by hashinit() is a valid index in the returned hash array.
lstewart [Thu, 7 Mar 2013 04:42:20 +0000 (04:42 +0000)]
The hashmask returned by hashinit() is a valid index in the returned hash array.
Fix a siftr(4) potential memory leak and INVARIANTS triggered kernel panic in
hashdestroy() by ensuring the last array index in the flow counter hash table is
flushed of entries.

MFC after: 3 days

11 years agoCall sched_prio() to immediately change the priority of the thread in
ian [Thu, 7 Mar 2013 02:53:29 +0000 (02:53 +0000)]
Call sched_prio() to immediately change the priority of the thread in
response to an rtprio_thread() call, when the priority is different
than the old priority, and either the old or the new priority class is
not RTP_PRIO_NORMAL (timeshare).

The reasoning for the second half of the test is that if it's a change in
timeshare priority, then the scheduler is going to adjust that priority
in a way that completely wipes out the requested change anyway, so
what's the point?  (If that's not true, then allowing a thread to change
its own timeshare priority would subvert the scheduler's adjustments and
let a cpu-bound thread monopolize the cpu; if allowed at all, that
should require priveleges.)

On the other hand, if either the old or new priority class is not
timeshare, then the scheduler doesn't make automatic adjustments, so we
should honor the request and make the priority change right away.  The
reason the old class gets caught up in this is the very reason for this
change:  when thread A changes the priority of its child thread B from
idle back to timeshare, thread B never actually gets moved to a
timeshare-range run queue unless there are some idle cycles available
to allow it to first get scheduled again as an idle thread.

Reviewed by: jhb@

11 years agoRemove strnvis(), strvis(), strvisx().
des [Wed, 6 Mar 2013 23:22:40 +0000 (23:22 +0000)]
Remove strnvis(), strvis(), strvisx().

11 years agoReduce minimal time intervals of setitimer(2) from 1/HZ to 1/(16*HZ) by
mav [Wed, 6 Mar 2013 22:40:47 +0000 (22:40 +0000)]
Reduce minimal time intervals of setitimer(2) from 1/HZ to 1/(16*HZ) by
using callout_reset_sbt() instead of callout_reset().  We can't remove
lower limit completely in this case because of significant processing
overhead, caused by unability to use direct callout execution due to using
process mutex in callout handler for sending SEGALRM signal.  With support
of periodic events that would allow unprivileged user to abuse the system.

Reviewed by: davide

11 years agoCreate a symlink from strchrnul.3 to strchr.3.
zeising [Wed, 6 Mar 2013 19:59:42 +0000 (19:59 +0000)]
Create a symlink from strchrnul.3 to strchr.3.
This was forgotten in the initial commit of strchrnul()

Approved by: theraven

11 years agoFix time math overflows and improve zero intervals handling in poll(),
mav [Wed, 6 Mar 2013 19:37:38 +0000 (19:37 +0000)]
Fix time math overflows and improve zero intervals handling in poll(),
select(), nanosleep() and kevent() functions after calloutng changes.

Reported by: bde

11 years agoForced commit to note that this file had not been regenerated since 5.8
des [Wed, 6 Mar 2013 13:48:49 +0000 (13:48 +0000)]
Forced commit to note that this file had not been regenerated since 5.8
due to issues with the configure script incorrectly detecting utmp and
lastlog despite the fact that FreeBSD 10 does not have them any more.

11 years agoExplicitly disable lastlog, utmp and wtmp.
des [Wed, 6 Mar 2013 13:46:20 +0000 (13:46 +0000)]
Explicitly disable lastlog, utmp and wtmp.

11 years agoFix 'make depend'
uqs [Wed, 6 Mar 2013 11:44:19 +0000 (11:44 +0000)]
Fix 'make depend'

11 years agoUpdate driver to version 4.6.95.0.
delphij [Wed, 6 Mar 2013 09:53:38 +0000 (09:53 +0000)]
Update driver to version 4.6.95.0.

Submitted by: "Duvvuru,Venkat Kumar" <VenkatKumar.Duvvuru Emulex.Com>
MFC after: 3 days

11 years agoSimplify virtio ring num-available calculation.
grehan [Wed, 6 Mar 2013 07:28:20 +0000 (07:28 +0000)]
Simplify virtio ring num-available calculation.

Submitted by: Chris Torek, torek at torek dot net

11 years agoRemove the virtio dependency entry for the VirtIO device drivers. This
bryanv [Wed, 6 Mar 2013 07:17:53 +0000 (07:17 +0000)]
Remove the virtio dependency entry for the VirtIO device drivers. This
will prevent the kernel from linking if the device driver are included
without the virtio module. Remove pci and scbus for the same reason.

Also explain the relationship and necessity of the virtio and virtio_pci
modules. Currently in FreeBSD, we only support VirtIO PCI, but it could
be replaced with a different interface (like MMIO) and the device
(network, block, etc) will still function.

Requested by: luigi
Approved by: grehan (mentor)
MFC after: 3 days

11 years agoReorder code to avoid the stat buffer being used uninitialized.
grehan [Wed, 6 Mar 2013 06:24:09 +0000 (06:24 +0000)]
Reorder code to avoid the stat buffer being used uninitialized.

Obtained from: NetApp

11 years agoFix stack alignment in the kernel to be on an 8 byte boundary as required
andrew [Wed, 6 Mar 2013 06:19:56 +0000 (06:19 +0000)]
Fix stack alignment in the kernel to be on an 8 byte boundary as required
by AAPCS.

11 years agoFix SIGSEGV when set_short_delay() is called when ifi->ifi_ra_timer is NULL.
hrs [Wed, 6 Mar 2013 04:58:48 +0000 (04:58 +0000)]
Fix SIGSEGV when set_short_delay() is called when ifi->ifi_ra_timer is NULL.
This can happen in a short period when a prefix is changed by a rtmsg and a
new interface arrives.

11 years agoUse build_iovec() to make it less cryptic. This also fixes warnings.
jkim [Wed, 6 Mar 2013 00:36:33 +0000 (00:36 +0000)]
Use build_iovec() to make it less cryptic.  This also fixes warnings.

11 years agoGC unused mount_* directories. mount_reiserfs was disconnected from build
jkim [Tue, 5 Mar 2013 23:53:37 +0000 (23:53 +0000)]
GC unused mount_* directories.  mount_reiserfs was disconnected from build
with r158666.  mount_ext2fs and mount_std were disconnected with r164527.

11 years agoUpdate the manual page to reflect reality. With r138509 and r152355,
jkim [Tue, 5 Mar 2013 23:05:43 +0000 (23:05 +0000)]
Update the manual page to reflect reality.  With r138509 and r152355,
"nostrictjoliet" option for mount_cd9660(8) was completely replaced with
"brokenjoliet" somehow.

MFC after: 3 days

11 years agoGC unused variables. Prefer NULL over 0 for pointers.
jkim [Tue, 5 Mar 2013 22:41:35 +0000 (22:41 +0000)]
GC unused variables.  Prefer NULL over 0 for pointers.

11 years ago- Reset DMA channel if error occured
gonzo [Tue, 5 Mar 2013 20:00:11 +0000 (20:00 +0000)]
- Reset DMA channel if error occured
- Initialize info field in bcm_dma_reset

Submitted by: Daisuke Aoyama <aoyama@peach.ne.jp>

11 years agoFix compile warning by including ctype.h for isdigit().
np [Tue, 5 Mar 2013 19:37:29 +0000 (19:37 +0000)]
Fix compile warning by including ctype.h for isdigit().

MFC after: 1 day

11 years agoMFV r247845:
mm [Tue, 5 Mar 2013 18:54:41 +0000 (18:54 +0000)]
MFV r247845:
Import ZFS bpobj bugfix from vendor.

Illumos ZFS issues:
  3603 panic from bpobj_enqueue_subobj()
  3604 zdb should print bpobjs more verbosely

References:
  https://www.illumos.org/issues/3603
  https://www.illumos.org/issues/3604

MFC after: 1 week

11 years agoFix build with gcc, do not use unnamed union.
kib [Tue, 5 Mar 2013 16:15:34 +0000 (16:15 +0000)]
Fix build with gcc, do not use unnamed union.

Reported and tested by: gjb
MFC after: 1 month

11 years agoFix build with gcc, remove redundand declarations.
kib [Tue, 5 Mar 2013 16:14:55 +0000 (16:14 +0000)]
Fix build with gcc, remove redundand declarations.

Reported and tested by: gjb
MFC after: 1 month

11 years agochoose in priority the allocated ABI if any to do the ${ABI} substitution in PACKAGESITE
bapt [Tue, 5 Mar 2013 14:08:36 +0000 (14:08 +0000)]
choose in priority the allocated ABI if any to do the ${ABI} substitution in PACKAGESITE

Reviewed by: bdrewery

11 years agoWrite lock is not required for find&compare operation.
melifaro [Tue, 5 Mar 2013 13:38:45 +0000 (13:38 +0000)]
Write lock is not required for find&compare operation.

MFC after: 2 weeks

11 years agoAdd the ability to correctly read pkg.conf is exists.
bapt [Tue, 5 Mar 2013 13:31:06 +0000 (13:31 +0000)]
Add the ability to correctly read pkg.conf is exists.

Only look for boostrap useful options:
 - PACKAGESITE
 - ABI
 - MIRROR_TYPE
 - ASSUME_ALWAYS_YES

While here makes PACKAGESITE expand the ${ABI} variable.
Allow to deactivate any SRV record look up (MIRROR_TYPE=none)
Use the same mechanism as for pkgng itself: first get configuration out of
environment variable and fallback on pkg.conf if exists.

Reviewed by: bdrewery

11 years agoAdd a stub manpage modeled over the libexpat one to explain to users not to use
bapt [Tue, 5 Mar 2013 13:06:40 +0000 (13:06 +0000)]
Add a stub manpage modeled over the libexpat one to explain to users not to use
this library outside of base.

Requested by: simon

11 years agodrm_global.c: Destroy sx in drm_global_release()
dumbbell [Tue, 5 Mar 2013 11:18:57 +0000 (11:18 +0000)]
drm_global.c: Destroy sx in drm_global_release()

This fixes a build error at the same time (unused variable "item"), if
the kernel is compiled without INVARIANTS.

Reported by: Hartmann, O. <ohartman@zedat.fu-berlin.de> (build error)
Reviewed by: Konstantin Belousov (kib@)

11 years agoCorrect the r247832.
kib [Tue, 5 Mar 2013 11:02:38 +0000 (11:02 +0000)]
Correct the r247832.

Noted by: marius, rdivacky
MFC after: 1 month

11 years agog_label_ntfs.c: Mark structures as __packed
dumbbell [Tue, 5 Mar 2013 11:02:05 +0000 (11:02 +0000)]
g_label_ntfs.c: Mark structures as __packed

Without this, read data is mis-interpreted. This could trigger a panic,
as was the case on one computer where computed "recsize" was zero,
leading to a call to g_read_page() asking for 0 bytes.

11 years agoAdd a generic way to call per event allocate / release function.
fabient [Tue, 5 Mar 2013 10:18:48 +0000 (10:18 +0000)]
Add a generic way to call per event allocate / release function.

Reviewed by: mav
MFC after: 1 month

11 years agoImport the preliminary port of the TTM.
kib [Tue, 5 Mar 2013 09:49:34 +0000 (09:49 +0000)]
Import the preliminary port of the TTM.

The early commit is done to facilitate the off-tree work on the
porting of the Radeon driver.

Sponsored by: The FreeBSD Foundation
Debugged and tested by:     dumbbell
MFC after: 1 month

11 years agoImport the drm_global references helpers.
kib [Tue, 5 Mar 2013 09:27:21 +0000 (09:27 +0000)]
Import the drm_global references helpers.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

11 years agoImport the drm_mm_debug_table() function.
kib [Tue, 5 Mar 2013 09:07:58 +0000 (09:07 +0000)]
Import the drm_mm_debug_table() function.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

11 years agoImport the likely() compat macro.
kib [Tue, 5 Mar 2013 09:07:01 +0000 (09:07 +0000)]
Import the likely() compat macro.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

11 years agoSimplify TAILQ usage and avoid additional memory allocations.
glebius [Tue, 5 Mar 2013 08:08:16 +0000 (08:08 +0000)]
Simplify TAILQ usage and avoid additional memory allocations.

Tested by: Eugene M. Zheganin <emz norma.perm.ru>
Sponsored by: Nginx, Inc

11 years agoOnly set the barrier flag if the feature was negotiated
bryanv [Tue, 5 Mar 2013 07:00:05 +0000 (07:00 +0000)]
Only set the barrier flag if the feature was negotiated

When the VirtIO barrier feature is not negotiated, the driver
must enforce the proper ordering for BIO_ORDERED BIOs. All the
in-flight BIOs must complete before starting the BIO, and the
ordered BIO must complete before subsequent BIOs can start.

Also fix a few whitespace nits.

Reported by: neel
Approved by: grehan (mentor)
MFC after: 3 days

11 years agoFix a small, but important bug, a task drain was mistakenly
jfv [Mon, 4 Mar 2013 23:15:07 +0000 (23:15 +0000)]
Fix a small, but important bug, a task drain was mistakenly
being compiled only when setting LEGACY_TX, this means you would
not get the drain when needed on detach!!

Thanks to Bryan Venteicher (bryanv@freebsd.org) for catching this
little gremlin!! :)

11 years agoFirst, sync to internal shared code, and then
jfv [Mon, 4 Mar 2013 23:07:40 +0000 (23:07 +0000)]
First, sync to internal shared code, and then

Fixes:
- flow control - don't override user value on re-init
- fix to make 1G optics work correctly
- change to interrupt enabling - some bits were incorrect
  for certain hardware.
- certain stats fixes, remove a duplicate increment of
  ierror, thanks to Scott Long for pointing these out.
- shared code link interface changed, requiring some
  core code changes to accomodate this.
- add an m_adj() to ETHER_ALIGN on the recieve side, this
  was requested by Mike Karels, thanks Mike.
- Multicast code corrections also thanks to Mike Karels.

11 years ago- Bump __FreeBSD_version after recent callout(9) changes.
davide [Mon, 4 Mar 2013 22:41:49 +0000 (22:41 +0000)]
- Bump __FreeBSD_version after recent callout(9) changes.
- Add an entry in UPDATING to notice users about breakages.

11 years agoFix assertion failure when using userland DTrace probes from
gibbs [Mon, 4 Mar 2013 22:07:36 +0000 (22:07 +0000)]
Fix assertion failure when using userland DTrace probes from
the pid provider on a kernel compiled with INVARIANTS.

sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c:
In fasttrap_probe_pid(), attempts to write to the
address space of the thread that fired the probe
must be performed with the process of the thread
held.  Use _PHOLD() to ensure this is the case.

In fasttrap_probe_pid(), use proc_write_regs() instead
of calling set_regs() directly.  proc_write_regs()
performs invariant checks to verify the calling
environment of set_regs().  PROC_LOCK()/UNLOCK() around
the call to proc_write_regs() so that it's invariants
are satisfied.

Sponsored by: Spectra Logic Corporation
Reviewed by: gnn, rpaulo
MFC after: 1 week

11 years agoComplete r247813:
davide [Mon, 4 Mar 2013 21:52:12 +0000 (21:52 +0000)]
Complete r247813:
Use true/false instead of TRUE/FALSE.

Reported by: attilio
Requested by: jhb

11 years agoAdd quirk to enable headphones redirection on Lenovo X220.
mav [Mon, 4 Mar 2013 21:20:13 +0000 (21:20 +0000)]
Add quirk to enable headphones redirection on Lenovo X220.

PR: kern/174876
MFC after: 1 week

11 years agoRe-enable CTL in GENERIC on i386 and amd64, but turn on the CTL disable
ken [Mon, 4 Mar 2013 21:18:45 +0000 (21:18 +0000)]
Re-enable CTL in GENERIC on i386 and amd64, but turn on the CTL disable
tunable by default.

This will allow GENERIC configurations to boot on small memory boxes, but
not require end users who want to use CTL to recompile their kernel.  They
can simply set kern.cam.ctl.disable=0 in loader.conf.

The eventual solution to the memory usage problem is to change the way
CTL allocates memory to be more configurable, but this should fix things
for small memory situations in the mean time.

UPDATING: Explain the change in the CTL configuration, and
how users can enable CTL if they would like to use
it.

sys/conf/options: Add a new option, CTL_DISABLE, that prevents CTL
from initializing.

ctl.c: If CTL_DISABLE is turned on, don't initialize.

i386/conf/GENERIC,
amd64/conf/GENERIC: Re-enable device ctl, and add the CTL_DISABLE
option.

11 years agoUse C99 'bool' rather than Machish 'boolean_t'.
davide [Mon, 4 Mar 2013 21:09:22 +0000 (21:09 +0000)]
Use C99 'bool' rather than Machish 'boolean_t'.

Requested by: jhb

11 years agoMFcalloutng:
davide [Mon, 4 Mar 2013 19:10:39 +0000 (19:10 +0000)]
MFcalloutng:
Dcoument the new functions added to condvar(9), sleep(9), sleepqueue(9)
KPIs. Also document recent changes in timeout(9) and eventtimers(4).

11 years agoDo not suddenly fail on some rulesets if -n (syntax check only) is specified
melifaro [Mon, 4 Mar 2013 19:01:38 +0000 (19:01 +0000)]
Do not suddenly fail on some rulesets if -n (syntax check only) is specified
and ipfw(4) module is not loaded.

MFC after: 2 weeks

11 years agoMerge upstream r634:646: correctly parse mixed quoted / unquoted text.
des [Mon, 4 Mar 2013 18:51:53 +0000 (18:51 +0000)]
Merge upstream r634:646: correctly parse mixed quoted / unquoted text.

11 years agoMFcalloutng:
davide [Mon, 4 Mar 2013 16:55:16 +0000 (16:55 +0000)]
MFcalloutng:
- Rewrite kevent() timeout implementation to allow sub-tick precision.
- Make the interval timings for EVFILT_TIMER more accurate. This also
removes an hack introduced in r238424.

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil

11 years agoMFcalloutng:
davide [Mon, 4 Mar 2013 16:41:27 +0000 (16:41 +0000)]
MFcalloutng:
Fix kern_select() and sys_poll() so that they can handle sub-tick
precision for timeouts (in the same fashion it was done for nanosleep()
in r247797).

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil

11 years agoMFcalloutng (r244251 with minor changes):
davide [Mon, 4 Mar 2013 16:25:12 +0000 (16:25 +0000)]
MFcalloutng (r244251 with minor changes):
Specify that precision of 0.5s is enough for resource limitation.

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil

11 years agoMFcalloutng (r236314 by mav):
davide [Mon, 4 Mar 2013 16:16:23 +0000 (16:16 +0000)]
MFcalloutng (r236314 by mav):
Specify that wakeup rate of 7.5-10Hz is enough for yarrow harvesting
thread.

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil

11 years agoMFcalloutng (r244255 by mav, with minor changes):
davide [Mon, 4 Mar 2013 16:07:55 +0000 (16:07 +0000)]
MFcalloutng (r244255 by mav, with minor changes):
Specify that syslog doesn't need exactly 5 wakeups per second.

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil

11 years agoMFcalloutng:
davide [Mon, 4 Mar 2013 15:57:41 +0000 (15:57 +0000)]
MFcalloutng:
kern_nanosleep() is now converted to use tsleep_sbt(). With this change
nanosleep() and usleep() can handle sub-tick precision for timeouts.
Also, try to help coalesce of events passing as argument to tsleep_bt()
a precision value calculated as a percentage of the sleep time.
This percentage is default 5%, but it can tuned according to users
need via the sysctl interface.

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil

11 years agoFix build with DIAGNOSTIC/CALLOUT_PROFILING options turned on.
davide [Mon, 4 Mar 2013 15:03:52 +0000 (15:03 +0000)]
Fix build with DIAGNOSTIC/CALLOUT_PROFILING options turned on.

Reported by: kib, David Wolfskill <david at catwhisker dot org>
Pointy-hat to: davide

11 years agoMFcalloutng (r244249, r244306 by mav):
davide [Mon, 4 Mar 2013 14:00:58 +0000 (14:00 +0000)]
MFcalloutng (r244249, r244306 by mav):
- Switch syscons from timeout() to callout_reset_flags() and specify that
precision is not important there -- anything from 20 to 30Hz will be fine.
- Reduce syscons "refresh" rate to 1-2Hz when console is in graphics mode
and there is nothing to do except some polling for keyboard.  Text mode
refresh would also be nice to have adaptive, but this change at least
should help laptop users who running X.

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil

11 years agoModernize some portions of the ports man page.
eadler [Mon, 4 Mar 2013 13:57:46 +0000 (13:57 +0000)]
Modernize some portions of the ports man page.
Stop documenting other operating systems's default patha

Approved by: bcr (mentor)

11 years agoMerge from vmcontention:
attilio [Mon, 4 Mar 2013 13:10:59 +0000 (13:10 +0000)]
Merge from vmcontention:
As vm objects are type-stable there is no need to initialize the
resident splay tree pointer and the cache splay tree pointer in
_vm_object_allocate() but this could be done in the init UMA zone
handler.

The destructor UMA zone handler, will further check if the condition is
retained at every destruction and catch for bugs.

Sponsored by: EMC / Isilon storage division
Submitted by: alc

11 years agoMFcalloutng:
davide [Mon, 4 Mar 2013 12:48:41 +0000 (12:48 +0000)]
MFcalloutng:
Introduce sbt variants of msleep(), msleep_spin(), pause(), tsleep() in
the KPI, allowing to specify timeout in 'sbintime_t' rather than ticks.

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil

11 years agoMFcalloutng:
davide [Mon, 4 Mar 2013 12:20:48 +0000 (12:20 +0000)]
MFcalloutng:
Extend condvar(9) KPI introducing sbt variant of cv_timedwait. This
rely on the previously committed sleepq_set_timeout_sbt().

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil

11 years agoStyle fix: remove useless braces. Sorry, my bad.
davide [Mon, 4 Mar 2013 11:55:32 +0000 (11:55 +0000)]
Style fix: remove useless braces. Sorry, my bad.

Submitted by: bde

11 years agoMFcalloutng:
davide [Mon, 4 Mar 2013 11:51:46 +0000 (11:51 +0000)]
MFcalloutng:
Convert sleepqueue(9) bits to the new callout KPI. Take advantage of
the possibility to run callback directly from hw interrupt context.

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil

11 years agoFix VERBOSE reporting on results when removing _PATH_LOCALTIME for UTC option.
dteske [Mon, 4 Mar 2013 11:34:31 +0000 (11:34 +0000)]
Fix VERBOSE reporting on results when removing _PATH_LOCALTIME for UTC option.

PR: bin/164976
Submitted by: dteske

11 years agoImport libyaml as libbsdyml (private brand name)
bapt [Mon, 4 Mar 2013 11:27:41 +0000 (11:27 +0000)]
Import libyaml as libbsdyml (private brand name)

LibYAML is a YAML 1.1 parser and emitter under MIT license which will
soon be used by the pkg boostrap (usr.bin/pkg) and bhyve

Reviewed by: roberto, antoine

11 years agoMFcalloutng (r244355):
davide [Mon, 4 Mar 2013 11:22:19 +0000 (11:22 +0000)]
MFcalloutng (r244355):
Make loadavg calculation callout direct. There are several reasons for it:
 - it is very simple and doesn't worth context switch to SWI;
 - since SWI is no longer used here, we can remove twelve years old hack,
excluding this SWI from from the loadavg statistics;
 - it fixes problem when eventtimer (HPET) shares interrupt with some other
device, and that interrupt thread counted as permanent loadavg of 1; now
loadavg accounted before that interrupt thread is scheduled.

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, Fabian Keil, markj

11 years ago- Make callout(9) tickless, relying on eventtimers(4) as backend for
davide [Mon, 4 Mar 2013 11:09:56 +0000 (11:09 +0000)]
- Make callout(9) tickless, relying on eventtimers(4) as backend for
precise time event generation. This greatly improves granularity of
callouts which are not anymore constrained to wait next tick to be
scheduled.
- Extend the callout KPI introducing a set of callout_reset_sbt* functions,
which take a sbintime_t as timeout argument. The new KPI also offers a
way for consumers to specify precision tolerance they allow, so that
callout can coalesce events and reduce number of interrupts as well as
potentially avoid scheduling a SWI thread.
- Introduce support for dispatching callouts directly from hardware
interrupt context, specifying an additional flag. This feature should be
used carefully, as long as interrupt context has some limitations
(e.g. no sleeping locks can be held).
- Enhance mechanisms to gather informations about callwheel, introducing
a new sysctl to obtain stats.

This change breaks the KBI. struct callout fields has been changed, in
particular 'int ticks' (4 bytes) has been replaced with 'sbintime_t'
(8 bytes) and another 'sbintime_t' field was added for precision.

Together with: mav
Reviewed by: attilio, bde, luigi, phk
Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo (amd64, sparc64), marius (sparc64), ian (arm),
markj (amd64), mav, Fabian Keil

11 years agoIf we're using a PIPT L2 cache, only merge 2 segments if both the virtual
cognet [Mon, 4 Mar 2013 10:41:54 +0000 (10:41 +0000)]
If we're using a PIPT L2 cache, only merge 2 segments if both the virtual
and the physical addreses are contiguous.

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

11 years agoadd a method to set/clear the VMF field in the TX descriptor.
adrian [Mon, 4 Mar 2013 07:40:49 +0000 (07:40 +0000)]
add a method to set/clear the VMF field in the TX descriptor.

Obtained from: Qualcomm Atheros

11 years agoRemove check for NULL prior to free(9) and m_freem(9).
eadler [Mon, 4 Mar 2013 02:21:34 +0000 (02:21 +0000)]
Remove check for NULL prior to free(9) and m_freem(9).

Approved by: cperciva (mentor)

11 years agodevd: Correct typo in comment.
eadler [Mon, 4 Mar 2013 02:21:31 +0000 (02:21 +0000)]
devd: Correct typo in comment.

Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
Approved by: cperciva (mentor)