Commit Graph

89653 Commits

Author SHA1 Message Date
Robert Watson
9eb71e68fe If FDT is compiled into a FreeBSD/beri kernel, initialise OpenFirmware.
Sponsored by:	DARPA, AFRL
2012-12-31 11:06:37 +00:00
Robert Watson
ff82fb46d4 When a partially initialised FDT-based device instance can't attach,
perhaps due to an interrupt configuration problem, do not try to free
device ivars that have not yet have been allocated.

MFC after:	1 week
Reviewed by:	gonzo
Sponsored by:	DARPA, AFRL
2012-12-30 21:10:48 +00:00
Adrian Chadd
29dbc48349 Add the initial HAL glue for the spectral analysis support.
* Finish adding the HAL capability to announce whether a NIC supports
  spectral scan or not;
* Add spectral scan methods to the HAL structure;
* Add HAL_SPECTRAL_PARAM for configuration of the spectral scan logic.

The capability ID and HAL_SPECTRAL_PARAM struct are from Qualcomm
Atheros.
2012-12-30 06:48:12 +00:00
Adrian Chadd
9cbc6f1595 Add spectral scan capability. 2012-12-30 06:46:11 +00:00
Hans Petter Selasky
92e2321883 Add new USB ID.
PR:		usb/174814
Submitted by:	Andy Balholm
MFC after:	1 week
2012-12-29 21:22:38 +00:00
Konstantin Belousov
91e9474552 Make it possible to atomically resume writes on the mount and account
the write start, by adding a variation of the vfs_write_resume(9)
which accepts flags.

Use the new function to prevent a deadlock between parallel suspension
and snapshotting a UFS mount.  The ffs_snapshot() code performed
vfs_write_resume() followed by vn_start_write() while owning the
snaplock.  If the suspension intervene between resume and
vn_start_write(), the deadlock occured after the suspending thread
tried to lock the snaplock, most typically during the write in the
ffs_copyonwrite().

Reported and tested by:	Andreas Longwitz <longwitz@incore.de>
Reviewed by:	mckusick
MFC after:	2 weeks
X-MFC-note:	make the vfs_write_resume(9) function a macro after the MFC,
	in HEAD
2012-12-28 23:08:30 +00:00
Baptiste Daroussin
661c81c3d6 Fix typo in comment.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2012-12-28 21:59:47 +00:00
Xin LI
1adb4ebd35 Add DEVICE_IDENTIFY method for wbwd(4), required on most of recent
Supermicro motherboards.

Tested on X8STi and X8DTH boards.

Sponsored by:	iXsystems, Inc.
MFC after:	2 weeks
2012-12-28 21:35:47 +00:00
Xin LI
e25fe6cdb9 Use DEVMETHOD_END.
MFC after:	2 weeks
2012-12-28 20:44:23 +00:00
Attilio Rao
85e43e9636 Improve bufring impl:
- Remove unused br_prod_bufs member
- Fixup r241037: buf_ring pads br_prod_* and br_cons_* members at 128
  bytes, assuming a fixed cache line size for all the architectures.
  However, the above mentioned revision broke the padding.
  Use explicit padding to the CACHE_LINE_SIZE on the members that
  mark the initial new padded sections. Of course, the padding is not
  important for performance reasons in the DEBUG_BUFRING case, leaving
  br_cons members to share the cache line with br_lock.
- Fixup r244732: by removing incorrectly added membar in
  buf_ring_dequeue_sc() where surrounding locking shoud be enough.
- Drastically reduce the number of membar used (pratically reverting
  r244732) by switching rmb() in buf_ring_dequeue_mc() and wmb() in
  buf_ring_enqueue() to be complete barriers.  This, along with
  br_prod_bufs departure, should fix ordering issues as explained in
  the provided comments.

This patch is not targeted for MFC.

Sponsored by:	EMC / Isilon storage division
Reviewed by:	glebius
2012-12-28 17:41:36 +00:00
Gleb Smirnoff
d8aa10cc35 In netpfil/pf:
- Add my copyright to files I've touched a lot this year.
  - Add dash in front of all copyright notices according to style(9).
  - Move $OpenBSD$ down below copyright notices.
  - Remove extra line between cdefs.h and __FBSDID.
2012-12-28 09:19:49 +00:00
Adrian Chadd
2720a0cbd9 Add the AR9280 and later spectral scan register definitions.
Obtained from:	Linux ath9k, Qualcomm Atheros (datasheet)
2012-12-28 08:00:31 +00:00
Adrian Chadd
00ba39c988 Add radar_bin_thresh_sel (bit 24:26), which defines when
to consider the radar FFT report bins as "strong".
2012-12-28 07:49:45 +00:00
Oleksandr Tymoshenko
7fc3ae51f3 Fix build on ARM (and probably other platforms) 2012-12-28 06:52:53 +00:00
Oleksandr Tymoshenko
3ada2d599e Add makeshift implementation for framebuffer console's cursor
Basically it's replica of VersatilePB code which is replica of XBox FB
code. All of them are linear framebuffers and should have common bits
moved to reusable framework.
2012-12-28 03:18:05 +00:00
David Xu
9d4bf0db7c Use strlcpy to NULL-terminate error message even if user provided a short
buffer.
2012-12-28 02:43:33 +00:00
Oleksandr Tymoshenko
0c093a7055 Fix event timer on Raspberry Pi
- Disable interrupt when updating compare value in order to
   make this operation atomical

- Increase minimum period for event timer. Systimer on BCM2835
    is compare timer, so if minimum period is too small it might
    be less then fraction of time between "read current value" and
    "set compare timer" operations. It means that when timer is armed
    actual counter value is more then compare value and it will take
    whole cycle (~32sec for 1MHz timer) to fire interrupt.

