]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoFix 'ipfw delete set N':
oleg [Tue, 29 Nov 2016 10:43:58 +0000 (10:43 +0000)]
Fix 'ipfw delete set N':
do not emit meaningless 'rule 0 not found' warning if set was already empty.

MFC after: 1 week

7 years agoFix interrupt clear in pl011 uart receive function
jchandra [Tue, 29 Nov 2016 04:32:14 +0000 (04:32 +0000)]
Fix interrupt clear in pl011 uart receive function

Clear the interrupt state before reading the input char from the
input FIFO. In the current code there is a window between the read
to the data register and the write to the the ICR, during which an
input char will not cause an interrupt.

This fixes the issue by which the serial port input on QEMU freezes
when using the emulated pl011 serial port.

7 years agoUse the correct name for the GCC macro indicating max_align_t is defined.
jhb [Tue, 29 Nov 2016 00:16:19 +0000 (00:16 +0000)]
Use the correct name for the GCC macro indicating max_align_t is defined.

MFC after: 3 days

7 years agoTrying to autodetect legacy setups lead to problems when people
imp [Mon, 28 Nov 2016 21:29:01 +0000 (21:29 +0000)]
Trying to autodetect legacy setups lead to problems when people
overrode the disk image creation routine. For now, just always bring
in the legecy defines / routines.

7 years agoAdd a FREEBSD-Xlist file for CK.
cognet [Mon, 28 Nov 2016 21:16:03 +0000 (21:16 +0000)]
Add a FREEBSD-Xlist file for CK.

7 years agoUse malloc()ed buffers instead of stack buffers in gr_copy() and pw_copy().
des [Mon, 28 Nov 2016 21:00:19 +0000 (21:00 +0000)]
Use malloc()ed buffers instead of stack buffers in gr_copy() and pw_copy().
This allows pw(8) to operate on passwd and group files with longer lines
than could be accomodated by a stack buffer.  It doesn't take more than a
few hundred users to exceed 8192 bytes in /etc/group.

MFC after: 3 weeks
Sponsored by: The University of Oslo

7 years agoHook CK to the kernel build.
cognet [Mon, 28 Nov 2016 20:44:12 +0000 (20:44 +0000)]
Hook CK to the kernel build.

7 years agoAdd FreeBSD-specific files.
cognet [Mon, 28 Nov 2016 20:33:30 +0000 (20:33 +0000)]
Add FreeBSD-specific files.

7 years agoImport Concurrency Kit in the kernel.
cognet [Mon, 28 Nov 2016 20:27:58 +0000 (20:27 +0000)]
Import Concurrency Kit in the kernel.
CK is a toolkit providing different lockfree algorithms/data structures.
More information can be found here : www.concurrencykit.org

7 years agoRemove files that won't be used during FreeBSD build.
cognet [Mon, 28 Nov 2016 20:22:32 +0000 (20:22 +0000)]
Remove files that won't be used during FreeBSD build.

7 years agoFix packaging for clang, lldb and lld 3.9.0
dim [Mon, 28 Nov 2016 20:13:56 +0000 (20:13 +0000)]
Fix packaging for clang, lldb and lld 3.9.0

