freebsd.git
6 years agoAdd a quick description of the geom_getxml(3), geom_xml2tree(3),
romain [Mon, 16 Oct 2017 17:21:52 +0000 (17:21 +0000)]
Add a quick description of the geom_getxml(3), geom_xml2tree(3),
geom_gettree(3) and geom_deletetree(3) functions provided by libgeom and are
not documented in libgeom(3).

Reviewed by: mav, bjk, allanjude
Approved by: allanjude
Differential Revision: https://reviews.freebsd.org/D12679

6 years agoProperly reset the fields in clean_unrhdr.
mjoras [Mon, 16 Oct 2017 16:14:50 +0000 (16:14 +0000)]
Properly reset the fields in clean_unrhdr.

In r324542 I neglected to reset the first and last fields of struct
unrhdr. This causes a tmpfs to fail the unr(9) consistency checks with
DIAGNOSTIC on. Fix this by resetting the fields by calling init_unrhdr.
While here, change a loop to use TAILQ_FOREACH_SAFE since it is more
readable and equally fast.

Reported by: David Wolfskill <david@catwhisker.org>
Approved by: rstone (mentor)
Sponsored by: Dell EMC Isilon

6 years agoFix the pv_chunks pc_lru tailq handling in reclaim_pv_chunk().
kib [Mon, 16 Oct 2017 15:16:24 +0000 (15:16 +0000)]
Fix the pv_chunks pc_lru tailq handling in reclaim_pv_chunk().

For processing, reclaim_pv_chunk() removes the pv_chunk from the lru
list, which makes pc_lru linkage invalid.  Then the pmap lock is
released, which allows for other thread to free the last pv entry
allocated from the chunk and call free_pv_chunk(), which tries to
modify the invalid linkage.

Similarly, the chunk is inserted into the private tailq new_tail
temporary.  Again, free_pv_chunk() might be run and corrupt the
linkage for the new_tail after the pmap lock is dropped.

This is a consequence of r299788 elimination of pvh_global_lock, which
allowed for reclaim to run in parallel with other pmap calls which
free pv chunks.

As a fix, do not remove the chunk from pc_lru queue, use a marker to
remember the position in the queue iteration.  We can safely operate
on the chunks after the chunk's pmap is locked, we fetched the chunk
after the marker, and we checked that chunk pmap is same as we have
locked, because chunk removal from pc_lru requires both pv_chunk_mutex
and the pmap mutex owned.

Note that the fix lost an optimization which was present in the
previous algorithm.  Namely, new_tail requeueing rotated the pv chunks
list so that reclaim didn't scan the same pv chunks that couldn't be
freed (because they contained a wired and/or superpage mapping) on
every invocation.  An additional change is planned which would improve
this.

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

6 years agopf tests: Use pft_set_rules everywhere
kp [Mon, 16 Oct 2017 15:05:32 +0000 (15:05 +0000)]
pf tests: Use pft_set_rules everywhere

We now have a utility function to set pf rules in the jail. Use it
whenever we need to set the pf rules in the test jail.

6 years agopf tests: Basic IPv6 forwarding tests
kp [Mon, 16 Oct 2017 15:03:45 +0000 (15:03 +0000)]
pf tests: Basic IPv6 forwarding tests

Pass/block packets in the forwarding path with pf.

Introduce the pft_set_rules() helper function, because we need to
remember to flush states between individual tests. If not we can get
packets passing despite rules blocking them because they match states
created in a previous test.

Extend pft_ping.py to be able to send IPv6 echo requests.

6 years agopf: test set-tos
kp [Mon, 16 Oct 2017 15:01:49 +0000 (15:01 +0000)]
pf: test set-tos

Introduce tests for the set-tos feature of pf. Teach pft_ping.py to send
and verify ToS flags.

6 years agoAdd Creative vendor ID.
mav [Mon, 16 Oct 2017 12:54:53 +0000 (12:54 +0000)]
Add Creative vendor ID.

MFC after: 1 week

6 years agoSave VFP state in getcontext(3) on ARM.
mmel [Mon, 16 Oct 2017 12:53:54 +0000 (12:53 +0000)]
Save VFP state in getcontext(3) on ARM.
This is a last followup of r315974, which fixes userland part
of VFP save/restore problems described in PR 217611.

PR: 217611
MFC after: 2 weeks

6 years agoUpdate details of interface capabilities changed by bridge(4).
mav [Mon, 16 Oct 2017 12:32:57 +0000 (12:32 +0000)]
Update details of interface capabilities changed by bridge(4).

PR: 221122
MFC after: 1 week

6 years agowlandebug(8): add a sanity check.
avos [Mon, 16 Oct 2017 07:15:50 +0000 (07:15 +0000)]
wlandebug(8): add a sanity check.

