]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoScript that knows how to put boot blocks onto a device. Eventually,
Warner Losh [Fri, 15 Dec 2017 06:34:11 +0000 (06:34 +0000)]
Script that knows how to put boot blocks onto a device.  Eventually,
this will be installed into /usr/sbin, but for now it's just used for
the boot loader regression script. It's still a bit green, and likely
will get edge cases wrong still. It's also x86 centric at the moment,
but will be enhanced shortly for u-boot, CHRP PowerPC and other
methods.

Sponsored by: Netflix

6 years agopw(8): r326738 broke expiration arithmetic in case of `-D' flag not supplied.
Eugene Grosbein [Fri, 15 Dec 2017 06:05:16 +0000 (06:05 +0000)]
pw(8): r326738 broke expiration arithmetic in case of `-D' flag not supplied.

Fix it and rename misnamed time_t variables `expire_days, password_days'
(always holding absolute time) to `expire_time, password_time'.

Add a comment for a case of overloading `cmdcnf->password_days'
and `cmdcnf->expire_days' with absolute time.

Reported by: markj
Approved by: mav (mentor)
MFC after: 1 week

6 years agobhnd(4)/bwn(4): Fix a number of small issues reported by Coverity.
Landon J. Fuller [Fri, 15 Dec 2017 04:51:47 +0000 (04:51 +0000)]
bhnd(4)/bwn(4): Fix a number of small issues reported by Coverity.

- Fix reference of uninitialized error value in bhndb_generic_resume() if
  the dynamic window count is 0.

- Fix incorrect bhnd_pmu(4) UPTME_MASK and PLL0_PC2_WILD_INT_MASK
  constants.

- Variable definitions referenced by our generated SPROM layouts will never
  be NULL, but add explicit asserts to make that clear.

- Add missing variable initialization in bhnd_nvram_sprom_ident().

- Fix leak of driver array in bhnd_erom_probe_driver_classes().

- Fix zero-length memset() in bhndb_pci_eio_init().

- Fix an off-by-one error and potential invalid OOBSEL bit shift operation
  in bcma_dinfo_init_intrs().

- Remove dead code in siba_suspend_hw().

- Fix duplicate call to bhnd_pmu_enable_regulator() in both the enable and
  disable code paths of bhnd_compat_cc_pmu_set_ldoparef().

Reported by: Coverity
CIDs: 135519413620201362022137311413665631373115,
13815691381579138355513835661383571
Sponsored by: The FreeBSD Foundation

6 years agoHandle the Facility Unavailable exception as a SIGILL
Justin Hibbits [Fri, 15 Dec 2017 04:11:20 +0000 (04:11 +0000)]
Handle the Facility Unavailable exception as a SIGILL

Currently Facility Unavailable is absent and once an application
tries to use or access a register from a feature disabled in the
CPU it causes a kernel panic.

A simple test-case is:

int main() { asm volatile ("tbegin.;"); }

which will use TM (Hardware Transactional Memory) feature which
is not supported by the kernel and so will trigger the following
kernel panic:

----

fatal user trap:

    exception       = 0xf60 (unknown)
    srr0            = 0x10000890
    srr1            = 0x800000000000f032
    lr              = 0x100004e4
    curthread       = 0x5f93000
    pid = 1021, comm = htm

panic: unknown trap
cpuid = 40
KDB: stack backtrace:
Uptime: 3m18s
Dumping 10 MB (3 chunks)
    chunk 0: 11MB (2648 pages) ... ok
    chunk 1: 1MB (24 pages) ... ok
    chunk 2: 1MB (2 pages)panic: IOMMU mapping error: -4

cpuid = 40
Uptime: 3m18s

----

Since Hardware Transactional Memory is not yet supported by FreeBSD, treat
this as an illegal instruction.

PR: 224350
Submitted by: Gustavo Romero <gromero_AT_ibm_DOT_com>
MFC after: 2 weeks

6 years agobsd-family-tree: add dfly 5.0.[12]
Eitan Adler [Fri, 15 Dec 2017 03:46:52 +0000 (03:46 +0000)]
bsd-family-tree: add dfly 5.0.[12]

6 years agobsd-family-tree: Add NetBSD 7.0.2
Eitan Adler [Fri, 15 Dec 2017 03:36:48 +0000 (03:36 +0000)]
bsd-family-tree: Add NetBSD 7.0.2

Pulled directly from NetBSD

6 years agoMinor cleanups found while fixing a bug involving double mapping of low
Bruce Evans [Fri, 15 Dec 2017 03:05:14 +0000 (03:05 +0000)]
Minor cleanups found while fixing a bug involving double mapping of low
memory:

Load the kernel eflags less magically, as in locore.  The magic increased
when I removed eflags from the pcb in r305899.

Remove a jump to low memory that became garbage when the i386 version was
mostly replaced by the amd64 version in r235622.

The amd64 version is very similar.  It still loads the flags magically,
but is not missing comments about using the special page table.

Reviewed by: kib

6 years agoMFC: r326864
Jung-uk Kim [Thu, 14 Dec 2017 23:21:31 +0000 (23:21 +0000)]
MFC: r326864

Merge ACPICA 20171214.

6 years agoImport ACPICA 20171214.
Jung-uk Kim [Thu, 14 Dec 2017 22:56:53 +0000 (22:56 +0000)]
Import ACPICA 20171214.

6 years agoBelatedly add syncwait.
Mark Johnston [Thu, 14 Dec 2017 22:15:46 +0000 (22:15 +0000)]
Belatedly add syncwait.