Submitted by:	Daisuke Aoyama <aoyama at peach.ne.jp>
2012-12-28 01:38:43 +00:00
Oleksandr Tymoshenko
142043670b Add custom renderer for poor man's cursor support for framebuffer console 2012-12-28 00:55:43 +00:00
Andrey V. Elsukov
e37e7917f3 Add an ability to set net.link.stf.permit_rfc1918 from the loader.
MFC after:	2 weeks
2012-12-27 21:26:08 +00:00
Andrey V. Elsukov
51743c5f73 Add net.link.stf.permit_rfc1918 sysctl variable. It can be used to allow
the use of private IPv4 addresses with stf(4).

MFC after:	2 weeks
2012-12-27 20:59:22 +00:00
Attilio Rao
ad9505aae7 Remove an unused var.
Sponsored by:	EMC / Isilon storage division
MFC after:	3 days
2012-12-27 12:53:46 +00:00
Attilio Rao
30c7dd147c br_prod_tail and br_cons_tail members are used as barrier to
signal bug_ring ownership. However, instructions can be reordered
around members write leading to stale values for ie. br_prod_bufs.

Use correct memory barriers to ensure proper ordering of the
ownership tokens updates.

Sponsored by:	EMC / Isilon storage division
MFC after:	2 weeks
2012-12-27 12:36:58 +00:00
Michael Tuexen
11e03b3200 Some cleanups.
MFC after: 3 days
2012-12-27 08:10:58 +00:00
Michael Tuexen
72c123a8b4 Minor cleanups of debug messages.
MFC after: 3 days
2012-12-27 08:06:58 +00:00
Michael Tuexen
2c2e3218cb Fix a copy and paste error.
MFC after: 3 days
2012-12-27 08:02:58 +00:00
Mark Johnston
7716eb4c40 Add the NO_SYNC_CACHE quirk for all Apple USB MSC devices, as they
typically do not handle the SYNCHRONIZE_CACHE command - they either
return an error or the firmware enters a reset loop.

Reviewed by:	hselasky
Approved by:	rstone (co-mentor)
MFC after:	2 weeks
2012-12-26 22:21:27 +00:00
Pawel Jakub Dawidek
6011443800 Reset provider-specific fields when resending I/O request in low memory
conditions. This fixes assertion which checks those fields when kernel is
compiled with DIAGNOSTIC.

Reported by:	kib, pho
MFC after:	1 week
2012-12-26 20:07:47 +00:00
Raphael Kubo da Costa
b42a2049f1 Use DEVMETHOD_END, as suggested by hselasky@.
Approved by:	glebius
2012-12-26 19:14:21 +00:00
Raphael Kubo da Costa
ac76cdc670 Use the correct USB interface macros instead of USB_IF_CSI.
As pointed out by hselasky@, USB_IF_CSI is the wrong macro here since we want
to declare the device's interface class, subclass and protocol, not class,
subclass and driver info.

Follow-up to r244704.

PR:		kern/174707
Approved by:	glebius
MFC after:	1 week
2012-12-26 19:12:31 +00:00
Attilio Rao
c92c859b7b Fixup r244240: mp_ncpus will be 1 also in the !SMP and smp_disabled=1
case. There is no point in optimizing further the code and use a TRUE
litteral for a path that does heavyweight stuff anyway (like lock acq),
at the price of obfuscated code.

Use the appropriate check where necessary and remove a macro.

Sponsored by:	EMC / Isilon storage division
MFC after:	3 days
2012-12-26 15:20:32 +00:00
Gleb Smirnoff
70a0e3403a Add vendor IDs for Broadcom USB dongles (BCM20702).
PR:		kern/174707
Submitted by:	rakuco
2012-12-26 15:10:20 +00:00
David Xu
fee3029ce7 Always initialize pattern_buf pointers to NULL, otherwise AMD64 machine
panics with:
   free: address xxx(yyy) has not been allocated.
it can be triggered by hald.
2012-12-26 13:07:17 +00:00
Gleb Smirnoff
c4d0697685 Garbage collect carp_cksum(). 2012-12-25 14:29:38 +00:00
Gleb Smirnoff
7951008b47 Change net.inet.carp.demotion sysctl to add the supplied value
to the current demotion factor instead of assigning it.

  This allows external scripts to control demotion factor together
with kernel in a raceless manner.
2012-12-25 14:08:13 +00:00
Gleb Smirnoff
e8db9937f3 Fix sysctl_handle_int() usage. Either arg1 or arg2 should be supplied,
and arg2 doesn't pass size of arg1.
2012-12-25 13:55:21 +00:00
Gleb Smirnoff
468e45f3bd The SIOCSIFFLAGS ioctl handler runs if_up()/if_down() that notify
all interested parties in case if interface flag IFF_UP has changed.

  However, not only SIOCSIFFLAGS can raise the flag, but SIOCAIFADDR
and SIOCAIFADDR_IN6 can, too. The actual |= is done not in the protocol
code, but in code of interface drivers. To fix this historical layering
violation, we will check whether ifp->if_ioctl(SIOCSIFADDR) raised the
IFF_UP flag, and if it did, run the if_up() handler.

  This fixes configuring an address under CARP control on an interface
that was initially !IFF_UP.

P.S. I intentionally omitted handling the IFF_SMART flag. This flag was
never ever used in any driver since it was introduced, and since it
means another layering violation, it should be garbage collected instead
of pretended to be supported.
2012-12-25 13:01:58 +00:00
Gleb Smirnoff
3e6c8b5366 Minor style(9) changes:
- Remove declaration in initializer.
- Add empty line between logical blocks.
2012-12-24 21:35:48 +00:00
Hans Petter Selasky
607bbcba30 Fix more regression issue after r244503.
usbd_transfer_setup() does not set a default length for USB transfers.
Only the number of frames is automatically setup.

