]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
12 years agoIntroduce an optional ath(4) radiotap vendor extension.
Adrian Chadd [Sun, 24 Jun 2012 07:01:49 +0000 (07:01 +0000)]
Introduce an optional ath(4) radiotap vendor extension.

This includes a few new fields in each RXed frame:

* per chain RX RSSI (ctl and ext);
* current RX chainmask;
* EVM information;
* PHY error code;
* basic RX status bits (CRC error, PHY error, etc).

This is primarily to allow me to do some userland PHY error processing
for radar and spectral scan data.  However since EVM and per-chain RSSI
is provided, others may find it useful for a variety of tasks.

The default is to not compile in the radiotap vendor extensions, primarily
because tcpdump doesn't seem to handle the particular vendor extension
layout I'm using, and I'd rather not break existing code out there that
may be (badly) parsing the radiotap data.

Instead, add the option 'ATH_ENABLE_RADIOTAP_VENDOR_EXT' to your kernel
configuration file to enable these options.

12 years agoOn second thought, let's just set both CRC and PHY errors together on
Adrian Chadd [Sun, 24 Jun 2012 06:37:28 +0000 (06:37 +0000)]
On second thought, let's just set both CRC and PHY errors together on
frames that have it and let the upper layer sort it out.

PR: kern/169362

12 years agoSometimes the AR5416 sends back radar PHY errors with both the PHY error
Adrian Chadd [Sun, 24 Jun 2012 05:59:32 +0000 (05:59 +0000)]
Sometimes the AR5416 sends back radar PHY errors with both the PHY error
and the CRC error bits set.  The radar payload is correct.

When this happens, the stack doesn't see them PHY error frames and
isn't interpreted as a PHY error.  So, no radar detection and no radiotap
PHY error handling.

Now, this may introduce some weird issues if the MAC sends up some other
combination of CRC error + PHY error frames; this commit would break that
and mark them as PHY errors instead of CRC errors.

I may tinker with this a little more to pass radar/early radar/spectral
frames up as PHY errors if the CRC bit is set, to restore the previous
behaviour (where if CRC is set on a PHY error frame, it's marked as a CRC
error rather than PHY error.)

Tested on: AR5416, over the air, to a USRP N200 which is generating a
large number of a variety of radar pulses.
TODO: Test on AR9130, AR9160, AR9280 (and maybe radar pulses on
2GHz on AR9285/AR9287.)

PR: kern/169362

12 years agoFix a bug which causes a panic in daopen(). The panic is caused by
Kenneth D. Merry [Sun, 24 Jun 2012 04:29:03 +0000 (04:29 +0000)]
Fix a bug which causes a panic in daopen(). The panic is caused by
a da(4) instance going away while GEOM is still probing it.

In this case, the GEOM disk class instance has been created by
disk_create(), and the taste of the disk is queued in the GEOM
event queue.

While that event is queued, the da(4) instance goes away.  When the
open call comes into the da(4) driver, it dereferences the freed
(but non-NULL) peripheral pointer provided by GEOM, which results
in a panic.

The solution is to add a callback to the GEOM disk code that is
called when all of its resources are cleaned up.  This is
implemented inside GEOM by adding an optional callback that is
called when all consumers have detached from a provider, and the
provider is about to be deleted.

scsi_cd.c,
scsi_da.c: In the register routine for the cd(4) and da(4)
routines, acquire a reference to the CAM peripheral
instance just before we call disk_create().

Use the new GEOM disk d_gone() callback to register
a callback (dadiskgonecb()/cddiskgonecb()) that
decrements the peripheral reference count once GEOM
has finished cleaning up its resources.

In the cd(4) driver, clean up open and close
behavior slightly.  GEOM makes sure we only get one
open() and one close call, so there is no need to
set an open flag and decrement the reference count
if we are not the first open.

In the cd(4) driver, use cam_periph_release_locked()
in a couple of error scenarios to avoid extra mutex
calls.

geom.h: Add a new, optional, providergone callback that
is called when a provider is about to be deleted.

geom_disk.h: Add a new d_gone() callback to the GEOM disk
interface.

Bump the DISK_VERSION to version 2.  This probably
should have been done after a couple of previous
changes, especially the addition of the d_getattr()
callback.

geom_disk.c: Add a providergone callback for the disk class,
g_disk_providergone(), that calls the user's
d_gone() callback if it exists.

Bump the DISK_VERSION to 2.

geom_subr.c: In g_destroy_provider(), call the providergone
callback if it has been provided.

In g_new_geomf(), propagate the class's
providergone callback to the new geom instance.

blkfront.c: Callers of disk_create() are supposed to pass in
DISK_VERSION, not an explicit disk API version
number.  Update the blkfront driver to do that.

disk.9: Update the disk(9) man page to include information
on the new d_gone() callback, as well as the
previously added d_getattr() callback, d_descr
field, and HBA PCI ID fields.

MFC after: 5 days

12 years agoMake the wchar_t type machine dependent.
Andrew Turner [Sun, 24 Jun 2012 04:15:58 +0000 (04:15 +0000)]
Make the wchar_t type machine dependent.

This is required for ARM EABI. Section 7.1.1 of the Procedure Call for the
ARM Architecture (AAPCS) defines wchar_t as either an unsigned int or an
unsigned short with the former preferred.

Because of this requirement we need to move the definition of __wchar_t to
a machine dependent header. It also cleans up the macros defining the limits
of wchar_t by defining __WCHAR_MIN and __WCHAR_MAX in the same machine
dependent header then using them to define WCHAR_MIN and WCHAR_MAX
respectively.

Discussed with: bde

12 years agoIntroduce reserve_pv_entry() and use it in pmap_pv_demote_pde(). In order
Alan Cox [Sat, 23 Jun 2012 22:54:25 +0000 (22:54 +0000)]
Introduce reserve_pv_entry() and use it in pmap_pv_demote_pde().  In order
to add PV list locking to pmap_pv_demote_pde(), it is necessary to change
the way that pmap_pv_demote_pde() allocates PV entries.  Specifically,
once pmap_pv_demote_pde() begins modifying the PV lists, it can't allocate
any new PV chunks, because that could require the PV list lock to be
dropped.  So, all necessary PV chunks must be allocated in advance.  To my
surprise, this new approach is a few percent faster than the old one.

