]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoSome random code cleaning.
mav [Sun, 25 Dec 2016 20:17:15 +0000 (20:17 +0000)]
Some random code cleaning.

 - Reduce indentation.
 - Remove extra braces.
 - Add few missing savety checks.

MFC after: 2 weeks

7 years agoSome optimizations for kqueue timers.
kib [Sun, 25 Dec 2016 19:49:35 +0000 (19:49 +0000)]
Some optimizations for kqueue timers.

There is no need to do two allocations per kqueue timer. Gather all
data needed by the timer callout into the structure and allocate it at
once.

Use the structure to preserve the result of timer2sbintime(), to not
perform repeated 64bit calculations in callout.

Remove tautological casts.
Remove now unused p_nexttime [1].

Noted by: markj [1]
Reviewed by: markj (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-MFC note: do not remove p_nexttime
Differential revision: https://reviews.freebsd.org/D8901

7 years agoImprove LinuxKPI device support. Only delete own BSD devices and not
hselasky [Sun, 25 Dec 2016 19:49:09 +0000 (19:49 +0000)]
Improve LinuxKPI device support. Only delete own BSD devices and not
the ones obtained through devclass_get_device(). Some minor code
cleanups while at it.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoSome style.
kib [Sun, 25 Dec 2016 19:38:07 +0000 (19:38 +0000)]
Some style.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D8901

7 years agoRemove a KASSERT which is not always true.
tuexen [Sun, 25 Dec 2016 17:37:18 +0000 (17:37 +0000)]
Remove a KASSERT which is not always true.

In case of the empty queue tp->snd_holes and tcp_sackhole_insert()
failing due to memory shortage, tp->snd_holes will be empty.
This problem was hit when stress tests where performed by pho.

PR: 215513
Reported by: pho
Tested by: pho
Sponsored by: Netflix, Inc.

7 years agoFix build of lib32 libraries for amd64 and powerpc64 with cross toolchain
bapt [Sun, 25 Dec 2016 15:39:52 +0000 (15:39 +0000)]
Fix build of lib32 libraries for amd64 and powerpc64 with cross toolchain

7 years agoRemove CTL_MAX_LUNS from places where it is not required.
mav [Sun, 25 Dec 2016 13:34:02 +0000 (13:34 +0000)]
Remove CTL_MAX_LUNS from places where it is not required.

MFC after: 2 weeks

7 years agoImprove third-party copy error reporting.
mav [Sun, 25 Dec 2016 09:40:44 +0000 (09:40 +0000)]
Improve third-party copy error reporting.

For EXTENDED COPY:
 - improve parameters checking to report some errors before copy start;
 - forward sense data from copy target as descriptor in case of error;
 - report which CSCD reported error in sense key specific information.
For WRITE USING TOKEN:
 - pass through real sense data from copy target instead of reporting
our copy error, since for initiator its a "simple" write, not a copy.

MFC after: 2 weeks

7 years agoImprove IP address list representation in libxo output.
jamie [Sat, 24 Dec 2016 23:51:27 +0000 (23:51 +0000)]
Improve IP address list representation in libxo output.

Extract decision-making about special-case printing of certain
jail parameters into a function.

Refactor emitting of IPv4 and IPv6 address lists into a function.

Resulting user-facing changes:

XO_VERSION is bumped to 2.

In verbose mode (-v), IPv4 and IPv6-Addresses are now properly emitted
as separate lists.
This only affects the output in encoding styles, i.e. xml and json.

{                                    {
  "__version": "1",                    "__version": "2",
  "jail-information": {                "jail-information": {
    "jail": [                            "jail": [
      {                                    {
        "jid": 166,                          "jid": 166,
        "hostname": "foo.com",               "hostname": "foo.com",
        "path": "/var/jail/foo",             "path": "/var/jail/foo",
        "name": "foo",                       "name": "foo",
        "state": "ACTIVE",                   "state": "ACTIVE",
        "cpusetid": 2,                       "cpusetid": 2,
        "ipv4_addrs": [                      "ipv4_addrs": [
          "10.1.1.1",                          "10.1.1.1",
          "10.1.1.2",                          "10.1.1.2",
          "10.1.1.3",              |           "10.1.1.3"
                                   >         ],
                                   >         "ipv6_addrs": [
          "fe80::1000:1",                      "fe80::1000:1",
          "fe80::1000:2"                       "fe80::1000:2"
        ]                                    ]
      }                                    }
    ]                                    ]
  }                                    }
}                                    }

In -n mode, ip4.addr and ip6.addr are formatted in the encoding styles'
native list types, e.g. instead of comma-separated lists, JSON arrays
are printed.

jls -n all --libxo json
 ...
 "ip4.addr": [
    "10.1.1.1",
    "10.1.1.2",
    "10.1.1.3"
  ],
  "ip4.saddrsel": true,
  "ip6.addr": [
    "fe80::1000:1",
    "fe80::1000:2"
  ],
  ...

jls -n all --libxo xml
  ...
  <ip4.addr>10.1.1.1</ip4.addr>
  <ip4.addr>10.1.1.2</ip4.addr>
  <ip4.addr>10.1.1.3</ip4.addr>
  <ip4.saddrsel>true</ip4.saddrsel>
  <ip6.addr>fe80::1000:1</ip6.addr>
  <ip6.addr>fe80::1000:2</ip6.addr>
  ...

PR: 215008
Submitted by: Christian Schwarz <me@cschwarz.com>
Differential Revision: https://reviews.freebsd.org/D8766

7 years agonet80211: fix 'pending CAC -> RUN transition lost' bug.
avos [Sat, 24 Dec 2016 23:43:14 +0000 (23:43 +0000)]
net80211: fix 'pending CAC -> RUN transition lost' bug.

Ensure that CAC -> RUN state transition will be requested
for every vap only once.

7 years ago- Fix -N flag (NoBind) for AF_LOCAL sockets.
hrs [Sat, 24 Dec 2016 23:29:50 +0000 (23:29 +0000)]
- Fix -N flag (NoBind) for AF_LOCAL sockets.
- Do setsockopt(SO_RCVBUF) for AF_LOCAL sockets regardless of -s flag.

7 years agoFix gcc build.
hrs [Sat, 24 Dec 2016 22:51:02 +0000 (22:51 +0000)]
Fix gcc build.

Spotted by: lidl

7 years agoImprove length handling when writing sense data.
mav [Sat, 24 Dec 2016 17:42:34 +0000 (17:42 +0000)]
Improve length handling when writing sense data.

 - Allow maximal sense size limitation via Control Extension mode page.
 - When sense size limited, include descriptors atomically: whole or none.
 - Set new SDAT_OVFL bit if some descriptors don't fit the limit.
 - Report real written sense length instead of static maximal 252 bytes.

MFC after: 2 weeks

7 years agoUnbreak syslogd after r310494
ngie [Sat, 24 Dec 2016 12:50:17 +0000 (12:50 +0000)]
Unbreak syslogd after r310494

Don't close all file descriptors greater than STDERR_FILENO (2) in
waitdaemon(..) -- only close fd (file descriptor for /dev/null used in
subsequent calls to dup2) if it's greater than STDERR_FILENO.

Reported by: subbsd@gmail.com, danny@cs.huji.ac.il
Pointyhat to: hrs
X-MFC with: r310494

7 years agostyle(9): delete stray trailing whitespace after break statement
ngie [Sat, 24 Dec 2016 11:49:25 +0000 (11:49 +0000)]
style(9): delete stray trailing whitespace after break statement

MFC after: 3 days

7 years agoBe more strict about IpAddress type in snmp_value_parse(..)
ngie [Sat, 24 Dec 2016 11:41:16 +0000 (11:41 +0000)]
Be more strict about IpAddress type in snmp_value_parse(..)

- Use inet_pton with AF_INET instead of doing longhand with sscanf.
- Use gethostbyname2 with AF_INET to ensure that the hostname isn't
  accidentally parsed with another address family, e.g. AF_INET6.

NB: IpAddress per RFC-2578 is IPv4 only. Work is in progress to add
    the InetAddress type and friends documented in RFC-4001 and
    elsewhere (which supports IPv4, IPv6, and more).

MFC after: 2 weeks

7 years agoMinor style(9) fixes
ngie [Sat, 24 Dec 2016 11:30:24 +0000 (11:30 +0000)]
Minor style(9) fixes

- Trailing whitespace cleanup
- Sort variables in snmp_dialog(..) by alignment

No functional change

MFC after: 1 week

7 years agoSort #includes
ngie [Sat, 24 Dec 2016 11:26:55 +0000 (11:26 +0000)]
Sort #includes

No functional change

MFC after: 3 days

7 years agoAllow SNMPv3 authNoPriv and noAuthNoPriv protocols to discover snmpEngineTime
ngie [Sat, 24 Dec 2016 11:23:18 +0000 (11:23 +0000)]
Allow SNMPv3 authNoPriv and noAuthNoPriv protocols to discover snmpEngineTime
as discussed in RFC-5343

This fixes interoperability with net-snmp.

Tested with the following invocations of snmpwalk (from net-snmp):

- noAuthNoPriv:

  % snmpwalk -v 3 -n '' -u public localhost snmpEngineTime

- authNoPriv:

  % snmpwalk -v 3 -n '' -u bsnmp -A bsnmptest -l authNoPriv -a sha localhost \
    localhost snmpEngineTime

- authPriv:

  % snmpwalk -v 3 -n '' -u bsnmp -A bsnmptest -l authPriv -a sha -x des \
    -X bsnmptest localhost snmpEngineTime

MFC after: 1 week
Obtained from: Isilon OneFS (5ec6d772cacbc, with minor tweaks)
Submitted by: Austin Voecks <austin.voecks@isilon.com>
Sponsored by: Dell EMC Isilon

7 years agoWarning message cleanup
ngie [Sat, 24 Dec 2016 11:22:28 +0000 (11:22 +0000)]
Warning message cleanup

- Use warn instead of warnx + strerror(errno)
- Remove unnecessary trailing newline from a warnx call
- Add missing spaces following "," in syslog and warn* calls

MFC after: 2 weeks

7 years agoFix argument type and microoptimize swp_pager_meta_free().
kib [Sat, 24 Dec 2016 09:57:31 +0000 (09:57 +0000)]
Fix argument type and microoptimize swp_pager_meta_free().

The count argument natural type if vm_pindex_t, but due to the loop
organization, it has to be signed type to detect the termination
condition.  Replace this logic by using distinguished counter for the
processed pages, and terminate loop when the counter exceeds the
argument.

Completely process one swblock for all relevant indexes instead of
doing relookup in hash when incrementing page index on the loop step.

Do not drop hash mutex around iterations.

Noted and reviewed by: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years ago- Remove unused code.
hrs [Sat, 24 Dec 2016 07:13:33 +0000 (07:13 +0000)]
- Remove unused code.
- Use closefrom().

7 years agoAdd driver for JZ4780 RTC device.
kan [Sat, 24 Dec 2016 02:31:26 +0000 (02:31 +0000)]
Add driver for JZ4780 RTC device.

Only support basic timekeeping for now.

7 years ago[spigen] Fix spigen attaching as a driver for SPI devices nodes in FDT
gonzo [Sat, 24 Dec 2016 00:30:29 +0000 (00:30 +0000)]
[spigen] Fix spigen attaching as a driver for SPI devices nodes in FDT

Return BUS_PROBE_NOWILDCARD in probe method to make sure that spigen
attaches only to the device created in identify method.

Before this change spigen probe method used to return 0 which meant it
competed with other drivers to be attached to the devices created for
child nodes of SPI bus node in FDT.

Reported by: Daniel Braniss
MFC after: 1 week

7 years agoFix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors.
rmacklem [Fri, 23 Dec 2016 23:14:53 +0000 (23:14 +0000)]
Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors.

For most NFSv4.1 servers, a NFS4ERR_BAD_SESSION error is a rare failure
that indicates that the server has lost session/open/lock state.
However, recent testing by cperciva@ against the AmazonEFS server found
several problems with client recovery from this due to it generating this
failure frequently.
Briefly, the problems fixed are:
- If all session slots were in use at the time of the failure, some processes
  would continue to loop waiting for a slot on the old session forever.
- If an RPC that doesn't use open/lock state failed with NFS4ERR_BAD_SESSION,
  it would fail the RPC/syscall instead of initiating recovery and then
  looping to retry the RPC.
- If a successful reply to an RPC for an old session wasn't processed
  until after a new session was created for a NFS4ERR_BAD_SESSION error,
  it would erroneously update the new session and corrupt it.
- The use of the first element of the session list in the nfs mount
  structure (which is always the current metadata session) was slightly
  racey. With changes for the above problems it became more racey, so all
  uses of this head pointer was wrapped with a NFSLOCKMNT()/NFSUNLOCKMNT().
- Although the kernel malloc() usually allocates more bytes than requested
  and, as such, this wouldn't have caused problems, the allocation of a
  session structure was 1 byte smaller than it should have been.
  (Null termination byte for the string not included in byte count.)

There are probably still problems with a pNFS data server that fails
with NFS4ERR_BAD_SESSION, but I have no server that does this to test
against (the AmazonEFS server doesn't do pNFS), so I can't fix these yet.

Although this patch is fairly large, it should only affect the handling
of NFS4ERR_BAD_SESSION error replies from an NFSv4.1 server.
Thanks go to cperciva@ for the extension testing he did to help isolate/fix
these problems.

Reported by: cperciva
Tested by: cperciva
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D8745

7 years agoImplement printing forwarded sense data.
mav [Fri, 23 Dec 2016 21:56:08 +0000 (21:56 +0000)]
Implement printing forwarded sense data.

MFC after: 2 weeks

7 years agomlx(4): remove date from log message
emaste [Fri, 23 Dec 2016 20:14:05 +0000 (20:14 +0000)]
mlx(4): remove date from log message

Further to r310425, go one step further and just remove the date.

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

7 years agoPass memattrs to fb device so that user mappings can inherit them
kan [Fri, 23 Dec 2016 19:30:14 +0000 (19:30 +0000)]
Pass memattrs to fb device so that user mappings can inherit them

Reviewed by: jmcneill

7 years agoMove the objects used to create temporary mappings for i386 pmap zero and copy
jah [Fri, 23 Dec 2016 15:14:56 +0000 (15:14 +0000)]
Move the objects used to create temporary mappings for i386 pmap zero and copy
operations to the MD PCPU region.  Change sysmap initialization to only
allocate KVA pages for CPUs that are actually present.  As a minor
optimization, this also prevents false sharing between adjacent sysmap objects
since the pcpu struct is already cacheline-aligned.

While here, move pc_qmap_addr initialization for the BSP into
pmap_bootstrap(), which allows use of pmap_quick* functions during early boot.

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

7 years agoAdd place-holders for TAPE STREAM MIRRORING subcommands of XCOPY.
mav [Fri, 23 Dec 2016 14:54:40 +0000 (14:54 +0000)]
Add place-holders for TAPE STREAM MIRRORING subcommands of XCOPY.

We do not support tapes, so this is only a comments.

MFC after: 2 weeks

7 years agoProvide some guidance when dealing with sections and variables contained
ngie [Fri, 23 Dec 2016 08:59:23 +0000 (08:59 +0000)]
Provide some guidance when dealing with sections and variables contained
within them

For example, using variables designated for %usm requires uncommenting
%usm section header

MFC after: 1 month

7 years agoDon't hardcode $(securityModelUSM) (3) in the authPriv example under the %vacm
ngie [Fri, 23 Dec 2016 08:54:44 +0000 (08:54 +0000)]
Don't hardcode $(securityModelUSM) (3) in the authPriv example under the %vacm
section

MFC after: 1 week

7 years agohyperv/ic: Allow applying the samples from hypervisor unconditionally.
sephe [Fri, 23 Dec 2016 08:52:10 +0000 (08:52 +0000)]
hyperv/ic: Allow applying the samples from hypervisor unconditionally.

MFC after: 1 week
Sponsored by: Microsoft

7 years agohyperv/ic: Fix version4 timesync message format.
sephe [Fri, 23 Dec 2016 08:41:28 +0000 (08:41 +0000)]
hyperv/ic: Fix version4 timesync message format.

It is not compat w/ the old timesync message format, which the message
type stays the same as the old timesync message.

MFC after: 1 week
Sponsored by: Microsoft

7 years agoSort #includes per style(9)
ngie [Fri, 23 Dec 2016 07:55:13 +0000 (07:55 +0000)]
Sort #includes per style(9)

No functional change

MFC after: 3 days

7 years agoGroup all loadable modules in the %default section
ngie [Fri, 23 Dec 2016 06:56:48 +0000 (06:56 +0000)]
Group all loadable modules in the %default section

This will allow new users to uncomment the modules and have things work
with less head scratching, in the event they decide to uncomment any
of the section separators, e.g. %usm or %vcm, as the module loading is
only effective in the %default section.

MFC after: 1 week

7 years agoClean up trailing whitespace
ngie [Fri, 23 Dec 2016 06:35:18 +0000 (06:35 +0000)]
Clean up trailing whitespace

No functional change

MFC after: 3 days

7 years ago- More ifdef INET and INET6.
hrs [Fri, 23 Dec 2016 06:29:24 +0000 (06:29 +0000)]
- More ifdef INET and INET6.
- Use STDERR_FILENO + 1 instead of "3".
- Fix dprintf() in cvthname().

7 years agoClarify failure in snmp_output(..) with call to snmp_pdu_decode
ngie [Fri, 23 Dec 2016 05:07:28 +0000 (05:07 +0000)]
Clarify failure in snmp_output(..) with call to snmp_pdu_decode

- Explicitly test snmp_pdu_encode against SNMP_CODE_OK instead of assuming
  any non-zero value is bad.
- Print out the code before calling abort() to give the end-user something
  actionable to debug without having to recompile the binary, since the
  core might not have these details.

MFC after: 1 week

7 years agoAdd a comment explaining the race fixed by r310423.
markj [Fri, 23 Dec 2016 05:02:17 +0000 (05:02 +0000)]
Add a comment explaining the race fixed by r310423.

Suggested and reviewed by: jhb
X-MFC With: r310423

7 years agomdoc and style fixes.
hrs [Fri, 23 Dec 2016 04:59:22 +0000 (04:59 +0000)]
mdoc and style fixes.

7 years agomdoc fixes.
hrs [Fri, 23 Dec 2016 04:38:27 +0000 (04:38 +0000)]
mdoc fixes.

7 years agoTeach DDB how to unwind across a kernel stack overflow.
jhb [Fri, 23 Dec 2016 03:27:11 +0000 (03:27 +0000)]
Teach DDB how to unwind across a kernel stack overflow.

Kernel stack overflows in MIPS call panic() directly from an assembly
handler after storing the interrupted context's registers in a
trapframe.  Rather than inferring the location of ra, sp, and pc from
the instruction stream, recognize the pc of a kernel stack overflow
and pull the registers from the trapframe.

Sponsored by: DARPA / AFRL

7 years agoMFamd64: Various fixes for MIPS minidumps.
jhb [Fri, 23 Dec 2016 03:20:34 +0000 (03:20 +0000)]
MFamd64: Various fixes for MIPS minidumps.

- Honor PG_NODUMP by not dumping pages with this flag set.
- Pat the watchdog during dumps to avoid a watchdog reset while writing
  out a dump.
- Reformat the output during a dump to update every 10% done rather than
  every 2MB dumped.
- Include UMA small pages and pages holding PV entries in minidumps.

Sponsored by: DARPA / AFRL

7 years agoUpdate meta* from bmake-20161212
sjg [Fri, 23 Dec 2016 02:57:00 +0000 (02:57 +0000)]
Update meta* from bmake-20161212

7 years ago[net80211] WEP offload support.
adrian [Thu, 22 Dec 2016 23:59:53 +0000 (23:59 +0000)]
[net80211] WEP offload support.

Yes, the ath10k NIC actually also does do WEP TX/RX offload.

Tested:

* ath10k driver port, WEP STA mode.

7 years ago- Add -S option to specify the source address/port for UDP communication.
hrs [Thu, 22 Dec 2016 23:39:11 +0000 (23:39 +0000)]
- Add -S option to specify the source address/port for UDP communication.
- Document -S option.
- Document that -h option supports AF_LOCAL.
- Split preparation of UDP sockets in logmessage() into socksetup().

7 years agoRevert r310138
ngie [Thu, 22 Dec 2016 22:30:42 +0000 (22:30 +0000)]
Revert r310138

Adding %b support to vfprintf for parity with kernel space requires
more discussion/review.

In particular, many parties were concerned over introducing a
non-standard format qualifier to *printf(3) which didn't already
exist in other OSes, e.g. Linux, thus making code which used %b
harder to port to other operating systems.

Requested by: many

7 years agoUse ${.OBJDIR} to refer to the kernel build object dir, instead of trying
ian [Thu, 22 Dec 2016 21:11:42 +0000 (21:11 +0000)]
Use ${.OBJDIR} to refer to the kernel build object dir, instead of trying
to recreate it from ${MAKEOBJDIRPREFIX} and ${SRC_BASE} and ${KERNCONF},
the latter being especially problematic when KERNCONF is set to the names
of multiple kernel configs.

7 years ago[rsu] convert rsu to use the ieee80211_rx_stats struct to pass up RSSI, PHY and rate...
adrian [Thu, 22 Dec 2016 21:01:56 +0000 (21:01 +0000)]
[rsu] convert rsu to use the ieee80211_rx_stats struct to pass up RSSI, PHY and rate information.

I don't yet know which RX descriptor bits map to shortgi, long-gi,
short-preamble, long-preamble, STBC, LDPC, HT40, etc - so I can't
easily add those just yet.

There's apparently no per-frame RX RSSI information exposed so we
also just use the results from the previous calibration task.

This also tidies up how the per-mbuf RSSI is pushed into the frame -
now that it's attached to the mbuf via rx_stats, we don't have to
do any silly hijinx to get it out of the frame processing path.

Tested:

* RTL8712, 1x1 cut 3, STA mode

7 years agoFix dump_avail[] for MALTA platforms to include the kernel.
jhb [Thu, 22 Dec 2016 20:28:06 +0000 (20:28 +0000)]
Fix dump_avail[] for MALTA platforms to include the kernel.

dump_avail[] is supposed to be a superset of phys_avail[] that
describes all of the memory ranges that should be included in a full
dump.  minidumps don't consider pages described by dump_avail[] to be
valid and thus they are excluded via the is_dumpable() function.  Most
MIPS platforms (including MALTA) set dump_avail[] to be identical to
phys_avail[].  In particular, phys_avail[] doesn't include the kernel
itself, so pages for the kernel and it's global variables are not
considered dumpable and not included in the dump.  Fix this by setting
dump_avail[0] to the first memory address (0) rather than the end of
the kernel.

Several other MIPS platforms have the same bug, though I am only able
to test malta in qemu.  The correct fix is to set dump_avail[] to
describe RAM and in particular to not set dump_avail[0] to the end of
the kernel (kernel_kseg0_end).

Sponsored by: DARPA / AFRL

7 years agoIf you are going to be run individually to make a new timezone set
julian [Thu, 22 Dec 2016 18:30:29 +0000 (18:30 +0000)]
If you are going to be run individually to make a new timezone set
then ensure the destination directories exist.
Especially if you define OLDTIMEZONES because the mtree pass
doesn't do it for you.

MFC after: 1 week
Sponsored by: Panzura

7 years agomlx: avoid use of __DATE__ to make build reproducible
emaste [Thu, 22 Dec 2016 18:26:21 +0000 (18:26 +0000)]
mlx: avoid use of __DATE__ to make build reproducible

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

7 years agoReplace passive voice with active voice and other tweaks.
jhb [Thu, 22 Dec 2016 18:05:22 +0000 (18:05 +0000)]
Replace passive voice with active voice and other tweaks.

- Drop uses of 'will'.
- Replace 'to use' with active voice.
- Tidy language around interrupt types and clarify that INTx doesn't
  work on VFs.
- Drop leading articles from sysctl/tunable descriptions.
- Tweak the wording of several sysctl/tunable descriptions.

Submitted by: wblock (1, 2, 4)
Sponsored by: Chelsio Communications
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D8812

7 years agoRevert part of r300109.
markj [Thu, 22 Dec 2016 17:51:44 +0000 (17:51 +0000)]
Revert part of r300109.

The removal of TAILQ_FOREACH_SAFE introduced a small race: when the last
thread on a sleepqueue is awoken, it reclaims the sleepqueue and may begin
executing on a different CPU before sleepq_resume_thread() returns. This
leaves a window during which it may go back to sleep and incorrectly be
awoken again by the caller of sleepq_broadcast().

Reported and tested by: pho
MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agortld: Fix a couple of bugs around the unloading of ELF filters.
markj [Thu, 22 Dec 2016 17:44:27 +0000 (17:44 +0000)]
rtld: Fix a couple of bugs around the unloading of ELF filters.

- Pass the correct object to unload_filtees().
- Use a marker to restart iteration after unload_filtees() has returned.
  It calls dlclose() and may recursively remove entries from the global
  object list, so TAILQ_FOREACH_SAFE is not sufficient.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agortld: Ensure that dlopen() cannot obtain a reference on a doomed object.
markj [Thu, 22 Dec 2016 17:41:32 +0000 (17:41 +0000)]
rtld: Ensure that dlopen() cannot obtain a reference on a doomed object.

rtld drops the bind lock to call fini functions in an object prior to
unmapping it. The new "doomed" state flag prevents the acquisition of new
references for an object while the lock is dropped.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agortld: Fix a race between dl_iterate_phdr() and dlclose().
markj [Thu, 22 Dec 2016 17:37:39 +0000 (17:37 +0000)]
rtld: Fix a race between dl_iterate_phdr() and dlclose().

Add a transient reference count to ensure that the phdr argument to the
callback remains valid while the bind lock is dropped.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoxen: fix IPI setup with EARLY_AP_STARTUP
royger [Thu, 22 Dec 2016 16:09:44 +0000 (16:09 +0000)]
xen: fix IPI setup with EARLY_AP_STARTUP

Current Xen IPI setup functions require that the caller provide a device in
order to obtain the name of the interrupt from it. With early AP startup this
device is no longer available at the point where IPIs are bound, and a KASSERT
would trigger:

panic: NULL pcpu device_t
cpuid = 0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff82233a20
vpanic() at vpanic+0x186/frame 0xffffffff82233aa0
kassert_panic() at kassert_panic+0x126/frame 0xffffffff82233b10
xen_setup_cpus() at xen_setup_cpus+0x5b/frame 0xffffffff82233b50
mi_startup() at mi_startup+0x118/frame 0xffffffff82233b70
btext() at btext+0x2c

Fix this by no longer requiring the presence of a device in order to bind IPIs,
and simply use the "cpuX" format where X is the CPU identifier in order to
describe the interrupt.

Reported by:            sbruno, cperciva
Tested by:              sbruno
X-MFC-With:             r310177
Sponsored by:           Citrix Systems R&D

7 years agoAdd a dumpdev example to /boot/defaults/loader.conf
asomers [Thu, 22 Dec 2016 15:48:54 +0000 (15:48 +0000)]
Add a dumpdev example to /boot/defaults/loader.conf

Submitted by: rgrimes
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp

7 years agoAllwinner clk: factor M for mod clock is 4 bits, not 5
manu [Thu, 22 Dec 2016 15:01:06 +0000 (15:01 +0000)]
Allwinner clk: factor M for mod clock is 4 bits, not 5

MFC after: 1 week

7 years ago- Fix a use-after-free bug when dq_timeout == 1 and
hrs [Thu, 22 Dec 2016 13:46:17 +0000 (13:46 +0000)]
- Fix a use-after-free bug when dq_timeout == 1 and
  sending SIGTERM to the process failed.  It is an
  unusual situation but it can happen.
- Split deadq_remove() into deadq_remove() and
  deadq_removebypid().
- Normalize variable names of struct deadq_entry *.

7 years agoAdd support for REPD bit in RSTMF command.
mav [Thu, 22 Dec 2016 12:18:40 +0000 (12:18 +0000)]
Add support for REPD bit in RSTMF command.

We have no real timeout values to report there, but its better then error.

MFC after: 2 weeks

7 years agoFix REPORT SUPPORTED OPERATION CODES for READ/WRITE BUFFER commands.
mav [Thu, 22 Dec 2016 11:10:11 +0000 (11:10 +0000)]
Fix REPORT SUPPORTED OPERATION CODES for READ/WRITE BUFFER commands.

Specifications require MODE parameter of those commands to be treated
the same as SERVICE ACTION parameter of other commands.

MFC after: 2 weeks

7 years agoMake a read only pointer constant.
hselasky [Thu, 22 Dec 2016 10:12:19 +0000 (10:12 +0000)]
Make a read only pointer constant.

Sponsored by: Mellanox Technologies
MFC after: 1 week

7 years agoAdd more comments regarding collection of statistics counters.
hselasky [Thu, 22 Dec 2016 10:11:03 +0000 (10:11 +0000)]
Add more comments regarding collection of statistics counters.

Sponsored by: Mellanox Technologies
MFC after: 1 week

7 years agoAdd a missing "default:" case.
hrs [Thu, 22 Dec 2016 05:57:45 +0000 (05:57 +0000)]
Add a missing "default:" case.

7 years agoInitialize a structure by using a compound literal to avoid forgetting
hrs [Thu, 22 Dec 2016 05:55:44 +0000 (05:55 +0000)]
Initialize a structure by using a compound literal to avoid forgetting
to zero unspecified members.

7 years agoFix debug log in the case of AF_INET6.
hrs [Thu, 22 Dec 2016 05:28:30 +0000 (05:28 +0000)]
Fix debug log in the case of AF_INET6.

7 years ago- Simplify masklen->netmask conversion for AF_INET6.
hrs [Thu, 22 Dec 2016 05:23:38 +0000 (05:23 +0000)]
- Simplify masklen->netmask conversion for AF_INET6.
- Use iov[N] by array index instead of using pointer v = &iov[0] to
  make the compiler catch an out-of-range access of the array.

7 years agoConvert tunefs use to nmount(2)
brooks [Thu, 22 Dec 2016 00:35:12 +0000 (00:35 +0000)]
Convert tunefs use to nmount(2)

Reviewed by: jhb, emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8822

7 years agoow_temp: Update the temperature visible via the sysctl atomically, rather
gavin [Thu, 22 Dec 2016 00:09:53 +0000 (00:09 +0000)]
ow_temp: Update the temperature visible via the sysctl atomically, rather
than using it as temporary calculation space.

7 years agoow_temp: Correct typo in comment
gavin [Wed, 21 Dec 2016 23:54:12 +0000 (23:54 +0000)]
ow_temp: Correct typo in comment

7 years agoRemove assigned only variable.
glebius [Wed, 21 Dec 2016 22:47:10 +0000 (22:47 +0000)]
Remove assigned only variable.

7 years ago[iwn] Several fixes for DMA part of iwn(4)
gonzo [Wed, 21 Dec 2016 22:35:26 +0000 (22:35 +0000)]
[iwn] Several fixes for DMA part of iwn(4)

- Perform DMS sync when accessing/initializing ICT table
- Fix some DMA sync operations to use matching tags

Reviewed by: avos
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D8804

7 years agoAdd support for REPORTING OPTIONS == 3 in REPORT SUPPORTED OPERATION CODES.
mav [Wed, 21 Dec 2016 20:19:12 +0000 (20:19 +0000)]
Add support for REPORTING OPTIONS == 3 in REPORT SUPPORTED OPERATION CODES.

MFC after: 2 weeks

7 years agobhnd: remove srand() to ensure deterministic output
emaste [Wed, 21 Dec 2016 15:45:23 +0000 (15:45 +0000)]
bhnd: remove srand() to ensure deterministic output

r310342 fixed non-deterministic nvram_map_gen.awk output and thus a non-
reproducible bhnd(4) build by using a unique sort key.

Go one step further and also remove the srand() call. There's no reason
we want non-deterministic behaviour from this script.

PR: 215422
Reported by: gjb (non-reproducibility of bhnd)
Reported by: lidl (srand as the cause)
Reviewed by: landonf
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8857

7 years agopax(1): Fix a bug with archives smaller than 512 bytes.
pfg [Wed, 21 Dec 2016 15:26:59 +0000 (15:26 +0000)]
pax(1): Fix a bug with archives smaller than 512 bytes.

The problem here is that the archive is too short (< 512 bytes). The
buffer routines, try to read at least 512 bytes, even when we try to
determine what format file we have, which is wrong.

Obtained from: NetBSD (CVS rev 1.26)
MFC after: 5 days

7 years agoAdd support for SITUA bit in Logical Block Provisioning mode page.
mav [Wed, 21 Dec 2016 15:17:47 +0000 (15:17 +0000)]
Add support for SITUA bit in Logical Block Provisioning mode page.

VMware tries to enable this bit to avoid multiple threshold notifications
in case of multiple initiators connected to the same LUN.  Unfortunately
their code sends MODE SELECT(6) request with parameter length hardcoded
for the page without any thresholds.  Since we have four threshold and our
page is bigger, this attempt fails, that is correct in my understanding.
So all we can do about this now is to report proper error code and hope
VMware fix their code one day.

MFC after: 2 weeks

7 years agolibunwind: make __{de,}register_frame compatible with libgcc API
emaste [Wed, 21 Dec 2016 14:06:44 +0000 (14:06 +0000)]
libunwind: make __{de,}register_frame compatible with libgcc API

The libgcc __register_frame and __deregister_frame functions take a
pointer to a set of FDE/CIEs, terminated by an entry where length is 0.

In Apple's libunwind implementation the pointer is taken to be to a
single FDE. I suspect this was just an Apple bug, compensated by Apple-
specific code in LLVM.

See lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp and
http://lists.llvm.org/pipermail/llvm-dev/2013-April/061737.html
for more detail.

This change is based on the LLVM RTDyldMemoryManager.cpp. It should
later be changed to be alignment-safe.

Reported by: dim
Reviewed by: dim
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8869

7 years agoFix UUID formatting added in r310360. Oops!
mav [Wed, 21 Dec 2016 09:49:16 +0000 (09:49 +0000)]
Fix UUID formatting added in r310360.  Oops!

MFC after: 2 weeks

7 years agoReport UUID and MD5 LUN IDs.
mav [Wed, 21 Dec 2016 09:36:23 +0000 (09:36 +0000)]
Report UUID and MD5 LUN IDs.

MFC after: 2 weeks

7 years agoAdd support for locally assigned RFC 4122 UUID LUN identifiers.
mav [Wed, 21 Dec 2016 09:05:30 +0000 (09:05 +0000)]
Add support for locally assigned RFC 4122 UUID LUN identifiers.

MFC after: 2 weeks

7 years agoAdd an example inetd(8) entry for the Prometheus sysctl exporter.
ed [Wed, 21 Dec 2016 08:32:20 +0000 (08:32 +0000)]
Add an example inetd(8) entry for the Prometheus sysctl exporter.

I went through the process of allocating a default port number for this
exporter, TCP 9124. This means that we can add an entry to the services
file as well.

List of Prometheus default port numbers:
https://github.com/prometheus/prometheus/wiki/Default-port-allocations

7 years agoAdd a Prometheus exporter for sysctl values.
ed [Wed, 21 Dec 2016 08:29:44 +0000 (08:29 +0000)]
Add a Prometheus exporter for sysctl values.

Now that we have our sysctl tree annotated with aggregation labels,
let's go ahead and provide a very simple utility for exporting the
sysctl tree in Prometheus' format. It can either be used in conjunction
with the Prometheus node exporter or run through inetd(8).

The reason why I'm opting for having it in the base system is because it
has a pretty strong integration with some of sysctl's innards, such as
access to iterators, name lookups, metadata and type information. As I
am investigating whether we can add histograms as native types to sysctl
as well, this integration will only get stronger as we go along. That's
why it would be safer to oversee the development of this exporter
ourselves, as opposed to having it as an external project.

This exporter is remarkably compact, especially when compared to the
official Linux binary of the Prometheus node exporter (16 KB vs 12 MB).
I guess this could be an interesting aspect for monitoring embedded
FreeBSD-based systems.

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

7 years agoSimplify type casting of struct sockaddr_in.
hrs [Wed, 21 Dec 2016 07:05:34 +0000 (07:05 +0000)]
Simplify type casting of struct sockaddr_in.

7 years ago- Initialize deadq_head statically.
hrs [Wed, 21 Dec 2016 06:49:21 +0000 (06:49 +0000)]
- Initialize deadq_head statically.
- Fix indent.
- Add missing -S flag into usage().
- Use nitems() for an iov array instead of a macro.

7 years ago- Add fklog into struct socklist. Files and local/remote sockets are
hrs [Wed, 21 Dec 2016 06:42:30 +0000 (06:42 +0000)]
- Add fklog into struct socklist.  Files and local/remote sockets are
  now processed in struct socklist in a consistent manner.
- Add helper functions to add a new entry of struct socklist, filed, or peer.
- Use the same routine for -l, -p, and -S.
- Close /dev/klog when read(2) failed.

7 years ago- Use fnmatch(3) for domanname matching of -a options.
hrs [Wed, 21 Dec 2016 05:45:59 +0000 (05:45 +0000)]
- Use fnmatch(3) for domanname matching of -a options.
- Document the patten matching.
- Document -S flag in SYNOPSIS.

7 years agohyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhook
sephe [Wed, 21 Dec 2016 03:23:35 +0000 (03:23 +0000)]
hyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhook

Properly working pause and friends are required.

MFC after: 3 days
Sponsored by: Microsoft

7 years agohyperv/storvsc: The max channel in PDU actually means the max sub-chans.
sephe [Wed, 21 Dec 2016 03:09:07 +0000 (03:09 +0000)]
hyperv/storvsc: The max channel in PDU actually means the max sub-chans.

Use proper name for local variables. PDU fields' name was not changed yet.
While I'm here, make # of usable channels tunable. This eases further
testing.

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

7 years agoAdd amdmi3 to ports-secteam
feld [Wed, 21 Dec 2016 01:48:54 +0000 (01:48 +0000)]
Add amdmi3 to ports-secteam

Approved by: swills

7 years agobuild: Unbreak LINT
sephe [Wed, 21 Dec 2016 01:39:11 +0000 (01:39 +0000)]
build: Unbreak LINT

Sponsored by: Microsoft

7 years ago[iMX6] Fix SDMA driver build
gonzo [Wed, 21 Dec 2016 01:38:44 +0000 (01:38 +0000)]
[iMX6] Fix SDMA driver build

- Place const modifiers where required
- Make sure sdma device is attahched before consumers like SSI

Reviewed by: br
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D8874

7 years ago[iMX6] Fix build for SSI driver and add dependency for SDMA driver
gonzo [Wed, 21 Dec 2016 01:32:19 +0000 (01:32 +0000)]
[iMX6] Fix build for SSI driver and add dependency for SDMA driver

- Pass correct pointer to OF_getencprop
- Check the size of "dmas" property
- Add dependency on sdma driver

Reviewed by: br
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D8873

7 years agobhnd(4): Use a stable sort key to produce deterministic nvram_map_gen.awk
landonf [Wed, 21 Dec 2016 00:50:21 +0000 (00:50 +0000)]
bhnd(4): Use a stable sort key to produce deterministic nvram_map_gen.awk
output.

When ordering SROM layout entries, we now use the unique (var_id,
rev_start, rev_end) tuple as the sort key; this fixes the previously
non-deterministic output when sorting entries with overlapping var_ids.

PR: 215422
Reported by: emaste
Reviewed by: emaste
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D8859

7 years agoFollow-up to r310340: Add missing "Intel" to description
cem [Tue, 20 Dec 2016 22:47:09 +0000 (22:47 +0000)]
Follow-up to r310340: Add missing "Intel" to description

Reported by: rpokala@

7 years agoAdd Braswell PCI IDs for Intel Cherryview
cem [Tue, 20 Dec 2016 22:08:36 +0000 (22:08 +0000)]
Add Braswell PCI IDs for Intel Cherryview

Submitted by: Johannes Lundberg <yohanesu75 at gmail.com>
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D8861

7 years agoBump specifications support to SAM-6/SPC-5.
mav [Tue, 20 Dec 2016 21:58:43 +0000 (21:58 +0000)]
Bump specifications support to SAM-6/SPC-5.

7 years agoTurn on FC-Tape by default in the isp(4) driver.
ken [Tue, 20 Dec 2016 21:17:07 +0000 (21:17 +0000)]
Turn on FC-Tape by default in the isp(4) driver.

FC-Tape provides additional link level error recovery, and is
highly recommended for tape devices.  It will only be turned on for
a given target if the target supports it.

Without this setting, we default to whatever FC-Tape setting is in
NVRAM on the card.

This can be overridden by setting the following loader tunable, for
example for isp0:

hint.isp.0.nofctape=1

sys/conf/options:
Add a new kernel config option, ISP_FCTAPE_OFF, that
defaults the FC-Tape configuration to off.

sys/dev/isp/isp_pci.c:
If ISP_FCTAPE_OFF is defined, turn off FC-Tape.  Otherwise,
turn it on if the card supports it.

share/man/man4/isp.4:
Add a description of FC-Tape to the isp(4) man page.

Add descriptions of the fctape and nofctape options, as well as the
ISP_FCTAPE_OFF kernel configuration option.

Add the ispfw module and kernel drivers to the suggested
configurations at the top of the man page so that users are less
likely to leave it out.  The driver works well with the included
firmware, but may not work at all with whatever firmware the user
has flashed on their card.

MFC after: 3 days
Sponsored by: Spectra Logic