Commit Graph

91840 Commits

Author SHA1 Message Date
Neel Natu
e3f0800bd1 Postpone vmm module initialization until after SMP is initialized - particularly
that 'smp_started != 0'.

This is required because the VT-x initialization calls smp_rendezvous()
to set the CR4_VMXE bit on all the cpus.

With this change we can preload vmm.ko from the loader.

Reported by:	alfred@, sbruno@
Obtained from:	NetApp
2013-01-21 01:33:10 +00:00
Tim Kientzle
6f91e2520b Use correct size for AM335x CPSW memory window. 2013-01-21 01:02:49 +00:00
Andriy Gapon
4afa5361cc zfs/sparc64 boot: fix booting after r242230
arch_zfs_probe method is supposed to only probe for ZFS vdevs, but it can
not expect that ZFS data is in a ready state yet.
So, move some code from sparc64_zfs_probe to main to meet the constraints.

Reported by:	Chris Ross <cross+freebsd@distal.com>
Tested by:	Chris Ross <cross+freebsd@distal.com>
MFC after:	4 days
2013-01-20 19:55:49 +00:00
Neel Natu
912a3e678a Add svn properties to the recently merged bhyve source files.
The pre-commit hook will not allow any commits without the svn:keywords
property in head.
2013-01-20 03:42:49 +00:00
Andrew Turner
6c71f24345 Link against compiler-rt to pull in the required __aeabi_* functions 2013-01-19 22:12:57 +00:00
Andrew Turner
b56c0c673a When DDB is enabled and we are building for the ARM EABI include the unwind
tables in the kernel.
2013-01-19 22:08:16 +00:00
Tim Kientzle
3f67e83a60 Use correct GPIO interrupt lines. 2013-01-19 17:22:12 +00:00
Tim Kientzle
296aaa6046 Clarify the error messages for unrecognized pins and muxtypes. 2013-01-19 17:12:23 +00:00
Neel Natu
c458fc1ed4 Merge projects/bhyve to head.
'bhyve' was developed by grehan@ and myself at NetApp (thanks!).

Special thanks to Peter Snyder, Joe Caradonna and Michael Dexter for their
support and encouragement.

Obtained from:	NetApp
2013-01-19 04:18:52 +00:00
Alexander Kabaev
e15f85e71c Do not pretend to have autosense data when no such data is available.
Make umass return an error code if SCSI sense retrieval request
has failed. Make sure scsi_error_action honors SF_NO_RETRY and
SF_NO_RECOVERY in all cases, even if it cannot parse sense bytes.

