Commit Graph

103684 Commits

Author SHA1 Message Date
Rick Macklem
66e80f77d2 mav@ has found that NFS servers exporting ZFS file systems
can perform better when using a 128K read/write data size.
This patch changes NFS_MAXDATA from 64K to 128K so that
clients can use 128K for NFS mounts to allow this.
The patch also renames NFS_MAXDATA to NFS_SRVMAXIO so
that it is clear that it applies to the NFS server side
only. It also avoids a name conflict with the NFS_MAXDATA
defined in rpcsvc/nfs_prot.h, that is used for userland RPC.

Tested by:	mav
Reviewed by:	mav
MFC after:	2 weeks
2015-04-16 22:35:15 +00:00
Ed Maste
7dd824c370 Fix kernel build ${MACHINE} path
$M should be the kernel machine src directory, ${MACHINE}. In most cases
${MACHINE} and ${MACHINE_CPUARCH} are the same, but this is not true for
pc98 and arm64.

It appears we previously set M=${MACHINE_CPUARCH} as a workaround to
accommodate pc98, where MACHINE_CPUARCH is pc98 but it uses
sys/i386/i386/genassym.c.

arm64 relies on this being set correctly, so update $M and add explicit
workarounds for pc98.

Differential Revision:	https://reviews.freebsd.org/D2307
Reviewed by:	andrew, imp
Sponsored by:	The FreeBSD Foundation
2015-04-16 22:34:10 +00:00
Devin Teske
43d4f8c4c6 Add "GELI Passphrase:" prompt to boot loader.
A new loader.conf(5) option of geom_eli_passphrase_prompt="YES" will now
allow you to enter your geli(8) root-mount credentials prior to invoking
the kernel.

See check-password.4th(8) for details.

Differential Revision:	https://reviews.freebsd.org/D2105
Reviewed by:	imp, kmoore
Discussed on:	-current
MFC after:	3 days
X-MFC-to:	stable/10
Relnotes:	yes
2015-04-16 20:53:15 +00:00
Gleb Smirnoff
772e66a6fc Move ALTQ from contrib to net/altq. The ALTQ code is for many years
discontinued by its initial authors. In FreeBSD the code was already
slightly edited during the pf(4) SMP project. It is about to be edited
more in the projects/ifnet. Moving out of contrib also allows to remove
several hacks to the make glue.

Reviewed by:	net@
2015-04-16 20:22:40 +00:00
Neel Natu
7c0b0b9ad3 Prefer 'vcpu_should_yield()' over checking 'curthread->td_flags' directly.
MFC after:	1 week
2015-04-16 20:15:47 +00:00
Ed Maste
8b25059d94 Set MACHINE_ARCH to aarch64 for arm64
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2015-04-16 19:23:08 +00:00
Craig Rodrigues
800be1b6f9 In the version of gcc in the FreeBSD tree, this modification was made to
the compiler in svn r242182:

#if STDC_HOSTED
#include <mm_malloc.h>
#endif

A similar change was done to clang in the FreeBSD tree in svn r218893:

However, for external gcc toolchains, this patch is not in the compiler's header
file.

This patch to FreeBSD's aesni code allows compilation with an external
gcc toolchain.

Differential Revision: https://reviews.freebsd.org/D2285
Reviewed by:  jmg, dim
Approved by:  dim
2015-04-16 17:42:52 +00:00
John Baldwin
3b2fd85e29 Remove THRMISC_VERSION. The thrmisc structure doesn't include a version
number, so this wasn't used (and can't easily be added).  If at some point
we want to extend thrmisc, we will probably need to just add a new note
type and ensure that the new type includes a version number.

Discussed with:	kib
MFC after:	2 weeks
2015-04-16 12:58:51 +00:00
Julien Charbon
5571f9cf81 Fix an old and well-documented use-after-free race condition in
TCP timers:
 - Add a reference from tcpcb to its inpcb
 - Defer tcpcb deletion until TCP timers have finished

Differential Revision:	https://reviews.freebsd.org/D2079
Submitted by:		jch, Marc De La Gueronniere <mdelagueronniere@verisign.com>
Reviewed by:		imp, rrs, adrian, jhb, bz
Approved by:		jhb
Sponsored by:		Verisign, Inc.
2015-04-16 10:00:06 +00:00
Kevin Lo
c3358f4ed2 Enable LDO to 2.5V before efuse r/w action in order to prevent
incorrect mac address read from efuse.

Reported by:	swills
Tested by:	rpaulo and myself on RPi
2015-04-16 07:40:01 +00:00
Marcelo Araujo
546afaf83d Remove duplicate header entry. 2015-04-16 02:44:37 +00:00
Rick Macklem
dda11d4ab9 File systems that do not use the buffer cache (such as ZFS) must
use VOP_FSYNC() to perform the NFS server's Commit operation.
This patch adds a mnt_kern_flag called MNTK_USES_BCACHE which
is set by file systems that use the buffer cache. If this flag
is not set, the NFS server always does a VOP_FSYNC().
This should be ok for old file system modules that do not set
MNTK_USES_BCACHE, since calling VOP_FSYNC() is correct, although
it might not be optimal for file systems that use the buffer cache.

Reviewed by:	kib
MFC after:	2 weeks
2015-04-15 20:16:31 +00:00
Neel Natu
1a688aa53e Fix handling of BUS_PROBE_NOWILDCARD in 'device_probe_child()'.
Device probe value of BUS_PROBE_NOWILDCARD should be treated specially only
if the device has a fixed devclass. Otherwise it should be interpreted just
as if the driver doesn't want to claim the device.

Prior to this change a device that was not claimed explicitly by its driver
would remain "attached" to the driver that returned BUS_PROBE_NOWILDCARD.
This would bump up the reference on 'driver->refs' and its 'dev->ops' would
point to the 'driver->ops'. When the driver is subsequently unloaded the
'dev->ops->cls' is left pointing to freed memory.

This fixes an easily reproducible #GP fault caused by loading and unloading
vmm.ko multiple times.

Differential Revision:	https://reviews.freebsd.org/D2294
Reviewed by:	imp, jhb
Discussed with:	rstone
Reported by:	Leon Dang (ldang@nahannisys.com)
MFC after:	2 weeks
2015-04-15 16:22:05 +00:00
George V. Neville-Neil
6332e4cc38 Minor change to the macros to make sure that if an AF is passed that is neither AF_INET6 nor AF_INET that we don't touch random bits of memory.
Differential Revision:	https://reviews.freebsd.org/D2291
2015-04-15 14:46:45 +00:00
Andrew Turner
731b28fb31 Enter a critical section when storing the vfp registers, we don't want to
be preempted here as this will enter back into this function, but the
hardware could be in an inconsistant state, and the vfp unit will be off
when switced back to this function.

Sponsored by:	The FreeBSD Foundation
2015-04-15 14:30:07 +00:00
Andrew Turner
2db317ca85 Ensure the userland thread and floating-point state has been saved before
copying the pcb. These values may have been changed just before the call
to fork and without a call to cpu_switch, where they would have been saved.

Sponsored by:	The FreeBSD Foundation
2015-04-15 14:18:25 +00:00
Tijl Coosemans
4ee4d5917b Point to the right location where __FreeBSD_version numbers are documented. 2015-04-15 09:39:52 +00:00
Edward Tomasz Napierala
1c73bcab8e Rewrite linprocfs_domtab() as a wrapper around kern_getfsstat(). This
adds missing jail and MAC checks.

Differential Revision:	https://reviews.freebsd.org/D2193
Reviewed by:	kib@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-04-15 09:13:11 +00:00
Tijl Coosemans
1243a98e38 Remove the const qualifier from iconv(3) to comply with POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html

Adjust all code that calls iconv.

PR:		199099
Exp-run by:	antoine
MFC after:	2 weeks
2015-04-15 09:09:20 +00:00
Konstantin Belousov
316b384343 Implement support for binary to requesting specific stack size for the
initial thread.  It is read by the ELF image activator as the virtual
size of the PT_GNU_STACK program header entry, and can be specified by
the linker option -z stack-size in newer binutils.

