Commit Graph

106020 Commits

Author SHA1 Message Date
Adrian Chadd
1f3a8d1129 Add an external facing function to manually set the RX A-MPDU parameters
for re-ordering.

Devices like if_rsu don't pass through action/management frames but do send
firmware commands to inform us of things.  One of those notifications is
the RX A-MPDU negotiated parameters.
2015-09-18 05:01:05 +00:00
Adrian Chadd
4b9d9eee03 Add initial 11n support to if_rsu.
* Add a tunable to enable 11n if it's available, so to not anger people
  who upgrade.

  kenv hw.usb.rsu.enable_11n=1 before inserting the device.

* Add initial 11n htconfig bits;
* Enable 40MHz mode if it's available;
* Add 11n channels;
* Set 11n bits in the firmware.

It works for RX; I haven't tested TX aggregation just yet.
However the firmware doesn't do RX re-ordering, so I have to tie it into
the net80211 A-MPDU RX reorder path before I flip this on by default.

I've verified that I'm indeed actually seeing MCS 0->7 rates being received.
I haven't dug into whether it's actually transmitting 11n rates; I'll dig into
that later.
2015-09-18 04:12:11 +00:00
Adrian Chadd
4eadefc260 Expose the wme_info IE method. 2015-09-18 04:01:26 +00:00
Alan Cox
c9af644e5c Eliminate (many) unnecessary calls to pmap_remove_all(). Pages from objects
with a reference count of zero can't possibly be mapped, so there is never a
need for vm_page_set_invalid() to call pmap_remove_all() on them.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-09-17 22:28:38 +00:00
Alexander Motin
0c05f0dc16 Replicate initiators WWPNs and names between HA peers. 2015-09-17 21:51:11 +00:00
John Baldwin
b2e38974e2 The EFI boot loader allocates a single chunk of contiguous memory to
hold the kernel, modules, and any other loaded data.  This memory block
is relocated to the kernel's expected location during the transfer of
control from the loader to the kernel.

The GENERIC kernel on amd64 has recently grown such that a kernel + zfs.ko
no longer fits in the default staging size.  Bump the default size from
32MB to 48MB to provide more breathing room.

PR:		201679
Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3666
2015-09-17 20:36:46 +00:00
Alexander Motin
54713bce25 Replicate port->init_devid to HA peer. 2015-09-17 20:36:34 +00:00
Gleb Smirnoff
37bde76922 Remove extra tabs. 2015-09-17 20:21:55 +00:00
John Baldwin
5dc89bd2a0 Various small cleanups to EFI loader Makefiles.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D3641
2015-09-17 18:32:51 +00:00
Gleb Smirnoff
399fbd0ec0 Use proper byteswap macro. This isn't a functional change. 2015-09-17 17:27:49 +00:00
Alexander Motin
6213882769 When reporting TPT UA, report which of thresholds was reached. 2015-09-17 17:00:36 +00:00
Sean Bruno
25fd5dd9a0 Add Intel Skylake/I219 Support
- New em(4) device in currently shipping products

Differential Revision:	https://reviews.freebsd.org/D3163
Submitted by:	erj@freebsd.org
Reviewed by:	jfv@freebsd.org
MFC after:	2 weeks
Sponsored by:	Intel Corporation
2015-09-17 15:11:45 +00:00
Alexander Motin
042e9bdc41 Report number of failed XCOPY segment. 2015-09-17 14:22:52 +00:00
Alexander Motin
7f7bb97a0f Report proper medium error code for VERIFY commands. 2015-09-17 12:52:18 +00:00
Bjoern A. Zeeb
5f3a15445d Remove more unused variables leading to compile time errors. 2015-09-17 12:04:41 +00:00
Adrian Chadd
a851c66778 .. oops, flip on QoS. 2015-09-17 07:04:15 +00:00
Bjoern A. Zeeb
b7c61ac8b7 Remove unused variable leading to compile errors. 2015-09-17 06:07:49 +00:00
Adrian Chadd
b4d4079c85 Bring over the QoS logic from the Linux r92su driver.
* the tx descriptor TID is priority, not TID.
* the tx descriptor queue id mapping is separate from the
  TID/priority; rather than just "BE".

TODO:

* go and re-re-re-verify the queue mappings; the linux and openbsd
  mappings aren't exactly the same.  I need to verify all of this
  before I try to flip on 11n RX.
2015-09-17 04:45:29 +00:00
Adrian Chadd
b8303685fa Program the firmware setup stuff with the current hardware setup:
* Do 1T1R for now, until we read the config out of ROM and use it.
* Disable turbo mode, I dunno what this is, but the linux drivers
  have this disabled.
* Set the firmware endpoints to what we read from USB.

Tested:

* RTL8712 cut 3, STA mode
2015-09-17 03:42:18 +00:00
Adrian Chadd
bc6a9865d6 Use the H2C endpoint for sending firmware commands, rather than the voice
data queues.

This is similar to the openbsd and rtlwifi/r92su drivers.

Note: this driver still assumes it's a 4-endpoint device; I'll enforce
that in a follow-up commit.
2015-09-17 03:19:09 +00:00
Adrian Chadd
882704d0ce Add 11n and QoS methods.
The firmware takes care of ampdu tx/rx (except for RX reordering, grr),
QoS/WME and other bits/pieces.  So they're stubs, just in case.
2015-09-17 03:13:01 +00:00
Adrian Chadd
47b0d9dd88 Prepare for 11n - get the number of endpoints and whether 11n is available. 2015-09-17 03:08:02 +00:00
Adrian Chadd
ddf4995dc5 Bump RX_LIST_COUNT so we don't fall behind during active traffic. 2015-09-17 03:01:55 +00:00
Adrian Chadd
17ebf55362 Use DELAY() rather than usb_pause_mtx() - the latter releases the lock
before waiting, which prevents the lock from really acting like
a hardware serialiser.  Sigh.
2015-09-17 03:01:19 +00:00
Steven Hartland
412ce2744c Fix kqueue write events for files > 2GB
Due to the use of int's for file offsets in the VOP_WRITE_(PRE|POST)
macros, kqueue write events for files greater 2GB where never fired.

