]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/log
mirror_ubuntu-zesty-kernel.git
7 years agoARM: dts: apq8064: Add OPP data for frequencies above 1ghz
Georgi Djakov [Fri, 28 Aug 2015 08:43:33 +0000 (11:43 +0300)]
ARM: dts: apq8064: Add OPP data for frequencies above 1ghz

Now we can scale voltages, so add all frequencies.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
7 years agoARM: dts: apq8064: Assign a power supply to each CPU
Georgi Djakov [Fri, 28 Aug 2015 08:42:05 +0000 (11:42 +0300)]
ARM: dts: apq8064: Assign a power supply to each CPU

Assign to each CPU its power supply that will be used for
voltage scaling.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
7 years agoARM: qcom: add description of KPSS WDT for APQ8064
Pramod Gurav [Wed, 19 Nov 2014 10:09:04 +0000 (15:39 +0530)]
ARM: qcom: add description of KPSS WDT for APQ8064

Describe the Krait Processor Sub-system (KPSS) Watchdog timer in the
APQ8064 device tree.  Also, add a fixed-clock description of SLEEP_CLK,
which will do for now.

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
7 years agoARM: dts: qcom: Add necessary DT data for Krait cpufreq
Stephen Boyd [Fri, 5 Sep 2014 22:47:36 +0000 (15:47 -0700)]
ARM: dts: qcom: Add necessary DT data for Krait cpufreq

Add the necessary DT nodes and data so we can probe the cpufreq
driver on MSM devices with Krait CPUs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoARM: dts: apq8064: add pci support in CM QS600
Srinivas Kandagatla [Wed, 26 Nov 2014 12:42:18 +0000 (13:42 +0100)]
ARM: dts: apq8064: add pci support in CM QS600

This patch adds PCIE support to APQ8064, tested with Ethernet on
Compulab QS600 board.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agoARM: dts: APQ8064: Add iommu
Rob Clark [Thu, 10 Jul 2014 02:07:15 +0000 (22:07 -0400)]
ARM: dts: APQ8064: Add iommu

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Srinivas Kandagatla [updated with latest generic IOMMU changes from Sricharan]

7 years agoARM: dts: ifc6410: add inforce LVDS panel support
Srinivas Kandagatla [Tue, 28 Jul 2015 12:54:36 +0000 (13:54 +0100)]
ARM: dts: ifc6410: add inforce LVDS panel support

This patch adds LVDS panel for IFC6410.

Signed-off-by: Rob Clark <robdclark@gmail.com>
[Rob Clark: WIP patch]
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agoARM: dts: qs600: enable MDP support
Srinivas Kandagatla [Tue, 28 Jul 2015 12:54:27 +0000 (13:54 +0100)]
ARM: dts: qs600: enable MDP support

This patch enables MDP support on QS600 platform.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agoARM: dts: ifc6410: enable MDP support
Srinivas Kandagatla [Tue, 28 Jul 2015 12:54:18 +0000 (13:54 +0100)]
ARM: dts: ifc6410: enable MDP support

This patch enables MDP support on IFC6410.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agoARM: dts: apq8064: Add MDP support
Rob Clark [Tue, 28 Jul 2015 12:54:09 +0000 (13:54 +0100)]
ARM: dts: apq8064: Add MDP support

This patch adds MDP node to APQ8064 dt.

Signed-off-by: Rob Clark <robdclark@gmail.com>
[Srinivas Kandagatla] : updated with new style rpm regulators
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agoARM: dts: ifc6410: enable pcie dt node for this board
Stanimir Varbanov [Thu, 3 Dec 2015 13:35:24 +0000 (15:35 +0200)]
ARM: dts: ifc6410: enable pcie dt node for this board

Enable pcie dt node and fill pcie dt node with regulator, pinctrl
and reset gpio, to use the pcie on the ifc6410 board.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
7 years agoARM: dts: apq8064: add pcie devicetree node
Stanimir Varbanov [Thu, 3 Dec 2015 13:35:23 +0000 (15:35 +0200)]
ARM: dts: apq8064: add pcie devicetree node

Add the pcie dt node so that it can probe and used.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
7 years agoARM: dts: qcom: apq8064-ifc6410 Use hardware flow control for GSBI6
Ivan T. Ivanov [Fri, 11 Dec 2015 18:29:58 +0000 (18:29 +0000)]
ARM: dts: qcom: apq8064-ifc6410 Use hardware flow control for GSBI6

GSBI6 UART module is connected to BT chip, which uses
hardware flow control lines. Enable them on SoC side.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
7 years agoarm: dts: qcom: apq8064: Add fixed rate on-board oscillators
Georgi Djakov [Thu, 3 Dec 2015 14:02:55 +0000 (16:02 +0200)]
arm: dts: qcom: apq8064: Add fixed rate on-board oscillators

Currently the rates of the xo and sleep clocks are hard-coded in the
GCC driver, but this is a board layout description that actually should
be in the DT. Moving them into DT also allows us to insert the RPM
controlled clocks between the DT and GCC clocks.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Signed-off-by: Andy Gross <agross@codeaurora.org>
7 years agoarm: dts: qcom: Add generic PMIC gpio/MPP compat strings
Stephen Boyd [Sat, 21 Nov 2015 01:49:46 +0000 (17:49 -0800)]
arm: dts: qcom: Add generic PMIC gpio/MPP compat strings

Add the generic compatible strings for the PMIC gpio and MPP
modules found on qcom based PMICs.

Cc: <devicetree@vger.kernel.org>
Cc: "Ivan T. Ivanov" <iivanov@mm-sol.com>
Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Andy Gross <agross@codeaurora.org>
7 years agoARM: dts: qcom: apq8064: Introduce gsbi5 and gsbi5 serial node
Bjorn Andersson [Thu, 22 Oct 2015 18:13:50 +0000 (11:13 -0700)]
ARM: dts: qcom: apq8064: Introduce gsbi5 and gsbi5 serial node

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Andy Gross <agross@codeaurora.org>
7 years agoARM: dts: qcom: apq8064: Declare all pm8921 regulators
Bjorn Andersson [Thu, 22 Oct 2015 18:13:49 +0000 (11:13 -0700)]
ARM: dts: qcom: apq8064: Declare all pm8921 regulators

Consolidate all labeling of regulators into the core 8064 dtsi file to
make them available from all other dts files.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Andy Gross <agross@codeaurora.org>
7 years agoARM: dts: qcom: apq8064: Add hwmutex and SMEM nodes
Bjorn Andersson [Thu, 22 Oct 2015 18:13:48 +0000 (11:13 -0700)]
ARM: dts: qcom: apq8064: Add hwmutex and SMEM nodes

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Andy Gross <agross@codeaurora.org>
7 years agodevicetree: Add hardware rng entry to qcom-apq8064.dtsi
John Stultz [Fri, 18 Sep 2015 12:31:12 +0000 (13:31 +0100)]
devicetree: Add hardware rng entry to qcom-apq8064.dtsi

