]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoReapply r301691:
imp [Sun, 2 Jun 2019 20:47:15 +0000 (20:47 +0000)]
Reapply r301691:

Revert r301689 - one-true-awk: Avoid a NULL dereference.

I got this wrong and the coverity report doesn't match the NetBSD change,
which was thought for a different version.

The change wouldn't hurt but let's wait until upstream figures this out.

4 years agoThis should have been committed in r348511 with the awk update.
imp [Sun, 2 Jun 2019 16:44:50 +0000 (16:44 +0000)]
This should have been committed in r348511 with the awk update.

It was in my tree, the build worked, but I committed from contrib/one-true-awk
rather than the top level, so was omitted.

4 years agoMake tests(7) point people at the atf(7) man page.
trasz [Sun, 2 Jun 2019 16:33:24 +0000 (16:33 +0000)]
Make tests(7) point people at the atf(7) man page.

Other frameworks, such as googletest, should be added there as well,
once they become viable.  For now let's keep it simple.

Discussed with: ngie, emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20124

4 years agoReapply r315426 by pfg:
imp [Sun, 2 Jun 2019 16:30:53 +0000 (16:30 +0000)]
Reapply r315426 by pfg:

|    MFV r315425: one-true-awk: have calloc(3) do the multiplication.

4 years agoReapply r301289 by pfg:
imp [Sun, 2 Jun 2019 16:28:20 +0000 (16:28 +0000)]
Reapply r301289 by pfg:

|    MFV r300961: one-true-awk: replace 0 with NULL for pointers
|    Also remove a redundant semicolon.
|    Also had to rebase on upstream pull.

4 years agoMerge from upstream at 4189ef5d from https://github.com/onetrueawk/awk.git
imp [Sun, 2 Jun 2019 16:25:07 +0000 (16:25 +0000)]
Merge from upstream at 4189ef5d from https://github.com/onetrueawk/awk.git

Note: this backs out a number of changes we've made to awk because
they aren't upstream, but are on the vendor branch. Those will be
reapplied. svn makes it needlessly difficult to know which ones, but
at least r315426, r301289, and maybe r301691, though there may be
others too. None of these are critical, so bisecting through this
point is safe for all but awk regression tests :).

4 years agobectl(8): Don't accept jid=0 from jail_getid
kevans [Sun, 2 Jun 2019 14:05:51 +0000 (14:05 +0000)]
bectl(8): Don't accept jid=0 from jail_getid

This will trivially exist, but we don't want it - none of our jailed BEs
will have jid=0.

MFC after: 3 days

4 years agojail_getid(3): add special-case immediate return for jid 0
kevans [Sun, 2 Jun 2019 14:03:56 +0000 (14:03 +0000)]
jail_getid(3): add special-case immediate return for jid 0

As depicted in the comment: jid 0 always exists, but the lookup will fail as
it does not appear in the kernel's alljails list being a special jail. Some
callers will expect/rely on this, and we have no reason to lie because it
does always exist.

Reported by: Stefan Hegnauer <stefan.hegnauer gmx ch>
MFC after: soon (regression, breaks inspecting jail host bits, partial
revert)

4 years agoImport latest one-true-awk from upstream
imp [Sun, 2 Jun 2019 04:23:56 +0000 (04:23 +0000)]
Import latest one-true-awk from upstream

Import git hash 4189ef5d from https://github.com/onetrueawk/awk.git as
there's not been a release in a while.

Upstream one-true-awk woke-up! Time to catch up. This may also revert
FreeBSD changes that we'd placed in the vendor branch in anticipation
of their inclusion in upstream. That's not yet the case, and these
will be resolved in the merge.

See FIXES for a complete list of bugs fixed (starting with the Jun 7,
2018 entry).

4 years agollvm-symbolizer: Move out of CLANG_EXTRAS, into CLANG
kevans [Sun, 2 Jun 2019 04:04:21 +0000 (04:04 +0000)]
llvm-symbolizer: Move out of CLANG_EXTRAS, into CLANG

ASAN reports become a lot more useful with llvm-symbolizer in $PATH, and the
build is not much more time-consuming. The added benefit is that the
resulting reports will actually include symbol information; without, thread
trace information includes a bunch of addresses that immediately resolve to
an inline function in
^/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common.h and take a
little more effort to examine.

Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20484

4 years agogrep: Move lone 'r'grep case into the adjacent switch
kevans [Sun, 2 Jun 2019 02:38:44 +0000 (02:38 +0000)]
grep: Move lone 'r'grep case into the adjacent switch

This 'r' case should have belonged to the switch in the first place, but
I had somehow missed the switch when initially adding the rgrep link. The
zgrep script later came along and faithfully left this case standing alone,
so we will now go ahead and join it.

Nearby comment also adjusted a tad bit for wording and style.

Reported by: Daniel Ebdrup
MFC after: 3 days

4 years agoAdd a vm_page_wired() predicate.
markj [Sun, 2 Jun 2019 01:00:17 +0000 (01:00 +0000)]
Add a vm_page_wired() predicate.

Use it instead of accessing the wire_count field directly.  No
functional change intended.

Reviewed by: alc, kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20485

4 years agoAdd myself to committers-src.dot and calendar.freebsd
bdragon [Sun, 2 Jun 2019 00:08:24 +0000 (00:08 +0000)]
Add myself to committers-src.dot and calendar.freebsd

Approved by: jhibbits (mentor)

4 years agoPartially revert r271349, which disabled the msun cexp test #4 on i386.
dim [Sat, 1 Jun 2019 20:08:10 +0000 (20:08 +0000)]
Partially revert r271349, which disabled the msun cexp test #4 on i386.

Ensure the expected result is stored first in a volatile variable with
the desired type.  This makes all the tests succeed.

