Commit Graph

108353 Commits

Author SHA1 Message Date
Warner Losh
1e97830083 Implement -P for boot loader. It's a bit easier to implement here than
in boot1, like is normally done. When a keyboard appears in the UEFI
device tree, assume -D -h, just like on a BIOS boot.

# It is unclear if an ACPI keyboard appearing in the tree means there's
# a real keyboard or not. A USB keyboard doesn't seem to appear unless
# it is really there.

Differential Revision: https://reviews.freebsd.org/D5223
2016-02-08 19:34:17 +00:00
Ed Maste
afae3eed15 Restore kgzldr on i386 only
I previously disconnected kgzdr based on a misunderstanding.

I'd still like to transition to supporting only the loader(8)-based
boot path for handling compressed kernels, but that can follow the
standard deprecation procedure.

This reverts r291113.

Requested by:	dteske
2016-02-08 16:59:52 +00:00
Konstantin Belousov
2dab579bfc Remove the assert which outlived its usefulness, and, by default,
disable compilation of the code which made it possible to call
stop_all_proc() from usermode at all.

Move the comment to the preamble of stop_all_proc() and reword it to
give overview of the function intent.

proc0 has P_HADTHREADS flag set due to kthread_add(), but no
P_KTHREAD, which triggered the assert, which does not serve a purpose
now.

Reported by:	Oliver Pinter
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-02-08 10:54:27 +00:00
Jilles Tjoelker
f00fb5457e semget(): Check for [EEXIST] error first.
Although POSIX literally permits failing with [EINVAL] if IPC_CREAT and
IPC_EXCL were both passed, the semaphore set already exists and has fewer
semaphores than nsems, this does not allow an application to retry safely:
if the [EINVAL] is actually because of the semmsl limit, an infinite loop
would result.

PR:		206927
2016-02-07 22:12:39 +00:00
Pedro F. Giffuni
7559912039 Minor grammar fix in comment. 2016-02-07 16:18:12 +00:00
Pedro F. Giffuni
9da20ec3a0 Revert r295359:
CID 1018688 is a false positive.

The initialization is done by calling vn_start_write(... &mp, flags).
mp is only an output parameter unless (flags & V_MNTREF), and fdesc
doesn't put V_MNTREF in flags.

Pointed out by:	bde
2016-02-07 15:40:01 +00:00
Pedro F. Giffuni
db7e4ae81a msdosfs_rename: yet another unused value.
As with r295355, it seems to be left over from a cleanup
in r33548. The code is not in NetBSD either.

Thanks to bde for checking out the history.
2016-02-07 15:36:16 +00:00
Pedro F. Giffuni
062b0cc0e6 cd9660: Drop an unnecessary check for NULL.
This was unnecessary and also confused Coverity.

Confirmed on:	NetBSD
CID:		978558
2016-02-07 03:48:40 +00:00
Pedro F. Giffuni
0ae08af46a fdesc_setattr: unitialized pointer read
CID:	1018688
2016-02-07 01:09:38 +00:00
Kirk McKusick
b00b459084 Clarify a comment in kern_openat() about the use of falloc_noinstall().
Suggested by: Steve Jacobson
2016-02-07 01:04:47 +00:00
Allan Jude
9cdff681a4 Do not set vfs.root.mountfrom unnecessarily
This causes boot from external media (installer USB image) to mount / from
the default ZFS BE, rather than the USB device.

Reported by:	kmoore
MFC after:	5 days
Sponsored by:	ScaleEngine Inc.
2016-02-07 00:49:15 +00:00
Steven Hartland
5c25653daf Fix EFI platform build failures
With warnings now enabled some plaforms where failing due to warnings.
* Fix st_size printed as a size_t when its actually an off_t.
* Fix pointer conversion in load_elf for some 32bit platforms due to 64bit
  off in ef.

MFC after:	2 days
X-MFC-With:
Sponsored by:	Multiplay
2016-02-06 22:01:25 +00:00
Pedro F. Giffuni
2799a46fdf msdosfs_rename: Unused value
Assigned value to pmp, is immediatedly overwritten before it can be used.

CID:	1304892
2016-02-06 21:54:02 +00:00
Konstantin Belousov
0fb2c5d60c Do not call vn_fullpath(9) (through the pmc_getfilename() wrapper)
when its result is immediately ignored, i.e. for kernel processes
forked from the user process.  Do not test for non-null before freeing
string.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-02-06 15:39:04 +00:00
Michal Meloun
7a308c64b4 ARM: Rename remaining ARMv4 specific function in DTrace code.
I missed it in r295319.