Add devicetree data to add support for hw_rng support
to the apq8064 dts.

Tested on the Nexus7 (2013).

Cc: Kumar Gala <galak@codeaurora.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: devicetree@vger.kernel.org
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Andy Gross <agross@codeaurora.org>
7 years agodrm/msm: mdp4 lvds: Check the panel node in detect_panel()
Srinivas Kandagatla [Fri, 14 Aug 2015 13:51:29 +0000 (14:51 +0100)]
drm/msm: mdp4 lvds: Check the panel node in detect_panel()

This patch checks if the panel node is disabled in DT or not, this would
let us return proper error code so that the driver could stop panel
specific intialization.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agodrm/msm: mdp4 lvds: continue if the panel is not connected
Srinivas Kandagatla [Fri, 14 Aug 2015 13:42:13 +0000 (14:42 +0100)]
drm/msm: mdp4 lvds: continue if the panel is not connected

Two issues:

1> Intializing panel specific bits without actual panel presence.
2> Bailing out if the detect_panel() return -ENODEV.

With the existing code if detect_panel() returns an error code the
driver would bail out without doing anything, However it could continue
intializing hdmi related things. This patch adds two things.

1> moves the panel specific intialization only if the panel is detected
2> let the driver continue with hdmi intialization if detect_panel()
return -ENODEV.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agodrm/panel: simple-panel: Add panel picker support.
Srinivas Kandagatla [Fri, 14 Aug 2015 12:58:07 +0000 (13:58 +0100)]
drm/panel: simple-panel: Add panel picker support.

This patch adds panel picker support to simple-panel.

The idea of panel picker is to select the correct panel timings if it
supports probing edid via DDC bus, edid contains manufacture ID
and Manufacturer product code, so it can match against the panel_picker
entries to get the correct panel timings.

From DT point of view the panel picker uses generic compatible string
"panel-simple", keeping the panel specific compatible strings still
supported.

Panels can be static entry in the DT, but practically development boards
like IFC6410 where developers can connect any LVDS panel which makes it
difficult to maintian the dt support for those panels in dts file.
With this dynamic probing via panel picker makes it easy to support such
use-cases.
This patch also adds panel presence detection based, if there is no
panel detected or panel picker could not find the panel then the driver
would mark the panel DT node as disabled so that the drm driver would
be able to take right decision based on that panel node status.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agodrm/edid: export edid_vendor()
Srinivas Kandagatla [Thu, 13 Aug 2015 13:15:40 +0000 (14:15 +0100)]
drm/edid: export edid_vendor()

This patch exports edid_vendor() match function, so that other drivers
could use it for matching the vendor id.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agodrm/edid: Add support to get edid early
Srinivas Kandagatla [Thu, 13 Aug 2015 13:13:40 +0000 (14:13 +0100)]
drm/edid: Add support to get edid early

This patch adds support to get edid way early before the connector is
created, this is mainly used for panel drivers to auto-probe the panel
based on the vendor and product id from EDID.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agoPCI: qcom: Add Qualcomm PCIe controller driver
Stanimir Varbanov [Mon, 7 Dec 2015 14:05:27 +0000 (14:05 +0000)]
PCI: qcom: Add Qualcomm PCIe controller driver

The PCIe driver reuse the Designware common code for host
and MSI initialization, and also program the Qualcomm
application specific registers.

Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
7 years agoDT: PCI: qcom: Document PCIe devicetree bindings
Stanimir Varbanov [Thu, 3 Dec 2015 13:35:21 +0000 (15:35 +0200)]
DT: PCI: qcom: Document PCIe devicetree bindings

Document Qualcomm PCIe driver devicetree bindings.

Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
7 years agoPCI: designware: add memory barrier after enabling region
Stanimir Varbanov [Thu, 3 Dec 2015 13:35:20 +0000 (15:35 +0200)]
PCI: designware: add memory barrier after enabling region

Add 'write memory' barrier after enable region in PCIE_ATU_CR2
register. The barrier is needed to ensure that the region enable
request has been reached it's destination at time when we
read/write to PCI configuration space.

Without this barrier PCI device enumeration during kernel boot
is not reliable, and reading configuration space for particular
PCI device on the bus returns zero aka no device.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
7 years agomedia: vidc: Qualcomm video encoder/decoder driver
Stanimir Varbanov [Mon, 17 Aug 2015 12:38:23 +0000 (15:38 +0300)]
media: vidc: Qualcomm video encoder/decoder driver

add venus video encoder/decoder driver.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
7 years agomedia: v4l2-controls: add h264 5.2 level and constrained high profile
Stanimir Varbanov [Mon, 17 Aug 2015 12:35:55 +0000 (15:35 +0300)]
media: v4l2-controls: add h264 5.2 level and constrained high profile

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
7 years agoInput: pm8941: Add RESIN_N input handling
Ivan T. Ivanov [Fri, 18 Sep 2015 08:44:09 +0000 (11:44 +0300)]
Input: pm8941: Add RESIN_N input handling

RESIN_N PMIC input is commonly used as "Volume Down"
button on Quallcom platforms. Add support for it.

TODO: Do it better.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
7 years agoiommu:msm: fix compilation error.
Srinivas Kandagatla [Thu, 18 Sep 2014 17:56:58 +0000 (18:56 +0100)]
iommu:msm: fix compilation error.

As part of Rob Clarks cleanup one of the flags have been renamed in
header which introduced a compilation failure.

drivers/iommu/msm_iommu.c: In function ‘msm_iommu_map’:
drivers/iommu/msm_iommu.c:426:7: error: ‘FL_AP_READ’ undeclared (first use in this function)
drivers/iommu/msm_iommu.c:426:7: note: each undeclared identifier is reported only once for each function it appears in
drivers/iommu/msm_iommu.c:426:20: error: ‘FL_AP_WRITE’ undeclared (first use in this function)
make[3]: *** [drivers/iommu/msm_iommu.o] Error 1
make[2]: *** [drivers/iommu] Error 2
make[1]: *** [drivers] Error 2

iThis patch fixes the error by using the new flags in the driver.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agoWIP:pwrseq: Convert in to proper platform device
Srinivas Kandagatla [Thu, 17 Sep 2015 09:17:05 +0000 (10:17 +0100)]
WIP:pwrseq: Convert in to proper platform device

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agoarm:multi_v7_defconfig: Add QCOM specific Kconfigs
Srinivas Kandagatla [Wed, 18 Mar 2015 18:40:30 +0000 (18:40 +0000)]
arm:multi_v7_defconfig: Add QCOM specific Kconfigs

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agoARM: qcom_defconfig: Add QCOM specific drivers
Srinivas Kandagatla [Tue, 9 Dec 2014 10:15:24 +0000 (10:15 +0000)]
ARM: qcom_defconfig: Add QCOM specific drivers

This patch adds common kconfig options required for qcom chips to work.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
7 years agohid: add support for Lilliput touchscreen
Kiran Rudramuni [Tue, 15 Sep 2015 19:06:04 +0000 (21:06 +0200)]
hid: add support for Lilliput touchscreen

