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
1616
1717 - clocks:
1818 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.
2021
2122 - clock-names:
2223 Array of names corresponding to clocks property.
2324 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".
2426
2527 - reg:
2628 * For "marvell,armada-3700-sdhci", two register areas.
@@ -106,8 +108,8 @@ Example: · 79 unmodified lines
106108 compatible = "marvell,armada-ap806-sdhci";
107109 reg = <0xaa0000 0x1000>;
108110 interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>
109− clocks = <&emmc_clk>;
110− clock-names = "core";
111+ clocks = <&emmc_clk>,<&axi_clk>;
112+ clock-names = "core", "axi";
111113 bus-width = <4>;
112114 marvell,xenon-phy-slow-mode;
113115 marvell,xenon-tun-count = <11>;
@@ -126,8 +128,8 @@ Example: · 12 unmodified lines
126128 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>
127129 vqmmc-supply = <&sd_vqmmc_regulator>;
128130 vmmc-supply = <&sd_vmmc_regulator>;
129− clocks = <&sdclk>;
130− clock-names = "core";
131+ clocks = <&sdclk>, <&axi_clk>;
132+ clock-names = "core", "axi";
131133 bus-width = <4>;
132134 marvell,xenon-tun-count = <9>;
133135 };
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
210210 beneath or above the path of another overlay lower layer path.
211211
212212 Using an upper layer path and/or a workdir path that are already used by
213−another overlay mount is not allowed and will fail with EBUSY. Using
213+another overlay mount is not allowed and may fail with EBUSY. Using
214214 partially overlapping paths is not allowed but will not fail with EBUSY.
215+If files are accessed from two overlayfs mounts which share or overlap the
216+upper layer and/or workdir path the behavior of the overlay is undefined,
217+though it will not result in a crash or deadlock.
215218
216219 Mounting an overlay using an upper layer path, where the upper layer path
217220 was 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
3636 * Intel Gemini Lake (SOC)
3737 * Intel Cannon Lake-H (PCH)
3838 * Intel Cannon Lake-LP (PCH)
39+ * Intel Cedar Fork (PCH)
3940 Datasheets: Publicly available at the Intel website
4041
4142 On 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
23872387 and packet type ID), so in a "gatewayed" configuration, all
23882388 outgoing traffic will generally use the same device. Incoming
23892389 traffic may also end up on a single device, but that is
2390− dependent upon the balancing policy of the peer's 8023.ad
2390+ dependent upon the balancing policy of the peer's 802.3ad
23912391 implementation. In a "local" configuration, traffic will be
23922392 distributed across the devices in the bond.
23932393
MAINTAINERS+3−2
@@ -5259,7 +5259,8 @@ S: Maintained · 5258 unmodified lines
52595259 F: drivers/iommu/exynos-iommu.c
52605260
52615261 EZchip NPS platform support
5262−M: Noam Camus <noamc@ezchip.com>
5262+M: Elad Kanfi <eladkan@mellanox.com>
5263+M: Vineet Gupta <vgupta@synopsys.com>
52635264 S: Supported
52645265 F: arch/arc/plat-eznps
52655266 F: arch/arc/boot/dts/eznps.dts
@@ -9360,7 +9361,7 @@ NETWORK BLOCK DEVICE (NBD) · 4094 unmodified lines
93609361 M: Josef Bacik <jbacik@fb.com>
93619362 S: Maintained
93629363 L: linux-block@vger.kernel.org
9363−L: nbd-general@lists.sourceforge.net
9364+L: nbd@other.debian.org
93649365 F: Documentation/blockdev/nbd.txt
93659366 F: drivers/block/nbd.c
93669367 F: include/uapi/linux/nbd.h
Makefile+1−1
@@ -1,7 +1,7 @@
11 VERSION = 4
22 PATCHLEVEL = 14
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc3
4+EXTRAVERSION = -rc4
55 NAME = Fearless Coyote
66
77 # *DOCUMENTATION*
arch/Kconfig+0−3
@@ -937,9 +937,6 @@ config STRICT_MODULE_RWX · 936 unmodified lines
937937 and non-text memory will be made non-executable. This provides
938938 protection against certain security exploits (e.g. writing to text)
939939
940−config ARCH_WANT_RELAX_ORDER
941− bool
942−
943940 config ARCH_HAS_REFCOUNT
944941 bool
945942 help
arch/arc/Kconfig+1−1
@@ -24,7 +24,7 @@ config ARC · 23 unmodified lines
2424 select GENERIC_SMP_IDLE_THREAD
2525 select HAVE_ARCH_KGDB
2626 select HAVE_ARCH_TRACEHOOK
27− select HAVE_FUTEX_CMPXCHG
27+ select HAVE_FUTEX_CMPXCHG if FUTEX
2828 select HAVE_IOREMAP_PROT
2929 select HAVE_KPROBES
3030 select HAVE_KRETPROBES
arch/arc/Makefile+0−2
@@ -6,8 +6,6 @@ · 5 unmodified lines
66 # published by the Free Software Foundation.
77 #
88
9−UTS_MACHINE := arc
10−
119 ifeq ($(CROSS_COMPILE),)
1210 ifndef CONFIG_CPU_BIG_ENDIAN
1311 CROSS_COMPILE := arc-linux-
arch/arc/boot/dts/axs10x_mb.dtsi+8−1
@@ -44,7 +44,14 @@ · 43 unmodified lines
4444
4545 mmcclk: mmcclk {
4646 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>;
4855 #clock-cells = <0>;
4956 };
5057
arch/arc/boot/dts/hsdk.dts+29−3
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 /dts-v1/;
1313
1414 #include <dt-bindings/net/ti-dp83867.h>
15+#include <dt-bindings/reset/snps,hsdk-reset.h>
1516
1617 / {
1718 model = "snps,hsdk";
@@ -57,10 +58,10 @@ · 39 unmodified lines
5758 };
5859 };
5960
60− core_clk: core-clk {
61+ input_clk: input-clk {
6162 #clock-cells = <0>;
6263 compatible = "fixed-clock";
63− clock-frequency = <500000000>;
64+ clock-frequency = <33333333>;
6465 };
6566
6667 cpu_intc: cpu-interrupt-controller {
@@ -102,6 +103,19 @@ · 35 unmodified lines
102103
103104 ranges = <0x00000000 0xf0000000 0x10000000>;
104105
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+
105119 serial: serial@5000 {
106120 compatible = "snps,dw-apb-uart";
107121 reg = <0x5000 0x100>;
@@ -120,7 +134,17 @@ · 12 unmodified lines
120134
121135 mmcclk_ciu: mmcclk-ciu {
122136 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>;
124148 #clock-cells = <0>;
125149 };
126150
@@ -141,6 +165,8 @@ · 14 unmodified lines
141165 clocks = <&gmacclk>;
142166 clock-names = "stmmaceth";
143167 phy-handle = <&phy0>;
168+ resets = <&cgu_rst HSDK_ETH_RESET>;
169+ reset-names = "stmmaceth";
144170
145171 mdio {
146172 #address-cells = <1>;
arch/arc/configs/axs101_defconfig+1−1
@@ -105,7 +105,7 @@ CONFIG_NLS_ISO8859_1=y · 104 unmodified lines
105105 # CONFIG_ENABLE_WARN_DEPRECATED is not set
106106 # CONFIG_ENABLE_MUST_CHECK is not set
107107 CONFIG_STRIP_ASM_SYMS=y
108−CONFIG_LOCKUP_DETECTOR=y
108+CONFIG_SOFTLOCKUP_DETECTOR=y
109109 CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
110110 # CONFIG_SCHED_DEBUG is not set
111111 # 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
104104 # CONFIG_ENABLE_WARN_DEPRECATED is not set
105105 # CONFIG_ENABLE_MUST_CHECK is not set
106106 CONFIG_STRIP_ASM_SYMS=y
107−CONFIG_LOCKUP_DETECTOR=y
107+CONFIG_SOFTLOCKUP_DETECTOR=y
108108 CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
109109 # CONFIG_SCHED_DEBUG is not set
110110 # 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
107107 # CONFIG_ENABLE_WARN_DEPRECATED is not set
108108 # CONFIG_ENABLE_MUST_CHECK is not set
109109 CONFIG_STRIP_ASM_SYMS=y
110−CONFIG_LOCKUP_DETECTOR=y
110+CONFIG_SOFTLOCKUP_DETECTOR=y
111111 CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
112112 # CONFIG_SCHED_DEBUG is not set
113113 # 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
8484 CONFIG_NFS_FS=y
8585 # CONFIG_ENABLE_WARN_DEPRECATED is not set
8686 # CONFIG_ENABLE_MUST_CHECK is not set
87−CONFIG_LOCKUP_DETECTOR=y
87+CONFIG_SOFTLOCKUP_DETECTOR=y
8888 # CONFIG_DEBUG_PREEMPT is not set
arch/arc/configs/hsdk_defconfig+2−1
@@ -63,6 +63,7 @@ CONFIG_MMC_SDHCI=y · 62 unmodified lines
6363 CONFIG_MMC_SDHCI_PLTFM=y
6464 CONFIG_MMC_DW=y
6565 # CONFIG_IOMMU_SUPPORT is not set
66+CONFIG_RESET_HSDK=y
6667 CONFIG_EXT3_FS=y
6768 CONFIG_VFAT_FS=y
6869 CONFIG_TMPFS=y
@@ -72,7 +73,7 @@ CONFIG_NLS_ISO8859_1=y · 3 unmodified lines
7273 # CONFIG_ENABLE_WARN_DEPRECATED is not set
7374 # CONFIG_ENABLE_MUST_CHECK is not set
7475 CONFIG_STRIP_ASM_SYMS=y
75−CONFIG_LOCKUP_DETECTOR=y
76+CONFIG_SOFTLOCKUP_DETECTOR=y
7677 CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
7778 # CONFIG_SCHED_DEBUG is not set
7879 # 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
9494 # CONFIG_ENABLE_MUST_CHECK is not set
9595 CONFIG_STRIP_ASM_SYMS=y
9696 CONFIG_DEBUG_SHIRQ=y
97−CONFIG_LOCKUP_DETECTOR=y
97+CONFIG_SOFTLOCKUP_DETECTOR=y
9898 CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
9999 # CONFIG_SCHED_DEBUG is not set
100100 # 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
9898 # CONFIG_ENABLE_MUST_CHECK is not set
9999 CONFIG_STRIP_ASM_SYMS=y
100100 CONFIG_DEBUG_SHIRQ=y
101−CONFIG_LOCKUP_DETECTOR=y
101+CONFIG_SOFTLOCKUP_DETECTOR=y
102102 CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10
103103 # CONFIG_SCHED_DEBUG is not set
104104 # CONFIG_DEBUG_PREEMPT is not set
arch/arc/include/asm/arcregs.h+6−5
@@ -98,6 +98,7 @@ · 97 unmodified lines
9898
9999 /* Auxiliary registers */
100100 #define AUX_IDENTITY 4
101+#define AUX_EXEC_CTRL 8
101102 #define AUX_INTR_VEC_BASE 0x25
102103 #define AUX_VOL 0x5e
103104
@@ -135,12 +136,12 @@ struct bcr_identity { · 31 unmodified lines
135136 #endif
136137 };
137138
138−struct bcr_isa {
139+struct bcr_isa_arcv2 {
139140 #ifdef CONFIG_CPU_BIG_ENDIAN
140141 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;
142143 #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,
144145 ldd:1, pad2:4, div_rem:4;
145146 #endif
146147 };
@@ -263,13 +264,13 @@ struct cpuinfo_arc { · 116 unmodified lines
263264 struct cpuinfo_arc_mmu mmu;
264265 struct cpuinfo_arc_bpu bpu;
265266 struct bcr_identity core;
266− struct bcr_isa isa;
267+ struct bcr_isa_arcv2 isa;
267268 const char *details, *name;
268269 unsigned int vec_base;
269270 struct cpuinfo_arc_ccm iccm, dccm;
270271 struct {
271272 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,
273274 debug:1, ap:1, smart:1, rtt:1, pad3:4,
274275 timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4;
275276 } extn;
arch/arc/kernel/setup.c+25−7
@@ -51,6 +51,7 @@ static const struct id_to_str arc_cpu_rel[] = { · 50 unmodified lines
5151 { 0x51, "R2.0" },
5252 { 0x52, "R2.1" },
5353 { 0x53, "R3.0" },
54+ { 0x54, "R4.0" },
5455 #endif
5556 { 0x00, NULL }
5657 };
@@ -62,6 +63,7 @@ static const struct id_to_str arc_cpu_nm[] = { · 5 unmodified lines
6263 #else
6364 { 0x40, "ARC EM" },
6465 { 0x50, "ARC HS38" },
66+ { 0x54, "ARC HS48" },
6567 #endif
6668 { 0x00, "Unknown" }
6769 };
@@ -119,11 +121,11 @@ static void read_arc_build_cfg_regs(void) · 51 unmodified lines
119121 struct bcr_generic bcr;
120122 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
121123 const struct id_to_str *tbl;
124+ struct bcr_isa_arcv2 isa;
122125
123126 FIX_PTR(cpu);
124127
125128 READ_BCR(AUX_IDENTITY, cpu->core);
126− READ_BCR(ARC_REG_ISA_CFG_BCR, cpu->isa);
127129
128130 for (tbl = &arc_cpu_rel[0]; tbl->id != 0; tbl++) {
129131 if (cpu->core.family == tbl->id) {
@@ -133,7 +135,7 @@ static void read_arc_build_cfg_regs(void) · 3 unmodified lines
133135 }
134136
135137 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)
137139 break;
138140 }
139141 cpu->name = tbl->str;
@@ -192,6 +194,14 @@ static void read_arc_build_cfg_regs(void) · 52 unmodified lines
192194 cpu->bpu.full = bpu.ft;
193195 cpu->bpu.num_cache = 256 << bpu.bce;
194196 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+ }
195205 }
196206
197207 READ_BCR(ARC_REG_AP_BCR, bcr);
@@ -205,18 +215,25 @@ static void read_arc_build_cfg_regs(void) · 7 unmodified lines
205215
206216 cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt;
207217
218+ READ_BCR(ARC_REG_ISA_CFG_BCR, isa);
219+
208220 /* some hacks for lack of feature BCR info in old ARC700 cores */
209221 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 */
211223 cpu->isa.atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC);
212− else
213− cpu->isa.atomic = cpu->isa.atomic1;
224+ else {
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+ }
214229
215230 cpu->isa.be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN);
216231
217232 /* there's no direct way to distinguish 750 vs. 770 */
218233 if (unlikely(cpu->core.family < 0x34 || cpu->mmu.ver < 3))
219234 cpu->name = "ARC750";
235+ } else {
236+ cpu->isa = isa;
220237 }
221238 }
222239
@@ -232,10 +249,11 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) · 9 unmodified lines
232249 "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n",
233250 core->family, core->cpu_id, core->chip_id);
234251
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",
236253 cpu_id, cpu->name, cpu->details,
237254 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"));
239257
240258 n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s%s%s\nISA Extn\t: ",
241259 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
111111
112112 axs10x_enable_gpio_intc_wire();
113113
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+
114121 scnprintf(mb, 32, "MainBoard v%d", mb_rev);
115122 axs10x_print_board_ver(CREG_MB_VER, mb);
116123 }
arch/arc/plat-hsdk/Kconfig+2−1
@@ -6,4 +6,5 @@ · 5 unmodified lines
66 #
77
88 menuconfig 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
3838 #define CREG_PAE (CREG_BASE + 0x180)
3939 #define CREG_PAE_UPDATE (CREG_BASE + 0x194)
4040
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+
57+static 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+
4177 static void __init hsdk_init_early(void)
4278 {
4379 /*
@@ -52,6 +88,12 @@ static void __init hsdk_init_early(void) · 8 unmodified lines
5288
5389 /* Really apply settings made above */
5490 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();
5597 }
5698
5799 static const char *hsdk_compat[] __initconst = {
arch/arm64/include/asm/memory.h+6−3
@@ -95,16 +95,19 @@ · 94 unmodified lines
9595 #define KERNEL_END _end
9696
9797 /*
98− * The size of the KASAN shadow region. This should be 1/8th of the
99− * size of the entire kernel virtual address space.
98+ * KASAN requires 1/8th of the kernel virtual address space for the shadow
99+ * region. KASAN can bloat the stack significantly, so double the (minimum)
100+ * stack size when KASAN is in use.
100101 */
101102 #ifdef CONFIG_KASAN
102103 #define KASAN_SHADOW_SIZE (UL(1) << (VA_BITS - 3))
104+#define KASAN_THREAD_SHIFT 1
103105 #else
104106 #define KASAN_SHADOW_SIZE (0)
107+#define KASAN_THREAD_SHIFT 0
105108 #endif
106109
107−#define MIN_THREAD_SHIFT 14
110+#define MIN_THREAD_SHIFT (14 + KASAN_THREAD_SHIFT)
108111
109112 /*
110113 * 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
649649 return 0;
650650 }
651651
652−late_initcall(armv8_deprecated_init);
652+core_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
13071307 return 0;
13081308 }
13091309
1310−late_initcall(enable_mrs_emulation);
1310+core_initcall(enable_mrs_emulation);
arch/arm64/kernel/fpsimd.c+1−1
@@ -444,4 +444,4 @@ static int __init fpsimd_init(void) · 443 unmodified lines
444444
445445 return 0;
446446 }
447−late_initcall(fpsimd_init);
447+core_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
9797 (esr & ESR_ELx_SF) >> ESR_ELx_SF_SHIFT,
9898 (esr & ESR_ELx_AR) >> ESR_ELx_AR_SHIFT);
9999 } 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);
101101 }
102102
103103 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
146146
147147 /* prevent soft lockup/stalled CPU messages for endless loop. */
148148 rcu_sysrq_start();
149− lockup_detector_suspend();
149+ lockup_detector_soft_poweroff();
150150 for (;;);
151151 }
152152
arch/powerpc/kernel/dt_cpu_ftrs.c+2−2
@@ -102,10 +102,10 @@ static void cpufeatures_flush_tlb(void) · 101 unmodified lines
102102 case PVR_POWER8:
103103 case PVR_POWER8E:
104104 case PVR_POWER8NVL:
105− __flush_tlb_power8(POWER8_TLB_SETS);
105+ __flush_tlb_power8(TLB_INVAL_SCOPE_GLOBAL);
106106 break;
107107 case PVR_POWER9:
108− __flush_tlb_power9(POWER9_TLB_SETS_HASH);
108+ __flush_tlb_power9(TLB_INVAL_SCOPE_GLOBAL);
109109 break;
110110 default:
111111 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
734734 EXC_VIRT(program_check, 0x4700, 0x100, 0x700)
735735 TRAMP_KVM(PACA_EXGEN, 0x700)
736736 EXC_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 !! */
759+1: EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
738760 bl save_nvgprs
739761 RECONCILE_IRQ_STATE(r10, r11)
740762 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
624624
625625 long __machine_check_early_realmode_p9(struct pt_regs *regs)
626626 {
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+
627640 return mce_handle_error(regs, mce_p9_derror_table, mce_p9_ierror_table);
628641 }
arch/powerpc/kernel/setup-common.c+0−3
@@ -904,9 +904,6 @@ void __init setup_arch(char **cmdline_p) · 903 unmodified lines
904904 #endif
905905 #endif
906906
907−#ifdef CONFIG_PPC_64K_PAGES
908− init_mm.context.pte_frag = NULL;
909−#endif
910907 #ifdef CONFIG_SPAPR_TCE_IOMMU
911908 mm_iommu_init(&init_mm);
912909 #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
452452 if (MSR_TM_RESV(msr))
453453 return -EINVAL;
454454
455− /* pull in MSR TM from user context */
455+ /* pull in MSR TS bits from user context */
456456 regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);
457457
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+
458469 /* pull in MSR LE from user context */
459470 regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);
460471
arch/powerpc/kernel/watchdog.c+15−15
@@ -310,9 +310,6 @@ static int start_wd_on_cpu(unsigned int cpu) · 309 unmodified lines
310310 if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED))
311311 return 0;
312312
313− if (watchdog_suspended)
314− return 0;
315−
316313 if (!cpumask_test_cpu(cpu, &watchdog_cpumask))
317314 return 0;
318315
@@ -358,36 +355,39 @@ static void watchdog_calc_timeouts(void) · 39 unmodified lines
358355 wd_timer_period_ms = watchdog_thresh * 1000 * 2 / 5;
359356 }
360357
361−void watchdog_nmi_reconfigure(void)
358+void watchdog_nmi_stop(void)
362359 {
363360 int cpu;
364361
365− watchdog_calc_timeouts();
366−
367362 for_each_cpu(cpu, &wd_cpus_enabled)
368363 stop_wd_on_cpu(cpu);
364+}
369365
366+void watchdog_nmi_start(void)
367+{
368+ int cpu;
369+
370+ watchdog_calc_timeouts();
370371 for_each_cpu_and(cpu, cpu_online_mask, &watchdog_cpumask)
371372 start_wd_on_cpu(cpu);
372373 }
373374
374375 /*
375− * This runs after lockup_detector_init() which sets up watchdog_cpumask.
376+ * Invoked from core watchdog init.
376377 */
377−static int __init powerpc_watchdog_init(void)
378+int __init watchdog_nmi_probe(void)
378379 {
379380 int err;
380381
381− watchdog_calc_timeouts();
382−
383− err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "powerpc/watchdog:online",
384− start_wd_on_cpu, stop_wd_on_cpu);
385− if (err < 0)
382+ err = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
383+ "powerpc/watchdog:online",
384+ start_wd_on_cpu, stop_wd_on_cpu);
385+ if (err < 0) {
386386 pr_warn("Watchdog could not be initialized");
387−
387+ return err;
388+ }
388389 return 0;
389390 }
390−arch_initcall(powerpc_watchdog_init);
391391
392392 static void handle_backtrace_ipi(struct pt_regs *regs)
393393 {
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
622622 return -EINVAL;
623623 state = &sb->irq_state[idx];
624624 arch_spin_lock(&sb->lock);
625− *server = state->guest_server;
625+ *server = state->act_server;
626626 *priority = state->guest_priority;
627627 arch_spin_unlock(&sb->lock);
628628
@@ -1331,7 +1331,7 @@ static int xive_get_source(struct kvmppc_xive *xive, long irq, u64 addr) · 702 unmodified lines
13311331 xive->saved_src_count++;
13321332
13331333 /* Convert saved state into something compatible with xics */
1334− val = state->guest_server;
1334+ val = state->act_server;
13351335 prio = state->saved_scan_prio;
13361336
13371337 if (prio == MASKED) {
@@ -1507,7 +1507,6 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr) · 169 unmodified lines
15071507 /* First convert prio and mark interrupt as untargetted */
15081508 act_prio = xive_prio_from_guest(guest_prio);
15091509 state->act_priority = MASKED;
1510− state->guest_server = server;
15111510
15121511 /*
15131512 * 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
3535 struct xive_irq_data *pt_data; /* XIVE Pass-through associated data */
3636
3737 /* Targetting as set by guest */
38− u32 guest_server; /* Current guest selected target */
3938 u8 guest_priority; /* Guest set priority */
4039 u8 saved_priority; /* Saved priority when masking */
4140
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
361361 break;
362362 }
363363 wmb();
364+ local_irq_restore(flags);
364365 flush_tlb_kernel_range((unsigned long)page_address(start),
365366 (unsigned long)page_address(page));
366− local_irq_restore(flags);
367367 return err;
368368 }
369369
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
272272 #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
273273 static unsigned long pnv_memory_block_size(void)
274274 {
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;
276284 }
277285 #endif
278286
arch/powerpc/sysdev/xive/common.c+8−0
@@ -1402,6 +1402,14 @@ void xive_teardown_cpu(void) · 1401 unmodified lines
14021402
14031403 if (xive_ops->teardown_cpu)
14041404 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);
14051413 }
14061414
14071415 void 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
431431
432432 static void xive_spapr_put_ipi(unsigned int cpu, struct xive_cpu *xc)
433433 {
434+ if (!xc->hw_ipi)
435+ return;
436+
434437 xive_irq_bitmap_free(xc->hw_ipi);
438+ xc->hw_ipi = 0;
435439 }
436440 #endif /* CONFIG_SMP */
437441
arch/sparc/Kconfig+0−1
@@ -44,7 +44,6 @@ config SPARC · 43 unmodified lines
4444 select ARCH_HAS_SG_CHAIN
4545 select CPU_NO_EFFICIENT_FFS
4646 select LOCKDEP_SMALL if LOCKDEP
47− select ARCH_WANT_RELAX_ORDER
4847
4948 config SPARC32
5049 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
44094409 return 0;
44104410 }
44114411
4412− if (lockup_detector_suspend() != 0) {
4413− pr_debug("failed to disable PMU erratum BJ122, BV98, HSD29 workaround\n");
4414− return 0;
4415− }
4412+ cpus_read_lock();
4413+
4414+ hardlockup_detector_perf_stop();
44164415
44174416 x86_pmu.flags &= ~(PMU_FL_EXCL_CNTRS | PMU_FL_EXCL_ENABLED);
44184417
@@ -4420,9 +4419,7 @@ static __init int fixup_ht_bug(void) · 1 unmodified line
44204419 x86_pmu.commit_scheduling = NULL;
44214420 x86_pmu.stop_scheduling = NULL;
44224421
4423− lockup_detector_resume();
4424−
4425− cpus_read_lock();
4422+ hardlockup_detector_perf_restart();
44264423
44274424 for_each_online_cpu(c)
44284425 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
8888 bool kvm_para_available(void);
8989 unsigned int kvm_arch_para_features(void);
9090 void __init kvm_guest_init(void);
91−void kvm_async_pf_task_wait(u32 token);
91+void kvm_async_pf_task_wait(u32 token, int interrupt_kernel);
9292 void kvm_async_pf_task_wake(u32 token);
9393 u32 kvm_read_and_reset_pf_reason(void);
9494 extern void kvm_disable_steal_time(void);
@@ -103,7 +103,7 @@ static inline void kvm_spinlock_init(void) · 8 unmodified lines
103103
104104 #else /* CONFIG_KVM_GUEST */
105105 #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)
107107 #define kvm_async_pf_task_wake(T) do {} while(0)
108108
109109 static 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
117117 return NULL;
118118 }
119119
120−void 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+ */
124+void kvm_async_pf_task_wait(u32 token, int interrupt_kernel)
121125 {
122126 u32 key = hash_32(token, KVM_TASK_SLEEP_HASHBITS);
123127 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
140144
141145 n.token = token;
142146 n.cpu = smp_processor_id();
143− n.halted = is_idle_task(current) || preempt_count() > 1 ||
144− rcu_preempt_depth();
147+ n.halted = is_idle_task(current) ||
148+ (IS_ENABLED(CONFIG_PREEMPT_COUNT)
149+ ? preempt_count() > 1 || rcu_preempt_depth()
150+ : interrupt_kernel);
145151 init_swait_queue_head(&n.wq);
146152 hlist_add_head(&n.link, &b->list);
147153 raw_spin_unlock(&b->lock);
@@ -269,7 +275,7 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code) · 121 unmodified lines
269275 case KVM_PV_REASON_PAGE_NOT_PRESENT:
270276 /* page is swapped out by the host. */
271277 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));
273279 exception_exit(prev_state);
274280 break;
275281 case KVM_PV_REASON_PAGE_READY:
arch/x86/kvm/Kconfig+1−0
@@ -23,6 +23,7 @@ config KVM · 22 unmodified lines
2323 depends on HIGH_RES_TIMERS
2424 # for TASKSTATS/TASK_DELAY_ACCT:
2525 depends on NET && MULTIUSER
26+ depends on X86_LOCAL_APIC
2627 select PREEMPT_NOTIFIERS
2728 select MMU_NOTIFIER
2829 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
425425 #op " %al \n\t" \
426426 FOP_RET
427427
428−asm(".global kvm_fastop_exception \n"
429− "kvm_fastop_exception: xor %esi, %esi; ret");
428+asm(".pushsection .fixup, \"ax\"\n"
429+ ".global kvm_fastop_exception \n"
430+ "kvm_fastop_exception: xor %esi, %esi; ret\n"
431+ ".popsection");
430432
431433 FOP_START(setcc)
432434 FOP_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
38373837 case KVM_PV_REASON_PAGE_NOT_PRESENT:
38383838 vcpu->arch.apf.host_apf_reason = 0;
38393839 local_irq_disable();
3840− kvm_async_pf_task_wait(fault_address);
3840+ kvm_async_pf_task_wait(fault_address, 0);
38413841 local_irq_enable();
38423842 break;
38433843 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
815815 goto err;
816816
817817 /*
818− * blk_mq_init_hctx() attempted to do this already, but q->debugfs_dir
818+ * blk_mq_init_sched() attempted to do this already, but q->debugfs_dir
819819 * didn't exist yet (because we don't know what to name the directory
820820 * until the queue is registered to a gendisk).
821821 */
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. */
822826 queue_for_each_hw_ctx(q, hctx, i) {
823827 if (!hctx->debugfs_dir && blk_mq_debugfs_register_hctx(q, hctx))
824828 goto err;
block/blk-throttle.c+2−2
@@ -1911,11 +1911,11 @@ static void throtl_upgrade_state(struct throtl_data *td) · 1910 unmodified lines
19111911
19121912 tg->disptime = jiffies - 1;
19131913 throtl_select_dispatch(sq);
1914− throtl_schedule_next_dispatch(sq, false);
1914+ throtl_schedule_next_dispatch(sq, true);
19151915 }
19161916 rcu_read_unlock();
19171917 throtl_select_dispatch(&td->service_queue);
1918− throtl_schedule_next_dispatch(&td->service_queue, false);
1918+ throtl_schedule_next_dispatch(&td->service_queue, true);
19191919 queue_work(kthrotld_workqueue, &td->dispatch_work);
19201920 }
19211921
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
207207 struct bsg_job *job = blk_mq_rq_to_pdu(req);
208208 struct scsi_request *sreq = &job->sreq;
209209
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+
219+static 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+
210227 memset(job, 0, sizeof(*job));
211228
212229 scsi_req_init(sreq);
230+
231+ sreq->sense = sense;
213232 sreq->sense_len = SCSI_SENSE_BUFFERSIZE;
214− sreq->sense = kzalloc(sreq->sense_len, gfp);
215− if (!sreq->sense)
216− return -ENOMEM;
217233
218234 job->req = req;
219− job->reply = sreq->sense;
235+ job->reply = sense;
220236 job->reply_len = sreq->sense_len;
221237 job->dd_data = job + 1;
222−
223− return 0;
224238 }
225239
226240 static 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
251265 q->cmd_size = sizeof(struct bsg_job) + dd_job_size;
252266 q->init_rq_fn = bsg_init_rq;
253267 q->exit_rq_fn = bsg_exit_rq;
268+ q->initialize_rq_fn = bsg_initialize_rq;
254269 q->request_fn = bsg_request_fn;
255270
256271 ret = blk_init_allocated_queue(q);
drivers/acpi/arm64/iort.c+35−0
@@ -1178,12 +1178,44 @@ dev_put: · 1177 unmodified lines
11781178 return ret;
11791179 }
11801180
1181+static 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+
11811212 static void __init iort_init_platform_devices(void)
11821213 {
11831214 struct acpi_iort_node *iort_node, *iort_end;
11841215 struct acpi_table_iort *iort;
11851216 struct fwnode_handle *fwnode;
11861217 int i, ret;
1218+ bool acs_enabled = false;
11871219
11881220 /*
11891221 * 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
12031235 return;
12041236 }
12051237
1238+ if (!acs_enabled)
1239+ acs_enabled = iort_enable_acs(iort_node);
1240+
12061241 if ((iort_node->type == ACPI_IORT_NODE_SMMU) ||
12071242 (iort_node->type == ACPI_IORT_NODE_SMMU_V3)) {
12081243
drivers/block/Kconfig+1−1
@@ -17,7 +17,7 @@ if BLK_DEV · 16 unmodified lines
1717
1818 config BLK_DEV_NULL_BLK
1919 tristate "Null test block driver"
20− depends on CONFIGFS_FS
20+ select CONFIGFS_FS
2121
2222 config BLK_DEV_FD
2323 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
820820 * appropriate.
821821 */
822822 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;
823827 complete(&cmd->send_complete);
824828
825− return ret < 0 ? BLK_STS_IOERR : BLK_STS_OK;
829+ return ret;
826830 }
827831
828832 static 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
105105
106106 return ret;
107107 }
108+EXPORT_SYMBOL_GPL(clk_bulk_prepare);
108109
109110 #endif /* CONFIG_HAVE_CLK_PREPARE */
110111
drivers/clk/rockchip/clk-rk3128.c+7−5
@@ -315,13 +315,13 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { · 314 unmodified lines
315315 RK2928_CLKGATE_CON(10), 8, GFLAGS),
316316
317317 GATE(SCLK_PVTM_CORE, "clk_pvtm_core", "xin24m", 0,
318− RK2928_CLKGATE_CON(10), 8, GFLAGS),
318+ RK2928_CLKGATE_CON(10), 0, GFLAGS),
319319 GATE(SCLK_PVTM_GPU, "clk_pvtm_gpu", "xin24m", 0,
320− RK2928_CLKGATE_CON(10), 8, GFLAGS),
320+ RK2928_CLKGATE_CON(10), 1, GFLAGS),
321321 GATE(SCLK_PVTM_FUNC, "clk_pvtm_func", "xin24m", 0,
322− RK2928_CLKGATE_CON(10), 8, GFLAGS),
322+ RK2928_CLKGATE_CON(10), 2, GFLAGS),
323323 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),
325325
326326 COMPOSITE(SCLK_SDMMC, "sclk_sdmmc0", mux_mmc_src_p, 0,
327327 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
541541 GATE(0, "pclk_grf", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 4, GFLAGS),
542542 GATE(0, "pclk_mipiphy", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 0, GFLAGS),
543543
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),
545545 GATE(0, "pclk_pmu_niu", "pclk_pmu_pre", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 3, GFLAGS),
546546
547547 /* PD_MMC */
@@ -577,6 +577,8 @@ static const char *const rk3128_critical_clocks[] __initconst = { · 29 unmodified lines
577577 "aclk_peri",
578578 "hclk_peri",
579579 "pclk_peri",
580+ "pclk_pmu",
581+ "sclk_timer5",
580582 };
581583
582584 static 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
294294 #define PLL_ENABLED (1 << 31)
295295 #define PLL_LOCKED (1 << 29)
296296
297+static 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+
297309 static void exynos4_clk_wait_for_pll(u32 reg)
298310 {
299311 u32 pll_con;
@@ -315,6 +327,9 @@ static int exynos4_clk_suspend(void) · 15 unmodified lines
315327 samsung_clk_save(reg_base, exynos4_save_pll,
316328 ARRAY_SIZE(exynos4_clk_pll_regs));
317329
330+ exynos4_clk_enable_pll(EPLL_CON0);
331+ exynos4_clk_enable_pll(VPLL_CON0);
332+
318333 if (exynos4_soc == EXYNOS4210) {
319334 samsung_clk_save(reg_base, exynos4_save_soc,
320335 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
606606 connector->encoder->base.id,
607607 connector->encoder->name);
608608
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−
614609 connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
615610
616611 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
11631163 is_hdmi = is_dvi && (child->common.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0;
11641164 is_edp = is_dp && (child->common.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR);
11651165
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+
11661173 info->supports_dvi = is_dvi;
11671174 info->supports_hdmi = is_hdmi;
11681175 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
216216
217217 mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
218218
219− if (IS_BROXTON(dev_priv))
219+ if (IS_GEN9_LP(dev_priv))
220220 mask |= DC_STATE_DEBUG_MASK_CORES;
221221
222222 /* 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
16551655 out:
16561656 if (ret && IS_GEN9_LP(dev_priv)) {
16571657 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 |
16591660 BXT_PHY_LANE_ENABLED)) != BXT_PHY_LANE_ENABLED)
16601661 DRM_ERROR("Port %c enabled but PHY powered down? "
16611662 "(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
1235912359 struct drm_crtc_state *old_crtc_state, *new_crtc_state;
1236012360 struct drm_crtc *crtc;
1236112361 struct intel_crtc_state *intel_cstate;
12362− bool hw_check = intel_state->modeset;
1236312362 u64 put_domains[I915_MAX_PIPES] = {};
1236412363 unsigned crtc_vblank_mask = 0;
1236512364 int i;
@@ -12376,7 +12375,6 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) · 10 unmodified lines
1237612375
1237712376 if (needs_modeset(new_crtc_state) ||
1237812377 to_intel_crtc_state(new_crtc_state)->update_pipe) {
12379− hw_check = true;
1238012378
1238112379 put_domains[to_intel_crtc(crtc)->pipe] =
1238212380 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
208208 },
209209 };
210210
211−static 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−
217211 static const struct bxt_ddi_phy_info *
218212 bxt_get_phy_list(struct drm_i915_private *dev_priv, int *count)
219213 {
@@ -313,7 +307,6 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, · 93 unmodified lines
313307 enum dpio_phy phy)
314308 {
315309 const struct bxt_ddi_phy_info *phy_info;
316− enum port port;
317310
318311 phy_info = bxt_get_phy_info(dev_priv, phy);
319312
@@ -335,19 +328,6 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, · 15 unmodified lines
335328 return false;
336329 }
337330
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−
351331 return true;
352332 }
353333
drivers/gpu/drm/i915/intel_modes.c+17−0
@@ -30,6 +30,21 @@ · 29 unmodified lines
3030 #include "intel_drv.h"
3131 #include "i915_drv.h"
3232
33+static 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+
3348 /**
3449 * intel_connector_update_modes - update connector from edid
3550 * @connector: DRM connector device to use
@@ -44,6 +59,8 @@ int intel_connector_update_modes(struct drm_connector *connector, · 8 unmodified lines
4459 ret = drm_add_edid_modes(connector, edid);
4560 drm_edid_to_eld(connector, edid);
4661
62+ intel_connector_update_eld_conn_type(connector);
63+
4764 return ret;
4865 }
4966
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
27822782
27832783 /* 6. Enable DBUF */
27842784 gen9_dbuf_enable(dev_priv);
2785+
2786+ if (resume && dev_priv->csr.dmc_payload)
2787+ intel_csr_load_program(dev_priv);
27852788 }
27862789
27872790 #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
302302 hdmi->mod_clk = devm_clk_get(dev, "mod");
303303 if (IS_ERR(hdmi->mod_clk)) {
304304 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;
306307 }
307308 clk_prepare_enable(hdmi->mod_clk);
308309
309310 hdmi->pll0_clk = devm_clk_get(dev, "pll-0");
310311 if (IS_ERR(hdmi->pll0_clk)) {
311312 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;
313315 }
314316
315317 hdmi->pll1_clk = devm_clk_get(dev, "pll-1");
316318 if (IS_ERR(hdmi->pll1_clk)) {
317319 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;
319322 }
320323
321324 ret = sun4i_tmds_create(hdmi);
322325 if (ret) {
323326 dev_err(dev, "Couldn't create the TMDS clock\n");
324− return ret;
327+ goto err_disable_mod_clk;
325328 }
326329
327330 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
362365 ret = sun4i_hdmi_i2c_create(dev, hdmi);
363366 if (ret) {
364367 dev_err(dev, "Couldn't create the HDMI I2C adapter\n");
365− return ret;
368+ goto err_disable_mod_clk;
366369 }
367370
368371 drm_encoder_helper_add(&hdmi->encoder,
@@ -422,6 +425,10 @@ err_cleanup_connector: · 53 unmodified lines
422425 drm_encoder_cleanup(&hdmi->encoder);
423426 err_del_i2c_adapter:
424427 i2c_del_adapter(hdmi->i2c);
428+err_disable_mod_clk:
429+ clk_disable_unprepare(hdmi->mod_clk);
430+err_disable_bus_clk:
431+ clk_disable_unprepare(hdmi->bus_clk);
425432 return ret;
426433 }
427434
@@ -434,6 +441,8 @@ static void sun4i_hdmi_unbind(struct device *dev, struct device *master, · 6 unmodified lines
434441 drm_connector_cleanup(&hdmi->connector);
435442 drm_encoder_cleanup(&hdmi->encoder);
436443 i2c_del_adapter(hdmi->i2c);
444+ clk_disable_unprepare(hdmi->mod_clk);
445+ clk_disable_unprepare(hdmi->bus_clk);
437446 }
438447
439448 static 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
630630 sizeof(struct slimpro_resp_msg) * ASYNC_MSG_FIFO_SIZE,
631631 GFP_KERNEL);
632632 if (rc)
633− goto out_mbox_free;
633+ return -ENOMEM;
634634
635635 INIT_WORK(&ctx->workq, xgene_hwmon_evt_work);
636636
@@ -646,7 +646,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 9 unmodified lines
646646 if (IS_ERR(ctx->mbox_chan)) {
647647 dev_err(&pdev->dev,
648648 "SLIMpro mailbox channel request failed\n");
649− return -ENODEV;
649+ rc = -ENODEV;
650+ goto out_mbox_free;
650651 }
651652 } else {
652653 struct acpi_pcct_hw_reduced *cppc_ss;
@@ -654,7 +655,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 1 unmodified line
654655 if (device_property_read_u32(&pdev->dev, "pcc-channel",
655656 &ctx->mbox_idx)) {
656657 dev_err(&pdev->dev, "no pcc-channel property\n");
657− return -ENODEV;
658+ rc = -ENODEV;
659+ goto out_mbox_free;
658660 }
659661
660662 cl->rx_callback = xgene_hwmon_pcc_rx_cb;
@@ -662,7 +664,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 1 unmodified line
662664 if (IS_ERR(ctx->mbox_chan)) {
663665 dev_err(&pdev->dev,
664666 "PPC channel request failed\n");
665− return -ENODEV;
667+ rc = -ENODEV;
668+ goto out_mbox_free;
666669 }
667670
668671 /*
@@ -675,13 +678,13 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 6 unmodified lines
675678 if (!cppc_ss) {
676679 dev_err(&pdev->dev, "PPC subspace not found\n");
677680 rc = -ENODEV;
678− goto out_mbox_free;
681+ goto out;
679682 }
680683
681684 if (!ctx->mbox_chan->mbox->txdone_irq) {
682685 dev_err(&pdev->dev, "PCC IRQ not supported\n");
683686 rc = -ENODEV;
684− goto out_mbox_free;
687+ goto out;
685688 }
686689
687690 /*
@@ -696,14 +699,14 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 8 unmodified lines
696699 } else {
697700 dev_err(&pdev->dev, "Failed to get PCC comm region\n");
698701 rc = -ENODEV;
699− goto out_mbox_free;
702+ goto out;
700703 }
701704
702705 if (!ctx->pcc_comm_addr) {
703706 dev_err(&pdev->dev,
704707 "Failed to ioremap PCC comm region\n");
705708 rc = -ENOMEM;
706− goto out_mbox_free;
709+ goto out;
707710 }
708711
709712 /*
drivers/i2c/busses/Kconfig+1−0
@@ -131,6 +131,7 @@ config I2C_I801 · 130 unmodified lines
131131 Gemini Lake (SOC)
132132 Cannon Lake-H (PCH)
133133 Cannon Lake-LP (PCH)
134+ Cedar Fork (PCH)
134135
135136 This driver can also be built as a module. If so, the module
136137 will be called i2c-i801.
drivers/i2c/busses/i2c-i801.c+4−0
@@ -68,6 +68,7 @@ · 67 unmodified lines
6868 * Gemini Lake (SOC) 0x31d4 32 hard yes yes yes
6969 * Cannon Lake-H (PCH) 0xa323 32 hard yes yes yes
7070 * Cannon Lake-LP (PCH) 0x9da3 32 hard yes yes yes
71+ * Cedar Fork (PCH) 0x18df 32 hard yes yes yes
7172 *
7273 * Features supported by this driver:
7374 * Software PEC no
@@ -204,6 +205,7 @@ · 130 unmodified lines
204205
205206 /* Older devices have their ID defined in <linux/pci_ids.h> */
206207 #define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS 0x0f12
208+#define PCI_DEVICE_ID_INTEL_CDF_SMBUS 0x18df
207209 #define PCI_DEVICE_ID_INTEL_DNV_SMBUS 0x19df
208210 #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22
209211 #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22
@@ -1025,6 +1027,7 @@ static const struct pci_device_id i801_ids[] = { · 815 unmodified lines
10251027 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BRASWELL_SMBUS) },
10261028 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_SMBUS) },
10271029 { 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) },
10281031 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DNV_SMBUS) },
10291032 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BROXTON_SMBUS) },
10301033 { 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
15131516 case PCI_DEVICE_ID_INTEL_CANNONLAKE_LP_SMBUS:
15141517 case PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS:
15151518 case PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS:
1519+ case PCI_DEVICE_ID_INTEL_CDF_SMBUS:
15161520 case PCI_DEVICE_ID_INTEL_DNV_SMBUS:
15171521 case PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS:
15181522 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
627627
628628 static const struct of_device_id sprd_i2c_of_match[] = {
629629 { .compatible = "sprd,sc9860-i2c", },
630+ {},
630631 };
631632
632633 static 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
215215 unsigned int msg_num;
216216 unsigned int msg_id;
217217 struct stm32f7_i2c_msg f7_msg;
218− struct stm32f7_i2c_setup *setup;
218+ struct stm32f7_i2c_setup setup;
219219 struct stm32f7_i2c_timings timing;
220220 };
221221
@@ -265,7 +265,7 @@ static struct stm32f7_i2c_spec i2c_specs[] = { · 43 unmodified lines
265265 },
266266 };
267267
268−struct stm32f7_i2c_setup stm32f7_setup = {
268+static const struct stm32f7_i2c_setup stm32f7_setup = {
269269 .rise_time = STM32F7_I2C_RISE_TIME_DEFAULT,
270270 .fall_time = STM32F7_I2C_FALL_TIME_DEFAULT,
271271 .dnf = STM32F7_I2C_DNF_DEFAULT,
@@ -537,7 +537,7 @@ static void stm32f7_i2c_hw_config(struct stm32f7_i2c_dev *i2c_dev) · 265 unmodified lines
537537 writel_relaxed(timing, i2c_dev->base + STM32F7_I2C_TIMINGR);
538538
539539 /* Enable I2C */
540− if (i2c_dev->setup->analog_filter)
540+ if (i2c_dev->setup.analog_filter)
541541 stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1,
542542 STM32F7_I2C_CR1_ANFOFF);
543543 else
@@ -887,22 +887,19 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) · 343 unmodified lines
887887 }
888888
889889 setup = of_device_get_match_data(&pdev->dev);
890− i2c_dev->setup->rise_time = setup->rise_time;
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;
890+ i2c_dev->setup = *setup;
894891
895892 ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns",
896893 &rise_time);
897894 if (!ret)
898− i2c_dev->setup->rise_time = rise_time;
895+ i2c_dev->setup.rise_time = rise_time;
899896
900897 ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-falling-time-ns",
901898 &fall_time);
902899 if (!ret)
903− i2c_dev->setup->fall_time = fall_time;
900+ i2c_dev->setup.fall_time = fall_time;
904901
905− ret = stm32f7_i2c_setup_timing(i2c_dev, i2c_dev->setup);
902+ ret = stm32f7_i2c_setup_timing(i2c_dev, &i2c_dev->setup);
906903 if (ret)
907904 goto clk_free;
908905
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
14511451 if (hwif_init(hwif) == 0) {
14521452 printk(KERN_INFO "%s: failed to initialize IDE "
14531453 "interface\n", hwif->name);
1454+ device_unregister(hwif->portdev);
14541455 device_unregister(&hwif->gendev);
14551456 ide_disable_port(hwif);
14561457 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
5656 {
5757 struct list_head *l;
5858 struct pci_driver *d;
59+ int ret;
5960
6061 list_for_each(l, &ide_pci_drivers) {
6162 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
6364 const struct pci_device_id *id =
6465 pci_match_id(d->id_table, dev);
6566
66− if (id != NULL && d->probe(dev, id) >= 0) {
67− dev->driver = d;
68− pci_dev_get(dev);
69− return 1;
67+ if (id != NULL) {
68+ pci_assign_irq(dev);
69+ ret = d->probe(dev, id);
70+ if (ret >= 0) {
71+ dev->driver = d;
72+ pci_dev_get(dev);
73+ return 1;
74+ }
7075 }
7176 }
7277 }
drivers/ide/setup-pci.c+40−23
@@ -179,6 +179,7 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); · 178 unmodified lines
179179 /**
180180 * ide_pci_enable - do PCI enables
181181 * @dev: PCI device
182+ * @bars: PCI BARs mask
182183 * @d: IDE port info
183184 *
184185 * 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
189190 * Returns zero on success or an error code
190191 */
191192
192−static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d)
193+static int ide_pci_enable(struct pci_dev *dev, int bars,
194+ const struct ide_port_info *d)
193195 {
194− int ret, bars;
196+ int ret;
195197
196198 if (pci_enable_device(dev)) {
197199 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
216218 goto out;
217219 }
218220
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−
231221 ret = pci_request_selected_regions(dev, bars, d->name);
232222 if (ret < 0)
233223 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
403393 /**
404394 * ide_setup_pci_controller - set up IDE PCI
405395 * @dev: PCI device
396+ * @bars: PCI BARs mask
406397 * @d: IDE port info
407398 * @noisy: verbose flag
408399 *
@@ -411,7 +402,7 @@ int ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d) · 2 unmodified lines
411402 * and enables it if need be
412403 */
413404
414−static int ide_setup_pci_controller(struct pci_dev *dev,
405+static int ide_setup_pci_controller(struct pci_dev *dev, int bars,
415406 const struct ide_port_info *d, int noisy)
416407 {
417408 int ret;
@@ -420,7 +411,7 @@ static int ide_setup_pci_controller(struct pci_dev *dev, · 2 unmodified lines
420411 if (noisy)
421412 ide_setup_pci_noise(dev, d);
422413
423− ret = ide_pci_enable(dev, d);
414+ ret = ide_pci_enable(dev, bars, d);
424415 if (ret < 0)
425416 goto out;
426417
@@ -428,16 +419,20 @@ static int ide_setup_pci_controller(struct pci_dev *dev, · 1 unmodified line
428419 if (ret < 0) {
429420 printk(KERN_ERR "%s %s: error accessing PCI regs\n",
430421 d->name, pci_name(dev));
431− goto out;
422+ goto out_free_bars;
432423 }
433424 if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */
434425 ret = ide_pci_configure(dev, d);
435426 if (ret < 0)
436− goto out;
427+ goto out_free_bars;
437428 printk(KERN_INFO "%s %s: device enabled (Linux)\n",
438429 d->name, pci_name(dev));
439430 }
440431
432+ goto out;
433+
434+out_free_bars:
435+ pci_release_selected_regions(dev, bars);
441436 out:
442437 return ret;
443438 }
@@ -540,13 +535,28 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2, · 96 unmodified lines
540535 {
541536 struct pci_dev *pdev[] = { dev1, dev2 };
542537 struct ide_host *host;
543− int ret, i, n_ports = dev2 ? 4 : 2;
538+ int ret, i, n_ports = dev2 ? 4 : 2, bars;
544539 struct ide_hw hw[4], *hws[] = { NULL, NULL, NULL, NULL };
545540
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+
546553 for (i = 0; i < n_ports / 2; i++) {
547− ret = ide_setup_pci_controller(pdev[i], d, !i);
548− if (ret < 0)
554+ ret = ide_setup_pci_controller(pdev[i], bars, d, !i);
555+ if (ret < 0) {
556+ if (i == 1)
557+ pci_release_selected_regions(pdev[0], bars);
549558 goto out;
559+ }
550560
551561 ide_pci_setup_ports(pdev[i], d, &hw[i*2], &hws[i*2]);
552562 }
@@ -554,7 +564,7 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2, · 1 unmodified line
554564 host = ide_host_alloc(d, hws, n_ports);
555565 if (host == NULL) {
556566 ret = -ENOMEM;
557− goto out;
567+ goto out_free_bars;
558568 }
559569
560570 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
576586 * do_ide_setup_pci_device() on the first device!
577587 */
578588 if (ret < 0)
579− goto out;
589+ goto out_free_bars;
580590
581591 /* fixup IRQ */
582592 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
589599 ret = ide_host_register(host, d, hws);
590600 if (ret)
591601 ide_host_free(host);
602+ else
603+ goto out;
604+
605+out_free_bars:
606+ i = n_ports / 2;
607+ while (i--)
608+ pci_release_selected_regions(pdev[i], bars);
592609 out:
593610 return ret;
594611 }
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
100100 if (ret)
101101 goto pid_query_error;
102102
103+ nlmsg_end(skb, nlh);
104+
103105 pr_debug("%s: Multicasting a nlmsg (dev = %s ifname = %s iwpm = %s)\n",
104106 __func__, pm_msg->dev_name, pm_msg->if_name, iwpm_ulib_name);
105107
@@ -170,6 +172,8 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) · 64 unmodified lines
170172 &pm_msg->loc_addr, IWPM_NLA_MANAGE_ADDR);
171173 if (ret)
172174 goto add_mapping_error;
175+
176+ nlmsg_end(skb, nlh);
173177 nlmsg_request->req_buffer = pm_msg;
174178
175179 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
246250 &pm_msg->rem_addr, IWPM_NLA_QUERY_REMOTE_ADDR);
247251 if (ret)
248252 goto query_mapping_error;
253+
254+ nlmsg_end(skb, nlh);
249255 nlmsg_request->req_buffer = pm_msg;
250256
251257 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
308314 if (ret)
309315 goto remove_mapping_error;
310316
317+ nlmsg_end(skb, nlh);
318+
311319 ret = rdma_nl_unicast_wait(skb, iwpm_user_pid);
312320 if (ret) {
313321 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
597597 &mapping_num, IWPM_NLA_MAPINFO_SEND_NUM);
598598 if (ret)
599599 goto mapinfo_num_error;
600+
601+ nlmsg_end(skb, nlh);
602+
600603 ret = rdma_nl_unicast(skb, iwpm_pid);
601604 if (ret) {
602605 skb = NULL;
@@ -678,6 +681,8 @@ int iwpm_send_mapinfo(u8 nl_client, int iwpm_pid) · 75 unmodified lines
678681 if (ret)
679682 goto send_mapping_info_unlock;
680683
684+ nlmsg_end(skb, nlh);
685+
681686 iwpm_print_sockaddr(&map_info->local_sockaddr,
682687 "send_mapping_info: Local sockaddr:");
683688 iwpm_print_sockaddr(&map_info->mapped_sockaddr,
drivers/infiniband/hw/i40iw/i40iw_ctrl.c+1−1
@@ -48,7 +48,7 @@ · 47 unmodified lines
4848 * @wqe: cqp wqe for header
4949 * @header: header for the cqp wqe
5050 */
51−static inline void i40iw_insert_wqe_hdr(u64 *wqe, u64 header)
51+void i40iw_insert_wqe_hdr(u64 *wqe, u64 header)
5252 {
5353 wmb(); /* make sure WQE is populated before polarity is set */
5454 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
5959 struct i40iw_fast_reg_stag_info *info,
6060 bool post_sq);
6161
62+void i40iw_insert_wqe_hdr(u64 *wqe, u64 header);
63+
6264 /* HMC/FPM functions */
6365 enum i40iw_status_code i40iw_sc_init_iw_hmc(struct i40iw_sc_dev *dev,
6466 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
123123 get_64bit_val(wqe, 24, &offset24);
124124
125125 offset24 = (offset24) ? 0 : LS_64(1, I40IWQPSQ_VALID);
126− set_64bit_val(wqe, 24, offset24);
127126
128127 set_64bit_val(wqe, 0, buf->mem.pa);
129128 set_64bit_val(wqe, 8,
130129 LS_64(buf->mem.size, I40IWQPSQ_FRAG_LEN));
131− set_64bit_val(wqe, 24, offset24);
130+ i40iw_insert_wqe_hdr(wqe, offset24);
132131 }
133132
134133 /**
@@ -409,9 +408,7 @@ enum i40iw_status_code i40iw_puda_send(struct i40iw_sc_qp *qp, · 274 unmodified lines
409408 set_64bit_val(wqe, 8, LS_64(info->len, I40IWQPSQ_FRAG_LEN));
410409 set_64bit_val(wqe, 16, header[0]);
411410
412− /* Ensure all data is written before writing valid bit */
413− wmb();
414− set_64bit_val(wqe, 24, header[1]);
411+ i40iw_insert_wqe_hdr(wqe, header[1]);
415412
416413 i40iw_debug_buf(qp->dev, I40IW_DEBUG_PUDA, "PUDA SEND WQE", wqe, 32);
417414 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
539536 LS_64(2, I40IW_CQPSQ_QP_NEXTIWSTATE) |
540537 LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID);
541538
542− set_64bit_val(wqe, 24, header);
539+ i40iw_insert_wqe_hdr(wqe, header);
543540
544541 i40iw_debug_buf(cqp->dev, I40IW_DEBUG_PUDA, "PUDA CQE", wqe, 32);
545542 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
655652 LS_64(1, I40IW_CQPSQ_CQ_ENCEQEMASK) |
656653 LS_64(1, I40IW_CQPSQ_CQ_CEQIDVALID) |
657654 LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID);
658− set_64bit_val(wqe, 24, header);
655+ i40iw_insert_wqe_hdr(wqe, header);
659656
660657 i40iw_debug_buf(dev, I40IW_DEBUG_PUDA, "PUDA CQE",
661658 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
826826 attr->cap.max_inline_data = I40IW_MAX_INLINE_DATA_SIZE;
827827 attr->cap.max_send_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
828828 attr->cap.max_recv_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
829+ attr->port_num = 1;
829830 init_attr->event_handler = iwqp->ibqp.event_handler;
830831 init_attr->qp_context = iwqp->ibqp.qp_context;
831832 init_attr->send_cq = iwqp->ibqp.send_cq;
832833 init_attr->recv_cq = iwqp->ibqp.recv_cq;
833834 init_attr->srq = iwqp->ibqp.srq;
834835 init_attr->cap = attr->cap;
836+ init_attr->port_num = 1;
835837 return 0;
836838 }
837839
drivers/infiniband/hw/mlx5/main.c+2−2
@@ -4174,9 +4174,9 @@ err_bfreg: · 4173 unmodified lines
41744174 err_uar_page:
41754175 mlx5_put_uars_page(dev->mdev, dev->mdev->priv.uar);
41764176
4177−err_cnt:
4178− mlx5_ib_cleanup_cong_debugfs(dev);
41794177 err_cong:
4178+ mlx5_ib_cleanup_cong_debugfs(dev);
4179+err_cnt:
41804180 if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
41814181 mlx5_ib_dealloc_counters(dev);
41824182
drivers/infiniband/hw/qedr/qedr.h+1−1
@@ -387,7 +387,7 @@ struct qedr_qp { · 386 unmodified lines
387387 u8 wqe_size;
388388
389389 u8 smac[ETH_ALEN];
390− u16 vlan_id;
390+ u16 vlan;
391391 int rc;
392392 } *rqe_wr_id;
393393
drivers/infiniband/hw/qedr/qedr_cm.c+9−3
@@ -105,7 +105,7 @@ void qedr_ll2_complete_rx_packet(void *cxt, · 104 unmodified lines
105105
106106 qp->rqe_wr_id[qp->rq.gsi_cons].rc = data->u.data_length_error ?
107107 -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;
109109 /* note: length stands for data length i.e. GRH is excluded */
110110 qp->rqe_wr_id[qp->rq.gsi_cons].sg_list[0].length =
111111 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
694694 struct qedr_cq *cq = get_qedr_cq(ibcq);
695695 struct qedr_qp *qp = dev->gsi_qp;
696696 unsigned long flags;
697+ u16 vlan_id;
697698 int i = 0;
698699
699700 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
712713 wc[i].wc_flags |= IB_WC_GRH | IB_WC_IP_CSUM_OK;
713714 ether_addr_copy(wc[i].smac, qp->rqe_wr_id[qp->rq.cons].smac);
714715 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) {
716720 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;
718724 }
719725
720726 qedr_inc_sw_cons(&qp->rq);
drivers/md/bcache/closure.c+2−2
@@ -64,7 +64,7 @@ EXPORT_SYMBOL(closure_put); · 63 unmodified lines
6464 void __closure_wake_up(struct closure_waitlist *wait_list)
6565 {
6666 struct llist_node *list;
67− struct closure *cl;
67+ struct closure *cl, *t;
6868 struct llist_node *reverse = NULL;
6969
7070 list = llist_del_all(&wait_list->list);
@@ -73,7 +73,7 @@ void __closure_wake_up(struct closure_waitlist *wait_list) · 2 unmodified lines
7373 reverse = llist_reverse_order(list);
7474
7575 /* Then do the wakeups */
76− llist_for_each_entry(cl, reverse, list) {
76+ llist_for_each_entry_safe(cl, t, reverse, list) {
7777 closure_set_waiting(cl, 0);
7878 closure_sub(cl, CLOSURE_WAITING + 1);
7979 }
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
219219
220220 down_read(&mm->mmap_sem);
221221
222− for (dar = addr; dar < addr + size; dar += page_size) {
223− if (!vma || dar < vma->vm_start || dar > vma->vm_end) {
222+ vma = find_vma(mm, addr);
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) {
224233 vma = find_vma(mm, addr);
225234 if (!vma) {
226235 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
16341634 }
16351635
16361636 mqrq->areq.mrq = &brq->mrq;
1637−
1638− mmc_queue_bounce_pre(mqrq);
16391637 }
16401638
16411639 static 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
18291827 brq = &mq_rq->brq;
18301828 old_req = mmc_queue_req_to_req(mq_rq);
18311829 type = rq_data_dir(old_req) == READ ? MMC_BLK_READ : MMC_BLK_WRITE;
1832− mmc_queue_bounce_post(mq_rq);
18331830
18341831 switch (status) {
18351832 case MMC_BLK_SUCCESS:
drivers/mmc/core/mmc.c+19−17
@@ -1286,6 +1286,23 @@ out_err: · 1285 unmodified lines
12861286 return err;
12871287 }
12881288
1289+static 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+
12891306 static int mmc_select_hs400es(struct mmc_card *card)
12901307 {
12911308 struct mmc_host *host = card->host;
@@ -1341,6 +1358,8 @@ static int mmc_select_hs400es(struct mmc_card *card) · 49 unmodified lines
13411358 goto out_err;
13421359 }
13431360
1361+ mmc_select_driver_type(card);
1362+
13441363 /* Switch card to HS400 */
13451364 val = EXT_CSD_TIMING_HS400 |
13461365 card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
@@ -1374,23 +1393,6 @@ out_err: · 27 unmodified lines
13741393 return err;
13751394 }
13761395
1377−static 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−
13941396 /*
13951397 * For device supporting HS200 mode, the following sequence
13961398 * should be done before executing the tuning process.
drivers/mmc/core/queue.c+9−116
@@ -23,8 +23,6 @@ · 22 unmodified lines
2323 #include "core.h"
2424 #include "card.h"
2525
26−#define MMC_QUEUE_BOUNCESZ 65536
27−
2826 /*
2927 * Prepare a MMC request. This just filters out odd stuff.
3028 */
@@ -150,26 +148,6 @@ static void mmc_queue_setup_discard(struct request_queue *q, · 119 unmodified lines
150148 queue_flag_set_unlocked(QUEUE_FLAG_SECERASE, q);
151149 }
152150
153−static 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−
173151 /**
174152 * mmc_init_request() - initialize the MMC-specific per-request data
175153 * @q: the request queue
@@ -184,26 +162,9 @@ static int mmc_init_request(struct request_queue *q, struct request *req, · 8 unmodified lines
184162 struct mmc_card *card = mq->card;
185163 struct mmc_host *host = card->host;
186164
187− if (card->bouncesz) {
188− mq_rq->bounce_buf = kmalloc(card->bouncesz, gfp);
189− if (!mq_rq->bounce_buf)
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− }
165+ mq_rq->sg = mmc_alloc_sg(host->max_segs, gfp);
166+ if (!mq_rq->sg)
167+ return -ENOMEM;
207168
208169 return 0;
209170 }
@@ -212,13 +173,6 @@ static void mmc_exit_request(struct request_queue *q, struct request *req) · 2 unmodified lines
212173 {
213174 struct mmc_queue_req *mq_rq = req_to_mmc_queue_req(req);
214175
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−
222176 kfree(mq_rq->sg);
223177 mq_rq->sg = NULL;
224178 }
@@ -242,12 +196,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, · 17 unmodified lines
242196 if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
243197 limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
244198
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−
251199 mq->card = card;
252200 mq->queue = blk_alloc_queue(GFP_KERNEL);
253201 if (!mq->queue)
@@ -271,17 +219,11 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, · 17 unmodified lines
271219 if (mmc_can_erase(card))
272220 mmc_queue_setup_discard(mq->queue, card);
273221
274− if (card->bouncesz) {
275− blk_queue_max_hw_sectors(mq->queue, card->bouncesz / 512);
276− blk_queue_max_segments(mq->queue, card->bouncesz / 512);
277− blk_queue_max_segment_size(mq->queue, card->bouncesz);
278− } else {
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− }
222+ blk_queue_bounce_limit(mq->queue, limit);
223+ blk_queue_max_hw_sectors(mq->queue,
224+ min(host->max_blk_count, host->max_req_size / 512));
225+ blk_queue_max_segments(mq->queue, host->max_segs);
226+ blk_queue_max_segment_size(mq->queue, host->max_seg_size);
285227
286228 sema_init(&mq->thread_sem, 1);
287229
@@ -370,56 +312,7 @@ void mmc_queue_resume(struct mmc_queue *mq) · 82 unmodified lines
370312 */
371313 unsigned int mmc_queue_map_sg(struct mmc_queue *mq, struct mmc_queue_req *mqrq)
372314 {
373− unsigned int sg_len;
374− size_t buflen;
375− struct scatterlist *sg;
376315 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− */
399−void 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− */
415−void 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;
422316
423− sg_copy_from_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len,
424− mqrq->bounce_buf, mqrq->sg[0].length);
317+ return blk_rq_map_sg(mq->queue, req, mqrq->sg);
425318 }
drivers/mmc/core/queue.h+0−6
@@ -49,9 +49,6 @@ enum mmc_drv_op { · 48 unmodified lines
4949 struct mmc_queue_req {
5050 struct mmc_blk_request brq;
5151 struct scatterlist *sg;
52− char *bounce_buf;
53− struct scatterlist *bounce_sg;
54− unsigned int bounce_sg_len;
5552 struct mmc_async_req areq;
5653 enum mmc_drv_op drv_op;
5754 int drv_op_result;
@@ -81,11 +78,8 @@ extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *, · 23 unmodified lines
8178 extern void mmc_cleanup_queue(struct mmc_queue *);
8279 extern void mmc_queue_suspend(struct mmc_queue *);
8380 extern void mmc_queue_resume(struct mmc_queue *);
84−
8581 extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
8682 struct mmc_queue_req *);
87−extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
88−extern void mmc_queue_bounce_post(struct mmc_queue_req *);
8983
9084 extern int mmc_access_rpmb(struct mmc_queue *);
9185
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
10381038 */
10391039 mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
10401040 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;
10421042
10431043 if (host->use_sg)
10441044 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
531531 div->shift = __ffs(CLK_DIV_MASK);
532532 div->width = __builtin_popcountl(CLK_DIV_MASK);
533533 div->hw.init = &init;
534− div->flags = (CLK_DIVIDER_ONE_BASED |
535− CLK_DIVIDER_ROUND_CLOSEST);
534+ div->flags = CLK_DIVIDER_ONE_BASED;
536535
537536 clk = devm_clk_register(host->dev, &div->hw);
538537 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
717716 static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
718717 {
719718 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;
720735
721736 return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk);
722737 }
@@ -746,6 +761,11 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · 23 unmodified lines
746761 case MMC_POWER_UP:
747762 if (!IS_ERR(mmc->supply.vmmc))
748763 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+
749769 break;
750770
751771 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
759779 host->vqmmc_enabled = true;
760780 }
761781
762− /* Reset rx phase */
763− clk_set_phase(host->rx_clk, 0);
764782 break;
765783 }
766784
drivers/mmc/host/pxamci.c+1−5
@@ -702,11 +702,7 @@ static int pxamci_probe(struct platform_device *pdev) · 701 unmodified lines
702702
703703 pxamci_init_ocr(host);
704704
705− /*
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;
705+ mmc->caps = 0;
710706 host->cmdat = 0;
711707 if (!cpu_is_pxa25x()) {
712708 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
466466 {
467467 struct sdhci_pltfm_host *pltfm_host;
468468 struct sdhci_host *host;
469+ struct xenon_priv *priv;
469470 int err;
470471
471472 host = sdhci_pltfm_init(pdev, &sdhci_xenon_pdata,
@@ -474,6 +475,7 @@ static int xenon_probe(struct platform_device *pdev) · 2 unmodified lines
474475 return PTR_ERR(host);
475476
476477 pltfm_host = sdhci_priv(host);
478+ priv = sdhci_pltfm_priv(pltfm_host);
477479
478480 /*
479481 * Link Xenon specific mmc_host_ops function,
@@ -491,9 +493,20 @@ static int xenon_probe(struct platform_device *pdev) · 11 unmodified lines
491493 if (err)
492494 goto free_pltfm;
493495
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+
494507 err = mmc_of_parse(host->mmc);
495508 if (err)
496− goto err_clk;
509+ goto err_clk_axi;
497510
498511 sdhci_get_of_property(pdev);
499512
@@ -502,11 +515,11 @@ static int xenon_probe(struct platform_device *pdev) · 2 unmodified lines
502515 /* Xenon specific dt parse */
503516 err = xenon_probe_dt(pdev);
504517 if (err)
505− goto err_clk;
518+ goto err_clk_axi;
506519
507520 err = xenon_sdhc_prepare(host);
508521 if (err)
509− goto err_clk;
522+ goto err_clk_axi;
510523
511524 pm_runtime_get_noresume(&pdev->dev);
512525 pm_runtime_set_active(&pdev->dev);
@@ -527,6 +540,8 @@ remove_sdhc: · 14 unmodified lines
527540 pm_runtime_disable(&pdev->dev);
528541 pm_runtime_put_noidle(&pdev->dev);
529542 xenon_sdhc_unprepare(host);
543+err_clk_axi:
544+ clk_disable_unprepare(priv->axi_clk);
530545 err_clk:
531546 clk_disable_unprepare(pltfm_host->clk);
532547 free_pltfm:
@@ -538,6 +553,7 @@ static int xenon_remove(struct platform_device *pdev) · 5 unmodified lines
538553 {
539554 struct sdhci_host *host = platform_get_drvdata(pdev);
540555 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
556+ struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
541557
542558 pm_runtime_get_sync(&pdev->dev);
543559 pm_runtime_disable(&pdev->dev);
@@ -546,7 +562,7 @@ static int xenon_remove(struct platform_device *pdev) · 2 unmodified lines
546562 sdhci_remove_host(host, 0);
547563
548564 xenon_sdhc_unprepare(host);
549−
565+ clk_disable_unprepare(priv->axi_clk);
550566 clk_disable_unprepare(pltfm_host->clk);
551567
552568 sdhci_pltfm_free(pdev);
drivers/mmc/host/sdhci-xenon.h+1−0
@@ -83,6 +83,7 @@ struct xenon_priv { · 82 unmodified lines
8383 unsigned char bus_width;
8484 unsigned char timing;
8585 unsigned int clock;
86+ struct clk *axi_clk;
8687
8788 int phy_type;
8889 /*
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
566566 return true;
567567 default:
568568 bpf_warn_invalid_xdp_action(action);
569+ /* fall through */
569570 case XDP_ABORTED:
570571 trace_xdp_exception(nic->netdev, prog, action);
572+ /* fall through */
571573 case XDP_DROP:
572574 /* Check if it's a recycled page, if not
573575 * 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
175175 **/
176176 static s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw)
177177 {
178−#ifndef CONFIG_SPARC
179− u32 regval;
180− u32 i;
181−#endif
182178 s32 ret_val;
183179
184180 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
203181 if (ret_val)
204182 return ret_val;
205183
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
366366 }
367367 IXGBE_WRITE_FLUSH(hw);
368368
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
388369 return 0;
389370 }
390371
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
10491049 {
10501050 struct ixgbe_adapter *adapter = netdev_priv(netdev);
10511051 struct ixgbe_ring *temp_ring;
1052− int i, err = 0;
1052+ int i, j, err = 0;
10531053 u32 new_rx_count, new_tx_count;
10541054
10551055 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
10861086 }
10871087
10881088 /* allocate temporary buffer to store rings in */
1089− i = max_t(int, adapter->num_tx_queues, adapter->num_rx_queues);
1090− i = max_t(int, i, adapter->num_xdp_queues);
1089+ i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues,
1090+ adapter->num_rx_queues);
10911091 temp_ring = vmalloc(i * sizeof(struct ixgbe_ring));
10921092
10931093 if (!temp_ring) {
@@ -1119,8 +1119,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev, · 25 unmodified lines
11191119 }
11201120 }
11211121
1122− for (i = 0; i < adapter->num_xdp_queues; i++) {
1123− memcpy(&temp_ring[i], adapter->xdp_ring[i],
1122+ for (j = 0; j < adapter->num_xdp_queues; j++, i++) {
1123+ memcpy(&temp_ring[i], adapter->xdp_ring[j],
11241124 sizeof(struct ixgbe_ring));
11251125
11261126 temp_ring[i].count = new_tx_count;
@@ -1140,10 +1140,10 @@ static int ixgbe_set_ringparam(struct net_device *netdev, · 13 unmodified lines
11401140 memcpy(adapter->tx_ring[i], &temp_ring[i],
11411141 sizeof(struct ixgbe_ring));
11421142 }
1143− for (i = 0; i < adapter->num_xdp_queues; i++) {
1144− ixgbe_free_tx_resources(adapter->xdp_ring[i]);
1143+ for (j = 0; j < adapter->num_xdp_queues; j++, i++) {
1144+ ixgbe_free_tx_resources(adapter->xdp_ring[j]);
11451145
1146− memcpy(adapter->xdp_ring[i], &temp_ring[i],
1146+ memcpy(adapter->xdp_ring[j], &temp_ring[i],
11471147 sizeof(struct ixgbe_ring));
11481148 }
11491149
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
50145014 IXGBE_FLAG_GENEVE_OFFLOAD_CAPABLE)))
50155015 return;
50165016
5017− vxlanctrl = IXGBE_READ_REG(hw, IXGBE_VXLANCTRL) && ~mask;
5017+ vxlanctrl = IXGBE_READ_REG(hw, IXGBE_VXLANCTRL) & ~mask;
50185018 IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, vxlanctrl);
50195019
50205020 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
86658665 return ixgbe_ptp_set_ts_config(adapter, req);
86668666 case SIOCGHWTSTAMP:
86678667 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 */
86688672 default:
86698673 return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd);
86708674 }
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
36403640 static void mlxsw_sp_fib_lpm_tree_unlink(struct mlxsw_sp *mlxsw_sp,
36413641 struct mlxsw_sp_fib *fib)
36423642 {
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−
3656−err_tree_get:
36573643 if (!mlxsw_sp_prefix_usage_none(&fib->prefix_usage))
36583644 return;
36593645 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
13391339
13401340 static int ppp_dev_init(struct net_device *dev)
13411341 {
1342+ struct ppp *ppp;
1343+
13421344 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+
13431353 return 0;
13441354 }
13451355
@@ -1362,6 +1372,15 @@ static void ppp_dev_uninit(struct net_device *dev) · 16 unmodified lines
13621372 wake_up_interruptible(&ppp->file.rwait);
13631373 }
13641374
1375+static 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+
13651384 static const struct net_device_ops ppp_netdev_ops = {
13661385 .ndo_init = ppp_dev_init,
13671386 .ndo_uninit = ppp_dev_uninit,
@@ -1387,6 +1406,7 @@ static void ppp_setup(struct net_device *dev) · 19 unmodified lines
13871406 dev->tx_queue_len = 3;
13881407 dev->type = ARPHRD_PPP;
13891408 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
1409+ dev->priv_destructor = ppp_dev_priv_destructor;
13901410 netif_keep_dst(dev);
13911411 }
13921412
drivers/net/usb/cdc_ether.c+13−0
@@ -560,6 +560,7 @@ static const struct driver_info wwan_info = { · 559 unmodified lines
560560 #define NVIDIA_VENDOR_ID 0x0955
561561 #define HP_VENDOR_ID 0x03f0
562562 #define MICROSOFT_VENDOR_ID 0x045e
563+#define UBLOX_VENDOR_ID 0x1546
563564
564565 static const struct usb_device_id products[] = {
565566 /* BLACKLIST !!
@@ -868,6 +869,18 @@ static const struct usb_device_id products[] = { · 302 unmodified lines
868869 USB_CDC_SUBCLASS_ETHERNET,
869870 USB_CDC_PROTO_NONE),
870871 .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,
871884 }, {
872885 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
873886 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
21362136 struct nvme_ns *ns = nvme_get_ns_from_dev(dev);
21372137
21382138 if (a == &dev_attr_uuid.attr) {
2139− if (uuid_is_null(&ns->uuid) ||
2139+ if (uuid_is_null(&ns->uuid) &&
21402140 !memchr_inv(ns->nguid, 0, sizeof(ns->nguid)))
21412141 return 0;
21422142 }
drivers/nvme/host/pci.c+7−7
@@ -94,7 +94,7 @@ struct nvme_dev { · 93 unmodified lines
9494 struct mutex shutdown_lock;
9595 bool subsystem;
9696 void __iomem *cmb;
97− dma_addr_t cmb_dma_addr;
97+ pci_bus_addr_t cmb_bus_addr;
9898 u64 cmb_size;
9999 u32 cmbsz;
100100 u32 cmbloc;
@@ -1226,7 +1226,7 @@ static int nvme_alloc_sq_cmds(struct nvme_dev *dev, struct nvme_queue *nvmeq, · 1125 unmodified lines
12261226 if (qid && dev->cmb && use_cmb_sqes && NVME_CMB_SQS(dev->cmbsz)) {
12271227 unsigned offset = (qid - 1) * roundup(SQ_SIZE(depth),
12281228 dev->ctrl.page_size);
1229− nvmeq->sq_dma_addr = dev->cmb_dma_addr + offset;
1229+ nvmeq->sq_dma_addr = dev->cmb_bus_addr + offset;
12301230 nvmeq->sq_cmds_io = dev->cmb + offset;
12311231 } else {
12321232 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
15271527 resource_size_t bar_size;
15281528 struct pci_dev *pdev = to_pci_dev(dev->dev);
15291529 void __iomem *cmb;
1530− dma_addr_t dma_addr;
1530+ int bar;
15311531
15321532 dev->cmbsz = readl(dev->bar + NVME_REG_CMBSZ);
15331533 if (!(NVME_CMB_SZ(dev->cmbsz)))
@@ -1540,7 +1540,8 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev) · 6 unmodified lines
15401540 szu = (u64)1 << (12 + 4 * NVME_CMB_SZU(dev->cmbsz));
15411541 size = szu * NVME_CMB_SZ(dev->cmbsz);
15421542 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);
15441545
15451546 if (offset > bar_size)
15461547 return NULL;
@@ -1553,12 +1554,11 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev) · 6 unmodified lines
15531554 if (size > bar_size - offset)
15541555 size = bar_size - offset;
15551556
1556− dma_addr = pci_resource_start(pdev, NVME_CMB_BIR(dev->cmbloc)) + offset;
1557− cmb = ioremap_wc(dma_addr, size);
1557+ cmb = ioremap_wc(pci_resource_start(pdev, bar) + offset, size);
15581558 if (!cmb)
15591559 return NULL;
15601560
1561− dev->cmb_dma_addr = dma_addr;
1561+ dev->cmb_bus_addr = pci_bus_address(pdev, bar) + offset;
15621562 dev->cmb_size = size;
15631563 return cmb;
15641564 }
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
37673767 */
37683768 if ((vscsi->flags & (CLIENT_FAILED | RESPONSE_Q_DOWN))) {
37693769 pr_err("write_pending failed since: %d\n", vscsi->flags);
3770− return 0;
3770+ return -EIO;
37713771 }
37723772
37733773 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
28512851 /**
28522852 * iscsi_session_teardown - destroy session, host, and cls_session
28532853 * @cls_session: iscsi session
2854− *
2855− * The driver must have called iscsi_remove_session before
2856− * calling this.
28572854 */
28582855 void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
28592856 {
@@ -2863,6 +2860,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) · 3 unmodified lines
28632860
28642861 iscsi_pool_free(&session->cmdpool);
28652862
2863+ iscsi_remove_session(cls_session);
2864+
28662865 kfree(session->password);
28672866 kfree(session->password_in);
28682867 kfree(session->username);
@@ -2877,7 +2876,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) · 8 unmodified lines
28772876 kfree(session->portal_type);
28782877 kfree(session->discovery_parent_type);
28792878
2880− iscsi_destroy_session(cls_session);
2879+ iscsi_free_session(cls_session);
2880+
28812881 iscsi_host_dec_session_cnt(shost);
28822882 module_put(owner);
28832883 }
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
956956 if (*bflags & BLIST_NO_DIF)
957957 sdev->no_dif = 1;
958958
959+ if (*bflags & BLIST_UNMAP_LIMIT_WS)
960+ sdev->unmap_limit_for_ws = 1;
961+
959962 sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT;
960963
961964 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
22102210 }
22112211 EXPORT_SYMBOL_GPL(iscsi_free_session);
22122212
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− */
2220−int 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−}
2227−EXPORT_SYMBOL_GPL(iscsi_destroy_session);
2228−
22292213 /**
22302214 * iscsi_create_conn - create iscsi class connection
22312215 * @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
715715 break;
716716
717717 case SD_LBP_WS16:
718− max_blocks = min_not_zero(sdkp->max_ws_blocks,
719− (u32)SD_MAX_WS16_BLOCKS);
718+ if (sdkp->device->unmap_limit_for_ws)
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);
720724 break;
721725
722726 case SD_LBP_WS10:
723− max_blocks = min_not_zero(sdkp->max_ws_blocks,
724− (u32)SD_MAX_WS10_BLOCKS);
727+ if (sdkp->device->unmap_limit_for_ws)
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);
725733 break;
726734
727735 case SD_LBP_ZERO:
@@ -3099,8 +3107,6 @@ static int sd_revalidate_disk(struct gendisk *disk) · 2371 unmodified lines
30993107 sd_read_security(sdkp, buffer);
31003108 }
31013109
3102− sdkp->first_scan = 0;
3103−
31043110 /*
31053111 * We now have all cache related info, determine how we deal
31063112 * with flush requests.
@@ -3115,7 +3121,7 @@ static int sd_revalidate_disk(struct gendisk *disk) · 8 unmodified lines
31153121 q->limits.max_dev_sectors = logical_to_sectors(sdp, dev_max);
31163122
31173123 /*
3118− * Use the device's preferred I/O size for reads and writes
3124+ * Determine the device's preferred I/O size for reads and writes
31193125 * unless the reported value is unreasonably small, large, or
31203126 * garbage.
31213127 */
@@ -3129,8 +3135,19 @@ static int sd_revalidate_disk(struct gendisk *disk) · 7 unmodified lines
31293135 rw_max = min_not_zero(logical_to_sectors(sdp, dev_max),
31303136 (sector_t)BLK_DEF_MAX_SECTORS);
31313137
3132− /* Combine with controller limits */
3133− q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q));
3138+ /* Do not exceed controller limit */
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;
31343151
31353152 set_capacity(disk, logical_to_sectors(sdp, sdkp->capacity));
31363153 sd_config_write_same(sdkp);
fs/btrfs/ctree.h+1−1
@@ -722,7 +722,7 @@ struct btrfs_delayed_root; · 721 unmodified lines
722722 * Indicate that a whole-filesystem exclusive operation is running
723723 * (device replace, resize, device add/delete, balance)
724724 */
725−#define BTRFS_FS_EXCL_OP 14
725+#define BTRFS_FS_EXCL_OP 16
726726
727727 struct btrfs_fs_info {
728728 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
28012801 }
28022802 }
28032803
2804− bio = btrfs_bio_alloc(bdev, sector << 9);
2804+ bio = btrfs_bio_alloc(bdev, (u64)sector << 9);
28052805 bio_add_page(bio, page, page_size, offset);
28062806 bio->bi_end_io = end_io_func;
28072807 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
734734 inode = req->r_inode;
735735 ihold(inode);
736736 } else {
737− /* req->r_dentry is non-null for LSSNAP request.
738− * fall-thru */
739− WARN_ON_ONCE(!req->r_dentry);
737+ /* req->r_dentry is non-null for LSSNAP request */
738+ rcu_read_lock();
739+ inode = get_nonsnap_parent(req->r_dentry);
740+ rcu_read_unlock();
741+ dout("__choose_mds using snapdir's parent %p\n", inode);
740742 }
741− }
742− if (!inode && req->r_dentry) {
743+ } else if (req->r_dentry) {
743744 /* ignore race with rename; old or new d_parent is okay */
744745 struct dentry *parent;
745746 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
374374 realm->ino, realm, snapc, snapc->seq,
375375 (unsigned int) snapc->num_snaps);
376376
377− if (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− }
377+ ceph_put_snap_context(realm->cached_context);
382378 realm->cached_context = snapc;
379+ /* queue realm for cap_snap creation */
380+ list_add_tail(&realm->dirty_item, dirty_realms);
383381 return 0;
384382
385383 fail:
fs/namespace.c+3−1
@@ -468,7 +468,9 @@ static inline int may_write_real(struct file *file) · 467 unmodified lines
468468
469469 /* File refers to upper, writable layer? */
470470 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)))
472474 return 0;
473475
474476 /* 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
218218 static void pnfs_init_server(struct nfs_server *server)
219219 {
220220 rpc_init_wait_queue(&server->roc_rpcwaitq, "pNFS ROC");
221− rpc_init_wait_queue(&server->uoc_rpcwaitq, "NFS UOC");
222221 }
223222
224223 #else
@@ -888,6 +887,7 @@ struct nfs_server *nfs_alloc_server(void) · 663 unmodified lines
888887 ida_init(&server->openowner_id);
889888 ida_init(&server->lockowner_id);
890889 pnfs_init_server(server);
890+ rpc_init_wait_queue(&server->uoc_rpcwaitq, "NFS UOC");
891891
892892 return server;
893893 }
fs/nfs/filelayout/filelayout.c+2−1
@@ -745,7 +745,8 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg) · 744 unmodified lines
745745 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
746746
747747 dprintk("--> %s\n", __func__);
748− nfs4_fl_put_deviceid(fl->dsaddr);
748+ if (fl->dsaddr != NULL)
749+ nfs4_fl_put_deviceid(fl->dsaddr);
749750 /* This assumes a single RW lseg */
750751 if (lseg->pls_range.iomode == IOMODE_RW) {
751752 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
274274 ssize_t ret;
275275
276276 ret = nfs_idmap_get_desc(name, namelen, type, strlen(type), &desc);
277− if (ret <= 0)
277+ if (ret < 0)
278278 return ERR_PTR(ret);
279279
280280 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
83998399 lo = NFS_I(inode)->layout;
84008400 /* If the open stateid was bad, then recover it. */
84018401 if (!lo || test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags) ||
8402− nfs4_stateid_match_other(&lgp->args.stateid,
8403− &lgp->args.ctx->state->stateid)) {
8402+ !nfs4_stateid_match_other(&lgp->args.stateid, &lo->plh_stateid)) {
84048403 spin_unlock(&inode->i_lock);
84058404 exception->state = lgp->args.ctx->state;
84068405 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
18421842 * Assumes OPEN is the biggest non-idempotent compound.
18431843 * 2 is the verifier.
18441844 */
1845− max_resp_sz_cached = (NFS4_dec_open_sz + RPC_REPHDRSIZE +
1846− RPC_MAX_AUTH_SIZE + 2) * XDR_UNIT;
1845+ max_resp_sz_cached = (NFS4_dec_open_sz + RPC_REPHDRSIZE + 2)
1846+ * XDR_UNIT + RPC_MAX_AUTH_SIZE;
18471847
18481848 encode_op_hdr(xdr, OP_CREATE_SESSION, decode_create_session_maxsz, hdr);
18491849 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
561561 c->tmpfile = true;
562562 err = ovl_copy_up_locked(c);
563563 } else {
564− err = -EIO;
565− if (lock_rename(c->workdir, c->destdir) != NULL) {
566− pr_err("overlayfs: failed to lock workdir+upperdir\n");
567− } else {
564+ err = ovl_lock_rename_workdir(c->workdir, c->destdir);
565+ if (!err) {
568566 err = ovl_copy_up_locked(c);
569567 unlock_rename(c->workdir, c->destdir);
570568 }
fs/overlayfs/dir.c+0−20
@@ -216,26 +216,6 @@ out_unlock: · 215 unmodified lines
216216 return err;
217217 }
218218
219−static 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−
232−err_unlock:
233− unlock_rename(workdir, upperdir);
234−err:
235− pr_err("overlayfs: failed to lock workdir+upperdir\n");
236− return -EIO;
237−}
238−
239219 static struct dentry *ovl_clear_empty(struct dentry *dentry,
240220 struct list_head *list)
241221 {
fs/overlayfs/namei.c+1−0
@@ -506,6 +506,7 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry, · 505 unmodified lines
506506
507507 index = lookup_one_len_unlocked(name.name, ofs->indexdir, name.len);
508508 if (IS_ERR(index)) {
509+ err = PTR_ERR(index);
509510 pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n"
510511 "overlayfs: mount with '-o index=off' to disable inodes index.\n",
511512 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
235235 void ovl_inuse_unlock(struct dentry *dentry);
236236 int ovl_nlink_start(struct dentry *dentry, bool *locked);
237237 void ovl_nlink_end(struct dentry *dentry, bool locked);
238+int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *upperdir);
238239
239240 static inline bool ovl_is_impuredir(struct dentry *dentry)
240241 {
fs/overlayfs/ovl_entry.h+3−0
@@ -37,6 +37,9 @@ struct ovl_fs { · 36 unmodified lines
3737 bool noxattr;
3838 /* sb common to all layers */
3939 struct super_block *same_sb;
40+ /* Did we take the inuse lock? */
41+ bool upperdir_locked;
42+ bool workdir_locked;
4043 };
4144
4245 /* 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
988988 struct path *lowerstack, unsigned int numlower)
989989 {
990990 int err;
991+ struct dentry *index = NULL;
991992 struct inode *dir = dentry->d_inode;
992993 struct path path = { .mnt = mnt, .dentry = dentry };
993994 LIST_HEAD(list);
@@ -1007,8 +1008,6 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, · 13 unmodified lines
10071008
10081009 inode_lock_nested(dir, I_MUTEX_PARENT);
10091010 list_for_each_entry(p, &list, l_node) {
1010− struct dentry *index;
1011−
10121011 if (p->name[0] == '.') {
10131012 if (p->len == 1)
10141013 continue;
@@ -1018,6 +1017,7 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, · 3 unmodified lines
10181017 index = lookup_one_len(p->name, dentry, p->len);
10191018 if (IS_ERR(index)) {
10201019 err = PTR_ERR(index);
1020+ index = NULL;
10211021 break;
10221022 }
10231023 err = ovl_verify_index(index, lowerstack, numlower);
@@ -1029,7 +1029,9 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, · 5 unmodified lines
10291029 break;
10301030 }
10311031 dput(index);
1032+ index = NULL;
10321033 }
1034+ dput(index);
10331035 inode_unlock(dir);
10341036 out:
10351037 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
211211
212212 dput(ufs->indexdir);
213213 dput(ufs->workdir);
214− ovl_inuse_unlock(ufs->workbasedir);
214+ if (ufs->workdir_locked)
215+ ovl_inuse_unlock(ufs->workbasedir);
215216 dput(ufs->workbasedir);
216− if (ufs->upper_mnt)
217+ if (ufs->upper_mnt && ufs->upperdir_locked)
217218 ovl_inuse_unlock(ufs->upper_mnt->mnt_root);
218219 mntput(ufs->upper_mnt);
219220 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
881882 goto out_put_upperpath;
882883
883884 err = -EBUSY;
884− if (!ovl_inuse_trylock(upperpath.dentry)) {
885− pr_err("overlayfs: upperdir is in-use by another mount\n");
885+ if (ovl_inuse_trylock(upperpath.dentry)) {
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");
886889 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");
887892 }
888893
889894 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
901906 }
902907
903908 err = -EBUSY;
904− if (!ovl_inuse_trylock(workpath.dentry)) {
905− pr_err("overlayfs: workdir is in-use by another mount\n");
909+ if (ovl_inuse_trylock(workpath.dentry)) {
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");
906913 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");
907916 }
908917
909918 ufs->workbasedir = workpath.dentry;
@@ -1156,11 +1165,13 @@ out_put_lowerpath: · 246 unmodified lines
11561165 out_free_lowertmp:
11571166 kfree(lowertmp);
11581167 out_unlock_workdentry:
1159− ovl_inuse_unlock(workpath.dentry);
1168+ if (ufs->workdir_locked)
1169+ ovl_inuse_unlock(workpath.dentry);
11601170 out_put_workpath:
11611171 path_put(&workpath);
11621172 out_unlock_upperdentry:
1163− ovl_inuse_unlock(upperpath.dentry);
1173+ if (ufs->upperdir_locked)
1174+ ovl_inuse_unlock(upperpath.dentry);
11641175 out_put_upperpath:
11651176 path_put(&upperpath);
11661177 out_free_config:
fs/overlayfs/util.c+23−1
@@ -430,7 +430,7 @@ void ovl_inuse_unlock(struct dentry *dentry) · 429 unmodified lines
430430 }
431431 }
432432
433−/* Called must hold OVL_I(inode)->oi_lock */
433+/* Caller must hold OVL_I(inode)->lock */
434434 static void ovl_cleanup_index(struct dentry *dentry)
435435 {
436436 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
469469 err = PTR_ERR(index);
470470 if (!IS_ERR(index))
471471 err = ovl_cleanup(dir, index);
472+ else
473+ index = NULL;
474+
472475 inode_unlock(dir);
473476 if (err)
474477 goto fail;
@@ -557,3 +560,22 @@ void ovl_nlink_end(struct dentry *dentry, bool locked) · 82 unmodified lines
557560 mutex_unlock(&OVL_I(d_inode(dentry))->lock);
558561 }
559562 }
563+
564+int 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+
576+err_unlock:
577+ unlock_rename(workdir, upperdir);
578+err:
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
21222122 ip->i_d.di_flags2 |= tip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK;
21232123 tip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK;
21242124 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+
21252138 cowfp = ip->i_cowfp;
21262139 ip->i_cowfp = tip->i_cowfp;
21272140 tip->i_cowfp = cowfp;
2128− xfs_inode_set_cowblocks_tag(ip);
2129− xfs_inode_set_cowblocks_tag(tip);
2141+
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);
21302150 }
21312151
21322152 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
736736 /* If there is a hole at end_fsb - 1 go to the previous extent */
737737 if (!xfs_iext_lookup_extent(ip, ifp, end_fsb - 1, &idx, &got) ||
738738 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;
740746 xfs_iext_get_extent(ifp, --idx, &got);
741747 }
742748
@@ -809,6 +815,7 @@ next_extent: · 66 unmodified lines
809815
810816 out_defer:
811817 xfs_defer_cancel(&dfops);
818+out_cancel:
812819 xfs_trans_cancel(tp);
813820 xfs_iunlock(ip, XFS_ILOCK_EXCL);
814821 out:
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
407407 {
408408 }
409409
410+static inline int bpf_obj_get_user(const char __user *pathname)
411+{
412+ return -EOPNOTSUPP;
413+}
414+
410415 static inline struct net_device *__dev_map_lookup_elem(struct bpf_map *map,
411416 u32 key)
412417 {
include/linux/mmc/host.h+1−1
@@ -316,7 +316,7 @@ struct mmc_host { · 315 unmodified lines
316316 #define MMC_CAP_UHS_SDR50 (1 << 18) /* Host supports UHS SDR50 mode */
317317 #define MMC_CAP_UHS_SDR104 (1 << 19) /* Host supports UHS SDR104 mode */
318318 #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 */
320320 #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
321321 #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
322322 #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
108108
109109 #define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \
110110 ~(__alignof__(struct _xt_align)-1))
111−extern struct ebt_table *ebt_register_table(struct net *net,
112− const struct ebt_table *table,
113− const struct nf_hook_ops *);
111+extern int ebt_register_table(struct net *net,
112+ const struct ebt_table *table,
113+ const struct nf_hook_ops *ops,
114+ struct ebt_table **res);
114115 extern void ebt_unregister_table(struct net *net, struct ebt_table *table,
115116 const struct nf_hook_ops *);
116117 extern unsigned int ebt_do_table(struct sk_buff *skb,
include/linux/nmi.h+62−59
@@ -12,11 +12,31 @@ · 11 unmodified lines
1212
1313 #ifdef CONFIG_LOCKUP_DETECTOR
1414 void lockup_detector_init(void);
15+void lockup_detector_soft_poweroff(void);
16+void lockup_detector_cleanup(void);
17+bool is_hardlockup(void);
18+
19+extern int watchdog_user_enabled;
20+extern int nmi_watchdog_user_enabled;
21+extern int soft_watchdog_user_enabled;
22+extern int watchdog_thresh;
23+extern unsigned long watchdog_enabled;
24+
25+extern struct cpumask watchdog_cpumask;
26+extern unsigned long *watchdog_cpumask_bits;
27+#ifdef CONFIG_SMP
28+extern int sysctl_softlockup_all_cpu_backtrace;
29+extern int sysctl_hardlockup_all_cpu_backtrace;
1530 #else
16−static inline void lockup_detector_init(void)
17−{
18−}
19−#endif
31+#define sysctl_softlockup_all_cpu_backtrace 0
32+#define sysctl_hardlockup_all_cpu_backtrace 0
33+#endif /* !CONFIG_SMP */
34+
35+#else /* CONFIG_LOCKUP_DETECTOR */
36+static inline void lockup_detector_init(void) { }
37+static inline void lockup_detector_soft_poweroff(void) { }
38+static inline void lockup_detector_cleanup(void) { }
39+#endif /* !CONFIG_LOCKUP_DETECTOR */
2040
2141 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
2242 extern void touch_softlockup_watchdog_sched(void);
@@ -24,29 +44,17 @@ extern void touch_softlockup_watchdog(void); · 1 unmodified line
2444 extern void touch_softlockup_watchdog_sync(void);
2545 extern void touch_all_softlockup_watchdogs(void);
2646 extern unsigned int softlockup_panic;
27−extern int soft_watchdog_enabled;
28−extern atomic_t watchdog_park_in_progress;
2947 #else
30−static inline void touch_softlockup_watchdog_sched(void)
31−{
32−}
33−static inline void touch_softlockup_watchdog(void)
34−{
35−}
36−static inline void touch_softlockup_watchdog_sync(void)
37−{
38−}
39−static inline void touch_all_softlockup_watchdogs(void)
40−{
41−}
48+static inline void touch_softlockup_watchdog_sched(void) { }
49+static inline void touch_softlockup_watchdog(void) { }
50+static inline void touch_softlockup_watchdog_sync(void) { }
51+static inline void touch_all_softlockup_watchdogs(void) { }
4252 #endif
4353
4454 #ifdef CONFIG_DETECT_HUNG_TASK
4555 void reset_hung_task_detector(void);
4656 #else
47−static inline void reset_hung_task_detector(void)
48−{
49−}
57+static inline void reset_hung_task_detector(void) { }
5058 #endif
5159
5260 /*
@@ -54,12 +62,12 @@ static inline void reset_hung_task_detector(void) · 1 unmodified line
5462 * 'watchdog_enabled' variable. Each lockup detector has its dedicated bit -
5563 * bit 0 for the hard lockup detector and bit 1 for the soft lockup detector.
5664 *
57− * 'watchdog_user_enabled', 'nmi_watchdog_enabled' and 'soft_watchdog_enabled'
58− * are variables that are only used as an 'interface' between the parameters
59− * in /proc/sys/kernel and the internal state bits in 'watchdog_enabled'. The
60− * 'watchdog_thresh' variable is handled differently because its value is not
61− * boolean, and the lockup detectors are 'suspended' while 'watchdog_thresh'
62− * is equal zero.
65+ * 'watchdog_user_enabled', 'nmi_watchdog_user_enabled' and
66+ * 'soft_watchdog_user_enabled' are variables that are only used as an
67+ * 'interface' between the parameters in /proc/sys/kernel and the internal
68+ * state bits in 'watchdog_enabled'. The 'watchdog_thresh' variable is
69+ * handled differently because its value is not boolean, and the lockup
70+ * detectors are 'suspended' while 'watchdog_thresh' is equal zero.
6371 */
6472 #define NMI_WATCHDOG_ENABLED_BIT 0
6573 #define SOFT_WATCHDOG_ENABLED_BIT 1
@@ -73,17 +81,41 @@ extern unsigned int hardlockup_panic; · 7 unmodified lines
7381 static inline void hardlockup_detector_disable(void) {}
7482 #endif
7583
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+
7690 #if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF)
7791 extern void arch_touch_nmi_watchdog(void);
92+extern void hardlockup_detector_perf_stop(void);
93+extern void hardlockup_detector_perf_restart(void);
94+extern void hardlockup_detector_perf_disable(void);
95+extern void hardlockup_detector_perf_enable(void);
96+extern void hardlockup_detector_perf_cleanup(void);
97+extern int hardlockup_detector_perf_init(void);
7898 #else
79−#if !defined(CONFIG_HAVE_NMI_WATCHDOG)
99+static inline void hardlockup_detector_perf_stop(void) { }
100+static inline void hardlockup_detector_perf_restart(void) { }
101+static inline void hardlockup_detector_perf_disable(void) { }
102+static inline void hardlockup_detector_perf_enable(void) { }
103+static inline void hardlockup_detector_perf_cleanup(void) { }
104+# if !defined(CONFIG_HAVE_NMI_WATCHDOG)
105+static inline int hardlockup_detector_perf_init(void) { return -ENODEV; }
80106 static inline void arch_touch_nmi_watchdog(void) {}
107+# else
108+static inline int hardlockup_detector_perf_init(void) { return 0; }
109+# endif
81110 #endif
82−#endif
111+
112+void watchdog_nmi_stop(void);
113+void watchdog_nmi_start(void);
114+int watchdog_nmi_probe(void);
83115
84116 /**
85117 * touch_nmi_watchdog - restart NMI watchdog timeout.
86− *
118+ *
87119 * If the architecture supports the NMI watchdog, touch_nmi_watchdog()
88120 * may be used to reset the timeout - for code which intentionally
89121 * 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
153185 u64 hw_nmi_get_sample_period(int watchdog_thresh);
154186 #endif
155187
156−#ifdef CONFIG_LOCKUP_DETECTOR
157−extern int nmi_watchdog_enabled;
158−extern int watchdog_user_enabled;
159−extern int watchdog_thresh;
160−extern unsigned long watchdog_enabled;
161−extern struct cpumask watchdog_cpumask;
162−extern unsigned long *watchdog_cpumask_bits;
163−extern int __read_mostly watchdog_suspended;
164−#ifdef CONFIG_SMP
165−extern int sysctl_softlockup_all_cpu_backtrace;
166−extern 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−
172188 #if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \
173189 defined(CONFIG_HARDLOCKUP_DETECTOR)
174190 void watchdog_update_hrtimer_threshold(u64 period);
@@ -176,7 +192,6 @@ void watchdog_update_hrtimer_threshold(u64 period); · 1 unmodified line
176192 static inline void watchdog_update_hrtimer_threshold(u64 period) { }
177193 #endif
178194
179−extern bool is_hardlockup(void);
180195 struct ctl_table;
181196 extern int proc_watchdog(struct ctl_table *, int ,
182197 void __user *, size_t *, loff_t *);
@@ -188,18 +203,6 @@ extern int proc_watchdog_thresh(struct ctl_table *, int , · 5 unmodified lines
188203 void __user *, size_t *, loff_t *);
189204 extern int proc_watchdog_cpumask(struct ctl_table *, int,
190205 void __user *, size_t *, loff_t *);
191−extern int lockup_detector_suspend(void);
192−extern void lockup_detector_resume(void);
193−#else
194−static inline int lockup_detector_suspend(void)
195−{
196− return 0;
197−}
198−
199−static inline void lockup_detector_resume(void)
200−{
201−}
202−#endif
203206
204207 #ifdef CONFIG_HAVE_ACPI_APEI_NMI
205208 #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
5555 }
5656
5757 void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
58−int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread,
59− const struct cpumask *);
58+void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread,
59+ const struct cpumask *);
6060
6161 #endif
include/scsi/scsi_device.h+1−0
@@ -192,6 +192,7 @@ struct scsi_device { · 191 unmodified lines
192192 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */
193193 unsigned broken_fua:1; /* Don't set FUA bit */
194194 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 */
195196
196197 atomic_t disk_events_disable_depth; /* disable depth for disk events */
197198
include/scsi/scsi_devinfo.h+1−0
@@ -29,5 +29,6 @@ · 28 unmodified lines
2929 #define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */
3030 #define BLIST_NO_RSOC 0x20000000 /* don't try to issue RSOC */
3131 #define BLIST_MAX_1024 0x40000000 /* maximum 1024 sector cdb length */
32+#define BLIST_UNMAP_LIMIT_WS 0x80000000 /* Use UNMAP limit for WRITE SAME */
3233
3334 #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
434434 unsigned int target_id);
435435 extern void iscsi_remove_session(struct iscsi_cls_session *session);
436436 extern void iscsi_free_session(struct iscsi_cls_session *session);
437−extern int iscsi_destroy_session(struct iscsi_cls_session *session);
438437 extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
439438 int dd_size, uint32_t cid);
440439 extern 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
2323 XT_BPF_MODE_FD_PINNED,
2424 XT_BPF_MODE_FD_ELF,
2525 };
26+#define XT_BPF_MODE_PATH_PINNED XT_BPF_MODE_FD_PINNED
2627
2728 struct xt_bpf_info_v1 {
2829 __u16 mode;
kernel/bpf/inode.c+1−0
@@ -363,6 +363,7 @@ out: · 362 unmodified lines
363363 putname(pname);
364364 return ret;
365365 }
366+EXPORT_SYMBOL_GPL(bpf_obj_get_user);
366367
367368 static void bpf_evict_inode(struct inode *inode)
368369 {
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
704704 {
705705 struct bpf_verifier_state *parent = state->parent;
706706
707+ if (regno == BPF_REG_FP)
708+ /* We don't need to worry about FP liveness because it's read-only */
709+ return;
710+
707711 while (parent) {
708712 /* if read wasn't screened by an earlier write ... */
709713 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
24022406 * copy register state to dest reg
24032407 */
24042408 regs[insn->dst_reg] = regs[insn->src_reg];
2409+ regs[insn->dst_reg].live |= REG_LIVE_WRITTEN;
24052410 } else {
24062411 /* R1 = (u32) R2 */
24072412 if (is_pointer_value(env, insn->src_reg)) {
kernel/cpu.c+6−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <linux/lockdep.h>
2525 #include <linux/tick.h>
2626 #include <linux/irq.h>
27+#include <linux/nmi.h>
2728 #include <linux/smpboot.h>
2829 #include <linux/relay.h>
2930 #include <linux/slab.h>
@@ -897,6 +898,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen, · 867 unmodified lines
897898
898899 out:
899900 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();
900906 return ret;
901907 }
902908
kernel/smpboot.c+8−17
@@ -344,39 +344,30 @@ EXPORT_SYMBOL_GPL(smpboot_unregister_percpu_thread); · 343 unmodified lines
344344 * by the client, but only by calling this function.
345345 * This function can only be called on a registered smp_hotplug_thread.
346346 */
347−int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread,
348− const struct cpumask *new)
347+void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread,
348+ const struct cpumask *new)
349349 {
350350 struct cpumask *old = plug_thread->cpumask;
351− cpumask_var_t tmp;
351+ static struct cpumask tmp;
352352 unsigned int cpu;
353353
354− if (!alloc_cpumask_var(&tmp, GFP_KERNEL))
355− return -ENOMEM;
356−
357− get_online_cpus();
354+ lockdep_assert_cpus_held();
358355 mutex_lock(&smpboot_threads_lock);
359356
360357 /* Park threads that were exclusively enabled on the old mask. */
361− cpumask_andnot(tmp, old, new);
362− for_each_cpu_and(cpu, tmp, cpu_online_mask)
358+ cpumask_andnot(&tmp, old, new);
359+ for_each_cpu_and(cpu, &tmp, cpu_online_mask)
363360 smpboot_park_thread(plug_thread, cpu);
364361
365362 /* Unpark threads that are exclusively enabled on the new mask. */
366− cpumask_andnot(tmp, new, old);
367− for_each_cpu_and(cpu, tmp, cpu_online_mask)
363+ cpumask_andnot(&tmp, new, old);
364+ for_each_cpu_and(cpu, &tmp, cpu_online_mask)
368365 smpboot_unpark_thread(plug_thread, cpu);
369366
370367 cpumask_copy(old, new);
371368
372369 mutex_unlock(&smpboot_threads_lock);
373− put_online_cpus();
374−
375− free_cpumask_var(tmp);
376−
377− return 0;
378370 }
379−EXPORT_SYMBOL_GPL(smpboot_update_cpumask_percpu_thread);
380371
381372 static DEFINE_PER_CPU(atomic_t, cpu_hotplug_state) = ATOMIC_INIT(CPU_POST_DEAD);
382373
kernel/sysctl.c+9−13
@@ -872,9 +872,9 @@ static struct ctl_table kern_table[] = { · 871 unmodified lines
872872 #if defined(CONFIG_LOCKUP_DETECTOR)
873873 {
874874 .procname = "watchdog",
875− .data = &watchdog_user_enabled,
876− .maxlen = sizeof (int),
877− .mode = 0644,
875+ .data = &watchdog_user_enabled,
876+ .maxlen = sizeof(int),
877+ .mode = 0644,
878878 .proc_handler = proc_watchdog,
879879 .extra1 = &zero,
880880 .extra2 = &one,
@@ -890,16 +890,12 @@ static struct ctl_table kern_table[] = { · 9 unmodified lines
890890 },
891891 {
892892 .procname = "nmi_watchdog",
893− .data = &nmi_watchdog_enabled,
894− .maxlen = sizeof (int),
895− .mode = 0644,
893+ .data = &nmi_watchdog_user_enabled,
894+ .maxlen = sizeof(int),
895+ .mode = NMI_WATCHDOG_SYSCTL_PERM,
896896 .proc_handler = proc_nmi_watchdog,
897897 .extra1 = &zero,
898−#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
899898 .extra2 = &one,
900−#else
901− .extra2 = &zero,
902−#endif
903899 },
904900 {
905901 .procname = "watchdog_cpumask",
@@ -911,9 +907,9 @@ static struct ctl_table kern_table[] = { · 5 unmodified lines
911907 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
912908 {
913909 .procname = "soft_watchdog",
914− .data = &soft_watchdog_enabled,
915− .maxlen = sizeof (int),
916− .mode = 0644,
910+ .data = &soft_watchdog_user_enabled,
911+ .maxlen = sizeof(int),
912+ .mode = 0644,
917913 .proc_handler = proc_soft_watchdog,
918914 .extra1 = &zero,
919915 .extra2 = &one,
kernel/watchdog.c+238−405
@@ -29,20 +29,29 @@ · 28 unmodified lines
2929 #include <linux/kvm_para.h>
3030 #include <linux/kthread.h>
3131
32−/* Watchdog configuration */
33−static DEFINE_MUTEX(watchdog_proc_mutex);
34−
35−int __read_mostly nmi_watchdog_enabled;
32+static DEFINE_MUTEX(watchdog_mutex);
3633
3734 #if defined(CONFIG_HARDLOCKUP_DETECTOR) || defined(CONFIG_HAVE_NMI_WATCHDOG)
38−unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED |
39− NMI_WATCHDOG_ENABLED;
35+# define WATCHDOG_DEFAULT (SOFT_WATCHDOG_ENABLED | NMI_WATCHDOG_ENABLED)
36+# define NMI_WATCHDOG_DEFAULT 1
4037 #else
41−unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED;
38+# define WATCHDOG_DEFAULT (SOFT_WATCHDOG_ENABLED)
39+# define NMI_WATCHDOG_DEFAULT 0
4240 #endif
4341
42+unsigned long __read_mostly watchdog_enabled;
43+int __read_mostly watchdog_user_enabled = 1;
44+int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT;
45+int __read_mostly soft_watchdog_user_enabled = 1;
46+int __read_mostly watchdog_thresh = 10;
47+int __read_mostly nmi_watchdog_available;
48+
49+struct cpumask watchdog_allowed_mask __read_mostly;
50+
51+struct cpumask watchdog_cpumask __read_mostly;
52+unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask);
53+
4454 #ifdef CONFIG_HARDLOCKUP_DETECTOR
45−/* boot commands */
4655 /*
4756 * Should we panic when a soft-lockup or hard-lockup occurs:
4857 */
@@ -56,9 +65,9 @@ unsigned int __read_mostly hardlockup_panic = · 7 unmodified lines
5665 * kernel command line parameters are parsed, because otherwise it is not
5766 * possible to override this in hardlockup_panic_setup().
5867 */
59−void hardlockup_detector_disable(void)
68+void __init hardlockup_detector_disable(void)
6069 {
61− watchdog_enabled &= ~NMI_WATCHDOG_ENABLED;
70+ nmi_watchdog_user_enabled = 0;
6271 }
6372
6473 static int __init hardlockup_panic_setup(char *str)
@@ -68,48 +77,24 @@ static int __init hardlockup_panic_setup(char *str) · 3 unmodified lines
6877 else if (!strncmp(str, "nopanic", 7))
6978 hardlockup_panic = 0;
7079 else if (!strncmp(str, "0", 1))
71− watchdog_enabled &= ~NMI_WATCHDOG_ENABLED;
80+ nmi_watchdog_user_enabled = 0;
7281 else if (!strncmp(str, "1", 1))
73− watchdog_enabled |= NMI_WATCHDOG_ENABLED;
82+ nmi_watchdog_user_enabled = 1;
7483 return 1;
7584 }
7685 __setup("nmi_watchdog=", hardlockup_panic_setup);
7786
78−#endif
79−
80−#ifdef CONFIG_SOFTLOCKUP_DETECTOR
81−int __read_mostly soft_watchdog_enabled;
82−#endif
83−
84−int __read_mostly watchdog_user_enabled;
85−int __read_mostly watchdog_thresh = 10;
86−
87−#ifdef CONFIG_SMP
88−int __read_mostly sysctl_softlockup_all_cpu_backtrace;
87+# ifdef CONFIG_SMP
8988 int __read_mostly sysctl_hardlockup_all_cpu_backtrace;
90−#endif
91−struct cpumask watchdog_cpumask __read_mostly;
92−unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask);
9389
94−/*
95− * The 'watchdog_running' variable is set to 1 when the watchdog threads
96− * are registered/started and is set to 0 when the watchdog threads are
97− * unregistered/stopped, so it is an indicator whether the threads exist.
98− */
99−static int __read_mostly watchdog_running;
100−/*
101− * If a subsystem has a need to deactivate the watchdog temporarily, it
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− */
112−int __read_mostly watchdog_suspended;
90+static int __init hardlockup_all_cpu_backtrace_setup(char *str)
91+{
92+ sysctl_hardlockup_all_cpu_backtrace = !!simple_strtol(str, NULL, 0);
93+ return 1;
94+}
95+__setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup);
96+# endif /* CONFIG_SMP */
97+#endif /* CONFIG_HARDLOCKUP_DETECTOR */
11398
11499 /*
115100 * These functions can be overridden if an architecture implements its
@@ -121,36 +106,68 @@ int __read_mostly watchdog_suspended; · 5 unmodified lines
121106 */
122107 int __weak watchdog_nmi_enable(unsigned int cpu)
123108 {
109+ hardlockup_detector_perf_enable();
124110 return 0;
125111 }
112+
126113 void __weak watchdog_nmi_disable(unsigned int cpu)
127114 {
115+ hardlockup_detector_perf_disable();
128116 }
129117
130−/*
131− * watchdog_nmi_reconfigure can be implemented to be notified after any
132− * watchdog configuration change. The arch hardlockup watchdog should
133− * respond to the following variables:
134− * - nmi_watchdog_enabled
118+/* Return 0, if a NMI watchdog is available. Error code otherwise */
119+int __weak __init watchdog_nmi_probe(void)
120+{
121+ return hardlockup_detector_perf_init();
122+}
123+
124+/**
125+ * watchdog_nmi_stop - Stop the watchdog for reconfiguration
126+ *
127+ * The reconfiguration steps are:
128+ * watchdog_nmi_stop();
129+ * update_variables();
130+ * watchdog_nmi_start();
131+ */
132+void __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
135142 * - watchdog_thresh
136143 * - watchdog_cpumask
137− * - sysctl_hardlockup_all_cpu_backtrace
138− * - hardlockup_panic
139− * - watchdog_suspended
140144 */
141−void __weak watchdog_nmi_reconfigure(void)
145+void __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+ */
153+static void lockup_detector_update_enable(void)
142154 {
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;
143162 }
144163
145−
146164 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
147165
148−/* Helper for online, unparked cpus. */
149−#define for_each_watchdog_cpu(cpu) \
150− for_each_cpu_and((cpu), cpu_online_mask, &watchdog_cpumask)
151−
152−atomic_t watchdog_park_in_progress = ATOMIC_INIT(0);
166+/* Global variables, exported for sysctl */
167+unsigned int __read_mostly softlockup_panic =
168+ CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
153169
170+static bool softlockup_threads_initialized __read_mostly;
154171 static u64 __read_mostly sample_period;
155172
156173 static 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
164181 static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved);
165182 static unsigned long soft_lockup_nmi_warn;
166183
167−unsigned int __read_mostly softlockup_panic =
168− CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
169−
170184 static int __init softlockup_panic_setup(char *str)
171185 {
172186 softlockup_panic = simple_strtoul(str, NULL, 0);
173−
174187 return 1;
175188 }
176189 __setup("softlockup_panic=", softlockup_panic_setup);
177190
178191 static int __init nowatchdog_setup(char *str)
179192 {
180− watchdog_enabled = 0;
193+ watchdog_user_enabled = 0;
181194 return 1;
182195 }
183196 __setup("nowatchdog", nowatchdog_setup);
184197
185198 static int __init nosoftlockup_setup(char *str)
186199 {
187− watchdog_enabled &= ~SOFT_WATCHDOG_ENABLED;
200+ soft_watchdog_user_enabled = 0;
188201 return 1;
189202 }
190203 __setup("nosoftlockup", nosoftlockup_setup);
191204
192205 #ifdef CONFIG_SMP
206+int __read_mostly sysctl_softlockup_all_cpu_backtrace;
207+
193208 static int __init softlockup_all_cpu_backtrace_setup(char *str)
194209 {
195− sysctl_softlockup_all_cpu_backtrace =
196− !!simple_strtol(str, NULL, 0);
210+ sysctl_softlockup_all_cpu_backtrace = !!simple_strtol(str, NULL, 0);
197211 return 1;
198212 }
199213 __setup("softlockup_all_cpu_backtrace=", softlockup_all_cpu_backtrace_setup);
200−#ifdef CONFIG_HARDLOCKUP_DETECTOR
201−static 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
209214 #endif
210215
216+static void __lockup_detector_cleanup(void);
217+
211218 /*
212219 * Hard-lockup warnings should be triggered after just a few seconds. Soft-
213220 * lockups can have false positives under extreme conditions. So we generally
@@ -278,11 +285,15 @@ void touch_all_softlockup_watchdogs(void) · 64 unmodified lines
278285 int cpu;
279286
280287 /*
281− * this is done lockless
282− * do we care if a 0 races with a timestamp?
283− * all it means is the softlock check starts one cycle later
288+ * watchdog_mutex cannpt be taken here, as this might be called
289+ * from (soft)interrupt context, so the access to
290+ * watchdog_allowed_cpumask might race with a concurrent update.
291+ *
292+ * The watchdog time stamp can race against a concurrent real
293+ * update as well, the only side effect might be a cycle delay for
294+ * the softlockup check.
284295 */
285− for_each_watchdog_cpu(cpu)
296+ for_each_cpu(cpu, &watchdog_allowed_mask)
286297 per_cpu(watchdog_touch_ts, cpu) = 0;
287298 wq_watchdog_touch(-1);
288299 }
@@ -322,9 +333,6 @@ static void watchdog_interrupt_count(void) · 33 unmodified lines
322333 __this_cpu_inc(hrtimer_interrupts);
323334 }
324335
325−static int watchdog_enable_all_cpus(void);
326−static void watchdog_disable_all_cpus(void);
327−
328336 /* watchdog kicker functions */
329337 static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
330338 {
@@ -333,7 +341,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) · 2 unmodified lines
333341 int duration;
334342 int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace;
335343
336− if (atomic_read(&watchdog_park_in_progress) != 0)
344+ if (!watchdog_enabled)
337345 return HRTIMER_NORESTART;
338346
339347 /* kick the hardlockup detector */
@@ -447,32 +455,38 @@ static void watchdog_set_prio(unsigned int policy, unsigned int prio) · 107 unmodified lines
447455
448456 static void watchdog_enable(unsigned int cpu)
449457 {
450− struct hrtimer *hrtimer = raw_cpu_ptr(&watchdog_hrtimer);
458+ struct hrtimer *hrtimer = this_cpu_ptr(&watchdog_hrtimer);
451459
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+ */
453464 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
454465 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() */
460466 hrtimer_start(hrtimer, ns_to_ktime(sample_period),
461467 HRTIMER_MODE_REL_PINNED);
462468
463− /* initialize timestamp */
464− watchdog_set_prio(SCHED_FIFO, MAX_RT_PRIO - 1);
469+ /* Initialize timestamp */
465470 __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);
466476 }
467477
468478 static void watchdog_disable(unsigned int cpu)
469479 {
470− struct hrtimer *hrtimer = raw_cpu_ptr(&watchdog_hrtimer);
480+ struct hrtimer *hrtimer = this_cpu_ptr(&watchdog_hrtimer);
471481
472482 watchdog_set_prio(SCHED_NORMAL, 0);
473− hrtimer_cancel(hrtimer);
474− /* disable the perf event */
483+ /*
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+ */
475488 watchdog_nmi_disable(cpu);
489+ hrtimer_cancel(hrtimer);
476490 }
477491
478492 static void watchdog_cleanup(unsigned int cpu, bool online)
@@ -499,21 +513,6 @@ static void watchdog(unsigned int cpu) · 20 unmodified lines
499513 __this_cpu_write(soft_lockup_hrtimer_cnt,
500514 __this_cpu_read(hrtimer_interrupts));
501515 __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);
517516 }
518517
519518 static struct smp_hotplug_thread watchdog_threads = {
@@ -527,295 +526,174 @@ static struct smp_hotplug_thread watchdog_threads = { · 7 unmodified lines
527526 .unpark = watchdog_enable,
528527 };
529528
530−/*
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− */
542−static int watchdog_park_threads(void)
529+static void softlockup_update_smpboot_threads(void)
543530 {
544− int cpu, ret = 0;
531+ lockdep_assert_held(&watchdog_mutex);
545532
546− atomic_set(&watchdog_park_in_progress, 1);
533+ if (!softlockup_threads_initialized)
534+ return;
547535
548− for_each_watchdog_cpu(cpu) {
549− ret = kthread_park(per_cpu(softlockup_watchdog, cpu));
550− if (ret)
551− break;
552− }
553−
554− atomic_set(&watchdog_park_in_progress, 0);
555−
556− return ret;
536+ smpboot_update_cpumask_percpu_thread(&watchdog_threads,
537+ &watchdog_allowed_mask);
557538 }
558539
559−/*
560− * unpark all watchdog threads that are specified in 'watchdog_cpumask'
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− */
565−static void watchdog_unpark_threads(void)
540+/* Temporarily park all watchdog threads */
541+static void softlockup_park_all_threads(void)
566542 {
567− int cpu;
568−
569− for_each_watchdog_cpu(cpu)
570− kthread_unpark(per_cpu(softlockup_watchdog, cpu));
543+ cpumask_clear(&watchdog_allowed_mask);
544+ softlockup_update_smpboot_threads();
571545 }
572546
573−static int update_watchdog_all_cpus(void)
547+/* Unpark enabled threads */
548+static void softlockup_unpark_threads(void)
574549 {
575− int ret;
576−
577− ret = watchdog_park_threads();
578− if (ret)
579− return ret;
580−
581− watchdog_unpark_threads();
582−
583− return 0;
550+ cpumask_copy(&watchdog_allowed_mask, &watchdog_cpumask);
551+ softlockup_update_smpboot_threads();
584552 }
585553
586−static int watchdog_enable_all_cpus(void)
554+static void lockup_detector_reconfigure(void)
587555 {
588− int err = 0;
589−
590− if (!watchdog_running) {
591− err = smpboot_register_percpu_thread_cpumask(&watchdog_threads,
592− &watchdog_cpumask);
593− if (err)
594− pr_err("Failed to create watchdog threads, disabled\n");
595− else
596− watchdog_running = 1;
597− } else {
598− /*
599− * Enable/disable the lockup detectors or
600− * change the sample period 'on the fly'.
601− */
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;
556+ cpus_read_lock();
557+ watchdog_nmi_stop();
558+ softlockup_park_all_threads();
559+ set_sample_period();
560+ lockup_detector_update_enable();
561+ if (watchdog_enabled && watchdog_thresh)
562+ softlockup_unpark_threads();
563+ watchdog_nmi_start();
564+ cpus_read_unlock();
565+ /*
566+ * Must be called outside the cpus locked section to prevent
567+ * recursive locking in the perf code.
568+ */
569+ __lockup_detector_cleanup();
614570 }
615571
616−static 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+ */
579+static __init void lockup_detector_setup(void)
617580 {
618− if (watchdog_running) {
619− watchdog_running = 0;
620− smpboot_unregister_percpu_thread(&watchdog_threads);
621− }
622−}
581+ int ret;
623582
624−#ifdef CONFIG_SYSCTL
625−static int watchdog_update_cpus(void)
626−{
627− return smpboot_update_cpumask_percpu_thread(
628− &watchdog_threads, &watchdog_cpumask);
629−}
630−#endif
583+ /*
584+ * If sysctl is off and watchdog got disabled on the command line,
585+ * nothing to do here.
586+ */
587+ lockup_detector_update_enable();
631588
632−#else /* SOFTLOCKUP */
633−static int watchdog_park_threads(void)
634−{
635− return 0;
636−}
589+ if (!IS_ENABLED(CONFIG_SYSCTL) &&
590+ !(watchdog_enabled && watchdog_thresh))
591+ return;
637592
638−static void watchdog_unpark_threads(void)
639−{
640−}
593+ ret = smpboot_register_percpu_thread_cpumask(&watchdog_threads,
594+ &watchdog_allowed_mask);
595+ if (ret) {
596+ pr_err("Failed to initialize soft lockup detector threads\n");
597+ return;
598+ }
641599
642−static int watchdog_enable_all_cpus(void)
643−{
644− return 0;
600+ mutex_lock(&watchdog_mutex);
601+ softlockup_threads_initialized = true;
602+ lockup_detector_reconfigure();
603+ mutex_unlock(&watchdog_mutex);
645604 }
646605
647−static void watchdog_disable_all_cpus(void)
606+#else /* CONFIG_SOFTLOCKUP_DETECTOR */
607+static inline int watchdog_park_threads(void) { return 0; }
608+static inline void watchdog_unpark_threads(void) { }
609+static inline int watchdog_enable_all_cpus(void) { return 0; }
610+static inline void watchdog_disable_all_cpus(void) { }
611+static void lockup_detector_reconfigure(void)
648612 {
613+ cpus_read_lock();
614+ watchdog_nmi_stop();
615+ lockup_detector_update_enable();
616+ watchdog_nmi_start();
617+ cpus_read_unlock();
649618 }
650−
651−#ifdef CONFIG_SYSCTL
652−static int watchdog_update_cpus(void)
619+static inline void lockup_detector_setup(void)
653620 {
654− return 0;
621+ lockup_detector_reconfigure();
655622 }
656−#endif
623+#endif /* !CONFIG_SOFTLOCKUP_DETECTOR */
657624
658−static void set_sample_period(void)
625+static void __lockup_detector_cleanup(void)
659626 {
627+ lockdep_assert_held(&watchdog_mutex);
628+ hardlockup_detector_perf_cleanup();
660629 }
661−#endif /* SOFTLOCKUP */
662630
663−/*
664− * Suspend the hard and soft lockup detector by parking the watchdog threads.
631+/**
632+ * lockup_detector_cleanup - Cleanup after cpu hotplug or sysctl changes
633+ *
634+ * Caller must not hold the cpu hotplug rwsem.
665635 */
666−int lockup_detector_suspend(void)
636+void lockup_detector_cleanup(void)
667637 {
668− int ret = 0;
669−
670− get_online_cpus();
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;
638+ mutex_lock(&watchdog_mutex);
639+ __lockup_detector_cleanup();
640+ mutex_unlock(&watchdog_mutex);
695641 }
696642
697−/*
698− * Resume the hard and soft lockup detector by unparking the watchdog threads.
643+/**
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.
699648 */
700−void lockup_detector_resume(void)
649+void lockup_detector_soft_poweroff(void)
701650 {
702− mutex_lock(&watchdog_proc_mutex);
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();
651+ watchdog_enabled = 0;
716652 }
717653
718654 #ifdef CONFIG_SYSCTL
719655
720−/*
721− * Update the run state of the lockup detectors.
722− */
723−static int proc_watchdog_update(void)
656+/* Propagate any changes to the watchdog threads */
657+static void proc_watchdog_update(void)
724658 {
725− int err = 0;
726−
727− /*
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−
659+ /* Remove impossible cpus to keep sysctl output clean. */
660+ cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask);
661+ lockup_detector_reconfigure();
743662 }
744663
745664 /*
746665 * common function for watchdog, nmi_watchdog and soft_watchdog parameter
747666 *
748− * caller | table->data points to | 'which' contains the flag(s)
749− * -------------------|-----------------------|-----------------------------
750− * proc_watchdog | watchdog_user_enabled | NMI_WATCHDOG_ENABLED or'ed
751− * | | with SOFT_WATCHDOG_ENABLED
752− * -------------------|-----------------------|-----------------------------
753− * proc_nmi_watchdog | nmi_watchdog_enabled | NMI_WATCHDOG_ENABLED
754− * -------------------|-----------------------|-----------------------------
755− * proc_soft_watchdog | soft_watchdog_enabled | SOFT_WATCHDOG_ENABLED
667+ * caller | table->data points to | 'which'
668+ * -------------------|----------------------------|--------------------------
669+ * proc_watchdog | watchdog_user_enabled | NMI_WATCHDOG_ENABLED |
670+ * | | SOFT_WATCHDOG_ENABLED
671+ * -------------------|----------------------------|--------------------------
672+ * proc_nmi_watchdog | nmi_watchdog_user_enabled | NMI_WATCHDOG_ENABLED
673+ * -------------------|----------------------------|--------------------------
674+ * proc_soft_watchdog | soft_watchdog_user_enabled | SOFT_WATCHDOG_ENABLED
756675 */
757676 static int proc_watchdog_common(int which, struct ctl_table *table, int write,
758677 void __user *buffer, size_t *lenp, loff_t *ppos)
759678 {
760− int err, old, new;
761− int *watchdog_param = (int *)table->data;
679+ int err, old, *param = table->data;
762680
763− get_online_cpus();
764− mutex_lock(&watchdog_proc_mutex);
681+ mutex_lock(&watchdog_mutex);
765682
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− */
777683 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;
779689 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
780690 } else {
691+ old = READ_ONCE(*param);
781692 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
782− if (err)
783− goto out;
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();
693+ if (!err && old != READ_ONCE(*param))
694+ proc_watchdog_update();
815695 }
816−out:
817− mutex_unlock(&watchdog_proc_mutex);
818− put_online_cpus();
696+ mutex_unlock(&watchdog_mutex);
819697 return err;
820698 }
821699
@@ -835,6 +713,8 @@ int proc_watchdog(struct ctl_table *table, int write, · 13 unmodified lines
835713 int proc_nmi_watchdog(struct ctl_table *table, int write,
836714 void __user *buffer, size_t *lenp, loff_t *ppos)
837715 {
716+ if (!nmi_watchdog_available && write)
717+ return -ENOTSUPP;
838718 return proc_watchdog_common(NMI_WATCHDOG_ENABLED,
839719 table, write, buffer, lenp, ppos);
840720 }
@@ -855,39 +735,17 @@ int proc_soft_watchdog(struct ctl_table *table, int write, · 14 unmodified lines
855735 int proc_watchdog_thresh(struct ctl_table *table, int write,
856736 void __user *buffer, size_t *lenp, loff_t *ppos)
857737 {
858− int err, old, new;
859−
860− get_online_cpus();
861− mutex_lock(&watchdog_proc_mutex);
738+ int err, old;
862739
863− if (watchdog_suspended) {
864− /* no parameter changes allowed while watchdog is suspended */
865− err = -EAGAIN;
866− goto out;
867− }
740+ mutex_lock(&watchdog_mutex);
868741
869− old = ACCESS_ONCE(watchdog_thresh);
742+ old = READ_ONCE(watchdog_thresh);
870743 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
871744
872− if (err || !write)
873− goto out;
874−
875− /*
876− * Update the sample period. Restore on failure.
877− */
878− new = ACCESS_ONCE(watchdog_thresh);
879− if (old == new)
880− goto out;
745+ if (!err && write && old != READ_ONCE(watchdog_thresh))
746+ proc_watchdog_update();
881747
882− set_sample_period();
883− err = proc_watchdog_update();
884− if (err) {
885− watchdog_thresh = old;
886− set_sample_period();
887− }
888−out:
889− mutex_unlock(&watchdog_proc_mutex);
890− put_online_cpus();
748+ mutex_unlock(&watchdog_mutex);
891749 return err;
892750 }
893751
@@ -902,45 +760,19 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write, · 8 unmodified lines
902760 {
903761 int err;
904762
905− get_online_cpus();
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− }
763+ mutex_lock(&watchdog_mutex);
913764
914765 err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
915− if (!err && write) {
916− /* Remove impossible cpus to keep sysctl output cleaner. */
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− }
766+ if (!err && write)
767+ proc_watchdog_update();
929768
930− watchdog_nmi_reconfigure();
931− }
932−out:
933− mutex_unlock(&watchdog_proc_mutex);
934− put_online_cpus();
769+ mutex_unlock(&watchdog_mutex);
935770 return err;
936771 }
937−
938772 #endif /* CONFIG_SYSCTL */
939773
940774 void __init lockup_detector_init(void)
941775 {
942− set_sample_period();
943−
944776 #ifdef CONFIG_NO_HZ_FULL
945777 if (tick_nohz_full_enabled()) {
946778 pr_info("Disabling watchdog on nohz_full cores by default\n");
@@ -951,6 +783,7 @@ void __init lockup_detector_init(void) · 4 unmodified lines
951783 cpumask_copy(&watchdog_cpumask, cpu_possible_mask);
952784 #endif
953785
954− if (watchdog_enabled)
955− watchdog_enable_all_cpus();
786+ if (!watchdog_nmi_probe())
787+ nmi_watchdog_available = true;
788+ lockup_detector_setup();
956789 }
kernel/watchdog_hld.c+111−85
@@ -21,8 +21,10 @@ · 20 unmodified lines
2121 static DEFINE_PER_CPU(bool, hard_watchdog_warn);
2222 static DEFINE_PER_CPU(bool, watchdog_nmi_touch);
2323 static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
24+static struct cpumask dead_events_mask;
2425
2526 static unsigned long hardlockup_allcpu_dumped;
27+static unsigned int watchdog_cpus;
2628
2729 void arch_touch_nmi_watchdog(void)
2830 {
@@ -103,15 +105,12 @@ static struct perf_event_attr wd_hw_attr = { · 74 unmodified lines
103105
104106 /* Callback function for perf event subsystem */
105107 static void watchdog_overflow_callback(struct perf_event *event,
106− struct perf_sample_data *data,
107− struct pt_regs *regs)
108+ struct perf_sample_data *data,
109+ struct pt_regs *regs)
108110 {
109111 /* Ensure the watchdog never gets throttled */
110112 event->hw.interrupts = 0;
111113
112− if (atomic_read(&watchdog_park_in_progress) != 0)
113− return;
114−
115114 if (__this_cpu_read(watchdog_nmi_touch) == true) {
116115 __this_cpu_write(watchdog_nmi_touch, false);
117116 return;
@@ -160,104 +159,131 @@ static void watchdog_overflow_callback(struct perf_event *event, · 42 unmodified lines
160159 return;
161160 }
162161
163−/*
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− */
168−static unsigned long firstcpu_err;
169−static atomic_t watchdog_cpus;
170−
171−int watchdog_nmi_enable(unsigned int cpu)
162+static int hardlockup_detector_event_create(void)
172163 {
164+ unsigned int cpu = smp_processor_id();
173165 struct perf_event_attr *wd_attr;
174− struct perf_event *event = per_cpu(watchdog_ev, cpu);
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;
166+ struct perf_event *evt;
191167
192168 wd_attr = &wd_hw_attr;
193169 wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh);
194170
195171 /* 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+}
197182
198− /* save the first cpu's error for future comparision */
199− if (firstcpu && IS_ERR(event))
200− firstcpu_err = PTR_ERR(event);
183+/**
184+ * hardlockup_detector_perf_enable - Enable the local event
185+ */
186+void hardlockup_detector_perf_enable(void)
187+{
188+ if (hardlockup_detector_event_create())
189+ return;
201190
202− if (!IS_ERR(event)) {
203− /* only print for the first cpu initialized */
204− if (firstcpu || firstcpu_err)
205− pr_info("enabled on all CPUs, permanently consumes one hw-PMU counter.\n");
206− goto out_save;
207− }
191+ if (!watchdog_cpus++)
192+ pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
208193
209− /*
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 */
240−out_save:
241− per_cpu(watchdog_ev, cpu) = event;
242−out_enable:
243− perf_event_enable(per_cpu(watchdog_ev, cpu));
244−out:
245− return 0;
194+ perf_event_enable(this_cpu_read(watchdog_ev));
246195 }
247196
248−void watchdog_nmi_disable(unsigned int cpu)
197+/**
198+ * hardlockup_detector_perf_disable - Disable the local event
199+ */
200+void hardlockup_detector_perf_disable(void)
249201 {
250− struct perf_event *event = per_cpu(watchdog_ev, cpu);
202+ struct perf_event *event = this_cpu_read(watchdog_ev);
251203
252204 if (event) {
253205 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+ */
216+void 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);
254229 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+ */
239+void __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+}
255252
256− /* should be in cleanup, but blocks oprofile */
257− perf_event_release_kernel(event);
253+/**
254+ * hardlockup_detector_perf_restart - Globally restart watchdog events
255+ *
256+ * Special interface for x86 to handle the perf HT bug.
257+ */
258+void __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+ */
278+int __init hardlockup_detector_perf_init(void)
279+{
280+ int ret = hardlockup_detector_event_create();
258281
259− /* watchdog_nmi_enable() expects this to be zero initially. */
260− if (atomic_dec_and_test(&watchdog_cpus))
261− firstcpu_err = 0;
282+ if (ret) {
283+ pr_info("Perf NMI watchdog permanently disabled\n");
284+ } else {
285+ perf_event_release_kernel(this_cpu_read(watchdog_ev));
286+ this_cpu_write(watchdog_ev, NULL);
262287 }
288+ return ret;
263289 }
net/bridge/netfilter/ebtable_broute.c+2−2
@@ -65,8 +65,8 @@ static int ebt_broute(struct sk_buff *skb) · 64 unmodified lines
6565
6666 static int __net_init broute_net_init(struct net *net)
6767 {
68− net->xt.broute_table = ebt_register_table(net, &broute_table, NULL);
69− return PTR_ERR_OR_ZERO(net->xt.broute_table);
68+ return ebt_register_table(net, &broute_table, NULL,
69+ &net->xt.broute_table);
7070 }
7171
7272 static 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
9393
9494 static int __net_init frame_filter_net_init(struct net *net)
9595 {
96− net->xt.frame_filter = ebt_register_table(net, &frame_filter, ebt_ops_filter);
97− return PTR_ERR_OR_ZERO(net->xt.frame_filter);
96+ return ebt_register_table(net, &frame_filter, ebt_ops_filter,
97+ &net->xt.frame_filter);
9898 }
9999
100100 static 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
9393
9494 static int __net_init frame_nat_net_init(struct net *net)
9595 {
96− net->xt.frame_nat = ebt_register_table(net, &frame_nat, ebt_ops_nat);
97− return PTR_ERR_OR_ZERO(net->xt.frame_nat);
96+ return ebt_register_table(net, &frame_nat, ebt_ops_nat,
97+ &net->xt.frame_nat);
9898 }
9999
100100 static 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
11691169 kfree(table);
11701170 }
11711171
1172−struct ebt_table *
1173−ebt_register_table(struct net *net, const struct ebt_table *input_table,
1174− const struct nf_hook_ops *ops)
1172+int ebt_register_table(struct net *net, const struct ebt_table *input_table,
1173+ const struct nf_hook_ops *ops, struct ebt_table **res)
11751174 {
11761175 struct ebt_table_info *newinfo;
11771176 struct ebt_table *t, *table;
@@ -1183,7 +1182,7 @@ ebt_register_table(struct net *net, const struct ebt_table *input_table, · 5 unmodified lines
11831182 repl->entries == NULL || repl->entries_size == 0 ||
11841183 repl->counters != NULL || input_table->private != NULL) {
11851184 BUGPRINT("Bad table data for ebt_register_table!!!\n");
1186− return ERR_PTR(-EINVAL);
1185+ return -EINVAL;
11871186 }
11881187
11891188 /* 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
12521251 list_add(&table->list, &net->xt.tables[NFPROTO_BRIDGE]);
12531252 mutex_unlock(&ebt_mutex);
12541253
1254+ WRITE_ONCE(*res, table);
1255+
12551256 if (!ops)
1256− return table;
1257+ return 0;
12571258
12581259 ret = nf_register_net_hooks(net, ops, hweight32(table->valid_hooks));
12591260 if (ret) {
12601261 __ebt_unregister_table(net, table);
1261− return ERR_PTR(ret);
1262+ *res = NULL;
12621263 }
12631264
1264− return table;
1265+ return ret;
12651266 free_unlock:
12661267 mutex_unlock(&ebt_mutex);
12671268 free_chainstack:
@@ -1276,7 +1277,7 @@ free_newinfo: · 8 unmodified lines
12761277 free_table:
12771278 kfree(table);
12781279 out:
1279− return ERR_PTR(ret);
1280+ return ret;
12801281 }
12811282
12821283 void 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
8686 greh = (struct gre_base_hdr *)skb_transport_header(skb);
8787 pcsum = (__sum16 *)(greh + 1);
8888
89− if (gso_partial) {
89+ if (gso_partial && skb_is_gso(skb)) {
9090 unsigned int partial_adj;
9191
9292 /* 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
330330 if (synproxy == NULL)
331331 return NF_ACCEPT;
332332
333− if (nf_is_loopback_packet(skb))
333+ if (nf_is_loopback_packet(skb) ||
334+ ip_hdr(skb)->protocol != IPPROTO_TCP)
334335 return NF_ACCEPT;
335336
336337 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
25132513 struct rtable *ort = (struct rtable *) dst_orig;
25142514 struct rtable *rt;
25152515
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);
25172517 if (rt) {
25182518 struct dst_entry *new = &rt->dst;
25192519
net/ipv4/udp.c+5−9
@@ -2239,20 +2239,16 @@ int udp_v4_early_demux(struct sk_buff *skb) · 2238 unmodified lines
22392239 iph = ip_hdr(skb);
22402240 uh = udp_hdr(skb);
22412241
2242− if (skb->pkt_type == PACKET_BROADCAST ||
2243− skb->pkt_type == PACKET_MULTICAST) {
2242+ if (skb->pkt_type == PACKET_MULTICAST) {
22442243 in_dev = __in_dev_get_rcu(skb->dev);
22452244
22462245 if (!in_dev)
22472246 return 0;
22482247
2249− /* we are supposed to accept bcast packets */
2250− if (skb->pkt_type == PACKET_MULTICAST) {
2251− ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
2252− iph->protocol);
2253− if (!ours)
2254− return 0;
2255− }
2248+ ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
2249+ iph->protocol);
2250+ if (!ours)
2251+ return 0;
22562252
22572253 sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr,
22582254 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
120120 * will be using a length value equal to only one MSS sized
121121 * segment instead of the entire frame.
122122 */
123− if (gso_partial) {
123+ if (gso_partial && skb_is_gso(skb)) {
124124 uh->len = htons(skb_shinfo(skb)->gso_size +
125125 SKB_GSO_CB(skb)->data_offset +
126126 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
38003800 goto out;
38013801
38023802 if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) ||
3803− dev_net(dev)->ipv6.devconf_all->accept_dad < 1 ||
3804− idev->cnf.accept_dad < 1 ||
3803+ (dev_net(dev)->ipv6.devconf_all->accept_dad < 1 &&
3804+ idev->cnf.accept_dad < 1) ||
38053805 !(ifp->flags&IFA_F_TENTATIVE) ||
38063806 ifp->flags & IFA_F_NODAD) {
38073807 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
105105
106106 for (skb = segs; skb; skb = skb->next) {
107107 ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff);
108− if (gso_partial)
108+ if (gso_partial && skb_is_gso(skb))
109109 payload_len = skb_shinfo(skb)->gso_size +
110110 SKB_GSO_CB(skb)->data_offset +
111111 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
353353 nexthdr = ipv6_hdr(skb)->nexthdr;
354354 thoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr,
355355 &frag_off);
356− if (thoff < 0)
356+ if (thoff < 0 || nexthdr != IPPROTO_TCP)
357357 return NF_ACCEPT;
358358
359359 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
18771877 struct dst_entry *new = NULL;
18781878
18791879 rt = dst_alloc(&ip6_dst_blackhole_ops, loopback_dev, 1,
1880− DST_OBSOLETE_NONE, 0);
1880+ DST_OBSOLETE_DEAD, 0);
18811881 if (rt) {
18821882 rt6_info_init(rt);
18831883 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
11911191 from->family == to->family))
11921192 return -IPSET_ERR_TYPE_MISMATCH;
11931193
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);
11951198 return -EBUSY;
1199+ }
11961200
11971201 strncpy(from_name, from->name, IPSET_MAXNAMELEN);
11981202 strncpy(from->name, to->name, IPSET_MAXNAMELEN);
11991203 strncpy(to->name, from_name, IPSET_MAXNAMELEN);
12001204
1201− write_lock_bh(&ip_set_ref_lock);
12021205 swap(from->ref, to->ref);
12031206 ip_set(inst, from_id) = to;
12041207 ip_set(inst, to_id) = from;
@@ -2072,25 +2075,28 @@ static struct pernet_operations ip_set_net_ops = { · 867 unmodified lines
20722075 static int __init
20732076 ip_set_init(void)
20742077 {
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+ }
20762084
2085+ ret = nfnetlink_subsys_register(&ip_set_netlink_subsys);
20772086 if (ret != 0) {
20782087 pr_err("ip_set: cannot register with nfnetlink.\n");
2088+ unregister_pernet_subsys(&ip_set_net_ops);
20792089 return ret;
20802090 }
2091+
20812092 ret = nf_register_sockopt(&so_set);
20822093 if (ret != 0) {
20832094 pr_err("SO_SET registry failed: %d\n", ret);
20842095 nfnetlink_subsys_unregister(&ip_set_netlink_subsys);
2096+ unregister_pernet_subsys(&ip_set_net_ops);
20852097 return ret;
20862098 }
2087− ret = register_pernet_subsys(&ip_set_net_ops);
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− }
2099+
20942100 pr_info("ip_set: protocol %u\n", IPSET_PROTOCOL);
20952101 return 0;
20962102 }
@@ -2098,9 +2104,10 @@ ip_set_init(void) · 1 unmodified line
20982104 static void __exit
20992105 ip_set_fini(void)
21002106 {
2101− unregister_pernet_subsys(&ip_set_net_ops);
21022107 nf_unregister_sockopt(&so_set);
21032108 nfnetlink_subsys_unregister(&ip_set_netlink_subsys);
2109+
2110+ unregister_pernet_subsys(&ip_set_net_ops);
21042111 pr_debug("these are the famous last words\n");
21052112 }
21062113
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
123123 return ret;
124124
125125 ip &= ip_set_hostmask(h->netmask);
126+ e.ip = htonl(ip);
127+ if (e.ip == 0)
128+ return -IPSET_ERR_HASH_ELEM;
126129
127− if (adt == IPSET_TEST) {
128− e.ip = htonl(ip);
129− if (e.ip == 0)
130− return -IPSET_ERR_HASH_ELEM;
130+ if (adt == IPSET_TEST)
131131 return adtfn(set, &e, &ext, &ext, flags);
132− }
133132
134133 ip_to = ip;
135134 if (tb[IPSET_ATTR_IP_TO]) {
@@ -148,17 +147,20 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], · 12 unmodified lines
148147
149148 hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1);
150149
151− if (retried)
150+ if (retried) {
152151 ip = ntohl(h->next.ip);
153− for (; !before(ip_to, ip); ip += hosts) {
154152 e.ip = htonl(ip);
155− if (e.ip == 0)
156− return -IPSET_ERR_HASH_ELEM;
153+ }
154+ for (; ip <= ip_to;) {
157155 ret = adtfn(set, &e, &ext, &ext, flags);
158−
159156 if (ret && !ip_set_eexist(ret, flags))
160157 return ret;
161158
159+ ip += hosts;
160+ e.ip = htonl(ip);
161+ if (e.ip == 0)
162+ return 0;
163+
162164 ret = 0;
163165 }
164166 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
149149
150150 if (retried)
151151 ip = ntohl(h->next.ip);
152− for (; !before(ip_to, ip); ip++) {
152+ for (; ip <= ip_to; ip++) {
153153 e.ip = htonl(ip);
154154 ret = adtfn(set, &e, &ext, &ext, flags);
155155
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
178178
179179 if (retried)
180180 ip = ntohl(h->next.ip);
181− for (; !before(ip_to, ip); ip++) {
181+ for (; ip <= ip_to; ip++) {
182182 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
183183 : port;
184184 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
185185
186186 if (retried)
187187 ip = ntohl(h->next.ip);
188− for (; !before(ip_to, ip); ip++) {
188+ for (; ip <= ip_to; ip++) {
189189 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
190190 : port;
191191 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
271271
272272 if (retried)
273273 ip = ntohl(h->next.ip);
274− for (; !before(ip_to, ip); ip++) {
274+ for (; ip <= ip_to; ip++) {
275275 e.ip = htonl(ip);
276276 p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
277277 : port;
@@ -281,7 +281,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 3 unmodified lines
281281 ip == ntohl(h->next.ip) &&
282282 p == ntohs(h->next.port)
283283 ? ntohl(h->next.ip2) : ip2_from;
284− while (!after(ip2, ip2_to)) {
284+ while (ip2 <= ip2_to) {
285285 e.ip2 = htonl(ip2);
286286 ip2_last = ip_set_range_to_cidr(ip2, ip2_to,
287287 &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
193193 }
194194 if (retried)
195195 ip = ntohl(h->next.ip);
196− while (!after(ip, ip_to)) {
196+ while (ip <= ip_to) {
197197 e.ip = htonl(ip);
198198 last = ip_set_range_to_cidr(ip, ip_to, &e.cidr);
199199 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
255255
256256 if (retried)
257257 ip = ntohl(h->next.ip);
258− while (!after(ip, ip_to)) {
258+ while (ip <= ip_to) {
259259 e.ip = htonl(ip);
260260 last = ip_set_range_to_cidr(ip, ip_to, &e.cidr);
261261 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
250250 if (retried)
251251 ip = ntohl(h->next.ip[0]);
252252
253− while (!after(ip, ip_to)) {
253+ while (ip <= ip_to) {
254254 e.ip[0] = htonl(ip);
255255 last = ip_set_range_to_cidr(ip, ip_to, &e.cidr[0]);
256256 ip2 = (retried &&
257257 ip == ntohl(h->next.ip[0])) ? ntohl(h->next.ip[1])
258258 : ip2_from;
259− while (!after(ip2, ip2_to)) {
259+ while (ip2 <= ip2_to) {
260260 e.ip[1] = htonl(ip2);
261261 last2 = ip_set_range_to_cidr(ip2, ip2_to, &e.cidr[1]);
262262 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
241241
242242 if (retried)
243243 ip = ntohl(h->next.ip);
244− while (!after(ip, ip_to)) {
244+ while (ip <= ip_to) {
245245 e.ip = htonl(ip);
246246 last = ip_set_range_to_cidr(ip, ip_to, &cidr);
247247 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
291291 if (retried)
292292 ip = ntohl(h->next.ip[0]);
293293
294− while (!after(ip, ip_to)) {
294+ while (ip <= ip_to) {
295295 e.ip[0] = htonl(ip);
296296 ip_last = ip_set_range_to_cidr(ip, ip_to, &e.cidr[0]);
297297 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
301301 ip2 = (retried && ip == ntohl(h->next.ip[0]) &&
302302 p == ntohs(h->next.port)) ? ntohl(h->next.ip[1])
303303 : ip2_from;
304− while (!after(ip2, ip2_to)) {
304+ while (ip2 <= ip2_to) {
305305 e.ip[1] = htonl(ip2);
306306 ip2_last = ip_set_range_to_cidr(ip2, ip2_to,
307307 &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
921921 {
922922 struct sk_buff *new_skb = NULL;
923923 struct iphdr *old_iph = NULL;
924+ __u8 old_dsfield;
924925 #ifdef CONFIG_IP_VS_IPV6
925926 struct ipv6hdr *old_ipv6h = NULL;
926927 #endif
@@ -945,7 +946,7 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, · 18 unmodified lines
945946 *payload_len =
946947 ntohs(old_ipv6h->payload_len) +
947948 sizeof(*old_ipv6h);
948− *dsfield = ipv6_get_dsfield(old_ipv6h);
949+ old_dsfield = ipv6_get_dsfield(old_ipv6h);
949950 *ttl = old_ipv6h->hop_limit;
950951 if (df)
951952 *df = 0;
@@ -960,12 +961,15 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, · 8 unmodified lines
960961
961962 /* fix old IP header checksum */
962963 ip_send_check(old_iph);
963− *dsfield = ipv4_get_dsfield(old_iph);
964+ old_dsfield = ipv4_get_dsfield(old_iph);
964965 *ttl = old_iph->ttl;
965966 if (payload_len)
966967 *payload_len = ntohs(old_iph->tot_len);
967968 }
968969
970+ /* Implement full-functionality option for ECN encapsulation */
971+ *dsfield = INET_ECN_encapsulate(old_dsfield, old_dsfield);
972+
969973 return skb;
970974 error:
971975 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
10481048 if (nla_put_string(skb, NFTA_CHAIN_TYPE, basechain->type->name))
10491049 goto nla_put_failure;
10501050
1051− if (nft_dump_stats(skb, nft_base_chain(chain)->stats))
1051+ if (basechain->stats && nft_dump_stats(skb, basechain->stats))
10521052 goto nla_put_failure;
10531053 }
10541054
@@ -1487,8 +1487,8 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy, · 432 unmodified lines
14871487
14881488 chain2 = nf_tables_chain_lookup(table, nla[NFTA_CHAIN_NAME],
14891489 genmask);
1490− if (IS_ERR(chain2))
1491− return PTR_ERR(chain2);
1490+ if (!IS_ERR(chain2))
1491+ return -EEXIST;
14921492 }
14931493
14941494 if (nla[NFTA_CHAIN_COUNTERS]) {
@@ -2741,8 +2741,10 @@ cont: · 1246 unmodified lines
27412741 list_for_each_entry(i, &ctx->table->sets, list) {
27422742 if (!nft_is_active_next(ctx->net, i))
27432743 continue;
2744− if (!strcmp(set->name, i->name))
2744+ if (!strcmp(set->name, i->name)) {
2745+ kfree(set->name);
27452746 return -ENFILE;
2747+ }
27462748 }
27472749 return 0;
27482750 }
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
892892 if (copy_from_user(&compat_tmp, user, sizeof(compat_tmp)) != 0)
893893 return ERR_PTR(-EFAULT);
894894
895− strlcpy(info->name, compat_tmp.name, sizeof(info->name));
895+ memcpy(info->name, compat_tmp.name, sizeof(info->name) - 1);
896896 info->num_counters = compat_tmp.num_counters;
897897 user += sizeof(compat_tmp);
898898 } else
@@ -905,9 +905,9 @@ void *xt_copy_counters_from_user(const void __user *user, unsigned int len, · 6 unmodified lines
905905 if (copy_from_user(info, user, sizeof(*info)) != 0)
906906 return ERR_PTR(-EFAULT);
907907
908− info->name[sizeof(info->name) - 1] = '\0';
909908 user += sizeof(*info);
910909 }
910+ info->name[sizeof(info->name) - 1] = '\0';
911911
912912 size = sizeof(struct xt_counters);
913913 size *= info->num_counters;
net/netfilter/xt_bpf.c+20−2
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 */
99
1010 #include <linux/module.h>
11+#include <linux/syscalls.h>
1112 #include <linux/skbuff.h>
1213 #include <linux/filter.h>
1314 #include <linux/bpf.h>
@@ -49,6 +50,22 @@ static int __bpf_mt_check_fd(int fd, struct bpf_prog **ret) · 35 unmodified lines
4950 return 0;
5051 }
5152
53+static 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+
5269 static int bpf_mt_check(const struct xt_mtchk_param *par)
5370 {
5471 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
6683 return __bpf_mt_check_bytecode(info->bpf_program,
6784 info->bpf_program_num_elem,
6885 &info->filter);
69− else if (info->mode == XT_BPF_MODE_FD_PINNED ||
70− info->mode == XT_BPF_MODE_FD_ELF)
86+ else if (info->mode == XT_BPF_MODE_FD_ELF)
7187 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);
7290 else
7391 return -EINVAL;
7492 }
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
7676 transparent = nf_sk_is_transparent(sk);
7777
7878 if (info->flags & XT_SOCKET_RESTORESKMARK && !wildcard &&
79− transparent)
79+ transparent && sk_fullsock(sk))
8080 pskb->mark = sk->sk_mark;
8181
8282 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
133133 transparent = nf_sk_is_transparent(sk);
134134
135135 if (info->flags & XT_SOCKET_RESTORESKMARK && !wildcard &&
136− transparent)
136+ transparent && sk_fullsock(sk))
137137 pskb->mark = sk->sk_mark;
138138
139139 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
22662266 cb->min_dump_alloc = control->min_dump_alloc;
22672267 cb->skb = skb;
22682268
2269+ if (cb->start) {
2270+ ret = cb->start(cb);
2271+ if (ret)
2272+ goto error_unlock;
2273+ }
2274+
22692275 nlk->cb_running = true;
22702276
22712277 mutex_unlock(nlk->cb_mutex);
22722278
2273− ret = 0;
2274− if (cb->start)
2275− ret = cb->start(cb);
2276−
2277− if (!ret)
2278− ret = netlink_dump(sk);
2279+ ret = netlink_dump(sk);
22792280
22802281 sock_put(sk);
22812282
net/sunrpc/xprtsock.c+1−1
@@ -2203,7 +2203,7 @@ static void xs_udp_setup_socket(struct work_struct *work) · 2202 unmodified lines
22032203 struct sock_xprt *transport =
22042204 container_of(work, struct sock_xprt, connect_worker.work);
22052205 struct rpc_xprt *xprt = &transport->xprt;
2206− struct socket *sock = transport->sock;
2206+ struct socket *sock;
22072207 int status = -EIO;
22082208
22092209 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
233233 struct sk_buff_head xmitq;
234234 int rc = 0;
235235
236− __skb_queue_head_init(&xmitq);
236+ skb_queue_head_init(&xmitq);
237237 tipc_bcast_lock(net);
238238 if (tipc_link_bc_peers(l))
239239 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
263263 u32 dst, selector;
264264
265265 selector = msg_link_selector(buf_msg(skb_peek(pkts)));
266− __skb_queue_head_init(&_pkts);
266+ skb_queue_head_init(&_pkts);
267267
268268 list_for_each_entry_safe(n, tmp, &dests->list, list) {
269269 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
568568 msg_set_destnode(msg, dnode);
569569 msg_set_destport(msg, dport);
570570 *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+
571579 return true;
572580 }
573581
net/wireless/nl80211.c+12−2
@@ -549,6 +549,14 @@ nl80211_nan_srf_policy[NL80211_NAN_SRF_ATTR_MAX + 1] = { · 548 unmodified lines
549549 [NL80211_NAN_SRF_MAC_ADDRS] = { .type = NLA_NESTED },
550550 };
551551
552+/* policy for packet pattern attributes */
553+static const struct nla_policy
554+nl80211_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+
552560 static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
553561 struct netlink_callback *cb,
554562 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
1053210540 u8 *mask_pat;
1053310541
1053410542 nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
10535− NULL, info->extack);
10543+ nl80211_packet_pattern_policy,
10544+ info->extack);
1053610545 err = -EINVAL;
1053710546 if (!pat_tb[NL80211_PKTPAT_MASK] ||
1053810547 !pat_tb[NL80211_PKTPAT_PATTERN])
@@ -10781,7 +10790,8 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev, · 242 unmodified lines
1078110790 rem) {
1078210791 u8 *mask_pat;
1078310792
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);
1078510795 if (!pat_tb[NL80211_PKTPAT_MASK] ||
1078610796 !pat_tb[NL80211_PKTPAT_PATTERN])
1078710797 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
9191 }
9292
9393 if (!dev->xfrmdev_ops || !dev->xfrmdev_ops->xdo_dev_state_add) {
94+ xso->dev = NULL;
9495 dev_put(dev);
9596 return 0;
9697 }
net/xfrm/xfrm_input.c+4−2
@@ -429,7 +429,8 @@ resume: · 428 unmodified lines
429429 nf_reset(skb);
430430
431431 if (decaps) {
432− skb->sp->olen = 0;
432+ if (skb->sp)
433+ skb->sp->olen = 0;
433434 skb_dst_drop(skb);
434435 gro_cells_receive(&gro_cells, skb);
435436 return 0;
@@ -440,7 +441,8 @@ resume: · 4 unmodified lines
440441
441442 err = x->inner_mode->afinfo->transport_finish(skb, xfrm_gro || async);
442443 if (xfrm_gro) {
443− skb->sp->olen = 0;
444+ if (skb->sp)
445+ skb->sp->olen = 0;
444446 skb_dst_drop(skb);
445447 gro_cells_receive(&gro_cells, skb);
446448 return err;
net/xfrm/xfrm_state.c+2−2
@@ -732,12 +732,12 @@ restart: · 731 unmodified lines
732732 }
733733 }
734734 }
735+out:
736+ spin_unlock_bh(&net->xfrm.xfrm_state_lock);
735737 if (cnt) {
736738 err = 0;
737739 xfrm_policy_cache_flush();
738740 }
739−out:
740− spin_unlock_bh(&net->xfrm.xfrm_state_lock);
741741 return err;
742742 }
743743 EXPORT_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
657657
658658 if (err < 0) {
659659 x->km.state = XFRM_STATE_DEAD;
660+ xfrm_dev_state_delete(x);
660661 __xfrm_state_put(x);
661662 goto out;
662663 }
tools/testing/selftests/networking/timestamping/rxtimestamp.c+1−1
@@ -341,7 +341,7 @@ int main(int argc, char **argv) · 340 unmodified lines
341341 return 0;
342342 case 'n':
343343 t = atoi(optarg);
344− if (t > ARRAY_SIZE(test_cases))
344+ if (t >= ARRAY_SIZE(test_cases))
345345 error(1, 0, "Invalid test case: %d", t);
346346 all_tests = false;
347347 test_cases[t].enabled = true;