The soft RLIMIT_STACK is auto-increased if possible, to satisfy the
binary' request.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-04-15 08:13:53 +00:00
Rui Paulo
420827da5b snd_hda: add support for the Lenovo X1 20BS model.
This requires a patch to redirect the output to a separate DAC when
the headphones are used.  While there, add device strings for Intel
Broadwell HDA controllers and Realtek ALC292 codecs.

MFC after:	1 week
2015-04-15 05:24:39 +00:00
Adrian Chadd
3e217461e6 Fix RSS build - netisr input / NETISR_IP_DIRECT is used here. 2015-04-15 00:57:21 +00:00
Ed Maste
a04eaf906b Increase vt font limits to allow use of GNU Unifont
PR:		199438
Submitted by:	Ting-Wei Lan <lantw44@gmail.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2015-04-14 19:18:34 +00:00
Kristof Provost
3d1bbe5fa0 pf: Fix forwarding detection
If the direction is not PF_OUT we can never be forwarding. Some input packets
have rcvif != ifp (looped back packets), which lead us to ip6_forward() inbound
packets, causing panics.

Equally, we need to ensure that packets were really received and not locally
generated before trying to ip6_forward() them.

Differential Revision:	https://reviews.freebsd.org/D2286
Approved by:		gnn(mentor)
2015-04-14 19:07:37 +00:00
Alan Somers
738fd16625 Initialize async_arg_ptr in xpt_async when called with async_code
AC_ADVINFO_CHANGED.

Without this change, newly inserted hard disks won't always have their
physical path device nodes created.  The problem reproduces most readily
when attaching a large number of disks at once.

Differential Revision:	https://reviews.freebsd.org/D2290
Reviewed by:	mav, imp
MFC after:	2 weeks
Sponsored by:	Spectra Logic
2015-04-14 16:33:33 +00:00
George V. Neville-Neil
3085e1216e Document internal interface types which are specific to FreeBSD. 2015-04-14 15:21:20 +00:00
George V. Neville-Neil
916e17fd56 I can find no reason to allow packets with both SYN and FIN bits
set past this point in the code. The packet should be dropped and
not massaged as it is here.

Differential Revision:  https://reviews.freebsd.org/D2266
Submitted by: eri
Sponsored by: Rubicon Communications (Netgate)
2015-04-14 14:43:42 +00:00
George V. Neville-Neil
63bf240482 When a kernel has DEVICE_POLLING turned on but no drivers have
the capability do not try to take the mutex at all.

Replaces misbegotten attempt from reverted commit 281276

Pointed out by: glebius
Sponsored by: Rubicon Communications (Netgate)
Differential Revision:	https://reviews.freebsd.org/D2262
2015-04-14 14:22:34 +00:00
Andrew Turner
3f06facc8a * Remove the wfi when the efi loader returns, it's unneeded and is not
available on older designs.
* Enable the efi loader on arm
2015-04-14 14:15:14 +00:00
Andrew Turner
0cafabf97f Add support for arm64 to loader.efi and boot1.efi
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2015-04-14 13:55:01 +00:00
Andrew Turner
30dd368aa7 Fix the arm64 MACHINE_CPUARCH value in the efi fdt glue code.
Sponsored by:	The FreeBSD Foundation
2015-04-14 10:41:57 +00:00
Andrew Turner
c93a8403be Use MACHINE in the efi loader when it is what we mean, it may not be the
same as MACHINE_CPUARCH, it just happened to be the case the architectures
this code currently supports.

Sponsored by:	The FreeBSD Foundation
2015-04-14 10:40:37 +00:00
Randall Stewart
b132edb56f Fix my stupid restoral of old code.. must be c_iflags now.
Thanks jhb for catching my stupidity...
MFC after:	3 days
2015-04-14 00:02:39 +00:00
Randall Stewart
07a2df5d83 Restore the two lines accidentally deleted that allow CALLOUT_DIRECT to be
specifed in the flags.

Thanks Mark Johnston for noticing this ;-o

MFC after:	3 days
2015-04-13 23:06:13 +00:00
Xin LI
687a306f23 Sync with OpenBSD: Use volatile instead of __volatile__.
MFC after:	2 weeks
2015-04-13 20:23:46 +00:00
Neel Natu
9b0e3c5a47 Modify the return value of the uhci/ehci/xhci PCI probe routines to
'BUS_PROBE_DEFAULT'. This allows bhyve's 'ppt' driver to claim ownership
of the device and pass it through to the guest.

In the common case where there are no competing drivers for USB controllers
this change is a no-op.

Reviewed by:	hselasky
MFC after:	2 weeks
2015-04-13 19:13:51 +00:00
Andrew Turner
7d9cff3d23 Add psci for arm64. This is currently used when rebooting and powering off
in qemu.

Sponsored by:	The FreeBSD Foundation
2015-04-13 16:41:33 +00:00
Andrew Turner
2d790e26e5 Create the correct symlinks for the machine directory, and only create the
x86 symlink on i386 and amd64. Before this incorrect symlinks were being
created on armi and i386.

Differential Revision:	https://reviews.freebsd.org/D2283
Reviewed by:	emaste, imp
Sponsored by:	The FreeBSD Foundation
2015-04-13 16:00:09 +00:00
Konstantin Belousov
34c15db9cd Add config option PAE_TABLES for the i386 kernel. It switches pmap to
use PAE format for the page tables, but does not incur other
consequences of the full PAE config.  In particular, vm_paddr_t and
bus_addr_t are left 32bit, and max supported memory is still limited
by 4GB.

The option allows to have nx permissions for memory mappings on i386
kernel, while keeping the usual i386 KBI and avoiding the kernel data
sizing problems typical for the PAE config.

Intel documented that the PAE format for page tables is available
starting with the Pentium Pro, but it is possible that the plain
Pentium CPUs have the required support (Appendix H).  The goal is to
enable the option and non-exec mappings on i386 for the GENERIC
kernel.  Anybody wanting a useful system on 486, have to reconfigure
the modern i386 kernel anyway.

Discussed with:	alc, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-04-13 15:22:45 +00:00
Andrew Turner
e5acd89c78 Bring in the start of the arm64 kernel.
This is only the minimum set of files needed to boot in qemu. As such it is
missing a few things.

The bus_dma code is currently only stub functions with a full implementation
from the development tree to follow.

The gic driver has been copied as the interrupt framework is different. It
is expected the two drivers will be merged by the arm intrng project,
however this will need to be imported into the tree and support for arm64
would need to be added.

This includes code developed by myself, SemiHalf, Ed Maste, and Robin
Randhawa from ARM. This has been funded by the FreeBSD Foundation, with
early development by myself in my spare time with assistance from Robin.

Differential Revision:	https://reviews.freebsd.org/D2199
Reviewed by:	emaste, imp
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2015-04-13 14:43:10 +00:00
Andrew Turner
67cca85e45 Update the arm devmap code to also work with arm64.
There are a few differences between the two. On arm we need to provide a
list of addresses we may be mapping before we have initialised the virtual
memory subsystem, however on arm64 we allocate a small (2MiB for a 4k
granule) range to be used for such purposes.

Differential Revision:	https://reviews.freebsd.org/D2249
Sponsored by:	The FreeBSD Foundation
2015-04-13 13:21:27 +00:00
Mark Johnston
dff78447a4 Fix a possible refcount leak in regen_tmpaddr().
public_ifa6 may be set to NULL after taking a reference to a previous
address list element. Instead, only take the reference after leaving the
loop but before releasing the address list lock.

Differential Revision:	https://reviews.freebsd.org/D2253
Reviewed by:		ae
MFC after:		2 weeks
2015-04-13 01:55:42 +00:00
Jung-uk Kim
9e222cd613 Fix build on i386.
Reported by:	bz
2015-04-12 22:40:27 +00:00
Pedro F. Giffuni
8f4523be7e Add definition for the gcc gnu_inline attribute.
This uses a non-standard (who would guess that) inlining method
that is useful for legacy GNU software. This attribute was added
in GCC 4.1.3. Older versions of clang would just ignore the
attribute but as lately it is supported also there.

This is currently unused but it is required for the
FORTIFY_SOURCE extension.
2015-04-12 16:43:55 +00:00
Andrew Turner
46b1fe9224 Add a driver for the ARM Power State Coordination Interface (PSCI). This
handles versions 0.1 and 0.2 of the standard on 32-bit ARM.