Slightly changed from the original pull request, but functionally the
same.

Obtained from: https://github.com/freebsd/freebsd/pull/401
Submitted by: Moritz Buhl <gh@moritzbuhl.de>
PR: 191676
MFC after: 3 days

4 years agoFix comment parsing in interp_simple.c
bcran [Sat, 1 Jun 2019 19:47:15 +0000 (19:47 +0000)]
Fix comment parsing in interp_simple.c

loader.rc has comment lines without a trailing space, which get
interpreted as commands. Avoid this by only matching against the
backslash character.

Reviewed by: imp, tsoome
Differential Revision: https://reviews.freebsd.org/D20491

4 years agolibatf: remove workaround not required after atf >= 0.18 update
emaste [Sat, 1 Jun 2019 18:26:07 +0000 (18:26 +0000)]
libatf: remove workaround not required after atf >= 0.18 update

lib/atf/libatf-c/tests/Makefile added the -Wno-duplicate-decl-specifier
due to an issue with an old version of ATF.  ATF has long since been
updated to a version with the fix so the workaround is no longer
necessary.

Found during review for PR 236889.

PR: 236889
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agooctusb: fix detach loop over USB ports
emaste [Sat, 1 Jun 2019 18:19:16 +0000 (18:19 +0000)]
octusb: fix detach loop over USB ports

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoDocument max_chains bump to 16384 at r330049.
mav [Sat, 1 Jun 2019 16:04:20 +0000 (16:04 +0000)]
Document max_chains bump to 16384 at r330049.

MFC after: 1 week

4 years agoSince a fatal trap can happen at aribtrary times, don't panic when the
imp [Sat, 1 Jun 2019 15:37:44 +0000 (15:37 +0000)]
Since a fatal trap can happen at aribtrary times, don't panic when the
completions are not in a consistent state. Cope with the different
places the normal I/O completion polling thread can be interrupted and
then re-entered during a kernel panic + dump.

Reviewed by: jhb and markj (both prior versions)
Differential Revision:  https://reviews.freebsd.org/D20478

4 years agoAfter parts of the locking fixes in r346595, syzkaller found
bz [Sat, 1 Jun 2019 14:57:42 +0000 (14:57 +0000)]
After parts of the locking fixes in r346595, syzkaller found
another one in udp_output(). This one is a race condition.
We do check on the laddr and lport without holding a lock in
order to determine whether we want a read or a write lock
(this is in the "sendto/sendmsg" cases where addr (sin) is given).

Instrumenting the kernel showed that after taking the lock, we
had bound to a local port from a parallel thread on the same socket.

If we find that case, unlock, and retry again. Taking the write
lock would not be a problem in first place (apart from killing some
parallelism). However the retry is needed as later on based on
similar condition checks we do acquire the pcbinfo lock and if the
conditions have changed, we might find ourselves with a lock
inconsistency, hence at the end of the function when trying to
unlock, hitting the KASSERT.

Reported by: syzbot+bdf4caa36f3ceeac198f@syzkaller.appspotmail.com
Reviewed by: markj
MFC after: 6 weeks
Event: Waterloo Hackathon 2019

4 years agoImprove error/debug messages in sdhci.c
bz [Sat, 1 Jun 2019 14:39:12 +0000 (14:39 +0000)]
Improve error/debug messages in sdhci.c

When starting a command also print the opcode and flags.
More consitently print flags as hex.
Use slot_printf rather than printf in one case.

MFC after: 6 weeks
Reviewed by: marius, kibab, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19748

4 years agocxgbe/t4_tom: adjust the hardware receive window to match changes to the
np [Sat, 1 Jun 2019 03:03:48 +0000 (03:03 +0000)]
cxgbe/t4_tom: adjust the hardware receive window to match changes to the
receive sockbuf's high water mark.

Calculate rx credits on the spot instead of tracking sbused/sb_cc and
rx_credits in the toepcb.  The previous method worked when the high
water mark changed due to SB_AUTOSIZE but not when it was adjusted
directly (for example, by the soreserve in nfsrvd_addsock).

This fixes a connection hang while running iozone over an NFS mounted
share where nfsd's TCP sockets are being handled by t4_tom.

MFC after: 3 days
Sponsored by: Chelsio Communications

4 years agopowerpc/moea: Fix moea64 native VA invalidation
jhibbits [Sat, 1 Jun 2019 01:40:14 +0000 (01:40 +0000)]
powerpc/moea: Fix moea64 native VA invalidation

Summary:
moea64_insert_pteg_native()'s invalidation only works by happenstance.
The purpose of the shifts and XORs is to extract the VSID in order to
reverse-engineer the lower bits of the VPN.  Currently a segment size is 256MB
(2**28), and ADDR_API_SHFT64 is 16, so ADDR_PIDX_SHIFT is equivalent.  However,
it's semantically incorrect, in that we don't want to shift by the page shift
size, we want to shift to get to the VSID.

Tested by: bdragon
Differential Revision: https://reviews.freebsd.org/D20467

4 years agorandom(4): Fix RANDOM_LOADABLE build
cem [Sat, 1 Jun 2019 01:22:21 +0000 (01:22 +0000)]
random(4): Fix RANDOM_LOADABLE build

I introduced an obvious compiler error in r346282, so this change fixes
that.

Unfortunately, RANDOM_LOADABLE isn't covered by our existing tinderbox, and
it seems like there were existing latent linking problems.  I believe these
were introduced on accident in r338324 during reduction of the boolean
expression(s) adjacent to randomdev.c and hash.c.  It seems the
RANDOM_LOADABLE build breakage has gone unnoticed for nine months.

