Commit Graph

104990 Commits

Author SHA1 Message Date
Konstantin Belousov
fcb5b3a419 Cover a race between doselwakeup() and selfdfree(). If doselwakeup()
loop finds the selfd entry and clears its sf_si pointer, which is
handled by selfdfree() in parallel, NULL sf_si makes selfdfree() free
the memory.  The result is the race and accesses to the freed memory.

Refcount the selfd ownership.  One reference is for the sf_link
linkage, which is unconditionally dereferenced by selfdfree().
Another reference is for sf_threads, both selfdfree() and
doselwakeup() race to deref it, the winner unlinks and than frees the
selfd entry.

Reported by:	Larry Rosenman <ler@lerctr.org>
Tested by:	Larry Rosenman <ler@lerctr.org>, pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-07-09 09:22:21 +00:00
Ed Schouten
39b160b3e2 Add forward declaration of struct thread.
This structure is used in some of the functions in this header, but we
don't depend on any header that pulls it i.
2015-07-09 07:31:40 +00:00
Ed Schouten
f355e810cf Generate CloudABI system call table with proper $FreeBSD$ tags. 2015-07-09 07:21:33 +00:00
Ed Schouten
6d338f9a81 Import the CloudABI datatypes and create a system call table.
CloudABI is a pure capability-based runtime environment for UNIX. It
works similar to Capsicum, except that processes already run in
capabilities mode on startup. All functionality that conflicts with this
model has been omitted, making it a compact binary interface that can be
supported by other operating systems without too much effort.

CloudABI is 'secure by default'; the idea is that it should be safe to
run arbitrary third-party binaries without requiring any explicit
hardware virtualization (Bhyve) or namespace virtualization (Jails). The
rights of an application are purely determined by the set of file
descriptors that you grant it on startup.

The datatypes and constants used by CloudABI's C library (cloudlibc) are
defined in separate files called syscalldefs_mi.h (pointer size
independent) and syscalldefs_md.h (pointer size dependent). We import
these files in sys/contrib/cloudabi and wrap around them in
cloudabi*_syscalldefs.h.

We then add stubs for all of the system calls in sys/compat/cloudabi or
sys/compat/cloudabi64, depending on whether the system call depends on
the pointer size. We only have nine system calls that depend on the
pointer size. If we ever want to support 32-bit binaries, we can simply
add sys/compat/cloudabi32 and implement these nine system calls again.

The next step is to send in code reviews for the individual system call
implementations, but also add a sysentvec, to allow CloudABI executabled
to be started through execve().

More information about CloudABI:
- GitHub: https://github.com/NuxiNL/cloudlibc
- Talk at BSDCan: https://www.youtube.com/watch?v=SVdF84x1EdA

Differential Revision:	https://reviews.freebsd.org/D2848
Reviewed by:	emaste, brooks
Obtained from:	https://github.com/NuxiNL/freebsd
2015-07-09 07:20:15 +00:00
John-Mark Gurney
275a0a97ed upon further examination, it turns out that _unregister_all already
provides the guarantee that no threads will be in the _newsession code..
This is provided by the CRYPTODRIVER lock...  This makes the pause
unneeded...
2015-07-08 22:48:41 +00:00
Mateusz Guzik
06d1ada870 seq: use seq_consistent_nomb in seq_consistent
Constify seqp argument for seq_consistent_nomb.

No functional changes.
2015-07-08 22:21:25 +00:00
Zbigniew Bodek
0a3f65a107 Style cleanups after r285270
There should be no semicolons in added macro definitions.
Define empty macro as "do {} while (0)".

Pointed out by: jmg
2015-07-08 22:09:47 +00:00
John-Mark Gurney
e808e13b8b Now that aesni won't reuse fpu contexts (D3016), add seatbelts to the
fpu code to prevent other reuse of the contexts in the future...

Differential Revision:        https://reviews.freebsd.org/D3015
Reviewed by:	kib, gnn
2015-07-08 19:26:36 +00:00
John-Mark Gurney
9d38fd076e address an issue where consumers, like IPsec, can reuse the same
session in multiple threads w/o locking..  There was a single fpu
context shared per session, if multiple threads were using the session,
and both migrated away, they could corrupt each other's fpu context...

This patch adds a per cpu context and a lock to protect it...

It also tries to better address unloading of the aesni module...
The pause will be removed once the OpenCrypto Framework provides a
better method for draining callers into _newsession...

I first discovered the fpu context sharing issue w/ a flood ping over
an IPsec tunnel between two bhyve machines...  The patch in D3015
was used to verify that this fix does fix the issue...

Reviewed by:	gnn, kib (both earlier versions)
Differential Revision:        https://reviews.freebsd.org/D3016
2015-07-08 19:15:29 +00:00
Konstantin Belousov
f4b5a9725a Reimplement the ordering requirements for the timehands updates, and
for timehands consumers, by using fences.

Ensure that the timehands->th_generation reset to zero is visible
before the data update is visible [*].  tc_setget() allowed data update
writes to become visible before generation (but not on TSO
architectures).

Remove tc_setgen(), tc_getgen() helpers, use atomics inline [**].

Noted by:	alc [*]
Requested by:	bde [**]
Reviewed by:	alc, bde
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-07-08 18:42:08 +00:00
Konstantin Belousov
261fda00cd Use atomic_fence_fence_rel() to ensure ordering in the
seq_write_begin(), instead of the load_rmb/rbm_load functions.  The
update does not need to be atomic due to the write lock owned.

Similarly, in seq_write_end(), update of *seqp needs not be atomic.
Only store must be atomic with release.

For seq_read(), the natural operation is the load acquire of the
sequence value, express this directly with atomic_load_acq_int()
instead of using custom partial fence implementation
atomic_load_rmb_int().

In seq_consistent, use atomic_thread_fence_acq() which provides the
desired semantic of ordering reads before fence before the re-reading
of *seqp, instead of custom atomic_rmb_load_int().

Reviewed by:	alc, bde
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-07-08 18:37:08 +00:00
Konstantin Belousov
8954a9a4e6 Add the atomic_thread_fence() family of functions with intent to
provide a semantic defined by the C11 fences with corresponding
memory_order.

atomic_thread_fence_acq() gives r | r, w, where r and w are read and
write accesses, and | denotes the fence itself.

atomic_thread_fence_rel() is r, w | w.

atomic_thread_fence_acq_rel() is the combination of the acquire and
release in single operation.  Note that reads after the acq+rel fence
could be made visible before writes preceeding the fence.

atomic_thread_fence_seq_cst() orders all accesses before/after the
fence, and the fence itself is globally ordered against other
sequentially consistent atomic operations.

