freebsd.git
8 years agoo make sure the boundary is a power of 2, when not zero.
marcel [Sun, 26 Jul 2015 16:39:37 +0000 (16:39 +0000)]
o   make sure the boundary is a power of 2, when not zero.
o   don't convert 0 to ~0 just so that we can use MIN. ~0 is not a
    valid boundary. Introduce BNDRY_MIN that deals with 0 values
    that mean no boundary.

8 years agoPass unsigned long argument to ioctl().
rodrigc [Sun, 26 Jul 2015 14:46:42 +0000 (14:46 +0000)]
Pass unsigned long argument to ioctl().

Eliminates "ioctl sign-extension" warnings.

PR: 200896

8 years agoReplace GNU RCS ident with a BSD license ident
bapt [Sun, 26 Jul 2015 11:21:36 +0000 (11:21 +0000)]
Replace GNU RCS ident with a BSD license ident

Rationale: ident(1) is useful out of RCS, lot of scripts are using ident(1) and
failing when base is built WITHOUT_RCS.

This version is:
- fully compatible with RCS 5.7 ident.
- fully compatible with RCS 5.9 ident.
- passes all ident test from GNU RCS 5.9 test suite

This version has support for: svn extension for the Keyword id (double colon and
# before last $)

DiffĂ©rences with GNU RCS ident:
- no long options as found in GNU RCS 5.9 (but not commented there).
- '-V' reports nothing but has been added for compatibility.

Differential Revision: https://reviews.freebsd.org/D3200
Reviewed by: pfg

8 years agoReport the scheme and provider names in warning message about unaligned
ae [Sun, 26 Jul 2015 11:16:48 +0000 (11:16 +0000)]
Report the scheme and provider names in warning message about unaligned
partition.

PR: 201873
MFC after: 1 week

8 years agoBuild debug version of rmlock's methods only when LOCK_DEBUG > 0.
ae [Sun, 26 Jul 2015 10:53:32 +0000 (10:53 +0000)]
Build debug version of rmlock's methods only when LOCK_DEBUG > 0.

Currently LOCK_DEBUG is always defined in sys/lock.h (0 or 1).
This means that debugging code always built. In addition the kernel
modules have always defined LOCK_DEBUG as 1. So, debugging rmlock code
is always used by kernel modules.

MFC after: 1 week

8 years agoImprove locking on Mac OS X. This does not change the functionality
tuexen [Sun, 26 Jul 2015 10:37:40 +0000 (10:37 +0000)]
Improve locking on Mac OS X. This does not change the functionality
on FreeBSD.

Reviewed by: rrs
MFC after: 1 week

8 years agoFix and improve a debug message. The SID was reported as an SSN.
tuexen [Sun, 26 Jul 2015 10:17:17 +0000 (10:17 +0000)]
Fix and improve a debug message. The SID was reported as an SSN.

MFC after: 1 week

8 years agoIn tmpfs_chtimes(), remove checks on the nanosecond level when
brueffer [Sun, 26 Jul 2015 08:33:46 +0000 (08:33 +0000)]
In tmpfs_chtimes(), remove checks on the nanosecond level when
determining whether a node changed.

Other filesystems, e.g., UFS, only check on seconds, when determining
whether something changed.

This also corrects the birthtime case, where we checked tv_nsec
twice, instead of tv_sec and tv_nsec (PR).

PR: 201284
Submitted by: David Binderman
Patch suggested by: kib
Reviewed by: kib
MFC after: 2 weeks
Committed from: Essen FreeBSD Hackathon

8 years agoBump GCC max-inline-insns-single in libiconv_modules and grep
pfg [Sun, 26 Jul 2015 00:11:04 +0000 (00:11 +0000)]
Bump GCC max-inline-insns-single in libiconv_modules and grep

This is required by our FORTIFY_SOURCE implementation as it
does more inlining. As a rule of thumb, FORTIFY_SOURCE doubles
the number  of inlines except that in grep inlining
blows up for some reason.

8 years agoisl(4), driver for Intersil I2C ISL29018 Digital Ambient Light Sensor
grembo [Sat, 25 Jul 2015 20:17:19 +0000 (20:17 +0000)]
isl(4), driver for Intersil I2C ISL29018 Digital Ambient Light Sensor

Differential Revision: https://reviews.freebsd.org/D2811
Reviewed by: adrian, wblock
Approved by: adrian, wblock
Relnotes: yes

8 years agoUse consistent spacing.
trasz [Sat, 25 Jul 2015 20:17:19 +0000 (20:17 +0000)]
Use consistent spacing.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoAdd md_root example to defaults/loader.conf.
trasz [Sat, 25 Jul 2015 20:15:29 +0000 (20:15 +0000)]
Add md_root example to defaults/loader.conf.

Note that this doesn't quite work yet - the preloaded image
gets loaded twice for some reason.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoRemove unused txd_saved.
sbruno [Sat, 25 Jul 2015 19:24:33 +0000 (19:24 +0000)]
Remove unused txd_saved.

Intialize txd_upper, txd_lower and txd_used at declaration.

Differential Revision: D3174
Reviewed by: erj hiren
MFC after: 2 weeks
Sponsored by: Limelight Networks

8 years agoRevert r173708's modifications to vm_object_page_remove().
kib [Sat, 25 Jul 2015 18:29:06 +0000 (18:29 +0000)]
Revert r173708's modifications to vm_object_page_remove().

Assume that a vnode is mapped shared and mlocked(), and then the vnode
is truncated, or truncated and then again extended past the mapping
point EOF.  Truncation removes the pages past the truncation point,
and if pages are later created at this range, they are not properly
mapped into the mlocked region, and their wiring count is wrong.

The revert leaves the invalidated but wired pages on the object queue,
which means that the pages are found by vm_object_unwire() when the
mapped range is munlock()ed, and reused by the buffer cache when the
vnode is extended again.

The changes in r173708 were required since then vm_map_unwire() looked
at the page tables to find the page to unwire.  This is no longer
needed with the vm_object_unwire() introduction, which follows the
objects shadow chain.

Also eliminate OBJPR_NOTWIRED flag for vm_object_page_remove(), which
is now redundand, we do not remove wired pages.

Reported by: trasz, Dmitry Sivachenko <trtrmitya@gmail.com>
Suggested and reviewed by: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoMove including netinet/icmp6.h around to avoid a problem when including
tuexen [Sat, 25 Jul 2015 18:26:09 +0000 (18:26 +0000)]
Move including netinet/icmp6.h around to avoid a problem when including
netinet/icmp6.h and net/netmap.h. Both use ni_flags...
This allows to build multistack with SCTP support.

MFC after: 1 week

8 years agocyapa(4), driver for the Cypress APA I2C trackpad
grembo [Sat, 25 Jul 2015 18:14:35 +0000 (18:14 +0000)]
cyapa(4), driver for the Cypress APA I2C trackpad

Differential Revision: https://reviews.freebsd.org/D3068
Reviewed by: kib, wblock
Approved by: kib
Relnotes: yes

8 years agoUse double newlines consistently.
trasz [Sat, 25 Jul 2015 16:20:04 +0000 (16:20 +0000)]
Use double newlines consistently.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoRemove stale comment.
kp [Sat, 25 Jul 2015 16:14:55 +0000 (16:14 +0000)]
Remove stale comment.

The IPv6 pseudo header checksum was added by bz in r235961.

Sponsored by: Essen FreeBSD Hackathon

8 years agoUpdate Capsicum and Mandatory Access Control manual pages
trasz [Sat, 25 Jul 2015 15:56:49 +0000 (15:56 +0000)]
Update Capsicum and Mandatory Access Control manual pages
to no longer claim they are experimental.

Reviewed by: rwatson@, wblock@
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2985

8 years agoWith the removal of b_saveaddr in the r285819, b_data must be reset to
kib [Sat, 25 Jul 2015 15:00:14 +0000 (15:00 +0000)]
With the removal of b_saveaddr in the r285819, b_data must be reset to
b_kvabase when the buffer is reclaimed.  Otherwise, if b_data for the
mapped buffer was adjusted with the page-offset portion of b_offset,
nothing would re-adjust the b_data, which breaks buffer management
code which expects page-aligned b_data (see e.g. bpman_qenter(), which
skips partial pages).

Fix a minor issue with the GB_KVAALLOC requests, which could result in
returning the mapped buffer if the reused buffer is mapped and have
the right amount of KVA reserved.

Improve assertion in the vfs_buf_check_mapped() to catch unmapped
buffers which have their b_data incorrectly adjusted with offset.

Reported and tested by: pho (previous version)
Reviewed by: jeff (previous version)
Sponsored by: The FreeBSD Foundation

8 years agoPf can reassemble IPv6 fragments now.
kp [Sat, 25 Jul 2015 14:06:32 +0000 (14:06 +0000)]
Pf can reassemble IPv6 fragments now.

Obtained from: bluhm (OpenBSD)
Sponsored by: Essen FreeBSD Hackathon

8 years agoDocument md_root in loader(8). The md(4) manual page mentions it,
trasz [Sat, 25 Jul 2015 13:02:41 +0000 (13:02 +0000)]
Document md_root in loader(8). The md(4) manual page mentions it,
but it's hard to find and easy to miss.

Reviewed by: wblock@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3183

8 years agoFix transposed words in man page.
dru [Sat, 25 Jul 2015 11:10:49 +0000 (11:10 +0000)]
Fix transposed words in man page.

PR: 201752
Reviewed by: bcr
MFC after: 3 days
Sponsored by: Essen FreeBSD Hackathon

8 years agoFix color mapping for TDA19988. Values for VIP_CNTRL_1 and VIP_CNTRL_2
gonzo [Sat, 25 Jul 2015 03:19:02 +0000 (03:19 +0000)]
Fix color mapping for TDA19988. Values for VIP_CNTRL_1 and VIP_CNTRL_2
registers were mixed up

8 years agoSynchronize PIN input/output modes with gnu/dts/include/dt-bindings/pinctrl/am33xx.h
gonzo [Sat, 25 Jul 2015 03:03:32 +0000 (03:03 +0000)]
Synchronize PIN input/output modes with gnu/dts/include/dt-bindings/pinctrl/am33xx.h
gpio driver requires exact value to match SoC pin mode with GPIO pin direction

8 years agoIf there is panel info in DTB do not wait for HDMI event and setup
gonzo [Sat, 25 Jul 2015 02:59:45 +0000 (02:59 +0000)]
If there is panel info in DTB do not wait for HDMI event and setup
framebuffer immediately

8 years agoOF_getencprop_alloc shouldn't be used to get string value. If string
gonzo [Sat, 25 Jul 2015 00:58:50 +0000 (00:58 +0000)]
OF_getencprop_alloc shouldn't be used to get string value. If string
length + 1 is not divisible by 4 this function returns NULL property
value. Otherwise - string with each 4 letters inverted

8 years agoDocument the fact that system(3) can easily be misused due to shell meta
delphij [Sat, 25 Jul 2015 00:21:29 +0000 (00:21 +0000)]
Document the fact that system(3) can easily be misused due to shell meta
characters are honored.  While I'm there also mention posix_spawn in the
SEE ALSO section.

MFC after: 2 weeks

8 years agoFix a typo in comment.
delphij [Fri, 24 Jul 2015 22:13:39 +0000 (22:13 +0000)]
Fix a typo in comment.

Submitted by: Yanhui Shen via twitter
MFC after: 3 days

8 years agoAuto-generate hardware notes for pms(4).
brueffer [Fri, 24 Jul 2015 21:55:16 +0000 (21:55 +0000)]
Auto-generate hardware notes for pms(4).

MFC after: 1 week
Committed from: Essen FreeBSD Hackathon

8 years agoAdd a basic manpage for the pms driver.
brueffer [Fri, 24 Jul 2015 21:48:53 +0000 (21:48 +0000)]
Add a basic manpage for the pms driver.

MFC after: 1 week
Committed from: Essen FreeBSD Hackathon

8 years agoCast uid and gid to the correct type for display to solve segfault in ls(1) on 32bit...
allanjude [Fri, 24 Jul 2015 20:20:59 +0000 (20:20 +0000)]
Cast uid and gid to the correct type for display to solve segfault in ls(1) on 32bit arches

Correctly escape literal % for display

This fixes segfaults in 32bit arches caused by r285734

Reviewed by: ngie
Approved by: dim
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D3191

8 years agoAdd a comment discussing the appropriate use of the atomic_*() functions
alc [Fri, 24 Jul 2015 19:43:18 +0000 (19:43 +0000)]
Add a comment discussing the appropriate use of the atomic_*() functions
with acquire and release semantics versus the *mb() functions on amd64
processors.

Reviewed by: bde (an earlier version), kib
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd missing SIGUSR1 description.
trasz [Fri, 24 Jul 2015 18:14:57 +0000 (18:14 +0000)]
Add missing SIGUSR1 description.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

8 years agoAdd missing capitalization.
trasz [Fri, 24 Jul 2015 18:13:13 +0000 (18:13 +0000)]
Add missing capitalization.

8 years agoreadelf: avoid division by zero on section entry size
emaste [Fri, 24 Jul 2015 18:00:53 +0000 (18:00 +0000)]
readelf: avoid division by zero on section entry size

ELF Tool Chain tickets #439, #444, #445, #467
Reported by: Alexander Cherepanov <cherepan@mccme.ru> (#467)
Reported by: antiAgainst (others)

Reviewed by: brooks
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2338

8 years agoar: add -U (unique) option to disable -D (deterministic) mode
emaste [Fri, 24 Jul 2015 17:46:43 +0000 (17:46 +0000)]
ar: add -U (unique) option to disable -D (deterministic) mode

This is required in order for us to support deterministic mode by
default.  If multiple -D or -U options are specified on the command
line, the final one takes precedence.  GNU ar also uses -U for this.

An equivalent change will be applied to ELF Tool Chain's version of ar.

PR: 196929
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3175

8 years ago- Since r253161, uart_intr() abuses FILTER_SCHEDULE_THREAD for signaling
marius [Fri, 24 Jul 2015 17:01:16 +0000 (17:01 +0000)]
- Since r253161, uart_intr() abuses FILTER_SCHEDULE_THREAD for signaling
  uart_bus_attach() during its test that 20 iterations weren't sufficient
  for clearing all pending interrupts, assuming this means that hardware
  is broken and doesn't deassert interrupts. However, under pressure, 20
  iterations also can be insufficient for clearing all pending interrupts,
  leading to a panic as intr_event_handle() tries to schedule an interrupt
  handler not registered. Solve this by introducing a flag that is set in
  test mode and otherwise restores pre-r253161 behavior of uart_intr(). The
  approach of additionally registering uart_intr() as handler as suggested
  in PR 194979 is not taken as that in turn would abuse special pccard and
  pccbb handling code of intr_event_handle(). [1]
- Const'ify uart_driver_name.
- Fix some minor style bugs.

PR: 194979 [1]
Reviewed by: marcel (earlier version)
MFC after: 3 days

8 years agotruss: follow pdfork()ed descendents with -f
emaste [Fri, 24 Jul 2015 16:57:13 +0000 (16:57 +0000)]
truss: follow pdfork()ed descendents with -f

PR: 201276
Reported by: David Drysdale
Reviewed by: oshogbo
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2976

8 years agoAdd RISC-V ELF machine type definition
emaste [Fri, 24 Jul 2015 16:52:21 +0000 (16:52 +0000)]
Add RISC-V ELF machine type definition

EM_RISCV is now officially registered as e_machine 243.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years ago- In mpt_send_handshake_cmd(), use bus_space_write_stream_4(9) for writing
marius [Fri, 24 Jul 2015 16:00:35 +0000 (16:00 +0000)]
- In mpt_send_handshake_cmd(), use bus_space_write_stream_4(9) for writing
  raw data to the doorbell offset in order to clarify the intent and for
  avoiding unnecessarily converting the endianess back and forth.
  Unfortunately, the same can't be done in mpt_recv_handshake_reply() as
  16-bit data needs to be read using 32-bit bus accessors.
- In mpt_recv_handshake_reply(), get rid of a redundant variable.

MFC after: 1 fortnight

8 years agoo Revert the other functional half of r239864, i. e. the merge of r134227
marius [Fri, 24 Jul 2015 15:13:21 +0000 (15:13 +0000)]
o Revert the other functional half of r239864, i. e. the merge of r134227
  from x86 to use smp_ipi_mtx spin lock not only for smp_rendezvous_cpus()
  but also for the MD cache invalidation, TLB demapping and remote register
  reading IPIs due to the following reasons:
  - The cross-IPI SMP deadlock x86 otherwise is subject to can't happen on
    sparc64. That's because on sparc64, spin locks don't disable interrupts
    completely but only raise the processor interrupt level to PIL_TICK. This
    means that IPIs still get delivered and direct dispatch IPIs such as the
    cache invalidation etc. IPIs in question are still executed.
  - In smp_rendezvous_cpus(), smp_ipi_mtx is held not only while sending an
    IPI_RENDEZVOUS, but until all CPUs have processed smp_rendezvous_action().
    Consequently, smp_ipi_mtx may be locked for an extended amount of time as
    queued IPIs (as opposed to the direct ones) such as IPI_RENDEZVOUS are
    scheduled via a soft interrupt. Moreover, given that this soft interrupt
    is only delivered at PIL_RENDEZVOUS, processing of smp_rendezvous_action()
    on a target may be interrupted by f. e. a tick interrupt at PIL_TICK, in
    turn leading to the target in question trying to send an IPI by itself
    while IPI_RENDEZVOUS isn't fully handled, yet, and, thus, resulting in a
    deadlock.
o As mentioned in the commit message of r245850, on least some sun4u platforms
  concurrent sending of IPIs by different CPUs is fatal. Therefore, hold the
  reintroduced MD ipi_mtx also while delivering cross-traps via MI helpers,
  i. e. ipi_{all_but_self,cpu,selected}().
o Akin to x86, let the last CPU to process cpu_mp_bootstrap() set smp_started
  instead of the BSP in cpu_mp_unleash(). This ensures that all APs actually
  are started, when smp_started is no longer 0.
o In all MD and MI IPI helpers, check for smp_started == 1 rather than for
  smp_cpus > 1 or nothing at all. This avoids races during boot causing IPIs
  trying to be delivered to APs that in fact aren't up and running, yet.
  While at it, move setting of the cpu_ipi_{selected,single}() pointers to
  the appropriate delivery functions from mp_init() to cpu_mp_start() where
  it's better suited and allows to get rid of the global isjbus variable.
o Given that now concurrent IPI delivery no longer is possible, also nuke
  the delays before completely disabling interrupts again in the CPU-specific
  cross-trap delivery functions, previously giving other CPUs a window for
  sending IPIs on their part. Actually, we now should be able to entirely get
  rid of completely disabling interrupts in these functions. Such a change
  needs more testing, though.
o In {s,}tick_get_timecount_mp(), make the {s,}tick variable static. While not
  necessary for correctness, this avoids page faults when accessing the stack
  of a foreign CPU as {s,}tick now is locked into the TLBs as part of static
  kernel data. Hence, {s,}tick_get_timecount_mp() always execute as fast as
  possible, avoiding jitter.

PR: 201245
MFC after: 3 days

8 years agoFix silly syntax error emacs chugged in for me.. gesh.
rrs [Fri, 24 Jul 2015 14:13:43 +0000 (14:13 +0000)]
Fix silly syntax error emacs chugged in for me.. gesh.

MFC after: 3 weeks

8 years agoFix an issue with MAC OS locking and also optimize the case
rrs [Fri, 24 Jul 2015 14:09:03 +0000 (14:09 +0000)]
Fix an issue with MAC OS locking and also optimize the case
where we are sending back a stream-reset and a sack timer is running, in
that case we should just send the SACK.

MFC after: 3 weeks

8 years agoinode should be different to actually mean mandocdb is in used
bapt [Fri, 24 Jul 2015 09:20:02 +0000 (09:20 +0000)]
inode should be different to actually mean mandocdb is in used

Sponsored by: gandi.net

8 years agoFix man -k with mandocdb
bapt [Fri, 24 Jul 2015 09:10:03 +0000 (09:10 +0000)]
Fix man -k with mandocdb

If apropos(1) and whatis(1) are not hardlinks to man(1) that means the system is
using mandocdb, then man -k should spawn apropos(1) and/or whatis(1) directly

Reported by: kevlo
Tested by: kevlo
Sponsored by: gandi.net

8 years agoImplement the basic system calls that operate on pathnames.
ed [Fri, 24 Jul 2015 07:46:02 +0000 (07:46 +0000)]
Implement the basic system calls that operate on pathnames.

Summary:
Unlike FreeBSD, CloudABI does not use null terminated strings for its
pathnames. Introduce a function called copyin_path() that can be used by
all of the filesystem system calls that use pathnames. This change
already implements the system calls that don't depend on any additional
functionality (e.g., conversion of struct stat).

Also implement the socket system calls that operate on pathnames, namely
the ones used by the C library functions bindat() and connectat(). These
don't receive a 'struct sockaddr_un', but just the pathname, meaning
they could be implemented in such a way that they don't depend on the
size of sun_path. For now, just use the existing interfaces.

Add a missing #include to cloudabi_syscalldefs.h to get this code to
build, as one of its macros depends on UINT64_C().

Test Plan:
These implementations have already been tested in the CloudABI branch on
GitHub. They pass all of the tests.

Reviewers: kib, pjd

Subscribers: imp

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

8 years agoPanic when a device is trying to recursively acquire rather than hang
imp [Fri, 24 Jul 2015 04:56:46 +0000 (04:56 +0000)]
Panic when a device is trying to recursively acquire rather than hang
indefinitely. Improve error messages from other panics.

8 years agoCall ksem_get() with initialized 'rights'.
pluknet [Thu, 23 Jul 2015 23:18:03 +0000 (23:18 +0000)]
Call ksem_get() with initialized 'rights'.

ksem_get() consumes fget(), and it's mandatory there.

Reported by: truckman
Reviewed by: mjg

8 years agoRefactor unmapped buffer address handling.
jeff [Thu, 23 Jul 2015 19:13:41 +0000 (19:13 +0000)]
Refactor unmapped buffer address handling.
 - Use pointer assignment rather than a combination of pointers and
   flags to switch buffers between unmapped and mapped.  This eliminates
   multiple flags and generally simplifies the logic.
 - Eliminate b_saveaddr since it is only used with pager bufs which have
   their b_data re-initialized on each allocation.
 - Gather up some convenience routines in the buffer cache for
   manipulating buf space and buf malloc space.
 - Add an inline, buf_mapped(), to standardize checks around unmapped
   buffers.

In collaboration with: mlaier
Reviewed by: kib
Tested by: pho (many small revisions ago)
Sponsored by: EMC / Isilon Storage Division

8 years agoRefine the PAE_TABLES entry based on feedback from kib
gjb [Thu, 23 Jul 2015 18:11:52 +0000 (18:11 +0000)]
Refine the PAE_TABLES entry based on feedback from kib
and jhb.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

8 years agoDocument the fact that tunables can be set in device.hints.
brooks [Thu, 23 Jul 2015 17:27:10 +0000 (17:27 +0000)]
Document the fact that tunables can be set in device.hints.

Reviewed by: wblock
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D3153

8 years agonvme: ensure csts.rdy bit is cleared before returning from nvme_ctrlr_disable
jimharris [Thu, 23 Jul 2015 15:50:39 +0000 (15:50 +0000)]
nvme: ensure csts.rdy bit is cleared before returning from nvme_ctrlr_disable

PR: 200458
MFC after: 3 days
Sponsored by: Intel

8 years agonvme: properly handle case where pci_alloc_msix does not alloc all vectors
jimharris [Thu, 23 Jul 2015 15:35:08 +0000 (15:35 +0000)]
nvme: properly handle case where pci_alloc_msix does not alloc all vectors

Reported by: Sean Kelly <smkelly@smkelly.org>
MFC after: 3 days
Sponsored by: Intel

8 years agoAllow us to create UNIX sockets and socketpairs in CloudABI processes.
ed [Thu, 23 Jul 2015 13:52:53 +0000 (13:52 +0000)]
Allow us to create UNIX sockets and socketpairs in CloudABI processes.

8 years agoAllow cap_rights_{set,clear,is_set} to be called with no arguments.
ed [Thu, 23 Jul 2015 11:11:01 +0000 (11:11 +0000)]
Allow cap_rights_{set,clear,is_set} to be called with no arguments.

In the CloudABI code I sometimes call into cap_rights_* without
providing any arguments. Though one could argue that this doesn't make
sense, in this specific case it's hard to avoid, as the rights that
should be tested against are forwarded by a couple of wrapper macros.

8 years ago - Don't defeat the FIFO nature of the buffer cache by eliminating the
jeff [Thu, 23 Jul 2015 02:20:41 +0000 (02:20 +0000)]
 - Don't defeat the FIFO nature of the buffer cache by eliminating the
   most recently used buffer when we are under paging pressure.  This is
   a perversion of the buffer and page replacement algorithms and recent
   improvements to the page daemon have rendered it unnecessary.  In the
   event that low-memory deadlocks become an issue it would be possible
   to make a daemon or event handler that performs a similar action on
   the oldest buffers rather than the newest.  Since the buf cache
   is analogous to the page cache and some minimum working set is desired
   another possibility is to simply shrink the minimum working set which
   has less downside now that file pages are not directly mapped.

Sponsored by: EMC / Isilon
Reviewed by: alc, kib (with some minor objection)
Tested by: pho

8 years agovt: cpu logos: Correct reversed 0/1 beastie descriptions
cem [Wed, 22 Jul 2015 23:30:54 +0000 (23:30 +0000)]
vt: cpu logos: Correct reversed 0/1 beastie descriptions

Differential Revision: https://reviews.freebsd.org/D3158
Approved by: markj (mentor)
Obtained from: Pavel Timofeev
MFC after: 1 week

8 years agovt: Change default CPU logo to Orb
cem [Wed, 22 Jul 2015 23:23:12 +0000 (23:23 +0000)]
vt: Change default CPU logo to Orb

Differential Revision: https://reviews.freebsd.org/D3156
Approved by: markj (mentor)
MFC after: 1 week

8 years agovt: Default to cpu logos off
cem [Wed, 22 Jul 2015 23:19:53 +0000 (23:19 +0000)]
vt: Default to cpu logos off

Apologies, this was how it was supposed to land. Mea culpa.

Differential Revision: https://reviews.freebsd.org/D3157
Reviewed by: gnn, hiren
Approved by: markj (mentor)
MFC after: 1 week

8 years agomount_nfs: Be more clear on nmount(2) error with errmsg unset
cem [Wed, 22 Jul 2015 22:53:40 +0000 (22:53 +0000)]
mount_nfs: Be more clear on nmount(2) error with errmsg unset

Differential Revision: https://reviews.freebsd.org/D3147
Reviewed by: rmacklem
Approved by: markj (mentor)
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove an excess space accidently introduced in the output in ls(1) by r285734
allanjude [Wed, 22 Jul 2015 19:58:21 +0000 (19:58 +0000)]
Remove an excess space accidently introduced in the output in ls(1) by r285734

Spotted by: dim
Approved by: eadler (mentor)
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D3152

8 years agovt_core.c: Use do/while to highlight missed semi-colon errors
cem [Wed, 22 Jul 2015 18:50:47 +0000 (18:50 +0000)]
vt_core.c: Use do/while to highlight missed semi-colon errors

Also, fix some nearby #define whitespace while here.

(Style cleanup for r285794.)

Suggested by: jmg

Differential Revision: https://reviews.freebsd.org/D3154
Approved by: markj (mentor)
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoCatch up with ACPICA 20150717.
jkim [Wed, 22 Jul 2015 16:26:17 +0000 (16:26 +0000)]
Catch up with ACPICA 20150717.

8 years agosfxge: added fallbacks for pre 4.2.1 firmware support
arybchik [Wed, 22 Jul 2015 16:25:18 +0000 (16:25 +0000)]
sfxge: added fallbacks for pre 4.2.1 firmware support

Driver must be able to start against older firmware that is missing
recently added MCDI calls, otherwise firmware upgrade will not be
possible.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D3145

8 years agoMerge ACPICA 20150717.
jkim [Wed, 22 Jul 2015 16:25:07 +0000 (16:25 +0000)]
Merge ACPICA 20150717.

8 years agonvmecontrol: read controller identify data before any log page operations
jimharris [Wed, 22 Jul 2015 16:10:29 +0000 (16:10 +0000)]
nvmecontrol: read controller identify data before any log page operations

MFC after: 3 days
Sponsored by: Intel

8 years agovt: Unbreak build on no-splash configurations
cem [Wed, 22 Jul 2015 15:30:10 +0000 (15:30 +0000)]
vt: Unbreak build on no-splash configurations

PR: 201751
Differential Revision: https://reviews.freebsd.org/D3151
Tested by: Andrey Fesenko
Approved by: markj (mentor)
MFC after: 1 week

8 years agoFix several problems with Stream Reset.
rrs [Wed, 22 Jul 2015 11:30:37 +0000 (11:30 +0000)]
Fix several problems with Stream Reset.
 1) We were not handling (or sending) the IN_PROGRESS case if
    the other side (or our side) was not able to reset (awaiting more data).
 2) We would improperly send a stream-reset when we should not. Not
    waiting until the TSN had been assigned when data was inqueue.