X-MFC with: r326861

6 years agoMake indentation consistent with other tests, and use syncwait.
Mark Johnston [Thu, 14 Dec 2017 22:14:07 +0000 (22:14 +0000)]
Make indentation consistent with other tests, and use syncwait.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoAdd some basic tests for gmirror read and write error handling.
Mark Johnston [Thu, 14 Dec 2017 22:11:35 +0000 (22:11 +0000)]
Add some basic tests for gmirror read and write error handling.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoPlug an ifaddr leak when changing a route's src
Ryan Stone [Thu, 14 Dec 2017 20:48:50 +0000 (20:48 +0000)]
Plug an ifaddr leak when changing a route's src

If a route is modified in a way that changes the route's source
address (i.e. the address used to access the gateway), then a
reference on the ifaddr representing the old source address will
be leaked if the address type does not have an ifa_rtrequest
method defined.  Plug the leak by releasing the reference in
all cases.

Differential Revision: https://reviews.freebsd.org/D13417
Reviewed by: ae
MFC after: 3 weeks
Sponsored by: Dell

6 years agoAdd identifier for POWER9 CPU to CPU list
Justin Hibbits [Thu, 14 Dec 2017 20:01:04 +0000 (20:01 +0000)]
Add identifier for POWER9 CPU to CPU list

Without the identifier in the list booting FreeBSD results in printing the
following (from a PowerKVM boot):

cpu0: Unknown PowerPC CPU revision 0x1201, 2550.00 MHz

For now, add the same feature list as POWER8.  As new capabilities are added to
support POWER9 specific features, they will be added to this.

PR: 224344
Submitted by: Breno Leitao <breno_DOT_leitao_AT_gmail_DOT_com>

6 years agoRevert r326855: Cargo cut a fix for the regressions r326585 caused.
Warner Losh [Thu, 14 Dec 2017 18:57:17 +0000 (18:57 +0000)]
Revert r326855: Cargo cut a fix for the regressions r326585 caused.

This was an experiment that landed in the wrong branch and was pushed
accidentally. It's best if it is ignored because the difference was
due to vers.o being different, not float.o... And it was confirmed to
not fix anything...

Pointy Hat to: imp

6 years agoTurn loader GELI support in the boot loaders off by default as a
Warner Losh [Thu, 14 Dec 2017 17:00:24 +0000 (17:00 +0000)]
Turn loader GELI support in the boot loaders off by default as a
temporary workaround. This fixes zfs booting generally, but breaks all
GELI booting by default. Add note to UPDATING to this effect. When the
GELI issues are resolved, this will be reverted.

6 years agoFix comments after bump in size.
Warner Losh [Thu, 14 Dec 2017 16:51:43 +0000 (16:51 +0000)]
Fix comments after bump in size.

6 years agoCargo cut a fix for the regressions r326585 caused.
Warner Losh [Thu, 14 Dec 2017 16:51:26 +0000 (16:51 +0000)]
Cargo cut a fix for the regressions r326585 caused.

We need to include ficl.h after the standard includes, rather than
before them. It changes the generated code in ways that haven't been
completely analyized. This restores the old code generation (as
verified by md5 changing back for zfsloader).

This should restore GPT + ZFS and GPT + ZFS + GELI booting that was
broken in r326585 (or would have been if r326584 hadn't broken the
build).

Sponsored by: Netflix

6 years agolibefi: make efichar.h more usable in stand code
Toomas Soome [Thu, 14 Dec 2017 16:41:52 +0000 (16:41 +0000)]
libefi: make efichar.h more usable in stand code

Use _STANDALONE for guard expression in efichar.[ch] and add efi_char typedef.
clean up boot1.c, and replace for loop in efipart.c with ucs2len().

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D13488

6 years agodhclient(8): raise WARNS to 3
Alan Somers [Thu, 14 Dec 2017 15:41:32 +0000 (15:41 +0000)]
dhclient(8): raise WARNS to 3

Mostly had to fix a lot of signed/unsigned comparison warnings

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoRe-add spaces lost in r326436.
Mark Johnston [Thu, 14 Dec 2017 15:40:03 +0000 (15:40 +0000)]
Re-add spaces lost in r326436.

X-MFC with: r326436

6 years agoIn devfs_lookupx() dotdot lookup case, avoid dereferencing
Konstantin Belousov [Thu, 14 Dec 2017 13:41:11 +0000 (13:41 +0000)]
In devfs_lookupx() dotdot lookup case, avoid dereferencing
dvp->v_mount after dvp is unlocked.

The vnode might be reclaimed after unlock, so v_mount becomes NULL.
Cache the struct mount pointer before the unlock, the struct is
type-stable.

Note that devfs_allocv() reads mp->mnt_data but does not operate on it
further when dirent is doomed.  The unmount cannot proceed until all
dirents are reclaimed.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoAdd the virtualisation special register definitions.
Andrew Turner [Thu, 14 Dec 2017 13:19:43 +0000 (13:19 +0000)]
Add the virtualisation special register definitions.

Submitted by: Mihai Carabas <mihai.carabas@gmail.com>
Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D11846

6 years agoFix mbuf leak when TCPMD5_OUTPUT() method returns error.
Andrey V. Elsukov [Thu, 14 Dec 2017 12:54:20 +0000 (12:54 +0000)]
Fix mbuf leak when TCPMD5_OUTPUT() method returns error.

PR: 223817
MFC after: 1 week