12 years agoBetter way to determine the status page length and rx pad boundary.
Navdeep Parhar [Sat, 23 Jun 2012 22:12:27 +0000 (22:12 +0000)]
Better way to determine the status page length and rx pad boundary.

12 years agoRemove superfluous paragraph macro.
Joel Dahl [Sat, 23 Jun 2012 20:44:45 +0000 (20:44 +0000)]
Remove superfluous paragraph macro.

12 years agoAdd description about dev.acpi_ibm.0.handlerevents.
Mitsuru IWASAKI [Sat, 23 Jun 2012 18:45:32 +0000 (18:45 +0000)]
Add description about dev.acpi_ibm.0.handlerevents.

MFC after: 3 days

12 years agoAdd in-driver event handler.
Mitsuru IWASAKI [Sat, 23 Jun 2012 18:43:54 +0000 (18:43 +0000)]
Add in-driver event handler.

MFC after: 3 days

12 years agoCorrect device id for GPU on some server SandyBridge model.
Konstantin Belousov [Sat, 23 Jun 2012 15:36:32 +0000 (15:36 +0000)]
Correct device id for GPU on some server SandyBridge model.

Submitted and tested by: Thomas Zander <thomas.e.zander googlemail com>
MFC after: 3 days

12 years agoUnbreak options ZFS after r236884.
Marius Strobl [Sat, 23 Jun 2012 14:43:25 +0000 (14:43 +0000)]
Unbreak options ZFS after r236884.

12 years agoRelease the ADB keyboard mutex when handling the power button
Justin Hibbits [Sat, 23 Jun 2012 13:52:44 +0000 (13:52 +0000)]
Release the ADB keyboard mutex when handling the power button
press/release.  Found by WITNESS.

Approved by: nwhitehorn (mentor)
MFC after: 3 days

12 years agoFix interface matching by ipfw table
Alexander V. Chernikov [Sat, 23 Jun 2012 12:40:24 +0000 (12:40 +0000)]
Fix interface matching by ipfw table

Submitted by:     Ihor Kaharlichenko <madkinder@gmail.com>
Tested by:        Ihor Kaharlichenko <madkinder@gmail.com>
Approved by:      kib(mentor)
MFC after:        3 days

12 years agoAdd scsi_extract_sense_ccb() -- wrapper around scsi_extract_sense_len().
Alexander Motin [Sat, 23 Jun 2012 12:32:53 +0000 (12:32 +0000)]
Add scsi_extract_sense_ccb() -- wrapper around scsi_extract_sense_len().
It allows to remove number of duplicate checks from several places.

12 years agoMove the code dealing with shared page into a dedicated
Konstantin Belousov [Sat, 23 Jun 2012 10:15:23 +0000 (10:15 +0000)]
Move the code dealing with shared page into a dedicated
kern_sharedpage.c source file from kern_exec.c.

MFC after:   29 days

12 years agoRemove no longer needed forward declaration for struct sf_buf.
Konstantin Belousov [Sat, 23 Jun 2012 10:14:51 +0000 (10:14 +0000)]
Remove no longer needed forward declaration for struct sf_buf.

MFC after:  29 days

12 years agoStop updating the struct vdso_timehands from even handler executed in
Konstantin Belousov [Sat, 23 Jun 2012 09:33:06 +0000 (09:33 +0000)]
Stop updating the struct vdso_timehands from even handler executed in
the scheduled task from tc_windup(). Do it directly from tc_windup in
interrupt context [1].

Establish the permanent mapping of the shared page into the kernel
address space, avoiding the potential need to sleep waiting for
allocation of sf buffer during vdso_timehands update. As a
consequence, shared_page_write_start() and shared_page_write_end()
functions are not needed anymore.

Guess and memorize the pointers to native host and compat32 sysentvec
during initialization, to avoid the need to get shared_page_alloc_sx
lock during the update.

In tc_fill_vdso_timehands(), do not loop waiting for timehands
generation to stabilize, since vdso_timehands is written in the same
interrupt context which wrote timehands.

Requested by:   mav [1]
MFC after:   29 days

12 years agoDo not allocate extra vectors when adapter is not TOE
Navdeep Parhar [Fri, 22 Jun 2012 22:59:42 +0000 (22:59 +0000)]
Do not allocate extra vectors when adapter is not TOE
capable (or toecaps have been disallowed by the user).

+ one very minor unrelated cleanup in t4_sge.c

12 years agoReturn CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE instead of CAM_TID_INVALID
Alexander Motin [Fri, 22 Jun 2012 21:46:41 +0000 (21:46 +0000)]
Return CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE instead of CAM_TID_INVALID
and CAM_LUN_INVALID for case of missing devices. In removes tons of error
messages from CAM during bus scans.

Reported and tested by: Mike Tancsa <mike@sentex.net>
MFC after: 3 days

12 years agoJust add a comment to further investigate when being closer to that code
Bjoern A. Zeeb [Fri, 22 Jun 2012 21:26:35 +0000 (21:26 +0000)]
Just add a comment to further investigate when being closer to that code
again next time.  The condition of the 2nd if() is very unlikely ever met.

12 years agoImport Illumos revision 13736:9f1d48e1681f
Martin Matuska [Fri, 22 Jun 2012 20:42:11 +0000 (20:42 +0000)]
Import Illumos revision 13736:9f1d48e1681f
2901 ZFS receive fails for exabyte sparse files

References:
https://www.illumos.org/issues/2901