Pointed by: tuexen
2016-02-06 11:16:15 +00:00
Mateusz Guzik
0c829a301d fork: ansify sys_pdfork
No functional changes.
2016-02-06 09:01:03 +00:00
John Baldwin
5652770d8f Rename aiocblist to kaiocb and use consistent variable names.
Typically <foo>list is used for a structure that holds a list head in
FreeBSD, not for members of a list.  As such, rename 'struct aiocblist'
to 'struct kaiocb' (the kernel version of 'struct aiocb').

While here, use more consistent variable names for AIO control blocks:

- Use 'job' instead of 'aiocbe', 'cb', 'cbe', or 'iocb' for kernel job
  objects.
- Use 'jobn' instead of 'cbn' for use with TAILQ_FOREACH_SAFE().
- Use 'sjob' and 'sjobn' instead of 'scb' and 'scbn' for fsync jobs.
- Use 'ujob' instead of 'aiocbp', 'job', 'uaiocb', or 'uuaiocb' to hold
  a user pointer to a 'struct aiocb'.
- Use 'ujobp' instead of 'aiocbp' for a user pointer to a 'struct aiocb *'.

Reviewed by:	kib
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D5125
2016-02-05 20:38:09 +00:00
Mark Johnston
3f38e13073 Plug a vm_page leak introduced in r292373.
Reported by:	vangyzen
2016-02-05 19:35:53 +00:00
Eric Joyner
c80429cedb Update em(4) to 7.6.1; update igb(4) to 2.5.3.
Major changes:

- Add i219/i219(2) hardware support. (Found on Skylake generation and newer
  chipsets.)
  - Further to the last Skylake support diff, this one also includes support for
    the Lewisburg chipset (i219(3)).

- Add a workaround to an igb hardware errata.
  All 1G server products need to have IPv6 extension header parsing turned off.
  This should be listed in the specification updates for current 1G server
  products, e.g. for i350 it's errata #37 in this document:
  http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/ethernet-controller-i350-spec-update.pdf

- Avoton (i354) PHY errata workaround added

And a bunch of minor fixes, as well as #defines for things that the current
em(4)/igb(4) drivers don't implement.

Differential Revision: https://reviews.freebsd.org/D3162
Reviewed by: sbruno, marius, gnn
Approved by: gnn
MFC after: 2 weeks
Sponsored by: Intel Corporation
2016-02-05 17:14:37 +00:00
Andrew Turner
55beb2a538 Implement kdb_cpu_sync_icache on arm64.
Sponsored by:	ABT Systems Ltd
2016-02-05 15:38:28 +00:00
Steven Hartland
89b50f6b4d Fix EFI multi device boot support
Fix EFI boot support when presented with multiple valid boot partitions
across multiple devices.

It now prefers to boot from partitions that are present on the underlying
device that the boot1 image was loaded from. This means that it will boot
from the partitions on device the user chose from EFI boot menu in
preference to those on other devices.

Also fixed is the recovery from a failed attempt to boot, from a seemingly
valid partition, by continuing to trying all other available partitions
no matter what the error.

boot1 now use * to signify a partition what was accepted from the preferred
device and + otherwise.

Finally some error messages where improved and DPRINTF's with slowed boot
to aid debugging.

ZFS will still be preferred over UFS when both are available on the boot
device.

Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5108
2016-02-05 15:35:33 +00:00
Michal Meloun
a89156f53f ARM: Use new ARMv6 naming conventions for cache and TLB functions
in all but ARMv4 specific files.
Expand ARMv6 compatibility stubs in cpu-v4.h. Use physical address
in L2 cache functions if ARM_L2_PIPT is defined.
2016-02-05 14:57:41 +00:00
Svatopluk Kraus
3af1c2aae2 Follow up r295257 and replace bad reference to TEX in defines,
variables and functions. This stuff is named properly now.

Thus, the VM_MEMATTR_xxx is an index to PTE2 attribute table.

Pointy hat to:	skra
2016-02-05 11:28:35 +00:00
Svatopluk Kraus
a901e7b637 Follow up r295257 and convert also pt_memattr. This did not break
anything as both VM_MEMATTR_WB_WA and PTE2_ATTR_WB_WA are zero.
Correct also type of pmap_dcache_wb_pou() last argument.
2016-02-05 10:40:01 +00:00
Michal Meloun
3025d19dfc ARM: Introduce new cpu-v4.h header and move all ARMv4 specific code
from cpu-v6.h to it.
Remove unneeded cpu-v6.h includes.
2016-02-05 09:46:24 +00:00
Sepherosa Ziehau
3fd8cd9ce4 hyperv: Use malloc for page allocation.
We will eventually convert them to use busdma.

