]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoConvert casperd(8) daemon to the libcasper.
oshogbo [Thu, 25 Feb 2016 18:23:40 +0000 (18:23 +0000)]
Convert casperd(8) daemon to the libcasper.
After calling the cap_init(3) function Casper will fork from it's original
process, using pdfork(2). Forking from a process has a lot of advantages:
1. We have the same cwd as the original process.
2. The same uid, gid and groups.
3. The same MAC labels.
4. The same descriptor table.
5. The same routing table.
6. The same umask.
7. The same cpuset(1).
From now services are also in form of libraries.
We also removed libcapsicum at all and converts existing program using Casper
to new architecture.

Discussed with: pjd, jonathan, ed, drysdale@google.com, emaste
Partially reviewed by: drysdale@google.com, bdrewery
Approved by: pjd (mentor)
Differential Revision: https://reviews.freebsd.org/D4277

8 years agoAdd simple support for CloudABI processes to kdump(1).
jhb [Thu, 25 Feb 2016 17:43:32 +0000 (17:43 +0000)]
Add simple support for CloudABI processes to kdump(1).

This does not decode arguments to system calls but should properly
decode system call names and error return values.

Reviewed by: ed
Differential Revision: https://reviews.freebsd.org/D5412

8 years agoAdd support for the Allwinner A31 watchdog to the existing A10 watchdog
andrew [Thu, 25 Feb 2016 16:50:36 +0000 (16:50 +0000)]
Add support for the Allwinner A31 watchdog to the existing A10 watchdog
driver. This mostly involves selecting the register offsets to use at
runtime based on the hardware we are talking to.

Submitted by: Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision: https://reviews.freebsd.org/D5327

8 years agoIntroduce HW TSO support for VNIC
zbb [Thu, 25 Feb 2016 14:29:57 +0000 (14:29 +0000)]
Introduce HW TSO support for VNIC

This feature was added in Pass2.0.
Significantly improves VNIC's TCP performance on Tx.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5424

8 years agoEnable CQ count threshold interrupt on VNIC Pass2.0
zbb [Thu, 25 Feb 2016 14:28:10 +0000 (14:28 +0000)]
Enable CQ count threshold interrupt on VNIC Pass2.0

On Pass2.0 can trigger interrupt on both timer and CQ count.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5423

8 years agoFix VNIC support for Pass2.0 ThunderX chips
zbb [Thu, 25 Feb 2016 14:26:13 +0000 (14:26 +0000)]
Fix VNIC support for Pass2.0 ThunderX chips

- Check chip revision using pass1_silicon() routine.
- Configure CPI correctly for Pass2.0

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5422

8 years agoRemove soft reset from the VNIC's PF driver
zbb [Thu, 25 Feb 2016 14:24:32 +0000 (14:24 +0000)]
Remove soft reset from the VNIC's PF driver

This is not needed and causes revid register of the PCI
configuration space to clear on Pass2.0.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5421

8 years agoImprove VNIC performance on Tx path by immediate packet transmission
zbb [Thu, 25 Feb 2016 14:23:02 +0000 (14:23 +0000)]
Improve VNIC performance on Tx path by immediate packet transmission

Don't postpone Tx if the Tx lock can be acquired now.
This gives 3x better performance on egress.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5325

8 years agoClean-up network interface settings for VNIC
zbb [Thu, 25 Feb 2016 14:21:04 +0000 (14:21 +0000)]
Clean-up network interface settings for VNIC

- Remove unrelevant bits
- Remove redundant code
- Reset variables and then set given bits

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5324

8 years agoEnable HWSTATS capability for VNIC
zbb [Thu, 25 Feb 2016 14:19:02 +0000 (14:19 +0000)]
Enable HWSTATS capability for VNIC

VNIC manages counters in hardware hence it is desired to have this
option enabled to avoid redundant stats update in ether_input_internal().

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5323

8 years agoPrefetch next CQ descriptor in Completion Queue handling loop of VNIC
zbb [Thu, 25 Feb 2016 14:17:13 +0000 (14:17 +0000)]
Prefetch next CQ descriptor in Completion Queue handling loop of VNIC

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5322

8 years agoEnable LRO support for VNIC driver
zbb [Thu, 25 Feb 2016 14:14:46 +0000 (14:14 +0000)]
Enable LRO support for VNIC driver

Support for software LRO when enabled in the capabilities

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5321

8 years agoAdd support for hardware Tx and Rx checksums to VNIC driver
zbb [Thu, 25 Feb 2016 14:12:51 +0000 (14:12 +0000)]
Add support for hardware Tx and Rx checksums to VNIC driver

- The network controller verifies Rx TCP/UDP/SCTP checksums by default.
  Communicate this to the stack when the packet is not marked as erroneous
  to avoid redundant checksum calculation in kernel.
- It is not uncommon to get the mbuf with m_len that is less than
  the minimal size for the IP, TCP, UDP, etc. when HW checsumming
  is enabled. To avoid data corruption performed by the HW that is
  intended to write IP and TCP/UDP/SCTP checksums to the data segment,
  the mbuf needs to be pulled up by the required number of bytes.
- Make sure that one can modify the mbufs that require checsum calculation
  rather than check for NULL mbuf on each transmission.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5320

8 years agoAdd the Allwinner A31 and A31s padconf support. It's currently unused, but
andrew [Thu, 25 Feb 2016 12:17:41 +0000 (12:17 +0000)]
Add the Allwinner A31 and A31s padconf support. It's currently unused, but
will be needed when we bring in further support for these SoCs.

