Commit Graph

77990 Commits

Author SHA1 Message Date
Konstantin Belousov
b38f7723eb In NFS clients, instead of inconsistently using #ifdef
DIAGNOSTIC and #ifndef DIAGNOSTIC for debug assertions, prefer
KASSERT(). Also change one #ifdef DIAGNOSTIC in the new nfs server.

Submitted by:	Mikolaj Golub <to.my.trociny gmail com>
MFC after:	2 weeks
2010-06-13 05:24:27 +00:00
Lawrence Stewart
5ad333cf62 Add a utility macro to simplify calculating an aggregate sum from a DPCPU
counter variable.

Sponsored by:	FreeBSD Foundation
Reviewed by:	jhb, rpaulo, rwatson (previous version of patch)
MFC after:	1 week
2010-06-13 02:39:55 +00:00
Navdeep Parhar
27d1c65e8e cxgb(4): add knob to get packet timestamps from the hardware.
The T3 ASIC can provide an incoming packet's timestamp instead of its RSS hash.
The timestamp is just a counter running off the card's clock.  With a 175MHz
clock an increment represents ~5.7ns and the 32 bit value wraps around in ~25s.

# sysctl -d dev.cxgbc.0.pkt_timestamp
dev.cxgbc.0.pkt_timestamp: provide packet timestamp instead of connection hash

# sysctl -d dev.cxgbc.0.core_clock
dev.cxgbc.0.core_clock: core clock frequency (in KHz)
# sysctl dev.cxgbc.0.core_clock
dev.cxgbc.0.core_clock: 175000
2010-06-12 22:33:04 +00:00
Navdeep Parhar
06eace6376 make format string a string literal.
Reported by:	clang
2010-06-12 22:24:39 +00:00
Nathan Whitehorn
ed6e65a2fe Make SMP work on MPC7400-based Apple desktops like the PowerMac3,3. 2010-06-12 21:14:22 +00:00
Konstantin Belousov
f1bb758d4b Add another variation of make_dev(9), make_dev_p(9), that is allowed
to fail and can return useful error code.

Requested by:	jh
Reviewed by:	imp, jh
MFC after:	3 weeks
2010-06-12 13:22:39 +00:00
Konstantin Belousov
76d43557d8 When make_dev_credf(MAKEDEV_WAITOK) is called, use
devctl_notify_f(M_WAITOK) for devfs notifications.

Suggested by:	jh
Reviewed by:	imp, jh
MFC after:	3 weeks
2010-06-12 13:21:25 +00:00
Konstantin Belousov
bebc339116 Add modifications of devctl_notify(9) functions that take flags. Use
flags to specify M_WAITOK/M_NOWAIT. M_WAITOK allows devctl to sleep for
the memory allocation.

As Warner noted, allowing the functions to sleep might cause
reordering of the queued notifications.

Reviewed by:	imp, jh
MFC after:	3 weeks
2010-06-12 13:20:38 +00:00
Alexander Motin
1440de203f Check general TSC presence before doing more specific checks and printfs. 2010-06-12 13:10:03 +00:00
Ed Schouten
6c9cdb5860 ANSIfy prototypes in subr_usbd.c.
Clang generates the following warnings when building subr_usbd.c:

| subr_usbd.c:598:13: warning: promoted type 'int' of K&R function
|   parameter is not compatible with the parameter type 'uint8_t' (aka
|   'unsigned char') declared in a previous prototype
| subr_usbd.c:627:13: warning: promoted type 'int' of K&R function
|   parameter is not compatible with the parameter type 'uint8_t' (aka
|   'unsigned char') declared in a previous prototype
| subr_usbd.c:649:13: warning: promoted type 'int' of K&R function
|   parameter is not compatible with the parameter type 'uint8_t' (aka
|   'unsigned char') declared in a previous prototype

Instead of just ANSIfying these three prototypes, do it for the entire
file.

Spotted by:	clang
2010-06-12 12:19:08 +00:00
Martin Matuska
bc5752e811 Fix arc_read_done may try to byteswap undefined data (sparc related)
OpenSolaris onnv-revision:	10839:cf83b553a2ab

Obtained from:	OpenSolaris (Bug ID 6836714)
Approved by:	pjd, delphij (mentor)
MFC after:	3 days
2010-06-12 11:28:46 +00:00
Martin Matuska
726db0af89 Fix panic in zfs_getsecattr
OpenSolaris onnv-revision:	10295:f7a18a1e9610

Obtained from:	OpenSolaris (Bug ID 6870564)
Approved by:	pjd, delphij (mentor)
MFC after:	3 days
2010-06-12 11:27:10 +00:00
Martin Matuska
9dac494ce6 Fix possible zfs panic on zpool import
OpenSolaris onnv-revision:	10040:38b25aeeaf7a