Reviewed by: hselasky (umass), scottl (cam)
2013-01-19 03:19:39 +00:00
John Baldwin
b5821c6f0e Fix build with SMP disabled.`
Reported by:	bf
2013-01-19 01:18:22 +00:00
Ian Lepore
ae4f863c89 Eliminate the need for an intermediate array of indices into the arrays of
interrupt counts and names, by making the names into an array of fixed-length
strings that can be directly indexed.  This eliminates extra memory accesses
on every interrupt to increment the counts.

As a side effect, it also fixes a bug that would corrupt the names data
if a name was longer than MAXCOMLEN, which led to incorrect vmstat -i output.

Approved by:	cognet (mentor)
2013-01-19 00:50:12 +00:00
Jung-uk Kim
10c281ab92 Work around build breakage with GCC 4.2. 2013-01-19 00:37:17 +00:00
Xin LI
e4558aacfc Make it possible to force async at server side on new NFS server, similar
to the old one's nfs.nfsrv.async.

Please note that by enabling this option (default is disabled), the system
could potentionally have silent data corruption if the server crashes
before write is committed to non-volatile storage, as the client side have
no way to tell if the data is already written.

Submitted by:	rmacklem
MFC after:	2 weeks
2013-01-18 19:42:08 +00:00
Pedro F. Giffuni
b187108f66 ext2fs: Add some DOINGASYNC check to match ffs.
This is mostly cosmetical.

Reviewed by:	bde
MFC after:	3 days
2013-01-18 19:11:17 +00:00
John Baldwin
d177f14da9 Use vfs_timestamp() to set file timestamps rather than invoking
getmicrotime() or getnanotime() directly in NFS.

Reviewed by:	rmacklem, bde
MFC after:	1 week
2013-01-18 18:43:38 +00:00
Jung-uk Kim
efcc2a3054 Merge ACPICA 20130117. 2013-01-17 23:56:43 +00:00
Luigi Rizzo
70ca194a4c remove the old memory allocator, not useful anymore 2013-01-17 23:14:17 +00:00
Luigi Rizzo
1dce924d25 add some definition and driver changes in preparation for
two upcoming features:

semi-transparent mode:
    when a device is opened in this mode, the
    user program will be able to mark slots that must be forwarded
    to the "other" side (i.e. from NIC to host stack, or viceversa),
    and the forwarding will occur automatically at the next netmap syscall.
    This saves the need to open another file descriptor and do
    the forwarding manually.

direct-forwarding mode:
    when operating with a VALE port, the user can specify in the slot
    the actual destination port, overriding the forwarding decision
    made by a lookup of the destination MAC. This can be useful to
    implement packet dispatchers.

No API changes will be introduced.
No new functionality in this patch yet.
2013-01-17 22:14:58 +00:00
John Baldwin
f876ffeae3 Don't attempt to use clflush on the local APIC register window. Various
CPUs exhibit bad behavior if this is done (Intel Errata AAJ3, hangs on
Pentium-M, and trashing of the local APIC registers on a VIA C7).  The
local APIC is implicitly mapped UC already via MTRRs, so the clflush isn't
necessary anyway.

MFC after:	2 weeks
2013-01-17 21:32:25 +00:00
Andre Oppermann
371407162b Move the mbuf memory limit calculations from init_param2() to
tunable_mbinit() where it is next to where it is used later.

Change the sysinit level of tunable_mbinit() from SI_SUB_TUNABLES
to SI_SUB_KMEM after the VM is running.  This allows to use better
methods to determine the effectively available physical and virtual
memory available to the kernel.

Update comments.

In a second step it can be merged into mbuf_init().
2013-01-17 21:28:31 +00:00
Christian S.J. Peron
14bc51359c Implement the zonename token for jailed processes. If
a process has an auditid/preselection masks specified, and
is jailed, include the zonename (jailname) token as a
part of the audit record.

Reviewed by:	pjd
MFC after:	2 weeks
2013-01-17 21:02:53 +00:00
Luigi Rizzo
e814dcebf3 remove an incorrect comment and debugging code 2013-01-17 19:27:12 +00:00
Neel Natu
9ad6525193 IFC @ r245542 2013-01-17 19:08:20 +00:00
John Baldwin
9f5038374b Remove the unused nfs_curusec(). 2013-01-17 19:03:24 +00:00
Navdeep Parhar
e13fe79820 cxgbe: Make the for_each macros safer to use by turning them
into a single statement each.

Submitted by:	Christoph Mallon <christoph dot mallon at gmx dot de>
MFC after:	1 week
2013-01-17 18:52:49 +00:00
John Baldwin
39804bc89d Remove a no-longer-used variable after the previous change to use
VA_UTIMES_NULL.

Submitted by:	bde, rmacklem
MFC after:	1 week
2013-01-17 18:45:20 +00:00
Adrian Chadd
a74ebfe59e Fix hangs (exposed by spectral scan activity) in STA mode when the
chip hangs.

* Always do a reset in ath_bmiss_proc(), regardless of whether the
  hardware is "hung" or not.  Specifically, for spectral scan, there's
  likely a whole bunch of potential hangs that we don't (yet) recognise
  in the HAL.  So to avoid staying RX deaf persisting until the station
  disassociates, just do a no-loss reset.

* Set sc_beacons=1 in STA mode.  During a reset, the beacon programming
  isn't done.  (It's likely I need to set sc_syncbeacons during a hang
  reset, but I digress.)  Thus after a reset, there's no beacon timer
  programming to send a BMISS interrupt if beacons aren't heard ..
  thus if the AP disappears, you won't get notified and you'll have to
  reset your interface.

This hasn't yet fixed all of the hangs that I've seen when debugging
spectral scan, but it's certainly reduced the hang frequency and it
should improve general STA stability in very noisy environments.

Tested:

* AR9280, STA mode, spectral scan off/on

PR:		kern/175227
2013-01-17 16:43:59 +00:00
Adrian Chadd
61cd9692bb Add a quick work-around if ath_beacon_config() to not die if it's called
when an interface is going down.

Right now it's quite possible (but very unlikely!) that ath_reset()
or similar is called, leading to a beacon config call, in parallel with
the last VAP being destroyed.

This likely should be fixed by making sure the bmiss/bstuck/watchdog
taskqueues are canceled whenever the last VAP is destroyed.
2013-01-17 16:26:40 +00:00
Andrew Turner
9fd57b44e4 * Correct KINFO_PROC_SIZE for ARM EABI.
* Update the syscall interface to pass in the syscall value in register r7.
2013-01-17 09:52:35 +00:00
Andrew Turner
29ce0a2aff Implement stack unwinding based on section 9 of the "Exception handling ABI
for the ARM architecture" documentation. The unwind tables are currently
not stored in the kernel but will be added later.
2013-01-17 09:47:56 +00:00
Andrew Turner
46d741dc7f Add the required __aeabi_* functions the kernel uses when built for ARM EABI 2013-01-17 09:37:42 +00:00
Neel Natu
c2217b9848 IFC @ r245509 2013-01-17 07:04:37 +00:00
Alexander Motin
c3ec009a97 - Fix rebuild position broken at r245522.
- Identify one more metadata field.
2013-01-17 03:27:08 +00:00
Alexander Motin
821a0f639e For Promise/AMD metadata add support for disks with capacity above 2TiB
and for volumes with sector size above 512 bytes.
2013-01-17 00:50:25 +00:00
Alexander Motin
ed8180e665 Recalculate volume size only for real CONCATs. For SINGLE trust volume
size given by metadata, as it should be correct and in some cases can be
smaller then subdisk size.
2013-01-17 00:09:50 +00:00
Navdeep Parhar
601fce8879 cxgbe: Do a more thorough job in the CLEAR_STATS ioctl.
MFC after:	3 days
2013-01-16 23:49:55 +00:00
Navdeep Parhar
5bb17208d7 cxgbe: Fix the for_each_foo macros -- the last argument should not share
its name with any member of struct sge.

MFC after:	3 days
2013-01-16 23:48:55 +00:00
Xin LI
5c74885e99 MFV r245510:
improve the comment in txg.c

Obtained from:	Illumos (13910:f3454e0a097c)
MFC after:	2 weeks
2013-01-16 22:59:50 +00:00
John Baldwin
5055536eec Use the VA_UTIMES_NULL flag to detect when NULL was passed to utimes()
instead of comparing the desired time against the current time as a
heuristic.

Reviewed by:	rmacklem
MFC after:	1 week
2013-01-16 21:52:31 +00:00
Ganbold Tsagaankhuu
486beae0a6 Fix style bugs
Use defined constant instead of variable for reg_shift
Change u_int32_t to uint32_t

Approved by: gonzo
Suggested by: bde, wkoszek
2013-01-16 08:04:55 +00:00
Konstantin Belousov
e8f966eeb8 Remove the filtering of the acceptable mount options for nullfs, added
in r245004.  Although the report was for noatime option which is
non-functional for the nullfs, other standard options like nosuid or
noexec are useful with it.

Reported by:	Dewayne Geraghty <dewayne.geraghty@heuristicsystems.com.au>
MFC after:	3 days
2013-01-16 05:32:49 +00:00
Pyun YongHyeon
16796cb910 Add D-Link DFE-520TX rev C1.
Tested by:	Ruslan Makhmatkhanov < cvs-src <> yandex dot ru >
MFC After:	1 week
2013-01-16 01:30:46 +00:00
Olivier Houchard
19b73c0586 Use armv7_drain_writebuf() and armv7_context_switch, instead of the arm11
variants.
2013-01-15 22:11:28 +00:00
Olivier Houchard
a7d20a4864 Only spin on the blocked_lock for SCHED_ULE+SMP, as it's done on the other
arches.
2013-01-15 22:09:11 +00:00
John Baldwin
6910d7a0d8 - More properly handle interrupted NFS requests on an interruptible mount
by returning an error of EINTR rather than EACCES.
- While here, bring back some (but not all) of the NFS RPC statistics lost
  when krpc was committed.

Reviewed by:	rmacklem
MFC after:	1 week
2013-01-15 22:08:17 +00:00
Olivier Houchard
58fdb5f3e6 Don't define rel/acq variants of some atomic operations as the regular
version for armv6.
2013-01-15 22:08:03 +00:00
John Baldwin
323e149ade Do not require a filter-only interrupt handler for puc ports that are not
serial devices (such as printer ports).  This allows ppc devices attached
to puc to correctly setup an interrupt handler and work.

Tested by:	Andre Albsmeier  Andre.Albsmeier@siemens.com
MFC after:	1 week
2013-01-15 20:13:25 +00:00
Alfred Perlstein
17ebe960a6 Do not autotune ncallout to be greater than 18508.
When maxusers was unrestricted and maxfiles was allowed to autotune
much higher the result was that ncallout which was based on maxfiles
and maxproc grew much higher than was needed.

To fix this clip autotuning to the same number we would get with
the old maxusers algorithm which would stop scaling at 384
maxusers.

Growing ncalout higher is not likely to be needed since most consumers
of timeout(9) are gone and any higher value for ncallout causes the
callwheel hashes to be much larger than will even be needed for
most applications.

MFC after:      1 month

Reviewed by:	mav
2013-01-15 19:26:17 +00:00
Navdeep Parhar
c995301b2d cxgbe/tom: Add support for fully offloaded TCP/IPv6 connections (passive open).
MFC after:	1 week
2013-01-15 18:50:40 +00:00
Navdeep Parhar
8be0815671 cxgbe/tom: Add support for fully offloaded TCP/IPv6 connections (active open).
MFC after:	1 week
2013-01-15 18:38:51 +00:00
Adrian Chadd
425dd534ac Add some new debugging options for the ath(4) and ath_hal(4) drivers. 2013-01-15 18:04:15 +00:00
Adrian Chadd
c5239edb98 Implement frame (data) transmission using if_transmit(), rather than
if_start().

This removes the overlapping data path TX from occuring, which
solves quite a number of the potential TX queue races in ath(4).
It doesn't fix the net80211 layer TX queue races and it doesn't
fix the raw TX path yet, but it's an important step towards this.

This hasn't dropped the TX performance in my testing; primarily
because now the TX path can quickly queue frames and continue
along processing.

This involves a few rather deep changes:

* Use the ath_buf as a queue placeholder for now, as we need to be
  able to support queuing a list of mbufs (ie, when transmitting
  fragments) and m_nextpkt can't be used here (because it's what is
  joining the fragments together)

* if_transmit() now simply allocates the ath_buf and queues it to
  a driver TX staging queue.

* TX is now moved into a taskqueue function.

* The TX taskqueue function now dequeues and transmits frames.

* Fragments are handled correctly here - as the current API passes
  the fragment list as one mbuf list (joined with m_nextpkt) through
  to the driver if_transmit().

* For the couple of places where ath_start() may be called (mostly
  from net80211 when starting the VAP up again), just reimplement
  it using the new enqueue and taskqueue methods.

What I don't like (about this work and the TX code in general):

* I'm using the same lock for the staging TX queue management and the
  actual TX.  This isn't required; I'm just being slack.

* I haven't yet moved TX to a separate taskqueue (but the taskqueue is
  created); it's easy enough to do this later if necessary.  I just need
  to make sure it's a higher priority queue, so TX has the same
  behaviour as it used to (where it would preempt existing RX..)

* I need to re-review the TX path a little more and make sure that
  ieee80211_node_*() functions aren't called within the TX lock.
  When queueing, I should just push failed frames into a queue and
  when I'm wrapping up the TX code, unlock the TX lock and
  call ieee80211_node_free() on each.

* It would be nice if I could hold the TX lock for the entire
  TX and TX completion, rather than this release/re-acquire behaviour.
  But that requires that I shuffle around the TX completion code
  to handle actual ath_buf free and net80211 callback/free outside
  of the TX lock.  That's one of my next projects.

* the ic_raw_xmit() path doesn't use this yet - so it still has
  sequencing problems with parallel, overlapping calls to the
  data path.  I'll fix this later.

Tested:

* Hostap - AR9280, AR9220
* STA - AR5212, AR9280, AR5416
2013-01-15 18:01:23 +00:00
Adrian Chadd
3484d5ad30 Remove the use of the ifnet send queue and if_start() in the power
save queue code.

Instead, use if_transmit() directly - and handle the cases where frame
transmission fails.

I don't necessarily like this and I think at this point the M_ENCAP check,
node freeing upon fail and the actual if_transmit() call should be done
in methods in ieee80211_freebsd.c, but I digress slightly..

This removes one of the last few uses of if_start() and the ifnet
if_snd queue.  The last major offender is ieee80211_output.c, where
ieee80211_start() implements if_start() and uses the ifnet queue
directly.

(There's a couple of gotchas here, where the if_start pointer is
compared to ieee80211_start(), but that's a later problem.)
2013-01-15 17:50:07 +00:00
Sean Bruno
e3edca225f Satisfy the intent of kern/151564: [ciss] ciss(4) should increase
CISS_MAX_LOGICAL to 107

Submitter wanted to increase the number of logical disks supported by ciss(4)
by simply raising the CISS_MAX_LOGICAL value even higher.  Instead, consult
the documentation for the raid controller (OPENCISS) and poke the controller
bits to ask it for how many logical/physical disks it can handle.

Revert svn R242089 that raised CISS_MAX_LOGICAL to 64 for all controllers.

For older controllers that don't support this mechanism, fallback to the old
value of 16 logical disks.  Tested on P420, P410, P400 and 6i model ciss(4)
controllers.

This should will be MFC'd back to stable/9 stable/8 and stable/7 after the MFC
period.

PR:		kern/151564
Reviewed by:	scottl@freebsd.org
MFC after:	2 weeks
2013-01-15 14:35:35 +00:00
Andrey Zonov
0165f660c1 - Detect when we are in KVM.
Silence on:	emulation
Approved by:	kib (mentor)
MFC after:	1 week
2013-01-15 14:05:59 +00:00
Alexander Motin
2c6a273750 Allow to insert new component to geom_raid3 without specifying number.
PR:		kern/160562
MFC after:	2 weeks
2013-01-15 10:06:35 +00:00
Ganbold Tsagaankhuu
3415f14f85 Add mistakenly removed third clause to license
Reviewed by: joel
2013-01-15 09:56:20 +00:00
Ganbold Tsagaankhuu
f97c5511c0 Fix formatting of license according to share/examples/etc/bsd-style-copyright
Reviewed by: joel
2013-01-15 09:39:11 +00:00
Ganbold Tsagaankhuu
2b80c23a85 Fix license to follow standard license template
Reviewed by: joel
2013-01-15 09:31:13 +00:00
Ganbold Tsagaankhuu
ebc93265c7 Initial support for Allwinner A10 SoC (Cubieboard)
Add simple console driver
	Add interrupt handling and timer codes
	Add kernel config file
	Add dts file
Approved by: gonzo
2013-01-15 08:26:16 +00:00
Navdeep Parhar
87aa6825ff cxgbe/tom: Basic CLIP table management.
This is the Compressed Local IPv6 table on the chip.  To save space, the
chip uses an index into this table instead of a full IPv6 address in
some of its hardware data structures.

For now the driver fills this table with all the local IPv6 addresses
that it sees at the time the table is initialized.  I'll improve this
later so that the table is updated whenever new IPv6 addresses are
configured or existing ones deleted.

MFC after:	1 week
2013-01-15 07:07:29 +00:00
Alexander Motin
14b5a2cd6b In case somebody still use it, fix legacy ataraid(4) to work on combined
PATA+AHCI controllers, such as JMicron JMB363.

PR:		kern/159271
MFC after:	1 week
2013-01-15 02:18:04 +00:00
Alexander Motin
f62c1a47d6 Alike to r242314 for GRAID make GRAID3 more aggressive in marking volumes
as clean on shutdown and move that action from shutdown_pre_sync stage to
shutdown_post_sync to avoid extra flapping.

ZFS tends to not close devices on shutdown, that doesn't allow GEOM RAID
to shutdown gracefully.  To handle that, mark volume as clean just when
shutdown time comes and there are no active writes.

MFC after:	2 weeks
2013-01-15 01:27:04 +00:00
Alexander Motin
cbab616174 Alike to r242314 for GRAID make GMIRROR more aggressive in marking volumes
as clean on shutdown and move that action from shutdown_pre_sync stage to
shutdown_post_sync to avoid extra flapping.

ZFS tends to not close devices on shutdown, that doesn't allow GEOM RAID
to shutdown gracefully.  To handle that, mark volume as clean just when
shutdown time comes and there are no active writes.

PR:		kern/113957
MFC after:	2 weeks
2013-01-15 01:13:55 +00:00
Navdeep Parhar
7f441ef267 cxgbe/tom: Miscellaneous updates for TOE+IPv6 support (more to follow).
- Teach find_best_mtu_idx() to deal with IPv6 endpoints.

- Install correct protosw in offloaded TCP/IPv6 sockets when DDP is
  enabled.

- Move set_tcp_ddp_ulp_mode to t4_tom.c so that t4_tom.h can be included
  without having to drag in t4_msg.h too.  This was bothering the iWARP
  driver for some reason.

MFC after:	1 week
2013-01-15 00:24:01 +00:00
Navdeep Parhar
0a0a697c73 cxgbe(4): Updates to the hardware L2 table management code.
- Add full support for IPv6 addresses.

- Read the size of the L2 table during attach.  Do not assume that PCIe
  physical function 4 of the card has all of the table to itself.

- Use FNV instead of Jenkins to hash L3 addresses and drop the private
  copy of jhash.h from the driver.

MFC after:	1 week
2013-01-14 20:36:22 +00:00
Alexander Motin
4c10c25e33 Keep value of orig_config_id metadata field. Windows driver writes there
previous value of config_id when it is changed in some cases.  I guess it
may be used do avoid some split-brain conditions.
2013-01-14 20:31:45 +00:00
Hans Petter Selasky
c25ca7790c Add new u3g device quirk.
Submitted by:	Lowell Gilbert
MFC after:	1 week
2013-01-14 17:41:04 +00:00
Alexander Motin
eb84fc957c Small cosmetic tuning of the IRRT status constants. 2013-01-14 16:38:43 +00:00
Sean Bruno
b9fd59b70c Quiesce some clang warnings while we're here doing stuff.
Submitted by:	Hiren Panchasara <hiren.panchasara@gmail.com>
Obtained from:	Yahoo! Inc
2013-01-14 15:05:22 +00:00
Alexander Motin
511c69d9ce Print some more metadata fields. 2013-01-14 13:06:35 +00:00
Andrey Zonov
1cc20081df - Get rid of unused function vmspace_wired_count().
Reviewed by:	alc
Approved by:	kib (mentor)
MFC after:	1 week
2013-01-14 12:12:56 +00:00
Andrew Turner
eb23ab3120 Update sigcode to use both the current ABI and FreeBSD's version of the
ARM EABI syscall calling convention.

The current ABI encodes the syscall number in the instruction. This causes
issues with the thumb mode as it only has 8 bits to encode this value and
we have too many system calls and by using a register will simplify the
code to get the syscall number in the kernel.

With the ARM EABI we reuse the Linux calling convention by storing the
value in r7. Because of this we use both methods to encode the syscall
number in this function.
2013-01-14 09:11:18 +00:00
Konstantin Belousov
10b4bb0b33 Add a trivial comment to record the proper commit log for r245407:
Set the v_hash for a new vnode in the getnewvnode() to the value
calculated based on the vnode structure address.  Filesystems using
vfs_hash_insert() override the v_hash using the standard formula of
(inode_number + mnt_hashseed).  For other filesystems, the
initialization allows the vfs_hash_index() to provide useful hash too.

Suggested, reviewed and tested by:	peter
Sponsored by:	The FreeBSD Foundation
MFC after:	5 days
2013-01-14 05:52:23 +00:00
Konstantin Belousov
ab52a230cf Rearrange the struct bufobj and struct vnode layouts to reduce
padding.  On the amd64 kernel with INVARIANTS turned off, size of the
struct vnode is reduced from 496 to 472 bytes, saving 24 bytes of
memory and KVA per vnode.

Noted and reviewed by:	peter
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
2013-01-14 05:46:49 +00:00
Konstantin Belousov
614b9f9130 For zfs vnodes, use the standard inode number based hash algorithm.
Reviewed and tested by:	peter
Sponsored by:	The FreeBSD Foundation
MFC after:	5 days
2013-01-14 05:45:33 +00:00
Konstantin Belousov
603f963e56 The current default size of the nullfs hash table used to lookup the
existing nullfs vnode by the lower vnode is only 16 slots.  Since the
default mode for the nullfs is to cache the vnodes, hash has extremely
huge chains.

Size the nullfs hashtbl based on the current value of
desiredvnodes. Use vfs_hash_index() to calculate the hash bucket for a
given vnode.

Pointy hat to:	    kib
Diagnosed and reviewed by:	peter
Tested by:    peter, pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	5 days
2013-01-14 05:44:47 +00:00
Konstantin Belousov
a41df84820 diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 7c243b6..0bdaf36 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -279,6 +279,7 @@ SYSCTL_INT(_debug, OID_AUTO, vnlru_nowhere, CTLFLAG_RW,
 #define VSHOULDFREE(vp) (!((vp)->v_iflag & VI_FREE) && !(vp)->v_holdcnt)
 #define VSHOULDBUSY(vp) (((vp)->v_iflag & VI_FREE) && (vp)->v_holdcnt)

+static int vnsz2log;

 /*
  * Initialize the vnode management data structures.
@@ -293,6 +294,7 @@ SYSCTL_INT(_debug, OID_AUTO, vnlru_nowhere, CTLFLAG_RW,
 static void
 vntblinit(void *dummy __unused)
 {
+	u_int i;
 	int physvnodes, virtvnodes;

 	/*
@@ -332,6 +334,9 @@ vntblinit(void *dummy __unused)
 	syncer_maxdelay = syncer_mask + 1;
 	mtx_init(&sync_mtx, "Syncer mtx", NULL, MTX_DEF);
 	cv_init(&sync_wakeup, "syncer");
+	for (i = 1; i <= sizeof(struct vnode); i <<= 1)
+		vnsz2log++;
+	vnsz2log--;
 }
 SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_FIRST, vntblinit, NULL);

@@ -1067,6 +1072,14 @@ alloc:
 	}
 	rangelock_init(&vp->v_rl);

+	/*
+	 * For the filesystems which do not use vfs_hash_insert(),
+	 * still initialize v_hash to have vfs_hash_index() useful.
+	 * E.g., nullfs uses vfs_hash_index() on the lower vnode for
+	 * its own hashing.
+	 */
+	vp->v_hash = (uintptr_t)vp >> vnsz2log;
+
 	*vpp = vp;
 	return (0);
 }
2013-01-14 05:42:54 +00:00
Konstantin Belousov
f6af8e375c Add exported vfs_hash_index() function, which calculates the canonical
pre-masked hash for the given vnode.  The function assumes that
vp->v_hash is initialized by the filesystem vnode instantiation
function.  At the moment, it is only done if filesystem uses
vfs_hash_insert().

Reviewed by:	peter
Tested by:	peter, pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	5 days
2013-01-14 05:41:40 +00:00
Konstantin Belousov
7b982bc831 Rename vfs_hash_index() to vfs_hash_bucket().
Reviewed by:	peter
Tested by:	peter, pho
Sponsored by:	The FreeBSD Foundation
MFC after:	5 days
2013-01-14 05:40:21 +00:00
Alexander Motin
898a4b74f4 Windows driver writes relative volume IDs to metadata field. Use that value
as a hint for raid/rX device number to make it persistent across reboots.
2013-01-14 00:38:51 +00:00
Alexander Motin
f9462b9bbe - Add checks for Intel metadata version and attributes. Ignore disks with
unsupported metadata types like Intel Smart Response to not corrupt them.
 - Improve setting of these things during metadata writing to protect from
incapable BIOS'es and other implementations.
2013-01-13 23:00:40 +00:00
Adrian Chadd
233af52df2 If we're doing a kickpcu, make sure we flush the whole RX list rather than
stopping after 128 frames.

Whilst here, add in some code that lets me optionally flip back to the
original behaviour of calling ath_startrecv().
2013-01-13 22:41:58 +00:00
Aleksandr Rybalko
f101fd7fdc Enable syscons framebuffer support for bcm2835. It makes possible to run Xorg
on Raspberry Pi.
o convert mmap address to physical.
o add FBIOGTYPE ioctl handler - allow to get screen resolution by new
    xf86-video-scfb driver.
Originally designed for "Efika MX" project.

Sponsored by:	FreeBSD Foundation
2013-01-13 22:05:46 +00:00
Oleksandr Tymoshenko
0b5eb45655 Remove accidentally copypasted comment
Spotted by: gavin
2013-01-13 21:32:40 +00:00
Robert Watson
6a347d023b Merge Perforce changeset 219952 to head:
Make different bus attachments for Altera and Terasice
  device drivers share the same devclass_t.

Sponsored by:	DARPA, AFRL
2013-01-13 16:57:11 +00:00
Robert Watson
e360ca5ade Partially merge Perforce changeset 219944 to head:
Consistently use the vendor name "sri-cambridge" for device
  compatibility strings on the BERI platform.

Sponsored by:	DARPA, AFRL
2013-01-13 16:53:31 +00:00
Robert Watson
0a349699f4 Partially merge Perforce changeset 219942 to head:
Implement an FDT attachment for altera_avgen(4).

Portions of the changeset updating DTS and device.hints will be merged
separately.

Sponsored by:	DARPA, AFRL
2013-01-13 16:51:57 +00:00
Robert Watson
1925f29537 Merge Perforce changeset 219941 to head:
Copy altera_avgen(4) nexus attachment as a starting point for an
  FDT attachment.

Sponsored by:	DARPA, AFRL
2013-01-13 16:44:45 +00:00
Robert Watson
b364a5252e Merge Perforce changeset 219940 to head:
Rework altera_avgen(4) to cleanly(ish) separate nexus bus
  attachment from the driver itself.  This should allow us to
  plug in an fdt attachment more easily.

Sponsored by:	DARPA, AFRL
2013-01-13 16:43:59 +00:00
Robert Watson
86f4a437c9 Merge Perforce changeset 219939 to head:
Start restructuring of altera_avgen(4) so that it can have an FDT
  attachment -- this requires first properly breaking out the current
  nexus attachment from the driver implementation.

Sponsored by:	DARPA, AFRL
2013-01-13 16:41:25 +00:00
Robert Watson
1aef4ac1bc Partially merge Perforce changeset 219938 to head:
Write FDT attachment for the Terasic MTL (multitouch LCD) driver.
  Exploit the fact that FDT allows multiple memory ranges to be
  assigned to a device, giving us a cleaner description than
  device.hints does.

Portions of this changeset that remove mtl from BERI device.hints and
add to DTS will be merged separately.

Sponsored by:	DARPA, AFRL
2013-01-13 16:27:56 +00:00
Robert Watson
0eb420a37d Merge Perforce changeset 219937 to head:
Copy Terasic MTL nexus bus attachment as a starting point for an
  FDT attachment for the same driver.

Sponsored by:	DARPA, AFRL
2013-01-13 16:21:51 +00:00
Robert Watson
dc43fd8624 Partially merge Perforce changeset 219930 to head:
Add an Intel StrataFlash (isf) driver FDT attachment.

Portions of the original changeset hooking up FDT use for BERI will be
merged separately.

Sponsored by:	DARPA, AFRL
2013-01-13 16:20:40 +00:00
Robert Watson
a3b6a17c4b Merge Perforce changeset 219929 to head:
Replicate nexus attachment for isf(4) to become an FDT attachment.

Sponsored by:	DARPA, AFRL
2013-01-13 15:16:18 +00:00
Robert Watson
180ee20c4e Merge Perforce changeset 219927 to head:
Implement an FDT attachment for the Altera SD Card driver

Sponsored by:	DARPA, AFRL
2013-01-13 15:15:24 +00:00
Robert Watson
3cae0c3353 Merge Perforce changeset 219926 to head:
Copy Altera SDCard nexus attachment as a starting point for the FDT
  attachment.

Sponsored by:	DARPA, AFRL
2013-01-13 15:13:25 +00:00
Robert Watson
c4b4976dee Merge Perforce changeset 219922 to head:
Update nexus parts in copied DE4LED attachment to use FDT.

Sponsored by:	DARPA, AFRL
2013-01-13 15:12:35 +00:00
Robert Watson
1be4dfd49e Merge Perforce changeset 219921 to head:
Copy DE4 LED nexus bus attachment as a starting point for an FDT
  attachment.

Sponsored by:	DARPA, AFRL
2013-01-13 15:10:27 +00:00
Robert Watson
100bfa3f87 Merge Perforce changeset 219918 to head:
Naive first cut at an FDT bus attachment for the Altera JTAG UART.

Sponsored by:	DARPA, AFRL
2013-01-13 15:08:17 +00:00
Robert Watson
9d995792df Merge Perforce changeset 219917 to head:
Copy Altera JTAG UART nexus bus attachment as a starting point
  for an FDT bus attachment.

Sponsored by: DARPA, AFRL
2013-01-13 14:38:09 +00:00
Alexander Motin
b99586c25f Improve support for disabled disks. If disabled disk disconnected and then
reconnected back, leave it as disconnected. If new disk inserted instead of
disabled, rebuild it and leave as enabled.
2013-01-13 14:30:37 +00:00
Bryan Venteicher
ae366ffcbd Add VirtIO to the i386 and amd64 GENERIC kernels
This also removes the kludge from r239009 that covered only
the network driver.

Reviewed by:	grehan
Approved by:	grehan (mentor)
MFC after:	1 week
2013-01-13 07:14:16 +00:00
Alexander Motin
865aea63c3 Windows handles INIT and VERIFY as array-wide and it doesn't specify which
disks should be rebuilt. Our rebuild code is same time disk-centric.  To
handle this situation  properly check all disks for RBLD flags, and if no
disk specified try rebuild/resync all of them except newly inserted.
2013-01-12 21:51:49 +00:00
Sean Bruno
ca57f64f7d Quiesce a couple of clang warnings
Submitted by:	hiren panchasara <hiren.panchasara@gmail.com>
Obtained from:	Yahoo! Inc
2013-01-12 18:30:52 +00:00
Alexander Motin
4c95a24141 Implement migration from single disk to RAID1/IRRT for Intel metadata.
Windows driver uses such migration when it creates new arrays.  While GEOM
RAID has no mechanism to implement migration in general case, this specifc
case still can be handled easily via degraded RAID1 creation followed by
regular rebuild.
2013-01-12 18:25:48 +00:00
Alan Cox
fa12b7f6e0 Define VM_KMEM_SIZE_MAX as a fraction of the kernel address space size
rather than a constant so that VM_KMEM_SIZE_MAX will scale automatically
with the kernel address space size.  This is particularly important for
MIPS because the same definition is used by both 32- and 64-bit kernels.

Tested by:	jchandra
2013-01-12 18:06:21 +00:00
Robert Watson
2029d071db Merge Perforce changeset 219933 and portions of 219962 (omits changes to
unmerged BERI DTS files) to head:

  Use the OFW compatible string "mips,mips4k" rather than
  "mips4k,cp0" for interrupt control using MIPS4k CP0.

  Suggested by:   thompsa

  Implement a MIPS FDT PIC decode routine to use when no PIC has been
  configured, which assumes a cascade back to the nexus bus (e.g.,
  the on-board CP0 interrupt management parts on the MIPS).  If the
  soc bus in a MIPS DTS file is declared as "mips4k,cp0"-compatible,
  then this will be enabled.  This is sufficient to allow IRQs to be
  configured on BERI.

Sponsored by:	DARPA, AFRL
2013-01-12 16:09:33 +00:00
Steven Hartland
31e85bd9cd Fixed mbuf free when receive structures fail to allocate.
This prevents quad igb card on high core machines, without any nmbcluster or
igb queue tuning wedging the boot process if all nics are configured.

Reviewed by:	jfv
Approved by:	pjd (mentor)
MFC after:	1 week
2013-01-12 16:05:55 +00:00
Robert Watson
c36a1b5c66 Merge Perforce changeset 219925 to head:
Provided a bus_space implementation for FDT, modelled on
  bus_space_generic, but with a local version of the map address
  routine that does a P->V translation, as is the case with NLM's
  similar routine for XLP.  It's not clear to me that this is the
  right solution -- possibly this belongs in simplebus -- however,
  it is sufficient to get the DE4 LED driver working.

Sponsored by:	DARPA, AFRL
2013-01-12 15:58:20 +00:00
Robert Watson
0fe7f25666 Merge Perforce chance 219924 to head:
In a sign of weakness, replicate the MIPS bus_space_generic.c to
  produce a new FDT version, which will perform necessary address
  space translation for bus_space -- the solution used in NLM's MIPS
  FDT support, but possibly not quite the right thing.  This is
  inconsistent with regular I/O via the nexus and the generic
  bus_space, which instead perform translation via pmap_mapdev()
  when a resource is activated.  However, it will work while I
  attempt to identify what the right way to reconcile possible
  approaches.

  (Another approach might be to make simplebus use Nexus's activate
  routine instead of a generic one?)

Sponsored by:	DARPA, AFRL
2013-01-12 15:53:45 +00:00
Robert Watson
4d19b97f11 Merge Perforce change @219948 to head:
Add code so that the BERI boot process can ask the kernel linker for
  DTB blobs that may have been left for it by the boot loader, as done
  on PowerPC and ARM.  This will require both a more mature boot
  loader, and more mature boot loader argument passing mechanism,
  than currently supported on BERI.

Sponsored by:	DARPA, AFRL
2013-01-12 13:20:21 +00:00
Robert Watson
f73faab74b Merge Perforce change @219935 to head:
Initialise Openfirmware/FDT code earlier in the FreeBSD/beri boot,
  so that the results will be available for configuring the console
  UART (eventually).

  Suggested by:   thompsa

Sponsored by:	DARPA, AFRL
2013-01-12 12:34:59 +00:00
Alexander Motin
cda00e8ccd Freeze device queue before returning errors to CAM. This is required
for proper error recovery, including keeping original request order.

Reviewed by:	hselasky
2013-01-12 11:36:23 +00:00
Alexander Motin
26c538bc0b Add basic support for Intel Rapid Recover Technology (Intel RRT).
It is alike to RAID1, but with dedicating master and recovery disks and
providing manual control over synchronization.  It allows to use recovery
disk as snapshot of the master disk from the time of the last sync.

This implementation is not functionaly complete comparing to Windows,
but it is better then silent conversion to RAID1 on first boot.
2013-01-12 09:35:44 +00:00
Warner Losh
f30498a04b MFi386: Make similar changes that were made to atkbdc in r245315. 2013-01-11 23:42:24 +00:00
Warner Losh
0897438a74 Pass the device_t into atkbd_{probe,attach}_unit and get the
controller unit and keyboard unit from there. It will be needed
for other things in the future as well...
2013-01-11 21:42:23 +00:00
Warner Losh
f0143dac9a style(9) changes before I do more real changes. 2013-01-11 21:19:45 +00:00
Brooks Davis
32dd3b4a7a Bump __FreeBSD_version for install -N and (belatedly) nmtree. 2013-01-11 21:11:01 +00:00
Alexander Motin
c7cbfddd2b - Add missig xpt_schedule() call for cases when requested immediate CCB
priority is lower then payload/TUR one.

- Reduce TUR priority and avoid sending them if there are any other
outstanding commands, alike to DA driver.
2013-01-11 19:11:56 +00:00
Alexander Motin
d287278c44 Do not schedule periph for payload/TUR requests if reprobe is in progress
to avoid sending extra READ CAPACITY requests by dastart().  Schedule periph
again on reprobe completion, or otherwise it may stuck indefinitely long.

This should fix USB explore thread hanging on device unplug, waiting for
periph destruction.

Reported by:	hselasky
2013-01-11 16:10:11 +00:00
Xin LI
9e8bad8106 Add ID for Nuvoton WPCM450RA0BX found on Supermicro X9SCA-F motherboards.
While I'm there, also make this driver to attach to devices that have
an unknown device ID.

MFC after:	1 month
2013-01-11 10:22:09 +00:00
Andrey Zonov
cde4a72547 - Improve readability of sys_obreak().
Suggested by:	alc
Reviewed by:	alc
Approved by:	kib (mentor)
MFC after:	1 week
2013-01-11 09:58:35 +00:00
Konstantin Belousov
ddd6b3fc33 Add flags argument to vfs_write_resume() and remove
vfs_write_resume_flags().

Sponsored by:	The FreeBSD Foundation
2013-01-11 06:08:32 +00:00
Adrian Chadd
4c2f84b119 Place-holders for enable/active parameter flags. 2013-01-11 02:25:39 +00:00
Navdeep Parhar
c66c36a454 Overhaul the stid allocator so that it can be used for IPv6 servers
too.  The entry for an IPv6 server in the TCAM takes up the equivalent
of two ordinary stids and must be properly aligned too.

MFC after:	1 week
2013-01-11 00:07:01 +00:00
Warner Losh
d5cd45a38d Use better arm memory barrier 2013-01-11 00:03:19 +00:00
Navdeep Parhar
b174b65819 cxgbe(4): Add functions to help synchronize "slow" operations (those not
on the fast data path) and use them instead of frobbing the adapter lock
and busy flag directly.

Other changes made while reworking all slow operations:
- Wait for the reply to a filter request (add/delete).  This guarantees
  that the operation is complete by the time the ioctl returns.
- Tidy up the tid_info structure.
- Do not allow the tx queue size to be set to something that's not a
  power of 2.

MFC after:	1 week
2013-01-10 23:56:50 +00:00
Alexander Motin
f404e02afd Remove not very useful printf, that can be too chatty.
ASUS P8Z77-V board reports _AC2, _AC3 and _AC4 setpoints as 0C.  With active
cooling already automatically set to _AC2, that still caused driver to print
two useless lines about temperature above _AC3 and _AC4 every ten seconds.
Three setponts of 0C is probably a board bug, but the same spam could happen
also in correct case if system is runnign not with the lowest cooling level.
2013-01-10 21:38:31 +00:00
Xin LI
290a1ba9a4 The current ZFS code expects ddt_zap_count to always succeed by asserting
the underlying zap_count() to return no errors.  However, it is possible
that the pool reaches to such a state where zap_count would return error,
leading to panics when a pool is imported.

This commit changes the ddt_zap_count to return error returned from
zap_count and handle the error appropriately.  With this change, it's now
possible to let zpool rollback damaged transaction groups and import the
pool.

Obtained from:	ZFS on Linux github (e8fd45a0f9)
MFC after:	1 month
2013-01-10 19:26:56 +00:00
Warner Losh
81b450cfee Clang complains about the comparision of fak < 0 always being
false. It is right. Delete it because on the next line we catch all
'negative' cases with the test > 2, since 'negative' numbers are just
really big unsigned numbers and we do an identical action.
2013-01-10 18:51:35 +00:00
Konstantin Belousov
6b17595133 When nullfs mount is forcibly unmounted and nullfs vnode is reclaimed,
get back the leased write reference from the lower vnode.  There is no
other path which can correct v_writecount on the lowervp.

Reported by:	flo
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2013-01-10 18:24:48 +00:00
Andrey Zonov
3ac7d29722 - Reduce kernel size by removing unnecessary pointer indirections.
GENERIC kernel size reduced in 16 bytes and RACCT kernel in 336 bytes.

Suggested by:	alc
Reviewed by:	alc
Approved by:	kib (mentor)
MFC after:	1 week
2013-01-10 12:43:58 +00:00
Steven Hartland
1a71c5b935 Changed scsi_da device requests to use the sysctl tunable value for retry_count
and da_default_timeout where their current hardcoded values matched the current
default value for said tunables.

PR:		kern/169976
Reviewed by:	pjd (mentor)
Approved by:	mav
2013-01-10 12:25:00 +00:00
Steven Hartland
fd16fbdd70 Updates delete_method sysctl changes to always maintain disk d_flags
DISKFLAG_CANDELETE. While this change makes this layer consistent
other layers such as UFS and ZFS BIO_DELETE support may not notice
any change made manually via these device sysctls until the device
is reopened via a mount.

Also corrected var order in dadeletemethodsysctl

PR:		kern/169801
Reviewed by:	pjd (mentor)
Approved by:	mav
MFC after:	2 weeks
2013-01-10 11:57:46 +00:00
Steven Hartland
d8e8ee3177 Removes essentially unused variables from scsi_da probe setups
PR:		kern/169835
Reviewed by:	pjd (mentor)
Approved by:	mav
MFC after:	2 weeks
2013-01-10 11:28:12 +00:00
Hans Petter Selasky
bdf43bb5c3 Bugfix: Fix sizeof() argument.
Found by:	Haakon Loevdal
MFC after:	1 week
2013-01-10 08:06:12 +00:00
Hans Petter Selasky
60867f577a Fix detection of Razer Copperhead as a USB mouse.
Factor out USB mouse and keyboard detection logic.
Reject USB keyboards which have mouse alike HID items
in their HID descriptors.

Submitted by:	Matthew W
MFC after:	1 week
2013-01-10 07:45:46 +00:00
Andrey V. Elsukov
3ea87cb57f Simplify in6_setscope() function to get better performance.
Currently we use interface indeces as zone IDs for link-local and
interface-local scopes, and since we don't have any tool to configure
zone IDs, there is no need to acquire the afdata lock several times per
packet only to read if_index value.
So, now in6_setscope reads zone IDs for interface-local, link-local and
global scopes without a lock.

Sponsored by:	Yandex LLC
MFC after:	2 weeks
2013-01-10 00:10:24 +00:00
Navdeep Parhar
c9bfe3d179 cxgbe(4): updates to the configuration file that controls how hardware
resources are partitioned.

- Reduce the number of virtual interfaces reserved for PF4.  This leaves
  spare room in the source MAC table and allows the driver to setup
  filters that rewrite the source MAC address.

- Reduce the number of filters and use the freed up space for the CLIP
  (Compressed Local IPv6 addresses) table.  This is a prerequisite for
  IPv6 TOE support which will follow separately in a series of commits.

MFC after:	1 week
2013-01-09 21:27:14 +00:00
John Baldwin
6c0ef8957f Don't drop options from the third retransmitted SYN by default. If the
SYNs (or SYN/ACK replies) are dropped due to network congestion, then the
remote end of the connection may act as if options such as window scaling
are enabled but the local end will think they are not.  This can result in
very slow data transfers in the case of window scaling disagreements.

The old behavior can be obtained by setting the
net.inet.tcp.rexmit_drop_options sysctl to a non-zero value.

Reviewed by:	net@
MFC after:	2 weeks
2013-01-09 20:27:06 +00:00
Glen Barber
d28396ae13 Update where porters handbook lives.
MFC after:	3 days
2013-01-09 20:10:45 +00:00
Andrey V. Elsukov
6e9a5a5e52 Remove unneeded variable.
MFC after:	1 week
2013-01-09 18:54:58 +00:00
Hajimu UMEMOTO
164051cea5 Add no_prefer_iface option.
It stops treating the address on the interface as special by source
address selection rule even when the interface is outgoing interface.
This is desired in some situation.

Requested by:	hrs
Reviewed by:	IHANet folks including hrs
MFC after:	1 week
2013-01-09 18:18:08 +00:00
Kenneth D. Merry
744c26b250 Make CTL work a little better with loading and unloading drivers.
Previously CTL would leave individual LUNs enabled in the target
driver, whether or not the port as a whole was enabled.  It would
also leave the wildcard LUN enabled indefinitely.

This change means that CTL will enable and disable any active LUNs,
as well as the wildcard LUN, when enabling and disabling a port.

Also, fix a bug that could crop up due to an uninitialized CCB
type.

ctl.c:		Before calling ctl_frontend_online(), run through
		the LUN list and enable all active LUNs.

		After calling ctl_frontend_offline(), run through
		the LUN list and disble all active LUNs.

scsi_ctl.c:	Before bringing a port online, allocate the
		wildcard peripheral for that bus.  And after taking
		a port offline, invalidate the wildcard peripheral
		for that bus.

		Make sure that we hold the SIM lock around all
		calls to xpt_action() and other transport layer
		interfaces that require it.

		Use CAM_SIM_{LOCK|UNLOCK} consistently to acquire
		and release the SIM lock.

		Update a number of outdated comments.  Some of
		these should have been fixed long ago.

		Actually do LUN disbables now.  The newer drivers
		in the tree work correctly for this as far as I
		know.

		Initialize the CCB type to CTLFE_CCB_DEFAULT to
		avoid a panic due to uninitialized memory.

Submitted by:	Chuck Tuffli (partially)
MFC after:	1 week
2013-01-09 17:02:08 +00:00
Kenneth D. Merry
43ab9660c5 Fix a bug in the device pager code that can trigger an assertion
in devfs if a particular race condition is hit in the device pager
code.

This was a side effect of change 227530 which changed the device
pager interface to call a new destructor routine for the cdev.
That destructor routine, old_dev_pager_dtor(), takes a VM object
handle.

The object handle is cast to a struct cdev *, and passed into
dev_rel().

That works in most cases, except the case in cdev_pager_allocate()
where there is a race condition between two threads allocating an
object backed by the same device.  The loser of the race
deallocates its object at the end of the function.

The problem is that before inserting the object into the
dev_pager_object_list, the object's handle is changed from the
struct cdev pointer to the object's own address.  This is to avoid
conflicts with the winner of the race, which already inserted an
object in the list with a handle that is a pointer to the same cdev
structure.

The object is then passed to vm_object_deallocate(), and eventually
makes its way down to old_dev_pager_dtor().  That function passes
the handle pointer (which is actually a VM object, not a struct
cdev as usual) into dev_rel().  dev_rel() decrements the reference
count in the assumed struct cdev (which happens to be 0), and
that triggers the assertion in dev_rel() that the reference count
is greater than or equal to 0.

The fix is to add a cdev pointer to the VM object, and use that
pointer when calling the cdev_pg_dtor() routine.

vm_object.h:	Add a struct cdev pointer to the VM object
		structure.

device_pager.c:	In cdev_pager_allocate(), populate the new cdev
		pointer.

		In dev_pager_dealloc(), use the new cdev pointer
		when calling the object's cdev_pg_dtor() routine.

Reviewed by:	kib
Sponsored by:	Spectra Logic Corporation
MFC after:	1 week
2013-01-09 16:48:38 +00:00
Hans Petter Selasky
6799bce965 Change function argument type instead of casting.
Suggested by:	glebius @
2013-01-09 09:29:22 +00:00
Hans Petter Selasky
f3a2bb16ba Fix compile warning when using GCC:
Comparison between signed and unsigned.

MFC after:	1 week
2013-01-09 09:09:09 +00:00
Neel Natu
a68090f70c Get rid of gratuitous diff with respect to HEAD.
Obtained from:	NetApp
2013-01-09 03:52:03 +00:00
Neel Natu
8a60b77db8 IFC @ r245205 2013-01-09 03:32:23 +00:00
Neel Natu
1b54fbe69d IFC @ r245178 2013-01-09 02:26:50 +00:00
Neel Natu
95102a8bcb Add a "pause" to busy wait loops in the cpu reset path.
This should not matter much when running on bare metal but it makes the guest
more friendly when running inside a virtual machine.

Discussed with:	jhb
Obtained from:	NetApp
2013-01-09 02:11:16 +00:00
Olivier Houchard
6db9b3528e Define IPI_IRQ_START and IPI_IRQ_END. 2013-01-09 01:54:17 +00:00
Olivier Houchard
00100b0eec Use get_pcpu() instead of using pcpup, as it's wrong for SMP.
Submitted by:	Lukasz Plachno <luk@semihalf.com>
2013-01-09 01:52:28 +00:00
Andrey V. Elsukov
78c235c99f The in6_setscope() function determines the scope zone id of an address
and embeds it into address. Inside the kernel we keep addresses with
embedded zone id only for two scopes: link-local and interface-local.

For other scopes this function is nop in most cases. To reduce an
overhead of locking, first check that address is capable for embedding.
Also, handle the loopback address before acquire the lock.

Sponsored by:	Yandex LLC
MFC after:	1 week
2013-01-09 00:36:06 +00:00
Olivier Houchard
ac021d82d2 Remove old declarations. 2013-01-08 22:55:39 +00:00
Adrian Chadd
3aa1b9569d Fix format size. 2013-01-08 22:42:15 +00:00
Adrian Chadd
e1c562d83a Add support for triggering spectral scan upon a channel reset/change.
This is intended to support reporting FFT results during active channel
scans, for users who would like to fiddle around with writing applications
that do both FFT visualisation _and_ AP scanning.

* add a new ioctl to enable/trigger spectral scan at channel change/reset;
* set do_spectral consistently if it's enabled, so a channel set/reset
  will carry forth the correct PHY error configuration so frames
  are actually received;
* for NICs that don't do spectral scan, don't bother checking the
  spectral scan state on channel change/reset.

Tested:

* AR9280 - STA and scanning;
* AR5416 - STA, ensured that the SS code doesn't panic
2013-01-08 22:15:13 +00:00
Adrian Chadd
f29c6bdec5 If spectral scan is enabled, ensure radar report PHY errors are also
enabled.
2013-01-08 22:12:45 +00:00
Hans Petter Selasky
6317f31612 Shave off another register write to save some more
microseconds of PCI access time.

Tested by:	sos @
Submitted by:	sos @
MFC after:	1 week
2013-01-08 19:38:57 +00:00
Baptiste Daroussin
3d94054c30 Add support for IO_APPEND flag in fuse
This make open(..., O_APPEND) actually works on fuse filesystem.

Reviewed by:	attilio
2013-01-08 12:21:50 +00:00
Adrian Chadd
b8f699e9a8 Add in the missing radiotap definitions from the sipsolutions.net
radiotap "upstream" source.
2013-01-08 06:59:21 +00:00
Peter Grehan
fc1ae0bc42 Bring in some userboot changes from the bhyve branch to reduce diffs.
r238966
  Bump up the heap size to 1MB. With a few kernel modules, libstand
  zalloc and userboot seem to want to use ~600KB of heap space, which
  results in a segfault when malloc fails in bhyveload.

r241180
  Clarify comment about default number of FICL dictionary cells.

r241153
  Allow the number of FICL dictionary cells to be overridden.
  Loading a 7.3 ISO with userboot/amd64 takes up 10035 cells,
  overflowing the long-standing default of 10000.

  Bump userboot's value up to 15000 cells.

Reviewed by:	dteske (r238966,241180)
Obtained from:	NetApp
2013-01-08 03:27:37 +00:00
Oleksandr Tymoshenko
fdf78e7823 Switch default cache type for ARMv6/ARMv7 from write-through to
writeback-writeallocate
2013-01-08 02:40:20 +00:00
Oleksandr Tymoshenko
fdde618d1d Fix cache-related issue with pmap for ARMv6/ARMv7:
- Missing PTE_SYNC in pmap_kremove caused memory corruption
    in userland applications
- Fix lack of cache flushes when using special PTEs for zeroing or
    copying pages. If there are dirty lines for destination memory
    and page later remapped as a non-cached region actual content
    might be overwritten by these dirty lines when cache eviction
    happens as a result of applying cache eviction policy or because
    of wbinv_all call.
- icache sync for new mapping for userland applications.

Tested by: gber
2013-01-08 02:38:38 +00:00
Oleksandr Tymoshenko
5c79e1dd7d - Identify more devices for OMAP4 SoC (up to OMAP4470)
- Whitespace fixes
2013-01-07 23:30:53 +00:00
Jim Harris
43e35466de Revert r244549.
This change was originally intended to account for test kthreads under
the nvmecontrol process, but jhb indicated it may not be safe to
associate kthreads with userland processes and this could have
unintended consequences.

I did not observe any problems with this change, but my testing didn't
exhaust the kinds of corner cases that could cause problems.  It is not
that important to account for these test threads under nvmecontrol, so I
am just reverting this change for now.

On a related note, the part of this patch for <= 7.x fails compilation
so reverting this fixes that too.

Suggested by: jhb
2013-01-07 21:35:25 +00:00
Oleksandr Tymoshenko
c5d04c4c3b Implement barriers for AMRv6 and ARMv7
Submitted by:	Daisuke Aoyama <aoyama at peach.ne.jp>
Reviewed by:	ian, cognet
2013-01-07 20:36:51 +00:00
Gleb Smirnoff
f6eef2c2d6 - Add dashes before copyright notices.
- Add $FreeBSD$.
- Remove unused define.
2013-01-07 19:36:11 +00:00
Hans Petter Selasky
878b1fbdce Optimise the XHCI interrupt handling.
This patch will save CPU time when the XHCI interrupt is
shared with other devices.
Only check event rings when interrupt bits are set.
Otherwise would indicate hiding possible hardware fault(s).

Tested by:	sos @
Submitted by:	sos @
MFC after:	1 week
2013-01-07 16:38:13 +00:00
Pedro F. Giffuni
98f5c0d41a ext2fs: cleanup de dinode structure.
It was plagued with style errors and the offsets had been lost.
While here took the time to update the fields according to the
latest ext4 documentation.

Reviewed by:	bde
MFC after:	3 days
2013-01-07 03:36:32 +00:00
Oleksandr Tymoshenko
aa4f1f553a Release version check for erratum 727915 workaround in
l2_wbinv_range function implementation causes function
fail to flush caches for chip with RTL number 0x7. I failed
to find official PL310 revision with this RTL number
so further research on this matter required.
2013-01-07 02:38:36 +00:00
Gleb Kurtsou
4fd5efe79e tmpfs: Replace directory entry linked list with RB-Tree.
Use file name hash as a tree key, handle duplicate keys.  Both VOP_LOOKUP
and VOP_READDIR operations utilize same tree for search.  Directory
entry offset (cookie) is either file name hash or incremental id in case
of hash collisions (duplicate-cookies).  Keep sorted per directory list
of duplicate-cookie entries to facilitate cookie number allocation.

Don't fail if previous VOP_READDIR() offset is no longer valid, start
with next dirent instead.  Other file system handle it similarly.

Workaround race prone tn_readdir_last[pn] fields update.

Add tmpfs_dir_destroy() to free all dirents.

Set NFS cookies in tmpfs_dir_getdents(). Return EJUSTRETURN from
tmpfs_dir_getdents() instead of hard coded -1.

Mark directory traversal routines static as they are no longer
used outside of tmpfs_subr.c
2013-01-06 22:15:44 +00:00
Mateusz Guzik
43287e2753 lockmgr: unlock interlock (if requested) when dealing with upgrade/downgrade
requests for LK_NOSHARE locks, just like for shared locks.

PR:		kern/174969
Reviewed by:	attilio
MFC after:	1 week
2013-01-06 21:47:59 +00:00
Monthadar Al Jaberi
3fbbb3be4f Mips Atheros AR71XX: make PCI base slot configurable through hints.
* Mikrotik RouterBoard 433AH have PCI slot 18 wired to INT0 on the PCI Bus.
  This is different from e.g. Atheros PB42 and Ubiquiti boards.
* Check for hint hint.pcib.0.baseslot=X, where X is number of base slot;
* If hint not supplied print a warning and use default AR71XX_PCI_BASE_SLOT;

PR:		kern/174978
Approved by:	adrian (mentor)
2013-01-06 20:50:31 +00:00
Konstantin Belousov
a545089ed5 Protect the p->p_pgrp dereference with the process lock.
MFC after:	3 days
2013-01-06 15:10:10 +00:00
Peter Wemm
a116ec4b5e Juggle some internal symbols from our antique zlib (that originally came
in from kernel-pppd which is long gone) so that ZFS and DTRACE play nice.

This is a horrible hack to get freefall to compile, and is in dire need
of reconciliation.  This antique zlib-1.04 code needs to go away.
2013-01-06 14:59:59 +00:00
Neel Natu
03429e45a7 Revert changes for x2apic support from projects/bhyve.
During the early days of bhyve it did not support instruction emulation
which necessitated the use of x2apic to access the local apic. This is no
longer the case and the dependency on x2apic has gone away.

The x2apic patches can be considered independently of bhyve and will be
merged into head via projects/x2apic.

Discussed with:	grehan
2013-01-06 05:37:26 +00:00
Adrian Chadd
7ea3aada55 Handle ps-poll data frame if_transmit() failure.
If the data frame transmission failures, it may have a node reference
that needs cleaning up.

If the frame is marked as M_ENCAP then it should treat recvif as a node
reference and clear it.

Now - since the mbuf has been freed by calling if_transmit() (even on
failure), the mbuf has to be treated as invalid.  Hence why the ifp is
used.
2013-01-06 04:40:07 +00:00
Adrian Chadd
17b08c4368 Handle HWMP if_transmit() failure gracefully.
If if_transmit() fails, the node ref may need freeing.

This is based on the same logic used by the ageq, which the mesh code
(re) uses for frames which need to be staged before transmitting.
It also does the same thing - if M_ENCAP is set on the mbuf, it treats
the recvif pointer as a node reference and derefs it.
2013-01-06 04:38:31 +00:00
Andrew Turner
aa070dea50 Fix the build:
* Use pl310_softc when the softc is otherwise unavailable.
 * Use the correct spelling of sc_rtl_revision.
2013-01-06 01:17:36 +00:00
Andrew Turner
a4244dbff9 Only work around errata when we are on a part where the erratum applies.
Reviewed by:	gonzo
2013-01-06 00:42:09 +00:00
Oleksandr Tymoshenko
fd79f4a5a4 Export board serial and board revision obtained from FDT blob 2013-01-05 23:08:58 +00:00
Oleksandr Tymoshenko
e57c66d586 Add hw.board.serial and hw.board.revision for exporting board-specific info 2013-01-05 23:08:10 +00:00
Oleksandr Tymoshenko
706f28ae4b Fix background color calculation
Spotted by: ray@
2013-01-05 21:05:16 +00:00
Tim Kientzle
d7631c7111 Shuffle the TX underrun to work the same way as the RX underrun,
as suggested by YongHyeon PYUN.
2013-01-05 20:37:40 +00:00
Tim Kientzle
139dac05e2 Prefer the new NFS modules 2013-01-05 20:30:10 +00:00
Neel Natu
a09580e7a3 Teach the kernel to recognize that it is executing inside a bhyve virtual
machine.

Obtained from:	NetApp
2013-01-05 19:18:50 +00:00
Neel Natu
a61359a9a6 Add quirk to indicate that the bhyve hostbridge is capable of supporting
MSI and MSI-X even though it does not advertise the PCI-E capability
itself.

Obtained from:	NetApp
2013-01-05 18:48:23 +00:00
Tim Kientzle
ebc4238eea While trying to track down the root cause for
TX stalls in this driver, I've also had some
time to evaluate the effectiveness of different
watchdog strategies.

This is the latest attempt, which consolidates
all of the watchdog logic in one place and
consistently detects TX stalls and resets within
a couple of seconds.
2013-01-05 17:59:44 +00:00
Neel Natu
bf70b87555 Add macros required to enable VMX operation on Intel processors.
Obtained from:	NetApp
2013-01-05 04:20:14 +00:00
Neel Natu
2d28bff346 bhyve does not require a custom configuration file anymore so make the GENERIC
identical to the one in HEAD.

Obtained from:	NetApp
2013-01-05 03:35:30 +00:00
Neel Natu
1c211178a7 Get rid of workarounds to avoid ins/outs instructions emitted by the guest.
They can be emulated if needed in the future.

Obtained from:	NetApp
2013-01-05 02:10:27 +00:00
Benjamin Kaduk
5e9723e271 Fix some minor inaccuracies introduced in r243251.
Also correct the comment in kern_synch.c which was the source of the
problematic text.

Reviewed by:	kib (previous version)
Approved by:	hrs (mentor)
2013-01-05 00:23:26 +00:00
Hans Petter Selasky
d021dd19b6 Fix for "run0: wcid=xx out of range" error message.
MFC after:	1 week
PR:		usb/174963
Submitted by:	PseudoCylon <moonlightakkiy@yahoo.ca>
2013-01-04 20:44:17 +00:00
Neel Natu
46b1c55d9e IFC @ r244983. 2013-01-04 19:28:32 +00:00
Hiroki Sato
729e57723d Remove firewire devices missed in r244992. 2013-01-04 15:29:50 +00:00
David Xu
eea8d86d4d Revert revision 244760 because strncpy pads trailing space with zero,
this prevents kernel data from being leaked.

Noticed by: Joerg Sonnenberger &lt; joerg at britannica dot bec dot de &gt;
2013-01-04 11:11:12 +00:00
Yoshihiro Takahashi
bf5c6315c6 MFi386: r232521
Exclude USB drivers (except umass and ukbd) from main kernel image.
2013-01-04 09:52:09 +00:00
Konstantin Belousov
268dd286a0 Fix reversed condition in the assertion.
Pointy hat to:	kib
MFC after:	13 days
2013-01-04 07:52:47 +00:00
Adrian Chadd
55caa1df93 For PHY error frames, populate the configured channel flags rather than
based on the received frame.

PHY errors don't have the relevant HT or 40MHz MCS flag set.
2013-01-04 06:28:34 +00:00
Neel Natu
23ce7fedb4 There is no need for a special 'BHYVE' kernel configuration file anymore -
'GENERIC' works fine.

Obtained from:	NetApp
2013-01-04 03:02:43 +00:00
Neel Natu
014a52f3a6 There is no need for 'start_emulating()' and 'stop_emulating()' to be defined
in <machine/cpufunc.h> so remove them from there.

Obtained from:	NetApp
2013-01-04 02:49:12 +00:00
Neel Natu
5f0677d392 The "unrestricted guest" capability is a feature of Intel VT-x that allows
the guest to execute real or unpaged protected mode code - bhyve relies on
this feature to execute the AP bootstrap code.

Get rid of the hack that allowed bhyve to support SMP guests on processors
that do not have the "unrestricted guest" capability. This hack was entirely
FreeBSD-specific and would not work with any other guest OS.

Instead, limit the number of vcpus to 1 when executing on processors without
"unrestricted guest" capability.

Suggested by:	grehan
Obtained from:	NetApp
2013-01-04 02:04:41 +00:00
Marius Strobl
369109e254 Revert bogus part of r241740.
Reported by:	Michael Moll

MFC after:	3 days
2013-01-03 23:12:08 +00:00
Konstantin Belousov
9cf4c952ca Add the "nocache" nullfs mount option, which disables the caching of
the free nullfs vnodes, switching nullfs behaviour to pre-r240285.
The option is mostly intended as the last-resort when higher pressure
on the vnode cache due to doubling of the vnode counts is not
desirable.

Note that disabling the cache costs more than 2x wall time in the
metadata-hungry scenarious.  The default is "cache".

Tested and benchmarked by:	pho (previous version)
MFC after:	2 weeks
2013-01-03 19:17:57 +00:00
Konstantin Belousov
0dcbedfa61 Enable the UFS quotas for big-iron GENERIC kernels.
Discussed with:	      mckusick
MFC after:	      2 weeks
2013-01-03 19:03:41 +00:00
Adrian Chadd
5da4cc48ba Don't call the spectral methods for NICS that don't implement them. 2013-01-03 19:03:03 +00:00
Konstantin Belousov
d1c5e3f8b0 Remove the deprecated MNT_VNODE_FOREACH interface. Use the
MNT_VNODE_FOREACH_ALL instead.
2013-01-03 19:02:52 +00:00
Konstantin Belousov
6b54784391 Remove the last use of the deprecated MNT_VNODE_FOREACH interface in
the tree.

With the help from:	mjg
Tested by:	Ronald Klop <ronald-freebsd8@klop.yi.org>
MFC after:	2 weeks
2013-01-03 19:01:56 +00:00
Marius Strobl
f4131300c4 Remove files not connected to the build. It's confusing enough that
we still have two not quite the same evtchn.c left over.

MFC after:	3 day
2013-01-03 15:31:23 +00:00
Dag-Erling Smørgrav
36fca20f10 As discussed on -current last October, remove the firewire drivers from
GENERIC.
2013-01-03 14:30:24 +00:00
Marius Strobl
6f9767ac27 - Replace partially incorrect function names in panic(9) strings with
__func__ and add some missing ones.
- Remove a stale comment.
- Remove unused NUM_ELEMENTS macro.
- Remove extra empty lines.
- Use DEVMETHOD_END.
- Use NULL rather than 0 for pointers.

MFC after:	3 days
2013-01-03 13:44:25 +00:00
Marius Strobl
dcceabd344 - Fix !SMP build.
- Replace incorrect function names in printf(9) strings with __func__.
- Make xctrl_shutdown_reasons table const.
- Use nitems() rather than rolling an own version.
- Use DEVMETHOD_END.
- Use NULL rather than 0 for pointers.

MFC after:	3 days
2013-01-03 13:42:45 +00:00
Peter Wemm
8a1163e82f Temporarily revert rev 244678. This is causing loopback problems with
the lo (loopback) interfaces.
2013-01-03 10:21:28 +00:00
Marius Strobl
9355088a94 Fix !INVARIANTS && !SMP build.
MFC after:	3 days
2013-01-03 01:09:50 +00:00
Juli Mallett
161aae1a7a Use the right USB clock type on the EdgeRouter Lite. This fixes USB. 2013-01-02 23:29:54 +00:00
Juli Mallett
b29648facd Add basic support for the Ubiquiti EdgeRouter Lite.
Note that USB does not currently work, and the flash is connected via USB, so
local storage is not working.
2013-01-02 23:17:50 +00:00
Jack F Vogel
e1d6f7b47b Add Intel Lynx Point PCH SATA Controller Device IDs 2013-01-02 22:26:46 +00:00
Jack F Vogel
cf40e447b9 Add Intel Lynx Point PCH SMBus Device IDs 2013-01-02 22:01:26 +00:00
Jack F Vogel
9e81697fdf Add Intel Lynx Point PCH HD Audio Device IDs 2013-01-02 21:56:58 +00:00
Jack F Vogel
5531f5a148 Add support for new Intel Lynx Point PCH - Watchdog Timer Device IDs 2013-01-02 21:45:20 +00:00
Hans Petter Selasky
558e8c9878 Add missing dependancy.
Submitted by:	Michael Butler
MFC after:	1 week
2013-01-02 07:33:43 +00:00
Adrian Chadd
aaa4568321 Link if_ath_spectral.c into the build. 2013-01-02 04:00:54 +00:00
Adrian Chadd
9af351f9e8 Add a new (skeleton) spectral mode manager module. 2013-01-02 03:59:02 +00:00
Adrian Chadd
bcd2a42f0b Fix the short repeat option code to not flip the option to 0 when
we call this w/ NOVAL set.
2013-01-02 03:56:20 +00:00
Adrian Chadd
1535a81e5e Add spectral HAL accessor methods. 2013-01-02 01:40:23 +00:00
Adrian Chadd
c9b690d37a Add a method to explicitly disable radar reporting if required. 2013-01-02 01:36:10 +00:00
Adrian Chadd
e9d8a3ab4b Add missing update to link ar5416_spectral.c into the build. 2013-01-02 01:24:36 +00:00
Adrian Chadd
973d40776c Bring over the basic spectral scan framework code from Qualcomm Atheros.
This includes the HAL routines to setup, enable/activate/disable spectral
scan and configure the relevant registers.

This still requires driver interaction to enable spectral scan reporting.
Specifically:

* call ah_spectralConfigure() to configure and enable spectral scan;
* .. there's currently no way to disable spectral scan... that will have
  to follow.
* call ah_spectralStart() to force start a spectral report;
* call ah_spectralStop() to force stop an active spectral report.

The spectral scan results appear as PHY errors (type 0x5 on the AR9280,
same as radar) but with the spectral scan bit set (0x10 in the last byte
of the frame) identifying it as a spectral report rather than a radar
FFT report.

Caveats:

* It's likely quite difficult to run spectral _and_ radar at the same
  time.  Enabling spectral scan disables the radar thresholds but
  leaves radar enabled.  Thus, the driver (for now) needs to ensure
  that only one or the other is enabled.

* .. it needs testing on HT40 mode.

Tested:

* AR9280 in STA mode, HT/20 only

TODO:

* Test on AR9285, AR9287;
* Test in both HT20 and HT40 modes;
* .. all the driver glue.

Obtained from:	Qualcomm Atheros
2013-01-02 00:38:01 +00:00
Robert Watson
d8c7c88283 Merge @219932 from Perforce:
FDT headers can't be included if the kernel is compiled without
  FDT support, due to dependence on generated kobj headers.  BERI
  supports both FDT and non-FDT kernels.

  Spotted by:	bz
2013-01-01 19:42:06 +00:00
Tim Kientzle
5bf325556b Overhauled CPSW driver for TI CPSW Ethernet module
(as used in AM335x SoC for BeagleBone).

Among other things:
 * Watchdog reset doesn't hang the driver.
 * Disconnecting cable doesn't hang the driver.
 * ifconfig up/down doesn't hang the driver
 * Out-of-memory no longer panics the driver.

Known issues:
 * Doesn't have good support for fragmented packets
   (calls m_defrag() on TX, assumes RX packets are never fragmented)
 * Promisc and allmulti still unimplimented
 * addmulti and delmulti still unimplemented
 * TX queue still stalls (but watchdog now consistently recovers in ~5s)
 * No sysctl monitoring
 * Only supports port0
 * No switch configuration support
 * Not tested on anything but BeagleBone

Committed from: BeagleBone
2013-01-01 18:55:04 +00:00
Antoine Brodin
dfa4d7fdb9 Remove unneeded semicolons.
Reviewed by:	md5 of the object files
2013-01-01 18:16:49 +00:00
Konstantin Belousov
f99cb34c4f The process_deferred_inactive() function locks the vnodes of the ufs
mount, which means that is must not be called while the snaplock is
owned.  The vfs_write_resume(9) does call the function as the
VFS_SUSP_CLEAN() method, which is too early and falls into the region
still protected by snaplock.

Add yet another flag for the vfs_write_resume_flags() to avoid calling
suspension cleanup handler after the suspend is lifted, and use it in
the ffs_snapshot() call to vfs_write_resume.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2013-01-01 16:14:48 +00:00
Andrew Turner
5c9e101707 Document the known values of the RTL release field in the cache is register 2013-01-01 03:48:39 +00:00
Oleksandr Tymoshenko
72b5255edf Add interrupt for PL310 controller 2012-12-31 22:48:54 +00:00
Oleksandr Tymoshenko
7c5338d71e PL310 driver update:
- Add pl310.disable tunable to disable L2 cache altogether. In
    order to make sure that it's 100% disabled we use cache event
    counters for cache line eviction and read allocate events
    and panic if any of these counters increased. This is purely
    for debugging purpose
- Direct access DEBUG_CTRL and CTRL might be unavailable in
    unsecure mode, so use platform-specific functions for
    these registers
- Replace #if 1 with proper erratum numbers
- Add erratum 753970 workaround
- Remove wait function for atomic operations
- Protect cache operations with spin mutex in order to prevent race condition
- Disable instruction cache prefetch and make sure data cache
    prefetch is enabled in OMAP4-specific intialization
2012-12-31 21:19:44 +00:00
Oleksandr Tymoshenko
28009afbb4 Merge r234561 from busdma_machdep.c to ARMv6 version of busdma:
Interrupts must be disabled while handling a partial cache line flush,
as otherwise the interrupt handling code may modify data in the non-DMA
part of the cache line while we have it stashed away in the temporary
stack buffer, then we end up restoring a stale value.

PR:             160431
Submitted by:   Ian Lepore
2012-12-31 21:00:38 +00:00
Bjoern A. Zeeb
3d4ff5e9f0 Happy New Year 2013! 2012-12-31 11:22:55 +00:00
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