This caused tail -f on a file greater 2GB to never see updates.

MFC after:	1 week
Relnotes:	YES
Sponsored by:	Multiplay
2015-09-17 00:03:55 +00:00
Zbigniew Bodek
7b1c945350 Block secondary ITS instances from attaching on ARM64
Currently FreeBSD supports only single PIC controller. Some systems
that have more than one (like ThunderX dual-socket) fails to boot.
Disable other PICes until proper handling is implemented in the
generic interrupt code.

Reviewed by:   imp
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3682
2015-09-16 23:59:45 +00:00
Zbigniew Bodek
dbf66ac207 Release memory for CPUs that fail to init on ARM64
cpu_init_fdt will now release memory allocated for structures
serving CPUs that have failed to init.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3297
2015-09-16 23:46:20 +00:00
Zbigniew Bodek
18c72666ce Add domain support to PCI bus allocation
When the system has more than a single PCI domain, the bus numbers
are not unique, thus they cannot be used for "pci" device numbering.
Change bus numbers to -1 (i.e. to-be-determined automatically)
wherever the code did not care about domains.

Reviewed by:   jhb
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3406
2015-09-16 23:34:51 +00:00
Alexander Motin
83981e319d Fix reading after end of file for file-backed LUNs.
If backing file is smaller then the LUN size, we have to explicitly clear
the rest of the buffer to not leak some random data from previous I/Os.
2015-09-16 21:43:51 +00:00
Gleb Smirnoff
db642c8e6e In tcp_ctlinput() separate the (ip == NULL) block from the rest of the
function to reduce so many levels of indentation.  Style the lines that
got now indentation reduced.  No functional change.

Checked with:	md5
2015-09-16 21:42:33 +00:00
John Baldwin
bdd64116b0 Always clear TDB_USERWR before fetching system call arguments. The
TDB_USERWR flag may still be set after a debugger detaches from a
process via PT_DETACH.  Previously the flag would never be cleared
forcing a double fetch of the system call arguments for each system
call.  Note that the flag cannot be cleared at PT_DETACH time in case
one of the threads in the process is currently stopped in
syscallenter() and the debugger has modified the arguments for that
pending system call before detaching.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3678
2015-09-16 20:55:00 +00:00
Alexander Motin
d6043e4643 Make COMPARE AND WRITE report offset of difference. 2015-09-16 18:33:04 +00:00
Alexander Motin
723c363f7f Fix fixed sense writing when passed more data then it can fit.
MFC after:	1 week
2015-09-16 17:56:24 +00:00
John Baldwin
4295bec16a When a process group leader exits, all of the processes in the group are
sent SIGHUP and SIGCONT if any of the processes are stopped.  Currently this
behavior is triggered for any type of process stop including ptrace() stops
and transient stops for single threading during exit() and execve().
Thus, if a debugger is attached to a process in a group when the leader
exits, the entire group can be HUPed.  Instead, only send the signals if a
process in the group is stopped due to SIGSTOP.

PR:		201149
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3681
2015-09-16 16:40:07 +00:00
Alexander V. Chernikov
fb373bc2b1 Fix build broken by r287861.
Spotted by:	zb
2015-09-16 15:40:08 +00:00
Alexander V. Chernikov
1fe201c322 Simplify the way of attaching IPv6 link-layer header.
Problem description:
How do we currently perform layer 2 resolution and header imposition:

For IPv4 we have the following chain:
  ip_output() -> (ether|atm|whatever)_output() -> arpresolve()

Lookup is done in proper place (link-layer output routine) and it is possible
  to provide cached lle data.

For IPv6 situation is more complex:
  ip6_output() -> nd6_output() -> nd6_output_ifp() -> (whatever)_output() ->
    nd6_storelladdr()

We have ip6_ouput() which calls nd6_output() instead of link output routine.
nd6_output() does the following:
  * checks if lle exists, creates it if needed (similar to arpresolve())
  * performes lle state transitions (similar to arpresolve())
  * calls nd6_output_ifp() which pushes packets to link output routine along
    with running SeND/MAC hooks regardless of lle state
    (e.g. works as run-hooks placeholder).

After that, iface output routine like ether_output() calls nd6_storelladdr()
  which performs lle lookup once again.

As a result, we perform lookup twice for each outgoing packet for most types
  of interfaces. We also need to maintain runtime-checked table of 'nd6-free'
  interfaces (see nd6_need_cache()).

Fix this behavior by eliminating first ND lookup. To be more specific:
  * make all nd6_output() consumers use nd6_output_ifp() instead
  * rename nd6_output[_slow]() to nd6_resolve_[slow]()
  * convert nd6_resolve() and nd6_resolve_slow() to arpresolve() semantics,
    e.g. copy L2 address to buffer instead of pushing packet towards lower
    layers
  * Make all nd6_storelladdr() users use nd6_resolve()
  * eliminate nd6_storelladdr()

The resulting callchain is the following:
  ip6_output() -> nd6_output_ifp() -> (whatever)_output() -> nd6_resolve()

Error handling:
Currently sending packet to non-existing la results in ip6_<output|forward>
  -> nd6_output() -> nd6_output _lle() which returns 0.
In new scenario packet is propagated to <ether|whatever>_output() ->
  nd6_resolve() which will return EWOULDBLOCK, and that result
  will be converted to 0.

(And EWOULDBLOCK is actually used by IB/TOE code).