Obtained from: illumos (issue #2901)
MFC after: 1 week

12 years agoChange 'camcontrol defects' to first probe a drive to find out how much
Kenneth D. Merry [Fri, 22 Jun 2012 18:57:06 +0000 (18:57 +0000)]
Change 'camcontrol defects' to first probe a drive to find out how much
defect information it has before grabbing the full defect list.

This works around a bug with some Hitachi drives that generate data overrun
errors when they are asked for more defect data than they have.

The change is done in a spec-compliant way, so it should have no negative
impact on drives that don't have this issue.

This is based on work originally done at Sandvine.

scsi_da.h: Add a define for the maximum amount of data that can be
contained in a defect list.

camcontrol.c: Update the readdefects() function to issue an initial
command to determine the length of the defect list, and
then use that length in the request for the full defect
list.

camcontrol.8: Add a note that some drives will report 0 defects available
if you don't request either the PLIST or GLIST.

Submitted by: Mark Johnston <markjdb@gmail.com> (original version)
MFC after: 3 days

12 years ago- Add a comment explaining the locking of the cached pages pool held
Attilio Rao [Fri, 22 Jun 2012 18:34:11 +0000 (18:34 +0000)]
- Add a comment explaining the locking of the cached pages pool held
  by vm_objects.
- Add flags for the per-object lock and free pages queue mutex lock.
  Use the newly added flags to mark the cache root within the vm_object
  structure.

Please note that other vm_object members should be marked with correct
locking but they are left for other commits.

In collabouration with: alc

MFC after: 3 days3 days3 days

12 years agoMerge changes from upstream libedit.
Pedro F. Giffuni [Fri, 22 Jun 2012 18:01:22 +0000 (18:01 +0000)]
Merge changes from upstream libedit.

Our libedit has been diverging from the mainstream version
maintained in NetBSD. As a consequence it has been difficult
to do an appropriate MFV and we have been bringing only
partial updates.

Here we update most of the files to at least match the
version available in NetBSD's snapshot of 20091228. This
version was chosen because it still doesn't include wide
character support (UTF-8), which involves many changes and
new files.

From NetBSD's logs:

Dec 15 22:13:33 2006 - editline.3 el.c el.h histedit.h
add EL_GETFP, and EL_SETFP.

Apr 5 15:53:28 2008 - editline.3 el.c histedit.h readline.c
add EL_REFRESH for the benefit of readline

Sep 10 15:45:37 2008 - common.c el.c read.c refresh.c sig.c term.c term.h tty.c
Allow a single process to control multiple ttys (for pthreads using _REENTRANT)
using multiple EditLine objects.

Jan 18 12:17:24 2009 - el.c read.c readline.c
fix -Wsign-compare issues

Feb 6 14:40:32 2009 - history.c
Plug memory leak, from MySQL.

Feb 5 19:15:44 2009 - histedit.h read.c
match documentation in el_push

Feb 6 13:14:37 2009 - vi.c
Portability fix.

Feb 12 13:39:49 2009 - readline.c term.c
More fixes for existing portability stuff.

Feb 15 21:24:13 2009 - el.h read.c
don't restart on EINTR, instead return NULL immediately. From Anon Ymous

Feb 15 21:25:01 2009 - sig.c sig.h
in order for read() to return EINTR we need to use sigaction, not signal,
otherwise SA_RESTART is set.

Feb 15 21:55:23 2009 - chared.c chared.h common.c emacs.c filecomplete.c
filecomplete.h key.c key.h read.c readline.c refresh.c search.c
term.c tokenizer.c tty.c vi.c
pass lint on _LP64.

Feb 17 21:34:26 2009 - el.c histedit.h prompt.c prompt.h
allow for a prompt argument.

Feb 18 15:04:40 2009 - sig.c
SA_RESTART for all signals but SIGINT. From Anon Ymous.

Feb 19 15:20:22 2009 - read.c sig.c sig.h
reset and redraw on sigcont. From Anon Ymous.

Feb 21 23:31:56 2009 - key.c key.h readline.c vi.c
more size_t stuff.

Mar 10 20:46:15 2009 - editline.3 read.c
make el_gets set the count to -1 on error to distinguish between EOF and
error.

Mar 31 17:38:27 2009 - editline.3 el.c histedit.h prompt.c prompt.h
refresh.c term.c term.h
Implement literal prompt sequences. Now someone can implement
RL_PROMPT_START_LITERAL/RL_PROMPT_END_LITERAL :-)

Mar 31 21:33:17 2009 - term.c
cast to size_t to avoid sign / unsigned comparison warning.