Reviewed by: tuexen

8 years agoRegenerate system call table.
ed [Wed, 22 Jul 2015 10:05:46 +0000 (10:05 +0000)]
Regenerate system call table.

8 years agoImport upstream changes to the system call definitions.
ed [Wed, 22 Jul 2015 10:04:53 +0000 (10:04 +0000)]
Import upstream changes to the system call definitions.

Support has been added for providing the scope of a futex operation,
whether the futex is local to the process or shared between processes.

8 years agoIntroduce support for MSI-X interrupts in AHCI
zbb [Wed, 22 Jul 2015 09:46:22 +0000 (09:46 +0000)]
Introduce support for MSI-X interrupts in AHCI

- Allocate resources for MSI-X table and PBA if necessary
- Add function ahci_free_mem() to free all resources

Reviewed by:   jhb, mav
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3009

8 years agoFix inverted logic bug that David Wolfskill found (thanks David!)
rrs [Wed, 22 Jul 2015 09:29:50 +0000 (09:29 +0000)]
Fix inverted logic bug that David Wolfskill found (thanks David!)

MFC after: 3 Weeks

8 years agoRemove duplicate and useless declarations.
kib [Wed, 22 Jul 2015 09:12:40 +0000 (09:12 +0000)]
Remove duplicate and useless declarations.