6 years agoReplace usage of fparselen(3) by a getline(3)
Baptiste Daroussin [Thu, 14 Dec 2017 08:57:37 +0000 (08:57 +0000)]
Replace usage of fparselen(3) by a getline(3)

This allow to remove the dependency on libutil

6 years agoAdd basic bwn(4) support for the (BCMA-based) BCM43224 and BCM43225.
Landon J. Fuller [Thu, 14 Dec 2017 06:45:04 +0000 (06:45 +0000)]
Add basic bwn(4) support for the (BCMA-based) BCM43224 and BCM43225.

- Add the BCM4322X D11 core revision and missing BCM43224 PCI device ID to
  our device tables.
- Disable the DMA engine parity check (rather than adding parity support
  to the to-be-replaced bwn(4) DMA implementation).

Currently, N-PHY support in bwn(4) is GPL licensed, and is not included by
default. Until this is replaced with Broadcom's ISC-licensed N-PHY
implementation, bwn(4) must be rebuilt to enable N-PHY support.

To build bwn(4) with N-PHY support, add the following lines to your kernel
configuration file and rebuild the kernel (and modules):

options BWN_GPL_PHY

To test bwn(4) with a BCM43224/BCM43225 device, install the firmware from
the net/bwn-firmware-kmod port, and place the following lines in
loader.conf(5):

hw.bwn_pci.preferred="1"

if_bwn_pci_load="YES
bwn_v4_ucode_load="YES"
bwn_v4_n_ucode_load="YES"
bwn_v4_lp_ucode_load="YES"

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agoAllow bman-portals and qman-portals to attach to simple-bus
Justin Hibbits [Thu, 14 Dec 2017 04:41:07 +0000 (04:41 +0000)]
Allow bman-portals and qman-portals to attach to simple-bus

Official Linux dts's put the individual portals under a simple-bus, rather
than under a '*-portals' grouping.  This adds a hack to permit that, which
gets us closer to using stock device trees for DPAA-based devices.

6 years agobhndb(4): Fix two register window overcommit bugs introduced in r326297:
Landon J. Fuller [Thu, 14 Dec 2017 03:41:12 +0000 (03:41 +0000)]
bhndb(4): Fix two register window overcommit bugs introduced in r326297:

- The window target must always be updated when stealing a register window.
- Fix missing initialization of bhndb(4) region alloc_flags when
  registering statically mapped port regions (caught by scan-build).

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agobhnd_chipc(4): Correct typo in flag macros that broke clearing of GPIO
Landon J. Fuller [Thu, 14 Dec 2017 03:12:05 +0000 (03:12 +0000)]
bhnd_chipc(4): Correct typo in flag macros that broke clearing of GPIO
pin flags.

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agobhnd(4): Add missing enclosing parentheses to the bhnd bus space macros to
Landon J. Fuller [Thu, 14 Dec 2017 03:03:08 +0000 (03:03 +0000)]
bhnd(4): Add missing enclosing parentheses to the bhnd bus space macros to
avoid precedence bugs.

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agobhnd(4): Include board_devid in the bhnd_board_info structure, and populate
Landon J. Fuller [Thu, 14 Dec 2017 01:58:05 +0000 (01:58 +0000)]
bhnd(4): Include board_devid in the bhnd_board_info structure, and populate
the expected default board_vendor value on MIPS SoCs.

This is required by bwn(4) to differentiate between single-band and
dual-band device variants that otherwise share a common chip ID.

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agoReduce size of several on-stack string buffers.
Alexander Motin [Wed, 13 Dec 2017 21:17:00 +0000 (21:17 +0000)]
Reduce size of several on-stack string buffers.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

6 years agodhclient(8): Don't shift through the sign bit of a signed int
Alan Somers [Wed, 13 Dec 2017 20:48:20 +0000 (20:48 +0000)]
dhclient(8): Don't shift through the sign bit of a signed int

PR: 208007
Submitted by: Michael McConville <mmcco@mykolab.com>
MFC after: 3 weeks

6 years agonetmap pkt-gen tool: Fix memset(3) argument order
Conrad Meyer [Wed, 13 Dec 2017 19:36:29 +0000 (19:36 +0000)]
netmap pkt-gen tool: Fix memset(3) argument order

Submitted by: Michael McConville <mmcco AT mykolab.com>
Sponsored by: Dell EMC Isilon

6 years agoPull in r315334 from upstream lld trunk (by Rafael Espindola):
Dimitry Andric [Wed, 13 Dec 2017 19:03:48 +0000 (19:03 +0000)]
Pull in r315334 from upstream lld trunk (by Rafael Espindola):

  Don't create a dummy __tls_get_addr.

  We just don't need one with the current setup.

  We only error on undefined references that are used by some
  relocation.

  If we managed to relax all uses of __tls_get_addr, no relocation uses
  it and we don't produce an error.

  This is less code and fixes the case were we fail to relax. Before we
  would produce a broken output, but now we produce an error.

Pull in r320390 from upstream lld trunk (by Rafael Espindola):

  Create reserved symbols early so they can be versioned.

  This fixes pr35570.

  We were creating these symbols after parsing version scripts, so they
  could not be versioned.

  We cannot move the version script parsing later because we need it for
  lto.

  One option is to move both addReservedSymbols and
  createSyntheticSections earlier. The disadvantage is that some
  sections created by createSyntheticSections replace other input
  sections. For example, gdb index replaces .debug_gnu_pubnames, so it
  wants to run after gc sections so that it can set S->Live to false.

  What this patch does instead is to move just the ElfHeader creation
  early.

