brooks [Sun, 21 Oct 2012 09:31:48 +0000 (09:31 +0000)]
MFC r228120:
Allow NO_FOO to override WITH_FOO that could be specified in /etc/src.conf.
This is required to override knobs (e.g. WITH_PROFILE) during buildworld
stages in Makefile.inc1 (otherwise the build is stopped due to both WITH_FOO
and WITHOUT_FOO defined).
mav [Fri, 19 Oct 2012 19:27:33 +0000 (19:27 +0000)]
MFC r241444:
Increase device CCB queue array size by CAM_RL_VALUES - 1 (4) elements.
It is required to store extra recovery requests in case of bus resets.
On ATA/SATA this fixes assertion panics on HEAD with INVARIANTS enabled or
possible memory corruptions otherwise if timeout/reset happens when device
CCB queue is already full.
mav [Fri, 19 Oct 2012 17:39:15 +0000 (17:39 +0000)]
MFC r241375:
Cast vendor-specific spell on VIA VT1818S codecs alike to VT1708S to
make analog input loopback and dual-stream playback work by enabling
signal mixing by nid 22, as it should be according to info returned by
the CODEC. Otherwise pin nid 28 receives only signal from DAC nid 16.
jhb [Fri, 19 Oct 2012 00:22:09 +0000 (00:22 +0000)]
MFC 227429,228121,228124,228137,228140,228141,228147,228153,228158,228311,
241395,241396:
Various fixes to WITH_CTF:
- Conditionalize ctfconvert/ctfmerge runs on make level (.if/.endif)
instead of executing a shell on every object or executable/library file.
- CTF knob is now implemented using common scheme: MK_CTF=yes/no is
defined based on WITH/WITHOUT_CTF settings, default is WITHOUT_CTF,
NO_CTF overrides WITH_CTF (used by Makefile.inc1)
- Add missing calls to ctfconvert/ctfmerge for various edge cases.
marius [Thu, 18 Oct 2012 15:20:37 +0000 (15:20 +0000)]
MFC: r239089
- Merge from NetBSD:
When issuing a non-DMA command, make sure to set the "remaining length of
command to be transferred via DMA" (sc_cmdlen) to zero up-front, otherwise
we might get confused on command competition interrupt (no DMA active but
still data left to transfer).
- Implement handling of MSG_IGN_WIDE_RESIDUE which some targets produce, as
just rejecting these leads to a resend and disconnect loop.
Reported and tested by: mjacob
marius [Thu, 18 Oct 2012 12:06:26 +0000 (12:06 +0000)]
MFC: r239864
- Unlike cache invalidation and TLB demapping IPIs, reading registers from
other CPUs doesn't require locking so get rid of it. As the latter is used
for the timecounter on certain machine models, using a spin lock in this
case can lead to a deadlock with the upcoming callout(9) rework.
- Merge r134227/r167250 from x86:
Avoid cross-IPI SMP deadlock by using the smp_ipi_mtx spin lock not only
for smp_rendezvous_cpus() but also for the MD cache invalidation and TLB
demapping IPIs.
- Mark some unused function arguments as such.
pfg [Tue, 16 Oct 2012 01:37:17 +0000 (01:37 +0000)]
MFC r241143:
rpc: be sure to free cl_netid and cl_tp.
When creating a client with clnt_tli_create, it uses strdup to copy
strings for these fields if nconf is passed in. clnt_dg_destroy frees
these strings already. Make sure clnt_vc_destroy frees them in the same
way.
np [Mon, 15 Oct 2012 06:48:50 +0000 (06:48 +0000)]
MFC r241401, r241416.
r241401:
Add an "i2c" subcommand to cxgbetool. You can use this to read
information from the transceivers connected to the ports of a
cxgbe(4) based card.
np [Mon, 15 Oct 2012 06:41:54 +0000 (06:41 +0000)]
MFC r241397-241399, r241409, r241493-24194.
r241397:
Remove unused item. cxgbe's rx queue's lock was removed a long time ago.
r241398:
There is no need to report the same error twice.
r241399:
Add a driver ioctl to read a byte from any device on a port's i2c bus.
This lets userspace read arbitrary information from the SFP+ modules
etc. on this bus.
Reading multiple bytes in the same transaction isn't possible right now.
I'll update the driver once the chip's firmware supports this.
r241409:
Add a driver ioctl to clear a port's MAC statistics.
r241493:
Use global knob in the TP_PARA_REG3 register to disable congestion
drops if the user has chosen this behaviour.
rmacklem [Mon, 15 Oct 2012 01:09:33 +0000 (01:09 +0000)]
MFC: r241097
Attila Bogar and Herbert Poeckl both reported similar problems
w.r.t. a Linux NFS client doing a krb5 NFS mount against the
FreeBSD server. We determined this was a Linux bug:
http://www.spinics.net/lists/linux-nfs/msg32466.html, however
the mount failed to work, because the Destroy operation with a
bogus encrypted checksum destroyed the authenticator handle.
This patch changes the rpcsec_gss code so that it doesn't
Destroy the authenticator handle for this case and, as such,
the Linux mount will work.
dim [Sat, 13 Oct 2012 13:00:51 +0000 (13:00 +0000)]
MFC r241430:
Pull in r164132 from upstream llvm trunk:
When creating MCAsmBackend pass the CPU string as well. In X86AsmBackend
store this and use it to not emit long nops when the CPU is geode which
doesnt support them.
Fixes PR11212.
Pull in r164133 from upstream clang trunk:
Follow up on llvm r164132.
This should prevent illegal instructions when building world on Geode
CPUs (e.g. Soekris).
ache [Fri, 12 Oct 2012 13:17:19 +0000 (13:17 +0000)]
MFC r241137,r241154
Using putenv() and later direct pointer contents modification it is possibe
to craft environment variables with similar names like that:
a=1
a=2
...
unsetenv("a") should remove them all to make later getenv("a") impossible.
Fix it to do so (this is GNU autoconf test #3 failure too).
glebius [Thu, 11 Oct 2012 01:32:51 +0000 (01:32 +0000)]
Merge r241129:
There is a complex race in in_pcblookup_hash() and in_pcblookup_group().
Both functions need to obtain lock on the found PCB, and they can't do
classic inter-lock with the PCB hash lock, due to lock order reversal.
To keep the PCB stable, these functions put a reference on it and after PCB
lock is acquired drop it. If the reference was the last one, this means
we've raced with in_pcbfree() and the PCB is no longer valid.
This approach works okay only if we are acquiring writer-lock on the PCB.
In case of reader-lock, the following scenario can happen:
- 2 threads locate pcb, and do in_pcbref() on it.
- These 2 threads drop the inp hash lock.
- Another thread comes to delete pcb via in_pcbfree(), it obtains hash
lock, does in_pcbremlists(), drops hash lock, and runs
in_pcbrele_wlocked(), which doesn't free the pcb due to two references
on it. Then it unlocks the pcb.
- 2 aforementioned threads acquire reader lock on the pcb and run
in_pcbrele_rlocked(). One gets 1 from in_pcbrele_rlocked() and continues,
second gets 0 and considers pcb freed, returns.
- The thread that got 1 continutes working with detached pcb, which later
leads to panic in the underlying protocol level.
To plumb that problem an additional INPCB flag introduced - INP_FREED. We
check for that flag in the in_pcbrele_rlocked() and if it is set, we pretend
that that was the last reference.
Discussed with: rwatson, jhb
Reported by: Vladimir Medvedkin <medved rambler-co.ru>
pfg [Wed, 10 Oct 2012 19:08:46 +0000 (19:08 +0000)]
rpc: fix __rpc_getconfip
__rpc_getconfip is supposed to return the first netconf
entry supporting tcp or udp, respectively. The code will
currently return the *last* entry, plus it will leak
memory when there is more than one such entry.
jimharris [Tue, 9 Oct 2012 19:55:12 +0000 (19:55 +0000)]
MFC r240901:
Use CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE to report missing targets or
LUNs respectively. This removes a huge number of error messages
from CAM during bus scans.
jimharris [Tue, 9 Oct 2012 19:53:15 +0000 (19:53 +0000)]
MFC r240900:
Specify MTX_RECURSE for the controller's io_lock. Without it, tws(4)
immediately panics on boot with INVARIANTS enabled. The driver already
clearly expects to be able to recurse on this mutex - the main I/O path
is always recursing on this lock.
sbruno [Tue, 9 Oct 2012 03:41:59 +0000 (03:41 +0000)]
MFC r240879
This patch fixes a nit in the em, lem, and igb driver statistics. Increment
adapter->dropped_pkts instead of if_ierrors because if_ierrors is
overwritten by hw stats collection.
Submitted by: Andrew Boyer <aboyer@averesystems.com>
Reviewed by: Jack F Vogel <jfv@freebsd.org>
rmacklem [Mon, 8 Oct 2012 12:59:09 +0000 (12:59 +0000)]
MFC: r240902
Attila Bogar reported a bug in mountd when multiple export
entries with different security flavors are in the exports(5)
file. For that case, mountd replies with the security flavors
of the last entry and not the correct one for the client host.
This patch fixes that by storing separate copies of the flavors
for each host/net case, plus a default one for the case where
no hosts/nets are specified on an entry in the exports(5) file.
Unlike the patch in the PR, it replies with the security flavors
for the entry instead of merging the security flavors for all
the entries and replying with that.
jhb [Sun, 7 Oct 2012 21:32:41 +0000 (21:32 +0000)]
MFC 239955-239957:
Cleanups and fixes for building firmware modules into a kernel:
- Add common rules for building firmware object files (NORMAL_FW to run
uudecode, and NORMAL_FWO to use ld to build the .fwo file) and use those
instead of explicit ld/uudecode invocations in sys/conf/files. Apart from
increasing readability, this makes it possible to adjust the flags used for
firmware objects in one place.
- Similar to how r171350 fixed linking of kernel modules containing
firmware objects by adding --no-warn-mismatch to the linker flags,
add --no-warn-mismatch when linking firmware objects (*.fwo) as
well as to the link of the main kernel file. This permits firmware
modules to be statically linked into an ia64 kernel.
jhb [Sun, 7 Oct 2012 18:57:29 +0000 (18:57 +0000)]
MFC 239440,239519:
Refine the changes made in r208212 to avoid bogus failures from
if_delmulti() when clearing the configuration for a subinterface when
the parent interface is being detached. The current code was still
triggering an assertion in if_delmulti() due to the parent interface being
partially detached. Fix this by not calling if_delmulti() at all if the
parent interface is being detached. Warn if if_delmulti() fails when the
parent is not being detached (but similar to 208212, still proceed with
tearing down the vlan state).
jhb [Sun, 7 Oct 2012 18:47:53 +0000 (18:47 +0000)]
MFC 239354:
Allow static DMA allocations that allow for enough segments to do page-sized
segments for the entire allocation to use kmem_alloc_attr() to allocate
KVM rather than using kmem_alloc_contig(). This avoids requiring
a single physically contiguous chunk in this case.
jhb [Sun, 7 Oct 2012 18:31:01 +0000 (18:31 +0000)]
MFC 226961,239951:
Add a -h flag similar to the -h flag for ln to force mv(1) to treat a
symbolic link to a directory for the target as a symbolic link instead of
a directory. This makes it possible to atomically update a symbolic
link using rename().
jhb [Sun, 7 Oct 2012 18:25:33 +0000 (18:25 +0000)]
MFC 239906:
Clarify that bus_dma does not stall future load requests once a load is
deferred. The caller is required to enforce that if that is desired.
jhb [Sun, 7 Oct 2012 18:18:59 +0000 (18:18 +0000)]
MFC 239913:
Attach interrupt handlers during attach instead of during the first time
the interface is brought up. Without this, the boot time interrupt
round-robin assignment does not think the allocated interrupt resources
are active and leaves them assigned to CPU 0.
While here, add descriptive tags to each interrupt handler when MSI-X
is used.
pfg [Sun, 7 Oct 2012 05:11:29 +0000 (05:11 +0000)]
MFC r241141, r241165, r241165, r241181;
rpc: convert all uid and gid variables to u_int.
Follow a similar change in Solaris and linux where the uid and
gid variables were made more similar to what the system expects.
In our case we use u_int which is what XDR can manage,
mav [Sat, 6 Oct 2012 13:01:08 +0000 (13:01 +0000)]
MFC r239194:
Allow idle threads to steal second threads from other cores on systems with
8 or more cores to improve utilization. None of my tests on 2xXeon (2x6x2)
system shown any slowdown from mentioned "excess thrashing". Same time in
pbzip2 test with number of threads more then number of CPUs I see up to 10%
speedup with SMT disabled and up 5% with SMT enabled. Thinking about
trashing I was trying to limit that stealing within same last level cache,
but got only worse results. Present code any way prefers to steal threads
from topologically closer cores.
mav [Sat, 6 Oct 2012 12:58:56 +0000 (12:58 +0000)]
MFC r239185, r239196:
Some minor tunings/cleanups inspired by bde@ after previous commits:
- remove extra dynamic variable initializations;
- restore (4BSD) and implement (ULE) hogticks variable setting;
- make sched_rr_interval() more tolerant to options;
- restore (4BSD) and implement (ULE) kern.sched.quantum sysctl, a more
user-friendly wrapper for sched_slice;
- tune some sysctl descriptions;
- make some style fixes.
mav [Sat, 6 Oct 2012 12:51:16 +0000 (12:51 +0000)]
MFC r239157:
Rework r220198 change (by fabient). I believe it solves the problem from
the wrong direction. Before it, if preemption and end of time slice happen
same time, thread was put to the head of the queue as for only preemption.
It could cause single thread to run for indefinitely long time. r220198
handles it by not clearing TDF_NEEDRESCHED in case of preemption. But that
causes delayed context switch every time preemption happens, even when not
needed.
Solve problem by introducing scheduler-specifoc thread flag TDF_SLICEEND,
set when thread's time slice is over and it should be put to the tail of
queue. Using SW_PREEMPT flag for that purpose as it was before just not
enough informative to work correctly.
On my tests this by 2-3 times reduces run time deviation (improves fairness)
in cases when several threads share one CPU.
mav [Sat, 6 Oct 2012 12:38:41 +0000 (12:38 +0000)]
MFC r239153:
SCHED_4BSD scheduling quantum mechanism appears to be broken for some time.
With switchticks variable being reset each time thread preempted (that is
done regularly by interrupt threads) scheduling quantum may never expire.
It was not noticed in time because several other factors still regularly
trigger context switches.
Handle the problem by replacing that mechanism with its equivalent from
SCHED_ULE called time slice. It is effectively the same, just measured in
context of stathz instead of hz. Some unification is probably not bad.
eadler [Fri, 5 Oct 2012 22:42:57 +0000 (22:42 +0000)]
MFC r241116:
Correct the tip about finding all the directories on the system
Add a tip about clearing the screen.
Make things more consistent by removing quotes around 'make search'
Passing an invalid pointer results in undefined behaviour.
The wrappers in libthr access some of the data pointed to by the arguments
in userland, so that an invalid pointer will cause a signal and not an
[EFAULT] error return.
Furthermore, if the [EFAULT] error occurs when the kernel is writing, it is
not a proper error in the sense that the call still commits (changing the
signal disposition or accepting the signal).
Reserve room for the terminating NUL when setting or getting kernel
environment variables. KENV_MNAMELEN and KENV_MVALLEN doesn't include
space for the terminating NUL.