Submitted by: bde

8 years agoAdd Makefiles for CloudABI kernel modules.
ed [Wed, 22 Jul 2015 07:32:49 +0000 (07:32 +0000)]
Add Makefiles for CloudABI kernel modules.

Place all of the machine/pointer size independent code in a kernel
module called 'cloudabi'. All of the 64-bit specific code goes in a
separate module called 'cloudabi64'. The latter is only enabled on
amd64, as it is the only architecture supported.

8 years agoDo not enable UDP checksum offloading when running on the Hyper-V on
whu [Wed, 22 Jul 2015 05:05:01 +0000 (05:05 +0000)]
Do not enable UDP checksum offloading when running on the Hyper-V on
Windows Server 2012 and earlier hosts.

Submitted by: whu
Reviewed by: royger
Approved by: royger
MFC after: 3 days
Relnotes: No
Sponsored by: Microsoft OSTC
Differential Revision:  https://reviews.freebsd.org/D3086

8 years agoCosmetic change. When printing the child's mapped pins, use the plural
loos [Wed, 22 Jul 2015 04:18:33 +0000 (04:18 +0000)]
Cosmetic change.  When printing the child's mapped pins, use the plural
only when necessary.

Reported by: Daniel O'Connor <darius@dons.net.au>,
Sulev-Madis Silber (ketas)

