rmacklem [Mon, 15 Oct 2012 01:13:36 +0000 (01:13 +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.
jimharris [Tue, 9 Oct 2012 19:59:22 +0000 (19:59 +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:57:18 +0000 (19:57 +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.
jhb [Tue, 9 Oct 2012 18:45:08 +0000 (18:45 +0000)]
MFC 201279,201280,201286,213907,214146,220195,222753,223371,225515,235833:
Various fixes to managing PCI BARs including proper support for managing
PCI ROM BARs:
- Teach the PCI bus driver to handle PCIR_BIOS BARs properly and remove
special handling for the PCIR_BIOS decoding enable bit from the cardbus
driver. The PCIR_BIOS BAR does include type bits like other BARs.
Instead, it is always a 32-bit non-prefetchable memory BAR where the low
bit is used as a flag to enable decoding.
- Explicitly track the state of all known BARs for each PCI device. The PCI
bus driver will now remember the size of a BAR obtained during the initial
bus scan and use that size when doing lazy resource allocation rather than
resizing the BAR. The bus driver will now also report unallocated BARs to
userland for display by 'pciconf -lb'.
- Add a constant for the offset of the ROM BIOS BAR in PCI-PCI bridges and
properly handle ROM BIOS BARs in PCI-PCI bridges. The PCI bus now also
properly handles the lack of a ROM BIOS BAR in a PCI-Cardbus bridge.
sbruno [Tue, 9 Oct 2012 18:02:05 +0000 (18:02 +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>
obrien [Tue, 9 Oct 2012 05:06:30 +0000 (05:06 +0000)]
MF9: r237100: MFC r236338, r236339, r236346, r236347, r236365, & r236977
* Deprecate the FreeBSD 10's make's ":U" (to-upper case) and ":L"
(to-lower case) modifiers for ":tu" and ":tl".
* make it easier to test newly-built make.
* Add "-V '${VAR}'" variable expansion from Portable Berkeley Make.
* regression test for '-V' command line option and the :t[lu] modifiers.
rmacklem [Mon, 8 Oct 2012 13:14:00 +0000 (13:14 +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:33:04 +0000 (21:33 +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 20:17:24 +0000 (20:17 +0000)]
MFC 212429:
Add real dependancies on the uuencoded firmwares.
Now when one does 'make kernel ; make kernel' the second invocation
only does: `kernel.ko' is up to date.
rather than reproduce all the .fw files and relink the kernel.
jhb [Sun, 7 Oct 2012 18:57:52 +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:31:17 +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:48 +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:19:13 +0000 (18:19 +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.
rmacklem [Sat, 6 Oct 2012 22:14:19 +0000 (22:14 +0000)]
MFC: r240720
Modify the NFSv4 client so that it can handle owner
and owner_group strings that consist entirely of
digits, interpreting them as the uid/gid number.
This change was needed since new (>= 3.3) Linux
servers reply with these strings by default.
This change is mandated by the rfc3530bis draft.
Reported on freebsd-stable@ under the Subject
heading "Problem with Linux >= 3.3 as NFSv4 server"
by Norbert Aschendorff on Aug. 20, 2012.
mav [Sat, 6 Oct 2012 14:04:36 +0000 (14:04 +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 13:43:56 +0000 (13:43 +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 13:42:21 +0000 (13:42 +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.
mav [Sat, 6 Oct 2012 13:38:49 +0000 (13:38 +0000)]
MFC r212455:
Merge some SCHED_ULE features to SCHED_4BSD:
- Teach SCHED_4BSD to inform cpu_idle() about high sleep/wakeup rate to
choose optimized handler. In case of x86 it is MONITOR/MWAIT. Also it
will be needed to bypass forthcoming idle tick skipping logic to not
consume resources on events rescheduling when it won't give any benefits.
- Teach SCHED_4BSD to wake up idle CPUs without using IPI. In case of x86,
when MONITOR/MWAIT is active, it require just single memory write. This
doubles performance on some heavily switching test loads.
mav [Sat, 6 Oct 2012 12:25:13 +0000 (12:25 +0000)]
MFC r232207, r232454, r234066:
Rework CPU load balancing in SCHED_ULE:
- In sched_pickcpu() be more careful taking previous CPU on SMT systems.
Do it only if all other logical CPUs of that physical one are idle to avoid
extra resource sharing.
- In sched_pickcpu() change general logic of CPU selection. First
look for idle CPU, sharing last level cache with previously used one,
skipping SMT CPU groups. If none found, search all CPUs for the least loaded
one, where the thread with its priority can run now. If none found, search
just for the least loaded CPU.
- Make cpu_search() compare lowest/highest CPU load when comparing CPU
groups with equal load. That allows to differentiate 1+1 and 2+0 loads.
- Make cpu_search() to prefer specified (previous) CPU or group if load
is equal. This improves cache affinity for more complicated topologies.
- Randomize CPU selection if above factors are equal. Previous code tend
to prefer CPUs with lower IDs, causing unneeded collisions.
- Rework periodic balancer in sched_balance_group(). With cpu_search()
more intelligent now, make balansing process flat, removing recursion
over the topology tree. That fixes double swap problem and makes load
distribution more even and predictable.
All together this gives 10-15% performance improvement in many tests on
CPUs with SMT, such as Core i7, for number of threads is less then number
of logical CPUs. In some tests it also gives positive effect to systems
without SMT.
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'
rmacklem [Thu, 4 Oct 2012 21:55:37 +0000 (21:55 +0000)]
MFC: r240289
Add a simple printf() based debug facility to the new nfs client.
Use it for a printf() that can be harmlessly generated for mmap()'d
files. It will be used extensively for the NFSv4.1 client.
Debugging printf()s are enabled by setting vfs.nfs.debuglevel to
a non-zero value. The higher the value, the more debugging printf()s.
bapt [Tue, 2 Oct 2012 17:05:20 +0000 (17:05 +0000)]
MFC r240682
if a file in plist starts with / then do not prefix it with "prefix" [1]
pkg info -g returns 1 if a file mismatch [2]
flush stdout in pkg info -g [3]
clean up quiet mode (-q | --quiet) output of pkg_version(1) [4]
fix missing error call in uname check added to pkg_version(1) [5]
fix pkg_add(1) fails to install with -C from bad path [6]
only resolve path from pkg_add(1) -p if the given prefix do not start with a '/' [7]
Make sure that arraysz is initialized to a value larger than zero.
arraysz could get initialized to zero on ZFS because ZFS reports
directory sizes differently compared to UFS.
In snmp_hostres, device_map table is used for consistent device table
indexing. When a device has gone it is not removed from device_map
table but just its entry_p field is set to NULL.
So when traversing device_map in disk_OS_get_ATA_disks() and
disk_OS_get_MD_disks() check for entry_p being NULL, otherwise the
bsnmpd crash is possible when a removed map entry is dereferenced.
Before the fix, for disk_OS_get_ATA_disks() the crash could be easily
reproduced running:
atacontrol detach ata1
The crash was not observed in disk_OS_get_MD_disks() because currently
snmp_hostres does no see md(4) disks: to get the device list it uses
devinfo(3), which does not return md devices.
mm [Wed, 26 Sep 2012 12:36:22 +0000 (12:36 +0000)]
MFC r226940 (rmh):
Fix a few gratuitous library dependencies. Some of the ZFS utilities
are linked with libraries they don't use:
- zinject doesn't use libavl
- ztest doesn't use libz
- zdb uses neither libavl nor libz
- zfs uses neither libbsdxml nor libm, nor libsbuf
- zpool uses neither libbsdxml nor libm, nor libsbuf
In addition, libzfs needs libm because it uses pow(), however it isn't
linked with -lm. This went unnoticed because all its users had -lm before.
mm [Wed, 26 Sep 2012 11:12:09 +0000 (11:12 +0000)]
MFC r236248-r236250:
MFC r236248 (pjd):
Remove unused variable.
MFC r236249 (pjd):
Eliminate 'where' argument, we don't use it.
MFC r236250 (pjd):
Tighten up the assertion: because size can't be 0 and even if sm_space is equal
to sm_size, any 'sm_space - size' will be less than sm_size.
When an MFI command fails, the driver needs to set bio->bio_resid so that
the upper levels notice. Otherwise we see commands silently failing leading
to data corruption. This mirrors dadone()
Submitted by: Andrew Boyer aboyer@averesystems.com
Bring some changes from Bull's NFSv4 libtirpc implementation.
____
Fixed infinite loop in svc_run()
____
__rpc_taddr2uaddr_af() assumes the netbuf to always have a
non-zero data. This is a bad assumption and can lead to a
seg-fault. This patch adds a check for zero length and returns
NULL when found.
____
Changed clnt_spcreateerror() to return clearer
and more concise error messages.
____
Converted all uid and gid variables of the type uid_t and gid_t.
____
libtirpc: set r_netid and r_owner in __rpcb_findaddr_timed
These fields in the rpcbind GETADDR call are being passed uninitialized
to CLNT_CALL. In the case of x86_64 at least, this usually leads to a
segfault. On x86, it sometimes causes segfaults and other times causes
garbage to be sent on the wire.
rpcbind generally ignores the r_owner field for calls that come in over
the wire, so it really doesn't matter what we send in that slot. We just
need to send something. The reference implementation from Sun seems to
send a blank string. Have ours follow suit.
____
libtirpc: 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.