Signed-off-by: Kiran Rudramuni <kchitrik@codeaurora.org>
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
7 years agommc: mmci: Support any block sizes for ux500v2 and qcom variant
Ulf Hansson [Mon, 18 Aug 2014 05:06:46 +0000 (06:06 +0100)]
mmc: mmci: Support any block sizes for ux500v2 and qcom variant

For the ux500v2 variant of the PL18x block, any block sizes are
supported. This will make it possible to decrease data overhead
for SDIO transfers.

This patch is based on Ulf Hansson patch
http://www.spinics.net/lists/linux-mmc/msg12160.html

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
enabled this support on qcom variant.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
7 years agoUBUNTU: [packaging] collect all packaging history
Paolo Pisati [Thu, 3 Dec 2015 16:24:39 +0000 (17:24 +0100)]
UBUNTU: [packaging] collect all packaging history

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: Fix getabis
Paolo Pisati [Thu, 3 Dec 2015 16:10:19 +0000 (17:10 +0100)]
UBUNTU: Fix getabis

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: [Packaging] Fix dependency on linux-dragon410c-tools-common
Paolo Pisati [Thu, 3 Dec 2015 16:08:37 +0000 (17:08 +0100)]
UBUNTU: [Packaging] Fix dependency on linux-dragon410c-tools-common

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: Remove unused package definitions
Paolo Pisati [Thu, 3 Dec 2015 16:06:35 +0000 (17:06 +0100)]
UBUNTU: Remove unused package definitions

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: Disable doc and source package generation
Paolo Pisati [Thu, 3 Dec 2015 16:02:18 +0000 (17:02 +0100)]
UBUNTU: Disable doc and source package generation

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: arm64.mk: do_linux_tools=true
Paolo Pisati [Thu, 3 Dec 2015 15:58:21 +0000 (16:58 +0100)]
UBUNTU: packaging: arm64.mk: do_linux_tools=true

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: [Packaging] Clean up d-i
Paolo Pisati [Thu, 3 Dec 2015 15:56:38 +0000 (16:56 +0100)]
UBUNTU: [Packaging] Clean up d-i

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: [Debian] drop generic.inclusion-list
Paolo Pisati [Thu, 3 Dec 2015 15:53:03 +0000 (16:53 +0100)]
UBUNTU: [Debian] drop generic.inclusion-list

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: [Config] Added libssl-dev to Build-Depends
Paolo Pisati [Thu, 3 Dec 2015 15:47:49 +0000 (16:47 +0100)]
UBUNTU: [Config] Added libssl-dev to Build-Depends

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: [Config] Add uuid-dev to Build-Depends
Paolo Pisati [Thu, 3 Dec 2015 15:46:46 +0000 (16:46 +0100)]
UBUNTU: [Config] Add uuid-dev to Build-Depends

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: remove the abi dir
Paolo Pisati [Thu, 3 Dec 2015 15:31:05 +0000 (16:31 +0100)]
UBUNTU: packaging: remove the abi dir

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: remove all but generic-dragon410c vars
Paolo Pisati [Thu, 3 Dec 2015 15:30:08 +0000 (16:30 +0100)]
UBUNTU: packaging: remove all but generic-dragon410c vars

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: remove all but arm64 rules.mk
Paolo Pisati [Thu, 3 Dec 2015 15:28:38 +0000 (16:28 +0100)]
UBUNTU: packaging: remove all but arm64 rules.mk

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: remove all but arm64 configs
Paolo Pisati [Thu, 3 Dec 2015 15:23:10 +0000 (16:23 +0100)]
UBUNTU: packaging: remove all but arm64 configs

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: rename generic config to generic-dragon410c
Paolo Pisati [Thu, 3 Dec 2015 16:29:04 +0000 (17:29 +0100)]
UBUNTU: packaging: rename generic config to generic-dragon410c

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: arm64.mk: disable_d_i=true, do_libc_dev_package=false and do_commo...
Paolo Pisati [Thu, 3 Dec 2015 15:20:15 +0000 (16:20 +0100)]
UBUNTU: packaging: arm64.mk: disable_d_i=true, do_libc_dev_package=false and do_common_headers_indep=false

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: flavour-control.stub: linux-headers-PKGVER-ABINUM-FLAVOUR depends...
Paolo Pisati [Thu, 3 Dec 2015 15:11:57 +0000 (16:11 +0100)]
UBUNTU: packaging: flavour-control.stub: linux-headers-PKGVER-ABINUM-FLAVOUR depends on SRCPKGNAME-headers-PKGVER-ABINUM

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: control.stub.in: keep the src pkg as linux-dragon410c
Paolo Pisati [Thu, 3 Dec 2015 15:09:51 +0000 (16:09 +0100)]
UBUNTU: packaging: control.stub.in: keep the src pkg as linux-dragon410c

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: 2-binary-arch.mk: skip modules signing if the private key is not...
Paolo Pisati [Thu, 26 Feb 2015 16:41:19 +0000 (16:41 +0000)]
UBUNTU: packaging: 2-binary-arch.mk: skip modules signing if the private key is not available

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: kernel-versions.in: arm64 only and generic-dragon410c rename"
Paolo Pisati [Thu, 3 Dec 2015 14:58:10 +0000 (15:58 +0100)]
UBUNTU: packaging: kernel-versions.in: arm64 only and generic-dragon410c rename"

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: arm64.mk: generic-dragon410c rename
Paolo Pisati [Thu, 3 Dec 2015 14:57:54 +0000 (15:57 +0100)]
UBUNTU: packaging: arm64.mk: generic-dragon410c rename

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: vars.generic: arm64 only and generic-410c rename
Paolo Pisati [Thu, 3 Dec 2015 14:51:00 +0000 (15:51 +0100)]
UBUNTU: packaging: vars.generic: arm64 only and generic-410c rename

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: control.stub.in: arm64 only
Paolo Pisati [Thu, 3 Dec 2015 14:49:41 +0000 (15:49 +0100)]
UBUNTU: packaging: control.stub.in: arm64 only

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: getabis: arm64 only and generic-dragon410c rename
Paolo Pisati [Thu, 3 Dec 2015 14:36:26 +0000 (15:36 +0100)]
UBUNTU: packaging: getabis: arm64 only and generic-dragon410c rename

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging: kernelconfig: arm64 only
Paolo Pisati [Thu, 3 Dec 2015 14:35:20 +0000 (15:35 +0100)]
UBUNTU: packaging: kernelconfig: arm64 only

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: Switch default Debian to dragon410c
Paolo Pisati [Thu, 3 Dec 2015 14:31:12 +0000 (15:31 +0100)]
UBUNTU: Switch default Debian to dragon410c

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: Add debian.dragon410c
Paolo Pisati [Thu, 3 Dec 2015 14:30:21 +0000 (15:30 +0100)]
UBUNTU: Add debian.dragon410c

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: packaging fix: 0-common-vars.mk: don't choke on -0.0 version
Paolo Pisati [Thu, 19 Feb 2015 09:23:52 +0000 (09:23 +0000)]
UBUNTU: packaging fix: 0-common-vars.mk: don't choke on -0.0 version

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoRevert "arm64: kernel: implement ACPI parking protocol"
Paolo Pisati [Mon, 7 Mar 2016 14:49:53 +0000 (15:49 +0100)]
Revert "arm64: kernel: implement ACPI parking protocol"

