]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoAdd supporting changes for `Add limited sandbox capability to "make check"`
ngie [Mon, 14 Aug 2017 19:21:37 +0000 (19:21 +0000)]
Add supporting changes for `Add limited sandbox capability to "make check"`

Non-tests/... changes:
- Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration
  and propagate the appropriate environment down to *.test.mk.

tests/... changes:
- Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner,
  since tests/... is a special subdirectory tree compared to the others.

MFC after: 2 months
MFC with: r322511
Reviewed by: arch (silence), testing (silence)
Differential Revision: D12014

6 years agoAdd an UPDATING entry for r322511.
ngie [Mon, 14 Aug 2017 19:18:50 +0000 (19:18 +0000)]
Add an UPDATING entry for r322511.

MFC after: 2 months

6 years agoRegenerate src.conf(5) after change made in r322511 to "make check" behavior
ngie [Mon, 14 Aug 2017 19:03:55 +0000 (19:03 +0000)]
Regenerate src.conf(5) after change made in r322511 to "make check" behavior

6 years agoAdd limited sandbox capability to "make check"
ngie [Mon, 14 Aug 2017 19:03:05 +0000 (19:03 +0000)]
Add limited sandbox capability to "make check"

== Rationale ==

r295380 introduced "make check" and consolidated means for running
test code in an attempt to simplify running tests. One could either
install files/libraries/programs and run "make check", or run "make check"
with an explicit CHECKDIR, e.g., `make check CHECKDIR=$(make -V.OBJDIR)``.

One criticism that was received is that "make check" should be run with
the intent of making dev->test->commit easier, which means that the target
audience's workflow should be developers. One developer pattern available
in other opensource projects is to run test code from a developer sandbox,
instead of installing to a system.

== Method ==

This approach is slightly different from the standard approach, in the sense
that it builds and installs into a deterministic directory under .OBJDIR (as I call it,
the "sandbox"), then runs "make check" against that. In the event the test
run is successful, the deterministic directory is removed to save space.

== Approach ==

bsd.lib.mk, bsd.prog.mk:

To support this functionality, a new variable `HAS_TESTS` is being added.

HAS_TESTS enables appropriate behavior with bsd.lib.mk and bsd.prog.mk, as
follows:
- Add "make check" as an available target from the directory.
- Pass down appropriate variables via ${TESTS_ENV}, i.e.,
  ${TESTS_LD_LIBRARY_PATH} and ${TESTS_PATH}.

One should add "HAS_TESTS" to directories containing tests in them, e.g. from
bin/sh/Makefile,

  HAS_TESTS=
  SUBDIR.${MK_TESTS}+= tests

HAS_TESTS doesn't automatically add the tests subdirectory for flexibility
reasons.

bsd.opts.mk, src.opts.mk:
- The knob ${MK_MAKE_CHECK_USE_SANDBOX} has been added, both to explicitly
  direct (internally) when to set a deterministic ${DESTDIR} and to also allow
  users to disable this behavior globally, i.e., via src.conf.
- MK_TESTS has been promoted from src.opts.mk to bsd.opts.mk to leverage
  syntactic sugar for having MK_TESTS be a dependency for
  MK_MAKE_CHECK_USE_SANDBOX, but to also ensure that src.opts.mk isn't required
  to use suite.test.mk (which is a dependency of bsd.test.mk).

suite.test.mk:
- beforecheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified
  from a no-op to:
-- Build.
-- Run "make hierarchy" on the sandbox dir.
-- Install the tests/files to the sandbox dir.
- aftercheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified
  from a no-op to:
-- Remove the sandbox dir.

Again, because the dependency order set in bsd.test.mk is
beforecheck -> check -> aftercheck, "make check" will not be run unless
"beforecheck" completes successfully, and "aftercheck" will not be run unless
"beforecheck" and "check" complete successfully.

== Caveats ==

- This target must either be run with MK_INSTALL_AS_USER or as root. Otherwise
  it will fail when running "make install" as the default user/group for many
  makefiles when calling INSTALL is root/wheel.
- This target must be run from a suitable top-level directory. For example,
  running tests from `tests/sys/fs/tmpfs` won't work, but `tests/sys/fs` will,
  because `tests/sys/fs/tmpfs` relies on files installed by `tests/sys/fs`.
- Running MK_INSTALL_AS_USER may introduce determinism issues. However, using
  it could identify deficiences in tests in terms of needing to be run as
  root, which are not properly articulated in the test requirements.
- The doesn't negate the need for running "make installworld" and
  "make checkworld", etc. Again, this just is intended to simplify the
  dev->test->commit workflow.

== Cleanup done ==
- CHECKDIR is removed; one can use "MK_MAKE_CHECK_USE_SANDBOX=no" to enable
  "legacy" (r295380) behavior.

MFC after: 2 months
Relnotes: yes (CHECKDIR removed; "make check" behavior changed)
Requested by: jhb
Reviewed by: arch (silence), testing (silence)
Differential Revision: D11905

6 years agoRegenerate src.conf(5) per LLDB default change made in r322415
ngie [Mon, 14 Aug 2017 18:49:46 +0000 (18:49 +0000)]
Regenerate src.conf(5) per LLDB default change made in r322415

6 years agoRename RISC-V GCC config directory: riscv64 -> riscv
br [Mon, 14 Aug 2017 14:16:56 +0000 (14:16 +0000)]
Rename RISC-V GCC config directory: riscv64 -> riscv
(to match official RISC-V target for GCC 7.1).

This is only a minimal config required to build c start up (csu).

This fixes build after r322429 ("Make _TO_CPUARCH macro for
ARCH to CPUARCH conversions")

Reported by: lwhsu
Sponsored by: DARPA, AFRL

6 years agoPrint whole machine state on double fault.
kib [Mon, 14 Aug 2017 11:23:07 +0000 (11:23 +0000)]
Print whole machine state on double fault.

It is quite useful when double fault is not caused by a stack overflow.

Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoAdd {rd,wr}{fs,gs}base C wrappers for instructions.
kib [Mon, 14 Aug 2017 11:20:54 +0000 (11:20 +0000)]
Add {rd,wr}{fs,gs}base C wrappers for instructions.

Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoStyle.
kib [Mon, 14 Aug 2017 11:20:10 +0000 (11:20 +0000)]
Style.

Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoRemove confusion in the line explaining syntax of the msr read.
kib [Mon, 14 Aug 2017 11:19:31 +0000 (11:19 +0000)]
Remove confusion in the line explaining syntax of the msr read.
Specify words order in the display.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agohyperv: Update copyright for the files changed in 2017
sephe [Mon, 14 Aug 2017 06:00:50 +0000 (06:00 +0000)]
hyperv: Update copyright for the files changed in 2017

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11982

6 years agohyperv/hn: Re-set datapath after synthetic parts reattached.
sephe [Mon, 14 Aug 2017 05:55:16 +0000 (05:55 +0000)]
hyperv/hn: Re-set datapath after synthetic parts reattached.

Do this even for non-transparent mode VF. Better safe than sorry.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11981

6 years agohyperv/hn: Minor cleanup
sephe [Mon, 14 Aug 2017 05:46:50 +0000 (05:46 +0000)]
hyperv/hn: Minor cleanup

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11979

6 years agohyperv/hn: Fix/enhance receiving path when VF is activated.
sephe [Mon, 14 Aug 2017 05:40:52 +0000 (05:40 +0000)]
hyperv/hn: Fix/enhance receiving path when VF is activated.

- Update hn(4)'s stats properly for non-transparent mode VF.
- Allow BPF tapping to hn(4) for non-transparent mode VF.
- Don't setup mbuf hash, if 'options RSS' is set.
  In Azure, when VF is activated, TCP SYN and SYN|ACK go through hn(4)
  while the rest of segments and ACKs belonging to the same TCP 4-tuple
  go through the VF.  So don't setup mbuf hash, if a VF is activated
  and 'options RSS' is not enabled.  hn(4) and the VF may use neither
  the same RSS hash key nor the same RSS hash function, so the hash
  value for packets belonging to the same flow could be different!
- Disable LRO.
  hn(4) will only receive broadcast packets, multicast packets, TCP
  SYN and SYN|ACK (in Azure), LRO is useless for these packet types.
  For non-transparent, we definitely _cannot_ enable LRO at all, since
  the LRO flush will use hn(4) as the receiving interface; i.e.
  hn_ifp->if_input(hn_ifp, m).

While I'm here, remove unapplied comment and minor style change.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11978

6 years agoAdd myself
bhughes [Mon, 14 Aug 2017 05:31:51 +0000 (05:31 +0000)]
Add myself

Reported by: mckusick

6 years agohyperv/hn: Update VF's ibytes properly under transparent VF mode.
sephe [Mon, 14 Aug 2017 05:30:02 +0000 (05:30 +0000)]
hyperv/hn: Update VF's ibytes properly under transparent VF mode.

While, I'm here add comment about why updating VF's imcast stat is
not necessary.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11948

6 years agoAdd hinted attachment for non-FDT systems. Also, print a message if
ian [Mon, 14 Aug 2017 02:23:10 +0000 (02:23 +0000)]
Add hinted attachment for non-FDT systems.  Also, print a message if
setting up the timer fails, because on some types of chips that's the
first attempt to access the device.  If the chip is missing/non-responsive
then you'd get a driver that attached and didn't register the rtc, with
no clue about why.  On other chip types there are inits that come before
timer setup, and they already print messages about errors.

6 years agoAdd back the drivers for Dallas/Maxim ds13xx and Seiko S35390x now that
ian [Mon, 14 Aug 2017 00:12:14 +0000 (00:12 +0000)]
Add back the drivers for Dallas/Maxim ds13xx and Seiko S35390x now that
they've been rewritten/fixed to not cause panics by doing i2c transfers
before interrupts are available.

PR: 221227

6 years agoMinor fixes and enhancements for the s35390a i2c RTC driver...
ian [Mon, 14 Aug 2017 00:00:24 +0000 (00:00 +0000)]
Minor fixes and enhancements for the s35390a i2c RTC driver...

- Add FDT probe code.
- Do i2c transfers with exclusive bus ownership.
- Use config_intrhook_oneshot() to defer chip setup because some i2c
  busses can't do transfers without interrupts.
- Add a detach() routine.
- Add to module build.

6 years agoRemove the old ds1374 driver and use the ds13rtc driver instead. Adjust
ian [Sun, 13 Aug 2017 22:07:42 +0000 (22:07 +0000)]
Remove the old ds1374 driver and use the ds13rtc driver instead.  Adjust
several mips config files accordingly.

6 years agoChange "chiptype" to "compatible". Making the hint name the same as the FDT
ian [Sun, 13 Aug 2017 21:45:46 +0000 (21:45 +0000)]
Change "chiptype" to "compatible".  Making the hint name the same as the FDT
property name should make it easier to document the list of names accepted
by both configuration mechanisms.

6 years agolld: Add `-z muldefs` option.
emaste [Sun, 13 Aug 2017 21:11:48 +0000 (21:11 +0000)]
lld: Add `-z muldefs` option.

Obtained from: LLVM r310757

6 years agoAdd a new driver, ds13rtc, that handles all DS13xx series i2c RTC chips.
ian [Sun, 13 Aug 2017 21:02:40 +0000 (21:02 +0000)]
Add a new driver, ds13rtc, that handles all DS13xx series i2c RTC chips.

This driver supports only basic timekeeping functionality.  It completely
replaces the ds133x driver.  It can also replace the ds1374 driver, but that
will take a few other changes in MIPS code and config, and will be committed
separately.  It does NOT replace the existing ds1307 driver, which provides
access to some of the extended features on the 1307 chip, such as controlling
the square wave output signal.  If both ds1307 and ds13rtc drivers are
present, the ds1307 driver will outbid and win control of the device.

This driver can be configured with FDT data, or by using hints on non-FDT
systems.  In addition to the standard hints for i2c devices, it requires
a "chiptype" string of the form "dallas,ds13xx" where 'xx' is the chip id
(i.e., the same format as FDT compat strings).

6 years ago- Add myswlf
ohauer [Sun, 13 Aug 2017 18:59:19 +0000 (18:59 +0000)]
- Add myswlf

Reported by: mckusick

6 years agoAdd support for multiple GICv3 ITS devices. For this we add sc_irq_base
andrew [Sun, 13 Aug 2017 18:54:51 +0000 (18:54 +0000)]
Add support for multiple GICv3 ITS devices. For this we add sc_irq_base
and sc_irq_length to the softc to handle the base number of IRQs available,
make gicv3_get_nirqs return the number of available interrupt IDs, and
limit which CPUs we send interrupts to based on the numa domain.

The last point is only strictly needed on a dual socket ThunderX where we
are unable to send MSI/MSI-X interrupts between sockets.

Sponsored by: DARPA, AFRL

6 years agoAdd config_intrhook_oneshot(): schedule an intrhook function and unregister
ian [Sun, 13 Aug 2017 18:10:24 +0000 (18:10 +0000)]
Add config_intrhook_oneshot(): schedule an intrhook function and unregister
it automatically after it runs.

The config_intrhook mechanism allows a driver to stall the boot process
until device(s) required for booting are available, by not allowing system
inits to proceed until all intrhook functions have been unregistered.
Virtually all existing code simply unregisters from within the hook function
when it gets called.

This new function makes that common usage more convenient. Instead of
allocating and filling in a struct, passing it to a function that might (in
theory) fail, and checking the return code, now a driver can simply call
this cannot-fail routine, passing just the intrhook function and its arg.

Differential Revision: https://reviews.freebsd.org/D11963

6 years agoWhen read requests are sent from a filesystem running above g_journal,
mckusick [Sun, 13 Aug 2017 18:09:22 +0000 (18:09 +0000)]
When read requests are sent from a filesystem running above g_journal,
the g_journal level needs to check whether it is holding a newer
copy of the block than that which exists on the disk. If so, it
needs to return its copy. If not, it should pass the request down
to the disk to fulfill. It currently considers six queues:

0) delayed queue,
1) unsent (current queue),
2) in-flight to the journal (flush queue),
3) active journal (active queue),
4) inactive journal (inactive queue), and
5) inflight to the disk (copy queue).

Checking on two of these queues is unnecessary:

0) The delayed requests should not be used for reads because they
   have not yet been entered into the journal, so their value should
   reflect the disk contents, not the future contents that are not
   yet committed.

2) Because all the bio's in the flush queue are also found on the
   active queue, there is no need to inspect the flush queue for
   reads since they will be found when searching the active queue.

Submitted by: Dr. Andreas Longwitz <longwitz@incore.de>
Discussed with: kib
MFC after: 1 week

6 years agoEliminate a variable that is only ever set.
mckusick [Sun, 13 Aug 2017 18:06:38 +0000 (18:06 +0000)]
Eliminate a variable that is only ever set.

Submitted by: Dr. Andreas Longwitz <longwitz@incore.de>
Discussed with: kib
MFC after: 1 week

6 years agoThe *_meta_* functions include a radix parameter, a blk parameter, and
alc [Sun, 13 Aug 2017 16:39:49 +0000 (16:39 +0000)]
The *_meta_* functions include a radix parameter, a blk parameter, and
another parameter that identifies a starting point in the memory address
block.  Radix is a power of two, blk is a multiple of radix, and the
starting point is in the range [blk, blk+radix), so that blk can always be
computed from the other two.  This change drops the blk parameter from the
meta functions and computes it instead.  (On amd64, for example, this
change reduces subr_blist.o's text size by 7%.)

It also makes the radix parameters unsigned to address concerns that the
calculation of '-radix' might overflow without the -fwrapv option.  (See
https://reviews.freebsd.org/D11819.)

Submitted by: Doug Moore <dougm@rice.edu>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11964

6 years agoFix minor formatting issue.
tuexen [Sun, 13 Aug 2017 15:15:40 +0000 (15:15 +0000)]
Fix minor formatting issue.

6 years agosrat: use pmap_unmapbios
royger [Sun, 13 Aug 2017 14:50:38 +0000 (14:50 +0000)]
srat: use pmap_unmapbios

To match the pmap_mapbios.

Reported by: jhb
MFC with: r322403

6 years agoFix a regression in r321608.
kib [Sun, 13 Aug 2017 14:42:23 +0000 (14:42 +0000)]
Fix a regression in r321608.

On i386 with CPUID but without SSE2, set lfence_works to LMB_NONE
instead of looping.

Reported and tested by: Andre Albsmeier <andre@fbsd.e4m.org>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agosh: Add test for sh -c with missing command string.
jilles [Sun, 13 Aug 2017 14:36:10 +0000 (14:36 +0000)]
sh: Add test for sh -c with missing command string.

This already works correctly.

6 years agoWe don't use ARM_ARCH_6 in the tree, and haven't for a long long
imp [Sun, 13 Aug 2017 04:10:47 +0000 (04:10 +0000)]
We don't use ARM_ARCH_6 in the tree, and haven't for a long long
time. Remove it from here. As far as I could tell, nothing in ports
use it (either __ARM_ARCH or __ARM_ARCH_6__ is used in all the
apatches). We do have a define for _ARM_ARCH_6, but it's mostly unused
(and will remain, since it isn't in this file).

6 years agoTESTSDIR isn't required; remove it
ngie [Sun, 13 Aug 2017 01:08:37 +0000 (01:08 +0000)]
TESTSDIR isn't required; remove it

MFC after: 1 week
MFC with: r322450

6 years agoIntegrate the tests moved in r305626 in to the FreeBSD test suite
ngie [Sun, 13 Aug 2017 01:04:44 +0000 (01:04 +0000)]
Integrate the tests moved in r305626 in to the FreeBSD test suite

The reachover Kyuafiles were never added, and thus the tests were installed
as standalone tests, and not integrated into the full suite.

MFC after: 1 week
MFC with: r305626, 305629, r307863, r322447, r322448, r322449

6 years agoUse hardcoded IPv4/IPv6 addresses for google-public-dns-a.google.com instead
ngie [Sun, 13 Aug 2017 00:56:43 +0000 (00:56 +0000)]
Use hardcoded IPv4/IPv6 addresses for google-public-dns-a.google.com instead
of freefall.freebsd.org to unbreak the DNS tests

The address allocations for freefall.freebsd.org have changed in the past 4 years.
Use a more stable set of hardcoded addresses for now to make the tests succeed
reliably.

The hostname should be resolved dynamically instead of hardcoding the addresses in
the future. This is just a bandaid.

MFC after: 1 week

6 years agoMake root-privileges a requirement for the test
ngie [Sun, 13 Aug 2017 00:14:08 +0000 (00:14 +0000)]
Make root-privileges a requirement for the test

Some of the testcases try to manipulate sysctls that require root privileges,
e.g., "kern.sync_on_panic". Make root-privileges a hard requirement so the
tests don't raise false positives due to privilege issues when calling
sysctlbyname(3) on writable sysctls.

MFC after: 1 week

6 years agoFix result printing
ngie [Sun, 13 Aug 2017 00:04:50 +0000 (00:04 +0000)]
Fix result printing

- Flushing stdout prevents the buffer from being printed twice, fixing
  issues with stdout printing out the testplan, etc, twice.
- Don't print out raw source/line numbers; hide them behind comments.

MFC after: 1 week

6 years agoHide `sccsid` under #if 0, per example in style(9)
ngie [Sat, 12 Aug 2017 22:20:08 +0000 (22:20 +0000)]
Hide `sccsid` under #if 0, per example in style(9)

This fixes a -Wunused warning with gcc 6.3.0/7.0.0.

MFC after: 1 week

6 years agoMove NVME controller shutdown from being called as part of module unloading
nwhitehorn [Sat, 12 Aug 2017 22:13:06 +0000 (22:13 +0000)]
Move NVME controller shutdown from being called as part of module unloading
to being called through the newbus DEVICE_SHUTDOWN() path. This ensures that
the NVME controller gets shut down before the device and bus disappear
and prevents data corruption on shutdown on at least Samsung EVO 960 SSDs.

PR: kern/211852
Reviewed by: imp
MFC after: 2 weeks

6 years agoDelete trailing whitespace
ngie [Sat, 12 Aug 2017 21:26:46 +0000 (21:26 +0000)]
Delete trailing whitespace

MFC after: 1 month

6 years agobthidd(8): Add support for Apple's magic mouse
wulf [Sat, 12 Aug 2017 21:23:33 +0000 (21:23 +0000)]
bthidd(8): Add support for Apple's magic mouse

Note: Mouse's bthidd.conf record should contain vendor and device IDs
to make proper device detection. If it does not contain IDs,
regenerate record with "Query" command of recent bthidcontrol(8).

Submitted by: Dirk Engling <erdgeist@erdgeist.org>
Reviewed by: emax
Approved by: bapt (mentor), gonzo (mentor)
Differential Revision: https://reviews.freebsd.org/D3702

6 years agobthidd(8): Add support for vendor_id, product_id and version.
wulf [Sat, 12 Aug 2017 21:20:51 +0000 (21:20 +0000)]
bthidd(8): Add support for vendor_id, product_id and version.

Extend bthidd.conf format to store vendor and product IDs of remote
Bluetooth HID devices to make possible implementation of device
specific quirks inside bthidd(8).
Add support for querying of this information from device's SDP records
with bthidcontrol(8) "Query" command.

Submitted by: Dirk Engling <erdgeist@erdgeist.org>
Reviewed by: emax
Approved by: bapt (mentor), gonzo (mentor)
Differential Revision: https://reviews.freebsd.org/D3702

6 years agosh: Add tests for sh -c that already pass.
jilles [Sat, 12 Aug 2017 19:17:48 +0000 (19:17 +0000)]
sh: Add tests for sh -c that already pass.

PR: 220587
Submitted by: Ryan Moeller

6 years agoReliably enable debug exceptions on all CPUs.
jhb [Sat, 12 Aug 2017 18:42:54 +0000 (18:42 +0000)]
Reliably enable debug exceptions on all CPUs.

Previously, debug exceptions were only enabled on the boot CPU if
DDB was enabled in the dbg_monitor_init() function.  APs also called
this function, but since mp_machdep.c doesn't include opt_ddb.h, the
APs ended up calling an empty stub defined in <machine/debug_monitor.h>
instead of the real function.  Also, if DDB was not enabled in the kernel,
the boot CPU would not enable debug exceptions.

Fix this by adding a new dbg_init() function that always clears the OS
lock to enable debug exceptions which the boot CPU and the APs call.
This function also calls dbg_monitor_init() to enable hardware breakpoints
from DDB on all CPUs if DDB is enabled.  Eventually base support for
hardware breakpoints/watchpoints will need to move out of the DDB-only
debug_monitor.c for use by userland debuggers.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D12001

6 years agoDon't panic for PT_GETFPREGS.
jhb [Sat, 12 Aug 2017 18:38:18 +0000 (18:38 +0000)]
Don't panic for PT_GETFPREGS.

Only fetch the VFP state from the CPU if the thread whose registers are
being requested is the current thread.  If a stopped thread's registers
are being fetched by a debugger, the saved state in the PCB is already
valid.

Reviewed by: andrew
MFC after: 1 week

6 years agoRevert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches
rlibby [Sat, 12 Aug 2017 18:28:02 +0000 (18:28 +0000)]
Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches

Either need a different way to spell HALF_LDBL_MAX, or a different way
to spell LDBL_MAX_EXP, or a different approach.

Reported by: ian

6 years agoRe-remove excess / for installing SYMLINKS
lwhsu [Sat, 12 Aug 2017 18:11:41 +0000 (18:11 +0000)]
Re-remove excess / for installing SYMLINKS

This excess / was introduced in r280129, and fixed in r295230, but got
re-introduced while merging another branch in r298107.

Approved by: gjb
Differential Revision: https://reviews.freebsd.org/D11995

6 years agoAdd missing header.
sevan [Sat, 12 Aug 2017 17:46:50 +0000 (17:46 +0000)]
Add missing header.
S_IRUSR is defined in sys/stat.h

PR: 209229
Submitted by: <mt AT markoturk DOT info>
Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D12007

6 years agoBid for the device with BUS_PROBE_GENERIC, because this is very much a
ian [Sat, 12 Aug 2017 17:39:32 +0000 (17:39 +0000)]
Bid for the device with BUS_PROBE_GENERIC, because this is very much a
generic driver with minimal feature support for a large number of chips.
More featureful per-chip drivers might exist (especially out-of-tree) and
those should win the bidding even if they use BUS_PROBE_DEFAULT.

6 years agoarm*hf is no longer a thing, remove it from the conversion now that it's easy.
imp [Sat, 12 Aug 2017 17:07:32 +0000 (17:07 +0000)]
arm*hf is no longer a thing, remove it from the conversion now that it's easy.

Submitted by: andyt@

6 years agoMake _TO_CPUARCH macro for ARCH to CPUARCH conversions
imp [Sat, 12 Aug 2017 17:07:27 +0000 (17:07 +0000)]
Make _TO_CPUARCH macro for ARCH to CPUARCH conversions

Consolidate all the regular expressions to convert from MACHINE_ARCH
to MACHINE_CPUARCH into a variable and use that variable in preference
to the almost identical copies in the tree (which should have been
identical).

Differential Revision: https://reviews.freebsd.org/D11986

6 years agoSet usage() to show -d flag
sevan [Sat, 12 Aug 2017 15:51:46 +0000 (15:51 +0000)]
Set usage() to show -d flag
mkesdb supports the -d flag for enabling debug mode, as documented in the manual.

PR: 209865
Submitted by: Maya Rashish <coypu AT sdf DOT org>
Reviewed by: imp
Approved by: bcr (mentor)
Obtained from: NetBSD
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D11987

6 years agoImprove standard compliance for memset_s() and abort_handler_s().
kib [Sat, 12 Aug 2017 15:18:17 +0000 (15:18 +0000)]
Improve standard compliance for memset_s() and abort_handler_s().

abort_handler_s() currently simply calls abort(), though the standard
specifies more: "Writes an implementation-defined message to stderr
which must include the string pointed to by msg and calls abort()."

memset_s() is missing error condition "n > smax", and does not invoke
the constraint handler after filling the buffer: "following errors are
detected at runtime and call the currently installed constraint
handler function after storing ch in every location of the destination
range [dest, dest+destsz) if dest and destsz are themselves valid",
one of the errors is "n > smax" itself.

Submitted by: Yuri Pankov <yuripv@gmx.com>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D11991

6 years agoFix indent.
kib [Sat, 12 Aug 2017 14:58:09 +0000 (14:58 +0000)]
Fix indent.

Submitted by: Yuri Pankov <yuripv@gmx.com>
MFC after: 3 days

6 years agocxgbe(4): Save the last reported link parameters and compare them with
np [Sat, 12 Aug 2017 14:02:19 +0000 (14:02 +0000)]
cxgbe(4): Save the last reported link parameters and compare them with
the current state to determine whether to generate a link-state change
notification.  This fixes a bug introduced in r321063 that caused the
driver to sometimes skip these notifications.

Reported by: Jason Eggleston @ LLNW
MFC after: 3 days
Sponsored by: Chelsio Communications

6 years agoCorrect the -H longopt equivillant
sevan [Sat, 12 Aug 2017 12:17:38 +0000 (12:17 +0000)]
Correct the -H longopt equivillant

PR: 209876
Submitted by: <kdrakehp AT zoho DOT com>
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D11988

6 years agoFix a typo.
jhb [Fri, 11 Aug 2017 22:47:32 +0000 (22:47 +0000)]
Fix a typo.

6 years agolib/msun: avoid referring to broken LDBL_MAX
rlibby [Fri, 11 Aug 2017 22:41:24 +0000 (22:41 +0000)]
lib/msun: avoid referring to broken LDBL_MAX

LDBL_MAX is broken on i386:
https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html

Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
for some time, and newer versions of gcc are now warning that the
"floating constant exceeds range of 'long double'".  Avoid this by
referring to half the value of LDBL_MAX instead.

Reviewed by: bde
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon

6 years agoadd myself to calendar.freebsd
bhd [Fri, 11 Aug 2017 20:44:17 +0000 (20:44 +0000)]
add myself to calendar.freebsd

Requested by: mckusick

6 years agolldb: enable on i386
emaste [Fri, 11 Aug 2017 20:11:43 +0000 (20:11 +0000)]
lldb: enable on i386

It is functional on FreeBSD/i386 as of r322326.

Sponsored by: The FreeBSD Foundation

6 years agoarm: enable ARM_MANY_BOARD in NOTES for LINT build
emaste [Fri, 11 Aug 2017 19:49:29 +0000 (19:49 +0000)]
arm: enable ARM_MANY_BOARD in NOTES for LINT build

Added in r238189, ARM_MANY_BOARD adds support for multiple ARM boards in
a single kernel. Include it for LINT builds to avoid duplicate symbol
errors when linking with lld.

Sponsored by: The FreeBSD Foundation

6 years agoBump KERNELDUMP_BUFFER_SIZE to 4096.
markj [Fri, 11 Aug 2017 19:24:08 +0000 (19:24 +0000)]
Bump KERNELDUMP_BUFFER_SIZE to 4096.

The encrypted kernel dump code writes data in blocks of this size. A buffer
size of 4096 allows encrypted dumps to work with 4Kn drives.

Reviewed by: cem
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11870

6 years agoAdd SVNVERSION_CMD to bsd.own.mk, adding the capability to include
gjb [Fri, 11 Aug 2017 19:21:40 +0000 (19:21 +0000)]
Add SVNVERSION_CMD to bsd.own.mk, adding the capability to include
svnversion metadata to the runtime and kernel packages.

Instead of traversing src/sys, as is done by newvers.sh for uname(1),
a full tree walk is done to prevent userland and/or modifications
from not being reflected in a modified tree (M).

MFC after: 5 days
Sponsored by: The FreeBSD Foundation

6 years agoStop calling atrtc_set() from the xen timer clock_settime() method. That
ian [Fri, 11 Aug 2017 19:02:11 +0000 (19:02 +0000)]
Stop calling atrtc_set() from the xen timer clock_settime() method.  That
removes the only reference to atrtc_set() from outside of atrtc.c, so make
it static.

The xen timer driver registers as a realtime clock with 1us resolution.  In
the past that resulted in only the xen timer's clock_settime() getting
called, so it would call atrtc_set() to set the hardware clock as well.  As
of r32090, the clock_settime() method of all registered realtime clocks gets
called, so the xen driver no longer needs to chain-call the lower-resolution
driver.

Thanks to royger@ for talking me through the xen stuff, and for testing.

6 years agoAdd historical notes on QIC tape drives and fix a couple of issues in mt(1).
ken [Fri, 11 Aug 2017 18:43:52 +0000 (18:43 +0000)]
Add historical notes on QIC tape drives and fix a couple of issues in mt(1).

 o Density code 0x5 is also known as QIC-11, and should have a footnote
   reference.
 o Add notes on QIC tape drives from the bug report.  These may help anyone
   trying to use a QIC drive.
 o Take out a "more more" instance found by igor.
 o Bump the man page date.

The PR is 14 years old, so it's past time to retire it.

PR: doc/53596
Submitted by: tedm@toybox.placo.com
Reviewed by: bcr
Sponsored by: Spectra Logic

6 years agoRename at91_pmc's M_PMC malloc type to avoid duplicate definition
emaste [Fri, 11 Aug 2017 18:09:26 +0000 (18:09 +0000)]
Rename at91_pmc's M_PMC malloc type to avoid duplicate definition

M_PMC is defined in sys/dev/hwpmc/hwpmc_mod.c, and the LINT kernel build
fails when linking with lld due to a duplicate symbol error.

Sponsored by: The FreeBSD Foundation

6 years agoPerformance enhancements to reduce CPU utililization for large number of
davidcs [Fri, 11 Aug 2017 17:43:25 +0000 (17:43 +0000)]
Performance enhancements to reduce CPU utililization for large number of
TCP connections (order of tens of thousands), with predominantly Transmits.

Choice to perform receive operations either in IThread or Taskqueue Thread.

Submitted by:Vaishali.Kulkarni@cavium.com
MFC after:5 days

6 years agox86/crc32_sse42.c: quiet unused function warning
rlibby [Fri, 11 Aug 2017 17:05:31 +0000 (17:05 +0000)]
x86/crc32_sse42.c: quiet unused function warning

Reviewed by: cem
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11980

6 years agoHave sendfile_swapin() use vm_page_grab_pages().
markj [Fri, 11 Aug 2017 16:32:24 +0000 (16:32 +0000)]
Have sendfile_swapin() use vm_page_grab_pages().

Reviewed by: alc, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D11942

6 years agoModify vm_page_grab_pages() to handle VM_ALLOC_NOWAIT.
markj [Fri, 11 Aug 2017 16:29:22 +0000 (16:29 +0000)]
Modify vm_page_grab_pages() to handle VM_ALLOC_NOWAIT.

This will allow its use in sendfile_swapin().

Reviewed by: alc, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D11942

6 years agoAn invalid page can't be dirty.
alc [Fri, 11 Aug 2017 16:27:54 +0000 (16:27 +0000)]
An invalid page can't be dirty.

Reviewed by: kib
MFC after: 1 week

6 years agoacpi/srat: fix build without DMAP
royger [Fri, 11 Aug 2017 14:19:55 +0000 (14:19 +0000)]
acpi/srat: fix build without DMAP

Use pmap_mapbios to map memory used to store the cpus array.

Reported by: lwhsu
X-MFC-with: r322348

6 years agoFix indentation from r322401.
gjb [Fri, 11 Aug 2017 14:19:31 +0000 (14:19 +0000)]
Fix indentation from r322401.

MFC after: 3 days
MFC with: r322401
Sponsored by: The FreeBSD Foundation

6 years agoAvoid creating kernel-dbg.txz distribution sets and kernel-debug
gjb [Fri, 11 Aug 2017 14:18:11 +0000 (14:18 +0000)]
Avoid creating kernel-dbg.txz distribution sets and kernel-debug
packages when MK_DEBUG_FILES is 'no'.

MFC after: 5 days
Sponsored by: The FreeBSD Foundation

6 years agoOnly return the current cpu if it's in the cpumask. When we restrict the
andrew [Fri, 11 Aug 2017 12:45:58 +0000 (12:45 +0000)]
Only return the current cpu if it's in the cpumask. When we restrict the
cpumask it probably means we are unable to sent interrupts to CPUs outside
the map. As such only return the current CPU when it's within the mask
otherwise return the first valid CPU.

This is needed on ThunderX as, in a dual socket configuration, we are
unable to send MSI/MSI-X interrupts between sockets.

Reviewed by: mmel
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D11957

6 years agoMake sure the "vm_flags" and "vm_page_prot" fields get set correctly
hselasky [Fri, 11 Aug 2017 10:44:40 +0000 (10:44 +0000)]
Make sure the "vm_flags" and "vm_page_prot" fields get set correctly
in the VM area structure in the LinuxKPI when doing mmap() and that
unsupported bits are masked away.

While at it fix some redundant use of parenthesing inside some related
macros.

Found by: KrishnamRaju ErapaRaju <Krishna2@chelsio.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd a specialized function for DRM drivers to register themselves.
markj [Fri, 11 Aug 2017 03:59:48 +0000 (03:59 +0000)]
Add a specialized function for DRM drivers to register themselves.

Such drivers attach to a vgapci bus rather than directly to a pci bus. For
the rest of the LinuxKPI to work correctly in this case, we override the
vgapci bus' ivars with those of the grandparent.

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11932

6 years agoMicro-optimize kmem_unback().
markj [Fri, 11 Aug 2017 03:09:11 +0000 (03:09 +0000)]
Micro-optimize kmem_unback().

We can remove some unnecessary object radix tree lookups by using the
object memq to iterate over pages in the specified range. This does not,
however, eliminate the lookup needed in vm_page_free_toq() to remove each
tree entry.

Reviewed by: alc, kib (previous revision)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11945

6 years agoUpdate from sqlite3-3.14.1 to sqlite3-3.20.0. This is a private lib.
peter [Fri, 11 Aug 2017 00:00:01 +0000 (00:00 +0000)]
Update from sqlite3-3.14.1 to sqlite3-3.20.0.  This is a private lib.
This fixes a possible client-side crash when parsing corrupt databases.

6 years agoMake vm_page_sunbusy() assert that the page is unlocked.
markj [Thu, 10 Aug 2017 22:43:38 +0000 (22:43 +0000)]
Make vm_page_sunbusy() assert that the page is unlocked.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11946

6 years agoUpdate subversion 1.9.5 -> 1.9.7
peter [Thu, 10 Aug 2017 22:03:26 +0000 (22:03 +0000)]
Update subversion 1.9.5 -> 1.9.7

This includes a client-side fix for CVE-2017-9800.

6 years agobsdinstall: record DHCP config after obtaining lease
emaste [Thu, 10 Aug 2017 20:26:07 +0000 (20:26 +0000)]
bsdinstall: record DHCP config after obtaining lease

Previously we added an ifconfig_$INTERFACE line to rc.conf for each
unsuccessful DCHP attempt.

PR: 219515
Reviewed by: allanjude
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11967

6 years agoEnsure the clocks driver is attached before any drivers that need to enable
ian [Thu, 10 Aug 2017 19:42:30 +0000 (19:42 +0000)]
Ensure the clocks driver is attached before any drivers that need to enable
clocks in their attach().

6 years agomptable: fix i386 build failure
royger [Thu, 10 Aug 2017 17:46:57 +0000 (17:46 +0000)]
mptable: fix i386 build failure

Reported by: emaste
X-MFC-with: r322347

6 years agofnmatch(3): Update testcase for r322368.
pfg [Thu, 10 Aug 2017 17:03:46 +0000 (17:03 +0000)]
fnmatch(3): Update testcase for r322368.

6 years agoLimit descriptors stored in the pidfh structure.
oshogbo [Thu, 10 Aug 2017 16:50:13 +0000 (16:50 +0000)]
Limit descriptors stored in the pidfh structure.

Reviewed by: markj, cem
Differential Revision: https://reviews.freebsd.org/D11741

6 years agoStore directory descriptor in the pidfh structure and use unlinkat(2)
oshogbo [Thu, 10 Aug 2017 16:45:05 +0000 (16:45 +0000)]
Store directory descriptor in the pidfh structure and use unlinkat(2)
function instead of unlink(2).

Now when pidfile_remove() uses unlinkat(2) to remove the pidfile
it is safe to use this function in capability mode.

Style fix: sort headers.

PR: 220524
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D11692

6 years agofnmatch(3): improve POSIX conformance.
pfg [Thu, 10 Aug 2017 15:42:25 +0000 (15:42 +0000)]
fnmatch(3): improve POSIX conformance.

In a recent interpretation[1], "\\" shall return a non-zero value
(indicating either no match or an error).

The fix involves a change over r254091 and now the behavior matches the
Sun/IBM/HP closed source implementations and also likely musl libc.

Submitted by: Joerg Schilling <joerg at schily.net>
MFC after: 1 week

[1] http://austingroupbugs.net/view.php?id=806

6 years ago Add myself.
rcyu [Thu, 10 Aug 2017 15:31:45 +0000 (15:31 +0000)]
 Add myself.

Reported by: mckusick

6 years agoChanges to make mps(4) and mpr(4) handle reinit with reallocation.
ken [Thu, 10 Aug 2017 14:59:17 +0000 (14:59 +0000)]
Changes to make mps(4) and mpr(4) handle reinit with reallocation.

When the mps(4) and mpr(4) drivers need to reinitialize the
firmware, they sometimes need to reallocate all of the memory
allocated by the driver.  The reallocation happens whenever the IOC
Facts change.  That should only happen after a firmware upgrade.

If the reinitialization happens as a result of a timed out command
sent to the card, the command that timed out and triggered the
reinit may have been freed if iocfacts_allocate() reallocated all
memory.  If the caller attempts to access the command after that,
the kernel will panic because the caller will be dereferencing
freed memory.

The solution is to set a flag in the softc when we reallocate,
and avoid dereferencing the command strucure if we've reallocated.

The changes are largely the same in both drivers, since mpr(4) is a
derivative of mps(4).

 o In iocfacts_allocate(), if the IOC Facts have changed and we
   need to reallocate, set the REALLOCATED flag in the softc.

 o Change wait_command() to take a struct mps_command ** instead of
   a struct mps_command *.  This allows us to NULL out the caller's
   command pointer if we have to reinit the controller and the data
   structures get reallocated.  (The REALLOCATED flag will be set
   in the softc if that has happened.)

 o In every place that calls wait_command(), make sure we handle
   the case where the command is NULL after the call.

 o The mpr(4) driver has mpr_request_polled() which can also
   reinitialize the card.  Also check for reallocation there.

Reviewed by: scottl, slm
MFC after: 1 week
Sponsored by: Spectra Logic

6 years agoPurge deprecated locking macros.
sbruno [Thu, 10 Aug 2017 14:54:36 +0000 (14:54 +0000)]
Purge deprecated locking macros.

Submitted by: Matt Macy <matt@mattmacy.io>
Sponsored by: Limelight Networks

6 years agoIndent nested conditionals for readability.
gjb [Thu, 10 Aug 2017 14:18:58 +0000 (14:18 +0000)]
Indent nested conditionals for readability.

Sponsored by: The FreeBSD Foundation

6 years agoSupport for v1.10 (latest) of RISC-V privilege specification.
br [Thu, 10 Aug 2017 14:18:09 +0000 (14:18 +0000)]
Support for v1.10 (latest) of RISC-V privilege specification.

New version is not compatible on supervisor mode with v1.9.1
(previous version).

Highlights:
    o BBL (Berkeley Boot Loader) provides no initial page tables
      anymore allowing us to choose VM, to build page tables manually
      and enable MMU in S-mode.
    o SBI interface changed.
    o GENERIC kernel.
      FDT is now chosen standard for RISC-V hardware description.
      DTB is now provided by Spike (golden model simulator). This
      allows us to introduce GENERIC kernel. However, description
      for console and timer devices is not provided in DTB, so move
      these devices temporary to nexus bus.
    o Supervisor can't access userspace by default. Solution is to
      set SUM (permit Supervisor User Memory access) bit in sstatus
      register.
    o Compressed extension is now turned on by default.
    o External GCC 7.1 compiler used.
    o _gp renamed to __global_pointer$
    o Compiler -march= string is now in use allowing us to choose
      required extensions (compressed, FPU, atomic, etc).

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D11800

6 years agolldb: Report inferior signals as signals, not exceptions, on FreeBSD
emaste [Thu, 10 Aug 2017 13:51:04 +0000 (13:51 +0000)]
lldb: Report inferior signals as signals, not exceptions, on FreeBSD

This is the FreeBSD equivalent of LLVM r238549.

This serves 2 purposes:

* LLDB should handle inferior process signals SIGSEGV/SIGILL/SIGBUS/
  SIGFPE the way it is suppose to be handled. Prior to this fix these
  signals will neither create a coredump, nor exit from the debugger
  or work for signal handling scenario.
* eInvalidCrashReason need not report "unknown crash reason" if we have
  a valid si_signo

llvm.org/pr23699

Patch by Karnajit Wangkhem

Differential Revision:  https://reviews.llvm.org/D35223

Submitted by: Karnajit Wangkhem
Obtained from: LLVM r310591

6 years agoEnable OF_setprop API function to add property in FDT
mw [Thu, 10 Aug 2017 13:45:56 +0000 (13:45 +0000)]
Enable OF_setprop API function to add property in FDT

This patch modifies function ofw_fdt_setprop (called by OF_setprop),
so that it can add property, when replacing is not possible.
Adding property is needed to fixup FDT's that have missing
properties.

Submitted by: Patryk Duda <pdk@semihalf.com>
Reviewed by: nwhitehorn, cognet (mentor)
Approved by: cognet (mentor)
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D11879

6 years agoFurther revise r322327 and r322352 in release/packages/kernel.ucl.
gjb [Thu, 10 Aug 2017 13:32:04 +0000 (13:32 +0000)]
Further revise r322327 and r322352 in release/packages/kernel.ucl.

Use PPID and PID to kill off the pre-install and parent pkg(8)
processes unless 'Y' or 'y' are entered at the prompt if the user
wants to proceed with upgrading the kernel and userland at the same
time.

This restores some of the logic and intent of r322327, with the
caveat of printing "child process terminated unexpectedly."

MFC after: 5 days
MFC with: r322327, r322352
Sponsored by: The FreeBSD Foundation

6 years agoUse integer type to pass around jiffies and/or ticks values in the
hselasky [Thu, 10 Aug 2017 13:05:40 +0000 (13:05 +0000)]
Use integer type to pass around jiffies and/or ticks values in the
LinuxKPI because in FreeBSD ticks are 32-bit.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoMark PROFILE option as broken when targetting mips64
emaste [Thu, 10 Aug 2017 13:01:19 +0000 (13:01 +0000)]
Mark PROFILE option as broken when targetting mips64

The assembly in sys/mips/include/profile.h will only work for o32 ABI.

Submitted by: Alexander Richardson
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11950