6 years agowlandebug(8): obtain original interface name via ifconfig_get_orig_name()
avos [Mon, 16 Oct 2017 07:01:27 +0000 (07:01 +0000)]
wlandebug(8): obtain original interface name via ifconfig_get_orig_name()

6 years agolibifconfig: allow to get original interface name via ifconfig_get_orig_name()
avos [Mon, 16 Oct 2017 06:54:26 +0000 (06:54 +0000)]
libifconfig: allow to get original interface name via ifconfig_get_orig_name()

Uses the same method as in tools/tools/ifinfo/ifinfo.c
(via net.link.generic sysctl).

Tested with modified wlandebug(8).

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

6 years agoRemove the libstand directory which is now empty.
delphij [Mon, 16 Oct 2017 04:46:28 +0000 (04:46 +0000)]
Remove the libstand directory which is now empty.

6 years agoExplicitly inlcude SYSDIR in the include path -- need machine path too?
imp [Mon, 16 Oct 2017 03:59:58 +0000 (03:59 +0000)]
Explicitly inlcude SYSDIR in the include path -- need machine path too?

6 years agoLOADER_foo_SUPPORTED
imp [Mon, 16 Oct 2017 03:59:52 +0000 (03:59 +0000)]
LOADER_foo_SUPPORTED

6 years agoMove all the ficl common code into ficl.mk
imp [Mon, 16 Oct 2017 03:59:44 +0000 (03:59 +0000)]
Move all the ficl common code into ficl.mk

There's a number of copies of basically identical code to enable
building forth in /boot/loader. Move it all into ficl.mk.

6 years agocreate defs.mk for common definitions
imp [Mon, 16 Oct 2017 03:59:38 +0000 (03:59 +0000)]
create defs.mk for common definitions

6 years agotweak style
imp [Mon, 16 Oct 2017 03:59:33 +0000 (03:59 +0000)]
tweak style

6 years agoMove common/Makefile.inc to sys/boot/loader.mk.
imp [Mon, 16 Oct 2017 03:59:28 +0000 (03:59 +0000)]
Move common/Makefile.inc to sys/boot/loader.mk.

Makefile.inc has a specific meaning in the tree, and
common/Makefile.inc doesn't quite fit into that. Rename it to
loader.mk and it will be a place to collect common things to all
/boot/loader programs there.

Sponsored by: Netflix

6 years agoRename top level Makefile.ficl to ficl.mk.
imp [Mon, 16 Oct 2017 03:59:22 +0000 (03:59 +0000)]
Rename top level Makefile.ficl to ficl.mk.

6 years agoMove orphaned man pages into new man directory from common. This helps
imp [Mon, 16 Oct 2017 03:59:17 +0000 (03:59 +0000)]
Move orphaned man pages into new man directory from common. This helps
keep cleaer that common is just for the MI files for /boot/loader
programs.

Sponsored by: Netflix

6 years agoUnify boot1 with loader
imp [Mon, 16 Oct 2017 03:59:11 +0000 (03:59 +0000)]
Unify boot1 with loader

Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor
to use the common efi_main.c.

Submitted by: Eric McCorkle
Differential Revision: https://reviews.freebsd.org/D10447

6 years agoZero out the ccb's alloated on the stack for the dump routines to more
imp [Sun, 15 Oct 2017 23:54:04 +0000 (23:54 +0000)]
Zero out the ccb's alloated on the stack for the dump routines to more
closely match a ccb returned from xpt_get_ccb().

Sponsored by: Netflix

6 years agoCloser examination shows that nvme and CAM both normally zero-fill
imp [Sun, 15 Oct 2017 23:53:55 +0000 (23:53 +0000)]
Closer examination shows that nvme and CAM both normally zero-fill
allocations (for req and ccb, which ultimately contain the
nvme_cmd). As such, we can micro-optimize these routines. Add a
comment to this effect, and bzero the ccb used to make the requests
for the nda dump rotuine so it more closely matches a ccb allocated
with xpt_get_ccb().

Sponsored by: Netflix

6 years agoFix the client IP address reported by nfsdumpstate for 64bit arch and NFSv4.1.
rmacklem [Sun, 15 Oct 2017 22:22:27 +0000 (22:22 +0000)]
Fix the client IP address reported by nfsdumpstate for 64bit arch and NFSv4.1.

The client IP address was not being reported for some NFSv4 mounts by
nfsdumpstate. Upon investigation, two problems were found for mounts
using IPv4. One was that the code (originally written and tested on i386)
assumed that a "u_long" was a "uint32_t" and would exactly store an
IPv4 host address. Not correct for 64bit arches.
Also, for NFSv4.1 mounts, the field was not being filled in. This was
basically correct, because NFSv4.1 does not use a callback address.
However, it meant that nfsdumpstate could not report the client IP addr.
This patch should fix both of these issues.
For IPv6, the address will still not be reported. The original NFSv4 RFC
only specified IPv4 callback addresses. I think this has changed and, if so,
a future commit to fix reporting of IPv6 addresses will be needed.