This change correctly annotates randomdev.c and hash.c with !random_loadable
to match the pre-r338324 logic; and additionally updates the HWRNG drivers
in MD 'files.*', which depend on random_device symbols, with
!random_loadable (it is invalid for the kernel to depend on symbols from a
module).

(The expression for both randomdev.c and hash.c was the same, prior to
r338324: "optional random random_yarrow | random !random_yarrow
!random_loadable".  I.e., "random && (yarrow || !loadable)."  When Yarrow
was removed ("yarrow := False"), the expression was incorrectly reduced to
"optional random" when it should have retained "random && !loadable".)

Additionally, I discovered that virtio_random was missing a MODULE_DEPEND on
random_device, which breaks kld load/link of the driver on RANDOM_LOADABLE
kernels.  Address that issue as well.

PR: 238223
Reported by: Eir Nym <eirnym AT gmail.com>
Reviewed by: delphij, markm
Approved by: secteam(delphij)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20466

4 years agoDefer evaluation of modified until after it's set
imp [Fri, 31 May 2019 22:57:20 +0000 (22:57 +0000)]
Defer evaluation of modified until after it's set

With the reorg r348175, we now look at modified before it is
set. Rearrange things so that we can set include_metadata to either
yes, no or if-modified. This should fix the -R flag that was broken in
r348175, which broke WITH_REPRODUCIBLE_BUILD for kernels.

Feedback From: emaste@
Differential Revision: https://reviews.freebsd.org/D20480

4 years agoThe function vm_phys_free_contig invokes vm_phys_free_pages for every
dougm [Fri, 31 May 2019 21:02:42 +0000 (21:02 +0000)]
The function vm_phys_free_contig invokes vm_phys_free_pages for every
power-of-two page block it frees, launching an unsuccessful search for
a buddy to pair up with each time.  The only possible buddy-up mergers
are across the boundaries of the freed region, so change
vm_phys_free_contig simply to enqueue the freed interior blocks, via a
new function vm_phys_enqueue_contig, and then call vm_phys_free_pages
on the bounding blocks to create as big a cross-boundary block as
possible after buddy-merging.

The only callers of vm_phys_free_contig at the moment call it in
situations where merging blocks across the boundary is clearly
impossible, so just call vm_phys_enqueue_contig in those places and
avoid trying to buddy-up at all.

One beneficiary of this change is in breaking reservations.  For the
case where memory is freed in breaking a reservation with only the
first and last pages allocated, the number of cycles consumed by the
operation drops about 11% with this change.

Suggested by: alc
Reviewed by: alc
Approved by: kib, markj (mentors)
Differential Revision: https://reviews.freebsd.org/D16901

4 years agoSimplify flow of pmap_demote_pde_locked() and add more comprehensive
kib [Fri, 31 May 2019 18:53:04 +0000 (18:53 +0000)]
Simplify flow of pmap_demote_pde_locked() and add more comprehensive
debugging checks.

In particular,
- Move the code to handle failure to allocate page table page into
  a helper.
- After the previous item is done, it is possible to distinguish !PG_A
  case and case of missed page, in the control flow.
- Make the variable to indicate that in-kernel mapping is demoted.
- Assert that missed page table page can only happen for in-kernel
  mapping when demoting direct map.
- If DIAGNOSTIC is enabled, and the page table page should be already
  filled, check all ptes instead of only first one.

Reviewed by: alc, markj
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20266

4 years agoRevert r348438.
gjb [Fri, 31 May 2019 18:40:19 +0000 (18:40 +0000)]
Revert r348438.

The fix to override the default python version when building
the sysutils/py-google-compute-engine did not work, and there
are still issues that need to be addressed in the port itself.

See bugzilla 238267 for additional details.

MFC after: 6 days
MFC with: r348438
MFC note: no-op to appease the merge tracker
Sponsored by: The FreeBSD Foundation

4 years agonetdump: Buffer pages to avoid calling netdump_send() on each 4KB write.
markj [Fri, 31 May 2019 18:29:12 +0000 (18:29 +0000)]
netdump: Buffer pages to avoid calling netdump_send() on each 4KB write.

netdump waits for acknowledgement from the server for each write.  When
dumping page table pages, we perform many small writes, limiting
throughput.  Use the netdump client's buffer to buffer small contiguous
writes before calling netdump_send() to flush the MAXDUMPPGS-sized
buffer.  This results in a significant reduction in the time taken to
complete a netdump.

Submitted by: Sam Gwydir <sam@samgwydir.com>
Reviewed by: cem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20317

4 years agoWhitespace cleanups, no functional change.
jhb [Fri, 31 May 2019 18:00:44 +0000 (18:00 +0000)]
Whitespace cleanups, no functional change.

4 years agostand: zfs: Free bouncebuf on error path in vdev_read
kevans [Fri, 31 May 2019 17:44:22 +0000 (17:44 +0000)]
stand: zfs: Free bouncebuf on error path in vdev_read

r344226 inadvertently added this path in which we return from failure on an
lseek and do not free bouncebuf on the way out.

MFC after: 3 days

4 years agoacpi_dock(4): Notify devd(8) on dock status change.
markj [Fri, 31 May 2019 15:44:33 +0000 (15:44 +0000)]
acpi_dock(4): Notify devd(8) on dock status change.

PR: 238138
Submitted by: Muhammad Kaisar Arkhan <hi@yukiisbo.red>
MFC after: 2 weeks

4 years agoRemove a redundant vm_page_remove() call.
markj [Fri, 31 May 2019 14:59:40 +0000 (14:59 +0000)]
Remove a redundant vm_page_remove() call.

vm_page_free_prep() removes the page from its object.  No functional
change intended.

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

4 years agonewvers.sh correct typo from r348175
emaste [Fri, 31 May 2019 13:54:01 +0000 (13:54 +0000)]
newvers.sh correct typo from r348175