Submitted by: Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision: https://reviews.freebsd.org/D5340

8 years agohyperv: Wait 5 seconds for hyperv result, instead of 500ms
sephe [Thu, 25 Feb 2016 09:27:50 +0000 (09:27 +0000)]
hyperv: Wait 5 seconds for hyperv result, instead of 500ms

This addresses various devices (network, stoarge) attach failure.

Reported by: Hongxiong Xian <v-hoxian microsoft com>
Tested by: Hongxiong Xian <v-hoxian microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5435

8 years agopf: Fix possible out-of-bounds write
kp [Thu, 25 Feb 2016 07:33:59 +0000 (07:33 +0000)]
pf: Fix possible out-of-bounds write

In the DIOCRSETADDRS ioctl() handler we allocate a table for struct pfr_addrs,
which is processed in pfr_set_addrs(). At the users request we also provide
feedback on the deleted addresses, by storing them after the new list
('bcopy(&ad, addr + size + i, sizeof(ad));' in pfr_set_addrs()).

This means we write outside the bounds of the buffer we've just allocated.
We need to look at pfrio_size2 instead (i.e. the size the user reserved for our
feedback). That'd allow a malicious user to specify a smaller pfrio_size2 than
pfrio_size though, in which case we'd still read outside of the allocated
buffer. Instead we allocate the largest of the two values.

Reported By: Paul J Murphy <paul@inetstat.net>
PR: 207463
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D5426

8 years agohyperv/hn: Hold the TX ring lock then drain TX desc buf_ring
sephe [Thu, 25 Feb 2016 07:03:10 +0000 (07:03 +0000)]
hyperv/hn: Hold the TX ring lock then drain TX desc buf_ring

Reported by: Hongxiong Xian <v-hoxian microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC

8 years agoFix the build.
jhibbits [Thu, 25 Feb 2016 04:32:17 +0000 (04:32 +0000)]
Fix the build.

Pointy-hat to: jhibbits
Spotted by: bde

8 years agohyperv/hn: Implement ifnet.if_transmit method
sephe [Thu, 25 Feb 2016 03:21:25 +0000 (03:21 +0000)]
hyperv/hn: Implement ifnet.if_transmit method

It will be turned on by default later.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5415

8 years agoRemoved unused label and fix mutex_exit order
smh [Thu, 25 Feb 2016 03:01:24 +0000 (03:01 +0000)]
Removed unused label and fix mutex_exit order

Remove unused done label from zfs_setacl fixing PVS-Studio V729.

Fix mutex_exit order to mirror the mutex_enter order.

MFC after: 1 week
Sponsored by: Multiplay

8 years agoFix NULL pointer dereferences
smh [Thu, 25 Feb 2016 02:46:47 +0000 (02:46 +0000)]
Fix NULL pointer dereferences

Fix NULL pointer dereferences identified as V522 by PVS-Studio.

MFC after: 1 week
Sponsored by: Multiplay

8 years agoFix dedicated DMA transfers.
jmcneill [Thu, 25 Feb 2016 01:24:02 +0000 (01:24 +0000)]
Fix dedicated DMA transfers.

For sources and destinations marked "noincr", the previous code was
incorrectly programming the dedicated DMA channel control register
using bit definitions for normal DMA channels. This code path is not
currently used, but will be used by the HDMI audio driver in review.

Reviewed by: andrew
Approved by: gonzo (mentor)
Differential Revision: https://reviews.freebsd.org/D5382

8 years agocxgbe(4): Add a sysctl to retrieve the maximum speed/bandwidth supported by a
np [Thu, 25 Feb 2016 01:10:56 +0000 (01:10 +0000)]
cxgbe(4): Add a sysctl to retrieve the maximum speed/bandwidth supported by a
port.

dev.cxgbe.<n>.max_speed
dev.cxl.<n>.max_speed

Sponsored by: Chelsio Communications

8 years agoAdd myself as src committer.
jmcneill [Thu, 25 Feb 2016 01:03:34 +0000 (01:03 +0000)]
Add myself as src committer.

Approved by: gonzo (mentor)

8 years agoAdd order for installworld/installkernel.
bdrewery [Wed, 24 Feb 2016 22:27:25 +0000 (22:27 +0000)]
Add order for installworld/installkernel.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd more STANDALONE_SUBDIR_TARGETS.
bdrewery [Wed, 24 Feb 2016 22:27:22 +0000 (22:27 +0000)]
Add more STANDALONE_SUBDIR_TARGETS.

Sponsored by: EMC / Isilon Storage Division

8 years agoOBJS and POBJS have not been used since r215127.
bdrewery [Wed, 24 Feb 2016 22:27:18 +0000 (22:27 +0000)]
OBJS and POBJS have not been used since r215127.

r215127 disabled building of libgcc.a.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoIn bpf_getdltlist(), do not call copyout(9) while holding bpf lock.
kib [Wed, 24 Feb 2016 22:00:35 +0000 (22:00 +0000)]
In bpf_getdltlist(), do not call copyout(9) while holding bpf lock.
Copy the data into temprorary malloced buffer and drop the lock for
copyout.

Reported, reviewed and tested by: cem
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoDon't hide AR command as bsd.lib.mk's r283925 changed as well.
bdrewery [Wed, 24 Feb 2016 21:19:44 +0000 (21:19 +0000)]
Don't hide AR command as bsd.lib.mk's r283925 changed as well.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoFix year.
kib [Wed, 24 Feb 2016 20:32:24 +0000 (20:32 +0000)]
Fix year.

