freebsd.git
7 years agoThis file is also used in libcompiler_rt, so bring in stdbool.h if we're not
cognet [Tue, 11 Apr 2017 13:31:27 +0000 (13:31 +0000)]
This file is also used in libcompiler_rt, so bring in stdbool.h if we're not
in the kernel.

7 years agoDo not adjust interface MTU automatically. Leave this task to the system
ae [Tue, 11 Apr 2017 08:56:18 +0000 (08:56 +0000)]
Do not adjust interface MTU automatically. Leave this task to the system
administrator.

This restores the behavior that was prior to r274246.

No objection from: #network
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10215

7 years agoRemove debugging printf.
kib [Tue, 11 Apr 2017 08:29:12 +0000 (08:29 +0000)]
Remove debugging printf.

Instead, issue a diagnostic and return appropriate error if
ncl_flush() was unable to clean buffer queue after the specified
number or retries.

Reviewed by: rmacklem
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years ago[net80211] refactor out "add slot" and "purge slot" for A-MPDU.
adrian [Tue, 11 Apr 2017 07:05:55 +0000 (07:05 +0000)]
[net80211] refactor out "add slot" and "purge slot" for A-MPDU.

This is in preparation for A-MSDU decap in A-MPDU support.

* refactor out the code to purge a single reorder slot into ampdu_rx_purge_slot().
* refactor out the code to add a frame to the given reorder slot
  to ampdu_rx_add_slot().

This should be a big no-op as far as current code is concerned.

Tested:

* QCA9880v2, STA mode (11ac)
* iwn(4), STA mode (11n)

Reviewed by: avos
Differential Revision: https://reviews.freebsd.org/D10328

7 years agoMFV r316693:
pfg [Mon, 10 Apr 2017 22:56:38 +0000 (22:56 +0000)]
MFV r316693:
8046 Let calloc() do the multiplication in libzfs_fru_refresh

https://github.com/illumos/illumos-gate/commit/5697e03e6e3e2697f56ae341c7c8ce79680d6a2e

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

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Pedro Giffuni <pfg@freebsd.org>

MFC after: 3 days

7 years agoFix a crash during unmount of an NFSv4.1 mount.
rmacklem [Mon, 10 Apr 2017 22:47:18 +0000 (22:47 +0000)]
Fix a crash during unmount of an NFSv4.1 mount.

Larry Rosenman reported a crash on freebsd-current@ which was caused by
a premature release of the krpc backchannel socket structure.
I believe this was caused by a race between the SVC_RELEASE() in clnt_vc.c
and the xprt_unregister() in the higher layer (clnt_rc.c), which tried
to lock the mutex in the xprt structure and crashed.
This patch fixes this by removing the xprt_unregister() in the clnt_vc
layer and allowing this to always be done by the clnt_rc (higher reconnect
layer).

Reported by: ler@lerctr.org
Tested by: ler@letctr.org
MFC after: 2 weeks

7 years agoSet initial values for nfsstatfs in the NFSv4 client.
rmacklem [Mon, 10 Apr 2017 21:49:35 +0000 (21:49 +0000)]
Set initial values for nfsstatfs in the NFSv4 client.

The AmazonEFS NFSv4.1 server does not support the FILES_FREE and FILES_TOTAL
attributes. As such, an NFSv4.1 mount to the server would return garbage
for these values. This patch initializes the fields of the nfsstatfs structure,
so that "df" and friends will at least return consistent bogus values.
This patch should have effect when mounting other NFSv4.1 servers.

Reported by: cperciva
MFC after: 2 weeks

7 years agoProvide some kind of __sync_bool_compare_and_swap_4(), as it is used by CK,
cognet [Mon, 10 Apr 2017 21:44:13 +0000 (21:44 +0000)]
Provide some kind of __sync_bool_compare_and_swap_4(), as it is used by CK,
and our gcc is too ancient to provide it.
This should fix the build on mips.

7 years agoFix build with LLD by removing duplicate symbols already in IBVERBS_1.0.
bdrewery [Mon, 10 Apr 2017 21:26:37 +0000 (21:26 +0000)]
Fix build with LLD by removing duplicate symbols already in IBVERBS_1.0.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D10352

7 years agoBusy the map in vm_map_protect().
markj [Mon, 10 Apr 2017 21:01:42 +0000 (21:01 +0000)]
Busy the map in vm_map_protect().

We are otherwise susceptible to a race with a concurrent vm_map_wire(),
which may drop the map lock to fault pages into the object chain. In
particular, vm_map_protect() will only copy newly writable wired pages
into the top-level object when MAP_ENTRY_USER_WIRED is set, but
vm_map_wire() only sets this flag after its fault loop. We may thus end
up with a writable wired entry whose top-level object does not contain the
entire range of pages.

Reported and tested by: pho
Reviewed by: kib
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D10349

7 years agoregenerate src.conf.5 after r316647 and r316684
emaste [Mon, 10 Apr 2017 21:00:47 +0000 (21:00 +0000)]
regenerate src.conf.5 after r316647 and r316684

Sponsored by: The FreeBSD Foundation

7 years agoConsistently use for-loops in vm_map_protect().
markj [Mon, 10 Apr 2017 20:57:16 +0000 (20:57 +0000)]
Consistently use for-loops in vm_map_protect().

No functional change.

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

7 years agoAdd some bounds assertions to the vm_map_entry clip functions.
markj [Mon, 10 Apr 2017 20:55:42 +0000 (20:55 +0000)]
Add some bounds assertions to the vm_map_entry clip functions.

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

7 years agolibelf: add an assert that msz is non-zero
emaste [Mon, 10 Apr 2017 19:22:15 +0000 (19:22 +0000)]
libelf: add an assert that msz is non-zero

Reported by: Coverity
CID: 976023

