Commit Graph

211382 Commits

Author SHA1 Message Date
Andriy Gapon
f9ac50ac45 fix missing variable in r298736
Pointyhat to:	avg
Reported by:	Ivan Klymenko <fidaj@ukr.net>
MFC after:	2 weeks
X-MFC with:	r298736
2016-04-28 09:40:24 +00:00
Andriy Gapon
e5e4452078 ensure that initial local apic id is sane on AMD 10h systems
Summary:
The Initial Local APIC ID is returned by CPUID function 1 (in EBX).
On AMD Family 10h systems the way that ID is built is controlled by
an MSR bit (InitApicIdCpuIdLo).  BKDG instructs BIOS to set it in a
certain way, but a BIOS can be buggy.  In that case the ID can confuse
tools that use it, e.g. hwloc.
For example, on a system that I own real Local APIC IDs are configured
as 0, 1, 2, 3, but IDs reported via CPUID.1 are 0, 0x40, 0x80, 0xc0.
See: https://github.com/open-mpi/hwloc/issues/183

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D6060
2016-04-28 08:29:57 +00:00
Andrew Rybchenko
341134426f sfxge(4): do not use RxQ index as label
Labels are limitted by 32 on EF10. It is not sufficient on powerful hosts.
Since only one RxQ is running over each EvQ, zero label may be used.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
PR:             208267
Differential Revision:  https://reviews.freebsd.org/D6121
2016-04-28 06:20:43 +00:00
Pedro F. Giffuni
5fe2c518bd ndis(4): it's rather unrealistic to expect a size_t here.
int was actually OK, and u_int is more than enough.
2016-04-28 03:19:53 +00:00
Pedro F. Giffuni
a5b50fbc20 ipdivert: Remove unnecessary and incorrectly typed variable.
In principle n is only used to carry a copy of ipi_count, which is
unsigned, in the non-VIMAGE case, however ipi_count can be used
directly so it is not needed at all. Removing it makes things look
cleaner.
2016-04-28 02:46:08 +00:00
Pedro F. Giffuni
b114da42af sys/devfs: unsign an index to prevent signed integer overflow.
cdp_maxdirent in struct:cdev_priv is of type u_int.  Use the same
type for the corresponding index in devfs_revoke().

MFC after:	1 week
2016-04-28 02:39:43 +00:00
Pedro F. Giffuni
9119df34df ndis(4): unsign some indexes to prevent overflows.
The "len" parameter is uint32_t, indexing it with an int may
end up in a signed integer overflow.

strlen(3) returns an integer of size_t so the corresponding index should
have that size.

MFC after:	1 week
2016-04-28 01:58:56 +00:00
Sepherosa Ziehau
9b436b180c tcp/lro: Fix more typo
Noticed by:	hiren
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-28 01:43:18 +00:00
John Baldwin
164a37a55a Trim redundant message.
WITNESS_WARN() appends "with non-sleepable lock" to the caller's message.

Sponsored by:	Chelsio Communications
2016-04-27 21:51:24 +00:00
John Baldwin
1b424b5655 Adjust prototypes for NUMA-related functions to match the style of the
rest of this file.
2016-04-27 21:12:05 +00:00
Emmanuel Vadot
30c05743c4 Add support for the Non-maskable interrupt driver found in the Allwinner A20 and A31 SoCs.
This is normally used for the PMU.