Pull in r320412 from upstream lld trunk (by Rafael Espindola):

  Handle symbols pointing to output sections.

  Now that gc sections runs after linker defined symbols are added it
  can see symbols that point to an OutputSection.

  Should fix a bot failure.

Pull in r320431 from upstream lld trunk (by Peter Collingbourne):

  ELF: Do not follow relocation edges to output sections during GC.

  This fixes an assertion error introduced by r320390.

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

Together these fix handling of reserved symbols, in particular _end,
which is needed to make brk(2) and sbrk(2) work correctly.  This
unbreaks the emacs ports on amd64, and also appears to unbreak most of
world on i386.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13466

6 years agoCleaup, no functional change.
Michael Tuexen [Wed, 13 Dec 2017 17:11:57 +0000 (17:11 +0000)]
Cleaup, no functional change.

6 years agoSPDX: some uses of the RSA-MD license.
Pedro F. Giffuni [Wed, 13 Dec 2017 16:30:39 +0000 (16:30 +0000)]
SPDX: some uses of the RSA-MD license.

6 years agoFix kernel build if MAC is not defined.
Fedor Uporov [Wed, 13 Dec 2017 16:14:38 +0000 (16:14 +0000)]
Fix kernel build if MAC is not defined.

Reported by:    Ravi Pokala, Andrew Turner
Approved by:    pfg (mentor)
MFC after:      1 week

6 years agoSPDX: mostly fixes to previous changes.
Pedro F. Giffuni [Wed, 13 Dec 2017 16:13:17 +0000 (16:13 +0000)]
SPDX: mostly fixes to previous changes.

Introduce the recently approved BSD-1-Clause and replace 0BSD which
never did fit well our use cases.

6 years agoReplace homemade equivalent of tolower(3) by towlower(3)
Baptiste Daroussin [Wed, 13 Dec 2017 16:09:00 +0000 (16:09 +0000)]
Replace homemade equivalent of tolower(3) by towlower(3)

This will help in the futur making diff -i works with multibyte

6 years agoTone down the description for the growfs "-y" flag.
Edward Tomasz Napierala [Wed, 13 Dec 2017 14:08:33 +0000 (14:08 +0000)]
Tone down the description for the growfs "-y" flag.

MFC after: 2 weeks

6 years agoUse ataio ccb instead of general ccb to avoid excessice stack usage.
Warner Losh [Wed, 13 Dec 2017 07:07:27 +0000 (07:07 +0000)]
Use ataio ccb instead of general ccb to avoid excessice stack usage.

6 years agofind(1): remove unused variable
Eitan Adler [Wed, 13 Dec 2017 03:36:33 +0000 (03:36 +0000)]
find(1): remove unused variable

6 years agoFollow-up to r325967, which removed /etc/casper, by also removing it
Dimitry Andric [Tue, 12 Dec 2017 22:21:20 +0000 (22:21 +0000)]
Follow-up to r325967, which removed /etc/casper, by also removing it
from BSD.root.dist, so it does not get created again on installworld.

6 years agoMFV r326785: 8880 improve DTrace error checking
Mark Johnston [Tue, 12 Dec 2017 22:08:34 +0000 (22:08 +0000)]
MFV r326785: 8880 improve DTrace error checking

illumos/illumos-gate@2cf374268f3e1c9e9be6367466b183d27632583a
https://github.com/illumos/illumos-gate/commit/2cf374268f3e1c9e9be6367466b183d27632583a

https://www.illumos.org/issues/8880

Reviewed by: Tim Kordas <tim.kordas@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Jerry Jelinek <jerry.jelinek@joyent.com>

MFC after: 1 week

6 years agoRevert r326792, r326784, r326772, r326712
Warner Losh [Tue, 12 Dec 2017 22:06:22 +0000 (22:06 +0000)]
Revert r326792, r326784, r326772, r326712

Something subtle is creating problems for disk access on ubldr. Back
it out unti that can be sorted out.

Sponsored by: Netflix

6 years agoCorrect initialization of pc on powerpc.
Mark Johnston [Tue, 12 Dec 2017 20:41:11 +0000 (20:41 +0000)]
Correct initialization of pc on powerpc.

PR: 224293
Submitted by: Breno Leitao <breno.leitao@gmail.com>
X-MFC with: r326774
Pointy hat: markj

6 years ago1k objects on the stack are a bad idea. While it's likely safe in this
Warner Losh [Tue, 12 Dec 2017 20:22:09 +0000 (20:22 +0000)]
1k objects on the stack are a bad idea. While it's likely safe in this
context, it's also safe to allocate the memory and free it instead.

Noticed by: Eugene Grosbein's script

6 years agoMove buffer size checks outside of the vnode locks.
Fedor Uporov [Tue, 12 Dec 2017 20:15:57 +0000 (20:15 +0000)]
Move buffer size checks outside of the vnode locks.

Reviewed by:    kib, cem, pfg (mentor)
Approved by:    pfg (mentor)
MFC after:      1 weeks

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

6 years agoFix extattr getters in case of neither uio nor buffer was not passed to VOP_*.
Fedor Uporov [Tue, 12 Dec 2017 20:02:48 +0000 (20:02 +0000)]
Fix extattr getters in case of neither uio nor buffer was not passed to VOP_*.

Approved by:    pfg (mentor)
MFC after:      2 weeks

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