8 years agoVarious changes to the registers displayed in DDB for x86.
jhb [Wed, 22 Jul 2015 01:09:02 +0000 (01:09 +0000)]
Various changes to the registers displayed in DDB for x86.
- Fix segment registers to only display the low 16 bits.
- Remove unused handlers and entries for the debug registers.
- Display xcr0 (if valid) in 'show sysregs'.
- Add '0x' prefix to MSR values to match other values in 'show sysregs'.
- MFamd64: Display various MSRs in 'show sysregs'.
- Add a 'show dbregs' to display the value of debug registers.
- Dynamically size the column width for register values to properly
  align columns on 64-bit platforms.
- Display %gs for i386 in 'show registers'.

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

8 years agoFix counter reads on platforms where sizeof(uint64_t) != sizeof(uint64_t *).
markj [Tue, 21 Jul 2015 23:57:38 +0000 (23:57 +0000)]
Fix counter reads on platforms where sizeof(uint64_t) != sizeof(uint64_t *).

In the kernel, structs such as tcpstat are manipulated as an array of
counter_u64_t (uint64_t *), but made visible to userland as an array of
uint64_t. kread_counters() was previously copying the counter array into
user space and sequentially overwriting each counter with its value. This
mostly affects IPsec counters, as other counters are exported via sysctl.