Apr 23 02:03 2009 - term.c
Apply patch (requested by msaitoh in ticket #2007):
Coverity CID 1668: Plug memory leak when malloc() failed.:55 2009

May 11 18:33:30 2009 - editline.3 el.c histedit.h
restore binary compatibility by providing new prompt functions that take
an extra literal character.

May 19 21:45:14 2009 - refresh.c
always scroll when we advance past bottom. From Caleb Welton
cwelton at greenplum dot com.

Jul 17 12:27:57 2009 - term.c
- off by one in the term.h case.
- make code more similar to tcsh (if we want to handle wide chars, this is
  needed; for now it is a no-op)

Jul 22 15:56:29 2009 - el.c
Move filename to the scope it is being used.
From Michael Cook mcook at bbn dot com

Jul 22 15:57:00 2009 - read.c
Always initialize nread since it is an out param.
From Michael Cook mcook at bbn dot com

Jul 22 18:25:26 2009 - el.c
Only need path if we have issetugid... From Anon Ymous

Jul 25 21:19:23 2009 - el.c
Ignore comment lines in .editrc from Jess Thrysoee

Sep 7 21:24:33 2009
histedit.h history.c readline.c
apply apple patches from:
http://opensource.apple.com/source/libedit/libedit-11/patches/

Dec 28 21:52:43 2009 - refresh.c
Fix bug where tab completion on the second or > line that caused listing
ended up corrupting the display by an extra space in the beginning. Reported
by Mac Chan.

Dec 28 22:15:36 2009 - refresh.c term.c
reduce diff with tcsh

Obtained from: NetBSD
Tested by: bapt, jilles and current@
MFC after: 1 week

12 years agoDon't print SCSI Queue Full and CAM_REQUEUE_REQ statuses as errors if they
Alexander Motin [Fri, 22 Jun 2012 16:20:13 +0000 (16:20 +0000)]
Don't print SCSI Queue Full and CAM_REQUEUE_REQ statuses as errors if they
were handled and retried. They are part of normal operation for SCSI TCQ.

MFC after: 3 days

12 years agoCommit changes missed from r237435. Properly calculate the signal
Konstantin Belousov [Fri, 22 Jun 2012 16:05:56 +0000 (16:05 +0000)]
Commit changes missed from r237435.  Properly calculate the signal
trampoline addresses after the shared page is enabled.  Handle FreeBSD
ABIs without shared page support too.

Reported and tested by: David Wolfskill <david catwhisker org>
 (previous version)
Pointy hat to: kib
MFC after:   1 month

12 years agoDo not read registers with read side effects while performing a register
Navdeep Parhar [Fri, 22 Jun 2012 08:37:33 +0000 (08:37 +0000)]
Do not read registers with read side effects while performing a register
dump for cxgbetool.

12 years agocxgbe(4): update to firmware interface 1.5.2.0; updates to shared code.
Navdeep Parhar [Fri, 22 Jun 2012 07:51:15 +0000 (07:51 +0000)]
cxgbe(4): update to firmware interface 1.5.2.0; updates to shared code.

12 years agoEnable shared page on i386, now it has a use for vdso_timehands.
Konstantin Belousov [Fri, 22 Jun 2012 07:16:29 +0000 (07:16 +0000)]
Enable shared page on i386, now it has a use for vdso_timehands.

MFC after: 1 month

12 years agoUse struct vdso_timehands data to implement fast gettimeofday(2) and
Konstantin Belousov [Fri, 22 Jun 2012 07:13:30 +0000 (07:13 +0000)]
Use struct vdso_timehands data to implement fast gettimeofday(2) and
clock_gettime(2) functions if supported. The speedup seen in
microbenchmarks is in range 4x-7x depending on the hardware.

Only amd64 and i386 architectures are supported. Libc uses rdtsc and
kernel data to calculate current time, if enabled by kernel.

Hopefully, this code is going to migrate into vdso in some future.

Discussed with: bde
Reviewed by: jhb
Tested by: flo
MFC after: 1 month

12 years agoImplement mechanism to export some kernel timekeeping data to
Konstantin Belousov [Fri, 22 Jun 2012 07:06:40 +0000 (07:06 +0000)]
Implement mechanism to export some kernel timekeeping data to
usermode, using shared page.  The structures and functions have vdso
prefix, to indicate the intended location of the code in some future.

The versioned per-algorithm data is exported in the format of struct
vdso_timehands, which mostly repeats the content of in-kernel struct
timehands. Usermode reading of the structure can be lockless.
Compatibility export for 32bit processes on 64bit host is also
provided. Kernel also provides usermode with indication about
currently used timecounter, so that libc can fall back to syscall if
configured timecounter is unknown to usermode code.

The shared data updates are initiated both from the tc_windup(), where
a fast task is queued to do the update, and from sysctl handlers which
change timecounter. A manual override switch
kern.timecounter.fast_gettime allows to turn off the mechanism.

Only x86 architectures export the real algorithm data, and there, only
for tsc timecounter. HPET counters page could be exported as well, but
I prefer to not further glue the kernel and libc ABI there until
proper vdso-based solution is developed.

Minimal stubs neccessary for non-x86 architectures to still compile
are provided.

Discussed with: bde
Reviewed by: jhb
Tested by: flo
MFC after: 1 month

12 years agoFix a stray debug that I committed accidentally years ago...
Warner Losh [Fri, 22 Jun 2012 06:44:22 +0000 (06:44 +0000)]
Fix a stray debug that I committed accidentally years ago...

12 years agoEnchance the shared page chunk allocator.
Konstantin Belousov [Fri, 22 Jun 2012 06:39:28 +0000 (06:39 +0000)]
Enchance the shared page chunk allocator.

Do not rely on the busy state of the page from which we allocate the
chunk, to protect allocator state. Use statically allocated sx lock
instead.

Provide more flexible KPI. In particular, allow to allocate chunk
without providing initial data, and allow writes into existing
allocation. Allow to get an sf buf which temporary maps the chunk, to
allow sequential updates to shared page content without unmapping in
between.

Reviewed by: jhb
Tested by: flo
MFC after: 1 month

12 years agoReserve AT_TIMEKEEP auxv entry for providing usermode the pointer to
Konstantin Belousov [Fri, 22 Jun 2012 06:38:31 +0000 (06:38 +0000)]
Reserve AT_TIMEKEEP auxv entry for providing usermode the pointer to
timekeeping information.

MFC after:  1 week

12 years agoMove these #defines to at91reg.h (where I should have put them in the
Warner Losh [Fri, 22 Jun 2012 05:54:34 +0000 (05:54 +0000)]
Move these #defines to at91reg.h (where I should have put them in the
first place).

12 years agoIntroduce CHANGE_PV_LIST_LOCK_TO_{PHYS,VM_PAGE}() to avoid duplication of
Alan Cox [Fri, 22 Jun 2012 05:01:36 +0000 (05:01 +0000)]
Introduce CHANGE_PV_LIST_LOCK_TO_{PHYS,VM_PAGE}() to avoid duplication of
code.

12 years agoMerge ACPICA 20120620.
Jung-uk Kim [Fri, 22 Jun 2012 00:40:44 +0000 (00:40 +0000)]
Merge ACPICA 20120620.

12 years agoAdd PCI IDs for Ivy Bridge
Ed Maste [Thu, 21 Jun 2012 22:06:57 +0000 (22:06 +0000)]
Add PCI IDs for Ivy Bridge

12 years agoMFV: Update zlib to 1.2.7.
Xin LI [Thu, 21 Jun 2012 21:47:08 +0000 (21:47 +0000)]
MFV: Update zlib to 1.2.7.

(x86 assembler optimization disabled for now because it
requires the new .cfi_* directives that is not supported
by base system binutils).

MFC after: 1 week

12 years agoAdd the functions documented in the man pages in commit 237393 to the
Isabell Long [Thu, 21 Jun 2012 18:28:48 +0000 (18:28 +0000)]
Add the functions documented in the man pages in commit 237393 to the
relevant Makefile.

Reminded by: gavin
Approved by: gabor (mentor)
MFC after: 5 days

12 years agoFix "comparison is always true due to limited range of data type" warning
Jung-uk Kim [Thu, 21 Jun 2012 18:22:50 +0000 (18:22 +0000)]
Fix "comparison is always true due to limited range of data type" warning
from GCC in the base system.  Note this patch was submitted upstream and it
will appear in the next ACPICA release.

Discussed with: Moore, Robert (robert dot moore at intel dot com)

12 years agoBring a couple of fixes for gcc optimizations.
Pedro F. Giffuni [Thu, 21 Jun 2012 16:49:20 +0000 (16:49 +0000)]
Bring a couple of fixes for gcc optimizations.

The GCC4.3 branch contains some optimization fixes
that were not considered regressions and therefore
were never backported. We are bringing a couple of
them that are under GPLv2 since they were made
before the license switch upstream.

While here, add the GCC revision numbers in the
log.

Discussed with: jkim
MFC after: 1 week