6 years agoActually insert the free(d) call missed in r326802.
Warner Losh [Tue, 12 Dec 2017 19:45:24 +0000 (19:45 +0000)]
Actually insert the free(d) call missed in r326802.

Noticed by: rpokala@

6 years agoIniailize str so ucs2_to_utf8 won't free stack garbage.
Warner Losh [Tue, 12 Dec 2017 19:26:28 +0000 (19:26 +0000)]
Iniailize str so ucs2_to_utf8 won't free stack garbage.

CID: 1381037
Sponsored by: Netflix

6 years agoAdd sanity testing against maximum sane lengths for device paths for
Warner Losh [Tue, 12 Dec 2017 19:26:24 +0000 (19:26 +0000)]
Add sanity testing against maximum sane lengths for device paths for
loader and kernel.

CID: 1383608
Sponsored by: Netflix

6 years agoFree load_opt_buf after we're done with it.
Warner Losh [Tue, 12 Dec 2017 19:26:19 +0000 (19:26 +0000)]
Free load_opt_buf after we're done with it.

CID: 1383607
Sponsored by: Netflix

6 years agoFix resource leak. Free converted description after printing it.
Warner Losh [Tue, 12 Dec 2017 19:26:15 +0000 (19:26 +0000)]
Fix resource leak. Free converted description after printing it.
Also minor style sort of local vars.

CID: 1383606
Sponsored by: Netflix

6 years agoDon't leak new_data.
Warner Losh [Tue, 12 Dec 2017 19:26:10 +0000 (19:26 +0000)]
Don't leak new_data.

CID: 1383605
Sponsored by: Netflix

6 years agoCheck return value for set_bootvar and give a good error message.
Warner Losh [Tue, 12 Dec 2017 19:25:54 +0000 (19:25 +0000)]
Check return value for set_bootvar and give a good error message.

CID: 1383601
Sponsored by: Netflix

6 years agoless(1): diff reduction vs upstream
Alan Somers [Tue, 12 Dec 2017 17:34:35 +0000 (17:34 +0000)]
less(1): diff reduction vs upstream

No functional change.

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoAddress a possible lost wakeup for gmirror events.
Mark Johnston [Tue, 12 Dec 2017 17:29:34 +0000 (17:29 +0000)]
Address a possible lost wakeup for gmirror events.

g_mirror_event_send() acquires the I/O queue lock to deliver a wakeup
to the worker thread, and this is done after enqueuing the event.
So it's sufficient to check the event queue before atomically releasing
the queue lock and going to sleep.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoGive g_mirror_event_get() a more accurate name.
Mark Johnston [Tue, 12 Dec 2017 17:25:25 +0000 (17:25 +0000)]
Give g_mirror_event_get() a more accurate name.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoDecrement sc_writes when BIO_DELETE requests complete.
Mark Johnston [Tue, 12 Dec 2017 17:24:30 +0000 (17:24 +0000)]
Decrement sc_writes when BIO_DELETE requests complete.

Otherwise a gmirror that has received a BIO_DELETE request will never be
marked clean (unless sc_writes overflows).

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoRework alignment handling in __libc_allocate_tls() for Variant I of TLS layout.
Michal Meloun [Tue, 12 Dec 2017 11:25:30 +0000 (11:25 +0000)]
Rework alignment handling in __libc_allocate_tls() for Variant I of TLS layout.

There are two versions of variant I of TLS
- ARM and aarch64 uses original version of variant I here TP points to
  start of TCB followed by aligned TLS segment. Both TCB and TLS must
  be aligned to alignment of TLS section. The TCB[0] points to DTV vector
  and DTV values are real addresses (without bias).

- MIPS, PowerPC and RISC-V use modified version of variant I,
  where TP points (with bias) to TLS and TCB immediately precedes TLS
  without any alignment gap. Only TLS should be aligned. The TCB[0]
  points to DTV vector and DTV values are biased by constant value (0x8000)
  from real addresses.

Take all this in account when allocating memory for TLS structures.

MFC after: 1 month
Reviewed by: kib, mizhka
Tested by: mizhka(on mips)
Differential Revision: https://reviews.freebsd.org/D13378

6 years agoAttempt to unbreak buildworld
Antoine Brodin [Tue, 12 Dec 2017 09:46:53 +0000 (09:46 +0000)]
Attempt to unbreak buildworld

6 years agoClose the correct file descriptor.
Xin LI [Tue, 12 Dec 2017 06:56:21 +0000 (06:56 +0000)]
Close the correct file descriptor.

MFC after: 2 weeks

6 years agoDecode some PowerPC trap registers
Justin Hibbits [Tue, 12 Dec 2017 03:16:10 +0000 (03:16 +0000)]
Decode some PowerPC trap registers

Decode on Book-E:
* ESR (Exception Syndrome Register)
* MCSR (Machine Check Status Register)

On AIM:
* MSSSR (Memory Subsystem Status Register)

Makes it easier to tell at a glance the type of trap and machine check
conditions now.

6 years agogzip(1): Remove duplicate close()
Conrad Meyer [Tue, 12 Dec 2017 01:19:08 +0000 (01:19 +0000)]
gzip(1): Remove duplicate close()

CID: 1383560
Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years ago8880 improve DTrace error checking
Mark Johnston [Tue, 12 Dec 2017 00:51:39 +0000 (00:51 +0000)]
8880 improve DTrace error checking

illumos/illumos-gate@2cf374268f3e1c9e9be6367466b183d27632583a
https://github.com/illumos/illumos-gate/commit/2cf374268f3e1c9e9be6367466b183d27632583a