Reviewed by:	alc
Discussed with:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-07-08 18:12:24 +00:00
Alan Cox
22cf98d1f3 The intention of r254304 was to scan the active queue continuously.
However, I've observed the active queue scan stopping when there are
frequent free page shortages and the inactive queue is steadily refilled
by other mechanisms, such as the sequential access heuristic in vm_fault()
or madvise(2).  To remedy this problem, record the time of the last active
queue scan, and always scan a number of pages proportional to the time
since the last scan, regardless of whether that last scan was a
timeout-triggered ("pass == 0") or free-page-shortage-triggered ("pass >
0") scan.

Also, on a timeout-triggered scan, allow a full scan of the active queue
when the system is short of inactive pages.

Reviewed by:	kib
MFC after:	6 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-07-08 17:45:59 +00:00
Andrew Turner
6bae05d951 Correctly set __WCHAR_MIN, there is no __UINT_MIN, it's 0.
Sponsored by:	ABT Systems Ltd
2015-07-08 16:18:28 +00:00
Andrew Turner
ded32d88f1 Add support for ipi_all_but_self on arm64.
Obtained from:	ABT Systems Ltd
Sponsored by:	The freeBSD Foundation
2015-07-08 15:32:59 +00:00
Andrew Turner
80ad08a3e9 Add an implementation of savectx that doesn't just call panic.
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-07-08 14:07:06 +00:00
Zbigniew Bodek
4981c60e07 Add memory barrier to bus_dmamap_sync()
On platforms which are fully IO-coherent, the map might be null.
We need to guarantee that all data is observable after the
sync operation is called. Add a memory barrier to ensure that on ARM.

Reviewed by:   andrew, kib
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3012
2015-07-08 13:52:59 +00:00
Konstantin Belousov
69d11def74 Handle copyout for the fcntl(F_OGETLK) using oflock structure.
Otherwise, kernel overwrites a word past the destination.

Submitted by:	walter@pelissero.de
PR:	196718
MFC after:	1 week
2015-07-08 13:19:13 +00:00
Andrew Turner
cb02f6b942 Send the correct signal when vm_fault fails. While here also set the code
and address fields.

Sponsored by:	ABT Systems Ltd
2015-07-08 12:42:44 +00:00
John-Mark Gurney
a13589bc47 unroll the loop slightly... This improves performance enough to
justify, especially for CBC performance where we can't pipeline..  I
don't happen to have my measurements handy though...

Sponsored by:	Netflix, Inc.
2015-07-07 20:31:09 +00:00
Mark Johnston
620711e033 Fix an incorrect assertion in witness.
The number of available lock list entries for a thread is LOCK_CHILDCOUNT,
and each entry can record up to LOCK_NCHILDREN locks. When iterating over
the locks held by a thread, a bound on the loop index is therefore given
by LOCK_CHILDCOUNT * LOCK_NCHILDREN; WITNESS_COUNT is an unrelated
constant.

Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D2974
2015-07-07 19:29:18 +00:00
Luiz Otavio O Souza
f935da6fee Add the Banana Pi DTS.
The Banana Pi support is in progress and this is intended to help the early
adopters.
2015-07-07 19:01:54 +00:00
John-Mark Gurney
748a12e2c3 we may get here w/ non-sleepable locks held, so switch to _NOWAIT when
doing this memory allocation...

Reviewed by:	ae
2015-07-07 18:45:32 +00:00
Ed Maste
906451276a Avoid creating invalid UEFI device path
The UEFI loader on the 10.1 release install disk (disc1) modifies an
existing EFI_DEVICE_PATH_PROTOCOL instance in an apparent attempt to
truncate the device path.  In doing so it creates an invalid device
path.

Perform the equivalent action without modification of structures
allocated by firmware.

PR:		197641
MFC After:	1 week
Submitted by:	Chris Ruffin <chris.ruffin@intel.com>
2015-07-07 18:44:27 +00:00
Luiz Otavio O Souza
f4b61a34e5 Add the GMAC entries to sun7i (A20) DTS.
While here make EMAC disabled unless explicitly enabled.
2015-07-07 18:32:23 +00:00
Takanori Watanabe
99043514c6 Fix rfcomm_sppd regression I could reproduced.
To reproduce it, Two machine running FreeBSD and
run
rfcomm_sppd -c 3 -S
rfcomm_sppd -a ${PEER} -c 3
on each side.
2015-07-07 15:56:51 +00:00
Pedro F. Giffuni
9129dd59be Relocate sched_random() within the SMP section.
Place sched_random nearer to where it's first used: moving the
code nearer to where it  is used makes the code easier to read
and we can reduce the initial "#ifdef SMP" island.

Reword a little the comment and clean some whitespaces
while here.
2015-07-07 15:22:29 +00:00
Achim Leubner
4e1bc9a039 Driver 'pmspcv' added. Supports PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 SAS/SATA HBA Controllers. 2015-07-07 13:17:02 +00:00
Michael Tuexen
29b9533b43 Export the ssthresh value per SCTP path via the sysctl interface.
MFC after: 1 month
2015-07-07 06:34:28 +00:00
Adrian Chadd
54991f37c9 Attempt to make 5GHz HT/40 work on the 6xxx series NICs.
The 6205 (Taylor Peak) in the Lenovo X230 works fine in 5GHz 11a and 11n HT20,
but not 11n HT40.  The NIC goes RX deaf the moment HT40 is configured.
It's so RX deaf that it doesn't even hear beacons and the firmware sends
"BEACON MISS" events.  That's pretty deaf.

I tried configuring up the HT40 flags in monitor mode and it worked - so
I assumed that doing the transition from 20 -> 40MHz channel configuration
when going auth->assoc (ie, after the NIC has been partially configured)
is a problem.

So for now, let's just always set them if they're available.

Tested:

* Intel 5300, STA mode, 5GHz HT/40 AP; 2GHz HT/20 AP
* Intel 6205, STA mode, 5GHz HT/40, HT20, 11a AP; 2GHz HT/20 AP

This was pointed out to me by coworkers trying to use FreeBSD-HEAD
in the office on their Thinkpad T420p laptops.

TODO:

* I don't like how the HT40 flags are configured - the whole interop/
  protection config should be re-checked.  Notably, I think curhtprotmode
  is 0 in a lot of cases, which means "no interoperability" and i think
  that's busted.

Sponsored by:	Norse Corp, Inc.
2015-07-07 03:51:29 +00:00
Justin Hibbits
7f78865ba0 Enable the wireless on attach.
This comes from the archives of "forgotten in the original commit, and probably
pointless now because nobody uses it, and the driver's broken anyway."
2015-07-07 02:42:48 +00:00
Justin Hibbits
44027a8321 style(9) cleanups.
Don't use PRIxPTR, these registers are 32-bits, cast to u_long instead.

Pointed out by:	bde
2015-07-07 02:37:29 +00:00
Navdeep Parhar
9af71ab3bc cxgbe(4): Add a new knob that controls the congestion response of netmap
rx queues.  The default is to drop rather than backpressure.

This decouples the congestion settings of NIC and netmap rx queues.

MFC after:	3 days
2015-07-06 20:56:59 +00:00
Navdeep Parhar
41f7622b64 cxgbe(4): Do not override the the global defaults for congestion drops.
The hw.cxgbe.cong_drop knob is not affected by this change because the
driver sets up congestion drop on a per-queue basis.

MFC after:	3 days
2015-07-06 20:28:42 +00:00
Neel Natu
5e4f29c037 Move the 'devmem' device nodes from /dev/vmm to /dev/vmm.io
Some external tools just do a 'ls /dev/vmm' to figure out the bhyve virtual
machines on the host. These tools break if the devmem device nodes also
appear in /dev/vmm.

Requested by:	grehan
2015-07-06 19:41:43 +00:00
John-Mark Gurney
5a550cca9a Fix for non-random IV's when CRD_F_IV_PRESENT and CRD_F_IV_EXPLICIT
flags are not specified... This bug was introduced in r275732...

This only affects IPsec ESP only policies w/ the aesni module loaded,
other subsystems specify one or both of the flags...

Reviewed by:	gnn, delphij, eri
2015-07-06 19:30:29 +00:00
John-Mark Gurney
bcc0b68477 remove _NORMAL flag which isn't suppose to be used w/ _alloc_ctx...
Reviewed by:	kib (a while ago)
2015-07-06 19:17:56 +00:00
Mateusz Guzik
aa0e2887f4 tty: replace several curthread->td_proc with stored curproc
No functional changes.
2015-07-06 18:53:56 +00:00
Zbigniew Bodek
1ae9c994c8 Introduce ITS support for ARM64
Add ARM ITS (Interrupt Translation Services) support required
to bring-up message signalled interrupts on some ARM64 platforms.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
2015-07-06 18:27:41 +00:00
Andrew Turner
b67d1aad6f Add more tlb invalidations. We currently invalidate when we may not need
to, but with this I can boot on a simulator that models the tlb.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-07-06 18:27:18 +00:00
Luiz Otavio O Souza
1d7a730974 When initializing the (unused) TX descriptors it is not necessary set the
chain bit.

Obtained from:	NetBSD
2015-07-06 17:13:17 +00:00
Luiz Otavio O Souza
ff0752c870 Use uint32_t consistently to store registers values.
Always use unsigned numbers to avoid undefined behavior on (1 << 31).

Remove unused variables and some stray semicolons.

No functional changes.
2015-07-06 16:45:48 +00:00
Patrick Kelsey
6f99ea0520 Don't acquire sysctlmemlock in userland_sysctl() when the old value
pointer is NULL, as in that case there are no userland pages that
could potentially be wired.  It is common for old to be NULL and
oldlenp to be non-NULL in calls to userland_sysctl(), as this is used
to probe for the length of a variable-length sysctl entry before
retrieving a value.  Note that it is typical for such calls to be made
with an uninitialized value in *oldlenp, so sysctlmemlock was
essentially being acquired at random (depending on the uninitialized
value in *oldlenp being > PAGE_SIZE or not) for these calls prior to
this patch.

Differential Revision: https://reviews.freebsd.org/D2987
Reviewed by: mjg, kib
Approved by: jmallett (mentor)
MFC after: 1 month
2015-07-06 16:07:21 +00:00
Konstantin Belousov
9889bbac23 Mutex memory is not zeroed, add MTX_NEW.
Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-07-06 14:09:00 +00:00
Andrey V. Elsukov
280d77a3bb Fill the port and protocol information in the SADB_ACQUIRE message
in case when security policy has it as required by RFC 2367.

PR:		192774
Differential Revision:	https://reviews.freebsd.org/D2972
MFC after:	1 week
2015-07-06 12:40:31 +00:00
Steven Hartland
64ce6b09a3 Correct bit offsets for ahci quirks
Fix bit offsets causing incorrect quirks being reported on boot for ahci
introduced by r280184.

MFC after:	3 days
Sponsored by:	Multiplay
2015-07-06 09:44:07 +00:00
Justin Hibbits
3f3cffedce Merge booke and aim interrupt.c files.
Summary:
Both booke and AIM interrupt.c files contain nearly identical code.  This merges
the two files, to reduce duplication.

Reviewers: #powerpc, marcel

Reviewed By: marcel

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D2991
2015-07-06 05:08:57 +00:00
Luiz Otavio O Souza
a5221d68dc Fix the sent packets statistics for if_dwc. 2015-07-06 03:06:13 +00:00
Patrick Kelsey
e9617c305c Fix if_loop so bpfwrite() can use it regardless of the state of
bd_hdrcmplt.  As if_loop does not use link-level headers, its behavior
when used by bpfwrite() should be the same regardless of the state of
bd_hdrcmplt.  Without this change, libpcap (and other BPF users that
work like it) fail when writing to loopback interfaces.

Differential Revision: https://reviews.freebsd.org/D2989
Reviewed by: gnn, melifaro
Approved by: jmallett (mentor)
MFC after: 3 days
2015-07-06 02:12:49 +00:00
Mark Johnston
947401dd50 Move the comment describing namei(9) back to namei()'s definition.
MFC after:	3 days
2015-07-05 22:56:41 +00:00
Mark Johnston
8bbd1f25b1 Remove a stale descriptive comment for gbincore().
The splay trees referenced in the comment were converted to
path-compressed tries in r250551.

MFC after:	3 days
2015-07-05 22:44:41 +00:00
Mark Johnston
5f34e93c58 Check suspendability on the mountpoint returned by VOP_GETWRITEMOUNT.
This obviates the need for a MNTK_SUSPENDABLE flag, since passthrough
filesystems like nullfs and unionfs no longer need to inherit this
information from their lower layer(s). This change also restores the
pre-r273336 behaviour of using the presence of a susp_clean VFS method to
request suspension support.

Reviewed by:	kib, mjg
Differential Revision:	https://reviews.freebsd.org/D2937
2015-07-05 22:37:33 +00:00
Mark Johnston
010ba3842c Add a local variable initialization needed in the OBJT_DEFAULT case.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D2992
2015-07-05 22:26:19 +00:00
Mateusz Guzik
f131759f54 fd: make 'rights' a manadatory argument to fget* functions 2015-07-05 19:05:16 +00:00
Andrew Turner
5f8583891f Add the kernel functions needed to enable threading.
Sponsored by:	ABT Systems Ltd
2015-07-05 18:16:06 +00:00
Bjoern A. Zeeb
31c98473c1 Fix GENERIC64 and LINT64 powerpc builds after r285144. 2015-07-05 15:30:16 +00:00
Ian Lepore
1a6570fb1f Enable ipsec by default on all armv6 platforms. 2015-07-05 14:16:31 +00:00
Ian Lepore
b108902461 Ensure all the required files get built when you include the IPSEC option. 2015-07-05 14:15:58 +00:00
Alexander Motin
d1f4058735 Make first step toward supporting target and initiator roles same time.
To avoid conflicts between target and initiator devices in CAM, make
CTL use target ID reported by HBA as its initiator_id in XPT_PATH_INQ.
That target ID is known to never be used for initiator role, so it won't
conflict.  For Fibre Channel and FireWire HBAs this specific ID choice
is irrelevant since all target IDs there are virtual. Same time for SPI
HBAs it seems could be even requirement to use same target ID for both
initiator and target roles.

While there are some more things to polish in isp(4) driver, first tests
of using both roles same time on the same port appeared successfull:

# camcontrol devlist -v
scbus0 on isp0 bus 0:
<FREEBSD CTLDISK 0001>             at scbus0 target 1 lun 0 (da20,pass21)
<>                                 at scbus0 target 256 lun 0 (ctl0)
<>                                 at scbus0 target -1 lun ffffffff (ctl1)
2015-07-05 03:38:58 +00:00
Alexander Motin
766a65a50d Remove extra level of target ID indirection (isp_dev_map).
FreeBSD never had limitation on number of target IDs, and there is no
any other requirement to allocate them densely.  Since slots of port
database already populated just sequentially, there is no much need
for another indirection to allocate sequentially too.
2015-07-05 02:09:46 +00:00
George V. Neville-Neil
aaa7cbfe1a Summary: Add missing files necessary to build with IPSEC and crypto 2015-07-04 21:32:44 +00:00
George V. Neville-Neil
0661a7c224 Fix up tabs vs. spaces 2015-07-04 20:31:06 +00:00
Justin Hibbits
0936003e3d Use the correct type for physical addresses.
On Book-E, physical addresses are actually 36-bits, not 32-bits.  This is
currently worked around by ignoring the top bits.  However, in some cases, the
boot loader configures CCSR to something above the 32-bit mark.  This is stage 1
in updating the pmap to handle 36-bit physaddr.
2015-07-04 19:00:38 +00:00
Alexander Motin
8656f200dc Change comment added in r284540.
This appeared to be not card's issue, but driver's, though solution is
the same so far.
2015-07-04 18:51:54 +00:00
Alexander Motin
6bef0aa0c6 Drop discovered targets when initiator role is disabled. 2015-07-04 18:38:46 +00:00
Justin Hibbits
398973f809 Add machine check register printing
This will print out the Memory Subsystem Status Register on MPC745x (G4+ class),
and the Machine Check Status Register on Book-E class CPUs, to aid in debugging
machine checks.  Other relevant registers, for other CPUs, can be added in the
future.
2015-07-04 18:16:41 +00:00
George V. Neville-Neil
3839369c03 Enable IPSEC in all GENERIC kernels.
Universe and kernel build tests passed 4 July 2015

PR:		128030
Sponsored by:	Rubicon Communications (Netgate)
2015-07-04 17:37:00 +00:00
Mariusz Zaborski
54f98da930 Move the nvlist source and private includes from sys/kern to seperate
directory sys/contrib/libnv.

The goal of this operation is to NOT install header files which shouldn't
be used outside the nvlist library.

Approved by:	pjd (mentor)
2015-07-04 16:33:37 +00:00
Luiz Otavio O Souza
06844c0f7e Install loader.rc with ARM u-boot loader (ubldr).
loader.rc is the responsible to read and process loader.conf variables.

This fix the issue of loader.conf being silently ignored.

MFC after:	3 days
2015-07-04 16:19:38 +00:00
Mateusz Guzik
9ca30b0e06 vfs: use shared vnode locking when looking up ".." in vop_stdvptocnp
Briefly discussed with: kib
2015-07-04 15:46:39 +00:00
Mateusz Guzik
dba0bec2bb fd: de-k&r-ify functions + some whitespace fixes
No functional changes.
2015-07-04 15:42:03 +00:00
Mateusz Guzik
ee5f66f820 sysctl: get rid of sysctl_lock/unlock
Inline their contents into the only consumer.
2015-07-04 14:44:39 +00:00
Mariusz Zaborski
07929e4e77 Remove non-existent dnvlist functions.
Approved by:	pjd (mentor)
2015-07-04 10:33:33 +00:00
John-Mark Gurney
64ff224dd5 improve dependencies for this module a bit... not great, but at
least gives some basics...  I would add them to DPSRC, but due to the
intrinsics headers, they can't be added...
2015-07-04 08:16:32 +00:00
Mateusz Guzik
d5fc115a1a sysctl: remove a debugging printf which crept in with r285125 2015-07-04 07:01:43 +00:00
Mateusz Guzik
b8633775a8 sysctl: switch sysctllock to a sleepable rmlock
The lock is almost never taken for writing.
2015-07-04 06:54:15 +00:00
Warner Losh
8cad626fbb Cache _MPATH and pass it down into the modules build. Some NFS setups
make the find it does extremely expensive, so compute it only
once. Also make sure the 'traditional' module building method works at
the expense of a bit of duplicated code.
2015-07-04 05:43:45 +00:00
Adrian Chadd
3e307100f6 Quieten the scorpion SoC/WMAC reset path. Stuff the non-error stuff
under HALDEBUG().
2015-07-04 03:15:42 +00:00
Adrian Chadd
35aae619d7 Call the WMAC DDR flush before handling an interrupt for the
Atheros AHB (internally) connected MAC.

TODO:

* verify the interrupt was for us before doing the DDR flush.
2015-07-04 03:07:28 +00:00
Adrian Chadd
c37904e8ba Reshuffle all of the DDR flush operations into a single switch/mux,
and start teaching subsystems about it.

The Atheros MIPS platforms don't guarantee any kind of FIFO consistency
with interrupts in hardware.  So software needs to do a flush when it
receives an interrupt and before it calls the interrupt handler.

There are new ones for the QCA934x and QCA955x, so do a few things:

* Get rid of the individual ones (for ethernet and IP2);
* Create a mux and enum listing all the variations on DDR flushes;
* replace the uses of IP2 with the relevant one (which will typically
  be "PCI" here);
* call the USB DDR flush before calling the real USB interrupt handlers;
* call the ethernet one upon receiving an interrupt that's for us,
  rather than never calling it during operation.

Tested:

* QCA9558 (TP-Link archer c7 v2)
* AR9331 (Carambola 2)

TODO:

* PCI, USB, ethernet, etc need to do a double-check to see if the
  interrupt was truely for them before doing the DDR.  For now I
  prefer "correct" over "fast".
2015-07-04 03:05:57 +00:00
Adrian Chadd
52f5515397 Wake up the hardware before doing anything in sysctl.
This stops the panics that occur on MIPS platforms when doing say,
'sysctl dev.ath.0' whilst the MAC is asleep.  The MIPS platform is
rather unforgiving in getting power-save register access wrong and you
will get all kinds of odd failures if you don't have things woken
up at the right times.

Tested:

* QCA9558 (TP-Link Archer C7 v2)
* AR9331 (Carambola 2)

.. with no VAPs configured and ath0 down (thus the MAC is definitely
   asleep.)

PR:		kern/201117
2015-07-04 02:59:30 +00:00
Rick Macklem
2a3508eb48 If a "principal" argument isn't provided for a Kerberized NFS mount,
the kernel would generate a bogus one with a ":/<path>" suffix.
This would only occur for the case where there was no explicit
"principal" argument and the getaddrinfo() call in mount_nfs.c failed to a
return a cannonical name for the server.
This patch fixes this unusual case.

PR:		201073
Submitted by:	masato@itc.naist.jp
MFC after:	2 weeks
2015-07-03 22:11:07 +00:00
George V. Neville-Neil
987de84445 New AES modes for IPSec, user space components.
Update setkey and libipsec to understand aes-gcm-16 as an
encryption method.

A partial commit of the work in review D2936.

Submitted by:	eri
Reviewed by:	jmg
MFC after:	2 weeks
Sponsored by:	Rubicon Communications (Netgate)
2015-07-03 20:09:14 +00:00
Andrey V. Elsukov
cb207f93ca Keep IPv6 address specified by IPV6_PKTINFO socket option in kernel
internal form to be able handle link-local IPv6 addresses.

Reported by:	kp
Tested by:	kp
2015-07-03 19:01:38 +00:00
Luiz Otavio O Souza
50ad20b383 Add the routines to activate the GMAC clock and setup the GMAC mode.
Tested on Cubieboard 2 and Banana pi.
2015-07-03 18:39:25 +00:00
Luiz Otavio O Souza
9639a6c7c9 Rename a10_emac_gpio_config() to a10_gpio_ethernet_activate() to make the
change to GMAC easier on A20 SoCs.

On A10 only the EMAC controller is available (fast ethernet), but on A20
there is also GMAC a high (or better) performant controller (gigabit
ethernet).

On A20 the both controllers uses the same pins to talk to the ethernet PHY
(MII or RGMII) and they can be selected by the GPIO pin mux.

There is work in progress to bring in GMAC support.
2015-07-03 17:54:41 +00:00
Luiz Otavio O Souza
2e33d3583d Remove duplicate and unnecessary includes.
While here remove an unused and wrong define.
2015-07-03 17:09:27 +00:00
Marcel Moolenaar
194709a520 Remove commented-out and non-existent cbus(4) attachment for uart(4). 2015-07-03 16:02:06 +00:00
Marcel Moolenaar
472aa69925 Allow proto(4) to be compiled into the kernel. 2015-07-03 15:56:00 +00:00
Ermal Luçi
c1fc5e9601 Reduce overhead of IPSEC for traffic generated from host
When IPSEC is enabled on the kernel the forwarding path has an optimization to not enter the code paths
for checking security policies but first checks if there is any security policy active at all.

The patch introduces the same optimization but for traffic generated from the host itself.
This reduces the overhead by 50% on my tests for generated host traffic without and SP active.

Differential Revision:	https://reviews.freebsd.org/D2980
Reviewed by:	ae, gnn
Approved by:	gnn(mentor)
2015-07-03 15:31:56 +00:00
Ruslan Bukin
4ebd95ae06 o Add a description for virtio block device implemented
in PISM (Bluespec C-interface device)
o Add a kernel config

Sponsored by:	HEIF5
2015-07-03 14:46:57 +00:00
Ruslan Bukin
4934834d6b Allow BERI virtio-platform code to operate with no PIO devices specified.
We will use it with Bluespec simulator of CHERI processor for invalidating
caches only.
2015-07-03 14:27:28 +00:00
Ruslan Bukin
116b8d2b0b Add 'prewrite' method allowing us to run some platform-specific
code before each write happens, e.g. write-back caches.
This will help booting in Bluespec simulator of CHERI processor.
2015-07-03 14:13:16 +00:00
Luiz Otavio O Souza
7ec8c789c3 Add AHCI attachment code for Allwinner A10/A20 SoCs.
The Allwinner SoC has an AHCI device on its internal main bus rather
than the PCI bus.  This SoC is somewhat underdocumented, and its SATA
controller is no exception.  The methods to support this chip were
harvested from the Linux Allwinner SDK, and then constants invented to
describe what's going on based on low-level constants contained in the
SATA standard and guess work.

This SoC requires a specific AHCI channel setup in order to start the
operations on the channel properly.

Clock setup and AHCI channel setup idea came from NetBSD.

Tested on Cubieboard 2 and Banana pi (and attachment on Cubieboard by
Pratik Singhal).

Differential Revision:	https://reviews.freebsd.org/D737
Submitted by:	imp
Reviewed by:	imp, ganbold, mav, andrew
2015-07-03 14:11:01 +00:00
Roger Pau Monné
6a8e9695ba netfront: preserve configuration across migrations
Try to preserve the xn configuration when migrating. This is not always
possible since the backend might not have the same set of options
available, in which case we will try to preserve as many as possible.

MFC after:    2 weeks
PR:           183139
Reported by:  mcdouga9@egr.msu.edu
Sponsored by: Citrix Systems R&D
2015-07-03 12:09:05 +00:00
Hans Petter Selasky
49557d2481 Fix broken implementation of "kvasprintf()" function by adding missing
kmalloc() call. Make function global instead of static inline to fix
compiler warnings about passing variable argument lists to inline
functions.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-07-03 11:16:20 +00:00
Bjoern A. Zeeb
bfbc08b848 Move comment to the right position.
PR:		152791
Submitted by:	vangyzen (as part of the functional change)
MFC after:	3 days
2015-07-03 09:53:56 +00:00
Adrian Chadd
ef19855701 Oops - fix typo. 2015-07-03 07:00:24 +00:00
Simon J. Gerraty
96a11afdff Updated depends 2015-07-03 06:11:54 +00:00
Adrian Chadd
b14a705362 Add initial support for the TP-Link Archer C7 v2.
The SoC, the flash, the ethernet ports and ethernet switch all work.
The USB works.

The 11ac PCIe NIC internally is at least seen by the PCIE RC, but
I haven't tried using it yet.  There's no driver and I haven't
yet swapped it out for a non-11ac chip.

The on-chip 2GHz wifi works, but there are some data errors that
get thrown up in STA mode when scanning.  I have a feeling I have
to finish the DDR flush code out and have it run correctly on the
shared interrupts; that'll take a bit of time to get right.

But if you're after an updated piece of hardware, the Archer C7 v2
is certainly there, and you can replace the 11ac NIC with a 3x3
Atheros PCIe device (eg AR9380, AR9390, AR9580, etc) and it'll
"just work".

Tested:

* TP-Link archer c7v2.
2015-07-03 06:09:56 +00:00
Adrian Chadd
212faba17d Add pcb1 to the QCA955x.
The Tp-link Archer-C7v2 unit has a QCA9558 internally but hangs the
QCA988x 11ac PCIe NIC off of PCI RC #1, not #0.

So I actually finally /do/ have a board to verify whether PCIe is working.
Grr.

Tested:

* TP-Link Archer-C7v2.
2015-07-03 06:06:44 +00:00
Marcel Moolenaar
42d3ab5d1b Implement unload and sync operations. 2015-07-03 05:44:58 +00:00
Adrian Chadd
9d0e5a1718 Enable setting the QCA955x GPIO output mux configuration.
It's not used by any boards yet, but it's going to creep up soon
as more boards show up.
2015-07-03 03:34:21 +00:00
Adrian Chadd
3facd56c71 Add register defines for the QCA955x DDR flush and GPIO control. 2015-07-03 03:32:54 +00:00
Marcel Moolenaar
89abdea8f0 Add create, destroy and load of memory descriptors. 2015-07-03 01:52:22 +00:00
Warner Losh
12f05b8446 Kill MFILES and find things automatically. It turned out to be only
lightly used. Find the proper .m file when we depend on *_if.[ch] in
the srcs line, with seat-belts for false positive matches.  This uses
make's path mechanism. A further refinement would be to calculate this
once, and then pass the resulting _MPATH to modules submakes.

Differential Revision: https://reviews.freebsd.org/D2327
2015-07-03 01:50:26 +00:00
Rick Macklem
d189dcb6e2 Alex Burlyga reported a POLA violation for the new NFS client as
compared to the old NFS client via email to the freebsd-fs@ mailing list.
For the new client, when multiple clients attempted to create a symbolic
link concurrently, more that one client would report success instead of
EEXIST. This was caused by code in the new client that mapped EEXIST to
OK assuming it was caused by a retried RPC request.
Since the old client did not do this, the patch defaults to the old
behaviour and permits the new behaviour to be enabled via a sysctl.

Reported by:	alex.burlyga.ietf@gmail.com
Tested by:	alex.burlyga.ietf@gmail.com
MFC after:	2 weeks
2015-07-03 01:15:21 +00:00
Mariusz Zaborski
dc619c2f57 Add stddef.h for size_t typedef.
Approved by:	pjd (mentor)
2015-07-02 21:46:07 +00:00
Marcel Moolenaar
3a232946f7 Add an ISA/ACPI bus attachment to proto(4). 2015-07-02 19:21:29 +00:00
Mateusz Guzik
e2f5418e73 sysvshm: fix up some whitespace issues and spurious initialisation 2015-07-02 19:14:30 +00:00
Mateusz Guzik
77a26248a3 sysvshm: don't lock proc when calculating attach_va
vm_daddr is constant and RLIMIT_DATA can be obtained from thread's copy of
rlimits.
2015-07-02 19:03:44 +00:00
Mateusz Guzik
0be3a191a4 sysvshm: fix shmrealloc
The code was supposed to initialize new segs in newsegs array, but used the old
pointer.
2015-07-02 19:00:22 +00:00
Mateusz Guzik
cd336bad26 vm: don't lock proc around accesses to vm_{t,d}addr and RLIMIT_DATA in sys_mmap
vm_{t,d}addr are constant and we can use thread's copy of resource limits
2015-07-02 18:30:12 +00:00
Ermal Luçi
d14122b078 Avoid doing multiple route lookups for the same destination IP during forwarding
ip_forward() does a route lookup for testing this packet can be sent to a known destination,
it also can do another route lookup if it detects that an ICMP redirect is needed,
it forgets all of this and handovers to ip_output() to do the same lookup yet again.

This optimisation just does one route lookup during the forwarding path and handovers that to be considered by ip_output().

Differential Revision:	https://reviews.freebsd.org/D2964
Approved by:	ae, gnn(mentor)
MFC after:	1 week
2015-07-02 18:10:41 +00:00
Andrew Turner
d2676f552e Remove an unneeded define and old comment referencing amd64. 2015-07-02 16:13:29 +00:00
Andrew Turner
b9b3574474 Remove an old comment, the cache is enabled.
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-07-02 15:26:40 +00:00
Konstantin Belousov
be930a2021 Account for the main process stack being one page below the highest
user address when ABI uses shared page.

Note that the change is no-op for correctness, since shared page does
not fault.  The mapping for the shared page is installed at the
address space creation, the page is unmanaged and its pte/pv entry
cannot be reclaimed.

Submitted by:	Oliver Pinter
Review:	https://reviews.freebsd.org/D2954
MFC after:	1 week
2015-07-02 15:22:13 +00:00
Andrew Turner
40fc1dffc3 Use pmap_load to load table entries. This simplifies finding places where
we access the tables.

Obtained from:	ABT Systems Ltd
Sponsored by:	The fReeBSD Foundation
2015-07-02 15:17:30 +00:00
Konstantin Belousov
6fdfd88220 Use single instance of the identical INKERNEL() and PMC_IN_KERNEL()
macros on amd64 and i386.  Move the definition to machine/param.h.
kgdb defines INKERNEL() too, the conflict is resolved by renaming kgdb
version to PINKERNEL().

On i386, correct the lowest kernel address.  After the shared page was
introduced, USRSTACK no longer points to the last user address + 1 [*]

Submitted by:	Oliver Pinter [*]
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-07-02 14:37:21 +00:00
Andrew Turner
a380ef6a02 Enable kernel debugging on arm64, other than GDB as it fails to build.
Sponsored by:	ABT Systems Ltd
2015-07-02 14:35:30 +00:00
Konstantin Belousov
1965f86c72 Vnode is not referenced by the vfs_domount() at the point where
asserts are made.  Remove them, since we might dereference freed
memory.  Leaked locks are asserted by the syscall return code anyway.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-07-02 14:31:47 +00:00
Alexander Motin
b9b4269c1d Fix couple panics on forced unmount of backing file.
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2015-07-02 12:53:22 +00:00
Pawel Jakub Dawidek
fefb6a143a Properly propagate errors in metadata reading.
PR:		198860
Submitted by:	Matthew D. Fuller
2015-07-02 10:57:34 +00:00
Pawel Jakub Dawidek
edaa9008ff Allow to omit keyfile number for the first keyfile. 2015-07-02 10:55:32 +00:00
Andriy Gapon
74f75cb1bd zfs_mount(MS_REMOUNT): protect zfs_(un)register_callbacks calls
We now take z_teardown_lock as a writer to ensure that there is no I/O
while the filesystem state is in a flux.  Also, zfs_suspend_fs() ->
zfsvfs_teardown() call zfs_unregister_callbacks() and zfs_resume_fs() ->
zfsvfs_setup() call zfs_unregister_callbacks().  Previously there was no
synchronization between those calls and the calls in the re-mounting
case.  That could lead to concurrent execution and a crash.

PR:		180060
Differential Revision:	https://reviews.freebsd.org/D2865
Suggested by:	mahrens
Reviewed by:	delphij, pho, mahrens, will
MFC after:	13 days
Sponsored by:	ClusterHQ
2015-07-02 08:32:02 +00:00
Alexander Motin
556e4c9a83 Disable port multiplier support on Marvell 88SE61xx chips.
According to report, some recent unrelated changes in the driver triggered
timeouts when testing for absent port multiplier.  Cause of this behavior
channge is unclear, but since these chips are old, rare and buggy, it is
easier to just disable port multiplier support, same as done in Linux.

Reported by:	bar
MFC after:	3 days
2015-07-02 08:25:45 +00:00
Luiz Otavio O Souza
5ee00411e4 Add DMA support for Allwinner MMC controller.
DMA handles all data transfers up to 128K or 16 segments and fallback to
pio mode when DMA requirements are not met.

The read performance has improved greatly while the write performance also
showed some improvement but seems limited by the card type and quality.

Submitted by:	Pratik Singhal <pratiksinghal@freebsd.org>
Sponsored by:	Google Summer of Code 2015
Tested on:	A10 (cubieboard) and A20 (cubieboard 2 and banana pi)
2015-07-01 23:27:01 +00:00
Andrew Turner
c950fb6b67 Fix the logic for when to restore the VFP registers. It should restore
them when a different thread last used them, or when the thread was last
run on a different cpu.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-07-01 17:27:44 +00:00
Konstantin Belousov
3ce8c94f29 Disallow a debugger on 64bit system to set fs/gs bases of the 32bit
process beyond the end of the process address space.  Such setting is
not dangerous to the kernel integrity, but it causes confusing
application misbehaviour.

Sponsored by:	The FreeBSD Foundation
MFC after:	12 days
2015-07-01 16:37:03 +00:00
Ruslan Bukin
b78ee15e9f First cut of DTrace for AArch64.
Reviewed by:	andrew, emaste
Sponsored by:	ARM Limited
Differential Revision:	https://reviews.freebsd.org/D2738
2015-07-01 15:51:11 +00:00
Christian Brueffer
8b47cda2f7 Use the correct le*dec function to decode a 16bit type.
PR:		194228
Submitted by:	David Horwitt
MFC after:	2 weeks
2015-07-01 14:54:13 +00:00
Ruslan Bukin
0ff41755cd Add a central location for exclusion checks. We check
here if function is excluded from FBT instrumentation.

Reviewed by:	andrew, emaste, markj
Differential Revision:	https://reviews.freebsd.org/D2899
2015-07-01 14:09:59 +00:00
Navdeep Parhar
fd215e45eb cxgbe(4): request an automatic tx update when a netmap tx queue idles.
The NIC tx queues already do this.

MFC after:	1 week
Differential Revision:
2015-07-01 00:34:14 +00:00
Li-Wen Hsu
4889014996 - Fix make depend in sys/modules
Differential Revision:	https://reviews.freebsd.org/D2951
Approved by:	delphij
2015-06-30 19:35:14 +00:00
Navdeep Parhar
9523d1bfc3 Fix leak in tcp_lro_rx. Simply clearing M_PKTHDR isn't enough, any tags
hanging off the header need to be freed too.

Differential Revision:	https://reviews.freebsd.org/D2708
Reviewed by:	ae@, hiren@
2015-06-30 17:19:58 +00:00
Mark Murray
c4f9c760c9 Updated random(4) boot/shutdown scripting.
Fix the man pages as well.

Differential Revision: https://reviews.freebsd.org/D2924
Approved by: so (delphij)
2015-06-30 17:09:41 +00:00
Mark Murray
d1b06863fb Huge cleanup of random(4) code.
* GENERAL
- Update copyright.
- Make kernel options for RANDOM_YARROW and RANDOM_DUMMY. Set
  neither to ON, which means we want Fortuna
- If there is no 'device random' in the kernel, there will be NO
  random(4) device in the kernel, and the KERN_ARND sysctl will
  return nothing. With RANDOM_DUMMY there will be a random(4) that
  always blocks.
- Repair kern.arandom (KERN_ARND sysctl). The old version went
  through arc4random(9) and was a bit weird.
- Adjust arc4random stirring a bit - the existing code looks a little
  suspect.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Redo read_random(9) so as to duplicate random(4)'s read internals.
  This makes it a first-class citizen rather than a hack.
- Move stuff out of locked regions when it does not need to be
  there.
- Trim RANDOM_DEBUG printfs. Some are excess to requirement, some
  behind boot verbose.
- Use SYSINIT to sequence the startup.
- Fix init/deinit sysctl stuff.
- Make relevant sysctls also tunables.
- Add different harvesting "styles" to allow for different requirements
  (direct, queue, fast).
- Add harvesting of FFS atime events. This needs to be checked for
  weighing down the FS code.
- Add harvesting of slab allocator events. This needs to be checked for
  weighing down the allocator code.
- Fix the random(9) manpage.
- Loadable modules are not present for now. These will be re-engineered
  when the dust settles.
- Use macros for locks.
- Fix comments.

* src/share/man/...
- Update the man pages.

* src/etc/...
- The startup/shutdown work is done in D2924.

* src/UPDATING
- Add UPDATING announcement.

* src/sys/dev/random/build.sh
- Add copyright.
- Add libz for unit tests.

* src/sys/dev/random/dummy.c
- Remove; no longer needed. Functionality incorporated into randomdev.*.

* live_entropy_sources.c live_entropy_sources.h
- Remove; content moved.
- move content to randomdev.[ch] and optimise.

* src/sys/dev/random/random_adaptors.c src/sys/dev/random/random_adaptors.h
- Remove; plugability is no longer used. Compile-time algorithm
  selection is the way to go.

* src/sys/dev/random/random_harvestq.c src/sys/dev/random/random_harvestq.h
- Add early (re)boot-time randomness caching.

* src/sys/dev/random/randomdev_soft.c src/sys/dev/random/randomdev_soft.h
- Remove; no longer needed.

* src/sys/dev/random/uint128.h
- Provide a fake uint128_t; if a real one ever arrived, we can use
  that instead. All that is needed here is N=0, N++, N==0, and some
  localised trickery is used to manufacture a 128-bit 0ULLL.

* src/sys/dev/random/unit_test.c src/sys/dev/random/unit_test.h
- Improve unit tests; previously the testing human needed clairvoyance;
  now the test will do a basic check of compressibility. Clairvoyant
  talent is still a good idea.
- This is still a long way off a proper unit test.

* src/sys/dev/random/fortuna.c src/sys/dev/random/fortuna.h
- Improve messy union to just uint128_t.
- Remove unneeded 'static struct fortuna_start_cache'.
- Tighten up up arithmetic.
- Provide a method to allow eternal junk to be introduced; harden
  it against blatant by compress/hashing.
- Assert that locks are held correctly.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Turn into self-sufficient module (no longer requires randomdev_soft.[ch])

* src/sys/dev/random/yarrow.c src/sys/dev/random/yarrow.h
- Improve messy union to just uint128_t.
- Remove unneeded 'staic struct start_cache'.
- Tighten up up arithmetic.
- Provide a method to allow eternal junk to be introduced; harden
  it against blatant by compress/hashing.
- Assert that locks are held correctly.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Turn into self-sufficient module (no longer requires randomdev_soft.[ch])
- Fix some magic numbers elsewhere used as FAST and SLOW.

Differential Revision: https://reviews.freebsd.org/D2025
Reviewed by: vsevolod,delphij,rwatson,trasz,jmg
Approved by: so (delphij)
2015-06-30 17:00:45 +00:00
Konstantin Belousov
6ef120027f Do not calculate the stack's bottom address twice.
Submitted by:	Olivц╘r Pintц╘r
Review:	https://reviews.freebsd.org/D2953
MFC after:	1 week
2015-06-30 15:22:47 +00:00
Hiren Panchasara
f85680793b Avoid a situation where we do not set persist timer after a zero window
condition.
If you send a 0-length packet, but there is data is the socket buffer, and
neither the rexmt or persist timer is already set, then activate the persist
timer.

PR:			192599
Differential Revision:	D2946
Submitted by:		jlott at averesystems dot com
Reviewed by:		jhb, jch, gnn, hiren
Tested by:		jlott at averesystems dot com, jch
MFC after:		2 weeks
2015-06-29 21:23:54 +00:00
Christian Brueffer
9f026a420b Set the initial system time to a sane (as in: not end of 21st century) value when
booting on a PC with CMOS clock set to a year before 2000.

This uses 1980 (instead of 1970 as in the initial patch) as pivot year as
suggested by imp in the PR followup.

PR:		195703
Submitted by:	cs@soi.spb.ru
Reviewed by:	imp
MFC after:	1 weeks
2015-06-29 17:02:09 +00:00
Konstantin Belousov
521987c3e5 Simplify code, no need to test the flag before clearing it.
Submitted by:	ed
MFC after:	12 days
2015-06-29 13:06:24 +00:00
Konstantin Belousov
b24de3ac40 Provide npx_get_fsave(9) and npx_set_fsave(9) functions to obtain and
restore the FPU state from the format of machine FSAVE area.  The
intended use is for ABI emulators to provide FSAVE-formatted FPU state
to usermode requiring it, while kernel could use FXSAVE due to
XMM/XSAVE.

The core functionality to convert from/to FXSAVE format is shared with
the fill_fpregs_xmm() and set_fpregs_xmm().  Move the later functions
to npx.c and rename them to npx_fill_fpregs_xmm() and
npx_set_fpregs_xmm().  They differ from nptx_get/set_fsave(9) since
our mcontext contains padding to be zeroed or ignored.

fill_fpregs() and set_fpregs() could be converted to use the new
interface, but there are small differences to handle.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-06-29 12:06:36 +00:00
Konstantin Belousov
f9343dacbd Move CS_SECURE() and EFL_SECURE() macros to the machine/frame.h. They
are useful for most implementations of sendsig().

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-06-29 10:35:00 +00:00
Konstantin Belousov
2a4734651c svr4 emulator has custom sendsig() implementation, it does not use
sv_sigtbl.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-06-29 10:33:04 +00:00
Konstantin Belousov
773554f79e Remove sv_sigtbl handling from the arm64 sendsig(). There is no ABI
emulators on arm64.

Reviewed by:	andrew
Review:	https://reviews.freebsd.org/D2889
Sponsored by:	The FreeBSD Foundation
2015-06-29 10:31:12 +00:00
Konstantin Belousov
3ac3c0f269 Add a comment about too strong semantic of atomic_load_acq() on x86.
Submitted by:	bde
MFC after:	2 weeks
2015-06-29 09:58:40 +00:00
Konstantin Belousov
d9008978c8 pcb_gs32sd is unused for long time, remove it. Keep the padding in pcb.
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-06-29 07:53:44 +00:00
Konstantin Belousov
1817023775 Add x86 PT_GETFSBASE, PT_GETGSBASE machine-depended ptrace requests to
obtain the thread %fs and %gs bases.  Add x86 PT_SETFSBASE and
PT_SETGSBASE requests to set the bases from debuggers.  The set
requests, similarly to the sysarch({I386,AMD64}_SET_FSBASE),
override the corresponding segment registers.

The main purpose of the operations is to retrieve and modify the tcb
address for debuggee.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-06-29 07:07:24 +00:00
Konstantin Belousov
06d058bd23 Reduce code duplication. Add helper fill_based_sd(9) which creates a
based user data descriptor covering whole VA.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-06-29 06:59:08 +00:00
Pedro F. Giffuni
1374252397 Add a new __sentinel attribute.
The sentinel attribute was originally implemented in OpenBSD's gcc and
later adopted by upstream GCC 4.0 (and clang). From the OpenBSD's
gcc-local manpage:

-   gcc recognizes the extra attribute __sentinel__, which can be used to
    mark varargs function that need a NULL pointer to mark argument
    termination, like execl(3).  This exposes latent bugs for 64-bit
    architectures, where a terminating 0 will expand to a 32-bit int, and
    not a full-fledged 64-bits pointer.

While here sort the visibility attributes.

Hinted-by:	OpenBSD
2015-06-29 00:30:30 +00:00
Hans Petter Selasky
38b622e199 Make the system queue header file fully usable within C++ programs by
adding macros to define class lists.

This change is backwards compatible for all use within C and C++
programs. Only C++ programs will have added support to use the queue
macros within classes. Previously the queue macros could only be used
within structures.

The queue.3 manual page has been updated to describe the new
functionality and some alphabetic sorting has been done while
at it.

Differential Revision:	https://reviews.freebsd.org/D2745
PR:			200827 (exp-run)
MFC after:		2 weeks
2015-06-28 21:06:45 +00:00
Mark Murray
be1eea0753 Add const to char * pointers. This breaks nothing, and means const
chars can be passed with no warnings.
2015-06-28 12:52:28 +00:00
Mark Murray
6687b6720b Ansify another function. This is the last in the file, I hope. 2015-06-28 10:51:08 +00:00
Mark Murray
7233d3094d ANSIfy the only function that uses K&R definition in this file. 2015-06-28 09:44:58 +00:00
Konstantin Belousov
7626d062c3 Remove unneeded data dependency, currently imposed by
atomic_load_acq(9), on it source, for x86.

Right now, atomic_load_acq() on x86 is sequentially consistent with
other atomics, code ensures this by doing store/load barrier by
performing locked nop on the source.  Provide separate primitive
__storeload_barrier(), which is implemented as the locked nop done on
a cpu-private variable, and put __storeload_barrier() before load, to
keep seq_cst semantic but avoid introducing false dependency on the
no-modification of the source for its later use.

Note that seq_cst property of x86 atomic_load_acq() is not documented
and not carried by atomics implementations on other architectures,
although some kernel code relies on the behaviour.  This commit does
not intend to change this.

Reviewed by:	alc
Discussed with:	bde
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-06-28 05:04:08 +00:00
Pedro F. Giffuni
49a740381e Change detection for the gnu_inline attribute.
According to the GCC documentation:
"This attribute is available in GCC 4.1.3 and later. It is available
if either of the preprocessor macros __GNUC_GNU_INLINE__ or
__GNUC_STDC_INLINE__ are defined."

We don't keep the gcc granularity up to the minor number so it's
better to use the documented way. Current clang defines both
macros.

Reference:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
2015-06-27 15:13:14 +00:00
Bjoern A. Zeeb
de3587025a Fix compilation without INET6 and without INET and INET6 after
offload support was introduced in r284746.

While here also fix the ioctl() handler for IPv4 added in r279819,
which was never compiled in given opt_inet.h was not included.
2015-06-27 12:37:09 +00:00
Konstantin Belousov
b2c3df842b Handle errors from background write of the cylinder group blocks.
First, on the write error, bufdone() call from ffs_backgroundwrite()
panics because pbrelvp() cleared bp->b_bufobj, while brelse() would
try to re-dirty the copy of the cg buffer.  Handle this by setting
B_INVAL for the case of BIO_ERROR.

Second, we must re-dirty the real buffer containing the cylinder group
block data when background write failed.  Real cg buffer was already
marked clean in ffs_bufwrite(). After the BV_BKGRDINPROG flag is
cleared on the real cg buffer in ffs_backgroundwrite(), buffer scan
may reuse the buffer at any moment. The result is lost write, and if
the write error was only transient, we get corrupted bitmaps.

We cannot re-dirty the original cg buffer in the
ffs_backgroundwritedone(), since the context is not sleepable,
preventing us from sleeping for origbp' lock.  Add BV_BKGDERR flag
(protected by the buffer object lock), which is converted into delayed
write by brelse(), bqrelse() and buffer scan.

In collaboration with:	Conrad Meyer <cse.cem@gmail.com>
Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation (kib),
	  EMC/Isilon storage division (Conrad)
MFC after:	2 weeks
2015-06-27 09:44:14 +00:00
Yoshihiro Takahashi
5d62c861b5 MFi386: r278165
Silence a coverity warning about ignoring a return value.
2015-06-27 09:01:49 +00:00
Yoshihiro Takahashi
7d0de310ff MFi386: r284878
Reduce warnings:

   - Add prototype for boot2 main()
   - Don't make assignment within if statement, split it into two.
2015-06-27 08:49:41 +00:00
Xin LI
4b1222a215 Reduce warnings:
- Add prototype for boot2 main()
 - Don't make assignment within if statement, split it into two.

No functional or binary change -- verified with sha256(1).

MFC after:	2 weeks
2015-06-26 18:03:19 +00:00
Tycho Nightingale
ea587cd825 verify_gla() needs to account for non-zero segment base addresses.
Reviewed by:	neel
2015-06-26 18:00:29 +00:00
Kashyap D Desai
2f2163ab40 Counter part of mfi driver commit in mrsas
Switch from make_dev_alias to make_dev_alias_p since make_dev_alias_p can
gracefully fail if the /dev/megaraid_sas_ioctl_node symlink already exists.
This can happen if mfi(4) and mrsas(4) are both attached to cards and
providing Linux emulation support.  Let the first one win.  An equivalent
change has been done in mfi(4).  Extra credit would be to pass the
Linux emulation call to the other driver when appropriate.  This will
probably be a rare case and the user can manually change where the symlink
points to.

MFC after:  3 days
2015-06-26 12:00:51 +00:00
Kashyap D Desai
5b2490f890 Kernel panic may be observed by user, if MR controller is under Chip reset (OCR)
and there are some pending IOs at the time of OCR. This is mainly because of
recursive mutext in OCR and IO completion function call. Generic IO completion (from ISR) needs
sim_lock to be held before it calls completion to CAM (xpt_done), but in case of OCR path mrsas_ocr thread
itself take sim_lock, so this condition is now handled in this patch.

MFC after:  3 days
2015-06-26 11:58:42 +00:00
Andrew Turner
de50bcd56f pc_curpmap is only in the armv6 pcpu data. 2015-06-26 09:02:40 +00:00
Roger Pau Monné
7e748038cd amd64: set the correct LMA values
The current linker script generates program headers with VMA == LMA:

Entry point 0xffffffff802e7000
There are 6 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0xffffffff80200040 0xffffffff80200040
                 0x0000000000000150 0x0000000000000150  R E    8
  INTERP         0x0000000000000190 0xffffffff80200190 0xffffffff80200190
                 0x000000000000000d 0x000000000000000d  R      1
      [Requesting program interpreter: /red/herring]
  LOAD           0x0000000000000000 0xffffffff80200000 0xffffffff80200000
                 0x00000000010559b0 0x00000000010559b0  R E    200000
  LOAD           0x0000000001056000 0xffffffff81456000 0xffffffff81456000
                 0x0000000000132638 0x000000000052ecf8  RW     200000
  DYNAMIC        0x0000000001056000 0xffffffff81456000 0xffffffff81456000
                 0x00000000000000d0 0x00000000000000d0  RW     8
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RWE    8

This is fine for the FreeBSD loader, because it completely ignores p_paddr
and instead uses p_vaddr with a hardcoded offset. Other loaders however
acknowledge p_paddr (like the Xen ELF loader), in which case they will try
to load the kernel at the wrong place. Fix this by adding an AT keyword to
the first section specifying the physical address, other sections will
follow suit, so it ends up looking like:

Entry point 0xffffffff802e7000
There are 6 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0xffffffff80200040 0x0000000000200040
                 0x0000000000000150 0x0000000000000150  R E    8
  INTERP         0x0000000000000190 0xffffffff80200190 0x0000000000200190
                 0x000000000000000d 0x000000000000000d  R      1
      [Requesting program interpreter: /red/herring]
  LOAD           0x0000000000000000 0xffffffff80200000 0x0000000000200000
                 0x00000000010559b0 0x00000000010559b0  R E    200000
  LOAD           0x0000000001056000 0xffffffff81456000 0x0000000001456000
                 0x0000000000132638 0x000000000052ecf8  RW     200000
  DYNAMIC        0x0000000001056000 0xffffffff81456000 0x0000000001456000
                 0x00000000000000d0 0x00000000000000d0  RW     8
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RWE    8

Tested on bare metal using the native FreeBSD loader and grub2 from TRUEOS.

Sponsored by: Citrix Systems R&D
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D2783
2015-06-26 07:12:17 +00:00
Konstantin Belousov
1abfd35537 Split the DMAR unit domains and contexts. Domains carry address space
and related data structures.  Contexts attach requests initiators to
domains.  There is still 1:1 correspondence between contexts and
domains on the running system, since only busdma currently allocates
them, using dmar_get_ctx_for_dev().

Large part of the change is formal rename of the ctx to domain, but
patch also reworks the context allocation and free to allow for
independent domain creation.

The helper dmar_move_ctx_to_domain() is introduced for future use, to
reassign request initiator from one domain to another.  The hard issue
which is not yet resolved with the context move is proper handling (or
reserving) RMRR entries in the destination domain as required by ACPI
DMAR table for moved context.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
2015-06-26 07:01:29 +00:00
Adrian Chadd
5bbb2169d2 Un-static cpuset_which() - it's useful in other contexts, such as some
CPU set operations in my upcoming NUMA work.

Tested/compiled:

* i386 (run)
* amd64 (run)
* mips (run)
* mips64 (run)
* armv6 (built)

Sponsored by:	Norse Corp, Inc.
2015-06-26 04:14:05 +00:00
Adrian Chadd
f902ea0761 Rename seq_* to mseq_*, to avoid clashes with seq.h (namely, seq_read.) 2015-06-26 04:12:06 +00:00
Bjoern A. Zeeb
9656119da4 Another attempt to make this compile on more architectures after r284777. 2015-06-25 23:16:01 +00:00
John-Mark Gurney
afc6dc3669 If INVARIANTS is specified, add ctor/dtor to junk memory if they are
unspecified...

Submitted by:	Suresh Gumpula at Netapp
Differential Revision:	https://reviews.freebsd.org/D2725
2015-06-25 20:44:46 +00:00
Tijl Coosemans
6f071e02b8 Enable the use of __builtin_va_* for ICC.
PR:		198822
Submitted by:	Sergey Melnikov <sergey.melnikov@intel.com>
MFC after:	5 days
2015-06-25 19:39:07 +00:00
Ermal Luçi
cd2bc2ef4e Correct r284777 to use proper includes and remove dead code to unbreak kernel builds.
Differential Revision:	https://reviews.freebsd.org/D2847
2015-06-25 15:05:58 +00:00
Alexander Motin
804121f37a Remove limitations on setting WWNNs starting from 2.
It is odd that driver first tries to generate synthetic WWNN based on
WWPN starting from 2, but then refuses to use it.  If we don't trust
generated WWNN, we should probably not generate it.  Same time this
limitation prevents potentially valid WWNN setting by user.
2015-06-25 10:03:38 +00:00
Michael Gmelin
4cd6abddcd Protect smbus ioctls in ig4 driver using a shared lock.
Document locking semantics.

Differential Revision:	https://reviews.freebsd.org/D2744
Reviewed by:	jah, kib
Approved by:	kib
2015-06-25 07:52:51 +00:00
Xin LI
7d379626b1 Merge changes from vendor driver 1.1.4:
v1.1.4 2015-06-09
   * Fix a bug that FailLED was not initialized properly.
  v1.1.3 2015-05-19
   * Support Report Luns command.
  v1.1.2 2015-05-05
   * Fix a bug that report wrong physical sector size for 512e HDD.

Many thanks to HighPoint for continued support of FreeBSD!

This driver update is intended for 10.2-RELEASE.

Submitted by:	Steve Chang
MFC after:	3 days
2015-06-25 06:15:08 +00:00
Mateusz Guzik
94edbbb037 rlimit: fix a an old name in a comment: uihashtbl_mtx -> uihashtbl_lock 2015-06-25 01:24:36 +00:00
Mateusz Guzik
7150ce743a rlimit: deduplicate code in chg* functions 2015-06-25 00:15:37 +00:00
Ermal Luçi
a5b789f65a ALTQ FAIRQ discipline import from DragonFLY
Differential Revision:  https://reviews.freebsd.org/D2847
Reviewed by:    glebius, wblock(manpage)
Approved by:    gnn(mentor)
Obtained from:  pfSense
Sponsored by:   Netgate
2015-06-24 19:16:41 +00:00
Ian Lepore
bb094ed79d Fix a misplaced #endif (maybe a mismerge?). Emitting the symbol for CURPMAP
is not dependent on whether VFP (hardware floating point) is enabled.
2015-06-24 18:26:04 +00:00
Eric Joyner
1f6c33ac45 Several build changes for ix and ixv:
- Allow ix and ixv to be built seperately.
- Re-enable building ix for i386 and amd64 archs
- Fix ixv Makefile.

Approved by: jfv (mentor)
2015-06-24 15:53:52 +00:00
Sean Bruno
4e83b32a80 At the suggestion of jhb, replace atomic_set/clear calls with use of
exclusive locks in the enable/disable interpreter path.

Tested with WITNESS/INVARIANTS on and off.

Reviewed by:	sson davide
2015-06-24 15:52:26 +00:00
Ed Maste
ae1860cb89 add floatingpoint.h for arm64
On other architectures floatingpoint.h is a symlink to
machine/floatingpoint.h which in turn includes machine/ieeefp.h.
Do this on arm64 as well for now.

Sponsored by:	The FreeBSD Foundation
2015-06-24 14:51:53 +00:00
Andrew Turner
e2def8eae3 Fix the floating-point exception values to line up with the hardware
register bits. Nothing in base uses these as they are deprecated, however
third-party applications, such as perl, expect some of these functions to
exist.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-06-24 12:19:49 +00:00
Alexander Motin
5cbe3e8eee Fix reported_gone setting, missed in some cases.
This makes driver better track reported CAM_SEL_TIMEOUTs to properly
report device reappearance later.  This fixes target 0 not reappearing
after initiator mode disabled and then reenabled.

MFC after:	3 days
2015-06-24 09:06:12 +00:00
Andrew Rybchenko
29033246a8 sfxge: skip VPD info population if access is denied
The patch allows to run on unprivileged PF (PFIOV) passed to
a virtual machine.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2891
2015-06-24 06:25:20 +00:00
Wei Hu
5efed58bdd TSO and checksum offloading support for Netvsc driver on Hyper-V.
Submitted by:	whu
Reviewed by:	royger
Approved by:	royger
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D2517
2015-06-24 06:01:29 +00:00
Hans Petter Selasky
491f3ef01b Rename __weak to __weak_symbol to avoid language conflict with objective-C.
PR:		200972 (exp-run)
Suggested by:	theraven@
MFC after:	3 days
2015-06-23 22:40:22 +00:00
David C Somayajulu
35291c2247 Updated Copyright information
Added support for the following:
        - iSCSI TLV (requires 64 Tx and 32 Rx rings
        - 9K receive buffers for jumbo frames (feature may be enabled/disabled)
        - builtin firmware, bootloader and minidump template
        - quick stats
        - async event handling for SFP insertion/removal and DCBX changes
        - Configuring DCBX and interrupt coalescing parameters
2015-06-23 22:22:36 +00:00
David C Somayajulu
c197bf4fe1 tx_mtx should be grabbed before calling buf_ring_dequeue_sc()
Submitted by:Attilio.Rao@isilon.com
MFC after:5 days
2015-06-23 20:09:52 +00:00
Dimitry Andric
966ab68df1 Fix endless recursion in sys/net/if.c's drbr_inuse_drv(), found by clang
3.7.0.

Reviewed by:	marcel
2015-06-23 18:48:41 +00:00
John-Mark Gurney
1977bd233a zero this struct as it depends upon it...
Reviewed by:	mjg
Differential Revision:	https://reviews.freebsd.org/D2890
2015-06-23 18:40:20 +00:00
Xin LI
f29c86f1ed Update vendor driver to 1.2.7. This update improves driver reliability and
adds support of 4Kn drives and report LUNs command.

This driver update is intended for 10.2-RELEASE.

Many thanks to HighPoint for providing this driver update.

Submitted by:	Steve Chang
MFC after:	3 days
2015-06-23 17:26:16 +00:00
Alexander Motin
07f56f1cc9 Add dev.isp.X.role sysctl in addition to tunable.
It (mostly) allows to enable/disable initiator mode in run time.
Target mode control is blocked here to force coordination with CTL.

While there, add separate tunables/sysctls for virtual channels.
2015-06-23 16:13:20 +00:00
Dimitry Andric
71d827559b Fix r284722, by making it actually compile.
Pointy hat to:	dim
2015-06-23 06:59:46 +00:00
Colin Percival
7a70e15235 Rename mksegarray to xbd_mksegarray for consistency with other function
names in this file.

Submitted by:	royger
2015-06-23 06:50:03 +00:00
Dimitry Andric
42e2071b63 Fix endless recursion in ti(4)'s ti_ifmedia_upd(), found by clang 3.7.0. 2015-06-23 06:48:02 +00:00
Konstantin Belousov
b05c401ff6 Only take previous buffer queue lock (olock) when needed for REMFREE
in binsfree().

Submitted by:	Conrad Meyer
Sponsored by:	EMC / Isilon Storage Division
Review:	https://reviews.freebsd.org/D2882
MFC after:	1 week
2015-06-23 06:12:14 +00:00
Navdeep Parhar
dbbf46c40c cxgbe: get_fl_payload returns a header mbuf when successful.
MFC after:	3 days
2015-06-23 05:55:13 +00:00
Neel Natu
90e528f838 Restore the host's GS.base before returning from 'svm_launch()'.
Previously this was done by the caller of 'svm_launch()' after it returned.
This works fine as long as no code is executed in the interim that depends
on pcpu data.

The dtrace probe 'fbt:vmm:svm_launch:return' broke this assumption because
it calls 'dtrace_probe()' which in turn relies on pcpu data.

Reported by:	avg
MFC after:	1 week
2015-06-23 02:17:23 +00:00
Hiren Panchasara
4c3972f0af Reverting r284710.
Today I learned: iff == if and only if.

Suggested by: many
2015-06-22 22:16:06 +00:00
Hiren Panchasara
26f2eb6979 Fix a typo: s/iff/if/
Sponsored by:	    Limelight Networks
2015-06-22 21:53:55 +00:00
Sean Bruno
4abd25091d Add new UART device presented on newer AMT enabled systems/laptops.
Tested on Dell Latitude E7240.

MFC after:	2 weeks
Relnotes:	yes
2015-06-22 17:16:09 +00:00
Sean Bruno
945afa7c25 Make imgact_binmisc_exec() static.
Submitted by:	kib
Reviewed by:	sson
2015-06-22 17:04:24 +00:00
Alexander Motin
4eea8d9b41 Dump additional config bytes for INIT_FIRMWARE_MULTI_ID. 2015-06-22 08:26:28 +00:00
Alexander Motin
1c231d5a21 Add logging of executed mailbox command names.
Previously those commands were logged only as part of register dump,
that is not very readable.
2015-06-22 06:30:02 +00:00
Marcel Moolenaar
3f745144d9 Change the probe to what was intended: attach to devices with
a type 0 header and not to function 0 devices.
2015-06-22 00:34:29 +00:00
Alexander Motin
3036312050 Rewrite port database handling for target mode.
Previous implementation was too fragile to initiator parameters changes.
In case of port role change it could not survive different handle assigned
to the same initiator by firmware, even though initiator was logged out.
The new implementation should be more resillient to this kind of problems,
trying to work in any situation and only warn user about suspisious events.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2015-06-21 14:18:54 +00:00
Antoine Brodin
d2a1c16b1a Install version.4th.8 again
It was disconnected from installation in r281081, but was never removed
from the tree or added to ObsoleteFiles.inc
2015-06-21 06:56:29 +00:00
Colin Percival
ad935ed241 Garbage collect comments and a macro which related to the pre-r284296
support for a "segment block" extension in FreeBSD's Xen blkfront/blkback
drivers.

This commit should not result in any functional changes.
2015-06-21 06:52:03 +00:00
Colin Percival
c077dc26e7 Garbage collect comments which related to the pre-r284296 support for a
"segment block" extension in FreeBSD's Xen blkfront/blkback drivers.

Since this commit only affects comments, it should have no functional
effect.
2015-06-21 06:05:33 +00:00
Colin Percival
91fb36cfa8 Move the bus_dma_tag creation and per-transaction data allocation from
xbd_initialize to xbd_connect.  Both of these initialization steps need
to know what the maximum possible I/O size will be, and when we gain
support for indirect segment I/Os we won't know that value until we
reach xbd_connect.  Since none of this data is used before xbd_connect
completes, moving the initialization is harmless.

This commit should not result in any functional changes.
2015-06-21 05:36:58 +00:00
Colin Percival
0115209538 If we fail to allocate memory, pass ENOMEM as the error code, not the
"error" variable (which is always zero at this point).
2015-06-21 05:32:56 +00:00
Alan Cox
aa04413540 Avoid pmap_is_modified() on pages that can't be mapped.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-06-21 01:22:35 +00:00
David C Somayajulu
284d94cfc8 Simplified implementation of bxe_set_mc_list()
removed bxe_free_mcast_macs_list() and bxe_init_mcast_macs_list()
fixed bug where copy of multicast list mta was deleted prior to passing the list to firmware

MFC after:5 days
2015-06-20 22:24:44 +00:00
Alexander Motin
1ec1012dd2 Fix REPORT LUNS command output for the case when same LUN mapped to same
port several times.  While it is unusual configuration, it is not illegal.

MFC after:	1 week
2015-06-20 13:02:57 +00:00
Alexander Motin
7834ea8891 Bring per-port LUN enable/disable code up to date:
- remove last remnants of never implemented multiple targets support;
 - implement missing support for LUN mapping in this area.

Due to existing locking constraints LUN mapping code is practically
unlocked at this point.  Hopefully it is not racy enough to live until
somebody get idea how to call sleeping fronend methods under lock also
taken by the same frontend in non-sleepable context. :(
2015-06-20 12:43:54 +00:00
Alexander Motin
2d8b28765c Introduce separate lock for tokens to reduce ctl_lock scope. 2015-06-20 11:20:25 +00:00
Alexander Motin
754e493530 Remove some dead and duplicate LUN enabling code. 2015-06-20 07:33:06 +00:00
Dmitry Chagin
3c91646b46 Add EPOLLRDHUP support.
Tested by:	abi at abinet dot ru
2015-06-20 05:40:35 +00:00
Warner Losh
3dede9f354 Use ofw_bus_find_child_device_by_phandle to see if the child we're
adding already exists and if so just return that. The typical use case
is from identify routines, which shouldn't be adding multiple copies
of the same phandle_t to the gpiobus. Only one per phandle_t is needed
(or expected by the current code).

Differential Revision: https://reviews.freebsd.org/D2871
2015-06-20 04:48:53 +00:00
Warner Losh
bb39ff4c36 Add ofw_bus_find_child_by_phandle, a helper routine to find a device_t
child matchig a given phandle_t.

Differential Revision: https://reviews.freebsd.org/D2871
2015-06-20 04:48:48 +00:00
Marcel Moolenaar
9308005ed9 Add support for the Intel Atom E3800 series SoC (aka Bay Trail).
Sponsored by:	XipLink, Inc
2015-06-20 04:02:33 +00:00
Alexander Motin
b9807a43b0 Remove device queue freeze handling and replace it with dummy.
At this point CTL has no known use case for device queue freezes.
Same time existing (considered to be broken) code was found to cause
modify-after-free issues.

Discussed with:	ken
MFC after:	1 week
2015-06-20 03:40:19 +00:00
Colin Percival
d0ecc14d49 Refactor xbd_queue_cb, extracting the code which converts bus_dma segments
into blkif segments, and moving it into a new function.  This will be used
by upcoming support for indirect-segment blkif requests.

This commit should not result in any functional changes.
2015-06-20 00:02:03 +00:00
John-Mark Gurney
fb17b4c55c change the KASSERT so it is meaningful, var is unsigned, so even
when it wraps, it's still >= 0...

Reported by:	Coverity
CID:		1017564
2015-06-19 22:42:26 +00:00
Colin Percival
d33a1217bd Minor clean up to xbd_queue_cb:
* nsegs must be at most BLKIF_MAX_SEGMENTS_PER_REQUEST (since we specify
  that limit to bus_dma_tag_create), so KASSERT that rather than silently
  adjusting the request.
* block_segs is now a synonym for nsegs, so garbage collect that variable.
* nsegs is never read during or after the while loop, so remove the dead
  decrement from the loop.

These were all left behind from the pre-r284296 support for a "segment
block" extension.
2015-06-19 22:40:58 +00:00
Maxim Sobolev
15e862e33c Provide bug4bug workaround for certain dumbiness of the u-boot's API_env_enum
function, which is expected to set returned env to NULL upon reaching the end
of the environment list but fails to do so in certain cases. The respective
u-boot code looks like the following (HEAD at the time of this commit):

--- api.c ---
 496 static int API_env_enum(va_list ap)
 ...
 510                 *next = last;
 511
 512                 for (i = 0; env_get_char(i) != '\0'; i = n + 1) {
 513                         for (n = i; env_get_char(n) != '\0'; ++n) {
 514                                 if (n >= CONFIG_ENV_SIZE) {
 515                                         /* XXX shouldn't we set *next = NULL?? */
 516                                         return 0;
 517                                 }
 518                         }
-------------

The net result is that any unfortunate user of the loader's ub_env_enum()
function hitting this condition would be trapped in the infinite loop, as
the main use pattern of ub_env_enum() is basically the following:

while ((env = ub_env_enum(env)) != NULL) { DO STUFF }

Which would stuck forever with the last element.
2015-06-19 22:24:58 +00:00
Michael Tuexen
bb2dc69f9a Fix two KTRACE related bugs.
Reported by:	Coverity
CID:		1018058, 1018060

MFC after:	3 days
2015-06-19 21:55:12 +00:00
Andrew Gallatin
53aab9ea70 Fix typo in baudrate initialization that was causing ixl to be seen as
a 4GbE NIC, rather than a 40GbE NIC.

Reviewed by:	Eric Joyner <eric.joyner@intel.com>
MFC after:	3 days
Sponsored by:	Netflix
2015-06-19 21:40:26 +00:00
Sean Bruno
602ec83516 Remove uneeded NULL check since malloc the malloc is now M_WAITOK
Submitted by:	mjg
2015-06-19 20:35:17 +00:00
Sean Bruno
e0ae213f63 Must have one of either M_WAITOK or M_NOWAIT, read the man page bruno.
Submitted by:	mjg
2015-06-19 19:57:39 +00:00
Sean Bruno
a7647ec444 Feedback from commit r284535
davide:  imgact_binmisc_clear_entry() needs to use atomic ops to remove
the enable bit.

kib:  M_NOWAIT is not warranted and comment is invalid.
2015-06-19 18:57:36 +00:00
Simon J. Gerraty
3df2b1571b sx_sunlock for sx_slock 2015-06-19 17:34:59 +00:00
Simon J. Gerraty
c849fda850 filemon_pid_check needs to hold proctree_lock
Reviewed by:	kib
MFC after:	few days
2015-06-19 17:19:20 +00:00
Maxim Sobolev
8f207db125 Fix bug in the ubldr introduced in the rev.283035. The new code
fails to properly consider memory regions when the loader is
located below of those regions or engulfs their lower limit. This
results in "not enough RAM to load kernel" panic, which is totally
bogus. On top of that, there are some variables that can be left
unitialized in those cases, which might cause it fail with memory
access violation instead of panic while trying to load kernel to
a wrong or non-existing address of memory.

Augment the code to properly deal with the loader being below or
at the lower bound of the memory region in question. Also, don't
leave ununitialized variables behind.

Reviewed by:	ian
2015-06-19 17:00:36 +00:00
Baptiste Daroussin
27823c59c5 Fix fallouts from r284590
Reported by:	kib
2015-06-19 14:20:21 +00:00
Michael Tuexen
5de07f524d When setting the primary address, return an error whenever it fails.
MFC after: 3 days
2015-06-19 12:48:22 +00:00
Konstantin Belousov
8551285097 Restore the td_cookie value for the tmpfs directory entry which was a
dup entry, upon detach from the parent directory.  If the node is
renamed, the entry is re-attached at the different directory, and
invalud cookie value triggers assert (or corrupts directory rb tree,
it seems).

Reported by:	clusteradm (gjb, antoine)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-06-19 07:25:15 +00:00
Andriy Gapon
bc97daa07e MFV r284412: 5911 ZFS "hangs" while deleting file
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Reviewed by: Alek Pinchuk <alek@nexenta.com>
Reviewed by: Simon Klinkert <simon.klinkert@gmail.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@46e1baa6cf

https://www.illumos.org/issues/5911
Sometimes ZFS appears to hang while deleting a file. It is actually
making slow progress at the file deletion, but other operations
(administrative and writes via the data path) "hang" until the file
removal completes, which can take a long time if the file has many
blocks. The deletion (or most of it) happens in a single txg, and the
sync thread spends most of its time reading indirect blocks via this
stack trace:
	swtch+0x141()
	cv_wait+0x70()
	zio_wait+0x5b()
	dbuf_read+0x2c0()
	free_children+0x50()
	free_children+0x12a()
	free_children+0x12a()
	free_children+0x12a()
	dnode_sync_free_range_impl+0xdf()
	dnode_sync_free_range+0x52()
	range_tree_vacate+0x65()
	dnode_sync+0x1d8()
	dmu_objset_sync_dnodes+0x77()
	dmu_objset_sync+0x19f()
	dsl_dataset_sync+0x51()
	dsl_pool_sync+0x9a()
	spa_sync+0x2ff()
	txg_sync_thread+0x21f()
	thread_start+8()
One way to reproduce the problem is if we are over the arc_meta_limit,
e.g. because lots of indirect blocks are pinned because we have L0
dbufs under them.  It could be that most of the L1 indirects are cached,
in which case when dmu_free_long_range_impl() calls dmu_tx_hold_free(),
it will complete very quickly. This allows dmu_free_long_range_impl() to
put many (perhaps all of its) transactions in the same TXG. However,
dmu_free_long_range_impl() calls dnode_evict_dbufs (and
dnode_free_range()), which removes the L0 dbufs, thus reducing the hold
count on the L1 indirect blocks above it, allowing them to be evicted.
Because we are over the arc_meta_limit(), these L1 blocks will be
evicted ASAP. Thus when we get to syncing context, the L1 indirects are
no longer cached and must be read in.

Obtained from:	illumos
MFC after:	15 days
2015-06-19 06:58:05 +00:00
Hans Petter Selasky
2d45d7935b Add USB gold driver to default kernel build. 2015-06-19 06:48:55 +00:00
Andriy Gapon
ab50c99d40 illums compat: use flsl/flsll for highbit/highbit64
Do that only when when fast inline versions are available.
At the moment that can be the case only in the kernel and not for all
platforms.

The original code uses the binary search and that's kept as a fallback.
This is a micro optimization.

Differential Revision:	https://reviews.freebsd.org/D2839
Reviewed by:	delphij, mahrens, mav
MFC after:	17 days
2015-06-19 06:41:53 +00:00
Baptiste Daroussin
bda8af6860 Install loader(8) and zfsloader(8) only once
Differential Revision:	https://reviews.freebsd.org/D2841
Reviewed by:	imp
2015-06-19 05:42:24 +00:00
Adrian Chadd
3233d0c654 First cut at attempting to buffer frames until we see a beacon.
The iwn(4) firmware forgets most of its channel state after an RXON
command.  This means that any beacons its seen on passive 5GHz channels
are forgotten upon an association/authorisation request.
This unfortuantely means that 5GHz association almost always fails -
the assoc and/or auth frames are dropped with a status of "passive
channel, haven't seen a beacon yet." (0x90.)

So:

* add an xmit queue, global, to buffer frames
* modify the xmit path to use the mbuf tag from net80211
  to specify raw frame details
* buffer xmit frames from both raw and non-raw paths
* if a beacon is seen in the RX path, schedule a taskqueue to
  send said frames and un-buffer things.
* flush frames during state change back to INIT, or NIC
  down/up/detach.

This isn't the final shape I'd like this to be in but it certainly
is better than 5GHz "not working at all".

Tested:

* Intel 5100, STA mode (before spilling coffee)
* Intel 5300, STA mode (after spilling coffee)

Story:

* This has been bugging me at work for months, which I just
  worked around by throwing an ath(4) into my Lenovo T400 cardbus
  slot.

* Our ops director discovered indeed FreeBSD runs well on the
  Lenovo T420p, except for that pesky 5GHz thing.  So now developers
  also can have a T420p running FreeBSD to do work with.
  Their #1 feedback to me - "boy it'd be nice if 5GHz wifi worked."

* .. then, I was at NANOG but stuck with 5GHz only wifi and no ath(4)
  NIC to put in a laptop - and I snapped.

Thus, the reason this is actually work related.

MFC after:	2 weeks
Sponsored by:	Norse Corp, Inc.
2015-06-19 01:44:17 +00:00
Adrian Chadd
bcb23c1e09 Add in library routines not supplied by gcc-4.9 but required by the kernel.
Reviewed by:	imp
2015-06-19 01:21:10 +00:00
Rui Paulo
3bf6d93962 Synaptics: fix a problem with trackpoint passthrough.
There was a inconsistency which led to enable passthrough commands
being interpreted as actual touchpad commands.

Submitted by:	Jan Kokemüller <jan.kokemueller at gmail.com>
MFC after:	1 week
2015-06-19 00:10:30 +00:00
Jung-uk Kim
5ef5072350 Merge ACPICA 20150619. 2015-06-18 23:14:45 +00:00
Edward Tomasz Napierala
628b712826 Fix off-by-one error in fstyp(8) and geom_label(4) that made them use
a single space (" ") as a CD9660 label name when no label was present.
Similar problem was also present in msdosfs label recognition.

PR:		200828
Differential Revision:	https://reviews.freebsd.org/D2830
Reviewed by:	asomers@, emaste@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-06-18 21:55:55 +00:00
Andrey V. Elsukov
efb5228ce8 Fix possible use after free in encap[46]_input().
There is small window, when encap_detach() can free matched entry
directly after we release encapmtx. Instead of use pointer to the
matched entry, save pointers to needed variables from this entry
and use them after release mutex.

Pass argument stored in the encaptab entry to encap_fillarg(), instead
of pointer to matched entry. Also do not allocate new mbuf tag, when
argument that we plan to save in this tag is NULL.

Also make encaptab variable static.

Obtained from:	Yandex LLC
Sponsored by:	Yandex LLC
2015-06-18 18:28:38 +00:00
Oleksandr Tymoshenko
960dff03c3 Add missing driver for TDA19988 HDMI framer 2015-06-18 16:51:49 +00:00