Obtained from:	OpenSolaris (Bug ID 6857012)
Approved by:	pjd, delphij (mentor)
MFC after:	3 days
2010-06-12 11:25:57 +00:00
Martin Matuska
16547ea20b Fix zpool resilver stalls with spa_scrub_thread in a 3 way deadlock
OpenSolaris onnv-revision:	9997:174d75a29a1c

Obtained from:	OpenSolaris (Bug ID 6843235)
Approved by:	pjd, delphij (mentor)
MFC after:	3 days
2010-06-12 11:24:10 +00:00
Martin Matuska
072b6fc60e Fix ZFS panic deadlock: cycle in blocking chain via zfs_zget
OpenSolaris onnv-revision:	9774:0bb234ab2287

Obtained from:	OpenSolaris (Bug ID 6788152)
Approved by:	pjd, delphij (mentor)
MFC after:	3 days
2010-06-12 11:22:45 +00:00
Martin Matuska
1aa2ebdd23 Fix vdev_probe() starvation brings txg train to a screeching halt
OpenSolaris onnv-revision:	9722:e3866bad4e96

Obtained from:	OpenSolaris (Bug ID 6844069)
Approved by:	pjd, delphij (mentor)
MFC after:	3 days
2010-06-12 11:21:37 +00:00
Martin Matuska
a2d6c8d15b Fix incomplete resilvering after disk replacement (raidz)
OpenSolaris onnv-revision:	9434:3bebded7c76a

Obtained from:	OpenSolaris (Bug ID 6794570)
Approved by:	pjd, delphij (mentor)
MFC after:	3 days
2010-06-12 11:20:50 +00:00
Martin Matuska
b90308c521 Fix zfs destroy fails to free object in open context, stops up txg train
OpenSolaris onnv-revision:	9409:9dc3f17354ed

Obtained from:	OpenSolaris (Bug ID 6809683)
Approved by:	pjd, delphij (mentor)
MFC after:	3 days
2010-06-12 11:19:51 +00:00
Martin Matuska
62c55b6d08 Fix unable to remove a file over NFS after hitting refquota limit
OpenSolaris onnv-revision:	8890:8c2bd5f17bf2

Obtained from:	OpenSolaris (Bug ID 6798878)
Approved by:	pjd, delphij (mentor)
MFC after:	3 days
2010-06-12 11:18:29 +00:00
Ed Schouten
6ea677604a Remove GNU-style struct initialization.
Spotted by:	clang
Approved by:	rpaulo
2010-06-12 07:02:43 +00:00
Marcel Moolenaar
d87d5bbf82 The ptc.g operation for the Mckinley and Madison processors has the
side-effect of purging more than the requested translation. While
this is not a problem in general, it invalidates the assumption made
during constructing the trapframe on entry into the kernel in SMP
configurations. The assumption is that only the first store to the
stack will possibly cause a TLB miss. Since the ptc.g purges the
translation caches of all CPUs in the coherency domain, a ptc.g
executed on one CPU can cause a purge on another CPU that is
currently running the critical code that saves the state to the
trapframe. This can cause an unexpected TLB miss and with interrupt
collection disabled this means an unexpected data nested TLB fault.

A data nested TLB fault will not save any context, nor provide a
way for software to determine what caused the TLB miss nor where
it occured. Careful construction of the kernel entry and exit code
allows us to handle a TLB miss in precisely orchastrated points
and thereby avoiding the need to wire the kernel stack, but the
unexpected TLB miss caused by the ptc.g instructution resulted in
an unrecoverable condition and resulting in machine checks.

The solution to this problem is to synchronize the kernel entry
on all CPUs with the use of the ptc.g instruction on a single CPU
by implementing a bare-bones readers-writer lock that allows N
readers (= N CPUs entering the kernel) and 1 writer (= execution
of the ptc.g instruction on some CPU). This solution wins over
a rendez-vous approach by not interrupting CPUs with an IPI.

This problem has not been observed on the Montecito.

PR:		ia64/147772
MFC after:	6 days
2010-06-12 01:45:29 +00:00
Jung-uk Kim
bc8e0a9a4b Apply band-aid around function-like macro fdrop() without turning it into
a real (inline) function or applying void casting for all its consumers.
In most of places, the "return value" is not checked nor assigned, which
causes too many warnings for some smart compilers, i.e., clang.

Found by:	clang
2010-06-11 23:38:25 +00:00
Jack F Vogel
e6ec2d1fa6 Put back the lost bus_describe_intr() calls. 2010-06-11 21:35:19 +00:00
Jack F Vogel
91c0189dc0 Change the mbuf memory calls back to NOWAIT as a
problem has been seen in one case with doing the
M_WAITOK
2010-06-11 20:59:29 +00:00
Jack F Vogel
2e6bd30b46 Add a couple fixes from Michael Tuexen.
Remove unneeded rxtx handler, make que handler generic.
Do not allocate header mbufs in rx ring if not doing hdr split.
Release the lock in rxeof call to stack.

