Commit Graph

209842 Commits

Author SHA1 Message Date
Pedro F. Giffuni
6a2a9844b0 freopen(3): prevent uninitialized errno.
Revert r297407 and redo it cleanly.

Pointed out by:	Jukka A. Ukkonen
CID:		1018720
MFC after:	1 week
2016-03-30 06:13:58 +00:00
Pedro F. Giffuni
36226c47ef freopen(3): prevent uninitialized errno.
The case doesn't look very likely but clean the possibility nevertheless

CID:		1018720
MFC after:	1 week
2016-03-30 01:32:08 +00:00
Navdeep Parhar
0ff41bb737 Remove unnecessary dequeue_mutex (added in r294610) from the iWARP
connection manager.  Examining so_comp without synchronization with
iw_so_event_handler is a harmless race.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
Reviewed by:	Steve Wise @ Open Grid Computing
Sponsored by:	Chelsio Communications
2016-03-30 01:08:08 +00:00
Adrian Chadd
b8e29e065d [net80211] migrate the time_* macros to ieee80211_* namespace.
It turns out that these will clash very annoyingly with the linux
macros in the linuxkpi layer, so let the wookie^Wlinux win.

The only user that I can find is ath(4), so fix it there too.
2016-03-30 00:44:10 +00:00
Adrian Chadd
275b79bd9b [net80211] Add fields to decode uAPSD fields.
It turns out that madwifi actually has the basics for uAPSD implemented
but it was never ported to FreeBSD.  I may eventually port most of the
pieces; I'll see how it goes!

Obtained from:	Madwifi
2016-03-30 00:42:18 +00:00
Mark Johnston
47d2d39111 Fix the lladdr copy in in6_lltable_dump_entry() after r292978.
This bug caused "ndp -a" to show the wrong link layer address for neighbour
cache entries.

PR:	208067
2016-03-30 00:03:59 +00:00
Pedro F. Giffuni
9c2ceeafd5 Small typo. 2016-03-29 23:33:44 +00:00
Konstantin Belousov
cc4916adf2 Do not access buffer if bread(9) or cluster_read(9) failed. On error,
the functions free the buffer and set the pointer to NULL.  Also
remove useless call to brelse(9) on the error path.

PR:	208275
Submitted by:	Fabian Keil <fk@fabiankeil.de>
MFC after:	2 weeks
2016-03-29 19:59:44 +00:00
Gleb Smirnoff
9c64cfe56c The sendfile(2) allows to send extra data from userspace before the file
data (headers).  Historically the size of the headers was not checked
against the socket buffer space.  Application could easily overcommit the
socket buffer space.

With the new sendfile (r293439) the problem remained, but a KASSERT was
inserted that checked that amount of data written to the socket matches
its space.  In case when size of headers is bigger that socket space,
KASSERT fires.  Without INVARIANTS the new sendfile won't panic, but
would report incorrect amount of bytes sent.

o With this change, the headers copyin is moved down into the cycle, after
  the sbspace() check.  The uio size is trimmed by socket space there,
  which fixes the overcommit problem and its consequences.
o The compatibility handling for FreeBSD 4 sendfile headers API is pushed
  up the stack to syscall wrappers.  This required a copy and paste of the
  code, but in turn this allowed to remove extra stack carried parameter
  from fo_sendfile_t, and embrace entire compat code into #ifdef.  If in
  future we got more fo_sendfile_t function, the copy and paste level would
  even reduce.

Reviewed by:	emax, gallatin, Maxim Dounin <mdounin mdounin.ru>
Tested by:	Vitalij Satanivskij <satan ukr.net>
Sponsored by:	Netflix
2016-03-29 19:57:11 +00:00
Konstantin Belousov
0df87548b9 Type of the interrupt handlers on x86 cannot be expressed in C.
Simplify and unify placeholder type definitions.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D5771
2016-03-29 19:56:48 +00:00
Konstantin Belousov
d317106ce2 Fix several bugs in r297374:
- fix UP build [1]
- do not obliterate initial reading of rdtsc by the loop counter [2]
- restore the meaning of the argument -1 to native_lapic_ipi_wait()
  as wait until LAPIC acknowledge without timeout