PR: 201700
Tested by: Jason Unovitch
MFC after: 1 week

8 years agoRemove checks for a NULL return value from M_WAITOK allocations.
markj [Tue, 21 Jul 2015 23:44:36 +0000 (23:44 +0000)]
Remove checks for a NULL return value from M_WAITOK allocations.

8 years agoFix resource exhaustion due to sessions stuck in LAST_ACK state.
delphij [Tue, 21 Jul 2015 23:42:15 +0000 (23:42 +0000)]
Fix resource exhaustion due to sessions stuck in LAST_ACK state.

Submitted by: Jonathan Looney (Juniper SIRT)
Reviewed by: lstewart
Security: CVE-2015-5358
Security: SA-15:13.tcp

8 years agoLet the unwinder handle faults during function prologues or epilogues.
markj [Tue, 21 Jul 2015 23:22:23 +0000 (23:22 +0000)]
Let the unwinder handle faults during function prologues or epilogues.

The i386 and amd64 DDB stack unwinders contain code to detect and handle
the case where the first frame is not completely set up or torn down. This
code was accidentally unused however, since db_backtrace() was never called
with a non-NULL trap frame. This change fixes that.

Also remove get_rsp() from the amd64 code. It appears to have come from
i386, which needs to take into account whether the exception triggered a
CPL switch, since SS:ESP is only pushed onto the stack if so. On amd64,
SS:RSP is pushed regardless, so get_rsp() was doing the wrong thing for
kernel-mode exceptions. As a result, we can also remove custom print
functions for these registers.