4 years agoRemove tests for the deprecated algorithms in r348206
lwhsu [Fri, 31 May 2019 04:29:29 +0000 (04:29 +0000)]
Remove tests for the deprecated algorithms in r348206

The tests are failing because the return value and output have changed, but
before test code structure adjusted, removing these test cases help people
be able to focus on more important cases.

Discussed with: emaste
MFC with: r348206
Sponsored by: The FreeBSD Foundation

4 years agoGet rid of extraneous initialization.
rmacklem [Fri, 31 May 2019 03:13:09 +0000 (03:13 +0000)]
Get rid of extraneous initialization.

Get rid of an extraneous initialization, mainly to keep a static analyser
happy. No semantic change.

PR: 238167
Submitted by: Alexey Dokuchaev

4 years agoReplace a single linked list with a hash table of lists.
rmacklem [Fri, 31 May 2019 01:28:48 +0000 (01:28 +0000)]
Replace a single linked list with a hash table of lists.

mountd.c uses a single linked list of "struct exportlist" structures,
where there is one of these for each exported file system on the NFS server.
This list gets long if there are a large number of file systems exported and
the list must be searched for each line in the exports file(s) when
SIGHUP causes the exports file(s) to be reloaded.
A simple benchmark that traverses SLIST() elements and compares two 32bit
fields in the structure for equal (which is what the search is)
appears to take a couple of nsec. So, for a server with 72000 exported file
systems, this can take about 5sec during reload of the exports file(s).
By replacing the single linked list with a hash table with a target of
10 elements per list, the time should be reduced to less than 1msec.
Peter Errikson (who has a server with 72000+ exported file systems) ran
a test program using 5 hashes to see how they worked.
fnv_32_buf(fsid,..., 0)
fnv_32_buf(fsid,..., FNV1_32_INIT)
hash32_buf(fsid,..., 0)
hash32_buf(fsid,..., HASHINIT)
- plus simply using the low order bits of fsid.val[0].
The first three behaved about equally well, with the first one being
slightly better than the others.
It has an average variation of about 4.5% about the target list length
and that is what this patch uses.
Peter Errikson also tested this hash table version and found that the
performance wasn't measurably improved by a larger hash table, so a
load factor of 10 appears adequate.

Tested by: pen@lysator.liu.se (with other patches)
PR: 237860
MFC after: 1 month

4 years agoClean up silly code case.
rmacklem [Fri, 31 May 2019 00:56:31 +0000 (00:56 +0000)]
Clean up silly code case.

This silly code segment has existed in the sources since it was brought
into FreeBSD 10 years ago. I honestly have no idea why this was done.
It was possible that I thought that it might have been better to not
set B_ASYNC for the "else" case, but I can't remember.
Anyhow, this patch gets rid of the if/else that does the same thing
either way, since it looks silly and upsets a static analyser.
This will have no semantic effect on the NFS client.

PR: 238167

4 years agoAdd Sergio Carlavilla (myself) to the committers doc, Gabor is going to be my mentor...
carlavilla [Thu, 30 May 2019 21:39:49 +0000 (21:39 +0000)]
Add Sergio Carlavilla (myself) to the committers doc, Gabor is going to be my mentor Approved by: gabor

4 years agomakesyscalls.sh: always use absolute path for syscalls.conf
brooks [Thu, 30 May 2019 20:56:23 +0000 (20:56 +0000)]
makesyscalls.sh: always use absolute path for syscalls.conf

syscalls.conf is included using "." which per the Open Group:

 If file does not contain a <slash>, the shell shall use the search
 path specified by PATH to find the directory containing file.

POSIX shells don't fall back to the current working directory.

Submitted by: Nathaniel Wesley Filardo <nwf20@cl.cam.ac.uk>
Reviewed by: bdrewery
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D20476

4 years agoAdd the missing braces to fix the code not guarded by the if clause and has
lwhsu [Thu, 30 May 2019 20:42:36 +0000 (20:42 +0000)]
Add the missing braces to fix the code not guarded by the if clause and has
misleading indentation.  This is found by gcc -Wmisleading-indentation

Approved by: erj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20428

4 years agolibelftc: Add MLINKS.
markj [Thu, 30 May 2019 19:18:01 +0000 (19:18 +0000)]
libelftc: Add MLINKS.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20474

4 years agoreadelf: Make -t imply -S, for compatibility with GNU binutils.
markj [Thu, 30 May 2019 18:54:34 +0000 (18:54 +0000)]
readelf: Make -t imply -S, for compatibility with GNU binutils.

Reported by: jhb
Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20475

4 years agocxgbe/t4_tom: Do not attempt to look up entries in the TCB history if
np [Thu, 30 May 2019 17:27:40 +0000 (17:27 +0000)]
cxgbe/t4_tom: Do not attempt to look up entries in the TCB history if
it hasn't been initialized.

This fixes a bug in r346570 that could cause a panic when servicing
TCP_INFO for offloaded connections.

MFC after: 3 days
Sponsored by: Chelsio Communications

4 years agoIncrease the size of the Vagrant default image size, as the 3GB
gjb [Thu, 30 May 2019 17:00:57 +0000 (17:00 +0000)]
Increase the size of the Vagrant default image size, as the 3GB
size is too small to bootstrap the firstboot_pkgs list.

While here, add the growfs(8) startup script to /etc/rc.conf,
as Vagrant images can be resized by modifying the Vagrantfile.

Reported by: dbaio
PR: 238226
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoFix GCE virtual machine startup.
gjb [Thu, 30 May 2019 16:49:40 +0000 (16:49 +0000)]
Fix GCE virtual machine startup.

