--- /dev/null
+ftrace-x86-set-ftrace_stub-to-weak-to-prevent-gcc-from-using-short-jumps-to-it.patch
+ib-mlx5-avoid-system-crash-when-enabling-many-vfs.patch
+ib-mlx5-fix-reported-max-sge-calculation.patch
+ib-mlx5-wait-for-all-async-command-completions-to-complete.patch
+ib-mlx4-set-traffic-class-in-ah.patch
+ib-mlx4-fix-out-of-range-array-index-in-destroy-qp-flow.patch
+ib-mlx4-handle-well-known-gid-in-mad_demux-processing.patch
+ib-mlx4-fix-port-query-for-56gb-ethernet-links.patch
+ib-mlx4-when-no-dmfs-for-ipoib-don-t-allow-net_if-qps.patch
+ib-ipoib-remove-can-t-use-gfp_noio-warning.patch
+perf-scripting-avoid-leaking-the-scripting_context-variable.patch
+arm-dts-imx31-fix-clock-control-module-interrupts-description.patch
+arm-dts-imx31-move-ccm-device-node-to-aips2-bus-devices.patch
+arm-dts-imx31-fix-avic-base-address.patch
--- /dev/null
+From 7d891a685dd46b925cf25b74ada0280a2531c34f Mon Sep 17 00:00:00 2001
+From: Stefan Wahren <stefan.wahren@i2se.com>
+Date: Sun, 30 Oct 2016 17:22:19 +0000
+Subject: ARM: dts: bcm283x: fix typo in mailbox address
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Stefan Wahren <stefan.wahren@i2se.com>
+
+commit 7d891a685dd46b925cf25b74ada0280a2531c34f upstream.
+
+The address of the mailbox node in the bcm283x.dtsi also has a typo.
+So fix it accordingly.
+
+Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
+Reviewed-by: Andreas Färber <afaerber@suse.de>
+Fixes: 05b682b7a3b2 ("ARM: bcm2835: dt: Add the mailbox to the device tree")
+Signed-off-by: Eric Anholt <eric@anholt.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/boot/dts/bcm283x.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm/boot/dts/bcm283x.dtsi
++++ b/arch/arm/boot/dts/bcm283x.dtsi
+@@ -104,7 +104,7 @@
+ reg = <0x7e104000 0x10>;
+ };
+
+- mailbox: mailbox@7e00b800 {
++ mailbox: mailbox@7e00b880 {
+ compatible = "brcm,bcm2835-mbox";
+ reg = <0x7e00b880 0x40>;
+ interrupts = <0 1>;
--- /dev/null
+From af92305e567b7f4c9cf48b9e46c1f48ec9ffb1fb Mon Sep 17 00:00:00 2001
+From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
+Date: Thu, 17 Nov 2016 03:30:51 +0200
+Subject: ARM: dts: imx31: fix AVIC base address
+
+From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
+
+commit af92305e567b7f4c9cf48b9e46c1f48ec9ffb1fb upstream.
+
+On i.MX31 AVIC interrupt controller base address is at 0x68000000.
+
+The problem was shadowed by the AVIC driver, which takes the correct
+base address from a SoC specific header file.
+
+Fixes: d2a37b3d91f4 ("ARM i.MX31: Add devicetree support")
+Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
+Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/boot/dts/imx31.dtsi | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/boot/dts/imx31.dtsi
++++ b/arch/arm/boot/dts/imx31.dtsi
+@@ -30,11 +30,11 @@
+ };
+ };
+
+- avic: avic-interrupt-controller@60000000 {
++ avic: interrupt-controller@68000000 {
+ compatible = "fsl,imx31-avic", "fsl,avic";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+- reg = <0x60000000 0x100000>;
++ reg = <0x68000000 0x100000>;
+ };
+
+ soc {
--- /dev/null
+From 2e575cbc930901718cc18e084566ecbb9a4b5ebb Mon Sep 17 00:00:00 2001
+From: Vladimir Zapolskiy <vz@mleia.com>
+Date: Mon, 26 Sep 2016 03:03:40 +0300
+Subject: ARM: dts: imx31: fix clock control module interrupts description
+
+From: Vladimir Zapolskiy <vz@mleia.com>
+
+commit 2e575cbc930901718cc18e084566ecbb9a4b5ebb upstream.
+
+The type of AVIC interrupt controller found on i.MX31 is one-cell,
+namely 31 for CCM DVFS and 53 for CCM, however for clock control
+module its interrupts are specified as 3-cells, fix it.
+
+Fixes: ef0e4a606fb6 ("ARM: mx31: Replace clk_register_clkdev with clock DT lookup")
+Acked-by: Rob Herring <robh@kernel.org>
+Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Documentation/devicetree/bindings/clock/imx31-clock.txt | 2 +-
+ arch/arm/boot/dts/imx31.dtsi | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/Documentation/devicetree/bindings/clock/imx31-clock.txt
++++ b/Documentation/devicetree/bindings/clock/imx31-clock.txt
+@@ -77,7 +77,7 @@ Examples:
+ clks: ccm@53f80000{
+ compatible = "fsl,imx31-ccm";
+ reg = <0x53f80000 0x4000>;
+- interrupts = <0 31 0x04 0 53 0x04>;
++ interrupts = <31>, <53>;
+ #clock-cells = <1>;
+ };
+
+--- a/arch/arm/boot/dts/imx31.dtsi
++++ b/arch/arm/boot/dts/imx31.dtsi
+@@ -122,7 +122,7 @@
+ clks: ccm@53f80000{
+ compatible = "fsl,imx31-ccm";
+ reg = <0x53f80000 0x4000>;
+- interrupts = <0 31 0x04 0 53 0x04>;
++ interrupts = <31>, <53>;
+ #clock-cells = <1>;
+ };
+ };
--- /dev/null
+From 1f87aee6a2e55eda466a43ba6248a8b75eede153 Mon Sep 17 00:00:00 2001
+From: Vladimir Zapolskiy <vz@mleia.com>
+Date: Mon, 26 Sep 2016 03:03:41 +0300
+Subject: ARM: dts: imx31: move CCM device node to AIPS2 bus devices
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Vladimir Zapolskiy <vz@mleia.com>
+
+commit 1f87aee6a2e55eda466a43ba6248a8b75eede153 upstream.
+
+i.MX31 Clock Control Module controller is found on AIPS2 bus, move it
+there from SPBA bus to avoid a conflict of device IO space mismatch.
+
+Fixes: ef0e4a606fb6 ("ARM: mx31: Replace clk_register_clkdev with clock DT lookup")
+Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
+Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/boot/dts/imx31.dtsi | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+--- a/arch/arm/boot/dts/imx31.dtsi
++++ b/arch/arm/boot/dts/imx31.dtsi
+@@ -118,13 +118,6 @@
+ interrupts = <19>;
+ clocks = <&clks 25>;
+ };
+-
+- clks: ccm@53f80000{
+- compatible = "fsl,imx31-ccm";
+- reg = <0x53f80000 0x4000>;
+- interrupts = <31>, <53>;
+- #clock-cells = <1>;
+- };
+ };
+
+ aips@53f00000 { /* AIPS2 */
+@@ -134,6 +127,13 @@
+ reg = <0x53f00000 0x100000>;
+ ranges;
+
++ clks: ccm@53f80000{
++ compatible = "fsl,imx31-ccm";
++ reg = <0x53f80000 0x4000>;
++ interrupts = <31>, <53>;
++ #clock-cells = <1>;
++ };
++
+ gpt: timer@53f90000 {
+ compatible = "fsl,imx31-gpt";
+ reg = <0x53f90000 0x4000>;
--- /dev/null
+From 72649a46067903d00f46e2ebef6543768224f1a0 Mon Sep 17 00:00:00 2001
+From: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
+Date: Fri, 11 Nov 2016 16:59:38 +0100
+Subject: ARM: dts: imx6q-cm-fx6: fix fec pinctrl
+
+From: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
+
+commit 72649a46067903d00f46e2ebef6543768224f1a0 upstream.
+
+According to the schematics of CompuLab's sbc-fx6 baseboard and the
+vendor devicetree GPIO_16 is *not* muxed to ENET_REF_CLK but to SPDIF_IN.
+
+Remove the wrong pinctrl setting.
+
+Fixes: 682d055e6ac5 ("ARM: dts: Add initial support for cm-fx6.")
+Signed-off-by: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/boot/dts/imx6q-cm-fx6.dts | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/arch/arm/boot/dts/imx6q-cm-fx6.dts
++++ b/arch/arm/boot/dts/imx6q-cm-fx6.dts
+@@ -183,7 +183,6 @@
+ MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
+ MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
+ MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
+- MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
+ >;
+ };
+
--- /dev/null
+From 7245f67f86e847769f41dacad26bb8f5b5d74bf4 Mon Sep 17 00:00:00 2001
+From: Adam Ford <aford173@gmail.com>
+Date: Sat, 3 Dec 2016 04:57:23 -0600
+Subject: ARM: dts: omap3: Add DTS for Logic PD SOM-LV 37xx Dev Kit
+
+From: Adam Ford <aford173@gmail.com>
+
+commit 7245f67f86e847769f41dacad26bb8f5b5d74bf4 upstream.
+
+Fixes: ("ab8dd3aed011 ARM: DTS: Add minimal Support for Logic PD
+DM3730 SOM-LV")
+
+This adds the dts file into the Makefile. This should have been included in
+the original patch.
+
+V2: Update patch description - same source code
+V1: Original patch
+
+Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
+Signed-off-by: Adam Ford <aford173@gmail.com>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/boot/dts/Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -485,6 +485,7 @@ dtb-$(CONFIG_ARCH_OMAP3) += \
+ am3517-evm.dtb \
+ am3517_mt_ventoux.dtb \
+ logicpd-torpedo-37xx-devkit.dtb \
++ logicpd-som-lv-37xx-devkit.dtb \
+ omap3430-sdp.dtb \
+ omap3-beagle.dtb \
+ omap3-beagle-xm.dtb \
--- /dev/null
+From 68cc085a4daaa32f7138de1e918331c05165a484 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Sun, 30 Oct 2016 00:31:27 +0300
+Subject: ARM: dts: r8a7794: remove Z clock
+
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+
+commit 68cc085a4daaa32f7138de1e918331c05165a484 upstream.
+
+R8A7794 doesn't have Cortex-A15 CPUs, thus there's no Z clock...
+
+Fixes: 0dce5454d5c2 ("ARM: shmobile: Initial r8a7794 SoC device tree")
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/boot/dts/r8a7794.dtsi | 3 +--
+ include/dt-bindings/clock/r8a7794-clock.h | 3 +--
+ 2 files changed, 2 insertions(+), 4 deletions(-)
+
+--- a/arch/arm/boot/dts/r8a7794.dtsi
++++ b/arch/arm/boot/dts/r8a7794.dtsi
+@@ -1025,8 +1025,7 @@
+ clocks = <&extal_clk &usb_extal_clk>;
+ #clock-cells = <1>;
+ clock-output-names = "main", "pll0", "pll1", "pll3",
+- "lb", "qspi", "sdh", "sd0", "z",
+- "rcan";
++ "lb", "qspi", "sdh", "sd0", "rcan";
+ #power-domain-cells = <0>;
+ };
+ /* Variable factor clocks */
+--- a/include/dt-bindings/clock/r8a7794-clock.h
++++ b/include/dt-bindings/clock/r8a7794-clock.h
+@@ -20,8 +20,7 @@
+ #define R8A7794_CLK_QSPI 5
+ #define R8A7794_CLK_SDH 6
+ #define R8A7794_CLK_SD0 7
+-#define R8A7794_CLK_Z 8
+-#define R8A7794_CLK_RCAN 9
++#define R8A7794_CLK_RCAN 8
+
+ /* MSTP0 */
+ #define R8A7794_CLK_MSIOF0 0
--- /dev/null
+From 24b2d930a50662c11918fd0c22931f1448488da4 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Mon, 7 Nov 2016 20:10:04 +0100
+Subject: ARM: dts: r8a7794: Use SYSC "always-on" PM Domain for sound
+
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+
+commit 24b2d930a50662c11918fd0c22931f1448488da4 upstream.
+
+Hook up the Audio-DMAC and sound device nodes to the SYSC "always-on" PM
+Domain, for a more consistent device-power-area description in DT.
+
+Cfr. commit 0761ff2ad0c581f3 ("ARM: dts: r8a7794: Add SYSC PM Domains").
+
+Fixes: 320d6c5a08a4abd3 ("ARM: dts: r8a7794: add sound support")
+Fixes: 298e4ee3d213a076 ("ARM: dts: r8a7794: add Audio-DMAC support")
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/boot/dts/r8a7794.dtsi | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/boot/dts/r8a7794.dtsi
++++ b/arch/arm/boot/dts/r8a7794.dtsi
+@@ -319,7 +319,7 @@
+ "ch12";
+ clocks = <&mstp5_clks R8A7794_CLK_AUDIO_DMAC0>;
+ clock-names = "fck";
+- power-domains = <&cpg_clocks>;
++ power-domains = <&sysc R8A7794_PD_ALWAYS_ON>;
+ #dma-cells = <1>;
+ dma-channels = <13>;
+ };
+@@ -1483,7 +1483,7 @@
+ "mix.0", "mix.1",
+ "dvc.0", "dvc.1",
+ "clk_a", "clk_b", "clk_c", "clk_i";
+- power-domains = <&cpg_clocks>;
++ power-domains = <&sysc R8A7794_PD_ALWAYS_ON>;
+
+ status = "disabled";
+
--- /dev/null
+From aa6aae38f7fb2c030f326a6dd10b58fff1851dfa Mon Sep 17 00:00:00 2001
+From: Leon Romanovsky <leon@kernel.org>
+Date: Thu, 3 Nov 2016 16:44:11 +0200
+Subject: IB/core: Release allocated memory in cache setup failure
+
+From: Leon Romanovsky <leon@kernel.org>
+
+commit aa6aae38f7fb2c030f326a6dd10b58fff1851dfa upstream.
+
+The failure in ib_cache_setup_one function during
+ib_register_device will leave leaked allocated memory.
+
+Fixes: 03db3a2d81e6 ("IB/core: Add RoCE GID table management")
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/core/cache.c | 16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -770,12 +770,8 @@ static int _gid_table_setup_one(struct i
+ int err = 0;
+
+ table = kcalloc(ib_dev->phys_port_cnt, sizeof(*table), GFP_KERNEL);
+-
+- if (!table) {
+- pr_warn("failed to allocate ib gid cache for %s\n",
+- ib_dev->name);
++ if (!table)
+ return -ENOMEM;
+- }
+
+ for (port = 0; port < ib_dev->phys_port_cnt; port++) {
+ u8 rdma_port = port + rdma_start_port(ib_dev);
+@@ -1170,14 +1166,13 @@ int ib_cache_setup_one(struct ib_device
+ GFP_KERNEL);
+ if (!device->cache.pkey_cache ||
+ !device->cache.lmc_cache) {
+- pr_warn("Couldn't allocate cache for %s\n", device->name);
+- return -ENOMEM;
++ err = -ENOMEM;
++ goto free;
+ }
+
+ err = gid_table_setup_one(device);
+ if (err)
+- /* Allocated memory will be cleaned in the release function */
+- return err;
++ goto free;
+
+ for (p = 0; p <= rdma_end_port(device) - rdma_start_port(device); ++p)
+ ib_cache_update(device, p + rdma_start_port(device));
+@@ -1192,6 +1187,9 @@ int ib_cache_setup_one(struct ib_device
+
+ err:
+ gid_table_cleanup_one(device);
++free:
++ kfree(device->cache.pkey_cache);
++ kfree(device->cache.lmc_cache);
+ return err;
+ }
+
--- /dev/null
+From 0b59970e7d96edcb3c7f651d9d48e1a59af3c3b0 Mon Sep 17 00:00:00 2001
+From: Kamal Heib <kamalh@mellanox.com>
+Date: Thu, 10 Nov 2016 10:16:48 +0200
+Subject: IB/IPoIB: Remove can't use GFP_NOIO warning
+
+From: Kamal Heib <kamalh@mellanox.com>
+
+commit 0b59970e7d96edcb3c7f651d9d48e1a59af3c3b0 upstream.
+
+Remove the warning print of "can't use of GFP_NOIO" to avoid prints in
+each QP creation when devices aren't supporting IB_QP_CREATE_USE_GFP_NOIO.
+
+This print become more annoying when the IPoIB interface is configured
+to work in connected mode.
+
+Fixes: 09b93088d750 ('IB: Add a QP creation flag to use GFP_NOIO allocations')
+Signed-off-by: Kamal Heib <kamalh@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+@@ -1054,8 +1054,6 @@ static struct ib_qp *ipoib_cm_create_tx_
+
+ tx_qp = ib_create_qp(priv->pd, &attr);
+ if (PTR_ERR(tx_qp) == -EINVAL) {
+- ipoib_warn(priv, "can't use GFP_NOIO for QPs on device %s, using GFP_KERNEL\n",
+- priv->ca->name);
+ attr.create_flags &= ~IB_QP_CREATE_USE_GFP_NOIO;
+ tx_qp = ib_create_qp(priv->pd, &attr);
+ }
--- /dev/null
+From bf08e884bfd5be068fd2ccf2bc450f085d8dd853 Mon Sep 17 00:00:00 2001
+From: Eran Ben Elisha <eranbe@mellanox.com>
+Date: Thu, 10 Nov 2016 11:31:01 +0200
+Subject: IB/mlx4: Check if GRH is available before using it
+
+From: Eran Ben Elisha <eranbe@mellanox.com>
+
+commit bf08e884bfd5be068fd2ccf2bc450f085d8dd853 upstream.
+
+Before reading GRH attributes, need to make sure AH contains GRH,
+and in addition, initialize GID type.
+
+Fixes: dbf727de7440 ('IB/core: Use GID table in AH creation and dmac resolution')
+Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
+Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
+Reviewed-by: Mark Bloch <markb@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx4/qp.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/infiniband/hw/mlx4/qp.c
++++ b/drivers/infiniband/hw/mlx4/qp.c
+@@ -1765,14 +1765,14 @@ static int __mlx4_ib_modify_qp(struct ib
+ u8 port_num = mlx4_is_bonded(to_mdev(ibqp->device)->dev) ? 1 :
+ attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
+ union ib_gid gid;
+- struct ib_gid_attr gid_attr;
++ struct ib_gid_attr gid_attr = {.gid_type = IB_GID_TYPE_IB};
+ u16 vlan = 0xffff;
+ u8 smac[ETH_ALEN];
+ int status = 0;
+ int is_eth = rdma_cap_eth_ah(&dev->ib_dev, port_num) &&
+ attr->ah_attr.ah_flags & IB_AH_GRH;
+
+- if (is_eth) {
++ if (is_eth && attr->ah_attr.ah_flags & IB_AH_GRH) {
+ int index = attr->ah_attr.grh.sgid_index;
+
+ status = ib_get_cached_gid(ibqp->device, port_num,
--- /dev/null
+From c482af646d0809a8d5e1b7f4398cce3592589b98 Mon Sep 17 00:00:00 2001
+From: Jack Morgenstein <jackm@dev.mellanox.co.il>
+Date: Sun, 27 Nov 2016 15:18:19 +0200
+Subject: IB/mlx4: Fix out-of-range array index in destroy qp flow
+
+From: Jack Morgenstein <jackm@dev.mellanox.co.il>
+
+commit c482af646d0809a8d5e1b7f4398cce3592589b98 upstream.
+
+For non-special QPs, the port value becomes non-zero only at the
+RESET-to-INIT transition. If the QP has not undergone that transition,
+its port number value is still zero.
+
+If such a QP is destroyed before being moved out of the RESET state,
+subtracting one from the qp port number results in a negative value.
+Using that negative value as an index into the qp1_proxy array
+results in an out-of-bounds array reference.
+
+Fix this by testing that the QP type is one that uses qp1_proxy before
+using the port number. For special QPs of all types, the port number is
+specified at QP creation time.
+
+Fixes: 9433c188915c ("IB/mlx4: Invoke UPDATE_QP for proxy QP1 on MAC changes")
+Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx4/qp.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/infiniband/hw/mlx4/qp.c
++++ b/drivers/infiniband/hw/mlx4/qp.c
+@@ -1280,7 +1280,8 @@ static int _mlx4_ib_destroy_qp(struct ib
+ if (is_qp0(dev, mqp))
+ mlx4_CLOSE_PORT(dev->dev, mqp->port);
+
+- if (dev->qp1_proxy[mqp->port - 1] == mqp) {
++ if (mqp->mlx4_ib_qp_type == MLX4_IB_QPT_PROXY_GSI &&
++ dev->qp1_proxy[mqp->port - 1] == mqp) {
+ mutex_lock(&dev->qp1_proxy_lock[mqp->port - 1]);
+ dev->qp1_proxy[mqp->port - 1] = NULL;
+ mutex_unlock(&dev->qp1_proxy_lock[mqp->port - 1]);
--- /dev/null
+From 6fa26208206c406fa529cd73f7ae6bf4181e270b Mon Sep 17 00:00:00 2001
+From: Saeed Mahameed <saeedm@mellanox.com>
+Date: Thu, 10 Nov 2016 11:30:59 +0200
+Subject: IB/mlx4: Fix port query for 56Gb Ethernet links
+
+From: Saeed Mahameed <saeedm@mellanox.com>
+
+commit 6fa26208206c406fa529cd73f7ae6bf4181e270b upstream.
+
+Report the correct speed in the port attributes when using a 56Gbps
+ethernet link. Without this change the field is incorrectly set to 10.
+
+Fixes: a9c766bb75ee ('IB/mlx4: Fix info returned when querying IBoE ports')
+Fixes: 2e96691c31ec ('IB: Use central enum for speed instead of hard-coded values')
+Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
+Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
+Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx4/main.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/infiniband/hw/mlx4/main.c
++++ b/drivers/infiniband/hw/mlx4/main.c
+@@ -697,9 +697,11 @@ static int eth_link_query_port(struct ib
+ if (err)
+ goto out;
+
+- props->active_width = (((u8 *)mailbox->buf)[5] == 0x40) ?
+- IB_WIDTH_4X : IB_WIDTH_1X;
+- props->active_speed = IB_SPEED_QDR;
++ props->active_width = (((u8 *)mailbox->buf)[5] == 0x40) ||
++ (((u8 *)mailbox->buf)[5] == 0x20 /*56Gb*/) ?
++ IB_WIDTH_4X : IB_WIDTH_1X;
++ props->active_speed = (((u8 *)mailbox->buf)[5] == 0x20 /*56Gb*/) ?
++ IB_SPEED_FDR : IB_SPEED_QDR;
+ props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_IP_BASED_GIDS;
+ props->gid_tbl_len = mdev->dev->caps.gid_table_len[port];
+ props->max_msg_sz = mdev->dev->caps.max_msg_sz;
--- /dev/null
+From befcabcd530e4ffb6f016638f693b7d94986d2ba Mon Sep 17 00:00:00 2001
+From: Jack Morgenstein <jackm@dev.mellanox.co.il>
+Date: Thu, 10 Nov 2016 11:30:57 +0200
+Subject: IB/mlx4: Handle well-known-gid in mad_demux processing
+
+From: Jack Morgenstein <jackm@dev.mellanox.co.il>
+
+commit befcabcd530e4ffb6f016638f693b7d94986d2ba upstream.
+
+If OpenSM runs over a ConnectX-3, and there are ConnectX-4 or Connect-IB
+VFs active on the network, the OpenSM will receive QP1 packets containing
+a GRH where the destination GID is the "Well-Known GID" -- which is not a
+GID in the HCA Port's GID Table.
+
+This GID must be tested-for separately -- and packets which contain
+this destination GID should be routed to slave 0 (the PF).
+
+Fixes: 37bfc7c1e83f ('IB/mlx4: SR-IOV multiplex and demultiplex MADs')
+Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
+Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx4/mad.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+--- a/drivers/infiniband/hw/mlx4/mad.c
++++ b/drivers/infiniband/hw/mlx4/mad.c
+@@ -702,10 +702,18 @@ static int mlx4_ib_demux_mad(struct ib_d
+
+ /* If a grh is present, we demux according to it */
+ if (wc->wc_flags & IB_WC_GRH) {
+- slave = mlx4_ib_find_real_gid(ibdev, port, grh->dgid.global.interface_id);
+- if (slave < 0) {
+- mlx4_ib_warn(ibdev, "failed matching grh\n");
+- return -ENOENT;
++ if (grh->dgid.global.interface_id ==
++ cpu_to_be64(IB_SA_WELL_KNOWN_GUID) &&
++ grh->dgid.global.subnet_prefix == cpu_to_be64(
++ atomic64_read(&dev->sriov.demux[port - 1].subnet_prefix))) {
++ slave = 0;
++ } else {
++ slave = mlx4_ib_find_real_gid(ibdev, port,
++ grh->dgid.global.interface_id);
++ if (slave < 0) {
++ mlx4_ib_warn(ibdev, "failed matching grh\n");
++ return -ENOENT;
++ }
+ }
+ }
+ /* Class-specific handling */
--- /dev/null
+From af4295c117b82a521b05d0daf39ce879d26e6cb1 Mon Sep 17 00:00:00 2001
+From: Maor Gottlieb <maorg@mellanox.com>
+Date: Thu, 10 Nov 2016 11:30:53 +0200
+Subject: IB/mlx4: Set traffic class in AH
+
+From: Maor Gottlieb <maorg@mellanox.com>
+
+commit af4295c117b82a521b05d0daf39ce879d26e6cb1 upstream.
+
+Set traffic class within sl_tclass_flowlabel when create iboe AH.
+Without this the TOS value will be empty when running VLAN tagged
+traffic, because the TOS value is taken from the traffic class in the
+address handle attributes.
+
+Fixes: 9106c4106974 ('IB/mlx4: Fix SL to 802.1Q priority-bits mapping for IBoE')
+Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
+Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
+Reviewed-by: Mark Bloch <markb@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx4/ah.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/infiniband/hw/mlx4/ah.c
++++ b/drivers/infiniband/hw/mlx4/ah.c
+@@ -114,7 +114,9 @@ static struct ib_ah *create_iboe_ah(stru
+ !(1 << ah->av.eth.stat_rate & dev->caps.stat_rate_support))
+ --ah->av.eth.stat_rate;
+ }
+-
++ ah->av.eth.sl_tclass_flowlabel |=
++ cpu_to_be32((ah_attr->grh.traffic_class << 20) |
++ ah_attr->grh.flow_label);
+ /*
+ * HW requires multicast LID so we just choose one.
+ */
+@@ -122,7 +124,7 @@ static struct ib_ah *create_iboe_ah(stru
+ ah->av.ib.dlid = cpu_to_be16(0xc000);
+
+ memcpy(ah->av.eth.dgid, ah_attr->grh.dgid.raw, 16);
+- ah->av.eth.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 29);
++ ah->av.eth.sl_tclass_flowlabel |= cpu_to_be32(ah_attr->sl << 29);
+
+ return &ah->ibah;
+ }
--- /dev/null
+From 1f22e454df2eb99ba6b7ace3f594f6805cdf5cbc Mon Sep 17 00:00:00 2001
+From: Eran Ben Elisha <eranbe@mellanox.com>
+Date: Thu, 10 Nov 2016 11:31:00 +0200
+Subject: IB/mlx4: When no DMFS for IPoIB, don't allow NET_IF QPs
+
+From: Eran Ben Elisha <eranbe@mellanox.com>
+
+commit 1f22e454df2eb99ba6b7ace3f594f6805cdf5cbc upstream.
+
+According to the firmware spec, FLOW_STEERING_IB_UC_QP_RANGE command is
+supported only if dmfs_ipoib bit is set.
+
+If it isn't set we want to ensure allocating NET_IF QPs fail. We do so
+by filling out the allocation bitmap. By thus, the NET_IF QPs allocating
+function won't find any free QP and will fail.
+
+Fixes: c1c98501121e ('IB/mlx4: Add support for steerable IB UD QPs')
+Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
+Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
+Reviewed-by: Mark Bloch <markb@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx4/main.c | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+--- a/drivers/infiniband/hw/mlx4/main.c
++++ b/drivers/infiniband/hw/mlx4/main.c
+@@ -2822,14 +2822,19 @@ static void *mlx4_ib_add(struct mlx4_dev
+ goto err_steer_qp_release;
+ }
+
+- bitmap_zero(ibdev->ib_uc_qpns_bitmap, ibdev->steer_qpn_count);
+-
+- err = mlx4_FLOW_STEERING_IB_UC_QP_RANGE(
+- dev, ibdev->steer_qpn_base,
+- ibdev->steer_qpn_base +
+- ibdev->steer_qpn_count - 1);
+- if (err)
+- goto err_steer_free_bitmap;
++ if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_DMFS_IPOIB) {
++ bitmap_zero(ibdev->ib_uc_qpns_bitmap,
++ ibdev->steer_qpn_count);
++ err = mlx4_FLOW_STEERING_IB_UC_QP_RANGE(
++ dev, ibdev->steer_qpn_base,
++ ibdev->steer_qpn_base +
++ ibdev->steer_qpn_count - 1);
++ if (err)
++ goto err_steer_free_bitmap;
++ } else {
++ bitmap_fill(ibdev->ib_uc_qpns_bitmap,
++ ibdev->steer_qpn_count);
++ }
+ }
+
+ for (j = 1; j <= ibdev->dev->caps.num_ports; j++)
--- /dev/null
+From c73b7911de97fad3ab9032a110af48d6ab2da48f Mon Sep 17 00:00:00 2001
+From: Maor Gottlieb <maorg@mellanox.com>
+Date: Sun, 27 Nov 2016 15:18:20 +0200
+Subject: IB/mlx5: Assign SRQ type earlier
+
+From: Maor Gottlieb <maorg@mellanox.com>
+
+commit c73b7911de97fad3ab9032a110af48d6ab2da48f upstream.
+
+Move the SRQ type assignment to be before actually using it
+in create_srq_user() and in create_srq_kernel() functions.
+
+Fixes: af1ba291c5e4 ('{net, IB}/mlx5: Refactor internal SRQ API')
+Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
+Reviewed-by: Majd Dibbiny <majd@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx5/srq.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/infiniband/hw/mlx5/srq.c
++++ b/drivers/infiniband/hw/mlx5/srq.c
+@@ -282,6 +282,7 @@ struct ib_srq *mlx5_ib_create_srq(struct
+ mlx5_ib_dbg(dev, "desc_size 0x%x, req wr 0x%x, srq size 0x%x, max_gs 0x%x, max_avail_gather 0x%x\n",
+ desc_size, init_attr->attr.max_wr, srq->msrq.max, srq->msrq.max_gs,
+ srq->msrq.max_avail_gather);
++ in.type = init_attr->srq_type;
+
+ if (pd->uobject)
+ err = create_srq_user(pd, srq, &in, udata, buf_size);
+@@ -294,7 +295,6 @@ struct ib_srq *mlx5_ib_create_srq(struct
+ goto err_srq;
+ }
+
+- in.type = init_attr->srq_type;
+ in.log_size = ilog2(srq->msrq.max);
+ in.wqe_shift = srq->msrq.wqe_shift - 4;
+ if (srq->wq_sig)
--- /dev/null
+From afd02cd3a9b6c04b41d946b5d7f6e17b3fc30c6b Mon Sep 17 00:00:00 2001
+From: Eli Cohen <eli@mellanox.com>
+Date: Sun, 27 Nov 2016 15:18:21 +0200
+Subject: IB/mlx5: Avoid system crash when enabling many VFs
+
+From: Eli Cohen <eli@mellanox.com>
+
+commit afd02cd3a9b6c04b41d946b5d7f6e17b3fc30c6b upstream.
+
+When enabling many VFs, the total amount of DMA mappings increase
+significantly. This causes DMA allocations to take a lot of time
+since they are serialized in the kernel.
+
+As a result the driver enters into fatal condition due to
+timeout and the system hangs. To recover from this we disable
+MR cache for VFs.
+
+PFs will still have a full cache and VFs cache can be manipulated
+as usual after driver load.
+
+Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
+Signed-off-by: Eli Cohen <eli@mellanox.com>
+Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx5/mr.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/infiniband/hw/mlx5/mr.c
++++ b/drivers/infiniband/hw/mlx5/mr.c
+@@ -628,7 +628,8 @@ int mlx5_mr_cache_init(struct mlx5_ib_de
+ ent->order = i + 2;
+ ent->dev = dev;
+
+- if (dev->mdev->profile->mask & MLX5_PROF_MASK_MR_CACHE)
++ if ((dev->mdev->profile->mask & MLX5_PROF_MASK_MR_CACHE) &&
++ (mlx5_core_is_pf(dev->mdev)))
+ limit = dev->mdev->profile->mr_cache[i].limit;
+ else
+ limit = 0;
--- /dev/null
+From 288c01b746aab484651391ca6d64b585d3eb5ec6 Mon Sep 17 00:00:00 2001
+From: Eli Cohen <eli@mellanox.com>
+Date: Thu, 27 Oct 2016 16:36:45 +0300
+Subject: IB/mlx5: Fix reported max SGE calculation
+
+From: Eli Cohen <eli@mellanox.com>
+
+commit 288c01b746aab484651391ca6d64b585d3eb5ec6 upstream.
+
+Add the 512 bytes limit of RDMA READ and the size of remote
+address to the max SGE calculation.
+
+Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
+Signed-off-by: Eli Cohen <eli@mellanox.com>
+Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx5/main.c | 8 +++++---
+ drivers/infiniband/hw/mlx5/qp.c | 29 ++++++++++++++++++++++++++++-
+ 2 files changed, 33 insertions(+), 4 deletions(-)
+
+--- a/drivers/infiniband/hw/mlx5/main.c
++++ b/drivers/infiniband/hw/mlx5/main.c
+@@ -496,6 +496,7 @@ static int mlx5_ib_query_device(struct i
+ struct mlx5_ib_dev *dev = to_mdev(ibdev);
+ struct mlx5_core_dev *mdev = dev->mdev;
+ int err = -ENOMEM;
++ int max_sq_desc;
+ int max_rq_sg;
+ int max_sq_sg;
+ u64 min_page_size = 1ull << MLX5_CAP_GEN(mdev, log_pg_sz);
+@@ -618,9 +619,10 @@ static int mlx5_ib_query_device(struct i
+ props->max_qp_wr = 1 << MLX5_CAP_GEN(mdev, log_max_qp_sz);
+ max_rq_sg = MLX5_CAP_GEN(mdev, max_wqe_sz_rq) /
+ sizeof(struct mlx5_wqe_data_seg);
+- max_sq_sg = (MLX5_CAP_GEN(mdev, max_wqe_sz_sq) -
+- sizeof(struct mlx5_wqe_ctrl_seg)) /
+- sizeof(struct mlx5_wqe_data_seg);
++ max_sq_desc = min_t(int, MLX5_CAP_GEN(mdev, max_wqe_sz_sq), 512);
++ max_sq_sg = (max_sq_desc - sizeof(struct mlx5_wqe_ctrl_seg) -
++ sizeof(struct mlx5_wqe_raddr_seg)) /
++ sizeof(struct mlx5_wqe_data_seg);
+ props->max_sge = min(max_rq_sg, max_sq_sg);
+ props->max_sge_rd = MLX5_MAX_SGE_RD;
+ props->max_cq = 1 << MLX5_CAP_GEN(mdev, log_max_cq);
+--- a/drivers/infiniband/hw/mlx5/qp.c
++++ b/drivers/infiniband/hw/mlx5/qp.c
+@@ -351,6 +351,29 @@ static int calc_send_wqe(struct ib_qp_in
+ return ALIGN(max_t(int, inl_size, size), MLX5_SEND_WQE_BB);
+ }
+
++static int get_send_sge(struct ib_qp_init_attr *attr, int wqe_size)
++{
++ int max_sge;
++
++ if (attr->qp_type == IB_QPT_RC)
++ max_sge = (min_t(int, wqe_size, 512) -
++ sizeof(struct mlx5_wqe_ctrl_seg) -
++ sizeof(struct mlx5_wqe_raddr_seg)) /
++ sizeof(struct mlx5_wqe_data_seg);
++ else if (attr->qp_type == IB_QPT_XRC_INI)
++ max_sge = (min_t(int, wqe_size, 512) -
++ sizeof(struct mlx5_wqe_ctrl_seg) -
++ sizeof(struct mlx5_wqe_xrc_seg) -
++ sizeof(struct mlx5_wqe_raddr_seg)) /
++ sizeof(struct mlx5_wqe_data_seg);
++ else
++ max_sge = (wqe_size - sq_overhead(attr)) /
++ sizeof(struct mlx5_wqe_data_seg);
++
++ return min_t(int, max_sge, wqe_size - sq_overhead(attr) /
++ sizeof(struct mlx5_wqe_data_seg));
++}
++
+ static int calc_sq_size(struct mlx5_ib_dev *dev, struct ib_qp_init_attr *attr,
+ struct mlx5_ib_qp *qp)
+ {
+@@ -387,7 +410,11 @@ static int calc_sq_size(struct mlx5_ib_d
+ return -ENOMEM;
+ }
+ qp->sq.wqe_shift = ilog2(MLX5_SEND_WQE_BB);
+- qp->sq.max_gs = attr->cap.max_send_sge;
++ qp->sq.max_gs = get_send_sge(attr, wqe_size);
++ if (qp->sq.max_gs < attr->cap.max_send_sge)
++ return -ENOMEM;
++
++ attr->cap.max_send_sge = qp->sq.max_gs;
+ qp->sq.max_post = wq_size / wqe_size;
+ attr->cap.max_send_wr = qp->sq.max_post;
+
--- /dev/null
+From acbda523884dcf45613bf6818d8ead5180df35c2 Mon Sep 17 00:00:00 2001
+From: Eli Cohen <eli@mellanox.com>
+Date: Thu, 27 Oct 2016 16:36:43 +0300
+Subject: IB/mlx5: Wait for all async command completions to complete
+
+From: Eli Cohen <eli@mellanox.com>
+
+commit acbda523884dcf45613bf6818d8ead5180df35c2 upstream.
+
+Wait before continuing unload till all pending mkey async creation requests
+are done.
+
+Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
+Signed-off-by: Eli Cohen <eli@mellanox.com>
+Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx5/mr.c | 28 ++++++++++++++++++++++++++++
+ 1 file changed, 28 insertions(+)
+
+--- a/drivers/infiniband/hw/mlx5/mr.c
++++ b/drivers/infiniband/hw/mlx5/mr.c
+@@ -647,6 +647,33 @@ int mlx5_mr_cache_init(struct mlx5_ib_de
+ return 0;
+ }
+
++static void wait_for_async_commands(struct mlx5_ib_dev *dev)
++{
++ struct mlx5_mr_cache *cache = &dev->cache;
++ struct mlx5_cache_ent *ent;
++ int total = 0;
++ int i;
++ int j;
++
++ for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) {
++ ent = &cache->ent[i];
++ for (j = 0 ; j < 1000; j++) {
++ if (!ent->pending)
++ break;
++ msleep(50);
++ }
++ }
++ for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) {
++ ent = &cache->ent[i];
++ total += ent->pending;
++ }
++
++ if (total)
++ mlx5_ib_warn(dev, "aborted while there are %d pending mr requests\n", total);
++ else
++ mlx5_ib_warn(dev, "done with all pending requests\n");
++}
++
+ int mlx5_mr_cache_cleanup(struct mlx5_ib_dev *dev)
+ {
+ int i;
+@@ -660,6 +687,7 @@ int mlx5_mr_cache_cleanup(struct mlx5_ib
+ clean_keys(dev, i);
+
+ destroy_workqueue(dev->cache.wq);
++ wait_for_async_commands(dev);
+ del_timer_sync(&dev->delay_timer);
+
+ return 0;
--- /dev/null
+From a0fa72683e78979ef1123d679b1c40ae28bd9096 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 19 Sep 2016 13:57:26 +0200
+Subject: IB/rxe: avoid putting a large struct rxe_qp on stack
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit a0fa72683e78979ef1123d679b1c40ae28bd9096 upstream.
+
+A race condition fix added an rxe_qp structure to the stack in order
+to be able to perform rollback in rxe_requester(), but the structure
+is large enough to trigger the warning for possible stack overflow:
+
+drivers/infiniband/sw/rxe/rxe_req.c: In function 'rxe_requester':
+drivers/infiniband/sw/rxe/rxe_req.c:757:1: error: the frame size of 2064 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
+
+This changes the rollback function to only save the psn inside
+the qp, which is the only field we access in the rollback_qp
+anyway.
+
+Fixes: 3050b9985024 ("IB/rxe: Fix race condition between requester and completer")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/sw/rxe/rxe_req.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+--- a/drivers/infiniband/sw/rxe/rxe_req.c
++++ b/drivers/infiniband/sw/rxe/rxe_req.c
+@@ -548,23 +548,23 @@ static void update_wqe_psn(struct rxe_qp
+ static void save_state(struct rxe_send_wqe *wqe,
+ struct rxe_qp *qp,
+ struct rxe_send_wqe *rollback_wqe,
+- struct rxe_qp *rollback_qp)
++ u32 *rollback_psn)
+ {
+ rollback_wqe->state = wqe->state;
+ rollback_wqe->first_psn = wqe->first_psn;
+ rollback_wqe->last_psn = wqe->last_psn;
+- rollback_qp->req.psn = qp->req.psn;
++ *rollback_psn = qp->req.psn;
+ }
+
+ static void rollback_state(struct rxe_send_wqe *wqe,
+ struct rxe_qp *qp,
+ struct rxe_send_wqe *rollback_wqe,
+- struct rxe_qp *rollback_qp)
++ u32 rollback_psn)
+ {
+ wqe->state = rollback_wqe->state;
+ wqe->first_psn = rollback_wqe->first_psn;
+ wqe->last_psn = rollback_wqe->last_psn;
+- qp->req.psn = rollback_qp->req.psn;
++ qp->req.psn = rollback_psn;
+ }
+
+ static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
+@@ -593,8 +593,8 @@ int rxe_requester(void *arg)
+ int mtu;
+ int opcode;
+ int ret;
+- struct rxe_qp rollback_qp;
+ struct rxe_send_wqe rollback_wqe;
++ u32 rollback_psn;
+
+ next_wqe:
+ if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR))
+@@ -719,7 +719,7 @@ next_wqe:
+ * rxe_xmit_packet().
+ * Otherwise, completer might initiate an unjustified retry flow.
+ */
+- save_state(wqe, qp, &rollback_wqe, &rollback_qp);
++ save_state(wqe, qp, &rollback_wqe, &rollback_psn);
+ update_wqe_state(qp, wqe, &pkt);
+ update_wqe_psn(qp, wqe, &pkt, payload);
+ ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb);
+@@ -727,7 +727,7 @@ next_wqe:
+ qp->need_req_skb = 1;
+ kfree_skb(skb);
+
+- rollback_state(wqe, qp, &rollback_wqe, &rollback_qp);
++ rollback_state(wqe, qp, &rollback_wqe, rollback_psn);
+
+ if (ret == -EAGAIN) {
+ rxe_run_task(&qp->req.task, 1);
--- /dev/null
+From d680ebed91e0b45c43ae03a880a0b43211096161 Mon Sep 17 00:00:00 2001
+From: Yonatan Cohen <yonatanc@mellanox.com>
+Date: Wed, 16 Nov 2016 10:39:16 +0200
+Subject: IB/rxe: Increase max number of completions to 32k
+
+From: Yonatan Cohen <yonatanc@mellanox.com>
+
+commit d680ebed91e0b45c43ae03a880a0b43211096161 upstream.
+
+Increase limit of max CQE from 8K to 32K to allow demanding
+applications to work over SoftRoCE with same configuration
+as most RoCEv2 HW vendors have.
+
+Fixes: 8700e3e7c485 ("Soft RoCE driver")
+Signed-off-by: Yonatan Cohen <yonatanc@mellanox.com>
+Reviewed-by: Moni Shoua <monis@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/sw/rxe/rxe_param.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/infiniband/sw/rxe/rxe_param.h
++++ b/drivers/infiniband/sw/rxe/rxe_param.h
+@@ -82,7 +82,7 @@ enum rxe_device_param {
+ RXE_MAX_SGE = 32,
+ RXE_MAX_SGE_RD = 32,
+ RXE_MAX_CQ = 16384,
+- RXE_MAX_LOG_CQE = 13,
++ RXE_MAX_LOG_CQE = 15,
+ RXE_MAX_MR = 2 * 1024,
+ RXE_MAX_PD = 0x7ffc,
+ RXE_MAX_QP_RD_ATOM = 128,
--- /dev/null
+From c56cb33b56c13493eeb95612f80e4dd6e35cd109 Mon Sep 17 00:00:00 2001
+From: Rabin Vincent <rabinv@axis.com>
+Date: Wed, 10 Aug 2016 15:52:28 +0200
+Subject: perf callchain: Fixup help/config for no-unwinding
+
+From: Rabin Vincent <rabinv@axis.com>
+
+commit c56cb33b56c13493eeb95612f80e4dd6e35cd109 upstream.
+
+Since 841e3558b2d ("perf callchain: Recording 'dwarf' callchains do not
+need DWARF unwinding support"), --call-graph dwarf is allowed in 'perf
+record' even without unwind support. A couple of other places don't
+reflect this yet though: the help text should list dwarf as a valid
+record mode and the dump_size config should be respected too.
+
+Signed-off-by: Rabin Vincent <rabinv@axis.com>
+Cc: He Kuang <hekuang@huawei.com>
+Fixes: 841e3558b2de ("perf callchain: Recording 'dwarf' callchains do not need DWARF unwinding support")
+Link: http://lkml.kernel.org/r/1470837148-7642-1-git-send-email-rabin.vincent@axis.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/util/callchain.c | 2 --
+ tools/perf/util/callchain.h | 4 ----
+ 2 files changed, 6 deletions(-)
+
+--- a/tools/perf/util/callchain.c
++++ b/tools/perf/util/callchain.c
+@@ -193,7 +193,6 @@ int perf_callchain_config(const char *va
+
+ if (!strcmp(var, "record-mode"))
+ return parse_callchain_record_opt(value, &callchain_param);
+-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+ if (!strcmp(var, "dump-size")) {
+ unsigned long size = 0;
+ int ret;
+@@ -203,7 +202,6 @@ int perf_callchain_config(const char *va
+
+ return ret;
+ }
+-#endif
+ if (!strcmp(var, "print-type"))
+ return parse_callchain_mode(value);
+ if (!strcmp(var, "order"))
+--- a/tools/perf/util/callchain.h
++++ b/tools/perf/util/callchain.h
+@@ -11,11 +11,7 @@
+
+ #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace):\n\n"
+
+-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+ # define RECORD_MODE_HELP HELP_PAD "record_mode:\tcall graph recording mode (fp|dwarf|lbr)\n"
+-#else
+-# define RECORD_MODE_HELP HELP_PAD "record_mode:\tcall graph recording mode (fp|lbr)\n"
+-#endif
+
+ #define RECORD_SIZE_HELP \
+ HELP_PAD "record_size:\tif record_mode is 'dwarf', max size of stack recording (<bytes>)\n" \
--- /dev/null
+From ed6c166cc7dc329736cace3affd2df984fb22ec8 Mon Sep 17 00:00:00 2001
+From: Kan Liang <kan.liang@intel.com>
+Date: Tue, 13 Dec 2016 10:29:44 -0500
+Subject: perf diff: Do not overwrite valid build id
+
+From: Kan Liang <kan.liang@intel.com>
+
+commit ed6c166cc7dc329736cace3affd2df984fb22ec8 upstream.
+
+Fixes a perf diff regression issue which was introduced by commit
+5baecbcd9c9a ("perf symbols: we can now read separate debug-info files
+based on a build ID")
+
+The binary name could be same when perf diff different binaries. Build
+id is used to distinguish between them.
+However, the previous patch assumes the same binary name has same build
+id. So it overwrites the build id according to the binary name,
+regardless of whether the build id is set or not.
+
+Check the has_build_id in dso__load. If the build id is already set, use
+it.
+
+Before the fix:
+
+ $ perf diff 1.perf.data 2.perf.data
+ # Event 'cycles'
+ #
+ # Baseline Delta Shared Object Symbol
+ # ........ ....... ................ .............................
+ #
+ 99.83% -99.80% tchain_edit [.] f2
+ 0.12% +99.81% tchain_edit [.] f3
+ 0.02% -0.01% [ixgbe] [k] ixgbe_read_reg
+
+ After the fix:
+ $ perf diff 1.perf.data 2.perf.data
+ # Event 'cycles'
+ #
+ # Baseline Delta Shared Object Symbol
+ # ........ ....... ................ .............................
+ #
+ 99.83% +0.10% tchain_edit [.] f3
+ 0.12% -0.08% tchain_edit [.] f2
+
+Signed-off-by: Kan Liang <kan.liang@intel.com>
+Cc: Andi Kleen <andi@firstfloor.org>
+CC: Dima Kogan <dima@secretsauce.net>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Fixes: 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files based on a build ID")
+Link: http://lkml.kernel.org/r/1481642984-13593-1-git-send-email-kan.liang@intel.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/util/symbol.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/tools/perf/util/symbol.c
++++ b/tools/perf/util/symbol.c
+@@ -1459,7 +1459,8 @@ int dso__load(struct dso *dso, struct ma
+ * Read the build id if possible. This is required for
+ * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
+ */
+- if (is_regular_file(dso->long_name) &&
++ if (!dso->has_build_id &&
++ is_regular_file(dso->long_name) &&
+ filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
+ dso__set_build_id(dso, build_id);
+
--- /dev/null
+From 621cb4e7837e39d25a5af5a785ad282cdd2b4ce8 Mon Sep 17 00:00:00 2001
+From: Maciej Debski <maciejd@google.com>
+Date: Thu, 13 Oct 2016 03:59:36 -0700
+Subject: perf jit: Enable jitdump support without dwarf
+
+From: Maciej Debski <maciejd@google.com>
+
+commit 621cb4e7837e39d25a5af5a785ad282cdd2b4ce8 upstream.
+
+This patch modifies the build dependencies on the jitdump support in
+perf. As it stands jitdump was wrongfully made dependent 100% on using
+DWARF. However, the dwarf dependency, only exist if generating the
+source line table in genelf_debug.c. The rest of the support does not
+need DWARF.
+
+This patch removes the dependency on DWARF for the entire jitdump
+support. It keeps it only for the genelf_debug.c support.
+
+Signed-off-by: Maciej Debski <maciejd@google.com>
+Reviewed-by: Stephane Eranian <eranian@google.com>
+Cc: Anton Blanchard <anton@ozlabs.org>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: http://lkml.kernel.org/r/1476356383-30100-3-git-send-email-eranian@google.com
+Fixes: e12b202f8fb9 ("perf jitdump: Build only on supported archs")
+[ Make it build only if NO_LIBELF isn't defined, as jitdump.o will only be built in that case ]
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/Makefile.config | 2 +-
+ tools/perf/util/Build | 2 +-
+ tools/perf/util/genelf.c | 9 +++++++--
+ tools/perf/util/genelf.h | 2 ++
+ 4 files changed, 11 insertions(+), 4 deletions(-)
+
+--- a/tools/perf/Makefile.config
++++ b/tools/perf/Makefile.config
+@@ -366,7 +366,7 @@ ifndef NO_SDT
+ endif
+
+ ifdef PERF_HAVE_JITDUMP
+- ifndef NO_DWARF
++ ifndef NO_LIBELF
+ $(call detected,CONFIG_JITDUMP)
+ CFLAGS += -DHAVE_JITDUMP
+ endif
+--- a/tools/perf/util/Build
++++ b/tools/perf/util/Build
+@@ -120,7 +120,7 @@ libperf-y += demangle-rust.o
+ ifdef CONFIG_JITDUMP
+ libperf-$(CONFIG_LIBELF) += jitdump.o
+ libperf-$(CONFIG_LIBELF) += genelf.o
+-libperf-$(CONFIG_LIBELF) += genelf_debug.o
++libperf-$(CONFIG_DWARF) += genelf_debug.o
+ endif
+
+ CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
+--- a/tools/perf/util/genelf.c
++++ b/tools/perf/util/genelf.c
+@@ -19,7 +19,9 @@
+ #include <limits.h>
+ #include <fcntl.h>
+ #include <err.h>
++#ifdef HAVE_DWARF_SUPPORT
+ #include <dwarf.h>
++#endif
+
+ #include "perf.h"
+ #include "genelf.h"
+@@ -157,7 +159,7 @@ gen_build_id(struct buildid_note *note,
+ int
+ jit_write_elf(int fd, uint64_t load_addr, const char *sym,
+ const void *code, int csize,
+- void *debug, int nr_debug_entries)
++ void *debug __maybe_unused, int nr_debug_entries __maybe_unused)
+ {
+ Elf *e;
+ Elf_Data *d;
+@@ -386,11 +388,14 @@ jit_write_elf(int fd, uint64_t load_addr
+ shdr->sh_size = sizeof(bnote);
+ shdr->sh_entsize = 0;
+
++#ifdef HAVE_DWARF_SUPPORT
+ if (debug && nr_debug_entries) {
+ retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries);
+ if (retval)
+ goto error;
+- } else {
++ } else
++#endif
++ {
+ if (elf_update(e, ELF_C_WRITE) < 0) {
+ warnx("elf_update 4 failed");
+ goto error;
+--- a/tools/perf/util/genelf.h
++++ b/tools/perf/util/genelf.h
+@@ -4,8 +4,10 @@
+ /* genelf.c */
+ int jit_write_elf(int fd, uint64_t code_addr, const char *sym,
+ const void *code, int csize, void *debug, int nr_debug_entries);
++#ifdef HAVE_DWARF_SUPPORT
+ /* genelf_debug.c */
+ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_entries);
++#endif
+
+ #if defined(__arm__)
+ #define GEN_ELF_ARCH EM_ARM
--- /dev/null
+From 631ac41b46d293fb3ee43a809776c1663de8d9c6 Mon Sep 17 00:00:00 2001
+From: Jiri Olsa <jolsa@kernel.org>
+Date: Mon, 12 Dec 2016 11:35:39 +0100
+Subject: perf mem: Fix --all-user/--all-kernel options
+
+From: Jiri Olsa <jolsa@kernel.org>
+
+commit 631ac41b46d293fb3ee43a809776c1663de8d9c6 upstream.
+
+Removing extra '--' prefix.
+
+Signed-off-by: Jiri Olsa <jolsa@kernel.org>
+Cc: David Ahern <dsahern@gmail.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
+Fixes: ad16511b0e40 ("perf mem: Add -U/-K (--all-user/--all-kernel) options")
+Link: http://lkml.kernel.org/r/1481538943-21874-2-git-send-email-jolsa@kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/builtin-mem.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/tools/perf/builtin-mem.c
++++ b/tools/perf/builtin-mem.c
+@@ -70,8 +70,8 @@ static int __cmd_record(int argc, const
+ OPT_UINTEGER(0, "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"),
+ OPT_INCR('v', "verbose", &verbose,
+ "be more verbose (show counter open errors, etc)"),
+- OPT_BOOLEAN('U', "--all-user", &all_user, "collect only user level data"),
+- OPT_BOOLEAN('K', "--all-kernel", &all_kernel, "collect only kernel level data"),
++ OPT_BOOLEAN('U', "all-user", &all_user, "collect only user level data"),
++ OPT_BOOLEAN('K', "all-kernel", &all_kernel, "collect only kernel level data"),
+ OPT_END()
+ };
+
--- /dev/null
+From cf346d5bd4b9d61656df2f72565c9b354ef3ca0d Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+Date: Tue, 25 Oct 2016 17:20:47 -0300
+Subject: perf scripting: Avoid leaking the scripting_context variable
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+commit cf346d5bd4b9d61656df2f72565c9b354ef3ca0d upstream.
+
+Both register_perl_scripting() and register_python_scripting() allocate
+this variable, fix it by checking if it already was.
+
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: David Ahern <dsahern@gmail.com>
+Cc: Frederic Weisbecker <fweisbec@gmail.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Tom Zanussi <tzanussi@gmail.com>
+Cc: Wang Nan <wangnan0@huawei.com>
+Fixes: 7e4b21b84c43 ("perf/scripts: Add Python scripting engine")
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/util/trace-event-scripting.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/tools/perf/util/trace-event-scripting.c
++++ b/tools/perf/util/trace-event-scripting.c
+@@ -95,7 +95,8 @@ static void register_python_scripting(st
+ if (err)
+ die("error registering py script extension");
+
+- scripting_context = malloc(sizeof(struct scripting_context));
++ if (scripting_context == NULL)
++ scripting_context = malloc(sizeof(*scripting_context));
+ }
+
+ #ifdef NO_LIBPYTHON
+@@ -159,7 +160,8 @@ static void register_perl_scripting(stru
+ if (err)
+ die("error registering pl script extension");
+
+- scripting_context = malloc(sizeof(struct scripting_context));
++ if (scripting_context == NULL)
++ scripting_context = malloc(sizeof(*scripting_context));
+ }
+
+ #ifdef NO_LIBPERL
--- /dev/null
+From 2bd42f3aaa53ebe78b9be6f898b7945dd61f9773 Mon Sep 17 00:00:00 2001
+From: Jiri Olsa <jolsa@kernel.org>
+Date: Thu, 15 Dec 2016 20:56:54 +0100
+Subject: perf trace: Check if MAP_32BIT is defined (again)
+
+From: Jiri Olsa <jolsa@kernel.org>
+
+commit 2bd42f3aaa53ebe78b9be6f898b7945dd61f9773 upstream.
+
+There might be systems where MAP_32BIT is not defined, like some some
+RHEL7 powerpc versions.
+
+Signed-off-by: Jiri Olsa <jolsa@kernel.org>
+Cc: David Ahern <dsahern@gmail.com>
+Cc: Kyle McMartin <kyle@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
+Fixes: 256763b01741 ("perf trace beauty mmap: Add more conditional defines")
+Link: http://lkml.kernel.org/r/1481831814-23683-1-git-send-email-jolsa@kernel.org
+[ Changed the Fixme cset to the one removing the conditional switch case for MAP_32BIT ]
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/trace/beauty/mmap.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/tools/perf/trace/beauty/mmap.c
++++ b/tools/perf/trace/beauty/mmap.c
+@@ -42,7 +42,9 @@ static size_t syscall_arg__scnprintf_mma
+
+ P_MMAP_FLAG(SHARED);
+ P_MMAP_FLAG(PRIVATE);
++#ifdef MAP_32BIT
+ P_MMAP_FLAG(32BIT);
++#endif
+ P_MMAP_FLAG(ANONYMOUS);
+ P_MMAP_FLAG(DENYWRITE);
+ P_MMAP_FLAG(EXECUTABLE);
--- /dev/null
+From ecf1e2253ea79c6204f4d6a5e756e8fb4aed5a7e Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+Date: Tue, 18 Oct 2016 11:28:32 -0300
+Subject: perf trace: Use the syscall raw_syscalls:sys_enter timestamp
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+commit ecf1e2253ea79c6204f4d6a5e756e8fb4aed5a7e upstream.
+
+Instead of the one when another syscall takes place while another is being
+processed (in another CPU, but we show it serialized, so need to "interrupt"
+the other), and also when finally showing the sys_enter + sys_exit + duration,
+where we were showing the sample->time for the sys_exit, duh.
+
+Before:
+
+ # perf trace sleep 1
+ <SNIP>
+ 0.373 ( 0.001 ms): close(fd: 3 ) = 0
+ 1000.626 (1000.211 ms): nanosleep(rqtp: 0x7ffd6ddddfb0) = 0
+ 1000.653 ( 0.003 ms): close(fd: 1 ) = 0
+ 1000.657 ( 0.002 ms): close(fd: 2 ) = 0
+ 1000.667 ( 0.000 ms): exit_group( )
+ #
+
+After:
+
+ # perf trace sleep 1
+ <SNIP>
+ 0.336 ( 0.001 ms): close(fd: 3 ) = 0
+ 0.373 (1000.086 ms): nanosleep(rqtp: 0x7ffe303e9550) = 0
+ 1000.481 ( 0.002 ms): close(fd: 1 ) = 0
+ 1000.485 ( 0.001 ms): close(fd: 2 ) = 0
+ 1000.494 ( 0.000 ms): exit_group( )
+[root@jouet linux]#
+
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: David Ahern <dsahern@gmail.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Wang Nan <wangnan0@huawei.com>
+Link: http://lkml.kernel.org/n/tip-ecbzgmu2ni6glc6zkw8p1zmx@git.kernel.org
+Fixes: 752fde44fd1c ("perf trace: Support interrupted syscalls")
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/builtin-trace.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/tools/perf/builtin-trace.c
++++ b/tools/perf/builtin-trace.c
+@@ -1452,7 +1452,7 @@ static int trace__printf_interrupted_ent
+
+ duration = sample->time - ttrace->entry_time;
+
+- printed = trace__fprintf_entry_head(trace, trace->current, duration, sample->time, trace->output);
++ printed = trace__fprintf_entry_head(trace, trace->current, duration, ttrace->entry_time, trace->output);
+ printed += fprintf(trace->output, "%-70s) ...\n", ttrace->entry_str);
+ ttrace->entry_pending = false;
+
+@@ -1499,7 +1499,7 @@ static int trace__sys_enter(struct trace
+
+ if (sc->is_exit) {
+ if (!(trace->duration_filter || trace->summary_only || trace->min_stack)) {
+- trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output);
++ trace__fprintf_entry_head(trace, thread, 1, ttrace->entry_time, trace->output);
+ fprintf(trace->output, "%-70s)\n", ttrace->entry_str);
+ }
+ } else {
+@@ -1592,7 +1592,7 @@ static int trace__sys_exit(struct trace
+ if (trace->summary_only)
+ goto out;
+
+- trace__fprintf_entry_head(trace, thread, duration, sample->time, trace->output);
++ trace__fprintf_entry_head(trace, thread, duration, ttrace->entry_time, trace->output);
+
+ if (ttrace->entry_pending) {
+ fprintf(trace->output, "%-70s", ttrace->entry_str);
--- /dev/null
+ib-core-release-allocated-memory-in-cache-setup-failure.patch
+ib-rxe-increase-max-number-of-completions-to-32k.patch
+ib-rxe-avoid-putting-a-large-struct-rxe_qp-on-stack.patch
+ib-mlx5-avoid-system-crash-when-enabling-many-vfs.patch
+ib-mlx5-fix-reported-max-sge-calculation.patch
+ib-mlx5-assign-srq-type-earlier.patch
+ib-mlx5-wait-for-all-async-command-completions-to-complete.patch
+ib-mlx4-set-traffic-class-in-ah.patch
+ib-mlx4-fix-out-of-range-array-index-in-destroy-qp-flow.patch
+ib-mlx4-handle-well-known-gid-in-mad_demux-processing.patch
+ib-mlx4-fix-port-query-for-56gb-ethernet-links.patch
+ib-mlx4-when-no-dmfs-for-ipoib-don-t-allow-net_if-qps.patch
+ib-mlx4-check-if-grh-is-available-before-using-it.patch
+ib-ipoib-remove-can-t-use-gfp_noio-warning.patch
+perf-trace-use-the-syscall-raw_syscalls-sys_enter-timestamp.patch
+perf-mem-fix-all-user-all-kernel-options.patch
+perf-trace-check-if-map_32bit-is-defined-again.patch
+perf-diff-do-not-overwrite-valid-build-id.patch
+perf-callchain-fixup-help-config-for-no-unwinding.patch
+perf-scripting-avoid-leaking-the-scripting_context-variable.patch
+perf-jit-enable-jitdump-support-without-dwarf.patch
+arm-dts-bcm283x-fix-typo-in-mailbox-address.patch
+arm-dts-r8a7794-use-sysc-always-on-pm-domain-for-sound.patch
+arm-dts-r8a7794-remove-z-clock.patch
+arm-dts-imx6q-cm-fx6-fix-fec-pinctrl.patch
+arm-dts-imx31-fix-clock-control-module-interrupts-description.patch
+arm-dts-imx31-move-ccm-device-node-to-aips2-bus-devices.patch
+arm-dts-imx31-fix-avic-base-address.patch
+arm-dts-omap3-add-dts-for-logic-pd-som-lv-37xx-dev-kit.patch