Reviewed by: jhb
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D2881

8 years agoImprove stack unwinding on i386 and amd64 after an IP fault.
markj [Tue, 21 Jul 2015 23:13:11 +0000 (23:13 +0000)]
Improve stack unwinding on i386 and amd64 after an IP fault.

If we can't find a symbol corresponding to the faulting instruction, assume
that the previously-executed function is a call and attempt to find the
calling function using the return address on the stack. Otherwise we end
up associating the last stack frame with the current call, which is
incorrect and causes the unwinder to skip printing of the calling function,
resulting in a confusing backtrace.

Reviewed by: jhb
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D2859

8 years agoDon't return undefined symbols to a DDB symbol lookup.
markj [Tue, 21 Jul 2015 23:07:55 +0000 (23:07 +0000)]
Don't return undefined symbols to a DDB symbol lookup.

Undefined symbols have a value of zero, so it makes no sense to return
such a symbol when performing a lookup by value. This occurs for example
when unwinding the stack after calling a NULL function pointer, and we
confusingly report the faulting function as uart_sab82532_class() on
amd64.

Convert db_print_loc_and_inst() to only attempt disassembly if we managed
to find a symbol corresponding to the IP. Otherwise we may fault and
re-enter the debugger.

Reviewed by: jhb
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D2858