With this driver we can shutdown in QEMU. Further work is needed to
turn secondary cores on on boot and to support later revisions of the
specification.

Submitted by:	Robin Randhawa <Robin.Randhawa at ARM.com>
Sponsored by:	The FreeBSD Foundation
2015-04-12 13:00:58 +00:00
Mark Murray
52c47fd8ef Fix a very minor typo. 2015-04-12 11:23:59 +00:00
Konstantin Belousov
4f1c158445 Define capabilities bits from the revision 007 of the document 302223
"Intelб╝ Processor Vendor-Specific ACPI Interface Specification",
issied Dec 2014.  Previous revision 005 was from Sep 2006.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-04-12 10:28:15 +00:00
Andrew Turner
fac289a29e Switch to the new v6 pmap code to increase its testing. It will now be
built as part of universe.
2015-04-12 08:10:18 +00:00
Dmitry Chagin
51cfb0be84 Rework r281162. Indeed, the flexible array member is preferable here.
Suggested by:   Justin T. Gibbs

MFC after:	3 days
2015-04-12 06:21:58 +00:00
Adrian Chadd
517aea2c14 Start enabling the available GPIO pins on the Carambola 2.
The carambola2 exposes all the gpio pins, but some are reserved for
core functions (eg usb, ethernet, etc.) Others are configured by default
to be available as normal GPIO pins to do interesting things with.

GPIO 18->23 is the I2S, SLIC and SPDIF device pins, but none of those
are currently used.  So, just allow those to show up.

Tested:

* AR9344, Carambola 2
* (.. bitbang SPI to an Adafruit LCD via libgpio, because FreeBSD could
  do with more shiny output devices that aren't network interfaces.)

TODO:

There are some other pins aren't currently included here, but should be.
The LED pins are for the internal switch inside the AR9344.

* GPIO 0+1 are "LED0 + LED1", but they're tied to high for bootstrapping.
* GPIO 13-17 are "LED2..7", but they're tied (H, L, L, L, H) for bootstrapping.
* GPIO 11 and 12 are UART RTS/CTS or I2S; but GPIO 12 is tied L for bootstrap.
2015-04-12 00:02:32 +00:00
Alan Cox
6a93e36b5f Correct an off-by-one error in vm_reserv_reclaim_contig() that results in
an infinite loop.

Submitted by:	Svatopluk Kraus
MFC after:	1 week
2015-04-11 22:57:13 +00:00
Andrew Turner
849d143dba Change the virtual address used to not be 0xc0000000, the arm loader
doesn't handle this address.
2015-04-11 20:44:21 +00:00
Will Andrews
6311d7aaf0 uiomove_object_page(): Avoid instantiating pages in sparse regions on reads.
Check whether the page being requested is either resident or on swap.  If
not, read from the zero_region instead of instantiating an unnecessary page.

This avoids consuming memory for sparse files on tmpfs, when they are read
by applications that do not use SEEK_HOLE/SEEK_DATA (which is most of them).

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Spectra Logic
2015-04-11 18:51:41 +00:00
Rui Paulo
e6ef49ea68 Add support for controlling the trackpoint when Synaptics is enabled.
To accomplish this, we must put the Synaptics hardware in passthrough
mode when talking to the trackpoint.

I only performed minor style modifications.

Submitted by:	Jan Kokemüller <jan.kokemueller at gmail.com>
MFC after:	1 week
2015-04-11 18:45:22 +00:00
Rui Paulo
e197118083 Improve Synaptics support for newer touchpads.
Enable two finger scrolling by default and disable the edge scrolling if
the touchpad has no physical zone for it.  Disable directional scrolling
by default to avoid using extended buttons as scroll buttons.

Add support for ClickPad.  On Lenovo laptops, this is the button
reported when one presses the touchpad.

While there, fix a problem where the extended buttons were not reporting
the button release event correctly: we need to save the state of the
buttons and report it to sysmouse until we receive a packet from the
touchpad indicating the button has been released.  This makes it
possible to use an extended button to resize a window.  On Lenovo
laptops, the major buttons are actually reported as extended buttons.

Tested by:	many (current@)
MFC after:	1 week
2015-04-11 18:44:07 +00:00
Andrew Turner
42f0d1fa49 Add support for the QEMU virt SoC. This is a SoC built depending on the
command line arguments passed in. It will then generate a dtb on the fly,
as such no dts will be added as it may be incorrect.

Relnotes:	yes
2015-04-11 17:52:47 +00:00
Andrew Turner
405ada37fb Add support for the uart classes to set their default register shift value.
This is needed with the pl011 driver. Before this change it would default
to a shift of 0, however the hardware places the registers at 4-byte
addresses meaning the value should be 2.

This patch fixes this for the pl011 when configured using the fdt. The
other drivers have a default value of 0 to keep this a no-op.

MFC after:	1 week
2015-04-11 17:16:23 +00:00
Mateusz Guzik
2574218578 Replace struct filedesc argument in getsock_cap with struct thread
This is is a step towards removal of spurious arguments.
2015-04-11 16:00:33 +00:00
Mateusz Guzik
90f54cbfeb fd: remove filedesc argument from fdclose
Just accept a thread instead. This makes it consistent with fdalloc.

No functional changes.
2015-04-11 15:40:28 +00:00
Andrew Turner
3d08016fc4 Add fdt support to the arm loader.efi 2015-04-11 11:00:53 +00:00
Andrew Turner
cc0ab6997e Only add -fPIC to CFLAGS and -Wl,-znocombreloc to LDFLAGS on x86, they
shouldn't be used on arm.
2015-04-11 10:36:48 +00:00
Andrew Turner
d4926f83a8 Move reloc.c to the top level Makefile as it has become generic. 2015-04-11 10:21:26 +00:00
Andrew Turner
43e9209c57 Update the arm efi ldscript to generate a valid efi binary 2015-04-11 10:07:58 +00:00
Ganbold Tsagaankhuu
c119629dd0 This modifies several FreeBSD drivers to use the GNU approach to
supply clk81 information.  It also changes the hardware strings
in some of the drivers to match what's present in the GNU files.

Submitted by:  John Wehle
Reviewed by:   imp
2015-04-11 08:34:41 +00:00
Ganbold Tsagaankhuu
5254cb2676 This modifies several FreeBSD drivers to use the hardware strings
present in the GNU dts files.

Submitted by:  John Wehle
Reviewed by:   imp
2015-04-11 08:30:37 +00:00
Ganbold Tsagaankhuu
498c473a94 This modifies the FreeBSD Amlogic DTS files to use the GNU files
as the base.

Submitted by:	John Wehle
Reviewed by:	imp
2015-04-11 08:27:38 +00:00
Ganbold Tsagaankhuu
7a24f0a21f The GNU files don't include a DTS for the aml8726-m8b (which has
cortex-a5 cores unlike the aml8726-m8 which has cortex-a9 cores).

Submitted by:	John Wehle
Reviewed by:	imp
2015-04-11 08:25:53 +00:00
Ganbold Tsagaankhuu
ec75fb8571 The GNU Amlogic DTS files have some errors (e.g. bad register
address, bad IRQ, etc) which are fixed by this patch.

John has sent these changes to the author of the files who said
he'll propagate the changes further upstream.

Submitted by:	John Wehle
Reviewed by:	imp
2015-04-11 08:17:39 +00:00
Rui Paulo
d82f9014fa netmap: improve the netmap attach message on FreeBSD.
MFC after:	1 week
2015-04-11 06:20:46 +00:00
Jung-uk Kim
7cf3e94a41 Merge ACPICA 20150410. 2015-04-11 03:23:41 +00:00
Xin LI
843b0e5716 Attempt to fix build after 281351 by defining full prototype for the
functions that were moved to ip_reass.c.
2015-04-11 01:06:59 +00:00
Xin LI
e157d5973c Merge changes from vendor driver version 1.1.1:
v1.1.1 2015-03-26
 * Support 4Kn drive.
 * Change the SCSI target ID of the disk to be the index of physical
   connetion to the HBA.
 * Support staggered drive spin up.
 * Fix a bug that command would be timeout because of improper
   interrupt service routine.
 * Error handling to avoid scsi command lost which caused system
   hang up.
 * Fix a bug that fail to get the devcie's serial number via
   FreeNAS WebGUI.

