Fix an obvious bug from r186196 shadowing a variable, not correctly
appending the new mbuf to the chain reference but possibly causing an mbuf
nextpkt loop leading to a memory used after handoff (or having been freed)
and leaking an mbuf here.
Pass the fibnum where we need filtering of the message on the
rtsock allowing routing daemons to filter routing updates on an
rtsock per FIB.
Adjust raw_input() and split it into wrapper and a new function
taking an optional callback argument even though we only have one
consumer [1] to keep the hackish flags local to rtsock.c.
trociny [Tue, 4 Oct 2011 11:08:31 +0000 (11:08 +0000)]
MFC r225809:
When script(1) reads EOF from input it starts spinning on zero-byte
reads eating 100% CPU. Fix this by skipping select on STDIN after
reading EOF -- permanently if STDIN is not terminal and for one second
if it is.
Also after reading EOF from STDIN we have to pass it to the program
being scripted. The previous approach was to write zero bytes into the
pseudo-terminal. This does not work because zero-byte write does not
have any effect on read. Fix this by sending VEOF instead.
Submitted by: Ronald Klop <ronald-freebsd8@klop.yi.org>
Discussed with: kib, Chris Torek <chris.torek@gmail.com>
kib [Tue, 4 Oct 2011 09:55:15 +0000 (09:55 +0000)]
MFC r225699:
Restore the writing of the .bss sections of the dsos.
Revert the optimization of using mprotect(2) to establish .bss, overlap
the section with mmap(2).
emaste [Tue, 4 Oct 2011 00:29:10 +0000 (00:29 +0000)]
MFC r225798: Improve battery capacity reporting
When a status pointer is passed in mfi_dcmd_command does not return an
errno (if the ioctl is successful), so move the test for NO_HW_PRESENT
outside of the error case. This should fix incorrect reporting for
systems with a dead or no battery.
Additionally, handle error codes other than NO_HW_PRESENT by omitting
the battery capacity display. LSI's supercap-based parts (CV series)
report their data using the same interface as battery-based parts,
except that they do not include the capacity stats (state of charge,
cumulative charge cycles, etc.)
kib [Mon, 3 Oct 2011 20:05:21 +0000 (20:05 +0000)]
Restore the td_syscalls counter, that was erronously removed in the r225855.
Note that this is a direct commit to stable/8, td_syscalls was removed in
head by r210138.
MFC:
r212938: Support new variable NANO_LABEL.
r212990: Make the labels match the device name that's mounted, not just the
slice they are on.
r214955:
- Set -x flag when executing customisation scripts to aid in debugging them.
- Use KERNCONFDIR with KERNCONF instead of copying the kernel config into
the source tree so included kernel configs work.
- Put more stuff in the _.bk/_.ik log file, not just make statements.
- Add the kernel config name to the pprint during kernel installation.
- Add NANO_MODULES providing a list of modules to build and install.
r215069: Document NANO_CFGDIR and NANO_DATADIR
r215070: Build make.conf when the world is not selected to build, but the
kernel is.
r215081: Insulate the nanobsd build from the current system by opting out of
the SRCCONF processing.
r216144: _WITHOUT_SRCCONF has too much baggage. Instead, use the simpler
SRCCONF=/dev/null.
r216145:
- Mount the device async when we're doing the copy.
- Create a sparse file instead of a fully zerod one. This trades the
possibiltiy of running out of space during the build for the speed
gain not having do write all those zeros...
r216928: Put in the other half of the SRCCONF patch.
r216929: Bump the media size from approx 600MB to approx 750MB. The great
hob-nailed tennis shoe of progress demands it!
r220091: Use ${NANO_WORLDDIR}/var/empty as copy source since
it has no schg flag set.
r221850: Copy symbolic links as files rather than recreating the links.
r221851: Implement -f to inhibit copying s1 partition out for speed.
r221852: Add ${} around variable dereference...
r221856: If there's no package directory, don't try to install packages from
it. Instead, report that 0 packages are reported.
r221877: Restore BOOT2CFG, accidentally removed in r212938.
r222535: Don't need (and can't use) -L to copy links here.
mav [Sun, 2 Oct 2011 12:18:06 +0000 (12:18 +0000)]
MFC r225869:
- Add special support for the MFI_CMD ioctl with MFI_CMD_STP command,
used by present MegaCLI version. It has some special meaning for the
first s/g list entry, while the main s/g list begins from the the second
entry, and those lists should remain separate after loading to the
busdma map.
- Fix bug in 32bit ioctl compatibility shims when s/g list consists of
more then on element.
delphij [Sun, 2 Oct 2011 09:44:28 +0000 (09:44 +0000)]
MFC r225339:
Expose more variables from coretemp(4) via sysctl:
- tjmax - Tj(max) value from the CPU
- delta - current delta reading
- resolution - sensor resolution in Celsius
- throttle_log - whether a #PROCHOT was asserted since last reset
Submitted by: Mark Johnston <markjdb gmail.com> (mostly)
kib [Sat, 1 Oct 2011 11:59:45 +0000 (11:59 +0000)]
MFC r212405 (by davidxu):
Because POSIX does not allow EINTR to be returned from sigwait(),
add a wrapper for it in libc and rework the code in libthr, the
system call still can return EINTR, we keep this feature.
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.