8 years agoRemove some dead code from DDB's amd64 stack unwinder.
markj [Tue, 21 Jul 2015 23:03:21 +0000 (23:03 +0000)]
Remove some dead code from DDB's amd64 stack unwinder.

The amd64 port copied some code from i386 to fetch function arguments and
display them in backtraces. However, it was commented out and can't easily
be implemented since the function arguments are passed in
registers rather than on the stack in amd64. Remove it in preparation for
some bug fixes in this area.

Reviewed by: jhb
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D2857

8 years agopatch(1): Add -Vnone option to disable backup files
cem [Tue, 21 Jul 2015 22:57:27 +0000 (22:57 +0000)]
patch(1): Add -Vnone option to disable backup files

Differential Revision: https://reviews.freebsd.org/D3146
Reviewed by: pfg
Approved by: markj (mentor)
MFC after: 1 week
Relnotes: yes
Sponsored by: EMC / Isilon Storage Division

8 years agoThe smp_rendezvous_cpus() function should ensure that all accesses
kib [Tue, 21 Jul 2015 22:56:46 +0000 (22:56 +0000)]
The smp_rendezvous_cpus() function should ensure that all accesses
done by the functions called on other CPUs, are visible to the caller.
Pair otherwise useless acquire on smp_rv_waiters[3] with a release add
to ensure synchronized with relation, which guarantees visibility.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

8 years agoIPSEC, remove variable argument function its already due.
eri [Tue, 21 Jul 2015 21:46:24 +0000 (21:46 +0000)]
IPSEC, remove variable argument function its already due.

Differential Revision: https://reviews.freebsd.org/D3080
Reviewed by: gnn, ae
Approved by: gnn(mentor)

8 years agoFix for a customer issue with ixl(4):
erj [Tue, 21 Jul 2015 21:07:18 +0000 (21:07 +0000)]
Fix for a customer issue with ixl(4):

- Add required MAC/VLAN filter when adding an LAA
- Fix bug where code did not check for I40E_SUCCESS from a successful
  i40e_validate_mac_address() call in ixl_init_locked(), when setting
  an LAA.

PR: 201240
Differential Revision: https://reviews.freebsd.org/D3111
Submitted by: Gregory Rose <gregory.v.rose@intel.com>
Reviewed by: gnn, rstone
Approved by: gnn
MFC after: 2 weeks

8 years agonvd: set d_delmaxsize to full capacity of NVMe namespace
jimharris [Tue, 21 Jul 2015 20:53:21 +0000 (20:53 +0000)]
nvd: set d_delmaxsize to full capacity of NVMe namespace