Noted by: bdrewery
MFC after: 2 weeks

8 years agoPROGS: Only the main process will install INCS.
bdrewery [Wed, 24 Feb 2016 20:28:48 +0000 (20:28 +0000)]
PROGS: Only the main process will install INCS.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoFAST_DEPEND: Still need to remove DEPENDFILE when rebuilding.
bdrewery [Wed, 24 Feb 2016 20:28:45 +0000 (20:28 +0000)]
FAST_DEPEND: Still need to remove DEPENDFILE when rebuilding.

This avoids _EXTRADEPEND adding duplicate entries.

Sponsored by: EMC / Isilon Storage Division

8 years agoRemove references to Giant in the description of vrele(9). Add notes
kib [Wed, 24 Feb 2016 20:04:41 +0000 (20:04 +0000)]
Remove references to Giant in the description of vrele(9).  Add notes
about vnode lock and sleeping.

Reported by: julian
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoRemove hack from r2408 that is no longer needed.
bdrewery [Wed, 24 Feb 2016 20:02:58 +0000 (20:02 +0000)]
Remove hack from r2408 that is no longer needed.

Sponsored by: EMC / Isilon Storage Division

8 years agoRegenerate
bdrewery [Wed, 24 Feb 2016 19:19:25 +0000 (19:19 +0000)]
Regenerate

8 years agoBDECFLAGS has not been available since r82604 removed /etc/defaults/make.conf.
bdrewery [Wed, 24 Feb 2016 19:07:35 +0000 (19:07 +0000)]
BDECFLAGS has not been available since r82604 removed /etc/defaults/make.conf.

WARNS=6 has provided BDECFLAGS since r94332 as well.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoPROGS: Remove the 'build one' optimization since it breaks 'build multiple'
bdrewery [Wed, 24 Feb 2016 17:20:34 +0000 (17:20 +0000)]
PROGS: Remove the 'build one' optimization since it breaks 'build multiple'

Given PROG1 PROG2, 'make PROG1' would work but 'make PROG1 PROG2' would not.
Just build them as normal in a sub-make to avoid any issues.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoShow full DIRPRFX in subdir parallel target name.
bdrewery [Wed, 24 Feb 2016 17:20:31 +0000 (17:20 +0000)]
Show full DIRPRFX in subdir parallel target name.

For example when building, from buildworld, lib/atf/libatf-c++/tests/detail:
    --- all_subdir_atf ---
is now:
    --- all_subdir_lib/atf/libatf-c++/tests/detail ---

Sponsored by: EMC / Isilon Storage Division

8 years agoDIRDEPS_BUILD: Allow destroy-(arch|host|stage) from top-level.
bdrewery [Wed, 24 Feb 2016 17:20:28 +0000 (17:20 +0000)]
DIRDEPS_BUILD: Allow destroy-(arch|host|stage) from top-level.

Sponsored by: EMC / Isilon Storage Division

8 years agoDIRDEPS_BUILD: Allow 'make destroy*' to work from top-level.
bdrewery [Wed, 24 Feb 2016 17:20:25 +0000 (17:20 +0000)]
DIRDEPS_BUILD: Allow 'make destroy*' to work from top-level.

Sponsored by: EMC / Isilon Storage Division

8 years agoFAST_DEPEND: Skip 'make depend' for buildworld and kernel since it is auto-ran now.
bdrewery [Wed, 24 Feb 2016 17:20:22 +0000 (17:20 +0000)]
FAST_DEPEND: Skip 'make depend' for buildworld and kernel since it is auto-ran now.

Sponsored by: EMC / Isilon Storage Division

8 years agoDIRDEPS_BUILD: Regenerate without local dependencies.
bdrewery [Wed, 24 Feb 2016 17:20:11 +0000 (17:20 +0000)]
DIRDEPS_BUILD: Regenerate without local dependencies.

These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by: EMC / Isilon Storage Division

8 years agoFAST_DEPEND: Always run depend via beforebuild which removes many hacks.
bdrewery [Wed, 24 Feb 2016 17:19:18 +0000 (17:19 +0000)]
FAST_DEPEND: Always run depend via beforebuild which removes many hacks.

This will generate dependencies rather than depending on the previous behavior
of depending on the guessed OBJS: *.h dependecies or a user running
'make depend'.

Experimentation showed that depending only on headers was not enough and
prone to .ORDER errors.  Downstream users may also have added
dependencies into beforedepend or afterdepend targets.  The safest way to
ensure dependencies are generated before build is to run 'make depend'
beforehand rather than just depending on DPSRCS+SRCS.

Note that the OBJS_DEPEND_GUESS mechanism (a.k.a .if !exists(.depend) then
foo.o: *.h) is still useful as it improves incremental builds with missing
.depend.* files and allows 'make foo.o' to usually work, while this
'beforebuild: depend' ensures that the build will always find all dependencies.
The 'make foo.o' case has no means of a 'beforebuild' hook.

This also removes several hacks in the DIRDEPS_BUILD:
- NO_INSTALL_INCLUDES is no longer needed as it mostly was to work around
  .ORDER problems with building the needed headers early.