- correct formula for calculating loop iteration count for 1us, it was
  inverted, and ensure that even on unlikely slow CPUs at least one
  check for ack is performed.

Reported by:	Michael Butler <imb@protected-networks.net> [1], rpokala[2],
	jhb[3]
Tested by:	Michael Butler
Pointy hat to:	kib
Sponsored by:	The FreeBSD Foundation
2016-03-29 19:54:13 +00:00
Mark Johnston
435bece4c5 Modify nd6_llinfo_timer() to acquire the nd6 lock before the LLE lock.
When expiring a neighbour cache entry we may need to look up the associated
default router, which requires the nd6 read lock. To avoid an LOR, the nd6
lock should be acquired first.

X-MFC-With:	r296063
Tested by:	Larry Rosenman <ler@lerctr.org> (previous revision)
2016-03-29 19:23:00 +00:00
Alexander Motin
86b0daa373 Modify "4958 zdb trips assert on pools with ashift >= 0xe".
Unlike Illumos FreeBSD has concept of logical ashift, that specifies
really minimal vdev block size that can be accessed.  This knowledge
allows properly pad physical I/O and correctly assert its alignment.

This change fixes L2ARC write errors when device has logical sector
size above 512 bytes.

MFC after:	1 month
2016-03-29 19:18:34 +00:00
Luiz Otavio O Souza
cb18f3f308 Add the SPI driver for am335x.
This driver works in PIO mode for now, interrupts are available only when
FIFO is enabled.  The FIFO cannot be used with arbitrary sizes which defeat
its general use.

At some point we can add DMA transfers where the FIFO can be more useful.

Tested on uBMC (microBMC) and BBB.

Sponsored by:	Rubicon Communications (Netgate)
2016-03-29 19:11:04 +00:00
Bryan Drewery
a23b48fee5 Reword descriptions of asserting locks held without WITNESS.
This corrects an error in r296947 in that it is not possible to assert
which thread holds a shared (or read) lock, but it is possible to assert
that one is held.  Just not very useful.

MFC after:	1 week
Submitted by:	wblock, jhb
Reviewed by:	kib (earlier version), jhb, wblock
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D5659
2016-03-29 16:07:51 +00:00
Bryan Drewery
2dfe93f0ab Use proper kern.opts.mk rather than src.opts.mk from r297058.
Reported by:	kib
Sponsored by:	EMC / Isilon Storage Division
2016-03-29 15:26:53 +00:00
Zbigniew Bodek
c43a86743c Reduce OFW PCI code duplication - involves ARM, PPC and SPARC64
Import portions of the PowerPC OF PCI implementation into new file
"ofwpci.c", common for other platforms. The files ofw_pci.c and ofw_pci.h
from sys/powerpc/ofw no longer exist. All required declarations are moved
to sys/dev/ofw/ofwpci.h. This creates a new ofw_pci_write_ivar() function
and modifies some others methods. Most functions contain existing ppc
implementations in the majority unchanged. Now there is no need to have
multiple identical copies of methods for various architectures.

Requested by:  jhibbits
Reviewed by:   jhibbits, marius
Submitted by:  Marcin Mazurek <mma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Annapurna Labs
Differential Revision: https://reviews.freebsd.org/D4879
2016-03-29 15:19:56 +00:00
Edward Tomasz Napierala
35030a5dd4 Remove some NULL checks for M_WAITOK allocations.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-03-29 13:56:59 +00:00
Andrew Turner
6c5b1ed4b6 Read the CPU ID for the current CPU from the GIC. The GIC may have a
different ID space than the kernel. Because of this we need to read the
ID from the hardware. The hardware will provide this value to the CPU by
reading any of the first 8 Interrupt Processor Targets Registers.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5706
2016-03-29 13:51:26 +00:00
Zbigniew Bodek
c890792330 Improve HW checksums support in VNIC
- Do not mark CSUM_IP_CHECKED and CSUM_IP_VALID on IPv6 packets.
  IPv6 does not have checksums by definition.
- Set SCTP packets csum_flags CSUM_SCTP_VALID instead of
  CSUM_DATA_VALID and skip csum_data
- Set csum_data simply as 0xffff without byteswap