Sponsored by:		Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D1469
2015-09-16 14:26:28 +00:00
Alexander Motin
5c5fb901eb Frontends don't need to set errors themselves. 2015-09-16 13:25:35 +00:00
Andrey V. Elsukov
b71bed24a6 Use KASSERT for some checks, that are late to do.
Discussed with:	melifaro, glebius
2015-09-16 13:17:00 +00:00
Alexander V. Chernikov
f0316e1acb Constantify lookup key in several nd6_* functions. 2015-09-16 11:06:07 +00:00
Oleg Bulyzhin
3f70ebbf05 Remove superfluous m_freem().
MFC after:	1 month
2015-09-16 10:07:45 +00:00
Alexander Motin
e2c3044b13 Don't flap the HA link if sysctl is reset to the same value. 2015-09-16 09:59:05 +00:00
Kevin Lo
97ad4604d7 Use M_WAITOK rather than M_NOWAIT since it's not used within
interrupt context.
2015-09-16 07:26:18 +00:00
Kevin Lo
4bae831003 Fix a debug message which didn't quite get it right about eeprom version. 2015-09-16 07:18:54 +00:00
Kevin Lo
f75281b8f2 Remove checks for a NULL return value from M_WAITOK allocations. 2015-09-16 07:16:21 +00:00
Alexander V. Chernikov
59c180c35c Unify loopback route switching:
* prepare gateway before insertion
* use RTM_CHANGE instead of explicit find/change route
* Remove fib argument from ifa_switch_loopback_route added in r264887:
  if old ifp fib differes from new one, that the caller
  is doing something wrong
* Make ifa_*_loopback_route call single ifa_maintain_loopback_route().
2015-09-16 06:23:15 +00:00
Adrian Chadd
a14bc739d5 Add ASUS Sandybridge laptops to the similar x2apic disable logic
that was recently added for Lenovo laptops.

This is a prime candidate for conversion into a table and also
checking other fields like "product".

Tested:

* ASUS UX31E
2015-09-16 01:44:11 +00:00
Mark Johnston
4af587d062 Ensure that the MAD agent's delayed taskqueue is completely stopped
before proceeding. Otherwise, nothing prevents it from running after the
MAD agent struct has been been freed, and this results in a use-after-free
when the task's ta_pending count is incremented in the callout handler.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-15 23:56:31 +00:00
Ed Maste
319a55f4cd arm64: add kbd.c to the build for ukbd to fix the build
Pointy hat to:	emaste
2015-09-15 23:44:19 +00:00
Mateusz Guzik
7665e341ca sysctl: switch sysctllock to a sleepable rmlock, take 2
This restores r285125. Previous attempt was reverted due to a bug in rmlocks,
which is fixed since r287833.
2015-09-15 23:06:56 +00:00
John Baldwin
e89d5f43da Threads holding a read lock of a sleepable rm lock are not permitted
to sleep.  The rmlock implementation enforces this by disabling
sleeping when a read lock is acquired. To simplify the implementation,
sleeping is disabled for most of the duration of rm_rlock.  However,
it doesn't need to be disabled until the lock is acquired.  If a
sleepable rm lock is contested, then rm_rlock may need to acquire the
backing sx lock.  This tripped the overly-broad assertion.  Fix by
relaxing the assertion around the call to sx_xlock().

Reported by:	mjg
Reviewed by:	kib, mjg
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3324
2015-09-15 22:16:21 +00:00
Brad Davis
e5fe11011a Remove redundant 'man page'
Reviewed by:	allanjude
2015-09-15 21:16:45 +00:00
Conrad Meyer
55d33667ee kevent(2): Note DOOMED vnodes with NOTE_REVOKE
In poll mode, check for and wake VBAD vnodes.  (Vnodes that are VBAD at
registration will never be woken by the RECLAIM trigger.)

Add post-VOP_RECLAIM hook to trigger notes on vnode reclamation.  (Vnodes that
were fine at registration but are vgoned while being monitored should signal
waiters.)

Reviewed by:	kib
Approved by:	markj (mentor)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3675
2015-09-15 20:22:30 +00:00
Hiren Panchasara
550e9d4235 Remove unnecessary tcp state transition call.
Differential Revision:	D3451
Reviewed by:		markj
MFC after:		2 weeks
Sponsored by:		Limelight Networks
2015-09-15 20:04:30 +00:00
Ed Maste
9b76bf99d5 arm64: add xhci driver and umass/ukbd to GENERIC for Cavium ThunderX
Sponsored by:	The FreeBSD Foundation
2015-09-15 19:59:35 +00:00
Renato Botelho
1a2b77cf2e Add support for Sierra MC7355 card
Submitted by:	Jeremy Porter <jporter@netgate.com>
Approved by:	loos
Obtained from:	pfSense
MFC after:	1 week
Sponsored by:	Rubicon Communications (Netgate)
2015-09-15 18:21:56 +00:00
Edward Tomasz Napierala
bb27d7ed90 Add a way to specify stripesize and stripeoffset to gnop(8). This makes
it possible to "simulate" 4K media, to eg test alignment handling.

Reviewed by:	mav@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3664
2015-09-15 18:01:59 +00:00
Alexander V. Chernikov
0e2dcee6b2 Simplify nd6_cache_lladdr:
* Move isRouter calculation code to separate nd6_is_router() function.
* Make nd6_cache_lladdr() return void: its return value hasn't been used
  since r53541 KAME import in 1999.

Sponsored by:	Yandex LLC
2015-09-15 17:16:31 +00:00
Ed Maste
aafbd0257a Add Cavium ThunderX xHCI controller PCI ID
There is an issue with interrupts at the moment, but it works with
polling mode set (hw.usb.xhci.use_polling=1).

Reviewed by:	hselasky
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3665
2015-09-15 16:08:25 +00:00
Alexander Motin
c39d464164 Make CAM log errors that make it wait.
Waiting can take minutes, and it would be good for user to know what is
going on.

MFC after:	2 weeks
2015-09-15 10:57:16 +00:00
Alexander Motin
18e87f95f7 Fix completion/error status reporting. 2015-09-15 10:42:53 +00:00
Alexander Motin
923863546a Close potential race between datamove and HA failover. 2015-09-15 09:36:46 +00:00
Alexander V. Chernikov
eec33ea052 * Improve logging invalid arp messages
* Remove redundant check in ip_arpinput

Suggested by:	glebius
MFC after:	2 weeks
2015-09-15 08:50:44 +00:00
Alexander V. Chernikov
d3cdb71655 * Require explicitl lle unlink prior to calling llentry_delete().
This one slightly decreases time of holding afdata wlock.
* While here, make nd6_free() return void. No one has used its return value
  since r186119.