- DIRDEPS_BUILD: It is no longer necesarry to track "local dependencies" in
  Makefile.depend.

  These were only in Makefile.depend for 'clean builds' since nothing would
  generate the files due to skipping 'make depend' and early dependency
  bugs that have been fixed, such as adding headers into SRCS for the
  OBJS_DEPEND_GUESS mechanism.  Normally if a .depend file does not exist then
  a dependency is added by bsd.lib.mk/bsd.prog.mk from OBJS: *.h.  However,
  meta.autodep.mk creates a .depend file from created meta files and inserts
  that into Makefile.depend.  It also only tracks *.[ch] files though which can
  miss some dependencies that are hooked into 'make depend'.  This .depend
  that is created then breaks incremental builds due to the !exists(.depend)
  checks for OBJS_DEPEND_GUESS.  The goal was to skip 'make depend' yet it only
  really works the first time.  After that files are not generated as expected,
  which r288966 tried to address but was using buildfiles: rather than
  beforebuild: and was reverted in r291725.  As noted previously,
  depending only on headers in beforebuild: would create .ORDER errors
  in some cases.

  meta.autodep.mk is still used to generate Makefile.depend though via:
    gendirdeps: Makefile.depend
    .END: gendirdeps

  This commit allows removing all of the "local dependencies" in
  Makefile.depend which cuts down on churn and removes some of the
  arch-dependent Makefile.depend files.

  The "local dependencies" were also problematic for bootstrapping.

Sponsored by: EMC / Isilon Storage Division

8 years agoHook the meta/nofilemon build into using FAST_DEPEND.
bdrewery [Wed, 24 Feb 2016 17:19:13 +0000 (17:19 +0000)]
Hook the meta/nofilemon build into using FAST_DEPEND.

FAST_DEPEND is intended to be the "skip 'make depend' and mkdep"
feature.  Since DIRDEPS_BUILD does this already with some of its own
hacks, and filemon doesn't need this, and nofilemon does, teach it how
to handle each of these cases.

In meta+filemon mode filemon will handle dependencies itself via the
meta mode logic in bmake.  We still want to set MK_FAST_DEPEND=yes to
enable some logic that indicates that 'make depend' is skipped in the
traditional sense.  The actual .depend.* files will be skipped.

When nofilemon is set though we still need to track and generate dependencies.

Sponsored by: EMC / Isilon Storage Division

8 years agoFAST_DEPEND: Don't waste time generating an empty .depend file.
bdrewery [Wed, 24 Feb 2016 17:19:09 +0000 (17:19 +0000)]
FAST_DEPEND: Don't waste time generating an empty .depend file.

The .depend file will still be generated if _EXTRADEPEND is used.  The target
is kept with a dependency on DPSRCS though so that 'make depend' will generate
all files.

Sponsored by: EMC / Isilon Storage Division

8 years agoFAST_DEPEND: Rework how guessed dependencies are handled.
bdrewery [Wed, 24 Feb 2016 17:19:05 +0000 (17:19 +0000)]
FAST_DEPEND: Rework how guessed dependencies are handled.

Rather than depend on .depend not existing, check the actual
.depend.OBJ file that will be used for that object.  If it doesn't
exist then use the guessed dependencies.

FAST_DEPEND may never have a .depend file.  Not having one means all of the
previous logic would over-depend all object files on all headers which is not
what we wanted.  It also means that if a .depend is generated before a build
is done for _EXTRADEPEND (such as for PROG or LIB) then all of these
dependencies would not be used since the .depend wasn't generated from mkdep
and the real .depend.* files are not generated until the build.

Sponsored by: EMC / Isilon Storage Division

8 years agoSupport beforebuild in the kernel.
bdrewery [Wed, 24 Feb 2016 17:19:02 +0000 (17:19 +0000)]
Support beforebuild in the kernel.

Sponsored by: EMC / Isilon Storage Division

8 years agoRemove ilinks in cleandepend directly via CLEANDEPENDFILES.
bdrewery [Wed, 24 Feb 2016 17:18:58 +0000 (17:18 +0000)]
Remove ilinks in cleandepend directly via CLEANDEPENDFILES.

The 'cleanilinks' target is kept since it may still be useful as added in
r200178, though never documented.

Sponsored by: EMC / Isilon Storage Division

8 years agoFollow-up r295667 with fixes for SRCS defined.
bdrewery [Wed, 24 Feb 2016 17:18:55 +0000 (17:18 +0000)]
Follow-up r295667 with fixes for SRCS defined.

cleandepend should always remove CLEANDEPEND* if they are not empty,
but bsd.dep.mk should not add the tags entries unless SRCS is defined
as it did before.  The .depend file itself it still always removed
to avoid accidentally keeping a stale one around as done in r295666.

Sponsored by: EMC / Isilon Storage Division

8 years agoConvert to LIBADD.
bdrewery [Wed, 24 Feb 2016 17:18:52 +0000 (17:18 +0000)]
Convert to LIBADD.

Sponsored by: EMC / Isilon Storage Division

8 years agoSupport a WANT_MAKE_VERSION.
bdrewery [Wed, 24 Feb 2016 17:18:49 +0000 (17:18 +0000)]
Support a WANT_MAKE_VERSION.

This will be used soon for .dinclude support in FAST_DEPEND.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoDIRDEPS_BUILD: Add some missing build dependencies for kerberos5.
bdrewery [Wed, 24 Feb 2016 17:18:43 +0000 (17:18 +0000)]
DIRDEPS_BUILD: Add some missing build dependencies for kerberos5.

Sponsored by: EMC / Isilon Storage Division

8 years agoDIRDEPS_BUILD: Update dependencies.
bdrewery [Wed, 24 Feb 2016 17:18:35 +0000 (17:18 +0000)]
DIRDEPS_BUILD: Update dependencies.