Pointed out by: yongari
Reviewed by:    yongari, wma
Obtained from:  Semihalf
Sponsored by:   Cavium
Differential Revision: https://reviews.freebsd.org/D5537
2016-03-29 13:31:09 +00:00
Zbigniew Bodek
d6d108caa1 Don't manage free SQ entry index by the atomic operations
It is not necessary as entries are being manipulated under lock.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5536
2016-03-29 13:28:13 +00:00
Alexander Motin
15e01a35e1 Add some device IDs found on AMD FCH shipsets.
MFC after:	2 weeks
2016-03-29 12:50:42 +00:00
Alexander Motin
bc8b0193a6 Add support for AMD FCH watchdog timers.
MFC after:	2 weeks
2016-03-29 12:19:46 +00:00
Edward Tomasz Napierala
43a623c82f Add phttpget(8) .Xr to fetch(1).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-03-29 11:56:00 +00:00
Hans Petter Selasky
288edd19d7 Verify that all segments in the loaded segment list are back to back
with regard to the page offset, and not only the two first ones.
2016-03-29 10:47:14 +00:00
Konstantin Belousov
998e1ef11f Calibrate the frequency of the of the native_lapic_ipi_wait() loop,
and avoid a delay while waiting for IPI delivery acknowledgement in
xAPIC mode.  This makes the loop exit immediately after the delivery
bit in APIC_ICR register is set, instead of waiting for some
microseconds.

We only need to ensure that some amount of time is allowed for the
LAPIC to react to the command, and we need that the wait time is
finite and reasonable.  For that reasons, it is irrelevant if the CPU
frequency or throttling decrease the speed and make the loop,
calibrated for full CPU speed at boot time, execute somewhat slower.

Discussed with:	bde, jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
2016-03-29 08:44:56 +00:00
Konstantin Belousov
d58c003a8a Use ANSI function definition.
Sponsored by:	The FreeBSD Foundation
2016-03-29 08:31:34 +00:00
Jean-Sébastien Pédron
eae90da9b0 CAM: Generalize 4k quirk to all Samsung MZ7* SSDs
This adds Samsung PM851 to the list. It can be found in Lenovo Thinkpad
T440 for instance.

Reviewed by:	Kevin Bowling <kevin.bowling@kev009.com>,
		Jason Wolfe <j@nitrology.com>
Approved by:	Kevin Bowling <kevin.bowling@kev009.com>,
		Jason Wolfe <j@nitrology.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D5753
2016-03-29 06:56:46 +00:00
Navdeep Parhar
c0da2d161e krping wasn't designed to take more than one client. Fail any connect
requests if cb->state is not IDLE.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
Reviewed by:	Steve Wise @ Open Grid Computing
Sponsored by:	Chelsio Communications
2016-03-29 01:41:07 +00:00
Navdeep Parhar
79bb86ac2e cxgbe/iw_cxgbe: Fix for stray "start_ep_timer timer already started!"
messages.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
2016-03-29 00:10:47 +00:00
Jamie Gritton
859f4d0611 Move the various per-type arrays of OSD data into a single structure array. 2016-03-28 22:18:37 +00:00
John Baldwin
dd52390836 Don't start the random harvester process until timers are working.
This is a no-op currently, but in kernels with earlier AP startup, the
random kthread was trying to use timeouts with sleeps before timers are
working.  Wait until SI_SUB_KICK_SCHEDULER to start the random kproc.

Reviewed by:	delphij, imp, markm
Approved by:	so
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D5712
2016-03-28 21:51:56 +00:00
Warner Losh
cb49b65481 Move pccard_safe_quote() up to subr_bus.c and rename to
devctl_safe_quote() so it can be used more generally.
2016-03-28 20:16:29 +00:00
Warren Block
c8edf4bc2a Fix two more unhappy instances of "user land".
Submitted by:	bdrewery
MFC after:	1 week
2016-03-28 19:55:30 +00:00
Ed Maste
915d57ae35 simplify compile-time default keyboard map generation
In r296926 the -P <path> option was added to kbdcontrol, which enables
this change for a simplified compile-time default keymap build process.

