jpaetzel [Mon, 19 Mar 2012 23:17:26 +0000 (23:17 +0000)]
MFC: 232898
Improve ZFS exporting functionality, only export pools which are on a
specific device we happen to be writing to. This fixes an issue when
running pc-sysinstall on a running system which needs ZFS and the main
disk gets exported.
jpaetzel [Mon, 19 Mar 2012 22:52:19 +0000 (22:52 +0000)]
MFC: 232681
Work around broken BIOS memory reporting
Andrzej has a machine with 32GB of RAM, but only 16GB is reported by the
smbios.memory.enabled. Thus, use the greater of hw.realmem and the smbios
value.
Reported by: Andrzej Tobola <ato of iem pw edu pl>
jpaetzel [Mon, 19 Mar 2012 22:41:53 +0000 (22:41 +0000)]
MFC 227470:
Report the amount of memory from smbios data if provided.
This should get the correct memory size even if a 32-bit image is running
on a machine with > 4GB of memory. This can be useful is using a 32-bit
installer on a machine which will eventually run a 64-bit image.
dim [Mon, 19 Mar 2012 08:10:23 +0000 (08:10 +0000)]
MFC r232894:
Pull in r145194 from upstream clang trunk:
Make our handling of MMX x SSE closer to what gcc does:
* Enabling sse enables mmx.
* Disabling (-mno-mmx) mmx, doesn't disable sse (we got this right already).
* The order in not important. -msse -mno-mmx is the same as -mno-mmx -msse.
Some configure scripts depend on this.
PR: i386/165968
MFC r232933:
Update comments and CFLAGS in sys/conf/kern.mk, introduced in r221879,
to match reality: clang does _not_ disable SSE automatically when
-mno-mmx is used, you have to specify -mno-sse explicitly.
Note this was the case even before r232894, which only makes a change in
the 'positive' flag case; e.g. when you specify -msse, MMX gets enabled
too.
mav [Mon, 19 Mar 2012 07:24:26 +0000 (07:24 +0000)]
MFC r230845:
Make sound(4) more flexible in setting soft buffer and block sizes when
hardware imposes strict limitations on hard buffer and block sizes.
Previous code set soft buffer to be no smaller then hard buffer. On some
cards with fixed 64K physical buffer that caused up to 800ms play latency.
New code allows to set soft buffer size down to just two blocks of the hard
buffer and to not write more then that size ahead to the hardware buffer.
As result of that change I was able to reduce full practically measured
record-playback loop delay in those conditions down to only about 115ms
with theoretical playback latency of only about 50ms.
New code works fine for both vchans and direct cases. In both cases sound(4)
tries to follow hw.snd.latency_profile and hw.snd.latency values and
application-requested buffer and block sizes as much as limitation of two
hardware blocks allows.
mav [Mon, 19 Mar 2012 07:15:42 +0000 (07:15 +0000)]
MFC r232783:
Idle ticks optimization:
- Pass number of events to the statclock() and profclock() functions
same as to hardclock() before to not call them many times in a loop.
- Rename them into statclock_cnt() and profclock_cnt().
- Turn statclock() and profclock() into compatibility wrappers,
still needed for arm.
- Rename hardclock_anycpu() into hardclock_cnt() for unification.
mav [Mon, 19 Mar 2012 07:13:30 +0000 (07:13 +0000)]
MFC r232797:
ServerWorks HT1000 HPET reported to have problems with IRQs >= 16.
Lower (ISA) IRQs are working, but allowed mask is not set correctly.
Block both by default to allow HP BL465c G6 blade system to boot.
eadler [Mon, 19 Mar 2012 01:51:08 +0000 (01:51 +0000)]
MFC r231306:
Fix NULL ptr dereference in setusercontext if pwd is null,
LOGIN_SETPRIORITY is set, and setting the priority (rtprio or
setpriority) fails.
- Add an __alignof() for non-GCC and GCC < 2.95.
- Attempt to implement the following C11 keywords: _Alignas(),
_Alignof(), _Noreturn, _Static_assert() and _Thread_local.
- Add __generic(), which allows us to do _Generic() in a portable
fashion.
- Improve __offsetof(), __DECONST(), __DEVOLATILE() and __DEQUALIFY()
to use __uintptr_t and __size_t to make them work with less
header prerequisites.
- Add __has_feature(), __has_include() and __has_builtin() to make it
easier to test against Clang features.
dim [Sat, 17 Mar 2012 22:29:05 +0000 (22:29 +0000)]
MFC 232322:
Add a WITH_CLANG_IS_CC option for src.conf(5), disabled by default, that
installs clang as /usr/bin/cc, /usr/bin/c++ and /usr/bin/cpp.
Note this does *not* disable building and installing gcc, which will
still be available as /usr/bin/gcc, /usr/bin/g++ and /usr/bin/gcpp. If
you want to disable gcc completely, you must use WITHOUT_GCC.
MFC 232323:
Regenerate src.conf(5) after r232322.
MFC 232477:
In r232322, I forgot one case where a check for MK_CLANG_IS_CC was
needed, in sys/conf/kern.pre.mk. Add it now.
MFC 232522:
Fix a thinko in r232322, where gcc (and its tools) are not built during
the cross-tools stage, if CC=clang and WITH_CLANG_IS_CC is not set.
This causes no 'cc' to be installed in the temporary cross-tools tree,
making lint fall over later in the build, because it ignores ${CC} and
attempts to run 'cc' anyway.
To fix this, only skip building gcc during cross-tools, if WITHOUT_GCC
is set, or if WITH_CLANG_IS_CC is set.
marcel [Sat, 17 Mar 2012 05:45:21 +0000 (05:45 +0000)]
MFC r227430:
On i386, fbt probes are implemented by writing an invalid opcode over
certain instructions in a function prologue or epilogue. DTrace has a
hook into the invalid opcode fault handler that checks whether the fault
was due to an probe and if so, runs the DTrace magic.
Upon returning from an invalid opcode fault caused by a probe, DTrace must
emulate the instruction that was replaced with the invalid opcode and then
return control to the instruction following the invalid opcode.
There were a pair of related bugs in the emulation for the leave
instruction. The leave instruction is used to pop off a stack frame prior
to returning from a function. The emulation for this instruction must
move the trap frame for the invalid opcode fault down the stack to the
bottom of the stack frame that is being removed, and then execute an iret.
At two points in this process, the emulation code was storing values above
the current value of the stack pointer. This opened up a window in which
if we were two take an interrupt, the trap frame for the interrupt would
overwrite the values stored on the stack, causing the system to panic
later.
The first bug was that at one point the emulation code saves the new value
for $esp above the current stack pointer value. The fix is to save this
value instead inside of the original trap frame. At this point we do
not need the original trap frame so this is safe.
The second bug is that when the emulate code loads $esp from the stack, it
points part-way through the new trap frame instead of at its beginning.
The emulation code adjusts the stack pointer to the correct value
immediately afterwards, but this still leaves a one instruction window in
which an interrupt would corrupt this trap frame. Fix this by adjusting
the stack frame value before loading it into $esp.
This fixes panics in invop_leave on i386 when using fbt return probes.
jhb [Fri, 16 Mar 2012 21:28:05 +0000 (21:28 +0000)]
MFC 226340,226340:
Use queue(3) macros instead of home-rolled versions in several places in
the INET6 code. This includes retiring the 'ndpr_next' and 'pfr_next'
macros.
kib [Thu, 15 Mar 2012 11:06:37 +0000 (11:06 +0000)]
MFC r232071:
Account the writeable shared mappings backed by file in the vnode
v_writecount.
MFC r232103:
Place the if() at the right location.
MFC note: the added struct vm_object un_pager.vnp.writemappings member
is located after the fields of struct vm_object that could be accessed
from the modules.
marius [Wed, 14 Mar 2012 10:02:35 +0000 (10:02 +0000)]
MFC: r232822
Fix a bug introduced in r223938; on big-endian machines coping a 32-bit
quantum bytewise to the address of a 64-bit variable results in writing
to the "wrong" 32-bit half so adjust the address accordingly. This fix
is implemented in a hackish way for two reasons:
o in order to be able to get it into 8.3 with zero impact on the little-
endian architectures where this bug has no effect and
o to avoid blowing the x86 boot2 out of the water again when compiling
it with clang, which all sane versions of this fix tested do.
This change fixes booting from UFS1 file systems on big-endian machines.
glebius [Tue, 13 Mar 2012 20:37:57 +0000 (20:37 +0000)]
Merge 231025 from head:
Add new socket options: TCP_KEEPINIT, TCP_KEEPIDLE, TCP_KEEPINTVL and
TCP_KEEPCNT, that allow to control initial timeout, idle time, idle
re-send interval and idle send count on a per-socket basis.
mav [Tue, 13 Mar 2012 20:36:03 +0000 (20:36 +0000)]
MFc r229288:
Remove unneeded checks for CAM_DEV_QFRZN after cam_periph_runccb() call.
cam_periph_runccb() since the beginning checks it and releases device queue.
After r203108 it even clears CAM_DEV_QFRZN flag after that to avoid double
release, so removed code is unreachable now.
mav [Tue, 13 Mar 2012 20:33:15 +0000 (20:33 +0000)]
MFC r228846:
Use READ CAPACITY(16) to get information about device physical sectors.
As soon as not all devices support READ CAPACITY(16), automatically fall
back to READ CAPACITY(10) if CAM_REQ_INVALID or SSD_KEY_ILLEGAL_REQUEST
status returned.
It also provides first bits of information about Logical Block Provisioning
(aka UNMAP/TRIM) support by the device.
dim [Tue, 13 Mar 2012 18:39:57 +0000 (18:39 +0000)]
MFC r232263:
Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to
get rid of testing explicitly for clang (using ${CC:T:Mclang}) in
individual Makefiles.
Instead, use the following extra macros, for use with clang:
- NO_WERROR.clang (disables -Werror)
- NO_WCAST_ALIGN.clang (disables -Wcast-align)
- NO_WFORMAT.clang (disables -Wformat and friends)
- CLANG_NO_IAS (disables integrated assembler)
- CLANG_OPT_SMALL (adds flags for extra small size optimizations)
As a side effect, this enables setting CC/CXX/CPP in src.conf instead of
make.conf! For clang, use the following:
bz [Mon, 12 Mar 2012 22:08:03 +0000 (22:08 +0000)]
MFC r232515:
Rather than printing the output from route add for all FIBs just print them
for the default FIB followed by a statement with a list of FIB numbers for
all the other FIBs we install the routes for.
Request by: kib (to make it less noisy)
Tested by: kib
kib [Mon, 12 Mar 2012 12:53:27 +0000 (12:53 +0000)]
MFC r232240:
Currently, the debugger attached to the process executing vfork() does
not get syscall exit notification until the child performed exec of
exit. Swap the order of doing ptracestop() and waiting for P_PPWAIT
clearing, by postponing the wait into syscallret after ptracestop()
notification is done.
This includes major code refactoring, HDMI support, new volume control,
automatic recording source selection, runtime reconfigureation, support
for more then 4 PCM devices on controller, multichannel recording,
additional playback/record streams, higher bandwidths support, more
informative device names and many other things.
rstone [Sat, 10 Mar 2012 02:26:12 +0000 (02:26 +0000)]
MFC r230984:
Whenever a new kernel thread is spawned, explicitly clear any CPU affinity
set on the new thread. This prevents the thread from inadvertently
inheriting affinity from a random sibling.
MFC r231265:
Introduce the "ruleset=number" option for devfs(5) mounts.
Add support for updating the devfs mount (currently only changing the
ruleset number is supported).
Check mnt_optnew with vfs_filteropt(9).
This new option sets the specified ruleset number as the active ruleset
of the new devfs mount and applies all its rules at mount time. If the
specified ruleset doesn't exist, a new empty ruleset is created.
MFC r231267 [1]:
Add support for mounting devfs inside jails.
A new jail(8) option "devfs_ruleset" defines the ruleset enforcement for
mounting devfs inside jails. A value of -1 disables mounting devfs in
jails, a value of zero means no restrictions. Nested jails can only
have mounting devfs disabled or inherit parent's enforcement as jails are
not allowed to view or manipulate devfs(8) rules.
MFC r232059 [1]:
To improve control over the use of mount(8) inside a jail(8), introduce
a new jail parameter node with the following parameters:
allow.mount.devfs:
allow mounting the devfs filesystem inside a jail
allow.mount.nullfs:
allow mounting the nullfs filesystem inside a jail
Both parameters are disabled by default (equals the behavior before
devfs and nullfs in jails). Administrators have to explicitly allow
mounting devfs and nullfs for each jail. The value "-1" of the
devfs_ruleset parameter is removed in favor of the new allow setting.
MFC r232186:
Analogous to r232059, add a parameter for the ZFS file system:
allow.mount.zfs:
allow mounting the zfs filesystem inside a jail
This way the permssions for mounting all current VFCF_JAIL filesystems
inside a jail are controlled wia allow.mount.* jail parameters.
Update sysctl descriptions.
Update jail(8) and zfs(8) manpages.
MFC r232247:
mdoc(7) stype - start new sentences on new line
MFC r232278 [1]:
Add procfs to jail-mountable filesystems.
MFC r232291:
Bump .Dd to reflect latest update
MFC r232307:
Add "export" to devfs_opts[] and return EOPNOTSUPP if called with it.
Fixes mountd warnings.
MFC r232342 (jamie) [2]:
Handle the case where a boolean parameter is also a node.
mav [Fri, 9 Mar 2012 05:43:08 +0000 (05:43 +0000)]
MFC r232380:
Fix names of some Marvell SATA chips. It looks like chips with proprietary
interface supported by mvs(4) are 88SX, while AHCI-like chips are 88SE.
kib [Thu, 8 Mar 2012 12:54:26 +0000 (12:54 +0000)]
MFC r232048:
Allow the parent to gather the exit status of the children reparented
to the debugger. When reparenting for debugging, keep the child in
the new orphan list of old parent. When looping over the children in
kern_wait(), iterate over both children list and orphan list to search
for the process by pid.
MFC r232104:
Restore the return statement erronously removed in the r232048.
In order to keep stable/9 KBI, the p_dbg_child member of struct proc
was replaced with padding.
rmacklem [Thu, 8 Mar 2012 03:02:48 +0000 (03:02 +0000)]
MFC: r2323467
The name caching changes of r230394 exposed an intermittent bug
in the new NFS server for NFSv4, where it would report ENOENT
when the file actually existed on the server. This turned out
to be caused by not initializing ni_topdir before calling lookup()
and there was a rare case where the value on the stack location
assigned to ni_topdir happened to be a pointer to a ".." entry,
such that "dp == ndp->ni_topdir" succeeded in lookup().
This patch initializes ni_topdir to fix the problem.
kib [Wed, 7 Mar 2012 08:05:12 +0000 (08:05 +0000)]
MFC r232303:
In null_reclaim(), assert that reclaimed vnode is fully constructed,
instead of accepting half-constructed vnode. Previous code cannot decide
what to do with such vnode anyway, and although processing it for hash
removal, paniced later when getting rid of nullfs reference on lowervp.
While there, remove initializations from the declaration block.
kib [Wed, 7 Mar 2012 08:02:43 +0000 (08:02 +0000)]
MFC r232301:
Always request exclusive lock for the lower vnode in nullfs_vget().
The null_nodeget() requires exclusive lock on lowervp to be able to
insmntque() new vnode.
kib [Wed, 7 Mar 2012 07:59:30 +0000 (07:59 +0000)]
MFC r232299:
Move the code to destroy half-contructed nullfs vnode into helper
function null_destroy_proto() from null_insmntque_dtr(). Also
apply null_destroy_proto() in null_nodeget() when we raced and a vnode
is found in the hash, so the currently allocated protonode shall be
destroyed.
Lock the vnode interlock around reassigning the v_vnlock.
MFC r232383:
Do not expose unlocked unconstructed nullfs vnode on mount list.
Lock the native nullfs vnode lock before switching the locks.
Add regression tests scripts for multi-IP FIBs exercising the send,
receive and forward path tagging packets with both the ifconfig fib
option or using ipfw, running ICMP6, TCP/v6 and UDP/v6 tests and
testing both setfib(2) as well as the SO_SETFIB socket option.
At 16 FIBs a total of over 64k return codes/replies/stati are checked,
sometimes multiple times (in different ways, e.g. the reflected request
as well as ipfw counter values).
The scripts need two or three machines to run and are thus not added
to the tools/regression framework but only to tools/test.
MFC r232114:
Update scripts to work around two sh(1) bugs found in stable/8:
1) _x=$((_x + 1)) does not work while x=$((x + 1)) does.
2) Parameter Expansion, esp. "${x%%bar}" does not work if quoted.
Correct typos and improve some details forwarding.sh already
had in initiator, esp. related to ipfw accepting if the default
is deny.
Add an extra stat call to the "delay" function in addition to the
touch which together is still a lot faster than sleep 1 but seems
to help a lot more to mitigate the unrelated kernel race seen.