Sponsored by: EMC / Isilon Storage Division

8 years agoProperly fix these builds by adding NO_WMISSING_VARIABLE_DECLARATIONS from r249657.
bdrewery [Wed, 24 Feb 2016 17:18:31 +0000 (17:18 +0000)]
Properly fix these builds by adding NO_WMISSING_VARIABLE_DECLARATIONS from r249657.

This reverts r284374.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoPROGS: Only recurse on called targets like done for SUBDIR in r291635.
bdrewery [Wed, 24 Feb 2016 17:18:28 +0000 (17:18 +0000)]
PROGS: Only recurse on called targets like done for SUBDIR in r291635.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agodb(3): Fix aliasing warnings from modern GCC.
pfg [Wed, 24 Feb 2016 17:14:11 +0000 (17:14 +0000)]
db(3): Fix aliasing warnings from modern GCC.

While here also drop a malloc cast.

Obtained from: NetBSD (CVS Rev. 1.18 - 1.20)

8 years agoMake asynchronous connection failures on UNIX sockets fail with ECONNRESET.
ed [Wed, 24 Feb 2016 17:10:32 +0000 (17:10 +0000)]
Make asynchronous connection failures on UNIX sockets fail with ECONNRESET.

While making CloudABI work well on Linux, I discovered that I had a
FreeBSD-ism in one of my unit tests. The test did the following:

- Create UNIX socket 1, bind it, make it listen.
- Create UNIX socket 2, connect it to UNIX socket 1.
- Close UNIX socket 1.
- Obtain SO_ERROR from socket 2.

On FreeBSD this returns ECONNABORTED, while on Linux it returns
ECONNRESET. I dug through some of the relevant specifications[1] and it
looks like Linux is all right here. ECONNABORTED should only be returned
when the local connection (socket 2) is aborted; not the peer (socket 1).

It is of course slightly misleading: the function in which we set this
error is called uipc_abort(), but keep in mind that we're aborting the
peer, thus resetting the local socket.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html

Reviewed by: cem
Sponsored by: Nuxi, the Netherlands
Differential Revision: https://reviews.freebsd.org/D5419

8 years agodb(3): Fix aliasing warnings from modern GCC.
pfg [Wed, 24 Feb 2016 16:52:03 +0000 (16:52 +0000)]
db(3): Fix aliasing warnings from modern GCC.

Obtained from: NetBSD (CVS Rev. 1.20)

8 years agoAdd support for symmetric multiprocessing (SMP).
br [Wed, 24 Feb 2016 16:50:34 +0000 (16:50 +0000)]
Add support for symmetric multiprocessing (SMP).

Tested on Spike simulator with 2 and 16 cores (tlb enabled),
so set MAXCPU to 16 at this time.

This uses FDT data to get information about CPUs
(code based on arm64 mp_machdep).

Invalidate entire TLB cache as it is the only way yet.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

8 years agoProvide more correct sizing of the KVA consumed by a vnode, used by
kib [Wed, 24 Feb 2016 15:15:46 +0000 (15:15 +0000)]
Provide more correct sizing of the KVA consumed by a vnode, used by
the virtvnodes calculation.  Include the size of fs-specific v_data as
the nfs nclnode inline, the NFS nclnode is bigger than either ZFS
znode or UFS inode.  Include the size of namecache_ts and short cache
path element, multiplied by the name cache population factor, again
inline.

Inline defines are used to avoid pollution of the vnode.h with the
subsystem-private objects.  Non-significant unsynchronized changes of
the definitions are fine, we do not care about that precision, and
e.g. ZFS consumes much malloced memory per vnode for reasons
unaccounted in the formula.

Lower the partition of kmem dedicated to vnodes, from 1/7 to 1/10.

The measures reduce vnode cache pressure on kmem and bring the vnode
cache memory use below some apparent thresholds that were exceeded by
r291244 due to more robust vnode reuse.

Reported and tested by: marius (i386, previous version)
Reviewed by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoFix bug in filling and handling ipfw's O_DSCP opcode.
ae [Wed, 24 Feb 2016 13:16:03 +0000 (13:16 +0000)]
Fix bug in filling and handling ipfw's O_DSCP opcode.
Due to integer overflow CS4 token was handled as BE.

PR: 207459
MFC after: 1 week

8 years agoFix useless check. m_pkthdr.len should be equal to orglen.
ae [Wed, 24 Feb 2016 12:28:49 +0000 (12:28 +0000)]
Fix useless check. m_pkthdr.len should be equal to orglen.

MFC after: 2 weeks

8 years agoReturn dst as the result from memcpy(9) on amd64.
kib [Wed, 24 Feb 2016 11:58:15 +0000 (11:58 +0000)]
Return dst as the result from memcpy(9) on amd64.

PR: 207422
MFC after: 1 week

8 years agoCall cap_rights_init() properly.
ed [Wed, 24 Feb 2016 10:54:26 +0000 (10:54 +0000)]
Call cap_rights_init() properly.

Even though or'ing the individual rights works in this specific case, it
may not work in general. Pass them in as varargs.

8 years agohyperv/vmbus: Use free(9) for interrupt page; it is allocated by malloc(9)
sephe [Wed, 24 Feb 2016 08:54:50 +0000 (08:54 +0000)]
hyperv/vmbus: Use free(9) for interrupt page; it is allocated by malloc(9)

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5417