2015-09-15 06:48:19 +00:00
Mark Johnston
87dd1668e0 Preserve the device queue status before retrying a sense request in
chdone(). Previously, the retry could clear the CAM_DEV_QFRZN bit in the
CCB status, leaving the queue frozen.

Submitted by:	Jeff Miller <Jeff.Miller@isilon.com>
Reviewed by:	ken
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-15 05:09:17 +00:00
Adrian Chadd
89fd823782 Replace the scan event input path hack with the new rx-stats based method.
This allows for arbitrary channel info to be placed in the input call rather
than the totally gross hack of overriding ic_curchan.

Without this I'm sure ic_curchan setting was racing with the scan code
setting the channel itself..
2015-09-15 03:01:40 +00:00
Eric van Gyzen
17a036563d Fix the handling of IPv6 On-Link Redirects.
On receipt of a redirect message, install an interface route for the
redirected destination.  On removal of the corresponding Neighbor Cache
entry, remove the interface route.

This requires changes in rtredirect_fib() to cope with an AF_LINK
address for the gateway and with the absence of RTF_GATEWAY.

This fixes the "Redirected On-Link" test cases in the Tahi IPv6 Ready Logo
Phase 2 test suite.

Unrelated to the above, fix a recursion on the radix node head lock
triggered by the Tahi Redirected to Alternate Router test cases.

When I first wrote this patch in October 2012, all Section 2
(Neighbor Discovery) test cases passed on 10-CURRENT, 9-STABLE,
and 8-STABLE.  cem@ recently rebased the 10.x patch onto head and reported
that it passes Tahi.  (Thanks!)

These other test cases also passed in 2012:

* the RTF_MODIFIED case, with IPv4 and IPv6 (using a
  RTF_HOST|RTF_GATEWAY route for the destination)

* the redirected-to-self case, with IPv4 and IPv6

* a valid IPv4 redirect

All testing in 2012 was done with WITNESS and INVARIANTS.

Tested by:    EMC / Isilon Storage Division via Conrad Meyer (cem) in 2015,
              Mark Kelley <mark_kelley@dell.com> in 2012,
              TC Telkamp <terence_telkamp@dell.com> in 2012
PR:           152791
Reviewed by:  melifaro (current rev), bz (earlier rev)
Approved by:  kib (mentor)
MFC after:    1 month
Relnotes:     yes
Sponsored by: Dell Inc.
Differential Revision: https://reviews.freebsd.org/D3602
2015-09-14 19:17:25 +00:00
Alexander V. Chernikov
3e7a2321e3 * Do more fine-grained locking: call eventhandlers/free_entry
without holding afdata wlock
* convert per-af delete_address callback to global lltable_delete_entry() and
  more low-level "delete this lle" per-af callback
* fix some bugs/inconsistencies in IPv4/IPv6 ifscrub procedures

Sponsored by:		Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D3573
2015-09-14 16:48:19 +00:00
Alexander Motin
d0f25804a7 Implement data/status aggregation for secondary HA node.
For short read requests this reduces latency by 30%, reporting command
completion after two interlink roundtrips instead of full three.
2015-09-14 15:21:23 +00:00
Alexander Motin
3ed019a919 Implement data/status aggregation for camsim backend.
This is almost pointless for primary HA node, but useful for secondary,
where between fe_datamove and fe_done calls goes another link roundtrip.
2015-09-14 15:15:32 +00:00
Hans Petter Selasky
9acc0eafd7 Implement callout_drain_async(), inspired by the projects/hps_head
branch.

This function is used to drain a callout via a callback instead of
blocking the caller until the drain is complete. Refer to the
callout_drain_async() manual page for a detailed description.

Limitation: If a lock is used with the callout, the callout can only
be drained asynchronously one time unless the callout_init_mtx()
function is called again. This limitation is not present in
projects/hps_head and will require more invasive changes to the
timeout code, which was not in the scope of this patch.

Differential Revision:	https://reviews.freebsd.org/D3521
Reviewed by:		wblock
MFC after:		1 month
2015-09-14 10:52:26 +00:00
Alexander V. Chernikov
deb6bda6e3 * Improve error checking for arp messages.
* Clean stale headers from if_ether.c.

Reported by:	rozhuk.im at gmail.com
Reviewed by:	ae
MFC after:	2 weeks
2015-09-14 10:28:47 +00:00
Alexander Motin
7b6660c9aa Remove CTL_PRIV_LBA_LEN from HA messages.
Previously it was used for statistics, but now just a 16 extra bytes.
2015-09-14 09:56:01 +00:00
Hans Petter Selasky
d76d40126e Update TSO limits to include all headers.
To make driver programming easier the TSO limits are changed to
reflect the values used in the BUSDMA tag a network adapter driver is
using. The TCP/IP network stack will subtract space for all linklevel
and protocol level headers and ensure that the full mbuf chain passed
to the network adapter fits within the given limits.

Implementation notes:

If a network adapter driver needs to fixup the first mbuf in order to
support VLAN tag insertion, the size of the VLAN tag should be
subtracted from the TSO limit. Else not.

Network adapters which typically inline the complete header mbuf could
technically transmit one more segment. This patch does not implement a
mechanism to recover the last segment for data transmission. It is
believed when sufficiently large mbuf clusters are used, the segment
limit will not be reached and recovering the last segment will not
have any effect.

The current TSO algorithm tries to send MTU-sized packets, where the
MTU typically is 1500 bytes, which gives 1448 bytes of TCP data
payload per packet for IPv4. That means if the TSO length limitiation
is set to 65536 bytes, there will be a data payload remainder of
(65536 - 1500) mod 1448 bytes which is equal to 324 bytes. Trying to
recover total TSO length due to inlining mbuf header data will not
have any effect, because adding or removing the ETH/IP/TCP headers
to or from 324 bytes will not cause more or less TCP payload to be
TSO'ed.

Existing network adapter limits will be updated separately.