The ports/head branch recently switched to python3 as the default,
which breaks the sysutils/py-google-compute-engine startup scripts,
as lang/python installs lang/python3{,.x} where lang/python2{,.x}
are needed.

Set DEFAULT_VERSIONS in release/tools/gce.conf to python=2.7, and
remove the lang/python3 inclusion in VM_EXTRA_PACKAGES.

Additionally, unset DEFAULT_VERSIONS in release/tools/vmimage.subr
to prevent persistence of DEFAULT_VERSIONS=python=2.7 in subsequent
VM/cloud image builds.

Note: at present, this affects only 13-CURRENT and 12-STABLE, as
the stable/11 branch had already switched to using the 2019Q2 branch
at the start of the 11.3-RELEASE cycle, so this does not immediately
affect 11.3-BETA, hence the 1-week merge timeout.  This had been
manually tested on 13-CURRENT.

Reported by: ler (privately)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoRemove wrong inline keyword.
dchagin [Thu, 30 May 2019 16:11:20 +0000 (16:11 +0000)]
Remove wrong inline keyword.

Reported by: markj
MFC after: 1 week

4 years agoRemove TODO comment after posixshmcontrol(1) added.
kib [Thu, 30 May 2019 16:04:00 +0000 (16:04 +0000)]
Remove TODO comment after posixshmcontrol(1) added.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 years agoMinor tweaks to the layout.
kib [Thu, 30 May 2019 16:02:40 +0000 (16:02 +0000)]
Minor tweaks to the layout.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 years agoelfcopy: Optimize for insertions at the end of the section list.
markj [Thu, 30 May 2019 15:28:48 +0000 (15:28 +0000)]
elfcopy: Optimize for insertions at the end of the section list.

This is the common case when strip(1) is creating the output file.
The change provides a significant speedup when running on ELF files with
many sections.

PR: 234949
Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20444

4 years agoelfcopy: Remove an unneeded memset.
markj [Thu, 30 May 2019 15:26:39 +0000 (15:26 +0000)]
elfcopy: Remove an unneeded memset.

Reviewed by: emaste, trasz
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20445

4 years agoPass data pointers to the driver in way in expects.
mav [Thu, 30 May 2019 15:07:39 +0000 (15:07 +0000)]
Pass data pointers to the driver in way in expects.

Probably due to historical reasons the driver uses In/Out arguments in
odd way.  While this tool still never uses Out arguments to see that,
make the code to not trigger EINVAL in possible future uses.

MFC after: 2 weeks

4 years agoSilence witness warning about duplicated mutex type.
kib [Thu, 30 May 2019 15:04:09 +0000 (15:04 +0000)]
Silence witness warning about duplicated mutex type.

The order is correct, it is nullfs vnode interlock -> lower vnode
interlock.  vop_stdadd_writecount() is called from nullfs
VOP_ADD_WRITECOUNT() and both take interlocks.

Requested by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

4 years agoComplete LOCAL_PEERCRED support. Cache pid of the remote process in the
dchagin [Thu, 30 May 2019 14:24:26 +0000 (14:24 +0000)]
Complete LOCAL_PEERCRED support. Cache pid of the remote process in the
struct xucred. Do not bump XUCRED_VERSION as struct layout is not changed.

PR: 215202
Reviewed by: tijl
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20415

4 years agoLinux does not support MSG_OOB for unix(4) or non-stream oriented socket,
dchagin [Thu, 30 May 2019 14:21:51 +0000 (14:21 +0000)]
Linux does not support MSG_OOB for unix(4) or non-stream oriented socket,
return EOPNOTSUPP as a Linux does.

Reviewed by: tijl
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20409

4 years agoFix busy status leak in case of incorrect passthrough args.
mav [Thu, 30 May 2019 14:13:09 +0000 (14:13 +0000)]
Fix busy status leak in case of incorrect passthrough args.

MFC after: 1 week

4 years agoUpdate ENA version to v2.0.0
mw [Thu, 30 May 2019 13:52:32 +0000 (13:52 +0000)]
Update ENA version to v2.0.0

ENAv2 introduces many new features, bug fixes and improvements.

Main new features are LLQ (Low Latency Queues) and independent queues
reconfiguration using sysctl commands.

The year in copyright notice was updated to 2019.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoFix ENA manual issues
mw [Thu, 30 May 2019 13:50:45 +0000 (13:50 +0000)]
Fix ENA manual issues

The issues were pointed in community review:
https://reviews.freebsd.org/D10427#inline-67587

Also, fix other issues found by the igor tool.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoImprove ENA reset handling
mw [Thu, 30 May 2019 13:45:41 +0000 (13:45 +0000)]
Improve ENA reset handling

For easier debugging, the reset is being triggered and the reset reason is
being set only in case it is done for the first time. Such approach will
ensure that the first reset reason is not going to be overwritten and
will make it easier for debugging.

Also, add a reset trigger upon invalid Tx requested ID.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoFix NULL pointer dereference in ena_up()
mw [Thu, 30 May 2019 13:42:52 +0000 (13:42 +0000)]
Fix NULL pointer dereference in ena_up()

If the call to ena_up() in ena_restore_device() fails, next usage of
`ifconfig up` will cause NULL pointer dereference.

This patch adds additional checks to prevent that.

Submitted by:  Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoUnify new line characters in the ENA driver
mw [Thu, 30 May 2019 13:41:39 +0000 (13:41 +0000)]
Unify new line characters in the ENA driver

Some messages were missing new line character and traces were not having
unified behavior. To fix that, each trace and printout should add new
line character at the end of each string - that should improve
readability.

Submitted by:  Rafal Kozik <rk@semihalf.com>
Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoFix Tx offloads for fragmented pkt headers in ENA
mw [Thu, 30 May 2019 13:40:51 +0000 (13:40 +0000)]
Fix Tx offloads for fragmented pkt headers in ENA