Reported by: manu
PR: 223036
MFC after: 2 weeks

6 years agoFix the handling of parital and too short chunks.
tuexen [Sun, 15 Oct 2017 19:33:30 +0000 (19:33 +0000)]
Fix the handling of parital and too short chunks.

Ensure that the current behaviour is consistent: stop processing
of the chunk, but finish the processing of the previous chunks.

This behaviour might be changed in a later commit to ABORT the
assoication due to a protocol violation, but changing this
is a separate issue.

MFC after: 3 days

6 years agoAdd information needed by Linux libdrm 2.4.74 (shipped with CentOS 7.4).
tijl [Sun, 15 Oct 2017 19:28:14 +0000 (19:28 +0000)]
Add information needed by Linux libdrm 2.4.74 (shipped with CentOS 7.4).

Create a config file for PCI devices that exposes their configuration
space.  Only fields needed by libdrm are filled in (vendor, device,
revision, subvendor and subdevice).

Link /sys/class/drm/card%d/device to the PCI device directory.

6 years agoSet DEVNAME to dri/card%d. This works with both in-tree drm and drm-next
tijl [Sun, 15 Oct 2017 19:21:15 +0000 (19:21 +0000)]
Set DEVNAME to dri/card%d.  This works with both in-tree drm and drm-next
and is also the value used on Linux.

Tested by: Greg V <greg@unrelenting.technology>

6 years agoWhen a Linux program tries to access a /path the kernel tries
tijl [Sun, 15 Oct 2017 18:53:21 +0000 (18:53 +0000)]
When a Linux program tries to access a /path the kernel tries
/compat/linux/path before /path.  Stop following symbolic links when
looking up /compat/linux/path so dead symbolic links aren't ignored.
This allows syscalls like readlink(2) and lstat(2) to work on such links.
And open(2) will return an error now instead of trying /path.

6 years agoUse nvme_ctrlr_poll instead of nvme_ctrlr_intx_handler since it is
imp [Sun, 15 Oct 2017 16:19:09 +0000 (16:19 +0000)]
Use nvme_ctrlr_poll instead of nvme_ctrlr_intx_handler since it is
more general and doesn't try to access registers that may be undefined
when the card is in MSIX mode.

This change, along with r324630, r324631, r324632, makes nda crash
dumps work again. Previously, they only worked on CPU 0 when the stack
garbage was just so.

Sponsored by: Netflix
Suggested by: scottl@ (who provided earlier version of the patch)

6 years agoCreate general polling function for the nvme controller. Use it when
imp [Sun, 15 Oct 2017 16:18:08 +0000 (16:18 +0000)]
Create general polling function for the nvme controller. Use it when
we're doing the various pin-based interrupt modes. Adjust
nvme_ctrlr_intx_handler to use nvme_ctrlr_poll.

Sponsored by: Netflix
Suggested by: scottl@

6 years agoBe nicer on the dump stack by allocating only a ccb_nvmeio rather than
imp [Sun, 15 Oct 2017 16:18:03 +0000 (16:18 +0000)]
Be nicer on the dump stack by allocating only a ccb_nvmeio rather than
a full ccb. This saves a few hundre bytes, which might be important
during a crash dump...

Sponsored by: Netflix
Suggested by: scottl@

6 years agoExplicitly set reserved fields and 'fuse' to 0. This prevents us from
imp [Sun, 15 Oct 2017 16:17:59 +0000 (16:17 +0000)]
Explicitly set reserved fields and 'fuse' to 0. This prevents us from
acidentally sending bogus values in these fields, which some drives
may reject with an error or worse (undefined behavior).

This is especially needed for the ndadump routine which allocates the
cmd from stack garbage....

Sponsored by: Netflix

6 years agoUpdate comment to reflect actual default timeout.
imp [Sun, 15 Oct 2017 16:17:55 +0000 (16:17 +0000)]
Update comment to reflect actual default timeout.

Sponsored by: Netflix

6 years agoAdd special handling for current in-tree drm devices, like r323692 added
tijl [Sun, 15 Oct 2017 16:08:22 +0000 (16:08 +0000)]
Add special handling for current in-tree drm devices, like r323692 added
for drm-next.

6 years agoUse sizeof instead of strlen on string constants. The compiler doesn't
tijl [Sun, 15 Oct 2017 16:03:45 +0000 (16:03 +0000)]
Use sizeof instead of strlen on string constants.  The compiler doesn't
optimise the strlen calls away with -ffreestanding.

6 years agoReplace some magic numbers in usb_template(4) code with #defines.
trasz [Sun, 15 Oct 2017 11:46:11 +0000 (11:46 +0000)]
Replace some magic numbers in usb_template(4) code with #defines.
There should be no functional changes.