7 years agoMake WITHOUT_TOOLCHAIN imply WITHOUT_LLD.
emaste [Mon, 10 Apr 2017 18:21:30 +0000 (18:21 +0000)]
Make WITHOUT_TOOLCHAIN imply WITHOUT_LLD.

LLD is a toolchain component.

7 years agoBump __FreeBSD_version due to r316648, rename of
pkelsey [Mon, 10 Apr 2017 17:59:29 +0000 (17:59 +0000)]
Bump __FreeBSD_version due to r316648, rename of
smp_no_redevous_barrier() to smp_no_rendezvous_barrier()

Reported by: jkim

7 years agoloader: r316585 did miss sparc/ofw
tsoome [Mon, 10 Apr 2017 17:57:56 +0000 (17:57 +0000)]
loader: r316585 did miss sparc/ofw

This update does add the code to pass partition size to vdev_probe() via
simple callback. Tested via tinderbox build, but not yet with actual boot.
The code can be improved still, but to verify the idea to read media
block size and amedia size has to be confirmed first.

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

7 years agoHandle NULL entries in gmirror disk ds_bios arrays.
markj [Mon, 10 Apr 2017 17:15:59 +0000 (17:15 +0000)]
Handle NULL entries in gmirror disk ds_bios arrays.

Entries may be removed and freed if an I/O error occurs during mirror
synchronization, so we cannot assume that all entries of ds_bios are
valid.

Also ensure that a synchronization BIO's array index is preserved after
a successful write.

Reported and tested by: pho
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoDo not lose dirty bits for removing PROT_WRITE on arm64.
kib [Mon, 10 Apr 2017 15:32:26 +0000 (15:32 +0000)]
Do not lose dirty bits for removing PROT_WRITE on arm64.

Arm64 pmap interprets accessed writable ptes as modified, since
ARMv8.0 does not track Dirty Bit Modifier in hardware. If writable bit
is removed, page must be marked as dirty for MI VM.

This change is most important for COW, where fork caused losing
content of the dirty pages which were not yet scanned by pagedaemon.

Reviewed by: alc, andrew
Reported and tested by: Mark Millard <markmi@dsl-only.net>
PR: 217138, 217239
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoPort the IMX6 kernel configuration to use MULTIDELAY. This will help adding
andrew [Mon, 10 Apr 2017 12:35:58 +0000 (12:35 +0000)]
Port the IMX6 kernel configuration to use MULTIDELAY. This will help adding
the i.MX series of SoCs to the armv6 GENERIC kernel.

This uses updated times from ian@.

Reviewed by: ian
Sponsored by: ABT Systems Ltd

7 years agoDo not register in CTL portal groups without portals.
mav [Mon, 10 Apr 2017 10:38:12 +0000 (10:38 +0000)]
Do not register in CTL portal groups without portals.

From config synthax point of view such portal groups are not incorrect,
but they are useless since can not receive any connection.  And since
CTL port resource is very limited, it is good to save it.

MFC after: 2 weeks

7 years agoUse estimated RTT for receive buffer auto resizing instead of timestamps
smh [Mon, 10 Apr 2017 08:19:35 +0000 (08:19 +0000)]
Use estimated RTT for receive buffer auto resizing instead of timestamps

Switched from using timestamps to RTT estimates when performing TCP receive
buffer auto resizing, as not all hosts support / enable TCP timestamps.

Disabled reset of receive buffer auto scaling when not in bulk receive mode,
which gives an extra 20% performance increase.

Also extracted auto resizing to a common method shared between standard and
fastpath modules.

With this AWS S3 downloads at ~17ms latency on a 1Gbps connection jump from
~3MB/s to ~100MB/s using the default settings.

Reviewed by:    lstewart, gnn
MFC after:      2 weeks
Relnotes:       Yes
Sponsored by:   Multiplay
Differential Revision:  https://reviews.freebsd.org/D9668

7 years agoSpecial rendering methods for removing mouse cursors cannot be removed
bde [Mon, 10 Apr 2017 06:19:09 +0000 (06:19 +0000)]
Special rendering methods for removing mouse cursors cannot be removed
like I hoped, since they are needed for removing parts over the border.
Continue fixing bugs in them.

In the vga planar mode renderer, remove removal of the part of the
image over the text window.  This was hard-coded for nearly 8x16 fonts
and in practice didn't remove enough for 8x8 fonts.  This used the
wrong attribute over cutmarked regions.  The caller refreshes with the
correct attribute later, so the attribute bug only caused flicker.
The caller uses the same hard-coding, so the refreshes fix up all the
spots with the wrong attribute, but keep missing the missed spots.
This still gives trails of bits of cursors for cursor motions in the
affected configurations (mainly depth 4 modes with 8x8) fonts.  8x14
fonts barely escape the problem since although the cursor is drawn
as 16x16, its active part is only 9x13 and the active part fits in
the hard-coded 2x2 character cell window for 8x14 fonts.  8x8 fonts
need a 2x3 window.

In the fb non-sparc64 renderer, the buggy image removal was buggier
and was already avoided by returning before it.  Remove it completely
and fix nearby style bugs.  It was essentially the same as for the vga
planar mode renderer (obfuscated by swapping x and y).  This was buggier
since fb should handle more types of hardware so the hard-coding is
wronger.

The remaining fb image removal is also buggier.  It never supported
software cursors drawn into the border, and the hardware cursor is
probably broken by other bugs to be fixed soon.

7 years agoAdd support for imx6ul soc.
ian [Mon, 10 Apr 2017 02:46:39 +0000 (02:46 +0000)]
Add support for imx6ul soc.

7 years agoAvoid starvation of the server crash recovery thread for the NFSv4 client.
rmacklem [Mon, 10 Apr 2017 01:28:01 +0000 (01:28 +0000)]
Avoid starvation of the server crash recovery thread for the NFSv4 client.

