Commit Graph

100092 Commits

Author SHA1 Message Date
trasz
21ec0cf2d0 MFC r264530:
Properly pass the initiator address when running in proxy mode.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:37:55 +00:00
trasz
1abd1411d7 MFC r264527:
Make it possible to interrupt login when running in proxy mode.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:33:56 +00:00
trasz
f2085cbf68 MFC r264526:
Properly identify target portal when running in proxy mode.  While here,
remove CTL_ISCSI_CLOSE, it wasn't used or implemented anyway.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:32:45 +00:00
trasz
f86dc9fb87 MFC r264525:
Add some stuff to make it easier to figure out for the system administrator
whether the ICL_KERNEL_PROXY stuff got compiled in correctly.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:31:25 +00:00
trasz
690b7a7a12 MFC r264524:
Make it possible for the iSCSI target side to operate in both normal
and ICL_KERNEL_PROXY mode, and fix some bit rot so the latter actually
works again.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:29:39 +00:00
trasz
69dfd86371 MFC r263740:
Use a less unusual syntax in debug printfs.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:25:47 +00:00
trasz
91f13dce9c MFC r264264 by mav@:
Wakeup only one thread of added in r263978i at a time.

This slightly reduces lock congestion between threads.
2014-05-07 07:20:02 +00:00
trasz
e342286804 MFC r264163:
Remove hack to pass STAILQ to a function and do it properly instead.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:18:38 +00:00
trasz
c4225c1e15 MFC r264122:
Rework the iSCSI PDU transmit code to avoid lock contention and coalesce
PDUs before sending.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:17:11 +00:00
trasz
339da02d0d MFC r264110:
All the iSCSI sysctls are also tunables; advertise that.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:46:59 +00:00
trasz
a88bc10e55 MFC r264109:
We don't need TAILQ for iSCSI PDUs; STAILQ is enough.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:44:19 +00:00
trasz
422c729ba7 MFC r264026:
Enable a KASSERT.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:41:33 +00:00
trasz
c0421f4379 MFC r264025:
Get rid of the "autoscaling", instead just set socket buffer sizes
in the usual way.  The only thing the old code did was making things
less predictable.

MFC r264058:

Fix build, broken by r264025.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:38:19 +00:00
trasz
4fd7169afe MFC r264024:
Use atomic ops instead of mutexes where appropriate.

Submitted by:	mav@
Sponsored by:	The FreeBSD Foundation
2014-05-07 06:34:03 +00:00
trasz
26ce3cd6c7 MFC r264023:
Instead of "icltx" and "iclrx", use thread names with prefix from upper
layer, so that one can see which side of the stack the threads are for.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:31:45 +00:00
trasz
76ebd34835 MFC r264022:
Get rid of ICL lock; use upper-layer (initiator or target) lock instead.
This avoids extra locking in icl_pdu_queue(); the upper layer needs to call
it while holding its own lock anyway, to avoid sending PDUs out of order.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:29:01 +00:00
trasz
dfa8f3f0a1 MFC r264020:
Remove the homegrown ctl_be_block_io allocator, replacing it with UMA.
There is no performance difference.

Reviewed by:	mav@
Sponsored by:	The FreeBSD Foundation
2014-05-07 06:26:34 +00:00
trasz
2cb2c64704 MFC r263979:
Hide CTL messages about SCSI error responses.  Too many users take
them for actual target errors.  They can be enabled back by setting
kern.cam.ctl.verbose=1, or booting with bootverbose.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:24:46 +00:00
trasz
4ceefd197d MFC r263978:
Make it possible to have multiple CTL worker threads.  Leave the default
of 1 for now.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:22:51 +00:00
trasz
d026d687fc MFC r263811:
Remove ctl_mem_pool.{c,h}.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:20:35 +00:00
trasz
0060724119 MFC r263810:
Rework cfiscsi_datamove_in() to obey expected data transfer length
received from the initiator.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:18:03 +00:00
trasz
6296615c5f MFC r263745:
Target Transfer Tag is opaque; no need to htonl(3) it.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:14:41 +00:00
trasz
3c0db90228 MFC r263743:
Move the ic_outstanding_count under #ifdef DIAGNOSTIC.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:12:59 +00:00
trasz
7ccc1ec941 MFC r263742:
Fix harmless warning after reconnecting a session and not doing anything
with it.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:10:55 +00:00
alc
8be11d4db2 MFC r262338
When the kernel is running in a virtual machine, it cannot rely upon the
  processor family to determine if the workaround for AMD Family 10h Erratum
  383 should be enabled.  To enable virtual machine migration among a
  heterogeneous collection of physical machines, the hypervisor may have
  been configured to report an older processor family with a reduced feature
  set.  Effectively, the reported processor family and its features are like
  a "least common denominator" for the collection of machines.

  Therefore, when the kernel is running in a virtual machine, instead of
  relying upon the processor family, we now test for features that prove
  that the underlying processor is not affected by the erratum.  (The
  features that we test for are unlikely to ever be emulated in software
  on an affected physical processor.)