Submitted by:	Jun Su <junsu microsoft com>
Reviewed by:	adrian, sephe, Dexuan Cui <decui microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5087
2016-02-05 07:29:11 +00:00
Sepherosa Ziehau
27cc90ebb1 hyperv: Use WAITOK in the places where we can wait
And convert rndis non-hot path spinlock to mutex.

Submitted by:	Jun Su <junsu microsoft com>
Reviewed by:	adrian, sephe
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5081
2016-02-05 07:20:31 +00:00
Sepherosa Ziehau
f11ef33f0d hyperv: Use standard taskqueue instead of hv_work_queue
HyperV code was ported from Linux.  There is an implementation of
work queue called hv_work_queue.  In FreeBSD, taskqueue could be
used for the same purpose.  Convert all the consumer of hv_work_queue
to use taskqueue, and remove work queue implementation.

Submitted by:	Jun Su <junsu microsoft com>
Reviewed by:	adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4963
2016-02-05 07:09:58 +00:00
Sepherosa Ziehau
a7f84cedee hyperv/hn: Add an option to always do transmission scheduling
It is off by default. This eases more experiment on hn(4).

Reviewed by:	adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5175
2016-02-05 05:50:53 +00:00
Sepherosa Ziehau
62c328f0c4 hyperv/hn: Move LRO flush to the channel processing rollup
This significantly increases LRO aggregation ratio when there are
large amount of connections (improves reception performance a lot).

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5167
2016-02-05 05:44:31 +00:00
Sepherosa Ziehau
e35e485b04 hyperv/hn: Increase LRO entry count to 128 by default
hn(4) only has one RX ring currently, so default 8 LRO entries
are too small.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5166
2016-02-05 05:38:01 +00:00
Sepherosa Ziehau
1e4bb37d22 hyperv/hn: Recover half of the chimney sending space
We lost half of the chimney sending space, because we mis-used
ffs() on a 64 bits mask, where ffsl() should be used.

While I'm here:
- Use system atomic operation instead.
- Stringent chimney sending index assertion.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5159
2016-02-05 05:31:31 +00:00
Sepherosa Ziehau
b256e94549 hyperv/hn: Factor out hn_encap() from hn_start_locked()
It will be shared w/ upcoming ifnet.if_transmit implementaion.

No functional changes.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5158
2016-02-05 05:25:11 +00:00
Sepherosa Ziehau
58d6fc930e hyperv/hn: Obey IFCAP_RXCSUM configure
Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5104
2016-02-05 05:17:48 +00:00
Sepherosa Ziehau
b8109bd09e hyperv/hn: Add sysctls to trust host side UDP and IP csum verification
Reviewed by:	adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5103
2016-02-05 05:12:30 +00:00
Sepherosa Ziehau
51ae346f9d hyperv/hn: Enable UDP RXCSUM
Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5102
2016-02-05 05:06:14 +00:00
Sepherosa Ziehau
b0fde7e820 hyperv/hn: Enable IP header checksum offloading
So that:
- TCP/IP stack will not do unnecessary IP header checksum for TSO
  packets.
- Reduce guest load for non-TSO IP packets.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5099
2016-02-05 05:01:02 +00:00
Sepherosa Ziehau
74506a55d6 hyperv/hn: Reorganize TX csum offloading
- For non-TSO offloading, we don't need to access mbuf to know
  which csum offloading is requested, we can just use the
  CSUM_{IP,TCP,UDP} in the csum_flags.
- For TSO offloading, we still can depend on CSUM_{TSO4,TSO6}
  in the csum_flags to tell whether the TSO packet is an IPv4
  TSO packet or an IPv6 TSO packet.

This streamlines csum offloading handling (remove the two goto)
and allows us the nuke the unnecessary get_transport_proto_type().

Reviewed by:	adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5098
2016-02-05 04:10:04 +00:00
Sepherosa Ziehau
82db5a8905 hyperv/hn: Avoid duplicate csum features settings
- Record csum features in softc, so we don't need to duplicate the
  logic from attach path to ioctl path.
- Protect if_capenable and if_hwassist changes by main lock.
- Prefer turn on/off bits in if_hwassist explicitly instead of using
  XOR.