Differential Revision:	https://reviews.freebsd.org/D3458
Reviewed by:		rmacklem
MFC after:		2 weeks
2015-09-14 08:36:22 +00:00
Alexander Motin
ceff31dc0c Implement QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT.
Now we support most of SAM-5 task management.
2015-09-14 08:01:05 +00:00
Hans Petter Selasky
6e17d3a7fc Add missing file to build. 2015-09-14 07:11:53 +00:00
Hans Petter Selasky
6eed0dd7c4 Correct PCI ID.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 month
PR:		202807
2015-09-14 07:08:29 +00:00
Marius Strobl
96b2c26ae1 Add preliminary support for RTL8168H, tested by Sreenath Battalahalli.
MFC after:	1 week
2015-09-13 22:22:30 +00:00
Marius Strobl
100f3d3da6 - Sanity check that the parent ranges given in the "ranges" property
of PCI-EBus-bridges actually match the BARs as specified in and
  required by [1, p. 113 f.]. Doing so earlier would have simplified
  diagnosing a bug in QEMU/OpenBIOS getting the mapping of child
  addresses wrong, which still needs to be fixed there.
  In theory, we could try to change the BARs accordingly if we hit
  this problem. However, at least with real machines changing the
  decoding likely won't work, especially if the PCI-EBus-bridge is
  beneath an APB one. So implementing such functionality generally
  is rather pointless.
- Actually change the allocation type of EBus resources if they
  change from SYS_RES_MEMORY to SYS_RES_IOPORT when mapping them
  to PCI ranges in ebus_alloc_resource() and passing them up to
  bus_activate_resource(9). This may happen with the QEMU/OpenBIOS
  PCI-EBus-bridge but not real ones. Still, this is only cleans up
  the code and the result of resource allocation and activation is
  unchanged.
- Change the remainder of printf(9) to device_printf(9) calls and
  canonicalize their wording.

MFC after:	1 week

Peripheral Component Interconnect Input Output Controller,
Part No.: 802-7837-01, Sun Microelectronics, March 1997 [1]
2015-09-13 21:59:56 +00:00
Alexander Motin
bb978da493 Map CLEAR TASK SET and I_T NEXUS RESET for iSCSI.
The last should not be called without iSCSIProtocolLevel negotiation.
2015-09-13 20:40:00 +00:00
Alexander Motin
4cbc0bc5ae Implement iSCSI TARGET COLD RESET task management function.
Implement it as CTL_TASK_TARGET_RESET plus termination of all sessions.
2015-09-13 20:22:18 +00:00
Adrian Chadd
cf52bbe053 Disable mgmt frame sending in if_rsu.
The firmware in this NIC sends management frames.  So far I'm not sure which
ones it handles and which ones it doesn't handle - but this is what openbsd
does.

The association messages are handled by the firmware; the key negotiation
for 802.1x and WPA are done as raw frames, not management frames.

This successfully allows it to associate to my home networks whereas it didn't
work beforehand.

Tested:

* RTL8712, cut 3, STA mode

TODO:

* The firmware does send a join response with a status code; that should be
  logged in a more obvious way to assist with debugging.  Ie, the firmware
  is the thing that is saying "couldn't join, sorry!", not net80211.
2015-09-13 19:17:26 +00:00
Sean Bruno
a44aa8e030 Update em(4) with D3162 after testing further on hardware that failed
to attach with the last version of this commit. This commit fixes
attach failures on "ICH8" class devices via modifications to
e1000_init_nvm_params_ich8lan()

-   Fix compiler warning in 80003es2lan.c
-   Add return value handler for e1000_*_kmrn_reg_80003es2lan
-   Fix usage of DEBUGOUT
-   Remove unnecessary variable initializations.
-   Removed unused variables (complaints from gcc).
-   Edit defines in 82571.h.
-   Add workaround for igb hw errata.
-   Shared code changes for Skylake/I219 support.
-   Remove unused OBFF and LTR functions.

Tested by some of the folks that reported breakage in previous incarnation.
Thanks to AllanJude, gjb, gnn, tijl for tempting fate with their machines.

Submitted by:	erj@freebsd.org
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D3162
2015-09-13 18:26:05 +00:00
Alexander Motin
6187d4722a Improve read-only support. 2015-09-13 16:49:41 +00:00
George V. Neville-Neil
5d06879adb dd DTrace probe points, translators and a corresponding script
to provide the TCPDEBUG functionality with pure DTrace.

Reviewed by:	rwatson
MFC after:	2 weeks
Sponsored by:	Limelight Networks
Differential Revision:	D3530
2015-09-13 15:50:55 +00:00
Alexander Motin
6b56dd0cfa Reannounce port to HA peer if LUN map changed after online. 2015-09-13 15:31:55 +00:00
Alexander Motin
cfa0987386 Report INQUIRY DATA HAS CHANGED for related LUNs on port on-/offline. 2015-09-13 14:52:31 +00:00
Alexander Motin
eebde34629 Report CTL_UA_LUN_CHANGE on LUN map change. 2015-09-13 14:04:42 +00:00
Alexander Motin
844c2a3a94 Make TARGET RESET respect LUN mapping. 2015-09-13 13:00:20 +00:00
Alexander Motin
0a5c75e53c Add ID for Intel Panther Point KT Controller
Found on ASUS P8Q77-M motherboard.

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2015-09-13 12:08:25 +00:00
Xin LI
b4f6099b9f MFV r287623: 5997 FRU field not set during pool creation and never
updated

ZFS already supports storing the vdev FRU in a vdev property.  There
is code in libzfs to work with this property, and there is code in
the zfs-retire FMA module that looks for that information.  But there
is no code actually setting or updating the FRU.

To address this, ZFS is changed to send a handful of new events
whenever a vdev is added, attached, cleared, or onlined, as well
as when a pool is created or imported.

Note that syseventd is not currently available on FreeBSD and thus
some work is needed to actually support the new ZFS events (e.g. in
zfsd) to actually use this capability, this changeset is mostly a
diff reduction from upstream.

illumos/illumos-gate@1437283407

Illumos issues:

    5997 FRU field not set during pool creation and never updated
    https://www.illumos.org/issues/5997