This reverts commit 72196fb6d7ab50bc99e6223fac76daaec0c1c18f.

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
7 years agoUBUNTU: Ubuntu-4.4.0-96.119
Stefan Bader [Tue, 12 Sep 2017 13:51:22 +0000 (15:51 +0200)]
UBUNTU: Ubuntu-4.4.0-96.119

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agoUBUNTU: SAUCE: s390/mm: fix race on mm->context.flush_mm
Martin Schwidefsky [Thu, 17 Aug 2017 06:15:16 +0000 (08:15 +0200)]
UBUNTU: SAUCE: s390/mm: fix race on mm->context.flush_mm

BugLink: http://bugs.launchpad.net/bugs/1708399
The order in __tlb_flush_mm_lazy is to flush TLB first and then clear
the mm->context.flush_mm bit. This can lead to missed flushes as the
bit can be set anytime, the order needs to be the other way aronud.

But this leads to a different race, __tlb_flush_mm_lazy may be called
on two CPUs concurrently. If mm->context.flush_mm is cleared first then
another CPU can bypass __tlb_flush_mm_lazy although the first CPU has
not done the flush yet. In a virtualized environment the time until the
flush is finally completed can be arbitrarily long.

Add a spinlock to serialize __tlb_flush_mm_lazy and use the function
in finish_arch_post_lock_switch as well.

Cc: <stable@vger.kernel.org>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
(backported from 60f07c8ec5fae06c23e9fd7bab67dabce92b3414 linux-next)
[context adaption]
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Colin King <colin.king@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agoUBUNTU: SAUCE: s390/mm: fix local TLB flushing vs. detach of an mm address space
Martin Schwidefsky [Wed, 16 Aug 2017 12:10:01 +0000 (14:10 +0200)]
UBUNTU: SAUCE: s390/mm: fix local TLB flushing vs. detach of an mm address space

BugLink: http://bugs.launchpad.net/bugs/1708399
The local TLB flushing code keeps an additional mask in the mm.context,
the cpu_attach_mask. At the time a global flush of an address space is
done the cpu_attach_mask is copied to the mm_cpumask in order to avoid
future global flushes in case the mm is used by a single CPU only after
the flush.

Trouble is that the reset of the mm_cpumask is racy against the detach
of an mm address space by switch_mm. The current order is first the
global TLB flush and then the copy of the cpu_attach_mask to the
mm_cpumask. The order needs to be the other way around.

Cc: <stable@vger.kernel.org>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
(backported from b3e5dc45fd1ec2aa1de6b80008f9295eb17e0659 linux-next)
[merged with "s390/mm,kvm: flush gmap address space with IDTE"]
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Colin King <colin.king@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agos390/mm: no local TLB flush for clearing-by-ASCE IDTE
Martin Schwidefsky [Fri, 10 Jun 2016 08:56:44 +0000 (10:56 +0200)]
s390/mm: no local TLB flush for clearing-by-ASCE IDTE

BugLink: http://bugs.launchpad.net/bugs/1708399
The local-clearing control of the IDTE instruction does not have any effect
for the clearing-by-ASCE operation. Only the invalidation-and-clearing
operation respects the local-clearing bit.

Remove __tlb_flush_idte_local and simplify the batched TLB flushing code.

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
(backported from commit d5dcafee5f183e9aedddb147a89cb46ab038f26b)
[Kept MACHINE_HAS_TLB_LC checks as 64f31d5802af11fd is not applied.]
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Colin King <colin.king@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agoBluetooth: Properly check L2CAP config option output buffer length
Ben Seri [Sat, 9 Sep 2017 21:15:59 +0000 (23:15 +0200)]
Bluetooth: Properly check L2CAP config option output buffer length

Validate the output buffer length for L2CAP config requests and responses
to avoid overflowing the stack buffer used for building the option blocks.

Cc: stable@vger.kernel.org
Signed-off-by: Ben Seri <ben@armis.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
CVE-2017-1000251