The NVMe specification has no ability to specify a maximum delete size
that is less than the full capacity of the namespace - so just using the
namespace size is the correct value here.

This fixes reported issues where ZFS trim on init looked like it was
hanging the system - previously the default I/O max size (128KB on
Intel NVMe controllers) was used for delete operations which worked out
to only about 8MB/s.  With this patch I can add an 800GB DC P3700
drive to a ZFS pool in about 15-20 seconds.

Reported by: Dylan Just <dylan@techtangents.com>
MFC after: 3 days
Sponsored by: Intel

8 years agovt: Draw logos per CPU core
cem [Tue, 21 Jul 2015 20:33:36 +0000 (20:33 +0000)]
vt: Draw logos per CPU core

This feature is inspired by another Unix-alike OS commonly found on
airplane headrests.

A number of beasties[0] are drawn at top of framebuffer during boot,
based on the number of active SMP CPUs[1]. Console buffer output
continues to scroll in the screen area below beastie(s)[2].

After some time[3] has passed, the beasties are erased leaving the
entire terminal for use.

Includes two 80x80 vga16 beastie graphics and an 80x80 vga16 orb
graphic. (The graphics are RLE compressed to save some space -- 3x 3200
bytes uncompressed, or 4208 compressed.)

[0]: The user may select the style of beastie with

    kern.vt.splash_cpu_style=(0|1|2)

[1]: Or the number may be overridden with tunable kern.vt.splash_ncpu.
[2]: https://www.youtube.com/watch?v=UP2jizfr3_o
[3]: Configurable with kern.vt.splash_cpu_duration (seconds, def. 10).

Differential Revision: https://reviews.freebsd.org/D2181
Reviewed by: dumbbell, emaste
Approved by: markj (mentor)
MFC after: 2 weeks

8 years agovt: De-static VT_SYSCTL_INT-defined objects
cem [Tue, 21 Jul 2015 20:30:06 +0000 (20:30 +0000)]
vt: De-static VT_SYSCTL_INT-defined objects

Explicitly mark existing VT_SYSCTL_INTs static. This is in preparation for
D2181.

Reviewed by: dumbbell, emaste
Approved by: markj (mentor)
MFC after: 1 week

8 years agoTeach the GICv2 driver about the Qualcomm GICv2 compatible string.
andrew [Tue, 21 Jul 2015 18:08:10 +0000 (18:08 +0000)]
Teach the GICv2 driver about the Qualcomm GICv2 compatible string.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoAdd some more explanation to r285752
zbb [Tue, 21 Jul 2015 17:14:24 +0000 (17:14 +0000)]
Add some more explanation to r285752

Add brief commentary to vendor-specific devid function in ITS
and remove redundant spaces by the way.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation

8 years agoDon't allow malloc() to wait for resource while holding a lock in ITS
zbb [Tue, 21 Jul 2015 15:28:07 +0000 (15:28 +0000)]
Don't allow malloc() to wait for resource while holding a lock in ITS

malloc() should not go to sleep in case of lack of resource while
the kernel thread is holding a non-sleepable lock.

- change malloc() flags to M_NOWAIT in such cases implement
  lpi_free_chunk() routine as it will be needed when ITT
  allocation fails in its_device_alloc_locked()
- do not increase verbosity of this code since upper layers will
  communicate an error if the interrupt setup fails

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3121

8 years agoMake clock_gettime() and clock_getres() work for CloudABI programs.
ed [Tue, 21 Jul 2015 15:08:13 +0000 (15:08 +0000)]
Make clock_gettime() and clock_getres() work for CloudABI programs.

Though the standard C library uses a 'struct timespec' using a 64-bit
'time_t', there is no need to use such a type at the system call level.
CloudABI uses a simple 64-bit unsigned timestamp in nanoseconds. This is
sufficient to express any time value from 1970 to 2554.

The CloudABI low-level interface also supports fetching timestamp values
with a lower precision. Instead of overloading the clock ID argument for
this purpose, the system call provides a precision argument that may be
used to specify the maximum slack. The current system call
implementation does not use this information, but it's good to already
have this available.

Expose cloudabi_convert_timespec(), as we're going to need this for
fstat() as well.

Obtained from: https://github.com/NuxiNL/freebsd

8 years agoAdd support for vendor specific function for PCI devid acquisition in ITS
zbb [Tue, 21 Jul 2015 14:47:23 +0000 (14:47 +0000)]
Add support for vendor specific function for PCI devid acquisition in ITS

It is possible that some HW will use different PCI devids,
hence allow to replace the default domain:bus:slot:func schema
by implementing and registering custom function.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3118

8 years agoThe part of r285680 which removed release semantic for two stores to
kib [Tue, 21 Jul 2015 14:39:34 +0000 (14:39 +0000)]
The part of r285680 which removed release semantic for two stores to
it_need was wrong [*].  Restore the releases and add a comment
explaining why it is needed.

Noted by: alc [*]
Reviewed by: bde [*]
Sponsored by: The FreeBSD Foundation

8 years agoDescribe COMPAT_CLOUDABI64 in the amd64 configuration NOTES file.
ed [Tue, 21 Jul 2015 12:53:47 +0000 (12:53 +0000)]
Describe COMPAT_CLOUDABI64 in the amd64 configuration NOTES file.

8 years agoImplement get_cyclecount() on ARM64
zbb [Tue, 21 Jul 2015 12:50:45 +0000 (12:50 +0000)]
Implement get_cyclecount() on ARM64

Use Vritual Counter register associated with Generic Timer to
read the cyclecount.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3134