2015-09-13 07:15:14 +00:00
Xin LI
011ecb128f Note r286552 as merged and reduce diff against upstream. 2015-09-13 06:49:42 +00:00
Adrian Chadd
a934198b02 Add RSSI logging to the event survey results. 2015-09-13 05:22:20 +00:00
Adrian Chadd
9b6916dbed After reading the linux driver, document what this bit is doing
(doing a full NIC awake.)
2015-09-13 04:41:13 +00:00
Adrian Chadd
e6d258f6ac * fiddle with some more of the debugging output
* yes, when a "sta disconnect" message comes through we should, like,
  disconnect things.  We're not currently generating beacon miss messages,
  and net80211 isn't disconnecting things via software beacon miss receive.

Tested:

* RTL8712, cut 3, STA mode
2015-09-13 04:12:51 +00:00
Marius Strobl
1ed1ef30ee Merge r286374 from x86:
Formally pair store_rel(&smp_started) with load_acq(&smp_started).
Similarly to x86, this change is mostly a NOP due to the kernel
being run in total store order.

MFC after:	1 week
2015-09-13 00:08:04 +00:00
Adrian Chadd
4914fa0fd6 if_rsu debug fixes:
* use an ath/iwn style debug bitmap - it's still global rather than per-device,
  but it's better than debug levels
* disable bgscan - it just makes things unstable/unpredictable for now.

Tested:

* if_rsu - RTL8712 cut 3, STA mode
2015-09-12 23:10:34 +00:00
Marius Strobl
9888f86a16 - Factor out the common and generic parts of the sparc64 host-PCI-bridge
drivers into the revived sys/sparc64/pci/ofw_pci.c, previously already
  serving a similar purpose. This has been done with sun4v in mind, which
  explains a) the otherwise not that obvious scheme employed and b) why
  reusing sys/powerpc/ofw/ofw_pci.c was even lesser an option.
- Add a workaround for QEMU once again not emulating real machines, in
  this case by not providing the OFW_PCI_CS_MEM64 range. [1]

Submitted by:	jhb [1]
MFC after:	1 week
2015-09-12 22:49:32 +00:00
Michael Tuexen
30811e70d9 Fix compilation issue introduced in r287717.
Thanks to bz@ for making me aware of it.

MFC after:	1 week
2015-09-12 21:23:24 +00:00
Alexander Motin
84e2fad15a Check for obsolete NUL bin in CSCD descriptor. 2015-09-12 20:45:09 +00:00
Alexander Motin
051481a24e Add HA support for CTL_TASK_I_T_NEXUS_RESET. 2015-09-12 20:06:22 +00:00
Alexander Motin
0a4c638188 Fix false CTL_UA_RES_RELEASE on secondary HA node. 2015-09-12 18:29:05 +00:00
Michael Tuexen
6802b0904f Address a compile warning.
MFC after:	1 week
2015-09-12 18:00:06 +00:00
Alexander Motin
119c9aca64 Decode WRITE ATOMIC(16) command. 2015-09-12 17:53:49 +00:00
Michael Tuexen
86eda749af Cleanup the handling of error causes for ERROR chunks. This fixes
an inconsistency of the padding handling. The final padding is
now considered to be a chunk padding.

MFC after:	1 week
2015-09-12 17:08:51 +00:00
Luiz Otavio O Souza
8fbc5d1840 Do not call mii_mediachg() from NIC interrupt handler.
This fixes the link instability on banana pi (A20).

Suggested by:	yongari
2015-09-12 16:46:41 +00:00
Alexander Motin
a65a997fd9 Improve XCOPY error reporting. 2015-09-12 16:30:01 +00:00
Alexander Motin
238b6b7c75 Report that we have no limit on POPULATE TOKEN segment size. 2015-09-12 14:20:11 +00:00
Alexander Motin
eed0d596cf Correct RTPG bitmask. 2015-09-12 13:53:41 +00:00
Alexander Motin
e184d2576a Some HA polishing. 2015-09-12 12:46:04 +00:00
Alexander Motin
d36c617616 CTL documentation update, mostly for HA. 2015-09-12 10:23:23 +00:00
Xin LI
653809335f MFV r287699: 6214 zpools going south
In r286570 (MFV of r277426) an unprotected write to b_flags to
set the compression mode was introduced.  This would open a race
window where data is partially decompressed, modified, checksummed
and written to the pool, resulting in pool corruption due to the
partial decompression.

Prevent this by reintroducing b_compress

illumos/illumos-gate@d4cd038c92

Illumos issues:

    6214 zpools going south
    https://www.illumos.org/issues/6214
2015-09-12 09:56:23 +00:00
Xin LI
3e691a57db MFV r287684: 6091 avl_add doesn't assert on non-debug builds
Use assfail() from libuutil instead of ASSERT() in userland
AVL avl_add.

illumos/illumos-gate@faa2b6be2f

Illumos issues:

    6091 avl_add doesn't assert on non-debug builds
    https://www.illumos.org/issues/6091
2015-09-12 08:50:43 +00:00
Xin LI
8c4f41ff34 MFV r287624: 5987 zfs prefetch code needs work
Rewrite the ZFS prefetch code to detect only forward, sequential
streams.

The following kstats have been added:

    kstat.zfs.misc.arcstats.sync_wait_for_async

	How many sync reads have waited for async read
	to complete. (less is better)

    kstat.zfs.misc.arcstats.demand_hit_predictive_prefetch

	How many demand read didn't have to wait for I/O
	because of predictive prefetch.  (more is better)

zfetch kstats have been similified to hits, misses, and max_streams,
with max_streams representing times when we were not able to create
new stream because we already have the maximum number of sequences
for a file.

The sysctl variable/loader tunable vfs.zfs.zfetch.block_cap have been
replaced by vfs.zfs.zfetch.max_distance, which controls maximum bytes
to prefetch per stream.

illumos/illumos-gate@cf6106c8a0

Illumos ZFS issues:

    5987 zfs prefetch code needs work
    https://www.illumos.org/issues/5987