Reviewed by: hselasky
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12670

6 years agorc.subr: Remove test that is always true.
jilles [Sun, 15 Oct 2017 11:28:41 +0000 (11:28 +0000)]
rc.subr: Remove test that is always true.

The code above always sets _pidcmd to a non-empty value.

6 years agoFix ctld segfaulting when using ucl conf file format and having duplicated
bapt [Sun, 15 Oct 2017 08:03:14 +0000 (08:03 +0000)]
Fix ctld segfaulting when using ucl conf file format and having duplicated
lun or target

Submitted by: Nikita Kozlov <nikita.kozlov at blade-group.com>
MFC after: 3 days
Sponsored by: blade
Differential Revision: https://reviews.freebsd.org/D12646

6 years agoSync (make same) the offsetof macro definition in include/ with the
cy [Sun, 15 Oct 2017 02:40:13 +0000 (02:40 +0000)]
Sync (make same) the offsetof macro definition in include/ with the
definition of the same in sys/sys/. The problem was discovered while
working on implementing a new C11 gets_s() for libc. (The new gets_s()
requires rsize_t found in include/stddef.h.) The solution to sync the two
definitions was suggested by ed@ while discussing D12667.

Suggested by: ed
MFC after: 2 weeks

6 years agomlx4: use enum constants instead of const vars for case exprs
rlibby [Sat, 14 Oct 2017 23:25:44 +0000 (23:25 +0000)]
mlx4: use enum constants instead of const vars for case exprs

Follow up from r324201 to fix compilation with gcc, which complains
about non-ICE case expressions.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D12675

6 years agoAdd extended attributes support to fuse kernel module.
fsu [Sat, 14 Oct 2017 19:02:52 +0000 (19:02 +0000)]
Add extended attributes support to fuse kernel module.

Author:         kem
Reviewed by:    cem, pfg (mentor)
Approved by:    pfg (mentor)
MFC after:      2 weeks

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

6 years agoSwitch procstat from subcommand flags to verbs
brooks [Sat, 14 Oct 2017 18:38:36 +0000 (18:38 +0000)]
Switch procstat from subcommand flags to verbs

- Use an enumerated value instead of separate flags for commands
- Look for a verb if no command flag is set
- Lookup the "xocontainer" value based on the command
- Document the new command verbs in the man-page

Submitted by: kdrakehp@zoho.com
Differential Revision: https://reviews.freebsd.org/D10916

6 years agoCode cleanup, not functional change.
tuexen [Sat, 14 Oct 2017 10:02:59 +0000 (10:02 +0000)]
Code cleanup, not functional change.

This avoids taking a pointer of a packed structure which allows simpler
compilation of the userland stack.

MFC after: 1 week

6 years agoFix wrong v_free_count annotation - (f) instead of (a)
mjg [Sat, 14 Oct 2017 04:27:58 +0000 (04:27 +0000)]
Fix wrong v_free_count annotation - (f) instead of (a)

Reported by: alc

6 years agomtx: fix up owner_mtx after r324609
mjg [Sat, 14 Oct 2017 00:47:30 +0000 (00:47 +0000)]
mtx: fix up owner_mtx after r324609

Now that MTX_UNOWNED is 0 the test was alwayas false.

6 years agoReduce traffic on vm_cnt.v_free_count
mjg [Fri, 13 Oct 2017 21:54:34 +0000 (21:54 +0000)]
Reduce traffic on vm_cnt.v_free_count

The variable is modified with the highly contended page free queue lock.
It unnecessarily shares a cacheline with purely read-only fields and is
re-read after the lock is dropped in the page allocation code making the
hold time longer.

Pad the variable just like the others and store the value as found with
the lock held instead of re-reading.

Provides a modest 1%-ish speed up in concurrent page faults.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D12665

6 years agomtx: change MTX_UNOWNED from 4 to 0
mjg [Fri, 13 Oct 2017 20:31:56 +0000 (20:31 +0000)]
mtx: change MTX_UNOWNED from 4 to 0

The value is spread all over the kernel and zeroing a register is
cheaper/shorter than setting it up to an arbitrary value.

Reduces amd64 GENERIC-NODEBUG .text size by 0.4%.

MFC after: 1 week

6 years agoRegenerate usb.conf
kp [Fri, 13 Oct 2017 20:29:35 +0000 (20:29 +0000)]
Regenerate usb.conf

6 years agoSupport the D-Link DWM-222 LTE Dongle
kp [Fri, 13 Oct 2017 19:41:35 +0000 (19:41 +0000)]
Support the D-Link DWM-222 LTE Dongle

Submitted by: Daniel Hänschke <jailedemon@googlemail.com>

