Merge the optimizations for the syscall entry and leave.
MFC r225474:
Inline the syscallenter() and syscallret(). This reduces the time measured
by the syscall entry speed microbenchmarks by ~10% on amd64.
MFC r225475:
Perform amd64-specific microoptimizations for native syscall entry
sequence. The effect is ~1% on the microbenchmark.
In particular, do not restore registers which are preserved by the
C calling sequence. Align the jump target. Avoid unneeded memory
accesses by calculating some data in syscall entry trampoline.
MFC r225483:
The jump target shall be after the padding, not into it.
MFC r225575:
Microoptimize the return path for the fast syscalls on amd64. Arrange
the code to have the fall-through path to follow the likely target.
Do not use intermediate register to reload user %rsp.
MFC r225576:
Put amd64_syscall() prototype in md_var.h.
Tested by: Alexandr Kovalenko <never nevermind kiev ua>
Rename the cc.4 and cc.9 modular congestion control related man pages to
mod_cc.4 and mod_cc.9 respectively to avoid any possible confusion with the cc.1
gcc man page. Update references to these man pages where required.
Cache failing and opened catalogs in catopen() and related functions.
Continuous catopen() calls cause 4 failig stat(2) each, which means a lot
of overhead. It is also a good idea to keep the opened catalogs in the memory
to speed up further catopen() calls to the same catalog since these catalogs
are not big at all. In this case, we count references and only free() the
allocated space when the reference count reaches 0. The reads and writes to
the cache are syncronized with an rwlock when these functions are called from
a threaded program.
MFC 225341:
Clear the mountprog variable after each mountfs() call so that mountprog
options don't leak over into subsequent mounts listed in /etc/fstab.
While here, fix a memory leak in debug mode.
MFC 225331:
Move the logic to parse volume cache commands out into a separate function
and use a loop so that multiple cache commands can be strung together on
the command line into a single update to the volume's properties.
MFC 225200:
- Replace references to sio(4) with uart(4) instead.
- We no longer use the same data structure in as NetBSD in pucdata.c.
- ppc(4) has had a puc(4) attachment for a while now.
MFC 225017:
Walk the zombproc list as well as the allproc list when enumerating threads
and processes in a kernel image. This allows examination of threads that
have exited or are in the late stages of exiting.
MFC 224942:
Fix a regression where a rule containing a source port option after a
destination IP would incorrectly display the source port as a destination
port.
MFC 225201:
Enable the puc(4) driver on amd64 and i386 in GENERIC. This allows
devices supported by puc(4) to work "out of the box" since puc.ko does
not work "out of the box".
MFC 225079:
Add two new macros DRIVER_MODULE_ORDERED() and EARLY_DRIVER_MODULE_ORDERED()
that allow a module to use an order other than the default of
SI_ORDER_MIDDLE when registering a driver. This can be useful for drivers
in a kld that contain multiple new-bus drivers as part of one logical device
driver. A typical case would be to use SI_ORDER_LAST for the "main" driver
to ensure that any other "helper" drivers are registered and available
before the "main" driver attempts to attach.
MFC 224733:
Allow the NFS client to use a max file size larger than 1TB for v3 mounts.
It now allows files up to OFF_MAX subject to whatever limit the server
advertises.
MFC 224228:
Note that the "kernel" variable in loader.conf is the name of a directory
containing a kernel under /boot and that it's default value is "kernel"
not "/boot/kernel/kernel".
MFC 223936,224205:
Allow per-CPU statistics to be toggled at runtime via the 'P' key.
While here, make -P a toggle similar to other options such as -I.
The value of namlen is copied from on-disk d_namlen, which is a 8-bit
unsigned integer which can never exceed MAXNAMLEN (255) so the test is
always true. Moreover, UFS does not allow d_namelen being zero.
Change namlen from u_int to u_int8_t, and replace the unneeded test
with a useful test.
MFC r225440:
vge(4) hardwares poll media status and generates an interrupt
whenever the link state is changed. Using software based polling
for media status tracking is known to cause MII access failure
under certain conditions once link is established so vge(4) used to
rely on link status change interrupt.
However DEVICE_POLLING completely disables generation of all kind
of interrupts on vge(4) such that this resulted in not detecting
link state change event. This means vge(4) does not correctly
detect established/lost link with DEVICE_POLLING. Losing the
interrupt made vge(4) not to send any packets to peer since vge(4)
does not try to send any packets when there is no established link.
Work around the issue by generating link state change interrupt
with DEVICE_POLLING.
Addendum to the original commit message:
This is mostly useful to protect kdb_trap() from concurrent entry as it
doesn't have any protection like e.g. panic(9) has. Even if kdb_trap()
had that protection there would still be a need for protection
between concurrect panic() and kdb_trap() entries. That protection
could be implemented externally, but doing it in generic_stop_cpus()
seems to be OK as well (stopping CPUs on panic is in the works).
MFC r223356 (by delphij):
Mod the offset padding by alignment. Without this change we may
pad too much when underlying GEOM object have a zero stripesize.
MFC r225445:
Don't use the whole free space when resizing partition to a larger size
on a disk with non zero stripesize (e.g. disks with 4k sector size)[1].
Also do not use automatic alignment when size is exactly specified, but
an alignment is not. Use automatic alignment only for case when user
omits both "-s" and "-a" options.
On the first loop for generating a bridge MAC address use the local
hostid, this gives a good chance of keeping the same address over
reboots. This is intended to help IPV6 and similar which generate
their addresses from the mac.
marius [Sun, 11 Sep 2011 20:38:33 +0000 (20:38 +0000)]
MFC: r221407 (partial)
- Let mii_phy_add_media() also announce the support of IFM_NONE.
- Add a PHY-specific reset routine is for lxtphy(4) which disables MII
interrupts.
- Remove redundant checks in NIC drivers for mii->mii_instance not being
zero before calling the reset routines because as soon as one PHY driver
attaches mii->mii_instance is incremented and we hardly can end up in
their media change callbacks etc if no PHY driver has attached as
mii_attach() would have failed in that case and not attach a miibus(4)
instance.
- Convert the mebers of the MII data structure to unsigned where
appropriate. This is partly inspired by NetBSD/OpenBSD.
- Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that
weren't explicitly converted to support flow control before. It's
unclear whether flow control actually works with these but typically
it should and their net behavior should be more correct with these
changes in place than without if the MAC driver sets MIIF_DOPAUSE.
MFC: r225109
Fix nfsstat(1) so that it prints out correct stats for the
new NFS server when the "-w" option is used. The problem was
spotted by hrs@ during testing where srvrpcnt[] must be indexed
by NFSV4OP_XXX and not NFSPROC_XXX.
Remove NIS entries from /etc/nsswitch.conf for WITHOUT_NIS.
We already modify various configuration files in /etc based on build
configuration. This is not done for nsswitch.conf right now when setting
WITHOUT_NIS. This breaks various utilities, including crond, that depend
on working databases.
MFC r225167:
Import bugfix for reading and extracting of FreeBSD ISO images with tar.
Vendor revision 3645 (merge of 3642):
Change the mechanism handling a rr_moved directory,
which is Rockridge extension that can exceed the limitation of
a maximum directory depth of ISO 9660.
- Stop reading all entries at a time.
- Connect "CL" entry to "RE" entry dynamically, which "CL" and "RE"
have information to rebuild a full directory tree.
- Tweak some related tests since we use Headsort for re-ordering
entries and it cannot make a steady order when the keies of
the entries are the same.
MFC r225329:
Import additional bugfix for reading and extracting makefs-created
ISO images with tar.
Vendor revision 3648 (merge of 3647):
Additional fix to issue 168 because the change of r3642 was not sufficient.
- Make sure "CL" entry appear after its "RE" entry which the "CL" entry
should be connected with.
- Give consideration to the case that the top level "RE" entry has
already been exposed outside before its tree.
MFC r225076:
Apply the limit to avoid the overflows in the radix tree subr_blist.c
after the conversion of the swap device size to the page size units,
not before.
art [Mon, 5 Sep 2011 06:54:13 +0000 (06:54 +0000)]
MFC r225234:
Make sure RPC calls over UDP return RPC_INTR status if the process has
been interrupted in a restartable syscall. Otherwise we could end up
in an (almost) endless loop in clnt_reconnect_call().
MFC r225040:
Prevent the hiwatermark for the unix domain socket from becoming
effectively negative. Often seen as upstream fastcgi connection timeouts
in nginx when using sendfile over unix domain sockets for communication.
MFC: r225049
Fix the NFSv4 server so that it returns NFSERR_SYMLINK when
an attempt to do an Open operation on any type of file other
than VREG is done. A recent discussion on the IETF working group's
mailing list (nfsv4@ietf.org) decided that NFSERR_SYMLINK
should be returned for all non-regular files and not just symlinks,
so that the Linux client would work correctly.
This change does not affect the FreeBSD NFSv4 client and is not
believed to have a negative effect on other NFSv4 clients.
marius [Fri, 2 Sep 2011 16:17:52 +0000 (16:17 +0000)]
MFC: r225229
Since r221218 (MFC'ed to stable/8 in r223500) rman_manage_region(9)
actually honors rm_start and rm_end which may cause problems when these
contain garbage so zero the range descriptors embedding the rmans when
allocating them.
yongari [Tue, 30 Aug 2011 17:20:34 +0000 (17:20 +0000)]
MFC r225088:
Disable PHY hibernation until I get more detailed hibernation
programming secret. The PHY would go into sleep state when it
detects no established link and it will re-establish link when the
cable is plugged in. Previously it failed to re-establish link
when the cable is plugged in such that it required to manually down
and up the interface again to make it work. This came from
incorrectly programmed hibernation parameters. According to
Atheros, each PHY chip requires different configuration for
hibernation and different vendor has different settings for the
same chip.
Disabling hibernation may consume more power but establishing link
looks more important than saving power.
Special thanks to Atheros for giving me instructions that disable
hibernation.
kib [Tue, 30 Aug 2011 11:50:28 +0000 (11:50 +0000)]
MFC r224915:
Do not return success and a string "unknown" when vn_fullpath() was unable
to resolve the path of the text vnode of the process. The behaviour is
very confusing for any consumer of the procfs, in particular, java.
marck [Tue, 30 Aug 2011 11:47:36 +0000 (11:47 +0000)]
MFC r225122:
Add kern.cam.boot_delay description (with reasonable default) to
default/loader.conf
This should help people installing ${OS} to USB devices, where there are
frequently cases where kernel tries to mount root before actual umass sensing
is finished.
marius [Tue, 23 Aug 2011 14:37:39 +0000 (14:37 +0000)]
MFC: r225015
Revert r224157 (MFC'ed to stable/8 in r224401), re-enabling r222135 (MFC'ed
to stable/8 in r222371). The underlying problem keeping the latter from
working as expected was fixed in r225014 (MFC'ed to stable/8 in r225116).
marius [Tue, 23 Aug 2011 14:32:53 +0000 (14:32 +0000)]
MFC: r225014
r221812 (MFC'ed to stable/8 in r222159) reveals that at least some Broadcom
PHYs default to being not only isolated but also powered down after a reset
and while they just work fine [sic] when both is the case they don't if they
are only deisolate but still powered down. So in order to put PHYs in an
overall normal operation mode for the common case, ensure in mii_phy_reset()
that they are not powered down after a reset. Unfortunately, this only helps
in case of BCM5421, while BCM5709S apparently only work when they remain
isolated and powered down after a reset. So don't call mii_phy_reset() in
brgphy_reset() and implement the reset locally leaving the problematic bits
alone. Effectively this bypasses r221812 for brgphy(4).
Thanks to Justin Hibbits for doing a binary search in order to identify
the problematic commit.
pjd [Tue, 23 Aug 2011 07:00:51 +0000 (07:00 +0000)]
MFC r224791:
Eliminate the zfsdev_state_lock entirely and replace it with the
spa_namespace_lock. This fixes LOR between the spa_namespace_lock and
spa_config lock. LOR can cause deadlock on vdevs removal/insertion.
jhb [Mon, 22 Aug 2011 18:57:59 +0000 (18:57 +0000)]
MFC 224495:
Properly initialize an error variable to avoid returning uninitialized
data when 'show drives' succeeds, often resulting in a failing exit code
even though the command worked fine.