(cherry-picked from commit e860d2c904d1a9f38a24eb44c9f34b8f915a6ea3)
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agoUBUNTU: Start new release
Stefan Bader [Tue, 12 Sep 2017 13:40:01 +0000 (15:40 +0200)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agoUBUNTU: Ubuntu-4.4.0-95.118
Kleber Sacilotto de Souza [Thu, 7 Sep 2017 15:34:35 +0000 (17:34 +0200)]
UBUNTU: Ubuntu-4.4.0-95.118

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agomm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes
Kees Cook [Fri, 18 Aug 2017 22:16:31 +0000 (15:16 -0700)]
mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes

BugLink: http://bugs.launchpad.net/bugs/1715636
Moving the x86_64 and arm64 PIE base from 0x555555554000 to 0x000100000000
broke AddressSanitizer.  This is a partial revert of:

  eab09532d400 ("binfmt_elf: use ELF_ET_DYN_BASE only for PIE")
  02445990a96e ("arm64: move ELF_ET_DYN_BASE to 4GB / 4MB")

The AddressSanitizer tool has hard-coded expectations about where
executable mappings are loaded.

The motivation for changing the PIE base in the above commits was to
avoid the Stack-Clash CVEs that allowed executable mappings to get too
close to heap and stack.  This was mainly a problem on 32-bit, but the
64-bit bases were moved too, in an effort to proactively protect those
systems (proofs of concept do exist that show 64-bit collisions, but
other recent changes to fix stack accounting and setuid behaviors will
minimize the impact).

The new 32-bit PIE base is fine for ASan (since it matches the ET_EXEC
base), so only the 64-bit PIE base needs to be reverted to let x86 and
arm64 ASan binaries run again.  Future changes to the 64-bit PIE base on
these architectures can be made optional once a more dynamic method for
dealing with AddressSanitizer is found.  (e.g.  always loading PIE into
the mmap region for marked binaries.)

Link: http://lkml.kernel.org/r/20170807201542.GA21271@beast
Fixes: eab09532d400 ("binfmt_elf: use ELF_ET_DYN_BASE only for PIE")
Fixes: 02445990a96e ("arm64: move ELF_ET_DYN_BASE to 4GB / 4MB")
Signed-off-by: Kees Cook <keescook@chromium.org>
Reported-by: Kostya Serebryany <kcc@google.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit c715b72c1ba406f133217b509044c38d8e714a37)
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Acked-by: Colin King <colin.king@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: Start new release
Thadeu Lima de Souza Cascardo [Wed, 6 Sep 2017 17:16:38 +0000 (14:16 -0300)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
7 years agoUBUNTU: Ubuntu-4.4.0-94.117
Kleber Sacilotto de Souza [Mon, 28 Aug 2017 15:09:59 +0000 (17:09 +0200)]
UBUNTU: Ubuntu-4.4.0-94.117

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: SAUCE: mwifiex: do not dereference invalid pointer
Wen-chien Jesse Sung [Thu, 24 Aug 2017 08:17:00 +0000 (10:17 +0200)]
UBUNTU: SAUCE: mwifiex: do not dereference invalid pointer

BugLink: https://launchpad.net/bugs/1712746
Check priv->wdev.wiphy before dereference.

Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-By: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: SAUCE: net/wireless: do not dereference invalid pointer
Wen-chien Jesse Sung [Thu, 24 Aug 2017 08:17:00 +0000 (10:17 +0200)]
UBUNTU: SAUCE: net/wireless: do not dereference invalid pointer

BugLink: https://launchpad.net/bugs/1712746
The wiphy may be NULL sometimes. Do not dereference when it's NULL.

Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-By: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: bnxt_en_bpo: [Config] Enable CONFIG_BNXT_BPO=m
Juerg Haefliger [Thu, 17 Aug 2017 11:32:00 +0000 (13:32 +0200)]
UBUNTU: bnxt_en_bpo: [Config] Enable CONFIG_BNXT_BPO=m

BugLink: http://bugs.launchpad.net/bugs/1711056
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: SAUCE: bnxt_en_bpo: Rename the backport driver to bnxt_en_bpo
Juerg Haefliger [Thu, 17 Aug 2017 11:32:00 +0000 (13:32 +0200)]
UBUNTU: SAUCE: bnxt_en_bpo: Rename the backport driver to bnxt_en_bpo

BugLink: http://bugs.launchpad.net/bugs/1711056
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: SAUCE: bnxt_en_bpo: Remove PCI_IDs handled by the regular driver
Juerg Haefliger [Thu, 17 Aug 2017 11:32:00 +0000 (13:32 +0200)]
UBUNTU: SAUCE: bnxt_en_bpo: Remove PCI_IDs handled by the regular driver

BugLink: http://bugs.launchpad.net/bugs/1711056
The backported bnxt_en_bpo driver should only load for NICs that are not
handled by the current bnxt_en driver.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: SAUCE: bnxt_en_bpo: Move config settings to Kconfig
Juerg Haefliger [Thu, 17 Aug 2017 11:32:00 +0000 (13:32 +0200)]
UBUNTU: SAUCE: bnxt_en_bpo: Move config settings to Kconfig

BugLink: http://bugs.launchpad.net/bugs/1711056
Move the CONFIG_BNXT settings from the driver's Makefile to a dedicated
Kconfig file.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: SAUCE: bnxt_en_bpo: Remove unnecessary compile flags
Juerg Haefliger [Thu, 17 Aug 2017 11:32:00 +0000 (13:32 +0200)]
UBUNTU: SAUCE: bnxt_en_bpo: Remove unnecessary compile flags

BugLink: http://bugs.launchpad.net/bugs/1711056
Remove the following compile flags that are set by the kernel's
Makefile:
  -g -D__LINUX

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: SAUCE: bnxt_en_bpo: Drop distro out-of-tree detection logic
Juerg Haefliger [Thu, 17 Aug 2017 11:32:00 +0000 (13:32 +0200)]
UBUNTU: SAUCE: bnxt_en_bpo: Drop distro out-of-tree detection logic

BugLink: http://bugs.launchpad.net/bugs/1711056
The provided Makefile is a generic out-of-tree Makefile that tries
to be smart and detect the source code location plus a few other
things based on the current distro. We don't need any of this since
we're adding the driver as an in-tree module, so get rid of it.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: SAUCE: bnxt_en_bpo: Import bnxt_en driver version 1.8.1
Juerg Haefliger [Thu, 17 Aug 2017 11:32:00 +0000 (13:32 +0200)]
UBUNTU: SAUCE: bnxt_en_bpo: Import bnxt_en driver version 1.8.1

BugLink: http://bugs.launchpad.net/bugs/1711056
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: SAUCE: HID: multitouch: Support ALPS PTP stick with pid 0x120A
Shrirang Bagul [Wed, 23 Aug 2017 15:40:00 +0000 (17:40 +0200)]
UBUNTU: SAUCE: HID: multitouch: Support ALPS PTP stick with pid 0x120A

BugLink:  https://bugs.launchpad.net/bugs/1712481

This patch adds ALPS PTP sticks with pid/device id 0x120A to the list of
devices supported by hid-multitouch.

Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Colin King <colin.king@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoHID: multitouch: Support PTP Stick and Touchpad device
Masaki Ota [Wed, 23 Aug 2017 15:40:00 +0000 (17:40 +0200)]
HID: multitouch: Support PTP Stick and Touchpad device

BugLink:  https://bugs.launchpad.net/bugs/1712481

Support PTP Stick and Touchpad device. This Touchpad is Precision Touchpad
(PTP), and Stick Pointer data is the same as Mouse; Stick Pointer works as
Mouse.

[jkosina@suse.cz: changelog deuglification]
Signed-off-by: Masaki Ota <masaki.ota@jp.alps.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
(cherry picked from commit 504c932c7c47a6b4c572302a13873f7d83af1ff3)
Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Colin King <colin.king@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoUBUNTU: SAUCE: igb: add support for using Broadcom 54616 as PHY
Wen-chien Jesse Sung [Mon, 21 Aug 2017 09:11:00 +0000 (11:11 +0200)]
UBUNTU: SAUCE: igb: add support for using Broadcom 54616 as PHY

BugLink: https://launchpad.net/bugs/1712024
Ported from packages/base/any/kernels/3.18.25/patches/driver-support-intel-igb-bcm54616-phy.patch
in OpenNetworkLinux https://github.com/opencomputeproject/OpenNetworkLinux/

Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-By: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoscsi: ipr: do not set DID_PASSTHROUGH on CHECK CONDITION
Mauricio Faria de Oliveira [Fri, 18 Aug 2017 16:18:00 +0000 (18:18 +0200)]
scsi: ipr: do not set DID_PASSTHROUGH on CHECK CONDITION

BugLink: http://bugs.launchpad.net/bugs/1682644
On a dual controller setup with multipath enabled, some MEDIUM ERRORs
caused both paths to be failed, thus I/O got queued/blocked since the
'queue_if_no_path' feature is enabled by default on IPR controllers.

This example disabled 'queue_if_no_path' so the I/O failure is seen at
the sg_dd program.  Notice that after the sg_dd test-case, both paths
are in 'failed' state, and both path/priority groups are in 'enabled'
state (not 'active') -- which would block I/O with 'queue_if_no_path'.

    # sg_dd if=/dev/dm-2 bs=4096 count=1 dio=1 verbose=4 blk_sgio=0
    <...>
    read(unix): count=4096, res=-1
    sg_dd: reading, skip=0 : Input/output error
    <...>

    # dmesg
    [...] sd 2:2:16:0: [sds] FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
    [...] sd 2:2:16:0: [sds] Sense Key : Medium Error [current]
    [...] sd 2:2:16:0: [sds] Add. Sense: Unrecovered read error - recommend rewrite the data
    [...] sd 2:2:16:0: [sds] CDB: Read(10) 28 00 00 00 00 00 00 00 20 00
    [...] blk_update_request: I/O error, dev sds, sector 0
    [...] device-mapper: multipath: Failing path 65:32.
    <...>
    [...] device-mapper: multipath: Failing path 65:224.

    # multipath -l
    1IBM_IPR-0_59C2AE0000001F80 dm-2 IBM     ,IPR-0   59C2AE00
    size=5.2T features='0' hwhandler='1 alua' wp=rw
    |-+- policy='service-time 0' prio=0 status=enabled
    | `- 2:2:16:0 sds  65:32  failed undef running
    `-+- policy='service-time 0' prio=0 status=enabled
      `- 1:2:7:0  sdae 65:224 failed undef running

This is not the desired behavior. The dm-multipath explicitly checks
for the MEDIUM ERROR case (and a few others) so not to fail the path
(e.g., I/O to other sectors could potentially happen without problems).
See dm-mpath.c :: do_end_io_bio() -> noretry_error() !->! fail_path().

The problem trace is:

1) ipr_scsi_done()  // SENSE KEY/CHECK CONDITION detected, go to..
2) ipr_erp_start()  // ipr_is_gscsi() and masked_ioasc OK, go to..
3) ipr_gen_sense()  // masked_ioasc is IPR_IOASC_MED_DO_NOT_REALLOC,
                    // so set DID_PASSTHROUGH.

4) scsi_decide_disposition()  // check for DID_PASSTHROUGH and return
                              // early on, faking a DID_OK.. *instead*
                              // of reaching scsi_check_sense().

                              // Had it reached the latter, that would
                              // set host_byte to DID_MEDIUM_ERROR.

5) scsi_finish_command()
6) scsi_io_completion()
7) __scsi_error_from_host_byte()  // That would be converted to -ENODATA
<...>
8) dm_softirq_done()
9) multipath_end_io()
10) do_end_io()
11) noretry_error()  // And that is checked in dm-mpath :: noretry_error()
                     // which would cause fail_path() not to be called.

With this patch applied, the I/O is failed but the paths are not.  This
multipath device continues accepting more I/O requests without blocking.
(and notice the different host byte/driver byte handling per SCSI layer).

    # dmesg
    [...] sd 2:2:7:0: [sdaf] Done: SUCCESS Result: hostbyte=0x13 driverbyte=DRIVER_OK
    [...] sd 2:2:7:0: [sdaf] CDB: Read(10) 28 00 00 00 00 00 00 00 40 00
    [...] sd 2:2:7:0: [sdaf] Sense Key : Medium Error [current]
    [...] sd 2:2:7:0: [sdaf] Add. Sense: Unrecovered read error - recommend rewrite the data
    [...] blk_update_request: critical medium error, dev sdaf, sector 0
    [...] blk_update_request: critical medium error, dev dm-6, sector 0
    [...] sd 2:2:7:0: [sdaf] Done: SUCCESS Result: hostbyte=0x13 driverbyte=DRIVER_OK
    [...] sd 2:2:7:0: [sdaf] CDB: Read(10) 28 00 00 00 00 00 00 00 10 00
    [...] sd 2:2:7:0: [sdaf] Sense Key : Medium Error [current]
    [...] sd 2:2:7:0: [sdaf] Add. Sense: Unrecovered read error - recommend rewrite the data
    [...] blk_update_request: critical medium error, dev sdaf, sector 0
    [...] blk_update_request: critical medium error, dev dm-6, sector 0
    [...] Buffer I/O error on dev dm-6, logical block 0, async page read

    # multipath -l 1IBM_IPR-0_59C2AE0000001F80
    1IBM_IPR-0_59C2AE0000001F80 dm-6 IBM     ,IPR-0   59C2AE00
    size=5.2T features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
    |-+- policy='service-time 0' prio=0 status=active
    | `- 2:2:7:0  sdaf 65:240 active undef running
    `-+- policy='service-time 0' prio=0 status=enabled
      `- 1:2:7:0  sdh  8:112  active undef running

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 785a470496d8e0a32e3d39f376984eb2c98ca5b3)
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Colin King <colin.king@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agotty/hvc: Use IRQF_SHARED for OPAL hvc consoles
Sam Mendoza-Jonas [Fri, 18 Aug 2017 12:22:00 +0000 (14:22 +0200)]
tty/hvc: Use IRQF_SHARED for OPAL hvc consoles