12 years agoUpdate the PV stats in free_pv_entry() using atomics. After which, it is
Alan Cox [Thu, 21 Jun 2012 16:37:36 +0000 (16:37 +0000)]
Update the PV stats in free_pv_entry() using atomics.  After which, it is
no longer necessary for free_pv_entry() to be serialized by the pvh global
lock.

Retire pmap_insert_entry() and pmap_remove_entry().  Once upon a time,
these functions were called from multiple places within the pmap.  Now,
each has only one caller.

12 years agoBe explicit about the dependency on nsparser.h.
David E. O'Brien [Thu, 21 Jun 2012 15:47:06 +0000 (15:47 +0000)]
Be explicit about the dependency on nsparser.h.

12 years agoMake cam_periph_hold() behavior consistent: drop taken reference and
Alexander Motin [Thu, 21 Jun 2012 15:14:51 +0000 (15:14 +0000)]
Make cam_periph_hold() behavior consistent: drop taken reference and
return ENXIO if periph was invalidated while we were waiting for it.

MFC after: 1 week

12 years agoIn camisr() clear CAM_SIM_ON_DONEQ flag after camisr_runqueue() purged SIM
Alexander Motin [Thu, 21 Jun 2012 14:35:46 +0000 (14:35 +0000)]
In camisr() clear CAM_SIM_ON_DONEQ flag after camisr_runqueue() purged SIM
done queue. Clearing it before caused extra SIM queueing in some cases.
It was invisible during normal operation, but during USB device unplug and
respective SIM destruction it could keep pointer on SIM without having
counted reference and as result crash the system by use afer free.

Reported by: hselasky
MFC after: 1 week

12 years agoAdd more locale-specific functions to the relevant man pages:
Isabell Long [Thu, 21 Jun 2012 12:52:15 +0000 (12:52 +0000)]
Add more locale-specific functions to the relevant man pages:
- libc/string/strcoll.3
- libc/string/strstr.3
- libc/string/strxfrm.3
- libc/string/strcasecmp.3

Reviewed by: theraven, gabor
Approved by: gabor (mentor)
MFC after: 5 days

12 years agoRemove redundant #ifdef. Reported by gnn@.
Michael Tuexen [Thu, 21 Jun 2012 12:51:24 +0000 (12:51 +0000)]
Remove redundant #ifdef. Reported by gnn@.

MFC after: 3 days

12 years agoEnable deadlock avoidance code for NFS client.
Konstantin Belousov [Thu, 21 Jun 2012 09:26:06 +0000 (09:26 +0000)]
Enable deadlock avoidance code for NFS client.

MFC after: 2 weeks

12 years agoFix unbounded-length malloc, controlled from usermode. The added check
Konstantin Belousov [Thu, 21 Jun 2012 09:20:07 +0000 (09:20 +0000)]
Fix unbounded-length malloc, controlled from usermode. The added check
is performed before exact size of the buffer is calculated, but the
buffer cannot have size greater then the total space allocated for
extended attributes. The existing check is executing with precise
size, but it is too late, since buffer needs to be allocated in
advance.

Also, adapt to uio_resid being of ssize_t type.  Use lblktosize instead of
multiplying by fs block size by hand as well.

Reported and tested by:   pho
MFC after:   1 week

12 years agoFix locking for f_offset, vn_read() and vn_write() cases only, for now.
Konstantin Belousov [Thu, 21 Jun 2012 09:19:41 +0000 (09:19 +0000)]
Fix locking for f_offset, vn_read() and vn_write() cases only, for now.

It seems that intended locking protocol for struct file f_offset field
was as follows: f_offset should always be changed under the vnode lock
(except fcntl(2) and lseek(2) did not followed the rules). Since
read(2) uses shared vnode lock, FOFFSET_LOCKED block is additionally
taken to serialize shared vnode lock owners.

This was broken first by enabling shared lock on writes, then by
fadvise changes, which moved f_offset assigned from under vnode lock,
and last by vn_io_fault() doing chunked i/o. More, due to uio_offset
not yet valid in vn_io_fault(), the range lock for reads was taken on
the wrong region.

Change the locking for f_offset to always use FOFFSET_LOCKED block,
which is placed before rangelocks in the lock order.

Extract foffset_lock() and foffset_unlock() functions which implements
FOFFSET_LOCKED lock, and consistently lock f_offset with it in the
vn_io_fault() both for reads and writes, even if MNTK_NO_IOPF flag is
not set for the vnode mount. Indicate that f_offset is already valid
for vn_read() and vn_write() calls from vn_io_fault() with FOF_OFFSET
flag, and assert that all callers of vn_read() and vn_write() follow
this protocol.

Extract get_advice() function to calculate the POSIX_FADV_XXX value
for the i/o region, and use it were appropriate.

Reviewed by: jhb
Tested by: pho
MFC after: 2 weeks

12 years agoRemove Moxa CP-132EL definition (RS422/485-only board).
Max Khon [Thu, 21 Jun 2012 04:57:59 +0000 (04:57 +0000)]
Remove Moxa CP-132EL definition (RS422/485-only board).

12 years agoAdd support for the following Moxa PCIe multiport serial boards:
Max Khon [Thu, 21 Jun 2012 03:10:48 +0000 (03:10 +0000)]
Add support for the following Moxa PCIe multiport serial boards:
- CP102E
- CP102EL
- CP132EL
- CP114EL
- CP118EL-A
- CP168EL-A

MFC after: 1 week

12 years agoCurrently the code uses gzFile * for a zlib file descriptor, which
Xin LI [Wed, 20 Jun 2012 23:53:36 +0000 (23:53 +0000)]
Currently the code uses gzFile * for a zlib file descriptor, which
is not correct.  The code works by accident because gzFile is
currently defined as void *, and internally it would be casted from
or to its real type.

A newer version of zlib will instead define it as a pointer to a
specific type pointer (namely, struct gzFile_s *).  This therefore
would cause stricter checks and compiler would catch this type
mismatch.

This change does not cause any changes to the resulting binary,
as validated with md5(1).

MFC after: 3 days

12 years agoSelectively inline vm_page_dirty().
Alan Cox [Wed, 20 Jun 2012 23:25:47 +0000 (23:25 +0000)]
Selectively inline vm_page_dirty().

