dchagin [Sat, 9 Jan 2016 14:08:10 +0000 (14:08 +0000)]
To facillitate an upcoming Linuxulator merging partially
MFC r275121 (by kib). Only merge the syntax changes from r275121,
PROC_*LOCK() macros still lock the same proc spinlock.
The process spin lock currently has the following distinct uses:
- Threads lifetime cycle, in particular, counting of the threads in
the process, and interlocking with process mutex and thread lock.
The main reason of this is that turnstile locks are after thread
locks, so you e.g. cannot unlock blockable mutex (think process
mutex) while owning thread lock.
- Virtual and profiling itimers, since the timers activation is done
from the clock interrupt context. Replace the p_slock by p_itimmtx
and PROC_ITIMLOCK().
- Profiling code (profil(2)), for similar reason. Replace the p_slock
by p_profmtx and PROC_PROFLOCK().
- Resource usage accounting. Need for the spinlock there is subtle,
my understanding is that spinlock blocks context switching for the
current thread, which prevents td_runtime and similar fields from
changing (updates are done at the mi_switch()). Replace the p_slock
by p_statmtx and PROC_STATLOCK().
gjb [Sat, 9 Jan 2016 00:31:24 +0000 (00:31 +0000)]
MFC r293173, r293231:
r293173:
Fix path to include .OBJDIR to avoid polluting the source
tree during 'make release'.
r293231:
Add a new target to touch the ${.OBJDIR}/release file, which
indicates the 'release' target has run (in order to prevent
subsequent invocations that may clobber original build output).
jpaetzel [Fri, 8 Jan 2016 23:58:32 +0000 (23:58 +0000)]
MFC 293043
Unset the gss kernel state when gssd exits
When gssd exits it leaves the kernel state set by
gssd_syscall(). nfsd sees this and waits endlessly
in an unkillable state for gssd to come back. If you
had acidentally started gssd then stopped it, then
started nfsd you'd be in a bad way until you either
restarted gssd or rebooted the system. This change
fixes that by setting the kernel state to "" when
gssd exits.
bdrewery [Thu, 7 Jan 2016 22:06:05 +0000 (22:06 +0000)]
MFC r291611:
Add NO_INSTALLKERNEL to undo the assumption that the first KERNCONF will be
installed as "kernel". This is relevant for packaging of the kernel when not
wanting a default "kernel.txz".
wollman [Thu, 7 Jan 2016 20:43:45 +0000 (20:43 +0000)]
MFH r292836:
in6_if2idlen: treat bridge(4) interfaces like other Ethernet interfaces
bridge(4) interfaces have an if_type of IFT_BRIDGE, rather than
IFT_ETHER, even though they only support Ethernet-style links. This
caused in6_if2idlen to emit an "unknown link type (209)" warning to
the console every time it was called. Add IFT_BRIDGE to the case
statement in the appropriate place, indicating that it uses the same
IPv6 address format as other Ethernet-like interfaces.
gnn [Thu, 7 Jan 2016 19:52:17 +0000 (19:52 +0000)]
MFC: 292394
Switch the IPsec related statistics to using the built in sysctl
variable set rather than reading from kernel memory.
This also makes the -z (zero) flag work correctly
emaste [Thu, 7 Jan 2016 17:03:26 +0000 (17:03 +0000)]
MFC r291377: vidfont: with vt(4) omit size from vidcontrol -f
When using syscons, vidfont extracts the font size from the filename
passes it to vidcontrol -f. In vt(4) mode the size argument is not
required, and some of the fonts in /usr/share/vt/fonts do not have the
size in the filename, which caused vidfont to fail. Thus, just omit the
size argument in vt(4) mode.
emaste [Thu, 7 Jan 2016 17:00:35 +0000 (17:00 +0000)]
MFC r291691: newvers: Honour SOURCE_DATE_EPOCH for build reproducibility
One reason the kernel does not build reproducibly is that it includes
a timestamp in the version string. SOURCE_DATE_EPOCH provides a standard
method to address this: it should be set to the last modification time
of the source, and build processes use the specified timestamp instead
of the "current" date and time.
This change uses SOURCE_DATE_EPOCH if it is set; how it gets set needs
to be addressed elsewhere.
mjg [Thu, 7 Jan 2016 12:08:15 +0000 (12:08 +0000)]
MFC r292440:
proc: fix a race which could result in dereference of bad p_pgrp pointer on
fork
During fork p_starcopy - p_endcopy area of a process is populated with bcopy
with only proc lock held. Another forking thread can find such a process and
proceed to access p_pgrp included in said area.
Fix the problem by moving the field outside. It is being properly assigned
later.
emaste [Thu, 7 Jan 2016 04:02:37 +0000 (04:02 +0000)]
loader.efi: combine GetMemoryMap and ExitBootServices and retry on error
MFC r292338: UEFI: combine GetMemoryMap and ExitBootServices and retry on error
The EFI memory map may change before or during the first
ExitBootServices call. In that case ExitBootServices returns an error,
and GetMemoryMap and ExitBootServices must be retried.
Glue together calls to GetMemoryMap(), ExitBootServices() and storage of
(now up-to-date) MODINFOMD_EFI_MAP metadata within a single function.
That new function - bi_add_efi_data_and_exit() - uses space previously
allocated in bi_load_efi_data() to store the memory map (it will fail if
that space is too short). It handles re-calling GetMemoryMap() once to
update the map key if necessary. Finally, if ExitBootServices() is
successful, it stores the memory map and its header as MODINFOMD_EFI_MAP
metadata.
ExitBootServices() calls are now done earlier, from within arch-
independent bi_load() code.
MFC r292442: loader.efi: show EFI error number, not full status value
EFI return values set the high bit to indicate an error. The log
messages changed here are printed only in the case of an error,
so including the error bit is redundant. Also switch to decimal to
match the error definitions (in sys/boot/efi/include/efierr.h).
MFC r292515: loader.efi: refresh size in GetMemoryMap retry loop
If ExitBootServices fails due to a changed efi_mapkey then GetMemoryMap
must be called again. In this case it is also possible for the memory
map to grow, so repeat the initial GetMemoryMap call to fetch the new
size.
Also roll bi_add_efi_data_and_exit into bi_load_efi_data as there's no
need for it to be a separate function.
PR: 202455
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
emaste [Thu, 7 Jan 2016 02:41:57 +0000 (02:41 +0000)]
MFC r287934: Increase EFI staging size from 32MB to 48MB
The EFI boot loader allocates a single chunk of contiguous memory to
hold the kernel, modules, and any other loaded data. This memory block
is relocated to the kernel's expected location during the transfer of
control from the loader to the kernel.
emaste [Thu, 7 Jan 2016 02:37:17 +0000 (02:37 +0000)]
MFC r292576: boot1.efi: show EFI error number, not full status value
EFI return values set the high bit to indicate an error. The log
messages changed here are printed only in the case of an error,
so including the error bit is redundant. Also switch to decimal to
match the error definitions (in sys/boot/efi/include/efierr.h).
emaste [Thu, 7 Jan 2016 02:33:28 +0000 (02:33 +0000)]
MFC r281000: Move i386/efi files to new home in efi/loader/arch/i386
This was not (and still is not) connected to the build, but the EFI
loader is in the process of being built for other than amd64 so these
files ought to live in their eventual MD location.
dteske [Thu, 7 Jan 2016 01:33:42 +0000 (01:33 +0000)]
MFC SVN revisions 280922,285875,285882.
r280922: Change contents of the exec variable in loader.conf (dteske/rpaulo)
r285875: Use double newlines consistently (trasz/foundation)
r285882: Use consistent spacing (trasz/foundation)
ngie [Wed, 6 Jan 2016 20:50:23 +0000 (20:50 +0000)]
MFC r270228:
r270228 (by asomers):
Numerous small fixes, mostly suggested by Coverity.
tests/sys/kern/unix_seqpacket_test.c
* Remove a duplicate error check in mk_pair_of_sockets
* Always close sockets in the success path of ATF test cases. Don't
bother with the error paths, because those are mostly assertions
anyway. Most of these socket leaks were reported by Coverity.
All of them are harmless, because each ATF test case runs in its
own process.
* Fix the len argument to send in shutdown_send and
shutdown_send_sigpipe. The old version was using sizeof a pointer
instead of sizeof the char array. Reported by Coverity.
* Change a few ATF_CHECK to ATF_REQUIRE if the test can't reasonably
continue past a failure.
ngie [Wed, 6 Jan 2016 20:21:40 +0000 (20:21 +0000)]
MFC r292328:
Integrate a number of testcases from tools/regression/lib/msun
into the FreeBSD test suite
There's no functional change with these testcases; they're purposely
being left in TAP format for the time being
Other testcases which crash on amd64/i386 as-is have not been
integrated yet (they need to be retested on a later version of
CURRENT, as I haven't used i386 in some time)
ngie [Wed, 6 Jan 2016 20:06:15 +0000 (20:06 +0000)]
MFC r292650,r292651:
r292650:
Move mac_bsdextended check up before running the test_libugidfw_strings testcases
I realize that these tests could be run before mac_bsdextended is loaded, but
it would overcomplicate things to special case handle the testcases before doing
the mac_bsdextended(4) feature check
The testcases will be split up so they can be run separately in the near future
r292651:
Delete the comment about running `test_libugidfw_strings` before testing
`mac_is_present` so it doesn't accidentally confuse people
ngie [Wed, 6 Jan 2016 20:02:49 +0000 (20:02 +0000)]
MFC r292570:
Integrate tools/regression/mac/mac_bsdextended and
tools/regression/mac/mac_portacl into the FreeBSD test suite as
tests/sys/mac/bsdextended and tests/sys/mac/portacl, respectively
ngie [Wed, 6 Jan 2016 19:40:37 +0000 (19:40 +0000)]
MFC r292530,r292546:
r292530:
- Use 1 for an exit code instead of -1 with err, errx, and exit
- Add unistd.h for getuid(3)
- Sort #includes
r292546:
- Convert testcase to TAP format
- Use nitems(x) instead of handrolled sizeof(x) / sizeof(*x) macro
- Do not mark count != 0 case with bsde_get_rule_count as a failure; this
generates false positives on systems with ugidfw rules set on it
rstone [Tue, 5 Jan 2016 16:58:07 +0000 (16:58 +0000)]
MFC r287920:
Fix /sbin/route to never look up (invalid) interface names through DNS
/sbin/route has a bug where if it is passed an interface name that does
not exist, it falls through and winds up interpreting it as a hostname.
It fails out eventually, but on a system where DNS lookup is broken you
can end up waiting for up to 60 seconds waiting for the DNS lookup to
timeout. I'm not quite sure what happens if the DNS lookup somehow
succeeds but I doubt that can end well.
emaste [Mon, 4 Jan 2016 16:33:54 +0000 (16:33 +0000)]
MFC r280351: Stop calling x86_efi_copyin and x86_efi_getdev directly
In HEAD this is to help port loader.efi to both 32 and 64-bit ARM where
we can use this file with minimal changes. Merged to stable/10 to
simplify MFCs of later EFI commits.
hselasky [Mon, 4 Jan 2016 09:52:40 +0000 (09:52 +0000)]
MFC r292838:
Add support for CQE zipping. CQE zipping reduces PCI overhead by
coalescing and zipping multiple CQEs into a single merged CQE. The
feature is enabled by default and can be disabled by a sysctl.
Implementing this feature mlx5_cqwq_pop() has been separated from
mlx5e_get_cqe().
hselasky [Mon, 4 Jan 2016 09:37:05 +0000 (09:37 +0000)]
MFC r289563,r291481,r292537,r292538,r292542,r292543,r292544 and r292834:
Update the LinuxKPI:
- Add more functions and types.
- Implement ACCESS_ONCE(), WRITE_ONCE() and READ_ONCE().
- Implement sleepable RCU mechanism using shared exclusive locks.
- Minor workqueue cleanup:
- Make some functions global instead of inline to ease debugging.
- Fix some minor style issues.
- In the zero delay case in queue_delayed_work() use the return value
from taskqueue_enqueue() instead of reading "ta_pending" unlocked and
also ensure the callout is stopped before proceeding.
- Implement drain_workqueue() function.
- Reduce memory consumption when allocating kobject strings in the
LinuxKPI. Compute string length before allocating memory instead of
using fixed size allocations. Make kobject_set_name_vargs() global
instead of inline to save some bytes when compiling.
ngie [Mon, 4 Jan 2016 07:11:15 +0000 (07:11 +0000)]
MFC r292814:
- Explicitly initialize ch to 0
- Delete some spurious whitespace
- Use calloc instead of malloc in the last test to ensure that
sendspace is properly zero'ed out
ngie [Mon, 4 Jan 2016 07:02:48 +0000 (07:02 +0000)]
MFC r292816,r292818,r292819:
r292816:
Place cancel and error under #ifdef DEBUG to mute
-Wunused-but-set-variable warnings reported by gcc 4.9
Remove some trailing whitespace as well
Tested with and without -DDEBUG
r292818:
Fix style(9) a bit and ensure that error from initializing kqueue(2) is
sane
- Push the kqueue(2) initialization down so the errno will correspond with
the failure instead of potentially being stomped on by functions called
by `PLAIN_REQUIRE_KERNEL_MODULE`
- Delete trailing whitespace
- Add spaces between braces for conditional and control blocks (for/if)
- Use err/errx instead of perror+printf+exit/printf+exit.
- Remove braces for single-line conditionals
Tested with and without -DDEBUG
r292819:
- Fix an improperly sized buffer for `pathname` [1]
- Fix a -Wunused-but-set-variable warning [2]
ngie [Sun, 3 Jan 2016 22:50:19 +0000 (22:50 +0000)]
MFC r279437,r284107:
r279437 (by rstone):
Allow Illumos code to co-exist with nv(9)
r284107 (by avg):
compat nvpair.h: make sure that the names are mangled only for kernel
Currently there is no good reason to mangle the userland API.
The change was introduced in eac1d566b46edef765754203bef22c75c1699966,
r279437. Also see https://reviews.freebsd.org/D1881.
I am still convinced that nv should not have introduced intentionally
conflicting API.
dim [Sun, 3 Jan 2016 17:23:16 +0000 (17:23 +0000)]
MFC r293015:
Merge r293013 from clang380-import branch:
Fix a clang 3.8.0 warning in pflogd.c:
contrib/pf/pflogd/pflogd.c:769:8: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses]
if (!if_exists(interface) == -1) {
^ ~~
The if_exists() function does not return -1, and even if it did, it
would not be the correct way to check. Just ditch the == -1 instead.
dim [Sun, 3 Jan 2016 17:19:17 +0000 (17:19 +0000)]
MFC r293014:
Merge r293006 from clang380-import branch:
For determining the compiler version, quote the string to be echo'd,
otherwise the command might fail. This is because clang -v now results
in the following:
FreeBSD clang version 3.8.0 (trunk 256633) (based on LLVM 3.8.0svn)
The second "3.8.8svn)" string tripped up the shell command.
This change reverts stable/10@r282122 and stable/10@r288340, and re-MFCs the
series again (r282122, r285339, and r288340).
More changes are pending to nv(9)/pci(4) after further review/work. Please see
the Phabricator review for more details (both https://reviews.freebsd.org/D4232
and https://reviews.freebsd.org/D4249 ).
- Tested with:
-- Booting VMware Fusion 8.1.0 running on a Haswell Apple Macbook Pro
-- Booting a Haswell machine with zfs and running some stress workloads with
VirtualBox guests
-- make tinderbox
-- kyua test -k /usr/tests/lib/libnv
Differential Revision: https://reviews.freebsd.org/D4249 (part of a larger diff)
Relnotes: yes
Reviewed by: oshogbo (implicit), sbruno (implicit)
Submitted by: Kevin Bowling <kevin.bowling@kev009.com>
Sponsored by: EMC / Isilon Storage Division
jamie [Thu, 31 Dec 2015 01:24:16 +0000 (01:24 +0000)]
MFC r292759:
Let old-style (shell-based) jail configuration handle jail names that
contain characters not allowed in a shell variable (such as "-").
These will be replaced by an underscore in jail config variables,
e.g. for jail "foo-bar" you would set "jail_foo_bar_hostname".
This is separate from the current code that changes the jail names
if they contain "." or "/". It also doesn't apply to jails defined
in a jail.conf file.