PR:		186061
2014-05-07 00:32:49 +00:00
rmacklem
d706690fda MFC: r264739
Add {} braces so that the code conforms to the indentation.
Fortunately, I don't think doing the assignment of cap->tsomax
unconditionally causes any problem.
2014-05-06 22:04:50 +00:00
rmacklem
2200ec99a6 MFC: r264738
For an NFSv4 mount with the "nocto" option, don't get the
up to date file attributes upon close. This reduces the
Getattr RPC count by about 65% for software builds.
2014-05-06 21:59:48 +00:00
rmacklem
bb012fd779 MFC: r264705, r264749
Modify the NFSv4 client create/mkdir RPC so that it acquires
post-create/mkdir directory attributes. This allows the RPC to
name cache the newly created directory and reduces the lookup RPC
count for applications creating a lot of directories.
2014-05-06 21:54:52 +00:00
rmacklem
5809be0d87 MFC: r264681
Modify the NFSv4 client open/create RPC so that it acquires
post-open/create directory attributes. This allows the RPC to
name cache the newly created file and reduces the lookup RPC
count by about 10% for software builds.
2014-05-06 21:47:43 +00:00
kib
f5b893b0e8 MFC r265102:
Fix two cases of recursive acquisitions of the vm object lock, only
possible in rare failure situations.
2014-05-06 12:31:25 +00:00
kib
68fab25080 MFC r265100:
Fix the comparision for the end of range in vm_phys_fictitious_reg_range().
2014-05-06 12:20:07 +00:00
rmacklem
cab8f4561e MFC: r264672
Modify the Lookup RPC for NFSv4 so that it acquires directory
attributes. This allows the client to cache directory names
when they are looked up, reducing the Lookup RPC count by
about 40% for software builds.
2014-05-06 12:15:05 +00:00
mav
941905ca5c MFC r264610:
Correct AMD chipsets identification.
2014-05-06 09:54:24 +00:00
mav
4990f3be06 MFC r260830:
Add ID for one more ASMedia AHCI-compatible controller.
2014-05-06 09:51:15 +00:00
np
ccdc23542c MFC r259382:
Read card capabilities after firmware initialization, instead of setting
them up as part of firmware initialization (which the driver gets to do
only if it's the master driver).

Read the range of tids available for the ETHOFLD functionality if it's
enabled.

New is_ftid() and is_etid() functions to test whether a tid falls within
the range of filter tids or ETHOFLD tids respectively.
2014-05-06 07:21:50 +00:00
np
ebd722c9b4 MFC r263317, r263412, and r263451.
r263317:
cxgbe(4): significant rx rework.

- More flexible cluster size selection, including the ability to fall
  back to a safe cluster size (PAGE_SIZE from zone_jumbop by default) in
  case an allocation of a larger size fails.
- A single get_fl_payload() function that assembles the payload into an
  mbuf chain for any kind of freelist.  This replaces two variants: one
  for freelists with buffer packing enabled and another for those without.
- Buffer packing with any sized cluster.  It was limited to 4K clusters
  only before this change.
- Enable buffer packing for TOE rx queues as well.
- Statistics and tunables to go with all these changes.  The driver's
  man page will be updated separately.

r263412:
cxgbe(4): if_iqdrops statistic should include tunnel congestion drops.

r263451:
cxgbe(4): man page updates.
2014-05-06 06:49:39 +00:00
np
c4599dcf44 MFC r260210 (by adrian@):
Add an option to enable or disable the small RX packet copying that
is done to improve performance of small frames.

When doing RX packing, the RX copying isn't necessarily required.
2014-05-06 04:22:06 +00:00
np
34844b41eb MFC r261804:
Provide additional information in some panic strings.
2014-05-06 03:05:14 +00:00
rmacklem
5bd3f1337e MFC: r264630
For NFS mounts using rsize,wsize=65536 over TSO enabled
network interfaces limited to 32 transmit segments, there
are two known issues.
The more serious one is that for an I/O of slightly less than 64K,
the net device driver prepends an ethernet header, resulting in a
TSO segment slightly larger than 64K. Since m_defrag() copies this
into 33 mbuf clusters, the transmit fails with EFBIG.
A tester indicated observing a similar failure using iSCSI.

The second less critical problem is that the network
device driver must copy the mbuf chain via m_defrag()
(m_collapse() is not sufficient), resulting in measurable overhead.

This patch reduces the default size of if_hw_tsomax
slightly, so that the first issue is avoided.
Fixing the second issue will require a way for the
network device driver to inform tcp_output() that it
is limited to 32 transmit segments.
2014-05-06 02:54:59 +00:00
rmacklem
a54326376a MFC: r264517
Vlan did not set the value of if_hw_tsomax, so when vlan
was stacked on top of a network interface that set if_hw_tsomax,
tcp_output() would see the default value instead of the value
set by the network interface. This patch modifies vlan so that
it sets if_hw_tsomax to the value of the parent interface.
2014-05-06 02:49:31 +00:00
rmacklem
1f951a5c9b MFC: r264469, r264498
Lagg did not set the value of if_hw_tsomax, so when lagg
was stacked on top of network interfaces that set if_hw_tsomax,
tcp_output() would see the default value instead of the value
set by the network interface(s). This patch modifies lagg so that
it sets if_hw_tsomax to the minimum of the value(s) for the
underlying network interfaces.
2014-05-06 02:44:01 +00:00
np
3942b0b24c MFC r261533, r261536, r261537, and r263457.
r261533:
cxgbe(4): Use the port's tx channel to identify it to t4_clr_port_stats.

r261536:
cxgbe(4): The T5 allows for a different freelist starvation threshold
for queues with buffer packing.  Use the correct value to calculate a
freelist's low water mark.

r261537:
cxgbe(4): Use the rx channel map (instead of the tx channel map) as the
congestion channel map.

r263457:
cxgbe(4):  Recognize the "spider" configuration where a T5 card's 40G
QSFP port is presented as 4 distinct 10G SFP+ ports to the driver.
2014-05-06 02:22:52 +00:00
ken
a354f057f0 MFC the mpr(4) driver for LSI's 12Gb SAS cards.
This includes r265236, r265237, r265241 and r265261:

  ------------------------------------------------------------------------
  r265236 | ken | 2014-05-02 14:25:09 -0600 (Fri, 02 May 2014) | 51 lines

  Bring in the mpr(4) driver for LSI's MPT3 12Gb SAS controllers.

  This is derived from the mps(4) driver, but it supports only the 12Gb
  IT and IR hardware including the SAS 3004, SAS 3008 and SAS 3108.

  Some notes about this driver:
   o The 12Gb hardware can do "FastPath" I/O, and that capability is included in
     this driver.

   o WarpDrive functionality has been removed, since it isn't supported in
     the 12Gb driver interface.

   o The Scatter/Gather list handling code is significantly different between
     the 6Gb and 12Gb hardware.  The 12Gb boards support IEEE Scatter/Gather
     lists.

  Thanks to LSI for developing and testing this driver for FreeBSD.

  share/man/man4/mpr.4:
  	mpr(4) man page.

  sys/dev/mpr/*:
  	mpr(4) driver files.

  sys/modules/Makefile,
  sys/modules/mpr/Makefile:
  	Add a module Makefile for the mpr(4) driver.

  sys/conf/files:
  	Add the mpr(4) driver.

  sys/amd64/conf/GENERIC,
  sys/i386/conf/GENERIC,
  sys/mips/conf/OCTEON1,
  sys/sparc64/conf/GENERIC:
  	Add the mpr(4) driver to all config files that currently
  	have the mps(4) driver.

  sys/ia64/conf/GENERIC:
  	Add the mps(4) and mpr(4) drivers to the ia64 GENERIC
  	config file.

  sys/i386/conf/XEN:
  	Exclude the mpr module from building here.

  Submitted by:	Steve McConnell <Stephen.McConnell@lsi.com>
  Tested by:	Chris Reeves <chrisr@spectralogic.com>
  Sponsored by:	LSI, Spectra Logic
  Relnotes:	LSI 12Gb SAS driver mpr(4) added

  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r265237 | ken | 2014-05-02 14:36:20 -0600 (Fri, 02 May 2014) | 8 lines

  Add the mpr(4) man page to the man4 Makefile.

  This should have been included in r265236.

  Submitted by:	Steve McConnell <Stephen.McConnell@lsi.com>
  MFC after:	3 days
  Sponsored by:	LSI, Spectra Logic

  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r265241 | brueffer | 2014-05-02 15:14:28 -0600 (Fri, 02 May 2014) | 2 lines

  Use our standard SYNOPSIS wording; perform some cleanup while here.

  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r265261 | brueffer | 2014-05-03 05:15:28 -0600 (Sat, 03 May 2014) | 2 lines

  Add a missing colon.

  ------------------------------------------------------------------------

Submitted by:	Steve McConnell <Stephen.McConnell@lsi.com>
Tested by:	Chris Reeves <chrisr@spectralogic.com>
Sponsored by:	LSI, Spectra Logic
Relnotes:	LSI 12Gb SAS driver mpr(4) added
2014-05-05 20:35:35 +00:00
markj
0bbe9c267f MFC r262661:
Fix emulation of call and jmp instructions on i386 and for 32-bit processes
on amd64.
2014-05-05 03:15:53 +00:00
kevlo
896088154c MFC r264317, r264864:
- Add the Asus USB-N10 NANO [1]
- Fix panic by adding mtx_assert() to urtwn_init_locked() and
  urtwn_stop_locked() [2]

Tested by:	Kuan-Chung Chiu <buganini@gmail.com> [1]
		Anthony Jenkins <scoobi_doo at yahoo dot com> [2]
2014-05-05 01:50:01 +00:00
kib
2dee5cfb76 MFC r265004:
Same as it was done in r263878 for invlrng_handler(), fix order of
checks for special pcid values in invlpg_pcid_handler().
2014-05-04 07:22:51 +00:00
kib
839393d336 MFC r265002:
Fix vm_fault_copy_entry() operation on upgrade; allow it to find the
pages in the shadowed objects.
2014-05-04 07:19:37 +00:00
bryanv
9653be1bc2 MFC r261150, r261151, r261164, r261166, r261167, r261168, r261394, r261395:
- Read and write the MAC address in the config space byte by byte
 - Also include the mbuf's csum_flags in an assert message
 - Remove stray space
 - Move duplicated transmit start code into a single function
 - Avoid queue unlock followed by relock when the enable interrupt race
   is lost
 - Check for a full virtqueue in the multiqueue transmit path
 - Do not place the sglist used for Rx/Tx on the stack
 - Use m_defrag() instead of m_collapse() to compact a long mbuf chain
2014-05-03 19:40:41 +00:00
bryanv
8d49b2e263 MFC r261147:
Remove spaces before tabs in the function prototype list
MFC r261149:
    Read each field of the configuration individually
2014-05-03 17:33:30 +00:00
markj
ca7f99a689 MFC r262543:
Fix the struct reg mappings for i386 and amd64, which differ between illumos
and FreeBSD.
2014-05-03 16:24:18 +00:00
markj
607e8b47f9 MFC r262542:
Move some files that are identical on i386 and amd64 to an x86 subdirectory
rather than keeping duplicate copies.
2014-05-03 16:08:52 +00:00
ae
1029f2ba6f MFC r264494:
Use SMB_QUERY_FS_SIZE_INFO request to populate statfs structure.
  When server doesn't support this request, try to use SMB_INFO_ALLOCATION.
  And use SMB_COM_QUERY_INFORMATION_DISK request as fallback.

MFC r264600:
  Remove redundant unlock.

  This code was removed from the opensolaris and darwin's
  netsmb implementations, in DfBSD it also has been disabled.
2014-05-02 21:30:59 +00:00
pfg
7c82f25917 MFC r264040:
4248 dtrace(1M) should never create DOF with empty probes section
4249 Only probes from the first DTrace object file will be included

Illumos Revision:	4a20ab41aadcb81c53e72fc65886e964e9add59

Reference:
https://www.illumos.org/issues/4248
https://www.illumos.org/issues/4249

Obtained from:	Illumos
2014-05-02 20:12:31 +00:00
trociny
4d8a3153db MFC r264963:
Define startup order the same way as it is in dummynet.
2014-05-02 14:44:17 +00:00
markj
79d434517b MFC r262733:
Use a full path to the target for make rules which create symlinks @,
machine and ${MACHINE_CPUARCH}. Otherwise the presence of a file named
"x86" or "x86.c" in the make path can cause problems.
2014-05-01 03:18:11 +00:00
smh
e6ff96679c MFC r265046
Fix ZIO reordering issue which could cause data loss / corruption.

Sponsored by:	Multiplay
2014-04-30 09:55:50 +00:00
delphij
acd7398463 Fix devfs rules not applied by default for jails.
Fix OpenSSL use-after-free vulnerability.

Fix TCP reassembly vulnerability.

Security:	FreeBSD-SA-14:07.devfs
Security:	CVE-2014-3001
Security:	FreeBSD-SA-14:08.tcp
Security:	CVE-2014-3000
Security:	FreeBSD-SA-14:09.openssl
Security:	CVE-2010-5298
2014-04-30 04:03:05 +00:00
hselasky
65035c2d37 MFC r265015:
Setting the IMOD value below 0x3F8 can cause IRQ lockups in the Intel
LynxPoint USB 3.0 controllers found in MacBookPro 2013's.
2014-04-29 05:45:17 +00:00
ian
3e706bc125 MFC r263052, r263124, r263265, r263267... Enhance loaderdev env var.
Enhance the mechanism that lets you configure the ubldr boot device by
setting the u-boot environment variable loaderdev=.  It used to accept only
'disk' or 'net'.  Now it allows specification of unit, slice, and partition
as well.  In addition to the generic 'disk' it also accepts specific
storage device types such as 'mmc' or 'sata'.

If there isn't a loaderdev env var, the historical behavior is maintained.
It will use the first storage device it finds, or a network device if
no working storage device exists.

99% of the work on this was done by Patrick Kelsey, but I made some
changes, so if anything goes wrong, blame me.

(Indeed, the 3 followup commits fixed things I got wrong on the first.)
2014-04-29 00:45:42 +00:00
ian
4d985863b1 MFC r262666: exit with code 0xbadab1 if the u-boot API support is missing. 2014-04-29 00:38:46 +00:00
ian
0eaada9b3b MFC r262664, r262694:
Prevent fdt data loaded from a file from overwriting the kernel environment,
  by having uboot_autoload() do the fdt setup (which may load a file) rather
  than waiting until we're actually in the process of launching the kernel.

  As part of making this happen...
   - Define LOADER_FDT_SUPPORT on the uboot/lib compile command line when
     MK_FDT is set.
   - Make fdt_setup_fdtb() public.
   - Declare public fdt_whatever() functions in a header instead of using
     scattered extern decls in .c files.
2014-04-29 00:36:51 +00:00
ian
56bd016e78 MFC r262340, r262345, r262347, find and load an appropriate dtb file.
The search order for a usable dtb in fdt_setup_fdtp() is now

 - A dtb loaded with an explicit "load -t dtb" command.
 - A dtb already loaded into memory somehow[*] and pointed to by fdt_to_load.
 - A dtb in the memory pointed to by the u-boot env vars fdtaddr or fdt_addr.
 - A file named by the u-boot env vars fdtfile or fdt_file.
 - A static dtb compiled into the kernel.

 * Presumably by some arch-specific command or code.
2014-04-29 00:31:32 +00:00
ian
4793c2eddb MFC r262337: Allow the boot device to be choosen by a u-boot env variable.
If a "loaderdev=<device>" env variable is set and the named device
  exists, it is used.  If the device doesn't exist, fall back to the
  historic "probe" loop that prefers disk devices over network devices.
2014-04-29 00:17:30 +00:00
ian
d388ba01ef MFC r262326 (white space) and r262327 (fdt_addr).
This change was supposed to be whitespace only, but a functional change
snuck in, as follows:

  Look for both fdtaddr and fdt_addr env var names.  Grepping the u-boot
  source shows that board vendors seem to be about evenly split on this.
  The added lines were:

    /* Board vendors use both fdtaddr and fdt_addr names.  Grrrr. */

    if (s == NULL)
        s = ub_env_get("fdt_addr");
2014-04-29 00:13:25 +00:00
ian
a021bcb6d4 MFC r261819 & r262242: Actually validate the header of a loaded dtb file. 2014-04-29 00:09:48 +00:00
ian
bd2b096941 MFC r257210, r258527: No hardfloat in ubldr, save/restore r9 for api calls. 2014-04-28 23:46:04 +00:00
ian
1fa6b5cd9c MFC r264800: fixes for problems found by Coverity scan...
- Get transmit loop more in line with the other serial drivers.
  - Add a comment about FTDI and ZLPs.
  - Correctly check odditiy of baud rate divisor.
  - Correct IOCTL handling for "error" and "event" char.
2014-04-28 13:12:19 +00:00
ian
cb4d7c77b6 MFC uftdi(4) driver changes...
r264010: Support speeds up to 12mbaud on newer chips.
  r264031: Use 2K IO buffers for improved throughput.
  r264149: Add ioctl(2) calls to access bitbang, MPSSE, CPU_FIFO,
           and other modes.
2014-04-28 12:46:23 +00:00
mm
5b89692b00 MFC r264689:
De-virtualize UMA zone pf_mtag_z and move to global initialization part.

The m_tag struct does not know about vnet context and the pf_mtag_free()
callback is called unaware of current vnet. This causes a panic.

PR:		kern/182964
2014-04-27 09:05:34 +00:00
marius
5b12da65bf MFC: r264832
- Sprinkle const and static as appropriate.
- Convert the remainder of snd_hda(4) to take advantage of nitems().
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.
2014-04-26 01:00:28 +00:00
marius
7d037e3a60 MFC: r264831
Add quirk to configure headphones redirection on Intel DH87RL boards.
2014-04-26 00:40:16 +00:00
marius
ad9e466c20 MFC: r260064
- Probe with BUS_PROBE_DEFAULT instead of 0.
- Nuke code setting PCI_POWERSTATE_D0; pci(4) already does that for type 0
  devices.
- There's no need to keep track of resource IDs.
- Quiesce the interrupt before actually detaching.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.
2014-04-25 22:23:38 +00:00
marius
ebc043d66b MFC: r260063
- Probe with BUS_PROBE_DEFAULT instead of 0.
- Nuke code setting PCI_POWERSTATE_D0; pci(4) already does that for type 0
  devices.
- Use PCIR_BAR instead of a homegrown macro.
- There's no need to keep track of resource IDs.
- Quiesce the interrupt before actually detaching.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.
2014-04-25 22:19:18 +00:00
marius
20ee9198c9 MFC: r260061
- Add support for using MSI instead of INTx, controllable via the tunable
  hw.ral.msi_disable (defaulting to using MSI).
- Probe with BUS_PROBE_DEFAULT instead of 0.
- Nuke code setting PCI_POWERSTATE_D0; pci(4) already does that for type 0
  devices.
- Use PCIR_BAR instead of a homegrown macro.
- There's no need to keep track of resource IDs.
- Release resources again in case attaching fails.
- Quiesce the interrupt before detaching.
- Sprinkle const.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.
- Trim headers.
- Nuke dupe $FreeBSD$.
2014-04-25 22:04:40 +00:00
marius
9fecd67a52 MFC: r260058
- Remove a redundant variable in mpt_pci_attach().
- #if 0 the currently unused paired port linking and unlinking of dual
  adapters.
- Simplify MSI/MSI-X allocation and release. For a single one, we don't need
  to fiddle with the MSI/MSI-X count and pci_release_msi(9) is smart enough
  to just do nothing in case of INTx.
- Canonicalize actions taken on attach failure and detach.
- Remove the remainder of incomplete support for older FreeBSD versions.
2014-04-25 22:01:02 +00:00
marius
d0bdbe8092 MFC: r260086
- Probe with BUS_PROBE_DEFAULT instead of 0.
- Remove clearing PCIM_CMD_INTxDIS; pci(4) will do that as appropriate since
  r189367.
2014-04-25 21:58:28 +00:00
marius
6fda5991f6 MFC: r260053
- There's no need to keep track of resource IDs.
- Simplify MSI allocation and release. For a single one, we don't need to
  fiddle with the MSI count and pci_release_msi(9) is smart enough to just
  do nothing in case of INTx.
- Don't allocate MSI as RF_SHAREABLE.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.
2014-04-25 21:42:52 +00:00
marius
195efbca74 MFC: r260050, r261528
- Switch to using the common MII bitbang'ing code instead of duplicating it.
- Based on lessons learnt with dc(4) (see r185750), add bus space barriers to
  the MII bitbang read and write functions as well as to instances of page
  switching.
- Add missing locking to ed_ifmedia_{upd,sts}().
- Canonicalize some messages.
- Based on actual functionality, ED_TC5299J_MII_DIROUT should be rather named
  ED_TC5299J_MII_DIRIN.
- Remove unused headers.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.
2014-04-25 21:32:34 +00:00
marius
74997a8fe2 MFC: r260045
- Simplify MSI allocation and release. For a single one, we don't need to
  fiddle with the MSI count and pci_release_msi(9) is smart enough to just
  do nothing in case of INTx.
- Don't allocate MSI as RF_SHAREABLE.
2014-04-25 21:28:39 +00:00
marius
68e83c58d9 MFC: r260044
Free the MSI again on detach if allocated. Arguably, this code would be
better off living in aac_pci.c, but it doesn't seem worth creating a
aac_pci_detach() and it's also not the first PCI-specific bit in aac.c
2014-04-25 21:24:33 +00:00
hselasky
ed891fed44 MFC r264653:
Add new USB quirk.
2014-04-25 09:53:15 +00:00
ae
94eabd9f66 MFC r264582:
Remove unused variable.

PR:		173521
2014-04-24 11:12:53 +00:00
mav
c2e3819ca8 MFC r264318:
Fix wrong sizes used to access PD_Type and PD_State DDF metadata fields.

This caused incorrect behavior of arrays with big-endian DDF metadata.
Little-endian (like used by Adaptec controllers) should not be harmed.
Add workaround should be enough to manage compatibility.
2014-04-24 10:22:00 +00:00
bryanv
7f430de4a1 MFC r263259
Add Tx/Rx multiqueue support to vmx(4)

    As a prerequisite for multiple queues, the guest must have MSIX enabled.
    Unfortunately, to work around device passthrough bugs, FreeBSD disables
    MSIX when running as a VMWare guest due to the hw.pci.honor_msi_blacklist
    tunable; this tunable must be disabled for multiple queues.

    Also included is various minor changes from the projects/vmxnet branch.

MFC r264865
    Update the date that was missed in r263259
2014-04-24 04:43:50 +00:00
mav
825aecc9cf MFC r264550:
Fix VIRTUAL and PROF interval timers for short intervals, broken at r247903.

Due to the way those timers are implemented, we can't handle very short
intervals.  In addition to that mentioned patch caused math overflows
for short intervals.  To avoid that round those intervals to 1 tick.

PR:		kern/187668
2014-04-23 12:46:27 +00:00
brueffer
d9c1f7d446 MFC: r264422, r264471
Set buf to NULL only when we don't allocate memory,
and free buf unconditionally.

Found with:	Coverity Prevent(tm)
Requested by:	kib (r264471)
2014-04-23 12:15:14 +00:00
brueffer
0cbc420487 MFC: r264482
Re-indent break statement.
2014-04-23 12:08:20 +00:00
ae
a243d13ce7 MFC r264124:
Remove dead code.

MFC r264125:
  Remove unused variable.

MFC r264126:
  The check for local address spoofing lacks ifaddr locking.
  Remove these loops and use in_localip() and in6_localip()
  functions instead.

MFC r264520:
  Remove _IP_VHL* macros and related ifdefs.
2014-04-23 11:22:54 +00:00
ae
8057942ba8 MFC r264540:
Set oif only for outgoing packets.

  PR:		188543
2014-04-23 09:56:17 +00:00
brueffer
4bf359bbbf MFC: r264421
Free resources in error cases; re-indent a curly brace while here.

CID:		1199366
Found with:	Coverity Prevent(tm)
2014-04-23 07:22:40 +00:00
markj
ec059ac886 MFC r262596:
4478 dtrace_dof_maxsize is far too small

illumos/illumos-gate@d339a29bb4
2014-04-23 03:26:29 +00:00
brueffer
37a4748dfc MFC: r264416
Add a missing comma between error message definitions.

CID:		1199266
Found with:	Coverity Prevent(tm)
MFC after:	1 week
2014-04-22 21:02:02 +00:00
marius
f2fa870ceb MFC: r264257, r264327, r264514
Distinguish between the different variants and configurations of Sunix
{MIO,SER}5xxxx chips instead of treating all of them as PUC_PORT_2S.
Among others, this fixes the hang seen when trying to probe the none-
existent second UART on an actually 1-port chip.

Obtained from:	NetBSD (BAR layouts)
Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-04-22 13:02:03 +00:00
yongari
353e3008f5 MFC r264293:
Add workaround for MCP61 Ethernet controller found on MSI K9
  motherboard.  PHY hardware used for the controller responded at
  all possible addresses which in turn resulted in having 32 PHYs
  for the controller.  If driver detects "MSI K9N6PGM2-V2 (MS-7309)"
  motherboard, tell miibus(4) PHY is located at 0.
2014-04-22 04:35:07 +00:00
yongari
e9b36215b6 MFC r264062:
Correct endianness handling in getting station address from EEPROM.
  While I'm here, remove aue_eeprom_getword() as its only usage is to
  read station address and make it more readable.  This change is
  inspired by NetBSD.
  With this change, aue(4) should work on big endian architectures.

  PR:	188177
2014-04-22 04:30:24 +00:00
emax
e8052c13e8 MFC r264621
use correct (integer) type for the temperature sysctl

Reviewed by:	np, scottl
Obtained from:	Netflix
2014-04-21 17:17:23 +00:00
sbruno
6771e94c82 MFC r264127
Add PCI-IDs for TBD Gen9 RAID controller HBAs from HP to ciss(4)

Submitted by:	Benesh, Scott <scott.benesh@hp.com>
Sponsored by:	Yahoo! Inc.
2014-04-21 16:54:38 +00:00
mav
757e439c97 MFC r264193:
In addition to r264077, tell GEOM that we do support BIO_DELETE now.
2014-04-21 16:46:44 +00:00
mav
dbfef773ce MFC r264077:
Add BIO_DELETE support to ZVOL.

It is an adapted merge from the vendor branch of:
    701 UNMAP support for COMSTAR  (in part related to ZFS)
    2130 zvol DKIOCFREE uses nested DMU transactions
2014-04-21 16:42:15 +00:00
mav
cfbba1d7fc MFC r264341:
Create zvol devices on zfs clone.

While big and shiny patch is not ready, it is better to have something.

PR:		kern/178999
2014-04-21 16:33:49 +00:00
mav
f908bd3cc2 MFC r264191:
Report stripe size and offset of the backing device in READ CAPACITY (16)
as physical sector size and offset.
2014-04-21 16:26:24 +00:00
ae
7125a2147c MFC r264364:
Properly release the in6_multi lock.

Sponsored by:	Yandex LLC
2014-04-21 11:17:29 +00:00
bdrewery
73c210dce0 MFC r264142:
Show error code when failing to destroy a mirror on delay
2014-04-21 02:49:41 +00:00
bdrewery
5d04f39f50 MFC r264320:
Fix spelling error in g_trace() call.
2014-04-21 02:48:04 +00:00
kib
be9f211c78 MFC r264620:
Fix typo.
2014-04-20 01:37:30 +00:00
hselasky
585ac61d0c MFC r264340:
Correct IMOD default value according to comment.
2014-04-18 07:48:29 +00:00
jhb
2e8b45c43c MFC 258860,260167,260238,260397:
- Restructure the VMX code to enter and exit the guest. In large part this
  change hides the setjmp/longjmp semantics of VM enter/exit.
  vmx_enter_guest() is used to enter guest context and vmx_exit_guest() is
  used to transition back into host context.

  Fix a longstanding race where a vcpu interrupt notification might be
  ignored if it happens after vmx_inject_interrupts() but before host
  interrupts are disabled in vmx_resume/vmx_launch. We now call
  vmx_inject_interrupts() with host interrupts disabled to prevent this.
- The 'protection' field in the VM exit collateral for the PAGING exit is
  not used - get rid of it.

Reviewed by:	grehan
2014-04-17 18:00:07 +00:00
ray
cd3c0c7897 MFC r264258
Fix cursor color in reverse video mode.

Sponsored by:	The FreeBSD Foundation
2014-04-17 14:18:30 +00:00
trasz
37c6468863 MFC r262837:
Make reset handling in iSCSI target RFC-compliant.  This fixes some rare
hangs with Open-iSCSI (Linux).

Sponsored by:	The FreeBSD Foundation
2014-04-17 12:41:12 +00:00
emax
13d344e5ca MFC r263690
change defaule permissions on /dev/devstat. while i'm here remove
D_NEEDGIANT flag

Submitted by:	jhb
Reviewed by:	jhb, scottl, rwatson, delphij, phk
2014-04-16 17:57:08 +00:00
mav
71409ea2b1 MFC r264311 (by smh):
Fix build breakage caused by r264295
2014-04-16 15:27:14 +00:00
mav
469b08489b MFC r264307:
Fix three refcounter leaks and lock recursion they covered.
2014-04-16 10:05:35 +00:00
mav
b3571af592 MFC r264295:
Remove support of LUN-based CD changers from cd(4) driver.

This code was heavily broken few months ago during CAM locking changes.
Fixing it would require almost complete rewrite.  Since there are no
known devices on market using this interface younger then ~15 years, and
they are CD, not even DVD, I don't see much reason to rewrite it.

This change does not mean those devices won't work.  They will just work
slower due to inefficient disks load/unload schedule if several LUNs
accessed same time.
2014-04-16 10:04:19 +00:00
sbruno
9b6cbf64ed MFC r264354
Fix insta-panic on assert of unlocked periph mtx in ciss(4) when
logical volume state changes.

Sponsored by:	Yahoo! Inc.
2014-04-15 17:49:47 +00:00
tijl
e8ab551e5f MFC r263998:
Rename __wchar_t so it no longer conflicts with __wchar_t from clang 3.4
-fms-extensions.
2014-04-15 09:41:52 +00:00
scottl
7d93aa7db1 MFC r261558
Add a new sysctl, dev.cxgbe.N.rsrv_noflow, and a companion tunable,
hw.cxgbe.rsrv_noflow.  When set, queue 0 of the port is reserved for
TX packets without a flowid.  The hash value of packets with a flowid
is bumped up by 1.  The intent is to provide a private queue for
link-level packets like LACP that is unlikely to overflow or suffer
deep queue latency.
2014-04-15 08:08:44 +00:00
scottl
425242a210 MFC r264229
Add some assertions to ensure that the target array doesn't get accessed
out of bounds.
2014-04-15 08:02:57 +00:00
scottl
d06a5364e1 MFC r262814
- If we fail to do a non-blocking acquire of a buf lock while doing a
  waiting sync pass we need to do a blocking acquire and restart.
  Another thread, typically the buf daemon, may have this buf locked and
  if we don't wait we can fail to sync the file.  This lead to a great
  variety of softdep panics because we rely on all dependencies being
  flushed before proceeding in several cases.

Submitted by:	jeffr
2014-04-15 07:54:17 +00:00
scottl
c804ca5e78 MFC r262812
- Gracefully handle truncation failures when trying to shrink directories.
  This could cause dirhash panics since the dirhash state would be
  successfully truncated while the directory was not.

Submitted by:   jeffr
2014-04-15 07:50:18 +00:00
jmmv
d9b0a628da MFC various fixes to the tools/regression/ tests.
- r262953 Fix m4 tests so that they run cleanly with prove.
- r262954 Fix printf tests so that they run cleanly with prove.
- r262959 Fix sed tests so that they run cleanly with prove.
- r262960 Fix yacc tests so that they run cleanly with prove.
- r262961 Fix pkill tests so that they run cleanly with prove.
- r262962 Fix ncal tests so that they run cleanly with prove.
- r263081 Fix lastcomm tests under amd64.
- r263082 Only run the make tests when make is fmake.
- r263083 Fix sa tests.
- r263084 Turn a test precondition into a skip in the mdconfig tests.
- r263085 Make the strerror tests work without libtap.
- r263087 Remove broken tests for eui64_line.
- r263221 Change etcupdate tests to return 1 on test failures.
- r263352 Make the priv test program exit with non-zero if any failures are detected.
- r263353 errx prepends the program name to the message; don't do it by hand.
- r263362 Include strings.h so that bpf_filter.c can be built in userland.
2014-04-14 13:30:08 +00:00
ray
bd8afe2477 MFC 264242,264244,264259
Fix panic on load new driver while vt(4) is in VGA textmode.
o Mute terminal while vt(4) driver change in progress.
o Reset VDF_TEXTMODE before init new driver.
o Assign default font, if new driver is not in TEXTMODE.
o Do not update screen while driver changing.
o Unmute terminal when done with driver replacement.
o Move init fonts to early point.
o Minor cleanup.
o Do not fill screen, while muted. (kern/subr_terminal.c)

Sponsored by:	The FreeBSD Foundation
2014-04-14 12:40:37 +00:00
mm
e1ea0d7316 MFC r264220:
Execute pf_overload_task() in vnet context. Fixes a vnet kernel panic.

Reviewed by:	trociny
2014-04-14 09:36:15 +00:00
yongari
457d0ba100 MFC r260429:
m_defrag(9) does not touch original mbuf chain when it can't
  allocate new mbuf.  Free original mbuf chain when driver is not
  able to send the packet.
2014-04-14 05:04:23 +00:00
yongari
6a63f9b17b MFC r259543:
Failed m_devget(9) indicates lack of free mbuf cluster.  Update
  if_iqdrops counter for that case since the received frame is ok.
  While here, simplify updating counter logic.
2014-04-14 04:58:50 +00:00
yongari
fa731335a2 MFC r263957:
Increase the number of TX DMA segments from 32 to 35.  It turned
  out 32 is not enough to support a full sized TSO packet.
  While I'm here fix a long standing bug introduced in r169632 in
  bce(4) where it didn't include L2 header length of TSO packet in
  the maximum DMA segment size calculation.
2014-04-14 04:51:59 +00:00
andreast
0918f176a2 MFC r260607, r260610, r260934:
r260607:
The onyx codec works also as module, so add it.

r260610:
Described in the man page but not implemented. Here it comes,
atomic_swap_32/64. The latter only for powerpc64.

r260934:
Fix the resource information for the i2s-a node on certain G5 PowerMacs.
This is the first step needed to get the snapper codec working on those
machines.
The second step is to enable the corresponding I2S device and its clock.

Tested on machines where the snapper codec was already working, a G4 PowerBook
and a PowerMac9,1 with a Shasta based macio.
The PowerMac7,2/7,3 with a K2 based macio can now also play sound.
2014-04-12 19:57:15 +00:00
kib
91bb0a33cf MFC r264173:
Use realloc(9) instead of doing the reallocation inline.
2014-04-12 14:18:25 +00:00
kib
67f7cbcad8 MFC r264146:
Fix a race between kqueue_register() and kqueue_scan() setting KN_INFLUX
flag while knlist is not locked, which caused lost notifications from
parallel knote().
2014-04-12 14:08:53 +00:00
dchagin
ee7f22ddbc MFC r264151:
Prevent alq from panic when the invalid alq_file path specified.
2014-04-12 06:50:11 +00:00
hselasky
fde2f5ed58 MFC r264294:
Fix for infinite XHCI reset loops when the set address USB request fails.
2014-04-11 06:13:56 +00:00
joerg
8f4a94c1c9 Merge r264084: make the Dresden Elektronik "USB Level Shifter Low Cost"
known to the FTDI driver.
2014-04-10 21:53:50 +00:00
glebius
a25c39725c Merge r263203: garbage collect long time obsoleted (or never used) stuff
from routing API.
2014-04-09 11:15:50 +00:00
peter
f93104a916 Bump osreldate for tracking SA-14:06 2014-04-09 01:26:58 +00:00
delphij
7ec723c6ae Fix NFS deadlock vulnerability. [SA-14:05]
Fix "Heartbleed" vulnerability and ECDSA Cache Side-channel
Attack in OpenSSL. [SA-14:06]
2014-04-08 18:27:39 +00:00
ae
d32682111b MFC r263969,263971:
Don't generate an ICMPv6 error message if packet was consumed by filter.
  Remove unused label.

Sponsored by:	Yandex LLC
2014-04-07 12:58:54 +00:00
ae
92efc4b623 MFC r263966:
Don't copy the MF flag from original IP header to ICMP error message.

PR:		188092
Sponsored by:	Yandex LLC
2014-04-07 12:50:08 +00:00
pfg
f0fa402e84 MFC r264121;
gcc: define __block when block support is enabled

This mimics the behaviour in clang and lets us build cleanly
the libdispatch port on platforms where the base gcc is still
the default compiler.

Bump __FreeBSD_version for ports.

Tested by:	theraven
2014-04-07 01:55:54 +00:00
pfg
0a0ec7aed4 MFC r263973;
ddb: Minor style cleanups.

#define should be followed by tab.
2014-04-07 01:49:30 +00:00
kib
660fbf80db MFC r263912:
Clear the kernel grab of the FPU state on fork.
2014-04-05 14:24:29 +00:00
kib
5e4b8bc0fd MFC r263878:
Several fixes for the PCID implementation.
2014-04-04 19:17:33 +00:00
royger
382b727d12 MFC r263001
Move asm IPIs handlers to C code, so both Xen and native IPI handlers
share the same code.

Approved by: gibbs
Sponsored by: Citrix Systems R&D
2014-04-04 14:54:54 +00:00
ray
6c8c52eb6b MFC r263885
o Add new vd_driver method to do bitblt with mask, named vd_maskbitbltchr.
o Move vd_bitbltchr vga's driver method to vd_maskbitbltchr.
o Implement new vd_bitbltchr method for vga driver. (It do single write for 8
	pixels, have to be a bit faster).

Sponsored by:	The FreeBSD Foundation
2014-04-04 11:17:49 +00:00
glebius
be0e4274f5 Merge r262341:
- Improve logging of send errors, reporting error code and interface.
  - Reduce code duplication between INET and INET6.
2014-04-04 10:33:59 +00:00
asomers
6b6e4c2d32 MFC r263116
Replace 4.4BSD Lite's unix domain socket backpressure hack with a cleaner
mechanism, based on the new SB_STOP sockbuf flag.  The old hack dynamically
changed the sending sockbuf's high water mark whenever adding or removing
data from the receiving sockbuf.  It worked for stream sockets, but it never
worked for SOCK_SEQPACKET sockets because of their atomic nature.  If the
sockbuf was partially full, it might return EMSGSIZE instead of blocking.

The new solution is based on DragonFlyBSD's fix from commit
3a6117bbe0ed6a87605c1e43e12a1438d8844380 on 2008-05-27.  It adds an SB_STOP
flag to sockbufs.  Whenever uipc_send surpasses the socket's size limit, it
sets SB_STOP on the sending sockbuf.  sbspace() will then return 0 for that
sockbuf, causing sosend_generic and friends to block.  uipc_rcvd will
likewise clear SB_STOP.  There are two fringe benefits: uipc_{send,rcvd} no
longer need to call chgsbsize() on every send and receive because they don't
change the sockbuf's high water mark.  Also, uipc_sense no longer needs to
acquire the UIPC linkage lock, because it's simpler to compute the
st_blksizes.

There is one drawback: since sbspace() will only ever return 0 or the
maximum, sosend_generic will allow the sockbuf to exceed its nominal maximum
size by at most one packet of size less than the max.  I don't think that's
a serious problem.  In fact, I'm not even positive that FreeBSD guarantees a
socket will always stay within its nominal size limit.

sys/sys/sockbuf.h
	Add the SB_STOP flag and adjust sbspace()

sys/sys/unpcb.h
	Delete the obsolete unp_cc and unp_mbcnt fields from struct unpcb.

sys/kern/uipc_usrreq.c
	Adjust uipc_rcvd, uipc_send, and uipc_sense to use the SB_STOP
	backpressure mechanism.  Removing obsolete unpcb fields from
	db_show_unpcb.

tests/sys/kern/unix_seqpacket_test.c
	Clear expected failures from ATF.
2014-04-03 16:57:16 +00:00
glebius
1e3b300892 o Provide a compatibility shim for netstat(1) to obtain output queue
drops via NET_RT_IFLISTL sysctl. The sysctl handler appends oqdrops
  at the end of struct if_msghdrl, and netstat(1) sees that as an
  additional field of struct if_data. This allows us to fetch the data
  keeping ABI and API compatibility.
  This is direct commit to stable/10.

o Merge r263331 from head, to restore printing of queue drops.

Sponsored by:	Nginx, Inc.
Sponsored by:	Netflix
2014-04-03 14:58:52 +00:00
ray
003ac1d9a0 MFC r263809
Fix crash on resume in vt(9).
Statically allocated terminal window have not initialized callout handler, so we
have to initialize it even for existing window if it is console window.

Sponsored by:	The FreeBSD Foundation
2014-04-03 11:59:04 +00:00
mav
e28755359a MFC r263118:
Report ZVOL block size as GEOM stripesize.
2014-04-01 12:07:15 +00:00
ae
ed08ddc2a1 MFC r263468:
When loader(8) inspects MBR, it chooses GPT as main partition table,
  when MBR contains only PMBR entry or it is bootcamp-compatible.
  If MBR has PMBR entry and some other, the loader rejects it.

  Make these checks to be less strict. If loader decided that PMBR
  isn't suitable for GPT, it will use MBR.

  Reported by:	Paul Thornton
2014-03-31 09:34:46 +00:00
mjg
e7b96c1d34 MFC r263755:
Document a known problem with handling the process intended to receive
SIGIO in /dev/devctl.
2014-03-31 02:44:43 +00:00
mjg
0cdb222abb MFC r263704:
Make /dev/devctl mpsafe.

MFC r263753:
Remove lockless check in devopen, while correct it does not make much sense.
2014-03-31 02:30:55 +00:00
mjg
08656a370c MFC r263458:
audit: plug FILEDESC_LOCK leak in audit_canon_path.
2014-03-31 02:24:29 +00:00
mjg
ae2823466f MFC r263530:
Mark the following sysctls as MPSAFE:
kern.file
kern.proc.filedesc
kern.proc.ofiledesc
2014-03-31 02:19:57 +00:00
mjg
11fbc59f9b MFC r263460:
Take filedesc lock only for reading when allocating new fdtable.

Code populating the table does this already.
2014-03-31 02:17:58 +00:00
bdrewery
1416559ea4 MFC r263131,r263174,r263175:
Tmpfs readdir() redundant logic and code readability cleanup.

  r263131:
    Cleanup redundant logic and add some comments to help explain how it works
    in lieu of potentially less clear code.

  r263174:
    Rename cnt to maxcookies and change its use as the condition for when to
    lookup cookies to be less obscure.

  r263175:
    Add missing FALLTHROUGH comment in tmpfs_dir_getdents for looking up '.'
    and '..'.
2014-03-30 18:22:10 +00:00
bdrewery
6dfd032c57 MFC r263130:
Fix -o size less than PAGE_SIZE resulting in SIZE_MAX being used.
2014-03-30 16:51:12 +00:00
bdrewery
e696b793ca MFC r263129:
Combine similar code from vprintf(9) and log(9).
2014-03-30 16:48:04 +00:00
kib
ef58943ab3 MFC r263475:
Fix two issues with /dev/mem access on amd64, both causing kernel page
faults.

First, for accesses to direct map region should check for the limit by
which direct map is instantiated.

Second, for accesses to the kernel map, use a new thread private flag
TDP_DEVMEMIO, which instructs vm_fault() to return error when fault
happens on the MAP_ENTRY_NOFAULT entry, instead of panicing.

MFC r263498:
Add change forgotten in r263475.  Make dmaplimit accessible outside
amd64/pmap.c.
2014-03-28 15:38:38 +00:00
brueffer
a44c2eaca9 MFC: r263169
Add support for AMD Family 16h (Kabini) sensor devices.

PR:		186587
Submitted by:	David Rufino <david.rufino at gmail.com>
2014-03-28 08:55:34 +00:00
delphij
02202f1ec4 MFC r259180 (pjd) + r263123:
Hide a few messages under bootverbose.
2014-03-28 01:13:08 +00:00
asomers
df22d5312e MFC r262867
Fix PR kern/185813 "SOCK_SEQPACKET AF_UNIX sockets with asymmetrical buffers
drop packets".  It was caused by a check for the space available in a
sockbuf, but it was checking the wrong sockbuf.

sys/sys/sockbuf.h
sys/kern/uipc_sockbuf.c
	Add sbappendaddr_nospacecheck_locked(), which is just like
	sbappendaddr_locked but doesn't validate the receiving socket's space.
	Factor out common code into sbappendaddr_locked_internal().  We
	shouldn't simply make sbappendaddr_locked check the space and then call
	sbappendaddr_nospacecheck_locked, because that would cause the O(n)
	function m_length to be called twice.

sys/kern/uipc_usrreq.c
	Use sbappendaddr_nospacecheck_locked for SOCK_SEQPACKET sockets,
	because the receiving sockbuf's size limit is irrelevant.

tests/sys/kern/unix_seqpacket_test.c
	Now that 185813 is fixed, pipe_128k_8k fails intermittently due to
	185812.  Make it fail every time by adding a usleep after starting the
	writer thread and before starting the reader thread in test_pipe.  That
	gives the writer time to fill up its send buffer.  Also, clear the
	expected failure message due to 185813.  It actually said "185812", but
	that was a typo.

PR:		kern/185813
2014-03-27 16:47:35 +00:00
hselasky
5d4dbd39e3 MFC r263423:
Try to resolve a possible deadlock when detaching USB devices which
create character devices. The deadlock can happen if an application is
issuing IOCTLs which require USB refcounting, at the same time the USB
device is detaching.

There is already a counter in place in the USB device structure to
detect this situation, but it was not always checked ahead of invoking
functions that might destroy character devices, like detach, set
configuration, set alternate interface or detach active kernel driver.
2014-03-27 06:59:56 +00:00
delphij
9c78ab8bb8 MFC r262991:
Correct a typo in nlm_find_host_by_addr(): the intention of the
code is to give "<unknown>" rather than comparing the buffer
against it.
2014-03-26 23:57:09 +00:00
kib
4d414590eb MFC r263349:
Make the array pointed to by AT_PAGESIZES auxv properly aligned.
2014-03-26 16:59:28 +00:00
dim
fb422e6d31 MFC r262613:
Merge the projects/clang-sparc64 branch back to head.  This brings in
several updates from the llvm and clang trunks to make the sparc64
backend fully functional.

Apart from one patch to sys/sparc64/include/pcpu.h which is still under
discussion, this makes it possible to let clang fully build world and
kernel for sparc64.

Any assistance with testing this on actual sparc64 hardware is greatly
appreciated, as there will unavoidably be bugs left.

Many thanks go to Roman Divacky for his upstream work on getting the
sparc64 backend into shape.

MFC r262985:

Repair a few minor mismerges from r262261 in the clang-sparc64 project
branch.  This is also to minimize differences with upstream.
2014-03-26 07:31:57 +00:00
kib
5a582ae617 MFC r263306:
Add some support for the PCI(e)-PCI bridges to the Intel VT-d driver.
2014-03-25 20:17:57 +00:00
kib
879dfba7f2 MFC r263305:
Provide a workaround by identity mapping the 32 pages after the bogus
entry start, which seems to be enough for the reported BIOS.
2014-03-25 20:16:28 +00:00
trasz
49c9412490 MFC 262782:
Fix missing unlock in persistent reservations code, which resulted in panics
with Hyper-V Failover Cluster.

Sponsored by:	The FreeBSD Foundation
2014-03-25 13:18:09 +00:00
emaste
f9534c5185 MFC r263289: Update NetBSD Foundation copyrights to 2-clause BSD
The NetBSD Foundation states "Third parties are encouraged to change the
  license on any files which have a 4-clause license contributed to the
  NetBSD Foundation to a 2-clause license."

  This change removes clauses 3 and 4 from copyright / license blocks that
  list The NetBSD Foundation as the only copyright holder.

Sponsored by:	The FreeBSD Foundation
2014-03-24 13:48:04 +00:00
kib
b020ab10d3 MFC r263471:
Initialize vm_map_entry member wiring_thread on the map entry creation.
2014-03-24 12:40:53 +00:00
glebius
b117682e18 Merge r263497: fix ipfw + VIMAGE sysctls.
PR:		kern/187665
2014-03-24 10:19:07 +00:00
pfg
94058dd923 MFC: r263441:
msdosfs: minor format fix - spaces vs tab
2014-03-23 19:48:30 +00:00
hselasky
1e89433bcc MFC r263159:
Workaround for USB MIDI adapters which use non-supported values of
wMaxPacketSize for BULK endpoints.
2014-03-22 17:18:44 +00:00
hselasky
3b3c7827c3 MFC r263155:
Add support for more sample rates to USB audio driver.

PR:		usb/171254
2014-03-22 17:16:40 +00:00
edavis
6b2cc0eea6 MFC 262999
Fixed MSI interrupt allocation and handling.
Fixed a DMA mapping leak that occurs when defragmenting packet chains.

Approved by:	davidch (mentor)
2014-03-21 23:04:23 +00:00
dim
9cedb8bb69 MFC 261991:
Upgrade our copy of llvm/clang to 3.4 release.  This version supports
all of the features in the current working draft of the upcoming C++
standard, provisionally named C++1y.

The code generator's performance is greatly increased, and the loop
auto-vectorizer is now enabled at -Os and -O2 in addition to -O3.  The
PowerPC backend has made several major improvements to code generation
quality and compile time, and the X86, SPARC, ARM32, Aarch64 and SystemZ
backends have all seen major feature work.

Release notes for llvm and clang can be found here:
<http://llvm.org/releases/3.4/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.4/tools/clang/docs/ReleaseNotes.html>

MFC 262121 (by emaste):

Update lldb for clang/llvm 3.4 import

This commit largely restores the lldb source to the upstream r196259
snapshot with the addition of threaded inferior support and a few bug
fixes.

Specific upstream lldb revisions restored include:
   SVN      git
  181387  779e6ac
  181703  7bef4e2
  182099  b31044e
  182650  f2dcf35
  182683  0d91b80
  183862  15c1774
  183929  99447a6
  184177  0b2934b
  184948  4dc3761
  184954  007e7bc
  186990  eebd175

Sponsored by:	DARPA, AFRL

MFC 262186 (by emaste):

Fix mismerge in r262121

A break statement was lost in the merge.  The error had no functional
impact, but restore it to reduce the diff against upstream.

MFC 262303:

Pull in r197521 from upstream clang trunk (by rdivacky):

  Use the integrated assembler by default on FreeBSD/ppc and ppc64.

Requested by:	jhibbits

MFC 262611:

Pull in r196874 from upstream llvm trunk:

  Fix a crash that occurs when PWD is invalid.

  MCJIT needs to be able to run in hostile environments, even when PWD
  is invalid. There's no need to crash MCJIT in this case.

  The obvious fix is to simply leave MCContext's CompilationDir empty
  when PWD can't be determined. This way, MCJIT clients,
  and other clients that link with LLVM don't need a valid working directory.

  If we do want to guarantee valid CompilationDir, that should be done
  only for clients of getCompilationDir(). This is as simple as checking
  for an empty string.

  The only current use of getCompilationDir is EmitGenDwarfInfo, which
  won't conceivably run with an invalid working dir. However, in the
  purely hypothetically and untestable case that this happens, the
  AT_comp_dir will be omitted from the compilation_unit DIE.

This should help fix assertions occurring with ports-mgmt/tinderbox,
when it is using jails, and sometimes invalidates clang's current
working directory.

Reported by:	decke

MFC 262809:

Pull in r203007 from upstream clang trunk:

  Don't produce an alias between destructors with different calling conventions.

  Fixes pr19007.

(Please note that is an LLVM PR identifier, not a FreeBSD one.)

This should fix Firefox and/or libxul crashes (due to problems with
regparm/stdcall calling conventions) on i386.

Reported by:	multiple users on freebsd-current
PR:		bin/187103

MFC 263048:

Repair recognition of "CC" as an alias for the C++ compiler, since it
was silently broken by upstream for a Windows-specific use-case.

Apparently some versions of CMake still rely on this archaic feature...

Reported by:	rakuco

MFC 263049:

Garbage collect the old way of adding the libstdc++ include directories
in clang's InitHeaderSearch.cpp.  This has been superseded by David
Chisnall's commit in r255321.

Moreover, if libc++ is used, the libstdc++ include directories should
not be in the search path at all.  These directories are now only used
if you pass -stdlib=libstdc++.
2014-03-21 17:53:59 +00:00
glebius
03fdc2934e Merge r262763, r262767, r262771, r262806 from head:
- Remove rt_metrics_lite and simply put its members into rtentry.
  - Use counter(9) for rt_pksent (former rt_rmx.rmx_pksent). This
    removes another cache trashing ++ from packet forwarding path.
  - Create zini/fini methods for the rtentry UMA zone. Via initialize
    mutex and counter in them.
  - Fix reporting of rmx_pksent to routing socket.
  - Fix netstat(1) to report "Use" both in kvm(3) and sysctl(3) mode.
2014-03-21 15:15:30 +00:00
kib
a528b1ed30 MFC r263304:
Trim at EOL.
2014-03-21 13:31:56 +00:00
dim
9133572e2e MFC r262408 (by ian):
Eliminate an unused-var warning by wrapping #if 0 around some tables of
values that were probably entered "for completeness" from a datasheet, and
for all I know may be useful/necessary some day.
2014-03-21 00:19:20 +00:00
dim
d46bcdadc4 MFC r262393 (by ian):
Fix a typo _IMX51_TZICRREG_H_ -> _IMX51_TZICREG_H_ (extra R)
2014-03-20 23:48:18 +00:00
delphij
ec5d67aa46 MFC r260183: MFV r260154 + 260182:
4369 implement zfs bookmarks
4368 zfs send filesystems from readonly pools

Illumos/illumos-gate@78f1710053
2014-03-20 00:28:53 +00:00
delphij
5cc12e5eaf MFC r260181:
Fix build on platforms where atomic_swap_64 is not available.
2014-03-20 00:05:23 +00:00
delphij
e5948aa6c8 MFC r260157: MFV r260153:
4121 vdev_label_init should treat request as succeeded when pool
     is read only

illumos/illumos-gate@973c78e94b
2014-03-20 00:01:19 +00:00
delphij
ede49d4106 MFC r260150: MFV r259170:
4370 avoid transmitting holes during zfs send

4371 DMU code clean up

illumos/illumos-gate@43466aae47

NOTE: Make sure the boot code is updated if a zpool upgrade is
done on boot zpool.
2014-03-19 23:55:03 +00:00
delphij
8e41bb96f8 MFC r260141: MFV r258385:
(Note: this change is not applicable to FreeBSD and the file
is not included in build.  It's integrated for completeness).

4128 disks in zpools never go away when pulled

illumos/illumos-gate@39cddb10a3
2014-03-19 23:50:13 +00:00
delphij
874f949f14 MFC r260138: MFV r242733:
3306 zdb should be able to issue reads in parallel
3321 'zpool reopen' command should be documented in the man page
and help message

illumos/illumos-gate@31d7e8fa33

FreeBSD porting notes: the kernel part of this changeset depends
on Solaris buf(9S) interfaces and are not really applicable for
our use.  vdev_disk.c is patched as-is to reduce diverge from
upstream, but vdev_file.c is left intact.
2014-03-19 23:44:03 +00:00
delphij
5b9b9ced50 MFC r259813 + r259813: MFV r258374:
4171 clean up spa_feature_*() interfaces

4172 implement extensible_dataset feature for use by other zpool
features

illumos/illumos-gate@2acef22db7
2014-03-19 23:36:12 +00:00
dim
b7ccc923c2 MFC r259860 (by mjacob):
Harvest one no longer used constant string.

Remove another and place it into play in the
normally ifdef protected zone it would be used
int.

Noticed by:	dim
2014-03-19 22:50:14 +00:00
kib
2a9993c246 MFC r263095:
Initialize paddr to handle the case of zero size.
2014-03-19 13:09:17 +00:00
kib
741b07ba7d MFC r263092:
Do not vdrop() the tmpfs vnode until it is unlocked.  The hold
reference might be the last, and then vdrop() would free the vnode.
2014-03-19 13:04:16 +00:00
kib
5484edfdac MFC r263080:
Use correct types for sizeof() in the calculations for the malloc(9) sizes.
2014-03-19 13:02:17 +00:00
kib
7b315234ad MFC r263079:
The auio structure is only initialized when the vnode is symlink,
avoid reading from it otherwise.
2014-03-19 12:55:57 +00:00
glebius
73a339242d Merge r262747: remove extraneous ifa_ref()/ifa_free(). 2014-03-19 09:23:58 +00:00
glebius
ad70c4103e Merge r263091: fix mbuf flags clash that lead to failure of operation
of IPSEC and packet filters.

PR:		kern/185876
PR:		kern/186755
2014-03-18 16:56:05 +00:00
mav
5e93044a78 MFC r262741:
Do not retry on CAM_FUNC_NOTAVAIL error, but return immediately.
2014-03-18 14:18:45 +00:00
markj
f17aef0675 MFC r262325:
Print a backtrace if the SDT(9) stub gets called so that there's at least
some hope of figuring out how it happened.
2014-03-18 00:55:19 +00:00
markj
437134881a MFC r259535:
The fasttrap fork handler is responsible for removing tracepoints in the
child process that were inherited from its parent. However, this should
not be done in the case of a vfork, since the fork handler ends up removing
the tracepoints from the shared vm space, and userland DTrace probes in the
parent will no longer fire as a result.

Now the child of a vfork may trigger userland DTrace probes enabled in its
parent, so modify the fasttrap probe handler to handle this case and handle
the child process in the same way that it would handle the traced process.
In particular, if once traces function foo() in a process that vforks, and
the child calls foo(), fasttrap will treat this call as having come from the
parent. This is the behaviour of the upstream code.

While here, add #ifdef guards to some code that isn't present upstream.
2014-03-18 00:29:33 +00:00
delphij
78a6a60426 MFC r262676:
All callers of static method load_nvlist() in spa.c handles error case,
so there is no reason to assert that we won't hit an error.  Instead,
just return that error to caller and have the upper layer handle it.

Obtained from:	FreeNAS
Reported by:	rodrigc
Reviewed by:	Matthew Ahrens
2014-03-17 19:09:00 +00:00
hselasky
7024a257ca MFC r262972:
Ignore USB keyboard driver calls from critical sections.
2014-03-17 06:38:40 +00:00
kevlo
bcee023c7f MFC r263153, r263154:
- Similar to r246614, fix panic on removing urtwn(4).  It happens because
  nodes are freed after the adapter is gone.

- Reset the bit of the R92C_MCUFWDL associated with checksum report
  before loading firmware page.  It may fix this problem:
  "urtwn0: timeout waiting for checksum report"
2014-03-17 02:14:13 +00:00
hselasky
394eaed7a5 MFC r262663:
- Make pointer easier to control when moving slowly.
- Increase chance of vertical scrolling as vertical scrolling is used more often.
2014-03-15 18:19:09 +00:00