MFC after:	1 week
2012-12-24 10:10:18 +00:00
Konstantin Belousov
ad9789f6db Do not force a writer to the devfs file to drain the buffer writes.
Requested and tested by:	Ian Lepore <freebsd@damnhippie.dyndns.org>
MFC after:	2 weeks
2012-12-23 22:43:27 +00:00
Andriy Gapon
f71fbb1d12 zfs: solaris doesn't have KM_ZERO, kmem_zalloc should be used instead
To do:		remove KM_ZERO declaration
Pointyhat to:	avg (for mindlessly using the pseudo-flag)
MFC after:	instantly (to fix stable/8 build)
2012-12-23 19:58:41 +00:00
Alexander V. Chernikov
3abd4586a4 Add parentheses to IP_FW_ARG_TABLEARG() definition.
Suggested by:	glebius
MFC with:	r244633
2012-12-23 18:35:42 +00:00
Alexander V. Chernikov
f37de965cc Use unified IP_FW_ARG_TABLEARG() macro for most tablearg checks.
Log real value instead of IP_FW_TABLEARG (65535) in ipfw_log().

Noticed by:	Vitaliy Tokarenko <rphone@ukr.net>
MFC after:	2 weeks
2012-12-23 16:28:18 +00:00
Ryan Stone
6969ef6656 Correct a series of errors in the hand-rolled locking for drace_debug.c:
- Use spinlock_enter()/spinlock_exit() to prevent a thread holding a
  debug lock from being preempted to prevent other threads waiting
  on that lock from starvation.

- Handle the possibility of CPU migration in between the fetch of curcpu
  and the call to spinlock_enter() by saving curcpu in a local variable.

- Use memory barriers to prevent reordering of loads and stores of the
  data protected by the lock outside of the critical section

- Eliminate false sharing of the locks by moving them into the structures
  that they protect and aligning them to a cacheline boundary.

- Record the owning thread in the lock to make debugging future problems
  easier.

Reviewed by:	rpaulo (initial version)
MFC after:	2 weeks
2012-12-23 15:50:37 +00:00
Hans Petter Selasky
2691bc24f1 Fix regression issue after r244503.
MFC after:	1 week
2012-12-23 10:21:01 +00:00
Jaakko Heinonen
efec959c2c Mangle label names containing spaces, non-printable characters '%' or
'"'.  Mangling is only done for label names read from file system
metadata. Encoding resembles URL encoding. For example, the space
character becomes %20.

Help by:	kib
Discussed with:	imp, kib, pjd
2012-12-22 13:43:12 +00:00
Jaakko Heinonen
b1e1f725e7 Reject spaces and double quotation marks in device names. devctl(4)
and devd(8) can't handle names with such characters properly.

PR:		bin/144736, kern/161912
Discussed with:	imp, kib, pjd
2012-12-22 13:33:28 +00:00
Attilio Rao
cd2fe4e632 Fixup r240424: On entering KDB backends, the hijacked thread to run
interrupt context can still be idlethread. At that point, without the
panic condition, it can still happen that idlethread then will try to
acquire some locks to carry on some operations.

Skip the idlethread check on block/sleep lock operations when KDB is
active.

Reported by:	jh
Tested by:	jh
MFC after:	1 week
2012-12-22 09:37:34 +00:00
Navdeep Parhar
c6719ccdef cxgbe(4): Add support for the T440-LP-CR card. This is the 4x10G low
profile card with a QSFP+ transceiver.

MFC after:	3 days
2012-12-22 07:47:07 +00:00
Adrian Chadd
a7f31a3636 if_start() is being used here as a way of kick-starting the new queue
processing.  For if_transmit() style hardware drivers (which none publicly
exist yet, for wireless) they will need to still implement if_start()
but only to re-start the TX queue.
2012-12-22 01:17:49 +00:00
Adrian Chadd
88954eb02e Remove a use of if_start() - instead, use if_transmit() to dispatch the
frame.
2012-12-22 01:16:28 +00:00
Olivier Houchard
67314b8bd2 The manpage states that bus_dmamap_create(9) returns ENOMEM if it can't
allocate a map or mapping resources.  That seems to imply that any memory
allocations it does must use M_NOWAIT and check for NULL.

Submitted by:	Ian Lepore <freebsd@damnhippie.dyndns.org>
2012-12-22 01:04:29 +00:00
Olivier Houchard
8c06ac50fc The VM_MEMATTR_ constants are enumerated, not a bitset. Compare accordingly.
Submitted by:	Ian Lepore <freebsd@damnhippie.dyndns.org>
2012-12-22 01:03:23 +00:00
Hans Petter Selasky
f7e62ad092 Reduce stack usage in the USB audio driver by moving some large stack
elements to the USB audio softc structure. This fixes a double CPU
fault when attaching USB audio devices in 10-current for i386 at
least.

MFC after:	1 week
2012-12-21 21:41:23 +00:00
Navdeep Parhar
4cead97615 cxgbe(4): must hold a write-lock on the table while allocating an L2
entry for switching.

MFC after:	3 days
2012-12-21 19:28:17 +00:00
Jim Harris
96790da4f4 Put kthreads under curproc so they are attached to nvmecontrol rather
than pid 0.

Sponsored by:	Intel
2012-12-21 19:13:48 +00:00
Rui Paulo
a443a16906 Move the 64-bit _setjmp to lib/libstand. 2012-12-21 15:15:35 +00:00
Hans Petter Selasky
1a7c3e9097 Regression issue:
Use a boundary of zero, hence a PAGE_SIZE boundary
is implied by all memory allocations.