This patch gives a requestor of the exclusive lock on the client state
in the NFSv4 client priority over shared lock requestors. This avoids
the server crash recovery thread being starved out by other threads doing
RPCs.

Tested by: cperciva
PR: 216087
MFC after: 2 weeks

7 years agoFix the NFSv4 client hndling of a stale write verifier in the Commit operation.
rmacklem [Sun, 9 Apr 2017 21:50:21 +0000 (21:50 +0000)]
Fix the NFSv4 client hndling of a stale write verifier in the Commit operation.

When the NFSv4 client Commit operation encountered a stale write verifier,
it erroneously mapped that to EIO. This could have caused recently written
data to be lost when a server crashes/reboots between an UNSTABLE write
and the subsequent commit. This patch fixes this.
The bug was only for the NFSv4 client and did not affect NFSv3.

Tested by: cperciva
PR: 215887
MFC after: 2 weeks

7 years agoFix the NFSv4.1 client for NFSERR_BADSESSION recovery via ReclaimComplete.
rmacklem [Sun, 9 Apr 2017 21:06:21 +0000 (21:06 +0000)]
Fix the NFSv4.1 client for NFSERR_BADSESSION recovery via ReclaimComplete.

For the ReclaimComplete operation, the RPC layer should not loop on
NFSERR_BADSESSION. If it does, the recovery thread (nfscl) can get stuck
looping and will not do a recovery.
This patch fixes it so it does not loop. This bug only affects NFSv4.1 and
only when a server reboots.

Tested by: cperciva
PR: 215886
MFC after: 2 weeks

7 years agoImport CK as of commit 6b141c0bdd21ce8b3e14147af8f87f22b20ecf32
cognet [Sun, 9 Apr 2017 21:02:05 +0000 (21:02 +0000)]
Import CK as of commit 6b141c0bdd21ce8b3e14147af8f87f22b20ecf32
This brings us changes we needed in ck_epoch.

7 years agoAdd code/constants for detecting imx6ul (ultralite) chips, a species of
ian [Sun, 9 Apr 2017 20:59:12 +0000 (20:59 +0000)]
Add code/constants for detecting imx6ul (ultralite) chips, a species of
imx6 based on a single cortex-a7 core.  Other changes to imx6 drivers
and support code are needed to fully support the imx6ul.

Also fix an indentation glitch committed in the prior change.

7 years agoUpdate the code that compensates for the lack of a GPC interrupt controller
ian [Sun, 9 Apr 2017 20:41:00 +0000 (20:41 +0000)]
Update the code that compensates for the lack of a GPC interrupt controller
driver for imx6.  Some newer dts source puts the GIC node at the root
instead of under /soc, so look in both places.  Also, sometimes the GIC
node doesn't list itself as its own interrupt-parent, allow that too.

7 years agoRemove some old interrupt handling workaround code from the pre-INTRNG days.
ian [Sun, 9 Apr 2017 18:31:33 +0000 (18:31 +0000)]
Remove some old interrupt handling workaround code from the pre-INTRNG days.

At this point, INTRNG is not going away (the option may go away, but the
code is not), so we no longer need code to support workarounds that handled
the lack of INTRNG functionality.

7 years agoAdding SIOCGIFNAME support in Linuxulator. This should silence the console warning...
avatar [Sun, 9 Apr 2017 15:27:04 +0000 (15:27 +0000)]
Adding SIOCGIFNAME support in Linuxulator.  This should silence the console warning associated
with linux-opera:
linux: pid 23492 (opera): ioctl fd=5, cmd=0x8910 ('\M^I',16) is not implemented
linux: pid 23492 (opera): ioctl fd=28, cmd=0x8910 ('\M^I',16) is not implemented
...

Reviewed by: kib, marcel, dchagin
Tested with: linux-opera-12.16_3
MFC after: 1 month

7 years agoMake setkey(8) more clear about anti-replay window size option semantics.
bcr [Sun, 9 Apr 2017 15:17:55 +0000 (15:17 +0000)]
Make setkey(8) more clear about anti-replay window size option semantics.

PR: 172913
Submitted by: john@saltant.com
Reviewed by: ae@
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10304

7 years agoFix compilation of LinuxKPI for PowerPC.
hselasky [Sun, 9 Apr 2017 14:31:41 +0000 (14:31 +0000)]
Fix compilation of LinuxKPI for PowerPC.

Found by: emaste @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix parsing failure for NFSv4 Setattr operation for failed case.
rmacklem [Sun, 9 Apr 2017 12:32:22 +0000 (12:32 +0000)]
Fix parsing failure for NFSv4 Setattr operation for failed case.

If an operation that preceeds a Setattr in an NFSv4 compound fails,
there is no bitmap of attributes to parse. Without this patch, the
parsing would fail and return EBADRPC instead of the correct failure
error. This could break recovery from a server crash/reboot.

Tested by: cperciva
PR: 215883
MFC after: 2 weeks

7 years agoloader: r316585 did miss userboot update
tsoome [Sun, 9 Apr 2017 11:16:16 +0000 (11:16 +0000)]
loader: r316585 did miss userboot update

The work to implement zfs reader to inspect all pool label copies did
miss the userboot, this update does correct this issue.

Since userboot is already using common/disk.c API (disk_open() etc),
the fix is quite simple - we only need to make sure the userdisk_iocl()
will call disk_ioctl(). In addition, the diskioctl callback does return
int, not pointer.

Note, the review request is actually addressing the sparc and userboot,
but as testing the fix for sparc will take some more time, I am posting the
userboot fix now.

This patch is part of the implementation presented in review:
https://reviews.freebsd.org/D10302

Once we have the sparc part tested, we will have the complete fix
for the issue.