12 years agoProvide a mechanism to not clear out the work and output dirs when
David E. O'Brien [Wed, 20 Jun 2012 21:38:16 +0000 (21:38 +0000)]
Provide a mechanism to not clear out the work and output dirs when
developing tests.

12 years agoPolish previous revision: if the fts_* routines have lstat()'ed the
Xin LI [Wed, 20 Jun 2012 21:10:38 +0000 (21:10 +0000)]
Polish previous revision: if the fts_* routines have lstat()'ed the
directory entry then use the struct stat from that instead of doing
it again, and skip the rm_overwrite() call if fts_read() indicated
that the entry couldn't be a regular file.

Obtained from: OpenBSD
MFC after: 1 week

12 years agoDon't return an error if a kld does not contain any modules (e.g. a
John Baldwin [Wed, 20 Jun 2012 21:06:51 +0000 (21:06 +0000)]
Don't return an error if a kld does not contain any modules (e.g. a
kld that only contained a sysctl).  The kernel linker allows such
modules, so the boot loader should not reject them.

MFC after: 2 weeks

12 years agoOnly output a list of file systems that need to be dumped if the system
John Baldwin [Wed, 20 Jun 2012 20:01:51 +0000 (20:01 +0000)]
Only output a list of file systems that need to be dumped if the system
has a non-empty dumpdates file.

Reviewed by: brooks
MFC after: 1 week

12 years agoRemove unused error variables in cdclose() and daclose().
Alexander Motin [Wed, 20 Jun 2012 18:35:36 +0000 (18:35 +0000)]
Remove unused error variables in cdclose() and daclose().

12 years agoCheck status of cam_periph_hold() inside cdclose(). If cd device was
Alexander Motin [Wed, 20 Jun 2012 18:25:51 +0000 (18:25 +0000)]
Check status of cam_periph_hold() inside cdclose().  If cd device was
invalidated while open, cam_periph_hold() will return error and won't
get the reference.  Following reference release will crash the system.

Sponsored by: iXsystems, Inc.
MFC after: 3 days

12 years agoMove the per-thread deferred user map entries list into a private list
John Baldwin [Wed, 20 Jun 2012 18:00:26 +0000 (18:00 +0000)]
Move the per-thread deferred user map entries list into a private list
in vm_map_process_deferred() which is then iterated to release map entries.
This avoids having a nested vm map unlock operation called from the loop
body attempt to recuse into vm_map_process_deferred().  This can happen if
the vm_map_remove() triggers the OOM killer.

Reviewed by: alc, kib
MFC after: 1 week

12 years agoImport ACPICA 20120620.
Jung-uk Kim [Wed, 20 Jun 2012 17:51:04 +0000 (17:51 +0000)]
Import ACPICA 20120620.

12 years agoNow that there is an est(4) man page, reference it here in cpufreq(4).
Sean Bruno [Wed, 20 Jun 2012 17:26:22 +0000 (17:26 +0000)]
Now that there is an est(4) man page, reference it here in cpufreq(4).

12 years agoFix ARM compilation issue.
Matt Jacob [Wed, 20 Jun 2012 17:20:25 +0000 (17:20 +0000)]
Fix ARM compilation issue.

X-MFC: 237260

12 years agoFix several reference counting and object lifetime issues between
Kenneth D. Merry [Wed, 20 Jun 2012 17:08:00 +0000 (17:08 +0000)]
Fix several reference counting and object lifetime issues between
the pass(4) and enc(4) drivers and devfs.

The pass(4) driver uses the destroy_dev_sched() routine to
schedule its device node for destruction in a separate thread
context.  It does this because the passcleanup() routine can get
called indirectly from the passclose() routine, and that would
cause a deadlock if the close routine tried to destroy its own
device node.

In any case, once a particular passthrough driver number, e.g.
pass3, is destroyed, CAM considers that unit number (3 in this
case) available for reuse.

The problem is that devfs may not be done cleaning up the previous
instance of pass3, and will panic if isn't done cleaning up the
previous instance.

The solution is to get a callback from devfs when the device node
is removed, and make sure we hold a reference to the peripheral
until that happens.

Testing exposed some other cases where we have reference counting
issues, and those were also fixed in the pass(4) driver.

cam_periph.c: In camperiphfree(), reorder some of the operations.

The peripheral destructor needs to be called before
the peripheral is removed from the peripheral is
removed from the list.  This is because once we
remove the peripheral from the list, and drop the
topology lock, the peripheral number may be reused.
But if the destructor hasn't been called yet, there
may still be resources hanging around (like devfs
nodes) that haven't been fully cleaned up.

cam_xpt.c: Add an argument to xpt_remove_periph() to indicate
whether the topology lock is already held.

scsi_enc.c: Acquire an extra reference to the peripheral during
registration, and release it once we get a callback
from devfs indicating that the device node is gone.

Call destroy_dev_sched_cb() in enc_oninvalidate()
instead of calling destroy_dev() in the cleanup
routine.

scsi_pass.c: Add reference counting to handle peripheral and
devfs object lifetime issues.

Add a reference to the peripheral and the devfs
node in the peripheral registration.

Don't attempt to add a physical path alias if the
peripheral has been marked invalid.

Release the devfs reference once the initial
physical path alias taskqueue run has completed.

Schedule devfs node destruction in the
passoninvalidate(), and release our peripheral
reference in a new routine, passdevgonecb() once
the devfs node is gone.  This allows the peripheral
to fully go away, and the peripheral destructor,
passcleanup(), will get called.

MFC after: 3 days
Sponsored by: Spectra Logic

12 years agoAllow booting XENHVM kernel without Xen hypervisor.
Fabien Thomas [Wed, 20 Jun 2012 15:45:50 +0000 (15:45 +0000)]
Allow booting XENHVM kernel without Xen hypervisor.

MFC after: 3 days

12 years agoFix viawd(4) that was only working as a module.
Fabien Thomas [Wed, 20 Jun 2012 09:01:44 +0000 (09:01 +0000)]
Fix viawd(4) that was only working as a module.

Obtained from: jhb
MFC after: 3 days

12 years agoAdd PV list locking to pmap_copy(), pmap_enter_object(), and
Alan Cox [Wed, 20 Jun 2012 07:25:20 +0000 (07:25 +0000)]
Add PV list locking to pmap_copy(), pmap_enter_object(), and
pmap_enter_quick().  These functions are no longer serialized by the pvh
global lock.

