mav [Wed, 20 Jun 2012 18:25:51 +0000 (18:25 +0000)]
Check status of cam_periph_hold() inside cdclose(). If cd device was
invalidated while open, cam_periph_hold() will return error and won't
get the reference. Following reference release will crash the system.
jhb [Wed, 20 Jun 2012 18:00:26 +0000 (18:00 +0000)]
Move the per-thread deferred user map entries list into a private list
in vm_map_process_deferred() which is then iterated to release map entries.
This avoids having a nested vm map unlock operation called from the loop
body attempt to recuse into vm_map_process_deferred(). This can happen if
the vm_map_remove() triggers the OOM killer.
ken [Wed, 20 Jun 2012 17:08:00 +0000 (17:08 +0000)]
Fix several reference counting and object lifetime issues between
the pass(4) and enc(4) drivers and devfs.
The pass(4) driver uses the destroy_dev_sched() routine to
schedule its device node for destruction in a separate thread
context. It does this because the passcleanup() routine can get
called indirectly from the passclose() routine, and that would
cause a deadlock if the close routine tried to destroy its own
device node.
In any case, once a particular passthrough driver number, e.g.
pass3, is destroyed, CAM considers that unit number (3 in this
case) available for reuse.
The problem is that devfs may not be done cleaning up the previous
instance of pass3, and will panic if isn't done cleaning up the
previous instance.
The solution is to get a callback from devfs when the device node
is removed, and make sure we hold a reference to the peripheral
until that happens.
Testing exposed some other cases where we have reference counting
issues, and those were also fixed in the pass(4) driver.
cam_periph.c: In camperiphfree(), reorder some of the operations.
The peripheral destructor needs to be called before
the peripheral is removed from the peripheral is
removed from the list. This is because once we
remove the peripheral from the list, and drop the
topology lock, the peripheral number may be reused.
But if the destructor hasn't been called yet, there
may still be resources hanging around (like devfs
nodes) that haven't been fully cleaned up.
cam_xpt.c: Add an argument to xpt_remove_periph() to indicate
whether the topology lock is already held.
scsi_enc.c: Acquire an extra reference to the peripheral during
registration, and release it once we get a callback
from devfs indicating that the device node is gone.
Call destroy_dev_sched_cb() in enc_oninvalidate()
instead of calling destroy_dev() in the cleanup
routine.
scsi_pass.c: Add reference counting to handle peripheral and
devfs object lifetime issues.
Add a reference to the peripheral and the devfs
node in the peripheral registration.
Don't attempt to add a physical path alias if the
peripheral has been marked invalid.
Release the devfs reference once the initial
physical path alias taskqueue run has completed.
Schedule devfs node destruction in the
passoninvalidate(), and release our peripheral
reference in a new routine, passdevgonecb() once
the devfs node is gone. This allows the peripheral
to fully go away, and the peripheral destructor,
passcleanup(), will get called.
kevlo [Wed, 20 Jun 2012 02:21:53 +0000 (02:21 +0000)]
Fix potential symlink race condition in "rm -P" by adding a check
that the file we have opened is the one we expected. Also open in
non-blocking mode to avoid a potential hang with FIFOs.
scottl [Wed, 20 Jun 2012 00:17:29 +0000 (00:17 +0000)]
Update the 'fwdownload' command to also flash disks connected over an
ATA/SATA transport. The detection logic is automatic, so it should Just
Work. While here, also improve the progress meter that is displayed
during firmware download.
Submitted by: Alistair Crooks
Obtained from: Netflix, Inc.
MFC after: 3 days
pjd [Tue, 19 Jun 2012 22:21:59 +0000 (22:21 +0000)]
The falloc() function obtains two references to newly created 'fp'.
On success we have to drop one after procdesc_finit() and on failure
we have to close allocated slot with fdclose(), which also drops one
reference for us and drop the remaining reference with fdrop().
Without this change closing process descriptor didn't result in killing
pdfork(2)ed child.
jhb [Tue, 19 Jun 2012 18:42:24 +0000 (18:42 +0000)]
Further refine the implementation of POSIX_FADV_NOREUSE.
First, extend the changes in r230782 to better handle the common case
of using NOREUSE with sequential reads. A NOREUSE file descriptor
will now track the last implicit DONTNEED request it made as a result
of a NOREUSE read. If a subsequent NOREUSE read is adjacent to the
previous range, it will apply the DONTNEED request to the entire range
of both the previous read and the current read. The effect is that
each read of a file accessed sequentially will apply the DONTNEED
request to the entire range that has been read. This allows NOREUSE
to properly handle misaligned reads by flushing each buffer to cache
once it has been completely read.
Second, apply the same changes made to read(2) by r230782 and this
change to writes. This provides much better performance in the
sequential write case as it allows writes to still be clustered. It
also provides much better performance for misaligned writes. It does
mean that NOREUSE will be generally ineffective for non-sequential
writes as the current implementation relies on a future NOREUSE
write's implicit DONTNEED request to flush the dirty buffer from the
current write.
jhb [Tue, 19 Jun 2012 16:06:27 +0000 (16:06 +0000)]
Add a 'wmask' variable to hold the expression '(1ul << w->step) - 1' in
pcib_grow_window(). This makes the code slightly easier to read and
prevents the type of bug fixed in r237271.
jhb [Tue, 19 Jun 2012 15:15:35 +0000 (15:15 +0000)]
Fix another off-by-one error in the previous fix so that the new start
address is properly aligned. While here, use a simpler expression to
align the new end address that we use elsewhere for aligning the end.
alc [Tue, 19 Jun 2012 08:12:44 +0000 (08:12 +0000)]
Condition the implementation of pv_entry_count on PV_STATS. On amd64,
pv_entry_count is purely informational. It does not serve any functional
purpose.
np [Tue, 19 Jun 2012 07:34:13 +0000 (07:34 +0000)]
- Updated TOE support in the kernel.
- Stateful TCP offload drivers for Terminator 3 and 4 (T3 and T4) ASICs.
These are available as t3_tom and t4_tom modules that augment cxgb(4)
and cxgbe(4) respectively. The cxgb/cxgbe drivers continue to work as
usual with or without these extra features.
- iWARP driver for Terminator 3 ASIC (kernel verbs). T4 iWARP in the
works and will follow soon.
Build-tested with make universe.
30s overview
============
What interfaces support TCP offload? Look for TOE4 and/or TOE6 in the
capabilities of an interface:
# ifconfig -m | grep TOE
Enable/disable TCP offload on an interface (just like any other ifnet
capability):
# ifconfig cxgbe0 toe
# ifconfig cxgbe0 -toe
Which connections are offloaded? Look for toe4 and/or toe6 in the
output of netstat and sockstat:
# netstat -np tcp | grep toe
# sockstat -46c | grep toe
Reviewed by: bz, gnn
Sponsored by: Chelsio communications.
MFC after: ~3 months (after 9.1, and after ensuring MFC is feasible)
sbruno [Mon, 18 Jun 2012 23:18:49 +0000 (23:18 +0000)]
Document support for Intel Enhanced Speedstep Tech interface
of cpufreq(4) via a new man page est(4)
Document the two exposed tuneables of est(4).
I'd appreciate more reviews of content if possible. I gleaned
the information contained herein from sys/x86/cpufreq/est.c and
the Intel reference documentation
rmacklem [Mon, 18 Jun 2012 22:17:28 +0000 (22:17 +0000)]
Fix the NFSv4 client for the case where mmap'd files are
written, but not msync'd by a process. A VOP_PUTPAGES()
called when VOP_RECLAIM() happens will usually fail, since
the NFSv4 Open has already been closed by VOP_INACTIVE().
Add a vm_object_page_clean() call to the NFSv4 client's
VOP_INACTIVE(), so that the write happens before the NFSv4
Open is closed. kib@ suggested using vgone() instead and
I will explore this, but this patch fixes things in the
meantime. For some reason, the VOP_PUTPAGES() is still
attaempted in VOP_RECLAIM(), but having this fail doesn't
cause any problems except a "stateid0 in write" being logged.
kib [Mon, 18 Jun 2012 21:08:48 +0000 (21:08 +0000)]
Adjust the fix in r236953, by not generating the signal manually, but
performing the return to usermode using full return path. This
consolidates the handling of exceptional situations in less number of
places, and is less code as well.
marius [Mon, 18 Jun 2012 20:19:07 +0000 (20:19 +0000)]
Revert r236529, re-enabling verification of the flashed content as
the underlying problem was dealt with in r237239 (in fact, disabling
verification also actually only made the problem less likely to occur).
marius [Mon, 18 Jun 2012 20:14:42 +0000 (20:14 +0000)]
Revert the part of r236495 that introduced checking of SPI_SR_TXEMPTY
for TX transfer completion as for reasons unknown this occasionally
causes SPI_SR_RXBUFF and SPI_SR_ENDRX to not rise.
In any case, once the RX part of the transfer is done it's obvious
that the preceding TX part had finished and checking of SPI_SR_TXEMPTY
was introduced to rule out a possible cause for the data corruption
mentioned in r236495 but which didn't turn out to be the problem
anyway.
alc [Mon, 18 Jun 2012 16:21:59 +0000 (16:21 +0000)]
Add PV chunk and list locking to pmap_page_exists_quick(),
pmap_page_is_mapped(), and pmap_remove_pages(). These functions
are no longer serialized by the pvh global lock.
melifaro [Mon, 18 Jun 2012 13:56:36 +0000 (13:56 +0000)]
Make radix lookup on src and dst flow addresses optional
and configurable on per-interface basis.
Remove __inline__ for several functions being called once per
flow (e.g once per 10-20 packets on common traffic flows).
Update manual page to simplify search for BPF data link types.
adrian [Mon, 18 Jun 2012 02:08:04 +0000 (02:08 +0000)]
Extend the radiotap code to be aware of the size of any extra vendor
bitmaps that may occur.
The way this works is:
* the beginning of the radiotap frame has a 32 bit "radiotap" namespace
bitmap;
* if the vendor bitmap bit is set, then the next bitmap will be interpreted
as a vendor bitmap;
* this can keep going on and on (ie, more vendor and radiotap namespace
bitmaps can be added) until the last bitmap with no "more bitmaps" set.
Now, the radiotap code gets its grubby fingers into the supplied
radiotap rx/tx buffer and replaces the channel configuration
for each frame. I don't know why it's not up to the drivers themselves
to do this, but I digress. So, if a vendor bitmap (or two, etc) exists,
the offset calculations will be all completely wrong.
This particular patch introduces ieee80211_radiotap_attachv(), which
includes the number of vendor bitmaps (well, any other bitmaps, vendor
or otherwise) between the end of the bitmap/header and the start of the
actual radiotap field entries. This makes the radiotap calculations
"right", so it correctly calculates where to overwrite the channel
configuration.
The long term fix is to go through and make each driver update the channel
configuration, as some of the fields are already being updated.
That, however, is a longer term fix that will need each driver fixed.
I leave that as an exercise to someone in the future.
mjacob [Sun, 17 Jun 2012 21:39:40 +0000 (21:39 +0000)]
Prepare for FC-Tape support. This involved doing a lot of little cleanups
and crosschecks against firmware documentation. We now check and report
FC firmware attributes and at least are now prepared for the upper 48 bits
of f/w attributes (which are probably for the 8100 or later cards). This
involed changing how inbits and outbits are calculated for varios commands,
hopefully clearer and cleaner. This also caused me to clean up the actual
mailbox register usage. Finally, we are now unconditionally using a CRN
for initiator mode.
A longstanding issue with the 2400/2500 is that they do *not* support
a "Prefer PTP followed by loop", which explains why enabling that
caused the f/w to crash.
A slightly more invasive change is to let the firmware load entirely
drive whether multi_id support is enabled or not.
pjd [Sun, 17 Jun 2012 21:04:22 +0000 (21:04 +0000)]
Don't check for race with close on advisory unlock (there is nothing smart we
can do when such a race occurs). This saves lock/unlock cycle for the filedesc
lock for every advisory unlock operation.
phk [Sun, 17 Jun 2012 21:02:48 +0000 (21:02 +0000)]
On certain newer Intel Atom based motherboards, for instance the D2500CC which I have, syscons in text-mode fails to show the expected
contents due to write errors into video-memory.
At least one of the causes is that we copy from syscons internal buffer
to the video memory with optimized bcopy(9) which uses >16bit operations.
Until now, 32bit and wider operations have always worked on the video
memory, but since I cannot find a single source which says that this
SHALL work, and since these chipsets/bugs are now out there, this
commit changes syscons to always use 16bit copies on i386 & amd64.
This may be relevevant for PR's:
166262
166639
and various other bug reports floating elsewhere on the net, but
I lack hardware to test those.
davide [Sun, 17 Jun 2012 13:48:39 +0000 (13:48 +0000)]
Disable hwpmc(4) support for Intel Xeon Sandy Bridge (Model 0x2D).
Due to some differences in MSRs between Xeon Sandy Bridge and Core Sandy
Bridge (Model 0x2A), wrmsr() may generate in a GP# fault exception and so a
panic of the machine.
davide [Sun, 17 Jun 2012 13:03:50 +0000 (13:03 +0000)]
The variable 'error' in sys_poll() is initialized in declaration to value
zero but in any case is overwritten by successive copyin(), making the
previous initialization useless. Remove this.
As an added bonus this fixes a style(9) bug.
adrian [Sun, 17 Jun 2012 03:08:33 +0000 (03:08 +0000)]
After some discussion with bschmidt@, it's likely better to just go
through ieee80211_suspend_all() and ieee80211_resume_all().
All the other wireless drivers are doing that particular dance.
eadler [Sun, 17 Jun 2012 02:46:27 +0000 (02:46 +0000)]
attach_generic causes missing devices in /dev when the driver
interacts with some non-highpoint controollers. Change attach_generic to
be off by default.
PR: kern/168910
Submitted by: Richard Yao <ryao@gentoo.org>
Approved by: cperciva
No objections by: -hackers
Obtained from: Gentoo FreeBSD
MFC after: 2 weeks
attilio [Sat, 16 Jun 2012 21:39:00 +0000 (21:39 +0000)]
Do a more targeted check on the page cache and avoid to check the cache
pointer directly in vnode_pager_setsize() by using newly introduced
vm_page_is_cached() function.
alc [Sat, 16 Jun 2012 18:56:19 +0000 (18:56 +0000)]
The page flag PGA_WRITEABLE is set and cleared exclusively by the pmap
layer, but it is read directly by the MI VM layer. This change introduces
pmap_page_is_write_mapped() in order to completely encapsulate all direct
access to PGA_WRITEABLE in the pmap layer.
Aesthetics aside, I am making this change because amd64 will likely begin
using an alternative method to track write mappings, and having
pmap_page_is_write_mapped() in place allows me to make such a change
without further modification to the MI VM layer.
As an added bonus, tidy up some nearby comments concerning page flags.
rmh [Sat, 16 Jun 2012 16:51:42 +0000 (16:51 +0000)]
In CTFCONVERT_CMD initialization, check that ${MAKE_VERSION} is defined
before using it. Bootstrap make (as built by usr.bin/make/Makefile.dist)
does not define this variable, but it needs to parse bsd.own.mk in order
to build a complete make.
kib [Sat, 16 Jun 2012 13:10:22 +0000 (13:10 +0000)]
Revert part of the r235740 which changed separate allocation of the
string buffer for each linelist l_line into one large string. Since
linelists parsed out during the previous passes store the pointers to
previously allocated l_lines, the reallocation caused undefined
behaviour on accessing the buffers, and quite deterministic fault on
freeing them (in mountd(8) startup).
This fixes reading of netgroup(5) file which contains more then one
netgroup.
brooks [Fri, 15 Jun 2012 19:40:59 +0000 (19:40 +0000)]
MFP4: 212854, 212854
Add a LOCAL_LIB_DIRS variable to complement the existing LOCAL_DIRS
and LOCAL_TOOL_DIRS variables. Directories in LOCAL_LIB_DIRS are
built at the end of the _generic_libs target.