BugLink: http://bugs.launchpad.net/bugs/1711401
Commit 2def86a7200c ("hvc: Convert to using interrupts instead of opal
events") enabled the use of interrupts in the hvc_driver for OPAL
platforms. However on machines with more than one hvc console, any
console after the first will fail to register an interrupt handler in
notifier_add_irq() since all consoles share the same IRQ number but do
not set the IRQF_SHARED flag:

  genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs. 00000000 (hvc_console)
  hvc_open: request_irq failed with rc -16.

This error propagates up to hvc_open() and the console is closed, but
OPAL will still generate interrupts that are not handled, leading to
rcu_sched stall warnings.

Set IRQF_SHARED when calling request_irq(), allowing additional consoles
to start properly. This is only set for consoles handled by
hvc_opal_probe(), leaving other types unaffected.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit bbc3dfe8805de86874b1a1b1429a002e8670043e)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoselftests: fix memory-hotplug test
Po-Hsu Lin [Thu, 10 Aug 2017 06:32:00 +0000 (08:32 +0200)]
selftests: fix memory-hotplug test

BugLink: http://bugs.launchpad.net/bugs/1710868
In the memory offline test, the $ration was used with RANDOM as the
possibility to get it offlined, correct it to become the portion of
available removable memory blocks.

Also ask the tool to try to offline the next available memory block
if the attempt is unsuccessful. It will only fail if all removable
memory blocks are busy.

A nice example:
$ sudo ./test.sh
Test scope: 10% hotplug memory
online all hot-pluggable memory in offline state:
SKIPPED - no hot-pluggable memory in offline state
offline 10% hot-pluggable memory in online state
trying to offline 3 out of 28 memory block(s):
online->offline memory1
online->offline memory10
./test.sh: line 74: echo: write error: Resource temporarily unavailable
offline_memory_expect_success 10: unexpected fail
online->offline memory100
online->offline memory101
online all hot-pluggable memory in offline state:
offline->online memory1
offline->online memory100
offline->online memory101
skip extra tests: debugfs is not mounted
$ echo $?
0

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
(cherry picked from commit 5ff0c60b0e5e8c2a2139c304d7620b0ea70d721a)
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoselftests: add missing test name in memory-hotplug test
Po-Hsu Lin [Thu, 10 Aug 2017 06:32:00 +0000 (08:32 +0200)]
selftests: add missing test name in memory-hotplug test