Reviewed by:	adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5085
2016-02-05 04:03:50 +00:00
Sepherosa Ziehau
f70c7ffe5e hyperv/stor: Fix the NULL pointer dereference
Reported by:	Netapp
Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Reviewed by:	adrian, sephe, Dexuan Cui <decui microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5097
2016-02-05 03:46:53 +00:00
Scott Long
ee5c196b0a Add sysctls for dumping out the device mapping tables. I'm finding this
useful for debugging device-target translation bugs.

MFC after:	3 days
Sponsored by:	Netflix
2016-02-04 23:38:55 +00:00
Adrian Chadd
3f84dfc1cd Provide a workaround for setting the correct endianness when doing CFI on
a mips big-endian board.

This is (hopefully! ish!) a temporary change until a slightly better way
can be found to express this without a config option.

Tested:

* BUFFALO WZR-HP-G300NH 1stGen (by submitter)

Submitted by:	Mori Hiroki <yamori813@yahoo.co.jp>
2016-02-04 22:39:27 +00:00
Konstantin Belousov
af582aaed1 When matching brand to the ELF binary by notes, try to find a brand
with interpreter name exactly matching one wanted by the binary.  If
no such brand exists, return first brand which accepted the binary by
note.

The change fixes a regression after r292749, where e.g. our two ia32
compat brands, ia32_brand_info and ia32_brand_oinfo, only differ by
the interpeter path and binary matches to a brand by linkage order.
Then old binaries which require /usr/libexec/ld-elf.so.1 but matched
against ia32_brand_info with interp_path /libexec/ld-elf.so.1, were
considered requiring non-standard interpreter name, and magic to force
ld-elf32.so.1 did not happen.

Note that it might make sense to apply the same selection of brands
for other matching criteria, SCO EI_OSABI and 3.x string.

Reported and tested by:	dwmalone
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2016-02-04 20:55:49 +00:00
Ravi Pokala
dd4637c078 Add defines for WRITE_UNCORRECTABLE ATA command, and improve command logging
Add #defines for ATA_WRITE_UNCORRECTABLE48 and its features. Update the
decoding in ATACAM to recognize the new values. Also improve command
decoding for a few other commands (SMART, NOP, SET_FEATURES). Bring the
decoding in ata(4) up to parity with ATACAM.

Reviewed by:	mav, imp
MFC after:	1 month
Sponsored by:	Panasas, Inc.
Differential Revision:	https://reviews.freebsd.org/D5181
2016-02-04 19:53:54 +00:00
Michael Tuexen
2602455cc2 In FreeBSD 10 and higher the driver announces SCTP checksum offloading support
also for 82598, which doesn't support it.
The legacy code has a check for it, which was missed when the code for dealing with
CSUM_IP6_* was added. Add the same check for FreeBSD 10 and higher.

Differential Revision:	https://reviews.freebsd.org/D5192
2016-02-04 18:08:50 +00:00
John Baldwin
aa59d767c7 Fix build of powerpc FPU emulator after changes in r295132 to restore the
ABI of struct fpreg.  The FPU emulator operates on the "raw" FPU state
stored in the pcb rather than the "cooked" fpreg state used for ptrace()
and cores.

Reported by:	bz
2016-02-04 17:43:56 +00:00
Andrew Turner
f13ec4b40e Enable checking of the stack alignment. The stack should be aligned to a
16-byte value. With this the hardware will check if a memory access uses
an incorrectly aligned stack pointer as the base address.

Sponsored by:	ABT Systems Ltd
2016-02-04 17:22:15 +00:00
Michal Meloun
49475a5b47 Replace broken implementation of fuswintr() and suswintr() by functions
which return -1 as well as on tier 1 archs. Remove block_userspace_access
used only in these implementations.

(1) These functions may be called in interrupt context and pcb_onfault
can be already set in this time. Thus, prior pcb_onfault must be saved
and restored afterwards.

(2) The check that an abort came either from nested interrupt or while
in critical section or holding not sleepable lock must be avoided for
this case.

These functions are called only for profiling reason, so there will be
only small gain by making the code more complex.
2016-02-04 17:01:38 +00:00
Konstantin Belousov
76c404fce5 Do not copy by field when converting struct oexport_args to struct
export_args on mount update, bzero() is consistent with
vfs_oexport_conv().
Make the code structure more explicit by using switch.
Return EINVAL if export option layout (deduced from size) is unknown.

Based on the submission by:	bde
Sponsored by:	The FreeBSD Foundation
2016-02-04 16:32:21 +00:00
Michal Meloun
dfa0f9c66a ARM: For ARMv6/v7, code in locore.S initializes SCTLR and ACTRL registers.
Don't duplicate this initialization in cpu_setup().
2016-02-04 14:32:48 +00:00