There is no need to release the PV list lock before calling free_pv_chunk()
in pmap_remove_pages().

12 years agoDon't close an uninitialized descriptor. [1]
Eitan Adler [Wed, 20 Jun 2012 06:38:41 +0000 (06:38 +0000)]
Don't close an uninitialized descriptor. [1]
Add a sanity check for the validity of the passed fd.

PR: kern/139080 [1]
Submitted by: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> [1]
Reviewed by: pjd (briefly)
Approved by: cperciva
MFC after: 1 week

12 years agoAdd progress.c and progress.h, missed in the previous commit to camcontrol.
Scott Long [Wed, 20 Jun 2012 04:11:34 +0000 (04:11 +0000)]
Add progress.c and progress.h, missed in the previous commit to camcontrol.

Submitted by:   Garrett Cooper
Obtained from:  Netflix, Inc.

12 years agoFix potential symlink race condition in "rm -P" by adding a check
Kevin Lo [Wed, 20 Jun 2012 02:21:53 +0000 (02:21 +0000)]
Fix potential symlink race condition in "rm -P" by adding a check
that the file we have opened is the one we expected.  Also open in
non-blocking mode to avoid a potential hang with FIFOs.

Obtained from: NetBSD via OpenBSD

12 years agoCorrect typo in version.
David E. O'Brien [Wed, 20 Jun 2012 00:37:00 +0000 (00:37 +0000)]
Correct typo in version.

12 years agoUpdate the 'fwdownload' command to also flash disks connected over an
Scott Long [Wed, 20 Jun 2012 00:17:29 +0000 (00:17 +0000)]
Update the 'fwdownload' command to also flash disks connected over an
ATA/SATA transport.  The detection logic is automatic, so it should Just
Work.  While here, also improve the progress meter that is displayed
during firmware download.

Submitted by: Alistair Crooks
Obtained from: Netflix, Inc.
MFC after: 3 days

12 years agoInstall filemon.h into /usr/include for userland consumption.
David E. O'Brien [Wed, 20 Jun 2012 00:09:47 +0000 (00:09 +0000)]
Install filemon.h into /usr/include for userland consumption.

12 years agoCheck proper flag (PDF_DAEMON, not PD_DAEMON) when deciding if the process
Pawel Jakub Dawidek [Tue, 19 Jun 2012 22:23:59 +0000 (22:23 +0000)]
Check proper flag (PDF_DAEMON, not PD_DAEMON) when deciding if the process
should be killed or not.

This fixes killing pdfork(2)ed process on last close of the corresponding
process descriptor.

Reviewed by: rwatson
MFC after: 1 month

12 years agoThe falloc() function obtains two references to newly created 'fp'.
Pawel Jakub Dawidek [Tue, 19 Jun 2012 22:21:59 +0000 (22:21 +0000)]
The falloc() function obtains two references to newly created 'fp'.
On success we have to drop one after procdesc_finit() and on failure
we have to close allocated slot with fdclose(), which also drops one
reference for us and drop the remaining reference with fdrop().

Without this change closing process descriptor didn't result in killing
pdfork(2)ed child.

Reviewed by: rwatson
MFC after: 1 month

12 years agoFurther refine the implementation of POSIX_FADV_NOREUSE.
John Baldwin [Tue, 19 Jun 2012 18:42:24 +0000 (18:42 +0000)]
Further refine the implementation of POSIX_FADV_NOREUSE.

First, extend the changes in r230782 to better handle the common case
of using NOREUSE with sequential reads.  A NOREUSE file descriptor
will now track the last implicit DONTNEED request it made as a result
of a NOREUSE read.  If a subsequent NOREUSE read is adjacent to the
previous range, it will apply the DONTNEED request to the entire range
of both the previous read and the current read.  The effect is that
each read of a file accessed sequentially will apply the DONTNEED
request to the entire range that has been read.  This allows NOREUSE
to properly handle misaligned reads by flushing each buffer to cache
once it has been completely read.

Second, apply the same changes made to read(2) by r230782 and this
change to writes.  This provides much better performance in the
sequential write case as it allows writes to still be clustered.  It
also provides much better performance for misaligned writes.  It does
mean that NOREUSE will be generally ineffective for non-sequential
writes as the current implementation relies on a future NOREUSE
write's implicit DONTNEED request to flush the dirty buffer from the
current write.

MFC after: 2 weeks

12 years agoCorrect misunderstanding of hw.est.strict
Sean Bruno [Tue, 19 Jun 2012 17:13:14 +0000 (17:13 +0000)]
Correct misunderstanding of hw.est.strict

Setting strict causes a validation of the requested
value vs the value currently running after a frequency
change is requested.

Change applicability to be single core not i386.

Thanks to mav@ for reviewing and commenting on my
lack of understanding.

MFC after: 2 weeks

12 years agoAdd a 'wmask' variable to hold the expression '(1ul << w->step) - 1' in
John Baldwin [Tue, 19 Jun 2012 16:06:27 +0000 (16:06 +0000)]
Add a 'wmask' variable to hold the expression '(1ul << w->step) - 1' in
pcib_grow_window().  This makes the code slightly easier to read and
prevents the type of bug fixed in r237271.

MFC after: 3 days

12 years agoFix another off-by-one error in the previous fix so that the new start
John Baldwin [Tue, 19 Jun 2012 15:15:35 +0000 (15:15 +0000)]
Fix another off-by-one error in the previous fix so that the new start
address is properly aligned.  While here, use a simpler expression to
align the new end address that we use elsewhere for aligning the end.

12 years agoPassive mode is the default, and has been for a while.
Dag-Erling Smørgrav [Tue, 19 Jun 2012 14:47:07 +0000 (14:47 +0000)]
Passive mode is the default, and has been for a while.

MFC after: 1 week

12 years agoSwitch the default password hash from md5 to sha512.
Dag-Erling Smørgrav [Tue, 19 Jun 2012 14:46:18 +0000 (14:46 +0000)]
Switch the default password hash from md5 to sha512.

MFC after: 1 week