Reviewed by:	andrew
Approved by:	andrew (mentor)
Differential Revision:	https://reviews.freebsd.org/D5663
2016-04-27 20:49:57 +00:00
Jung-uk Kim
f8628d5bf2 Fix build without ACPI_DEBUG. 2016-04-27 20:24:48 +00:00
John Baldwin
5e45663658 Fix build for systems without PCI_RES_BUS.
Submitted by:	vangyzen
2016-04-27 19:54:56 +00:00
Jung-uk Kim
f49794cc8f Sort SUBDIR. 2016-04-27 19:38:24 +00:00
Jung-uk Kim
f8146b882b Merge ACPICA 20160422. 2016-04-27 19:09:21 +00:00
Michael Tuexen
c09a15342a Don't use the control argument after calling sctp_add_to_readq().
This breaks the userland stack. There should be no functional change
for the FreeBSD kernel stack.
While there, use consistent variable nameing.
2016-04-27 18:58:47 +00:00
John Baldwin
e240255ffc Add a bus_null_rescan() method that always fails with an error.
Use this in place of kobj_error_method to disable BUS_RESCAN() on
PCI drivers that do not use the "standard" scanning algorithm.
2016-04-27 17:49:42 +00:00
John Baldwin
67e7d085ae Add a pcib_attach_child() method to manage adding the child "pci" device.
This allows the PCI-PCI bridge driver to save a reference to the child
device in its softc.

Note that this required moving the "pci" device creation out of
acpi_pcib_attach().  Instead, acpi_pcib_attach() is renamed to
acpi_pcib_fetch_prt() as it's sole action now is to fetch the PCI
interrupt routing table.

Differential Revision:	https://reviews.freebsd.org/D6021
2016-04-27 16:39:05 +00:00
John Baldwin
c91991a2d8 Fix PCI bus detach to delete child devices.
Differential Revision:	https://reviews.freebsd.org/D6020
2016-04-27 16:34:29 +00:00
John Baldwin
88eb5c506d Add 'devctl delete' that calls device_delete_child().
'devctl delete' can be used to delete a device that is no longer present.
As an anti-foot-shooting measure, 'delete' will not delete a device
unless it's parent bus says it is no longer present.  This can be
overridden by passing the force ('-f') flag.

Note that this command should be used with care.  If a device is deleted
that is actually present it can't be resurrected unless the parent bus
device's driver supports rescans.

Differential Revision:	https://reviews.freebsd.org/D6019
2016-04-27 16:33:17 +00:00
John Baldwin
3d0338a092 Implement a PCI bus rescan method.
Rescanning a PCI bus uses the following steps:
- Fetch the current set of child devices and save it in the 'devlist'
  array.
- Allocate a parallel array 'unchanged' initalized with NULL pointers.
- Scan the bus checking each slot (and each function on slots with a
  multifunction device).
- If a valid function is found, look for a matching device in the 'devlist'
  array.  If a device is found, save the pointer in the 'unchanged' array.
  If a device is not found, add a new device.
- After the scan has finished, walk the 'devlist' array deleting any
  devices that do not have a matching pointer in the 'unchanged' array.
- Finally, fetch an updated set of child devices and explicitly attach any
  devices that are not present in the 'unchanged' array.

This builds on the previous changes to move subclass data management into
pci_alloc_devinfo(), pci_child_added(), and bus_child_deleted().

Subclasses of the PCI bus use custom rescan logic explicitly override the
rescan method to disable rescans.

Differential Revision:	https://reviews.freebsd.org/D6018
2016-04-27 16:31:12 +00:00
John Baldwin
a907c6914c Add a new rescan method to the bus interface.
The BUS_RESCAN() method rescans a single bus device checking for devices
that have been added or removed from the bus.  A new 'rescan' command is
added to devctl(8) to trigger a rescan.

Differential Revision:	https://reviews.freebsd.org/D6016
2016-04-27 16:29:03 +00:00
Pedro F. Giffuni
167e63e394 cam: unsign some types to match their definitions and avoid overflows.
numpatterns is u_int.

ctl:
CTL_NUM_MODE_PAGES comes from sizeof().
In struct:ctl_scsiio, kern_sg_entries is uint32_t.

MFC after:	2 weeks
2016-04-27 15:35:05 +00:00
Andrey V. Elsukov
9a5be809ab Make create_object callback optional and return EOPNOTSUPP when it isn't
defined. Remove eaction_create_compat() and use designated initializers to
initialize eaction_opcodes structure.