If the headers of the packets are split into multiple segments of the
mbuf chain, the previous version of ena_tx_csum which was assuming,
that all segments will lay in the first mbuf, will eventually fail to
map the headers properties to meta descriptor.

That will cause Tx checksum offload to do not work and was leading to
memory corruption. It could even cause the crash of the system.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoSplit ENA reset routine into restore and destroy stages
mw [Thu, 30 May 2019 13:39:25 +0000 (13:39 +0000)]
Split ENA reset routine into restore and destroy stages

For alignment with Linux driver and better handling ena_detach(), the
reset is now calling ena_device_restore() and ena_device_destroy().

The ena_device_destroy() is also being called on ena_detach(), so the
code will be more readable.

The watchdog is now being activated after reset only, if it was active
before.

There were added additional checks to ensure, that there is no race with
the link state change AENQ handler.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoUse bitfield for storing global ENA device states
mw [Thu, 30 May 2019 13:37:15 +0000 (13:37 +0000)]
Use bitfield for storing global ENA device states

As the ENA can have multiple states turned on/off, it is more convenient
to store them in single bitfield instead of multiple boolean variables.

The bitset FreeBSD API was used for the bitfield implementation, as it
provides flexible structure together with API which also supports atomic
bitfield operations.

For better readability basic macros from API were wrapped into custom
ENA_FLAG_* macros, which are filling up common parameters for all calls.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoFix error handling when ENA reset fails
mw [Thu, 30 May 2019 13:35:43 +0000 (13:35 +0000)]
Fix error handling when ENA reset fails

Before the patch, error handling was not releasing all resources and
was not issuing device reset if the reset task failed.

That could cause memory leak and fault of the device.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoFill bdf field of the host_info structure in ENA
mw [Thu, 30 May 2019 13:35:02 +0000 (13:35 +0000)]
Fill bdf field of the host_info structure in ENA

The host info bdf field is the abbreviation for the bus, device,
function of the PCI on which the device is being attached to.

Now the driver is filling information about that using FreeBSD RID
resource.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoAdd additional doorbells on ENA Tx path
mw [Thu, 30 May 2019 13:33:31 +0000 (13:33 +0000)]
Add additional doorbells on ENA Tx path

The new ENA HAL is introducing API, which can determine on Tx path if
the doorbell is needed.

That way, it can tell the driver, that it should call an doorbell.
The old threshold value wasn't removed, as not all HW is supporting this
feature - so it was reworked to also work with the new API.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoLimit maximum size of Rx refill threshold in ENA
mw [Thu, 30 May 2019 13:31:35 +0000 (13:31 +0000)]
Limit maximum size of Rx refill threshold in ENA

The Rx ring size can be as high as 8k. Because of that we want to limit
the cleanup threshold by maximum value of 256.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoAdd support for the LLQv2 and WC in ENA
mw [Thu, 30 May 2019 13:30:52 +0000 (13:30 +0000)]
Add support for the LLQv2 and WC in ENA

LLQ (Low Latency Queue) is the feature, that allows pushing header
directly to the device through PCI before even DMA is triggered.

It reduces latency, because device can start preparing packet before
payload is sent through DMA.

To speed up sending data through PCI, the Write Combining is enabled,
which allows hardware to buffer data before sending them on the PCI - it
allows to reduce number of PCI IO operations.

ENAv2 is using special descriptor for the negotiation of the LLQ.
Currently, only the default configuration is supported.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoLock optimization in ENA
mw [Thu, 30 May 2019 13:29:24 +0000 (13:29 +0000)]
Lock optimization in ENA

Handle IO interrupts using filter routine. That way, the main cleanup
task could be moved to the separate thread using taskqueue.

The deferred Rx cleanup task was removed, and now the cleanup task is
begin called instead. That way, the Rx lock could be removed.

In addition, Queue management (wake up and stop TX ring) was added, so
the TX cleanup task can be performed mostly lockless.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoAdd tuneable drbr ring size and hw queues depth for ENA
mw [Thu, 30 May 2019 13:28:03 +0000 (13:28 +0000)]
Add tuneable drbr ring size and hw queues depth for ENA

The driver now supports per adapter tuning of buffer ring size and HW Rx
ring size.

It can be achieved using sysctl node dev.ena.X.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoFix error in validate_tx_req_id() in ENA
mw [Thu, 30 May 2019 13:26:18 +0000 (13:26 +0000)]
Fix error in validate_tx_req_id() in ENA

If the requested ID was out of range, the tx_info structure was NULL and
the function was trying to access the field of the NULL object.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoChange attach order to prevent crash upon failure in ENA
mw [Thu, 30 May 2019 13:24:47 +0000 (13:24 +0000)]
Change attach order to prevent crash upon failure in ENA

The if_detach was causing crash if the MSI-x configuration in the attach
failed. To prevent this issue, the ifnet is being configured at the end
of the attach function.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoChange order of ifp release on ENA detach
mw [Thu, 30 May 2019 13:22:53 +0000 (13:22 +0000)]
Change order of ifp release on ENA detach

In rare case, when the ifconfig is called just before kldunload, it is
possible, that ena_up routine will be called after queue locks are
released.

To prevent that, ifp is detached before the last ena_down is called and
further, the ifp is freed at the end of the function.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoCheck for number of MSI-x upon partial allocation in ENA
mw [Thu, 30 May 2019 13:22:12 +0000 (13:22 +0000)]
Check for number of MSI-x upon partial allocation in ENA

The ENA driver needs at least 2 MSI-x - one for admin queue, and one for
IO queues pair. If there were not enough resources to allocate more than
one MSI-x, the device should not be attached.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoSet error value when allocation of IO irq fails in ENA
mw [Thu, 30 May 2019 13:20:42 +0000 (13:20 +0000)]
Set error value when allocation of IO irq fails in ENA