8 years agoMake pci_host_generic and thunderx_pci common
wma [Wed, 24 Feb 2016 06:05:30 +0000 (06:05 +0000)]
Make pci_host_generic and thunderx_pci common
  * provided OFW interface for pci_host_generic (for handling devices which are present in DTS under the PCI node)
  * removed support for internal PCI from arm64/cavium
  * cleaned up and made most of the code common

Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D5261

8 years agoo kill few remaining references to the GEOM_UNCOMPRESS;
sobomax [Wed, 24 Feb 2016 05:17:52 +0000 (05:17 +0000)]
o kill few remaining references to the GEOM_UNCOMPRESS;

o add GEOM_UZIP_DEBUG.

8 years agoKill few remaininng instances of GEOM_UNCOMPRESS.
sobomax [Wed, 24 Feb 2016 05:16:24 +0000 (05:16 +0000)]
Kill few remaininng instances of GEOM_UNCOMPRESS.

8 years agohyperv/utils: Code rearrange and cleanup
sephe [Wed, 24 Feb 2016 05:01:18 +0000 (05:01 +0000)]
hyperv/utils: Code rearrange and cleanup

Split heartbeat, shutdown and timesync out of utils code
and name them properly.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: adrian, sephe, Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5216

8 years agoMigrate UNCOMPRESS -> UZIP
adrian [Wed, 24 Feb 2016 03:06:26 +0000 (03:06 +0000)]
Migrate UNCOMPRESS -> UZIP

8 years agoFixes to make it compile under gcc-4.2.
adrian [Wed, 24 Feb 2016 02:52:49 +0000 (02:52 +0000)]
Fixes to make it compile under gcc-4.2.

8 years agoThe UFS filesystem requires that the last block of a file always be
mckusick [Wed, 24 Feb 2016 01:58:40 +0000 (01:58 +0000)]
The UFS filesystem requires that the last block of a file always be
allocated. When shortening the length of a file in which the new end
of the file contains a hole, the hole must have a block allocated.

Reported by: Maxim Sobolev
Reviewed by: kib
Tested by:   Peter Holm

8 years ago- Add a global option where we can protect processes when swap space
araujo [Wed, 24 Feb 2016 01:32:12 +0000 (01:32 +0000)]
- Add a global option where we can protect processes when swap space
  is exhausted.

How to use:

Basically we need to add on rc.conf an another option like:

    If we want to protect only the main processes.
    syslogd_oomprotect="YES"

    If we want to protect all future children of the specified processes.
    syslogd_oomprotect="ALL"

PR: 204741 (based on)
Submitted by: eugen@grosbein.net
Reviewed by: jhb, allanjude, rpokala and bapt
MFC after: 4 weeks
Relnotes: Yes
Sponsored by: gandi.net
Differential Revision: https://reviews.freebsd.org/D5176

8 years agoixl(4)/ixlv(4): Remove a couple unnecessary register writes/flushes.
erj [Wed, 24 Feb 2016 01:11:51 +0000 (01:11 +0000)]
ixl(4)/ixlv(4): Remove a couple unnecessary register writes/flushes.

The one in ixl_xmit() has brought up to us as being unnecessary at least a
couple times.

Differential Revision: https://reviews.freebsd.org/D5208
Tested by: jeffrey.e.pieper@intel.com
Sponsored by: Intel Corporation

8 years agoixl(4): Fix potential driver interrupt setup issues and startup crash.
erj [Wed, 24 Feb 2016 00:42:43 +0000 (00:42 +0000)]
ixl(4): Fix potential driver interrupt setup issues and startup crash.

- Limit queue autoconfiguration to 8 queues to prevent the driver from
  requesting a large number of MSI-X vectors at boot.

- Fix potential kernel panic that occurs when the driver loads and cannot
  get all requested MSIX vectors. Instead, attach() will fail with an error.
  - Move taskqueue setup to later in attach() to prevent having to free
    taskqueues if some other error in attach() occurs.

Differential Revision:  https://reviews.freebsd.org/D5205
MFC after: 1 month
Tested by: jeffrey.e.pieper@intel.com
Sponsored by: Intel Corporation

8 years agoObsolete mkulzma(8) and geom_uncompress(4), their functionality
sobomax [Wed, 24 Feb 2016 00:39:36 +0000 (00:39 +0000)]
Obsolete mkulzma(8) and geom_uncompress(4), their functionality
is now provided by mkuzip(8) and geom_uzip(4) respectively.

MFC after: 1 month

8 years agonvme: fix intx handler to not dereference ioq during initialization
jimharris [Wed, 24 Feb 2016 00:01:10 +0000 (00:01 +0000)]
nvme: fix intx handler to not dereference ioq during initialization

This was a regression from r293328, which deferred allocation
of the controller's ioq array until after interrupts are enabled
during boot.

PR: 207432
Reported and tested by: Andy Carrel <wac@google.com>
MFC after: 3 days
Sponsored by: Intel

8 years agoImprove mkuzip(8) and geom_uzip(4), merge in LZMA support from mkulzma(8)
sobomax [Tue, 23 Feb 2016 23:59:08 +0000 (23:59 +0000)]
Improve mkuzip(8) and geom_uzip(4), merge in LZMA support from mkulzma(8)
and geom_uncompress(4):