BugLink: http://bugs.launchpad.net/bugs/1710868
There is no prompt for testing memory notifier error injection,
added with the same echo format of other tests above.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
(cherry picked from commit 02d8f075ac44f6f0dc46881965f815576921f2c0)
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoselftests: check percentage range for memory-hotplug test
Po-Hsu Lin [Thu, 10 Aug 2017 06:32:00 +0000 (08:32 +0200)]
selftests: check percentage range for memory-hotplug test

BugLink: http://bugs.launchpad.net/bugs/1710868
Check the precentage range for -r flag in memory-hotplug test.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
(cherry picked from commit 72441ea5886780d04ac96913e02dba9e84ea80e5)
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoselftests: check hot-pluggagble memory for memory-hotplug test
Po-Hsu Lin [Thu, 10 Aug 2017 06:32:00 +0000 (08:32 +0200)]
selftests: check hot-pluggagble memory for memory-hotplug test

BugLink: http://bugs.launchpad.net/bugs/1710868
Check for hot-pluggable memory availability in prerequisite() of the
memory-hotplug test.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
(cherry picked from commit a34b28c92ec8c92938de03c18c5fab32efd2e29a)
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoselftests: typo correction for memory-hotplug test
Po-Hsu Lin [Thu, 10 Aug 2017 06:32:00 +0000 (08:32 +0200)]
selftests: typo correction for memory-hotplug test

BugLink: http://bugs.launchpad.net/bugs/1710868
Typo fixed for hotpluggable_offline_memory() in memory-hotplug test.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
(cherry picked from commit 593f927851a58fdca559b173c807a0b78c9f6e49)
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agonet: cdc_mbim: apply "NDP to end" quirk to HP lt4132
Tore Anderson [Thu, 17 Aug 2017 11:16:00 +0000 (13:16 +0200)]
net: cdc_mbim: apply "NDP to end" quirk to HP lt4132

BugLink: https://bugs.launchpad.net/bugs/1707643
The HP lt4132 LTE/HSPA+ 4G Module (03f0:a31d) is a rebranded Huawei
ME906s-158 device. It, like the ME906s-158, requires the "NDP to end"
quirk for correct operation.

Signed-off-by: Tore Anderson <tore@fud.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
(backported from commit a68491f895a937778bb25b0795830797239de31f)
Signed-off-by: Aurimas Fišeras <aurimas@members.fsf.org>
Tested-by: Aurimas Fišeras <aurimas@members.fsf.org>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoksm: optimize refile of stable_node_dup at the head of the chain
Andrea Arcangeli [Tue, 18 Jul 2017 12:05:00 +0000 (14:05 +0200)]
ksm: optimize refile of stable_node_dup at the head of the chain

BugLink: http://bugs.launchpad.net/bugs/1680513
If a candidate stable_node_dup has been found and it can accept further
merges it can be refiled to the head of the list to speedup next
searches without altering which dup is found and how the dups accumulate
in the chain.

We already refiled it back to the head in the prune_stale_stable_nodes
case, but we didn't refile it if not pruning (which is more common).
And we also refiled it when it was already at the head which is
unnecessary (in the prune_stale_stable_nodes case, nr > 1 means there's
more than one dup in the chain, it doesn't mean it's not already at the
head of the chain).

The stable_node_chain list is single threaded and there's no SMP locking
contention so it should be faster to refile it to the head of the list
also if prune_stale_stable_nodes is false.

Profiling shows the refile happens 1.9% of the time when a dup is found
with a max_page_sharing limit setting of 3 (with max_page_sharing of 2
the refile never happens of course as there's never space for one more
merge) which is reasonably low.  At higher max_page_sharing values it
should be much less frequent.

This is just an optimization.

Link: http://lkml.kernel.org/r/20170518173721.22316-4-aarcange@redhat.com
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Evgheni Dereveanchin <ederevea@redhat.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Petr Holasek <pholasek@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Gavin Guo <gavin.guo@canonical.com>
Cc: Jay Vosburgh <jay.vosburgh@canonical.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 80b18dfa53bbb03085eba6401f5d29dad49205b7)
Signed-off-by: Gavin Guo <gavin.guo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoksm: swap the two output parameters of chain/chain_prune
Andrea Arcangeli [Tue, 18 Jul 2017 12:05:00 +0000 (14:05 +0200)]
ksm: swap the two output parameters of chain/chain_prune

BugLink: http://bugs.launchpad.net/bugs/1680513
Some static checker complains if chain/chain_prune returns a potentially
stale pointer.

There are two output parameters to chain/chain_prune, one is tree_page
the other is stable_node_dup.  Like in get_ksm_page the caller has to
check tree_page is NULL before touching the stable_node.  Similarly in
chain/chain_prune the caller has to check tree_page before touching the
stable_node_dup returned or the original stable_node passed as
parameter.

Because the tree_page is never returned as a stale pointer, it may be
more intuitive to return tree_page and to pass stable_node_dup for
reference instead of the reverse.

This patch purely swaps the two output parameters of chain/chain_prune
as a cleanup for the static checker and to mimic the get_ksm_page
behavior more closely.  There's no change to the caller at all except
the swap, it's purely a cleanup and it is a noop from the caller point
of view.

Link: http://lkml.kernel.org/r/20170518173721.22316-3-aarcange@redhat.com
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Tested-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Evgheni Dereveanchin <ederevea@redhat.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Petr Holasek <pholasek@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Gavin Guo <gavin.guo@canonical.com>
Cc: Jay Vosburgh <jay.vosburgh@canonical.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 8dc5ffcd5a74da39ed2c533d786a3f78671a38b8)
Signed-off-by: Gavin Guo <gavin.guo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoksm: cleanup stable_node chain collapse case
Andrea Arcangeli [Tue, 18 Jul 2017 12:05:00 +0000 (14:05 +0200)]
ksm: cleanup stable_node chain collapse case

BugLink: http://bugs.launchpad.net/bugs/1680513
Patch series "KSMscale cleanup/optimizations".

There are no fixes here it's just minor cleanups and optimizations.

1/3 removes makes the "fix" for the stale stable_node fall in the
    standard case without introducing new cases.  Setting stable_node to
    NULL was marginally safer, but stale pointer is still wiped from the
    caller, this looks cleaner.

2/3 should fix the false positive from Dan's static checker.

3/3 is a microoptimization to apply the the refile of future merge
    candidate dups at the head of the chain in all cases and to skip it in
    one case where we did it and but it was a noop (to avoid checking if
    it was already at the head but now we've to check it anyway so it got
    optimized away).

This patch (of 3):

When the stable_node chain is collapsed we can as well set the caller
stable_node to match the returned stable_node_dup in chain_prune().

This way the collapse case becomes indistinguishable from the regular
stable_node case and we can remove two branches from the KSM page
migration handling slow paths.

While it was all correct this looks cleaner (and faster) as the caller has
to deal with fewer special cases.