6 years agoMake the PHOLD in linux_wait_event_common() unconditional.
markj [Fri, 13 Oct 2017 19:27:33 +0000 (19:27 +0000)]
Make the PHOLD in linux_wait_event_common() unconditional.

After some in-progress work is committed, this would otherwise be the only
instance of #if(n)def NO_SWAPPING in the tree. Moreover, the requisite
opt_vm.h include was missing, so the PHOLD/PRELE calls were always being
compiled in anyway.

MFC after: 1 week

6 years agoclean up remnants of removed GPL software
emaste [Fri, 13 Oct 2017 18:30:32 +0000 (18:30 +0000)]
clean up remnants of removed GPL software

send-pr r267486
texinfo r276551
ranlib r286332
sdiff r298823
rcs r307351
diff r317209

6 years agoRemove additional groff leftovers (r319664)
emaste [Fri, 13 Oct 2017 18:23:08 +0000 (18:23 +0000)]
Remove additional groff leftovers (r319664)

6 years agoObsoleteFiles.inc: correct year on libstand removal
emaste [Fri, 13 Oct 2017 17:15:17 +0000 (17:15 +0000)]
ObsoleteFiles.inc: correct year on libstand removal

6 years agoAddress two problems with sendfile(..., SF_NOCACHE) and apply one
alc [Fri, 13 Oct 2017 16:31:50 +0000 (16:31 +0000)]
Address two problems with sendfile(..., SF_NOCACHE) and apply one
"optimization".  First, sendfile(..., SF_NOCACHE) frees pages without
checking whether those pages are mapped.  This can leave the system
with mappings to free or repurposed pages.  Second, a page can be
busied between the time of the current busy test and acquiring the
object lock.  Essentially, the test performed before the object lock
is acquired can only be regarded as an optimization to short-circuit
further work on the page.  It cannot, however, be relied upon to prove
that it is safe to free the page.  Third, when sendfile(..., SF_NOCACHE)
was originally implemented, vm_page_deactivate_noreuse() did not yet
exist.  Use vm_page_deactivate_noreuse() instead of vm_page_deactivate(),
because it comes closer to freeing the page.

In collaboration with: glebius
Discussed with: gallatin, kib, markj
X-MFC after: r324448

6 years agoEvaluate the real size of the sblk_zone.
kib [Fri, 13 Oct 2017 16:23:05 +0000 (16:23 +0000)]
Evaluate the real size of the sblk_zone.

Submitted by: ota@j.email.ne.jp
PR: 221356
Reviewed by: alc, markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D12660

6 years agoIncrease the arm/armv6 and arm/armv7 images from 2.5GB to 3GB,
gjb [Fri, 13 Oct 2017 15:16:57 +0000 (15:16 +0000)]
Increase the arm/armv6 and arm/armv7 images from 2.5GB to 3GB,
since the RPI2 (at least) does not fit in 2.5GB.

While here, add a missing BOARDNAME to RPI2.conf.

Sponsored by: The FreeBSD Foundation

6 years agoo Support for Kabylake CPU PMCs (fall down to PMC_CPU_INTEL_SKYLAKE).
br [Fri, 13 Oct 2017 15:02:29 +0000 (15:02 +0000)]
o Support for Kabylake CPU PMCs (fall down to PMC_CPU_INTEL_SKYLAKE).
o Fix bugs in events descriptions for Skylake, Skylake Xeon and Haswell.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12654

6 years agoDon't call selrecord() outside the select system call in the LinuxKPI, because
hselasky [Fri, 13 Oct 2017 14:14:46 +0000 (14:14 +0000)]
Don't call selrecord() outside the select system call in the LinuxKPI, because
then td->td_sel is NULL and this will result in a segfault inside selrecord().
This happens when only using kqueue() to poll for read and write events.
If select() and kqueue() is mixed there won't be a segfault.

Reported by: Johannes Lundberg
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoANSIfy vm_kern.c
emaste [Fri, 13 Oct 2017 13:53:19 +0000 (13:53 +0000)]
ANSIfy vm_kern.c

PR: 222673
Submitted by: ota@j.email.ne.jp
MFC after: 1 week

6 years agotruss: mention 'H' in usage
emaste [Fri, 13 Oct 2017 13:47:55 +0000 (13:47 +0000)]
truss: mention 'H' in usage

r295930 introduced the 'H' option to display thread IDs, but did not add
the option to usage().

PR: 222837
Submitted by: Oliver Kiddle <okiddle@yahoo.co.uk>
MFC after: 1 week

6 years agoFix regression in handling O_FORWARD_IP opcode after r279948.
ae [Fri, 13 Oct 2017 11:11:53 +0000 (11:11 +0000)]
Fix regression in handling O_FORWARD_IP opcode after r279948.

To properly handle 'fwd tablearg,port' opcode, copy sin_port value from
sockaddr_in structure stored in the opcode into corresponding hopstore
field.