Many thanks to HighPoint for continued support of FreeBSD!

MFC after:	2 weeks
2015-04-11 00:45:03 +00:00
Eitan Adler
f05e369aa2 iwn, wlan: fix typos
Fxi tow typos

Obtained from:	DragonFlyBSD
MFC after:	3 days
2015-04-10 20:55:17 +00:00
Ed Maste
27513bd396 Use explicitly sized types in EFI module metadata
This will allow the same metadata struct to be used on all platforms.

Differential Revision:	https://reviews.freebsd.org/D2275
Reviewed by:	jhb
2015-04-10 19:26:45 +00:00
Andrey V. Elsukov
e2956804dd Fix the IPV6_MULTICAST_IF sockopt handling. RFC 3493 says when the
interface index is specified as zero, the system should select the
interface to use for outgoing multicast packets. Even the comment
for the in6p_set_multicast_if() function says about index of zero.
But in fact for zero index the function just returns EADDRNOTAVAIL.

I.e. if you first set some interface and then will try reset it
with zero ifindex, you will get EADDRNOTAVAIL.

Reset im6o_multicast_ifp to NULL when interface index specified as
zero. Also return EINVAL in case when ifnet_byindex() returns NULL.
This will be the same behaviour as when ifindex is bigger than
V_if_index. And return EADDRNOTAVAIL only when interface is not
multicast capable.

Reported by:	Olivier Cochard-Labbé
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2015-04-10 19:09:51 +00:00
Will Andrews
677c3c0c66 tmpfs_getattr(): Return more correct allocated byte counts.
For VREG vnodes, return the resident page count (multiplied by PAGE_SIZE)
for the tmpfs node's anonymous VM object that stores actual file contents.

For all other vnodes, return the tmpfs_node's tn_size, which should not
be rounded to a page.

This change allows using stat(2) to identify a sparse file on tmpfs.

Reviewed by:	kib
MFC after:	1 week
2015-04-10 19:04:39 +00:00
Ed Maste
5ec8fa0ee4 Add build support for i386 loader.efi
Kernel changes are required for this to be useful but this will allow
others to experiment.

Differential Revision:	https://reviews.freebsd.org/D2276
2015-04-10 18:49:43 +00:00
Ed Maste
dea6bf66ea Limit EFI framebuffer metadata to amd64 for now
The i386 loader.efi does not yet exist. Avoid dealing with vt and
framebuffer issues there until the initial bootstrapping is done.
2015-04-10 18:08:09 +00:00
Ian Lepore
c441925e31 Use OF_getencpropalloc() to handle endianess of the properties.
Submitted by:	Michal Meloun
2015-04-10 13:50:57 +00:00
Ian Lepore
7669914f32 Add a pmap_kremove_device() to undo mappings made with pmap_kenter_device().
Previously we used pmap_kremove(), but with ARM_NEW_PMAP it does the remove
in a way that isn't SMP-coherent (which is appropriate in some circumstances
such as mapping/unmapping sf buffers).  With matching enter/remove routines
for device mappings, each low-level implementation can do the right thing.

Reviewed by:	Svatopluk Kraus <onwahe@gmail.com>
2015-04-10 13:26:35 +00:00
Ian Lepore
78261920b0 The "get latency" and "get bitmode" device commands are read operations,
not writes.
2015-04-10 13:20:31 +00:00
Gleb Smirnoff
4651df570c Redo r274966. Instead of global all-interface all-vnet undocumented sysctl,
use per-interface flag, and document it.

Sponsored by:	Nginx, Inc.
2015-04-10 09:50:13 +00:00
Andrew Turner
b6e1ffd447 Port the EFI reloc codeto work on arm64. This used the rela relocation
table so wiill need the addend included in the relocation calculation.

Sponsored by:	The FreeBSD Foundation
2015-04-10 09:15:35 +00:00
Gleb Smirnoff
16be9f54e7 UMA zone limit can be lowered, so remove protection against from
the sysctl_handle_uma_zone_max().

Sponsored by:	Nginx, Inc.
2015-04-10 06:56:49 +00:00
Gleb Smirnoff
c047fd1b99 o Use Jenkins hash. With previous hash, for a single source IP address and
sequential IP ID case (e.g. ping -f), distribution fell into 8-10 buckets
  out of 64. With Jenkins hash, distribution is even.
o Add random seed to the hash.

Sponsored by:	Nginx, Inc.
2015-04-10 06:55:43 +00:00
Gleb Smirnoff
1dbefcc00d Move all code related to IP fragment reassembly to ip_reass.c. Some
function names have changed and comments are reformatted or added, but
there is no functional change.

Claim copyright for me and Adrian.

Sponsored by:	Nginx, Inc.
2015-04-10 06:02:37 +00:00
Gleb Smirnoff
f25a3d10b3 Now that IP reassembly is no longer under single lock, book-keeping amount
of allocations in V_nipq is racy.  To fix that, we would simply stop doing
book-keeping ourselves, and rely on UMA doing that.  There could be a
slight overcommit due to caches, but that isn't a big deal.

o V_nipq and V_maxnipq go away.
o net.inet.ip.fragpackets is now just SYSCTL_UMA_CUR()
o net.inet.ip.maxfragpackets could have been just SYSCTL_UMA_MAX(), but
  historically it has special semantics about values of 0 and -1, so
  provide sysctl_maxfragpackets() to handle these special cases.
o If zone limit lowers either due to net.inet.ip.maxfragpackets or due to
  kern.ipc.nmbclusters, then new function ipq_drain_tomax() goes over
  buckets and frees the oldest packets until we are in the limit.
  The code that (incorrectly) did that in ip_slowtimo() is removed.
o ip_reass() doesn't check any limits and calls uma_zalloc(M_NOWAIT).
  If it fails, a new function ipq_reuse() is called. This function will
  find the oldest packet in the currently locked bucket, and if there is
  none, it will search in other buckets until success.

Sponsored by:	Nginx, Inc.
2015-04-09 22:13:27 +00:00
Marius Strobl
0f55f9d67b Don't enable RX and TX before their initial configuration is done, i. e.
after setting up interrupt moderation but before turning interrupts on.
This matches what Realtek's r8168 Linux driver does as of version 8.039.00
and fixes problems with certain incarnations of certain MAC revisions
like the interface requiring an extra up/down-cycle after boot to start
working or DMA configuration not being adhered to.

PR:		193743, 197535
MFC after:	1 week
2015-04-09 21:35:44 +00:00
Gleb Smirnoff
f5746f593c In the ip_reass() do packet examination and adjusting before acquiring
locks and doing lookups.

Sponsored by:	Nginx, Inc.
2015-04-09 21:32:32 +00:00
Gleb Smirnoff
e3c2c63476 Make ip reassembly queue mutexes per-vnet, putting them into the structure
that they protect.

Sponsored by:	Nginx, Inc.
2015-04-09 21:17:07 +00:00
Ed Maste
b291974d25 Remove EOL whitespace from i386 EFI loader source 2015-04-09 19:48:42 +00:00
George V. Neville-Neil
51d4054eeb Revert 281276 as unnecessary. Proper change to be committed
to the base polling code in a subsequent commit.

Pointed out by: glebius

Sponsored by:	Rubicon Communications (NetGate)
2015-04-09 14:44:30 +00:00
Alexander Motin
0ada3afc25 Remove sleeps from geom_up thread on device destruction.
MFC after:	3 days.
2015-04-09 13:09:05 +00:00
Andrey V. Elsukov
efb19cf6db Fix the check for maximum mbuf's size needed to send ND6 NA and NS.
It is acceptable that the size can be equal to MCLBYTES. In the later
KAME's code this check has been moved under DIAGNOSTIC ifdef, because
the size of NA and NS is much smaller than MCLBYTES. So, it is safe to
replace the check with KASSERT.