https://www.illumos.org/issues/8880

Reviewed by: Tim Kordas <tim.kordas@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Jerry Jelinek <jerry.jelinek@joyent.com>

6 years agoRevert part of 362772. It was causing problems for includes and making
Warner Losh [Mon, 11 Dec 2017 23:15:43 +0000 (23:15 +0000)]
Revert part of 362772. It was causing problems for includes and making
the menus disappear.

Sponsored by: Netflix

6 years agoCorrect a typo in syscon driver 'modify' logic
Kyle Evans [Mon, 11 Dec 2017 22:55:51 +0000 (22:55 +0000)]
Correct a typo in syscon driver 'modify' logic

Not previously caught because the current consumer (not yet in tree) doesn't
use the 'modify' bits (yet).

Reported by: rpokala

6 years agoPull in r320396 from upstream clang trunk (by Malcolm Parsons):
Dimitry Andric [Mon, 11 Dec 2017 20:04:40 +0000 (20:04 +0000)]
Pull in r320396 from upstream clang trunk (by Malcolm Parsons):

  [Sema] Fix crash in unused-lambda-capture warning for VLAs

  Summary:
  Clang was crashing when diagnosing an unused-lambda-capture for a VLA
  because From.getVariable() is null for the capture of a VLA bound.
  Warning about the VLA bound capture is not helpful, so only warn for
  the VLA itself.

Fixes: PR35555
  Reviewers: aaron.ballman, dim, rsmith

  Reviewed By: aaron.ballman, dim

  Subscribers: cfe-commits

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

This fixes a segfault when building recent audio/zynaddsubfx port
versions.

Reported by: hps
MFC after: 3 days

6 years agoIncrement encap_pad_mbuf_fail when m_dup() fails in padding
Stephen Hurd [Mon, 11 Dec 2017 20:01:28 +0000 (20:01 +0000)]
Increment encap_pad_mbuf_fail when m_dup() fails in padding

Previously, the counter was only incremented when m_append() failed.  Since
the function can also fail on m_dup() now, increment the counter there as
well.

Sponsored by: Limelight Networks

6 years agoPass the trap frame to fasttrap hooks.
Mark Johnston [Mon, 11 Dec 2017 19:21:39 +0000 (19:21 +0000)]
Pass the trap frame to fasttrap hooks.

The DTrace fasttrap entry points expect a struct reg containing the
register values of the calling thread. Perform the conversion in
fasttrap rather than in the trap handler: this reduces the number of
ifdefs and avoids wasting stack space for traps that don't involve
DTrace.

MFC after: 2 weeks

6 years agoAdd generic 'syscon' driver
Kyle Evans [Mon, 11 Dec 2017 18:04:04 +0000 (18:04 +0000)]
Add generic 'syscon' driver

Upstream dts for allwinner will require a syscon driver, since the emac node
coming in 4.15 will be using xref to /soc/syscon for configuring the emac
clock. Add a generic syscon driver to attach to /soc/syscon for use by
if_awg, providing basic read/write functionality to consumers.

syscon driver will also be used by arm64 at least for A64+H5 emac/if_awg.

Written by: mmel
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D13295

6 years agoFix regression with lua import
Warner Losh [Mon, 11 Dec 2017 16:18:05 +0000 (16:18 +0000)]
Fix regression with lua import

Don't print when we can't find a file. Copy it instead to the error
buffer. Higher level routines determine if it's appropriate to print
the error message.

Also, remove dead code (labeled bogusly lost functionality) since we
never used that functionality. Remove unused arg from interact() too.

Sponsored by: Netflix

6 years agoUnbreak gcc build by using (void) for functions that take no args.
Warner Losh [Mon, 11 Dec 2017 16:17:53 +0000 (16:17 +0000)]
Unbreak gcc build by using (void) for functions that take no args.

Sponsored by: Netflix

6 years agoUse a dedicated counter for inactive queue scans.
Mark Johnston [Mon, 11 Dec 2017 15:33:24 +0000 (15:33 +0000)]
Use a dedicated counter for inactive queue scans.

The laundry thread keeps track of the number of inactive queue scans
performed by the page daemon, and was previously using the v_pdwakeups
counter to count them. However, in some cases the inactive queue may
be scanned multiple times after a single wakeup, so it's more accurate
to use a dedicated counter.

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

6 years agoRemove hard coded number of lun definition
Baptiste Daroussin [Mon, 11 Dec 2017 14:54:42 +0000 (14:54 +0000)]
Remove hard coded number of lun definition

The number of lun exposed is now exposed via sysctl by the kernel.
Use that number in ctlstat instead of the hardcoded version
Add a backward compatibility in case the sysctl(2) request fails.

This also allows ctlstat -l 1118 to actually work when having more than
1024 luns.

Reviewed by: avg, manu (both before the backward compatibility addition)
Approved by: avg, manu (both before the backward compatibility addition)
MFC after: 2 weeks
Sponsored by: Gandi.net
Differential Revision: https://reviews.freebsd.org/D13446

6 years agoFix a comment to be more accurate
Warner Losh [Mon, 11 Dec 2017 14:47:23 +0000 (14:47 +0000)]
Fix a comment to be more accurate

6 years agoofed: Define barriers for mips and arm.
Konstantin Belousov [Mon, 11 Dec 2017 11:59:45 +0000 (11:59 +0000)]
ofed: Define barriers for mips and arm.