PR: 222953
MFC after: 1 week

6 years agoReturn 'errno' value from the table_do_modify_record(), it is expected
ae [Fri, 13 Oct 2017 11:01:33 +0000 (11:01 +0000)]
Return 'errno' value from the table_do_modify_record(), it is expected
by table_modify_record().

This makes quiet operations with tables really quiet.

PR: 222953
MFC after: 1 week

6 years agoremove process and jail directory machinations from dounmount
avg [Fri, 13 Oct 2017 09:42:05 +0000 (09:42 +0000)]
remove process and jail directory machinations from dounmount

The manipulations done by mountcheckdirs() are not that useful during
the unmount, they can bring about unexpected security consequences.

Thic change effectively reverts the change in r73241.

The change also allows to simplify the handling of rootvnode global
variable.

Discussed with: mckusick, mjg, kib
Reviewed by: trasz
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12366

6 years agoi2c(8): clean up and clarify read operation
avg [Fri, 13 Oct 2017 09:21:41 +0000 (09:21 +0000)]
i2c(8): clean up and clarify read operation

The code went to a lot of trouble to issue either a start+stop condition
or a repeated start condition only to follow it with a stop condition
and a read(2) call that issues a new start condition.
So, fix the read in I2C_MODE_REPEATED_START mode by using I2CREAD ioctl
within the running transaction.  This obviously requires that the slave
address has the read bit set which was not required before.

Another problem was with width parameter of zero and
I2C_MODE_REPEATED_START mode.  In that case we issued a repeated start
without any preceding start.

While here, remove the redundant (unused) argument to I2CSTOP throughout
the program.
Also, clarify the meaning of -w option, especially "-w 0", in the manual
page.

Reviewed by: no one
Differential Revision: https://reviews.freebsd.org/D12331

6 years ago[net80211] don't try to follow a NULL rxs pointer down the sink.
adrian [Fri, 13 Oct 2017 06:49:07 +0000 (06:49 +0000)]
[net80211] don't try to follow a NULL rxs pointer down the sink.

It's smelly, and we already checked earlier whether we needed to.

6 years ago[ath] Begin using the replacement EDCA functions.
adrian [Thu, 12 Oct 2017 21:58:51 +0000 (21:58 +0000)]
[ath] Begin using the replacement EDCA functions.

As part of ath10k and other chipset support, the EDCA stuff has to be moved
to potentially be per-VAP.  For hardware that doesn't support it (ie,
everything that we currently support) it can just fetch the "current"
global EDCA parameters for the NIC.

This is one of those parameters that is linked to the currently active
channel context / VAP in Linux mac80211 parlance.

Tested:

* ath(4), STA and AP modes

6 years ago[net80211] begin handling multiple hardware decap'ed A-MSDU in the RX path.
adrian [Thu, 12 Oct 2017 21:56:58 +0000 (21:56 +0000)]
[net80211] begin handling multiple hardware decap'ed A-MSDU in the RX path.

The duplicate detection code currently expects A-MSDU frames to be encaped -
they're decap'ed /after/ duplicate detection.

However for ath10k (and iwm hardware later on) the firmware supports
doing A-MSDU decap in hardware - which shows up as multiple frames with
the same sequence number and IV.

This is the first part of decap handling - if we see a stretch of A-MSDU
frames from the driver with the MORE bit set, then don't treat them
as duplicates.

This isn't 100% complete as crypto sequence number handling and "A-MSDU in
A-MPDU" needs handling, but it's a start.

This should be a glorified no-op for everyone.  Please tell me if it isn't.

6 years agoFix build after r324446.
glebius [Thu, 12 Oct 2017 21:26:52 +0000 (21:26 +0000)]
Fix build after r324446.

6 years agoOptimize zpool_read_all_labels with AIO
asomers [Thu, 12 Oct 2017 21:25:11 +0000 (21:25 +0000)]
Optimize zpool_read_all_labels with AIO

Read all labels in parallel instead of sequentially

MFC after: 3 weeks
X-MFC-With: 322854
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12495

6 years agoAdd arm/armv7 checks to env_check().
gjb [Thu, 12 Oct 2017 20:31:10 +0000 (20:31 +0000)]
Add arm/armv7 checks to env_check().

Sponsored by: The FreeBSD Foundation

6 years agoFix shadowed variable hidden by WARNS changing to 3 in r313006.
bdrewery [Thu, 12 Oct 2017 19:58:21 +0000 (19:58 +0000)]
Fix shadowed variable hidden by WARNS changing to 3 in r313006.

Sponsored by: Dell EMC Isilon
MFC after: 1 week

6 years agoregen freebsd32_sysent.c after r324564 (freebsd32_posix_fallocate)
emaste [Thu, 12 Oct 2017 18:31:28 +0000 (18:31 +0000)]
regen freebsd32_sysent.c after r324564 (freebsd32_posix_fallocate)