Obtained from:	Yandex LLC
2016-04-27 15:28:25 +00:00
Pedro F. Giffuni
b99bce73e2 geom: unsign some types to match their definitions and avoid overflows.
In struct:gctl_req, nargs is unsigned.

In mirror:
g_mirror_syncreqs is unsigned.

In raid:
in struct:g_raid_volume, v_disks_count is unsigned.

In virstor:
in struct:g_virstor_softc, n_components is unsigned.

MFC after:	2 weeks
2016-04-27 15:10:40 +00:00
Sepherosa Ziehau
9e3db01282 tcp/lro: Fix typo.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-27 09:40:55 +00:00
Xin LI
4990d495fc MFV r298691:
ntp 4.2.8p7.

Security:	CVE-2016-1547, CVE-2016-1548, CVE-2016-1549, CVE-2016-1550
Security:	CVE-2016-1551, CVE-2016-2516, CVE-2016-2517, CVE-2016-2518
Security:	CVE-2016-2519
Security:	FreeBSD-SA-16:16.ntp
With hat:	so
2016-04-27 07:46:38 +00:00
Sepherosa Ziehau
0fbe6eaef6 hyperv/hn: Add stat for # of chimney sending tries
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-27 06:49:16 +00:00
Sepherosa Ziehau
677d0d5076 hyperv/vmbus: Mark sysctls MPSAFE
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-27 05:45:14 +00:00
Xin LI
c1950318d1 Vendor import of ntp-4.2.8p7. 2016-04-27 05:37:54 +00:00
Sepherosa Ziehau
b649be4068 hyperv/hn: Mark sysctls MPSAFE
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-27 05:18:04 +00:00
Sepherosa Ziehau
6456e1587b hyperv/hn: Remove unapplied comment.
Chimney sending buffers are shared across channels.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-27 05:05:54 +00:00
Sepherosa Ziehau
ff1c886a59 hyperv/hn: Restart sending earlier once we gathered some free TX descs
This greatly reduces the oqdrops under heavy workload.

For TCP send/recv test (10K concurrent connections):
oqdrops is reduced by 17% on sending side, and 57% on receiving side.

For nginx-1.8/wrk-4 1KB object test (10K concurrent connections,
4 requests/connection):
oqdrops is reduced by 44% on nginx side, and 10% on wrk side.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-27 04:51:28 +00:00
Marcelo Araujo
1f3d62ab98 For pointers use NULL instead of 0.
Reviewed by:	rpaulo
MFC after:	2 weeks.
Differential Revision:	https://reviews.freebsd.org/D5946
2016-04-27 03:06:53 +00:00
Marcelo Araujo
cd59e2f343 Use MIN() macro from sys/param.h.
MFC after:	2 weeks.
2016-04-27 02:44:10 +00:00
Marcelo Araujo
a9a46bd918 Use MIN() macro from sys/param.h.
MFC after:	2 weeks.
2016-04-27 02:34:25 +00:00
Marcelo Araujo
1e8b591f62 Use macro MIN() from sys/param.h.
MFC after:	2 weeks.
2016-04-27 02:26:31 +00:00
Jamie Gritton
73d9e52d2f Delay revmoing the last jail reference in prison_proc_free, and instead
put it off into the pr_task.  This is similar to prison_free, and in fact
uses the same task even though they do something slightly different.

This resolves a LOR between the process lock and allprison_lock, which
came about in r298565.

PR:		48471
2016-04-27 02:25:21 +00:00
Marcelo Araujo
a301044615 Use MIN() macro from sys/param.h.
MFC after:	2 weeks.
2016-04-27 02:13:57 +00:00
Marcelo Araujo
7de7df1554 Use macro MIN() from sys/param.h.
MFC after:	2 weeks.
2016-04-27 02:02:44 +00:00
Pedro F. Giffuni
11ec5dd04b fsck_ffs: Revert partially the unsigned changes.
Any value of uint16_t will be internally promoted to int so
changing them to an unsigned value doesn't help.

Missing revert value in suj_read().