1. mkuzip(8):

 - Proper support for eliminating all-zero blocks when compressing an
   image. This feature is already supported by the geom_uzip(4) module
   and CLOOP format in general, so it's just a matter of making mkuzip(8)
   match. It should be noted, however that this feature while it sounds
   great, results in very slight improvement in the overall compression
   ratio, since compressing default 16k all-zero block produces only 39
   bytes compressed output block, which is 99.8% compression ratio. With
   typical average compression ratio of amd64 binaries and data being
   around 60-70% the difference between 99.8% and 100.0% is not that
   great further diluted by the ratio of number of zero blocks in the
   uncompressed image to the overall number of blocks being less than
   0.5 (typically). However, this may be important from performance
   standpoint, so that kernel are not spinning its wheels decompressing
   those empty blocks every time this zero region is read. It could also
   be important when you create huge image mostly filled with zero
   blocks for testing purposes.

 - New feature allowing to de-duplicate output image. It turns out that
   if you twist CLOOP format a bit you can do that as well. And unlike
   zero-blocks elimination, this gives a noticeable improvement in the
   overall compression ratio, reducing output image by something like
   3-4% on my test UFS2 3GB image consisting of full FreeBSD base system
   plus some of the packages (openjdk, apache etc), about 2.3GB worth of
   file data (800+MB compressed). The only caveat is that images created
   with this feature "on" would not work on older versions of FeeBSDxi
   kernel, hence it's turned off by default.

 - provide options to control both features and document them in manual
   page.

 - merge in all relevant LZMA compression support from the mkulzma(8),
   add new option to select between both.

 - switch license from ad-hoc beerware into standard 2-clause BSD.

2. geom_uzip(4):

 - implement support for de-duplicated images;

 - optimize some code paths to handle "all-zero" blocks without reading
   any compressed data;

 - beef up manual page to explain that geom_uzip(4) is not limited only
   to md(4) images. The compressed data can be written to the block
   device and accessed directly via magic of GEOM(4) and devfs(4),
   including to mount root fs from a compressed drive.

 - convert debug log code from being compiled in conditionally into
   being present all the time and provide two sysctls to turn it on or
   off. Due to intended use of the module, it can be used in
   environments where there may not be a luxury to put new kernel with
   debug code enabled. Having those options handy allows debug issues
   without as much problem by just having access to serial console or
   network shell access to a box/appliance. The resulting additional
   CPU cycles are just few int comparisons and branches, and those are
   minuscule when compared to data decompression which is the main
   feature of the module.

 - hopefully improve robustness and resiliency of the geom_uzip(4) by
   performing some of the data validation / range checking on the TOC
   entries and rejecting to attach to an image if those checks fail.

 - merge in all relevant LZMA decompression support from the
   geom_uncompress(4), enable automatically when appropriate format is
   indicated in the header.

 - move compilation work into its own worker thread so that it does not
   clog g_up. This allows multiple instances work in parallel utilizing
   smp cores.

 - document new knobs in the manual page.

Reviewed by: adrian
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D5333

8 years agoSilence PVS-Studio warning (V595). It can never be NULL here.
jkim [Tue, 23 Feb 2016 23:57:24 +0000 (23:57 +0000)]
Silence PVS-Studio warning (V595).  It can never be NULL here.

8 years agoFix build after r295934.
bdrewery [Tue, 23 Feb 2016 23:37:10 +0000 (23:37 +0000)]
Fix build after r295934.

8 years agoSilence PVS-Studio warning (V595).
jkim [Tue, 23 Feb 2016 23:09:45 +0000 (23:09 +0000)]
Silence PVS-Studio warning (V595).

8 years agoSilence PVS-Studio warning (V595).
jkim [Tue, 23 Feb 2016 22:55:44 +0000 (22:55 +0000)]
Silence PVS-Studio warning (V595).

8 years agoRemove brightness notify handler before reinstalling new one.
jkim [Tue, 23 Feb 2016 22:50:45 +0000 (22:50 +0000)]
Remove brightness notify handler before reinstalling new one.

8 years agosh: Fix set -v and multiline history after r295825.
jilles [Tue, 23 Feb 2016 22:44:01 +0000 (22:44 +0000)]
sh: Fix set -v and multiline history after r295825.

r295825 erroneously dropped the newline from the input data for 'set -v'
output and multiline history.

Reported by: vangyzen

8 years agoFix white spaces.
jkim [Tue, 23 Feb 2016 22:30:45 +0000 (22:30 +0000)]
Fix white spaces.

8 years agoFix style(9) bugs.
jkim [Tue, 23 Feb 2016 22:22:15 +0000 (22:22 +0000)]
Fix style(9) bugs.

8 years agoAccording to the sys/kern/capabilities.conf, gethostid(3) should be allowed.
oshogbo [Tue, 23 Feb 2016 22:02:25 +0000 (22:02 +0000)]
According to the sys/kern/capabilities.conf, gethostid(3) should be allowed.

Pointed out by: Milosz Kaniewski <m.kaniewski@wheelsystems.com>
Approved by: pjd (mentor)
MFC after: 3 days
Sponsored by: Wheel Systems, http://wheelsystems.com

8 years agoFix build after r29592.
bdrewery [Tue, 23 Feb 2016 21:21:47 +0000 (21:21 +0000)]
Fix build after r29592.

8 years agonet80211: fix TIM cleanup.
avos [Tue, 23 Feb 2016 21:11:42 +0000 (21:11 +0000)]
net80211: fix TIM cleanup.

Remove duplicate 'ni->ni_associd = 0' assignment from
ieee80211_node_leave(), since it breaks iv_set_tim() in
ic->ic_node_cleanup() (associd is cleared right after this call).

Tested with RTL8188EU (HOSTAP mode) and
WUSB54GC (STA mode, with powersaving enabled).

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D5398