PR:		199304
Discussed with:	glebius
MFC after:	1 week
2015-04-09 12:57:58 +00:00
Andrew Turner
e8a2ef58c2 Add R_AARCH64_NONE, the null relocation. 2015-04-09 10:28:05 +00:00
Andrew Turner
23c48d2315 Print error values with hex to make it easier to find the EFI error type. 2015-04-09 10:15:47 +00:00
Andrew Turner
8ab49d66d2 Only use -fPIC when building boot1.efi for x86.
Sponsored by:	The FreeBSD Foundation
2015-04-09 10:08:10 +00:00
Andrew Turner
3252a3c107 Add the arm64 machine dependent parts of ficl. This is not machine
dependent, as most copies of these files are identical, but unfortunately
this is still needed.

Sponsored by:	The FreeBSD Foundation
2015-04-09 10:00:26 +00:00
Gleb Smirnoff
71c70e138d Use TAILQ_FOREACH_SAFE() instead of implementing it ourselves.
Sponsored by:	Nginx, Inc.
2015-04-09 09:00:32 +00:00
Gleb Smirnoff
1c0b48c79a If V_maxnipq is set to zero, drain the queue here and now, instead of
relying on timeouts.

Sponsored by:	Nginx, Inc.
2015-04-09 08:56:23 +00:00
Gleb Smirnoff
55c28800ad o Since we always update either fragdrop or fragtimeout stat counter when we
free a fragment, provide two inline functions that do that for us:
  ipq_drop() and ipq_timeout().
o Rename ip_free_f() to ipq_free() to match the name scheme of IP reassembly.
o Remove assertion from ipq_free(), since it requires extra argument to be
  passed, but locking scheme is simple enough and function is static.

Sponsored by:	Nginx, Inc.
2015-04-09 08:52:02 +00:00
Gleb Smirnoff
3de5805b02 Rename ip_drain_locked() to ip_drain_vnet(), since the function differs
from ip_drain() not in locking, but in the scope of its work.

Sponsored by:	Nginx, Inc.
2015-04-09 08:37:16 +00:00
Adrian Chadd
02d4991526 Do not access peripheral before clock stabilization.
Tested:

* Intel 3945ABG NIC, STA mode

PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-04-09 04:56:24 +00:00
Adrian Chadd
655e8ba806 Fix buffer overflow introduced in previous commits (unbreaks 802.11a capable NICs).
Tested:

* PCIe Intel 3945ABG NIC

PR:		kern/197143
Submitted by:	 Andriy Voskoboinyk <s3erios@gmail.com>
2015-04-09 04:51:39 +00:00
Jim Harris
3345ed9a55 nvme: use BUS_SPACE_MAXSIZE for bus_dma_tag_create maxsize parameter
This fixes i386 PAE build fallout from r281281.

Reported by:	bz
MFC after:	1 week
2015-04-09 00:37:55 +00:00
Jim Harris
36b0e4ee1f nvme: remove CHATHAM related code
Chatham was an internal NVMe prototype board used for
early driver development.

MFC after:	1 week
Sponsored by:	Intel
2015-04-08 21:52:06 +00:00
Jim Harris
eb4929fb41 nvme: add device strings for Intel DC series NVMe SSDs
MFC after:	1 week
Sponsored by:	Intel
2015-04-08 21:50:45 +00:00
Jim Harris
a6e3096392 nvme: create separate DMA tag for non-payload DMA buffers
Submission and completion queue memory need to use a
separate DMA tag for mappings than payload buffers,
to ensure mappings remain contiguous even with DMAR
enabled.

Submitted by:	kib
MFC after:	1 week
Sponsored by:	Intel
2015-04-08 21:49:45 +00:00
Jim Harris
e5ce537999 nvme: fall back to a smaller MSI-X vector allocation if necessary
Previously, if per-CPU MSI-X vectors could not be allocated,
nvme(4) would fall back to INTx with a single I/O queue pair.
This change will still fall back to a single I/O queue pair, but
allocate MSI-X vectors instead of reverting to INTx.

MFC after:	1 week
Sponsored by:	Intel
2015-04-08 21:46:18 +00:00
George V. Neville-Neil
8a7ad10169 Add support for a netisr polling tunable, which allows run time switching of
device polling rather than having it only be controlled by the compile
time option.

Summary: Rubicon Communications (Netgate)

Reviewers: #network, hiren

Reviewed By: #network, hiren

Subscribers: hiren

Differential Revision: https://reviews.freebsd.org/D2258
2015-04-08 20:25:51 +00:00
Devin Teske
a7ec487755 Re-do proper mode-endings. Antithesis of r281176-281179 which reverted
earlier migration away from sloppy mode-endings (r280925,280974-280976)
due to a red-herring in diagnosing HardenedBSD boot lockup.

Thanks to:	lattera (shawn.webb@hardenedbsd<dot>org)
MFC after:	3 days
X-MFC-to:	stable/10
X-MFC-with:	r280925,280974-280976,281176-281179
2015-04-08 20:10:42 +00:00
Konstantin Belousov
a7496c776d Explain that vm_page_array is mapped to describe the memory, not the
memory itself.  Provide the formula to calculate the number of
required page tables.  Correct the size of the struct vm_page for
non-PAE case.