6 years agoallow posix_fallocate in 32-bit compat capability mode
emaste [Thu, 12 Oct 2017 18:30:54 +0000 (18:30 +0000)]
allow posix_fallocate in 32-bit compat capability mode

Reported by: kib
MFC after: 2 weeks
MFC with: r324560
Sponsored by: The FreeBSD Foundation

6 years agoa10_ehci: Remove the passby code
manu [Thu, 12 Oct 2017 18:00:29 +0000 (18:00 +0000)]
a10_ehci: Remove the passby code

It doesn't seems to be needed anymore and this make ehci working again
on the Pine64.
Thanks to jmcneill@ for the help.

Tested on: Pine64 (A64), OrangePi One (H3), BananapiM2 (A31s)

6 years agoAdd rev16 instruction to the disassembler.
bz [Thu, 12 Oct 2017 15:53:54 +0000 (15:53 +0000)]
Add rev16 instruction to the disassembler.

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

6 years agoregen init_sysent.c r324560
emaste [Thu, 12 Oct 2017 15:48:37 +0000 (15:48 +0000)]
regen init_sysent.c r324560

6 years agoallow posix_fallocate in capability mode
emaste [Thu, 12 Oct 2017 15:45:53 +0000 (15:45 +0000)]
allow posix_fallocate in capability mode

posix_fallocate is logically equivalent to writing zero blocks to the
desired file size and there is no reason to prevent calling it in
capability mode. posix_fallocate already checked for the CAP_WRITE
right, so we merely need to list it in capabilities.conf.

Reviewed by: allanjude
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12640

6 years agoMove panic back into libsa. It's documented in libstand(3) to belong
imp [Thu, 12 Oct 2017 15:16:27 +0000 (15:16 +0000)]
Move panic back into libsa. It's documented in libstand(3) to belong
there.

Sponsored by: Netflix

6 years agoDefine prototype for exit and ensure references
imp [Thu, 12 Oct 2017 15:16:22 +0000 (15:16 +0000)]
Define prototype for exit and ensure references

Define a prototype for exit in stand.h. Provide a reference to exit in
a few conf.c files to ensure that its definition gets pulled in early.
Since exit() is a MD routine, it isn't defined in libsa. However,
libsa tends to be listed last and will soon have panic() in it which
calls exit(). The reference to exit early ensures that the MD exit is
available to satisfy linking for static libraries.

6 years agoRename exit to efi_exit to avoid clashing with libsa exit definition
imp [Thu, 12 Oct 2017 15:16:16 +0000 (15:16 +0000)]
Rename exit to efi_exit to avoid clashing with libsa exit definition

Rename exit to efi_exit. It doesn't have the proper signature and
conflicts with standard definition. Provide the standard definition as
well.

Sponsored by: Netflix

6 years agoMove ufsread.c
imp [Thu, 12 Oct 2017 14:57:05 +0000 (14:57 +0000)]
Move ufsread.c

Move ufsread.c from sys/boot/common (which used to be all the common
files for /boot/loader, but grew to be all the common files for
sys/boot, but that's now sys/boot/libsa's job) to sys/boot/libsa.

Sponsored by: Netflix

6 years agoHonor CFLAGS modifications in Makefile.inc by using += here. There's
imp [Thu, 12 Oct 2017 14:57:00 +0000 (14:57 +0000)]
Honor CFLAGS modifications in Makefile.inc by using += here.  There's
no hyper-small space constraints, so there's no reason to tightly
control it.

Sponsored by: Netflix

6 years agoMove crc32.c, util.c and gpt.c over to libsa.
imp [Thu, 12 Oct 2017 14:56:54 +0000 (14:56 +0000)]
Move crc32.c, util.c and gpt.c over to libsa.

Sponsored by: Netflix

6 years agoRename libstand.a to libsa.a and libstand32.a to libsa32.a
imp [Thu, 12 Oct 2017 14:56:48 +0000 (14:56 +0000)]
Rename libstand.a to libsa.a and libstand32.a to libsa32.a

Sponsored by: Netflix

6 years agoKill the userboot copy of libstand.
imp [Thu, 12 Oct 2017 14:56:42 +0000 (14:56 +0000)]
Kill the userboot copy of libstand.

It's not needed (it's now identical to libsa, and seems to have been
for some time).

Sponsored by: Netflix

6 years agoMove lib/libstand to sys/boot/libsa
imp [Thu, 12 Oct 2017 14:56:28 +0000 (14:56 +0000)]
Move lib/libstand to sys/boot/libsa

Move the sources to sys/boot. Make adjustments related to the
move. Kill LIBSTAND_SRC since it's no longer needed.

Sponsored by: Netflix