During the upgrade of clang/llvm etc to 3.9.0 in r309124, the PACKAGE
directive in the usr.bin/clang/*.mk files got dropped accidentally.

Restore it, with a few minor changes and additions:
* Correct license in clang.ucl to NCSA
* Add PACKAGE=clang for clang and most of the "ll" tools
* Put lldb in its own package
* Put lld in its own package

Reviewed by: gjb, jmallett
X-MFC-With: 309124
Differential Revision: https://reviews.freebsd.org/D8666

7 years agoImport concurrencykit as of commit 566bb28dba963a1904e0889b74fe7005a5bc5eb8
cognet [Mon, 28 Nov 2016 20:08:52 +0000 (20:08 +0000)]
Import concurrencykit as of commit 566bb28dba963a1904e0889b74fe7005a5bc5eb8

7 years agoRework ip_tryforward() to use FIB4 KPI.
ae [Mon, 28 Nov 2016 17:55:32 +0000 (17:55 +0000)]
Rework ip_tryforward() to use FIB4 KPI.

Tested by: olivier
Obtained from: Yandex LLC
MFC after: 1 month
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D8526

7 years ago[ath] force wake the hardware if we see a missed beacon.
adrian [Mon, 28 Nov 2016 17:54:29 +0000 (17:54 +0000)]
[ath] force wake the hardware if we see a missed beacon.

This adds a workaround to incorrectly behaving APs (ie, FreeBSD APs) which
don't beacon out exactly when they should (at TBTT multiples of beacon
intervals.)

It forces the hardware awake (but leaves it in network-sleep so self
generated frames still state that the hardware is asleep!) and will
remain awake until the next sleep transition driven by net80211.

That way if the beacons are just at the wrong interval, we get a much
better chance of hearing more consecutive beacons before we go to sleep,
thus not constantly disconnecting.

Tested:

* AR9485, STA mode, against a misbehaving FreeBSD AP.

7 years ago[ath] revert the previous commit, after reading the 802.11-2012 spec a bit more.
adrian [Mon, 28 Nov 2016 17:06:35 +0000 (17:06 +0000)]
[ath] revert the previous commit, after reading the 802.11-2012 spec a bit more.

The 802.11-2012 spec talks about this - section 10.1.3.2 - Beacon Generation
in Infrastructure Networks.  So yes, we should be expecting beacons to be
going out in multiples of intval.

Silly adrian.

So:

* fix the FreeBSD APs that are sending beacons at incorrect TBTTs (target
  beacon transmit time); and
* yes indeed we will have to wake up out of network sleep until we sync
  a beacon.

7 years agoAdd more ASMedia PCI IDs from different sources.
mav [Mon, 28 Nov 2016 16:25:05 +0000 (16:25 +0000)]
Add more ASMedia PCI IDs from different sources.

Exact device names are not clear, but its better then nothing at all.

MFC after: 1 month

7 years agoProcess port interrupt even is PxIS register is zero.
mav [Mon, 28 Nov 2016 16:23:32 +0000 (16:23 +0000)]
Process port interrupt even is PxIS register is zero.

ASMedia ASM1062 AHCI chips with some fancy firmware handling PMP inside
seems sometimes forgeting to set bits in PxIS, causing command timeouts.
Removal of this check fixes the issue by the theoretical cost of slightly
higher CPU usage in some odd cases, but this is what Linux does too.

MFC after: 1 month

7 years agoMFV r309249: 3821 Race in rollback, zil close, and zil flush
avg [Mon, 28 Nov 2016 15:14:31 +0000 (15:14 +0000)]
MFV r309249: 3821 Race in rollback, zil close, and zil flush

Note: there was a merge conflict resolved by me.

illumos/illumos-gate@43297f973a3543e7403ac27076490ab958a94b15
https://github.com/illumos/illumos-gate/commit/43297f973a3543e7403ac27076490ab958a94b15

https://www.illumos.org/issues/3821
  We recently had nodes with some of the latest zfs bits panic on us in a
  rollback-heavy environment. The following is from my preliminary analysis:
  Let's look at where we died:
  > $C
  ffffff01ea6b9a10 taskq_dispatch+0x3a(0, fffffffff7d20450ffffff5551dea920, 1)
  ffffff01ea6b9a60 zil_clean+0xce(ffffff4b7106c080, 7e0f1)
  ffffff01ea6b9aa0 dsl_pool_sync_done+0x47(ffffff4313065680, 7e0f1)
  ffffff01ea6b9b70 spa_sync+0x55f(ffffff4310c1d040, 7e0f1)
  ffffff01ea6b9c20 txg_sync_thread+0x20f(ffffff4313065680)
  ffffff01ea6b9c30 thread_start+8()
  If we dig in we can find that this dataset corresponds to a zone:
  > ffffff4b7106c080::print zilog_t zl_os->os_dsl_dataset->ds_dir->dd_myname
  zl_os->os_dsl_dataset->ds_dir->dd_myname = [ "8ffce16a-13c2-4efa-a233-
  9e378e89877b" ]
  Okay so we have a null taskq pointer. That only happens during the calls to
  zil_open and zil_close. If we poke around we can see that we're actually in
  midst of a rollback:
  > ::pgrep zfs | ::printf "0x%x %s\\n" proc_t . p_user.u_psargs
  0xffffff43262800a0 zfs rollback zones/15714eb6-f5ea-469f-ac6d-
  4b8ab06213c2@marlin_init
  0xffffff54e22a1028 zfs rollback zones/8ffce16a-13c2-4efa-a233-
  9e378e89877b@marlin_init
  0xffffff4362f3a058 zfs rollback zones/0ddb8e49-ca7e-42e1-8fdc-
  4ac4ba8fe9f8@marlin_init
  0xffffff5748e8d020 zfs rollback zones/426357b5-832d-4430-953e-
  10cd45ff8e9f@marlin_init
  0xffffff436b867008 zfs rollback zones/8f36bf37-8a9c-4a44-995c-
  6d1b2751e6f5@marlin_init
  0xffffff4381ad4090 zfs rollback zones/6c8eca18-fbd6-46dd-ac24-
  2ed45cd0da70@marlin_init

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: George Wilson <george.wilson@delphix.com>

MFC after: 3 weeks

7 years agoFix ISS_DATA_DFSC_MASK, it should include all bits in the field.
andrew [Mon, 28 Nov 2016 14:24:07 +0000 (14:24 +0000)]
Fix ISS_DATA_DFSC_MASK, it should include all bits in the field.

7 years ago[ath] wake up the hardware from power-save before doing transmit completion checking.
adrian [Mon, 28 Nov 2016 08:13:20 +0000 (08:13 +0000)]
[ath] wake up the hardware from power-save before doing transmit completion checking.

This was being done in the pre-AR9380 case, but not for AR9380 and later.
When powersave in STA mode is enabled, this may have lead to the transmit
completion code doing this:

* call the task, which doesn't wake up the hardware
* complete the frames, which doesn't touch the hardware
* schedule pending frames on the hardware queue, which DOES touch the
  hardware, and this will be ignored

This would show up in the logs like this:

(with debugging enabled):
Nov 27 23:03:56 lovelace kernel: Q1[  0] (nseg=1) (DS.V:0xfffffe011bd57300 DS.P:0x49b57300) I: 168cc117 L:00000000 F:0005
...
(in general, doesn't require debugging enabled):
Nov 27 23:03:56 lovelace kernel: ath_hal_reg_write: reg=0x00000804, val=0x49b57300, pm=2

That register is a EDMA TX FIFO register (queue 1), and the val is the descriptor
being written.

Whilst here, make sure the software queue gets kicked here.

Tested;

* AR9485, STA mode + powersave

7 years agohyperv/vmbus: Use poll/cancel APIs to wait for the CHOPEN response.
sephe [Mon, 28 Nov 2016 07:56:03 +0000 (07:56 +0000)]
hyperv/vmbus: Use poll/cancel APIs to wait for the CHOPEN response.

Since hypervisor does not respond CHOPEN to a revoked channel.

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

7 years agohyperv/vmbus: Add exec cancel support for message Hypercall API.
sephe [Mon, 28 Nov 2016 07:44:50 +0000 (07:44 +0000)]
hyperv/vmbus: Add exec cancel support for message Hypercall API.

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

7 years agoPlug another leak with malformed IPv6 address.
delphij [Mon, 28 Nov 2016 07:41:01 +0000 (07:41 +0000)]
Plug another leak with malformed IPv6 address.

MFC after: 2 weeks

7 years agohyperv/vmbus: Add result polling support for message Hypercall API.
sephe [Mon, 28 Nov 2016 07:36:51 +0000 (07:36 +0000)]
hyperv/vmbus: Add result polling support for message Hypercall API.

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

7 years agoDon't leak 'str' when we see a malformed IPv6 address.
delphij [Mon, 28 Nov 2016 07:33:26 +0000 (07:33 +0000)]
Don't leak 'str' when we see a malformed IPv6 address.

MFC after: 2 weeks

7 years agohyperv/vmbus: Add result polling support for xact API.
sephe [Mon, 28 Nov 2016 07:27:08 +0000 (07:27 +0000)]
hyperv/vmbus: Add result polling support for xact API.

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

7 years agostyle(9).
delphij [Mon, 28 Nov 2016 07:21:09 +0000 (07:21 +0000)]
style(9).

MFC after: 2 weeks

7 years agoPlug a potential memory leak.
delphij [Mon, 28 Nov 2016 07:19:45 +0000 (07:19 +0000)]
Plug a potential memory leak.

MFC after: 2 weeks

7 years agohyperv/vmbus: Stringent GPADL parameter assertion.
sephe [Mon, 28 Nov 2016 07:04:32 +0000 (07:04 +0000)]
hyperv/vmbus: Stringent GPADL parameter assertion.

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

7 years agohyperv/vmbus: Make sure that the allocated GPADL is not zero.
sephe [Mon, 28 Nov 2016 06:53:00 +0000 (06:53 +0000)]
hyperv/vmbus: Make sure that the allocated GPADL is not zero.

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

7 years agohyperv/hn: Simplify RSS indirect table fixup API
sephe [Mon, 28 Nov 2016 06:40:26 +0000 (06:40 +0000)]
hyperv/hn: Simplify RSS indirect table fixup API

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

7 years agopages and psize are always assigned, so there is no need to initialize
delphij [Mon, 28 Nov 2016 06:38:41 +0000 (06:38 +0000)]
pages and psize are always assigned, so there is no need to initialize
them as zero.

MFC after: 2 weeks

7 years agoEliminate variables that are computed, assigned but never
delphij [Mon, 28 Nov 2016 06:36:10 +0000 (06:36 +0000)]
Eliminate variables that are computed, assigned but never
used.

MFC after: 2 weeks

7 years agoFix an obvious typo.
delphij [Mon, 28 Nov 2016 06:32:05 +0000 (06:32 +0000)]
Fix an obvious typo.

MFC after: 2 weeks

7 years agohyperv/hn: Fix vmbus_chan_subidx usage.
sephe [Mon, 28 Nov 2016 06:10:41 +0000 (06:10 +0000)]
hyperv/hn: Fix vmbus_chan_subidx usage.

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

7 years agohyperv/hn: Enable multi-packet RNDIS message support by default.
sephe [Mon, 28 Nov 2016 05:54:20 +0000 (05:54 +0000)]
hyperv/hn: Enable multi-packet RNDIS message support by default.

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

7 years agohyperv/hn: Fix attach error handling
sephe [Mon, 28 Nov 2016 05:46:00 +0000 (05:46 +0000)]
hyperv/hn: Fix attach error handling

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

7 years agohyperv/hn: Fix multi-packet RNDIS message aggregation size setting.
sephe [Mon, 28 Nov 2016 05:31:36 +0000 (05:31 +0000)]
hyperv/hn: Fix multi-packet RNDIS message aggregation size setting.

Just in case that no chimney sending buffer can be used.

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

7 years agohyperv/hn: Fix detach error handling.
sephe [Mon, 28 Nov 2016 05:23:57 +0000 (05:23 +0000)]
hyperv/hn: Fix detach error handling.

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

7 years agohyperv/hn: Utilize vmbus_chan_xact_wait
sephe [Mon, 28 Nov 2016 05:15:28 +0000 (05:15 +0000)]
hyperv/hn: Utilize vmbus_chan_xact_wait

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

7 years agohyperv/vmbus: Add supportive transaction wait function.
sephe [Mon, 28 Nov 2016 05:07:48 +0000 (05:07 +0000)]
hyperv/vmbus: Add supportive transaction wait function.

This function supports channel revocation properly.

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

7 years agohyperv/vmbus: Zero out GPADL if error happens.
sephe [Mon, 28 Nov 2016 04:53:36 +0000 (04:53 +0000)]
hyperv/vmbus: Zero out GPADL if error happens.

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

7 years ago[ath] fix target beacon interval programming for STA mode when in powersave.
adrian [Mon, 28 Nov 2016 02:59:33 +0000 (02:59 +0000)]
[ath] fix target beacon interval programming for STA mode when in powersave.

This bug has been bugging me for quite some time.  I finally sat down
with enough coffee to figure it out.

The short of it - rounding up to the next intval multiple of the TSF value
only works if the AP is transmitting all its beacons on an interval of
the TSF.  If it isn't - for example, doing staggered beacons on a multi-VAP
setup with a single hardware TSF - then weird things occur.

The long of it -

When powersave is enabled, the MAC and PHY are partially powered off.
They can't receive any packets (or transmit, for that matter.)
The target beacon timer programming will wake up the MAC/PHY just before
the beacon is supposed to be received (well, strictly speaking, at DTIM
so it can see the TIM - traffic information map - telling the STA whether
any traffic is there for it) and it happens automatically.

However, this relies on the target beacon time being programmed correctly.
If it isn't then the hardware will wake up and not hear any beacons -
and then it'll be asleep for said beacons.  After enough of this, net80211
will give up and assume the AP went away.

This should fix both TSFOOR interrupts and disconnects from APs with powersave
enabled.

The annoying bit is that it only happens if APs stagger things or start
on a non-zero TSF.  So, this would sometimes be fine and sometimes not be
fine.

What:

* I don't know (yet) why the code rounds up to the next intval.
  For now, just disable rounding it and trust the value we get.

TODO:

* If we do see a beacon miss in STA mode then we should transition
  out of sleep for a while so we can hear beacons to resync against.
  I'd love a patch from someone to enable that particular behaviour.
  Note - that doesn't require that net80211 brings the chip out of
  sleep state - only that we wake the chip up through to full-on and
  then let it go to sleep again when we've seen a beacon.  The wifi
  stack and AP can still completely just stay believing we're in sleep
  mode.

Tested:

* AR9485, STA mode, powersave enabled

MFC after: 1 week
Relnotes: Yes

7 years ago[ath] include logging of TU versions of the TSF values.
adrian [Mon, 28 Nov 2016 02:51:55 +0000 (02:51 +0000)]
[ath] include logging of TU versions of the TSF values.

The beacon programming side of things deals in TUs and 1/8th TUs, so
it's good to se the TU value here when debugging beaconing issues.

7 years agoindent(1): Properly handle the wide string literal and wide char constant L.
pfg [Sun, 27 Nov 2016 20:38:14 +0000 (20:38 +0000)]
indent(1): Properly handle the wide string literal and wide char constant L.

indent(1) treated the "L" in "L'a'" as if it were an identifier and forced
a space character after it, breaking valid code.

PR: 143090
MFC after: 2 weeks

7 years agoindent(1): fix regression introduced in r303596.
pfg [Sun, 27 Nov 2016 20:30:09 +0000 (20:30 +0000)]
indent(1): fix regression introduced in r303596.

Multi-line comments are always block comments in KNF. Restore properly,
handling the case when a long one-liner gets wrapped and becomes a
multi-line comment.

Obtained from: Piotr Stefaniak

7 years agoindent(1): minor off-by-one error.
pfg [Sun, 27 Nov 2016 20:11:55 +0000 (20:11 +0000)]
indent(1): minor off-by-one error.

This was introduced in r303571.

Obtianed from: Piotr Stefaniak

7 years agoProperly initialize nextp
bapt [Sun, 27 Nov 2016 19:27:13 +0000 (19:27 +0000)]
Properly initialize nextp

MFC after: 1 day

7 years ago[ath] Begin to lay the groundwork for btcoex related ioctl controls.
adrian [Sun, 27 Nov 2016 18:34:29 +0000 (18:34 +0000)]
[ath] Begin to lay the groundwork for btcoex related ioctl controls.

7 years agorsu: add support for hardware multicast filter setup.
avos [Sun, 27 Nov 2016 18:06:03 +0000 (18:06 +0000)]
rsu: add support for hardware multicast filter setup.

The algorithm is the same as in rtwn(4).

Tested with Asus USB-N10 (STA) + RTL8188CUS (AP).

7 years agoAdd a few missed clang 3.9.0 files to OptionalObsoleteFiles.
dim [Sun, 27 Nov 2016 14:19:19 +0000 (14:19 +0000)]
Add a few missed clang 3.9.0 files to OptionalObsoleteFiles.

X-MFC-With: 309149

7 years agoFix spelling.
hselasky [Sun, 27 Nov 2016 12:04:54 +0000 (12:04 +0000)]
Fix spelling.

7 years agorsu: various scanning fixes.
avos [Sun, 27 Nov 2016 12:03:34 +0000 (12:03 +0000)]
rsu: various scanning fixes.

- Set IEEE80211_FEXT_SCAN_OFFLOAD flag; firmware can send null data
frames when associated.
- Check IEEE80211_SCAN_ACTIVE scan flag instead of IEEE80211_F_ASCAN
ic flag; the last is never set since r170530.
- Eliminate software scan (net80211) <-> site_survey (driver) race:
 * override ic_scan_curchan and ic_scan_mindwell pointers so net80211
will not try to finish scanning automatically;
 * inform net80211 about current status via ieee80211_cancel_scan()
and ieee80211_scan_done();
 * remove corresponding workaround from rsu_join_bss().

Now the driver can associate to an AP with hidden SSID.

Tested with Asus USB-N10.

7 years agoNFSv4 client tracks opens, and the track records are only dropped when
kib [Sun, 27 Nov 2016 09:20:58 +0000 (09:20 +0000)]
NFSv4 client tracks opens, and the track records are only dropped when
the vnode is inactivated.  This contradicts with the nullfs caching
which keeps upper vnode around, as consequence keeping the use
reference to lower vnode.

Add a filesystem flag to request nullfs to not cache when mounted over
that filesystem, and set the flag for nfs v4 mounts.

Reported by: asomers
Reviewed by: rmacklem
Tested by: asomers, rmacklem
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoThe function vm_page_cache() no longer exists. Remove its man page.
alc [Sun, 27 Nov 2016 01:44:31 +0000 (01:44 +0000)]
The function vm_page_cache() no longer exists.  Remove its man page.

7 years agoRecursion on the free page queue mutex occurred when UMA needed to allocate
alc [Sun, 27 Nov 2016 01:42:53 +0000 (01:42 +0000)]
Recursion on the free page queue mutex occurred when UMA needed to allocate
a new page of radix trie nodes to complete a vm_radix_insert() operation
that was requested by vm_page_cache().  Specifically, vm_page_cache()
already held the free page queue lock when UMA tried to acquire it through
a call to vm_page_alloc().  This code path no longer exists, so there is no
longer any reason to allow recursion on the free page queue mutex.

Improve nearby comments.

Reviewed by: kib, markj
Tested by: pho
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8628

7 years agobhnd(4): Unify NVRAM/SPROM parsing, implement compact SPROM layout encoding.
landonf [Sat, 26 Nov 2016 23:22:32 +0000 (23:22 +0000)]
bhnd(4): Unify NVRAM/SPROM parsing, implement compact SPROM layout encoding.

- Defined an abstract NVRAM I/O API (bhnd_nvram_io), decoupling NVRAM/SPROM
  parsing from the actual underlying NVRAM data provider (e.g. CFE firmware
  devices).
- Defined an abstract NVRAM data API (bhnd_nvram_data), decoupling
  higher-level NVRAM operations (indexed lookup, data conversion, etc) from
  the underlying NVRAM file format parsing/serialization.
- Implemented a new high-level bhnd_nvram_store API, providing indexed
  variable lookup, pending write tracking, etc on top of an arbitrary
  bhnd_nvram_data instance.
- Migrated all bhnd(4) NVRAM device drivers to the common bhnd_nvram_store
  API.
- Implemented a common bhnd_nvram_val API for parsing/encoding NVRAM
  variable values, including applying format-specific behavior when
  converting to/from the NVRAM string representations.
- Dropped the now unnecessary bhnd_nvram driver, and moved the
  broadcom/mips-specific CFE NVRAM driver out into sys/mips/broadcom.
- Implemented a new nvram_map file format:
        - Variable definitions are now defined separately from the SPROM
          layout. This will also allow us to define CIS tuple NVRAM
          mappings referencing the common NVRAM variable definitions.
        - Variables can now be defined within arbitrary named groups.
        - Textual descriptions and help information can be defined inline
          for both variables and variable groups.
        - Implemented a new, compact encoding of SPROM image layout
          offsets.
- Source-level (but not build system) support for building the NVRAM file
  format APIs (bhnd_nvram_io, bhnd_nvram_data, bhnd_nvram_store) as a
  userspace library.

The new compact SPROM image layout encoding is loosely modeled on Apple
dyld compressed LINKEDIT symbol binding opcodes; it provides a compact
state-machine encoding of the mapping between NVRAM variables and the SPROM
image offset, mask, and shift instructions necessary to decode or encode
the SPROM variable data.

The compact encoding reduces the size of the generated SPROM layout data
from roughly 60KB to 3KB. The sequential nature SPROM layout opcode tables
also simplify iteration of the SPROM variables, as it's no longer
neccessary to iterate the full NVRAM variable definition table, but
instead simply scan the SPROM revision's layout opcode table.

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

7 years agoAdd a missing header
scottl [Sat, 26 Nov 2016 23:15:11 +0000 (23:15 +0000)]
Add a missing header

7 years agoLaunder VPO_NOSYNC pages upon vnode deactivation.
markj [Sat, 26 Nov 2016 21:00:27 +0000 (21:00 +0000)]
Launder VPO_NOSYNC pages upon vnode deactivation.

As of r234483, vnode deactivation causes non-VPO_NOSYNC pages to be
laundered. This behaviour has two problems:

1. Dirty VPO_NOSYNC pages must be laundered before the vnode can be
   reclaimed, and this work may be unfairly deferred to the vnlru process
   or an unrelated application when the system is under vnode pressure.
2. Deactivation of a vnode with dirty VPO_NOSYNC pages requires a scan of
   the corresponding VM object's memq for non-VPO_NOSYNC dirty pages; if
   the laundry thread needs to launder pages from an unreferenced such
   vnode, it will reactivate and deactivate the vnode with each laundering,
   potentially resulting in a large number of expensive scans.

Therefore, ensure that all dirty pages are laundered upon deactivation,
i.e., when all maps of the vnode are removed and all references are
released.

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

7 years agoUse November instead of the abbreviation.
rmacklem [Sat, 26 Nov 2016 20:58:05 +0000 (20:58 +0000)]
Use November instead of the abbreviation.

Requested by: Ed Shouten
MFC after: 2 weeks

7 years agoDocument the -E flag for nfsstat.
rmacklem [Sat, 26 Nov 2016 20:53:22 +0000 (20:53 +0000)]
Document the -E flag for nfsstat.
This is a content change.

Reviewed by: bcr
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8626

7 years agoAdd a -E flag to nfsstat.c so that it prints out the NFSv4.1
rmacklem [Sat, 26 Nov 2016 20:47:11 +0000 (20:47 +0000)]
Add a -E flag to nfsstat.c so that it prints out the NFSv4.1
procedure/operation counts.
It also avoids clipping the counts at 9 digits.

Reviewed by: bcr (doc parts)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8626

7 years agorsu: fix R92S_TXDW1_QSEL_H2C definition (0x1f -> 0x13).
avos [Sat, 26 Nov 2016 20:26:29 +0000 (20:26 +0000)]
rsu: fix R92S_TXDW1_QSEL_H2C definition (0x1f -> 0x13).

Without this fix firmware ignores all but first 32 commands
(= almost everything (except plain Tx / Rx) stops working).

Tested with ASUS USB-N10.

7 years agoAdd an ethernet0 alias pointing to the /aix/usb/hub/ethernet node. This
ian [Sat, 26 Nov 2016 17:55:46 +0000 (17:55 +0000)]
Add an ethernet0 alias pointing to the /aix/usb/hub/ethernet node.  This
is required for u-boot to locate the ethernet node when it's doing fixup
of the mac-address property when the user has overridden the default addr.

7 years agoinitialize *nextp which could be left uninitialized in case the configuration
bapt [Sat, 26 Nov 2016 15:49:59 +0000 (15:49 +0000)]
initialize *nextp which could be left uninitialized in case the configuration
file cannot be open/read

Reported by: Coverity via cem
MFC after: 2 days
CID: 1365665

7 years agoFix null dereference when running out of nodes during rename.
sevan [Sat, 26 Nov 2016 13:26:29 +0000 (13:26 +0000)]
Fix null dereference when running out of nodes during rename.

PR: 212370
Submitted by: Sascha Wildner <swildner AT gmail>
Reviewed by: bcr (mentor)
Approved by: bapt
Obtained from: NetBSD
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8643

7 years agofdt: Expect strchr() to return a const char*
rakuco [Sat, 26 Nov 2016 12:36:11 +0000 (12:36 +0000)]
fdt: Expect strchr() to return a const char*

In C, strchr(3) returns a char*, whereas C++ defines two overloads:
* const char *strchr(const char*, int)
* char *strchr(char*, int)

Building fdt.cc (with the WITHOUT_GPL_DTC knob set) with libc++ 3.9.0 (imported
in r309124) was failing because libc++ r260377 added the first overload to
string.h, leading to failures such as:

    fdt.cc:1638:8: error: cannot initialize a variable of type 'char *' with an
    rvalue of type 'const char *'

Just define val as a const char* to fix it.

Upstreamed in https://github.com/davidchisnall/dtc/pull/14

Reviewed by: emaste
Approved by: emaste

7 years agoPLL3 have a fractional mode where an explicit frequency (297Mhz or 270)
manu [Sat, 26 Nov 2016 10:36:48 +0000 (10:36 +0000)]
PLL3 have a fractional mode where an explicit frequency (297Mhz or 270)
can be selected for it. If the desired frequency is one of those two, use
this mode instead of the integer one.
When calculating the PLL3 freq for the dotclock, check if it is a multiple
of the fracional frequencies.

MFC after: 2 weeks

7 years agoFix automatic eventtimer hardware selection when ARAT
kib [Sat, 26 Nov 2016 10:33:53 +0000 (10:33 +0000)]
Fix automatic eventtimer hardware selection when ARAT
(APIC-Timer-always-running) is not implemented.

If machine has ncpus >= 8 and non-FSB interrupt routing from HPET,
default HPET eventtimer quality 450 is reduced by 100, i.e. it is
350. On the other hand, LAPIC default quality is 600 and it is reduced
by 200 if ARAT is not reported. We end up with HPET quality 350 <
LAPIC quality 400, despite ARAT is not set.  Then, since deep Cx
states are active by default, eventtimer fail.

E.g., on Nehalem Core i7 CPU and X58 chipset, LAPIC only works in
C0/C1/C1E and HPET does not implement FSB mode, which otherwise
requires manual switch to HPET to get working system.

Set LAPIC eventtimer quality to 100 if no ARAT.
While there, do not ignore deadlint TSC mode for LAPIC timer if ARAT
is not implemented.  If user manually selected LAPIC eventtimer on
such CPU, there is no reason to not use deadline if available and not
disabled administratively.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoDon't build Ingenic kernels until we have non-static FDT support
br [Sat, 26 Nov 2016 10:20:33 +0000 (10:20 +0000)]
Don't build Ingenic kernels until we have non-static FDT support
for them.

Sponsored by: DARPA, AFRL

7 years agoFix ICMPv6 Time Exceeded error message translation.
ae [Sat, 26 Nov 2016 10:04:05 +0000 (10:04 +0000)]
Fix ICMPv6 Time Exceeded error message translation.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

7 years agostyle(9) indent changes, no actual code change.
delphij [Sat, 26 Nov 2016 07:02:44 +0000 (07:02 +0000)]
style(9) indent changes, no actual code change.

MFC after: 2 weeks

7 years agoext2: avoid possible overflow when calculating malloc size.
pfg [Sat, 26 Nov 2016 02:06:33 +0000 (02:06 +0000)]
ext2: avoid possible overflow when calculating malloc size.

This is inspired on r308064 for case of reloading UFS.

MFC after: 1 week

7 years agonetipsec: fix build after 309144
emaste [Sat, 26 Nov 2016 00:59:01 +0000 (00:59 +0000)]
netipsec: fix build after 309144

Reported by: rakuco

7 years agoStop "nfsstat -z" from clearing counts of NFSv4 state structures.
rmacklem [Fri, 25 Nov 2016 23:28:09 +0000 (23:28 +0000)]
Stop "nfsstat -z" from clearing counts of NFSv4 state structures.

The "-z" option on nfsstats was erroneously zeroing out the counts
of NFSv4 state structures. These counts will normally go back down
to zero as state is released. When zeroed out by "-z", these counts
can go negative. This patch fixes this problem.

MFC after: 2 weeks

7 years agoAdd an isync to after mtsrin, required by the MPC750 errata
jhibbits [Fri, 25 Nov 2016 19:36:27 +0000 (19:36 +0000)]
Add an isync to after mtsrin, required by the MPC750 errata

MPC750 User Manual Errata (rev 1) adds a note to C.4.2.2 noting that mtsr,
mtsrin, and mtmsr all require a isync after the instruction and before data
address translation uses any of the segment registers.  This should make FreeBSD
run correctly on the G3 again.

Reported by: Mark Millard
MFC after: 1 week

7 years agoUse explicit 0x200000 instead of MAXPAGESIZE for the amd64 kernel physaddr
emaste [Fri, 25 Nov 2016 18:57:14 +0000 (18:57 +0000)]
Use explicit 0x200000 instead of MAXPAGESIZE for the amd64 kernel physaddr

MAXPAGESIZE is not well defined by the GNU ld documentation.
Different linkers, and different versions of the same linker, use
different MAXPAGESIZE values. Current versions of GNU gold and LLVM's
lld use 4K. When set to 4K the kernel panics at boot due to an issue
with x86bios.

Here we want the kernel physaddr to be the amd64 superpage size, so use
that value (2MB) explicitly. With this change GNU gold and LLVM lld can
link a working amd64 kernel.

PR: 214718 (x86bios)
Differential Revision: https://reviews.freebsd.org/D8610

7 years agoBump FREEBSD_CC_VERSION again for r309147 and 309149.
dim [Fri, 25 Nov 2016 18:12:57 +0000 (18:12 +0000)]
Bump FREEBSD_CC_VERSION again for r309147 and 309149.

7 years agoPull in r283060 from upstream llvm trunk (by Hal Finkel):
dim [Fri, 25 Nov 2016 18:12:13 +0000 (18:12 +0000)]
Pull in r283060 from upstream llvm trunk (by Hal Finkel):

  [PowerPC] Refactor soft-float support, and enable PPC64 soft float

  This change enables soft-float for PowerPC64, and also makes
  soft-float disable all vector instruction sets for both 32-bit and
  64-bit modes. This latter part is necessary because the PPC backend
  canonicalizes many Altivec vector types to floating-point types, and
  so soft-float breaks scalarization support for many operations. Both
  for embedded targets and for operating-system kernels desiring
  soft-float support, it seems reasonable that disabling hardware
  floating-point also disables vector instructions (embedded targets
  without hardware floating point support are unlikely to have Altivec,
  etc. and operating system kernels desiring not to use floating-point
  registers to lower syscall cost are unlikely to want to use vector
  registers either). If someone needs this to work, we'll need to
  change the fact that we promote many Altivec operations to act on
  v4f32. To make it possible to disable Altivec when soft-float is
  enabled, hardware floating-point support needs to be expressed as a
  positive feature, like the others, and not a negative feature,
  because target features cannot have dependencies on the disabling of
  some other feature. So +soft-float has now become -hard-float.

  Fixes PR26970.

Pull in r283061 from upstream clang trunk (by Hal Finkel):

  [PowerPC] Enable soft-float for PPC64, and +soft-float -> -hard-float

  Enable soft-float support on PPC64, as the backend now supports it.
  Also, the backend now uses -hard-float instead of +soft-float, so set
  the target features accordingly.

  Fixes PR26970.

Reported by: Mark Millard
PR: 214433

7 years agoPermit timed sleeps for threads other than thread0 before timers are working.
jhb [Fri, 25 Nov 2016 18:02:43 +0000 (18:02 +0000)]
Permit timed sleeps for threads other than thread0 before timers are working.

The callout subsystem already handles early callouts and schedules
the first clock interrupt appropriately based on the currently pending
callouts.  The one nit to fix was that callouts scheduled via C_HARDCLOCK
during early boot could fire too early once timers were enabled as the
per-CPU base time is always zero until timers are initialized.  The change
in callout_when() handles this case by using the current uptime as the
base time of the callout during bootup if the per-CPU base time is zero.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Netflix

7 years agoPull in r282174 from upstream llvm trunk (by Krzysztof Parzyszek):
dim [Fri, 25 Nov 2016 18:01:32 +0000 (18:01 +0000)]
Pull in r282174 from upstream llvm trunk (by Krzysztof Parzyszek):

  [PPC] Set SP after loading data from stack frame, if no red zone is
  present

  Follow-up to r280705: Make sure that the SP is only restored after
  all data is loaded from the stack frame, if there is no red zone.

  This completes the fix for
  https://llvm.org/bugs/show_bug.cgi?id=26519.

  Differential Revision: https://reviews.llvm.org/D24466

Reported by:    Mark Millard
PR:             214433

7 years agoUpdate r309143 to prevent false sharing.
fabient [Fri, 25 Nov 2016 17:20:23 +0000 (17:20 +0000)]
Update r309143 to prevent false sharing.

Reported by: mjg
Approved by: so
MFC after: 1 month

7 years agoFix the TLB conflict abort value. This should be a no-op as we don't use
andrew [Fri, 25 Nov 2016 16:04:36 +0000 (16:04 +0000)]
Fix the TLB conflict abort value. This should be a no-op as we don't use
this value in the code.

7 years agoIPsec RFC6479 support for replay window sizes up to 2^32 - 32 packets.
fabient [Fri, 25 Nov 2016 14:44:49 +0000 (14:44 +0000)]
IPsec RFC6479 support for replay window sizes up to 2^32 - 32 packets.

Since the previous algorithm, based on bit shifting, does not scale
with large replay windows, the algorithm used here is based on
RFC 6479: IPsec Anti-Replay Algorithm without Bit Shifting.
The replay window will be fast to be updated, but will cost as many bits
in RAM as its size.

The previous implementation did not provide a lock on the replay window,
which may lead to replay issues.

Reviewed by: ae
Obtained from: emeric.poupon@stormshield.eu
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D8468

7 years agoIn a dual processor system (2*6 cores) during IPSec throughput tests,
fabient [Fri, 25 Nov 2016 13:49:33 +0000 (13:49 +0000)]
In a dual processor system (2*6 cores) during IPSec throughput tests,
we see a lot of contention on the arc4 lock, used to generate the IV
of the ESP output packets.

The idea of this patch is to split this mutex in order to reduce the
contention on this lock.

Reviewed by: delphij, markm, ache
Approved by: so
Obtained from: emeric.poupon@stormshield.eu
MFC after: 1 month
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D8130

7 years agoAdd WITH_LLD_AS_LD build knob
emaste [Fri, 25 Nov 2016 13:15:28 +0000 (13:15 +0000)]
Add WITH_LLD_AS_LD build knob

If set it installs LLD as /usr/bin/ld.  LLD (as of version 3.9) is not
capable of linking the world and kernel, but can self-host and link many
substantial applications. GNU ld continues to be used for the world and
kernel build, regardless of how this knob is set.

It is on by default for arm64, and off for all other CPU architectures.

Sponsored by: The FreeBSD Foundation

7 years agohyperv/vmbus: Add a simplified version of channel close.
sephe [Fri, 25 Nov 2016 09:13:10 +0000 (09:13 +0000)]
hyperv/vmbus: Add a simplified version of channel close.

So that the caller can know the channel close error and react accordingly.

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

7 years agohyperv/vmbus: Propagate close error.
sephe [Fri, 25 Nov 2016 08:57:52 +0000 (08:57 +0000)]
hyperv/vmbus: Propagate close error.

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

7 years agohyperv/vmbus: Always try disconnect/free bufring memory upon channel close
sephe [Fri, 25 Nov 2016 08:31:13 +0000 (08:31 +0000)]
hyperv/vmbus: Always try disconnect/free bufring memory upon channel close

While I'm here, minor wording and style changes.

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

7 years agohyperv/vmbus: Don't free the bufring if its GPADL can't be disconnected.
sephe [Fri, 25 Nov 2016 07:41:42 +0000 (07:41 +0000)]
hyperv/vmbus: Don't free the bufring if its GPADL can't be disconnected.

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

7 years agohyperv/vmbus: Return EISCONN if the bufring GPADL can't be disconnected.
sephe [Fri, 25 Nov 2016 07:24:11 +0000 (07:24 +0000)]
hyperv/vmbus: Return EISCONN if the bufring GPADL can't be disconnected.

So that the callers of vmbus_chan_open_br() could handle the passed in
bufring memory properly.

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

7 years agohyperv/vmbus: No stranded bufring GPADL is allowed.
sephe [Fri, 25 Nov 2016 07:03:45 +0000 (07:03 +0000)]
hyperv/vmbus: No stranded bufring GPADL is allowed.

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

7 years agohyperv/vmbus: GPADL disconnect error on a revoked channel is benign.
sephe [Fri, 25 Nov 2016 06:48:53 +0000 (06:48 +0000)]
hyperv/vmbus: GPADL disconnect error on a revoked channel is benign.

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

7 years agohyperv/vmbus: Don't close unopened channels.
sephe [Fri, 25 Nov 2016 06:12:18 +0000 (06:12 +0000)]
hyperv/vmbus: Don't close unopened channels.

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

7 years agohyperv/vmbus: Fix sysctl tree leakage, if channel open fails.
sephe [Fri, 25 Nov 2016 06:01:45 +0000 (06:01 +0000)]
hyperv/vmbus: Fix sysctl tree leakage, if channel open fails.

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

7 years agohyperv/vmbus: Minor style changes.
sephe [Fri, 25 Nov 2016 05:46:15 +0000 (05:46 +0000)]
hyperv/vmbus: Minor style changes.

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

7 years agohyperv/vmbus: Commit the GPADL id only after the connection succeeds.
sephe [Fri, 25 Nov 2016 05:35:29 +0000 (05:35 +0000)]
hyperv/vmbus: Commit the GPADL id only after the connection succeeds.

Minor style change.

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

7 years agohyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined
dexuan [Fri, 25 Nov 2016 04:35:40 +0000 (04:35 +0000)]
hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined

vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at
least shouldn't break build.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 3 days
Sponsored by: Microsoft

7 years agoCorrect lld llvm-tblgen dependency file name
emaste [Fri, 25 Nov 2016 01:24:35 +0000 (01:24 +0000)]
Correct lld llvm-tblgen dependency file name

7 years agoUpgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0
dim [Thu, 24 Nov 2016 22:55:24 +0000 (22:55 +0000)]
Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0
release, and add lld 3.9.0.  Also completely revamp the build system for
clang, llvm, lldb and their related tools.

Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
support to build; see UPDATING for more information.

Release notes for llvm, clang and lld are available here:
<http://llvm.org/releases/3.9.0/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.9.0/tools/clang/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.9.0/tools/lld/docs/ReleaseNotes.html>

Thanks to Ed Maste, Bryan Drewery, Andrew Turner, Antoine Brodin and Jan
Beich for their help.

Relnotes: yes
MFC after: 1 month