PR:		193865
Reviewed by:	Oliver Pinter
Tested by:	Oliver Pinter
MFC After:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5708
2016-03-28 19:51:45 +00:00
Michael Tuexen
a08b29253d Don't allow the user to set a peer primary which is restricted
and not pending.

MFC after: 1 week
2016-03-28 19:32:13 +00:00
Michael Tuexen
76f8482a93 Restrict local addresses until they are acked by the peer.
MFC after: 1 week
2016-03-28 19:31:10 +00:00
Jilles Tjoelker
f30e8c7e71 sh: Fix use-after-free if a trap replaces itself.
MFC after:	1 week
2016-03-28 18:58:40 +00:00
John Baldwin
ad3ecc2025 Fix parsing of a 1GB page table entry.
Use 'pdpe' to extract the PA of the 1GB page instead of 'pde' (which was
a copy and paste bug from the 2MB page case further down).

CID:		1341467
Reported by:	pfg
2016-03-28 18:41:48 +00:00
George V. Neville-Neil
cd4a821c2f Add ethertype reserved for network testing
MFC after:	2 weeks
2016-03-28 18:25:54 +00:00
Warren Block
4a734567e7 Replace "user land", which, for any definition of the word "user",
sounds like some kind of horrific theme park.  "Hey kids, want to go to
User Land?"  "No!  We'll be good!"

The obvious replacement is "userland", a compound word replete with
term-of-art meaning and just a hint of cautionary tale.  The alternate
terms "flugelhorn" and "bullfrog", while also good, are less well-known
and were voted down in committee.

MFC after:	1 week
2016-03-28 17:42:14 +00:00
Warner Losh
b1101485df Support simple soft floating point abi for CPUTYPE in arm. Complex
types to follow.
2016-03-28 17:32:31 +00:00
Edward Tomasz Napierala
225636dccb Fix bunch of .Xrs.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-03-28 16:48:28 +00:00
Konstantin Belousov
841d5e0151 Do not load LAPIC_DCR_TIMER with an undefined value. If we are in the
deadline mode the divide configuration is not used and
lapic_timer_divisor is not set.

Reported by:	dhw, mav
Tested by:	mav
Sponsored by:	The FreeBSD Foundation
2016-03-28 15:05:00 +00:00
Jared McNeill
7a8917b25d Pass clkdev_if methods through to parent device by default.
Reviewed by:		mmel, adrian (mentor)
Approved by:		adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5750
2016-03-28 11:51:35 +00:00
Michael Tuexen
5114dccbd4 Trigger sending of queued ASCONF chunks if outstanding ones are ACKED.
MFC after:	1 week
2016-03-28 11:32:20 +00:00
Konstantin Belousov
ecabd74728 Use TSC deadline mode for LAPIC timer, when available. The mode fires
LAPIC timer iinterrupt when TSC reaches the value written to the
IA32_TSC_DEADLINE MSR.  To arm or reset the timer in deadline mode, a
single non-serializing MSR write is enough.  This is an advance from
the one-shot mode of LAPIC, where timer operated with the FSB
frequency and required two (serialized in case of xAPIC) writes to the
APIC registers.

The LVT_TIMER register value is cached to avoid unneeded writes in the
deadline mode.  Unused arguments to specify period (which is passed in
struct lapic as la_timer_period) and interrupt enable (which is always
enabled) are removed from lapic_timer_{oneshot,periodic,deadline}
functions.  Instead, special lapic_timer_oneshot_nointr() function for
interrupt-less one-shot calibration is added.

Reviewed by:	mav (previous version)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D5738
2016-03-28 09:52:44 +00:00
Konstantin Belousov
7c4e76935e Add defines for the LAPIC TSC deadline timer mode. The LVT timer mode
field is two-bit, extend the mask.

Also add comments about all MSRs writes to which are not serializing.

Sponsored by:	The FreeBSD Foundation
2016-03-28 09:43:40 +00:00
Alexander Motin
78b127f2fc Pass through error code from make_dev_p().
ENAMETOOLONG is much more informative in logs then ENXIO.

MFC after:	1 week
2016-03-28 08:12:29 +00:00
Kevin Lo
98a768596e Update superblock and inode structs for ext4.
Reviewed by:	pfg
2016-03-28 07:44:55 +00:00