6 years agoAdd $FreeBSD$ to ancient sources that it's missing from.
imp [Thu, 12 Oct 2017 14:53:25 +0000 (14:53 +0000)]
Add $FreeBSD$ to ancient sources that it's missing from.

Sponsored by: Netflix

6 years agoPreviously there was a VIRT kernel to which I had added these options.
bz [Thu, 12 Oct 2017 14:32:45 +0000 (14:32 +0000)]
Previously there was a VIRT kernel to which I had added these options.
With that gone they need to go into GENERIC now.

Makes FreeBSD/arm usable on gem5 by default.

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

6 years agoxinstall: plug an infinite loop in directory creation
mjg [Thu, 12 Oct 2017 13:59:23 +0000 (13:59 +0000)]
xinstall: plug an infinite loop in directory creation

If stat continues to fail with ENOENT and mkdir with EEXIST the code wont
finish. In particular this can show up when the target path follows through
a symlink to a non-existent directory.

Reported by: ae
MFC after: 1 week

6 years agoWhen unmounting a tmpfs, do not call free_unr.
mjoras [Wed, 11 Oct 2017 21:53:53 +0000 (21:53 +0000)]
When unmounting a tmpfs, do not call free_unr.

tmpfs uses unr(9) to allocate inodes. Previously when unmounting it
would individually free the units when it freed each vnode. This is
unnecessary as we can use the newly-added unrhdr_clear function to clear
out the unr in onde go. This measurably reduces the time to unmount a
tmpfs with many files.

Reviewed by: cem, lidl
Approved by: rstone (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12591

6 years agoAdd clearing function for unr(9).
mjoras [Wed, 11 Oct 2017 21:53:50 +0000 (21:53 +0000)]
Add clearing function for unr(9).

Previously before you could call unrhdr_delete you needed to
individually free every allocated unit. It is useful to be able to tear
down the unr without having to go through this process, as it is
significantly faster than freeing the individual units.

Reviewed by: cem, lidl
Approved by: rstone (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12591

6 years agoDeclare more TCP globals in tcp_var.h, so that alternative TCP stacks
glebius [Wed, 11 Oct 2017 20:36:09 +0000 (20:36 +0000)]
Declare more TCP globals in tcp_var.h, so that alternative TCP stacks
can use them.  Gather all TCP tunables in tcp_var.h in one place and
alphabetically sort them, to ease maintainance of the list.

Don't copy and paste declarations in tcp_stacks/fastpath.c.

6 years agoAdded support driver state capture/retrieval
davidcs [Wed, 11 Oct 2017 20:22:01 +0000 (20:22 +0000)]
Added support driver state capture/retrieval

MFC after:5 days

6 years agocrypto(9): Print flags in more useful hex
cem [Wed, 11 Oct 2017 20:04:30 +0000 (20:04 +0000)]
crypto(9): Print flags in more useful hex

Sponsored by: Dell EMC Isilon

6 years agolibunwind: use upstream patch to disable executable stacks
emaste [Wed, 11 Oct 2017 19:26:39 +0000 (19:26 +0000)]
libunwind: use upstream patch to disable executable stacks

arm uses '@' as a comment character, and cannot use @progbits in the
.section directive. Apply the upstream noexec stach change which avoids
this issue.

Obtained from: LLVM r277868

6 years agoAdd sanity checks in ql_hw_send() qla_send() to ensure that empty slots
davidcs [Wed, 11 Oct 2017 18:25:05 +0000 (18:25 +0000)]
Add sanity checks in ql_hw_send() qla_send() to ensure that empty slots
in Tx Ring map to empty slot in Tx_buf array before Transmits. If the
checks fail further Transmission on that Tx Ring is prevented.

MFC after:5 days

6 years agohwpmc(4): Actually use a sufficiently wide type
cem [Wed, 11 Oct 2017 15:13:40 +0000 (15:13 +0000)]
hwpmc(4): Actually use a sufficiently wide type

jhibbits@ points out that left shifting bits 8-11 24 bits won't fit in a 32-bit
integer either.

Corrects r324533.

Submitted by: jhibbits
Sponsored by: Dell EMC Isilon

6 years agohwpmc(4): Force sufficiently wide type for left shift
cem [Wed, 11 Oct 2017 14:59:04 +0000 (14:59 +0000)]
hwpmc(4): Force sufficiently wide type for left shift

Ordinary input to this macro comes from pe_code, which is uint16_t.  Coverity
points out that shifting such a value discards the result of a 24 bit shift,
which is not what we want.

A follow-up to r324291.

CID: 1381676
Sponsored by: Dell EMC Isilon

6 years agoDo not try to remove diff.7 optionaly has it is always removed
bapt [Wed, 11 Oct 2017 14:41:11 +0000 (14:41 +0000)]
Do not try to remove diff.7 optionaly has it is always removed
since GNU diff(1) has been replaced with BSD diff(1)