Link: http://lkml.kernel.org/r/20170518173721.22316-2-aarcange@redhat.com
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Evgheni Dereveanchin <ederevea@redhat.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Petr Holasek <pholasek@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Gavin Guo <gavin.guo@canonical.com>
Cc: Jay Vosburgh <jay.vosburgh@canonical.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 0ba1d0f7c41cdab306a3d30e036bc393c3ebba7e)
Signed-off-by: Gavin Guo <gavin.guo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoksm: fix use after free with merge_across_nodes = 0
Andrea Arcangeli [Tue, 18 Jul 2017 12:05:00 +0000 (14:05 +0200)]
ksm: fix use after free with merge_across_nodes = 0

BugLink: http://bugs.launchpad.net/bugs/1680513
If merge_across_nodes was manually set to 0 (not the default value) by
the admin or a tuned profile on NUMA systems triggering cross-NODE page
migrations, a stable_node use after free could materialize.

If the chain is collapsed stable_node would point to the old chain that
was already freed.  stable_node_dup would be the stable_node dup now
converted to a regular stable_node and indexed in the rbtree in
replacement of the freed stable_node chain (not anymore a dup).

This special case where the chain is collapsed in the NUMA replacement
path, is now detected by setting stable_node to NULL by the chain_prune
callee if it decides to collapse the chain.  This tells the NUMA
replacement code that even if stable_node and stable_node_dup are
different, this is not a chain if stable_node is NULL, as the
stable_node_dup was converted to a regular stable_node and the chain was
collapsed.

It is generally safer for the callee to force the caller stable_node to
NULL the moment it become stale so any other mistake like this would
result in an instant Oops easier to debug than an use after free.

Otherwise the replace logic would act like if stable_node was a valid
chain, when in fact it was freed.  Notably
stable_node_chain_add_dup(page_node, stable_node) would run on a stable
stable_node.

Andrey Ryabinin found the source of the use after free in chain_prune().

Link: http://lkml.kernel.org/r/20170512193805.8807-2-aarcange@redhat.com
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Reported-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reported-by: Evgheni Dereveanchin <ederevea@redhat.com>
Tested-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Petr Holasek <pholasek@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Gavin Guo <gavin.guo@canonical.com>
Cc: Jay Vosburgh <jay.vosburgh@canonical.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit b4fecc67cc569b14301f5a1111363d5818b8da5e)
Signed-off-by: Gavin Guo <gavin.guo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
7 years agoksm: introduce ksm_max_page_sharing per page deduplication limit
Andrea Arcangeli [Tue, 18 Jul 2017 12:05:00 +0000 (14:05 +0200)]
ksm: introduce ksm_max_page_sharing per page deduplication limit

BugLink: http://bugs.launchpad.net/bugs/1680513
Without a max deduplication limit for each KSM page, the list of the
rmap_items associated to each stable_node can grow infinitely large.

During the rmap walk each entry can take up to ~10usec to process
because of IPIs for the TLB flushing (both for the primary MMU and the
secondary MMUs with the MMU notifier).  With only 16GB of address space
shared in the same KSM page, that would amount to dozens of seconds of
kernel runtime.

A ~256 max deduplication factor will reduce the latencies of the rmap
walks on KSM pages to order of a few msec.  Just doing the
cond_resched() during the rmap walks is not enough, the list size must
have a limit too, otherwise the caller could get blocked in (schedule
friendly) kernel computations for seconds, unexpectedly.

There's room for optimization to significantly reduce the IPI delivery
cost during the page_referenced(), but at least for page_migration in
the KSM case (used by hard NUMA bindings, compaction and NUMA balancing)
it may be inevitable to send lots of IPIs if each rmap_item->mm is
active on a different CPU and there are lots of CPUs.  Even if we ignore
the IPI delivery cost, we've still to walk the whole KSM rmap list, so
we can't allow millions or billions (ulimited) number of entries in the
KSM stable_node rmap_item lists.

The limit is enforced efficiently by adding a second dimension to the
stable rbtree.  So there are three types of stable_nodes: the regular
ones (identical as before, living in the first flat dimension of the
stable rbtree), the "chains" and the "dups".

Every "chain" and all "dups" linked into a "chain" enforce the invariant
that they represent the same write protected memory content, even if
each "dup" will be pointed by a different KSM page copy of that content.
This way the stable rbtree lookup computational complexity is unaffected
if compared to an unlimited max_sharing_limit.  It is still enforced
that there cannot be KSM page content duplicates in the stable rbtree
itself.

Adding the second dimension to the stable rbtree only after the
max_page_sharing limit hits, provides for a zero memory footprint
increase on 64bit archs.  The memory overhead of the per-KSM page
stable_tree and per virtual mapping rmap_item is unchanged.  Only after
the max_page_sharing limit hits, we need to allocate a stable_tree
"chain" and rb_replace() the "regular" stable_node with the newly
allocated stable_node "chain".  After that we simply add the "regular"
stable_node to the chain as a stable_node "dup" by linking hlist_dup in
the stable_node_chain->hlist.  This way the "regular" (flat) stable_node
is converted to a stable_node "dup" living in the second dimension of
the stable rbtree.

During stable rbtree lookups the stable_node "chain" is identified as
stable_node->rmap_hlist_len == STABLE_NODE_CHAIN (aka
is_stable_node_chain()).

When dropping stable_nodes, the stable_node "dup" is identified as
stable_node->head == STABLE_NODE_DUP_HEAD (aka is_stable_node_dup()).

The STABLE_NODE_DUP_HEAD must be an unique valid pointer never used
elsewhere in any stable_node->head/node to avoid a clashes with the
stable_node->node.rb_parent_color pointer, and different from
&migrate_nodes.  So the second field of &migrate_nodes is picked and
verified as always safe with a BUILD_BUG_ON in case the list_head
implementation changes in the future.

The STABLE_NODE_DUP is picked as a random negative value in
stable_node->rmap_hlist_len.  rmap_hlist_len cannot become negative when
it's a "regular" stable_node or a stable_node "dup".

The stable_node_chain->nid is irrelevant.  The stable_node_chain->kpfn
is aliased in a union with a time field used to rate limit the
stable_node_chain->hlist prunes.

The garbage collection of the stable_node_chain happens lazily during
stable rbtree lookups (as for all other kind of stable_nodes), or while
disabling KSM with "echo 2 >/sys/kernel/mm/ksm/run" while collecting the
entire stable rbtree.

While the "regular" stable_nodes and the stable_node "dups" must wait
for their underlying tree_page to be freed before they can be freed
themselves, the stable_node "chains" can be freed immediately if the
stable_node->hlist turns empty.  This is because the "chains" are never
pointed by any page->mapping and they're effectively stable rbtree KSM
self contained metadata.

[akpm@linux-foundation.org: fix non-NUMA build]
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Tested-by: Petr Holasek <pholasek@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Evgheni Dereveanchin <ederevea@redhat.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Gavin Guo <gavin.guo@canonical.com>
Cc: Jay Vosburgh <jay.vosburgh@canonical.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(backported from commit 2c653d0ee2ae78ff3a174cc877a057c8afac7069)
Signed-off-by: Gavin Guo <gavin.guo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>