Background:
Busdma has problems to allocate more than PAGE_SIZE
bytes when the boundary is PAGE_SIZE bytes too.
Initially it was thought that a boundary of PAGE_SIZE
bytes will only affect loading of DMA memory, so that
segments get split correctly, but it also affects
allocation of DMA'able memory.

Solution:
USB can detect big segments and split them as required
by the USB code.

MFC after:	1 week
Reported by:	gonzo
2012-12-21 14:17:39 +00:00
Attilio Rao
b1308d72c2 Fixup r218424: uio_yield() was scaling directly to userland priority.
When kern_yield() was introduced with the possibility to specify
a new priority, the behaviour changed by not lowering priority at all
in the consumers, making the yielding mechanism highly ineffective for
high priority kthreads like bufdaemon, syncer, vlrudaemon, etc.
There are no evidences that consumers could bear with such change in
semantic and this situation could finally lead to bugs similar to the
ones fixed in r244240.
Re-specify userland pri for kthreads involved.

Tested by:	pho
Reviewed by:	kib, mdf
MFC after:	1 week
2012-12-21 13:14:12 +00:00
Gleb Smirnoff
936c747be0 Comment fix: there is no ub_ptr, instead explain meaning of uz_count
field verbally.
2012-12-21 10:09:45 +00:00
Rui Paulo
e19caad7b1 Build a 64 bit version of the FICL library. This is need for a 64 bit
EFI bootloader (amd64 only for now).

This is not yet connected to the build.
2012-12-21 05:22:14 +00:00
Adrian Chadd
a5e67727fb Note why fast frames is disabled for 802.11n NICs now.
It actually works, but net80211 handles A-MPDU and Fast frames
incorrectly; it tries enabling both in some instances, with tragic
results.
2012-12-21 04:28:05 +00:00
Luigi Rizzo
60372f6f58 rename the 'tag' and 'map' fields used the rx ring to their
previous names, 'ptag' and 'pmap' -- p stands for packet.

This change reduces the difference between the code in stable/9
and head, and also helps using the same ixgbe_netmap.h on both branches.

Approved by:	Jack Vogel
2012-12-20 22:26:03 +00:00
Dag-Erling Smørgrav
b5471c918f Rewrite fdgrowtable() so common mortals can actually understand what
it does and how, and add comments describing the data structures and
explaining how they are managed.
2012-12-20 20:18:27 +00:00
Alexander Motin
b2e6b2f87c Make SES driver to not fall out on some errors in Additional Status page.
This allows CAM devices still get their physical paths even if status of
later elements it corrupted.

Sponsored by:	iXsystems, Inc.
2012-12-20 19:51:32 +00:00
Hans Petter Selasky
c180b3986d Make sure all USB drivers allocate buffer memory
through the USB API and/or busdma.

The following assumptions have been made:
umass - buffers passed from CAM/SCSI layer are OK
network - mbufs are OK.

Some other nits while at it.

MFC after:	1 week
Suggested by:	imp
2012-12-20 18:38:02 +00:00
Hans Petter Selasky
a6d2f40ec8 Allocate separate USB buffers for DMA'ed data, so that
DMA data does not reside next to non DMA data. This
might cause more memory to be allocated, but solves
problems on platforms using manual cache
synchronization.

Add a convenience function to get the buffer only
from a USB transfer's page cache structure.

MFC after:	1 week
Suggested by:	imp
2012-12-20 18:13:37 +00:00
Hans Petter Selasky
f578aba724 Add support for throttling UMASS.
Mostly useful for debugging purposes.

MFC after:	1 week
2012-12-20 17:14:10 +00:00
Hans Petter Selasky
3d6709a572 Make sure we block recursion on TTY's inwakeup callback
Suggested by:	davide
MFC after:	1 week
2012-12-20 16:21:02 +00:00
Pyun YongHyeon
0a75559c6c Recognize 5720S PHY and treat it as 5708S PHY.
Unfortunately 5720S uses 5709S PHY id so add a hack to detect 5720S
PHY by checking parent device name.  5720S PHY does not support 2500SX.

Tested by:	Geans Pin < geanspin <> broadcom dot com >
2012-12-20 05:02:12 +00:00
Pyun YongHyeon
29fed1c37e For fiber PHYs, BRGPHY_MII_1000CTL register is not defined at all
so do not touch it.
2012-12-20 04:47:31 +00:00
Oleksandr Tymoshenko
c5f8f8946c Replace generic ARM11 option with more specific
support for ARM1136 and ARM1176

Submitted by:	Daisuke Aoyama <aoyama at peach.ne.jp>
Obtained from:	NetBSD
2012-12-20 04:32:02 +00:00
Oleksandr Tymoshenko
b9a3b76662 Fix misleading comment 2012-12-20 03:33:33 +00:00
Pedro F. Giffuni
e28f5d5222 More constant renaming in preparation for newer features.
We also try to make better use of the fs flags instead of
trying adapt the code according to the fs structures. In
the case of subsecond timestamps and birthtime we now
check that the feature is explicitly enabled: previously
we only checked that the reserved space was available and
silently wrote them.

This approach is much safer, especially if the filesystem
happens to use embedded inodes or support EAs.

Discussed with:	Zheng Liu
MFC after:	5 days
2012-12-20 02:22:36 +00:00
Olivier Houchard
4c712a2589 We want to build subr_busdma_bufalloc.c on arm. 2012-12-20 00:57:24 +00:00
Olivier Houchard
c3ab874c8d Use C comments instead of C++ comments.
Spotted out by:	gonzo (thanks, man)
2012-12-20 00:50:04 +00:00
Olivier Houchard
f8405bc4bf Busdma enhancements, especially for managing small uncacheable buffers.
- Use the new architecture-agnostic buffer pool manager that uses uma(9)
  to manage a set of power-of-2 sized buffers for bus_dmamem_alloc().

