jhb [Wed, 23 Jun 2010 18:46:10 +0000 (18:46 +0000)]
MFC 198988:
Take a step towards removing if_watchdog/if_timer. Don't explicitly set
if_watchdog/if_timer to NULL/0 when initializing an ifnet. if_alloc()
sets those members to NULL/0 already.
jhb [Wed, 23 Jun 2010 17:56:20 +0000 (17:56 +0000)]
MFC 208388:
- Set 'dmadat' earlier so that we properly setup the heap if we fail to
locate a high memory area for the heap using the SMAP.
- Read the number of hard drive devices from the BIOS instead of hardcoding
a limit of 128. Some BIOSes duplicate disk devices once you get beyond
the maximum drive number.
jhb [Wed, 23 Jun 2010 17:04:42 +0000 (17:04 +0000)]
MFC 209213:
When updating individual CPU's lowest Cx state to use, never set it to a
state lower than the lowest one supported by the current CPU. This closes
some races with changes to the hw.acpi.cpu_cx_lowest sysctl while Cx
states for individual CPUs were changing (e.g. unplugging the AC adapter
of a laptop) that could result in panics.
nwhitehorn [Wed, 23 Jun 2010 13:13:14 +0000 (13:13 +0000)]
MFC r209369:
Temporarily disable instruction relocation while setting up the kernel's
IBAT entry in early boot in order to prevent possible faults from races
between the instruction cache and the MMU.
kib [Wed, 23 Jun 2010 10:06:57 +0000 (10:06 +0000)]
MFC r208920:
Reorganize the code in bdwrite() which handles move of dirtiness from
the buffer pages to buffer. Drain the VPO_BUSY bit of the buffer pages
before setting valid and clean bits.
Stable/8 version of vfs_page_set_validclean() requires page queue lock.
ae [Tue, 22 Jun 2010 07:38:30 +0000 (07:38 +0000)]
MFC r207178:
Fix undo for schemes that have internal partitions. Internal partitions
do not constitute user-visible or active partitions and as such should
not prevent undoing pending operations.
While here, initialize the last usable sector for the placeholder geom
based on the null scheme, created to allow undoing the destruction of
a scheme. This gives consistent output with "gpart show".
mjacob [Tue, 22 Jun 2010 04:40:50 +0000 (04:40 +0000)]
This is an MFC of 209188
For the target port groups structures, don't allocate the initial element.
This makes things easier for target implementations to calculate how many
elements they need to allocate.
rmacklem [Tue, 22 Jun 2010 01:30:46 +0000 (01:30 +0000)]
MFC: r209191
Add MODULE_DEPEND() macros to the experimental NFS client and
server so that the modules will load when kernels are built with
none of the NFS* configuration options specified. I believe this
resolves the problems reported by PR kern/144458 and the email on
freebsd-stable@ posted by Dmitry Pryanishnikov on June 13.
delphij [Mon, 21 Jun 2010 22:00:57 +0000 (22:00 +0000)]
MFC r208969,209268:
Driver update of twa(4) from LSI. Many thanks to LSI for continuing to
support FreeBSD.
1) Timeout ioctl command timeouts.
Do not reset the controller if ioctl command completed
successfully.
2) Remove G66_WORKAROUND code (this bug never shipped).
3) Remove unnecessary interrupt lock (intr_lock).
4) Timeout firmware handshake for PChip reset (don't wait forever).
5) Handle interrupts inline.
6) Unmask command interrupt ONLY when adding a command to the pending
queue.
7) Mask command interrupt ONLY after removing the last command from
the pending queue.
8) Remove TW_OSLI_DEFERRED_INTR_USED code.
9) Replace controller "state" with separate data fields to avoid races:
10) Fix "req" leak in twa_action() when simq is frozen and req is NOT
null.
11) Replace softc "state" with separate data fields to avoid races:
TW_OSLI_CTLR_STATE_OPEN sc->open
TW_OSLI_CTLR_STATE_SIMQ_FROZEN sc->simq_frozen
12) Fix reference to TW_OSLI_REQ_FLAGS_IN_PROGRESS in
tw_osl_complete_passthru()
13) Use correct CAM status values.
Change CAM_REQ_CMP_ERR to CAM_REQ_INVALID.
Remove use of CAM_RELEASE_SIMQ for physical data addresses.
14) Do not freeze/ release the simq with non I/O commands.
When it is appropriate to temporarily freeze the simq with an I/O
command use:
xpt_freeze_simq(sim, 1);
ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
otherwise use:
xpt_freeze_simq(sim, 1);
xpt_release_simq(sim, 1);
Submitted by: Tom Couch <tom.couch lsi.com>
PR: kern/147695
kaiw [Mon, 21 Jun 2010 13:47:29 +0000 (13:47 +0000)]
MFC r209122:
* Improve compatibility with existing application code by permitting the
use of `elf_getbase()` on non-archive members. This change is needed
for gcc LTO (-flto) to work properly.
* Style fix: paranthesize returned values.
* Document the current behaviour of `elf_getbase()`.
mjacob [Mon, 21 Jun 2010 04:37:39 +0000 (04:37 +0000)]
This is an MFC of 208895.
Fix XPT_GET_TRAN_SETTING for FC which has been broken for while so that
it will figure out the correct target to handle index and be able to find
things like WWPN, etc.
mav [Sun, 20 Jun 2010 10:23:46 +0000 (10:23 +0000)]
MFC r209155:
Fix bug introduced in SVN rev 194985. When calling pic_assign_cpu()
for pre-bound IRQs during boot, submit there LAPIC ID, same as in other
places, not CPU ID.
marcel [Sat, 19 Jun 2010 04:57:58 +0000 (04:57 +0000)]
MFC revs 209026 and 209085:
o Bump MAX_BPAGES from 256 to 1024.
o 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.
mjacob [Sat, 19 Jun 2010 00:37:14 +0000 (00:37 +0000)]
This is an MFC of 208808
I was getting panics in sleepq_add for the second sleep in isp_kthread.
I don't know why- but it occurred to me in looking at the second sleep
is that all I want is a pause- not an actual sleep. So do that instead.
kan [Fri, 18 Jun 2010 16:14:37 +0000 (16:14 +0000)]
MFC r207578:
Do not encode more than CTF_MAX_VLEN(1023) enum members.
CTF can not represent enums with more than CTF_MAX_VLEN members, but
ctfconvert will happily ignore that limitation and create CTF section no
other tool can interpret.
This change is different from similar change from upstream, which just
returns an error if big enum is encountered. Doing that means that
every FreeBSD kernel with compiled in hwpmc will have no useable CTF
information due to pmc_event enum having 1236+ members.
kan [Fri, 18 Jun 2010 15:25:57 +0000 (15:25 +0000)]
MFC r208994:
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.
kib [Fri, 18 Jun 2010 09:40:01 +0000 (09:40 +0000)]
MFC r208773:
Sometimes vnodes share the lock despite being different vnodes on
different mount points, e.g. the nullfs vnode and the covered vnode
from the lower filesystem. In this case, existing assertion in
vop_rename_pre() may be triggered.
Check for vnode locks equiality instead of the vnodes itself to
not trip over the situation.
mlaier [Thu, 17 Jun 2010 19:46:36 +0000 (19:46 +0000)]
MFC r209063:
Cache the last result from if_indextoname for printing. This speeds up
"arp -an" when using a lot of aliases (on a single interface).
A better fix would include a better interface for if_indextoname than
getting the whole address list from the kernel just to find the one
index->name mapping.
tuexen [Thu, 17 Jun 2010 19:17:50 +0000 (19:17 +0000)]
MFC 209178
* Fix a bug where the length of the ASCONF-ACK was calculated wrong due
to using an uninitialized variable.
* Fix a bug where a NULL pointer was dereferenced when interfaces
come and go at a high rate.
* Fix a bug where inps where not deregistered from iterators.
* Fix a race condition in freeing an association.
* Fix a refcount problem related to the iterator.
Each of the above bug results in a panic. It shows up when
interfaces come and go at a high rate.
Remove macros that are not really needed. The idea was to have them in case
we grow more descriptors, but I'll reconsider readding them once we get there.
Passing (a = b) expression to FD_ISSET() is bad idea, as FD_ISSET() evaluates
its argument twice.
Found by: Coverity Prevent
CID: 5243
r209179:
Plug memory leaks.
Found by: Coverity Prevent
CID: 7052, 7053, 7054, 7055
marius [Sat, 12 Jun 2010 00:28:41 +0000 (00:28 +0000)]
MFC: r208778
- Mention that VTOC8 labels are found in Fujitsu SPARC64 machines as well.
- Add information regarding VTOC8 bootrstrap code and how it's handled with
r208777 in place.
- Document the mapping of partition types to VTOC8 tags.
- Add examples for VTOC8 to the respective section.
- Eliminated hard sentence breaks.
Reviewed by: marcel (slightly buggy version)
Approved by: re (bz)
marius [Fri, 11 Jun 2010 22:25:50 +0000 (22:25 +0000)]
MFC: r208777
- In gpart_bootfile_read() fix an off-by-one error preventing the bootstrap
file to be of maximum size.
- Add special handling required for SMI/VTOC8 disklabel partcode, i.e. avoid
overwriting the label when writing the bootstrap code to the partition
starting at 0 and install it to all partitions when the -i option is omitted
just like geom_sunlabel(4) and sunlabel(8) do by default.
- Add missing prototypes.
- Add const where applicable.
tuexen [Fri, 11 Jun 2010 20:38:20 +0000 (20:38 +0000)]
MFC 209029
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.
ken [Fri, 11 Jun 2010 19:17:36 +0000 (19:17 +0000)]
MFC 199549, 199997, 204158, 207673, and 208901.
Bring in a number of netfront changes:
r199549 | jhb
Remove commented out reference to if_watchdog and an assignment of zero to
if_timer.
Reviewed by: scottl
r199997 | gibbs
Add media ioctl support and link notifications so that devd will attempt
to run dhclient on a netfront (xn) device that is setup for DHCP in
/etc/rc.conf.
PR: kern/136251 (fixed differently than the submitted patch)
r204158 | kmacy
- make printf conditional
- fix witness warnings by making configuration lock a mutex
r207673 | joel
Switch to our preferred 2-clause BSD license.
Approved by: kmacy
r208901 | ken
A number of netfront fixes and stability improvements:
- Re-enable TSO. This was broken previously due to CSUM_TSO clearing the
CSUM_TCP flag, so our checksum flags were incorrectly set going to the
netback driver. That was fixed in r206844 in tcp_output.c, so we can
turn TSO back on here.
- Fix the way transmit slots are calculated, so that we can't overfill
the ring.
- Avoid sending packets with more fragments/segments than netback can
handle. The Linux netback code can only handle packets of
MAX_SKB_FRAGS, which turns out to be 18 on machines with 4K pages. We
can easily generate packets with 32 or so fragments with TSO turned on.
Right now the solution is just to drop the packets (since netback
doesn't seem to handle it gracefully), but we should come up with a way
to allow a driver to tell the TCP stack the maximum number of fragments
it can handle in a single packet.
- Fix the way the consumer is tracked in the receive path. It could get
out of sync fairly easily.
- Use standard Xen ring macros to make it clearer how netfront is using
the rings.
- Get rid of Linux-ish negative errno return values.
nwhitehorn [Fri, 11 Jun 2010 14:10:20 +0000 (14:10 +0000)]
MFC r208162, 208836, 208837:
Program the K2 SATA controller's interrupt to be level-triggered low, and
respect the edge/level settings in the device tree.
OpenPIC on powerpc sets interrupts to be level high by default. On Apple
interrupt controllers, all level interrupts are low regardless of
programming except interrupt 0, used by K2 SATA on some Apple systems, with
the result that the K2 SATA IRQ is misconfigured. Pending review of changes
to this default, work around this by changing the programming of the K2
SATA interrupt to level low.
nwhitehorn [Fri, 11 Jun 2010 14:06:35 +0000 (14:06 +0000)]
MFC r208870:
Some revisions of the Serverworks K2 SATA controller have a data
corruption bug where if an ATA command is issued before DMA is started,
data will become available to the controller before it knows what to do
with it. This results in either data corruption or a controller crash.
This patch remedies the problem by adopting the workaround employed
by Linux and Darwin: starting the DMA engine prior to sending the ATA
command.
rrs [Fri, 11 Jun 2010 03:13:19 +0000 (03:13 +0000)]
MFC:
Fix a number of bugs and race conditions.
r208160: Bring back of the iterator thread. It now properly handles VNETS
having only one thread. The old timer based code was full of
LOR's and other issues.
r208852: Cleanup bug. Basically when an un-accepted socket was hanging on a
closed listener, we would leak the inp never cleaning it up
r208853: Enhance the use under invarients of the audit for locks function
and fix a bug where a close collision with a cookie being processed
would cause a crash.
r208854: Use the proper increment macros when working with the
sent_queue_retran_cnt
r208855: Align comments properly, Fix a bug where we were NOT looking at the
resend markings for control chunks and also not decrementing the
retran count which caused extra calls to retransmission. Alos add
a valid no locks call to the output routine.
r208856: Spacing issues in auth/bsd addr.
r208857: Get rid of a windows ifdef that somehow leaked in
r208863: Missing error leg returns in some failure cases
r208864: LOR fix between the iterator and sctp_inpcb_close
r208874: Don't call the sctp_inpcb_free from abort an association since you
don't know what locks you hold and a timer will take care of the
situation when the gone flag is set
r208875: sctp_inpcb_free bug - a socket under the right situation could get
stuck (from the accept queue) and never start the proper cleanup
timer)
r208876: Further enhance invariant lock validation, Fix a bug where a closed
socket and a INIT-ACK could collide and cause a crash
r208878: Clear up another bug in sctp_inpcb_free where we would end up due
to a race in freeing hit a destroy of a contended lock.
r208879: Optimize the cleanup and make some additional fixes in the sysctl
code so that it won't reference a GONE INP and crash us
r208883 & r208891: Fix so we don't open a hole between a sock lock and a call
to socantrcvmore.. we could before hit a race that would kill the
socket underneath us leading to a crash
r208897: CUM-ACK calculation was messed up. So basically large message got
broken from the original NR_sack integration.
r208902: Make sure that we don't move a bit to the NR array that is behind
the cum-ack
r208952: Use both bit maps to calculte the cum-ack.
r208953: Fix bug having to do with freeing an sctp_inpcb_free().
1) make sure not to remove the flag until you get the lock again.
2) make sure all log_closing calls hold the lock.
3) Release all the locks when everthing is done and call callout_drain
not callout_stop..
r208970: Fix some places on user allocation of a new sctp_inpcb where we run
out of resource that we make sure to NULL the so_pcb pointer.
Approved by: re - (bz@freebsd.org)
rpaulo [Thu, 10 Jun 2010 20:34:22 +0000 (20:34 +0000)]
MFC r208644:
Due to the way HALDEBUG() is defined, we need to add curly brackets
when using it as a sole if clause instruction.
While there, fix 'const static' typo.
Submitted by: Arnaud Lacombe <alc@FreeBSD.org>
Approved by: re (kensmith)
rpaulo [Thu, 10 Jun 2010 20:26:34 +0000 (20:26 +0000)]
MFC r208711:
Bring in a couple of fixes from the Linux ath9k related to chip hangs.
While there, try to make the register write pattern look like what's
done by ath9k.
jhb [Thu, 10 Jun 2010 20:13:03 +0000 (20:13 +0000)]
MFC 208603,208605:
More gracefully handle stale file handles and attributes when opening a
file via NFS. Specifically, to satisfy close-to-open-consistency, the NFS
client always performs at least one RPC on a file during an open(2) to see
if the file has changed. Normally this RPC is an ACCESS or GETATTR RPC
that is forced by flushing a file's attribute cache during nfs_open() and
then requesting new attributes. However, if the file is noticed to be
stale during nfs_open(), the only recourse is to fail the open(2) call
with ESTALE. On the other hand, if the ACCESS or GETATTR RPC is sent
during nfs_lookup(), then the NFS client can fall back to a LOOKUP RPC to
obtain the new file handle in the case that a file has been replaced.
This change causes the NFS client to flush the attribute cache during
nfs_lookup() when validating a name cache hit if the attributes fetched
during nfs_lookup() can be reused in nfs_open(). This allows the client
to open a replaced file via the new file handle the first time that it
notices a replaced file rather than failing with ESTALE in some cases.
nwhitehorn [Thu, 10 Jun 2010 19:11:00 +0000 (19:11 +0000)]
MFC r208835:
Make sure that interrupt sense settings set after interrupts are enabled
are respected. This fixes loading the Apple onboard audio driver
(snd_ai2s) as a module after boot, which would previously cause a panic.
yongari [Thu, 10 Jun 2010 17:53:35 +0000 (17:53 +0000)]
MFC r208862:
Fix a bug introduced in r199011. When bge(4) reuses loaded RX
buffers it should also reinitialize RX descriptors otherwise some
stale data could be passed to controller. This could end up with
mbuf double free or unexpected NULL pointer dereference in upper
stack. To fix the issue, save loaded buffer's length and
reinitialize RX descriptors with the saved value whenever bge(4)
reuses the loaded RX buffers.
While I'm here, increase the number of RX buffers to 512 from 256.
This simplifies RX buffer handling as well as giving more RX
buffers. Controller supports just fixed number of RX buffers
(i.e. 512) and bge(4) used to rely on hope that our CPU is fast
enough to keep up with the controller. With this change, bge(4)
will use 1MB for RX buffers but I don't think it would cause
problems in these days.
Reported by: marcel
Tested by: marcel
Approved by: re (bz)