aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.txt12
-rw-r--r--Documentation/filesystems/overlayfs.txt5
-rw-r--r--Documentation/i2c/busses/i2c-i8011
-rw-r--r--MAINTAINERS5
-rw-r--r--Makefile2
-rw-r--r--arch/arc/Kconfig2
-rw-r--r--arch/arc/Makefile2
-rw-r--r--arch/arc/boot/dts/axs10x_mb.dtsi9
-rw-r--r--arch/arc/boot/dts/hsdk.dts32
-rw-r--r--arch/arc/configs/axs101_defconfig2
-rw-r--r--arch/arc/configs/axs103_defconfig2
-rw-r--r--arch/arc/configs/axs103_smp_defconfig2
-rw-r--r--arch/arc/configs/haps_hs_smp_defconfig2
-rw-r--r--arch/arc/configs/hsdk_defconfig3
-rw-r--r--arch/arc/configs/vdk_hs38_defconfig2
-rw-r--r--arch/arc/configs/vdk_hs38_smp_defconfig2
-rw-r--r--arch/arc/include/asm/arcregs.h11
-rw-r--r--arch/arc/kernel/setup.c32
-rw-r--r--arch/arc/plat-axs10x/axs10x.c7
-rw-r--r--arch/arc/plat-hsdk/Kconfig3
-rw-r--r--arch/arc/plat-hsdk/platform.c42
-rw-r--r--arch/arm64/include/asm/memory.h9
-rw-r--r--arch/arm64/kernel/armv8_deprecated.c2
-rw-r--r--arch/arm64/kernel/cpufeature.c2
-rw-r--r--arch/arm64/kernel/fpsimd.c2
-rw-r--r--arch/arm64/mm/fault.c2
-rw-r--r--arch/parisc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/dt_cpu_ftrs.c4
-rw-r--r--arch/powerpc/kernel/mce_power.c13
-rw-r--r--arch/powerpc/kernel/setup-common.c3
-rw-r--r--arch/powerpc/kernel/watchdog.c30
-rw-r--r--arch/powerpc/kvm/book3s_xive.c5
-rw-r--r--arch/powerpc/kvm/book3s_xive.h1
-rw-r--r--arch/powerpc/mm/pgtable_32.c2
-rw-r--r--arch/powerpc/platforms/powernv/setup.c10
-rw-r--r--arch/powerpc/sysdev/xive/common.c8
-rw-r--r--arch/powerpc/sysdev/xive/spapr.c4
-rw-r--r--arch/x86/events/intel/core.c11
-rw-r--r--arch/x86/include/asm/kvm_para.h4
-rw-r--r--arch/x86/kernel/kvm.c14
-rw-r--r--arch/x86/kvm/Kconfig1
-rw-r--r--arch/x86/kvm/emulate.c6
-rw-r--r--arch/x86/kvm/mmu.c2
-rw-r--r--block/blk-mq-debugfs.c6
-rw-r--r--block/blk-throttle.c4
-rw-r--r--block/bsg-lib.c27
-rw-r--r--drivers/acpi/arm64/iort.c35
-rw-r--r--drivers/block/Kconfig2
-rw-r--r--drivers/block/nbd.c6
-rw-r--r--drivers/clk/clk-bulk.c1
-rw-r--r--drivers/clk/rockchip/clk-rk3128.c12
-rw-r--r--drivers/clk/samsung/clk-exynos4.c15
-rw-r--r--drivers/gpu/drm/i915/intel_audio.c5
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c7
-rw-r--r--drivers/gpu/drm/i915/intel_csr.c2
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c3
-rw-r--r--drivers/gpu/drm/i915/intel_display.c2
-rw-r--r--drivers/gpu/drm/i915/intel_dpio_phy.c20
-rw-r--r--drivers/gpu/drm/i915/intel_modes.c17
-rw-r--r--drivers/gpu/drm/i915/intel_runtime_pm.c3
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c19
-rw-r--r--drivers/hwmon/xgene-hwmon.c19
-rw-r--r--drivers/i2c/busses/Kconfig1
-rw-r--r--drivers/i2c/busses/i2c-i801.c4
-rw-r--r--drivers/i2c/busses/i2c-sprd.c1
-rw-r--r--drivers/i2c/busses/i2c-stm32f7.c17
-rw-r--r--drivers/ide/ide-probe.c1
-rw-r--r--drivers/ide/ide-scan-pci.c13
-rw-r--r--drivers/ide/setup-pci.c63
-rw-r--r--drivers/infiniband/core/iwpm_msg.c8
-rw-r--r--drivers/infiniband/core/iwpm_util.c5
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_ctrl.c2
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_p.h2
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_puda.c11
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_verbs.c2
-rw-r--r--drivers/infiniband/hw/mlx5/main.c4
-rw-r--r--drivers/infiniband/hw/qedr/qedr.h2
-rw-r--r--drivers/infiniband/hw/qedr/qedr_cm.c12
-rw-r--r--drivers/md/bcache/closure.c4
-rw-r--r--drivers/misc/cxl/cxllib.c13
-rw-r--r--drivers/mmc/core/block.c3
-rw-r--r--drivers/mmc/core/mmc.c36
-rw-r--r--drivers/mmc/core/queue.c125
-rw-r--r--drivers/mmc/core/queue.h6
-rw-r--r--drivers/mmc/host/cavium.c2
-rw-r--r--drivers/mmc/host/meson-gx-mmc.c26
-rw-r--r--drivers/mmc/host/pxamci.c6
-rw-r--r--drivers/mmc/host/sdhci-xenon.c24
-rw-r--r--drivers/mmc/host/sdhci-xenon.h1
-rw-r--r--drivers/nvme/host/core.c2
-rw-r--r--drivers/nvme/host/pci.c14
-rw-r--r--drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c2
-rw-r--r--drivers/scsi/libiscsi.c8
-rw-r--r--drivers/scsi/scsi_scan.c3
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c16
-rw-r--r--drivers/scsi/sd.c35
-rw-r--r--fs/btrfs/ctree.h2
-rw-r--r--fs/btrfs/extent_io.c2
-rw-r--r--fs/ceph/mds_client.c11
-rw-r--r--fs/ceph/snap.c8
-rw-r--r--fs/namespace.c4
-rw-r--r--fs/nfs/client.c2
-rw-r--r--fs/nfs/filelayout/filelayout.c3
-rw-r--r--fs/nfs/nfs4idmap.c2
-rw-r--r--fs/nfs/nfs4proc.c3
-rw-r--r--fs/nfs/nfs4xdr.c4
-rw-r--r--fs/overlayfs/copy_up.c6
-rw-r--r--fs/overlayfs/dir.c20
-rw-r--r--fs/overlayfs/namei.c1
-rw-r--r--fs/overlayfs/overlayfs.h1
-rw-r--r--fs/overlayfs/ovl_entry.h3
-rw-r--r--fs/overlayfs/readdir.c6
-rw-r--r--fs/overlayfs/super.c27
-rw-r--r--fs/overlayfs/util.c24
-rw-r--r--fs/xfs/xfs_bmap_util.c24
-rw-r--r--fs/xfs/xfs_reflink.c9
-rw-r--r--include/linux/mmc/host.h2
-rw-r--r--include/linux/nmi.h121
-rw-r--r--include/linux/smpboot.h4
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/scsi/scsi_devinfo.h1
-rw-r--r--include/scsi/scsi_transport_iscsi.h1
-rw-r--r--kernel/cpu.c6
-rw-r--r--kernel/smpboot.c25
-rw-r--r--kernel/sysctl.c22
-rw-r--r--kernel/watchdog.c643
-rw-r--r--kernel/watchdog_hld.c196
-rw-r--r--net/sunrpc/xprtsock.c2
128 files changed, 1147 insertions, 1035 deletions
diff --git a/Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.txt b/Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.txt
index b878a1e305af..ed1456f5c94d 100644
--- a/Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.txt
+++ b/Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.txt
@@ -16,11 +16,13 @@ Required Properties:
16 16
17- clocks: 17- clocks:
18 Array of clocks required for SDHC. 18 Array of clocks required for SDHC.
19 Require at least input clock for Xenon IP core. 19 Require at least input clock for Xenon IP core. For Armada AP806 and
20 CP110, the AXI clock is also mandatory.
20 21
21- clock-names: 22- clock-names:
22 Array of names corresponding to clocks property. 23 Array of names corresponding to clocks property.
23 The input clock for Xenon IP core should be named as "core". 24 The input clock for Xenon IP core should be named as "core".
25 The input clock for the AXI bus must be named as "axi".
24 26
25- reg: 27- reg:
26 * For "marvell,armada-3700-sdhci", two register areas. 28 * For "marvell,armada-3700-sdhci", two register areas.
@@ -106,8 +108,8 @@ Example:
106 compatible = "marvell,armada-ap806-sdhci"; 108 compatible = "marvell,armada-ap806-sdhci";
107 reg = <0xaa0000 0x1000>; 109 reg = <0xaa0000 0x1000>;
108 interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH> 110 interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>
109 clocks = <&emmc_clk>; 111 clocks = <&emmc_clk>,<&axi_clk>;
110 clock-names = "core"; 112 clock-names = "core", "axi";
111 bus-width = <4>; 113 bus-width = <4>;
112 marvell,xenon-phy-slow-mode; 114 marvell,xenon-phy-slow-mode;
113 marvell,xenon-tun-count = <11>; 115 marvell,xenon-tun-count = <11>;
@@ -126,8 +128,8 @@ Example:
126 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH> 128 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>
127 vqmmc-supply = <&sd_vqmmc_regulator>; 129 vqmmc-supply = <&sd_vqmmc_regulator>;
128 vmmc-supply = <&sd_vmmc_regulator>; 130 vmmc-supply = <&sd_vmmc_regulator>;
129 clocks = <&sdclk>; 131 clocks = <&sdclk>, <&axi_clk>;
130 clock-names = "core"; 132 clock-names = "core", "axi";
131 bus-width = <4>; 133 bus-width = <4>;
132 marvell,xenon-tun-count = <9>; 134 marvell,xenon-tun-count = <9>;
133 }; 135 };
diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt
index 36f528a7fdd6..8caa60734647 100644
--- a/Documentation/filesystems/overlayfs.txt
+++ b/Documentation/filesystems/overlayfs.txt
@@ -210,8 +210,11 @@ path as another overlay mount and it may use a lower layer path that is
210beneath or above the path of another overlay lower layer path. 210beneath or above the path of another overlay lower layer path.
211 211
212Using an upper layer path and/or a workdir path that are already used by 212Using an upper layer path and/or a workdir path that are already used by
213another overlay mount is not allowed and will fail with EBUSY. Using 213another overlay mount is not allowed and may fail with EBUSY. Using
214partially overlapping paths is not allowed but will not fail with EBUSY. 214partially overlapping paths is not allowed but will not fail with EBUSY.
215If files are accessed from two overlayfs mounts which share or overlap the
216upper layer and/or workdir path the behavior of the overlay is undefined,
217though it will not result in a crash or deadlock.
215 218
216Mounting an overlay using an upper layer path, where the upper layer path 219Mounting an overlay using an upper layer path, where the upper layer path
217was previously used by another mounted overlay in combination with a 220was previously used by another mounted overlay in combination with a
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801
index 0500193434cb..d47702456926 100644
--- a/Documentation/i2c/busses/i2c-i801
+++ b/Documentation/i2c/busses/i2c-i801
@@ -36,6 +36,7 @@ Supported adapters:
36 * Intel Gemini Lake (SOC) 36 * Intel Gemini Lake (SOC)
37 * Intel Cannon Lake-H (PCH) 37 * Intel Cannon Lake-H (PCH)
38 * Intel Cannon Lake-LP (PCH) 38 * Intel Cannon Lake-LP (PCH)
39 * Intel Cedar Fork (PCH)
39 Datasheets: Publicly available at the Intel website 40 Datasheets: Publicly available at the Intel website
40 41
41On Intel Patsburg and later chipsets, both the normal host SMBus controller 42On Intel Patsburg and later chipsets, both the normal host SMBus controller
diff --git a/MAINTAINERS b/MAINTAINERS
index cc42c838ab4f..2d3d750b19c0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5259,7 +5259,8 @@ S: Maintained
5259F: drivers/iommu/exynos-iommu.c 5259F: drivers/iommu/exynos-iommu.c
5260 5260
5261EZchip NPS platform support 5261EZchip NPS platform support
5262M: Noam Camus <noamc@ezchip.com> 5262M: Elad Kanfi <eladkan@mellanox.com>
5263M: Vineet Gupta <vgupta@synopsys.com>
5263S: Supported 5264S: Supported
5264F: arch/arc/plat-eznps 5265F: arch/arc/plat-eznps
5265F: arch/arc/boot/dts/eznps.dts 5266F: arch/arc/boot/dts/eznps.dts
@@ -9360,7 +9361,7 @@ NETWORK BLOCK DEVICE (NBD)
9360M: Josef Bacik <jbacik@fb.com> 9361M: Josef Bacik <jbacik@fb.com>
9361S: Maintained 9362S: Maintained
9362L: linux-block@vger.kernel.org 9363L: linux-block@vger.kernel.org
9363L: nbd-general@lists.sourceforge.net 9364L: nbd@other.debian.org
9364F: Documentation/blockdev/nbd.txt 9365F: Documentation/blockdev/nbd.txt
9365F: drivers/block/nbd.c 9366F: drivers/block/nbd.c
9366F: include/uapi/linux/nbd.h 9367F: include/uapi/linux/nbd.h
diff --git a/Makefile b/Makefile
index cf007a31d575..2835863bdd5a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 4 1VERSION = 4
2PATCHLEVEL = 14 2PATCHLEVEL = 14
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc3 4EXTRAVERSION = -rc4
5NAME = Fearless Coyote 5NAME = Fearless Coyote
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index a598641eed98..c84e67fdea09 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -24,7 +24,7 @@ config ARC
24 select GENERIC_SMP_IDLE_THREAD 24 select GENERIC_SMP_IDLE_THREAD
25 select HAVE_ARCH_KGDB 25 select HAVE_ARCH_KGDB
26 select HAVE_ARCH_TRACEHOOK 26 select HAVE_ARCH_TRACEHOOK
27 select HAVE_FUTEX_CMPXCHG 27 select HAVE_FUTEX_CMPXCHG if FUTEX
28 select HAVE_IOREMAP_PROT 28 select HAVE_IOREMAP_PROT
29 select HAVE_KPROBES 29 select HAVE_KPROBES
30 select HAVE_KRETPROBES 30 select HAVE_KRETPROBES
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 3a4b52b7e09d..d37f49d6a27f 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -6,8 +6,6 @@
6# published by the Free Software Foundation. 6# published by the Free Software Foundation.
7# 7#
8 8
9UTS_MACHINE := arc
10
11ifeq ($(CROSS_COMPILE),) 9ifeq ($(CROSS_COMPILE),)
12ifndef CONFIG_CPU_BIG_ENDIAN 10ifndef CONFIG_CPU_BIG_ENDIAN
13CROSS_COMPILE := arc-linux- 11CROSS_COMPILE := arc-linux-
diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 2367a67c5f10..e114000a84f5 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -44,7 +44,14 @@
44 44
45 mmcclk: mmcclk { 45 mmcclk: mmcclk {
46 compatible = "fixed-clock"; 46 compatible = "fixed-clock";
47 clock-frequency = <50000000>; 47 /*
48 * DW sdio controller has external ciu clock divider
49 * controlled via register in SDIO IP. It divides
50 * sdio_ref_clk (which comes from CGU) by 16 for
51 * default. So default mmcclk clock (which comes
52 * to sdk_in) is 25000000 Hz.
53 */
54 clock-frequency = <25000000>;
48 #clock-cells = <0>; 55 #clock-cells = <0>;
49 }; 56 };
50 57
diff --git a/arch/arc/boot/dts/hsdk.dts b/arch/arc/boot/dts/hsdk.dts
index 229d13adbce4..8adde1b492f1 100644
--- a/arch/arc/boot/dts/hsdk.dts
+++ b/arch/arc/boot/dts/hsdk.dts
@@ -12,6 +12,7 @@
12/dts-v1/; 12/dts-v1/;
13 13
14#include <dt-bindings/net/ti-dp83867.h> 14#include <dt-bindings/net/ti-dp83867.h>
15#include <dt-bindings/reset/snps,hsdk-reset.h>
15 16
16/ { 17/ {
17 model = "snps,hsdk"; 18 model = "snps,hsdk";
@@ -57,10 +58,10 @@
57 }; 58 };
58 }; 59 };
59 60
60 core_clk: core-clk { 61 input_clk: input-clk {
61 #clock-cells = <0>; 62 #clock-cells = <0>;
62 compatible = "fixed-clock"; 63 compatible = "fixed-clock";
63 clock-frequency = <500000000>; 64 clock-frequency = <33333333>;
64 }; 65 };
65 66
66 cpu_intc: cpu-interrupt-controller { 67 cpu_intc: cpu-interrupt-controller {
@@ -102,6 +103,19 @@
102 103
103 ranges = <0x00000000 0xf0000000 0x10000000>; 104 ranges = <0x00000000 0xf0000000 0x10000000>;
104 105
106 cgu_rst: reset-controller@8a0 {
107 compatible = "snps,hsdk-reset";
108 #reset-cells = <1>;
109 reg = <0x8A0 0x4>, <0xFF0 0x4>;
110 };
111
112 core_clk: core-clk@0 {
113 compatible = "snps,hsdk-core-pll-clock";
114 reg = <0x00 0x10>, <0x14B8 0x4>;
115 #clock-cells = <0>;
116 clocks = <&input_clk>;
117 };
118
105 serial: serial@5000 { 119 serial: serial@5000 {
106 compatible = "snps,dw-apb-uart"; 120 compatible = "snps,dw-apb-uart";
107 reg = <0x5000 0x100>; 121 reg = <0x5000 0x100>;
@@ -120,7 +134,17 @@
120 134
121 mmcclk_ciu: mmcclk-ciu { 135 mmcclk_ciu: mmcclk-ciu {
122 compatible = "fixed-clock"; 136 compatible = "fixed-clock";
123 clock-frequency = <100000000>; 137 /*
138 * DW sdio controller has external ciu clock divider
139 * controlled via register in SDIO IP. Due to its
140 * unexpected default value (it should devide by 1
141 * but it devides by 8) SDIO IP uses wrong clock and
142 * works unstable (see STAR 9001204800)
143 * So add temporary fix and change clock frequency
144 * from 100000000 to 12500000 Hz until we fix dw sdio
145 * driver itself.
146 */
147 clock-frequency = <12500000>;
124 #clock-cells = <0>; 148 #clock-cells = <0>;
125 }; 149 };
126 150
@@ -141,6 +165,8 @@
141 clocks = <&gmacclk>; 165 clocks = <&gmacclk>;
142 clock-names = "stmmaceth"; 166 clock-names = "stmmaceth";
143 phy-handle = <&phy0>; 167 phy-handle = <&phy0>;
168 resets = <&cgu_rst HSDK_ETH_RESET>;
169 reset-names = "stmmaceth";
144 170
145 mdio { 171 mdio {
146 #address-cells = <1>; 172 #address-cells = <1>;
diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig
index 6980b966a364..ec7c849a5c8e 100644
--- a/arch/arc/configs/axs101_defconfig
+++ b/arch/arc/configs/axs101_defconfig
@@ -105,7 +105,7 @@ CONFIG_NLS_ISO8859_1=y
105# CONFIG_ENABLE_WARN_DEPRECATED is not set 105# CONFIG_ENABLE_WARN_DEPRECATED is not set
106# CONFIG_ENABLE_MUST_CHECK is not set 106# CONFIG_ENABLE_MUST_CHECK is not set
107CONFIG_STRIP_ASM_SYMS=y 107CONFIG_STRIP_ASM_SYMS=y
108CONFIG_LOCKUP_DETECTOR=y 108CONFIG_SOFTLOCKUP_DETECTOR=y
109CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 109CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
110# CONFIG_SCHED_DEBUG is not set 110# CONFIG_SCHED_DEBUG is not set
111# CONFIG_DEBUG_PREEMPT is not set 111# CONFIG_DEBUG_PREEMPT is not set
diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig
index 2233f5777a71..63d3cf69e0b0 100644
--- a/arch/arc/configs/axs103_defconfig
+++ b/arch/arc/configs/axs103_defconfig
@@ -104,7 +104,7 @@ CONFIG_NLS_ISO8859_1=y
104# CONFIG_ENABLE_WARN_DEPRECATED is not set 104# CONFIG_ENABLE_WARN_DEPRECATED is not set
105# CONFIG_ENABLE_MUST_CHECK is not set 105# CONFIG_ENABLE_MUST_CHECK is not set
106CONFIG_STRIP_ASM_SYMS=y 106CONFIG_STRIP_ASM_SYMS=y
107CONFIG_LOCKUP_DETECTOR=y 107CONFIG_SOFTLOCKUP_DETECTOR=y
108CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 108CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
109# CONFIG_SCHED_DEBUG is not set 109# CONFIG_SCHED_DEBUG is not set
110# CONFIG_DEBUG_PREEMPT is not set 110# CONFIG_DEBUG_PREEMPT is not set
diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig
index 30a3d4cf53d2..f613ecac14a7 100644
--- a/arch/arc/configs/axs103_smp_defconfig
+++ b/arch/arc/configs/axs103_smp_defconfig
@@ -107,7 +107,7 @@ CONFIG_NLS_ISO8859_1=y
107# CONFIG_ENABLE_WARN_DEPRECATED is not set 107# CONFIG_ENABLE_WARN_DEPRECATED is not set
108# CONFIG_ENABLE_MUST_CHECK is not set 108# CONFIG_ENABLE_MUST_CHECK is not set
109CONFIG_STRIP_ASM_SYMS=y 109CONFIG_STRIP_ASM_SYMS=y
110CONFIG_LOCKUP_DETECTOR=y 110CONFIG_SOFTLOCKUP_DETECTOR=y
111CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 111CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
112# CONFIG_SCHED_DEBUG is not set 112# CONFIG_SCHED_DEBUG is not set
113# CONFIG_DEBUG_PREEMPT is not set 113# CONFIG_DEBUG_PREEMPT is not set
diff --git a/arch/arc/configs/haps_hs_smp_defconfig b/arch/arc/configs/haps_hs_smp_defconfig
index 821a2e562f3f..3507be2af6fe 100644
--- a/arch/arc/configs/haps_hs_smp_defconfig
+++ b/arch/arc/configs/haps_hs_smp_defconfig
@@ -84,5 +84,5 @@ CONFIG_TMPFS=y
84CONFIG_NFS_FS=y 84CONFIG_NFS_FS=y
85# CONFIG_ENABLE_WARN_DEPRECATED is not set 85# CONFIG_ENABLE_WARN_DEPRECATED is not set
86# CONFIG_ENABLE_MUST_CHECK is not set 86# CONFIG_ENABLE_MUST_CHECK is not set
87CONFIG_LOCKUP_DETECTOR=y 87CONFIG_SOFTLOCKUP_DETECTOR=y
88# CONFIG_DEBUG_PREEMPT is not set 88# CONFIG_DEBUG_PREEMPT is not set
diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig
index 9a3fcf446388..15f0f6b5fec1 100644
--- a/arch/arc/configs/hsdk_defconfig
+++ b/arch/arc/configs/hsdk_defconfig
@@ -63,6 +63,7 @@ CONFIG_MMC_SDHCI=y
63CONFIG_MMC_SDHCI_PLTFM=y 63CONFIG_MMC_SDHCI_PLTFM=y
64CONFIG_MMC_DW=y 64CONFIG_MMC_DW=y
65# CONFIG_IOMMU_SUPPORT is not set 65# CONFIG_IOMMU_SUPPORT is not set
66CONFIG_RESET_HSDK=y
66CONFIG_EXT3_FS=y 67CONFIG_EXT3_FS=y
67CONFIG_VFAT_FS=y 68CONFIG_VFAT_FS=y
68CONFIG_TMPFS=y 69CONFIG_TMPFS=y
@@ -72,7 +73,7 @@ CONFIG_NLS_ISO8859_1=y
72# CONFIG_ENABLE_WARN_DEPRECATED is not set 73# CONFIG_ENABLE_WARN_DEPRECATED is not set
73# CONFIG_ENABLE_MUST_CHECK is not set 74# CONFIG_ENABLE_MUST_CHECK is not set
74CONFIG_STRIP_ASM_SYMS=y 75CONFIG_STRIP_ASM_SYMS=y
75CONFIG_LOCKUP_DETECTOR=y 76CONFIG_SOFTLOCKUP_DETECTOR=y
76CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 77CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
77# CONFIG_SCHED_DEBUG is not set 78# CONFIG_SCHED_DEBUG is not set
78# CONFIG_DEBUG_PREEMPT is not set 79# CONFIG_DEBUG_PREEMPT is not set
diff --git a/arch/arc/configs/vdk_hs38_defconfig b/arch/arc/configs/vdk_hs38_defconfig
index c0d6a010751a..4fcf4f2503f6 100644
--- a/arch/arc/configs/vdk_hs38_defconfig
+++ b/arch/arc/configs/vdk_hs38_defconfig
@@ -94,7 +94,7 @@ CONFIG_NLS_ISO8859_1=y
94# CONFIG_ENABLE_MUST_CHECK is not set 94# CONFIG_ENABLE_MUST_CHECK is not set
95CONFIG_STRIP_ASM_SYMS=y 95CONFIG_STRIP_ASM_SYMS=y
96CONFIG_DEBUG_SHIRQ=y 96CONFIG_DEBUG_SHIRQ=y
97CONFIG_LOCKUP_DETECTOR=y 97CONFIG_SOFTLOCKUP_DETECTOR=y
98CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 98CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
99# CONFIG_SCHED_DEBUG is not set 99# CONFIG_SCHED_DEBUG is not set
100# CONFIG_DEBUG_PREEMPT is not set 100# CONFIG_DEBUG_PREEMPT is not set
diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig
index 5c0971787acf..7b71464f6c2f 100644
--- a/arch/arc/configs/vdk_hs38_smp_defconfig
+++ b/arch/arc/configs/vdk_hs38_smp_defconfig
@@ -98,7 +98,7 @@ CONFIG_NLS_ISO8859_1=y
98# CONFIG_ENABLE_MUST_CHECK is not set 98# CONFIG_ENABLE_MUST_CHECK is not set
99CONFIG_STRIP_ASM_SYMS=y 99CONFIG_STRIP_ASM_SYMS=y
100CONFIG_DEBUG_SHIRQ=y 100CONFIG_DEBUG_SHIRQ=y
101CONFIG_LOCKUP_DETECTOR=y 101CONFIG_SOFTLOCKUP_DETECTOR=y
102CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 102CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
103# CONFIG_SCHED_DEBUG is not set 103# CONFIG_SCHED_DEBUG is not set
104# CONFIG_DEBUG_PREEMPT is not set 104# CONFIG_DEBUG_PREEMPT is not set
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index ba8e802dba80..b1c56d35f2a9 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -98,6 +98,7 @@
98 98
99/* Auxiliary registers */ 99/* Auxiliary registers */
100#define AUX_IDENTITY 4 100#define AUX_IDENTITY 4
101#define AUX_EXEC_CTRL 8
101#define AUX_INTR_VEC_BASE 0x25 102#define AUX_INTR_VEC_BASE 0x25
102#define AUX_VOL 0x5e 103#define AUX_VOL 0x5e
103 104
@@ -135,12 +136,12 @@ struct bcr_identity {
135#endif 136#endif
136}; 137};
137 138
138struct bcr_isa { 139struct bcr_isa_arcv2 {
139#ifdef CONFIG_CPU_BIG_ENDIAN 140#ifdef CONFIG_CPU_BIG_ENDIAN
140 unsigned int div_rem:4, pad2:4, ldd:1, unalign:1, atomic:1, be:1, 141 unsigned int div_rem:4, pad2:4, ldd:1, unalign:1, atomic:1, be:1,
141 pad1:11, atomic1:1, ver:8; 142 pad1:12, ver:8;
142#else 143#else
143 unsigned int ver:8, atomic1:1, pad1:11, be:1, atomic:1, unalign:1, 144 unsigned int ver:8, pad1:12, be:1, atomic:1, unalign:1,
144 ldd:1, pad2:4, div_rem:4; 145 ldd:1, pad2:4, div_rem:4;
145#endif 146#endif
146}; 147};
@@ -263,13 +264,13 @@ struct cpuinfo_arc {
263 struct cpuinfo_arc_mmu mmu; 264 struct cpuinfo_arc_mmu mmu;
264 struct cpuinfo_arc_bpu bpu; 265 struct cpuinfo_arc_bpu bpu;
265 struct bcr_identity core; 266 struct bcr_identity core;
266 struct bcr_isa isa; 267 struct bcr_isa_arcv2 isa;
267 const char *details, *name; 268 const char *details, *name;
268 unsigned int vec_base; 269 unsigned int vec_base;
269 struct cpuinfo_arc_ccm iccm, dccm; 270 struct cpuinfo_arc_ccm iccm, dccm;
270 struct { 271 struct {
271 unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2, 272 unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2,
272 fpu_sp:1, fpu_dp:1, pad2:6, 273 fpu_sp:1, fpu_dp:1, dual_iss_enb:1, dual_iss_exist:1, pad2:4,
273 debug:1, ap:1, smart:1, rtt:1, pad3:4, 274 debug:1, ap:1, smart:1, rtt:1, pad3:4,
274 timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; 275 timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4;
275 } extn; 276 } extn;
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 877cec8f5ea2..fb83844daeea 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -51,6 +51,7 @@ static const struct id_to_str arc_cpu_rel[] = {
51 { 0x51, "R2.0" }, 51 { 0x51, "R2.0" },
52 { 0x52, "R2.1" }, 52 { 0x52, "R2.1" },
53 { 0x53, "R3.0" }, 53 { 0x53, "R3.0" },
54 { 0x54, "R4.0" },
54#endif 55#endif
55 { 0x00, NULL } 56 { 0x00, NULL }
56}; 57};
@@ -62,6 +63,7 @@ static const struct id_to_str arc_cpu_nm[] = {
62#else 63#else
63 { 0x40, "ARC EM" }, 64 { 0x40, "ARC EM" },
64 { 0x50, "ARC HS38" }, 65 { 0x50, "ARC HS38" },
66 { 0x54, "ARC HS48" },
65#endif 67#endif
66 { 0x00, "Unknown" } 68 { 0x00, "Unknown" }
67}; 69};
@@ -119,11 +121,11 @@ static void read_arc_build_cfg_regs(void)
119 struct bcr_generic bcr; 121 struct bcr_generic bcr;
120 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 122 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
121 const struct id_to_str *tbl; 123 const struct id_to_str *tbl;
124 struct bcr_isa_arcv2 isa;
122 125
123 FIX_PTR(cpu); 126 FIX_PTR(cpu);
124 127
125 READ_BCR(AUX_IDENTITY, cpu->core); 128 READ_BCR(AUX_IDENTITY, cpu->core);
126 READ_BCR(ARC_REG_ISA_CFG_BCR, cpu->isa);
127 129
128 for (tbl = &arc_cpu_rel[0]; tbl->id != 0; tbl++) { 130 for (tbl = &arc_cpu_rel[0]; tbl->id != 0; tbl++) {
129 if (cpu->core.family == tbl->id) { 131 if (cpu->core.family == tbl->id) {
@@ -133,7 +135,7 @@ static void read_arc_build_cfg_regs(void)
133 } 135 }
134 136
135 for (tbl = &arc_cpu_nm[0]; tbl->id != 0; tbl++) { 137 for (tbl = &arc_cpu_nm[0]; tbl->id != 0; tbl++) {
136 if ((cpu->core.family & 0xF0) == tbl->id) 138 if ((cpu->core.family & 0xF4) == tbl->id)
137 break; 139 break;
138 } 140 }
139 cpu->name = tbl->str; 141 cpu->name = tbl->str;
@@ -192,6 +194,14 @@ static void read_arc_build_cfg_regs(void)
192 cpu->bpu.full = bpu.ft; 194 cpu->bpu.full = bpu.ft;
193 cpu->bpu.num_cache = 256 << bpu.bce; 195 cpu->bpu.num_cache = 256 << bpu.bce;
194 cpu->bpu.num_pred = 2048 << bpu.pte; 196 cpu->bpu.num_pred = 2048 << bpu.pte;
197
198 if (cpu->core.family >= 0x54) {
199 unsigned int exec_ctrl;
200
201 READ_BCR(AUX_EXEC_CTRL, exec_ctrl);
202 cpu->extn.dual_iss_exist = 1;
203 cpu->extn.dual_iss_enb = exec_ctrl & 1;
204 }
195 } 205 }
196 206
197 READ_BCR(ARC_REG_AP_BCR, bcr); 207 READ_BCR(ARC_REG_AP_BCR, bcr);
@@ -205,18 +215,25 @@ static void read_arc_build_cfg_regs(void)
205 215
206 cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt; 216 cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt;
207 217
218 READ_BCR(ARC_REG_ISA_CFG_BCR, isa);
219
208 /* some hacks for lack of feature BCR info in old ARC700 cores */ 220 /* some hacks for lack of feature BCR info in old ARC700 cores */
209 if (is_isa_arcompact()) { 221 if (is_isa_arcompact()) {
210 if (!cpu->isa.ver) /* ISA BCR absent, use Kconfig info */ 222 if (!isa.ver) /* ISA BCR absent, use Kconfig info */
211 cpu->isa.atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC); 223 cpu->isa.atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC);
212 else 224 else {
213 cpu->isa.atomic = cpu->isa.atomic1; 225 /* ARC700_BUILD only has 2 bits of isa info */
226 struct bcr_generic bcr = *(struct bcr_generic *)&isa;
227 cpu->isa.atomic = bcr.info & 1;
228 }
214 229
215 cpu->isa.be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN); 230 cpu->isa.be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN);
216 231
217 /* there's no direct way to distinguish 750 vs. 770 */ 232 /* there's no direct way to distinguish 750 vs. 770 */
218 if (unlikely(cpu->core.family < 0x34 || cpu->mmu.ver < 3)) 233 if (unlikely(cpu->core.family < 0x34 || cpu->mmu.ver < 3))
219 cpu->name = "ARC750"; 234 cpu->name = "ARC750";
235 } else {
236 cpu->isa = isa;
220 } 237 }
221} 238}
222 239
@@ -232,10 +249,11 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
232 "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n", 249 "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n",
233 core->family, core->cpu_id, core->chip_id); 250 core->family, core->cpu_id, core->chip_id);
234 251
235 n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s\n", 252 n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s%s%s\n",
236 cpu_id, cpu->name, cpu->details, 253 cpu_id, cpu->name, cpu->details,
237 is_isa_arcompact() ? "ARCompact" : "ARCv2", 254 is_isa_arcompact() ? "ARCompact" : "ARCv2",
238 IS_AVAIL1(cpu->isa.be, "[Big-Endian]")); 255 IS_AVAIL1(cpu->isa.be, "[Big-Endian]"),
256 IS_AVAIL3(cpu->extn.dual_iss_exist, cpu->extn.dual_iss_enb, " Dual-Issue"));
239 257
240 n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s%s%s\nISA Extn\t: ", 258 n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s%s%s\nISA Extn\t: ",
241 IS_AVAIL1(cpu->extn.timer0, "Timer0 "), 259 IS_AVAIL1(cpu->extn.timer0, "Timer0 "),
diff --git a/arch/arc/plat-axs10x/axs10x.c b/arch/arc/plat-axs10x/axs10x.c
index f1ac6790da5f..cf14ebc36916 100644
--- a/arch/arc/plat-axs10x/axs10x.c
+++ b/arch/arc/plat-axs10x/axs10x.c
@@ -111,6 +111,13 @@ static void __init axs10x_early_init(void)
111 111
112 axs10x_enable_gpio_intc_wire(); 112 axs10x_enable_gpio_intc_wire();
113 113
114 /*
115 * Reset ethernet IP core.
116 * TODO: get rid of this quirk after axs10x reset driver (or simple
117 * reset driver) will be available in upstream.
118 */
119 iowrite32((1 << 5), (void __iomem *) CREG_MB_SW_RESET);
120
114 scnprintf(mb, 32, "MainBoard v%d", mb_rev); 121 scnprintf(mb, 32, "MainBoard v%d", mb_rev);
115 axs10x_print_board_ver(CREG_MB_VER, mb); 122 axs10x_print_board_ver(CREG_MB_VER, mb);
116} 123}
diff --git a/arch/arc/plat-hsdk/Kconfig b/arch/arc/plat-hsdk/Kconfig
index 5a6ed5afb009..bd08de4be75e 100644
--- a/arch/arc/plat-hsdk/Kconfig
+++ b/arch/arc/plat-hsdk/Kconfig
@@ -6,4 +6,5 @@
6# 6#
7 7
8menuconfig ARC_SOC_HSDK 8menuconfig ARC_SOC_HSDK
9 bool "ARC HS Development Kit SOC" 9 bool "ARC HS Development Kit SOC"
10 select CLK_HSDK
diff --git a/arch/arc/plat-hsdk/platform.c b/arch/arc/plat-hsdk/platform.c
index a2e7fd17e36d..744e62e58788 100644
--- a/arch/arc/plat-hsdk/platform.c
+++ b/arch/arc/plat-hsdk/platform.c
@@ -38,6 +38,42 @@ static void __init hsdk_init_per_cpu(unsigned int cpu)
38#define CREG_PAE (CREG_BASE + 0x180) 38#define CREG_PAE (CREG_BASE + 0x180)
39#define CREG_PAE_UPDATE (CREG_BASE + 0x194) 39#define CREG_PAE_UPDATE (CREG_BASE + 0x194)
40 40
41#define CREG_CORE_IF_CLK_DIV (CREG_BASE + 0x4B8)
42#define CREG_CORE_IF_CLK_DIV_2 0x1
43#define CGU_BASE ARC_PERIPHERAL_BASE
44#define CGU_PLL_STATUS (ARC_PERIPHERAL_BASE + 0x4)
45#define CGU_PLL_CTRL (ARC_PERIPHERAL_BASE + 0x0)
46#define CGU_PLL_STATUS_LOCK BIT(0)
47#define CGU_PLL_STATUS_ERR BIT(1)
48#define CGU_PLL_CTRL_1GHZ 0x3A10
49#define HSDK_PLL_LOCK_TIMEOUT 500
50
51#define HSDK_PLL_LOCKED() \
52 !!(ioread32((void __iomem *) CGU_PLL_STATUS) & CGU_PLL_STATUS_LOCK)
53
54#define HSDK_PLL_ERR() \
55 !!(ioread32((void __iomem *) CGU_PLL_STATUS) & CGU_PLL_STATUS_ERR)
56
57static void __init hsdk_set_cpu_freq_1ghz(void)
58{
59 u32 timeout = HSDK_PLL_LOCK_TIMEOUT;
60
61 /*
62 * As we set cpu clock which exceeds 500MHz, the divider for the interface
63 * clock must be programmed to div-by-2.
64 */
65 iowrite32(CREG_CORE_IF_CLK_DIV_2, (void __iomem *) CREG_CORE_IF_CLK_DIV);
66
67 /* Set cpu clock to 1GHz */
68 iowrite32(CGU_PLL_CTRL_1GHZ, (void __iomem *) CGU_PLL_CTRL);
69
70 while (!HSDK_PLL_LOCKED() && timeout--)
71 cpu_relax();
72
73 if (!HSDK_PLL_LOCKED() || HSDK_PLL_ERR())
74 pr_err("Failed to setup CPU frequency to 1GHz!");
75}
76
41static void __init hsdk_init_early(void) 77static void __init hsdk_init_early(void)
42{ 78{
43 /* 79 /*
@@ -52,6 +88,12 @@ static void __init hsdk_init_early(void)
52 88
53 /* Really apply settings made above */ 89 /* Really apply settings made above */
54 writel(1, (void __iomem *) CREG_PAE_UPDATE); 90 writel(1, (void __iomem *) CREG_PAE_UPDATE);
91
92 /*
93 * Setup CPU frequency to 1GHz.
94 * TODO: remove it after smart hsdk pll driver will be introduced.
95 */
96 hsdk_set_cpu_freq_1ghz();
55} 97}
56 98
57static const char *hsdk_compat[] __initconst = { 99static const char *hsdk_compat[] __initconst = {
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index 3585a5e26151..f7c4d2146aed 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -95,16 +95,19 @@
95#define KERNEL_END _end 95#define KERNEL_END _end
96 96
97/* 97/*
98 * The size of the KASAN shadow region. This should be 1/8th of the 98 * KASAN requires 1/8th of the kernel virtual address space for the shadow
99 * size of the entire kernel virtual address space. 99 * region. KASAN can bloat the stack significantly, so double the (minimum)
100 * stack size when KASAN is in use.
100 */ 101 */
101#ifdef CONFIG_KASAN 102#ifdef CONFIG_KASAN
102#define KASAN_SHADOW_SIZE (UL(1) << (VA_BITS - 3)) 103#define KASAN_SHADOW_SIZE (UL(1) << (VA_BITS - 3))
104#define KASAN_THREAD_SHIFT 1
103#else 105#else
104#define KASAN_SHADOW_SIZE (0) 106#define KASAN_SHADOW_SIZE (0)
107#define KASAN_THREAD_SHIFT 0
105#endif 108#endif
106 109
107#define MIN_THREAD_SHIFT 14 110#define MIN_THREAD_SHIFT (14 + KASAN_THREAD_SHIFT)
108 111
109/* 112/*
110 * VMAP'd stacks are allocated at page granularity, so we must ensure that such 113 * VMAP'd stacks are allocated at page granularity, so we must ensure that such
diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
index f0e6d717885b..d06fbe4cd38d 100644
--- a/arch/arm64/kernel/armv8_deprecated.c
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -649,4 +649,4 @@ static int __init armv8_deprecated_init(void)
649 return 0; 649 return 0;
650} 650}
651 651
652late_initcall(armv8_deprecated_init); 652core_initcall(armv8_deprecated_init);
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index cd52d365d1f0..21e2c95d24e7 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1307,4 +1307,4 @@ static int __init enable_mrs_emulation(void)
1307 return 0; 1307 return 0;
1308} 1308}
1309 1309
1310late_initcall(enable_mrs_emulation); 1310core_initcall(enable_mrs_emulation);
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index f444f374bd7b..5d547deb6996 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -444,4 +444,4 @@ static int __init fpsimd_init(void)
444 444
445 return 0; 445 return 0;
446} 446}
447late_initcall(fpsimd_init); 447core_initcall(fpsimd_init);
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 2069e9bc0fca..b64958b23a7f 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -97,7 +97,7 @@ static void data_abort_decode(unsigned int esr)
97 (esr & ESR_ELx_SF) >> ESR_ELx_SF_SHIFT, 97 (esr & ESR_ELx_SF) >> ESR_ELx_SF_SHIFT,
98 (esr & ESR_ELx_AR) >> ESR_ELx_AR_SHIFT); 98 (esr & ESR_ELx_AR) >> ESR_ELx_AR_SHIFT);
99 } else { 99 } else {
100 pr_alert(" ISV = 0, ISS = 0x%08lu\n", esr & ESR_ELx_ISS_MASK); 100 pr_alert(" ISV = 0, ISS = 0x%08lx\n", esr & ESR_ELx_ISS_MASK);
101 } 101 }
102 102
103 pr_alert(" CM = %lu, WnR = %lu\n", 103 pr_alert(" CM = %lu, WnR = %lu\n",
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index a45a67d526f8..30f92391a93e 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -146,7 +146,7 @@ void machine_power_off(void)
146 146
147 /* prevent soft lockup/stalled CPU messages for endless loop. */ 147 /* prevent soft lockup/stalled CPU messages for endless loop. */
148 rcu_sysrq_start(); 148 rcu_sysrq_start();
149 lockup_detector_suspend(); 149 lockup_detector_soft_poweroff();
150 for (;;); 150 for (;;);
151} 151}
152 152
diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index 1df770e8cbe0..7275fed271af 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -102,10 +102,10 @@ static void cpufeatures_flush_tlb(void)
102 case PVR_POWER8: 102 case PVR_POWER8:
103 case PVR_POWER8E: 103 case PVR_POWER8E:
104 case PVR_POWER8NVL: 104 case PVR_POWER8NVL:
105 __flush_tlb_power8(POWER8_TLB_SETS); 105 __flush_tlb_power8(TLB_INVAL_SCOPE_GLOBAL);
106 break; 106 break;
107 case PVR_POWER9: 107 case PVR_POWER9:
108 __flush_tlb_power9(POWER9_TLB_SETS_HASH); 108 __flush_tlb_power9(TLB_INVAL_SCOPE_GLOBAL);
109 break; 109 break;
110 default: 110 default:
111 pr_err("unknown CPU version for boot TLB flush\n"); 111 pr_err("unknown CPU version for boot TLB flush\n");
diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c
index b76ca198e09c..72f153c6f3fa 100644
--- a/arch/powerpc/kernel/mce_power.c
+++ b/arch/powerpc/kernel/mce_power.c
@@ -624,5 +624,18 @@ long __machine_check_early_realmode_p8(struct pt_regs *regs)
624 624
625long __machine_check_early_realmode_p9(struct pt_regs *regs) 625long __machine_check_early_realmode_p9(struct pt_regs *regs)
626{ 626{
627 /*
628 * On POWER9 DD2.1 and below, it's possible to get a machine check
629 * caused by a paste instruction where only DSISR bit 25 is set. This
630 * will result in the MCE handler seeing an unknown event and the kernel
631 * crashing. An MCE that occurs like this is spurious, so we don't need
632 * to do anything in terms of servicing it. If there is something that
633 * needs to be serviced, the CPU will raise the MCE again with the
634 * correct DSISR so that it can be serviced properly. So detect this
635 * case and mark it as handled.
636 */
637 if (SRR1_MC_LOADSTORE(regs->msr) && regs->dsisr == 0x02000000)
638 return 1;
639
627 return mce_handle_error(regs, mce_p9_derror_table, mce_p9_ierror_table); 640 return mce_handle_error(regs, mce_p9_derror_table, mce_p9_ierror_table);
628} 641}
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 0ac741fae90e..2e3bc16d02b2 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -904,9 +904,6 @@ void __init setup_arch(char **cmdline_p)
904#endif 904#endif
905#endif 905#endif
906 906
907#ifdef CONFIG_PPC_64K_PAGES
908 init_mm.context.pte_frag = NULL;
909#endif
910#ifdef CONFIG_SPAPR_TCE_IOMMU 907#ifdef CONFIG_SPAPR_TCE_IOMMU
911 mm_iommu_init(&init_mm); 908 mm_iommu_init(&init_mm);
912#endif 909#endif
diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c
index 2f6eadd9408d..c702a8981452 100644
--- a/arch/powerpc/kernel/watchdog.c
+++ b/arch/powerpc/kernel/watchdog.c
@@ -310,9 +310,6 @@ static int start_wd_on_cpu(unsigned int cpu)
310 if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) 310 if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED))
311 return 0; 311 return 0;
312 312
313 if (watchdog_suspended)
314 return 0;
315
316 if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) 313 if (!cpumask_test_cpu(cpu, &watchdog_cpumask))
317 return 0; 314 return 0;
318 315
@@ -358,36 +355,39 @@ static void watchdog_calc_timeouts(void)
358 wd_timer_period_ms = watchdog_thresh * 1000 * 2 / 5; 355 wd_timer_period_ms = watchdog_thresh * 1000 * 2 / 5;
359} 356}
360 357
361void watchdog_nmi_reconfigure(void) 358void watchdog_nmi_stop(void)
362{ 359{
363 int cpu; 360 int cpu;
364 361
365 watchdog_calc_timeouts();
366
367 for_each_cpu(cpu, &wd_cpus_enabled) 362 for_each_cpu(cpu, &wd_cpus_enabled)
368 stop_wd_on_cpu(cpu); 363 stop_wd_on_cpu(cpu);
364}
369 365
366void watchdog_nmi_start(void)
367{
368 int cpu;
369
370 watchdog_calc_timeouts();
370 for_each_cpu_and(cpu, cpu_online_mask, &watchdog_cpumask) 371 for_each_cpu_and(cpu, cpu_online_mask, &watchdog_cpumask)
371 start_wd_on_cpu(cpu); 372 start_wd_on_cpu(cpu);
372} 373}
373 374
374/* 375/*
375 * This runs after lockup_detector_init() which sets up watchdog_cpumask. 376 * Invoked from core watchdog init.
376 */ 377 */
377static int __init powerpc_watchdog_init(void) 378int __init watchdog_nmi_probe(void)
378{ 379{
379 int err; 380 int err;
380 381
381 watchdog_calc_timeouts(); 382 err = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
382 383 "powerpc/watchdog:online",
383 err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "powerpc/watchdog:online", 384 start_wd_on_cpu, stop_wd_on_cpu);
384 start_wd_on_cpu, stop_wd_on_cpu); 385 if (err < 0) {
385 if (err < 0)
386 pr_warn("Watchdog could not be initialized"); 386 pr_warn("Watchdog could not be initialized");
387 387 return err;
388 }
388 return 0; 389 return 0;
389} 390}
390arch_initcall(powerpc_watchdog_init);
391 391
392static void handle_backtrace_ipi(struct pt_regs *regs) 392static void handle_backtrace_ipi(struct pt_regs *regs)
393{ 393{
diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
index 13304622ab1c..bf457843e032 100644
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -622,7 +622,7 @@ int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server,
622 return -EINVAL; 622 return -EINVAL;
623 state = &sb->irq_state[idx]; 623 state = &sb->irq_state[idx];
624 arch_spin_lock(&sb->lock); 624 arch_spin_lock(&sb->lock);
625 *server = state->guest_server; 625 *server = state->act_server;
626 *priority = state->guest_priority; 626 *priority = state->guest_priority;
627 arch_spin_unlock(&sb->lock); 627 arch_spin_unlock(&sb->lock);
628 628
@@ -1331,7 +1331,7 @@ static int xive_get_source(struct kvmppc_xive *xive, long irq, u64 addr)
1331 xive->saved_src_count++; 1331 xive->saved_src_count++;
1332 1332
1333 /* Convert saved state into something compatible with xics */ 1333 /* Convert saved state into something compatible with xics */
1334 val = state->guest_server; 1334 val = state->act_server;
1335 prio = state->saved_scan_prio; 1335 prio = state->saved_scan_prio;
1336 1336
1337 if (prio == MASKED) { 1337 if (prio == MASKED) {
@@ -1507,7 +1507,6 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
1507 /* First convert prio and mark interrupt as untargetted */ 1507 /* First convert prio and mark interrupt as untargetted */
1508 act_prio = xive_prio_from_guest(guest_prio); 1508 act_prio = xive_prio_from_guest(guest_prio);
1509 state->act_priority = MASKED; 1509 state->act_priority = MASKED;
1510 state->guest_server = server;
1511 1510
1512 /* 1511 /*
1513 * We need to drop the lock due to the mutex below. Hopefully 1512 * We need to drop the lock due to the mutex below. Hopefully
diff --git a/arch/powerpc/kvm/book3s_xive.h b/arch/powerpc/kvm/book3s_xive.h
index 5938f7644dc1..6ba63f8e8a61 100644
--- a/arch/powerpc/kvm/book3s_xive.h
+++ b/arch/powerpc/kvm/book3s_xive.h
@@ -35,7 +35,6 @@ struct kvmppc_xive_irq_state {
35 struct xive_irq_data *pt_data; /* XIVE Pass-through associated data */ 35 struct xive_irq_data *pt_data; /* XIVE Pass-through associated data */
36 36
37 /* Targetting as set by guest */ 37 /* Targetting as set by guest */
38 u32 guest_server; /* Current guest selected target */
39 u8 guest_priority; /* Guest set priority */ 38 u8 guest_priority; /* Guest set priority */
40 u8 saved_priority; /* Saved priority when masking */ 39 u8 saved_priority; /* Saved priority when masking */
41 40
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 65eda1997c3f..f6c7f54c0515 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -361,9 +361,9 @@ static int change_page_attr(struct page *page, int numpages, pgprot_t prot)
361 break; 361 break;
362 } 362 }
363 wmb(); 363 wmb();
364 local_irq_restore(flags);
364 flush_tlb_kernel_range((unsigned long)page_address(start), 365 flush_tlb_kernel_range((unsigned long)page_address(start),
365 (unsigned long)page_address(page)); 366 (unsigned long)page_address(page));
366 local_irq_restore(flags);
367 return err; 367 return err;
368} 368}
369 369
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 897aa1400eb8..bbb73aa0eb8f 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -272,7 +272,15 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
272#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE 272#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
273static unsigned long pnv_memory_block_size(void) 273static unsigned long pnv_memory_block_size(void)
274{ 274{
275 return 256UL * 1024 * 1024; 275 /*
276 * We map the kernel linear region with 1GB large pages on radix. For
277 * memory hot unplug to work our memory block size must be at least
278 * this size.
279 */
280 if (radix_enabled())
281 return 1UL * 1024 * 1024 * 1024;
282 else
283 return 256UL * 1024 * 1024;
276} 284}
277#endif 285#endif
278 286
diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index f387318678b9..a3b8d7d1316e 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -1402,6 +1402,14 @@ void xive_teardown_cpu(void)
1402 1402
1403 if (xive_ops->teardown_cpu) 1403 if (xive_ops->teardown_cpu)
1404 xive_ops->teardown_cpu(cpu, xc); 1404 xive_ops->teardown_cpu(cpu, xc);
1405
1406#ifdef CONFIG_SMP
1407 /* Get rid of IPI */
1408 xive_cleanup_cpu_ipi(cpu, xc);
1409#endif
1410
1411 /* Disable and free the queues */
1412 xive_cleanup_cpu_queues(cpu, xc);
1405} 1413}
1406 1414
1407void xive_kexec_teardown_cpu(int secondary) 1415void xive_kexec_teardown_cpu(int secondary)
diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/spapr.c
index f24a70bc6855..d9c4c9366049 100644
--- a/arch/powerpc/sysdev/xive/spapr.c
+++ b/arch/powerpc/sysdev/xive/spapr.c
@@ -431,7 +431,11 @@ static int xive_spapr_get_ipi(unsigned int cpu, struct xive_cpu *xc)
431 431
432static void xive_spapr_put_ipi(unsigned int cpu, struct xive_cpu *xc) 432static void xive_spapr_put_ipi(unsigned int cpu, struct xive_cpu *xc)
433{ 433{
434 if (!xc->hw_ipi)
435 return;
436
434 xive_irq_bitmap_free(xc->hw_ipi); 437 xive_irq_bitmap_free(xc->hw_ipi);
438 xc->hw_ipi = 0;
435} 439}
436#endif /* CONFIG_SMP */ 440#endif /* CONFIG_SMP */
437 441
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 829e89cfcee2..9fb9a1f1e47b 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -4409,10 +4409,9 @@ static __init int fixup_ht_bug(void)
4409 return 0; 4409 return 0;
4410 } 4410 }
4411 4411
4412 if (lockup_detector_suspend() != 0) { 4412 cpus_read_lock();
4413 pr_debug("failed to disable PMU erratum BJ122, BV98, HSD29 workaround\n"); 4413
4414 return 0; 4414 hardlockup_detector_perf_stop();
4415 }
4416 4415
4417 x86_pmu.flags &= ~(PMU_FL_EXCL_CNTRS | PMU_FL_EXCL_ENABLED); 4416 x86_pmu.flags &= ~(PMU_FL_EXCL_CNTRS | PMU_FL_EXCL_ENABLED);
4418 4417
@@ -4420,9 +4419,7 @@ static __init int fixup_ht_bug(void)
4420 x86_pmu.commit_scheduling = NULL; 4419 x86_pmu.commit_scheduling = NULL;
4421 x86_pmu.stop_scheduling = NULL; 4420 x86_pmu.stop_scheduling = NULL;
4422 4421
4423 lockup_detector_resume(); 4422 hardlockup_detector_perf_restart();
4424
4425 cpus_read_lock();
4426 4423
4427 for_each_online_cpu(c) 4424 for_each_online_cpu(c)
4428 free_excl_cntrs(c); 4425 free_excl_cntrs(c);
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
index bc62e7cbf1b1..59ad3d132353 100644
--- a/arch/x86/include/asm/kvm_para.h
+++ b/arch/x86/include/asm/kvm_para.h
@@ -88,7 +88,7 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
88bool kvm_para_available(void); 88bool kvm_para_available(void);
89unsigned int kvm_arch_para_features(void); 89unsigned int kvm_arch_para_features(void);
90void __init kvm_guest_init(void); 90void __init kvm_guest_init(void);
91void kvm_async_pf_task_wait(u32 token); 91void kvm_async_pf_task_wait(u32 token, int interrupt_kernel);
92void kvm_async_pf_task_wake(u32 token); 92void kvm_async_pf_task_wake(u32 token);
93u32 kvm_read_and_reset_pf_reason(void); 93u32 kvm_read_and_reset_pf_reason(void);
94extern void kvm_disable_steal_time(void); 94extern void kvm_disable_steal_time(void);
@@ -103,7 +103,7 @@ static inline void kvm_spinlock_init(void)
103 103
104#else /* CONFIG_KVM_GUEST */ 104#else /* CONFIG_KVM_GUEST */
105#define kvm_guest_init() do {} while (0) 105#define kvm_guest_init() do {} while (0)
106#define kvm_async_pf_task_wait(T) do {} while(0) 106#define kvm_async_pf_task_wait(T, I) do {} while(0)
107#define kvm_async_pf_task_wake(T) do {} while(0) 107#define kvm_async_pf_task_wake(T) do {} while(0)
108 108
109static inline bool kvm_para_available(void) 109static inline bool kvm_para_available(void)
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index e675704fa6f7..8bb9594d0761 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -117,7 +117,11 @@ static struct kvm_task_sleep_node *_find_apf_task(struct kvm_task_sleep_head *b,
117 return NULL; 117 return NULL;
118} 118}
119 119
120void kvm_async_pf_task_wait(u32 token) 120/*
121 * @interrupt_kernel: Is this called from a routine which interrupts the kernel
122 * (other than user space)?
123 */
124void kvm_async_pf_task_wait(u32 token, int interrupt_kernel)
121{ 125{
122 u32 key = hash_32(token, KVM_TASK_SLEEP_HASHBITS); 126 u32 key = hash_32(token, KVM_TASK_SLEEP_HASHBITS);
123 struct kvm_task_sleep_head *b = &async_pf_sleepers[key]; 127 struct kvm_task_sleep_head *b = &async_pf_sleepers[key];
@@ -140,8 +144,10 @@ void kvm_async_pf_task_wait(u32 token)
140 144
141 n.token = token; 145 n.token = token;
142 n.cpu = smp_processor_id(); 146 n.cpu = smp_processor_id();
143 n.halted = is_idle_task(current) || preempt_count() > 1 || 147 n.halted = is_idle_task(current) ||
144 rcu_preempt_depth(); 148 (IS_ENABLED(CONFIG_PREEMPT_COUNT)
149 ? preempt_count() > 1 || rcu_preempt_depth()
150 : interrupt_kernel);
145 init_swait_queue_head(&n.wq); 151 init_swait_queue_head(&n.wq);
146 hlist_add_head(&n.link, &b->list); 152 hlist_add_head(&n.link, &b->list);
147 raw_spin_unlock(&b->lock); 153 raw_spin_unlock(&b->lock);
@@ -269,7 +275,7 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code)
269 case KVM_PV_REASON_PAGE_NOT_PRESENT: 275 case KVM_PV_REASON_PAGE_NOT_PRESENT:
270 /* page is swapped out by the host. */ 276 /* page is swapped out by the host. */
271 prev_state = exception_enter(); 277 prev_state = exception_enter();
272 kvm_async_pf_task_wait((u32)read_cr2()); 278 kvm_async_pf_task_wait((u32)read_cr2(), !user_mode(regs));
273 exception_exit(prev_state); 279 exception_exit(prev_state);
274 break; 280 break;
275 case KVM_PV_REASON_PAGE_READY: 281 case KVM_PV_REASON_PAGE_READY:
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 3ea624452f93..3c48bc8bf08c 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -23,6 +23,7 @@ config KVM
23 depends on HIGH_RES_TIMERS 23 depends on HIGH_RES_TIMERS
24 # for TASKSTATS/TASK_DELAY_ACCT: 24 # for TASKSTATS/TASK_DELAY_ACCT:
25 depends on NET && MULTIUSER 25 depends on NET && MULTIUSER
26 depends on X86_LOCAL_APIC
26 select PREEMPT_NOTIFIERS 27 select PREEMPT_NOTIFIERS
27 select MMU_NOTIFIER 28 select MMU_NOTIFIER
28 select ANON_INODES 29 select ANON_INODES
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index a36254cbf776..d90cdc77e077 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -425,8 +425,10 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
425 #op " %al \n\t" \ 425 #op " %al \n\t" \
426 FOP_RET 426 FOP_RET
427 427
428asm(".global kvm_fastop_exception \n" 428asm(".pushsection .fixup, \"ax\"\n"
429 "kvm_fastop_exception: xor %esi, %esi; ret"); 429 ".global kvm_fastop_exception \n"
430 "kvm_fastop_exception: xor %esi, %esi; ret\n"
431 ".popsection");
430 432
431FOP_START(setcc) 433FOP_START(setcc)
432FOP_SETCC(seto) 434FOP_SETCC(seto)
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index eca30c1eb1d9..106d4a029a8a 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3837,7 +3837,7 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code,
3837 case KVM_PV_REASON_PAGE_NOT_PRESENT: 3837 case KVM_PV_REASON_PAGE_NOT_PRESENT:
3838 vcpu->arch.apf.host_apf_reason = 0; 3838 vcpu->arch.apf.host_apf_reason = 0;
3839 local_irq_disable(); 3839 local_irq_disable();
3840 kvm_async_pf_task_wait(fault_address); 3840 kvm_async_pf_task_wait(fault_address, 0);
3841 local_irq_enable(); 3841 local_irq_enable();
3842 break; 3842 break;
3843 case KVM_PV_REASON_PAGE_READY: 3843 case KVM_PV_REASON_PAGE_READY:
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 980e73095643..de294d775acf 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -815,10 +815,14 @@ int blk_mq_debugfs_register(struct request_queue *q)
815 goto err; 815 goto err;
816 816
817 /* 817 /*
818 * blk_mq_init_hctx() attempted to do this already, but q->debugfs_dir 818 * blk_mq_init_sched() attempted to do this already, but q->debugfs_dir
819 * didn't exist yet (because we don't know what to name the directory 819 * didn't exist yet (because we don't know what to name the directory
820 * until the queue is registered to a gendisk). 820 * until the queue is registered to a gendisk).
821 */ 821 */
822 if (q->elevator && !q->sched_debugfs_dir)
823 blk_mq_debugfs_register_sched(q);
824
825 /* Similarly, blk_mq_init_hctx() couldn't do this previously. */
822 queue_for_each_hw_ctx(q, hctx, i) { 826 queue_for_each_hw_ctx(q, hctx, i) {
823 if (!hctx->debugfs_dir && blk_mq_debugfs_register_hctx(q, hctx)) 827 if (!hctx->debugfs_dir && blk_mq_debugfs_register_hctx(q, hctx))
824 goto err; 828 goto err;
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 0fea76aa0f3f..17816a028dcb 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1911,11 +1911,11 @@ static void throtl_upgrade_state(struct throtl_data *td)
1911 1911
1912 tg->disptime = jiffies - 1; 1912 tg->disptime = jiffies - 1;
1913 throtl_select_dispatch(sq); 1913 throtl_select_dispatch(sq);
1914 throtl_schedule_next_dispatch(sq, false); 1914 throtl_schedule_next_dispatch(sq, true);
1915 } 1915 }
1916 rcu_read_unlock(); 1916 rcu_read_unlock();
1917 throtl_select_dispatch(&td->service_queue); 1917 throtl_select_dispatch(&td->service_queue);
1918 throtl_schedule_next_dispatch(&td->service_queue, false); 1918 throtl_schedule_next_dispatch(&td->service_queue, true);
1919 queue_work(kthrotld_workqueue, &td->dispatch_work); 1919 queue_work(kthrotld_workqueue, &td->dispatch_work);
1920} 1920}
1921 1921
diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index dbddff8174e5..15d25ccd51a5 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -207,20 +207,34 @@ static int bsg_init_rq(struct request_queue *q, struct request *req, gfp_t gfp)
207 struct bsg_job *job = blk_mq_rq_to_pdu(req); 207 struct bsg_job *job = blk_mq_rq_to_pdu(req);
208 struct scsi_request *sreq = &job->sreq; 208 struct scsi_request *sreq = &job->sreq;
209 209
210 /* called right after the request is allocated for the request_queue */
211
212 sreq->sense = kzalloc(SCSI_SENSE_BUFFERSIZE, gfp);
213 if (!sreq->sense)
214 return -ENOMEM;
215
216 return 0;
217}
218
219static void bsg_initialize_rq(struct request *req)
220{
221 struct bsg_job *job = blk_mq_rq_to_pdu(req);
222 struct scsi_request *sreq = &job->sreq;
223 void *sense = sreq->sense;
224
225 /* called right before the request is given to the request_queue user */
226
210 memset(job, 0, sizeof(*job)); 227 memset(job, 0, sizeof(*job));
211 228
212 scsi_req_init(sreq); 229 scsi_req_init(sreq);
230
231 sreq->sense = sense;
213 sreq->sense_len = SCSI_SENSE_BUFFERSIZE; 232 sreq->sense_len = SCSI_SENSE_BUFFERSIZE;
214 sreq->sense = kzalloc(sreq->sense_len, gfp);
215 if (!sreq->sense)
216 return -ENOMEM;
217 233
218 job->req = req; 234 job->req = req;
219 job->reply = sreq->sense; 235 job->reply = sense;
220 job->reply_len = sreq->sense_len; 236 job->reply_len = sreq->sense_len;
221 job->dd_data = job + 1; 237 job->dd_data = job + 1;
222
223 return 0;
224} 238}
225 239
226static void bsg_exit_rq(struct request_queue *q, struct request *req) 240static void bsg_exit_rq(struct request_queue *q, struct request *req)
@@ -251,6 +265,7 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
251 q->cmd_size = sizeof(struct bsg_job) + dd_job_size; 265 q->cmd_size = sizeof(struct bsg_job) + dd_job_size;
252 q->init_rq_fn = bsg_init_rq; 266 q->init_rq_fn = bsg_init_rq;
253 q->exit_rq_fn = bsg_exit_rq; 267 q->exit_rq_fn = bsg_exit_rq;
268 q->initialize_rq_fn = bsg_initialize_rq;
254 q->request_fn = bsg_request_fn; 269 q->request_fn = bsg_request_fn;
255 270
256 ret = blk_init_allocated_queue(q); 271 ret = blk_init_allocated_queue(q);
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 9565d572f8dd..de56394dd161 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1178,12 +1178,44 @@ dev_put:
1178 return ret; 1178 return ret;
1179} 1179}
1180 1180
1181static bool __init iort_enable_acs(struct acpi_iort_node *iort_node)
1182{
1183 if (iort_node->type == ACPI_IORT_NODE_PCI_ROOT_COMPLEX) {
1184 struct acpi_iort_node *parent;
1185 struct acpi_iort_id_mapping *map;
1186 int i;
1187
1188 map = ACPI_ADD_PTR(struct acpi_iort_id_mapping, iort_node,
1189 iort_node->mapping_offset);
1190
1191 for (i = 0; i < iort_node->mapping_count; i++, map++) {
1192 if (!map->output_reference)
1193 continue;
1194
1195 parent = ACPI_ADD_PTR(struct acpi_iort_node,
1196 iort_table, map->output_reference);
1197 /*
1198 * If we detect a RC->SMMU mapping, make sure
1199 * we enable ACS on the system.
1200 */
1201 if ((parent->type == ACPI_IORT_NODE_SMMU) ||
1202 (parent->type == ACPI_IORT_NODE_SMMU_V3)) {
1203 pci_request_acs();
1204 return true;
1205 }
1206 }
1207 }
1208
1209 return false;
1210}
1211
1181static void __init iort_init_platform_devices(void) 1212static void __init iort_init_platform_devices(void)
1182{ 1213{
1183 struct acpi_iort_node *iort_node, *iort_end; 1214 struct acpi_iort_node *iort_node, *iort_end;
1184 struct acpi_table_iort *iort; 1215 struct acpi_table_iort *iort;
1185 struct fwnode_handle *fwnode; 1216 struct fwnode_handle *fwnode;
1186 int i, ret; 1217 int i, ret;
1218 bool acs_enabled = false;
1187 1219
1188 /* 1220 /*
1189 * iort_table and iort both point to the start of IORT table, but 1221 * iort_table and iort both point to the start of IORT table, but
@@ -1203,6 +1235,9 @@ static void __init iort_init_platform_devices(void)
1203 return; 1235 return;
1204 } 1236 }
1205 1237
1238 if (!acs_enabled)
1239 acs_enabled = iort_enable_acs(iort_node);
1240
1206 if ((iort_node->type == ACPI_IORT_NODE_SMMU) || 1241 if ((iort_node->type == ACPI_IORT_NODE_SMMU) ||
1207 (iort_node->type == ACPI_IORT_NODE_SMMU_V3)) { 1242 (iort_node->type == ACPI_IORT_NODE_SMMU_V3)) {
1208 1243
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 4a438b8abe27..2dfe99b328f8 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -17,7 +17,7 @@ if BLK_DEV
17 17
18config BLK_DEV_NULL_BLK 18config BLK_DEV_NULL_BLK
19 tristate "Null test block driver" 19 tristate "Null test block driver"
20 depends on CONFIGFS_FS 20 select CONFIGFS_FS
21 21
22config BLK_DEV_FD 22config BLK_DEV_FD
23 tristate "Normal floppy disk support" 23 tristate "Normal floppy disk support"
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 3684e21d543f..883dfebd3014 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -820,9 +820,13 @@ static blk_status_t nbd_queue_rq(struct blk_mq_hw_ctx *hctx,
820 * appropriate. 820 * appropriate.
821 */ 821 */
822 ret = nbd_handle_cmd(cmd, hctx->queue_num); 822 ret = nbd_handle_cmd(cmd, hctx->queue_num);
823 if (ret < 0)
824 ret = BLK_STS_IOERR;
825 else if (!ret)
826 ret = BLK_STS_OK;
823 complete(&cmd->send_complete); 827 complete(&cmd->send_complete);
824 828
825 return ret < 0 ? BLK_STS_IOERR : BLK_STS_OK; 829 return ret;
826} 830}
827 831
828static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, 832static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
index c834f5abfc49..4c10456f8a32 100644
--- a/drivers/clk/clk-bulk.c
+++ b/drivers/clk/clk-bulk.c
@@ -105,6 +105,7 @@ err:
105 105
106 return ret; 106 return ret;
107} 107}
108EXPORT_SYMBOL_GPL(clk_bulk_prepare);
108 109
109#endif /* CONFIG_HAVE_CLK_PREPARE */ 110#endif /* CONFIG_HAVE_CLK_PREPARE */
110 111
diff --git a/drivers/clk/rockchip/clk-rk3128.c b/drivers/clk/rockchip/clk-rk3128.c
index 62d7854e4b87..5970a50671b9 100644
--- a/drivers/clk/rockchip/clk-rk3128.c
+++ b/drivers/clk/rockchip/clk-rk3128.c
@@ -315,13 +315,13 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {
315 RK2928_CLKGATE_CON(10), 8, GFLAGS), 315 RK2928_CLKGATE_CON(10), 8, GFLAGS),
316 316
317 GATE(SCLK_PVTM_CORE, "clk_pvtm_core", "xin24m", 0, 317 GATE(SCLK_PVTM_CORE, "clk_pvtm_core", "xin24m", 0,
318 RK2928_CLKGATE_CON(10), 8, GFLAGS), 318 RK2928_CLKGATE_CON(10), 0, GFLAGS),
319 GATE(SCLK_PVTM_GPU, "clk_pvtm_gpu", "xin24m", 0, 319 GATE(SCLK_PVTM_GPU, "clk_pvtm_gpu", "xin24m", 0,
320 RK2928_CLKGATE_CON(10), 8, GFLAGS), 320 RK2928_CLKGATE_CON(10), 1, GFLAGS),
321 GATE(SCLK_PVTM_FUNC, "clk_pvtm_func", "xin24m", 0, 321 GATE(SCLK_PVTM_FUNC, "clk_pvtm_func", "xin24m", 0,
322 RK2928_CLKGATE_CON(10), 8, GFLAGS), 322 RK2928_CLKGATE_CON(10), 2, GFLAGS),
323 GATE(SCLK_MIPI_24M, "clk_mipi_24m", "xin24m", CLK_IGNORE_UNUSED, 323 GATE(SCLK_MIPI_24M, "clk_mipi_24m", "xin24m", CLK_IGNORE_UNUSED,
324 RK2928_CLKGATE_CON(10), 8, GFLAGS), 324 RK2928_CLKGATE_CON(2), 15, GFLAGS),
325 325
326 COMPOSITE(SCLK_SDMMC, "sclk_sdmmc0", mux_mmc_src_p, 0, 326 COMPOSITE(SCLK_SDMMC, "sclk_sdmmc0", mux_mmc_src_p, 0,
327 RK2928_CLKSEL_CON(11), 6, 2, MFLAGS, 0, 6, DFLAGS, 327 RK2928_CLKSEL_CON(11), 6, 2, MFLAGS, 0, 6, DFLAGS,
@@ -541,7 +541,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {
541 GATE(0, "pclk_grf", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 4, GFLAGS), 541 GATE(0, "pclk_grf", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 4, GFLAGS),
542 GATE(0, "pclk_mipiphy", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 0, GFLAGS), 542 GATE(0, "pclk_mipiphy", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 0, GFLAGS),
543 543
544 GATE(0, "pclk_pmu", "pclk_pmu_pre", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 2, GFLAGS), 544 GATE(0, "pclk_pmu", "pclk_pmu_pre", 0, RK2928_CLKGATE_CON(9), 2, GFLAGS),
545 GATE(0, "pclk_pmu_niu", "pclk_pmu_pre", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 3, GFLAGS), 545 GATE(0, "pclk_pmu_niu", "pclk_pmu_pre", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 3, GFLAGS),
546 546
547 /* PD_MMC */ 547 /* PD_MMC */
@@ -577,6 +577,8 @@ static const char *const rk3128_critical_clocks[] __initconst = {
577 "aclk_peri", 577 "aclk_peri",
578 "hclk_peri", 578 "hclk_peri",
579 "pclk_peri", 579 "pclk_peri",
580 "pclk_pmu",
581 "sclk_timer5",
580}; 582};
581 583
582static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device_node *np) 584static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device_node *np)
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
index e40b77583c47..d8d3cb67b402 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -294,6 +294,18 @@ static const struct samsung_clk_reg_dump src_mask_suspend_e4210[] = {
294#define PLL_ENABLED (1 << 31) 294#define PLL_ENABLED (1 << 31)
295#define PLL_LOCKED (1 << 29) 295#define PLL_LOCKED (1 << 29)
296 296
297static void exynos4_clk_enable_pll(u32 reg)
298{
299 u32 pll_con = readl(reg_base + reg);
300 pll_con |= PLL_ENABLED;
301 writel(pll_con, reg_base + reg);
302
303 while (!(pll_con & PLL_LOCKED)) {
304 cpu_relax();
305 pll_con = readl(reg_base + reg);
306 }
307}
308
297static void exynos4_clk_wait_for_pll(u32 reg) 309static void exynos4_clk_wait_for_pll(u32 reg)
298{ 310{
299 u32 pll_con; 311 u32 pll_con;
@@ -315,6 +327,9 @@ static int exynos4_clk_suspend(void)
315 samsung_clk_save(reg_base, exynos4_save_pll, 327 samsung_clk_save(reg_base, exynos4_save_pll,
316 ARRAY_SIZE(exynos4_clk_pll_regs)); 328 ARRAY_SIZE(exynos4_clk_pll_regs));
317 329
330 exynos4_clk_enable_pll(EPLL_CON0);
331 exynos4_clk_enable_pll(VPLL_CON0);
332
318 if (exynos4_soc == EXYNOS4210) { 333 if (exynos4_soc == EXYNOS4210) {
319 samsung_clk_save(reg_base, exynos4_save_soc, 334 samsung_clk_save(reg_base, exynos4_save_soc,
320 ARRAY_SIZE(exynos4210_clk_save)); 335 ARRAY_SIZE(exynos4210_clk_save));
diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index d805b6e6fe71..27743be5b768 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -606,11 +606,6 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
606 connector->encoder->base.id, 606 connector->encoder->base.id,
607 connector->encoder->name); 607 connector->encoder->name);
608 608
609 /* ELD Conn_Type */
610 connector->eld[5] &= ~(3 << 2);
611 if (intel_crtc_has_dp_encoder(crtc_state))
612 connector->eld[5] |= (1 << 2);
613
614 connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2; 609 connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
615 610
616 if (dev_priv->display.audio_codec_enable) 611 if (dev_priv->display.audio_codec_enable)
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 183e87e8ea31..00c6aee0a9a1 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1163,6 +1163,13 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
1163 is_hdmi = is_dvi && (child->common.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0; 1163 is_hdmi = is_dvi && (child->common.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0;
1164 is_edp = is_dp && (child->common.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR); 1164 is_edp = is_dp && (child->common.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR);
1165 1165
1166 if (port == PORT_A && is_dvi) {
1167 DRM_DEBUG_KMS("VBT claims port A supports DVI%s, ignoring\n",
1168 is_hdmi ? "/HDMI" : "");
1169 is_dvi = false;
1170 is_hdmi = false;
1171 }
1172
1166 info->supports_dvi = is_dvi; 1173 info->supports_dvi = is_dvi;
1167 info->supports_hdmi = is_hdmi; 1174 info->supports_hdmi = is_hdmi;
1168 info->supports_dp = is_dp; 1175 info->supports_dp = is_dp;
diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
index 965988f79a55..92c1f8e166dc 100644
--- a/drivers/gpu/drm/i915/intel_csr.c
+++ b/drivers/gpu/drm/i915/intel_csr.c
@@ -216,7 +216,7 @@ static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)
216 216
217 mask = DC_STATE_DEBUG_MASK_MEMORY_UP; 217 mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
218 218
219 if (IS_BROXTON(dev_priv)) 219 if (IS_GEN9_LP(dev_priv))
220 mask |= DC_STATE_DEBUG_MASK_CORES; 220 mask |= DC_STATE_DEBUG_MASK_CORES;
221 221
222 /* The below bit doesn't need to be cleared ever afterwards */ 222 /* The below bit doesn't need to be cleared ever afterwards */
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 4b4fd1f8110b..476681d5940c 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1655,7 +1655,8 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
1655out: 1655out:
1656 if (ret && IS_GEN9_LP(dev_priv)) { 1656 if (ret && IS_GEN9_LP(dev_priv)) {
1657 tmp = I915_READ(BXT_PHY_CTL(port)); 1657 tmp = I915_READ(BXT_PHY_CTL(port));
1658 if ((tmp & (BXT_PHY_LANE_POWERDOWN_ACK | 1658 if ((tmp & (BXT_PHY_CMNLANE_POWERDOWN_ACK |
1659 BXT_PHY_LANE_POWERDOWN_ACK |
1659 BXT_PHY_LANE_ENABLED)) != BXT_PHY_LANE_ENABLED) 1660 BXT_PHY_LANE_ENABLED)) != BXT_PHY_LANE_ENABLED)
1660 DRM_ERROR("Port %c enabled but PHY powered down? " 1661 DRM_ERROR("Port %c enabled but PHY powered down? "
1661 "(PHY_CTL %08x)\n", port_name(port), tmp); 1662 "(PHY_CTL %08x)\n", port_name(port), tmp);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 00cd17c76fdc..64f7b51ed97c 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12359,7 +12359,6 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
12359 struct drm_crtc_state *old_crtc_state, *new_crtc_state; 12359 struct drm_crtc_state *old_crtc_state, *new_crtc_state;
12360 struct drm_crtc *crtc; 12360 struct drm_crtc *crtc;
12361 struct intel_crtc_state *intel_cstate; 12361 struct intel_crtc_state *intel_cstate;
12362 bool hw_check = intel_state->modeset;
12363 u64 put_domains[I915_MAX_PIPES] = {}; 12362 u64 put_domains[I915_MAX_PIPES] = {};
12364 unsigned crtc_vblank_mask = 0; 12363 unsigned crtc_vblank_mask = 0;
12365 int i; 12364 int i;
@@ -12376,7 +12375,6 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
12376 12375
12377 if (needs_modeset(new_crtc_state) || 12376 if (needs_modeset(new_crtc_state) ||
12378 to_intel_crtc_state(new_crtc_state)->update_pipe) { 12377 to_intel_crtc_state(new_crtc_state)->update_pipe) {
12379 hw_check = true;
12380 12378
12381 put_domains[to_intel_crtc(crtc)->pipe] = 12379 put_domains[to_intel_crtc(crtc)->pipe] =
12382 modeset_get_crtc_power_domains(crtc, 12380 modeset_get_crtc_power_domains(crtc,
diff --git a/drivers/gpu/drm/i915/intel_dpio_phy.c b/drivers/gpu/drm/i915/intel_dpio_phy.c
index 09b670929786..de38d014ed39 100644
--- a/drivers/gpu/drm/i915/intel_dpio_phy.c
+++ b/drivers/gpu/drm/i915/intel_dpio_phy.c
@@ -208,12 +208,6 @@ static const struct bxt_ddi_phy_info glk_ddi_phy_info[] = {
208 }, 208 },
209}; 209};
210 210
211static u32 bxt_phy_port_mask(const struct bxt_ddi_phy_info *phy_info)
212{
213 return (phy_info->dual_channel * BIT(phy_info->channel[DPIO_CH1].port)) |
214 BIT(phy_info->channel[DPIO_CH0].port);
215}
216
217static const struct bxt_ddi_phy_info * 211static const struct bxt_ddi_phy_info *
218bxt_get_phy_list(struct drm_i915_private *dev_priv, int *count) 212bxt_get_phy_list(struct drm_i915_private *dev_priv, int *count)
219{ 213{
@@ -313,7 +307,6 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv,
313 enum dpio_phy phy) 307 enum dpio_phy phy)
314{ 308{
315 const struct bxt_ddi_phy_info *phy_info; 309 const struct bxt_ddi_phy_info *phy_info;
316 enum port port;
317 310
318 phy_info = bxt_get_phy_info(dev_priv, phy); 311 phy_info = bxt_get_phy_info(dev_priv, phy);
319 312
@@ -335,19 +328,6 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv,
335 return false; 328 return false;
336 } 329 }
337 330
338 for_each_port_masked(port, bxt_phy_port_mask(phy_info)) {
339 u32 tmp = I915_READ(BXT_PHY_CTL(port));
340
341 if (tmp & BXT_PHY_CMNLANE_POWERDOWN_ACK) {
342 DRM_DEBUG_DRIVER("DDI PHY %d powered, but common lane "
343 "for port %c powered down "
344 "(PHY_CTL %08x)\n",
345 phy, port_name(port), tmp);
346
347 return false;
348 }
349 }
350
351 return true; 331 return true;
352} 332}
353 333
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
index 951e834dd274..28a778b785ac 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -30,6 +30,21 @@
30#include "intel_drv.h" 30#include "intel_drv.h"
31#include "i915_drv.h" 31#include "i915_drv.h"
32 32
33static void intel_connector_update_eld_conn_type(struct drm_connector *connector)
34{
35 u8 conn_type;
36
37 if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
38 connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
39 conn_type = DRM_ELD_CONN_TYPE_DP;
40 } else {
41 conn_type = DRM_ELD_CONN_TYPE_HDMI;
42 }
43
44 connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] &= ~DRM_ELD_CONN_TYPE_MASK;
45 connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= conn_type;
46}
47
33/** 48/**
34 * intel_connector_update_modes - update connector from edid 49 * intel_connector_update_modes - update connector from edid
35 * @connector: DRM connector device to use 50 * @connector: DRM connector device to use
@@ -44,6 +59,8 @@ int intel_connector_update_modes(struct drm_connector *connector,
44 ret = drm_add_edid_modes(connector, edid); 59 ret = drm_add_edid_modes(connector, edid);
45 drm_edid_to_eld(connector, edid); 60 drm_edid_to_eld(connector, edid);
46 61
62 intel_connector_update_eld_conn_type(connector);
63
47 return ret; 64 return ret;
48} 65}
49 66
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index b66d8e136aa3..b3a087cb0860 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -2782,6 +2782,9 @@ static void cnl_display_core_init(struct drm_i915_private *dev_priv, bool resume
2782 2782
2783 /* 6. Enable DBUF */ 2783 /* 6. Enable DBUF */
2784 gen9_dbuf_enable(dev_priv); 2784 gen9_dbuf_enable(dev_priv);
2785
2786 if (resume && dev_priv->csr.dmc_payload)
2787 intel_csr_load_program(dev_priv);
2785} 2788}
2786 2789
2787#undef CNL_PROCMON_IDX 2790#undef CNL_PROCMON_IDX
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index 9ea6cd5a1370..3cf1a6932fac 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -302,26 +302,29 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
302 hdmi->mod_clk = devm_clk_get(dev, "mod"); 302 hdmi->mod_clk = devm_clk_get(dev, "mod");
303 if (IS_ERR(hdmi->mod_clk)) { 303 if (IS_ERR(hdmi->mod_clk)) {
304 dev_err(dev, "Couldn't get the HDMI mod clock\n"); 304 dev_err(dev, "Couldn't get the HDMI mod clock\n");
305 return PTR_ERR(hdmi->mod_clk); 305 ret = PTR_ERR(hdmi->mod_clk);
306 goto err_disable_bus_clk;
306 } 307 }
307 clk_prepare_enable(hdmi->mod_clk); 308 clk_prepare_enable(hdmi->mod_clk);
308 309
309 hdmi->pll0_clk = devm_clk_get(dev, "pll-0"); 310 hdmi->pll0_clk = devm_clk_get(dev, "pll-0");
310 if (IS_ERR(hdmi->pll0_clk)) { 311 if (IS_ERR(hdmi->pll0_clk)) {
311 dev_err(dev, "Couldn't get the HDMI PLL 0 clock\n"); 312 dev_err(dev, "Couldn't get the HDMI PLL 0 clock\n");
312 return PTR_ERR(hdmi->pll0_clk); 313 ret = PTR_ERR(hdmi->pll0_clk);
314 goto err_disable_mod_clk;
313 } 315 }
314 316
315 hdmi->pll1_clk = devm_clk_get(dev, "pll-1"); 317 hdmi->pll1_clk = devm_clk_get(dev, "pll-1");
316 if (IS_ERR(hdmi->pll1_clk)) { 318 if (IS_ERR(hdmi->pll1_clk)) {
317 dev_err(dev, "Couldn't get the HDMI PLL 1 clock\n"); 319 dev_err(dev, "Couldn't get the HDMI PLL 1 clock\n");
318 return PTR_ERR(hdmi->pll1_clk); 320 ret = PTR_ERR(hdmi->pll1_clk);
321 goto err_disable_mod_clk;
319 } 322 }
320 323
321 ret = sun4i_tmds_create(hdmi); 324 ret = sun4i_tmds_create(hdmi);
322 if (ret) { 325 if (ret) {
323 dev_err(dev, "Couldn't create the TMDS clock\n"); 326 dev_err(dev, "Couldn't create the TMDS clock\n");
324 return ret; 327 goto err_disable_mod_clk;
325 } 328 }
326 329
327 writel(SUN4I_HDMI_CTRL_ENABLE, hdmi->base + SUN4I_HDMI_CTRL_REG); 330 writel(SUN4I_HDMI_CTRL_ENABLE, hdmi->base + SUN4I_HDMI_CTRL_REG);
@@ -362,7 +365,7 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
362 ret = sun4i_hdmi_i2c_create(dev, hdmi); 365 ret = sun4i_hdmi_i2c_create(dev, hdmi);
363 if (ret) { 366 if (ret) {
364 dev_err(dev, "Couldn't create the HDMI I2C adapter\n"); 367 dev_err(dev, "Couldn't create the HDMI I2C adapter\n");
365 return ret; 368 goto err_disable_mod_clk;
366 } 369 }
367 370
368 drm_encoder_helper_add(&hdmi->encoder, 371 drm_encoder_helper_add(&hdmi->encoder,
@@ -422,6 +425,10 @@ err_cleanup_connector:
422 drm_encoder_cleanup(&hdmi->encoder); 425 drm_encoder_cleanup(&hdmi->encoder);
423err_del_i2c_adapter: 426err_del_i2c_adapter:
424 i2c_del_adapter(hdmi->i2c); 427 i2c_del_adapter(hdmi->i2c);
428err_disable_mod_clk:
429 clk_disable_unprepare(hdmi->mod_clk);
430err_disable_bus_clk:
431 clk_disable_unprepare(hdmi->bus_clk);
425 return ret; 432 return ret;
426} 433}
427 434
@@ -434,6 +441,8 @@ static void sun4i_hdmi_unbind(struct device *dev, struct device *master,
434 drm_connector_cleanup(&hdmi->connector); 441 drm_connector_cleanup(&hdmi->connector);
435 drm_encoder_cleanup(&hdmi->encoder); 442 drm_encoder_cleanup(&hdmi->encoder);
436 i2c_del_adapter(hdmi->i2c); 443 i2c_del_adapter(hdmi->i2c);
444 clk_disable_unprepare(hdmi->mod_clk);
445 clk_disable_unprepare(hdmi->bus_clk);
437} 446}
438 447
439static const struct component_ops sun4i_hdmi_ops = { 448static const struct component_ops sun4i_hdmi_ops = {
diff --git a/drivers/hwmon/xgene-hwmon.c b/drivers/hwmon/xgene-hwmon.c
index 9c0dbb8191ad..e1be61095532 100644
--- a/drivers/hwmon/xgene-hwmon.c
+++ b/drivers/hwmon/xgene-hwmon.c
@@ -630,7 +630,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
630 sizeof(struct slimpro_resp_msg) * ASYNC_MSG_FIFO_SIZE, 630 sizeof(struct slimpro_resp_msg) * ASYNC_MSG_FIFO_SIZE,
631 GFP_KERNEL); 631 GFP_KERNEL);
632 if (rc) 632 if (rc)
633 goto out_mbox_free; 633 return -ENOMEM;
634 634
635 INIT_WORK(&ctx->workq, xgene_hwmon_evt_work); 635 INIT_WORK(&ctx->workq, xgene_hwmon_evt_work);
636 636
@@ -646,7 +646,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
646 if (IS_ERR(ctx->mbox_chan)) { 646 if (IS_ERR(ctx->mbox_chan)) {
647 dev_err(&pdev->dev, 647 dev_err(&pdev->dev,
648 "SLIMpro mailbox channel request failed\n"); 648 "SLIMpro mailbox channel request failed\n");
649 return -ENODEV; 649 rc = -ENODEV;
650 goto out_mbox_free;
650 } 651 }
651 } else { 652 } else {
652 struct acpi_pcct_hw_reduced *cppc_ss; 653 struct acpi_pcct_hw_reduced *cppc_ss;
@@ -654,7 +655,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
654 if (device_property_read_u32(&pdev->dev, "pcc-channel", 655 if (device_property_read_u32(&pdev->dev, "pcc-channel",
655 &ctx->mbox_idx)) { 656 &ctx->mbox_idx)) {
656 dev_err(&pdev->dev, "no pcc-channel property\n"); 657 dev_err(&pdev->dev, "no pcc-channel property\n");
657 return -ENODEV; 658 rc = -ENODEV;
659 goto out_mbox_free;
658 } 660 }
659 661
660 cl->rx_callback = xgene_hwmon_pcc_rx_cb; 662 cl->rx_callback = xgene_hwmon_pcc_rx_cb;
@@ -662,7 +664,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
662 if (IS_ERR(ctx->mbox_chan)) { 664 if (IS_ERR(ctx->mbox_chan)) {
663 dev_err(&pdev->dev, 665 dev_err(&pdev->dev,
664 "PPC channel request failed\n"); 666 "PPC channel request failed\n");
665 return -ENODEV; 667 rc = -ENODEV;
668 goto out_mbox_free;
666 } 669 }
667 670
668 /* 671 /*
@@ -675,13 +678,13 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
675 if (!cppc_ss) { 678 if (!cppc_ss) {
676 dev_err(&pdev->dev, "PPC subspace not found\n"); 679 dev_err(&pdev->dev, "PPC subspace not found\n");
677 rc = -ENODEV; 680 rc = -ENODEV;
678 goto out_mbox_free; 681 goto out;
679 } 682 }
680 683
681 if (!ctx->mbox_chan->mbox->txdone_irq) { 684 if (!ctx->mbox_chan->mbox->txdone_irq) {
682 dev_err(&pdev->dev, "PCC IRQ not supported\n"); 685 dev_err(&pdev->dev, "PCC IRQ not supported\n");
683 rc = -ENODEV; 686 rc = -ENODEV;
684 goto out_mbox_free; 687 goto out;
685 } 688 }
686 689
687 /* 690 /*
@@ -696,14 +699,14 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
696 } else { 699 } else {
697 dev_err(&pdev->dev, "Failed to get PCC comm region\n"); 700 dev_err(&pdev->dev, "Failed to get PCC comm region\n");
698 rc = -ENODEV; 701 rc = -ENODEV;
699 goto out_mbox_free; 702 goto out;
700 } 703 }
701 704
702 if (!ctx->pcc_comm_addr) { 705 if (!ctx->pcc_comm_addr) {
703 dev_err(&pdev->dev, 706 dev_err(&pdev->dev,
704 "Failed to ioremap PCC comm region\n"); 707 "Failed to ioremap PCC comm region\n");
705 rc = -ENOMEM; 708 rc = -ENOMEM;
706 goto out_mbox_free; 709 goto out;
707 } 710 }
708 711
709 /* 712 /*
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index c06dce2c1da7..45a3f3ca29b3 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -131,6 +131,7 @@ config I2C_I801
131 Gemini Lake (SOC) 131 Gemini Lake (SOC)
132 Cannon Lake-H (PCH) 132 Cannon Lake-H (PCH)
133 Cannon Lake-LP (PCH) 133 Cannon Lake-LP (PCH)
134 Cedar Fork (PCH)
134 135
135 This driver can also be built as a module. If so, the module 136 This driver can also be built as a module. If so, the module
136 will be called i2c-i801. 137 will be called i2c-i801.
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index e114e4e00d29..9e12a53ef7b8 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -68,6 +68,7 @@
68 * Gemini Lake (SOC) 0x31d4 32 hard yes yes yes 68 * Gemini Lake (SOC) 0x31d4 32 hard yes yes yes
69 * Cannon Lake-H (PCH) 0xa323 32 hard yes yes yes 69 * Cannon Lake-H (PCH) 0xa323 32 hard yes yes yes
70 * Cannon Lake-LP (PCH) 0x9da3 32 hard yes yes yes 70 * Cannon Lake-LP (PCH) 0x9da3 32 hard yes yes yes
71 * Cedar Fork (PCH) 0x18df 32 hard yes yes yes
71 * 72 *
72 * Features supported by this driver: 73 * Features supported by this driver:
73 * Software PEC no 74 * Software PEC no
@@ -204,6 +205,7 @@
204 205
205/* Older devices have their ID defined in <linux/pci_ids.h> */ 206/* Older devices have their ID defined in <linux/pci_ids.h> */
206#define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS 0x0f12 207#define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS 0x0f12
208#define PCI_DEVICE_ID_INTEL_CDF_SMBUS 0x18df
207#define PCI_DEVICE_ID_INTEL_DNV_SMBUS 0x19df 209#define PCI_DEVICE_ID_INTEL_DNV_SMBUS 0x19df
208#define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 210#define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22
209#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 211#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22
@@ -1025,6 +1027,7 @@ static const struct pci_device_id i801_ids[] = {
1025 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BRASWELL_SMBUS) }, 1027 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BRASWELL_SMBUS) },
1026 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_SMBUS) }, 1028 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_SMBUS) },
1027 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS) }, 1029 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS) },
1030 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CDF_SMBUS) },
1028 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DNV_SMBUS) }, 1031 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DNV_SMBUS) },
1029 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BROXTON_SMBUS) }, 1032 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BROXTON_SMBUS) },
1030 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS) }, 1033 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS) },
@@ -1513,6 +1516,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
1513 case PCI_DEVICE_ID_INTEL_CANNONLAKE_LP_SMBUS: 1516 case PCI_DEVICE_ID_INTEL_CANNONLAKE_LP_SMBUS:
1514 case PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS: 1517 case PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS:
1515 case PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS: 1518 case PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS:
1519 case PCI_DEVICE_ID_INTEL_CDF_SMBUS:
1516 case PCI_DEVICE_ID_INTEL_DNV_SMBUS: 1520 case PCI_DEVICE_ID_INTEL_DNV_SMBUS:
1517 case PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS: 1521 case PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS:
1518 priv->features |= FEATURE_I2C_BLOCK_READ; 1522 priv->features |= FEATURE_I2C_BLOCK_READ;
diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c
index 22e08ae1704f..25fcc3c1e32b 100644
--- a/drivers/i2c/busses/i2c-sprd.c
+++ b/drivers/i2c/busses/i2c-sprd.c
@@ -627,6 +627,7 @@ static const struct dev_pm_ops sprd_i2c_pm_ops = {
627 627
628static const struct of_device_id sprd_i2c_of_match[] = { 628static const struct of_device_id sprd_i2c_of_match[] = {
629 { .compatible = "sprd,sc9860-i2c", }, 629 { .compatible = "sprd,sc9860-i2c", },
630 {},
630}; 631};
631 632
632static struct platform_driver sprd_i2c_driver = { 633static struct platform_driver sprd_i2c_driver = {
diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index 47c67b0ca896..d4a6e9c2e9aa 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -215,7 +215,7 @@ struct stm32f7_i2c_dev {
215 unsigned int msg_num; 215 unsigned int msg_num;
216 unsigned int msg_id; 216 unsigned int msg_id;
217 struct stm32f7_i2c_msg f7_msg; 217 struct stm32f7_i2c_msg f7_msg;
218 struct stm32f7_i2c_setup *setup; 218 struct stm32f7_i2c_setup setup;
219 struct stm32f7_i2c_timings timing; 219 struct stm32f7_i2c_timings timing;
220}; 220};
221 221
@@ -265,7 +265,7 @@ static struct stm32f7_i2c_spec i2c_specs[] = {
265 }, 265 },
266}; 266};
267 267
268struct stm32f7_i2c_setup stm32f7_setup = { 268static const struct stm32f7_i2c_setup stm32f7_setup = {
269 .rise_time = STM32F7_I2C_RISE_TIME_DEFAULT, 269 .rise_time = STM32F7_I2C_RISE_TIME_DEFAULT,
270 .fall_time = STM32F7_I2C_FALL_TIME_DEFAULT, 270 .fall_time = STM32F7_I2C_FALL_TIME_DEFAULT,
271 .dnf = STM32F7_I2C_DNF_DEFAULT, 271 .dnf = STM32F7_I2C_DNF_DEFAULT,
@@ -537,7 +537,7 @@ static void stm32f7_i2c_hw_config(struct stm32f7_i2c_dev *i2c_dev)
537 writel_relaxed(timing, i2c_dev->base + STM32F7_I2C_TIMINGR); 537 writel_relaxed(timing, i2c_dev->base + STM32F7_I2C_TIMINGR);
538 538
539 /* Enable I2C */ 539 /* Enable I2C */
540 if (i2c_dev->setup->analog_filter) 540 if (i2c_dev->setup.analog_filter)
541 stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1, 541 stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1,
542 STM32F7_I2C_CR1_ANFOFF); 542 STM32F7_I2C_CR1_ANFOFF);
543 else 543 else
@@ -887,22 +887,19 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
887 } 887 }
888 888
889 setup = of_device_get_match_data(&pdev->dev); 889 setup = of_device_get_match_data(&pdev->dev);
890 i2c_dev->setup->rise_time = setup->rise_time; 890 i2c_dev->setup = *setup;
891 i2c_dev->setup->fall_time = setup->fall_time;
892 i2c_dev->setup->dnf = setup->dnf;
893 i2c_dev->setup->analog_filter = setup->analog_filter;
894 891
895 ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns", 892 ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns",
896 &rise_time); 893 &rise_time);
897 if (!ret) 894 if (!ret)
898 i2c_dev->setup->rise_time = rise_time; 895 i2c_dev->setup.rise_time = rise_time;
899 896
900 ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-falling-time-ns", 897 ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-falling-time-ns",
901 &fall_time); 898 &fall_time);
902 if (!ret) 899 if (!ret)
903 i2c_dev->setup->fall_time = fall_time; 900 i2c_dev->setup.fall_time = fall_time;
904 901
905 ret = stm32f7_i2c_setup_timing(i2c_dev, i2c_dev->setup); 902 ret = stm32f7_i2c_setup_timing(i2c_dev, &i2c_dev->setup);
906 if (ret) 903 if (ret)
907 goto clk_free; 904 goto clk_free;
908 905
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 01b2adfd8226..eaf39e5db08b 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1451,6 +1451,7 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1451 if (hwif_init(hwif) == 0) { 1451 if (hwif_init(hwif) == 0) {
1452 printk(KERN_INFO "%s: failed to initialize IDE " 1452 printk(KERN_INFO "%s: failed to initialize IDE "
1453 "interface\n", hwif->name); 1453 "interface\n", hwif->name);
1454 device_unregister(hwif->portdev);
1454 device_unregister(&hwif->gendev); 1455 device_unregister(&hwif->gendev);
1455 ide_disable_port(hwif); 1456 ide_disable_port(hwif);
1456 continue; 1457 continue;
diff --git a/drivers/ide/ide-scan-pci.c b/drivers/ide/ide-scan-pci.c
index 86aa88aeb3a6..acf874800ca4 100644
--- a/drivers/ide/ide-scan-pci.c
+++ b/drivers/ide/ide-scan-pci.c
@@ -56,6 +56,7 @@ static int __init ide_scan_pcidev(struct pci_dev *dev)
56{ 56{
57 struct list_head *l; 57 struct list_head *l;
58 struct pci_driver *d; 58 struct pci_driver *d;
59 int ret;
59 60
60 list_for_each(l, &ide_pci_drivers) { 61 list_for_each(l, &ide_pci_drivers) {
61 d = list_entry(l, struct pci_driver, node); 62 d = list_entry(l, struct pci_driver, node);
@@ -63,10 +64,14 @@ static int __init ide_scan_pcidev(struct pci_dev *dev)
63 const struct pci_device_id *id = 64 const struct pci_device_id *id =
64 pci_match_id(d->id_table, dev); 65 pci_match_id(d->id_table, dev);
65 66
66 if (id != NULL && d->probe(dev, id) >= 0) { 67 if (id != NULL) {
67 dev->driver = d; 68 pci_assign_irq(dev);
68 pci_dev_get(dev); 69 ret = d->probe(dev, id);
69 return 1; 70 if (ret >= 0) {
71 dev->driver = d;
72 pci_dev_get(dev);
73 return 1;
74 }
70 } 75 }
71 } 76 }
72 } 77 }
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 112d2fe1bcdb..fdc8e813170c 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -179,6 +179,7 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
179/** 179/**
180 * ide_pci_enable - do PCI enables 180 * ide_pci_enable - do PCI enables
181 * @dev: PCI device 181 * @dev: PCI device
182 * @bars: PCI BARs mask
182 * @d: IDE port info 183 * @d: IDE port info
183 * 184 *
184 * Enable the IDE PCI device. We attempt to enable the device in full 185 * Enable the IDE PCI device. We attempt to enable the device in full
@@ -189,9 +190,10 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
189 * Returns zero on success or an error code 190 * Returns zero on success or an error code
190 */ 191 */
191 192
192static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) 193static int ide_pci_enable(struct pci_dev *dev, int bars,
194 const struct ide_port_info *d)
193{ 195{
194 int ret, bars; 196 int ret;
195 197
196 if (pci_enable_device(dev)) { 198 if (pci_enable_device(dev)) {
197 ret = pci_enable_device_io(dev); 199 ret = pci_enable_device_io(dev);
@@ -216,18 +218,6 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d)
216 goto out; 218 goto out;
217 } 219 }
218 220
219 if (d->host_flags & IDE_HFLAG_SINGLE)
220 bars = (1 << 2) - 1;
221 else
222 bars = (1 << 4) - 1;
223
224 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) {
225 if (d->host_flags & IDE_HFLAG_CS5520)
226 bars |= (1 << 2);
227 else
228 bars |= (1 << 4);
229 }
230
231 ret = pci_request_selected_regions(dev, bars, d->name); 221 ret = pci_request_selected_regions(dev, bars, d->name);
232 if (ret < 0) 222 if (ret < 0)
233 printk(KERN_ERR "%s %s: can't reserve resources\n", 223 printk(KERN_ERR "%s %s: can't reserve resources\n",
@@ -403,6 +393,7 @@ int ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
403/** 393/**
404 * ide_setup_pci_controller - set up IDE PCI 394 * ide_setup_pci_controller - set up IDE PCI
405 * @dev: PCI device 395 * @dev: PCI device
396 * @bars: PCI BARs mask
406 * @d: IDE port info 397 * @d: IDE port info
407 * @noisy: verbose flag 398 * @noisy: verbose flag
408 * 399 *
@@ -411,7 +402,7 @@ int ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
411 * and enables it if need be 402 * and enables it if need be
412 */ 403 */
413 404
414static int ide_setup_pci_controller(struct pci_dev *dev, 405static int ide_setup_pci_controller(struct pci_dev *dev, int bars,
415 const struct ide_port_info *d, int noisy) 406 const struct ide_port_info *d, int noisy)
416{ 407{
417 int ret; 408 int ret;
@@ -420,7 +411,7 @@ static int ide_setup_pci_controller(struct pci_dev *dev,
420 if (noisy) 411 if (noisy)
421 ide_setup_pci_noise(dev, d); 412 ide_setup_pci_noise(dev, d);
422 413
423 ret = ide_pci_enable(dev, d); 414 ret = ide_pci_enable(dev, bars, d);
424 if (ret < 0) 415 if (ret < 0)
425 goto out; 416 goto out;
426 417
@@ -428,16 +419,20 @@ static int ide_setup_pci_controller(struct pci_dev *dev,
428 if (ret < 0) { 419 if (ret < 0) {
429 printk(KERN_ERR "%s %s: error accessing PCI regs\n", 420 printk(KERN_ERR "%s %s: error accessing PCI regs\n",
430 d->name, pci_name(dev)); 421 d->name, pci_name(dev));
431 goto out; 422 goto out_free_bars;
432 } 423 }
433 if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */ 424 if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */
434 ret = ide_pci_configure(dev, d); 425 ret = ide_pci_configure(dev, d);
435 if (ret < 0) 426 if (ret < 0)
436 goto out; 427 goto out_free_bars;
437 printk(KERN_INFO "%s %s: device enabled (Linux)\n", 428 printk(KERN_INFO "%s %s: device enabled (Linux)\n",
438 d->name, pci_name(dev)); 429 d->name, pci_name(dev));
439 } 430 }
440 431
432 goto out;
433
434out_free_bars:
435 pci_release_selected_regions(dev, bars);
441out: 436out:
442 return ret; 437 return ret;
443} 438}
@@ -540,13 +535,28 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
540{ 535{
541 struct pci_dev *pdev[] = { dev1, dev2 }; 536 struct pci_dev *pdev[] = { dev1, dev2 };
542 struct ide_host *host; 537 struct ide_host *host;
543 int ret, i, n_ports = dev2 ? 4 : 2; 538 int ret, i, n_ports = dev2 ? 4 : 2, bars;
544 struct ide_hw hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 539 struct ide_hw hw[4], *hws[] = { NULL, NULL, NULL, NULL };
545 540
541 if (d->host_flags & IDE_HFLAG_SINGLE)
542 bars = (1 << 2) - 1;
543 else
544 bars = (1 << 4) - 1;
545
546 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) {
547 if (d->host_flags & IDE_HFLAG_CS5520)
548 bars |= (1 << 2);
549 else
550 bars |= (1 << 4);
551 }
552
546 for (i = 0; i < n_ports / 2; i++) { 553 for (i = 0; i < n_ports / 2; i++) {
547 ret = ide_setup_pci_controller(pdev[i], d, !i); 554 ret = ide_setup_pci_controller(pdev[i], bars, d, !i);
548 if (ret < 0) 555 if (ret < 0) {
556 if (i == 1)
557 pci_release_selected_regions(pdev[0], bars);
549 goto out; 558 goto out;
559 }
550 560
551 ide_pci_setup_ports(pdev[i], d, &hw[i*2], &hws[i*2]); 561 ide_pci_setup_ports(pdev[i], d, &hw[i*2], &hws[i*2]);
552 } 562 }
@@ -554,7 +564,7 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
554 host = ide_host_alloc(d, hws, n_ports); 564 host = ide_host_alloc(d, hws, n_ports);
555 if (host == NULL) { 565 if (host == NULL) {
556 ret = -ENOMEM; 566 ret = -ENOMEM;
557 goto out; 567 goto out_free_bars;
558 } 568 }
559 569
560 host->dev[0] = &dev1->dev; 570 host->dev[0] = &dev1->dev;
@@ -576,7 +586,7 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
576 * do_ide_setup_pci_device() on the first device! 586 * do_ide_setup_pci_device() on the first device!
577 */ 587 */
578 if (ret < 0) 588 if (ret < 0)
579 goto out; 589 goto out_free_bars;
580 590
581 /* fixup IRQ */ 591 /* fixup IRQ */
582 if (ide_pci_is_in_compatibility_mode(pdev[i])) { 592 if (ide_pci_is_in_compatibility_mode(pdev[i])) {
@@ -589,6 +599,13 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
589 ret = ide_host_register(host, d, hws); 599 ret = ide_host_register(host, d, hws);
590 if (ret) 600 if (ret)
591 ide_host_free(host); 601 ide_host_free(host);
602 else
603 goto out;
604
605out_free_bars:
606 i = n_ports / 2;
607 while (i--)
608 pci_release_selected_regions(pdev[i], bars);
592out: 609out:
593 return ret; 610 return ret;
594} 611}
diff --git a/drivers/infiniband/core/iwpm_msg.c b/drivers/infiniband/core/iwpm_msg.c
index 30825bb9b8e9..8861c052155a 100644
--- a/drivers/infiniband/core/iwpm_msg.c
+++ b/drivers/infiniband/core/iwpm_msg.c
@@ -100,6 +100,8 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client)
100 if (ret) 100 if (ret)
101 goto pid_query_error; 101 goto pid_query_error;
102 102
103 nlmsg_end(skb, nlh);
104
103 pr_debug("%s: Multicasting a nlmsg (dev = %s ifname = %s iwpm = %s)\n", 105 pr_debug("%s: Multicasting a nlmsg (dev = %s ifname = %s iwpm = %s)\n",
104 __func__, pm_msg->dev_name, pm_msg->if_name, iwpm_ulib_name); 106 __func__, pm_msg->dev_name, pm_msg->if_name, iwpm_ulib_name);
105 107
@@ -170,6 +172,8 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
170 &pm_msg->loc_addr, IWPM_NLA_MANAGE_ADDR); 172 &pm_msg->loc_addr, IWPM_NLA_MANAGE_ADDR);
171 if (ret) 173 if (ret)
172 goto add_mapping_error; 174 goto add_mapping_error;
175
176 nlmsg_end(skb, nlh);
173 nlmsg_request->req_buffer = pm_msg; 177 nlmsg_request->req_buffer = pm_msg;
174 178
175 ret = rdma_nl_unicast_wait(skb, iwpm_user_pid); 179 ret = rdma_nl_unicast_wait(skb, iwpm_user_pid);
@@ -246,6 +250,8 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
246 &pm_msg->rem_addr, IWPM_NLA_QUERY_REMOTE_ADDR); 250 &pm_msg->rem_addr, IWPM_NLA_QUERY_REMOTE_ADDR);
247 if (ret) 251 if (ret)
248 goto query_mapping_error; 252 goto query_mapping_error;
253
254 nlmsg_end(skb, nlh);
249 nlmsg_request->req_buffer = pm_msg; 255 nlmsg_request->req_buffer = pm_msg;
250 256
251 ret = rdma_nl_unicast_wait(skb, iwpm_user_pid); 257 ret = rdma_nl_unicast_wait(skb, iwpm_user_pid);
@@ -308,6 +314,8 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client)
308 if (ret) 314 if (ret)
309 goto remove_mapping_error; 315 goto remove_mapping_error;
310 316
317 nlmsg_end(skb, nlh);
318
311 ret = rdma_nl_unicast_wait(skb, iwpm_user_pid); 319 ret = rdma_nl_unicast_wait(skb, iwpm_user_pid);
312 if (ret) { 320 if (ret) {
313 skb = NULL; /* skb is freed in the netlink send-op handling */ 321 skb = NULL; /* skb is freed in the netlink send-op handling */
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index c81c55942626..3c4faadb8cdd 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -597,6 +597,9 @@ static int send_mapinfo_num(u32 mapping_num, u8 nl_client, int iwpm_pid)
597 &mapping_num, IWPM_NLA_MAPINFO_SEND_NUM); 597 &mapping_num, IWPM_NLA_MAPINFO_SEND_NUM);
598 if (ret) 598 if (ret)
599 goto mapinfo_num_error; 599 goto mapinfo_num_error;
600
601 nlmsg_end(skb, nlh);
602
600 ret = rdma_nl_unicast(skb, iwpm_pid); 603 ret = rdma_nl_unicast(skb, iwpm_pid);
601 if (ret) { 604 if (ret) {
602 skb = NULL; 605 skb = NULL;
@@ -678,6 +681,8 @@ int iwpm_send_mapinfo(u8 nl_client, int iwpm_pid)
678 if (ret) 681 if (ret)
679 goto send_mapping_info_unlock; 682 goto send_mapping_info_unlock;
680 683
684 nlmsg_end(skb, nlh);
685
681 iwpm_print_sockaddr(&map_info->local_sockaddr, 686 iwpm_print_sockaddr(&map_info->local_sockaddr,
682 "send_mapping_info: Local sockaddr:"); 687 "send_mapping_info: Local sockaddr:");
683 iwpm_print_sockaddr(&map_info->mapped_sockaddr, 688 iwpm_print_sockaddr(&map_info->mapped_sockaddr,
diff --git a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
index d1f5345f04f0..42ca5346777d 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
@@ -48,7 +48,7 @@
48 * @wqe: cqp wqe for header 48 * @wqe: cqp wqe for header
49 * @header: header for the cqp wqe 49 * @header: header for the cqp wqe
50 */ 50 */
51static inline void i40iw_insert_wqe_hdr(u64 *wqe, u64 header) 51void i40iw_insert_wqe_hdr(u64 *wqe, u64 header)
52{ 52{
53 wmb(); /* make sure WQE is populated before polarity is set */ 53 wmb(); /* make sure WQE is populated before polarity is set */
54 set_64bit_val(wqe, 24, header); 54 set_64bit_val(wqe, 24, header);
diff --git a/drivers/infiniband/hw/i40iw/i40iw_p.h b/drivers/infiniband/hw/i40iw/i40iw_p.h
index e217a1259f57..5498ad01c280 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_p.h
+++ b/drivers/infiniband/hw/i40iw/i40iw_p.h
@@ -59,6 +59,8 @@ enum i40iw_status_code i40iw_sc_mr_fast_register(struct i40iw_sc_qp *qp,
59 struct i40iw_fast_reg_stag_info *info, 59 struct i40iw_fast_reg_stag_info *info,
60 bool post_sq); 60 bool post_sq);
61 61
62void i40iw_insert_wqe_hdr(u64 *wqe, u64 header);
63
62/* HMC/FPM functions */ 64/* HMC/FPM functions */
63enum i40iw_status_code i40iw_sc_init_iw_hmc(struct i40iw_sc_dev *dev, 65enum i40iw_status_code i40iw_sc_init_iw_hmc(struct i40iw_sc_dev *dev,
64 u8 hmc_fn_id); 66 u8 hmc_fn_id);
diff --git a/drivers/infiniband/hw/i40iw/i40iw_puda.c b/drivers/infiniband/hw/i40iw/i40iw_puda.c
index c2cab20c4bc5..59f70676f0e0 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_puda.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_puda.c
@@ -123,12 +123,11 @@ static void i40iw_puda_post_recvbuf(struct i40iw_puda_rsrc *rsrc, u32 wqe_idx,
123 get_64bit_val(wqe, 24, &offset24); 123 get_64bit_val(wqe, 24, &offset24);
124 124
125 offset24 = (offset24) ? 0 : LS_64(1, I40IWQPSQ_VALID); 125 offset24 = (offset24) ? 0 : LS_64(1, I40IWQPSQ_VALID);
126 set_64bit_val(wqe, 24, offset24);
127 126
128 set_64bit_val(wqe, 0, buf->mem.pa); 127 set_64bit_val(wqe, 0, buf->mem.pa);
129 set_64bit_val(wqe, 8, 128 set_64bit_val(wqe, 8,
130 LS_64(buf->mem.size, I40IWQPSQ_FRAG_LEN)); 129 LS_64(buf->mem.size, I40IWQPSQ_FRAG_LEN));
131 set_64bit_val(wqe, 24, offset24); 130 i40iw_insert_wqe_hdr(wqe, offset24);
132} 131}
133 132
134/** 133/**
@@ -409,9 +408,7 @@ enum i40iw_status_code i40iw_puda_send(struct i40iw_sc_qp *qp,
409 set_64bit_val(wqe, 8, LS_64(info->len, I40IWQPSQ_FRAG_LEN)); 408 set_64bit_val(wqe, 8, LS_64(info->len, I40IWQPSQ_FRAG_LEN));
410 set_64bit_val(wqe, 16, header[0]); 409 set_64bit_val(wqe, 16, header[0]);
411 410
412 /* Ensure all data is written before writing valid bit */ 411 i40iw_insert_wqe_hdr(wqe, header[1]);
413 wmb();
414 set_64bit_val(wqe, 24, header[1]);
415 412
416 i40iw_debug_buf(qp->dev, I40IW_DEBUG_PUDA, "PUDA SEND WQE", wqe, 32); 413 i40iw_debug_buf(qp->dev, I40IW_DEBUG_PUDA, "PUDA SEND WQE", wqe, 32);
417 i40iw_qp_post_wr(&qp->qp_uk); 414 i40iw_qp_post_wr(&qp->qp_uk);
@@ -539,7 +536,7 @@ static enum i40iw_status_code i40iw_puda_qp_wqe(struct i40iw_sc_dev *dev, struct
539 LS_64(2, I40IW_CQPSQ_QP_NEXTIWSTATE) | 536 LS_64(2, I40IW_CQPSQ_QP_NEXTIWSTATE) |
540 LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID); 537 LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID);
541 538
542 set_64bit_val(wqe, 24, header); 539 i40iw_insert_wqe_hdr(wqe, header);
543 540
544 i40iw_debug_buf(cqp->dev, I40IW_DEBUG_PUDA, "PUDA CQE", wqe, 32); 541 i40iw_debug_buf(cqp->dev, I40IW_DEBUG_PUDA, "PUDA CQE", wqe, 32);
545 i40iw_sc_cqp_post_sq(cqp); 542 i40iw_sc_cqp_post_sq(cqp);
@@ -655,7 +652,7 @@ static enum i40iw_status_code i40iw_puda_cq_wqe(struct i40iw_sc_dev *dev, struct
655 LS_64(1, I40IW_CQPSQ_CQ_ENCEQEMASK) | 652 LS_64(1, I40IW_CQPSQ_CQ_ENCEQEMASK) |
656 LS_64(1, I40IW_CQPSQ_CQ_CEQIDVALID) | 653 LS_64(1, I40IW_CQPSQ_CQ_CEQIDVALID) |
657 LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID); 654 LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID);
658 set_64bit_val(wqe, 24, header); 655 i40iw_insert_wqe_hdr(wqe, header);
659 656
660 i40iw_debug_buf(dev, I40IW_DEBUG_PUDA, "PUDA CQE", 657 i40iw_debug_buf(dev, I40IW_DEBUG_PUDA, "PUDA CQE",
661 wqe, I40IW_CQP_WQE_SIZE * 8); 658 wqe, I40IW_CQP_WQE_SIZE * 8);
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 28b3d02d511b..62be0a41ad0b 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -826,12 +826,14 @@ static int i40iw_query_qp(struct ib_qp *ibqp,
826 attr->cap.max_inline_data = I40IW_MAX_INLINE_DATA_SIZE; 826 attr->cap.max_inline_data = I40IW_MAX_INLINE_DATA_SIZE;
827 attr->cap.max_send_sge = I40IW_MAX_WQ_FRAGMENT_COUNT; 827 attr->cap.max_send_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
828 attr->cap.max_recv_sge = I40IW_MAX_WQ_FRAGMENT_COUNT; 828 attr->cap.max_recv_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
829 attr->port_num = 1;
829 init_attr->event_handler = iwqp->ibqp.event_handler; 830 init_attr->event_handler = iwqp->ibqp.event_handler;
830 init_attr->qp_context = iwqp->ibqp.qp_context; 831 init_attr->qp_context = iwqp->ibqp.qp_context;
831 init_attr->send_cq = iwqp->ibqp.send_cq; 832 init_attr->send_cq = iwqp->ibqp.send_cq;
832 init_attr->recv_cq = iwqp->ibqp.recv_cq; 833 init_attr->recv_cq = iwqp->ibqp.recv_cq;
833 init_attr->srq = iwqp->ibqp.srq; 834 init_attr->srq = iwqp->ibqp.srq;
834 init_attr->cap = attr->cap; 835 init_attr->cap = attr->cap;
836 init_attr->port_num = 1;
835 return 0; 837 return 0;
836} 838}
837 839
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index d6fbad8f34aa..552f7bd4ecc3 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4174,9 +4174,9 @@ err_bfreg:
4174err_uar_page: 4174err_uar_page:
4175 mlx5_put_uars_page(dev->mdev, dev->mdev->priv.uar); 4175 mlx5_put_uars_page(dev->mdev, dev->mdev->priv.uar);
4176 4176
4177err_cnt:
4178 mlx5_ib_cleanup_cong_debugfs(dev);
4179err_cong: 4177err_cong:
4178 mlx5_ib_cleanup_cong_debugfs(dev);
4179err_cnt:
4180 if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt)) 4180 if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
4181 mlx5_ib_dealloc_counters(dev); 4181 mlx5_ib_dealloc_counters(dev);
4182 4182
diff --git a/drivers/infiniband/hw/qedr/qedr.h b/drivers/infiniband/hw/qedr/qedr.h
index b2bb42e2805d..254083b524bd 100644
--- a/drivers/infiniband/hw/qedr/qedr.h
+++ b/drivers/infiniband/hw/qedr/qedr.h
@@ -387,7 +387,7 @@ struct qedr_qp {
387 u8 wqe_size; 387 u8 wqe_size;
388 388
389 u8 smac[ETH_ALEN]; 389 u8 smac[ETH_ALEN];
390 u16 vlan_id; 390 u16 vlan;
391 int rc; 391 int rc;
392 } *rqe_wr_id; 392 } *rqe_wr_id;
393 393
diff --git a/drivers/infiniband/hw/qedr/qedr_cm.c b/drivers/infiniband/hw/qedr/qedr_cm.c
index 4689e802b332..ad8965397cf7 100644
--- a/drivers/infiniband/hw/qedr/qedr_cm.c
+++ b/drivers/infiniband/hw/qedr/qedr_cm.c
@@ -105,7 +105,7 @@ void qedr_ll2_complete_rx_packet(void *cxt,
105 105
106 qp->rqe_wr_id[qp->rq.gsi_cons].rc = data->u.data_length_error ? 106 qp->rqe_wr_id[qp->rq.gsi_cons].rc = data->u.data_length_error ?
107 -EINVAL : 0; 107 -EINVAL : 0;
108 qp->rqe_wr_id[qp->rq.gsi_cons].vlan_id = data->vlan; 108 qp->rqe_wr_id[qp->rq.gsi_cons].vlan = data->vlan;
109 /* note: length stands for data length i.e. GRH is excluded */ 109 /* note: length stands for data length i.e. GRH is excluded */
110 qp->rqe_wr_id[qp->rq.gsi_cons].sg_list[0].length = 110 qp->rqe_wr_id[qp->rq.gsi_cons].sg_list[0].length =
111 data->length.data_length; 111 data->length.data_length;
@@ -694,6 +694,7 @@ int qedr_gsi_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc)
694 struct qedr_cq *cq = get_qedr_cq(ibcq); 694 struct qedr_cq *cq = get_qedr_cq(ibcq);
695 struct qedr_qp *qp = dev->gsi_qp; 695 struct qedr_qp *qp = dev->gsi_qp;
696 unsigned long flags; 696 unsigned long flags;
697 u16 vlan_id;
697 int i = 0; 698 int i = 0;
698 699
699 spin_lock_irqsave(&cq->cq_lock, flags); 700 spin_lock_irqsave(&cq->cq_lock, flags);
@@ -712,9 +713,14 @@ int qedr_gsi_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc)
712 wc[i].wc_flags |= IB_WC_GRH | IB_WC_IP_CSUM_OK; 713 wc[i].wc_flags |= IB_WC_GRH | IB_WC_IP_CSUM_OK;
713 ether_addr_copy(wc[i].smac, qp->rqe_wr_id[qp->rq.cons].smac); 714 ether_addr_copy(wc[i].smac, qp->rqe_wr_id[qp->rq.cons].smac);
714 wc[i].wc_flags |= IB_WC_WITH_SMAC; 715 wc[i].wc_flags |= IB_WC_WITH_SMAC;
715 if (qp->rqe_wr_id[qp->rq.cons].vlan_id) { 716
717 vlan_id = qp->rqe_wr_id[qp->rq.cons].vlan &
718 VLAN_VID_MASK;
719 if (vlan_id) {
716 wc[i].wc_flags |= IB_WC_WITH_VLAN; 720 wc[i].wc_flags |= IB_WC_WITH_VLAN;
717 wc[i].vlan_id = qp->rqe_wr_id[qp->rq.cons].vlan_id; 721 wc[i].vlan_id = vlan_id;
722 wc[i].sl = (qp->rqe_wr_id[qp->rq.cons].vlan &
723 VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
718 } 724 }
719 725
720 qedr_inc_sw_cons(&qp->rq); 726 qedr_inc_sw_cons(&qp->rq);
diff --git a/drivers/md/bcache/closure.c b/drivers/md/bcache/closure.c
index 7d5286b05036..1841d0359bac 100644
--- a/drivers/md/bcache/closure.c
+++ b/drivers/md/bcache/closure.c
@@ -64,7 +64,7 @@ EXPORT_SYMBOL(closure_put);
64void __closure_wake_up(struct closure_waitlist *wait_list) 64void __closure_wake_up(struct closure_waitlist *wait_list)
65{ 65{
66 struct llist_node *list; 66 struct llist_node *list;
67 struct closure *cl; 67 struct closure *cl, *t;
68 struct llist_node *reverse = NULL; 68 struct llist_node *reverse = NULL;
69 69
70 list = llist_del_all(&wait_list->list); 70 list = llist_del_all(&wait_list->list);
@@ -73,7 +73,7 @@ void __closure_wake_up(struct closure_waitlist *wait_list)
73 reverse = llist_reverse_order(list); 73 reverse = llist_reverse_order(list);
74 74
75 /* Then do the wakeups */ 75 /* Then do the wakeups */
76 llist_for_each_entry(cl, reverse, list) { 76 llist_for_each_entry_safe(cl, t, reverse, list) {
77 closure_set_waiting(cl, 0); 77 closure_set_waiting(cl, 0);
78 closure_sub(cl, CLOSURE_WAITING + 1); 78 closure_sub(cl, CLOSURE_WAITING + 1);
79 } 79 }
diff --git a/drivers/misc/cxl/cxllib.c b/drivers/misc/cxl/cxllib.c
index 5dba23ca2e5f..dc9bc1807fdf 100644
--- a/drivers/misc/cxl/cxllib.c
+++ b/drivers/misc/cxl/cxllib.c
@@ -219,8 +219,17 @@ int cxllib_handle_fault(struct mm_struct *mm, u64 addr, u64 size, u64 flags)
219 219
220 down_read(&mm->mmap_sem); 220 down_read(&mm->mmap_sem);
221 221
222 for (dar = addr; dar < addr + size; dar += page_size) { 222 vma = find_vma(mm, addr);
223 if (!vma || dar < vma->vm_start || dar > vma->vm_end) { 223 if (!vma) {
224 pr_err("Can't find vma for addr %016llx\n", addr);
225 rc = -EFAULT;
226 goto out;
227 }
228 /* get the size of the pages allocated */
229 page_size = vma_kernel_pagesize(vma);
230
231 for (dar = (addr & ~(page_size - 1)); dar < (addr + size); dar += page_size) {
232 if (dar < vma->vm_start || dar >= vma->vm_end) {
224 vma = find_vma(mm, addr); 233 vma = find_vma(mm, addr);
225 if (!vma) { 234 if (!vma) {
226 pr_err("Can't find vma for addr %016llx\n", addr); 235 pr_err("Can't find vma for addr %016llx\n", addr);
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 29fc1e662891..2ad7b5c69156 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1634,8 +1634,6 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,
1634 } 1634 }
1635 1635
1636 mqrq->areq.mrq = &brq->mrq; 1636 mqrq->areq.mrq = &brq->mrq;
1637
1638 mmc_queue_bounce_pre(mqrq);
1639} 1637}
1640 1638
1641static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, 1639static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
@@ -1829,7 +1827,6 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *new_req)
1829 brq = &mq_rq->brq; 1827 brq = &mq_rq->brq;
1830 old_req = mmc_queue_req_to_req(mq_rq); 1828 old_req = mmc_queue_req_to_req(mq_rq);
1831 type = rq_data_dir(old_req) == READ ? MMC_BLK_READ : MMC_BLK_WRITE; 1829 type = rq_data_dir(old_req) == READ ? MMC_BLK_READ : MMC_BLK_WRITE;
1832 mmc_queue_bounce_post(mq_rq);
1833 1830
1834 switch (status) { 1831 switch (status) {
1835 case MMC_BLK_SUCCESS: 1832 case MMC_BLK_SUCCESS:
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index a7eb623f8daa..36217ad5e9b1 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1286,6 +1286,23 @@ out_err:
1286 return err; 1286 return err;
1287} 1287}
1288 1288
1289static void mmc_select_driver_type(struct mmc_card *card)
1290{
1291 int card_drv_type, drive_strength, drv_type;
1292
1293 card_drv_type = card->ext_csd.raw_driver_strength |
1294 mmc_driver_type_mask(0);
1295
1296 drive_strength = mmc_select_drive_strength(card,
1297 card->ext_csd.hs200_max_dtr,
1298 card_drv_type, &drv_type);
1299
1300 card->drive_strength = drive_strength;
1301
1302 if (drv_type)
1303 mmc_set_driver_type(card->host, drv_type);
1304}
1305
1289static int mmc_select_hs400es(struct mmc_card *card) 1306static int mmc_select_hs400es(struct mmc_card *card)
1290{ 1307{
1291 struct mmc_host *host = card->host; 1308 struct mmc_host *host = card->host;
@@ -1341,6 +1358,8 @@ static int mmc_select_hs400es(struct mmc_card *card)
1341 goto out_err; 1358 goto out_err;
1342 } 1359 }
1343 1360
1361 mmc_select_driver_type(card);
1362
1344 /* Switch card to HS400 */ 1363 /* Switch card to HS400 */
1345 val = EXT_CSD_TIMING_HS400 | 1364 val = EXT_CSD_TIMING_HS400 |
1346 card->drive_strength << EXT_CSD_DRV_STR_SHIFT; 1365 card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
@@ -1374,23 +1393,6 @@ out_err:
1374 return err; 1393 return err;
1375} 1394}
1376 1395
1377static void mmc_select_driver_type(struct mmc_card *card)
1378{
1379 int card_drv_type, drive_strength, drv_type;
1380
1381 card_drv_type = card->ext_csd.raw_driver_strength |
1382 mmc_driver_type_mask(0);
1383
1384 drive_strength = mmc_select_drive_strength(card,
1385 card->ext_csd.hs200_max_dtr,
1386 card_drv_type, &drv_type);
1387
1388 card->drive_strength = drive_strength;
1389
1390 if (drv_type)
1391 mmc_set_driver_type(card->host, drv_type);
1392}
1393
1394/* 1396/*
1395 * For device supporting HS200 mode, the following sequence 1397 * For device supporting HS200 mode, the following sequence
1396 * should be done before executing the tuning process. 1398 * should be done before executing the tuning process.
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index 74c663b1c0a7..0a4e77a5ba33 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -23,8 +23,6 @@
23#include "core.h" 23#include "core.h"
24#include "card.h" 24#include "card.h"
25 25
26#define MMC_QUEUE_BOUNCESZ 65536
27
28/* 26/*
29 * Prepare a MMC request. This just filters out odd stuff. 27 * Prepare a MMC request. This just filters out odd stuff.
30 */ 28 */
@@ -150,26 +148,6 @@ static void mmc_queue_setup_discard(struct request_queue *q,
150 queue_flag_set_unlocked(QUEUE_FLAG_SECERASE, q); 148 queue_flag_set_unlocked(QUEUE_FLAG_SECERASE, q);
151} 149}
152 150
153static unsigned int mmc_queue_calc_bouncesz(struct mmc_host *host)
154{
155 unsigned int bouncesz = MMC_QUEUE_BOUNCESZ;
156
157 if (host->max_segs != 1 || (host->caps & MMC_CAP_NO_BOUNCE_BUFF))
158 return 0;
159
160 if (bouncesz > host->max_req_size)
161 bouncesz = host->max_req_size;
162 if (bouncesz > host->max_seg_size)
163 bouncesz = host->max_seg_size;
164 if (bouncesz > host->max_blk_count * 512)
165 bouncesz = host->max_blk_count * 512;
166
167 if (bouncesz <= 512)
168 return 0;
169
170 return bouncesz;
171}
172
173/** 151/**
174 * mmc_init_request() - initialize the MMC-specific per-request data 152 * mmc_init_request() - initialize the MMC-specific per-request data
175 * @q: the request queue 153 * @q: the request queue
@@ -184,26 +162,9 @@ static int mmc_init_request(struct request_queue *q, struct request *req,
184 struct mmc_card *card = mq->card; 162 struct mmc_card *card = mq->card;
185 struct mmc_host *host = card->host; 163 struct mmc_host *host = card->host;
186 164
187 if (card->bouncesz) { 165 mq_rq->sg = mmc_alloc_sg(host->max_segs, gfp);
188 mq_rq->bounce_buf = kmalloc(card->bouncesz, gfp); 166 if (!mq_rq->sg)
189 if (!mq_rq->bounce_buf) 167 return -ENOMEM;
190 return -ENOMEM;
191 if (card->bouncesz > 512) {
192 mq_rq->sg = mmc_alloc_sg(1, gfp);
193 if (!mq_rq->sg)
194 return -ENOMEM;
195 mq_rq->bounce_sg = mmc_alloc_sg(card->bouncesz / 512,
196 gfp);
197 if (!mq_rq->bounce_sg)
198 return -ENOMEM;
199 }
200 } else {
201 mq_rq->bounce_buf = NULL;
202 mq_rq->bounce_sg = NULL;
203 mq_rq->sg = mmc_alloc_sg(host->max_segs, gfp);
204 if (!mq_rq->sg)
205 return -ENOMEM;
206 }
207 168
208 return 0; 169 return 0;
209} 170}
@@ -212,13 +173,6 @@ static void mmc_exit_request(struct request_queue *q, struct request *req)
212{ 173{
213 struct mmc_queue_req *mq_rq = req_to_mmc_queue_req(req); 174 struct mmc_queue_req *mq_rq = req_to_mmc_queue_req(req);
214 175
215 /* It is OK to kfree(NULL) so this will be smooth */
216 kfree(mq_rq->bounce_sg);
217 mq_rq->bounce_sg = NULL;
218
219 kfree(mq_rq->bounce_buf);
220 mq_rq->bounce_buf = NULL;
221
222 kfree(mq_rq->sg); 176 kfree(mq_rq->sg);
223 mq_rq->sg = NULL; 177 mq_rq->sg = NULL;
224} 178}
@@ -242,12 +196,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
242 if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) 196 if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
243 limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT; 197 limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
244 198
245 /*
246 * mmc_init_request() depends on card->bouncesz so it must be calculated
247 * before blk_init_allocated_queue() starts allocating requests.
248 */
249 card->bouncesz = mmc_queue_calc_bouncesz(host);
250
251 mq->card = card; 199 mq->card = card;
252 mq->queue = blk_alloc_queue(GFP_KERNEL); 200 mq->queue = blk_alloc_queue(GFP_KERNEL);
253 if (!mq->queue) 201 if (!mq->queue)
@@ -271,17 +219,11 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
271 if (mmc_can_erase(card)) 219 if (mmc_can_erase(card))
272 mmc_queue_setup_discard(mq->queue, card); 220 mmc_queue_setup_discard(mq->queue, card);
273 221
274 if (card->bouncesz) { 222 blk_queue_bounce_limit(mq->queue, limit);
275 blk_queue_max_hw_sectors(mq->queue, card->bouncesz / 512); 223 blk_queue_max_hw_sectors(mq->queue,
276 blk_queue_max_segments(mq->queue, card->bouncesz / 512); 224 min(host->max_blk_count, host->max_req_size / 512));
277 blk_queue_max_segment_size(mq->queue, card->bouncesz); 225 blk_queue_max_segments(mq->queue, host->max_segs);
278 } else { 226 blk_queue_max_segment_size(mq->queue, host->max_seg_size);
279 blk_queue_bounce_limit(mq->queue, limit);
280 blk_queue_max_hw_sectors(mq->queue,
281 min(host->max_blk_count, host->max_req_size / 512));
282 blk_queue_max_segments(mq->queue, host->max_segs);
283 blk_queue_max_segment_size(mq->queue, host->max_seg_size);
284 }
285 227
286 sema_init(&mq->thread_sem, 1); 228 sema_init(&mq->thread_sem, 1);
287 229
@@ -370,56 +312,7 @@ void mmc_queue_resume(struct mmc_queue *mq)
370 */ 312 */
371unsigned int mmc_queue_map_sg(struct mmc_queue *mq, struct mmc_queue_req *mqrq) 313unsigned int mmc_queue_map_sg(struct mmc_queue *mq, struct mmc_queue_req *mqrq)
372{ 314{
373 unsigned int sg_len;
374 size_t buflen;
375 struct scatterlist *sg;
376 struct request *req = mmc_queue_req_to_req(mqrq); 315 struct request *req = mmc_queue_req_to_req(mqrq);
377 int i;
378
379 if (!mqrq->bounce_buf)
380 return blk_rq_map_sg(mq->queue, req, mqrq->sg);
381
382 sg_len = blk_rq_map_sg(mq->queue, req, mqrq->bounce_sg);
383
384 mqrq->bounce_sg_len = sg_len;
385
386 buflen = 0;
387 for_each_sg(mqrq->bounce_sg, sg, sg_len, i)
388 buflen += sg->length;
389
390 sg_init_one(mqrq->sg, mqrq->bounce_buf, buflen);
391
392 return 1;
393}
394
395/*
396 * If writing, bounce the data to the buffer before the request
397 * is sent to the host driver
398 */
399void mmc_queue_bounce_pre(struct mmc_queue_req *mqrq)
400{
401 if (!mqrq->bounce_buf)
402 return;
403
404 if (rq_data_dir(mmc_queue_req_to_req(mqrq)) != WRITE)
405 return;
406
407 sg_copy_to_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len,
408 mqrq->bounce_buf, mqrq->sg[0].length);
409}
410
411/*
412 * If reading, bounce the data from the buffer after the request
413 * has been handled by the host driver
414 */
415void mmc_queue_bounce_post(struct mmc_queue_req *mqrq)
416{
417 if (!mqrq->bounce_buf)
418 return;
419
420 if (rq_data_dir(mmc_queue_req_to_req(mqrq)) != READ)
421 return;
422 316
423 sg_copy_from_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len, 317 return blk_rq_map_sg(mq->queue, req, mqrq->sg);
424 mqrq->bounce_buf, mqrq->sg[0].length);
425} 318}
diff --git a/drivers/mmc/core/queue.h b/drivers/mmc/core/queue.h
index 04fc89360a7a..f18d3f656baa 100644
--- a/drivers/mmc/core/queue.h
+++ b/drivers/mmc/core/queue.h
@@ -49,9 +49,6 @@ enum mmc_drv_op {
49struct mmc_queue_req { 49struct mmc_queue_req {
50 struct mmc_blk_request brq; 50 struct mmc_blk_request brq;
51 struct scatterlist *sg; 51 struct scatterlist *sg;
52 char *bounce_buf;
53 struct scatterlist *bounce_sg;
54 unsigned int bounce_sg_len;
55 struct mmc_async_req areq; 52 struct mmc_async_req areq;
56 enum mmc_drv_op drv_op; 53 enum mmc_drv_op drv_op;
57 int drv_op_result; 54 int drv_op_result;
@@ -81,11 +78,8 @@ extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
81extern void mmc_cleanup_queue(struct mmc_queue *); 78extern void mmc_cleanup_queue(struct mmc_queue *);
82extern void mmc_queue_suspend(struct mmc_queue *); 79extern void mmc_queue_suspend(struct mmc_queue *);
83extern void mmc_queue_resume(struct mmc_queue *); 80extern void mmc_queue_resume(struct mmc_queue *);
84
85extern unsigned int mmc_queue_map_sg(struct mmc_queue *, 81extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
86 struct mmc_queue_req *); 82 struct mmc_queue_req *);
87extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
88extern void mmc_queue_bounce_post(struct mmc_queue_req *);
89 83
90extern int mmc_access_rpmb(struct mmc_queue *); 84extern int mmc_access_rpmb(struct mmc_queue *);
91 85
diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
index 27fb625cbcf3..fbd29f00fca0 100644
--- a/drivers/mmc/host/cavium.c
+++ b/drivers/mmc/host/cavium.c
@@ -1038,7 +1038,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)
1038 */ 1038 */
1039 mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 1039 mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
1040 MMC_CAP_ERASE | MMC_CAP_CMD23 | MMC_CAP_POWER_OFF_CARD | 1040 MMC_CAP_ERASE | MMC_CAP_CMD23 | MMC_CAP_POWER_OFF_CARD |
1041 MMC_CAP_3_3V_DDR | MMC_CAP_NO_BOUNCE_BUFF; 1041 MMC_CAP_3_3V_DDR;
1042 1042
1043 if (host->use_sg) 1043 if (host->use_sg)
1044 mmc->max_segs = 16; 1044 mmc->max_segs = 16;
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index c885c2d4b904..85745ef179e2 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -531,8 +531,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
531 div->shift = __ffs(CLK_DIV_MASK); 531 div->shift = __ffs(CLK_DIV_MASK);
532 div->width = __builtin_popcountl(CLK_DIV_MASK); 532 div->width = __builtin_popcountl(CLK_DIV_MASK);
533 div->hw.init = &init; 533 div->hw.init = &init;
534 div->flags = (CLK_DIVIDER_ONE_BASED | 534 div->flags = CLK_DIVIDER_ONE_BASED;
535 CLK_DIVIDER_ROUND_CLOSEST);
536 535
537 clk = devm_clk_register(host->dev, &div->hw); 536 clk = devm_clk_register(host->dev, &div->hw);
538 if (WARN_ON(IS_ERR(clk))) 537 if (WARN_ON(IS_ERR(clk)))
@@ -717,6 +716,22 @@ static int meson_mmc_clk_phase_tuning(struct mmc_host *mmc, u32 opcode,
717static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) 716static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
718{ 717{
719 struct meson_host *host = mmc_priv(mmc); 718 struct meson_host *host = mmc_priv(mmc);
719 int ret;
720
721 /*
722 * If this is the initial tuning, try to get a sane Rx starting
723 * phase before doing the actual tuning.
724 */
725 if (!mmc->doing_retune) {
726 ret = meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk);
727
728 if (ret)
729 return ret;
730 }
731
732 ret = meson_mmc_clk_phase_tuning(mmc, opcode, host->tx_clk);
733 if (ret)
734 return ret;
720 735
721 return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); 736 return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk);
722} 737}
@@ -746,6 +761,11 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
746 case MMC_POWER_UP: 761 case MMC_POWER_UP:
747 if (!IS_ERR(mmc->supply.vmmc)) 762 if (!IS_ERR(mmc->supply.vmmc))
748 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); 763 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
764
765 /* Reset phases */
766 clk_set_phase(host->rx_clk, 0);
767 clk_set_phase(host->tx_clk, 270);
768
749 break; 769 break;
750 770
751 case MMC_POWER_ON: 771 case MMC_POWER_ON:
@@ -759,8 +779,6 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
759 host->vqmmc_enabled = true; 779 host->vqmmc_enabled = true;
760 } 780 }
761 781
762 /* Reset rx phase */
763 clk_set_phase(host->rx_clk, 0);
764 break; 782 break;
765 } 783 }
766 784
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 59ab194cb009..c763b404510f 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -702,11 +702,7 @@ static int pxamci_probe(struct platform_device *pdev)
702 702
703 pxamci_init_ocr(host); 703 pxamci_init_ocr(host);
704 704
705 /* 705 mmc->caps = 0;
706 * This architecture used to disable bounce buffers through its
707 * defconfig, now it is done at runtime as a host property.
708 */
709 mmc->caps = MMC_CAP_NO_BOUNCE_BUFF;
710 host->cmdat = 0; 706 host->cmdat = 0;
711 if (!cpu_is_pxa25x()) { 707 if (!cpu_is_pxa25x()) {
712 mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; 708 mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ;
diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
index 2eec2e652c53..0842bbc2d7ad 100644
--- a/drivers/mmc/host/sdhci-xenon.c
+++ b/drivers/mmc/host/sdhci-xenon.c
@@ -466,6 +466,7 @@ static int xenon_probe(struct platform_device *pdev)
466{ 466{
467 struct sdhci_pltfm_host *pltfm_host; 467 struct sdhci_pltfm_host *pltfm_host;
468 struct sdhci_host *host; 468 struct sdhci_host *host;
469 struct xenon_priv *priv;
469 int err; 470 int err;
470 471
471 host = sdhci_pltfm_init(pdev, &sdhci_xenon_pdata, 472 host = sdhci_pltfm_init(pdev, &sdhci_xenon_pdata,
@@ -474,6 +475,7 @@ static int xenon_probe(struct platform_device *pdev)
474 return PTR_ERR(host); 475 return PTR_ERR(host);
475 476
476 pltfm_host = sdhci_priv(host); 477 pltfm_host = sdhci_priv(host);
478 priv = sdhci_pltfm_priv(pltfm_host);
477 479
478 /* 480 /*
479 * Link Xenon specific mmc_host_ops function, 481 * Link Xenon specific mmc_host_ops function,
@@ -491,9 +493,20 @@ static int xenon_probe(struct platform_device *pdev)
491 if (err) 493 if (err)
492 goto free_pltfm; 494 goto free_pltfm;
493 495
496 priv->axi_clk = devm_clk_get(&pdev->dev, "axi");
497 if (IS_ERR(priv->axi_clk)) {
498 err = PTR_ERR(priv->axi_clk);
499 if (err == -EPROBE_DEFER)
500 goto err_clk;
501 } else {
502 err = clk_prepare_enable(priv->axi_clk);
503 if (err)
504 goto err_clk;
505 }
506
494 err = mmc_of_parse(host->mmc); 507 err = mmc_of_parse(host->mmc);
495 if (err) 508 if (err)
496 goto err_clk; 509 goto err_clk_axi;
497 510
498 sdhci_get_of_property(pdev); 511 sdhci_get_of_property(pdev);
499 512
@@ -502,11 +515,11 @@ static int xenon_probe(struct platform_device *pdev)
502 /* Xenon specific dt parse */ 515 /* Xenon specific dt parse */
503 err = xenon_probe_dt(pdev); 516 err = xenon_probe_dt(pdev);
504 if (err) 517 if (err)
505 goto err_clk; 518 goto err_clk_axi;
506 519
507 err = xenon_sdhc_prepare(host); 520 err = xenon_sdhc_prepare(host);
508 if (err) 521 if (err)
509 goto err_clk; 522 goto err_clk_axi;
510 523
511 pm_runtime_get_noresume(&pdev->dev); 524 pm_runtime_get_noresume(&pdev->dev);
512 pm_runtime_set_active(&pdev->dev); 525 pm_runtime_set_active(&pdev->dev);
@@ -527,6 +540,8 @@ remove_sdhc:
527 pm_runtime_disable(&pdev->dev); 540 pm_runtime_disable(&pdev->dev);
528 pm_runtime_put_noidle(&pdev->dev); 541 pm_runtime_put_noidle(&pdev->dev);
529 xenon_sdhc_unprepare(host); 542 xenon_sdhc_unprepare(host);
543err_clk_axi:
544 clk_disable_unprepare(priv->axi_clk);
530err_clk: 545err_clk:
531 clk_disable_unprepare(pltfm_host->clk); 546 clk_disable_unprepare(pltfm_host->clk);
532free_pltfm: 547free_pltfm:
@@ -538,6 +553,7 @@ static int xenon_remove(struct platform_device *pdev)
538{ 553{
539 struct sdhci_host *host = platform_get_drvdata(pdev); 554 struct sdhci_host *host = platform_get_drvdata(pdev);
540 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 555 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
556 struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
541 557
542 pm_runtime_get_sync(&pdev->dev); 558 pm_runtime_get_sync(&pdev->dev);
543 pm_runtime_disable(&pdev->dev); 559 pm_runtime_disable(&pdev->dev);
@@ -546,7 +562,7 @@ static int xenon_remove(struct platform_device *pdev)
546 sdhci_remove_host(host, 0); 562 sdhci_remove_host(host, 0);
547 563
548 xenon_sdhc_unprepare(host); 564 xenon_sdhc_unprepare(host);
549 565 clk_disable_unprepare(priv->axi_clk);
550 clk_disable_unprepare(pltfm_host->clk); 566 clk_disable_unprepare(pltfm_host->clk);
551 567
552 sdhci_pltfm_free(pdev); 568 sdhci_pltfm_free(pdev);
diff --git a/drivers/mmc/host/sdhci-xenon.h b/drivers/mmc/host/sdhci-xenon.h
index 2bc0510c0769..9994995c7c56 100644
--- a/drivers/mmc/host/sdhci-xenon.h
+++ b/drivers/mmc/host/sdhci-xenon.h
@@ -83,6 +83,7 @@ struct xenon_priv {
83 unsigned char bus_width; 83 unsigned char bus_width;
84 unsigned char timing; 84 unsigned char timing;
85 unsigned int clock; 85 unsigned int clock;
86 struct clk *axi_clk;
86 87
87 int phy_type; 88 int phy_type;
88 /* 89 /*
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index bb2aad078637..5a14cc7f28ee 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2136,7 +2136,7 @@ static umode_t nvme_ns_attrs_are_visible(struct kobject *kobj,
2136 struct nvme_ns *ns = nvme_get_ns_from_dev(dev); 2136 struct nvme_ns *ns = nvme_get_ns_from_dev(dev);
2137 2137
2138 if (a == &dev_attr_uuid.attr) { 2138 if (a == &dev_attr_uuid.attr) {
2139 if (uuid_is_null(&ns->uuid) || 2139 if (uuid_is_null(&ns->uuid) &&
2140 !memchr_inv(ns->nguid, 0, sizeof(ns->nguid))) 2140 !memchr_inv(ns->nguid, 0, sizeof(ns->nguid)))
2141 return 0; 2141 return 0;
2142 } 2142 }
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index cb73bc8cad3b..3f5a04c586ce 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -94,7 +94,7 @@ struct nvme_dev {
94 struct mutex shutdown_lock; 94 struct mutex shutdown_lock;
95 bool subsystem; 95 bool subsystem;
96 void __iomem *cmb; 96 void __iomem *cmb;
97 dma_addr_t cmb_dma_addr; 97 pci_bus_addr_t cmb_bus_addr;
98 u64 cmb_size; 98 u64 cmb_size;
99 u32 cmbsz; 99 u32 cmbsz;
100 u32 cmbloc; 100 u32 cmbloc;
@@ -1226,7 +1226,7 @@ static int nvme_alloc_sq_cmds(struct nvme_dev *dev, struct nvme_queue *nvmeq,
1226 if (qid && dev->cmb && use_cmb_sqes && NVME_CMB_SQS(dev->cmbsz)) { 1226 if (qid && dev->cmb && use_cmb_sqes && NVME_CMB_SQS(dev->cmbsz)) {
1227 unsigned offset = (qid - 1) * roundup(SQ_SIZE(depth), 1227 unsigned offset = (qid - 1) * roundup(SQ_SIZE(depth),
1228 dev->ctrl.page_size); 1228 dev->ctrl.page_size);
1229 nvmeq->sq_dma_addr = dev->cmb_dma_addr + offset; 1229 nvmeq->sq_dma_addr = dev->cmb_bus_addr + offset;
1230 nvmeq->sq_cmds_io = dev->cmb + offset; 1230 nvmeq->sq_cmds_io = dev->cmb + offset;
1231 } else { 1231 } else {
1232 nvmeq->sq_cmds = dma_alloc_coherent(dev->dev, SQ_SIZE(depth), 1232 nvmeq->sq_cmds = dma_alloc_coherent(dev->dev, SQ_SIZE(depth),
@@ -1527,7 +1527,7 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev)
1527 resource_size_t bar_size; 1527 resource_size_t bar_size;
1528 struct pci_dev *pdev = to_pci_dev(dev->dev); 1528 struct pci_dev *pdev = to_pci_dev(dev->dev);
1529 void __iomem *cmb; 1529 void __iomem *cmb;
1530 dma_addr_t dma_addr; 1530 int bar;
1531 1531
1532 dev->cmbsz = readl(dev->bar + NVME_REG_CMBSZ); 1532 dev->cmbsz = readl(dev->bar + NVME_REG_CMBSZ);
1533 if (!(NVME_CMB_SZ(dev->cmbsz))) 1533 if (!(NVME_CMB_SZ(dev->cmbsz)))
@@ -1540,7 +1540,8 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev)
1540 szu = (u64)1 << (12 + 4 * NVME_CMB_SZU(dev->cmbsz)); 1540 szu = (u64)1 << (12 + 4 * NVME_CMB_SZU(dev->cmbsz));
1541 size = szu * NVME_CMB_SZ(dev->cmbsz); 1541 size = szu * NVME_CMB_SZ(dev->cmbsz);
1542 offset = szu * NVME_CMB_OFST(dev->cmbloc); 1542 offset = szu * NVME_CMB_OFST(dev->cmbloc);
1543 bar_size = pci_resource_len(pdev, NVME_CMB_BIR(dev->cmbloc)); 1543 bar = NVME_CMB_BIR(dev->cmbloc);
1544 bar_size = pci_resource_len(pdev, bar);
1544 1545
1545 if (offset > bar_size) 1546 if (offset > bar_size)
1546 return NULL; 1547 return NULL;
@@ -1553,12 +1554,11 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev)
1553 if (size > bar_size - offset) 1554 if (size > bar_size - offset)
1554 size = bar_size - offset; 1555 size = bar_size - offset;
1555 1556
1556 dma_addr = pci_resource_start(pdev, NVME_CMB_BIR(dev->cmbloc)) + offset; 1557 cmb = ioremap_wc(pci_resource_start(pdev, bar) + offset, size);
1557 cmb = ioremap_wc(dma_addr, size);
1558 if (!cmb) 1558 if (!cmb)
1559 return NULL; 1559 return NULL;
1560 1560
1561 dev->cmb_dma_addr = dma_addr; 1561 dev->cmb_bus_addr = pci_bus_address(pdev, bar) + offset;
1562 dev->cmb_size = size; 1562 dev->cmb_size = size;
1563 return cmb; 1563 return cmb;
1564} 1564}
diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index 785fb42f6650..2799a6b08f73 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -3767,7 +3767,7 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd)
3767 */ 3767 */
3768 if ((vscsi->flags & (CLIENT_FAILED | RESPONSE_Q_DOWN))) { 3768 if ((vscsi->flags & (CLIENT_FAILED | RESPONSE_Q_DOWN))) {
3769 pr_err("write_pending failed since: %d\n", vscsi->flags); 3769 pr_err("write_pending failed since: %d\n", vscsi->flags);
3770 return 0; 3770 return -EIO;
3771 } 3771 }
3772 3772
3773 rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma, 3773 rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma,
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index bd4605a34f54..c62e8d111fd9 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2851,9 +2851,6 @@ EXPORT_SYMBOL_GPL(iscsi_session_setup);
2851/** 2851/**
2852 * iscsi_session_teardown - destroy session, host, and cls_session 2852 * iscsi_session_teardown - destroy session, host, and cls_session
2853 * @cls_session: iscsi session 2853 * @cls_session: iscsi session
2854 *
2855 * The driver must have called iscsi_remove_session before
2856 * calling this.
2857 */ 2854 */
2858void iscsi_session_teardown(struct iscsi_cls_session *cls_session) 2855void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
2859{ 2856{
@@ -2863,6 +2860,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
2863 2860
2864 iscsi_pool_free(&session->cmdpool); 2861 iscsi_pool_free(&session->cmdpool);
2865 2862
2863 iscsi_remove_session(cls_session);
2864
2866 kfree(session->password); 2865 kfree(session->password);
2867 kfree(session->password_in); 2866 kfree(session->password_in);
2868 kfree(session->username); 2867 kfree(session->username);
@@ -2877,7 +2876,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
2877 kfree(session->portal_type); 2876 kfree(session->portal_type);
2878 kfree(session->discovery_parent_type); 2877 kfree(session->discovery_parent_type);
2879 2878
2880 iscsi_destroy_session(cls_session); 2879 iscsi_free_session(cls_session);
2880
2881 iscsi_host_dec_session_cnt(shost); 2881 iscsi_host_dec_session_cnt(shost);
2882 module_put(owner); 2882 module_put(owner);
2883} 2883}
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index e7818afeda2b..15590a063ad9 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -956,6 +956,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
956 if (*bflags & BLIST_NO_DIF) 956 if (*bflags & BLIST_NO_DIF)
957 sdev->no_dif = 1; 957 sdev->no_dif = 1;
958 958
959 if (*bflags & BLIST_UNMAP_LIMIT_WS)
960 sdev->unmap_limit_for_ws = 1;
961
959 sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT; 962 sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT;
960 963
961 if (*bflags & BLIST_TRY_VPD_PAGES) 964 if (*bflags & BLIST_TRY_VPD_PAGES)
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 0190aeff5f7f..7404d26895f5 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2211,22 +2211,6 @@ void iscsi_free_session(struct iscsi_cls_session *session)
2211EXPORT_SYMBOL_GPL(iscsi_free_session); 2211EXPORT_SYMBOL_GPL(iscsi_free_session);
2212 2212
2213/** 2213/**
2214 * iscsi_destroy_session - destroy iscsi session
2215 * @session: iscsi_session
2216 *
2217 * Can be called by a LLD or iscsi_transport. There must not be
2218 * any running connections.
2219 */
2220int iscsi_destroy_session(struct iscsi_cls_session *session)
2221{
2222 iscsi_remove_session(session);
2223 ISCSI_DBG_TRANS_SESSION(session, "Completing session destruction\n");
2224 iscsi_free_session(session);
2225 return 0;
2226}
2227EXPORT_SYMBOL_GPL(iscsi_destroy_session);
2228
2229/**
2230 * iscsi_create_conn - create iscsi class connection 2214 * iscsi_create_conn - create iscsi class connection
2231 * @session: iscsi cls session 2215 * @session: iscsi cls session
2232 * @dd_size: private driver data size 2216 * @dd_size: private driver data size
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index fb9f8b5f4673..d175c5c5ccf8 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -715,13 +715,21 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
715 break; 715 break;
716 716
717 case SD_LBP_WS16: 717 case SD_LBP_WS16:
718 max_blocks = min_not_zero(sdkp->max_ws_blocks, 718 if (sdkp->device->unmap_limit_for_ws)
719 (u32)SD_MAX_WS16_BLOCKS); 719 max_blocks = sdkp->max_unmap_blocks;
720 else
721 max_blocks = sdkp->max_ws_blocks;
722
723 max_blocks = min_not_zero(max_blocks, (u32)SD_MAX_WS16_BLOCKS);
720 break; 724 break;
721 725
722 case SD_LBP_WS10: 726 case SD_LBP_WS10:
723 max_blocks = min_not_zero(sdkp->max_ws_blocks, 727 if (sdkp->device->unmap_limit_for_ws)
724 (u32)SD_MAX_WS10_BLOCKS); 728 max_blocks = sdkp->max_unmap_blocks;
729 else
730 max_blocks = sdkp->max_ws_blocks;
731
732 max_blocks = min_not_zero(max_blocks, (u32)SD_MAX_WS10_BLOCKS);
725 break; 733 break;
726 734
727 case SD_LBP_ZERO: 735 case SD_LBP_ZERO:
@@ -3099,8 +3107,6 @@ static int sd_revalidate_disk(struct gendisk *disk)
3099 sd_read_security(sdkp, buffer); 3107 sd_read_security(sdkp, buffer);
3100 } 3108 }
3101 3109
3102 sdkp->first_scan = 0;
3103
3104 /* 3110 /*
3105 * We now have all cache related info, determine how we deal 3111 * We now have all cache related info, determine how we deal
3106 * with flush requests. 3112 * with flush requests.
@@ -3115,7 +3121,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
3115 q->limits.max_dev_sectors = logical_to_sectors(sdp, dev_max); 3121 q->limits.max_dev_sectors = logical_to_sectors(sdp, dev_max);
3116 3122
3117 /* 3123 /*
3118 * Use the device's preferred I/O size for reads and writes 3124 * Determine the device's preferred I/O size for reads and writes
3119 * unless the reported value is unreasonably small, large, or 3125 * unless the reported value is unreasonably small, large, or
3120 * garbage. 3126 * garbage.
3121 */ 3127 */
@@ -3129,8 +3135,19 @@ static int sd_revalidate_disk(struct gendisk *disk)
3129 rw_max = min_not_zero(logical_to_sectors(sdp, dev_max), 3135 rw_max = min_not_zero(logical_to_sectors(sdp, dev_max),
3130 (sector_t)BLK_DEF_MAX_SECTORS); 3136 (sector_t)BLK_DEF_MAX_SECTORS);
3131 3137
3132 /* Combine with controller limits */ 3138 /* Do not exceed controller limit */
3133 q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q)); 3139 rw_max = min(rw_max, queue_max_hw_sectors(q));
3140
3141 /*
3142 * Only update max_sectors if previously unset or if the current value
3143 * exceeds the capabilities of the hardware.
3144 */
3145 if (sdkp->first_scan ||
3146 q->limits.max_sectors > q->limits.max_dev_sectors ||
3147 q->limits.max_sectors > q->limits.max_hw_sectors)
3148 q->limits.max_sectors = rw_max;
3149
3150 sdkp->first_scan = 0;
3134 3151
3135 set_capacity(disk, logical_to_sectors(sdp, sdkp->capacity)); 3152 set_capacity(disk, logical_to_sectors(sdp, sdkp->capacity));
3136 sd_config_write_same(sdkp); 3153 sd_config_write_same(sdkp);
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 899ddaeeacec..8fc690384c58 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -722,7 +722,7 @@ struct btrfs_delayed_root;
722 * Indicate that a whole-filesystem exclusive operation is running 722 * Indicate that a whole-filesystem exclusive operation is running
723 * (device replace, resize, device add/delete, balance) 723 * (device replace, resize, device add/delete, balance)
724 */ 724 */
725#define BTRFS_FS_EXCL_OP 14 725#define BTRFS_FS_EXCL_OP 16
726 726
727struct btrfs_fs_info { 727struct btrfs_fs_info {
728 u8 fsid[BTRFS_FSID_SIZE]; 728 u8 fsid[BTRFS_FSID_SIZE];
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 12ab19a4b93e..970190cd347e 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2801,7 +2801,7 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree,
2801 } 2801 }
2802 } 2802 }
2803 2803
2804 bio = btrfs_bio_alloc(bdev, sector << 9); 2804 bio = btrfs_bio_alloc(bdev, (u64)sector << 9);
2805 bio_add_page(bio, page, page_size, offset); 2805 bio_add_page(bio, page, page_size, offset);
2806 bio->bi_end_io = end_io_func; 2806 bio->bi_end_io = end_io_func;
2807 bio->bi_private = tree; 2807 bio->bi_private = tree;
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 84edfc60d87a..f23c820daaed 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -734,12 +734,13 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
734 inode = req->r_inode; 734 inode = req->r_inode;
735 ihold(inode); 735 ihold(inode);
736 } else { 736 } else {
737 /* req->r_dentry is non-null for LSSNAP request. 737 /* req->r_dentry is non-null for LSSNAP request */
738 * fall-thru */ 738 rcu_read_lock();
739 WARN_ON_ONCE(!req->r_dentry); 739 inode = get_nonsnap_parent(req->r_dentry);
740 rcu_read_unlock();
741 dout("__choose_mds using snapdir's parent %p\n", inode);
740 } 742 }
741 } 743 } else if (req->r_dentry) {
742 if (!inode && req->r_dentry) {
743 /* ignore race with rename; old or new d_parent is okay */ 744 /* ignore race with rename; old or new d_parent is okay */
744 struct dentry *parent; 745 struct dentry *parent;
745 struct inode *dir; 746 struct inode *dir;
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 1ffc8b426c1c..7fc0b850c352 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -374,12 +374,10 @@ static int build_snap_context(struct ceph_snap_realm *realm,
374 realm->ino, realm, snapc, snapc->seq, 374 realm->ino, realm, snapc, snapc->seq,
375 (unsigned int) snapc->num_snaps); 375 (unsigned int) snapc->num_snaps);
376 376
377 if (realm->cached_context) { 377 ceph_put_snap_context(realm->cached_context);
378 ceph_put_snap_context(realm->cached_context);
379 /* queue realm for cap_snap creation */
380 list_add_tail(&realm->dirty_item, dirty_realms);
381 }
382 realm->cached_context = snapc; 378 realm->cached_context = snapc;
379 /* queue realm for cap_snap creation */
380 list_add_tail(&realm->dirty_item, dirty_realms);
383 return 0; 381 return 0;
384 382
385fail: 383fail:
diff --git a/fs/namespace.c b/fs/namespace.c
index 54059b142d6b..3b601f115b6c 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -468,7 +468,9 @@ static inline int may_write_real(struct file *file)
468 468
469 /* File refers to upper, writable layer? */ 469 /* File refers to upper, writable layer? */
470 upperdentry = d_real(dentry, NULL, 0, D_REAL_UPPER); 470 upperdentry = d_real(dentry, NULL, 0, D_REAL_UPPER);
471 if (upperdentry && file_inode(file) == d_inode(upperdentry)) 471 if (upperdentry &&
472 (file_inode(file) == d_inode(upperdentry) ||
473 file_inode(file) == d_inode(dentry)))
472 return 0; 474 return 0;
473 475
474 /* Lower layer: can't write to real file, sorry... */ 476 /* Lower layer: can't write to real file, sorry... */
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index efebe6cf4378..22880ef6d8dd 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -218,7 +218,6 @@ static void nfs_cb_idr_remove_locked(struct nfs_client *clp)
218static void pnfs_init_server(struct nfs_server *server) 218static void pnfs_init_server(struct nfs_server *server)
219{ 219{
220 rpc_init_wait_queue(&server->roc_rpcwaitq, "pNFS ROC"); 220 rpc_init_wait_queue(&server->roc_rpcwaitq, "pNFS ROC");
221 rpc_init_wait_queue(&server->uoc_rpcwaitq, "NFS UOC");
222} 221}
223 222
224#else 223#else
@@ -888,6 +887,7 @@ struct nfs_server *nfs_alloc_server(void)
888 ida_init(&server->openowner_id); 887 ida_init(&server->openowner_id);
889 ida_init(&server->lockowner_id); 888 ida_init(&server->lockowner_id);
890 pnfs_init_server(server); 889 pnfs_init_server(server);
890 rpc_init_wait_queue(&server->uoc_rpcwaitq, "NFS UOC");
891 891
892 return server; 892 return server;
893} 893}
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index 44c638b7876c..508126eb49f9 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -745,7 +745,8 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg)
745 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg); 745 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
746 746
747 dprintk("--> %s\n", __func__); 747 dprintk("--> %s\n", __func__);
748 nfs4_fl_put_deviceid(fl->dsaddr); 748 if (fl->dsaddr != NULL)
749 nfs4_fl_put_deviceid(fl->dsaddr);
749 /* This assumes a single RW lseg */ 750 /* This assumes a single RW lseg */
750 if (lseg->pls_range.iomode == IOMODE_RW) { 751 if (lseg->pls_range.iomode == IOMODE_RW) {
751 struct nfs4_filelayout *flo; 752 struct nfs4_filelayout *flo;
diff --git a/fs/nfs/nfs4idmap.c b/fs/nfs/nfs4idmap.c
index dd5d27da8c0c..30426c1a1bbd 100644
--- a/fs/nfs/nfs4idmap.c
+++ b/fs/nfs/nfs4idmap.c
@@ -274,7 +274,7 @@ static struct key *nfs_idmap_request_key(const char *name, size_t namelen,
274 ssize_t ret; 274 ssize_t ret;
275 275
276 ret = nfs_idmap_get_desc(name, namelen, type, strlen(type), &desc); 276 ret = nfs_idmap_get_desc(name, namelen, type, strlen(type), &desc);
277 if (ret <= 0) 277 if (ret < 0)
278 return ERR_PTR(ret); 278 return ERR_PTR(ret);
279 279
280 rkey = request_key(&key_type_id_resolver, desc, ""); 280 rkey = request_key(&key_type_id_resolver, desc, "");
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 6c61e2b99635..f90090e8c959 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -8399,8 +8399,7 @@ nfs4_layoutget_handle_exception(struct rpc_task *task,
8399 lo = NFS_I(inode)->layout; 8399 lo = NFS_I(inode)->layout;
8400 /* If the open stateid was bad, then recover it. */ 8400 /* If the open stateid was bad, then recover it. */
8401 if (!lo || test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags) || 8401 if (!lo || test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags) ||
8402 nfs4_stateid_match_other(&lgp->args.stateid, 8402 !nfs4_stateid_match_other(&lgp->args.stateid, &lo->plh_stateid)) {
8403 &lgp->args.ctx->state->stateid)) {
8404 spin_unlock(&inode->i_lock); 8403 spin_unlock(&inode->i_lock);
8405 exception->state = lgp->args.ctx->state; 8404 exception->state = lgp->args.ctx->state;
8406 exception->stateid = &lgp->args.stateid; 8405 exception->stateid = &lgp->args.stateid;
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 37c8af003275..14ed9791ec9c 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1842,8 +1842,8 @@ static void encode_create_session(struct xdr_stream *xdr,
1842 * Assumes OPEN is the biggest non-idempotent compound. 1842 * Assumes OPEN is the biggest non-idempotent compound.
1843 * 2 is the verifier. 1843 * 2 is the verifier.
1844 */ 1844 */
1845 max_resp_sz_cached = (NFS4_dec_open_sz + RPC_REPHDRSIZE + 1845 max_resp_sz_cached = (NFS4_dec_open_sz + RPC_REPHDRSIZE + 2)
1846 RPC_MAX_AUTH_SIZE + 2) * XDR_UNIT; 1846 * XDR_UNIT + RPC_MAX_AUTH_SIZE;
1847 1847
1848 encode_op_hdr(xdr, OP_CREATE_SESSION, decode_create_session_maxsz, hdr); 1848 encode_op_hdr(xdr, OP_CREATE_SESSION, decode_create_session_maxsz, hdr);
1849 p = reserve_space(xdr, 16 + 2*28 + 20 + clnt->cl_nodelen + 12); 1849 p = reserve_space(xdr, 16 + 2*28 + 20 + clnt->cl_nodelen + 12);
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index aad97b30d5e6..c441f9387a1b 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -561,10 +561,8 @@ static int ovl_do_copy_up(struct ovl_copy_up_ctx *c)
561 c->tmpfile = true; 561 c->tmpfile = true;
562 err = ovl_copy_up_locked(c); 562 err = ovl_copy_up_locked(c);
563 } else { 563 } else {
564 err = -EIO; 564 err = ovl_lock_rename_workdir(c->workdir, c->destdir);
565 if (lock_rename(c->workdir, c->destdir) != NULL) { 565 if (!err) {
566 pr_err("overlayfs: failed to lock workdir+upperdir\n");
567 } else {
568 err = ovl_copy_up_locked(c); 566 err = ovl_copy_up_locked(c);
569 unlock_rename(c->workdir, c->destdir); 567 unlock_rename(c->workdir, c->destdir);
570 } 568 }
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 3309b1912241..cc961a3bd3bd 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -216,26 +216,6 @@ out_unlock:
216 return err; 216 return err;
217} 217}
218 218
219static int ovl_lock_rename_workdir(struct dentry *workdir,
220 struct dentry *upperdir)
221{
222 /* Workdir should not be the same as upperdir */
223 if (workdir == upperdir)
224 goto err;
225
226 /* Workdir should not be subdir of upperdir and vice versa */
227 if (lock_rename(workdir, upperdir) != NULL)
228 goto err_unlock;
229
230 return 0;
231
232err_unlock:
233 unlock_rename(workdir, upperdir);
234err:
235 pr_err("overlayfs: failed to lock workdir+upperdir\n");
236 return -EIO;
237}
238
239static struct dentry *ovl_clear_empty(struct dentry *dentry, 219static struct dentry *ovl_clear_empty(struct dentry *dentry,
240 struct list_head *list) 220 struct list_head *list)
241{ 221{
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index c3addd1114f1..654bea1a5ac9 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -506,6 +506,7 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry,
506 506
507 index = lookup_one_len_unlocked(name.name, ofs->indexdir, name.len); 507 index = lookup_one_len_unlocked(name.name, ofs->indexdir, name.len);
508 if (IS_ERR(index)) { 508 if (IS_ERR(index)) {
509 err = PTR_ERR(index);
509 pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n" 510 pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n"
510 "overlayfs: mount with '-o index=off' to disable inodes index.\n", 511 "overlayfs: mount with '-o index=off' to disable inodes index.\n",
511 d_inode(origin)->i_ino, name.len, name.name, 512 d_inode(origin)->i_ino, name.len, name.name,
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index d4e8c1a08fb0..c706a6f99928 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -235,6 +235,7 @@ bool ovl_inuse_trylock(struct dentry *dentry);
235void ovl_inuse_unlock(struct dentry *dentry); 235void ovl_inuse_unlock(struct dentry *dentry);
236int ovl_nlink_start(struct dentry *dentry, bool *locked); 236int ovl_nlink_start(struct dentry *dentry, bool *locked);
237void ovl_nlink_end(struct dentry *dentry, bool locked); 237void ovl_nlink_end(struct dentry *dentry, bool locked);
238int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *upperdir);
238 239
239static inline bool ovl_is_impuredir(struct dentry *dentry) 240static inline bool ovl_is_impuredir(struct dentry *dentry)
240{ 241{
diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h
index 878a750986dd..25d9b5adcd42 100644
--- a/fs/overlayfs/ovl_entry.h
+++ b/fs/overlayfs/ovl_entry.h
@@ -37,6 +37,9 @@ struct ovl_fs {
37 bool noxattr; 37 bool noxattr;
38 /* sb common to all layers */ 38 /* sb common to all layers */
39 struct super_block *same_sb; 39 struct super_block *same_sb;
40 /* Did we take the inuse lock? */
41 bool upperdir_locked;
42 bool workdir_locked;
40}; 43};
41 44
42/* private information held for every overlayfs dentry */ 45/* private information held for every overlayfs dentry */
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 62e9b22a2077..0f85ee9c3268 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -988,6 +988,7 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt,
988 struct path *lowerstack, unsigned int numlower) 988 struct path *lowerstack, unsigned int numlower)
989{ 989{
990 int err; 990 int err;
991 struct dentry *index = NULL;
991 struct inode *dir = dentry->d_inode; 992 struct inode *dir = dentry->d_inode;
992 struct path path = { .mnt = mnt, .dentry = dentry }; 993 struct path path = { .mnt = mnt, .dentry = dentry };
993 LIST_HEAD(list); 994 LIST_HEAD(list);
@@ -1007,8 +1008,6 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt,
1007 1008
1008 inode_lock_nested(dir, I_MUTEX_PARENT); 1009 inode_lock_nested(dir, I_MUTEX_PARENT);
1009 list_for_each_entry(p, &list, l_node) { 1010 list_for_each_entry(p, &list, l_node) {
1010 struct dentry *index;
1011
1012 if (p->name[0] == '.') { 1011 if (p->name[0] == '.') {
1013 if (p->len == 1) 1012 if (p->len == 1)
1014 continue; 1013 continue;
@@ -1018,6 +1017,7 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt,
1018 index = lookup_one_len(p->name, dentry, p->len); 1017 index = lookup_one_len(p->name, dentry, p->len);
1019 if (IS_ERR(index)) { 1018 if (IS_ERR(index)) {
1020 err = PTR_ERR(index); 1019 err = PTR_ERR(index);
1020 index = NULL;
1021 break; 1021 break;
1022 } 1022 }
1023 err = ovl_verify_index(index, lowerstack, numlower); 1023 err = ovl_verify_index(index, lowerstack, numlower);
@@ -1029,7 +1029,9 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt,
1029 break; 1029 break;
1030 } 1030 }
1031 dput(index); 1031 dput(index);
1032 index = NULL;
1032 } 1033 }
1034 dput(index);
1033 inode_unlock(dir); 1035 inode_unlock(dir);
1034out: 1036out:
1035 ovl_cache_free(&list); 1037 ovl_cache_free(&list);
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index fd5ea4facc62..092d150643c1 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -211,9 +211,10 @@ static void ovl_put_super(struct super_block *sb)
211 211
212 dput(ufs->indexdir); 212 dput(ufs->indexdir);
213 dput(ufs->workdir); 213 dput(ufs->workdir);
214 ovl_inuse_unlock(ufs->workbasedir); 214 if (ufs->workdir_locked)
215 ovl_inuse_unlock(ufs->workbasedir);
215 dput(ufs->workbasedir); 216 dput(ufs->workbasedir);
216 if (ufs->upper_mnt) 217 if (ufs->upper_mnt && ufs->upperdir_locked)
217 ovl_inuse_unlock(ufs->upper_mnt->mnt_root); 218 ovl_inuse_unlock(ufs->upper_mnt->mnt_root);
218 mntput(ufs->upper_mnt); 219 mntput(ufs->upper_mnt);
219 for (i = 0; i < ufs->numlower; i++) 220 for (i = 0; i < ufs->numlower; i++)
@@ -881,9 +882,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
881 goto out_put_upperpath; 882 goto out_put_upperpath;
882 883
883 err = -EBUSY; 884 err = -EBUSY;
884 if (!ovl_inuse_trylock(upperpath.dentry)) { 885 if (ovl_inuse_trylock(upperpath.dentry)) {
885 pr_err("overlayfs: upperdir is in-use by another mount\n"); 886 ufs->upperdir_locked = true;
887 } else if (ufs->config.index) {
888 pr_err("overlayfs: upperdir is in-use by another mount, mount with '-o index=off' to override exclusive upperdir protection.\n");
886 goto out_put_upperpath; 889 goto out_put_upperpath;
890 } else {
891 pr_warn("overlayfs: upperdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n");
887 } 892 }
888 893
889 err = ovl_mount_dir(ufs->config.workdir, &workpath); 894 err = ovl_mount_dir(ufs->config.workdir, &workpath);
@@ -901,9 +906,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
901 } 906 }
902 907
903 err = -EBUSY; 908 err = -EBUSY;
904 if (!ovl_inuse_trylock(workpath.dentry)) { 909 if (ovl_inuse_trylock(workpath.dentry)) {
905 pr_err("overlayfs: workdir is in-use by another mount\n"); 910 ufs->workdir_locked = true;
911 } else if (ufs->config.index) {
912 pr_err("overlayfs: workdir is in-use by another mount, mount with '-o index=off' to override exclusive workdir protection.\n");
906 goto out_put_workpath; 913 goto out_put_workpath;
914 } else {
915 pr_warn("overlayfs: workdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n");
907 } 916 }
908 917
909 ufs->workbasedir = workpath.dentry; 918 ufs->workbasedir = workpath.dentry;
@@ -1156,11 +1165,13 @@ out_put_lowerpath:
1156out_free_lowertmp: 1165out_free_lowertmp:
1157 kfree(lowertmp); 1166 kfree(lowertmp);
1158out_unlock_workdentry: 1167out_unlock_workdentry:
1159 ovl_inuse_unlock(workpath.dentry); 1168 if (ufs->workdir_locked)
1169 ovl_inuse_unlock(workpath.dentry);
1160out_put_workpath: 1170out_put_workpath:
1161 path_put(&workpath); 1171 path_put(&workpath);
1162out_unlock_upperdentry: 1172out_unlock_upperdentry:
1163 ovl_inuse_unlock(upperpath.dentry); 1173 if (ufs->upperdir_locked)
1174 ovl_inuse_unlock(upperpath.dentry);
1164out_put_upperpath: 1175out_put_upperpath:
1165 path_put(&upperpath); 1176 path_put(&upperpath);
1166out_free_config: 1177out_free_config:
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 117794582f9f..b9b239fa5cfd 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -430,7 +430,7 @@ void ovl_inuse_unlock(struct dentry *dentry)
430 } 430 }
431} 431}
432 432
433/* Called must hold OVL_I(inode)->oi_lock */ 433/* Caller must hold OVL_I(inode)->lock */
434static void ovl_cleanup_index(struct dentry *dentry) 434static void ovl_cleanup_index(struct dentry *dentry)
435{ 435{
436 struct inode *dir = ovl_indexdir(dentry->d_sb)->d_inode; 436 struct inode *dir = ovl_indexdir(dentry->d_sb)->d_inode;
@@ -469,6 +469,9 @@ static void ovl_cleanup_index(struct dentry *dentry)
469 err = PTR_ERR(index); 469 err = PTR_ERR(index);
470 if (!IS_ERR(index)) 470 if (!IS_ERR(index))
471 err = ovl_cleanup(dir, index); 471 err = ovl_cleanup(dir, index);
472 else
473 index = NULL;
474
472 inode_unlock(dir); 475 inode_unlock(dir);
473 if (err) 476 if (err)
474 goto fail; 477 goto fail;
@@ -557,3 +560,22 @@ void ovl_nlink_end(struct dentry *dentry, bool locked)
557 mutex_unlock(&OVL_I(d_inode(dentry))->lock); 560 mutex_unlock(&OVL_I(d_inode(dentry))->lock);
558 } 561 }
559} 562}
563
564int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *upperdir)
565{
566 /* Workdir should not be the same as upperdir */
567 if (workdir == upperdir)
568 goto err;
569
570 /* Workdir should not be subdir of upperdir and vice versa */
571 if (lock_rename(workdir, upperdir) != NULL)
572 goto err_unlock;
573
574 return 0;
575
576err_unlock:
577 unlock_rename(workdir, upperdir);
578err:
579 pr_err("overlayfs: failed to lock workdir+upperdir\n");
580 return -EIO;
581}
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index bc6c6e10a969..e9db7fc95b70 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -2122,11 +2122,31 @@ xfs_swap_extents(
2122 ip->i_d.di_flags2 |= tip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK; 2122 ip->i_d.di_flags2 |= tip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK;
2123 tip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK; 2123 tip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK;
2124 tip->i_d.di_flags2 |= f & XFS_DIFLAG2_REFLINK; 2124 tip->i_d.di_flags2 |= f & XFS_DIFLAG2_REFLINK;
2125 }
2126
2127 /* Swap the cow forks. */
2128 if (xfs_sb_version_hasreflink(&mp->m_sb)) {
2129 xfs_extnum_t extnum;
2130
2131 ASSERT(ip->i_cformat == XFS_DINODE_FMT_EXTENTS);
2132 ASSERT(tip->i_cformat == XFS_DINODE_FMT_EXTENTS);
2133
2134 extnum = ip->i_cnextents;
2135 ip->i_cnextents = tip->i_cnextents;
2136 tip->i_cnextents = extnum;
2137
2125 cowfp = ip->i_cowfp; 2138 cowfp = ip->i_cowfp;
2126 ip->i_cowfp = tip->i_cowfp; 2139 ip->i_cowfp = tip->i_cowfp;
2127 tip->i_cowfp = cowfp; 2140 tip->i_cowfp = cowfp;
2128 xfs_inode_set_cowblocks_tag(ip); 2141
2129 xfs_inode_set_cowblocks_tag(tip); 2142 if (ip->i_cowfp && ip->i_cnextents)
2143 xfs_inode_set_cowblocks_tag(ip);
2144 else
2145 xfs_inode_clear_cowblocks_tag(ip);
2146 if (tip->i_cowfp && tip->i_cnextents)
2147 xfs_inode_set_cowblocks_tag(tip);
2148 else
2149 xfs_inode_clear_cowblocks_tag(tip);
2130 } 2150 }
2131 2151
2132 xfs_trans_log_inode(tp, ip, src_log_flags); 2152 xfs_trans_log_inode(tp, ip, src_log_flags);
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 3246815c24d6..37e603bf1591 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -736,7 +736,13 @@ xfs_reflink_end_cow(
736 /* If there is a hole at end_fsb - 1 go to the previous extent */ 736 /* If there is a hole at end_fsb - 1 go to the previous extent */
737 if (!xfs_iext_lookup_extent(ip, ifp, end_fsb - 1, &idx, &got) || 737 if (!xfs_iext_lookup_extent(ip, ifp, end_fsb - 1, &idx, &got) ||
738 got.br_startoff > end_fsb) { 738 got.br_startoff > end_fsb) {
739 ASSERT(idx > 0); 739 /*
740 * In case of racing, overlapping AIO writes no COW extents
741 * might be left by the time I/O completes for the loser of
742 * the race. In that case we are done.
743 */
744 if (idx <= 0)
745 goto out_cancel;
740 xfs_iext_get_extent(ifp, --idx, &got); 746 xfs_iext_get_extent(ifp, --idx, &got);
741 } 747 }
742 748
@@ -809,6 +815,7 @@ next_extent:
809 815
810out_defer: 816out_defer:
811 xfs_defer_cancel(&dfops); 817 xfs_defer_cancel(&dfops);
818out_cancel:
812 xfs_trans_cancel(tp); 819 xfs_trans_cancel(tp);
813 xfs_iunlock(ip, XFS_ILOCK_EXCL); 820 xfs_iunlock(ip, XFS_ILOCK_EXCL);
814out: 821out:
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index f3f2d07feb2a..9a43763a68ad 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -316,7 +316,7 @@ struct mmc_host {
316#define MMC_CAP_UHS_SDR50 (1 << 18) /* Host supports UHS SDR50 mode */ 316#define MMC_CAP_UHS_SDR50 (1 << 18) /* Host supports UHS SDR50 mode */
317#define MMC_CAP_UHS_SDR104 (1 << 19) /* Host supports UHS SDR104 mode */ 317#define MMC_CAP_UHS_SDR104 (1 << 19) /* Host supports UHS SDR104 mode */
318#define MMC_CAP_UHS_DDR50 (1 << 20) /* Host supports UHS DDR50 mode */ 318#define MMC_CAP_UHS_DDR50 (1 << 20) /* Host supports UHS DDR50 mode */
319#define MMC_CAP_NO_BOUNCE_BUFF (1 << 21) /* Disable bounce buffers on host */ 319/* (1 << 21) is free for reuse */
320#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ 320#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
321#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ 321#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
322#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ 322#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index a36abe2da13e..27e249ed7c5c 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -12,11 +12,31 @@
12 12
13#ifdef CONFIG_LOCKUP_DETECTOR 13#ifdef CONFIG_LOCKUP_DETECTOR
14void lockup_detector_init(void); 14void lockup_detector_init(void);
15void lockup_detector_soft_poweroff(void);
16void lockup_detector_cleanup(void);
17bool is_hardlockup(void);
18
19extern int watchdog_user_enabled;
20extern int nmi_watchdog_user_enabled;
21extern int soft_watchdog_user_enabled;
22extern int watchdog_thresh;
23extern unsigned long watchdog_enabled;
24
25extern struct cpumask watchdog_cpumask;
26extern unsigned long *watchdog_cpumask_bits;
27#ifdef CONFIG_SMP
28extern int sysctl_softlockup_all_cpu_backtrace;
29extern int sysctl_hardlockup_all_cpu_backtrace;
15#else 30#else
16static inline void lockup_detector_init(void) 31#define sysctl_softlockup_all_cpu_backtrace 0
17{ 32#define sysctl_hardlockup_all_cpu_backtrace 0
18} 33#endif /* !CONFIG_SMP */
19#endif 34
35#else /* CONFIG_LOCKUP_DETECTOR */
36static inline void lockup_detector_init(void) { }
37static inline void lockup_detector_soft_poweroff(void) { }
38static inline void lockup_detector_cleanup(void) { }
39#endif /* !CONFIG_LOCKUP_DETECTOR */
20 40
21#ifdef CONFIG_SOFTLOCKUP_DETECTOR 41#ifdef CONFIG_SOFTLOCKUP_DETECTOR
22extern void touch_softlockup_watchdog_sched(void); 42extern void touch_softlockup_watchdog_sched(void);
@@ -24,29 +44,17 @@ extern void touch_softlockup_watchdog(void);
24extern void touch_softlockup_watchdog_sync(void); 44extern void touch_softlockup_watchdog_sync(void);
25extern void touch_all_softlockup_watchdogs(void); 45extern void touch_all_softlockup_watchdogs(void);
26extern unsigned int softlockup_panic; 46extern unsigned int softlockup_panic;
27extern int soft_watchdog_enabled;
28extern atomic_t watchdog_park_in_progress;
29#else 47#else
30static inline void touch_softlockup_watchdog_sched(void) 48static inline void touch_softlockup_watchdog_sched(void) { }
31{ 49static inline void touch_softlockup_watchdog(void) { }
32} 50static inline void touch_softlockup_watchdog_sync(void) { }
33static inline void touch_softlockup_watchdog(void) 51static inline void touch_all_softlockup_watchdogs(void) { }
34{
35}
36static inline void touch_softlockup_watchdog_sync(void)
37{
38}
39static inline void touch_all_softlockup_watchdogs(void)
40{
41}
42#endif 52#endif
43 53
44#ifdef CONFIG_DETECT_HUNG_TASK 54#ifdef CONFIG_DETECT_HUNG_TASK
45void reset_hung_task_detector(void); 55void reset_hung_task_detector(void);
46#else 56#else
47static inline void reset_hung_task_detector(void) 57static inline void reset_hung_task_detector(void) { }
48{
49}
50#endif 58#endif
51 59
52/* 60/*
@@ -54,12 +62,12 @@ static inline void reset_hung_task_detector(void)
54 * 'watchdog_enabled' variable. Each lockup detector has its dedicated bit - 62 * 'watchdog_enabled' variable. Each lockup detector has its dedicated bit -
55 * bit 0 for the hard lockup detector and bit 1 for the soft lockup detector. 63 * bit 0 for the hard lockup detector and bit 1 for the soft lockup detector.
56 * 64 *
57 * 'watchdog_user_enabled', 'nmi_watchdog_enabled' and 'soft_watchdog_enabled' 65 * 'watchdog_user_enabled', 'nmi_watchdog_user_enabled' and
58 * are variables that are only used as an 'interface' between the parameters 66 * 'soft_watchdog_user_enabled' are variables that are only used as an
59 * in /proc/sys/kernel and the internal state bits in 'watchdog_enabled'. The 67 * 'interface' between the parameters in /proc/sys/kernel and the internal
60 * 'watchdog_thresh' variable is handled differently because its value is not 68 * state bits in 'watchdog_enabled'. The 'watchdog_thresh' variable is
61 * boolean, and the lockup detectors are 'suspended' while 'watchdog_thresh' 69 * handled differently because its value is not boolean, and the lockup
62 * is equal zero. 70 * detectors are 'suspended' while 'watchdog_thresh' is equal zero.
63 */ 71 */
64#define NMI_WATCHDOG_ENABLED_BIT 0 72#define NMI_WATCHDOG_ENABLED_BIT 0
65#define SOFT_WATCHDOG_ENABLED_BIT 1 73#define SOFT_WATCHDOG_ENABLED_BIT 1
@@ -73,17 +81,41 @@ extern unsigned int hardlockup_panic;
73static inline void hardlockup_detector_disable(void) {} 81static inline void hardlockup_detector_disable(void) {}
74#endif 82#endif
75 83
84#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
85# define NMI_WATCHDOG_SYSCTL_PERM 0644
86#else
87# define NMI_WATCHDOG_SYSCTL_PERM 0444
88#endif
89
76#if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF) 90#if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF)
77extern void arch_touch_nmi_watchdog(void); 91extern void arch_touch_nmi_watchdog(void);
92extern void hardlockup_detector_perf_stop(void);
93extern void hardlockup_detector_perf_restart(void);
94extern void hardlockup_detector_perf_disable(void);
95extern void hardlockup_detector_perf_enable(void);
96extern void hardlockup_detector_perf_cleanup(void);
97extern int hardlockup_detector_perf_init(void);
78#else 98#else
79#if !defined(CONFIG_HAVE_NMI_WATCHDOG) 99static inline void hardlockup_detector_perf_stop(void) { }
100static inline void hardlockup_detector_perf_restart(void) { }
101static inline void hardlockup_detector_perf_disable(void) { }
102static inline void hardlockup_detector_perf_enable(void) { }
103static inline void hardlockup_detector_perf_cleanup(void) { }
104# if !defined(CONFIG_HAVE_NMI_WATCHDOG)
105static inline int hardlockup_detector_perf_init(void) { return -ENODEV; }
80static inline void arch_touch_nmi_watchdog(void) {} 106static inline void arch_touch_nmi_watchdog(void) {}
107# else
108static inline int hardlockup_detector_perf_init(void) { return 0; }
109# endif
81#endif 110#endif
82#endif 111
112void watchdog_nmi_stop(void);
113void watchdog_nmi_start(void);
114int watchdog_nmi_probe(void);
83 115
84/** 116/**
85 * touch_nmi_watchdog - restart NMI watchdog timeout. 117 * touch_nmi_watchdog - restart NMI watchdog timeout.
86 * 118 *
87 * If the architecture supports the NMI watchdog, touch_nmi_watchdog() 119 * If the architecture supports the NMI watchdog, touch_nmi_watchdog()
88 * may be used to reset the timeout - for code which intentionally 120 * may be used to reset the timeout - for code which intentionally
89 * disables interrupts for a long time. This call is stateless. 121 * disables interrupts for a long time. This call is stateless.
@@ -153,22 +185,6 @@ static inline bool trigger_single_cpu_backtrace(int cpu)
153u64 hw_nmi_get_sample_period(int watchdog_thresh); 185u64 hw_nmi_get_sample_period(int watchdog_thresh);
154#endif 186#endif
155 187
156#ifdef CONFIG_LOCKUP_DETECTOR
157extern int nmi_watchdog_enabled;
158extern int watchdog_user_enabled;
159extern int watchdog_thresh;
160extern unsigned long watchdog_enabled;
161extern struct cpumask watchdog_cpumask;
162extern unsigned long *watchdog_cpumask_bits;
163extern int __read_mostly watchdog_suspended;
164#ifdef CONFIG_SMP
165extern int sysctl_softlockup_all_cpu_backtrace;
166extern int sysctl_hardlockup_all_cpu_backtrace;
167#else
168#define sysctl_softlockup_all_cpu_backtrace 0
169#define sysctl_hardlockup_all_cpu_backtrace 0
170#endif
171
172#if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \ 188#if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \
173 defined(CONFIG_HARDLOCKUP_DETECTOR) 189 defined(CONFIG_HARDLOCKUP_DETECTOR)
174void watchdog_update_hrtimer_threshold(u64 period); 190void watchdog_update_hrtimer_threshold(u64 period);
@@ -176,7 +192,6 @@ void watchdog_update_hrtimer_threshold(u64 period);
176static inline void watchdog_update_hrtimer_threshold(u64 period) { } 192static inline void watchdog_update_hrtimer_threshold(u64 period) { }
177#endif 193#endif
178 194
179extern bool is_hardlockup(void);
180struct ctl_table; 195struct ctl_table;
181extern int proc_watchdog(struct ctl_table *, int , 196extern int proc_watchdog(struct ctl_table *, int ,
182 void __user *, size_t *, loff_t *); 197 void __user *, size_t *, loff_t *);
@@ -188,18 +203,6 @@ extern int proc_watchdog_thresh(struct ctl_table *, int ,
188 void __user *, size_t *, loff_t *); 203 void __user *, size_t *, loff_t *);
189extern int proc_watchdog_cpumask(struct ctl_table *, int, 204extern int proc_watchdog_cpumask(struct ctl_table *, int,
190 void __user *, size_t *, loff_t *); 205 void __user *, size_t *, loff_t *);
191extern int lockup_detector_suspend(void);
192extern void lockup_detector_resume(void);
193#else
194static inline int lockup_detector_suspend(void)
195{
196 return 0;
197}
198
199static inline void lockup_detector_resume(void)
200{
201}
202#endif
203 206
204#ifdef CONFIG_HAVE_ACPI_APEI_NMI 207#ifdef CONFIG_HAVE_ACPI_APEI_NMI
205#include <asm/nmi.h> 208#include <asm/nmi.h>
diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index 12910cf19869..c149aa7bedf3 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -55,7 +55,7 @@ smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
55} 55}
56 56
57void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread); 57void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
58int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread, 58void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread,
59 const struct cpumask *); 59 const struct cpumask *);
60 60
61#endif 61#endif
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 82e93ee94708..67c5a9f223f7 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -192,6 +192,7 @@ struct scsi_device {
192 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ 192 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */
193 unsigned broken_fua:1; /* Don't set FUA bit */ 193 unsigned broken_fua:1; /* Don't set FUA bit */
194 unsigned lun_in_cdb:1; /* Store LUN bits in CDB[1] */ 194 unsigned lun_in_cdb:1; /* Store LUN bits in CDB[1] */
195 unsigned unmap_limit_for_ws:1; /* Use the UNMAP limit for WRITE SAME */
195 196
196 atomic_t disk_events_disable_depth; /* disable depth for disk events */ 197 atomic_t disk_events_disable_depth; /* disable depth for disk events */
197 198
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index 9592570e092a..36b03013d629 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -29,5 +29,6 @@
29#define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */ 29#define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */
30#define BLIST_NO_RSOC 0x20000000 /* don't try to issue RSOC */ 30#define BLIST_NO_RSOC 0x20000000 /* don't try to issue RSOC */
31#define BLIST_MAX_1024 0x40000000 /* maximum 1024 sector cdb length */ 31#define BLIST_MAX_1024 0x40000000 /* maximum 1024 sector cdb length */
32#define BLIST_UNMAP_LIMIT_WS 0x80000000 /* Use UNMAP limit for WRITE SAME */
32 33
33#endif 34#endif
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 6183d20a01fb..b266d2a3bcb1 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -434,7 +434,6 @@ extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost,
434 unsigned int target_id); 434 unsigned int target_id);
435extern void iscsi_remove_session(struct iscsi_cls_session *session); 435extern void iscsi_remove_session(struct iscsi_cls_session *session);
436extern void iscsi_free_session(struct iscsi_cls_session *session); 436extern void iscsi_free_session(struct iscsi_cls_session *session);
437extern int iscsi_destroy_session(struct iscsi_cls_session *session);
438extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess, 437extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
439 int dd_size, uint32_t cid); 438 int dd_size, uint32_t cid);
440extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn); 439extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn);
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 8de11a29e495..d851df22f5c5 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -24,6 +24,7 @@
24#include <linux/lockdep.h> 24#include <linux/lockdep.h>
25#include <linux/tick.h> 25#include <linux/tick.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/nmi.h>
27#include <linux/smpboot.h> 28#include <linux/smpboot.h>
28#include <linux/relay.h> 29#include <linux/relay.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
@@ -897,6 +898,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
897 898
898out: 899out:
899 cpus_write_unlock(); 900 cpus_write_unlock();
901 /*
902 * Do post unplug cleanup. This is still protected against
903 * concurrent CPU hotplug via cpu_add_remove_lock.
904 */
905 lockup_detector_cleanup();
900 return ret; 906 return ret;
901} 907}
902 908
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 1d71c051a951..5043e7433f4b 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -344,39 +344,30 @@ EXPORT_SYMBOL_GPL(smpboot_unregister_percpu_thread);
344 * by the client, but only by calling this function. 344 * by the client, but only by calling this function.
345 * This function can only be called on a registered smp_hotplug_thread. 345 * This function can only be called on a registered smp_hotplug_thread.
346 */ 346 */
347int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread, 347void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread,
348 const struct cpumask *new) 348 const struct cpumask *new)
349{ 349{
350 struct cpumask *old = plug_thread->cpumask; 350 struct cpumask *old = plug_thread->cpumask;
351 cpumask_var_t tmp; 351 static struct cpumask tmp;
352 unsigned int cpu; 352 unsigned int cpu;
353 353
354 if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) 354 lockdep_assert_cpus_held();
355 return -ENOMEM;
356
357 get_online_cpus();
358 mutex_lock(&smpboot_threads_lock); 355 mutex_lock(&smpboot_threads_lock);
359 356
360 /* Park threads that were exclusively enabled on the old mask. */ 357 /* Park threads that were exclusively enabled on the old mask. */
361 cpumask_andnot(tmp, old, new); 358 cpumask_andnot(&tmp, old, new);
362 for_each_cpu_and(cpu, tmp, cpu_online_mask) 359 for_each_cpu_and(cpu, &tmp, cpu_online_mask)
363 smpboot_park_thread(plug_thread, cpu); 360 smpboot_park_thread(plug_thread, cpu);
364 361
365 /* Unpark threads that are exclusively enabled on the new mask. */ 362 /* Unpark threads that are exclusively enabled on the new mask. */
366 cpumask_andnot(tmp, new, old); 363 cpumask_andnot(&tmp, new, old);
367 for_each_cpu_and(cpu, tmp, cpu_online_mask) 364 for_each_cpu_and(cpu, &tmp, cpu_online_mask)
368 smpboot_unpark_thread(plug_thread, cpu); 365 smpboot_unpark_thread(plug_thread, cpu);
369 366
370 cpumask_copy(old, new); 367 cpumask_copy(old, new);
371 368
372 mutex_unlock(&smpboot_threads_lock); 369 mutex_unlock(&smpboot_threads_lock);
373 put_online_cpus();
374
375 free_cpumask_var(tmp);
376
377 return 0;
378} 370}
379EXPORT_SYMBOL_GPL(smpboot_update_cpumask_percpu_thread);
380 371
381static DEFINE_PER_CPU(atomic_t, cpu_hotplug_state) = ATOMIC_INIT(CPU_POST_DEAD); 372static DEFINE_PER_CPU(atomic_t, cpu_hotplug_state) = ATOMIC_INIT(CPU_POST_DEAD);
382 373
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 4da9e622471f..d9c31bc2eaea 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -872,9 +872,9 @@ static struct ctl_table kern_table[] = {
872#if defined(CONFIG_LOCKUP_DETECTOR) 872#if defined(CONFIG_LOCKUP_DETECTOR)
873 { 873 {
874 .procname = "watchdog", 874 .procname = "watchdog",
875 .data = &watchdog_user_enabled, 875 .data = &watchdog_user_enabled,
876 .maxlen = sizeof (int), 876 .maxlen = sizeof(int),
877 .mode = 0644, 877 .mode = 0644,
878 .proc_handler = proc_watchdog, 878 .proc_handler = proc_watchdog,
879 .extra1 = &zero, 879 .extra1 = &zero,
880 .extra2 = &one, 880 .extra2 = &one,
@@ -890,16 +890,12 @@ static struct ctl_table kern_table[] = {
890 }, 890 },
891 { 891 {
892 .procname = "nmi_watchdog", 892 .procname = "nmi_watchdog",
893 .data = &nmi_watchdog_enabled, 893 .data = &nmi_watchdog_user_enabled,
894 .maxlen = sizeof (int), 894 .maxlen = sizeof(int),
895 .mode = 0644, 895 .mode = NMI_WATCHDOG_SYSCTL_PERM,
896 .proc_handler = proc_nmi_watchdog, 896 .proc_handler = proc_nmi_watchdog,
897 .extra1 = &zero, 897 .extra1 = &zero,
898#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
899 .extra2 = &one, 898 .extra2 = &one,
900#else
901 .extra2 = &zero,
902#endif
903 }, 899 },
904 { 900 {
905 .procname = "watchdog_cpumask", 901 .procname = "watchdog_cpumask",
@@ -911,9 +907,9 @@ static struct ctl_table kern_table[] = {
911#ifdef CONFIG_SOFTLOCKUP_DETECTOR 907#ifdef CONFIG_SOFTLOCKUP_DETECTOR
912 { 908 {
913 .procname = "soft_watchdog", 909 .procname = "soft_watchdog",
914 .data = &soft_watchdog_enabled, 910 .data = &soft_watchdog_user_enabled,
915 .maxlen = sizeof (int), 911 .maxlen = sizeof(int),
916 .mode = 0644, 912 .mode = 0644,
917 .proc_handler = proc_soft_watchdog, 913 .proc_handler = proc_soft_watchdog,
918 .extra1 = &zero, 914 .extra1 = &zero,
919 .extra2 = &one, 915 .extra2 = &one,
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index f5d52024f6b7..6bcb854909c0 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -29,20 +29,29 @@
29#include <linux/kvm_para.h> 29#include <linux/kvm_para.h>
30#include <linux/kthread.h> 30#include <linux/kthread.h>
31 31
32/* Watchdog configuration */ 32static DEFINE_MUTEX(watchdog_mutex);
33static DEFINE_MUTEX(watchdog_proc_mutex);
34
35int __read_mostly nmi_watchdog_enabled;
36 33
37#if defined(CONFIG_HARDLOCKUP_DETECTOR) || defined(CONFIG_HAVE_NMI_WATCHDOG) 34#if defined(CONFIG_HARDLOCKUP_DETECTOR) || defined(CONFIG_HAVE_NMI_WATCHDOG)
38unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED | 35# define WATCHDOG_DEFAULT (SOFT_WATCHDOG_ENABLED | NMI_WATCHDOG_ENABLED)
39 NMI_WATCHDOG_ENABLED; 36# define NMI_WATCHDOG_DEFAULT 1
40#else 37#else
41unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED; 38# define WATCHDOG_DEFAULT (SOFT_WATCHDOG_ENABLED)
39# define NMI_WATCHDOG_DEFAULT 0
42#endif 40#endif
43 41
42unsigned long __read_mostly watchdog_enabled;
43int __read_mostly watchdog_user_enabled = 1;
44int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT;
45int __read_mostly soft_watchdog_user_enabled = 1;
46int __read_mostly watchdog_thresh = 10;
47int __read_mostly nmi_watchdog_available;
48
49struct cpumask watchdog_allowed_mask __read_mostly;
50
51struct cpumask watchdog_cpumask __read_mostly;
52unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask);
53
44#ifdef CONFIG_HARDLOCKUP_DETECTOR 54#ifdef CONFIG_HARDLOCKUP_DETECTOR
45/* boot commands */
46/* 55/*
47 * Should we panic when a soft-lockup or hard-lockup occurs: 56 * Should we panic when a soft-lockup or hard-lockup occurs:
48 */ 57 */
@@ -56,9 +65,9 @@ unsigned int __read_mostly hardlockup_panic =
56 * kernel command line parameters are parsed, because otherwise it is not 65 * kernel command line parameters are parsed, because otherwise it is not
57 * possible to override this in hardlockup_panic_setup(). 66 * possible to override this in hardlockup_panic_setup().
58 */ 67 */
59void hardlockup_detector_disable(void) 68void __init hardlockup_detector_disable(void)
60{ 69{
61 watchdog_enabled &= ~NMI_WATCHDOG_ENABLED; 70 nmi_watchdog_user_enabled = 0;
62} 71}
63 72
64static int __init hardlockup_panic_setup(char *str) 73static int __init hardlockup_panic_setup(char *str)
@@ -68,48 +77,24 @@ static int __init hardlockup_panic_setup(char *str)
68 else if (!strncmp(str, "nopanic", 7)) 77 else if (!strncmp(str, "nopanic", 7))
69 hardlockup_panic = 0; 78 hardlockup_panic = 0;
70 else if (!strncmp(str, "0", 1)) 79 else if (!strncmp(str, "0", 1))
71 watchdog_enabled &= ~NMI_WATCHDOG_ENABLED; 80 nmi_watchdog_user_enabled = 0;
72 else if (!strncmp(str, "1", 1)) 81 else if (!strncmp(str, "1", 1))
73 watchdog_enabled |= NMI_WATCHDOG_ENABLED; 82 nmi_watchdog_user_enabled = 1;
74 return 1; 83 return 1;
75} 84}
76__setup("nmi_watchdog=", hardlockup_panic_setup); 85__setup("nmi_watchdog=", hardlockup_panic_setup);
77 86
78#endif 87# ifdef CONFIG_SMP
79
80#ifdef CONFIG_SOFTLOCKUP_DETECTOR
81int __read_mostly soft_watchdog_enabled;
82#endif
83
84int __read_mostly watchdog_user_enabled;
85int __read_mostly watchdog_thresh = 10;
86
87#ifdef CONFIG_SMP
88int __read_mostly sysctl_softlockup_all_cpu_backtrace;
89int __read_mostly sysctl_hardlockup_all_cpu_backtrace; 88int __read_mostly sysctl_hardlockup_all_cpu_backtrace;
90#endif
91struct cpumask watchdog_cpumask __read_mostly;
92unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask);
93 89
94/* 90static int __init hardlockup_all_cpu_backtrace_setup(char *str)
95 * The 'watchdog_running' variable is set to 1 when the watchdog threads 91{
96 * are registered/started and is set to 0 when the watchdog threads are 92 sysctl_hardlockup_all_cpu_backtrace = !!simple_strtol(str, NULL, 0);
97 * unregistered/stopped, so it is an indicator whether the threads exist. 93 return 1;
98 */ 94}
99static int __read_mostly watchdog_running; 95__setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup);
100/* 96# endif /* CONFIG_SMP */
101 * If a subsystem has a need to deactivate the watchdog temporarily, it 97#endif /* CONFIG_HARDLOCKUP_DETECTOR */
102 * can use the suspend/resume interface to achieve this. The content of
103 * the 'watchdog_suspended' variable reflects this state. Existing threads
104 * are parked/unparked by the lockup_detector_{suspend|resume} functions
105 * (see comment blocks pertaining to those functions for further details).
106 *
107 * 'watchdog_suspended' also prevents threads from being registered/started
108 * or unregistered/stopped via parameters in /proc/sys/kernel, so the state
109 * of 'watchdog_running' cannot change while the watchdog is deactivated
110 * temporarily (see related code in 'proc' handlers).
111 */
112int __read_mostly watchdog_suspended;
113 98
114/* 99/*
115 * These functions can be overridden if an architecture implements its 100 * These functions can be overridden if an architecture implements its
@@ -121,36 +106,68 @@ int __read_mostly watchdog_suspended;
121 */ 106 */
122int __weak watchdog_nmi_enable(unsigned int cpu) 107int __weak watchdog_nmi_enable(unsigned int cpu)
123{ 108{
109 hardlockup_detector_perf_enable();
124 return 0; 110 return 0;
125} 111}
112
126void __weak watchdog_nmi_disable(unsigned int cpu) 113void __weak watchdog_nmi_disable(unsigned int cpu)
127{ 114{
115 hardlockup_detector_perf_disable();
128} 116}
129 117
130/* 118/* Return 0, if a NMI watchdog is available. Error code otherwise */
131 * watchdog_nmi_reconfigure can be implemented to be notified after any 119int __weak __init watchdog_nmi_probe(void)
132 * watchdog configuration change. The arch hardlockup watchdog should 120{
133 * respond to the following variables: 121 return hardlockup_detector_perf_init();
134 * - nmi_watchdog_enabled 122}
123
124/**
125 * watchdog_nmi_stop - Stop the watchdog for reconfiguration
126 *
127 * The reconfiguration steps are:
128 * watchdog_nmi_stop();
129 * update_variables();
130 * watchdog_nmi_start();
131 */
132void __weak watchdog_nmi_stop(void) { }
133
134/**
135 * watchdog_nmi_start - Start the watchdog after reconfiguration
136 *
137 * Counterpart to watchdog_nmi_stop().
138 *
139 * The following variables have been updated in update_variables() and
140 * contain the currently valid configuration:
141 * - watchdog_enabled
135 * - watchdog_thresh 142 * - watchdog_thresh
136 * - watchdog_cpumask 143 * - watchdog_cpumask
137 * - sysctl_hardlockup_all_cpu_backtrace
138 * - hardlockup_panic
139 * - watchdog_suspended
140 */ 144 */
141void __weak watchdog_nmi_reconfigure(void) 145void __weak watchdog_nmi_start(void) { }
146
147/**
148 * lockup_detector_update_enable - Update the sysctl enable bit
149 *
150 * Caller needs to make sure that the NMI/perf watchdogs are off, so this
151 * can't race with watchdog_nmi_disable().
152 */
153static void lockup_detector_update_enable(void)
142{ 154{
155 watchdog_enabled = 0;
156 if (!watchdog_user_enabled)
157 return;
158 if (nmi_watchdog_available && nmi_watchdog_user_enabled)
159 watchdog_enabled |= NMI_WATCHDOG_ENABLED;
160 if (soft_watchdog_user_enabled)
161 watchdog_enabled |= SOFT_WATCHDOG_ENABLED;
143} 162}
144 163
145
146#ifdef CONFIG_SOFTLOCKUP_DETECTOR 164#ifdef CONFIG_SOFTLOCKUP_DETECTOR
147 165
148/* Helper for online, unparked cpus. */ 166/* Global variables, exported for sysctl */
149#define for_each_watchdog_cpu(cpu) \ 167unsigned int __read_mostly softlockup_panic =
150 for_each_cpu_and((cpu), cpu_online_mask, &watchdog_cpumask) 168 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
151
152atomic_t watchdog_park_in_progress = ATOMIC_INIT(0);
153 169
170static bool softlockup_threads_initialized __read_mostly;
154static u64 __read_mostly sample_period; 171static u64 __read_mostly sample_period;
155 172
156static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); 173static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts);
@@ -164,50 +181,40 @@ static DEFINE_PER_CPU(struct task_struct *, softlockup_task_ptr_saved);
164static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); 181static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved);
165static unsigned long soft_lockup_nmi_warn; 182static unsigned long soft_lockup_nmi_warn;
166 183
167unsigned int __read_mostly softlockup_panic =
168 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
169
170static int __init softlockup_panic_setup(char *str) 184static int __init softlockup_panic_setup(char *str)
171{ 185{
172 softlockup_panic = simple_strtoul(str, NULL, 0); 186 softlockup_panic = simple_strtoul(str, NULL, 0);
173
174 return 1; 187 return 1;
175} 188}
176__setup("softlockup_panic=", softlockup_panic_setup); 189__setup("softlockup_panic=", softlockup_panic_setup);
177 190
178static int __init nowatchdog_setup(char *str) 191static int __init nowatchdog_setup(char *str)
179{ 192{
180 watchdog_enabled = 0; 193 watchdog_user_enabled = 0;
181 return 1; 194 return 1;
182} 195}
183__setup("nowatchdog", nowatchdog_setup); 196__setup("nowatchdog", nowatchdog_setup);
184 197
185static int __init nosoftlockup_setup(char *str) 198static int __init nosoftlockup_setup(char *str)
186{ 199{
187 watchdog_enabled &= ~SOFT_WATCHDOG_ENABLED; 200 soft_watchdog_user_enabled = 0;
188 return 1; 201 return 1;
189} 202}
190__setup("nosoftlockup", nosoftlockup_setup); 203__setup("nosoftlockup", nosoftlockup_setup);
191 204
192#ifdef CONFIG_SMP 205#ifdef CONFIG_SMP
206int __read_mostly sysctl_softlockup_all_cpu_backtrace;
207
193static int __init softlockup_all_cpu_backtrace_setup(char *str) 208static int __init softlockup_all_cpu_backtrace_setup(char *str)
194{ 209{
195 sysctl_softlockup_all_cpu_backtrace = 210 sysctl_softlockup_all_cpu_backtrace = !!simple_strtol(str, NULL, 0);
196 !!simple_strtol(str, NULL, 0);
197 return 1; 211 return 1;
198} 212}
199__setup("softlockup_all_cpu_backtrace=", softlockup_all_cpu_backtrace_setup); 213__setup("softlockup_all_cpu_backtrace=", softlockup_all_cpu_backtrace_setup);
200#ifdef CONFIG_HARDLOCKUP_DETECTOR
201static int __init hardlockup_all_cpu_backtrace_setup(char *str)
202{
203 sysctl_hardlockup_all_cpu_backtrace =
204 !!simple_strtol(str, NULL, 0);
205 return 1;
206}
207__setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup);
208#endif
209#endif 214#endif
210 215
216static void __lockup_detector_cleanup(void);
217
211/* 218/*
212 * Hard-lockup warnings should be triggered after just a few seconds. Soft- 219 * Hard-lockup warnings should be triggered after just a few seconds. Soft-
213 * lockups can have false positives under extreme conditions. So we generally 220 * lockups can have false positives under extreme conditions. So we generally
@@ -278,11 +285,15 @@ void touch_all_softlockup_watchdogs(void)
278 int cpu; 285 int cpu;
279 286
280 /* 287 /*
281 * this is done lockless 288 * watchdog_mutex cannpt be taken here, as this might be called
282 * do we care if a 0 races with a timestamp? 289 * from (soft)interrupt context, so the access to
283 * all it means is the softlock check starts one cycle later 290 * watchdog_allowed_cpumask might race with a concurrent update.
291 *
292 * The watchdog time stamp can race against a concurrent real
293 * update as well, the only side effect might be a cycle delay for
294 * the softlockup check.
284 */ 295 */
285 for_each_watchdog_cpu(cpu) 296 for_each_cpu(cpu, &watchdog_allowed_mask)
286 per_cpu(watchdog_touch_ts, cpu) = 0; 297 per_cpu(watchdog_touch_ts, cpu) = 0;
287 wq_watchdog_touch(-1); 298 wq_watchdog_touch(-1);
288} 299}
@@ -322,9 +333,6 @@ static void watchdog_interrupt_count(void)
322 __this_cpu_inc(hrtimer_interrupts); 333 __this_cpu_inc(hrtimer_interrupts);
323} 334}
324 335
325static int watchdog_enable_all_cpus(void);
326static void watchdog_disable_all_cpus(void);
327
328/* watchdog kicker functions */ 336/* watchdog kicker functions */
329static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) 337static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
330{ 338{
@@ -333,7 +341,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
333 int duration; 341 int duration;
334 int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace; 342 int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace;
335 343
336 if (atomic_read(&watchdog_park_in_progress) != 0) 344 if (!watchdog_enabled)
337 return HRTIMER_NORESTART; 345 return HRTIMER_NORESTART;
338 346
339 /* kick the hardlockup detector */ 347 /* kick the hardlockup detector */
@@ -447,32 +455,38 @@ static void watchdog_set_prio(unsigned int policy, unsigned int prio)
447 455
448static void watchdog_enable(unsigned int cpu) 456static void watchdog_enable(unsigned int cpu)
449{ 457{
450 struct hrtimer *hrtimer = raw_cpu_ptr(&watchdog_hrtimer); 458 struct hrtimer *hrtimer = this_cpu_ptr(&watchdog_hrtimer);
451 459
452 /* kick off the timer for the hardlockup detector */ 460 /*
461 * Start the timer first to prevent the NMI watchdog triggering
462 * before the timer has a chance to fire.
463 */
453 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 464 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
454 hrtimer->function = watchdog_timer_fn; 465 hrtimer->function = watchdog_timer_fn;
455
456 /* Enable the perf event */
457 watchdog_nmi_enable(cpu);
458
459 /* done here because hrtimer_start can only pin to smp_processor_id() */
460 hrtimer_start(hrtimer, ns_to_ktime(sample_period), 466 hrtimer_start(hrtimer, ns_to_ktime(sample_period),
461 HRTIMER_MODE_REL_PINNED); 467 HRTIMER_MODE_REL_PINNED);
462 468
463 /* initialize timestamp */ 469 /* Initialize timestamp */
464 watchdog_set_prio(SCHED_FIFO, MAX_RT_PRIO - 1);
465 __touch_watchdog(); 470 __touch_watchdog();
471 /* Enable the perf event */
472 if (watchdog_enabled & NMI_WATCHDOG_ENABLED)
473 watchdog_nmi_enable(cpu);
474
475 watchdog_set_prio(SCHED_FIFO, MAX_RT_PRIO - 1);
466} 476}
467 477
468static void watchdog_disable(unsigned int cpu) 478static void watchdog_disable(unsigned int cpu)
469{ 479{
470 struct hrtimer *hrtimer = raw_cpu_ptr(&watchdog_hrtimer); 480 struct hrtimer *hrtimer = this_cpu_ptr(&watchdog_hrtimer);
471 481
472 watchdog_set_prio(SCHED_NORMAL, 0); 482 watchdog_set_prio(SCHED_NORMAL, 0);
473 hrtimer_cancel(hrtimer); 483 /*
474 /* disable the perf event */ 484 * Disable the perf event first. That prevents that a large delay
485 * between disabling the timer and disabling the perf event causes
486 * the perf NMI to detect a false positive.
487 */
475 watchdog_nmi_disable(cpu); 488 watchdog_nmi_disable(cpu);
489 hrtimer_cancel(hrtimer);
476} 490}
477 491
478static void watchdog_cleanup(unsigned int cpu, bool online) 492static void watchdog_cleanup(unsigned int cpu, bool online)
@@ -499,21 +513,6 @@ static void watchdog(unsigned int cpu)
499 __this_cpu_write(soft_lockup_hrtimer_cnt, 513 __this_cpu_write(soft_lockup_hrtimer_cnt,
500 __this_cpu_read(hrtimer_interrupts)); 514 __this_cpu_read(hrtimer_interrupts));
501 __touch_watchdog(); 515 __touch_watchdog();
502
503 /*
504 * watchdog_nmi_enable() clears the NMI_WATCHDOG_ENABLED bit in the
505 * failure path. Check for failures that can occur asynchronously -
506 * for example, when CPUs are on-lined - and shut down the hardware
507 * perf event on each CPU accordingly.
508 *
509 * The only non-obvious place this bit can be cleared is through
510 * watchdog_nmi_enable(), so a pr_info() is placed there. Placing a
511 * pr_info here would be too noisy as it would result in a message
512 * every few seconds if the hardlockup was disabled but the softlockup
513 * enabled.
514 */
515 if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED))
516 watchdog_nmi_disable(cpu);
517} 516}
518 517
519static struct smp_hotplug_thread watchdog_threads = { 518static struct smp_hotplug_thread watchdog_threads = {
@@ -527,295 +526,174 @@ static struct smp_hotplug_thread watchdog_threads = {
527 .unpark = watchdog_enable, 526 .unpark = watchdog_enable,
528}; 527};
529 528
530/* 529static void softlockup_update_smpboot_threads(void)
531 * park all watchdog threads that are specified in 'watchdog_cpumask'
532 *
533 * This function returns an error if kthread_park() of a watchdog thread
534 * fails. In this situation, the watchdog threads of some CPUs can already
535 * be parked and the watchdog threads of other CPUs can still be runnable.
536 * Callers are expected to handle this special condition as appropriate in
537 * their context.
538 *
539 * This function may only be called in a context that is protected against
540 * races with CPU hotplug - for example, via get_online_cpus().
541 */
542static int watchdog_park_threads(void)
543{ 530{
544 int cpu, ret = 0; 531 lockdep_assert_held(&watchdog_mutex);
545 532
546 atomic_set(&watchdog_park_in_progress, 1); 533 if (!softlockup_threads_initialized)
534 return;
547 535
548 for_each_watchdog_cpu(cpu) { 536 smpboot_update_cpumask_percpu_thread(&watchdog_threads,
549 ret = kthread_park(per_cpu(softlockup_watchdog, cpu)); 537 &watchdog_allowed_mask);
550 if (ret)
551 break;
552 }
553
554 atomic_set(&watchdog_park_in_progress, 0);
555
556 return ret;
557} 538}
558 539
559/* 540/* Temporarily park all watchdog threads */
560 * unpark all watchdog threads that are specified in 'watchdog_cpumask' 541static void softlockup_park_all_threads(void)
561 *
562 * This function may only be called in a context that is protected against
563 * races with CPU hotplug - for example, via get_online_cpus().
564 */
565static void watchdog_unpark_threads(void)
566{ 542{
567 int cpu; 543 cpumask_clear(&watchdog_allowed_mask);
568 544 softlockup_update_smpboot_threads();
569 for_each_watchdog_cpu(cpu)
570 kthread_unpark(per_cpu(softlockup_watchdog, cpu));
571} 545}
572 546
573static int update_watchdog_all_cpus(void) 547/* Unpark enabled threads */
548static void softlockup_unpark_threads(void)
574{ 549{
575 int ret; 550 cpumask_copy(&watchdog_allowed_mask, &watchdog_cpumask);
576 551 softlockup_update_smpboot_threads();
577 ret = watchdog_park_threads();
578 if (ret)
579 return ret;
580
581 watchdog_unpark_threads();
582
583 return 0;
584} 552}
585 553
586static int watchdog_enable_all_cpus(void) 554static void lockup_detector_reconfigure(void)
587{ 555{
588 int err = 0; 556 cpus_read_lock();
589 557 watchdog_nmi_stop();
590 if (!watchdog_running) { 558 softlockup_park_all_threads();
591 err = smpboot_register_percpu_thread_cpumask(&watchdog_threads, 559 set_sample_period();
592 &watchdog_cpumask); 560 lockup_detector_update_enable();
593 if (err) 561 if (watchdog_enabled && watchdog_thresh)
594 pr_err("Failed to create watchdog threads, disabled\n"); 562 softlockup_unpark_threads();
595 else 563 watchdog_nmi_start();
596 watchdog_running = 1; 564 cpus_read_unlock();
597 } else { 565 /*
598 /* 566 * Must be called outside the cpus locked section to prevent
599 * Enable/disable the lockup detectors or 567 * recursive locking in the perf code.
600 * change the sample period 'on the fly'. 568 */
601 */ 569 __lockup_detector_cleanup();
602 err = update_watchdog_all_cpus();
603
604 if (err) {
605 watchdog_disable_all_cpus();
606 pr_err("Failed to update lockup detectors, disabled\n");
607 }
608 }
609
610 if (err)
611 watchdog_enabled = 0;
612
613 return err;
614} 570}
615 571
616static void watchdog_disable_all_cpus(void) 572/*
573 * Create the watchdog thread infrastructure and configure the detector(s).
574 *
575 * The threads are not unparked as watchdog_allowed_mask is empty. When
576 * the threads are sucessfully initialized, take the proper locks and
577 * unpark the threads in the watchdog_cpumask if the watchdog is enabled.
578 */
579static __init void lockup_detector_setup(void)
617{ 580{
618 if (watchdog_running) { 581 int ret;
619 watchdog_running = 0;
620 smpboot_unregister_percpu_thread(&watchdog_threads);
621 }
622}
623 582
624#ifdef CONFIG_SYSCTL 583 /*
625static int watchdog_update_cpus(void) 584 * If sysctl is off and watchdog got disabled on the command line,
626{ 585 * nothing to do here.
627 return smpboot_update_cpumask_percpu_thread( 586 */
628 &watchdog_threads, &watchdog_cpumask); 587 lockup_detector_update_enable();
629}
630#endif
631 588
632#else /* SOFTLOCKUP */ 589 if (!IS_ENABLED(CONFIG_SYSCTL) &&
633static int watchdog_park_threads(void) 590 !(watchdog_enabled && watchdog_thresh))
634{ 591 return;
635 return 0;
636}
637 592
638static void watchdog_unpark_threads(void) 593 ret = smpboot_register_percpu_thread_cpumask(&watchdog_threads,
639{ 594 &watchdog_allowed_mask);
640} 595 if (ret) {
596 pr_err("Failed to initialize soft lockup detector threads\n");
597 return;
598 }
641 599
642static int watchdog_enable_all_cpus(void) 600 mutex_lock(&watchdog_mutex);
643{ 601 softlockup_threads_initialized = true;
644 return 0; 602 lockup_detector_reconfigure();
603 mutex_unlock(&watchdog_mutex);
645} 604}
646 605
647static void watchdog_disable_all_cpus(void) 606#else /* CONFIG_SOFTLOCKUP_DETECTOR */
607static inline int watchdog_park_threads(void) { return 0; }
608static inline void watchdog_unpark_threads(void) { }
609static inline int watchdog_enable_all_cpus(void) { return 0; }
610static inline void watchdog_disable_all_cpus(void) { }
611static void lockup_detector_reconfigure(void)
648{ 612{
613 cpus_read_lock();
614 watchdog_nmi_stop();
615 lockup_detector_update_enable();
616 watchdog_nmi_start();
617 cpus_read_unlock();
649} 618}
650 619static inline void lockup_detector_setup(void)
651#ifdef CONFIG_SYSCTL
652static int watchdog_update_cpus(void)
653{ 620{
654 return 0; 621 lockup_detector_reconfigure();
655} 622}
656#endif 623#endif /* !CONFIG_SOFTLOCKUP_DETECTOR */
657 624
658static void set_sample_period(void) 625static void __lockup_detector_cleanup(void)
659{ 626{
627 lockdep_assert_held(&watchdog_mutex);
628 hardlockup_detector_perf_cleanup();
660} 629}
661#endif /* SOFTLOCKUP */
662 630
663/* 631/**
664 * Suspend the hard and soft lockup detector by parking the watchdog threads. 632 * lockup_detector_cleanup - Cleanup after cpu hotplug or sysctl changes
633 *
634 * Caller must not hold the cpu hotplug rwsem.
665 */ 635 */
666int lockup_detector_suspend(void) 636void lockup_detector_cleanup(void)
667{ 637{
668 int ret = 0; 638 mutex_lock(&watchdog_mutex);
669 639 __lockup_detector_cleanup();
670 get_online_cpus(); 640 mutex_unlock(&watchdog_mutex);
671 mutex_lock(&watchdog_proc_mutex);
672 /*
673 * Multiple suspend requests can be active in parallel (counted by
674 * the 'watchdog_suspended' variable). If the watchdog threads are
675 * running, the first caller takes care that they will be parked.
676 * The state of 'watchdog_running' cannot change while a suspend
677 * request is active (see related code in 'proc' handlers).
678 */
679 if (watchdog_running && !watchdog_suspended)
680 ret = watchdog_park_threads();
681
682 if (ret == 0)
683 watchdog_suspended++;
684 else {
685 watchdog_disable_all_cpus();
686 pr_err("Failed to suspend lockup detectors, disabled\n");
687 watchdog_enabled = 0;
688 }
689
690 watchdog_nmi_reconfigure();
691
692 mutex_unlock(&watchdog_proc_mutex);
693
694 return ret;
695} 641}
696 642
697/* 643/**
698 * Resume the hard and soft lockup detector by unparking the watchdog threads. 644 * lockup_detector_soft_poweroff - Interface to stop lockup detector(s)
645 *
646 * Special interface for parisc. It prevents lockup detector warnings from
647 * the default pm_poweroff() function which busy loops forever.
699 */ 648 */
700void lockup_detector_resume(void) 649void lockup_detector_soft_poweroff(void)
701{ 650{
702 mutex_lock(&watchdog_proc_mutex); 651 watchdog_enabled = 0;
703
704 watchdog_suspended--;
705 /*
706 * The watchdog threads are unparked if they were previously running
707 * and if there is no more active suspend request.
708 */
709 if (watchdog_running && !watchdog_suspended)
710 watchdog_unpark_threads();
711
712 watchdog_nmi_reconfigure();
713
714 mutex_unlock(&watchdog_proc_mutex);
715 put_online_cpus();
716} 652}
717 653
718#ifdef CONFIG_SYSCTL 654#ifdef CONFIG_SYSCTL
719 655
720/* 656/* Propagate any changes to the watchdog threads */
721 * Update the run state of the lockup detectors. 657static void proc_watchdog_update(void)
722 */
723static int proc_watchdog_update(void)
724{ 658{
725 int err = 0; 659 /* Remove impossible cpus to keep sysctl output clean. */
726 660 cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask);
727 /* 661 lockup_detector_reconfigure();
728 * Watchdog threads won't be started if they are already active.
729 * The 'watchdog_running' variable in watchdog_*_all_cpus() takes
730 * care of this. If those threads are already active, the sample
731 * period will be updated and the lockup detectors will be enabled
732 * or disabled 'on the fly'.
733 */
734 if (watchdog_enabled && watchdog_thresh)
735 err = watchdog_enable_all_cpus();
736 else
737 watchdog_disable_all_cpus();
738
739 watchdog_nmi_reconfigure();
740
741 return err;
742
743} 662}
744 663
745/* 664/*
746 * common function for watchdog, nmi_watchdog and soft_watchdog parameter 665 * common function for watchdog, nmi_watchdog and soft_watchdog parameter
747 * 666 *
748 * caller | table->data points to | 'which' contains the flag(s) 667 * caller | table->data points to | 'which'
749 * -------------------|-----------------------|----------------------------- 668 * -------------------|----------------------------|--------------------------
750 * proc_watchdog | watchdog_user_enabled | NMI_WATCHDOG_ENABLED or'ed 669 * proc_watchdog | watchdog_user_enabled | NMI_WATCHDOG_ENABLED |
751 * | | with SOFT_WATCHDOG_ENABLED 670 * | | SOFT_WATCHDOG_ENABLED
752 * -------------------|-----------------------|----------------------------- 671 * -------------------|----------------------------|--------------------------
753 * proc_nmi_watchdog | nmi_watchdog_enabled | NMI_WATCHDOG_ENABLED 672 * proc_nmi_watchdog | nmi_watchdog_user_enabled | NMI_WATCHDOG_ENABLED
754 * -------------------|-----------------------|----------------------------- 673 * -------------------|----------------------------|--------------------------
755 * proc_soft_watchdog | soft_watchdog_enabled | SOFT_WATCHDOG_ENABLED 674 * proc_soft_watchdog | soft_watchdog_user_enabled | SOFT_WATCHDOG_ENABLED
756 */ 675 */
757static int proc_watchdog_common(int which, struct ctl_table *table, int write, 676static int proc_watchdog_common(int which, struct ctl_table *table, int write,
758 void __user *buffer, size_t *lenp, loff_t *ppos) 677 void __user *buffer, size_t *lenp, loff_t *ppos)
759{ 678{
760 int err, old, new; 679 int err, old, *param = table->data;
761 int *watchdog_param = (int *)table->data;
762 680
763 get_online_cpus(); 681 mutex_lock(&watchdog_mutex);
764 mutex_lock(&watchdog_proc_mutex);
765 682
766 if (watchdog_suspended) {
767 /* no parameter changes allowed while watchdog is suspended */
768 err = -EAGAIN;
769 goto out;
770 }
771
772 /*
773 * If the parameter is being read return the state of the corresponding
774 * bit(s) in 'watchdog_enabled', else update 'watchdog_enabled' and the
775 * run state of the lockup detectors.
776 */
777 if (!write) { 683 if (!write) {
778 *watchdog_param = (watchdog_enabled & which) != 0; 684 /*
685 * On read synchronize the userspace interface. This is a
686 * racy snapshot.
687 */
688 *param = (watchdog_enabled & which) != 0;
779 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos); 689 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
780 } else { 690 } else {
691 old = READ_ONCE(*param);
781 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos); 692 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
782 if (err) 693 if (!err && old != READ_ONCE(*param))
783 goto out; 694 proc_watchdog_update();
784
785 /*
786 * There is a race window between fetching the current value
787 * from 'watchdog_enabled' and storing the new value. During
788 * this race window, watchdog_nmi_enable() can sneak in and
789 * clear the NMI_WATCHDOG_ENABLED bit in 'watchdog_enabled'.
790 * The 'cmpxchg' detects this race and the loop retries.
791 */
792 do {
793 old = watchdog_enabled;
794 /*
795 * If the parameter value is not zero set the
796 * corresponding bit(s), else clear it(them).
797 */
798 if (*watchdog_param)
799 new = old | which;
800 else
801 new = old & ~which;
802 } while (cmpxchg(&watchdog_enabled, old, new) != old);
803
804 /*
805 * Update the run state of the lockup detectors. There is _no_
806 * need to check the value returned by proc_watchdog_update()
807 * and to restore the previous value of 'watchdog_enabled' as
808 * both lockup detectors are disabled if proc_watchdog_update()
809 * returns an error.
810 */
811 if (old == new)
812 goto out;
813
814 err = proc_watchdog_update();
815 } 695 }
816out: 696 mutex_unlock(&watchdog_mutex);
817 mutex_unlock(&watchdog_proc_mutex);
818 put_online_cpus();
819 return err; 697 return err;
820} 698}
821 699
@@ -835,6 +713,8 @@ int proc_watchdog(struct ctl_table *table, int write,
835int proc_nmi_watchdog(struct ctl_table *table, int write, 713int proc_nmi_watchdog(struct ctl_table *table, int write,
836 void __user *buffer, size_t *lenp, loff_t *ppos) 714 void __user *buffer, size_t *lenp, loff_t *ppos)
837{ 715{
716 if (!nmi_watchdog_available && write)
717 return -ENOTSUPP;
838 return proc_watchdog_common(NMI_WATCHDOG_ENABLED, 718 return proc_watchdog_common(NMI_WATCHDOG_ENABLED,
839 table, write, buffer, lenp, ppos); 719 table, write, buffer, lenp, ppos);
840} 720}
@@ -855,39 +735,17 @@ int proc_soft_watchdog(struct ctl_table *table, int write,
855int proc_watchdog_thresh(struct ctl_table *table, int write, 735int proc_watchdog_thresh(struct ctl_table *table, int write,
856 void __user *buffer, size_t *lenp, loff_t *ppos) 736 void __user *buffer, size_t *lenp, loff_t *ppos)
857{ 737{
858 int err, old, new; 738 int err, old;
859
860 get_online_cpus();
861 mutex_lock(&watchdog_proc_mutex);
862 739
863 if (watchdog_suspended) { 740 mutex_lock(&watchdog_mutex);
864 /* no parameter changes allowed while watchdog is suspended */
865 err = -EAGAIN;
866 goto out;
867 }
868 741
869 old = ACCESS_ONCE(watchdog_thresh); 742 old = READ_ONCE(watchdog_thresh);
870 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos); 743 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
871 744
872 if (err || !write) 745 if (!err && write && old != READ_ONCE(watchdog_thresh))
873 goto out; 746 proc_watchdog_update();
874
875 /*
876 * Update the sample period. Restore on failure.
877 */
878 new = ACCESS_ONCE(watchdog_thresh);
879 if (old == new)
880 goto out;
881 747
882 set_sample_period(); 748 mutex_unlock(&watchdog_mutex);
883 err = proc_watchdog_update();
884 if (err) {
885 watchdog_thresh = old;
886 set_sample_period();
887 }
888out:
889 mutex_unlock(&watchdog_proc_mutex);
890 put_online_cpus();
891 return err; 749 return err;
892} 750}
893 751
@@ -902,45 +760,19 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write,
902{ 760{
903 int err; 761 int err;
904 762
905 get_online_cpus(); 763 mutex_lock(&watchdog_mutex);
906 mutex_lock(&watchdog_proc_mutex);
907
908 if (watchdog_suspended) {
909 /* no parameter changes allowed while watchdog is suspended */
910 err = -EAGAIN;
911 goto out;
912 }
913 764
914 err = proc_do_large_bitmap(table, write, buffer, lenp, ppos); 765 err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
915 if (!err && write) { 766 if (!err && write)
916 /* Remove impossible cpus to keep sysctl output cleaner. */ 767 proc_watchdog_update();
917 cpumask_and(&watchdog_cpumask, &watchdog_cpumask,
918 cpu_possible_mask);
919
920 if (watchdog_running) {
921 /*
922 * Failure would be due to being unable to allocate
923 * a temporary cpumask, so we are likely not in a
924 * position to do much else to make things better.
925 */
926 if (watchdog_update_cpus() != 0)
927 pr_err("cpumask update failed\n");
928 }
929 768
930 watchdog_nmi_reconfigure(); 769 mutex_unlock(&watchdog_mutex);
931 }
932out:
933 mutex_unlock(&watchdog_proc_mutex);
934 put_online_cpus();
935 return err; 770 return err;
936} 771}
937
938#endif /* CONFIG_SYSCTL */ 772#endif /* CONFIG_SYSCTL */
939 773
940void __init lockup_detector_init(void) 774void __init lockup_detector_init(void)
941{ 775{
942 set_sample_period();
943
944#ifdef CONFIG_NO_HZ_FULL 776#ifdef CONFIG_NO_HZ_FULL
945 if (tick_nohz_full_enabled()) { 777 if (tick_nohz_full_enabled()) {
946 pr_info("Disabling watchdog on nohz_full cores by default\n"); 778 pr_info("Disabling watchdog on nohz_full cores by default\n");
@@ -951,6 +783,7 @@ void __init lockup_detector_init(void)
951 cpumask_copy(&watchdog_cpumask, cpu_possible_mask); 783 cpumask_copy(&watchdog_cpumask, cpu_possible_mask);
952#endif 784#endif
953 785
954 if (watchdog_enabled) 786 if (!watchdog_nmi_probe())
955 watchdog_enable_all_cpus(); 787 nmi_watchdog_available = true;
788 lockup_detector_setup();
956} 789}
diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index 3a09ea1b1d3d..71a62ceacdc8 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -21,8 +21,10 @@
21static DEFINE_PER_CPU(bool, hard_watchdog_warn); 21static DEFINE_PER_CPU(bool, hard_watchdog_warn);
22static DEFINE_PER_CPU(bool, watchdog_nmi_touch); 22static DEFINE_PER_CPU(bool, watchdog_nmi_touch);
23static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); 23static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
24static struct cpumask dead_events_mask;
24 25
25static unsigned long hardlockup_allcpu_dumped; 26static unsigned long hardlockup_allcpu_dumped;
27static unsigned int watchdog_cpus;
26 28
27void arch_touch_nmi_watchdog(void) 29void arch_touch_nmi_watchdog(void)
28{ 30{
@@ -103,15 +105,12 @@ static struct perf_event_attr wd_hw_attr = {
103 105
104/* Callback function for perf event subsystem */ 106/* Callback function for perf event subsystem */
105static void watchdog_overflow_callback(struct perf_event *event, 107static void watchdog_overflow_callback(struct perf_event *event,
106 struct perf_sample_data *data, 108 struct perf_sample_data *data,
107 struct pt_regs *regs) 109 struct pt_regs *regs)
108{ 110{
109 /* Ensure the watchdog never gets throttled */ 111 /* Ensure the watchdog never gets throttled */
110 event->hw.interrupts = 0; 112 event->hw.interrupts = 0;
111 113
112 if (atomic_read(&watchdog_park_in_progress) != 0)
113 return;
114
115 if (__this_cpu_read(watchdog_nmi_touch) == true) { 114 if (__this_cpu_read(watchdog_nmi_touch) == true) {
116 __this_cpu_write(watchdog_nmi_touch, false); 115 __this_cpu_write(watchdog_nmi_touch, false);
117 return; 116 return;
@@ -160,104 +159,131 @@ static void watchdog_overflow_callback(struct perf_event *event,
160 return; 159 return;
161} 160}
162 161
163/* 162static int hardlockup_detector_event_create(void)
164 * People like the simple clean cpu node info on boot.
165 * Reduce the watchdog noise by only printing messages
166 * that are different from what cpu0 displayed.
167 */
168static unsigned long firstcpu_err;
169static atomic_t watchdog_cpus;
170
171int watchdog_nmi_enable(unsigned int cpu)
172{ 163{
164 unsigned int cpu = smp_processor_id();
173 struct perf_event_attr *wd_attr; 165 struct perf_event_attr *wd_attr;
174 struct perf_event *event = per_cpu(watchdog_ev, cpu); 166 struct perf_event *evt;
175 int firstcpu = 0;
176
177 /* nothing to do if the hard lockup detector is disabled */
178 if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED))
179 goto out;
180
181 /* is it already setup and enabled? */
182 if (event && event->state > PERF_EVENT_STATE_OFF)
183 goto out;
184
185 /* it is setup but not enabled */
186 if (event != NULL)
187 goto out_enable;
188
189 if (atomic_inc_return(&watchdog_cpus) == 1)
190 firstcpu = 1;
191 167
192 wd_attr = &wd_hw_attr; 168 wd_attr = &wd_hw_attr;
193 wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh); 169 wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh);
194 170
195 /* Try to register using hardware perf events */ 171 /* Try to register using hardware perf events */
196 event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback, NULL); 172 evt = perf_event_create_kernel_counter(wd_attr, cpu, NULL,
173 watchdog_overflow_callback, NULL);
174 if (IS_ERR(evt)) {
175 pr_info("Perf event create on CPU %d failed with %ld\n", cpu,
176 PTR_ERR(evt));
177 return PTR_ERR(evt);
178 }
179 this_cpu_write(watchdog_ev, evt);
180 return 0;
181}
197 182
198 /* save the first cpu's error for future comparision */ 183/**
199 if (firstcpu && IS_ERR(event)) 184 * hardlockup_detector_perf_enable - Enable the local event
200 firstcpu_err = PTR_ERR(event); 185 */
186void hardlockup_detector_perf_enable(void)
187{
188 if (hardlockup_detector_event_create())
189 return;
201 190
202 if (!IS_ERR(event)) { 191 if (!watchdog_cpus++)
203 /* only print for the first cpu initialized */ 192 pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
204 if (firstcpu || firstcpu_err)
205 pr_info("enabled on all CPUs, permanently consumes one hw-PMU counter.\n");
206 goto out_save;
207 }
208 193
209 /* 194 perf_event_enable(this_cpu_read(watchdog_ev));
210 * Disable the hard lockup detector if _any_ CPU fails to set up
211 * set up the hardware perf event. The watchdog() function checks
212 * the NMI_WATCHDOG_ENABLED bit periodically.
213 *
214 * The barriers are for syncing up watchdog_enabled across all the
215 * cpus, as clear_bit() does not use barriers.
216 */
217 smp_mb__before_atomic();
218 clear_bit(NMI_WATCHDOG_ENABLED_BIT, &watchdog_enabled);
219 smp_mb__after_atomic();
220
221 /* skip displaying the same error again */
222 if (!firstcpu && (PTR_ERR(event) == firstcpu_err))
223 return PTR_ERR(event);
224
225 /* vary the KERN level based on the returned errno */
226 if (PTR_ERR(event) == -EOPNOTSUPP)
227 pr_info("disabled (cpu%i): not supported (no LAPIC?)\n", cpu);
228 else if (PTR_ERR(event) == -ENOENT)
229 pr_warn("disabled (cpu%i): hardware events not enabled\n",
230 cpu);
231 else
232 pr_err("disabled (cpu%i): unable to create perf event: %ld\n",
233 cpu, PTR_ERR(event));
234
235 pr_info("Shutting down hard lockup detector on all cpus\n");
236
237 return PTR_ERR(event);
238
239 /* success path */
240out_save:
241 per_cpu(watchdog_ev, cpu) = event;
242out_enable:
243 perf_event_enable(per_cpu(watchdog_ev, cpu));
244out:
245 return 0;
246} 195}
247 196
248void watchdog_nmi_disable(unsigned int cpu) 197/**
198 * hardlockup_detector_perf_disable - Disable the local event
199 */
200void hardlockup_detector_perf_disable(void)
249{ 201{
250 struct perf_event *event = per_cpu(watchdog_ev, cpu); 202 struct perf_event *event = this_cpu_read(watchdog_ev);
251 203
252 if (event) { 204 if (event) {
253 perf_event_disable(event); 205 perf_event_disable(event);
206 cpumask_set_cpu(smp_processor_id(), &dead_events_mask);
207 watchdog_cpus--;
208 }
209}
210
211/**
212 * hardlockup_detector_perf_cleanup - Cleanup disabled events and destroy them
213 *
214 * Called from lockup_detector_cleanup(). Serialized by the caller.
215 */
216void hardlockup_detector_perf_cleanup(void)
217{
218 int cpu;
219
220 for_each_cpu(cpu, &dead_events_mask) {
221 struct perf_event *event = per_cpu(watchdog_ev, cpu);
222
223 /*
224 * Required because for_each_cpu() reports unconditionally
225 * CPU0 as set on UP kernels. Sigh.
226 */
227 if (event)
228 perf_event_release_kernel(event);
254 per_cpu(watchdog_ev, cpu) = NULL; 229 per_cpu(watchdog_ev, cpu) = NULL;
230 }
231 cpumask_clear(&dead_events_mask);
232}
233
234/**
235 * hardlockup_detector_perf_stop - Globally stop watchdog events
236 *
237 * Special interface for x86 to handle the perf HT bug.
238 */
239void __init hardlockup_detector_perf_stop(void)
240{
241 int cpu;
242
243 lockdep_assert_cpus_held();
244
245 for_each_online_cpu(cpu) {
246 struct perf_event *event = per_cpu(watchdog_ev, cpu);
247
248 if (event)
249 perf_event_disable(event);
250 }
251}
255 252
256 /* should be in cleanup, but blocks oprofile */ 253/**
257 perf_event_release_kernel(event); 254 * hardlockup_detector_perf_restart - Globally restart watchdog events
255 *
256 * Special interface for x86 to handle the perf HT bug.
257 */
258void __init hardlockup_detector_perf_restart(void)
259{
260 int cpu;
261
262 lockdep_assert_cpus_held();
263
264 if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED))
265 return;
266
267 for_each_online_cpu(cpu) {
268 struct perf_event *event = per_cpu(watchdog_ev, cpu);
269
270 if (event)
271 perf_event_enable(event);
272 }
273}
274
275/**
276 * hardlockup_detector_perf_init - Probe whether NMI event is available at all
277 */
278int __init hardlockup_detector_perf_init(void)
279{
280 int ret = hardlockup_detector_event_create();
258 281
259 /* watchdog_nmi_enable() expects this to be zero initially. */ 282 if (ret) {
260 if (atomic_dec_and_test(&watchdog_cpus)) 283 pr_info("Perf NMI watchdog permanently disabled\n");
261 firstcpu_err = 0; 284 } else {
285 perf_event_release_kernel(this_cpu_read(watchdog_ev));
286 this_cpu_write(watchdog_ev, NULL);
262 } 287 }
288 return ret;
263} 289}
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 9b5de31aa429..c1841f234a71 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2203,7 +2203,7 @@ static void xs_udp_setup_socket(struct work_struct *work)
2203 struct sock_xprt *transport = 2203 struct sock_xprt *transport =
2204 container_of(work, struct sock_xprt, connect_worker.work); 2204 container_of(work, struct sock_xprt, connect_worker.work);
2205 struct rpc_xprt *xprt = &transport->xprt; 2205 struct rpc_xprt *xprt = &transport->xprt;
2206 struct socket *sock = transport->sock; 2206 struct socket *sock;
2207 int status = -EIO; 2207 int status = -EIO;
2208 2208
2209 sock = xs_create_sock(xprt, transport, 2209 sock = xs_create_sock(xprt, transport,