12 years agoRevert user comparison back to user names as some user can share uids (root/toor
Baptiste Daroussin [Tue, 19 Jun 2012 11:39:56 +0000 (11:39 +0000)]
Revert user comparison back to user names as some user can share uids (root/toor
for example)

get the username information from old_pw structures to still allow renaming of a
user.

Reported by: Claude Buisson <clbuisson@orange.fr>
Approved by: des (mentor)
MFC after: 3 weeks

12 years agoCondition the implementation of pv_entry_count on PV_STATS. On amd64,
Alan Cox [Tue, 19 Jun 2012 08:12:44 +0000 (08:12 +0000)]
Condition the implementation of pv_entry_count on PV_STATS.  On amd64,
pv_entry_count is purely informational.  It does not serve any functional
purpose.

Add PV chunk locking to get_pv_entry().

12 years ago- Updated TOE support in the kernel.
Navdeep Parhar [Tue, 19 Jun 2012 07:34:13 +0000 (07:34 +0000)]
- Updated TOE support in the kernel.

- Stateful TCP offload drivers for Terminator 3 and 4 (T3 and T4) ASICs.
  These are available as t3_tom and t4_tom modules that augment cxgb(4)
  and cxgbe(4) respectively.  The cxgb/cxgbe drivers continue to work as
  usual with or without these extra features.

- iWARP driver for Terminator 3 ASIC (kernel verbs).  T4 iWARP in the
  works and will follow soon.

Build-tested with make universe.

30s overview
============
What interfaces support TCP offload?  Look for TOE4 and/or TOE6 in the
capabilities of an interface:
# ifconfig -m | grep TOE

Enable/disable TCP offload on an interface (just like any other ifnet
capability):
# ifconfig cxgbe0 toe
# ifconfig cxgbe0 -toe

Which connections are offloaded?  Look for toe4 and/or toe6 in the
output of netstat and sockstat:
# netstat -np tcp | grep toe
# sockstat -46c | grep toe

Reviewed by: bz, gnn
Sponsored by: Chelsio communications.
MFC after: ~3 months (after 9.1, and after ensuring MFC is feasible)

12 years agoAdd __unused macros to appropriate places in order to allow building
Eitan Adler [Tue, 19 Jun 2012 06:18:42 +0000 (06:18 +0000)]
Add __unused macros to appropriate places in order to allow building
with WARNS=6 on base gcc, gcc46, and clang

Approved by: cperciva
MFC after: 1 week

12 years agoAllow users with RO privilege to the device to read the RO attributes.
Eitan Adler [Tue, 19 Jun 2012 06:18:37 +0000 (06:18 +0000)]
Allow users with RO privilege to the device to read the RO attributes.

PR: bin/167302
Submitted by: markham breitbach <markham@ssimicro.com>
Discussed with: pjd (briefly)
Approved by: cperciva
MFC after: 1 week

12 years agoRemove variables which are initialized but never used thereafter reported by gcc46...
Eitan Adler [Tue, 19 Jun 2012 06:10:34 +0000 (06:10 +0000)]
Remove variables which are initialized but never used thereafter reported by gcc46 warning

Approved by: cperciva
MFC After: 3 days

12 years agoRemove variables which are initialized but never used thereafter reported by gcc46...
Eitan Adler [Tue, 19 Jun 2012 06:10:31 +0000 (06:10 +0000)]
Remove variables which are initialized but never used thereafter reported by gcc46 warning

Approved by: cperciva
MFC After: 3 days

12 years agoRemove variables which are initialized but never used thereafter reported by gcc46...
Eitan Adler [Tue, 19 Jun 2012 06:10:27 +0000 (06:10 +0000)]
Remove variables which are initialized but never used thereafter reported by gcc46 warning

Approved by: cperciva
MFC After: 3 days

12 years agoRemove variables which are initialized but never used thereafter reported by gcc46...
Eitan Adler [Tue, 19 Jun 2012 06:10:24 +0000 (06:10 +0000)]
Remove variables which are initialized but never used thereafter reported by gcc46 warning

Approved by: cperciva
MFC After: 3 days

12 years agoRemove variables which are initialized but never used thereafter reported by gcc46...
Eitan Adler [Tue, 19 Jun 2012 06:09:58 +0000 (06:09 +0000)]
Remove variables which are initialized but never used thereafter reported by gcc46 warning

Approved by: cperciva
MFC After: 3 days

12 years agoRemove variables which are initialized but never used thereafter reported by gcc46...
Eitan Adler [Tue, 19 Jun 2012 06:09:47 +0000 (06:09 +0000)]
Remove variables which are initialized but never used thereafter reported by gcc46 warning

Approved by: cperciva
MFC After: 3 days

12 years agoRemove end of line whitespace.
Joel Dahl [Tue, 19 Jun 2012 05:55:14 +0000 (05:55 +0000)]
Remove end of line whitespace.

12 years agoMinor mdoc fixes.
Joel Dahl [Tue, 19 Jun 2012 05:53:47 +0000 (05:53 +0000)]
Minor mdoc fixes.

12 years agoVendor import of zlib 1.2.7.
Xin LI [Tue, 19 Jun 2012 05:48:36 +0000 (05:48 +0000)]
Vendor import of zlib 1.2.7.

12 years agoDocument support for Intel Enhanced Speedstep Tech interface
Sean Bruno [Mon, 18 Jun 2012 23:18:49 +0000 (23:18 +0000)]
Document support for Intel Enhanced Speedstep Tech interface
of cpufreq(4) via a new man page est(4)

Document the two exposed tuneables of est(4).

I'd appreciate more reviews of content if possible.  I gleaned
the information contained herein from sys/x86/cpufreq/est.c and
the Intel reference documentation

Reviewed by:    wblock hrs gjb
MFC after:      2 weeks

12 years agoFix the NFSv4 client for the case where mmap'd files are
Rick Macklem [Mon, 18 Jun 2012 22:17:28 +0000 (22:17 +0000)]
Fix the NFSv4 client for the case where mmap'd files are
written, but not msync'd by a process. A VOP_PUTPAGES()
called when VOP_RECLAIM() happens will usually fail, since
the NFSv4 Open has already been closed by VOP_INACTIVE().
Add a vm_object_page_clean() call to the NFSv4 client's
VOP_INACTIVE(), so that the write happens before the NFSv4
Open is closed. kib@ suggested using vgone() instead and
I will explore this, but this patch fixes things in the
meantime. For some reason, the VOP_PUTPAGES() is still
attaempted in VOP_RECLAIM(), but having this fail doesn't
cause any problems except a "stateid0 in write" being logged.

Reviewed by: kib
MFC after: 1 week