bus_alloc_resource_any() is not returning error value in case of an
error.
If the function call fails, the error value was not passed to the
ena_up() function.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoSet vaddr and paddr as NULL when DMA alloc fails in ENA
mw [Thu, 30 May 2019 13:19:32 +0000 (13:19 +0000)]
Set vaddr and paddr as NULL when DMA alloc fails in ENA

To prevent errors from assigning values from the DMA structure in case
of an error, zero the vaddr and paddr values upon failure.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoFix DMA synchronization in the ENA driver Tx and Rx paths
mw [Thu, 30 May 2019 13:18:23 +0000 (13:18 +0000)]
Fix DMA synchronization in the ENA driver Tx and Rx paths

The DMA in FreeBSD requires explicit synchronization. ENA driver was
only doing PREREAD and PREWRITE synchronizations. Missing
bus_dmamap_sync() calls were added.

It is also required to synchronize DMA engine before unloading DMA map.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoCheck for missing MSI-x and Tx completions in ENA
mw [Thu, 30 May 2019 13:16:56 +0000 (13:16 +0000)]
Check for missing MSI-x and Tx completions in ENA

If the first MSI-x won't be executed, then the timer service will detect
that and trigger device reset.

The checking for missing Tx completion was reworked, so it will also
check for missing interrupts. Checking number of missing Tx completions
can be performed after loop, instead of checking it every iteration.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoFill number of CPUs field on ENA host_info structure
mw [Thu, 30 May 2019 13:15:38 +0000 (13:15 +0000)]
Fill number of CPUs field on ENA host_info structure

The new ena_com allows the number of CPUs to be passed to the device in
the host info structure as a hint.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoPrint ENA Tx error conditionally
mw [Thu, 30 May 2019 13:14:58 +0000 (13:14 +0000)]
Print ENA Tx error conditionally

Information about Tx error should be only displayed, if packet
preparation failed due to error other than out of memory.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoTrigger reset in ENA if there are too many Rx descriptors
mw [Thu, 30 May 2019 13:13:15 +0000 (13:13 +0000)]
Trigger reset in ENA if there are too many Rx descriptors

Whenever the driver will receive too many descriptors from the device,
it should trigger the device reset, as it is indicating that the device
is in invalid state.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoRemove RSS support in ENA
mw [Thu, 30 May 2019 13:12:14 +0000 (13:12 +0000)]
Remove RSS support in ENA

Receive Side Scaling is optional feature that could be enabled in kernel
configuration by defining flag RSS.

Kernel uses hash to store and find protocol control block which is
stored in hash tables.
Kernel and NIC hash functions must be consistent. Otherwise case lookup
fails.

To achieve this kernel provides API to set proper hash key to NIC.
As it is not possible to change key for virtual ENA NIC, this driver
cannot support RSS function.

ENA is designed to work in virtual environments so supporting hardware
version of this card is unnecessary.

Submitted by:  Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoAdd notification AENQ handler for ENA
mw [Thu, 30 May 2019 13:09:53 +0000 (13:09 +0000)]
Add notification AENQ handler for ENA

Notification AENQ handler is responsible for handling requests from ENA
device. Missing Tx threshold, Tx timeout and keep alive timeout can be
set using hints from the aenq descriptor which can be delivered in the
ENA admin notification.

The queue suspending and resuming tasks are not supported by the
driver.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoPrint information when ENA admin error occurs
mw [Thu, 30 May 2019 13:08:00 +0000 (13:08 +0000)]
Print information when ENA admin error occurs

ENA_ADMIN_FATAL_ERROR and ENA_ADMIN_WARNING aenq groups were indicated
as supported, so the unimplemented_aenq_handler() will print out error
message, whenever an error will occur within the ENA admin context.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoDo not specify active media type in ENA
mw [Thu, 30 May 2019 13:06:07 +0000 (13:06 +0000)]
Do not specify active media type in ENA

As the ENA is working only in virtualized environment, the active media
is not specified. Instead, the active link type is set as unknown.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoAdjust ENA driver to the new ena-com
mw [Thu, 30 May 2019 13:01:46 +0000 (13:01 +0000)]
Adjust ENA driver to the new ena-com

Recent HAL change preparing to support ENAv2 required minor driver
modifications.

The ena_com_sq_empty_space() is not available in this ena-com, so it had
to be replaced with ena_com_free_desc().

Moreover, the ena_com_admin_init() is no longer using 3rd argument
indicating if the spin lock should be initialized, so it was removed.

Submitted by:  Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Amazon, Inc.

4 years agoUnexpand be32dec().
delphij [Thu, 30 May 2019 02:23:57 +0000 (02:23 +0000)]
Unexpand be32dec().

MFC after: 2 weeks

4 years agoarm64 gicv3_its: Fix a typo
jchandra [Thu, 30 May 2019 01:39:07 +0000 (01:39 +0000)]
arm64 gicv3_its: Fix a typo

Fix 'Cavium' spelling in errata description.

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

4 years agogicv3_its: do LPI init only once per CPU
jchandra [Thu, 30 May 2019 01:32:00 +0000 (01:32 +0000)]
gicv3_its: do LPI init only once per CPU

The initialization required for LPIs (setting up pending tables etc.)
has to be done just once per CPU, even in the case where there are
multiple ITS blocks associated with the CPU.

Add a flag lpi_enabled in the per-cpu distributor info for this and
use it to ensure that we call its_init_cpu_lpi() just once.

This enables us to support platforms where multiple GIC ITS blocks
can generate LPIs to a CPU.

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