2015-09-12 08:35:51 +00:00
Tai-hwa Liang
05081ecd11 Fixing a memory leak on module unloading.
MFC after:	3 weeks
2015-09-11 22:43:35 +00:00
Cy Schubert
43fd750b64 Revert ip_fil_freebsd.c -r287674. This should not have gone in yet. 2015-09-11 16:52:13 +00:00
Cy Schubert
e1d4f0626e Fix ipfilter bug 3600459 NAT bucket count wrong.
Obtained from:	ipfilter cvs repo r1.48.2.25
MFC after:	2 weeks
2015-09-11 16:49:52 +00:00
Andriy Gapon
8f875df090 radeon_suspend_kms: don't mess with pci state that's managed by the bus
The pci bus driver handles the power state, it also manages
configuration state saving and restoring for its child devices.  Thus a
PCI device driver does not have to worry about those things.  In fact, I
observe a hard system hang when trying to suspend a system with active
radeonkms driver where both the bus driver and radeonkms driver try to
do the same thing.  I suspect that it could be because of an access to a
PCI configuration register after the device is placed into D3 state.

Reviewed by:	dumbbell, jhb
MFC after:	13 days
Differential Revision:	https://reviews.freebsd.org/D3561
2015-09-11 15:51:20 +00:00
Alexander Motin
572846e089 Make ctld restart on primary HA node less invasive for secondary. 2015-09-11 14:47:35 +00:00
Alexander Motin
ee4ad294d2 Close races between device close and request processing.
All requests arriving for processing after OFFLINE flag set are rejected
with BUSY status.  Races around OFFLINE flag setting are closed by calling
taskqueue_drain_all().
2015-09-11 14:33:05 +00:00
Michael Tuexen
e629b9fc56 Ensure that ERROR chunks are always padded by implementing this
in the routine, which queues an ERROR chunk, instead on relyinh
on the callers to do so. Since one caller missed this, this actially
fixes a bug.

MFC after:	1 week
2015-09-11 13:54:33 +00:00
Alexander Motin
3236151ea8 Reference/release devices on every I/O, rather on open/close.
While this may be slower, it allows device destruction to complete,
rather then block waiting for indefinitely long time.
2015-09-11 12:50:52 +00:00
Alexander Motin
5b363c09dc Add support for PPP-Max-Payload PPPoE tag (RFC4638).
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2015-09-11 09:15:27 +00:00
Cy Schubert
4d54c313b2 Revert $FreeBSD$. 2015-09-11 08:48:16 +00:00
Cy Schubert
7671e3b5b6 Fix mutex errors.
Obtained from:	NetBSD r1.4.
MFC after:	1 week
2015-09-11 08:35:53 +00:00
Cy Schubert
d7b78c26dc Fixup typos in comments.
Obtained from:	NetBSD r1.4.
MFC after:	1 week
2015-09-11 08:27:32 +00:00
Warner Losh
7297c5e535 bufdonebio is now unused. Retire it too. 2015-09-11 04:20:04 +00:00
Mark Johnston
610141cebb Add stack_save_td_running(), a function to trace the kernel stack of a
running thread.

It is currently implemented only on amd64 and i386; on these
architectures, it is implemented by raising an NMI on the CPU on which
the target thread is currently running. Unlike stack_save_td(), it may
fail, for example if the thread is running in user mode.

This change also modifies the kern.proc.kstack sysctl to use this function,
so that stacks of running threads are shown in the output of "procstat -kk".
This is handy for debugging threads that are stuck in a busy loop.

Reviewed by:	bdrewery, jhb, kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3256
2015-09-11 03:54:37 +00:00
Mark Johnston
1e954a7c63 Remove the arg0 field from struct amd64_frame. Its existence was a bug,
since on amd64 the first argument to a function is generally not on the
stack.

Revert an old DTrace bug fix to some code that assumed that
sizeof(struct amd64_frame) == 16.

Reviewed by:	jhb, kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3255
2015-09-11 03:31:22 +00:00
Mark Johnston
4db79feb8f Merge stack(9) implementations for i386 and amd64 under x86/.
Reviewed by:	jhb, kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3255
2015-09-11 03:24:07 +00:00
Mark Johnston
e8baaa998c MFV r283513:
5930 fasttrap_pid_enable() panics when prfind() fails in forking process
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>

illumos/illumos-gate@9df7e4e12e
2015-09-11 03:06:34 +00:00
Mark Johnston
2275da185c MFV r283512:
3599 dtrace_dynvar tail calls can blow stack
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>

illumos/illumos-gate@d47448f09a
2015-09-11 03:04:24 +00:00
Mark Johnston
d73ce4c698 Remove the v_cache_min and v_cache_max sysctls. They are unused and have
no effect.

Reviewed by:	alc
Sponsored by:	EMC / Isilon Storage Division
2015-09-11 03:00:20 +00:00
Warner Losh
ad8d57a99d dev_strategy and dev_strategy_csw are unused since r281825. Remove
them.

Differential Revision: https://reviews.freebsd.org/D3620
2015-09-11 00:38:58 +00:00
John Baldwin
8fb15ddb00 Add a comment that to clarify how to determine the amount of received DDP
data.

Reviewed by:	np
Differential Revision:	https://reviews.freebsd.org/D3619
2015-09-10 21:41:11 +00:00
Konstantin Belousov
1fa6712471 Do not hold the process around the vm_fault() call from the trap()s.
The only operation which is prevented by the hold is the kernel stack
swapout for the faulted thread, which should be fine to allow.

Remove useless checks for NULL curproc or curproc->p_vmspace from the
trap_pfault() wrappers on x86 and powerpc.