I used the strongest barriers available on the architectures, so if
the future analysis show that it is excessive, the barriers could be
relaxed. Still, it is unlikely that it is meaningful to run IB on 32bit
ARM or current MIPS machines, so the change is to make WITH_OFED to pass
tinderbox.

Sponsored by: Mellanox Technologies
Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D13329

6 years agoofed: Remove duplicated symbols from the version file.
Konstantin Belousov [Mon, 11 Dec 2017 11:57:46 +0000 (11:57 +0000)]
ofed: Remove duplicated symbols from the version file.

ld.bfd accepts multiple listing of the same symbol in the version script.
lld is stricter and errors out.  Since arm64 and sometimes amd64 use lld,
we should correct this cosmetic issue.

Sponsored by: Mellanox Technologies
Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D13329

6 years agoAdd myself to committers-src.dot
Chuck Tuffli [Mon, 11 Dec 2017 04:40:25 +0000 (04:40 +0000)]
Add myself to committers-src.dot

Reviewed by: ken, imp
Approved by: ken (mentor), imp (mentor)
Differential Revision: https://reviews.freebsd.org/D13406

6 years agoi386: Bump KSTACK_PAGES default to match amd64
Conrad Meyer [Mon, 11 Dec 2017 04:32:37 +0000 (04:32 +0000)]
i386: Bump KSTACK_PAGES default to match amd64

Logically, extend r286288 to cover all threads, by default.

The world has largely moved on from i386.  Most FreeBSD users and developers
test on amd64 hardware.  For better or worse, we have written a non-trivial
amount of kernel code that relies on stacks larger than 8 kB, and it "just
works" on amd64, so there has been little incentive to shrink it.

amd64 had its KSTACK_PAGES bumped to 4 back in Peter's initial AMD64 commit,
r114349, in 2003.  Since that time, i386 has limped along on a stack half
the size.  We've even observed the stack overflows years ago, but neglected
to fix the issue; see the 20121223 and 20150728 entries in UPDATING.

If anyone is concerned with this change, I suggest they configure their
AMD64 kernels with KSTACK_PAGES 2 and fix the fallout there first.  Eugene
has identified a list of high stack usage functions in the first PR below.

PR: 219476, 224218
Reported by: eugen@, Shreesh Holla <hshreesh AT yahoo.com>
Relnotes: maybe
Sponsored by: Dell EMC Isilon

6 years agoStart adding commands that I know are good to build up residual
Warner Losh [Mon, 11 Dec 2017 02:44:15 +0000 (02:44 +0000)]
Start adding commands that I know are good to build up residual
knowledge about qemu's quirks. Other qemu commands are possible, but
this is the quickest for testing.

Sponsored by: Netflix

6 years agoAdd -I to just run the imaging part of nanobsd so you can test out
Warner Losh [Mon, 11 Dec 2017 02:44:10 +0000 (02:44 +0000)]
Add -I to just run the imaging part of nanobsd so you can test out
changes to the packaging part of nanobsd more easily, or experiment
with the image contents w/o regenerating a whole new image tree. This
can save minutes when you don't need to do the installworld /
installkernel, etc.

Sponsored by: Netflix

6 years agoFix the std-x86 layout to produce a bootable system. Due to
Warner Losh [Mon, 11 Dec 2017 02:43:56 +0000 (02:43 +0000)]
Fix the std-x86 layout to produce a bootable system. Due to
limitations in mkimg we're still not quite to where I'd like to be
(I'd like to put s3 first on the disk, then s1, but mkimg won't allow
that currently). However, the resulting image now boots with qemu using:

qemu-system-x86_64 -hdd $file -serial telnet::4444,server -nographic

We'll need tweaks to create a specialized /etc/rc.d/growfs that can
create a properly grown image for either the simple or ping-pong
cases, but that will be later. Switched to pure serial console (-h)
instead of video or serial (-P) since that fits this usecase better.

Sponsored by: Netflix

6 years agoWhen building for arm arches, set PKGALIGN to the max cache line size
Ian Lepore [Sun, 10 Dec 2017 23:06:45 +0000 (23:06 +0000)]
When building for arm arches, set PKGALIGN to the max cache line size
supported by the arch, to meet u-boot's requirement that I/O be done
in cache-aligned chunks.

PR: 223977

6 years agoCorrect r326748, indicating that tgammal(3) is mapped to tgamma(3), not
Dimitry Andric [Sun, 10 Dec 2017 23:03:13 +0000 (23:03 +0000)]
Correct r326748, indicating that tgammal(3) is mapped to tgamma(3), not
to itself.

Noticed by: jilles
MFC after: 3 days

6 years agoSave and restore r9 register in arm ubldr. In old gcc 4.2, r9 was a callee-
Ian Lepore [Sun, 10 Dec 2017 21:51:27 +0000 (21:51 +0000)]
Save and restore r9 register in arm ubldr.  In old gcc 4.2, r9 was a callee-
saved register, but in arm EABI it may be either callee-saved or dedicated
to some special purpose (such as a TLS pointer).  It appears clang does not
treat it as a callee-saved register (instead using it as another work
register, similar to r12).

Another important side effect of these changes is that saving an extra
register in the push/pop statements keeps the stack aligned to an 8-byte
boundary during the self_reloc() call, as it always should have been.

As stated in the PR...

Essentially the important caller-saved registers are pushed (r0, r1, r9, lr)
before the relocation call, and popped after.  Then r8/r9 are saved as usual
for the syscall trampoline, and lr is stored in r8 (now free) as a
callee-saved value before calling into `main`.