Reviewed by: imp

7 years agoFix few minor issues found by Clang Analyzer.
mav [Sun, 9 Apr 2017 07:54:39 +0000 (07:54 +0000)]
Fix few minor issues found by Clang Analyzer.

MFC after: 2 weeks

7 years agoFix few minor issues found by Clang Analyzer.
mav [Sun, 9 Apr 2017 07:53:31 +0000 (07:53 +0000)]
Fix few minor issues found by Clang Analyzer.

MFC after: 2 weeks

7 years agoAdd missing double quote to fix r316635 commit.
kan [Sun, 9 Apr 2017 03:50:48 +0000 (03:50 +0000)]
Add missing double quote to fix r316635 commit.

7 years agoCorrected misspelled versions of rendezvous.
pkelsey [Sun, 9 Apr 2017 02:00:03 +0000 (02:00 +0000)]
Corrected misspelled versions of rendezvous.

The MFC will include a compat definition of smp_no_rendevous_barrier()
that calls smp_no_rendezvous_barrier().

Reviewed by: gnn, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10313

7 years agoIntroduce LLD_BOOTSTRAP to control lld as bootstrap linker
emaste [Sun, 9 Apr 2017 01:35:19 +0000 (01:35 +0000)]
Introduce LLD_BOOTSTRAP to control lld as bootstrap linker

Add WITH_LLD_BOOTSTRAP and WITHOUT_LLD_BOOTSTRAP knobs, similar to the
Clang bootstrap knobs.

Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10249

7 years agosh: Add test for unaliasing an alias that is currently in use.
jilles [Sat, 8 Apr 2017 21:57:59 +0000 (21:57 +0000)]
sh: Add test for unaliasing an alias that is currently in use.

This already works correctly.

7 years agoUnconditionally include arm64 in make universe / tinderbox
emaste [Sat, 8 Apr 2017 16:14:30 +0000 (16:14 +0000)]
Unconditionally include arm64 in make universe / tinderbox

As of r316629 FreeBSD/arm64 uses the in-tree LLD linker by default, and
does not require an external an aarch64-binutils port or package.

Sponsored by: The FreeBSD Foundation

7 years agoTrying to be more compatible with Linux if.h definitions:
avatar [Sat, 8 Apr 2017 14:41:39 +0000 (14:41 +0000)]
Trying to be more compatible with Linux if.h definitions:
- renaming l_ifreq::ifru_metric to l_ifreq::ifru_ivalue;
- adding a definition for ifr_ifindex which points to l_ifreq::ifru_ivalue.

A quick search indicates that Linux already got the above changes since 2.1.14.

Reviewed by: kib, marcel, dchagin
MFC after: 1 week

7 years agouse msr 0xc001100c to discover multi-node AMD processors
avg [Sat, 8 Apr 2017 14:16:42 +0000 (14:16 +0000)]
use msr 0xc001100c to discover multi-node AMD processors

This is applicable only to the older processors that do not have the AMD
Topology extension.
Opteron 6100-series "Magny-Cours" processors had multiple nodes within a
package and didn't have the Topology extension.  Without this change
FreeBSD would assume that those processors have a single L3 cache shared
by all cores while, in fact, each node has its own L3 cache.

Many thanks to Freddie Cash <fjwcash@gmail.com> for providing valuable
hardware information.

MFC after: 2 weeks

7 years agoQuick fix for removal of the mouse cursor in vga direct graphics modes
bde [Sat, 8 Apr 2017 10:00:39 +0000 (10:00 +0000)]
Quick fix for removal of the mouse cursor in vga direct graphics modes
(that is, in all supported 8, 15, 16 and 24-color modes).  Moving the
mouse cursor while holding down a button (giving cut marking) left a
trail of garbage from misremoved mouse cursors (usually colored
rectangles and not cursor shapes).  Cases with a button not held down
worked better and may even have worked.