X-MFC with:	r298551
2016-04-27 01:36:25 +00:00
Pedro F. Giffuni
4235bafa7e fsck_ffs: Revert partially the unsigned changes.
Any value of uint16_t will be internally promoted to int so
changing them to an unsigned value doesn't help.

Make clear we want to use uint32_t for closedisk()

X-MFC with:	r298551
2016-04-27 01:32:11 +00:00
Conrad Meyer
da95a2ae56 posix4_mib: Don't overrun facility_initialized array
The facility_initialized and facility arrays are the same size and were
intended to be indexed the same.  I believe this mismatch was just a
typo/braino in r208731.

Reported by:	Coverity
CID:		1017430
Sponsored by:	EMC / Isilon Storage Division
2016-04-27 00:10:32 +00:00
Conrad Meyer
a286650b08 subr_mbpool: Don't free bogus pointer in error paths
An mbpool is allocated with a contiguous array of mbpages.  Freeing an
individual mbpage has never been valid.  Don't do it.

This bug has been present since this code was introduced in r117624 (2003).

Reported by:	Coverity
CID:		1009687
Sponsored by:	EMC / Isilon Storage Division
2016-04-26 23:58:55 +00:00
Conrad Meyer
5a8c498f2e netipsec: Don't leak memory when deep copy fails
Reported by:	Coverity
CID:		1331693
Sponsored by:	EMC / Isilon Storage Division
2016-04-26 23:23:44 +00:00
Conrad Meyer
2769d06203 in_lltable_alloc and in6 copy: Don't leak LLE in error path
Fix a memory leak in error conditions introduced in r292978.

Reported by:	Coverity
CIDs:		1347009, 1347010
Sponsored by:	EMC / Isilon Storage Division
2016-04-26 23:13:48 +00:00
Oleksandr Tymoshenko
349ef43de4 Refactor DTS files for Zynq-based SoCs
- Factor out common part to zynq-7000.dtsi
- Fix problem with Zynq interrupts by using interrupt "triples"
    in .dtsi file to differentiate between edge-triggered and
    level-triggered interrupts
- cgem driver now recognizes "status" property

Submitted by:	Thomas Skibo <thomasskibo@yahoo.com>
Differential Revision:	https://reviews.freebsd.org/D6095
2016-04-26 23:09:47 +00:00
Conrad Meyer
bac5bedf44 tcp_usrreq: Free allocated buffer in relock case
The disgusting macro INP_WLOCK_RECHECK may early-return.  In
tcp_default_ctloutput() the TCP_CCALGOOPT case allocates memory before invoking
this macro, which may leak memory.

Add a _CLEANUP variant that takes a code argument to perform variable cleanup
in the early return path.  Use it to free the 'pbuf' allocated in
tcp_default_ctloutput().

I am not especially happy with this macro, but I reckon it's not any worse than
INP_WLOCK_RECHECK already was.

Reported by:	Coverity
CID:		1350286
Sponsored by:	EMC / Isilon Storage Division
2016-04-26 23:02:18 +00:00
Conrad Meyer
4a2776e538 g_part_bsd64: Delete duplicate/dead code
RAW_PART is handled earlier in the loop.

Reported by:	Coverity
CID:		1223201
Sponsored by:	EMC / Isilon Storage Division
2016-04-26 22:32:33 +00:00
Conrad Meyer
5ad33e776f g_part_bsd64: Check for valid on-disk npartitions value
This value is u32 on disk, but assigned to an int in memory.  After we do the
implicit conversion via assignment, check that the result is at least one[1]
(non-negative[2]).

1. The subsequent for-loop iterates from gpt_entries minus one, down, until
   reaching zero.  A negative or zero initial index results in undefined signed
   integer overflow.
2. It is also used to index into arrays later.

In practice, we expected non-malicious disks to contain small positive values.

Reported by:	Coverity
CID:		1223202
Sponsored by:	EMC / Isilon Storage Division
2016-04-26 22:30:54 +00:00