The call to `main` can no longer be a tail call because we must restore r9
especially after main returns (although since we have used r8 to hold lr we
must also restore this).

PR: 224008

6 years agoDo not give up if writing to the chip's control and status registers fails
Ian Lepore [Sun, 10 Dec 2017 18:55:42 +0000 (18:55 +0000)]
Do not give up if writing to the chip's control and status registers fails
during startup.  When a brand new chip leaves the factory, it is in a
special power-saving mode that disables most functions on the chip to
save battery power.  The chip is stuck in this mode until the first write
to the time registers, which automatically clears the special power-saving
mode and starts the oscillator.

Also, the day-of-week register in this chip counts 1-7, not 0-6, so write
the values accordingly.

These changes are based on the patch submitted by Brian Scott, but I
elimated warnings since this condition is expected, and added some comments,
and so in general blame me for any mistakes.

PR: 223642

6 years agowc(1): Restore regular file char count fast path
Conrad Meyer [Sun, 10 Dec 2017 17:56:03 +0000 (17:56 +0000)]
wc(1): Restore regular file char count fast path

fstat(2) is going to be a lot faster than reading all of the bytes in a
file, if we just need a character count for a regular file.  This fast path
was accidentally broken in r326736.

PR: 224160
Reported by: bde
Sponsored by: Dell EMC Isilon

6 years agoDocument the existence and precision of the remaining long double
Dimitry Andric [Sun, 10 Dec 2017 16:42:59 +0000 (16:42 +0000)]
Document the existence and precision of the remaining long double
functions for which an imprecise stub implementation was added in
r255294, namely powl(3) and tgammal(3).

Submitted by: Steve Kargl
MFC after: 3 days

6 years agoRelax too restrictive assert.
Michal Meloun [Sun, 10 Dec 2017 09:17:21 +0000 (09:17 +0000)]
Relax too restrictive assert.

The problem has been reported to upstream and similar change will
be included in next jemalloc release.

Submitted by: David Goldblatt <davidtgoldblatt@gmail.com>
MFC after:  2 weeks

6 years agoRevert r326740. I committed wrong diff.
Michal Meloun [Sun, 10 Dec 2017 09:15:37 +0000 (09:15 +0000)]
Revert r326740. I committed wrong diff.

6 years agoRelax too restrictive assert.
Michal Meloun [Sun, 10 Dec 2017 08:55:48 +0000 (08:55 +0000)]
Relax too restrictive assert.

The problem has been reported to upstream and similar change will
be included in next jemalloc release.

Submitted by: David Goldblatt <davidtgoldblatt@gmail.com>
MFC after:  2 weeks

6 years agoRetrieve the page outside of holding locks
Justin Hibbits [Sun, 10 Dec 2017 04:43:27 +0000 (04:43 +0000)]
Retrieve the page outside of holding locks

pmap_track_page() only works with physical memory pages, which have a
constant vm_page_t address.  Microoptimize pmap_track_page() to perform one
less operation under the lock.

6 years agopw(8): correct expiration period handling and command line overrides
Eugene Grosbein [Sat, 9 Dec 2017 23:34:00 +0000 (23:34 +0000)]
pw(8): correct expiration period handling and command line overrides
to preconfigured values for -e, -p and -w flags.

Use non-negative symbols instead of magic values
in passwd_val/pw_password functions.

PR: 223431
Submitted by: Yuri Pankov (in part, patch for the manual)
Reported by: mav (mentor)
MFC after: 3 days
Relnotes: yes

6 years ago[net80211] add a method for checking if a VAP WME AC has a NOACK policy or not.
Adrian Chadd [Sat, 9 Dec 2017 23:16:02 +0000 (23:16 +0000)]
[net80211] add a method for checking if a VAP WME AC has a NOACK policy or not.

A subsequent set of commits will introduce this instead of a whole lot of
gymnastics to check the WME category.

6 years agowc(1): Extend non-controversial optimizations to '-c' mode
Conrad Meyer [Sat, 9 Dec 2017 21:55:19 +0000 (21:55 +0000)]
wc(1): Extend non-controversial optimizations to '-c' mode

wc(1)'s slow path for counting words or multibyte characters requires
conversion of the 8-bit input stream to wide characters.  However, a faster
path can be used for counting only lines ('-l' -- newlines have the same
representation in all supported encodings) or bytes ('-c').

The existing line count optimization was not used if the input was the
implicit stdin.  Additionally, it wasn't used if only byte counting was
requested.  This change expands the fast path to both of these scenarios.

Expanding the buffer size from 64 kB helps reduce the number of read(2)
calls needed, but exactly what impact that change has and what size to
expand the buffer to are still under discussion.

PR: 224160
Tested by: wosch (earlier version)
Sponsored by: Dell EMC Isilon

6 years agoDefine macros used by the pNFS server code.
Rick Macklem [Sat, 9 Dec 2017 21:04:56 +0000 (21:04 +0000)]
Define macros used by the pNFS server code.

This commit defines some macros used by the pNFS server code.
They will not be used until the main pNFS server code merge occurs,
which will probably be in April 2018.

6 years agogifconfig_gif0 no longer works, document replacement
Mike Karels [Sat, 9 Dec 2017 17:27:36 +0000 (17:27 +0000)]
gifconfig_gif0 no longer works, document replacement

rc.conf(5) documents the gifconfig_<interface> keyword, which is
no longer implemented. Document the replacement, which works with
cloned_interfaces as well.

Reviewed by: dab
Group Reviwers: manpages
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D13130