Reviewed by:	alc (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-09-10 17:46:48 +00:00
Alexander Motin
7ac58230ea Reimplement CTL High Availability.
CTL HA functionality was originally implemented by Copan many years ago,
but large part of the sources was never published.  This change includes
clean room implementation of the missing code and fixes for many bugs.

This code supports dual-node HA with ALUA in four modes:
 - Active/Unavailable without interlink between nodes;
 - Active/Standby with second node handling only basic LUN discovery and
reservation, synchronizing with the first node through the interlink;
 - Active/Active with both nodes processing commands and accessing the
backing storage, synchronizing with the first node through the interlink;
 - Active/Active with second node working as proxy, transfering all
commands to the first node for execution through the interlink.

Unlike original Copan's implementation, depending on specific hardware,
this code uses simple custom TCP-based protocol for interlink.  It has
no authentication, so it should never be enabled on public interfaces.

The code may still need some polishing, but generally it is functional.

Relnotes:	yes
Sponsored by:	iXsystems, Inc.
2015-09-10 12:40:31 +00:00
Alexander Motin
fb606ebabc Remove unused target and initiator IDs. 2015-09-10 10:46:21 +00:00
Alexander Motin
3f326305fc Disable CTL_IO_DELAY feature.
It is too developer-oriented to be enabled by default.
2015-09-10 09:27:22 +00:00
Hiroki Sato
120ff2d73d Remove SIOCGDRLST_IN6 and SIOCGPRLST_IN6 forgotten in the previous commit.
MFC after:	3 days
2015-09-10 08:37:03 +00:00
Hans Petter Selasky
8c626ca5dc Update USB quirk.
MFC after:	1 month
PR:		202968
2015-09-10 07:36:54 +00:00
Hiroki Sato
e3884653f6 - Remove SIOCGDRLST_IN6 and SIOCGPRLST_IN6. These are quite old APIs and
there is no consumer now.

MFC after:	3 days
2015-09-10 06:31:24 +00:00
Hiroki Sato
d0bec2c522 - Remove SIOCGDRLST_IN6 and SIOCGPRLST_IN6. These are quite old APIs and
there is no consumer now.

- Simplify first and duplicate LLA check.

MFC after:	3 days
2015-09-10 06:29:18 +00:00
Hiroki Sato
1fce58fc62 Do not add IN6_IFF_TENTATIVE when ND6_IFF_NO_DAD.
MFC after:	3 days
2015-09-10 06:10:30 +00:00
Hiroki Sato
3ba7e4ce9c Remove IN6_IFF_NOPFX. This flag was no longer used.
MFC after:	3 days
2015-09-10 06:08:42 +00:00
Hiroki Sato
b1c250ff3f - Remove GIF_{SEND,ACCEPT}_REVETHIP.
- Simplify EADDRNOTAVAIL and EAFNOSUPPORT conditions.

MFC after:	3 days
2015-09-10 05:59:39 +00:00
Adrian Chadd
32766cd281 Also make kern.maxfilesperproc a boot time tunable.
Auto-tuning threshold discussions aside, it turns out that if you want
to lower this on say, rather memory-packed machines, you either set maxusers
or kern.maxfiles, or you set it in sysctl.  The former is a non-exact
way to tune this; the latter doesn't actually affect anything in the
startup scripts.

This first occured because I wondered why the hell screen would take upwards
of 10 seconds to spawn a new screen.  I then found python doing the same
thing during fork/exec of child processes - it calls close() on each FD
up to the current openfiles limit.  On a 1TB machine this is like, 26 million
FDs per process.  Ugh.

So:

* This allows it to be set early in /boot/loader.conf;
* It can be used to work around the ridiculous situation of
  screen, python, etc doing a close() on potentially millions of FDs
  even though you only have four open.

Tested:

* 4GB, 32GB, 64GB, 128GB, 384GB, 1TB systems with autotune, ensuring
  screen and python forking doesn't result in some pretty hilariously
  bad behaviour.

TODO:

* Note that the default login.conf sets openfiles-cur to unlimited,
  effectively obeying kern.maxfilesperproc.  Perhaps we should fix
  this.

* .. and even if we do, we need to also ensure that daemons get
  a soft limit of something reasonable and capped - they can request
  more FDs themselves.

MFC after:	1 week
Sponsored by:	Norse Corp, Inc.
2015-09-10 04:05:58 +00:00
Konstantin Belousov
9e18c9eb27 For open("name", O_DIRECTORY | O_CREAT), do not try to create the
named node, open(2) cannot create directories.  But do allow the flag
combination to succeed if the directory already exists.

Declare the open("name", O_DIRECTORY | O_CREAT | O_EXCL) always
invalid for the same reason, since open(2) cannot create directory.

Note that there is an argument that O_DIRECTORY | O_CREAT should be
invalid always, regardless of the target directory existence or
O_EXCL.  The current fix is conservative and allows the call to
succeed in the situation where it succeeded before the patch.

Reported by:	Tom Ridge <freebsd@tom-ridge.com>
Reviewed by:	rwatson
PR:	 202892
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-09-09 19:31:08 +00:00
Andrew Turner
8fe99e427f Rework copyinstr to:
* Fail when the length passed in is 0
 * Remove an unneeded increment of the count on success
 * Return ENAMETOOLONG when the input pointer is too long

Sponsored by:	ABT Systems Ltd
2015-09-09 11:51:14 +00:00
Hans Petter Selasky
b28014dd0b Add new USB ID.
MFC after:	1 month
PR:		202968
2015-09-09 07:04:00 +00:00
Konstantin Belousov
b8db977617 Remove a check which caused spurious SIGSEGV on usermode access to the
mapped address without valid pte installed, when parallel wiring of
the entry happen.  The entry must be copy on write.  If entry is COW
but was already copied, and parallel wiring set
MAP_ENTRY_IN_TRANSITION, vm_fault() would sleep waiting for the
MAP_ENTRY_IN_TRANSITION flag to clear.  After that, the fault handler
is restarted and vm_map_lookup() or vm_map_lookup_locked() trip over
the check.  Note that this is race, if the address is accessed after
the wiring is done, the entry does not fault at all.

There is no reason in the current kernel to disallow write access to
the COW wired entry if the entry permissions allow it.  Initially this
was done in r24666, since that kernel did not supported proper
copy-on-write for wired text, which was fixed in r199869.  The r251901
revision re-introduced the r24666 fix for the current VM.

Note that write access must clear MAP_ENTRY_NEEDS_COPY entry flag by
performing COW.  In reverse, when MAP_ENTRY_NEEDS_COPY is set in
vmspace_fork(), the MAP_ENTRY_USER_WIRED flag is cleared.  Put the
assert stating the invariant, instead of returning the error.

Reported and debugging help by:	peter
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-09-09 06:19:33 +00:00