MFC for 8.1 asap
2010-06-11 20:54:27 +00:00
Jung-uk Kim
7b2d603ef0 Fix one more case where a string is passed via format argument instead.
Found by:	clang
2010-06-11 20:08:20 +00:00
Jung-uk Kim
2e1bf57ca8 Simplify a function for getting brightness levels. 2010-06-11 19:58:41 +00:00
Jung-uk Kim
30363a9a9e Remove unused assignment.
Found by:	clang static analyzer
Found by:	Coverity Prevent[tm] (CID 4537, 4538, 4539)
2010-06-11 19:53:42 +00:00
Andriy Gapon
1bdfff2252 fix a few cases where a string is passed via format argument instead of
via %s

Most of the cases looked harmless, but this is done for the sake of
correctness.  In one case it even allowed to drop an intermediate buffer.

Found by:	clang
MFC after:	2 week
2010-06-11 19:27:21 +00:00
Jack F Vogel
0301599d3d Remove a disable_queue from the beginning of the
interrupt handler, automask handles it.
Also, add in msix vector descriptions.

MFC for 8.1 asap
2010-06-11 19:03:59 +00:00
John Baldwin
3aa6d94e0c Update several places that iterate over CPUs to use CPU_FOREACH(). 2010-06-11 18:46:34 +00:00
Andriy Gapon
d89c217f30 ffs_softdep: change K&R in function defintions to ANSI prototypes
Apparently it's bad when we first have an ANSI prototype in function
declaration, but then use K&R in its defintion.

Complaint from:	clang
MFC after:	2 weeks
2010-06-11 18:26:53 +00:00
Andriy Gapon
df17ff6130 vnode.h: expand debug macros to non-empty void statements when
DEBUG_VFS_LOCKS is disabled

MFC after:	2 weeks
2010-06-11 18:20:56 +00:00
Jung-uk Kim
80fba82198 Fix a possible dereference of null pointer.
Found by:	clang static analyzer
Found by:	Coverity Prevent[tm] (CID 3423)
2010-06-11 18:19:23 +00:00
Matthew D Fleming
d19511c357 Add INVARIANTS checking that numfreebufs values are sane. Also add a
per-buf flag to catch if a buf is double-counted in the free count.
This code was useful to debug an instance where a local patch at Isilon
was incorrectly managing numfreebufs for a new buf state.

Reviewed by:	jeff
Approved by:	zml (mentor)
2010-06-11 17:03:26 +00:00
John Baldwin
e762f66672 Add helper macros to iterate over available CPUs in the system.
CPU_FOREACH(i) iterates over the CPU IDs of all available CPUs.  The
CPU_FIRST() and CPU_NEXT(i) macros can also be used to iterate over
available CPU IDs.  CPU_NEXT(i) wraps around to CPU_FIRST() rather than
returning some sort of terminator.

Requested by:	rwatson
Reviewed by:	attilio
2010-06-11 15:56:18 +00:00
Alan Cox
9124d0d6a3 Relax one of the new assertions in pmap_enter() a little. Specifically,
allow pmap_enter() to be performed on an unmanaged page that doesn't have
VPO_BUSY set.  Having VPO_BUSY set really only matters for managed pages.
(See, for example, pmap_remove_write().)
2010-06-11 15:49:39 +00:00
Ivan Voras
c1e34abff8 In another move to join with the age of the Fruitbat, increase SYSV
shared resources defaults beyond absolute minimums.

The new values are chosen mostly by magic. They are still fairly
small and will need increasing for large installations (especially
SHMMAX). However, they are now enough to e.g. start PostgreSQL
installations with ~~300 users and nearly 512 MB of shared buffers.

Reviewed by:	A short discussion on hackers@
2010-06-11 09:27:33 +00:00
Randall Stewart
ec4c19fcf0 3 Fixes -
a) There was a case where a ICMP message could cause
   us to return leaving a stuck lock on an stcb.
b) The iterator needed some tweaks to fix its lock
   ordering.
c) The ITERATOR_LOCK is no longer needed in the freeing
   of a stcb. Now that the timer based one is gone we don't
   have a multiple resume situation. Add to that that there
   was somewhere a path out of the freeing of an assoc that
   did NOT release the iterator_lock.. it was time to clean
   this old code up and in the process fix the lock bug.

