History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

David S. Miller committed 9 years ago

Commit d93fa2b2 parents d0e6020 529a86e184 files · +1393 −1201Browse files

Unified · Split

184 files
  1. Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.txt +7 −5
  2. Documentation/filesystems/overlayfs.txt +4 −1
  3. Documentation/i2c/busses/i2c-i801 +1 −0
  4. Documentation/networking/bonding.txt +1 −1
  5. MAINTAINERS +3 −2
  6. Makefile +1 −1
  7. arch/Kconfig +0 −3
  8. arch/arc/Kconfig +1 −1
  9. arch/arc/Makefile +0 −2
  10. arch/arc/boot/dts/axs10x_mb.dtsi +8 −1
  11. arch/arc/boot/dts/hsdk.dts +29 −3
  12. arch/arc/configs/axs101_defconfig +1 −1
  13. arch/arc/configs/axs103_defconfig +1 −1
  14. arch/arc/configs/axs103_smp_defconfig +1 −1
  15. arch/arc/configs/haps_hs_smp_defconfig +1 −1
  16. arch/arc/configs/hsdk_defconfig +2 −1
  17. arch/arc/configs/vdk_hs38_defconfig +1 −1
  18. arch/arc/configs/vdk_hs38_smp_defconfig +1 −1
  19. arch/arc/include/asm/arcregs.h +6 −5
  20. arch/arc/kernel/setup.c +25 −7
  21. arch/arc/plat-axs10x/axs10x.c +7 −0
  22. arch/arc/plat-hsdk/Kconfig +2 −1
  23. arch/arc/plat-hsdk/platform.c +42 −0
  24. arch/arm64/include/asm/memory.h +6 −3
  25. arch/arm64/kernel/armv8_deprecated.c +1 −1
  26. arch/arm64/kernel/cpufeature.c +1 −1
  27. arch/arm64/kernel/fpsimd.c +1 −1
  28. arch/arm64/mm/fault.c +1 −1
  29. arch/parisc/kernel/process.c +1 −1
  30. arch/powerpc/kernel/dt_cpu_ftrs.c +2 −2
  31. arch/powerpc/kernel/exceptions-64s.S +23 −1
  32. arch/powerpc/kernel/mce_power.c +13 −0
  33. arch/powerpc/kernel/setup-common.c +0 −3
  34. arch/powerpc/kernel/signal_64.c +12 −1
  35. arch/powerpc/kernel/watchdog.c +15 −15
  36. arch/powerpc/kvm/book3s_xive.c +2 −3
  37. arch/powerpc/kvm/book3s_xive.h +0 −1
  38. arch/powerpc/mm/pgtable_32.c +1 −1
  39. arch/powerpc/platforms/powernv/setup.c +9 −1
  40. arch/powerpc/sysdev/xive/common.c +8 −0
  41. arch/powerpc/sysdev/xive/spapr.c +4 −0
  42. arch/sparc/Kconfig +0 −1
  43. arch/x86/events/intel/core.c +4 −7
  44. arch/x86/include/asm/kvm_para.h +2 −2
  45. arch/x86/kernel/kvm.c +10 −4
  46. arch/x86/kvm/Kconfig +1 −0
  47. arch/x86/kvm/emulate.c +4 −2
  48. arch/x86/kvm/mmu.c +1 −1
  49. block/blk-mq-debugfs.c +5 −1
  50. block/blk-throttle.c +2 −2
  51. block/bsg-lib.c +21 −6
  52. drivers/acpi/arm64/iort.c +35 −0
  53. drivers/block/Kconfig +1 −1
  54. drivers/block/nbd.c +5 −1
  55. drivers/clk/clk-bulk.c +1 −0
  56. drivers/clk/rockchip/clk-rk3128.c +7 −5
  57. drivers/clk/samsung/clk-exynos4.c +15 −0
  58. drivers/gpu/drm/i915/intel_audio.c +0 −5
  59. drivers/gpu/drm/i915/intel_bios.c +7 −0
  60. drivers/gpu/drm/i915/intel_csr.c +1 −1
  61. drivers/gpu/drm/i915/intel_ddi.c +2 −1
  62. drivers/gpu/drm/i915/intel_display.c +0 −2
  63. drivers/gpu/drm/i915/intel_dpio_phy.c +0 −20
  64. drivers/gpu/drm/i915/intel_modes.c +17 −0
  65. drivers/gpu/drm/i915/intel_runtime_pm.c +3 −0
  66. drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +14 −5
  67. drivers/hwmon/xgene-hwmon.c +11 −8
  68. drivers/i2c/busses/Kconfig +1 −0
  69. drivers/i2c/busses/i2c-i801.c +4 −0
  70. drivers/i2c/busses/i2c-sprd.c +1 −0
  71. drivers/i2c/busses/i2c-stm32f7.c +7 −10
  72. drivers/ide/ide-probe.c +1 −0
  73. drivers/ide/ide-scan-pci.c +9 −4
  74. drivers/ide/setup-pci.c +40 −23
  75. drivers/infiniband/core/iwpm_msg.c +8 −0
  76. drivers/infiniband/core/iwpm_util.c +5 −0
  77. drivers/infiniband/hw/i40iw/i40iw_ctrl.c +1 −1
  78. drivers/infiniband/hw/i40iw/i40iw_p.h +2 −0
  79. drivers/infiniband/hw/i40iw/i40iw_puda.c +4 −7
  80. drivers/infiniband/hw/i40iw/i40iw_verbs.c +2 −0
  81. drivers/infiniband/hw/mlx5/main.c +2 −2
  82. drivers/infiniband/hw/qedr/qedr.h +1 −1
  83. drivers/infiniband/hw/qedr/qedr_cm.c +9 −3
  84. drivers/md/bcache/closure.c +2 −2
  85. drivers/misc/cxl/cxllib.c +11 −2
  86. drivers/mmc/core/block.c +0 −3
  87. drivers/mmc/core/mmc.c +19 −17
  88. drivers/mmc/core/queue.c +9 −116
  89. drivers/mmc/core/queue.h +0 −6
  90. drivers/mmc/host/cavium.c +1 −1
  91. drivers/mmc/host/meson-gx-mmc.c +22 −4
  92. drivers/mmc/host/pxamci.c +1 −5
  93. drivers/mmc/host/sdhci-xenon.c +20 −4
  94. drivers/mmc/host/sdhci-xenon.h +1 −0
  95. drivers/net/ethernet/cavium/thunder/nicvf_main.c +2 −0
  96. drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +0 −22
  97. drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +0 −19
  98. drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +8 −8
  99. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +5 −1
  100. drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +0 −14
  101. drivers/net/ppp/ppp_generic.c +20 −0
  102. drivers/net/usb/cdc_ether.c +13 −0
  103. drivers/nvme/host/core.c +1 −1
  104. drivers/nvme/host/pci.c +7 −7
  105. drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +1 −1
  106. drivers/scsi/libiscsi.c +4 −4
  107. drivers/scsi/scsi_scan.c +3 −0
  108. drivers/scsi/scsi_transport_iscsi.c +0 −16
  109. drivers/scsi/sd.c +26 −9
  110. fs/btrfs/ctree.h +1 −1
  111. fs/btrfs/extent_io.c +1 −1
  112. fs/ceph/mds_client.c +6 −5
  113. fs/ceph/snap.c +3 −5
  114. fs/namespace.c +3 −1
  115. fs/nfs/client.c +1 −1
  116. fs/nfs/filelayout/filelayout.c +2 −1
  117. fs/nfs/nfs4idmap.c +1 −1
  118. fs/nfs/nfs4proc.c +1 −2
  119. fs/nfs/nfs4xdr.c +2 −2
  120. fs/overlayfs/copy_up.c +2 −4
  121. fs/overlayfs/dir.c +0 −20
  122. fs/overlayfs/namei.c +1 −0
  123. fs/overlayfs/overlayfs.h +1 −0
  124. fs/overlayfs/ovl_entry.h +3 −0
  125. fs/overlayfs/readdir.c +4 −2
  126. fs/overlayfs/super.c +19 −8
  127. fs/overlayfs/util.c +23 −1
  128. fs/xfs/xfs_bmap_util.c +22 −2
  129. fs/xfs/xfs_reflink.c +8 −1
  130. include/linux/bpf.h +5 −0
  131. include/linux/mmc/host.h +1 −1
  132. include/linux/netfilter_bridge/ebtables.h +4 −3
  133. include/linux/nmi.h +62 −59
  134. include/linux/smpboot.h +2 −2
  135. include/scsi/scsi_device.h +1 −0
  136. include/scsi/scsi_devinfo.h +1 −0
  137. include/scsi/scsi_transport_iscsi.h +0 −1
  138. include/uapi/linux/netfilter/xt_bpf.h +1 −0
  139. kernel/bpf/inode.c +1 −0
  140. kernel/bpf/verifier.c +5 −0
  141. kernel/cpu.c +6 −0
  142. kernel/smpboot.c +8 −17
  143. kernel/sysctl.c +9 −13
  144. kernel/watchdog.c +238 −405
  145. kernel/watchdog_hld.c +111 −85
  146. net/bridge/netfilter/ebtable_broute.c +2 −2
  147. net/bridge/netfilter/ebtable_filter.c +2 −2
  148. net/bridge/netfilter/ebtable_nat.c +2 −2
  149. net/bridge/netfilter/ebtables.c +9 −8
  150. net/ipv4/gre_offload.c +1 −1
  151. net/ipv4/netfilter/ipt_SYNPROXY.c +2 −1
  152. net/ipv4/route.c +1 −1
  153. net/ipv4/udp.c +5 −9
  154. net/ipv4/udp_offload.c +1 −1
  155. net/ipv6/addrconf.c +2 −2
  156. net/ipv6/ip6_offload.c +1 −1
  157. net/ipv6/netfilter/ip6t_SYNPROXY.c +1 −1
  158. net/ipv6/route.c +1 −1
  159. net/netfilter/ipset/ip_set_core.c +18 −11
  160. net/netfilter/ipset/ip_set_hash_ip.c +12 −10
  161. net/netfilter/ipset/ip_set_hash_ipmark.c +1 −1
  162. net/netfilter/ipset/ip_set_hash_ipport.c +1 −1
  163. net/netfilter/ipset/ip_set_hash_ipportip.c +1 −1
  164. net/netfilter/ipset/ip_set_hash_ipportnet.c +2 −2
  165. net/netfilter/ipset/ip_set_hash_net.c +1 −1
  166. net/netfilter/ipset/ip_set_hash_netiface.c +1 −1
  167. net/netfilter/ipset/ip_set_hash_netnet.c +2 −2
  168. net/netfilter/ipset/ip_set_hash_netport.c +1 −1
  169. net/netfilter/ipset/ip_set_hash_netportnet.c +2 −2
  170. net/netfilter/ipvs/ip_vs_xmit.c +6 −2
  171. net/netfilter/nf_tables_api.c +6 −4
  172. net/netfilter/x_tables.c +2 −2
  173. net/netfilter/xt_bpf.c +20 −2
  174. net/netfilter/xt_socket.c +2 −2
  175. net/netlink/af_netlink.c +7 −6
  176. net/sunrpc/xprtsock.c +1 −1
  177. net/tipc/bcast.c +2 −2
  178. net/tipc/msg.c +8 −0
  179. net/wireless/nl80211.c +12 −2
  180. net/xfrm/xfrm_device.c +1 −0
  181. net/xfrm/xfrm_input.c +4 −2
  182. net/xfrm/xfrm_state.c +2 −2
  183. net/xfrm/xfrm_user.c +1 −0
  184. tools/testing/selftests/networking/timestamping/rxtimestamp.c +1 −1
Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.txt+7−5
@@ -16,11 +16,13 @@ Required Properties: · 15 unmodified lines
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: · 79 unmodified lines
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: · 12 unmodified lines
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 };
Documentation/filesystems/overlayfs.txt+4−1
@@ -210,8 +210,11 @@ path as another overlay mount and it may use a lower layer path that is · 209 unmodified lines
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 by212Using 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. Using213another 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 path219Mounting an overlay using an upper layer path, where the upper layer path
217was previously used by another mounted overlay in combination with a220was previously used by another mounted overlay in combination with a
Documentation/i2c/busses/i2c-i801+1−0
@@ -36,6 +36,7 @@ Supported adapters: · 35 unmodified lines
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 website40 Datasheets: Publicly available at the Intel website
40 41
41On Intel Patsburg and later chipsets, both the normal host SMBus controller42On Intel Patsburg and later chipsets, both the normal host SMBus controller
Documentation/networking/bonding.txt+1−1
@@ -2387,7 +2387,7 @@ broadcast: Like active-backup, there is not much advantage to this · 2386 unmodified lines
2387 and packet type ID), so in a "gatewayed" configuration, all2387 and packet type ID), so in a "gatewayed" configuration, all
2388 outgoing traffic will generally use the same device. Incoming2388 outgoing traffic will generally use the same device. Incoming
2389 traffic may also end up on a single device, but that is2389 traffic may also end up on a single device, but that is
2390 dependent upon the balancing policy of the peer's 8023.ad2390 dependent upon the balancing policy of the peer's 802.3ad
2391 implementation. In a "local" configuration, traffic will be2391 implementation. In a "local" configuration, traffic will be
2392 distributed across the devices in the bond.2392 distributed across the devices in the bond.
2393 2393
MAINTAINERS+3−2
@@ -5259,7 +5259,8 @@ S: Maintained · 5258 unmodified lines
5259F: drivers/iommu/exynos-iommu.c5259F: drivers/iommu/exynos-iommu.c
5260 5260
5261EZchip NPS platform support5261EZchip NPS platform support
5262M: Noam Camus <noamc@ezchip.com>5262M: Elad Kanfi <eladkan@mellanox.com>
5263M: Vineet Gupta <vgupta@synopsys.com>
5263S: Supported5264S: Supported
5264F: arch/arc/plat-eznps5265F: arch/arc/plat-eznps
5265F: arch/arc/boot/dts/eznps.dts5266F: arch/arc/boot/dts/eznps.dts
@@ -9360,7 +9361,7 @@ NETWORK BLOCK DEVICE (NBD) · 4094 unmodified lines
9360M: Josef Bacik <jbacik@fb.com>9361M: Josef Bacik <jbacik@fb.com>
9361S: Maintained9362S: Maintained
9362L: linux-block@vger.kernel.org9363L: linux-block@vger.kernel.org
9363L: nbd-general@lists.sourceforge.net9364L: nbd@other.debian.org
9364F: Documentation/blockdev/nbd.txt9365F: Documentation/blockdev/nbd.txt
9365F: drivers/block/nbd.c9366F: drivers/block/nbd.c
9366F: include/uapi/linux/nbd.h9367F: include/uapi/linux/nbd.h
Makefile+1−1
@@ -1,7 +1,7 @@
1VERSION = 41VERSION = 4
2PATCHLEVEL = 142PATCHLEVEL = 14
3SUBLEVEL = 03SUBLEVEL = 0
4EXTRAVERSION = -rc34EXTRAVERSION = -rc4
5NAME = Fearless Coyote5NAME = Fearless Coyote
6 6
7# *DOCUMENTATION*7# *DOCUMENTATION*
arch/Kconfig+0−3
@@ -937,9 +937,6 @@ config STRICT_MODULE_RWX · 936 unmodified lines
937 and non-text memory will be made non-executable. This provides937 and non-text memory will be made non-executable. This provides
938 protection against certain security exploits (e.g. writing to text)938 protection against certain security exploits (e.g. writing to text)
939 939
940config ARCH_WANT_RELAX_ORDER
941 bool
942
943config ARCH_HAS_REFCOUNT940config ARCH_HAS_REFCOUNT
944 bool941 bool
945 help942 help
arch/arc/Kconfig+1−1
@@ -24,7 +24,7 @@ config ARC · 23 unmodified lines
24 select GENERIC_SMP_IDLE_THREAD24 select GENERIC_SMP_IDLE_THREAD
25 select HAVE_ARCH_KGDB25 select HAVE_ARCH_KGDB
26 select HAVE_ARCH_TRACEHOOK26 select HAVE_ARCH_TRACEHOOK
27 select HAVE_FUTEX_CMPXCHG27 select HAVE_FUTEX_CMPXCHG if FUTEX
28 select HAVE_IOREMAP_PROT28 select HAVE_IOREMAP_PROT
29 select HAVE_KPROBES29 select HAVE_KPROBES
30 select HAVE_KRETPROBES30 select HAVE_KRETPROBES
arch/arc/Makefile+0−2
@@ -6,8 +6,6 @@ · 5 unmodified lines
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_ENDIAN10ifndef CONFIG_CPU_BIG_ENDIAN
13CROSS_COMPILE := arc-linux-11CROSS_COMPILE := arc-linux-
arch/arc/boot/dts/axs10x_mb.dtsi+8−1
@@ -44,7 +44,14 @@ · 43 unmodified lines
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
arch/arc/boot/dts/hsdk.dts+29−3
@@ -12,6 +12,7 @@ · 11 unmodified lines
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 @@ · 39 unmodified lines
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 @@ · 35 unmodified lines
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 @@ · 12 unmodified lines
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 @@ · 14 unmodified lines
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>;
arch/arc/configs/axs101_defconfig+1−1
@@ -105,7 +105,7 @@ CONFIG_NLS_ISO8859_1=y · 104 unmodified lines
105# CONFIG_ENABLE_WARN_DEPRECATED is not set105# CONFIG_ENABLE_WARN_DEPRECATED is not set
106# CONFIG_ENABLE_MUST_CHECK is not set106# CONFIG_ENABLE_MUST_CHECK is not set
107CONFIG_STRIP_ASM_SYMS=y107CONFIG_STRIP_ASM_SYMS=y
108CONFIG_LOCKUP_DETECTOR=y108CONFIG_SOFTLOCKUP_DETECTOR=y
109CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10109CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
110# CONFIG_SCHED_DEBUG is not set110# CONFIG_SCHED_DEBUG is not set
111# CONFIG_DEBUG_PREEMPT is not set111# CONFIG_DEBUG_PREEMPT is not set
arch/arc/configs/axs103_defconfig+1−1
@@ -104,7 +104,7 @@ CONFIG_NLS_ISO8859_1=y · 103 unmodified lines
104# CONFIG_ENABLE_WARN_DEPRECATED is not set104# CONFIG_ENABLE_WARN_DEPRECATED is not set
105# CONFIG_ENABLE_MUST_CHECK is not set105# CONFIG_ENABLE_MUST_CHECK is not set
106CONFIG_STRIP_ASM_SYMS=y106CONFIG_STRIP_ASM_SYMS=y
107CONFIG_LOCKUP_DETECTOR=y107CONFIG_SOFTLOCKUP_DETECTOR=y
108CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10108CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
109# CONFIG_SCHED_DEBUG is not set109# CONFIG_SCHED_DEBUG is not set
110# CONFIG_DEBUG_PREEMPT is not set110# CONFIG_DEBUG_PREEMPT is not set
arch/arc/configs/axs103_smp_defconfig+1−1
@@ -107,7 +107,7 @@ CONFIG_NLS_ISO8859_1=y · 106 unmodified lines
107# CONFIG_ENABLE_WARN_DEPRECATED is not set107# CONFIG_ENABLE_WARN_DEPRECATED is not set
108# CONFIG_ENABLE_MUST_CHECK is not set108# CONFIG_ENABLE_MUST_CHECK is not set
109CONFIG_STRIP_ASM_SYMS=y109CONFIG_STRIP_ASM_SYMS=y
110CONFIG_LOCKUP_DETECTOR=y110CONFIG_SOFTLOCKUP_DETECTOR=y
111CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10111CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
112# CONFIG_SCHED_DEBUG is not set112# CONFIG_SCHED_DEBUG is not set
113# CONFIG_DEBUG_PREEMPT is not set113# CONFIG_DEBUG_PREEMPT is not set
arch/arc/configs/haps_hs_smp_defconfig+1−1
@@ -84,5 +84,5 @@ CONFIG_TMPFS=y · 83 unmodified lines
84CONFIG_NFS_FS=y84CONFIG_NFS_FS=y
85# CONFIG_ENABLE_WARN_DEPRECATED is not set85# CONFIG_ENABLE_WARN_DEPRECATED is not set
86# CONFIG_ENABLE_MUST_CHECK is not set86# CONFIG_ENABLE_MUST_CHECK is not set
87CONFIG_LOCKUP_DETECTOR=y87CONFIG_SOFTLOCKUP_DETECTOR=y
88# CONFIG_DEBUG_PREEMPT is not set88# CONFIG_DEBUG_PREEMPT is not set
arch/arc/configs/hsdk_defconfig+2−1
@@ -63,6 +63,7 @@ CONFIG_MMC_SDHCI=y · 62 unmodified lines
63CONFIG_MMC_SDHCI_PLTFM=y63CONFIG_MMC_SDHCI_PLTFM=y
64CONFIG_MMC_DW=y64CONFIG_MMC_DW=y
65# CONFIG_IOMMU_SUPPORT is not set65# CONFIG_IOMMU_SUPPORT is not set
66CONFIG_RESET_HSDK=y
66CONFIG_EXT3_FS=y67CONFIG_EXT3_FS=y
67CONFIG_VFAT_FS=y68CONFIG_VFAT_FS=y
68CONFIG_TMPFS=y69CONFIG_TMPFS=y
@@ -72,7 +73,7 @@ CONFIG_NLS_ISO8859_1=y · 3 unmodified lines
72# CONFIG_ENABLE_WARN_DEPRECATED is not set73# CONFIG_ENABLE_WARN_DEPRECATED is not set
73# CONFIG_ENABLE_MUST_CHECK is not set74# CONFIG_ENABLE_MUST_CHECK is not set
74CONFIG_STRIP_ASM_SYMS=y75CONFIG_STRIP_ASM_SYMS=y
75CONFIG_LOCKUP_DETECTOR=y76CONFIG_SOFTLOCKUP_DETECTOR=y
76CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=1077CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
77# CONFIG_SCHED_DEBUG is not set78# CONFIG_SCHED_DEBUG is not set
78# CONFIG_DEBUG_PREEMPT is not set79# CONFIG_DEBUG_PREEMPT is not set
arch/arc/configs/vdk_hs38_defconfig+1−1
@@ -94,7 +94,7 @@ CONFIG_NLS_ISO8859_1=y · 93 unmodified lines
94# CONFIG_ENABLE_MUST_CHECK is not set94# CONFIG_ENABLE_MUST_CHECK is not set
95CONFIG_STRIP_ASM_SYMS=y95CONFIG_STRIP_ASM_SYMS=y
96CONFIG_DEBUG_SHIRQ=y96CONFIG_DEBUG_SHIRQ=y
97CONFIG_LOCKUP_DETECTOR=y97CONFIG_SOFTLOCKUP_DETECTOR=y
98CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=1098CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
99# CONFIG_SCHED_DEBUG is not set99# CONFIG_SCHED_DEBUG is not set
100# CONFIG_DEBUG_PREEMPT is not set100# CONFIG_DEBUG_PREEMPT is not set
arch/arc/configs/vdk_hs38_smp_defconfig+1−1
@@ -98,7 +98,7 @@ CONFIG_NLS_ISO8859_1=y · 97 unmodified lines
98# CONFIG_ENABLE_MUST_CHECK is not set98# CONFIG_ENABLE_MUST_CHECK is not set
99CONFIG_STRIP_ASM_SYMS=y99CONFIG_STRIP_ASM_SYMS=y
100CONFIG_DEBUG_SHIRQ=y100CONFIG_DEBUG_SHIRQ=y
101CONFIG_LOCKUP_DETECTOR=y101CONFIG_SOFTLOCKUP_DETECTOR=y
102CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10102CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
103# CONFIG_SCHED_DEBUG is not set103# CONFIG_SCHED_DEBUG is not set
104# CONFIG_DEBUG_PREEMPT is not set104# CONFIG_DEBUG_PREEMPT is not set
arch/arc/include/asm/arcregs.h+6−5
@@ -98,6 +98,7 @@ · 97 unmodified lines
98 98
99/* Auxiliary registers */99/* Auxiliary registers */
100#define AUX_IDENTITY 4100#define AUX_IDENTITY 4
101#define AUX_EXEC_CTRL 8
101#define AUX_INTR_VEC_BASE 0x25102#define AUX_INTR_VEC_BASE 0x25
102#define AUX_VOL 0x5e103#define AUX_VOL 0x5e
103 104
@@ -135,12 +136,12 @@ struct bcr_identity { · 31 unmodified lines
135#endif136#endif
136};137};
137 138
138struct bcr_isa {139struct bcr_isa_arcv2 {
139#ifdef CONFIG_CPU_BIG_ENDIAN140#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#else143#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#endif146#endif
146};147};
@@ -263,13 +264,13 @@ struct cpuinfo_arc { · 116 unmodified lines
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;
arch/arc/kernel/setup.c+25−7
@@ -51,6 +51,7 @@ static const struct id_to_str arc_cpu_rel[] = { · 50 unmodified lines
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#endif55#endif
55 { 0x00, NULL }56 { 0x00, NULL }
56};57};
@@ -62,6 +63,7 @@ static const struct id_to_str arc_cpu_nm[] = { · 5 unmodified lines
62#else63#else
63 { 0x40, "ARC EM" },64 { 0x40, "ARC EM" },
64 { 0x50, "ARC HS38" },65 { 0x50, "ARC HS38" },
66 { 0x54, "ARC HS48" },
65#endif67#endif
66 { 0x00, "Unknown" }68 { 0x00, "Unknown" }
67};69};
@@ -119,11 +121,11 @@ static void read_arc_build_cfg_regs(void) · 51 unmodified lines
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) · 3 unmodified lines
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) · 52 unmodified lines
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) · 7 unmodified lines
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 else224 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) · 9 unmodified lines
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 "),
arch/arc/plat-axs10x/axs10x.c+7−0
@@ -111,6 +111,13 @@ static void __init axs10x_early_init(void) · 110 unmodified lines
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}
arch/arc/plat-hsdk/Kconfig+2−1
@@ -6,4 +6,5 @@ · 5 unmodified lines
6#6#
7 7
8menuconfig ARC_SOC_HSDK8menuconfig ARC_SOC_HSDK
9 bool "ARC HS Development Kit SOC"9 bool "ARC HS Development Kit SOC"
10 select CLK_HSDK
arch/arc/plat-hsdk/platform.c+42−0
@@ -38,6 +38,42 @@ static void __init hsdk_init_per_cpu(unsigned int cpu) · 37 unmodified lines
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) · 8 unmodified lines
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 = {
arch/arm64/include/asm/memory.h+6−3
@@ -95,16 +95,19 @@ · 94 unmodified lines
95#define KERNEL_END _end95#define KERNEL_END _end
96 96
97/*97/*
98 * The size of the KASAN shadow region. This should be 1/8th of the98 * 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_KASAN102#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#else105#else
104#define KASAN_SHADOW_SIZE (0)106#define KASAN_SHADOW_SIZE (0)
107#define KASAN_THREAD_SHIFT 0
105#endif108#endif
106 109
107#define MIN_THREAD_SHIFT 14110#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 such113 * VMAP'd stacks are allocated at page granularity, so we must ensure that such
arch/arm64/kernel/armv8_deprecated.c+1−1
@@ -649,4 +649,4 @@ static int __init armv8_deprecated_init(void) · 648 unmodified lines
649 return 0;649 return 0;
650}650}
651 651
652late_initcall(armv8_deprecated_init);652core_initcall(armv8_deprecated_init);
arch/arm64/kernel/cpufeature.c+1−1
@@ -1307,4 +1307,4 @@ static int __init enable_mrs_emulation(void) · 1306 unmodified lines
1307 return 0;1307 return 0;
1308}1308}
1309 1309
1310late_initcall(enable_mrs_emulation);1310core_initcall(enable_mrs_emulation);
arch/arm64/kernel/fpsimd.c+1−1
@@ -444,4 +444,4 @@ static int __init fpsimd_init(void) · 443 unmodified lines
444 444
445 return 0;445 return 0;
446}446}
447late_initcall(fpsimd_init);447core_initcall(fpsimd_init);
arch/arm64/mm/fault.c+1−1
@@ -97,7 +97,7 @@ static void data_abort_decode(unsigned int esr) · 96 unmodified lines
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",
arch/parisc/kernel/process.c+1−1
@@ -146,7 +146,7 @@ void machine_power_off(void) · 145 unmodified lines
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
arch/powerpc/kernel/dt_cpu_ftrs.c+2−2
@@ -102,10 +102,10 @@ static void cpufeatures_flush_tlb(void) · 101 unmodified lines
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");
arch/powerpc/kernel/exceptions-64s.S+23−1
@@ -734,7 +734,29 @@ EXC_REAL(program_check, 0x700, 0x100) · 733 unmodified lines
734EXC_VIRT(program_check, 0x4700, 0x100, 0x700)734EXC_VIRT(program_check, 0x4700, 0x100, 0x700)
735TRAMP_KVM(PACA_EXGEN, 0x700)735TRAMP_KVM(PACA_EXGEN, 0x700)
736EXC_COMMON_BEGIN(program_check_common)736EXC_COMMON_BEGIN(program_check_common)
737 EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)737 /*
738 * It's possible to receive a TM Bad Thing type program check with
739 * userspace register values (in particular r1), but with SRR1 reporting
740 * that we came from the kernel. Normally that would confuse the bad
741 * stack logic, and we would report a bad kernel stack pointer. Instead
742 * we switch to the emergency stack if we're taking a TM Bad Thing from
743 * the kernel.
744 */
745 li r10,MSR_PR /* Build a mask of MSR_PR .. */
746 oris r10,r10,0x200000@h /* .. and SRR1_PROGTM */
747 and r10,r10,r12 /* Mask SRR1 with that. */
748 srdi r10,r10,8 /* Shift it so we can compare */
749 cmpldi r10,(0x200000 >> 8) /* .. with an immediate. */
750 bne 1f /* If != go to normal path. */
751
752 /* SRR1 had PR=0 and SRR1_PROGTM=1, so use the emergency stack */
753 andi. r10,r12,MSR_PR; /* Set CR0 correctly for label */
754 /* 3 in EXCEPTION_PROLOG_COMMON */
755 mr r10,r1 /* Save r1 */
756 ld r1,PACAEMERGSP(r13) /* Use emergency stack */
757 subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */
758 b 3f /* Jump into the macro !! */
7591: EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
738 bl save_nvgprs760 bl save_nvgprs
739 RECONCILE_IRQ_STATE(r10, r11)761 RECONCILE_IRQ_STATE(r10, r11)
740 addi r3,r1,STACK_FRAME_OVERHEAD762 addi r3,r1,STACK_FRAME_OVERHEAD
arch/powerpc/kernel/mce_power.c+13−0
@@ -624,5 +624,18 @@ long __machine_check_early_realmode_p8(struct pt_regs *regs) · 623 unmodified lines
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}
arch/powerpc/kernel/setup-common.c+0−3
@@ -904,9 +904,6 @@ void __init setup_arch(char **cmdline_p) · 903 unmodified lines
904#endif904#endif
905#endif905#endif
906 906
907#ifdef CONFIG_PPC_64K_PAGES
908 init_mm.context.pte_frag = NULL;
909#endif
910#ifdef CONFIG_SPAPR_TCE_IOMMU907#ifdef CONFIG_SPAPR_TCE_IOMMU
911 mm_iommu_init(&init_mm);908 mm_iommu_init(&init_mm);
912#endif909#endif
arch/powerpc/kernel/signal_64.c+12−1
@@ -452,9 +452,20 @@ static long restore_tm_sigcontexts(struct task_struct *tsk, · 451 unmodified lines
452 if (MSR_TM_RESV(msr))452 if (MSR_TM_RESV(msr))
453 return -EINVAL;453 return -EINVAL;
454 454
455 /* pull in MSR TM from user context */455 /* pull in MSR TS bits from user context */
456 regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);456 regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);
457 457
458 /*
459 * Ensure that TM is enabled in regs->msr before we leave the signal
460 * handler. It could be the case that (a) user disabled the TM bit
461 * through the manipulation of the MSR bits in uc_mcontext or (b) the
462 * TM bit was disabled because a sufficient number of context switches
463 * happened whilst in the signal handler and load_tm overflowed,
464 * disabling the TM bit. In either case we can end up with an illegal
465 * TM state leading to a TM Bad Thing when we return to userspace.
466 */
467 regs->msr |= MSR_TM;
468
458 /* pull in MSR LE from user context */469 /* pull in MSR LE from user context */
459 regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);470 regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);
460 471
arch/powerpc/kernel/watchdog.c+15−15
@@ -310,9 +310,6 @@ static int start_wd_on_cpu(unsigned int cpu) · 309 unmodified lines
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) · 39 unmodified lines
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{
arch/powerpc/kvm/book3s_xive.c+2−3
@@ -622,7 +622,7 @@ int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server, · 621 unmodified lines
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) · 702 unmodified lines
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) · 169 unmodified lines
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. Hopefully1512 * We need to drop the lock due to the mutex below. Hopefully
arch/powerpc/kvm/book3s_xive.h+0−1
@@ -35,7 +35,6 @@ struct kvmppc_xive_irq_state { · 34 unmodified lines
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
arch/powerpc/mm/pgtable_32.c+1−1
@@ -361,9 +361,9 @@ static int change_page_attr(struct page *page, int numpages, pgprot_t prot) · 360 unmodified lines
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
arch/powerpc/platforms/powernv/setup.c+9−1
@@ -272,7 +272,15 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary) · 271 unmodified lines
272#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE272#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#endif285#endif
278 286
arch/powerpc/sysdev/xive/common.c+8−0
@@ -1402,6 +1402,14 @@ void xive_teardown_cpu(void) · 1401 unmodified lines
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)
arch/powerpc/sysdev/xive/spapr.c+4−0
@@ -431,7 +431,11 @@ static int xive_spapr_get_ipi(unsigned int cpu, struct xive_cpu *xc) · 430 unmodified lines
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
arch/sparc/Kconfig+0−1
@@ -44,7 +44,6 @@ config SPARC · 43 unmodified lines
44 select ARCH_HAS_SG_CHAIN44 select ARCH_HAS_SG_CHAIN
45 select CPU_NO_EFFICIENT_FFS45 select CPU_NO_EFFICIENT_FFS
46 select LOCKDEP_SMALL if LOCKDEP46 select LOCKDEP_SMALL if LOCKDEP
47 select ARCH_WANT_RELAX_ORDER
48 47
49config SPARC3248config SPARC32
50 def_bool !64BIT49 def_bool !64BIT
arch/x86/events/intel/core.c+4−7
@@ -4409,10 +4409,9 @@ static __init int fixup_ht_bug(void) · 4408 unmodified lines
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) · 1 unmodified line
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);
arch/x86/include/asm/kvm_para.h+2−2
@@ -88,7 +88,7 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1, · 87 unmodified lines
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) · 8 unmodified lines
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)
arch/x86/kernel/kvm.c+10−4
@@ -117,7 +117,11 @@ static struct kvm_task_sleep_node *_find_apf_task(struct kvm_task_sleep_head *b, · 116 unmodified lines
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) · 16 unmodified lines
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) · 121 unmodified lines
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:
arch/x86/kvm/Kconfig+1−0
@@ -23,6 +23,7 @@ config KVM · 22 unmodified lines
23 depends on HIGH_RES_TIMERS23 depends on HIGH_RES_TIMERS
24 # for TASKSTATS/TASK_DELAY_ACCT:24 # for TASKSTATS/TASK_DELAY_ACCT:
25 depends on NET && MULTIUSER25 depends on NET && MULTIUSER
26 depends on X86_LOCAL_APIC
26 select PREEMPT_NOTIFIERS27 select PREEMPT_NOTIFIERS
27 select MMU_NOTIFIER28 select MMU_NOTIFIER
28 select ANON_INODES29 select ANON_INODES
arch/x86/kvm/emulate.c+4−2
@@ -425,8 +425,10 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *)); · 424 unmodified lines
425 #op " %al \n\t" \425 #op " %al \n\t" \
426 FOP_RET426 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)
arch/x86/kvm/mmu.c+1−1
@@ -3837,7 +3837,7 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code, · 3836 unmodified lines
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:
block/blk-mq-debugfs.c+5−1
@@ -815,10 +815,14 @@ int blk_mq_debugfs_register(struct request_queue *q) · 814 unmodified lines
815 goto err;815 goto err;
816 816
817 /*817 /*
818 * blk_mq_init_hctx() attempted to do this already, but q->debugfs_dir818 * 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 directory819 * 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;
block/blk-throttle.c+2−2
@@ -1911,11 +1911,11 @@ static void throtl_upgrade_state(struct throtl_data *td) · 1910 unmodified lines
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
block/bsg-lib.c+21−6
@@ -207,20 +207,34 @@ static int bsg_init_rq(struct request_queue *q, struct request *req, gfp_t gfp) · 206 unmodified lines
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, · 24 unmodified lines
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);
drivers/acpi/arm64/iort.c+35−0
@@ -1178,12 +1178,44 @@ dev_put: · 1177 unmodified lines
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, but1221 * 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) · 13 unmodified lines
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
drivers/block/Kconfig+1−1
@@ -17,7 +17,7 @@ if BLK_DEV · 16 unmodified lines
17 17
18config BLK_DEV_NULL_BLK18config BLK_DEV_NULL_BLK
19 tristate "Null test block driver"19 tristate "Null test block driver"
20 depends on CONFIGFS_FS20 select CONFIGFS_FS
21 21
22config BLK_DEV_FD22config BLK_DEV_FD
23 tristate "Normal floppy disk support"23 tristate "Normal floppy disk support"
drivers/block/nbd.c+5−1
@@ -820,9 +820,13 @@ static blk_status_t nbd_queue_rq(struct blk_mq_hw_ctx *hctx, · 819 unmodified lines
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,
drivers/clk/clk-bulk.c+1−0
@@ -105,6 +105,7 @@ err: · 104 unmodified lines
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
drivers/clk/rockchip/clk-rk3128.c+7−5
@@ -315,13 +315,13 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { · 314 unmodified lines
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 = { · 213 unmodified lines
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 = { · 29 unmodified lines
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)
drivers/clk/samsung/clk-exynos4.c+15−0
@@ -294,6 +294,18 @@ static const struct samsung_clk_reg_dump src_mask_suspend_e4210[] = { · 293 unmodified lines
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) · 15 unmodified lines
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));
drivers/gpu/drm/i915/intel_audio.c+0−5
@@ -606,11 +606,6 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder, · 605 unmodified lines
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)
drivers/gpu/drm/i915/intel_bios.c+7−0
@@ -1163,6 +1163,13 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port, · 1162 unmodified lines
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;
drivers/gpu/drm/i915/intel_csr.c+1−1
@@ -216,7 +216,7 @@ static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv) · 215 unmodified lines
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 */
drivers/gpu/drm/i915/intel_ddi.c+2−1
@@ -1655,7 +1655,8 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder, · 1654 unmodified lines
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);
drivers/gpu/drm/i915/intel_display.c+0−2
@@ -12359,7 +12359,6 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) · 12358 unmodified lines
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) · 10 unmodified lines
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,
drivers/gpu/drm/i915/intel_dpio_phy.c+0−20
@@ -208,12 +208,6 @@ static const struct bxt_ddi_phy_info glk_ddi_phy_info[] = { · 207 unmodified lines
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, · 93 unmodified lines
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, · 15 unmodified lines
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
drivers/gpu/drm/i915/intel_modes.c+17−0
@@ -30,6 +30,21 @@ · 29 unmodified lines
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 edid49 * intel_connector_update_modes - update connector from edid
35 * @connector: DRM connector device to use50 * @connector: DRM connector device to use
@@ -44,6 +59,8 @@ int intel_connector_update_modes(struct drm_connector *connector, · 8 unmodified lines
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
drivers/gpu/drm/i915/intel_runtime_pm.c+3−0
@@ -2782,6 +2782,9 @@ static void cnl_display_core_init(struct drm_i915_private *dev_priv, bool resume · 2781 unmodified lines
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_IDX2790#undef CNL_PROCMON_IDX
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c+14−5
@@ -302,26 +302,29 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, · 301 unmodified lines
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, · 34 unmodified lines
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: · 53 unmodified lines
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, · 6 unmodified lines
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 = {
drivers/hwmon/xgene-hwmon.c+11−8
@@ -630,7 +630,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 629 unmodified lines
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) · 9 unmodified lines
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) · 1 unmodified line
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) · 1 unmodified line
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) · 6 unmodified lines
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) · 8 unmodified lines
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 /*
drivers/i2c/busses/Kconfig+1−0
@@ -131,6 +131,7 @@ config I2C_I801 · 130 unmodified lines
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 module136 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.
drivers/i2c/busses/i2c-i801.c+4−0
@@ -68,6 +68,7 @@ · 67 unmodified lines
68 * Gemini Lake (SOC) 0x31d4 32 hard yes yes yes68 * Gemini Lake (SOC) 0x31d4 32 hard yes yes yes
69 * Cannon Lake-H (PCH) 0xa323 32 hard yes yes yes69 * Cannon Lake-H (PCH) 0xa323 32 hard yes yes yes
70 * Cannon Lake-LP (PCH) 0x9da3 32 hard yes yes yes70 * 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 no74 * Software PEC no
@@ -204,6 +205,7 @@ · 130 unmodified lines
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 0x0f12207#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 0x19df209#define PCI_DEVICE_ID_INTEL_DNV_SMBUS 0x19df
208#define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22210#define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22
209#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22211#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22
@@ -1025,6 +1027,7 @@ static const struct pci_device_id i801_ids[] = { · 815 unmodified lines
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) · 482 unmodified lines
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;
drivers/i2c/busses/i2c-sprd.c+1−0
@@ -627,6 +627,7 @@ static const struct dev_pm_ops sprd_i2c_pm_ops = { · 626 unmodified lines
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 = {
drivers/i2c/busses/i2c-stm32f7.c+7−10
@@ -215,7 +215,7 @@ struct stm32f7_i2c_dev { · 214 unmodified lines
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[] = { · 43 unmodified lines
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) · 265 unmodified lines
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 else543 else
@@ -887,22 +887,19 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) · 343 unmodified lines
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
drivers/ide/ide-probe.c+1−0
@@ -1451,6 +1451,7 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, · 1450 unmodified lines
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;
drivers/ide/ide-scan-pci.c+9−4
@@ -56,6 +56,7 @@ static int __init ide_scan_pcidev(struct pci_dev *dev) · 55 unmodified lines
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) · 1 unmodified line
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 }
drivers/ide/setup-pci.c+40−23
@@ -179,6 +179,7 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); · 178 unmodified lines
179/**179/**
180 * ide_pci_enable - do PCI enables180 * ide_pci_enable - do PCI enables
181 * @dev: PCI device181 * @dev: PCI device
182 * @bars: PCI BARs mask
182 * @d: IDE port info183 * @d: IDE port info
183 *184 *
184 * Enable the IDE PCI device. We attempt to enable the device in full185 * Enable the IDE PCI device. We attempt to enable the device in full
@@ -189,9 +190,10 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); · 4 unmodified lines
189 * Returns zero on success or an error code190 * 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) · 18 unmodified lines
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) · 169 unmodified lines
403/**393/**
404 * ide_setup_pci_controller - set up IDE PCI394 * ide_setup_pci_controller - set up IDE PCI
405 * @dev: PCI device395 * @dev: PCI device
396 * @bars: PCI BARs mask
406 * @d: IDE port info397 * @d: IDE port info
407 * @noisy: verbose flag398 * @noisy: verbose flag
408 *399 *
@@ -411,7 +402,7 @@ int ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d) · 2 unmodified lines
411 * and enables it if need be402 * 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, · 2 unmodified lines
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, · 1 unmodified line
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, · 96 unmodified lines
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, · 1 unmodified line
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, · 15 unmodified lines
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, · 6 unmodified lines
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}
drivers/infiniband/core/iwpm_msg.c+8−0
@@ -100,6 +100,8 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client) · 99 unmodified lines
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) · 64 unmodified lines
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) · 70 unmodified lines
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) · 56 unmodified lines
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 */
drivers/infiniband/core/iwpm_util.c+5−0
@@ -597,6 +597,9 @@ static int send_mapinfo_num(u32 mapping_num, u8 nl_client, int iwpm_pid) · 596 unmodified lines
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) · 75 unmodified lines
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,
drivers/infiniband/hw/i40iw/i40iw_ctrl.c+1−1
@@ -48,7 +48,7 @@ · 47 unmodified lines
48 * @wqe: cqp wqe for header48 * @wqe: cqp wqe for header
49 * @header: header for the cqp wqe49 * @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);
drivers/infiniband/hw/i40iw/i40iw_p.h+2−0
@@ -59,6 +59,8 @@ enum i40iw_status_code i40iw_sc_mr_fast_register(struct i40iw_sc_qp *qp, · 58 unmodified lines
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);
drivers/infiniband/hw/i40iw/i40iw_puda.c+4−7
@@ -123,12 +123,11 @@ static void i40iw_puda_post_recvbuf(struct i40iw_puda_rsrc *rsrc, u32 wqe_idx, · 122 unmodified lines
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, · 274 unmodified lines
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 · 121 unmodified lines
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 · 109 unmodified lines
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);
drivers/infiniband/hw/i40iw/i40iw_verbs.c+2−0
@@ -826,12 +826,14 @@ static int i40iw_query_qp(struct ib_qp *ibqp, · 825 unmodified lines
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
drivers/infiniband/hw/mlx5/main.c+2−2
@@ -4174,9 +4174,9 @@ err_bfreg: · 4173 unmodified lines
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
drivers/infiniband/hw/qedr/qedr.h+1−1
@@ -387,7 +387,7 @@ struct qedr_qp { · 386 unmodified lines
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
drivers/infiniband/hw/qedr/qedr_cm.c+9−3
@@ -105,7 +105,7 @@ void qedr_ll2_complete_rx_packet(void *cxt, · 104 unmodified lines
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) · 582 unmodified lines
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) · 12 unmodified lines
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);
drivers/md/bcache/closure.c+2−2
@@ -64,7 +64,7 @@ EXPORT_SYMBOL(closure_put); · 63 unmodified lines
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) · 2 unmodified lines
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 }
drivers/misc/cxl/cxllib.c+11−2
@@ -219,8 +219,17 @@ int cxllib_handle_fault(struct mm_struct *mm, u64 addr, u64 size, u64 flags) · 218 unmodified lines
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);
drivers/mmc/core/block.c+0−3
@@ -1634,8 +1634,6 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq, · 1633 unmodified lines
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) · 187 unmodified lines
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:
drivers/mmc/core/mmc.c+19−17
@@ -1286,6 +1286,23 @@ out_err: · 1285 unmodified lines
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) · 49 unmodified lines
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: · 27 unmodified lines
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 sequence1397 * 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.
drivers/mmc/core/queue.c+9−116
@@ -23,8 +23,6 @@ · 22 unmodified lines
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, · 119 unmodified lines
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 data152 * mmc_init_request() - initialize the MMC-specific per-request data
175 * @q: the request queue153 * @q: the request queue
@@ -184,26 +162,9 @@ static int mmc_init_request(struct request_queue *q, struct request *req, · 8 unmodified lines
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) · 2 unmodified lines
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, · 17 unmodified lines
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, · 17 unmodified lines
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) · 82 unmodified lines
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}
drivers/mmc/core/queue.h+0−6
@@ -49,9 +49,6 @@ enum mmc_drv_op { · 48 unmodified lines
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 *, · 23 unmodified lines
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
drivers/mmc/host/cavium.c+1−1
@@ -1038,7 +1038,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host) · 1037 unmodified lines
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;
drivers/mmc/host/meson-gx-mmc.c+22−4
@@ -531,8 +531,7 @@ static int meson_mmc_clk_init(struct meson_host *host) · 530 unmodified lines
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, · 178 unmodified lines
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) · 23 unmodified lines
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) · 7 unmodified lines
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
drivers/mmc/host/pxamci.c+1−5
@@ -702,11 +702,7 @@ static int pxamci_probe(struct platform_device *pdev) · 701 unmodified lines
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;
drivers/mmc/host/sdhci-xenon.c+20−4
@@ -466,6 +466,7 @@ static int xenon_probe(struct platform_device *pdev) · 465 unmodified lines
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) · 2 unmodified lines
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) · 11 unmodified lines
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) · 2 unmodified lines
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: · 14 unmodified lines
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) · 5 unmodified lines
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) · 2 unmodified lines
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);
drivers/mmc/host/sdhci-xenon.h+1−0
@@ -83,6 +83,7 @@ struct xenon_priv { · 82 unmodified lines
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 /*
drivers/net/ethernet/cavium/thunder/nicvf_main.c+2−0
@@ -566,8 +566,10 @@ static inline bool nicvf_xdp_rx(struct nicvf *nic, struct bpf_prog *prog, · 565 unmodified lines
566 return true;566 return true;
567 default:567 default:
568 bpf_warn_invalid_xdp_action(action);568 bpf_warn_invalid_xdp_action(action);
569 /* fall through */
569 case XDP_ABORTED:570 case XDP_ABORTED:
570 trace_xdp_exception(nic->netdev, prog, action);571 trace_xdp_exception(nic->netdev, prog, action);
572 /* fall through */
571 case XDP_DROP:573 case XDP_DROP:
572 /* Check if it's a recycled page, if not574 /* Check if it's a recycled page, if not
573 * unmap the DMA mapping.575 * unmap the DMA mapping.
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c+0−22
@@ -175,31 +175,9 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw) · 174 unmodified lines
175 **/175 **/
176static s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw)176static s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw)
177{177{
178#ifndef CONFIG_SPARC
179 u32 regval;
180 u32 i;
181#endif
182 s32 ret_val;178 s32 ret_val;
183 179
184 ret_val = ixgbe_start_hw_generic(hw);180 ret_val = ixgbe_start_hw_generic(hw);
185
186#ifndef CONFIG_SPARC
187 /* Disable relaxed ordering */
188 for (i = 0; ((i < hw->mac.max_tx_queues) &&
189 (i < IXGBE_DCA_MAX_QUEUES_82598)); i++) {
190 regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(i));
191 regval &= ~IXGBE_DCA_TXCTRL_DESC_WRO_EN;
192 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(i), regval);
193 }
194
195 for (i = 0; ((i < hw->mac.max_rx_queues) &&
196 (i < IXGBE_DCA_MAX_QUEUES_82598)); i++) {
197 regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i));
198 regval &= ~(IXGBE_DCA_RXCTRL_DATA_WRO_EN |
199 IXGBE_DCA_RXCTRL_HEAD_WRO_EN);
200 IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval);
201 }
202#endif
203 if (ret_val)181 if (ret_val)
204 return ret_val;182 return ret_val;
205 183
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c+0−19
@@ -366,25 +366,6 @@ s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw) · 365 unmodified lines
366 }366 }
367 IXGBE_WRITE_FLUSH(hw);367 IXGBE_WRITE_FLUSH(hw);
368 368
369#ifndef CONFIG_ARCH_WANT_RELAX_ORDER
370 /* Disable relaxed ordering */
371 for (i = 0; i < hw->mac.max_tx_queues; i++) {
372 u32 regval;
373
374 regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(i));
375 regval &= ~IXGBE_DCA_TXCTRL_DESC_WRO_EN;
376 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(i), regval);
377 }
378
379 for (i = 0; i < hw->mac.max_rx_queues; i++) {
380 u32 regval;
381
382 regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i));
383 regval &= ~(IXGBE_DCA_RXCTRL_DATA_WRO_EN |
384 IXGBE_DCA_RXCTRL_HEAD_WRO_EN);
385 IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval);
386 }
387#endif
388 return 0;369 return 0;
389}370}
390 371
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c+8−8
@@ -1049,7 +1049,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev, · 1048 unmodified lines
1049{1049{
1050 struct ixgbe_adapter *adapter = netdev_priv(netdev);1050 struct ixgbe_adapter *adapter = netdev_priv(netdev);
1051 struct ixgbe_ring *temp_ring;1051 struct ixgbe_ring *temp_ring;
1052 int i, err = 0;1052 int i, j, err = 0;
1053 u32 new_rx_count, new_tx_count;1053 u32 new_rx_count, new_tx_count;
1054 1054
1055 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))1055 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
@@ -1086,8 +1086,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev, · 30 unmodified lines
1086 }1086 }
1087 1087
1088 /* allocate temporary buffer to store rings in */1088 /* allocate temporary buffer to store rings in */
1089 i = max_t(int, adapter->num_tx_queues, adapter->num_rx_queues);1089 i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues,
1090 i = max_t(int, i, adapter->num_xdp_queues);1090 adapter->num_rx_queues);
1091 temp_ring = vmalloc(i * sizeof(struct ixgbe_ring));1091 temp_ring = vmalloc(i * sizeof(struct ixgbe_ring));
1092 1092
1093 if (!temp_ring) {1093 if (!temp_ring) {
@@ -1119,8 +1119,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev, · 25 unmodified lines
1119 }1119 }
1120 }1120 }
1121 1121
1122 for (i = 0; i < adapter->num_xdp_queues; i++) {1122 for (j = 0; j < adapter->num_xdp_queues; j++, i++) {
1123 memcpy(&temp_ring[i], adapter->xdp_ring[i],1123 memcpy(&temp_ring[i], adapter->xdp_ring[j],
1124 sizeof(struct ixgbe_ring));1124 sizeof(struct ixgbe_ring));
1125 1125
1126 temp_ring[i].count = new_tx_count;1126 temp_ring[i].count = new_tx_count;
@@ -1140,10 +1140,10 @@ static int ixgbe_set_ringparam(struct net_device *netdev, · 13 unmodified lines
1140 memcpy(adapter->tx_ring[i], &temp_ring[i],1140 memcpy(adapter->tx_ring[i], &temp_ring[i],
1141 sizeof(struct ixgbe_ring));1141 sizeof(struct ixgbe_ring));
1142 }1142 }
1143 for (i = 0; i < adapter->num_xdp_queues; i++) {1143 for (j = 0; j < adapter->num_xdp_queues; j++, i++) {
1144 ixgbe_free_tx_resources(adapter->xdp_ring[i]);1144 ixgbe_free_tx_resources(adapter->xdp_ring[j]);
1145 1145
1146 memcpy(adapter->xdp_ring[i], &temp_ring[i],1146 memcpy(adapter->xdp_ring[j], &temp_ring[i],
1147 sizeof(struct ixgbe_ring));1147 sizeof(struct ixgbe_ring));
1148 }1148 }
1149 1149
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+5−1
@@ -5014,7 +5014,7 @@ static void ixgbe_clear_udp_tunnel_port(struct ixgbe_adapter *adapter, u32 mask) · 5013 unmodified lines
5014 IXGBE_FLAG_GENEVE_OFFLOAD_CAPABLE)))5014 IXGBE_FLAG_GENEVE_OFFLOAD_CAPABLE)))
5015 return;5015 return;
5016 5016
5017 vxlanctrl = IXGBE_READ_REG(hw, IXGBE_VXLANCTRL) && ~mask;5017 vxlanctrl = IXGBE_READ_REG(hw, IXGBE_VXLANCTRL) & ~mask;
5018 IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, vxlanctrl);5018 IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, vxlanctrl);
5019 5019
5020 if (mask & IXGBE_VXLANCTRL_VXLAN_UDPPORT_MASK)5020 if (mask & IXGBE_VXLANCTRL_VXLAN_UDPPORT_MASK)
@@ -8665,6 +8665,10 @@ static int ixgbe_ioctl(struct net_device *netdev, struct ifreq *req, int cmd) · 3644 unmodified lines
8665 return ixgbe_ptp_set_ts_config(adapter, req);8665 return ixgbe_ptp_set_ts_config(adapter, req);
8666 case SIOCGHWTSTAMP:8666 case SIOCGHWTSTAMP:
8667 return ixgbe_ptp_get_ts_config(adapter, req);8667 return ixgbe_ptp_get_ts_config(adapter, req);
8668 case SIOCGMIIPHY:
8669 if (!adapter->hw.phy.ops.read_reg)
8670 return -EOPNOTSUPP;
8671 /* fall through */
8668 default:8672 default:
8669 return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd);8673 return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd);
8670 }8674 }
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+0−14
@@ -3640,20 +3640,6 @@ static int mlxsw_sp_fib_lpm_tree_link(struct mlxsw_sp *mlxsw_sp, · 3639 unmodified lines
3640static void mlxsw_sp_fib_lpm_tree_unlink(struct mlxsw_sp *mlxsw_sp,3640static void mlxsw_sp_fib_lpm_tree_unlink(struct mlxsw_sp *mlxsw_sp,
3641 struct mlxsw_sp_fib *fib)3641 struct mlxsw_sp_fib *fib)
3642{3642{
3643 struct mlxsw_sp_prefix_usage req_prefix_usage = {{ 0 } };
3644 struct mlxsw_sp_lpm_tree *lpm_tree;
3645
3646 /* Aggregate prefix lengths across all virtual routers to make
3647 * sure we only have used prefix lengths in the LPM tree.
3648 */
3649 mlxsw_sp_vrs_prefixes(mlxsw_sp, fib->proto, &req_prefix_usage);
3650 lpm_tree = mlxsw_sp_lpm_tree_get(mlxsw_sp, &req_prefix_usage,
3651 fib->proto);
3652 if (IS_ERR(lpm_tree))
3653 goto err_tree_get;
3654 mlxsw_sp_vrs_lpm_tree_replace(mlxsw_sp, fib, lpm_tree);
3655
3656err_tree_get:
3657 if (!mlxsw_sp_prefix_usage_none(&fib->prefix_usage))3643 if (!mlxsw_sp_prefix_usage_none(&fib->prefix_usage))
3658 return;3644 return;
3659 mlxsw_sp_vr_lpm_tree_unbind(mlxsw_sp, fib);3645 mlxsw_sp_vr_lpm_tree_unbind(mlxsw_sp, fib);
drivers/net/ppp/ppp_generic.c+20−0
@@ -1339,7 +1339,17 @@ ppp_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats64) · 1338 unmodified lines
1339 1339
1340static int ppp_dev_init(struct net_device *dev)1340static int ppp_dev_init(struct net_device *dev)
1341{1341{
1342 struct ppp *ppp;
1343
1342 netdev_lockdep_set_classes(dev);1344 netdev_lockdep_set_classes(dev);
1345
1346 ppp = netdev_priv(dev);
1347 /* Let the netdevice take a reference on the ppp file. This ensures
1348 * that ppp_destroy_interface() won't run before the device gets
1349 * unregistered.
1350 */
1351 atomic_inc(&ppp->file.refcnt);
1352
1343 return 0;1353 return 0;
1344}1354}
1345 1355
@@ -1362,6 +1372,15 @@ static void ppp_dev_uninit(struct net_device *dev) · 16 unmodified lines
1362 wake_up_interruptible(&ppp->file.rwait);1372 wake_up_interruptible(&ppp->file.rwait);
1363}1373}
1364 1374
1375static void ppp_dev_priv_destructor(struct net_device *dev)
1376{
1377 struct ppp *ppp;
1378
1379 ppp = netdev_priv(dev);
1380 if (atomic_dec_and_test(&ppp->file.refcnt))
1381 ppp_destroy_interface(ppp);
1382}
1383
1365static const struct net_device_ops ppp_netdev_ops = {1384static const struct net_device_ops ppp_netdev_ops = {
1366 .ndo_init = ppp_dev_init,1385 .ndo_init = ppp_dev_init,
1367 .ndo_uninit = ppp_dev_uninit,1386 .ndo_uninit = ppp_dev_uninit,
@@ -1387,6 +1406,7 @@ static void ppp_setup(struct net_device *dev) · 19 unmodified lines
1387 dev->tx_queue_len = 3;1406 dev->tx_queue_len = 3;
1388 dev->type = ARPHRD_PPP;1407 dev->type = ARPHRD_PPP;
1389 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;1408 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
1409 dev->priv_destructor = ppp_dev_priv_destructor;
1390 netif_keep_dst(dev);1410 netif_keep_dst(dev);
1391}1411}
1392 1412
drivers/net/usb/cdc_ether.c+13−0
@@ -560,6 +560,7 @@ static const struct driver_info wwan_info = { · 559 unmodified lines
560#define NVIDIA_VENDOR_ID 0x0955560#define NVIDIA_VENDOR_ID 0x0955
561#define HP_VENDOR_ID 0x03f0561#define HP_VENDOR_ID 0x03f0
562#define MICROSOFT_VENDOR_ID 0x045e562#define MICROSOFT_VENDOR_ID 0x045e
563#define UBLOX_VENDOR_ID 0x1546
563 564
564static const struct usb_device_id products[] = {565static const struct usb_device_id products[] = {
565/* BLACKLIST !!566/* BLACKLIST !!
@@ -868,6 +869,18 @@ static const struct usb_device_id products[] = { · 302 unmodified lines
868 USB_CDC_SUBCLASS_ETHERNET,869 USB_CDC_SUBCLASS_ETHERNET,
869 USB_CDC_PROTO_NONE),870 USB_CDC_PROTO_NONE),
870 .driver_info = (unsigned long)&zte_cdc_info,871 .driver_info = (unsigned long)&zte_cdc_info,
872}, {
873 /* U-blox TOBY-L2 */
874 USB_DEVICE_AND_INTERFACE_INFO(UBLOX_VENDOR_ID, 0x1143, USB_CLASS_COMM,
875 USB_CDC_SUBCLASS_ETHERNET,
876 USB_CDC_PROTO_NONE),
877 .driver_info = (unsigned long)&wwan_info,
878}, {
879 /* U-blox SARA-U2 */
880 USB_DEVICE_AND_INTERFACE_INFO(UBLOX_VENDOR_ID, 0x1104, USB_CLASS_COMM,
881 USB_CDC_SUBCLASS_ETHERNET,
882 USB_CDC_PROTO_NONE),
883 .driver_info = (unsigned long)&wwan_info,
871}, {884}, {
872 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,885 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
873 USB_CDC_PROTO_NONE),886 USB_CDC_PROTO_NONE),
drivers/nvme/host/core.c+1−1
@@ -2136,7 +2136,7 @@ static umode_t nvme_ns_attrs_are_visible(struct kobject *kobj, · 2135 unmodified lines
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 }
drivers/nvme/host/pci.c+7−7
@@ -94,7 +94,7 @@ struct nvme_dev { · 93 unmodified lines
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, · 1125 unmodified lines
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) · 294 unmodified lines
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) · 6 unmodified lines
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) · 6 unmodified lines
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}
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c+1−1
@@ -3767,7 +3767,7 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd) · 3766 unmodified lines
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,
drivers/scsi/libiscsi.c+4−4
@@ -2851,9 +2851,6 @@ EXPORT_SYMBOL_GPL(iscsi_session_setup); · 2850 unmodified lines
2851/**2851/**
2852 * iscsi_session_teardown - destroy session, host, and cls_session2852 * iscsi_session_teardown - destroy session, host, and cls_session
2853 * @cls_session: iscsi session2853 * @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) · 3 unmodified lines
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) · 8 unmodified lines
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}
drivers/scsi/scsi_scan.c+3−0
@@ -956,6 +956,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, · 955 unmodified lines
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)
drivers/scsi/scsi_transport_iscsi.c+0−16
@@ -2210,22 +2210,6 @@ void iscsi_free_session(struct iscsi_cls_session *session) · 2209 unmodified lines
2210}2210}
2211EXPORT_SYMBOL_GPL(iscsi_free_session);2211EXPORT_SYMBOL_GPL(iscsi_free_session);
2212 2212
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/**2213/**
2230 * iscsi_create_conn - create iscsi class connection2214 * iscsi_create_conn - create iscsi class connection
2231 * @session: iscsi cls session2215 * @session: iscsi cls session
drivers/scsi/sd.c+26−9
@@ -715,13 +715,21 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode) · 714 unmodified lines
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) · 2371 unmodified lines
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 deal3111 * 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) · 8 unmodified lines
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 writes3124 * Determine the device's preferred I/O size for reads and writes
3119 * unless the reported value is unreasonably small, large, or3125 * 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) · 7 unmodified lines
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);
fs/btrfs/ctree.h+1−1
@@ -722,7 +722,7 @@ struct btrfs_delayed_root; · 721 unmodified lines
722 * Indicate that a whole-filesystem exclusive operation is running722 * 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 14725#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];
fs/btrfs/extent_io.c+1−1
@@ -2801,7 +2801,7 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree, · 2800 unmodified lines
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;
fs/ceph/mds_client.c+6−5
@@ -734,12 +734,13 @@ static int __choose_mds(struct ceph_mds_client *mdsc, · 733 unmodified lines
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;
fs/ceph/snap.c+3−5
@@ -374,12 +374,10 @@ static int build_snap_context(struct ceph_snap_realm *realm, · 373 unmodified lines
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:
fs/namespace.c+3−1
@@ -468,7 +468,9 @@ static inline int may_write_real(struct file *file) · 467 unmodified lines
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... */
fs/nfs/client.c+1−1
@@ -218,7 +218,6 @@ static void nfs_cb_idr_remove_locked(struct nfs_client *clp) · 217 unmodified lines
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#else223#else
@@ -888,6 +887,7 @@ struct nfs_server *nfs_alloc_server(void) · 663 unmodified lines
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}
fs/nfs/filelayout/filelayout.c+2−1
@@ -745,7 +745,8 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg) · 744 unmodified lines
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;
fs/nfs/nfs4idmap.c+1−1
@@ -274,7 +274,7 @@ static struct key *nfs_idmap_request_key(const char *name, size_t namelen, · 273 unmodified lines
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, "");
fs/nfs/nfs4proc.c+1−2
@@ -8399,8 +8399,7 @@ nfs4_layoutget_handle_exception(struct rpc_task *task, · 8398 unmodified lines
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;
fs/nfs/nfs4xdr.c+2−2
@@ -1842,8 +1842,8 @@ static void encode_create_session(struct xdr_stream *xdr, · 1841 unmodified lines
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);
fs/overlayfs/copy_up.c+2−4
@@ -561,10 +561,8 @@ static int ovl_do_copy_up(struct ovl_copy_up_ctx *c) · 560 unmodified lines
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 }
fs/overlayfs/dir.c+0−20
@@ -216,26 +216,6 @@ out_unlock: · 215 unmodified lines
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{
fs/overlayfs/namei.c+1−0
@@ -506,6 +506,7 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry, · 505 unmodified lines
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,
fs/overlayfs/overlayfs.h+1−0
@@ -235,6 +235,7 @@ bool ovl_inuse_trylock(struct dentry *dentry); · 234 unmodified lines
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{
fs/overlayfs/ovl_entry.h+3−0
@@ -37,6 +37,9 @@ struct ovl_fs { · 36 unmodified lines
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 */
fs/overlayfs/readdir.c+4−2
@@ -988,6 +988,7 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, · 987 unmodified lines
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, · 13 unmodified lines
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, · 3 unmodified lines
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, · 5 unmodified lines
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);
fs/overlayfs/super.c+19−8
@@ -211,9 +211,10 @@ static void ovl_put_super(struct super_block *sb) · 210 unmodified lines
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) · 661 unmodified lines
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) · 11 unmodified lines
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: · 246 unmodified lines
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:
fs/overlayfs/util.c+23−1
@@ -430,7 +430,7 @@ void ovl_inuse_unlock(struct dentry *dentry) · 429 unmodified lines
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) · 32 unmodified lines
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) · 82 unmodified lines
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}
fs/xfs/xfs_bmap_util.c+22−2
@@ -2122,11 +2122,31 @@ xfs_swap_extents( · 2121 unmodified lines
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);
fs/xfs/xfs_reflink.c+8−1
@@ -736,7 +736,13 @@ xfs_reflink_end_cow( · 735 unmodified lines
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: · 66 unmodified lines
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:
include/linux/bpf.h+5−0
@@ -407,6 +407,11 @@ static inline void __bpf_prog_uncharge(struct user_struct *user, u32 pages) · 406 unmodified lines
407{407{
408}408}
409 409
410static inline int bpf_obj_get_user(const char __user *pathname)
411{
412 return -EOPNOTSUPP;
413}
414
410static inline struct net_device *__dev_map_lookup_elem(struct bpf_map *map,415static inline struct net_device *__dev_map_lookup_elem(struct bpf_map *map,
411 u32 key)416 u32 key)
412{417{
include/linux/mmc/host.h+1−1
@@ -316,7 +316,7 @@ struct mmc_host { · 315 unmodified lines
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 */
include/linux/netfilter_bridge/ebtables.h+4−3
@@ -108,9 +108,10 @@ struct ebt_table { · 107 unmodified lines
108 108
109#define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \109#define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \
110 ~(__alignof__(struct _xt_align)-1))110 ~(__alignof__(struct _xt_align)-1))
111extern struct ebt_table *ebt_register_table(struct net *net,111extern int ebt_register_table(struct net *net,
112 const struct ebt_table *table,112 const struct ebt_table *table,
113 const struct nf_hook_ops *);113 const struct nf_hook_ops *ops,
114 struct ebt_table **res);
114extern void ebt_unregister_table(struct net *net, struct ebt_table *table,115extern void ebt_unregister_table(struct net *net, struct ebt_table *table,
115 const struct nf_hook_ops *);116 const struct nf_hook_ops *);
116extern unsigned int ebt_do_table(struct sk_buff *skb,117extern unsigned int ebt_do_table(struct sk_buff *skb,
include/linux/nmi.h+62−59
@@ -12,11 +12,31 @@ · 11 unmodified lines
12 12
13#ifdef CONFIG_LOCKUP_DETECTOR13#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#else30#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#endif34
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_DETECTOR41#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); · 1 unmodified line
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#else47#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#endif52#endif
43 53
44#ifdef CONFIG_DETECT_HUNG_TASK54#ifdef CONFIG_DETECT_HUNG_TASK
45void reset_hung_task_detector(void);55void reset_hung_task_detector(void);
46#else56#else
47static inline void reset_hung_task_detector(void)57static inline void reset_hung_task_detector(void) { }
48{
49}
50#endif58#endif
51 59
52/*60/*
@@ -54,12 +62,12 @@ static inline void reset_hung_task_detector(void) · 1 unmodified line
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 parameters66 * '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'. The67 * 'interface' between the parameters in /proc/sys/kernel and the internal
60 * 'watchdog_thresh' variable is handled differently because its value is not68 * 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 072#define NMI_WATCHDOG_ENABLED_BIT 0
65#define SOFT_WATCHDOG_ENABLED_BIT 173#define SOFT_WATCHDOG_ENABLED_BIT 1
@@ -73,17 +81,41 @@ extern unsigned int hardlockup_panic; · 7 unmodified lines
73static inline void hardlockup_detector_disable(void) {}81static inline void hardlockup_detector_disable(void) {}
74#endif82#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#else98#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#endif110#endif
82#endif111
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 intentionally120 * 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) · 63 unmodified lines
153u64 hw_nmi_get_sample_period(int watchdog_thresh);185u64 hw_nmi_get_sample_period(int watchdog_thresh);
154#endif186#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); · 1 unmodified line
176static inline void watchdog_update_hrtimer_threshold(u64 period) { }192static inline void watchdog_update_hrtimer_threshold(u64 period) { }
177#endif193#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 , · 5 unmodified lines
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_NMI207#ifdef CONFIG_HAVE_ACPI_APEI_NMI
205#include <asm/nmi.h>208#include <asm/nmi.h>
include/linux/smpboot.h+2−2
@@ -55,7 +55,7 @@ smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread) · 54 unmodified lines
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#endif61#endif
include/scsi/scsi_device.h+1−0
@@ -192,6 +192,7 @@ struct scsi_device { · 191 unmodified lines
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
include/scsi/scsi_devinfo.h+1−0
@@ -29,5 +29,6 @@ · 28 unmodified lines
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#endif34#endif
include/scsi/scsi_transport_iscsi.h+0−1
@@ -434,7 +434,6 @@ extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost, · 433 unmodified lines
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);
include/uapi/linux/netfilter/xt_bpf.h+1−0
@@ -23,6 +23,7 @@ enum xt_bpf_modes { · 22 unmodified lines
23 XT_BPF_MODE_FD_PINNED,23 XT_BPF_MODE_FD_PINNED,
24 XT_BPF_MODE_FD_ELF,24 XT_BPF_MODE_FD_ELF,
25};25};
26#define XT_BPF_MODE_PATH_PINNED XT_BPF_MODE_FD_PINNED
26 27
27struct xt_bpf_info_v1 {28struct xt_bpf_info_v1 {
28 __u16 mode;29 __u16 mode;
kernel/bpf/inode.c+1−0
@@ -363,6 +363,7 @@ out: · 362 unmodified lines
363 putname(pname);363 putname(pname);
364 return ret;364 return ret;
365}365}
366EXPORT_SYMBOL_GPL(bpf_obj_get_user);
366 367
367static void bpf_evict_inode(struct inode *inode)368static void bpf_evict_inode(struct inode *inode)
368{369{
kernel/bpf/verifier.c+5−0
@@ -704,6 +704,10 @@ static void mark_reg_read(const struct bpf_verifier_state *state, u32 regno) · 703 unmodified lines
704{704{
705 struct bpf_verifier_state *parent = state->parent;705 struct bpf_verifier_state *parent = state->parent;
706 706
707 if (regno == BPF_REG_FP)
708 /* We don't need to worry about FP liveness because it's read-only */
709 return;
710
707 while (parent) {711 while (parent) {
708 /* if read wasn't screened by an earlier write ... */712 /* if read wasn't screened by an earlier write ... */
709 if (state->regs[regno].live & REG_LIVE_WRITTEN)713 if (state->regs[regno].live & REG_LIVE_WRITTEN)
@@ -2402,6 +2406,7 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) · 1692 unmodified lines
2402 * copy register state to dest reg2406 * copy register state to dest reg
2403 */2407 */
2404 regs[insn->dst_reg] = regs[insn->src_reg];2408 regs[insn->dst_reg] = regs[insn->src_reg];
2409 regs[insn->dst_reg].live |= REG_LIVE_WRITTEN;
2405 } else {2410 } else {
2406 /* R1 = (u32) R2 */2411 /* R1 = (u32) R2 */
2407 if (is_pointer_value(env, insn->src_reg)) {2412 if (is_pointer_value(env, insn->src_reg)) {
kernel/cpu.c+6−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
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, · 867 unmodified lines
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
kernel/smpboot.c+8−17
@@ -344,39 +344,30 @@ EXPORT_SYMBOL_GPL(smpboot_unregister_percpu_thread); · 343 unmodified lines
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
kernel/sysctl.c+9−13
@@ -872,9 +872,9 @@ static struct ctl_table kern_table[] = { · 871 unmodified lines
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[] = { · 9 unmodified lines
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[] = { · 5 unmodified lines
911#ifdef CONFIG_SOFTLOCKUP_DETECTOR907#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,
kernel/watchdog.c+238−405
@@ -29,20 +29,29 @@ · 28 unmodified lines
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#else37#else
41unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED;38# define WATCHDOG_DEFAULT (SOFT_WATCHDOG_ENABLED)
39# define NMI_WATCHDOG_DEFAULT 0
42#endif40#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_DETECTOR54#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 = · 7 unmodified lines
56 * kernel command line parameters are parsed, because otherwise it is not65 * 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) · 3 unmodified lines
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#endif87# 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 threads91{
96 * are registered/started and is set to 0 when the watchdog threads are92 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, it97#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 its100 * These functions can be overridden if an architecture implements its
@@ -121,36 +106,68 @@ int __read_mostly watchdog_suspended; · 5 unmodified lines
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 any119int __weak __init watchdog_nmi_probe(void)
132 * watchdog configuration change. The arch hardlockup watchdog should120{
133 * respond to the following variables:121 return hardlockup_detector_perf_init();
134 * - nmi_watchdog_enabled122}
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_thresh142 * - watchdog_thresh
136 * - watchdog_cpumask143 * - 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_DETECTOR164#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); · 7 unmodified lines
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_SMP205#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#endif214#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 generally220 * lockups can have false positives under extreme conditions. So we generally
@@ -278,11 +285,15 @@ void touch_all_softlockup_watchdogs(void) · 64 unmodified lines
278 int cpu;285 int cpu;
279 286
280 /*287 /*
281 * this is done lockless288 * 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 later290 * 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) · 33 unmodified lines
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) · 2 unmodified lines
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) · 107 unmodified lines
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) · 20 unmodified lines
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 = { · 7 unmodified lines
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 else563 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 or567 * 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_SYSCTL583 /*
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#endif623#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_SYSCTL654#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 parameter665 * 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'ed669 * proc_watchdog | watchdog_user_enabled | NMI_WATCHDOG_ENABLED |
751 * | | with SOFT_WATCHDOG_ENABLED670 * | | SOFT_WATCHDOG_ENABLED
752 * -------------------|-----------------------|-----------------------------671 * -------------------|----------------------------|--------------------------
753 * proc_nmi_watchdog | nmi_watchdog_enabled | NMI_WATCHDOG_ENABLED672 * proc_nmi_watchdog | nmi_watchdog_user_enabled | NMI_WATCHDOG_ENABLED
754 * -------------------|-----------------------|-----------------------------673 * -------------------|----------------------------|--------------------------
755 * proc_soft_watchdog | soft_watchdog_enabled | SOFT_WATCHDOG_ENABLED674 * 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, · 13 unmodified lines
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, · 14 unmodified lines
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, · 8 unmodified lines
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_FULL776#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) · 4 unmodified lines
951 cpumask_copy(&watchdog_cpumask, cpu_possible_mask);783 cpumask_copy(&watchdog_cpumask, cpu_possible_mask);
952#endif784#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}
kernel/watchdog_hld.c+111−85
@@ -21,8 +21,10 @@ · 20 unmodified lines
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 = { · 74 unmodified lines
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, · 42 unmodified lines
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}
net/bridge/netfilter/ebtable_broute.c+2−2
@@ -65,8 +65,8 @@ static int ebt_broute(struct sk_buff *skb) · 64 unmodified lines
65 65
66static int __net_init broute_net_init(struct net *net)66static int __net_init broute_net_init(struct net *net)
67{67{
68 net->xt.broute_table = ebt_register_table(net, &broute_table, NULL);68 return ebt_register_table(net, &broute_table, NULL,
69 return PTR_ERR_OR_ZERO(net->xt.broute_table);69 &net->xt.broute_table);
70}70}
71 71
72static void __net_exit broute_net_exit(struct net *net)72static void __net_exit broute_net_exit(struct net *net)
net/bridge/netfilter/ebtable_filter.c+2−2
@@ -93,8 +93,8 @@ static const struct nf_hook_ops ebt_ops_filter[] = { · 92 unmodified lines
93 93
94static int __net_init frame_filter_net_init(struct net *net)94static int __net_init frame_filter_net_init(struct net *net)
95{95{
96 net->xt.frame_filter = ebt_register_table(net, &frame_filter, ebt_ops_filter);96 return ebt_register_table(net, &frame_filter, ebt_ops_filter,
97 return PTR_ERR_OR_ZERO(net->xt.frame_filter);97 &net->xt.frame_filter);
98}98}
99 99
100static void __net_exit frame_filter_net_exit(struct net *net)100static void __net_exit frame_filter_net_exit(struct net *net)
net/bridge/netfilter/ebtable_nat.c+2−2
@@ -93,8 +93,8 @@ static const struct nf_hook_ops ebt_ops_nat[] = { · 92 unmodified lines
93 93
94static int __net_init frame_nat_net_init(struct net *net)94static int __net_init frame_nat_net_init(struct net *net)
95{95{
96 net->xt.frame_nat = ebt_register_table(net, &frame_nat, ebt_ops_nat);96 return ebt_register_table(net, &frame_nat, ebt_ops_nat,
97 return PTR_ERR_OR_ZERO(net->xt.frame_nat);97 &net->xt.frame_nat);
98}98}
99 99
100static void __net_exit frame_nat_net_exit(struct net *net)100static void __net_exit frame_nat_net_exit(struct net *net)
net/bridge/netfilter/ebtables.c+9−8
@@ -1169,9 +1169,8 @@ static void __ebt_unregister_table(struct net *net, struct ebt_table *table) · 1168 unmodified lines
1169 kfree(table);1169 kfree(table);
1170}1170}
1171 1171
1172struct ebt_table *1172int ebt_register_table(struct net *net, const struct ebt_table *input_table,
1173ebt_register_table(struct net *net, const struct ebt_table *input_table,1173 const struct nf_hook_ops *ops, struct ebt_table **res)
1174 const struct nf_hook_ops *ops)
1175{1174{
1176 struct ebt_table_info *newinfo;1175 struct ebt_table_info *newinfo;
1177 struct ebt_table *t, *table;1176 struct ebt_table *t, *table;
@@ -1183,7 +1182,7 @@ ebt_register_table(struct net *net, const struct ebt_table *input_table, · 5 unmodified lines
1183 repl->entries == NULL || repl->entries_size == 0 ||1182 repl->entries == NULL || repl->entries_size == 0 ||
1184 repl->counters != NULL || input_table->private != NULL) {1183 repl->counters != NULL || input_table->private != NULL) {
1185 BUGPRINT("Bad table data for ebt_register_table!!!\n");1184 BUGPRINT("Bad table data for ebt_register_table!!!\n");
1186 return ERR_PTR(-EINVAL);1185 return -EINVAL;
1187 }1186 }
1188 1187
1189 /* Don't add one table to multiple lists. */1188 /* Don't add one table to multiple lists. */
@@ -1252,16 +1251,18 @@ ebt_register_table(struct net *net, const struct ebt_table *input_table, · 62 unmodified lines
1252 list_add(&table->list, &net->xt.tables[NFPROTO_BRIDGE]);1251 list_add(&table->list, &net->xt.tables[NFPROTO_BRIDGE]);
1253 mutex_unlock(&ebt_mutex);1252 mutex_unlock(&ebt_mutex);
1254 1253
1254 WRITE_ONCE(*res, table);
1255
1255 if (!ops)1256 if (!ops)
1256 return table;1257 return 0;
1257 1258
1258 ret = nf_register_net_hooks(net, ops, hweight32(table->valid_hooks));1259 ret = nf_register_net_hooks(net, ops, hweight32(table->valid_hooks));
1259 if (ret) {1260 if (ret) {
1260 __ebt_unregister_table(net, table);1261 __ebt_unregister_table(net, table);
1261 return ERR_PTR(ret);1262 *res = NULL;
1262 }1263 }
1263 1264
1264 return table;1265 return ret;
1265free_unlock:1266free_unlock:
1266 mutex_unlock(&ebt_mutex);1267 mutex_unlock(&ebt_mutex);
1267free_chainstack:1268free_chainstack:
@@ -1276,7 +1277,7 @@ free_newinfo: · 8 unmodified lines
1276free_table:1277free_table:
1277 kfree(table);1278 kfree(table);
1278out:1279out:
1279 return ERR_PTR(ret);1280 return ret;
1280}1281}
1281 1282
1282void ebt_unregister_table(struct net *net, struct ebt_table *table,1283void ebt_unregister_table(struct net *net, struct ebt_table *table,
net/ipv4/gre_offload.c+1−1
@@ -86,7 +86,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, · 85 unmodified lines
86 greh = (struct gre_base_hdr *)skb_transport_header(skb);86 greh = (struct gre_base_hdr *)skb_transport_header(skb);
87 pcsum = (__sum16 *)(greh + 1);87 pcsum = (__sum16 *)(greh + 1);
88 88
89 if (gso_partial) {89 if (gso_partial && skb_is_gso(skb)) {
90 unsigned int partial_adj;90 unsigned int partial_adj;
91 91
92 /* Adjust checksum to account for the fact that92 /* Adjust checksum to account for the fact that
net/ipv4/netfilter/ipt_SYNPROXY.c+2−1
@@ -330,7 +330,8 @@ static unsigned int ipv4_synproxy_hook(void *priv, · 329 unmodified lines
330 if (synproxy == NULL)330 if (synproxy == NULL)
331 return NF_ACCEPT;331 return NF_ACCEPT;
332 332
333 if (nf_is_loopback_packet(skb))333 if (nf_is_loopback_packet(skb) ||
334 ip_hdr(skb)->protocol != IPPROTO_TCP)
334 return NF_ACCEPT;335 return NF_ACCEPT;
335 336
336 thoff = ip_hdrlen(skb);337 thoff = ip_hdrlen(skb);
net/ipv4/route.c+1−1
@@ -2513,7 +2513,7 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or · 2512 unmodified lines
2513 struct rtable *ort = (struct rtable *) dst_orig;2513 struct rtable *ort = (struct rtable *) dst_orig;
2514 struct rtable *rt;2514 struct rtable *rt;
2515 2515
2516 rt = dst_alloc(&ipv4_dst_blackhole_ops, NULL, 1, DST_OBSOLETE_NONE, 0);2516 rt = dst_alloc(&ipv4_dst_blackhole_ops, NULL, 1, DST_OBSOLETE_DEAD, 0);
2517 if (rt) {2517 if (rt) {
2518 struct dst_entry *new = &rt->dst;2518 struct dst_entry *new = &rt->dst;
2519 2519
net/ipv4/udp.c+5−9
@@ -2239,20 +2239,16 @@ int udp_v4_early_demux(struct sk_buff *skb) · 2238 unmodified lines
2239 iph = ip_hdr(skb);2239 iph = ip_hdr(skb);
2240 uh = udp_hdr(skb);2240 uh = udp_hdr(skb);
2241 2241
2242 if (skb->pkt_type == PACKET_BROADCAST ||2242 if (skb->pkt_type == PACKET_MULTICAST) {
2243 skb->pkt_type == PACKET_MULTICAST) {
2244 in_dev = __in_dev_get_rcu(skb->dev);2243 in_dev = __in_dev_get_rcu(skb->dev);
2245 2244
2246 if (!in_dev)2245 if (!in_dev)
2247 return 0;2246 return 0;
2248 2247
2249 /* we are supposed to accept bcast packets */2248 ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
2250 if (skb->pkt_type == PACKET_MULTICAST) {2249 iph->protocol);
2251 ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,2250 if (!ours)
2252 iph->protocol);2251 return 0;
2253 if (!ours)
2254 return 0;
2255 }
2256 2252
2257 sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr,2253 sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr,
2258 uh->source, iph->saddr,2254 uh->source, iph->saddr,
net/ipv4/udp_offload.c+1−1
@@ -120,7 +120,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb, · 119 unmodified lines
120 * will be using a length value equal to only one MSS sized120 * will be using a length value equal to only one MSS sized
121 * segment instead of the entire frame.121 * segment instead of the entire frame.
122 */122 */
123 if (gso_partial) {123 if (gso_partial && skb_is_gso(skb)) {
124 uh->len = htons(skb_shinfo(skb)->gso_size +124 uh->len = htons(skb_shinfo(skb)->gso_size +
125 SKB_GSO_CB(skb)->data_offset +125 SKB_GSO_CB(skb)->data_offset +
126 skb->head - (unsigned char *)uh);126 skb->head - (unsigned char *)uh);
net/ipv6/addrconf.c+2−2
@@ -3800,8 +3800,8 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp) · 3799 unmodified lines
3800 goto out;3800 goto out;
3801 3801
3802 if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) ||3802 if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) ||
3803 dev_net(dev)->ipv6.devconf_all->accept_dad < 1 ||3803 (dev_net(dev)->ipv6.devconf_all->accept_dad < 1 &&
3804 idev->cnf.accept_dad < 1 ||3804 idev->cnf.accept_dad < 1) ||
3805 !(ifp->flags&IFA_F_TENTATIVE) ||3805 !(ifp->flags&IFA_F_TENTATIVE) ||
3806 ifp->flags & IFA_F_NODAD) {3806 ifp->flags & IFA_F_NODAD) {
3807 bump_id = ifp->flags & IFA_F_TENTATIVE;3807 bump_id = ifp->flags & IFA_F_TENTATIVE;
net/ipv6/ip6_offload.c+1−1
@@ -105,7 +105,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, · 104 unmodified lines
105 105
106 for (skb = segs; skb; skb = skb->next) {106 for (skb = segs; skb; skb = skb->next) {
107 ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff);107 ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff);
108 if (gso_partial)108 if (gso_partial && skb_is_gso(skb))
109 payload_len = skb_shinfo(skb)->gso_size +109 payload_len = skb_shinfo(skb)->gso_size +
110 SKB_GSO_CB(skb)->data_offset +110 SKB_GSO_CB(skb)->data_offset +
111 skb->head - (unsigned char *)(ipv6h + 1);111 skb->head - (unsigned char *)(ipv6h + 1);
net/ipv6/netfilter/ip6t_SYNPROXY.c+1−1
@@ -353,7 +353,7 @@ static unsigned int ipv6_synproxy_hook(void *priv, · 352 unmodified lines
353 nexthdr = ipv6_hdr(skb)->nexthdr;353 nexthdr = ipv6_hdr(skb)->nexthdr;
354 thoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr,354 thoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr,
355 &frag_off);355 &frag_off);
356 if (thoff < 0)356 if (thoff < 0 || nexthdr != IPPROTO_TCP)
357 return NF_ACCEPT;357 return NF_ACCEPT;
358 358
359 th = skb_header_pointer(skb, thoff, sizeof(_th), &_th);359 th = skb_header_pointer(skb, thoff, sizeof(_th), &_th);
net/ipv6/route.c+1−1
@@ -1877,7 +1877,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori · 1876 unmodified lines
1877 struct dst_entry *new = NULL;1877 struct dst_entry *new = NULL;
1878 1878
1879 rt = dst_alloc(&ip6_dst_blackhole_ops, loopback_dev, 1,1879 rt = dst_alloc(&ip6_dst_blackhole_ops, loopback_dev, 1,
1880 DST_OBSOLETE_NONE, 0);1880 DST_OBSOLETE_DEAD, 0);
1881 if (rt) {1881 if (rt) {
1882 rt6_info_init(rt);1882 rt6_info_init(rt);
1883 atomic_inc(&net->ipv6.rt6_stats->fib_rt_alloc);1883 atomic_inc(&net->ipv6.rt6_stats->fib_rt_alloc);
net/netfilter/ipset/ip_set_core.c+18−11
@@ -1191,14 +1191,17 @@ static int ip_set_swap(struct net *net, struct sock *ctnl, struct sk_buff *skb, · 1190 unmodified lines
1191 from->family == to->family))1191 from->family == to->family))
1192 return -IPSET_ERR_TYPE_MISMATCH;1192 return -IPSET_ERR_TYPE_MISMATCH;
1193 1193
1194 if (from->ref_netlink || to->ref_netlink)1194 write_lock_bh(&ip_set_ref_lock);
1195
1196 if (from->ref_netlink || to->ref_netlink) {
1197 write_unlock_bh(&ip_set_ref_lock);
1195 return -EBUSY;1198 return -EBUSY;
1199 }
1196 1200
1197 strncpy(from_name, from->name, IPSET_MAXNAMELEN);1201 strncpy(from_name, from->name, IPSET_MAXNAMELEN);
1198 strncpy(from->name, to->name, IPSET_MAXNAMELEN);1202 strncpy(from->name, to->name, IPSET_MAXNAMELEN);
1199 strncpy(to->name, from_name, IPSET_MAXNAMELEN);1203 strncpy(to->name, from_name, IPSET_MAXNAMELEN);
1200 1204
1201 write_lock_bh(&ip_set_ref_lock);
1202 swap(from->ref, to->ref);1205 swap(from->ref, to->ref);
1203 ip_set(inst, from_id) = to;1206 ip_set(inst, from_id) = to;
1204 ip_set(inst, to_id) = from;1207 ip_set(inst, to_id) = from;
@@ -2072,25 +2075,28 @@ static struct pernet_operations ip_set_net_ops = { · 867 unmodified lines
2072static int __init2075static int __init
2073ip_set_init(void)2076ip_set_init(void)
2074{2077{
2075 int ret = nfnetlink_subsys_register(&ip_set_netlink_subsys);2078 int ret = register_pernet_subsys(&ip_set_net_ops);
2079
2080 if (ret) {
2081 pr_err("ip_set: cannot register pernet_subsys.\n");
2082 return ret;
2083 }
2076 2084
2085 ret = nfnetlink_subsys_register(&ip_set_netlink_subsys);
2077 if (ret != 0) {2086 if (ret != 0) {
2078 pr_err("ip_set: cannot register with nfnetlink.\n");2087 pr_err("ip_set: cannot register with nfnetlink.\n");
2088 unregister_pernet_subsys(&ip_set_net_ops);
2079 return ret;2089 return ret;
2080 }2090 }
2091
2081 ret = nf_register_sockopt(&so_set);2092 ret = nf_register_sockopt(&so_set);
2082 if (ret != 0) {2093 if (ret != 0) {
2083 pr_err("SO_SET registry failed: %d\n", ret);2094 pr_err("SO_SET registry failed: %d\n", ret);
2084 nfnetlink_subsys_unregister(&ip_set_netlink_subsys);2095 nfnetlink_subsys_unregister(&ip_set_netlink_subsys);
2096 unregister_pernet_subsys(&ip_set_net_ops);
2085 return ret;2097 return ret;
2086 }2098 }
2087 ret = register_pernet_subsys(&ip_set_net_ops);2099
2088 if (ret) {
2089 pr_err("ip_set: cannot register pernet_subsys.\n");
2090 nf_unregister_sockopt(&so_set);
2091 nfnetlink_subsys_unregister(&ip_set_netlink_subsys);
2092 return ret;
2093 }
2094 pr_info("ip_set: protocol %u\n", IPSET_PROTOCOL);2100 pr_info("ip_set: protocol %u\n", IPSET_PROTOCOL);
2095 return 0;2101 return 0;
2096}2102}
@@ -2098,9 +2104,10 @@ ip_set_init(void) · 1 unmodified line
2098static void __exit2104static void __exit
2099ip_set_fini(void)2105ip_set_fini(void)
2100{2106{
2101 unregister_pernet_subsys(&ip_set_net_ops);
2102 nf_unregister_sockopt(&so_set);2107 nf_unregister_sockopt(&so_set);
2103 nfnetlink_subsys_unregister(&ip_set_netlink_subsys);2108 nfnetlink_subsys_unregister(&ip_set_netlink_subsys);
2109
2110 unregister_pernet_subsys(&ip_set_net_ops);
2104 pr_debug("these are the famous last words\n");2111 pr_debug("these are the famous last words\n");
2105}2112}
2106 2113
net/netfilter/ipset/ip_set_hash_ip.c+12−10
@@ -123,13 +123,12 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], · 122 unmodified lines
123 return ret;123 return ret;
124 124
125 ip &= ip_set_hostmask(h->netmask);125 ip &= ip_set_hostmask(h->netmask);
126 e.ip = htonl(ip);
127 if (e.ip == 0)
128 return -IPSET_ERR_HASH_ELEM;
126 129
127 if (adt == IPSET_TEST) {130 if (adt == IPSET_TEST)
128 e.ip = htonl(ip);
129 if (e.ip == 0)
130 return -IPSET_ERR_HASH_ELEM;
131 return adtfn(set, &e, &ext, &ext, flags);131 return adtfn(set, &e, &ext, &ext, flags);
132 }
133 132
134 ip_to = ip;133 ip_to = ip;
135 if (tb[IPSET_ATTR_IP_TO]) {134 if (tb[IPSET_ATTR_IP_TO]) {
@@ -148,17 +147,20 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], · 12 unmodified lines
148 147
149 hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1);148 hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1);
150 149
151 if (retried)150 if (retried) {
152 ip = ntohl(h->next.ip);151 ip = ntohl(h->next.ip);
153 for (; !before(ip_to, ip); ip += hosts) {
154 e.ip = htonl(ip);152 e.ip = htonl(ip);
155 if (e.ip == 0)153 }
156 return -IPSET_ERR_HASH_ELEM;154 for (; ip <= ip_to;) {
157 ret = adtfn(set, &e, &ext, &ext, flags);155 ret = adtfn(set, &e, &ext, &ext, flags);
158
159 if (ret && !ip_set_eexist(ret, flags))156 if (ret && !ip_set_eexist(ret, flags))
160 return ret;157 return ret;
161 158
159 ip += hosts;
160 e.ip = htonl(ip);
161 if (e.ip == 0)
162 return 0;
163
162 ret = 0;164 ret = 0;
163 }165 }
164 return ret;166 return ret;
net/netfilter/ipset/ip_set_hash_ipmark.c+1−1
@@ -149,7 +149,7 @@ hash_ipmark4_uadt(struct ip_set *set, struct nlattr *tb[], · 148 unmodified lines
149 149
150 if (retried)150 if (retried)
151 ip = ntohl(h->next.ip);151 ip = ntohl(h->next.ip);
152 for (; !before(ip_to, ip); ip++) {152 for (; ip <= ip_to; ip++) {
153 e.ip = htonl(ip);153 e.ip = htonl(ip);
154 ret = adtfn(set, &e, &ext, &ext, flags);154 ret = adtfn(set, &e, &ext, &ext, flags);
155 155
net/netfilter/ipset/ip_set_hash_ipport.c+1−1
@@ -178,7 +178,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], · 177 unmodified lines
178 178
179 if (retried)179 if (retried)
180 ip = ntohl(h->next.ip);180 ip = ntohl(h->next.ip);
181 for (; !before(ip_to, ip); ip++) {181 for (; ip <= ip_to; ip++) {
182 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)182 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
183 : port;183 : port;
184 for (; p <= port_to; p++) {184 for (; p <= port_to; p++) {
net/netfilter/ipset/ip_set_hash_ipportip.c+1−1
@@ -185,7 +185,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], · 184 unmodified lines
185 185
186 if (retried)186 if (retried)
187 ip = ntohl(h->next.ip);187 ip = ntohl(h->next.ip);
188 for (; !before(ip_to, ip); ip++) {188 for (; ip <= ip_to; ip++) {
189 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)189 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
190 : port;190 : port;
191 for (; p <= port_to; p++) {191 for (; p <= port_to; p++) {
net/netfilter/ipset/ip_set_hash_ipportnet.c+2−2
@@ -271,7 +271,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 270 unmodified lines
271 271
272 if (retried)272 if (retried)
273 ip = ntohl(h->next.ip);273 ip = ntohl(h->next.ip);
274 for (; !before(ip_to, ip); ip++) {274 for (; ip <= ip_to; ip++) {
275 e.ip = htonl(ip);275 e.ip = htonl(ip);
276 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)276 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
277 : port;277 : port;
@@ -281,7 +281,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 3 unmodified lines
281 ip == ntohl(h->next.ip) &&281 ip == ntohl(h->next.ip) &&
282 p == ntohs(h->next.port)282 p == ntohs(h->next.port)
283 ? ntohl(h->next.ip2) : ip2_from;283 ? ntohl(h->next.ip2) : ip2_from;
284 while (!after(ip2, ip2_to)) {284 while (ip2 <= ip2_to) {
285 e.ip2 = htonl(ip2);285 e.ip2 = htonl(ip2);
286 ip2_last = ip_set_range_to_cidr(ip2, ip2_to,286 ip2_last = ip_set_range_to_cidr(ip2, ip2_to,
287 &cidr);287 &cidr);
net/netfilter/ipset/ip_set_hash_net.c+1−1
@@ -193,7 +193,7 @@ hash_net4_uadt(struct ip_set *set, struct nlattr *tb[], · 192 unmodified lines
193 }193 }
194 if (retried)194 if (retried)
195 ip = ntohl(h->next.ip);195 ip = ntohl(h->next.ip);
196 while (!after(ip, ip_to)) {196 while (ip <= ip_to) {
197 e.ip = htonl(ip);197 e.ip = htonl(ip);
198 last = ip_set_range_to_cidr(ip, ip_to, &e.cidr);198 last = ip_set_range_to_cidr(ip, ip_to, &e.cidr);
199 ret = adtfn(set, &e, &ext, &ext, flags);199 ret = adtfn(set, &e, &ext, &ext, flags);
net/netfilter/ipset/ip_set_hash_netiface.c+1−1
@@ -255,7 +255,7 @@ hash_netiface4_uadt(struct ip_set *set, struct nlattr *tb[], · 254 unmodified lines
255 255
256 if (retried)256 if (retried)
257 ip = ntohl(h->next.ip);257 ip = ntohl(h->next.ip);
258 while (!after(ip, ip_to)) {258 while (ip <= ip_to) {
259 e.ip = htonl(ip);259 e.ip = htonl(ip);
260 last = ip_set_range_to_cidr(ip, ip_to, &e.cidr);260 last = ip_set_range_to_cidr(ip, ip_to, &e.cidr);
261 ret = adtfn(set, &e, &ext, &ext, flags);261 ret = adtfn(set, &e, &ext, &ext, flags);
net/netfilter/ipset/ip_set_hash_netnet.c+2−2
@@ -250,13 +250,13 @@ hash_netnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 249 unmodified lines
250 if (retried)250 if (retried)
251 ip = ntohl(h->next.ip[0]);251 ip = ntohl(h->next.ip[0]);
252 252
253 while (!after(ip, ip_to)) {253 while (ip <= ip_to) {
254 e.ip[0] = htonl(ip);254 e.ip[0] = htonl(ip);
255 last = ip_set_range_to_cidr(ip, ip_to, &e.cidr[0]);255 last = ip_set_range_to_cidr(ip, ip_to, &e.cidr[0]);
256 ip2 = (retried &&256 ip2 = (retried &&
257 ip == ntohl(h->next.ip[0])) ? ntohl(h->next.ip[1])257 ip == ntohl(h->next.ip[0])) ? ntohl(h->next.ip[1])
258 : ip2_from;258 : ip2_from;
259 while (!after(ip2, ip2_to)) {259 while (ip2 <= ip2_to) {
260 e.ip[1] = htonl(ip2);260 e.ip[1] = htonl(ip2);
261 last2 = ip_set_range_to_cidr(ip2, ip2_to, &e.cidr[1]);261 last2 = ip_set_range_to_cidr(ip2, ip2_to, &e.cidr[1]);
262 ret = adtfn(set, &e, &ext, &ext, flags);262 ret = adtfn(set, &e, &ext, &ext, flags);
net/netfilter/ipset/ip_set_hash_netport.c+1−1
@@ -241,7 +241,7 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *tb[], · 240 unmodified lines
241 241
242 if (retried)242 if (retried)
243 ip = ntohl(h->next.ip);243 ip = ntohl(h->next.ip);
244 while (!after(ip, ip_to)) {244 while (ip <= ip_to) {
245 e.ip = htonl(ip);245 e.ip = htonl(ip);
246 last = ip_set_range_to_cidr(ip, ip_to, &cidr);246 last = ip_set_range_to_cidr(ip, ip_to, &cidr);
247 e.cidr = cidr - 1;247 e.cidr = cidr - 1;
net/netfilter/ipset/ip_set_hash_netportnet.c+2−2
@@ -291,7 +291,7 @@ hash_netportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 290 unmodified lines
291 if (retried)291 if (retried)
292 ip = ntohl(h->next.ip[0]);292 ip = ntohl(h->next.ip[0]);
293 293
294 while (!after(ip, ip_to)) {294 while (ip <= ip_to) {
295 e.ip[0] = htonl(ip);295 e.ip[0] = htonl(ip);
296 ip_last = ip_set_range_to_cidr(ip, ip_to, &e.cidr[0]);296 ip_last = ip_set_range_to_cidr(ip, ip_to, &e.cidr[0]);
297 p = retried && ip == ntohl(h->next.ip[0]) ? ntohs(h->next.port)297 p = retried && ip == ntohl(h->next.ip[0]) ? ntohs(h->next.port)
@@ -301,7 +301,7 @@ hash_netportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 3 unmodified lines
301 ip2 = (retried && ip == ntohl(h->next.ip[0]) &&301 ip2 = (retried && ip == ntohl(h->next.ip[0]) &&
302 p == ntohs(h->next.port)) ? ntohl(h->next.ip[1])302 p == ntohs(h->next.port)) ? ntohl(h->next.ip[1])
303 : ip2_from;303 : ip2_from;
304 while (!after(ip2, ip2_to)) {304 while (ip2 <= ip2_to) {
305 e.ip[1] = htonl(ip2);305 e.ip[1] = htonl(ip2);
306 ip2_last = ip_set_range_to_cidr(ip2, ip2_to,306 ip2_last = ip_set_range_to_cidr(ip2, ip2_to,
307 &e.cidr[1]);307 &e.cidr[1]);
net/netfilter/ipvs/ip_vs_xmit.c+6−2
@@ -921,6 +921,7 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, · 920 unmodified lines
921{921{
922 struct sk_buff *new_skb = NULL;922 struct sk_buff *new_skb = NULL;
923 struct iphdr *old_iph = NULL;923 struct iphdr *old_iph = NULL;
924 __u8 old_dsfield;
924#ifdef CONFIG_IP_VS_IPV6925#ifdef CONFIG_IP_VS_IPV6
925 struct ipv6hdr *old_ipv6h = NULL;926 struct ipv6hdr *old_ipv6h = NULL;
926#endif927#endif
@@ -945,7 +946,7 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, · 18 unmodified lines
945 *payload_len =946 *payload_len =
946 ntohs(old_ipv6h->payload_len) +947 ntohs(old_ipv6h->payload_len) +
947 sizeof(*old_ipv6h);948 sizeof(*old_ipv6h);
948 *dsfield = ipv6_get_dsfield(old_ipv6h);949 old_dsfield = ipv6_get_dsfield(old_ipv6h);
949 *ttl = old_ipv6h->hop_limit;950 *ttl = old_ipv6h->hop_limit;
950 if (df)951 if (df)
951 *df = 0;952 *df = 0;
@@ -960,12 +961,15 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, · 8 unmodified lines
960 961
961 /* fix old IP header checksum */962 /* fix old IP header checksum */
962 ip_send_check(old_iph);963 ip_send_check(old_iph);
963 *dsfield = ipv4_get_dsfield(old_iph);964 old_dsfield = ipv4_get_dsfield(old_iph);
964 *ttl = old_iph->ttl;965 *ttl = old_iph->ttl;
965 if (payload_len)966 if (payload_len)
966 *payload_len = ntohs(old_iph->tot_len);967 *payload_len = ntohs(old_iph->tot_len);
967 }968 }
968 969
970 /* Implement full-functionality option for ECN encapsulation */
971 *dsfield = INET_ECN_encapsulate(old_dsfield, old_dsfield);
972
969 return skb;973 return skb;
970error:974error:
971 kfree_skb(skb);975 kfree_skb(skb);
net/netfilter/nf_tables_api.c+6−4
@@ -1048,7 +1048,7 @@ static int nf_tables_fill_chain_info(struct sk_buff *skb, struct net *net, · 1047 unmodified lines
1048 if (nla_put_string(skb, NFTA_CHAIN_TYPE, basechain->type->name))1048 if (nla_put_string(skb, NFTA_CHAIN_TYPE, basechain->type->name))
1049 goto nla_put_failure;1049 goto nla_put_failure;
1050 1050
1051 if (nft_dump_stats(skb, nft_base_chain(chain)->stats))1051 if (basechain->stats && nft_dump_stats(skb, basechain->stats))
1052 goto nla_put_failure;1052 goto nla_put_failure;
1053 }1053 }
1054 1054
@@ -1487,8 +1487,8 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy, · 432 unmodified lines
1487 1487
1488 chain2 = nf_tables_chain_lookup(table, nla[NFTA_CHAIN_NAME],1488 chain2 = nf_tables_chain_lookup(table, nla[NFTA_CHAIN_NAME],
1489 genmask);1489 genmask);
1490 if (IS_ERR(chain2))1490 if (!IS_ERR(chain2))
1491 return PTR_ERR(chain2);1491 return -EEXIST;
1492 }1492 }
1493 1493
1494 if (nla[NFTA_CHAIN_COUNTERS]) {1494 if (nla[NFTA_CHAIN_COUNTERS]) {
@@ -2741,8 +2741,10 @@ cont: · 1246 unmodified lines
2741 list_for_each_entry(i, &ctx->table->sets, list) {2741 list_for_each_entry(i, &ctx->table->sets, list) {
2742 if (!nft_is_active_next(ctx->net, i))2742 if (!nft_is_active_next(ctx->net, i))
2743 continue;2743 continue;
2744 if (!strcmp(set->name, i->name))2744 if (!strcmp(set->name, i->name)) {
2745 kfree(set->name);
2745 return -ENFILE;2746 return -ENFILE;
2747 }
2746 }2748 }
2747 return 0;2749 return 0;
2748}2750}
net/netfilter/x_tables.c+2−2
@@ -892,7 +892,7 @@ void *xt_copy_counters_from_user(const void __user *user, unsigned int len, · 891 unmodified lines
892 if (copy_from_user(&compat_tmp, user, sizeof(compat_tmp)) != 0)892 if (copy_from_user(&compat_tmp, user, sizeof(compat_tmp)) != 0)
893 return ERR_PTR(-EFAULT);893 return ERR_PTR(-EFAULT);
894 894
895 strlcpy(info->name, compat_tmp.name, sizeof(info->name));895 memcpy(info->name, compat_tmp.name, sizeof(info->name) - 1);
896 info->num_counters = compat_tmp.num_counters;896 info->num_counters = compat_tmp.num_counters;
897 user += sizeof(compat_tmp);897 user += sizeof(compat_tmp);
898 } else898 } else
@@ -905,9 +905,9 @@ void *xt_copy_counters_from_user(const void __user *user, unsigned int len, · 6 unmodified lines
905 if (copy_from_user(info, user, sizeof(*info)) != 0)905 if (copy_from_user(info, user, sizeof(*info)) != 0)
906 return ERR_PTR(-EFAULT);906 return ERR_PTR(-EFAULT);
907 907
908 info->name[sizeof(info->name) - 1] = '\0';
909 user += sizeof(*info);908 user += sizeof(*info);
910 }909 }
910 info->name[sizeof(info->name) - 1] = '\0';
911 911
912 size = sizeof(struct xt_counters);912 size = sizeof(struct xt_counters);
913 size *= info->num_counters;913 size *= info->num_counters;
net/netfilter/xt_bpf.c+20−2
@@ -8,6 +8,7 @@ · 7 unmodified lines
8 */8 */
9 9
10#include <linux/module.h>10#include <linux/module.h>
11#include <linux/syscalls.h>
11#include <linux/skbuff.h>12#include <linux/skbuff.h>
12#include <linux/filter.h>13#include <linux/filter.h>
13#include <linux/bpf.h>14#include <linux/bpf.h>
@@ -49,6 +50,22 @@ static int __bpf_mt_check_fd(int fd, struct bpf_prog **ret) · 35 unmodified lines
49 return 0;50 return 0;
50}51}
51 52
53static int __bpf_mt_check_path(const char *path, struct bpf_prog **ret)
54{
55 mm_segment_t oldfs = get_fs();
56 int retval, fd;
57
58 set_fs(KERNEL_DS);
59 fd = bpf_obj_get_user(path);
60 set_fs(oldfs);
61 if (fd < 0)
62 return fd;
63
64 retval = __bpf_mt_check_fd(fd, ret);
65 sys_close(fd);
66 return retval;
67}
68
52static int bpf_mt_check(const struct xt_mtchk_param *par)69static int bpf_mt_check(const struct xt_mtchk_param *par)
53{70{
54 struct xt_bpf_info *info = par->matchinfo;71 struct xt_bpf_info *info = par->matchinfo;
@@ -66,9 +83,10 @@ static int bpf_mt_check_v1(const struct xt_mtchk_param *par) · 11 unmodified lines
66 return __bpf_mt_check_bytecode(info->bpf_program,83 return __bpf_mt_check_bytecode(info->bpf_program,
67 info->bpf_program_num_elem,84 info->bpf_program_num_elem,
68 &info->filter);85 &info->filter);
69 else if (info->mode == XT_BPF_MODE_FD_PINNED ||86 else if (info->mode == XT_BPF_MODE_FD_ELF)
70 info->mode == XT_BPF_MODE_FD_ELF)
71 return __bpf_mt_check_fd(info->fd, &info->filter);87 return __bpf_mt_check_fd(info->fd, &info->filter);
88 else if (info->mode == XT_BPF_MODE_PATH_PINNED)
89 return __bpf_mt_check_path(info->path, &info->filter);
72 else90 else
73 return -EINVAL;91 return -EINVAL;
74}92}
net/netfilter/xt_socket.c+2−2
@@ -76,7 +76,7 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, · 75 unmodified lines
76 transparent = nf_sk_is_transparent(sk);76 transparent = nf_sk_is_transparent(sk);
77 77
78 if (info->flags & XT_SOCKET_RESTORESKMARK && !wildcard &&78 if (info->flags & XT_SOCKET_RESTORESKMARK && !wildcard &&
79 transparent)79 transparent && sk_fullsock(sk))
80 pskb->mark = sk->sk_mark;80 pskb->mark = sk->sk_mark;
81 81
82 if (sk != skb->sk)82 if (sk != skb->sk)
@@ -133,7 +133,7 @@ socket_mt6_v1_v2_v3(const struct sk_buff *skb, struct xt_action_param *par) · 50 unmodified lines
133 transparent = nf_sk_is_transparent(sk);133 transparent = nf_sk_is_transparent(sk);
134 134
135 if (info->flags & XT_SOCKET_RESTORESKMARK && !wildcard &&135 if (info->flags & XT_SOCKET_RESTORESKMARK && !wildcard &&
136 transparent)136 transparent && sk_fullsock(sk))
137 pskb->mark = sk->sk_mark;137 pskb->mark = sk->sk_mark;
138 138
139 if (sk != skb->sk)139 if (sk != skb->sk)
net/netlink/af_netlink.c+7−6
@@ -2266,16 +2266,17 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, · 2265 unmodified lines
2266 cb->min_dump_alloc = control->min_dump_alloc;2266 cb->min_dump_alloc = control->min_dump_alloc;
2267 cb->skb = skb;2267 cb->skb = skb;
2268 2268
2269 if (cb->start) {
2270 ret = cb->start(cb);
2271 if (ret)
2272 goto error_unlock;
2273 }
2274
2269 nlk->cb_running = true;2275 nlk->cb_running = true;
2270 2276
2271 mutex_unlock(nlk->cb_mutex);2277 mutex_unlock(nlk->cb_mutex);
2272 2278
2273 ret = 0;2279 ret = netlink_dump(sk);
2274 if (cb->start)
2275 ret = cb->start(cb);
2276
2277 if (!ret)
2278 ret = netlink_dump(sk);
2279 2280
2280 sock_put(sk);2281 sock_put(sk);
2281 2282
net/sunrpc/xprtsock.c+1−1
@@ -2203,7 +2203,7 @@ static void xs_udp_setup_socket(struct work_struct *work) · 2202 unmodified lines
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,
net/tipc/bcast.c+2−2
@@ -233,7 +233,7 @@ static int tipc_bcast_xmit(struct net *net, struct sk_buff_head *pkts, · 232 unmodified lines
233 struct sk_buff_head xmitq;233 struct sk_buff_head xmitq;
234 int rc = 0;234 int rc = 0;
235 235
236 __skb_queue_head_init(&xmitq);236 skb_queue_head_init(&xmitq);
237 tipc_bcast_lock(net);237 tipc_bcast_lock(net);
238 if (tipc_link_bc_peers(l))238 if (tipc_link_bc_peers(l))
239 rc = tipc_link_xmit(l, pkts, &xmitq);239 rc = tipc_link_xmit(l, pkts, &xmitq);
@@ -263,7 +263,7 @@ static int tipc_rcast_xmit(struct net *net, struct sk_buff_head *pkts, · 23 unmodified lines
263 u32 dst, selector;263 u32 dst, selector;
264 264
265 selector = msg_link_selector(buf_msg(skb_peek(pkts)));265 selector = msg_link_selector(buf_msg(skb_peek(pkts)));
266 __skb_queue_head_init(&_pkts);266 skb_queue_head_init(&_pkts);
267 267
268 list_for_each_entry_safe(n, tmp, &dests->list, list) {268 list_for_each_entry_safe(n, tmp, &dests->list, list) {
269 dst = n->value;269 dst = n->value;
net/tipc/msg.c+8−0
@@ -568,6 +568,14 @@ bool tipc_msg_lookup_dest(struct net *net, struct sk_buff *skb, int *err) · 567 unmodified lines
568 msg_set_destnode(msg, dnode);568 msg_set_destnode(msg, dnode);
569 msg_set_destport(msg, dport);569 msg_set_destport(msg, dport);
570 *err = TIPC_OK;570 *err = TIPC_OK;
571
572 if (!skb_cloned(skb))
573 return true;
574
575 /* Unclone buffer in case it was bundled */
576 if (pskb_expand_head(skb, BUF_HEADROOM, BUF_TAILROOM, GFP_ATOMIC))
577 return false;
578
571 return true;579 return true;
572}580}
573 581
net/wireless/nl80211.c+12−2
@@ -549,6 +549,14 @@ nl80211_nan_srf_policy[NL80211_NAN_SRF_ATTR_MAX + 1] = { · 548 unmodified lines
549 [NL80211_NAN_SRF_MAC_ADDRS] = { .type = NLA_NESTED },549 [NL80211_NAN_SRF_MAC_ADDRS] = { .type = NLA_NESTED },
550};550};
551 551
552/* policy for packet pattern attributes */
553static const struct nla_policy
554nl80211_packet_pattern_policy[MAX_NL80211_PKTPAT + 1] = {
555 [NL80211_PKTPAT_MASK] = { .type = NLA_BINARY, },
556 [NL80211_PKTPAT_PATTERN] = { .type = NLA_BINARY, },
557 [NL80211_PKTPAT_OFFSET] = { .type = NLA_U32 },
558};
559
552static int nl80211_prepare_wdev_dump(struct sk_buff *skb,560static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
553 struct netlink_callback *cb,561 struct netlink_callback *cb,
554 struct cfg80211_registered_device **rdev,562 struct cfg80211_registered_device **rdev,
@@ -10532,7 +10540,8 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) · 9977 unmodified lines
10532 u8 *mask_pat;10540 u8 *mask_pat;
10533 10541
10534 nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,10542 nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
10535 NULL, info->extack);10543 nl80211_packet_pattern_policy,
10544 info->extack);
10536 err = -EINVAL;10545 err = -EINVAL;
10537 if (!pat_tb[NL80211_PKTPAT_MASK] ||10546 if (!pat_tb[NL80211_PKTPAT_MASK] ||
10538 !pat_tb[NL80211_PKTPAT_PATTERN])10547 !pat_tb[NL80211_PKTPAT_PATTERN])
@@ -10781,7 +10790,8 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev, · 242 unmodified lines
10781 rem) {10790 rem) {
10782 u8 *mask_pat;10791 u8 *mask_pat;
10783 10792
10784 nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, NULL, NULL);10793 nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
10794 nl80211_packet_pattern_policy, NULL);
10785 if (!pat_tb[NL80211_PKTPAT_MASK] ||10795 if (!pat_tb[NL80211_PKTPAT_MASK] ||
10786 !pat_tb[NL80211_PKTPAT_PATTERN])10796 !pat_tb[NL80211_PKTPAT_PATTERN])
10787 return -EINVAL;10797 return -EINVAL;
net/xfrm/xfrm_device.c+1−0
@@ -91,6 +91,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, · 90 unmodified lines
91 }91 }
92 92
93 if (!dev->xfrmdev_ops || !dev->xfrmdev_ops->xdo_dev_state_add) {93 if (!dev->xfrmdev_ops || !dev->xfrmdev_ops->xdo_dev_state_add) {
94 xso->dev = NULL;
94 dev_put(dev);95 dev_put(dev);
95 return 0;96 return 0;
96 }97 }
net/xfrm/xfrm_input.c+4−2
@@ -429,7 +429,8 @@ resume: · 428 unmodified lines
429 nf_reset(skb);429 nf_reset(skb);
430 430
431 if (decaps) {431 if (decaps) {
432 skb->sp->olen = 0;432 if (skb->sp)
433 skb->sp->olen = 0;
433 skb_dst_drop(skb);434 skb_dst_drop(skb);
434 gro_cells_receive(&gro_cells, skb);435 gro_cells_receive(&gro_cells, skb);
435 return 0;436 return 0;
@@ -440,7 +441,8 @@ resume: · 4 unmodified lines
440 441
441 err = x->inner_mode->afinfo->transport_finish(skb, xfrm_gro || async);442 err = x->inner_mode->afinfo->transport_finish(skb, xfrm_gro || async);
442 if (xfrm_gro) {443 if (xfrm_gro) {
443 skb->sp->olen = 0;444 if (skb->sp)
445 skb->sp->olen = 0;
444 skb_dst_drop(skb);446 skb_dst_drop(skb);
445 gro_cells_receive(&gro_cells, skb);447 gro_cells_receive(&gro_cells, skb);
446 return err;448 return err;
net/xfrm/xfrm_state.c+2−2
@@ -732,12 +732,12 @@ restart: · 731 unmodified lines
732 }732 }
733 }733 }
734 }734 }
735out:
736 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
735 if (cnt) {737 if (cnt) {
736 err = 0;738 err = 0;
737 xfrm_policy_cache_flush();739 xfrm_policy_cache_flush();
738 }740 }
739out:
740 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
741 return err;741 return err;
742}742}
743EXPORT_SYMBOL(xfrm_state_flush);743EXPORT_SYMBOL(xfrm_state_flush);
net/xfrm/xfrm_user.c+1−0
@@ -657,6 +657,7 @@ static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh, · 656 unmodified lines
657 657
658 if (err < 0) {658 if (err < 0) {
659 x->km.state = XFRM_STATE_DEAD;659 x->km.state = XFRM_STATE_DEAD;
660 xfrm_dev_state_delete(x);
660 __xfrm_state_put(x);661 __xfrm_state_put(x);
661 goto out;662 goto out;
662 }663 }
tools/testing/selftests/networking/timestamping/rxtimestamp.c+1−1
@@ -341,7 +341,7 @@ int main(int argc, char **argv) · 340 unmodified lines
341 return 0;341 return 0;
342 case 'n':342 case 'n':
343 t = atoi(optarg);343 t = atoi(optarg);
344 if (t > ARRAY_SIZE(test_cases))344 if (t >= ARRAY_SIZE(test_cases))
345 error(1, 0, "Invalid test case: %d", t);345 error(1, 0, "Invalid test case: %d", t);
346 all_tests = false;346 all_tests = false;
347 test_cases[t].enabled = true;347 test_cases[t].enabled = true;