4 years agogicv3_its: refactor LPI init into a new function
jchandra [Thu, 30 May 2019 01:24:47 +0000 (01:24 +0000)]
gicv3_its: refactor LPI init into a new function

Move the per-cpu LPI intialization to a separate function. This is
in preparation for a commit that does LPI init only once for a CPU,
even when there are multiple ITS blocks associated with the CPU.

No functional changes in this commit.

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

4 years agogic_v3: consolidate per-cpu redistributor information
jchandra [Thu, 30 May 2019 01:21:08 +0000 (01:21 +0000)]
gic_v3: consolidate per-cpu redistributor information

Update 'struct gic_redists' to consolidate all per-cpu redistributor
information into a new 'struct redist_pcpu'. Provide a new interface
(GICV3_IVAR_REDIST) for the GIC driver, which can be used to retrieve
the per-cpu data.

This per-cpu redistributor struct will be later used to improve the
GIC ITS setup.

While there, remove some unused fields in gic_v3_var.h interface.
No functional changes.

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

4 years agoAdd bits related to SANITIZE, SED, and form-factor to (struct ata_params)
rpokala [Wed, 29 May 2019 23:50:31 +0000 (23:50 +0000)]
Add bits related to SANITIZE, SED, and form-factor to (struct ata_params)

Based on ATA-ACS-4, recognize several bit-fields related to the ATA SANITIZE
feature-set, Self-Encrypting Drives, and form-factor identification.

As part of this change, the name of word 48 of (struct ata_params) is being
changed. The previous name, "usedmovsd" does not appear to be related to the
previous definition of the word ("double-word IO supported"). The word was
defined that way in ATA-1 (1994), but it was marked "Reserved" (meaning
"unused, but might be used in the future") in ATA-2 (1996). It stayed that
way until ATA-8 (2008), which re-defined it as implemented in this change.
The field is not used in-tree.

Reviewed by: mav
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D20455

4 years agoIn r343857 the referred comment moved to uma_vm_zone_stats().
glebius [Wed, 29 May 2019 22:33:37 +0000 (22:33 +0000)]
In r343857 the referred comment moved to uma_vm_zone_stats().

4 years agoiflib: provide probe wrapper for vendor drivers
erj [Wed, 29 May 2019 22:24:10 +0000 (22:24 +0000)]
iflib: provide probe wrapper for vendor drivers

From Jake:
Vendor drivers that exist out-of-tree generally should return
BUS_PROBE_VENDOR from their device probe functions. This helps ensure
that a vendor replacement driver will supersede the in-kernel driver for
a given device.

Currently, if a vendor wants to implement a driver based on iflib, it
will always report BUS_PROBE_DEFAULT.

Add a wrapper function, iflib_device_probe_vendor() which can be used in
place of iflib_device_probe(). This function will just return
BUS_PROBE_VENDOR whenever iflib_device_probe() would return
BUS_PROBE_DEFAULT.

While vendor drivers can already implement such a wrapper themselves,
providing it in the iflib.h header makes it easier for the vendor driver
to do the right thing.

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: erj@, gallatin@, marius@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D20221

4 years agoFix assertion in ZFS TRIM code
allanjude [Wed, 29 May 2019 20:34:35 +0000 (20:34 +0000)]
Fix assertion in ZFS TRIM code

Due to an attempt to check two conditions at once in a macro not designed
as such, the assertion would always evaluate to true.

#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \
        const TYPE __left = (TYPE)(LEFT); \
        const TYPE __right = (TYPE)(RIGHT); \
        if (!(__left OP __right)) \
                assfail3(#LEFT " " #OP " " #RIGHT, \
                        (uintmax_t)__left, #OP, (uintmax_t)__right, \
                        __FILE__, __LINE__); \
_NOTE(CONSTCOND) } while (0)
#define ASSERT3U(x, y, z)       VERIFY3_IMPL(x, y, z, uint64_t)

Mean that we compared:
left = (type == ZIO_TYPE_FREE || psize)
OP = "<="
right = (SPA_MAXBLOCKSIZE)

If the type was not FREE, 0 is less than SPA_MAXBLOCKSIZE (16MB)
If the type is ZIO_TYPE_FREE, 1 is less than SPA_MAXBLOCKSIZE
The constraint on psize (physical size of the FREE operation) is never
checked against SPA_MAXBLOCKSIZE

Reported by: Ka Ho Ng <khng300@gmail.com>
Reviewed by: kevans
MFC after: 2 weeks
Sponsored by: Klara Systems

4 years agoAdd the likely missing braces in ips(4). This is found by gcc warning that
lwhsu [Wed, 29 May 2019 18:11:17 +0000 (18:11 +0000)]
Add the likely missing braces in ips(4).  This is found by gcc warning that
the code is not guarded by the if clause and has misleading indentation.

Approved by: scottl
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20427

4 years agoDon't copy the data from bounce buffer back to the mbuf if channel does
br [Wed, 29 May 2019 16:01:34 +0000 (16:01 +0000)]
Don't copy the data from bounce buffer back to the mbuf if channel does
not use bounce buffering.

Sponsored by: DARPA, AFRL

4 years agoPass pci_base address instead of physical address to rman_manage_region().
br [Wed, 29 May 2019 15:53:33 +0000 (15:53 +0000)]
Pass pci_base address instead of physical address to rman_manage_region().

This should had been part of r347930 ("pci: ecam: Correctly parse memory
and IO region").

Sponsored by: DARPA, AFRL

4 years agoRemove "All rights reserved." from FF copyright.
kib [Wed, 29 May 2019 14:26:35 +0000 (14:26 +0000)]
Remove "All rights reserved." from FF copyright.

Requested by: rgrimes
Sponsored by: The FreeBSD Foundation
MFC after: 1 week