MFC after:	1 week
2010-06-11 03:54:00 +00:00
Marcel Moolenaar
f635c047c5 Bump MAX_BPAGES from 256 to 1024. It seems that a few drivers, bge(4)
in particular, do not handle deferred DMA map load operations at all.
Any error, and especially EINPROGRESS, is treated as a hard error and
typically abort the current operation. The fact that the busdma code
queues the load operation for when resources (i.e. bounce buffers in
this particular case) are available makes this especially problematic.
Bounce buffering, unlike what the PR synopsis would suggest, works
fine.

While on the subject, properly implement swi_vm().

PR:		147502
MFC after:	1 week
2010-06-11 03:00:32 +00:00
Tai-hwa Liang
ca765120a8 Fixing compilation bustage by adding the missing && back. 2010-06-11 01:32:42 +00:00
Rui Paulo
2bc3bd71de Some odd APs send beacons on the same TX queue as non-beacons. This breaks
802.11 duplicate detection. Upon looking at the standard, we discover
that 802.11-2007 says:
"A receiving QoS STA is also required to keep only the most recent
cache entry per<Address 2, TID, sequence-number>  triple, storing only
the most recently received fragment number for that triple. A receiving
STA may omit tuples obtained from broadcast/multicast or ATIM frames
from the cache."

To fix this, we just disable duplicate detection for multicast/broadcast
frames.

Reviewed by:	sam
MFC after:	4 weeks
Obtained from:	DragonFly
2010-06-10 20:58:34 +00:00
Rui Paulo
dd7fc6998b Add missing braces.
Submitted by:	sam
MFC after:	3 days
2010-06-10 20:40:38 +00:00
Matt Jacob
8340692f44 Don't pass a buffer directly as a printflike format string.
Found by: clang
MFC after:	1 month
2010-06-10 19:38:07 +00:00
Alexander Kabaev
60743cbd22 Do not require pos parameter to be zero in MAP_ANONYMOUS mmap requests
in Linux emulation layer. Linux seems to only require that pos is
page-aligned, but otherwise ignores it. Default FreeBSD mmap parameter
checking is too strict to allow some Linux binaries to run. tsMuxeR is
one example of such a binary.

Discussed with:	jhb
MFC after:	1 week
2010-06-10 17:59:47 +00:00
Edward Tomasz Napierala
7ce513a52a Untangle g_print_bio(), silencing Coverity.
Found with:	Coverity Prevent
CID:		3566, 3567
2010-06-10 17:49:36 +00:00
Alexander Motin
ae834fc9ba Do not disable edge-triggered interrupts before migration. DELAY() with
interrupt disabled highly probable causes interrupt loss.
2010-06-10 17:04:01 +00:00
Alan Cox
ce18658792 Reduce the scope of the page queues lock and the number of
PG_REFERENCED changes in vm_pageout_object_deactivate_pages().
Simplify this function's inner loop using TAILQ_FOREACH(), and shorten
some of its overly long lines.  Update a stale comment.

Assert that PG_REFERENCED may be cleared only if the object containing
the page is locked.  Add a comment documenting this.

Assert that a caller to vm_page_requeue() holds the page queues lock,
and assert that the page is on a page queue.

Push down the page queues lock into pmap_ts_referenced() and
pmap_page_exists_quick().  (As of now, there are no longer any pmap
functions that expect to be called with the page queues lock held.)

Neither pmap_ts_referenced() nor pmap_page_exists_quick() should ever
be passed an unmanaged page.  Assert this rather than returning "0"
and "FALSE" respectively.

ARM:

Simplify pmap_page_exists_quick() by switching to TAILQ_FOREACH().

Push down the page queues lock inside of pmap_clearbit(), simplifying
pmap_clear_modify(), pmap_clear_reference(), and pmap_remove_write().
Additionally, this allows for avoiding the acquisition of the page
queues lock in some cases.

PowerPC/AIM:

moea*_page_exits_quick() and moea*_page_wired_mappings() will never be
called before pmap initialization is complete.  Therefore, the check
for moea_initialized can be eliminated.

Push down the page queues lock inside of moea*_clear_bit(),
simplifying moea*_clear_modify() and moea*_clear_reference().

The last parameter to moea*_clear_bit() is never used.  Eliminate it.

PowerPC/BookE:

Simplify mmu_booke_page_exists_quick()'s control flow.

Reviewed by:	kib@
2010-06-10 16:56:35 +00:00
Andrey V. Elsukov
6c0a2eb136 Style(9) fixes:
* Sort includes
* Replace #define<SPACE> to #define<TAB>
* Split declarations and initializations
* Split long lines

Requested by:	kib
Approved by:	kib (mentor)
MFC after:	1 month
2010-06-10 16:45:30 +00:00
Alexander Motin
1f255bd340 Store interrupt trap frame into struct thread. It allows interrupt handler
to obtain both trap frame and opaque argument submitted on registrction.
After kernel and all drivers get used to it, legacy hack can be removed.

Reviewed by:	jhb@
2010-06-10 16:14:05 +00:00