- Create pools of buffers backed by both regular and uncacheable memory,
  and use them to handle regular versus BUS_DMA_COHERENT allocations.

- Use uma(9) to manage a pool of bus_dmamap structs instead of local code
  to manage a static list of 500 items (it took 3300 maps to get to
  multi-user mode, so the static pool wasn't much of an optimization).

- Small BUS_DMA_COHERENT allocations no longer waste an entire page per
  allocation, or set pages to uncached when they contain data other than
  DMA buffers.  There's no longer a need for drivers to work around the
  inefficiency by allocing large buffers then sub-dividing them.

- Because we know the alignment and padding of buffers allocated by
  bus_dmamem_alloc() (whether coherent or regular memory, and whether
  obtained from the pool allocator or directly from the kernel) we
  can avoid doing partial cacheline flushes on them.

- Add a fast-out to _bus_dma_could_bounce() (and some comments about
  what the routine really does because the old misplaced comment was wrong).

- Everywhere the dma tag alignment is used, the interpretation is that
  an alignment of 1 means no special alignment.  If the tag is created
  with an alignment argument of zero, store it in the tag as one, and
  remove all the code scattered around that changed 0->1 at point of use.

- Remove stack-allocated arrays of segments, use a local array of two
  segments within the tag struct, or dynamically allocate an array at first
  use if nsegments > 2.  On an arm system I tested, only 5 of 97 tags used
  more than two segments.  On my x86 desktop it was only 7 of 111 tags.

Submitted by:	Ian Lepore <freebsd@damnhippie.dyndns.org>
2012-12-20 00:38:08 +00:00
Olivier Houchard
5d211d248c Use the new allocator in bus_dmamem_alloc(). 2012-12-20 00:35:26 +00:00
Olivier Houchard
05d9035003 Create an architecture-agnostic buffer pool manager that uses uma(9) to
manage a set of power-of-2 sized buffers for bus_dmamem_alloc().

This allows the caller to provide the back-end allocator uma allocator,
allowing full control of the memory pages backing the pool.  For
convenience, it provides an optional builtin allocator that provides pages
allocated with the VM_MEMATTR_UNCACHEABLE attribute, for managing pools of
DMA buffers for BUS_DMA_COHERENT or BUS_DMA_NOCACHE.

This also allows the caller to specify a minimum alignment, and it ensures
that all buffers start on a boundary and have a length that's a multiple of
that value, to avoid using buffers that trigger partial cache line flushes.

Submitted by:	Ian Lepore <freebsd@damnhippie.dyndns.org>
2012-12-20 00:34:54 +00:00
Olivier Houchard
3254bef2ec Get the old NFSCLIENT to compile by adding now needed files. 2012-12-20 00:06:24 +00:00
Pawel Jakub Dawidek
c345faea5a Replace expand_name() function with corefile_open() function, which not
only returns name, but also vnode of corefile to use.

This simplifies the code and closes few races, especially in %I handling.

Reviewed by:	kib
Obtained from:	WHEEL Systems
2012-12-19 23:59:48 +00:00
Pawel Jakub Dawidek
22a5d85aa9 Use correct file permissions when looking for available core file if
kern.corefile contains %I.

Obtained from:	WHEEL Systems
2012-12-19 23:40:02 +00:00
Oleksandr Tymoshenko
f82ad6f488 Use NFSCL since NFSCLIENT build is broken at the moment 2012-12-19 20:33:16 +00:00
Jeff Roberson
4c44811c9d - Add new machine parsable KTR macros for timing events.
- Use this new format to automatically handle syscalls and VOPs.  This
   changes the earlier format but is still human readable.

Sponsored by:	EMC / Isilon Storage Division
2012-12-19 20:10:00 +00:00
Jeff Roberson
5b39d5c739 - Correctly handle EWOULDBLOCK in quiesce_cpus
Discussed with:	mav
2012-12-19 20:08:06 +00:00
Andrey V. Elsukov
f8fe3dc9aa When we have some address to forward (e.g. it was specified with ipfw fwd),
we should pass it as first argument into in6_selectroute_fib function to
initiate new route lookup.

MFC after:	1 week
2012-12-19 17:28:17 +00:00
Andrey V. Elsukov
16607317b5 Make dst_sa initialization only when it is actually needed.
MFC after:	1 week
2012-12-19 17:08:49 +00:00
Andrey V. Elsukov
61d88f3421 The selectroute functions does own account of EHOSTUNREACH errors,
no need to do it twice.

MFC after:	1 week
2012-12-19 17:02:07 +00:00
Pawel Jakub Dawidek
07a8e07896 The 'flags' argument can be modified in vn_open_cred(), so we need to
set it for every loop interation.

Pointed out by:	kib
2012-12-19 12:14:08 +00:00
Pawel Jakub Dawidek
cc58032c44 Do not audit paths we try when kern.corefile contains %I.
Obtained from:	WHEEL Systems
2012-12-19 12:12:53 +00:00
Pawel Jakub Dawidek
29146f1a7a Style cleanups. 2012-12-19 12:10:14 +00:00
Pawel Jakub Dawidek
086053a370 The expand_name() function isn't called with the process lock held anymore,
so we can safely use malloc(M_WAITOK) now.

Pointed out by:	kib
2012-12-19 12:00:09 +00:00
Alexander Motin
44525d12bc Fix bug in r242720, that caused additional status page to not be used if
descriptor page is supported.
2012-12-19 09:55:13 +00:00
Alan Cox
c2c46ecd68 Eliminate some definitions that haven't been used in a decade or more. 2012-12-19 05:07:27 +00:00
Olivier Houchard
65d79ed70c Properly implement pmap_[get|set]_memattr
Submitted by:	Ian Lepore <freebsd@damnhippie.dyndns.org>
2012-12-19 00:24:31 +00:00
Jim Harris
91fe20e34d Map BAR 4/5, because NVMe spec says devices may place the MSI-X table
behind BAR 4/5, rather than in BAR 0/1 with the control/doorbell registers.

Sponsored by:	Intel
2012-12-18 23:27:18 +00:00
Oleksandr Tymoshenko
90576f541b Add sysctls for changing GPIO pins function
Submitted by:	Luiz Otavio O Souza
2012-12-18 22:18:54 +00:00
Jim Harris
e1e84e74c1 Simplify module definition by adding nvme_modevent to DRIVER_MODULE()
definition.

Submitted by:   Carl Delsey <carl.r.delsey@intel.com>
2012-12-18 22:10:40 +00:00
Jim Harris
4d6abcb19f Do not use taskqueue to defer completion work when using INTx. INTx now
matches MSI-X behavior.

Sponsored by:	Intel
2012-12-18 21:50:48 +00:00
Xin LI
7a7bc9595c Update arcmsr(4) to vendor version 1.20.00.26, this adds
support for their new RAID adapter ARC-1214.

Many thanks to Areca for continuing to support FreeBSD.

Submitted by:	黃清隆 Ching-Lung Huang <ching2048 areca com tw>
MFC after:	2 weeks
2012-12-18 20:47:23 +00:00
Jean-Sébastien Pédron
778dcb1c13 psm: Support detection of Synaptics touchpad v7.5 and above
Starting with firmware v7.5, the "Read TouchPad Modes" ($01) and "Read
Capabilities" ($02) commands changed: previously constant bytes now
carry variable information.

We now compare those bytes to expected constants only for firmware prior
to v7.5.

Tested by:	Zeus Panchenko <zeus@gnu.org.ua>
MFC after:	1 week
2012-12-18 20:02:53 +00:00
Mateusz Guzik
af3c786c47 prison_racct_detach can be called for not fully initialized jail, so make it check that the jail has racct before doing anything
PR:		kern/174436
Reviewed by:	trasz
MFC after:	3 days
2012-12-18 18:34:36 +00:00
Monthadar Al Jaberi
398228fc82 wtap should not set the IEEE80211_F_DATAPAD flag;
Approved by: adrian (mentor)
2012-12-18 16:15:20 +00:00
Monthadar Al Jaberi
e605766a04 wtap fix malloc/free.
* Remove malloc/free pointer cast;
* Check return value from malloc;

Submitted by: glebius
Approved by: adrian (mentor)
2012-12-18 16:11:13 +00:00
Monthadar Al Jaberi
263bbda93d wtap should check if ieee80211_vap_setup fails.
* If ieee80211_vap_setup fails, we free allocated M_80211_VAP
  memory and return NULL;

Approved by: adrian (mentor)
2012-12-18 08:44:59 +00:00
Monthadar Al Jaberi
3c6b71699a wtap: fix clang warning.
* The warning message was:
    'warning error: format string is not a string literal';
* Changed how make_dev is called, now a string literal
  for formatting is used;

Approved by: adrian (mentor)
2012-12-18 08:41:23 +00:00
Gleb Smirnoff
b8056fae06 Fix !INET6 build after r244365. 2012-12-18 08:14:16 +00:00
Gleb Smirnoff
dd029d52fa Clear correct flag in INET6 case. 2012-12-18 08:09:44 +00:00
Andrey Zonov
5eb0d2838c - Add sysctl to allow unprivileged users to call mlock(2)-family system
calls and turn it on.
- Do not allow to call them inside jail. [1]

Pointed out by:	trasz [1]
Reviewed by:	avg
Approved by:	kib (mentor)
MFC after:	1 week
2012-12-18 07:36:45 +00:00
Andrey Zonov
7e19eda4aa - Fix locked memory accounting for maps with MAP_WIREFUTURE flag.
- Add sysctl vm.old_mlock which may turn such accounting off.

Reviewed by:	avg, trasz
Approved by:	kib (mentor)
MFC after:	1 week
2012-12-18 07:35:01 +00:00
Kevin Lo
c7dada99bb Fix typo in comment.
Reviewed by:	thompsa
2012-12-18 06:37:23 +00:00
Rick Macklem
13870d5d7b Piete.Brooks at cl.cam.ac.uk reported via email a crash which was
caused by use of an invalid kgss_gssd_handle during an upcall to
the gssd daemon when it has exited. This patch seems to avoid the
crashes by holding a reference count on the kgss_gssd_handle until
the upcall is done. It also adds a new mutex kgss_gssd_lock used to
make manipulation of kgss_gssd_handle SMP safe.

Tested by:	Illias A. Marinos, Herbert Poeckl
Reviewed by:	jhb
MFC after:	2 weeks
2012-12-18 00:25:48 +00:00
Jim Harris
61ba2ac6b4 Use CAM_DEV_NOT_THERE instead of CAM_SEL_TIMEOUT to report nonexistent
LUNs for the virtual processor device.  This removes lots of CAM warnings,
and follows similar recent changes to tws(4) and twa(4) drivers.

Also fix case where CAM_REQ_CMP was getting OR'd with CAM_DEV_NOT_THERE
in the nonexistent LUN case, resulting in different CAM status (CAM_UA_TERMIO)
getting reported to CAM.  This issue existing previously, but was more subtle
because it changed CAM_SEL_TIMEOUT to CAM_CMD_TIMEOUT.

Sponsored by:	Intel
Reported and tested by:	Willem Jan Withagen <wjw@digiware.nl>
MFC after:	1 week
2012-12-18 00:00:07 +00:00
Andrey V. Elsukov
f491274582 Since we use different flags to detect tcp forwarding, and we share the
same code for IPv4 and IPv6 in tcp_input, we should check both
M_IP_NEXTHOP and M_IP6_NEXTHOP flags.

MFC after:	3 days
2012-12-17 20:55:33 +00:00
Andrey V. Elsukov
79672fd277 Use M_PROTO7 flag for M_IP6_NEXTHOP, because M_PROTO2 was used for
M_AUTHIPHDR.

Pointy hat to:	ae
Reported by:	Vadim Goncharov
MFC after:	3 days
2012-12-17 14:36:56 +00:00
Pawel Jakub Dawidek
f06f465db7 Minor style tweaks.
Obtained from:	WHEEL Systems
2012-12-17 10:51:22 +00:00
Pawel Jakub Dawidek
c52ff61196 Better variables naming in expand_name() to be more consistent with coredump().
Obtained from:	WHEEL Systems
2012-12-17 10:48:10 +00:00
Pawel Jakub Dawidek
f5002be657 Warn about reaching various PF limits.
Reviewed by:	glebius
Obtained from:	WHEEL Systems
2012-12-17 10:10:13 +00:00
Pyun YongHyeon
9f988ef16b Make sure to stop both TX and RX MACs in ale_stop_mac(). Previously
it used to stop TX MAC only such that MAC reconfiguration after
getting a link didn't work as expected.

PR:	kern/173652
2012-12-17 06:01:57 +00:00
Rui Paulo
d48fc6b377 amd64 only has rela sections. 2012-12-17 00:34:07 +00:00
Marius Strobl
d464a3641d Revert r237842 and switch back to SCHED_ULE. All problems I encountered
with the latter have been fixed with r241780.

MFC after:	3 days
2012-12-16 20:54:07 +00:00
Marius Strobl
c0c11f4c92 Restore pre-r234898 printing of boot loader and path.
MFC after:	3 days
2012-12-16 20:43:29 +00:00
Pawel Jakub Dawidek
dd57ce87eb Move expand_name() after process lock is released.
This fixed panic where we hold mutex (process lock) and try to obtain sleepable
lock (vnode lock in expand_name()). The panic could occur when %I was used
in kern.corefile.

Additionally we avoid expand_name() overhead when coredumps are disabled.

Obtained from:	WHEEL Systems
2012-12-16 14:53:27 +00:00
Pawel Jakub Dawidek
2ce1b32df2 Don't add audit record when coredumps are disabled or name cannot be expanded.
Discussed with:	rwatson
Obtained from:	WHEEL Systems
2012-12-16 14:24:59 +00:00
Pawel Jakub Dawidek
7e73ee85ab Make the check easier to read.
Obtained from:	WHEEL Systems
2012-12-16 14:14:18 +00:00
Pawel Jakub Dawidek
b039f8c2aa Use 'cred' variable.
Obtained from:	WHEEL Systems
2012-12-16 13:56:38 +00:00
Oleksandr Tymoshenko
6565185ed6 Fix comment to represent actual file purpose
Spotted by: gavin@
2012-12-16 00:20:16 +00:00
Pawel Jakub Dawidek
03385af198 sbuf_trim() cannot be used on sbuf with drain function set.
This fixes panic when listing sysctls on INVARIANTS-enabled kernel while
having wbwd loaded.

This panic was not fatal, at worst one additional space was printed.

Also sbuf_trim() makes some sense even if drain function is set. The drain
function is called only when buffer is to be expanded. So we could still trim
existing buffer before drain is called. In this case it worked just fine - the
trailing space was correctly trimmed.

Obtained from:	WHEEL Systems
MFC after:	1 week
2012-12-15 22:26:16 +00:00
Andrew Turner
d39894842b Ignore a warning in ubldr where clang doesn't understand the %D printf
specifier from libstand.
2012-12-15 21:47:05 +00:00
Andrey V. Elsukov
68eba526b9 In additional to the tailq of IPv6 addresses add the hash table.
For now use 256 buckets and fnv_hash function. Use xor'ed 32-bit
s6_addr32 parts of in6_addr structure as a hash key. Update
in6_localip and in6_is_addr_deprecated to use hash table for fastest
lookup.

Sponsored by:	Yandex LLC
Discussed with:	dwmalone, glebius, bz
2012-12-15 20:04:24 +00:00
Mikolaj Golub
bf1e95a21c In pfioctl, if the permission checks failed we returned with vnet context
set.

As the checks don't require vnet context, this is fixed by setting
vnet after the checks.

PR:		kern/160541
Submitted by:	Nikos Vassiliadis (slightly different approach)
2012-12-15 17:19:36 +00:00
Robert Watson
6f1cbda73d Four .c files from OpenBSM are used, in modified form, by the kernel to
implement the BSM audit trail format.  Rename the kernel versions of the
files to match the userspace filenames so that it's easier to work out
what they correspond to, and therefore ensure they are kept in-sync.

Obtained from:	TrustedBSD Project
2012-12-15 15:21:09 +00:00
Konstantin Belousov
14df601e47 When mnt_vnode_next_active iterator cannot lock the next vnode and
yields, specify the user priority for the yield.  Otherwise, a
higher-priority (kernel) thread could fall into the priority-inversion
with the thread owning the mutex lock.

On single-processor machines or UP kernels, do not loop adaptively
when the next vnode cannot be locked, instead yield unconditionally.

Restructure the iteration initializer and the iterator to remove code
duplication.  Put the code to fetch and lock a vnode next to the
current marker, into the mnt_vnode_next_active() function, and use it
instead of repeating the loop.

Reported by:	hrs, rmacklem
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2012-12-15 02:04:46 +00:00
Konstantin Belousov
9f37ee804a Fix a typo, resulting in the NULL pointer dereference.
Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2012-12-15 02:03:59 +00:00
Konstantin Belousov
4eea8aea94 Line up the continuation backslashes.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2012-12-15 02:03:06 +00:00
Konstantin Belousov
d4015944e7 Remove a special case for XEN, which is erronous and makes vfork(2)
behaviour to differ from the documented, only on XEN.  If there are
any issues with XEN pmap left, they should be fixed in pmap.

MFC after:	2 weeks
2012-12-15 02:02:11 +00:00
Rick Macklem
f1c4014cd5 The group list for a non-default export entry (a host/subnet one)
was being copied from the wrong place. This patch fixes that.
This could cause access failures for mapped users, when the group
permissions were needed.

PR:		147998
Submitted by:	Christopher Key (cjk32 at cam.ac.uk)
MFC after:	2 weeks
2012-12-14 21:49:06 +00:00
Gleb Smirnoff
f094f811fb Fix error in r235991. No-sleep version of IFNET_RLOCK() should
be used here, since we may hold the main pf rulesets rwlock.

Reported by:	Fleuriot Damien <ml my.gd>
2012-12-14 13:01:16 +00:00
Andrey V. Elsukov
a90d1c4bb2 Add an #include guard to the sys/fnv_hash.h.
MFC after:	3 days
2012-12-14 12:37:35 +00:00
Gleb Smirnoff
4c794f5c06 Fix VIMAGE build broken in r244185.
Submitted by:	Nikolai Lifanov <lifanov mail.lifanov.com>
2012-12-14 08:02:35 +00:00
Bryan Venteicher
ac4b6bcd17 virtio: Start taskqueues threads after attach cannot fail
If virtio_setup_intr() failed during boot, we would hang in
taskqueue_free() -> taskqueue_terminate() for all the taskq
threads to terminate. This will never happen since the
scheduler is not running by this point.

Reported by:	neel, grehan
Approved by:	grehan (mentor)
2012-12-14 05:27:56 +00:00
Oleksandr Tymoshenko
5874dee8b2 Add support for QEMU's version of Versatile Platform Board 2012-12-13 23:19:13 +00:00
Oleksandr Tymoshenko
e6440e15fc Add driver for PrimeCell Vectored Interrupt Controller (PL190) 2012-12-13 23:03:37 +00:00
Jim Harris
7b332f2020 Add bus_space_read_8 and bus_space_write_8 for amd64.
Rather than trying to KASSERT for callers that invoke this on
IO tags, either do nothing (for write_8) or return ~0 (for read_8).
Using KASSERT here just makes bus.h too messy from both
polluting bus.h with systm.h (for any number of drivers that include
bus.h without first including systm.h) or ports that use bus.h
directly (i.e. libpciaccess) as reported by zeising@.

Also don't try to implement all of the other bus_space functions for
8 byte access since realistically only these two are needed for some
devices that expose 64-bit memory-mapped registers.

Put the amd64-specific functions here rather than sys/amd64/include/bus.h
so that we can keep this header unified for x86, as requested by mdf@
and tijl@.

Submitted by:	Carl Delsey <carl.r.delsey@intel.com>
MFC after:	3 days
2012-12-13 21:40:11 +00:00
Jim Harris
f2fcc434ee Revert r243960 based on feedback regarding keeping x86 headers unified
(mdf@, tijl@) and use of KASSERT/systm.h in bus.h (zeising@, bde@).

Alternate implementation will be made in a separate commit.
2012-12-13 21:27:20 +00:00
Steven Hartland
5780c4a723 Added vfs.zfs.vdev.trim_on_init sysctl which allows full vdev trim on
initialisation to be enabled (1) / disabled (0) defaults to enabled.

This is useful for devices which have a slow trim speed and are either
new or have otherwise already been wiped e.g. secure erase.

PR:     kern/173116
Submitted by:   Steven Hartland
Approved by:    pjd (mentor)
2012-12-13 17:39:07 +00:00
Steven Hartland
c440a359ca Upgrades trim free request sizes before inserting them into to free map,
making range consolidation much more effective particularly for small
deletes.

This reduces memory used by the free map as well as reducing the number
of bio requests down to geom required to process all deletes.

In tests this achieved a factor of 10 reduction of trim ranges / geom
call downs.

While I'm here correct the description of zio_vdev_io_start.

PR:		kern/173254
Submitted by:	Steven Hartland
Approved by:	pjd (mentor)
2012-12-13 17:06:38 +00:00
Gleb Smirnoff
9ff7e6e922 Merge rev. 1.119 from OpenBSD:
date: 2009/03/31 01:21:29;  author: dlg;  state: Exp;  lines: +9 -16
  ...

  this also firms up some of the input parsing so it handles short frames a
  bit better.

This actually fixes reading beyond mbuf data area in pfsync_input(), that
may happen at certain pfsync datagrams.
2012-12-13 12:51:22 +00:00
Gleb Smirnoff
feaa4dd2d0 Initialize state id prior to attaching state to key hash. Otherwise a
race can happen, when pf_find_state() finds state via key hash, and locks
id hash slot 0 instead of appropriate to state id slot.
2012-12-13 12:48:57 +00:00
Gleb Smirnoff
b1ec2940af Fix problem in r238990. The LLE_LINKED flag should be tested prior to
entering llentry_free(), and in case if we lose the race, we should simply
perform LLE_FREE_LOCKED(). Otherwise, if the race is lost by the thread
performing arptimer(), it will remove two references from the lle instead
of one.

Reported by:	Ian FREISLICH <ianf clue.co.za>
2012-12-13 11:11:15 +00:00
Oleksandr Tymoshenko
be9914fc31 Prevent possible usage of uninitialized pbase variable by checking
return value of fdt_get_range
2012-12-13 03:35:47 +00:00