No renderer support for removing (software) mouse cursors is needed
(and many renderers don't have any), since sc_remove_mouse_image()
marks for update the region containing the image and usually much
more.  The mouse cursor can be (partially) over as many as 4 character
cells, and removing it in only the 1-4 cells occupied by it would be
best for efficiency and for avoiding flicker.  However,
sc_remove_mouse_image() can only mark a single linear region and
usually marks a full row of cells and 1 more to be sure to cover the
4 cells.  It always does this, so using the special rendering method
just wastes even more time and gives even more flicker.  The special
methods will be removed soon.

The general method always works.  vga_pxlmouse_direct() appeared to
defer to it by returning immediately if !on.  However,
vga_pxlmouse_direct() actually did foot-shooting using a disguised
saveunder method.  Normal order near a mouse move is:
  (1) remove the mouse cursor in the renderer (optional)
  (2) remove the mouse cursor again and refresh the screen over the
      mouse cursor and much more from the vtb.  When the mouse has
      actually moved and a button is down, many attributes in this
      region are changed to be up to date with the new cut marking
  (3) draw the keyboard cursor again if it was clobbered by the update
  (4) draw the mouse cursor image in its new position.
The bug was to remove the mouse cursor again in step (4), before the
drawing it again in (4), using a saveunder that was valid in step (1)
at best.  The quick fix is to use the saveunder in step (1) and not
in step (4).  Using it in step (4) also used it before it was
initialized, initially and after  mode and screen switches.

7 years agoadd a stub --speed-large-files for compatibility with GNU diff
bapt [Sat, 8 Apr 2017 08:46:02 +0000 (08:46 +0000)]
add a stub --speed-large-files for compatibility with GNU diff

There is no intention to implement it, but lots of scripts/tools using
diff(1) passes GNU diff option

7 years agoRemove a useless loop over the long options before passing through some
bapt [Sat, 8 Apr 2017 08:42:25 +0000 (08:42 +0000)]
Remove a useless loop over the long options before passing through some
options to diff(1)

7 years agoWhen passingthrough from sdiff to diff the -H/--speed-large-files
bapt [Sat, 8 Apr 2017 08:41:05 +0000 (08:41 +0000)]
When passingthrough from sdiff to diff the -H/--speed-large-files
options rename it to the long version as GNU diff only support the long
version of the option not the short version

7 years agoFix removal of the keyboard cursor image in text mode, especially
bde [Sat, 8 Apr 2017 08:24:25 +0000 (08:24 +0000)]
Fix removal of the keyboard cursor image in text mode, especially
in the vga renderer.  Removal used stale attributes and didn't try to
merge with the current attribute for cut marking, so special rendering
of cut marking was lost in many cases.  The gfb renderer is too broken
to support special rendering of cut marking at all, so this change is
supposed to be just a style fix for it.  Remove all traces of the
saveunder method which was used to implement this bug.

Fix drawing of the cursor image in text mode, only in the vga
renderer.  This used a stale attribute from the frame buffer instead
of from the saveunder, but did merge with the current attribute for
cut marking so it caused less obvious bugs (subtle misrendering for
the character under the cursor).

The saveunder method may be good in simpler drivers, but in syscons
the 'under' is already saved in a better way in the vtb.  Just redraw
it from there, with visible complications for cut marking and
invisible complications for mouse cursors.  Almost all drawing
requests are passed a flag 'flip' which currently means to flip to
reverse video for characters in the cut marking region, but should
mean that the the characters are in the cut marking regions so should
be rendered specially, preferably using something better than reverse
video.  The gfb renderer always ignores this flag.  The vga renderer
ignored it for removal of the text cursor -- the saveunder gave the
stale rendering at the time the cursor was drawn.  Mouse cursors need
even more complicated methods.  They are handled by drawing them last
and removing them first.  Removing them usually redraws many other
characters with the correct cut marking (but transiently loses the
keyboard cursor, which is redrawn soon).  This tended to hide the
saveunder bug for forward motions of the keyboard cursor.  But slow
backward motions of the keyboard cursor always lost the cut marking,
and fast backwards motions lost in for about 4 in every 5 characters,
depending on races with the scrn_update() timeout handler.  This is
because the forward motions are usually into the region redrawn for
the mouse cursor, while backwards motions rarely are.

Text cursor drawing in the vga renderer used also used a
possibly-stale copy of the character and its attribute.  The vga
render has the "optimization" of sometimes reading characters from the
screen instead of from the vtb (this was not so good even in 1990 when
main memory was only a few times faster than video RAM).  Due to care
in update orders, the character is never stale, but its attribute
might be (just the cut marking part, again due to care in order).

gfb doesn't have the scp->scr pointer used for the "optimization", and
vga only uses this pointer for text mode.  So most cases have to
refresh from the vtb, and we can be sure that the ordering of vtb
updates and drawing is as required for this to work.

7 years agoEnable 16-bit longest_match for x86.
delphij [Sat, 8 Apr 2017 06:39:13 +0000 (06:39 +0000)]
Enable 16-bit longest_match for x86.

This gives a ~2% improvement in compression tests.

MFC after: 2 weeks

7 years agoFixed typo in comment found while reading commit email for fix of
pkelsey [Sat, 8 Apr 2017 04:50:50 +0000 (04:50 +0000)]
Fixed typo in comment found while reading commit email for fix of
other typo in same comment.

ned -> need

MFC after: 3 days

7 years agoFixed typo in comment.
pkelsey [Sat, 8 Apr 2017 04:45:52 +0000 (04:45 +0000)]
Fixed typo in comment.

patckets -> packets

MFC after: 3 days

7 years agoFixed typo.
pkelsey [Sat, 8 Apr 2017 04:41:46 +0000 (04:41 +0000)]
Fixed typo.

CSUM_COALESED -> CSUM_COALESCED

MFC after: 3 days

7 years agoFix typo in comment.
pkelsey [Sat, 8 Apr 2017 04:37:01 +0000 (04:37 +0000)]
Fix typo in comment.

logest -> longest

MFC after: 3 days

7 years agoFix typo.
pkelsey [Sat, 8 Apr 2017 04:34:18 +0000 (04:34 +0000)]
Fix typo.

hist -> hint

MFC after: 3 days

7 years agodo not require binutils port when using lld as ld
emaste [Fri, 7 Apr 2017 23:37:22 +0000 (23:37 +0000)]
do not require binutils port when using lld as ld

r279908 added logic to Makefile.inc1 to automatically set
CROSS_BINUTILS_PREFIX for architectures not supported by the in-tree
binutils: arm64 when first introduced, and later riscv64 as well.

LLVM's LLD linker is now included in the base system, and is enabled by
default for arm64 and capable of linking world and kernel. Thus, avoid
automatically setting CROSS_BINUTILS_PREFIX and requiring the binutils
port if WITH_LLD_IS_LD is true.

Reviewed by: kan
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10310

7 years agoSilence GCC warning by initializing the local variable.
kan [Fri, 7 Apr 2017 22:58:34 +0000 (22:58 +0000)]
Silence GCC warning by initializing the local variable.

GCC 6.3 is unable to trace all code paths that lead to
this variable being left uninitialized and correlate that
to function return values.

7 years agoUse int to receive the return value of getopt function.
kan [Fri, 7 Apr 2017 22:58:31 +0000 (22:58 +0000)]
Use int to receive the return value of getopt function.

getopt returns int and not char, so assigning the value to
char is not ideal, especially on platforms with unsigned
chars.

7 years agoDefine 'lr' as x30 on aarch64
kan [Fri, 7 Apr 2017 22:58:28 +0000 (22:58 +0000)]
Define 'lr' as x30 on aarch64

GNU toolchain does not recognize LR as standard register alias,
but clang does. Use of #define will work on both. Place the
definition into central machine/asm.h instead of patching every
affected file, as requested by plaftorm maintainers.

Reviews by: andrew, emaste, imp
Differential Revision: https://reviews.freebsd.org/D10307

7 years agoDo not use -msoft-float with intention of disabling FP on aarch64
kan [Fri, 7 Apr 2017 22:58:25 +0000 (22:58 +0000)]
Do not use -msoft-float with intention of disabling FP on aarch64

GNU GCC does does recognise it as a valid option and we already
use -mgeneral-regs-only that has the desired effect.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D10306

7 years agoDo not use b.cs instruction to jump to cerror.
kan [Fri, 7 Apr 2017 22:58:20 +0000 (22:58 +0000)]
Do not use b.cs instruction to jump to cerror.

The conditional jump can only be performed to targets up to 1MB in
either direction and does not work too well when linker places cerror
further that that from the caller. In that case linker will complain
about relocation overflows.

Reviewed by: emaste, andrew
Differential Revision:  https://reviews.freebsd.org/D10305

7 years agoRevert previous change to sys/conf/options & associated notes so builds can
sevan [Fri, 7 Apr 2017 21:06:50 +0000 (21:06 +0000)]
Revert previous change to sys/conf/options & associated notes so builds can
resume while I investigate what I had missed.

7 years agoExplicitly set the desired MIPS ABI in toolchain flags.
jhb [Fri, 7 Apr 2017 20:02:01 +0000 (20:02 +0000)]
Explicitly set the desired MIPS ABI in toolchain flags.

Specifically, set '-mabi=XX' in AFLAGS, CFLAGS, and LDFLAGS.  This permits
building MIPS worlds and binaries with a toolchain whose default output
does not match the desired TARGET_ARCH.

_LDFLAGS (which is used with LD instead of with CC) required an update as
LD does not accept the -mabi flags (so they must be stripped from LDFLAGS
when generating _LDFLAGS).  For bare uses of LD (rather than linking via
CC), the desired ABI must be set by setting an explicit linker emulation
as done in r316514 for kernels and kernel modules.

Reviewed by: imp
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10085

7 years agoDon't set the MIPS endianness flags in both ACFLAGS and CFLAGS.
jhb [Fri, 7 Apr 2017 19:56:12 +0000 (19:56 +0000)]
Don't set the MIPS endianness flags in both ACFLAGS and CFLAGS.

This should no longer be necessary after r316620 as all places that
use ACFLAGS should already be using CFLAGS.

Reviewed by: imp
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10085

7 years agoRework r234502 to include a modified CFLAGS along with ACFLAGS.
jhb [Fri, 7 Apr 2017 19:53:14 +0000 (19:53 +0000)]
Rework r234502 to include a modified CFLAGS along with ACFLAGS.

On most architectures crt objects are compiled in a multiple-step process
so that sed can be run on the generated assembly.  As the final step,
the C compiler generates an object file from the modified assembly output.
Currently this last step uses $CC with only $ACFLAGS.  However, for other
uses in the tree, $ACFLAGS is meant to include assembly-specific compiler
flags that are in addition to $CFLAGS (see default .S.o rules
bsd.suffixes.mk).  In particular, external toolchains may require
additional flags to select a non-default target which will be present
in CFLAGS but not ACFLAGS.  To support this while still mitigating the
issue with CFLAGS described in r234502, include a modified CFLAGS that
excludes "-g" when assembling the modified assembly files.

Note that normally an assembler ($AS) is used to assemble .s flags to
object files (see bsd.suffixes.mk).  However, llvm-based toolchains do
not currently have a stand-alone assembler.

Reviewed by: imp
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10085

7 years agoRemove support for long gone oldnfs.
brooks [Fri, 7 Apr 2017 18:31:31 +0000 (18:31 +0000)]
Remove support for long gone oldnfs.

The code was calling nmount with an fstype of everything in the program
name after the last '_'. This was there to support mount_nfs being
linked to mount_oldnfs. Support for the link was removed in 2015 with
r281691.

Reviewed by: rmacklem
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10301

7 years ago- Increase the image size for RPI2 and IMX6-based boards from 1G
gjb [Fri, 7 Apr 2017 16:55:13 +0000 (16:55 +0000)]
- Increase the image size for RPI2 and IMX6-based boards from 1G
  to 1.5G.
- Use the 'conv=sync' dd(1) option to fix writing the u-boot.imx
  file to the md(4) device for IMX6-based boards.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years agobnxt(4): add support for WOL Magic.
sbruno [Fri, 7 Apr 2017 16:15:50 +0000 (16:15 +0000)]
bnxt(4): add support for WOL Magic.

Submitted by: venkatkumar.duvvuru@broadcom.com
Differential Revision: https://reviews.freebsd.org/D10124

7 years agoRemove the last vestiges of FDC_DEBUG & FD_DEBUG
sevan [Fri, 7 Apr 2017 16:14:25 +0000 (16:14 +0000)]
Remove the last vestiges of FDC_DEBUG & FD_DEBUG
FDC_DEBUG is not referenced in any c or header files but traces of it
still remain in other files.

PR: 105608
Reported by: Eugene Grosbein <ports AT grosbein DOT net>
Reviewed by: imp
Approved by: bcr (mentor)
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D10303

7 years agoIn r298230 the value of HEAP_MIN was changed from 3MB to 64MB. Correct a
benno [Fri, 7 Apr 2017 15:41:49 +0000 (15:41 +0000)]
In r298230 the value of HEAP_MIN was changed from 3MB to 64MB. Correct a
comment that was still referencing the 3MB value.

Sponsored by: Dell EMC Isilon
Discussed with: jhb

7 years agosbin/mount: strcpy -> strlcpy
asomers [Fri, 7 Apr 2017 15:39:41 +0000 (15:39 +0000)]
sbin/mount: strcpy -> strlcpy

Reported by: Coverity
CID: 1011173, 1011174
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

7 years agousr.bin/netstat: strcpy -> strlcpy
asomers [Fri, 7 Apr 2017 15:15:10 +0000 (15:15 +0000)]
usr.bin/netstat: strcpy -> strlcpy

Reported by: Coverity
CID: 1006741, 1006744
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

7 years agoCreate the LinuxKPI current task structure on the fly if it doesn't
hselasky [Fri, 7 Apr 2017 14:43:28 +0000 (14:43 +0000)]
Create the LinuxKPI current task structure on the fly if it doesn't
exist when the current macro is used.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd -fPIC to the standalone build flags on arm64. This is needed as
andrew [Fri, 7 Apr 2017 14:30:51 +0000 (14:30 +0000)]
Add -fPIC to the standalone build flags on arm64. This is needed as
loader.efi is position independend, however we were not building it as
such causing a build failure when building with lld.

Sponsored by: DARPA, AFRL

7 years agoFix linking with lld by marking OPENSSL_armcap_P as hidden.
andrew [Fri, 7 Apr 2017 12:41:57 +0000 (12:41 +0000)]
Fix linking with lld by marking OPENSSL_armcap_P as hidden.

Linking with lld fails as it contains a relative address, however the data
this address is for may be relocated from the shared object to the main
executable.

Fix this by adding the hidden attribute. This stops moving this value to
the main executable. It seems this is implicit upstream as it uses a
version script.

Approved by: jkim
Sponsored by: DARPA, AFRL

7 years agoThe __stringify() macro in the LinuxKPI should expand any macros
hselasky [Fri, 7 Apr 2017 12:27:49 +0000 (12:27 +0000)]
The __stringify() macro in the LinuxKPI should expand any macros
before stringifying.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoMETA_MODE: add additional reachover relative paths to DIRDEPS_BUILD
ngie [Fri, 7 Apr 2017 07:46:21 +0000 (07:46 +0000)]
META_MODE: add additional reachover relative paths to DIRDEPS_BUILD

These additional entries are being added, after their addition to the
source tree.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agopmc_read(3): fix manlint error
ngie [Fri, 7 Apr 2017 06:06:55 +0000 (06:06 +0000)]
pmc_read(3): fix manlint error

Remove spurious trailing comma from last .Nm entry in NAME section.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agopmc.atomsilvermont(3): fix manlint warnings
ngie [Fri, 7 Apr 2017 06:00:19 +0000 (06:00 +0000)]
pmc.atomsilvermont(3): fix manlint warnings

Start new sentences on new lines.

Sentences affected by the change are wrapped at <80 columns. Other
potentially offending lines have been left alone to reduce churn.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agopmc(3): add additional references for libpmc functions in the SEE ALSO section
ngie [Fri, 7 Apr 2017 05:46:45 +0000 (05:46 +0000)]
pmc(3): add additional references for libpmc functions in the SEE ALSO section

These functions are already referenced throughout the manpage -- this makes their
presence more apparent.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agoPrevent ushort values overflow when convert new Linux 64-bit ipc
dchagin [Fri, 7 Apr 2017 05:37:08 +0000 (05:37 +0000)]
Prevent ushort values overflow when convert new Linux 64-bit ipc
struct to the old Linux ipc struct.

Reported by: PVS-Studio
XMFC with: r314866

MFC after: 3 days

7 years agokern_descrip: Move kinfo_ofile size assert under COMPAT_FREEBSD7
cem [Fri, 7 Apr 2017 05:00:09 +0000 (05:00 +0000)]
kern_descrip: Move kinfo_ofile size assert under COMPAT_FREEBSD7

The size and structure are not used outside of FreeBSD 7 compatibility ABIs.

Sponsored by: Dell EMC Isilon

7 years agomakefs: Sync with NetBSD (fix unused variable warnings)
emaste [Fri, 7 Apr 2017 02:31:55 +0000 (02:31 +0000)]
makefs: Sync with NetBSD (fix unused variable warnings)

NetBSD revs:
cd9660.c 1.45
cd9660/cd9660_write.c 1.17

Obtained from: NetBSD

7 years agoMove pause frame counter out of struct if_ctx and into struct if_softc_ctx_t
sbruno [Fri, 7 Apr 2017 00:33:03 +0000 (00:33 +0000)]
Move pause frame counter out of struct if_ctx and into struct if_softc_ctx_t
so that we can use it in iflib to detect pause frames.

The igb(4) driver definitely used to use this in its old timer function and
I see no reason to restrict it to that driver only.

Sponsored by: Limelight Networks

7 years agoRegen after r316594.
brooks [Thu, 6 Apr 2017 23:40:51 +0000 (23:40 +0000)]
Regen after r316594.

7 years agoChange the size argument of __getcwd() to size_t.
brooks [Thu, 6 Apr 2017 23:40:13 +0000 (23:40 +0000)]
Change the size argument of __getcwd() to size_t.

This matches the getcwd() definition.

This is technically an ABI change, but that would only effect 64-bit
big-endian platforms that pass arguments on the stack. We have none of
those.

Reviewed by: jhb
Obtained from: CheriABI
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9428

7 years agoPoint out that -F probably does not do what the user expects.
brooks [Thu, 6 Apr 2017 23:35:10 +0000 (23:35 +0000)]
Point out that -F probably does not do what the user expects.

Users attempting to create images from mtree METALOG files created by
installworld often use -F when they should be passing the METALOG file
in place of a directory. This is often produces difficult to debug
error reports.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10038

7 years agoIntroduce libxo support to arp(8)
garga [Thu, 6 Apr 2017 22:50:28 +0000 (22:50 +0000)]
Introduce libxo support to arp(8)

Reviewed by: wblock, gnn, allanjude, phil
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9563

7 years agoRemove dead code.
obrien [Thu, 6 Apr 2017 22:21:49 +0000 (22:21 +0000)]
Remove dead code.
The #ifdef __FreeBSD__ section within the OpenBSD tpm_attach() implementation
can never be active.

7 years agolibstand/dosfs: cache FAT32 in 128 Kb blocks to save loader memory
tsoome [Thu, 6 Apr 2017 20:12:39 +0000 (20:12 +0000)]
libstand/dosfs: cache FAT32 in 128 Kb blocks to save loader memory

Current implementation of dosfs in libstand reads full File Allocation Table to
the RAM in the initialization code. In the extreme case of FAT32 filesystem,
this structure will take up to 256-1024 Mb of loader memory, depending on the
cluster size.

Proposed patch reduces libstands/dosfs memory requirements to 128 Kb for all
variants of dosfs filesystem. For FAT12 and FAT16 filesystems, File Allocation
Table is cached in full, as before. For FAT32, File Allocation Table is broken
into the equal blocks of 128 Kilobytes (32768 entries), and only current block
is cached.

Because per-filesystem context is now small, global FAT cache (for all
instances of dosfs filesystem) is replaced by local per-instance cache.

Submitted by: Mikhail.Kupchik_gmail.com
Reviewed by: tsoome, allanjude
Differential Revision: https://reviews.freebsd.org/D9547

7 years agoUnify capitalization.
trasz [Thu, 6 Apr 2017 19:17:20 +0000 (19:17 +0000)]
Unify capitalization.

MFC after: 2 weeks

7 years agoUpdate hier(7) by removing files and directories that no longer
trasz [Thu, 6 Apr 2017 19:10:16 +0000 (19:10 +0000)]
Update hier(7) by removing files and directories that no longer
exist and doing a few random tweaks.

MFC after: 2 weeks

7 years agoMETA_MODE: Fix build-tools still sometimes rebuilding during target build.
bdrewery [Thu, 6 Apr 2017 18:21:59 +0000 (18:21 +0000)]
META_MODE: Fix build-tools still sometimes rebuilding during target build.

In a cross-build, the build-tools are native host binaries.  We do not
want to rebuild them when building for the target.  Bmake previously
did not support checking .NOMETA on an existing target, so .NOMETA_CMP
was used here.  However, .NOMETA_CMP still triggers meta mode conditions
if the number of commands or the command changes.  In r312467 the paths
to build ncurses files were modified and thus triggered meta mode to
rebuild the build tools (make_keys, make_hash) in ncurses during the
target build.  Bmake 20160604 committed in r301462 changed .NOMETA to
also skip meta mode logic for an existing .meta file as well, thus it
is now the proper fix here.

I explored moving the build-tools output to WORLDTMP/tools with
relatively good success, but have concerns that doing so would be
problematic for downstream vendors who use LOCAL_TOOL_DIRS and
expect the tools to be in current OBJDIR for the target.  It also
adds more complexity into finding the tools during target build
and handling of where they are for rescue/rescue and
mkcsmapper_static/mkesdb_static which should really not be connected in
build-tools anyway.

MFC after: 2 weeks
Reported by: many
Sponsored by: Dell EMC Isilon

7 years agoloader: zfs reader should check all labels
tsoome [Thu, 6 Apr 2017 18:17:29 +0000 (18:17 +0000)]
loader: zfs reader should check all labels

The current zfs reader is only checking first label from each device, however,
we do have 4 labels on device and we should check all 4 to be protected
against disk failures and incomplete label updates.

The difficulty is about the fact that 2 label copies are in front of the
pool data, and 2 are at the end, which means, we have to know the size of
the pool data area.

Since we have now the mechanism from common/disk.c to use the partition
information, it does help us in this task; however, there are still some
corner cases.

Namely, if the pool is created without partition, directly on the disk,
and firmware will give us the wrong size for the disk, we only can check
the first two label copies.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D10203

7 years agosmbfs: Fix an indentation level
cem [Thu, 6 Apr 2017 17:31:58 +0000 (17:31 +0000)]
smbfs: Fix an indentation level

Based on the change in r242386, it seems clear that scred was intended to
be released in all paths at exit.

No functional change.  This line's indent was just the result of a bad copy
paste from the previous free() in an early exit path.

Reported by: PVS-Studio
Sponsored by: Dell EMC Isilon

7 years agoremove archaic register keyword from ixgb and ex
emaste [Thu, 6 Apr 2017 17:16:41 +0000 (17:16 +0000)]
remove archaic register keyword from ixgb and ex

Reviewed by: sbruno

7 years agobwn(4): Fix trivial null dereference
cem [Thu, 6 Apr 2017 17:08:59 +0000 (17:08 +0000)]
bwn(4): Fix trivial null dereference

Reported by: PVS-Studio
Sponsored by: Dell EMC Isilon

7 years agotx and rx interrupts are not combined in bnxt(4) and should be handled
sbruno [Thu, 6 Apr 2017 16:22:54 +0000 (16:22 +0000)]
tx and rx interrupts are not combined in bnxt(4) and should be handled
independantly.

Submitted by: venkatkumar.duvvuru@broadcom.com>
Differential Revision: https://reviews.freebsd.org/D10297

7 years agocxgbe/iw_cxgbe: Remove another bad cast. This should have been
np [Thu, 6 Apr 2017 16:19:19 +0000 (16:19 +0000)]
cxgbe/iw_cxgbe: Remove another bad cast.  This should have been
included in r316571.

MFC after: 3 days
Sponsored by: Chelsio Communications