8 years agoAdd handling for non-native error values to libsysdecode.
jhb [Tue, 23 Feb 2016 20:00:55 +0000 (20:00 +0000)]
Add handling for non-native error values to libsysdecode.

Add two new functions, sysdecode_abi_to_freebsd_errno() and
sysdecode_freebsd_to_abi_errno(), which convert errno values between
the native FreeBSD ABI and other supported ABIs. Note that the
mappings are not necessarily perfect meaning in some cases multiple
errors in one ABI might map to a single error in another ABI. In that
case, the reverse mapping will return one of the errors that maps, but
which error is non-deterministic.

Change truss to always report the raw error value to the user but
use libsysdecode to map it to a native errno value that can be used
with strerror() to generate a description. Previously truss reported
the "converted" error value. Now the user will always see the exact
error value that the application sees.

Change kdump to report the truly raw error value to the user. Previously
kdump would report the absolute value of the raw error value (so for
Linux binaries it didn't output the FreeBSD error value, but the positive
value of the Linux error). Now it reports the real (i.e. negative) error
value for Linux binaries. Also, use libsysdecode to convert the native
FreeBSD error reported in the ktrace record to the raw error used by the
ABI. This means that the Linux ABI can now be handled directly in
ktrsysret() and removes the need for linux_ktrsysret().

Reviewed by: bdrewery, kib
Helpful notes: wblock (manpage)
Differential Revision: https://reviews.freebsd.org/D5314

8 years agoAdd support for displaying thread IDs to truss(1).
jhb [Tue, 23 Feb 2016 19:56:29 +0000 (19:56 +0000)]
Add support for displaying thread IDs to truss(1).

- Consolidate duplicate code for printing the metadata at the start of
  each line into a shared function.
- Add an -H option which will log the thread ID of the relevant thread
  for each event.

While here, remove some extraneous calls to clock_gettime() in
print_syscall() and print_syscall_ret().  The caller of print_syscall_ret()
always updates the current thread's "after" time before it is called.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D5363

8 years agoDon't leak an address in an error path.
tuexen [Tue, 23 Feb 2016 18:50:34 +0000 (18:50 +0000)]
Don't leak an address in an error path.

CID: 1351729
MFC after: 3 days

8 years agoConfigure the correct bMaxPacketSize for control endpoints before
hselasky [Tue, 23 Feb 2016 18:17:01 +0000 (18:17 +0000)]
Configure the correct bMaxPacketSize for control endpoints before
requesting the initial complete device descriptor and not as part of
the subsequent babble error recovery. Babble means that the received
USB packet was bigger than than configured maximum packet size. This
only affects enumeration of FULL speed USB devices which use a
bMaxPacketSize different from 8 bytes. This patch might help fix
enumeration of USB devices which exhibit USB I/O errors in dmesg
during boot.

MFC after: 1 week

8 years agoThis fixes the fastpath code to have a better module initialization sequence when
rrs [Tue, 23 Feb 2016 17:53:39 +0000 (17:53 +0000)]
This fixes the fastpath code to have a better module initialization sequence when
included in loader.conf. It also fixes it so that no matter if some one incorrectly
specifies a load order, the lists and such will be initialized on demand at that
time so no one can make that mistake.

Reviewed by: hiren
Differential Revision: D5189

8 years agoFollowing revision r295924, the changes to a db file should be fsynced
dwmalone [Tue, 23 Feb 2016 15:28:13 +0000 (15:28 +0000)]
Following revision r295924, the changes to a db file should be fsynced
before the file is closed. Consequently, it shouldn't be necessary to
open the file with O_SYNC any more.

This improves the performance of building large .db files for large
password files a lot and should resolve this problem:

https://forums.freebsd.org/threads/10-2-pre-pwd_mkdb-slow-on-larger-master-passwd.52700/

Differential Revision: https://reviews.freebsd.org/D5186
Reviewed by: garga, vangyzen, bapt, se
MFC after: 1 week

8 years agoIf we close or sync a hash-based db file, make sure to call fsync to
dwmalone [Tue, 23 Feb 2016 15:21:13 +0000 (15:21 +0000)]
If we close or sync a hash-based db file, make sure to call fsync to
make sure the changes are on disk. The people at pfSense noticed that
it didn't always make it to the disk soon enough with soft updates.

Differential Revision: https://reviews.freebsd.org/D5186
Reviewed by: garga, vangyzen, bapt, se
MFC after: 1 week

8 years agoBe more verbose when truncating number of HID items.
hselasky [Tue, 23 Feb 2016 14:58:20 +0000 (14:58 +0000)]
Be more verbose when truncating number of HID items.

Suggested by: Larry Rosenman <ler@lerctr.org>
MFC after: 1 week

8 years agoSet a dependencies for stack(9) RISC-V MD part.
br [Tue, 23 Feb 2016 14:29:22 +0000 (14:29 +0000)]
Set a dependencies for stack(9) RISC-V MD part.

Pointed out by: andrew

8 years agoo Grab physical memory regions information from the device tree.
br [Tue, 23 Feb 2016 14:21:46 +0000 (14:21 +0000)]
o Grab physical memory regions information from the device tree.
o Increase memory size.

8 years agoRemove redundant __ARM_ARCH >= 6 check in armv6 specific files.
skra [Tue, 23 Feb 2016 10:12:50 +0000 (10:12 +0000)]
Remove redundant __ARM_ARCH >= 6 check in armv6 specific files.