Reviewed by:	alc, jhb (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-04-08 19:46:13 +00:00
Devin Teske
ea1401b9a9 Fix a bootlock condition if/when loader_logo is set in loader.conf(5)
NB: This deeply effected HardenedBSD which had a default value set.

Embarassingly, I allowed the `type' primitive to be passed -1/-1 for
c-addr/u stack input (the effect of which is to pull INT_MAX bytes
from character address negative one in which hilarity ensues over a
black screen in full-on bootlock). Much thanks to Shawn Webb [lattera]
for helping me diagnose.

NB: The mode-ending revisions were initially suspected (and reverted)
but proved to be a red-herring. Proper mode endings will be returning.

Thanks to:	lattera (@HardenedBSD [<dot><com>])
Reported by:	lattera
MFC after:	3 days
X-MFC-to:	stable/10
2015-04-08 19:12:38 +00:00
John Baldwin
dbee5c671a Move the 32-bit compatible procfs types from freebsd32.h to <sys/procfs.h>
and export them to userland.
- Define __HAVE_REG32 on platforms that define a reg32 structure and check
  for this in <sys/procfs.h> to control when to export prstatus32, etc.
- Add prstatus32_t and prpsinfo32_t typedefs for the 32-bit structures.
  libbfd looks for these types, and having them fixes 'gcore' in gdb of a
  32-bit process on a 64-bit platform.
- Use the structure definitions from <sys/procfs.h> in gcore's elf32 core
  dump code instead of duplicating the definitions.

Differential Revision:	https://reviews.freebsd.org/D2142
Reviewed by:	kib, nathanw (powerpc bits)
MFC after:	1 week
2015-04-08 16:30:45 +00:00
Justin Hibbits
39a4b70fbc Clean up printtrap a little.
* Sort exceptions
* Add printing of ESR on book-e, and only print DSISR on AIM
2015-04-08 04:37:11 +00:00
Justin Hibbits
e3e38bc79f Add DTrace support for Book-E PowerPC.
Book-E got DTrace support for free with r281096&related.  This adds the bits to
the db_trap_glue() to support FBT.

Relnotes:	Yes
2015-04-08 04:35:26 +00:00
Eitan Adler
22cac86d54 newvers.sh: remove 'X' hack from shell script
Reviewed by:	allanjude,  Daniel O'Connor
2015-04-08 04:01:02 +00:00
Mark Johnston
67cf27b70f libdtrace: add support for lazyload mode.
Passing "-x lazyload" to dtrace -G during compilation causes dtrace(1) to
not link drti.o into the output object file, so the USDT probes are not created
during process startup. Instead, dtrace(1) will automatically discover and
create probes on the process' behalf when attaching.

Differential Revision:	https://reviews.freebsd.org/D2203
Reviewed by:		rpaulo
MFC after:		1 month
2015-04-08 02:36:37 +00:00
Konstantin Belousov
5f01ba81ae Account for the offset of the page run when allocating the
dmar_map_entry.  Non-zero offset both increases the required mapping
size, which is handled in dmar_bus_dmamap_load_something1(), and makes
it possible that allocated range crosses boundary, which needs a check
in dmar_gas_match_one().

Reported and tested by:	jimharris
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-04-08 01:55:22 +00:00
Justin Hibbits
d8f2c16bb3 Unbreak book-e, broken by the trap.c merge (missed this file). 2015-04-08 00:31:33 +00:00
Adrian Chadd
f59e59d5c3 Move the IPv4 reassembly queue locking from a single lock to be per-bucket (global).
This significantly improves performance on multi-core servers where there
is any kind of IPv4 reassembly going on.

glebius@ would like to see the locking moved to be attached to the reassembly
bucket, which would make it per-bucket + per-VNET, instead of being global.
I decided to keep it global for now as it's the minimal useful change;
if people agree / wish to migrate it to be per-bucket / per-VNET then please
do feel free to do so.  I won't complain.

Thanks to Norse Corp for giving me access to much larger servers
to test this at across the 4 core boxes I have at home.

Differential Revision:	https://reviews.freebsd.org/D2095
Reviewed by:	glebius (initial comments incorporated into this patch)
MFC after:	2 weeks
Sponsored by:	Norse Corp, Inc (hardware)
2015-04-07 23:09:34 +00:00
Ed Maste
0c8a72c0d2 Add EFI boot1 for i386
loader.efi still needs work, but boot1.efi now builds.

Differential Revision:	https://reviews.freebsd.org/D2244
Reviewed by:	rpaulo
Sponsored by:	The FreeBSD Foundation
2015-04-07 21:41:26 +00:00
Ed Maste
c6f6755c90 EFI: use common reloc.c for all architectures
Much of this file is common to the architectures we support, so share
an implementation by adding a little #ifdef-ery.

Differential Revision:	https://reviews.freebsd.org/D2241
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2015-04-07 21:34:49 +00:00
Eric Joyner
eb7e25b22f ifmedia changes:
- Extend the number of available subtypes for Ethernet media by using some
of the ifmedia word's option bits to help denote subtypes. As a result, the
number of possible Ethernet subtype values increases from 31 to 511.

- Use some of those new values to define new media types.

- lacp_compose_key() recgonizes the new Ethernet media types added.
  (Change made as required by a comment in if_media.h)

- New ioctl, SIOGIFXMEDIA, to handle getting the new extended media types.
  SIOCGIFMEDIA is retained for backwards compatibility.

- Changes to ifconfig to allow it to handle the new extended media types.

Submitted by:	mike@karels.net (original), hselasky
Reviewed by:	jfvogel, gnn, hselasky
Approved by:	jfvogel (mentor), gnn (mentor)
Differential Revision: http://reviews.freebsd.org/D1965
2015-04-07 21:31:17 +00:00
Kristof Provost
53deb05c36 Evaluate packet size after the firewall had its chance
Defer the packet size check until after the firewall has had a look at it. This
means that the firewall now has the opportunity to (re-)fragment an oversized
packet.

Differential Revision:	https://reviews.freebsd.org/D1815
Reviewed by:	ae
Approved by:	gnn (mentor)
2015-04-07 20:29:03 +00:00
Xin LI
dd3856601d Mitigate Local Denial of Service with IPv6 Router Advertisements
and log attack attempts.

Submitted by:	hrs
Security:	FreeBSD-SA-15:09.nd6
Security:	CVE-2015-2923
2015-04-07 20:20:09 +00:00
Xin LI
edc76c95db Improve patch for SA-15:04.igmp to solve a potential buffer overflow.
Reported by:	bde
Submitted by:	oshogbo
2015-04-07 20:20:03 +00:00
Mark Johnston
c99d7d32ec Add B_KVAALLOC and B_UNMAPPED to the buf flag name list.
Differential Revision:	https://reviews.freebsd.org/D1895
Submitted by:		Conrad Meyer
MFC after:		1 week
2015-04-07 19:37:49 +00:00
Andrew Turner
be3b046ce8 Get the fdt uart driver working on arm64, there is no machine/fdt.h, and
the default shift should be 2 for the SoCs we support.

Sponsored by:	The FreeBSD Foundation
2015-04-07 15:12:03 +00:00
Pedro F. Giffuni
079419ddc2 Make use of allocation attributes in system headers.
Start using 'alloc_size' attribute in the allocator functions.
This is useful as it helps the compiler generate warnings on suspicious
code and can also enable some small optimizations.

This is based on r281130, which brought similar enhnacements
to the standard libc headers.
2015-04-07 14:47:27 +00:00
Andrew Turner
8c9db319f6 We will have fueword on arm64, mark as such in machine/param.h.
Sponsored by:	The FreeBSD Foundation
2015-04-07 13:17:28 +00:00
Andrew Turner
7966cc995c Fix uart_fdt_get_clock. It should have beed using the cell variable passed
in, not value on the stack.
2015-04-07 12:42:06 +00:00
Alexander Motin
80867e61d8 Remove hard limits on number of accepting NFS connections.
Limits of 5 connections set long ago creates problems for SPEC benchmark.
Make the NFS follow system-wide maximum.

MFC after:	1 week
2015-04-07 10:25:27 +00:00
Takanori Watanabe
fbc48c2bfb Initial Bluetooth LE support.
Note that sockaddr_l2cap structure is changed , check socket address
to initialize new structure member and define L2CAP_SOCKET_CHECKED
before including ng_btsocket.h

Differential Revision:        https://reviews.freebsd.org/D2021
Reviewed by:emax
2015-04-07 10:22:56 +00:00
John-Mark Gurney
9df9c6bc0d add the define to properly guard this header..
Sponsored by:	Netflix, Inc.
2015-04-07 09:00:03 +00:00
Gleb Smirnoff
b7703ad432 In ipfilter(4) there is the ipftest(1) program, that compiles half of the
ipfilter code as userland application. To reduce kernel structure knowledge
include if_var.h only if a file is compiled with _KERNEL defined.
In !_KERNEL case, provide our own definition of struct ifnet, that will
satisfy ipftest(1). This was already done earlier to struct ifaddr in
r279029. Protect the definition with _NET_IF_VAR_H_, since kernel part
of ipfilter may include if_var.h and ip_compat.h.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2015-04-07 06:22:22 +00:00
Jeff Roberson
34d8b7ea3b - Simplify vm_pageout_scan() by introducing a new vm_pageout_clean()
function that does the locking and validation associated with cleaning
   a page.  This moves 150 lines of code into its own function.
 - Rename vm_pageout_clean() to vm_pageout_cluster() to define what it
   really does; clustering nearby pages for pageout optimization.

Reviewd by:	alc, kib, kmacy
Tested by:	pho (earlier version)
Sponsored by:	EMC / Isilon
2015-04-07 02:18:52 +00:00
Kevin Lo
45440aa84e Add Lenovo ThinkPad OneLink GigaLAN.
PR:	199184
Submitted by:	Robin Karlsson
2015-04-07 01:47:36 +00:00
Devin Teske
2df04ab49b Eliminate literal escape sequences from *.rc
Suggested by:	alfred
MFC after:	3 days
X-MFC-to:	stable/10
X-MFC-with:	r280976, r281179
2015-04-06 23:37:04 +00:00
Devin Teske
e076835f9c Partially revert r280976: Back to previous mode-endings based on feedback
Reported by:	lattera
MFC after:	3 days
X-MFC-to:	stable/10
X-MFC-with:	r280976
2015-04-06 23:22:54 +00:00
Devin Teske
be77d1d90c Partially revert r280975: Back to previous mode-endings based on feedback
Reported by:	lattera
MFC after:	3 days
X-MFC-to:	stable/10
X-MFC-with:	r280975
2015-04-06 23:16:03 +00:00
Devin Teske
72bd569df0 Partially revert r280974: Back to previous mode-endings based on feedback
MFC after:	3 days
X-MFC-to:	stable/10
X-MFC-with:	r290974
Reported by:	lattera
2015-04-06 23:13:16 +00:00
Devin Teske
9390da3689 Partially revert r280925: Back to previous mode-endings based on feedback
MFC after:	3 days
X-MFC-with:	r280925
Reported by:	lattera
2015-04-06 23:10:47 +00:00
Gleb Smirnoff
c151f24d08 o Make net.inet6.ip6.mif6table return special API structure, that doesn't
contain kernel pointers, and instead has interface index.
  Bump __FreeBSD_version for that change.
o Now, netstat/mroute6.c no longer needs to kvm_read(3) struct ifnet, and
  no longer needs to include if_var.h

Note that this change is far from being a complete move of IPv6 multicast
routing to a proper API. Other structures are still dumped into their
sysctls as is, requiring userland application to #define _KERNEL when
including ip6_mroute.h and then call kvm_read(3) to gather all bits and
pieces. But fixing this is out of scope of the opaque ifnet project.

Sponsored by:	Nginx, Inc.
Sponsored by:	Netflix
2015-04-06 22:12:18 +00:00
Andrew Turner
533e5098de Make global variabled only used in this file static. 2015-04-06 19:58:28 +00:00
Kristof Provost
31e2e88c27 Remove duplicate code
We'll just fall into the same local delivery block under the
'if (m->m_flags & M_FASTFWD_OURS)'.

Suggested by:	ae
Differential Revision:	https://reviews.freebsd.org/D2225
Approved by:	gnn (mentor)
2015-04-06 19:08:44 +00:00
Kristof Provost
1873dcc8c9 pf: Skip firewall for refragmented ip6 packets
In cases where we scrub (fragment reassemble) on both input and output
we risk ending up in infinite loops when forwarding packets.

Fragmented packets come in and get collected until we can defragment. At
that point the defragmented packet is handed back to the ip stack (at
the pfil point in ip6_input(). Normal processing continues.

Eventually we figure out that the packet has to be forwarded and we end
up at the pfil hook in ip6_forward(). After doing the inspection on the
defragmented packet we see that the packet has been defragmented and
because we're forwarding we have to refragment it.

In pf_refragment6() we split the packet up again and then ip6_forward()
the individual fragments.  Those fragments hit the pfil hook on the way
out, so they're collected until we can reconstruct the full packet, at
which point we're right back where we left off and things continue until
we run out of stack.

Break that loop by marking the fragments generated by pf_refragment6()
as M_SKIP_FIREWALL. There's no point in processing those packets in the
firewall anyway. We've already filtered on the full packet.

Differential Revision:	https://reviews.freebsd.org/D2197
Reviewed by:	glebius, gnn
Approved by:	gnn (mentor)
2015-04-06 19:05:00 +00:00
Dmitry Chagin
6723fdfe46 Properly calculate "UMA Zones" per cpu cache size. Avoid allocating
an extra struct uma_cache since the struct uma_zone already has one.

PR:		199169
Submitted by:	luke.tw gmail com
MFC after:	1 week
2015-04-06 18:45:41 +00:00
John Baldwin
44947d3aeb Move the message complaining about failed system resource allocations
under bootverbose.  Every example I've seen to date has been due to
an ACPI system resource device reserving a range that overlaps with
system memory (which ram0 attempts to reserve) or a local or I/O APIC
(which apic0 attempts to reserve).  These are always harmless but look
scary to users.

MFC after:	1 week
2015-04-06 17:39:36 +00:00
Justin Hibbits
7a9d50b370 Fix the index for FAULTBUF_R13, missed during merge/cleanup. 2015-04-06 16:29:45 +00:00
Andrew Turner
46f52b028f Split out the _acq and _rel functions. These were the same, but there is
no need for them to be this strong, we only need to provide one or the
other.

While here replace atomic_load_acq_* and atomic_store_rel_* with a single
instruction version, and fix the definition of atomic_clear_* to point to
the correct functions.

Sponsored by:	The FreeBSD Foundation
2015-04-06 16:27:22 +00:00
Andrew Turner
63d071445e Add support to the efi boot1 and loader for 32-bit ARM. This will be used
by the future qemu virt support.

Differential Revision:	https://reviews.freebsd.org/D2238
Reviewed by:	emaste
2015-04-06 15:50:20 +00:00
Gleb Smirnoff
93d4534cdc Add sleepable lock to protect at least against two parallel SIOCSVHs.
Sponsored by:	Nginx, Inc.
2015-04-06 15:31:19 +00:00
Tycho Nightingale
fb5e95b4f6 Enhance the support for Group 1 Extended opcodes:
* Implemement the 0x81 and 0x83 CMP instructions.
  * Implemement the 0x83 AND instruction.
  * Implemement the 0x81 OR instruction.

Reviewed by:	neel
2015-04-06 12:22:41 +00:00
Gleb Smirnoff
f06a9bb77e Convert printfs in m_ext allocator to KASSERTs.
Discussed with:	rwatson
Sponsored by:	Nginx, Inc.
2015-04-06 09:15:18 +00:00
Rui Paulo
bb09480677 SMBIOS support for EFI.
MFC after:	1 week
2015-04-06 06:55:47 +00:00
Rui Paulo
63f9a9fa26 ichsmb: add a device id for the Wildcat Point-LP.
MFC after:	1 week
2015-04-06 06:02:58 +00:00
Adrian Chadd
03ab093569 Return the correct HAL data type for HAL_DIAG_ANI_STATS.
I .. stupidly added code to return HAL_ANI_STATS to HAL_DIAG_ANI_STATS.
I discovered this in a noisy environment when the returned values were
enough to .. well, make everything terrible.

So - restore functionality.

Tested:

* AR5416 (uses the AR5212 HAL), in a /very/ noisy 2GHz environment.
  Enough to trigger ANI to get upset and generate useful data.
2015-04-06 01:12:53 +00:00
Rui Paulo
c282164d42 psm: print newer Synaptics Touchpad capabilities. 2015-04-06 01:04:08 +00:00
Adrian Chadd
c2dc6e2aab Convert the DIR-825C1 to use the new map based MAC address configuration.
Tested:

* DIR-825C1
2015-04-05 22:00:44 +00:00
Konstantin Belousov
2359e2dcc3 Do not call msdosfs_sync() on the read-only msdosfs mounts. In fact,
it should be a nop for ro.

PR:	199152
Reviewed by:	bde (PR version of the patch)
Submitted by:	longwitz@incore.de
MFC after:	1 week
2015-04-05 21:10:38 +00:00
Konstantin Belousov
420d65d9e4 Assert that an msdosfs mount is not read-only when FAT modifications
are requested.

PR:	199152
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-04-05 21:08:04 +00:00
Adrian Chadd
e1f0bb305b Update the board MAC address configuration for the DIR-655A1.
The MAC addresses were totally wrong. They're like the DIR-625C1 - at
0x1ffe0004 and 0x1ffe0018. They're however stored as text strings.
The ath0 MAC address is also not set, even though the calibration
partition is valid.

So, pick the board address / first MAC as the ath0 MAC, and derive
arge0/arge1 from that.  That way they're hopefully unique enough
for people with multiple devices.

Tested:

* DIR-655A1

TODO:

* Do the same for the DIR-625A1 and DIR-625C1.
2015-04-05 20:56:51 +00:00
Alan Cox
b5ab20c066 Until the lock assertions in vm_page_advise() are properly reevaluated,
vm_fault_dontneed() should acquire a write lock on the first object in
the shadow chain.

Reported by:	gleb, David Wolfskill
2015-04-05 20:07:33 +00:00
Andrew Turner
45304e75b9 Move boot1.efi to the global CLEANFILES list, it's not x86 specific. 2015-04-05 18:57:58 +00:00
Andrew Turner
947d2519e3 Spell MACHINE_CPUARCH correctly 2015-04-05 18:42:43 +00:00
Andrew Turner
60ac534440 Add FDT support to loader.efi. This will be used on arm and arm64.
Differential Revision:	https://reviews.freebsd.org/D2219
2015-04-05 18:37:39 +00:00
Dmitry Chagin
1d2c0c460c Fix wrong kassert msg in uma.
PR:		199172
Submitted by:	luke.tw gmail com
MFC after:	1 week
2015-04-05 18:25:23 +00:00
Justin Hibbits
6d53f4a6ae Missed this in r281096 as well.
Renumber EXC_DEBUG to be above EXC_LAST, so as not to conflict with AIM trap
vectors.
2015-04-05 16:35:13 +00:00
Alexander Motin
91b9f63738 Add DTrace probe to the new ARC reclaim cause added in r281026.
MFC after:	1 month
2015-04-05 14:45:52 +00:00
Alexander Motin
cdd09fea28 Add vmem locking to r281026.
While races there are not fatal, they cause result underestimation, that
cause unneeded ARC reclaims.

MFC after:	1 month
2015-04-05 14:17:26 +00:00
Andrew Turner
02df43b866 dev/ofw/openfirm.h is not needed in the arm machine/fdt.h 2015-04-05 09:50:22 +00:00
Eitan Adler
f5cd4abcd0 adrian asked me to revert and get more testing 2015-04-05 05:18:14 +00:00
Rui Paulo
bc3464096a hwpmc: add initial Intel Broadwell support.
The full list of aliases and events will follow in a subsequent
commit.

MFC after:	1 month
2015-04-05 05:14:20 +00:00
Rui Paulo
03a24b7026 Remove whitespace. 2015-04-05 05:09:38 +00:00
Eitan Adler
7e937fbfc2 head/sys/amd64/amd64/support.S: unroll loop
unroll the loop in ENTRY(pagezero)
	acc' to the submitter this results in a reproducible 1% perf
	improvement under buildworld like workload

	I validated correctness and run-testing, but not performance impact

Submitted by:	lidl@pix.net
Reviewed by:	adrian
PR:		199151
MFC After:	1 month
2015-04-05 05:07:24 +00:00
Adrian Chadd
00e2f0a3cb Oops, add missing file from previous commit.
(Sorry bsdimp, I did break the build.)
2015-04-05 05:00:25 +00:00
Adrian Chadd
f6e6460dfc Add support for the MIPS74K SoC family performance counters events.
These are similar to the mips24k performance counters - some are
available on perfcnt0/3, some are available on perfcnt1/4.
However, the events aren't all the same.

* Add the events, named the same as from Linux oprofile.
* Verify they're the same as  "MIPS32(R) 74KTM Processor Core Family
  Software User's Manual"; Document Number: MD00519; Revision 01.05.
* Rename INSTRUCTIONS to something else, so it doesn't clash with
  the alias INSTRUCTIONS.  I'll try to tidy this up later; there
  are a few other aliases to add and shuffle around.

Tested:

* QCA9558 SoC (AP135 board) - MIPS74Kc core (no FPU.)
* make universe; where it didn't fail for other reasons.

TODO:

* It'd be nice to support the four performance counters
  in at least this hardware, rather than just two.

Reviewed by:	bsdimp ("looks good; don't break world".)
2015-04-05 02:57:02 +00:00
Justin Hibbits
c4f9a74168 Add file missed in r281096. 2015-04-05 02:43:36 +00:00
Justin Hibbits
28cbb9b173 Unify Book-E and AIM trap.c
Summary:
Book-E and AIM trap.c are almost identical, except for a few bits.  This is step
1 in unifying them.

This also renumbers EXC_DEBUG, to not conflict with AIM vector numbers.  Since
this is the only one thus far that is used in the switch statement in trap(),
it's the only one renumbered.  If others get added to the switch, which conflict
with AIM numbers, they should also be renumbered.

Reviewers: #powerpc, marcel, nwhitehorn

Reviewed By: marcel

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D2215
2015-04-05 02:42:52 +00:00
Konstantin Belousov
4cfc037c30 Restore proper error from oshmctl(2), used by COMPAT_43, when the
segment cannot be found.  Broken by r280323.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2015-04-04 23:56:38 +00:00
Andrew Turner
e8cfd62ed8 Re-add machine/bus.h to machine/fdt.h on arm, it's still needed. 2015-04-04 23:10:13 +00:00
Andrew Turner
087af50ab8 Include vm/pmap.h for pmap_kextract. 2015-04-04 23:03:11 +00:00
Andrew Turner
610373a6f7 Include machine/intr.h for arm_post_filter. 2015-04-04 23:00:37 +00:00
Andrew Turner
8c7336d57f Don't include unneeded files in the arm machine/fdt.h. While here, remove
it from more files.
2015-04-04 22:22:04 +00:00
Edward Tomasz Napierala
aca050aaaa Remove icl_conn_connected(); was unused.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-04-04 22:11:38 +00:00
Andrew Turner
7defa9a75c Move the definition of fdt_localbus_devmap to a Marvell specific file as
it's only used there.
2015-04-04 22:05:43 +00:00
Jilles Tjoelker
78d75aba77 utimensat: Correct Capsicum required capability rights. 2015-04-04 21:47:54 +00:00
Andrew Turner
ff3b52bb19 Stop using machine/fdt.h in the arm kernel code when we don't need it. 2015-04-04 21:34:26 +00:00
Andreas Tobler
b9c2f094f2 Fix build race on armv6* and powerpc*.
Tested with cross builds amd64 -> armv6(hf) and powerpc(64).

Suggested by:	andrew@
2015-04-04 20:30:20 +00:00
Baptiste Daroussin
b0aa40ed29 Make sure forth manpages are only installed once.
Differential Revision:	https://reviews.freebsd.org/D2224
Reviewed by:	imp
2015-04-04 19:56:54 +00:00
Alan Cox
a8b0f1009d Replace vm_fault()'s heuristic for automatic cache behind with a heuristic
that performs the equivalent of an automatic madvise(..., MADV_DONTNEED).
The current heuristic, even with the improvements that I made a few years
ago, is a good example of making the wrong trade-off, or optimizing for
the infrequent case.  The infrequent case being reading a single file that
is much larger than memory using mmap(2).  And, in this case, the page
daemon isn't the bottleneck; it's the I/O.

In all other cases, the current heuristic has too many false positives,
i.e., it caches too many pages that are later reused.  To give one
example, thousands of pages are cached by the current heuristic during a
buildworld and all of them are reactivated before the buildworld
completes.  In particular, clang reads source files using mmap(2) and
there are some relatively large source files in our source tree, e.g.,
sqlite, that are read multiple times.  With the new heuristic, I see fewer
false positives and they have a much lower cost.

I actually tried something like this more than two years ago and it
didn't perform as well as the cache behind heuristic.  However, that was
before the changes to the page daemon in late summer of 2013 and the
existence of pmap_advise().  In particular, with the page daemon doing
its work more frequently and in smaller batches, it now completes its
work while the application accessing the file is blocked on I/O.
Whereas previously, the page daemon appeared to hog the CPU for so long
that it caused "hiccups" in the application's execution.

Finally, I'll add that the elimination of cache pages is a prerequisite
for NUMA support.

Reviewed by:	jeff, kib
Sponsored by:	EMC / Isilon Storage Division
2015-04-04 19:10:22 +00:00
Andrew Turner
a8b295acf3 Move uart_fdt_get_clock and uart_fdt_get_shift to uart_bus_fdt.c, we may
not build uart_cpu_fdt.c in all configs.
2015-04-04 18:45:25 +00:00
Andrew Turner
06d8b1ed6e Remove the extra copy of uart_fdt_get_clock and uart_fdt_get_shift. While
here also use OF_getencprop in uart_fdt_get_clock.

Sponsored by:	The FreeBSD Foundation
2015-04-04 09:57:52 +00:00
Andrew Turner
3d2a63f5ac Use OF_getencprop over OF_getprop and fdt32_to_cpu. The latter may give
us the wrong data in the failure case if shift was not zero.

Sponsored by:	The FreeBSD Foundation
2015-04-04 09:21:56 +00:00
Andrew Turner
3e1eb51df7 Add support for arm64 to the existing arm generic timer driver:
- Add macros to handle the differences in accessing these registers on arm
   and arm64.
 - Use the fdt data to detect if we are on an ARMv7 or ARMv8.
 - Use the virtual timer by default on arm64, we may not have access to
   the physical timer.

Differential Revision:	https://reviews.freebsd.org/D2208
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2015-04-04 09:07:31 +00:00
Konstantin Belousov
0122d251bf Remove useless initialization.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2015-04-04 08:44:20 +00:00
Rui Paulo
3d8e91f9ce urtwn: blink the LED when scanning.
Previously, the driver was trying to blink the LED in the newstate
function, but that only gets called once (unlike OpenBSD's net80211
stack).  Move the LED blinking to set_channel().

While there, don't try to set the channel when we switch to the SCAN
state.  This is already accomplished by the set_channel() function.

MFC after:	1 week
2015-04-04 08:41:02 +00:00
Rui Paulo
f13c5f5428 Remove whitespace. 2015-04-04 08:36:02 +00:00
Justin Hibbits
a616b8213e Fix whitespace. 2015-04-04 06:24:03 +00:00