History

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

Cross-merge networking fixes after downstream PR. No conflicts (or adjacent changes of note).

Jakub Kicinski committed 3 years ago

Commit 2606cf02 parents 49e7265 f291209550 files · +5537 −3311Browse files

Unified · Split

550 files
  1. .mailmap +1 −0
  2. Documentation/admin-guide/cgroup-v1/memory.rst +7 −0
  3. Documentation/arch/arm64/cpu-feature-registers.rst +12 −0
  4. Documentation/arch/arm64/elf_hwcaps.rst +3 −0
  5. Documentation/arch/loongarch/introduction.rst +2 −2
  6. Documentation/devicetree/bindings/ata/pata-common.yaml +1 −0
  7. Documentation/devicetree/bindings/clock/renesas,5p35023.yaml +7 −4
  8. Documentation/devicetree/bindings/i2c/i2c-mxs.yaml +4 −1
  9. Documentation/devicetree/bindings/iommu/arm,smmu.yaml +1 −1
  10. Documentation/devicetree/bindings/mfd/maxim,max77693.yaml +0 −4
  11. Documentation/devicetree/bindings/soc/loongson/loongson,ls2k-pmc.yaml +37 −6
  12. Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml +7 −0
  13. Documentation/filesystems/porting.rst +96 −0
  14. Documentation/kbuild/kconfig-language.rst +26 −0
  15. Documentation/tools/rtla/rtla-timerlat-hist.rst +2 −2
  16. Documentation/translations/zh_CN/arch/loongarch/introduction.rst +2 −2
  17. MAINTAINERS +14 −18
  18. Makefile +1 −1
  19. arch/arm/boot/dts/ti/omap/motorola-mapphone-common.dtsi +3 −2
  20. arch/arm/boot/dts/ti/omap/omap3-cpu-thermal.dtsi +1 −2
  21. arch/arm/boot/dts/ti/omap/omap4-cpu-thermal.dtsi +4 −1
  22. arch/arm/boot/dts/ti/omap/omap443x.dtsi +1 −0
  23. arch/arm/boot/dts/ti/omap/omap4460.dtsi +1 −0
  24. arch/arm/include/asm/hardware/locomo.h +1 −1
  25. arch/arm/mach-omap2/pm44xx.c +2 −2
  26. arch/arm/mach-sa1100/include/mach/collie.h +0 −2
  27. arch/arm/mm/cache-uniphier.c +3 −1
  28. arch/arm64/boot/dts/freescale/Makefile +1 −0
  29. arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi +20 −12
  30. arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts +3 −2
  31. arch/arm64/boot/dts/freescale/imx8mp.dtsi +6 −0
  32. arch/arm64/boot/dts/freescale/imx93-tqma9352.dtsi +1 −1
  33. arch/arm64/boot/dts/mediatek/mt8195.dtsi +5 −5
  34. arch/arm64/configs/defconfig +1 −1
  35. arch/arm64/include/asm/cpufeature.h +1 −1
  36. arch/arm64/include/asm/hugetlb.h +1 −1
  37. arch/arm64/include/asm/kvm_hyp.h +1 −1
  38. arch/arm64/kernel/cpufeature.c +2 −1
  39. arch/arm64/kvm/hyp/include/nvhe/ffa.h +1 −1
  40. arch/arm64/kvm/hyp/nvhe/ffa.c +1 −2
  41. arch/arm64/kvm/hyp/nvhe/hyp-init.S +1 −0
  42. arch/arm64/kvm/hyp/nvhe/hyp-main.c +6 −2
  43. arch/arm64/kvm/hyp/nvhe/psci-relay.c +1 −2
  44. arch/arm64/kvm/mmu.c +3 −0
  45. arch/arm64/mm/hugetlbpage.c +7 −16
  46. arch/arm64/tools/sysreg +5 −1
  47. arch/ia64/kernel/acpi.c +4 −0
  48. arch/loongarch/include/asm/addrspace.h +6 −6
  49. arch/loongarch/include/asm/elf.h +9 −0
  50. arch/loongarch/include/asm/exception.h +45 −0
  51. arch/loongarch/include/asm/kasan.h +9 −50
  52. arch/loongarch/include/asm/smp.h +1 −0
  53. arch/loongarch/kernel/Makefile +4 −0
  54. arch/loongarch/kernel/acpi.c +0 −1
  55. arch/loongarch/kernel/mem.c +3 −1
  56. arch/loongarch/kernel/module-sections.c +1 −0
  57. arch/loongarch/kernel/module.c +21 −1
  58. arch/loongarch/kernel/numa.c +1 −1
  59. arch/loongarch/kernel/process.c +1 −0
  60. arch/loongarch/kernel/relocate_kernel.S +0 −1
  61. arch/loongarch/kernel/signal.c +4 −3
  62. arch/loongarch/kernel/smp.c +3 −0
  63. arch/loongarch/kernel/syscall.c +1 −0
  64. arch/loongarch/kernel/time.c +1 −1
  65. arch/loongarch/kernel/topology.c +3 −0
  66. arch/loongarch/kernel/traps.c +5 −20
  67. arch/loongarch/kernel/vmlinux.lds.S +28 −27
  68. arch/loongarch/mm/fault.c +1 −1
  69. arch/loongarch/mm/hugetlbpage.c +0 −12
  70. arch/loongarch/mm/ioremap.c +1 −0
  71. arch/loongarch/mm/kasan_init.c +51 −0
  72. arch/loongarch/mm/tlb.c +1 −1
  73. arch/mips/alchemy/devboards/db1000.c +4 −0
  74. arch/mips/alchemy/devboards/db1200.c +6 −0
  75. arch/mips/alchemy/devboards/db1300.c +4 −0
  76. arch/parisc/include/asm/hugetlb.h +1 −1
  77. arch/parisc/mm/hugetlbpage.c +1 −1
  78. arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h +2 −1
  79. arch/powerpc/kernel/stacktrace.c +5 −22
  80. arch/powerpc/mm/book3s64/hugetlbpage.c +4 −1
  81. arch/powerpc/mm/book3s64/radix_hugetlbpage.c +2 −1
  82. arch/powerpc/mm/nohash/8xx.c +2 −1
  83. arch/powerpc/mm/pgtable.c +2 −1
  84. arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +26 −25
  85. arch/riscv/include/asm/hugetlb.h +2 −1
  86. arch/riscv/kvm/vcpu_onereg.c +5 −2
  87. arch/riscv/mm/hugetlbpage.c +2 −1
  88. arch/s390/configs/debug_defconfig +10 −4
  89. arch/s390/configs/defconfig +9 −4
  90. arch/s390/configs/zfcpdump_defconfig +2 −2
  91. arch/s390/include/asm/hugetlb.h +4 −2
  92. arch/s390/kernel/cert_store.c +4 −3
  93. arch/s390/mm/hugetlbpage.c +7 −1
  94. arch/s390/net/bpf_jit_comp.c +1 −1
  95. arch/sh/mm/ioremap.c +2 −2
  96. arch/sparc/include/asm/hugetlb.h +4 −2
  97. arch/sparc/mm/hugetlbpage.c +7 −1
  98. arch/x86/events/amd/core.c +17 −7
  99. arch/x86/include/asm/kvm_host.h +1 −2
  100. arch/x86/include/asm/linkage.h +7 −0
  101. arch/x86/include/asm/mmu_context.h +1 −2
  102. arch/x86/include/asm/pgtable.h +8 −0
  103. arch/x86/include/asm/processor.h +0 −2
  104. arch/x86/kernel/alternative.c +2 −7
  105. arch/x86/kernel/callthunks.c +0 −1
  106. arch/x86/kernel/cpu/amd.c +9 −19
  107. arch/x86/kernel/cpu/bugs.c +3 −14
  108. arch/x86/kernel/cpu/common.c +1 −1
  109. arch/x86/kernel/cpu/sgx/encl.c +25 −5
  110. arch/x86/kernel/kgdb.c +0 −1
  111. arch/x86/kernel/process.c +0 −7
  112. arch/x86/kernel/setup.c +2 −6
  113. arch/x86/kernel/shstk.c +31 −2
  114. arch/x86/kvm/mmu/mmu.c +5 −16
  115. arch/x86/kvm/mmu/mmu_internal.h +7 −8
  116. arch/x86/kvm/mmu/tdp_mmu.c +67 −85
  117. arch/x86/kvm/mmu/tdp_mmu.h +2 −3
  118. arch/x86/kvm/svm/sev.c +26 −8
  119. arch/x86/kvm/svm/svm.c +35 −8
  120. arch/x86/kvm/svm/svm.h +1 −0
  121. arch/x86/kvm/x86.c +1 −4
  122. arch/x86/lib/memcpy_64.S +1 −1
  123. arch/x86/lib/memmove_64.S +1 −1
  124. arch/x86/lib/memset_64.S +1 −1
  125. arch/xtensa/boot/Makefile +1 −2
  126. arch/xtensa/boot/lib/zmem.c +3 −2
  127. arch/xtensa/include/asm/core.h +4 −0
  128. arch/xtensa/include/asm/hw_breakpoint.h +1 −0
  129. arch/xtensa/include/asm/processor.h +5 −0
  130. arch/xtensa/include/asm/ptrace.h +3 −0
  131. arch/xtensa/include/asm/smp.h +1 −0
  132. arch/xtensa/include/asm/tlb.h +2 −0
  133. arch/xtensa/kernel/hw_breakpoint.c +1 −0
  134. arch/xtensa/kernel/irq.c +1 −0
  135. arch/xtensa/kernel/ptrace.c +0 −1
  136. arch/xtensa/kernel/signal.c +2 −0
  137. arch/xtensa/kernel/smp.c +1 −0
  138. arch/xtensa/kernel/stacktrace.c +1 −0
  139. arch/xtensa/kernel/traps.c +1 −0
  140. arch/xtensa/lib/umulsidi3.S +3 −1
  141. arch/xtensa/mm/fault.c +1 −0
  142. arch/xtensa/mm/tlb.c +1 −0
  143. arch/xtensa/platforms/iss/network.c +2 −2
  144. block/blk-rq-qos.c +1 −1
  145. block/disk-events.c +0 −1
  146. crypto/sm2.c +5 −1
  147. drivers/accel/ivpu/ivpu_drv.c +2 −1
  148. drivers/accel/ivpu/ivpu_drv.h +2 −0
  149. drivers/accel/ivpu/ivpu_fw.c +5 −3
  150. drivers/accel/ivpu/ivpu_gem.h +5 −0
  151. drivers/accel/ivpu/ivpu_hw_40xx.c +23 −4
  152. drivers/accel/ivpu/ivpu_hw_40xx_reg.h +2 −0
  153. drivers/accel/ivpu/ivpu_ipc.c +4 −7
  154. drivers/acpi/acpi_video.c +5 −2
  155. drivers/acpi/nfit/core.c +1 −1
  156. drivers/acpi/processor_pdc.c +1 −0
  157. drivers/ata/libata-core.c +137 −12
  158. drivers/ata/libata-eh.c +46 −2
  159. drivers/ata/libata-scsi.c +67 −33
  160. drivers/ata/libata-transport.c +8 −1
  161. drivers/ata/libata.h +4 −0
  162. drivers/base/regmap/regcache-rbtree.c +2 −1
  163. drivers/block/rbd.c +225 −187
  164. drivers/bluetooth/btusb.c +1 −0
  165. drivers/bus/ti-sysc.c +22 −9
  166. drivers/clk/clk-si521xx.c +5 −4
  167. drivers/clk/clk-versaclock3.c +40 −41
  168. drivers/clk/sprd/ums512-clk.c +1 −1
  169. drivers/clk/tegra/clk-bpmp.c +1 −1
  170. drivers/cxl/acpi.c +2 −2
  171. drivers/cxl/core/mbox.c +12 −11
  172. drivers/cxl/core/port.c +9 −4
  173. drivers/cxl/core/region.c +31 −10
  174. drivers/cxl/pci.c +3 −4
  175. drivers/dma/ti/k3-udma-glue.c +3 −0
  176. drivers/firewire/sbp2.c +6 −3
  177. drivers/firmware/arm_ffa/driver.c +14 −2
  178. drivers/firmware/arm_scmi/perf.c +2 −2
  179. drivers/firmware/efi/efi.c +29 −3
  180. drivers/firmware/imx/imx-dsp.c +1 −0
  181. drivers/gpio/gpio-pmic-eic-sprd.c +1 −0
  182. drivers/gpio/gpio-sim.c +23 −37
  183. drivers/gpio/gpio-tb10x.c +5 −1
  184. drivers/gpio/gpio-timberdale.c +3 −2
  185. drivers/gpu/drm/Kconfig +1 −1
  186. drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +1 −1
  187. drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 −0
  188. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 −1
  189. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 −2
  190. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +17 −13
  191. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +2 −6
  192. drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mpc.c +1 −1
  193. drivers/gpu/drm/i915/gem/i915_gem_shmem.c +7 −4
  194. drivers/gpu/drm/i915/gt/intel_engine_cs.c +0 −1
  195. drivers/gpu/drm/i915/gt/intel_execlists_submission.c +2 −0
  196. drivers/gpu/drm/i915/gt/intel_ggtt.c +17 −6
  197. drivers/gpu/drm/i915/gt/intel_lrc.c +3 −2
  198. drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +35 −3
  199. drivers/gpu/drm/meson/meson_encoder_hdmi.c +2 −0
  200. drivers/gpu/drm/nouveau/nouveau_drv.h +5 −14
  201. drivers/gpu/drm/nouveau/nouveau_exec.c +1 −1
  202. drivers/gpu/drm/nouveau/nouveau_fence.c +1 −1
  203. drivers/gpu/drm/nouveau/nouveau_sched.c +9 −3
  204. drivers/gpu/drm/tests/drm_mm_test.c +1 −1
  205. drivers/gpu/drm/virtio/virtgpu_submit.c +0 −1
  206. drivers/i2c/busses/i2c-designware-common.c +17 −0
  207. drivers/i2c/busses/i2c-designware-core.h +3 −0
  208. drivers/i2c/busses/i2c-i801.c +1 −0
  209. drivers/i2c/busses/i2c-npcm7xx.c +7 −10
  210. drivers/i2c/busses/i2c-xiic.c +1 −1
  211. drivers/i2c/i2c-mux.c +1 −1
  212. drivers/i2c/muxes/i2c-demux-pinctrl.c +4 −0
  213. drivers/i2c/muxes/i2c-mux-gpio.c +3 −1
  214. drivers/iommu/apple-dart.c +1 −2
  215. drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c +16 −2
  216. drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +10 −5
  217. drivers/iommu/intel/iommu.c +0 −16
  218. drivers/iommu/intel/iommu.h +1 −1
  219. drivers/iommu/mtk_iommu.c +4 −5
  220. drivers/irqchip/irq-xtensa-mx.c +1 −0
  221. drivers/leds/led-core.c +0 −4
  222. drivers/mfd/Kconfig +1 −0
  223. drivers/mfd/cs42l43.c +2 −2
  224. drivers/misc/cardreader/rts5227.c +6 −49
  225. drivers/misc/cardreader/rts5228.c +17 −40
  226. drivers/misc/cardreader/rts5249.c +7 −49
  227. drivers/misc/cardreader/rts5260.c +13 −30
  228. drivers/misc/cardreader/rts5261.c +13 −39
  229. drivers/misc/cardreader/rtsx_pcr.c +46 −5
  230. drivers/mtd/ubi/build.c +7 −0
  231. drivers/net/dsa/mv88e6xxx/chip.c +4 −2
  232. drivers/net/dsa/mv88e6xxx/global1.c +0 −31
  233. drivers/net/dsa/mv88e6xxx/global1.h +0 −1
  234. drivers/net/dsa/mv88e6xxx/global2.c +1 −1
  235. drivers/net/dsa/mv88e6xxx/global2.h +1 −0
  236. drivers/net/ethernet/ibm/ibmveth.c +12 −13
  237. drivers/net/ethernet/intel/ice/ice_virtchnl.c +7 −5
  238. drivers/net/ethernet/marvell/sky2.h +1 −1
  239. drivers/net/ethernet/mediatek/mtk_eth_soc.c +2 −2
  240. drivers/net/ethernet/microchip/Kconfig +1 −0
  241. drivers/net/ethernet/microsoft/mana/mana_en.c +146 −65
  242. drivers/net/ethernet/qlogic/qed/qed_ll2.h +1 −1
  243. drivers/net/ethernet/renesas/rswitch.c +12 −1
  244. drivers/net/ethernet/renesas/rswitch.h +2 −0
  245. drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +5 −2
  246. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0 −30
  247. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 −1
  248. drivers/net/ethernet/ti/am65-cpsw-nuss.c +2 −1
  249. drivers/net/ethernet/ti/icssg/icssg_prueth.c +3 −3
  250. drivers/net/usb/smsc75xx.c +3 −1
  251. drivers/net/wan/fsl_ucc_hdlc.c +10 −2
  252. drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +7 −2
  253. drivers/net/wireless/intel/iwlwifi/fw/error-dump.h +3 −3
  254. drivers/net/wireless/intel/iwlwifi/mvm/fw.c +1 −1
  255. drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +63 −58
  256. drivers/net/wireless/intel/iwlwifi/mvm/scan.c +1 −1
  257. drivers/net/wireless/intel/iwlwifi/mvm/tx.c +3 −0
  258. drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c +19 −3
  259. drivers/net/wireless/marvell/mwifiex/fw.h +1 −1
  260. drivers/net/wireless/marvell/mwifiex/sta_rx.c +9 −7
  261. drivers/net/wireless/mediatek/mt76/dma.c +4 −4
  262. drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c +0 −7
  263. drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c +11 −2
  264. drivers/net/wireless/realtek/rtw88/rtw8723d.h +1 −0
  265. drivers/pci/pcie/aer.c +1 −0
  266. drivers/pci/pcie/portdrv.h +0 −2
  267. drivers/platform/x86/intel_scu_ipc.c +40 −26
  268. drivers/platform/x86/thinkpad_acpi.c +2 −0
  269. drivers/power/reset/Kconfig +1 −1
  270. drivers/power/reset/pwr-mlxbf.c +1 −1
  271. drivers/power/reset/vexpress-poweroff.c +1 −1
  272. drivers/power/supply/Kconfig +1 −0
  273. drivers/power/supply/ab8500_btemp.c +1 −8
  274. drivers/power/supply/ab8500_chargalg.c +1 −1
  275. drivers/power/supply/mt6370-charger.c +1 −1
  276. drivers/power/supply/power_supply_sysfs.c +7 −0
  277. drivers/power/supply/rk817_charger.c +13 −3
  278. drivers/power/supply/rt9467-charger.c +2 −2
  279. drivers/power/supply/ucs1002_power.c +2 −1
  280. drivers/ptp/ptp_ocp.c +0 −1
  281. drivers/regulator/core.c +3 −7
  282. drivers/regulator/mt6358-regulator.c +15 −3
  283. drivers/s390/scsi/zfcp_aux.c +5 −4
  284. drivers/scsi/fnic/fnic.h +3 −1
  285. drivers/scsi/fnic/fnic_io.h +2 −0
  286. drivers/scsi/fnic/fnic_main.c +2 −0
  287. drivers/scsi/fnic/fnic_scsi.c +47 −17
  288. drivers/scsi/scsi.c +11 −0
  289. drivers/scsi/scsi_scan.c +18 −2
  290. drivers/scsi/sd.c +82 −19
  291. drivers/scsi/sd.h +1 −0
  292. drivers/soc/imx/soc-imx8m.c +10 −0
  293. drivers/soc/loongson/Kconfig +1 −0
  294. drivers/soc/loongson/loongson2_guts.c +2 −4
  295. drivers/soc/loongson/loongson2_pm.c +6 −1
  296. drivers/spi/spi-cs42l43.c +0 −1
  297. drivers/spi/spi-gxp.c +1 −1
  298. drivers/target/target_core_device.c +4 −7
  299. drivers/tee/optee/optee_private.h +0 −2
  300. drivers/tee/tee_private.h +0 −2
  301. drivers/thermal/thermal_sysfs.c +5 −4
  302. drivers/tty/n_gsm.c +1 −3
  303. drivers/tty/serial/8250/8250_port.c +4 −1
  304. drivers/vfio/mdev/mdev_sysfs.c +2 −1
  305. drivers/vfio/pci/pds/Kconfig +1 −1
  306. drivers/vfio/pci/pds/vfio_dev.c +1 −1
  307. drivers/vhost/vringh.c +11 −1
  308. drivers/video/console/Kconfig +1 −0
  309. drivers/video/fbdev/Kconfig +1 −1
  310. drivers/video/fbdev/core/Kconfig +1 −1
  311. fs/aio.c +1 −1
  312. fs/binfmt_elf_fdpic.c +2 −3
  313. fs/btrfs/delayed-ref.c +35 −11
  314. fs/btrfs/delayed-ref.h +0 −1
  315. fs/btrfs/extent-tree.c +10 −8
  316. fs/btrfs/extent_io.c +7 −1
  317. fs/btrfs/super.c +1 −1
  318. fs/btrfs/transaction.c +3 −3
  319. fs/btrfs/tree-log.c +1 −1
  320. fs/btrfs/volumes.c +6 −7
  321. fs/buffer.c +24 −12
  322. fs/ceph/crypto.c +2 −4
  323. fs/fs-writeback.c +8 −3
  324. fs/iomap/buffered-io.c +19 −13
  325. fs/libfs.c +1 −0
  326. fs/nfs/nfs4proc.c +3 −1
  327. fs/nfs/nfs4state.c +33 −12
  328. fs/nfs/write.c +1 −1
  329. fs/nfsd/nfs4xdr.c +2 −2
  330. fs/nilfs2/gcinode.c +3 −3
  331. fs/ntfs3/super.c +1 −0
  332. fs/overlayfs/copy_up.c +1 −1
  333. fs/overlayfs/export.c +1 −1
  334. fs/overlayfs/file.c +6 −2
  335. fs/overlayfs/ovl_entry.h +1 −9
  336. fs/overlayfs/params.c +9 −8
  337. fs/overlayfs/super.c +17 −10
  338. fs/pipe.c +0 −1
  339. fs/proc/internal.h +0 −2
  340. fs/proc/task_nommu.c +37 −27
  341. fs/reiserfs/reiserfs.h +3 −3
  342. fs/smb/client/cached_dir.c +6 −0
  343. fs/smb/client/cifsglob.h +2 −1
  344. fs/smb/client/cifsproto.h +1 −1
  345. fs/smb/client/connect.c +6 −2
  346. fs/smb/client/fs_context.c +1 −0
  347. fs/smb/client/misc.c +9 −5
  348. fs/smb/client/smb2inode.c +3 −0
  349. fs/smb/client/smb2maperror.c +0 −2
  350. fs/smb/client/smb2pdu.c +2 −2
  351. fs/smb/client/smbdirect.c +6 −3
  352. fs/smb/client/trace.h +2 −0
  353. fs/smb/client/transport.c +23 −11
  354. fs/smb/server/connection.c +3 −0
  355. fs/smb/server/server.c +3 −1
  356. fs/smb/server/smb2misc.c +1 −3
  357. fs/tracefs/event_inode.c +70 −17
  358. fs/xfs/Kconfig +1 −1
  359. fs/xfs/libxfs/xfs_log_recover.h +22 −0
  360. fs/xfs/libxfs/xfs_sb.c +2 −1
  361. fs/xfs/scrub/scrub.c +2 −2
  362. fs/xfs/scrub/stats.c +4 −1
  363. fs/xfs/xfs_attr_inactive.c +0 −1
  364. fs/xfs/xfs_attr_item.c +4 −3
  365. fs/xfs/xfs_bmap_item.c +3 −1
  366. fs/xfs/xfs_export.c +14 −0
  367. fs/xfs/xfs_extfree_item.c +3 −1
  368. fs/xfs/xfs_fsmap.c +18 −7
  369. fs/xfs/xfs_icache.c +29 −51
  370. fs/xfs/xfs_icache.h +0 −1
  371. fs/xfs/xfs_inode.c +218 −13
  372. fs/xfs/xfs_inode.h +32 −2
  373. fs/xfs/xfs_itable.c +11 −0
  374. fs/xfs/xfs_log.c +0 −17
  375. fs/xfs/xfs_log_cil.c +16 −36
  376. fs/xfs/xfs_log_priv.h +6 −8
  377. fs/xfs/xfs_log_recover.c +2 −2
  378. fs/xfs/xfs_mount.h +13 −4
  379. fs/xfs/xfs_qm.c +16 −0
  380. fs/xfs/xfs_refcount_item.c +4 −2
  381. fs/xfs/xfs_rmap_item.c +4 −2
  382. fs/xfs/xfs_super.c +2 −84
  383. fs/xfs/xfs_trace.h +45 −0
  384. fs/xfs/xfs_xattr.c +11 −0
  385. include/asm-generic/hugetlb.h +1 −1
  386. include/asm-generic/vmlinux.lds.h +0 −7
  387. include/linux/aer.h +2 −0
  388. include/linux/arm-smccc.h +2 −0
  389. include/linux/atomic/atomic-arch-fallback.h +1 −9
  390. include/linux/bpf.h +1 −1
  391. include/linux/ceph/ceph_fs.h +11 −13
  392. include/linux/cpuhotplug.h +0 −1
  393. include/linux/hugetlb.h +4 −2
  394. include/linux/interrupt.h +5 −1
  395. include/linux/kasan.h +1 −1
  396. include/linux/libata.h +7 −3
  397. include/linux/maple_tree.h +11 −0
  398. include/linux/memcontrol.h +2 −2
  399. include/linux/netfilter/nf_conntrack_sctp.h +1 −0
  400. include/linux/pgtable.h +9 −1
  401. include/linux/resume_user_mode.h +1 −1
  402. include/linux/seqlock.h +1 −1
  403. include/linux/swiotlb.h +16 −7
  404. include/net/bluetooth/hci_core.h +1 −1
  405. include/net/cfg80211.h +4 −2
  406. include/net/ip_fib.h +1 −0
  407. include/net/mana/mana.h +3 −2
  408. include/net/neighbour.h +1 −1
  409. include/net/page_pool/helpers.h +3 −3
  410. include/net/tcp.h +4 −2
  411. include/scsi/scsi.h +3 −0
  412. include/scsi/scsi_device.h +4 −1
  413. include/scsi/scsi_host.h +1 −1
  414. include/uapi/linux/stddef.h +7 −0
  415. io_uring/fs.c +1 −1
  416. kernel/bpf/memalloc.c +19 −25
  417. kernel/bpf/mprog.c +3 −0
  418. kernel/bpf/verifier.c +3 −5
  419. kernel/crash_core.c +17 −0
  420. kernel/dma/swiotlb.c +22 −9
  421. kernel/pid.c +1 −1
  422. kernel/sched/core.c +1 −1
  423. kernel/sched/cpupri.c +1 −0
  424. kernel/sched/idle.c +1 −0
  425. kernel/task_work.c +1 −0
  426. kernel/trace/ring_buffer.c +18 −13
  427. kernel/trace/trace_events.c +1 −0
  428. kernel/trace/trace_events_user.c +51 −7
  429. kernel/workqueue.c +3 −6
  430. lib/argv_split.c +2 −2
  431. lib/maple_tree.c +163 −58
  432. lib/scatterlist.c +3 −1
  433. lib/test_maple_tree.c +72 −15
  434. mm/damon/vaddr-test.h +2 −0
  435. mm/damon/vaddr.c +2 −1
  436. mm/filemap.c +50 −23
  437. mm/hugetlb.c +24 −19
  438. mm/kasan/kasan.h +3 −5
  439. mm/memcontrol.c +16 −3
  440. mm/mempolicy.c +19 −20
  441. mm/migrate.c +5 −2
  442. mm/page_alloc.c +6 −6
  443. mm/rmap.c +18 −5
  444. mm/slab_common.c +18 −18
  445. mm/vmalloc.c +1 −1
  446. mm/zswap.c +20 −0
  447. net/bluetooth/hci_conn.c +35 −28
  448. net/bluetooth/hci_core.c +11 −3
  449. net/bluetooth/hci_event.c +1 −0
  450. net/bluetooth/hci_request.h +0 −2
  451. net/bluetooth/hci_sync.c +5 −9
  452. net/bluetooth/iso.c +6 −3
  453. net/bridge/br_netfilter_hooks.c +1 −1
  454. net/core/neighbour.c +8 −6
  455. net/core/sock_map.c +4 −0
  456. net/ethtool/plca.c +29 −16
  457. net/ipv4/fib_semantics.c +1 −0
  458. net/ipv4/fib_trie.c +4 −0
  459. net/ipv4/route.c +2 −0
  460. net/ipv4/tcp.c +2 −8
  461. net/ipv4/tcp_bpf.c +3 −1
  462. net/ipv4/tcp_input.c +13 −0
  463. net/ipv4/tcp_output.c +3 −4
  464. net/ipv6/tcp_ipv6.c +7 −3
  465. net/l2tp/l2tp_ip6.c +1 −1
  466. net/mac80211/cfg.c +5 −1
  467. net/mac80211/ibss.c +1 −1
  468. net/mac80211/ieee80211_i.h +2 −1
  469. net/mac80211/key.c +16 −6
  470. net/mac80211/mesh.c +4 −4
  471. net/mac80211/mesh_plink.c +1 −1
  472. net/mac80211/mlme.c +35 −10
  473. net/mac80211/tx.c +2 −1
  474. net/mac80211/vht.c +14 −2
  475. net/mptcp/pm_userspace.c +0 −6
  476. net/mptcp/protocol.c +14 −14
  477. net/mptcp/protocol.h +12 −23
  478. net/mptcp/subflow.c +8 −2
  479. net/netfilter/ipvs/ip_vs_sync.c +4 −4
  480. net/netfilter/nf_conntrack_proto_sctp.c +33 −10
  481. net/netfilter/nf_tables_api.c +28 −16
  482. net/netfilter/nft_payload.c +12 −1
  483. net/netfilter/nft_set_rbtree.c +29 −17
  484. net/netlink/af_netlink.c +4 −4
  485. net/nfc/llcp_core.c +2 −0
  486. net/rds/tcp_connect.c +2 −2
  487. net/rds/tcp_listen.c +1 −1
  488. net/rfkill/core.c +26 −6
  489. net/sctp/associola.c +1 −2
  490. net/sctp/socket.c +1 −0
  491. net/socket.c +29 −7
  492. net/sunrpc/auth.c +8 −3
  493. net/sunrpc/auth_tls.c +2 −2
  494. net/sunrpc/clnt.c +10 −3
  495. net/sunrpc/xprtsock.c +6 −0
  496. net/tipc/crypto.c +2 −2
  497. net/wireless/core.c +7 −7
  498. net/wireless/core.h +5 −2
  499. net/wireless/mlme.c +2 −1
  500. net/wireless/nl80211.c +81 −33
  501. net/wireless/scan.c +4 −0
  502. scripts/Makefile.modinst +1 −1
  503. scripts/atomic/gen-atomic-fallback.sh +1 −1
  504. scripts/gdb/linux/symbols.py +2 −21
  505. scripts/mod/file2alias.c +1 −1
  506. scripts/mod/modpost.c +13 −2
  507. scripts/package/builddeb +0 −1
  508. scripts/package/kernel.spec +0 −3
  509. security/integrity/ima/Kconfig +8 −14
  510. tools/arch/x86/include/asm/msr-index.h +12 −0
  511. tools/include/uapi/asm-generic/unistd.h +4 −1
  512. tools/include/uapi/drm/drm.h +69 −15
  513. tools/include/uapi/linux/seccomp.h +157 −0
  514. tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl +1 −0
  515. tools/perf/arch/powerpc/entry/syscalls/syscall.tbl +1 −0
  516. tools/perf/arch/s390/entry/syscalls/syscall.tbl +1 −0
  517. tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +2 −0
  518. tools/perf/bench/sched-seccomp-notify.c +1 −1
  519. tools/perf/check-headers.sh +1 −0
  520. tools/perf/pmu-events/jevents.py +1 −1
  521. tools/perf/pmu-events/metric.py +2 −2
  522. tools/perf/util/bpf-prologue.c +0 −508
  523. tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c +2 −0
  524. tools/perf/util/hashmap.h +0 −10
  525. tools/perf/util/pmu.c +1 −1
  526. tools/testing/selftests/Makefile +1 −1
  527. tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c +2 −0
  528. tools/testing/selftests/bpf/prog_tests/sockmap_basic.c +51 −0
  529. tools/testing/selftests/bpf/prog_tests/tc_opts.c +84 −0
  530. tools/testing/selftests/bpf/progs/bpf_cubic.c +3 −0
  531. tools/testing/selftests/fchmodat2/Makefile +1 −1
  532. tools/testing/selftests/kvm/lib/test_util.c +1 −1
  533. tools/testing/selftests/kvm/riscv/get-reg-list.c +42 −16
  534. tools/testing/selftests/mm/charge_reserved_hugetlb.sh +2 −2
  535. tools/testing/selftests/mm/hugetlb_reparenting_test.sh +2 −2
  536. tools/testing/selftests/netfilter/Makefile +3 −2
  537. tools/testing/selftests/netfilter/conntrack_sctp_collision.sh +89 −0
  538. tools/testing/selftests/netfilter/nft_audit.sh +101 −16
  539. tools/testing/selftests/netfilter/sctp_collision.c +99 −0
  540. tools/testing/selftests/openat2/Makefile +1 −1
  541. tools/testing/selftests/powerpc/Makefile +3 −4
  542. tools/testing/selftests/powerpc/pmu/Makefile +6 −5
  543. tools/testing/selftests/proc/proc-empty-vm.c +1 −0
  544. tools/testing/selftests/user_events/abi_test.c +3 −1
  545. tools/testing/selftests/user_events/dyn_test.c +4 −1
  546. tools/testing/selftests/user_events/ftrace_test.c +4 −1
  547. tools/testing/selftests/user_events/perf_test.c +4 −1
  548. tools/testing/selftests/user_events/user_events_selftests.h +19 −5
  549. tools/tracing/rtla/src/timerlat_aa.c +26 −6
  550. tools/tracing/rtla/src/timerlat_u.c +4 −2
.mailmap+1−0
@@ -377,6 +377,7 @@ Matthew Wilcox <willy@infradead.org> <willy@debian.org> · 376 unmodified lines
377377 Matthew Wilcox <willy@infradead.org> <willy@linux.intel.com>
378378 Matthew Wilcox <willy@infradead.org> <willy@parisc-linux.org>
379379 Matthias Fuchs <socketcan@esd.eu> <matthias.fuchs@esd.eu>
380+Matthieu Baerts <matttbe@kernel.org> <matthieu.baerts@tessares.net>
380381 Matthieu CASTET <castet.matthieu@free.fr>
381382 Matti Vaittinen <mazziesaccount@gmail.com> <matti.vaittinen@fi.rohmeurope.com>
382383 Matt Ranostay <matt.ranostay@konsulko.com> <matt@ranostay.consulting>
Documentation/admin-guide/cgroup-v1/memory.rst+7−0
@@ -92,6 +92,13 @@ Brief summary of control files. · 91 unmodified lines
9292 memory.oom_control set/show oom controls.
9393 memory.numa_stat show the number of memory usage per numa
9494 node
95+ memory.kmem.limit_in_bytes Deprecated knob to set and read the kernel
96+ memory hard limit. Kernel hard limit is not
97+ supported since 5.16. Writing any value to
98+ do file will not have any effect same as if
99+ nokmem kernel parameter was specified.
100+ Kernel memory is still charged and reported
101+ by memory.kmem.usage_in_bytes.
95102 memory.kmem.usage_in_bytes show current kernel memory allocation
96103 memory.kmem.failcnt show the number of kernel memory usage
97104 hits limits
Documentation/arch/arm64/cpu-feature-registers.rst+12−0
@@ -175,6 +175,8 @@ infrastructure: · 174 unmodified lines
175175 +------------------------------+---------+---------+
176176 | Name | bits | visible |
177177 +------------------------------+---------+---------+
178+ | SME | [27-24] | y |
179+ +------------------------------+---------+---------+
178180 | MTE | [11-8] | y |
179181 +------------------------------+---------+---------+
180182 | SSBS | [7-4] | y |
@@ -288,8 +290,18 @@ infrastructure: · 107 unmodified lines
288290 +------------------------------+---------+---------+
289291 | Name | bits | visible |
290292 +------------------------------+---------+---------+
293+ | CSSC | [55-52] | y |
294+ +------------------------------+---------+---------+
295+ | RPRFM | [51-48] | y |
296+ +------------------------------+---------+---------+
297+ | BC | [23-20] | y |
298+ +------------------------------+---------+---------+
291299 | MOPS | [19-16] | y |
292300 +------------------------------+---------+---------+
301+ | APA3 | [15-12] | y |
302+ +------------------------------+---------+---------+
303+ | GPA3 | [11-8] | y |
304+ +------------------------------+---------+---------+
293305 | RPRES | [7-4] | y |
294306 +------------------------------+---------+---------+
295307 | WFXT | [3-0] | y |
Documentation/arch/arm64/elf_hwcaps.rst+3−0
@@ -305,6 +305,9 @@ HWCAP2_SMEF16F16 · 304 unmodified lines
305305 HWCAP2_MOPS
306306 Functionality implied by ID_AA64ISAR2_EL1.MOPS == 0b0001.
307307
308+HWCAP2_HBC
309+ Functionality implied by ID_AA64ISAR2_EL1.BC == 0b0001.
310+
308311 4. Unused AT_HWCAP bits
309312 -----------------------
310313
Documentation/arch/loongarch/introduction.rst+2−2
@@ -381,9 +381,9 @@ Documentation of LoongArch ISA: · 380 unmodified lines
381381
382382 Documentation of LoongArch ELF psABI:
383383
384− https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.00-CN.pdf (in Chinese)
384+ https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.01-CN.pdf (in Chinese)
385385
386− https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.00-EN.pdf (in English)
386+ https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.01-EN.pdf (in English)
387387
388388 Linux kernel repository of Loongson and LoongArch:
389389
Documentation/devicetree/bindings/ata/pata-common.yaml+1−0
@@ -38,6 +38,7 @@ patternProperties: · 37 unmodified lines
3838 ID number 0 and the slave drive will have ID number 1. The PATA port
3939 nodes will be named "ide-port".
4040 type: object
41+ additionalProperties: false
4142
4243 properties:
4344 reg:
Documentation/devicetree/bindings/clock/renesas,5p35023.yaml+7−4
@@ -37,6 +37,9 @@ properties: · 36 unmodified lines
3737 maxItems: 1
3838
3939 '#clock-cells':
40+ description:
41+ The index in the assigned-clocks is mapped to the output clock as below
42+ 0 - REF, 1 - SE1, 2 - SE2, 3 - SE3, 4 - DIFF1, 5 - DIFF2.
4043 const: 1
4144
4245 clocks:
@@ -68,7 +71,7 @@ examples: · 25 unmodified lines
6871 reg = <0x68>;
6972 #clock-cells = <1>;
7073
71− clocks = <&x1_x2>;
74+ clocks = <&x1>;
7275
7376 renesas,settings = [
7477 80 00 11 19 4c 02 23 7f 83 19 08 a9 5f 25 24 bf
@@ -79,8 +82,8 @@ examples: · 4 unmodified lines
7982 assigned-clocks = <&versa3 0>, <&versa3 1>,
8083 <&versa3 2>, <&versa3 3>,
8184 <&versa3 4>, <&versa3 5>;
82− assigned-clock-rates = <12288000>, <25000000>,
83− <12000000>, <11289600>,
84− <11289600>, <24000000>;
85+ assigned-clock-rates = <24000000>, <11289600>,
86+ <11289600>, <12000000>,
87+ <25000000>, <12288000>;
8588 };
8689 };
Documentation/devicetree/bindings/i2c/i2c-mxs.yaml+4−1
@@ -9,6 +9,9 @@ title: Freescale MXS Inter IC (I2C) Controller · 8 unmodified lines
99 maintainers:
1010 - Shawn Guo <shawnguo@kernel.org>
1111
12+allOf:
13+ - $ref: /schemas/i2c/i2c-controller.yaml#
14+
1215 properties:
1316 compatible:
1417 enum:
@@ -37,7 +40,7 @@ required: · 22 unmodified lines
3740 - dmas
3841 - dma-names
3942
40−additionalProperties: false
43+unevaluatedProperties: false
4144
4245 examples:
4346 - |
Documentation/devicetree/bindings/iommu/arm,smmu.yaml+1−1
@@ -270,6 +270,7 @@ allOf: · 269 unmodified lines
270270 contains:
271271 enum:
272272 - qcom,msm8998-smmu-v2
273+ - qcom,sdm630-smmu-v2
273274 then:
274275 anyOf:
275276 - properties:
@@ -311,7 +312,6 @@ allOf: · 35 unmodified lines
311312 compatible:
312313 contains:
313314 enum:
314− - qcom,sdm630-smmu-v2
315315 - qcom,sm6375-smmu-v2
316316 then:
317317 anyOf:
Documentation/devicetree/bindings/mfd/maxim,max77693.yaml+0−4
@@ -31,10 +31,6 @@ properties: · 30 unmodified lines
3131 charger:
3232 $ref: /schemas/power/supply/maxim,max77693.yaml
3333
34− connector:
35− $ref: /schemas/connector/usb-connector.yaml#
36− unevaluatedProperties: false
37−
3834 led:
3935 $ref: /schemas/leds/maxim,max77693.yaml
4036
Documentation/devicetree/bindings/soc/loongson/loongson,ls2k-pmc.yaml+37−6
@@ -11,11 +11,16 @@ maintainers: · 10 unmodified lines
1111
1212 properties:
1313 compatible:
14− items:
15− - enum:
16− - loongson,ls2k0500-pmc
17− - loongson,ls2k1000-pmc
18− - const: syscon
14+ oneOf:
15+ - items:
16+ - const: loongson,ls2k0500-pmc
17+ - const: syscon
18+ - items:
19+ - enum:
20+ - loongson,ls2k1000-pmc
21+ - loongson,ls2k2000-pmc
22+ - const: loongson,ls2k0500-pmc
23+ - const: syscon
1924
2025 reg:
2126 maxItems: 1
@@ -32,6 +37,18 @@ properties: · 10 unmodified lines
3237 addition, the PM need according to it to indicate that current
3338 SoC whether support Suspend To RAM.
3439
40+ syscon-poweroff:
41+ $ref: /schemas/power/reset/syscon-poweroff.yaml#
42+ type: object
43+ description:
44+ Node for power off method
45+
46+ syscon-reboot:
47+ $ref: /schemas/power/reset/syscon-reboot.yaml#
48+ type: object
49+ description:
50+ Node for reboot method
51+
3552 required:
3653 - compatible
3754 - reg
@@ -44,9 +61,23 @@ examples: · 6 unmodified lines
4461 #include <dt-bindings/interrupt-controller/irq.h>
4562
4663 power-management@1fe27000 {
47− compatible = "loongson,ls2k1000-pmc", "syscon";
64+ compatible = "loongson,ls2k1000-pmc", "loongson,ls2k0500-pmc", "syscon";
4865 reg = <0x1fe27000 0x58>;
4966 interrupt-parent = <&liointc1>;
5067 interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
5168 loongson,suspend-address = <0x0 0x1c000500>;
69+
70+ syscon-reboot {
71+ compatible = "syscon-reboot";
72+ offset = <0x30>;
73+ mask = <0x1>;
74+ };
75+
76+ syscon-poweroff {
77+ compatible = "syscon-poweroff";
78+ regmap = <&pmc>;
79+ offset = <0x14>;
80+ mask = <0x3c00>;
81+ value = <0x3c00>;
82+ };
5283 };
Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml+7−0
@@ -22,6 +22,13 @@ properties: · 21 unmodified lines
2222 - const: fsl,imx35-cspi
2323 - const: fsl,imx51-ecspi
2424 - const: fsl,imx53-ecspi
25+ - items:
26+ - enum:
27+ - fsl,imx25-cspi
28+ - fsl,imx50-cspi
29+ - fsl,imx51-cspi
30+ - fsl,imx53-cspi
31+ - const: fsl,imx35-cspi
2532 - items:
2633 - const: fsl,imx8mp-ecspi
2734 - const: fsl,imx6ul-ecspi
Documentation/filesystems/porting.rst+96−0
@@ -949,3 +949,99 @@ mmap_lock held. All in-tree users have been audited and do not seem to · 948 unmodified lines
949949 depend on the mmap_lock being held, but out of tree users should verify
950950 for themselves. If they do need it, they can return VM_FAULT_RETRY to
951951 be called with the mmap_lock held.
952+
953+---
954+
955+**mandatory**
956+
957+The order of opening block devices and matching or creating superblocks has
958+changed.
959+
960+The old logic opened block devices first and then tried to find a
961+suitable superblock to reuse based on the block device pointer.
962+
963+The new logic tries to find a suitable superblock first based on the device
964+number, and opening the block device afterwards.
965+
966+Since opening block devices cannot happen under s_umount because of lock
967+ordering requirements s_umount is now dropped while opening block devices and
968+reacquired before calling fill_super().
969+
970+In the old logic concurrent mounters would find the superblock on the list of
971+superblocks for the filesystem type. Since the first opener of the block device
972+would hold s_umount they would wait until the superblock became either born or
973+was discarded due to initialization failure.
974+
975+Since the new logic drops s_umount concurrent mounters could grab s_umount and
976+would spin. Instead they are now made to wait using an explicit wait-wake
977+mechanism without having to hold s_umount.
978+
979+---
980+
981+**mandatory**
982+
983+The holder of a block device is now the superblock.
984+
985+The holder of a block device used to be the file_system_type which wasn't
986+particularly useful. It wasn't possible to go from block device to owning
987+superblock without matching on the device pointer stored in the superblock.
988+This mechanism would only work for a single device so the block layer couldn't
989+find the owning superblock of any additional devices.
990+
991+In the old mechanism reusing or creating a superblock for a racing mount(2) and
992+umount(2) relied on the file_system_type as the holder. This was severly
993+underdocumented however:
994+
995+(1) Any concurrent mounter that managed to grab an active reference on an
996+ existing superblock was made to wait until the superblock either became
997+ ready or until the superblock was removed from the list of superblocks of
998+ the filesystem type. If the superblock is ready the caller would simple
999+ reuse it.
1000+
1001+(2) If the mounter came after deactivate_locked_super() but before
1002+ the superblock had been removed from the list of superblocks of the
1003+ filesystem type the mounter would wait until the superblock was shutdown,
1004+ reuse the block device and allocate a new superblock.
1005+
1006+(3) If the mounter came after deactivate_locked_super() and after
1007+ the superblock had been removed from the list of superblocks of the
1008+ filesystem type the mounter would reuse the block device and allocate a new
1009+ superblock (the bd_holder point may still be set to the filesystem type).
1010+
1011+Because the holder of the block device was the file_system_type any concurrent
1012+mounter could open the block devices of any superblock of the same
1013+file_system_type without risking seeing EBUSY because the block device was
1014+still in use by another superblock.
1015+
1016+Making the superblock the owner of the block device changes this as the holder
1017+is now a unique superblock and thus block devices associated with it cannot be
1018+reused by concurrent mounters. So a concurrent mounter in (2) could suddenly
1019+see EBUSY when trying to open a block device whose holder was a different
1020+superblock.
1021+
1022+The new logic thus waits until the superblock and the devices are shutdown in
1023+->kill_sb(). Removal of the superblock from the list of superblocks of the
1024+filesystem type is now moved to a later point when the devices are closed:
1025+
1026+(1) Any concurrent mounter managing to grab an active reference on an existing
1027+ superblock is made to wait until the superblock is either ready or until
1028+ the superblock and all devices are shutdown in ->kill_sb(). If the
1029+ superblock is ready the caller will simply reuse it.
1030+
1031+(2) If the mounter comes after deactivate_locked_super() but before
1032+ the superblock has been removed from the list of superblocks of the
1033+ filesystem type the mounter is made to wait until the superblock and the
1034+ devices are shut down in ->kill_sb() and the superblock is removed from the
1035+ list of superblocks of the filesystem type. The mounter will allocate a new
1036+ superblock and grab ownership of the block device (the bd_holder pointer of
1037+ the block device will be set to the newly allocated superblock).
1038+
1039+(3) This case is now collapsed into (2) as the superblock is left on the list
1040+ of superblocks of the filesystem type until all devices are shutdown in
1041+ ->kill_sb(). In other words, if the superblock isn't on the list of
1042+ superblock of the filesystem type anymore then it has given up ownership of
1043+ all associated block devices (the bd_holder pointer is NULL).
1044+
1045+As this is a VFS level change it has no practical consequences for filesystems
1046+other than that all of them must use one of the provided kill_litter_super(),
1047+kill_anon_super(), or kill_block_super() helpers.
Documentation/kbuild/kconfig-language.rst+26−0
@@ -573,6 +573,32 @@ above, leading to: · 572 unmodified lines
573573 bool "Support for foo hardware"
574574 depends on ARCH_FOO_VENDOR || COMPILE_TEST
575575
576+Optional dependencies
577+~~~~~~~~~~~~~~~~~~~~~
578+
579+Some drivers are able to optionally use a feature from another module
580+or build cleanly with that module disabled, but cause a link failure
581+when trying to use that loadable module from a built-in driver.
582+
583+The most common way to express this optional dependency in Kconfig logic
584+uses the slightly counterintuitive::
585+
586+ config FOO
587+ tristate "Support for foo hardware"
588+ depends on BAR || !BAR
589+
590+This means that there is either a dependency on BAR that disallows
591+the combination of FOO=y with BAR=m, or BAR is completely disabled.
592+For a more formalized approach if there are multiple drivers that have
593+the same dependency, a helper symbol can be used, like::
594+
595+ config FOO
596+ tristate "Support for foo hardware"
597+ depends on BAR_OPTIONAL
598+
599+ config BAR_OPTIONAL
600+ def_tristate BAR || !BAR
601+
576602 Kconfig recursive dependency limitations
577603 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
578604
Documentation/tools/rtla/rtla-timerlat-hist.rst+2−2
@@ -36,11 +36,11 @@ EXAMPLE · 35 unmodified lines
3636 In the example below, **rtla timerlat hist** is set to run for *10* minutes,
3737 in the cpus *0-4*, *skipping zero* only lines. Moreover, **rtla timerlat
3838 hist** will change the priority of the *timerlat* threads to run under
39−*SCHED_DEADLINE* priority, with a *10us* runtime every *1ms* period. The
39+*SCHED_DEADLINE* priority, with a *100us* runtime every *1ms* period. The
4040 *1ms* period is also passed to the *timerlat* tracer. Auto-analysis is disabled
4141 to reduce overhead ::
4242
43− [root@alien ~]# timerlat hist -d 10m -c 0-4 -P d:100us:1ms -p 1ms --no-aa
43+ [root@alien ~]# timerlat hist -d 10m -c 0-4 -P d:100us:1ms -p 1000 --no-aa
4444 # RTLA timerlat histogram
4545 # Time unit is microseconds (us)
4646 # Duration: 0 00:10:00
Documentation/translations/zh_CN/arch/loongarch/introduction.rst+2−2
@@ -344,9 +344,9 @@ LoongArch指令集架构的文档: · 343 unmodified lines
344344
345345 LoongArch的ELF psABI文档:
346346
347− https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.00-CN.pdf (中文版)
347+ https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.01-CN.pdf (中文版)
348348
349− https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.00-EN.pdf (英文版)
349+ https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.01-EN.pdf (英文版)
350350
351351 Loongson与LoongArch的Linux内核源码仓库:
352352
MAINTAINERS+14−18
@@ -470,7 +470,6 @@ F: drivers/hwmon/adm1029.c · 469 unmodified lines
470470 ADM8211 WIRELESS DRIVER
471471 L: linux-wireless@vger.kernel.org
472472 S: Orphan
473−W: https://wireless.wiki.kernel.org/
474473 F: drivers/net/wireless/admtek/adm8211.*
475474
476475 ADP1653 FLASH CONTROLLER DRIVER
@@ -1662,7 +1661,7 @@ F: arch/arm*/include/asm/perf_event.h · 1185 unmodified lines
16621661 F: arch/arm*/kernel/hw_breakpoint.c
16631662 F: arch/arm*/kernel/perf_*
16641663 F: drivers/perf/
1665−F: include/linux/perf/arm_pmu.h
1664+F: include/linux/perf/arm_pmu*.h
16661665
16671666 ARM PORT
16681667 M: Russell King <linux@armlinux.org.uk>
@@ -1963,12 +1962,12 @@ F: drivers/irqchip/irq-aspeed-i2c-ic.c · 294 unmodified lines
19631962
19641963 ARM/ASPEED MACHINE SUPPORT
19651964 M: Joel Stanley <joel@jms.id.au>
1966−R: Andrew Jeffery <andrew@aj.id.au>
1965+R: Andrew Jeffery <andrew@codeconstruct.com.au>
19671966 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
19681967 L: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
19691968 S: Supported
19701969 Q: https://patchwork.ozlabs.org/project/linux-aspeed/list/
1971−T: git git://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed.git
1970+T: git git://git.kernel.org/pub/scm/linux/kernel/git/joel/bmc.git
19721971 F: Documentation/devicetree/bindings/arm/aspeed/
19731972 F: arch/arm/boot/dts/aspeed/
19741973 F: arch/arm/mach-aspeed/
@@ -3058,7 +3057,7 @@ F: Documentation/devicetree/bindings/peci/peci-aspeed.yaml · 1083 unmodified lines
30583057 F: drivers/peci/controller/peci-aspeed.c
30593058
30603059 ASPEED PINCTRL DRIVERS
3061−M: Andrew Jeffery <andrew@aj.id.au>
3060+M: Andrew Jeffery <andrew@codeconstruct.com.au>
30623061 L: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
30633062 L: openbmc@lists.ozlabs.org (moderated for non-subscribers)
30643063 L: linux-gpio@vger.kernel.org
@@ -3075,7 +3074,7 @@ F: drivers/irqchip/irq-aspeed-scu-ic.c · 10 unmodified lines
30753074 F: include/dt-bindings/interrupt-controller/aspeed-scu-ic.h
30763075
30773076 ASPEED SD/MMC DRIVER
3078−M: Andrew Jeffery <andrew@aj.id.au>
3077+M: Andrew Jeffery <andrew@codeconstruct.com.au>
30793078 L: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
30803079 L: openbmc@lists.ozlabs.org (moderated for non-subscribers)
30813080 L: linux-mmc@vger.kernel.org
@@ -4083,7 +4082,7 @@ F: drivers/net/wireless/broadcom/brcm80211/ · 1001 unmodified lines
40834082
40844083 BROADCOM BRCMSTB GPIO DRIVER
40854084 M: Doug Berger <opendmb@gmail.com>
4086−M: Florian Fainelli <florian.fainelli@broadcom>
4085+M: Florian Fainelli <florian.fainelli@broadcom.com>
40874086 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
40884087 S: Supported
40894088 F: Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml
@@ -6656,9 +6655,9 @@ F: Documentation/devicetree/bindings/display/panel/novatek,nt36672a.yaml · 2566 unmodified lines
66566655 F: drivers/gpu/drm/panel/panel-novatek-nt36672a.c
66576656
66586657 DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
6659−M: Ben Skeggs <bskeggs@redhat.com>
66606658 M: Karol Herbst <kherbst@redhat.com>
66616659 M: Lyude Paul <lyude@redhat.com>
6660+M: Danilo Krummrich <dakr@redhat.com>
66626661 L: dri-devel@lists.freedesktop.org
66636662 L: nouveau@lists.freedesktop.org
66646663 S: Supported
@@ -8885,7 +8884,7 @@ F: drivers/gpio/gpio-mockup.c · 2220 unmodified lines
88858884 F: tools/testing/selftests/gpio/
88868885
88878886 GPIO REGMAP
8888−R: Michael Walle <michael@walle.cc>
8887+M: Michael Walle <michael@walle.cc>
88898888 S: Maintained
88908889 F: drivers/gpio/gpio-regmap.c
88918890 F: include/linux/gpio/regmap.h
@@ -9542,10 +9541,8 @@ F: Documentation/devicetree/bindings/iio/pressure/honeywell,mprls0025pa.yaml · 650 unmodified lines
95429541 F: drivers/iio/pressure/mprls0025pa.c
95439542
95449543 HOST AP DRIVER
9545−M: Jouni Malinen <j@w1.fi>
95469544 L: linux-wireless@vger.kernel.org
95479545 S: Obsolete
9548−W: http://w1.fi/hostap-driver.html
95499546 F: drivers/net/wireless/intersil/hostap/
95509547
95519548 HP BIOSCFG DRIVER
@@ -13627,6 +13624,7 @@ F: drivers/net/ethernet/mellanox/mlxfw/ · 4075 unmodified lines
1362713624
1362813625 MELLANOX HARDWARE PLATFORM SUPPORT
1362913626 M: Hans de Goede <hdegoede@redhat.com>
13627+M: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1363013628 M: Mark Gross <markgross@kernel.org>
1363113629 M: Vadim Pasternak <vadimp@nvidia.com>
1363213630 L: platform-driver-x86@vger.kernel.org
@@ -14221,6 +14219,7 @@ F: drivers/platform/surface/surface_gpe.c · 588 unmodified lines
1422114219
1422214220 MICROSOFT SURFACE HARDWARE PLATFORM SUPPORT
1422314221 M: Hans de Goede <hdegoede@redhat.com>
14222+M: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1422414223 M: Mark Gross <markgross@kernel.org>
1422514224 M: Maximilian Luz <luzmaximilian@gmail.com>
1422614225 L: platform-driver-x86@vger.kernel.org
@@ -14958,7 +14957,7 @@ K: macsec · 731 unmodified lines
1495814957 K: \bmdo_
1495914958
1496014959 NETWORKING [MPTCP]
14961−M: Matthieu Baerts <matthieu.baerts@tessares.net>
14960+M: Matthieu Baerts <matttbe@kernel.org>
1496214961 M: Mat Martineau <martineau@kernel.org>
1496314962 L: netdev@vger.kernel.org
1496414963 L: mptcp@lists.linux.dev
@@ -17613,6 +17612,7 @@ M: Kalle Valo <kvalo@kernel.org> · 2648 unmodified lines
1761317612 M: Jeff Johnson <quic_jjohnson@quicinc.com>
1761417613 L: ath12k@lists.infradead.org
1761517614 S: Supported
17615+W: https://wireless.wiki.kernel.org/en/users/Drivers/ath12k
1761617616 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
1761717617 F: drivers/net/wireless/ath/ath12k/
1761817618
@@ -18143,8 +18143,6 @@ REALTEK WIRELESS DRIVER (rtlwifi family) · 524 unmodified lines
1814318143 M: Ping-Ke Shih <pkshih@realtek.com>
1814418144 L: linux-wireless@vger.kernel.org
1814518145 S: Maintained
18146−W: https://wireless.wiki.kernel.org/
18147−T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
1814818146 F: drivers/net/wireless/realtek/rtlwifi/
1814918147
1815018148 REALTEK WIRELESS DRIVER (rtw88)
@@ -18672,7 +18670,6 @@ F: drivers/media/dvb-frontends/rtl2832_sdr* · 521 unmodified lines
1867218670 RTL8180 WIRELESS DRIVER
1867318671 L: linux-wireless@vger.kernel.org
1867418672 S: Orphan
18675−W: https://wireless.wiki.kernel.org/
1867618673 F: drivers/net/wireless/realtek/rtl818x/rtl8180/
1867718674
1867818675 RTL8187 WIRELESS DRIVER
@@ -18680,14 +18677,12 @@ M: Hin-Tak Leung <hintak.leung@gmail.com> · 1 unmodified line
1868018677 M: Larry Finger <Larry.Finger@lwfinger.net>
1868118678 L: linux-wireless@vger.kernel.org
1868218679 S: Maintained
18683−W: https://wireless.wiki.kernel.org/
1868418680 F: drivers/net/wireless/realtek/rtl818x/rtl8187/
1868518681
1868618682 RTL8XXXU WIRELESS DRIVER (rtl8xxxu)
1868718683 M: Jes Sorensen <Jes.Sorensen@gmail.com>
1868818684 L: linux-wireless@vger.kernel.org
1868918685 S: Maintained
18690−T: git git://git.kernel.org/pub/scm/linux/kernel/git/jes/linux.git rtl8xxxu-devel
1869118686 F: drivers/net/wireless/realtek/rtl8xxxu/
1869218687
1869318688 RTRS TRANSPORT DRIVERS
@@ -21669,7 +21664,6 @@ L: linux-wireless@vger.kernel.org · 2975 unmodified lines
2166921664 S: Orphan
2167021665 W: https://wireless.wiki.kernel.org/en/users/Drivers/wl12xx
2167121666 W: https://wireless.wiki.kernel.org/en/users/Drivers/wl1251
21672−T: git git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git
2167321667 F: drivers/net/wireless/ti/
2167421668
2167521669 TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER
@@ -23436,9 +23430,11 @@ F: drivers/platform/x86/x86-android-tablets/ · 1760 unmodified lines
2343623430
2343723431 X86 PLATFORM DRIVERS
2343823432 M: Hans de Goede <hdegoede@redhat.com>
23433+M: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2343923434 M: Mark Gross <markgross@kernel.org>
2344023435 L: platform-driver-x86@vger.kernel.org
2344123436 S: Maintained
23437+Q: https://patchwork.kernel.org/project/platform-driver-x86/list/
2344223438 T: git git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git
2344323439 F: drivers/platform/olpc/
2344423440 F: drivers/platform/x86/
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 6
33 PATCHLEVEL = 6
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc2
5+EXTRAVERSION = -rc4
66 NAME = Hurr durr I'ma ninja sloth
77
88 # *DOCUMENTATION*
arch/arm/boot/dts/ti/omap/motorola-mapphone-common.dtsi+3−2
@@ -614,12 +614,12 @@ · 613 unmodified lines
614614 /* Configure pwm clock source for timers 8 & 9 */
615615 &timer8 {
616616 assigned-clocks = <&abe_clkctrl OMAP4_TIMER8_CLKCTRL 24>;
617− assigned-clock-parents = <&sys_clkin_ck>;
617+ assigned-clock-parents = <&sys_32k_ck>;
618618 };
619619
620620 &timer9 {
621621 assigned-clocks = <&l4_per_clkctrl OMAP4_TIMER9_CLKCTRL 24>;
622− assigned-clock-parents = <&sys_clkin_ck>;
622+ assigned-clock-parents = <&sys_32k_ck>;
623623 };
624624
625625 /*
@@ -640,6 +640,7 @@ · 14 unmodified lines
640640 &uart3 {
641641 interrupts-extended = <&wakeupgen GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH
642642 &omap4_pmx_core 0x17c>;
643+ overrun-throttle-ms = <500>;
643644 };
644645
645646 &uart4 {
arch/arm/boot/dts/ti/omap/omap3-cpu-thermal.dtsi+1−2
@@ -12,8 +12,7 @@ cpu_thermal: cpu-thermal { · 11 unmodified lines
1212 polling-delay = <1000>; /* milliseconds */
1313 coefficients = <0 20000>;
1414
15− /* sensor ID */
16− thermal-sensors = <&bandgap 0>;
15+ thermal-sensors = <&bandgap>;
1716
1817 cpu_trips: trips {
1918 cpu_alert0: cpu_alert {
arch/arm/boot/dts/ti/omap/omap4-cpu-thermal.dtsi+4−1
@@ -12,7 +12,10 @@ cpu_thermal: cpu_thermal { · 11 unmodified lines
1212 polling-delay-passive = <250>; /* milliseconds */
1313 polling-delay = <1000>; /* milliseconds */
1414
15− /* sensor ID */
15+ /*
16+ * See 44xx files for single sensor addressing, omap5 and dra7 need
17+ * also sensor ID for addressing.
18+ */
1619 thermal-sensors = <&bandgap 0>;
1720
1821 cpu_trips: trips {
arch/arm/boot/dts/ti/omap/omap443x.dtsi+1−0
@@ -69,6 +69,7 @@ · 68 unmodified lines
6969 };
7070
7171 &cpu_thermal {
72+ thermal-sensors = <&bandgap>;
7273 coefficients = <0 20000>;
7374 };
7475
arch/arm/boot/dts/ti/omap/omap4460.dtsi+1−0
@@ -79,6 +79,7 @@ · 78 unmodified lines
7979 };
8080
8181 &cpu_thermal {
82+ thermal-sensors = <&bandgap>;
8283 coefficients = <348 (-9301)>;
8384 };
8485
arch/arm/include/asm/hardware/locomo.h+1−1
@@ -195,7 +195,7 @@ struct locomo_driver { · 194 unmodified lines
195195
196196 #define LOCOMO_DRIVER_NAME(_ldev) ((_ldev)->dev.driver->name)
197197
198−void locomo_lcd_power(struct locomo_dev *, int, unsigned int);
198+extern void locomolcd_power(int on);
199199
200200 int locomo_driver_register(struct locomo_driver *);
201201 void locomo_driver_unregister(struct locomo_driver *);
arch/arm/mach-omap2/pm44xx.c+2−2
@@ -99,7 +99,7 @@ static int omap4_pm_suspend(void) · 98 unmodified lines
9999 * possible causes.
100100 * http://www.spinics.net/lists/arm-kernel/msg218641.html
101101 */
102− pr_warn("A possible cause could be an old bootloader - try u-boot >= v2012.07\n");
102+ pr_debug("A possible cause could be an old bootloader - try u-boot >= v2012.07\n");
103103 } else {
104104 pr_info("Successfully put all powerdomains to target state\n");
105105 }
@@ -257,7 +257,7 @@ int __init omap4_pm_init(void) · 151 unmodified lines
257257 * http://www.spinics.net/lists/arm-kernel/msg218641.html
258258 */
259259 if (cpu_is_omap44xx())
260− pr_warn("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n");
260+ pr_debug("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n");
261261
262262 ret = pwrdm_for_each(pwrdms_setup, NULL);
263263 if (ret) {
arch/arm/mach-sa1100/include/mach/collie.h+0−2
@@ -16,8 +16,6 @@ · 15 unmodified lines
1616
1717 #include "hardware.h" /* Gives GPIO_MAX */
1818
19−extern void locomolcd_power(int on);
20−
2119 #define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1)
2220 #define COLLIE_GPIO_CHARGE_ON (COLLIE_SCOOP_GPIO_BASE + 0)
2321 #define COLLIE_SCP_DIAG_BOOT1 SCOOP_GPCR_PA12
arch/arm/mm/cache-uniphier.c+3−1
@@ -58,11 +58,13 @@ · 57 unmodified lines
5858 ((op & UNIPHIER_SSCOQM_S_MASK) == UNIPHIER_SSCOQM_S_RANGE)
5959
6060 /**
61− * uniphier_cache_data - UniPhier outer cache specific data
61+ * struct uniphier_cache_data - UniPhier outer cache specific data
6262 *
6363 * @ctrl_base: virtual base address of control registers
6464 * @rev_base: virtual base address of revision registers
6565 * @op_base: virtual base address of operation registers
66+ * @way_ctrl_base: virtual address of the way control registers for this
67+ * SoC revision
6668 * @way_mask: each bit specifies if the way is present
6769 * @nsets: number of associativity sets
6870 * @line_size: line size in bytes
arch/arm64/boot/dts/freescale/Makefile+1−0
@@ -66,6 +66,7 @@ dtb-$(CONFIG_ARCH_MXC) += imx8mm-mx8menlo.dtb · 65 unmodified lines
6666 dtb-$(CONFIG_ARCH_MXC) += imx8mm-nitrogen-r2.dtb
6767 dtb-$(CONFIG_ARCH_MXC) += imx8mm-phg.dtb
6868 dtb-$(CONFIG_ARCH_MXC) += imx8mm-phyboard-polis-rdk.dtb
69+dtb-$(CONFIG_ARCH_MXC) += imx8mm-prt8mm.dtb
6970 dtb-$(CONFIG_ARCH_MXC) += imx8mm-tqma8mqml-mba8mx.dtb
7071 dtb-$(CONFIG_ARCH_MXC) += imx8mm-var-som-symphony.dtb
7172 dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw71xx-0x.dtb
arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi+20−12
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626
2727 port {
2828 hdmi_connector_in: endpoint {
29− remote-endpoint = <&adv7533_out>;
29+ remote-endpoint = <&adv7535_out>;
3030 };
3131 };
3232 };
@@ -72,6 +72,13 @@ · 39 unmodified lines
7272 enable-active-high;
7373 };
7474
75+ reg_vddext_3v3: regulator-vddext-3v3 {
76+ compatible = "regulator-fixed";
77+ regulator-name = "VDDEXT_3V3";
78+ regulator-min-microvolt = <3300000>;
79+ regulator-max-microvolt = <3300000>;
80+ };
81+
7582 backlight: backlight {
7683 compatible = "pwm-backlight";
7784 pwms = <&pwm1 0 5000000 0>;
@@ -317,15 +324,16 @@ · 239 unmodified lines
317324
318325 hdmi@3d {
319326 compatible = "adi,adv7535";
320− reg = <0x3d>, <0x3c>, <0x3e>, <0x3f>;
321− reg-names = "main", "cec", "edid", "packet";
327+ reg = <0x3d>;
328+ interrupt-parent = <&gpio1>;
329+ interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
322330 adi,dsi-lanes = <4>;
323−
324− adi,input-depth = <8>;
325− adi,input-colorspace = "rgb";
326− adi,input-clock = "1x";
327− adi,input-style = <1>;
328− adi,input-justification = "evenly";
331+ avdd-supply = <&buck5_reg>;
332+ dvdd-supply = <&buck5_reg>;
333+ pvdd-supply = <&buck5_reg>;
334+ a2vdd-supply = <&buck5_reg>;
335+ v3p3-supply = <&reg_vddext_3v3>;
336+ v1p2-supply = <&buck5_reg>;
329337
330338 ports {
331339 #address-cells = <1>;
@@ -334,7 +342,7 @@ · 2 unmodified lines
334342 port@0 {
335343 reg = <0>;
336344
337− adv7533_in: endpoint {
345+ adv7535_in: endpoint {
338346 remote-endpoint = <&dsi_out>;
339347 };
340348 };
@@ -342,7 +350,7 @@ · 1 unmodified line
342350 port@1 {
343351 reg = <1>;
344352
345− adv7533_out: endpoint {
353+ adv7535_out: endpoint {
346354 remote-endpoint = <&hdmi_connector_in>;
347355 };
348356 };
@@ -448,7 +456,7 @@ · 99 unmodified lines
448456 reg = <1>;
449457
450458 dsi_out: endpoint {
451− remote-endpoint = <&adv7533_in>;
459+ remote-endpoint = <&adv7535_in>;
452460 data-lanes = <1 2 3 4>;
453461 };
454462 };
arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts+3−2
@@ -381,9 +381,10 @@ · 380 unmodified lines
381381 &sai3 {
382382 pinctrl-names = "default";
383383 pinctrl-0 = <&pinctrl_sai3>;
384− assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
384+ assigned-clocks = <&clk IMX8MP_CLK_SAI3>,
385+ <&clk IMX8MP_AUDIO_PLL2> ;
385386 assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL2_OUT>;
386− assigned-clock-rates = <12288000>;
387+ assigned-clock-rates = <12288000>, <361267200>;
387388 fsl,sai-mclk-direction-output;
388389 status = "okay";
389390 };
arch/arm64/boot/dts/freescale/imx8mp.dtsi+6−0
@@ -790,6 +790,12 @@ · 789 unmodified lines
790790 reg = <IMX8MP_POWER_DOMAIN_AUDIOMIX>;
791791 clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
792792 <&clk IMX8MP_CLK_AUDIO_AXI>;
793+ assigned-clocks = <&clk IMX8MP_CLK_AUDIO_AHB>,
794+ <&clk IMX8MP_CLK_AUDIO_AXI_SRC>;
795+ assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
796+ <&clk IMX8MP_SYS_PLL1_800M>;
797+ assigned-clock-rates = <400000000>,
798+ <600000000>;
793799 };
794800
795801 pgc_gpu2d: power-domain@6 {
arch/arm64/boot/dts/freescale/imx93-tqma9352.dtsi+1−1
@@ -81,7 +81,7 @@ · 80 unmodified lines
8181 &gpio1 {
8282 pmic-irq-hog {
8383 gpio-hog;
84− gpios = <2 GPIO_ACTIVE_LOW>;
84+ gpios = <3 GPIO_ACTIVE_LOW>;
8585 input;
8686 line-name = "PMIC_IRQ#";
8787 };
arch/arm64/boot/dts/mediatek/mt8195.dtsi+5−5
@@ -2957,7 +2957,7 @@ · 2956 unmodified lines
29572957 clock-names = "merge","merge_async";
29582958 power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
29592959 mediatek,gce-client-reg = <&gce0 SUBSYS_1c10XXXX 0xc000 0x1000>;
2960− mediatek,merge-mute = <1>;
2960+ mediatek,merge-mute;
29612961 resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE0_DL_ASYNC>;
29622962 };
29632963
@@ -2970,7 +2970,7 @@ · 6 unmodified lines
29702970 clock-names = "merge","merge_async";
29712971 power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
29722972 mediatek,gce-client-reg = <&gce0 SUBSYS_1c10XXXX 0xd000 0x1000>;
2973− mediatek,merge-mute = <1>;
2973+ mediatek,merge-mute;
29742974 resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE1_DL_ASYNC>;
29752975 };
29762976
@@ -2983,7 +2983,7 @@ · 6 unmodified lines
29832983 clock-names = "merge","merge_async";
29842984 power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
29852985 mediatek,gce-client-reg = <&gce0 SUBSYS_1c10XXXX 0xe000 0x1000>;
2986− mediatek,merge-mute = <1>;
2986+ mediatek,merge-mute;
29872987 resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE2_DL_ASYNC>;
29882988 };
29892989
@@ -2996,7 +2996,7 @@ · 6 unmodified lines
29962996 clock-names = "merge","merge_async";
29972997 power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
29982998 mediatek,gce-client-reg = <&gce0 SUBSYS_1c10XXXX 0xf000 0x1000>;
2999− mediatek,merge-mute = <1>;
2999+ mediatek,merge-mute;
30003000 resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE3_DL_ASYNC>;
30013001 };
30023002
@@ -3009,7 +3009,7 @@ · 6 unmodified lines
30093009 clock-names = "merge","merge_async";
30103010 power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
30113011 mediatek,gce-client-reg = <&gce0 SUBSYS_1c11XXXX 0x0000 0x1000>;
3012− mediatek,merge-fifo-en = <1>;
3012+ mediatek,merge-fifo-en;
30133013 resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE4_DL_ASYNC>;
30143014 };
30153015
arch/arm64/configs/defconfig+1−1
@@ -636,6 +636,7 @@ CONFIG_POWER_RESET_MSM=y · 635 unmodified lines
636636 CONFIG_POWER_RESET_QCOM_PON=m
637637 CONFIG_POWER_RESET_XGENE=y
638638 CONFIG_POWER_RESET_SYSCON=y
639+CONFIG_POWER_RESET_SYSCON_POWEROFF=y
639640 CONFIG_SYSCON_REBOOT_MODE=y
640641 CONFIG_NVMEM_REBOOT_MODE=m
641642 CONFIG_BATTERY_SBS=m
@@ -1175,7 +1176,6 @@ CONFIG_COMMON_CLK_S2MPS11=y · 533 unmodified lines
11751176 CONFIG_COMMON_CLK_PWM=y
11761177 CONFIG_COMMON_CLK_RS9_PCIE=y
11771178 CONFIG_COMMON_CLK_VC5=y
1178−CONFIG_COMMON_CLK_NPCM8XX=y
11791179 CONFIG_COMMON_CLK_BD718XX=m
11801180 CONFIG_CLK_RASPBERRYPI=m
11811181 CONFIG_CLK_IMX8MM=y
arch/arm64/include/asm/cpufeature.h+1−1
@@ -663,7 +663,7 @@ static inline bool supports_clearbhb(int scope) · 662 unmodified lines
663663 isar2 = read_sanitised_ftr_reg(SYS_ID_AA64ISAR2_EL1);
664664
665665 return cpuid_feature_extract_unsigned_field(isar2,
666− ID_AA64ISAR2_EL1_BC_SHIFT);
666+ ID_AA64ISAR2_EL1_CLRBHB_SHIFT);
667667 }
668668
669669 const struct cpumask *system_32bit_el0_cpumask(void);
arch/arm64/include/asm/hugetlb.h+1−1
@@ -28,7 +28,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags); · 27 unmodified lines
2828 #define arch_make_huge_pte arch_make_huge_pte
2929 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
3030 extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
31− pte_t *ptep, pte_t pte);
31+ pte_t *ptep, pte_t pte, unsigned long sz);
3232 #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
3333 extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
3434 unsigned long addr, pte_t *ptep,
arch/arm64/include/asm/kvm_hyp.h+1−1
@@ -118,7 +118,7 @@ void deactivate_traps_vhe_put(struct kvm_vcpu *vcpu); · 117 unmodified lines
118118
119119 u64 __guest_enter(struct kvm_vcpu *vcpu);
120120
121−bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt);
121+bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt, u32 func_id);
122122
123123 #ifdef __KVM_NVHE_HYPERVISOR__
124124 void __noreturn __hyp_do_panic(struct kvm_cpu_context *host_ctxt, u64 spsr,
arch/arm64/kernel/cpufeature.c+2−1
@@ -222,7 +222,8 @@ static const struct arm64_ftr_bits ftr_id_aa64isar1[] = { · 221 unmodified lines
222222 static const struct arm64_ftr_bits ftr_id_aa64isar2[] = {
223223 ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_CSSC_SHIFT, 4, 0),
224224 ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_RPRFM_SHIFT, 4, 0),
225− ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, ID_AA64ISAR2_EL1_BC_SHIFT, 4, 0),
225+ ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_CLRBHB_SHIFT, 4, 0),
226+ ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_BC_SHIFT, 4, 0),
226227 ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_MOPS_SHIFT, 4, 0),
227228 ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_PTR_AUTH),
228229 FTR_STRICT, FTR_EXACT, ID_AA64ISAR2_EL1_APA3_SHIFT, 4, 0),
arch/arm64/kvm/hyp/include/nvhe/ffa.h+1−1
@@ -12,6 +12,6 @@ · 11 unmodified lines
1212 #define FFA_MAX_FUNC_NUM 0x7F
1313
1414 int hyp_ffa_init(void *pages);
15−bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt);
15+bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id);
1616
1717 #endif /* __KVM_HYP_FFA_H */
arch/arm64/kvm/hyp/nvhe/ffa.c+1−2
@@ -634,9 +634,8 @@ out_handled: · 633 unmodified lines
634634 return true;
635635 }
636636
637−bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt)
637+bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
638638 {
639− DECLARE_REG(u64, func_id, host_ctxt, 0);
640639 struct arm_smccc_res res;
641640
642641 /*
arch/arm64/kvm/hyp/nvhe/hyp-init.S+1−0
@@ -57,6 +57,7 @@ __do_hyp_init: · 56 unmodified lines
5757 cmp x0, #HVC_STUB_HCALL_NR
5858 b.lo __kvm_handle_stub_hvc
5959
60+ bic x0, x0, #ARM_SMCCC_CALL_HINTS
6061 mov x3, #KVM_HOST_SMCCC_FUNC(__kvm_hyp_init)
6162 cmp x0, x3
6263 b.eq 1f
arch/arm64/kvm/hyp/nvhe/hyp-main.c+6−2
@@ -368,6 +368,7 @@ static void handle_host_hcall(struct kvm_cpu_context *host_ctxt) · 367 unmodified lines
368368 if (static_branch_unlikely(&kvm_protected_mode_initialized))
369369 hcall_min = __KVM_HOST_SMCCC_FUNC___pkvm_prot_finalize;
370370
371+ id &= ~ARM_SMCCC_CALL_HINTS;
371372 id -= KVM_HOST_SMCCC_ID(0);
372373
373374 if (unlikely(id < hcall_min || id >= ARRAY_SIZE(host_hcall)))
@@ -392,11 +393,14 @@ static void default_host_smc_handler(struct kvm_cpu_context *host_ctxt) · 18 unmodified lines
392393
393394 static void handle_host_smc(struct kvm_cpu_context *host_ctxt)
394395 {
396+ DECLARE_REG(u64, func_id, host_ctxt, 0);
395397 bool handled;
396398
397− handled = kvm_host_psci_handler(host_ctxt);
399+ func_id &= ~ARM_SMCCC_CALL_HINTS;
400+
401+ handled = kvm_host_psci_handler(host_ctxt, func_id);
398402 if (!handled)
399− handled = kvm_host_ffa_handler(host_ctxt);
403+ handled = kvm_host_ffa_handler(host_ctxt, func_id);
400404 if (!handled)
401405 default_host_smc_handler(host_ctxt);
402406
arch/arm64/kvm/hyp/nvhe/psci-relay.c+1−2
@@ -273,9 +273,8 @@ static unsigned long psci_1_0_handler(u64 func_id, struct kvm_cpu_context *host_ · 272 unmodified lines
273273 }
274274 }
275275
276−bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt)
276+bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
277277 {
278− DECLARE_REG(u64, func_id, host_ctxt, 0);
279278 unsigned long ret;
280279
281280 switch (kvm_host_psci_config.version) {
arch/arm64/kvm/mmu.c+3−0
@@ -652,6 +652,9 @@ int hyp_alloc_private_va_range(size_t size, unsigned long *haddr) · 651 unmodified lines
652652
653653 mutex_unlock(&kvm_hyp_pgd_mutex);
654654
655+ if (!ret)
656+ *haddr = base;
657+
655658 return ret;
656659 }
657660
arch/arm64/mm/hugetlbpage.c+7−16
@@ -241,15 +241,8 @@ static void clear_flush(struct mm_struct *mm, · 240 unmodified lines
241241 flush_tlb_range(&vma, saddr, addr);
242242 }
243243
244−static inline struct folio *hugetlb_swap_entry_to_folio(swp_entry_t entry)
245−{
246− VM_BUG_ON(!is_migration_entry(entry) && !is_hwpoison_entry(entry));
247−
248− return page_folio(pfn_to_page(swp_offset_pfn(entry)));
249−}
250−
251244 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
252− pte_t *ptep, pte_t pte)
245+ pte_t *ptep, pte_t pte, unsigned long sz)
253246 {
254247 size_t pgsize;
255248 int i;
@@ -257,13 +250,10 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 1 unmodified line
257250 unsigned long pfn, dpfn;
258251 pgprot_t hugeprot;
259252
260− if (!pte_present(pte)) {
261− struct folio *folio;
262−
263− folio = hugetlb_swap_entry_to_folio(pte_to_swp_entry(pte));
264− ncontig = num_contig_ptes(folio_size(folio), &pgsize);
253+ ncontig = num_contig_ptes(sz, &pgsize);
265254
266− for (i = 0; i < ncontig; i++, ptep++)
255+ if (!pte_present(pte)) {
256+ for (i = 0; i < ncontig; i++, ptep++, addr += pgsize)
267257 set_pte_at(mm, addr, ptep, pte);
268258 return;
269259 }
@@ -273,7 +263,6 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 3 unmodified lines
273263 return;
274264 }
275265
276− ncontig = find_num_contig(mm, addr, ptep, &pgsize);
277266 pfn = pte_pfn(pte);
278267 dpfn = pgsize >> PAGE_SHIFT;
279268 hugeprot = pte_pgprot(pte);
@@ -571,5 +560,7 @@ pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr · 291 unmodified lines
571560 void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep,
572561 pte_t old_pte, pte_t pte)
573562 {
574− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
563+ unsigned long psize = huge_page_size(hstate_vma(vma));
564+
565+ set_huge_pte_at(vma->vm_mm, addr, ptep, pte, psize);
575566 }
arch/arm64/tools/sysreg+5−1
@@ -1347,7 +1347,11 @@ UnsignedEnum 51:48 RPRFM · 1346 unmodified lines
13471347 0b0000 NI
13481348 0b0001 IMP
13491349 EndEnum
1350−Res0 47:28
1350+Res0 47:32
1351+UnsignedEnum 31:28 CLRBHB
1352+ 0b0000 NI
1353+ 0b0001 IMP
1354+EndEnum
13511355 UnsignedEnum 27:24 PAC_frac
13521356 0b0000 NI
13531357 0b0001 IMP
arch/ia64/kernel/acpi.c+4−0
@@ -907,3 +907,7 @@ EXPORT_SYMBOL(acpi_unregister_ioapic); · 906 unmodified lines
907907 * TBD when IA64 starts to support suspend...
908908 */
909909 int acpi_suspend_lowlevel(void) { return 0; }
910+
911+void acpi_proc_quirk_mwait_check(void)
912+{
913+}
arch/loongarch/include/asm/addrspace.h+6−6
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919 */
2020 #ifndef __ASSEMBLY__
2121 #ifndef PHYS_OFFSET
22−#define PHYS_OFFSET _AC(0, UL)
22+#define PHYS_OFFSET _UL(0)
2323 #endif
2424 extern unsigned long vm_map_base;
2525 #endif /* __ASSEMBLY__ */
@@ -43,7 +43,7 @@ extern unsigned long vm_map_base; · 17 unmodified lines
4343 * Memory above this physical address will be considered highmem.
4444 */
4545 #ifndef HIGHMEM_START
46−#define HIGHMEM_START (_AC(1, UL) << _AC(DMW_PABITS, UL))
46+#define HIGHMEM_START (_UL(1) << _UL(DMW_PABITS))
4747 #endif
4848
4949 #define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
@@ -65,16 +65,16 @@ extern unsigned long vm_map_base; · 15 unmodified lines
6565 #define _ATYPE_
6666 #define _ATYPE32_
6767 #define _ATYPE64_
68−#define _CONST64_(x) x
6968 #else
7069 #define _ATYPE_ __PTRDIFF_TYPE__
7170 #define _ATYPE32_ int
7271 #define _ATYPE64_ __s64
72+#endif
73+
7374 #ifdef CONFIG_64BIT
74−#define _CONST64_(x) x ## UL
75+#define _CONST64_(x) _UL(x)
7576 #else
76−#define _CONST64_(x) x ## ULL
77−#endif
77+#define _CONST64_(x) _ULL(x)
7878 #endif
7979
8080 /*
arch/loongarch/include/asm/elf.h+9−0
@@ -111,6 +111,15 @@ · 110 unmodified lines
111111 #define R_LARCH_TLS_GD_HI20 98
112112 #define R_LARCH_32_PCREL 99
113113 #define R_LARCH_RELAX 100
114+#define R_LARCH_DELETE 101
115+#define R_LARCH_ALIGN 102
116+#define R_LARCH_PCREL20_S2 103
117+#define R_LARCH_CFA 104
118+#define R_LARCH_ADD6 105
119+#define R_LARCH_SUB6 106
120+#define R_LARCH_ADD_ULEB128 107
121+#define R_LARCH_SUB_ULEB128 108
122+#define R_LARCH_64_PCREL 109
114123
115124 #ifndef ELF_ARCH
116125
arch/loongarch/include/asm/exception.h+45−0
@@ -0,0 +1,45 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+#ifndef __ASM_EXCEPTION_H
4+#define __ASM_EXCEPTION_H
5+
6+#include <asm/ptrace.h>
7+#include <linux/kprobes.h>
8+
9+void show_registers(struct pt_regs *regs);
10+
11+asmlinkage void cache_parity_error(void);
12+asmlinkage void noinstr do_ade(struct pt_regs *regs);
13+asmlinkage void noinstr do_ale(struct pt_regs *regs);
14+asmlinkage void noinstr do_bce(struct pt_regs *regs);
15+asmlinkage void noinstr do_bp(struct pt_regs *regs);
16+asmlinkage void noinstr do_ri(struct pt_regs *regs);
17+asmlinkage void noinstr do_fpu(struct pt_regs *regs);
18+asmlinkage void noinstr do_fpe(struct pt_regs *regs, unsigned long fcsr);
19+asmlinkage void noinstr do_lsx(struct pt_regs *regs);
20+asmlinkage void noinstr do_lasx(struct pt_regs *regs);
21+asmlinkage void noinstr do_lbt(struct pt_regs *regs);
22+asmlinkage void noinstr do_watch(struct pt_regs *regs);
23+asmlinkage void noinstr do_syscall(struct pt_regs *regs);
24+asmlinkage void noinstr do_reserved(struct pt_regs *regs);
25+asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp);
26+asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
27+ unsigned long write, unsigned long address);
28+
29+asmlinkage void handle_ade(void);
30+asmlinkage void handle_ale(void);
31+asmlinkage void handle_bce(void);
32+asmlinkage void handle_sys(void);
33+asmlinkage void handle_bp(void);
34+asmlinkage void handle_ri(void);
35+asmlinkage void handle_fpu(void);
36+asmlinkage void handle_fpe(void);
37+asmlinkage void handle_lsx(void);
38+asmlinkage void handle_lasx(void);
39+asmlinkage void handle_lbt(void);
40+asmlinkage void handle_watch(void);
41+asmlinkage void handle_reserved(void);
42+asmlinkage void handle_vint(void);
43+asmlinkage void noinstr handle_loongarch_irq(struct pt_regs *regs);
44+
45+#endif /* __ASM_EXCEPTION_H */
arch/loongarch/include/asm/kasan.h+9−50
@@ -10,8 +10,6 @@ · 9 unmodified lines
1010 #include <asm/io.h>
1111 #include <asm/pgtable.h>
1212
13−#define __HAVE_ARCH_SHADOW_MAP
14−
1513 #define KASAN_SHADOW_SCALE_SHIFT 3
1614 #define KASAN_SHADOW_OFFSET _AC(CONFIG_KASAN_SHADOW_OFFSET, UL)
1715
@@ -62,61 +60,22 @@ · 44 unmodified lines
6260 extern bool kasan_early_stage;
6361 extern unsigned char kasan_early_shadow_page[PAGE_SIZE];
6462
63+#define kasan_mem_to_shadow kasan_mem_to_shadow
64+void *kasan_mem_to_shadow(const void *addr);
65+
66+#define kasan_shadow_to_mem kasan_shadow_to_mem
67+const void *kasan_shadow_to_mem(const void *shadow_addr);
68+
6569 #define kasan_arch_is_ready kasan_arch_is_ready
6670 static __always_inline bool kasan_arch_is_ready(void)
6771 {
6872 return !kasan_early_stage;
6973 }
7074
71−static inline void *kasan_mem_to_shadow(const void *addr)
72−{
73− if (!kasan_arch_is_ready()) {
74− return (void *)(kasan_early_shadow_page);
75− } else {
76− unsigned long maddr = (unsigned long)addr;
77− unsigned long xrange = (maddr >> XRANGE_SHIFT) & 0xffff;
78− unsigned long offset = 0;
79−
80− maddr &= XRANGE_SHADOW_MASK;
81− switch (xrange) {
82− case XKPRANGE_CC_SEG:
83− offset = XKPRANGE_CC_SHADOW_OFFSET;
84− break;
85− case XKPRANGE_UC_SEG:
86− offset = XKPRANGE_UC_SHADOW_OFFSET;
87− break;
88− case XKVRANGE_VC_SEG:
89− offset = XKVRANGE_VC_SHADOW_OFFSET;
90− break;
91− default:
92− WARN_ON(1);
93− return NULL;
94− }
95−
96− return (void *)((maddr >> KASAN_SHADOW_SCALE_SHIFT) + offset);
97− }
98−}
99−
100−static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
75+#define addr_has_metadata addr_has_metadata
76+static __always_inline bool addr_has_metadata(const void *addr)
10177 {
102− unsigned long addr = (unsigned long)shadow_addr;
103−
104− if (unlikely(addr > KASAN_SHADOW_END) ||
105− unlikely(addr < KASAN_SHADOW_START)) {
106− WARN_ON(1);
107− return NULL;
108− }
109−
110− if (addr >= XKVRANGE_VC_SHADOW_OFFSET)
111− return (void *)(((addr - XKVRANGE_VC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKVRANGE_VC_START);
112− else if (addr >= XKPRANGE_UC_SHADOW_OFFSET)
113− return (void *)(((addr - XKPRANGE_UC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKPRANGE_UC_START);
114− else if (addr >= XKPRANGE_CC_SHADOW_OFFSET)
115− return (void *)(((addr - XKPRANGE_CC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKPRANGE_CC_START);
116− else {
117− WARN_ON(1);
118− return NULL;
119− }
78+ return (kasan_mem_to_shadow((void *)addr) != NULL);
12079 }
12180
12281 void kasan_init(void);
arch/loongarch/include/asm/smp.h+1−0
@@ -70,6 +70,7 @@ struct secondary_data { · 69 unmodified lines
7070 extern struct secondary_data cpuboot_data;
7171
7272 extern asmlinkage void smpboot_entry(void);
73+extern asmlinkage void start_secondary(void);
7374
7475 extern void calculate_cpu_foreign_map(void);
7576
arch/loongarch/kernel/Makefile+4−0
@@ -19,6 +19,10 @@ obj-$(CONFIG_CPU_HAS_LBT) += lbt.o · 18 unmodified lines
1919
2020 obj-$(CONFIG_ARCH_STRICT_ALIGN) += unaligned.o
2121
22+CFLAGS_module.o += $(call cc-option,-Wno-override-init,)
23+CFLAGS_syscall.o += $(call cc-option,-Wno-override-init,)
24+CFLAGS_perf_event.o += $(call cc-option,-Wno-override-init,)
25+
2226 ifdef CONFIG_FUNCTION_TRACER
2327 ifndef CONFIG_DYNAMIC_FTRACE
2428 obj-y += mcount.o ftrace.o
arch/loongarch/kernel/acpi.c+0−1
@@ -281,7 +281,6 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) · 280 unmodified lines
281281 pr_info("SRAT: PXM %u -> CPU 0x%02x -> Node %u\n", pxm, pa->apic_id, node);
282282 }
283283
284−void __init acpi_numa_arch_fixup(void) {}
285284 #endif
286285
287286 void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
arch/loongarch/kernel/mem.c+3−1
@@ -50,7 +50,6 @@ void __init memblock_init(void) · 49 unmodified lines
5050 }
5151
5252 memblock_set_current_limit(PFN_PHYS(max_low_pfn));
53− memblock_set_node(0, PHYS_ADDR_MAX, &memblock.memory, 0);
5453
5554 /* Reserve the first 2MB */
5655 memblock_reserve(PHYS_OFFSET, 0x200000);
@@ -58,4 +57,7 @@ void __init memblock_init(void) · 1 unmodified line
5857 /* Reserve the kernel text/data/bss */
5958 memblock_reserve(__pa_symbol(&_text),
6059 __pa_symbol(&_end) - __pa_symbol(&_text));
60+
61+ memblock_set_node(0, PHYS_ADDR_MAX, &memblock.memory, 0);
62+ memblock_set_node(0, PHYS_ADDR_MAX, &memblock.reserved, 0);
6163 }
arch/loongarch/kernel/module-sections.c+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/elf.h>
77 #include <linux/kernel.h>
88 #include <linux/module.h>
9+#include <linux/moduleloader.h>
910 #include <linux/ftrace.h>
1011
1112 Elf_Addr module_emit_got_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr val)
arch/loongarch/kernel/module.c+21−1
@@ -367,6 +367,24 @@ static int apply_r_larch_got_pc(struct module *mod, · 366 unmodified lines
367367 return apply_r_larch_pcala(mod, location, got, rela_stack, rela_stack_top, type);
368368 }
369369
370+static int apply_r_larch_32_pcrel(struct module *mod, u32 *location, Elf_Addr v,
371+ s64 *rela_stack, size_t *rela_stack_top, unsigned int type)
372+{
373+ ptrdiff_t offset = (void *)v - (void *)location;
374+
375+ *(u32 *)location = offset;
376+ return 0;
377+}
378+
379+static int apply_r_larch_64_pcrel(struct module *mod, u32 *location, Elf_Addr v,
380+ s64 *rela_stack, size_t *rela_stack_top, unsigned int type)
381+{
382+ ptrdiff_t offset = (void *)v - (void *)location;
383+
384+ *(u64 *)location = offset;
385+ return 0;
386+}
387+
370388 /*
371389 * reloc_handlers_rela() - Apply a particular relocation to a module
372390 * @mod: the module to apply the reloc to
@@ -382,7 +400,7 @@ typedef int (*reloc_rela_handler)(struct module *mod, u32 *location, Elf_Addr v, · 9 unmodified lines
382400
383401 /* The handlers for known reloc types */
384402 static reloc_rela_handler reloc_rela_handlers[] = {
385− [R_LARCH_NONE ... R_LARCH_RELAX] = apply_r_larch_error,
403+ [R_LARCH_NONE ... R_LARCH_64_PCREL] = apply_r_larch_error,
386404
387405 [R_LARCH_NONE] = apply_r_larch_none,
388406 [R_LARCH_32] = apply_r_larch_32,
@@ -396,6 +414,8 @@ static reloc_rela_handler reloc_rela_handlers[] = { · 7 unmodified lines
396414 [R_LARCH_SOP_POP_32_S_10_5 ... R_LARCH_SOP_POP_32_U] = apply_r_larch_sop_imm_field,
397415 [R_LARCH_ADD32 ... R_LARCH_SUB64] = apply_r_larch_add_sub,
398416 [R_LARCH_PCALA_HI20...R_LARCH_PCALA64_HI12] = apply_r_larch_pcala,
417+ [R_LARCH_32_PCREL] = apply_r_larch_32_pcrel,
418+ [R_LARCH_64_PCREL] = apply_r_larch_64_pcrel,
399419 };
400420
401421 int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
arch/loongarch/kernel/numa.c+1−1
@@ -436,7 +436,7 @@ void __init paging_init(void) · 435 unmodified lines
436436
437437 void __init mem_init(void)
438438 {
439− high_memory = (void *) __va(get_num_physpages() << PAGE_SHIFT);
439+ high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
440440 memblock_free_all();
441441 }
442442
arch/loongarch/kernel/process.c+1−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #include <asm/bootinfo.h>
3838 #include <asm/cpu.h>
3939 #include <asm/elf.h>
40+#include <asm/exec.h>
4041 #include <asm/fpu.h>
4142 #include <asm/lbt.h>
4243 #include <asm/io.h>
arch/loongarch/kernel/relocate_kernel.S+0−1
@@ -72,7 +72,6 @@ copy_word: · 71 unmodified lines
7272 LONG_ADDI s5, s5, -1
7373 beqz s5, process_entry
7474 b copy_word
75− b process_entry
7675
7776 done:
7877 ibar 0
arch/loongarch/kernel/signal.c+4−3
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/audit.h>
1414 #include <linux/cache.h>
1515 #include <linux/context_tracking.h>
16+#include <linux/entry-common.h>
1617 #include <linux/irqflags.h>
1718 #include <linux/sched.h>
1819 #include <linux/mm.h>
@@ -891,8 +892,8 @@ static unsigned long setup_extcontext(struct extctx_layout *extctx, unsigned lon · 872 unmodified lines
891892 return new_sp;
892893 }
893894
894−void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
895− struct extctx_layout *extctx)
895+static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
896+ struct extctx_layout *extctx)
896897 {
897898 unsigned long sp;
898899
@@ -922,7 +923,7 @@ void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, · 23 unmodified lines
922923 * Atomically swap in the new signal mask, and wait for a signal.
923924 */
924925
925−asmlinkage long sys_rt_sigreturn(void)
926+SYSCALL_DEFINE0(rt_sigreturn)
926927 {
927928 int sig;
928929 sigset_t set;
arch/loongarch/kernel/smp.c+3−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/cpumask.h>
1414 #include <linux/init.h>
1515 #include <linux/interrupt.h>
16+#include <linux/profile.h>
1617 #include <linux/seq_file.h>
1718 #include <linux/smp.h>
1819 #include <linux/threads.h>
@@ -556,10 +557,12 @@ void smp_send_stop(void) · 537 unmodified lines
556557 smp_call_function(stop_this_cpu, NULL, 0);
557558 }
558559
560+#ifdef CONFIG_PROFILING
559561 int setup_profiling_timer(unsigned int multiplier)
560562 {
561563 return 0;
562564 }
565+#endif
563566
564567 static void flush_tlb_all_ipi(void *info)
565568 {
arch/loongarch/kernel/syscall.c+1−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/unistd.h>
1414
1515 #include <asm/asm.h>
16+#include <asm/exception.h>
1617 #include <asm/signal.h>
1718 #include <asm/switch_to.h>
1819 #include <asm-generic/syscalls.h>
arch/loongarch/kernel/time.c+1−1
@@ -29,7 +29,7 @@ static void constant_event_handler(struct clock_event_device *dev) · 28 unmodified lines
2929 {
3030 }
3131
32−irqreturn_t constant_timer_interrupt(int irq, void *data)
32+static irqreturn_t constant_timer_interrupt(int irq, void *data)
3333 {
3434 int cpu = smp_processor_id();
3535 struct clock_event_device *cd;
arch/loongarch/kernel/topology.c+3−0
@@ -1,4 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2+#include <linux/acpi.h>
23 #include <linux/cpu.h>
34 #include <linux/cpumask.h>
45 #include <linux/init.h>
@@ -7,6 +8,8 @@ · 2 unmodified lines
78 #include <linux/percpu.h>
89 #include <asm/bootinfo.h>
910
11+#include <acpi/processor.h>
12+
1013 static DEFINE_PER_CPU(struct cpu, cpu_devices);
1114
1215 #ifdef CONFIG_HOTPLUG_CPU
arch/loongarch/kernel/traps.c+5−20
@@ -25,7 +25,6 @@ · 24 unmodified lines
2525 #include <linux/ptrace.h>
2626 #include <linux/kgdb.h>
2727 #include <linux/kdebug.h>
28−#include <linux/kprobes.h>
2928 #include <linux/notifier.h>
3029 #include <linux/irq.h>
3130 #include <linux/perf_event.h>
@@ -35,6 +34,7 @@ · 3 unmodified lines
3534 #include <asm/branch.h>
3635 #include <asm/break.h>
3736 #include <asm/cpu.h>
37+#include <asm/exception.h>
3838 #include <asm/fpu.h>
3939 #include <asm/lbt.h>
4040 #include <asm/inst.h>
@@ -53,21 +53,6 @@ · 12 unmodified lines
5353
5454 #include "access-helper.h"
5555
56−extern asmlinkage void handle_ade(void);
57−extern asmlinkage void handle_ale(void);
58−extern asmlinkage void handle_bce(void);
59−extern asmlinkage void handle_sys(void);
60−extern asmlinkage void handle_bp(void);
61−extern asmlinkage void handle_ri(void);
62−extern asmlinkage void handle_fpu(void);
63−extern asmlinkage void handle_fpe(void);
64−extern asmlinkage void handle_lbt(void);
65−extern asmlinkage void handle_lsx(void);
66−extern asmlinkage void handle_lasx(void);
67−extern asmlinkage void handle_reserved(void);
68−extern asmlinkage void handle_watch(void);
69−extern asmlinkage void handle_vint(void);
70−
7156 static void show_backtrace(struct task_struct *task, const struct pt_regs *regs,
7257 const char *loglvl, bool user)
7358 {
@@ -439,8 +424,8 @@ static inline void setup_vint_size(unsigned int size) · 365 unmodified lines
439424 * happen together with Overflow or Underflow, and `ptrace' can set
440425 * any bits.
441426 */
442−void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr,
443− struct task_struct *tsk)
427+static void force_fcsr_sig(unsigned long fcsr,
428+ void __user *fault_addr, struct task_struct *tsk)
444429 {
445430 int si_code = FPE_FLTUNK;
446431
@@ -458,7 +443,7 @@ void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr, · 11 unmodified lines
458443 force_sig_fault(SIGFPE, si_code, fault_addr);
459444 }
460445
461−int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcsr)
446+static int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcsr)
462447 {
463448 int si_code;
464449
@@ -824,7 +809,7 @@ out: · 359 unmodified lines
824809 asmlinkage void noinstr do_ri(struct pt_regs *regs)
825810 {
826811 int status = SIGILL;
827− unsigned int opcode = 0;
812+ unsigned int __maybe_unused opcode;
828813 unsigned int __user *era = (unsigned int __user *)exception_era(regs);
829814 irqentry_state_t state = irqentry_enter(regs);
830815
arch/loongarch/kernel/vmlinux.lds.S+28−27
@@ -53,33 +53,6 @@ SECTIONS · 52 unmodified lines
5353 . = ALIGN(PECOFF_SEGMENT_ALIGN);
5454 _etext = .;
5555
56− /*
57− * struct alt_inst entries. From the header (alternative.h):
58− * "Alternative instructions for different CPU types or capabilities"
59− * Think locking instructions on spinlocks.
60− */
61− . = ALIGN(4);
62− .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
63− __alt_instructions = .;
64− *(.altinstructions)
65− __alt_instructions_end = .;
66− }
67−
68−#ifdef CONFIG_RELOCATABLE
69− . = ALIGN(8);
70− .la_abs : AT(ADDR(.la_abs) - LOAD_OFFSET) {
71− __la_abs_begin = .;
72− *(.la_abs)
73− __la_abs_end = .;
74− }
75−#endif
76−
77− .got : ALIGN(16) { *(.got) }
78− .plt : ALIGN(16) { *(.plt) }
79− .got.plt : ALIGN(16) { *(.got.plt) }
80−
81− .data.rel : { *(.data.rel*) }
82−
8356 . = ALIGN(PECOFF_SEGMENT_ALIGN);
8457 __init_begin = .;
8558 __inittext_begin = .;
@@ -94,6 +67,18 @@ SECTIONS · 8 unmodified lines
9467
9568 __initdata_begin = .;
9669
70+ /*
71+ * struct alt_inst entries. From the header (alternative.h):
72+ * "Alternative instructions for different CPU types or capabilities"
73+ * Think locking instructions on spinlocks.
74+ */
75+ . = ALIGN(4);
76+ .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
77+ __alt_instructions = .;
78+ *(.altinstructions)
79+ __alt_instructions_end = .;
80+ }
81+
9782 INIT_DATA_SECTION(16)
9883 .exit.data : {
9984 EXIT_DATA
@@ -113,6 +98,11 @@ SECTIONS · 13 unmodified lines
11398
11499 _sdata = .;
115100 RO_DATA(4096)
101+
102+ .got : ALIGN(16) { *(.got) }
103+ .plt : ALIGN(16) { *(.plt) }
104+ .got.plt : ALIGN(16) { *(.got.plt) }
105+
116106 RW_DATA(1 << CONFIG_L1_CACHE_SHIFT, PAGE_SIZE, THREAD_SIZE)
117107
118108 .rela.dyn : ALIGN(8) {
@@ -121,6 +111,17 @@ SECTIONS · 2 unmodified lines
121111 __rela_dyn_end = .;
122112 }
123113
114+ .data.rel : { *(.data.rel*) }
115+
116+#ifdef CONFIG_RELOCATABLE
117+ . = ALIGN(8);
118+ .la_abs : AT(ADDR(.la_abs) - LOAD_OFFSET) {
119+ __la_abs_begin = .;
120+ *(.la_abs)
121+ __la_abs_end = .;
122+ }
123+#endif
124+
124125 .sdata : {
125126 *(.sdata)
126127 }
arch/loongarch/mm/fault.c+1−1
@@ -20,12 +20,12 @@ · 19 unmodified lines
2020 #include <linux/mm.h>
2121 #include <linux/smp.h>
2222 #include <linux/kdebug.h>
23−#include <linux/kprobes.h>
2423 #include <linux/perf_event.h>
2524 #include <linux/uaccess.h>
2625 #include <linux/kfence.h>
2726
2827 #include <asm/branch.h>
28+#include <asm/exception.h>
2929 #include <asm/mmu_context.h>
3030 #include <asm/ptrace.h>
3131
arch/loongarch/mm/hugetlbpage.c+0−12
@@ -50,18 +50,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, · 49 unmodified lines
5050 return (pte_t *) pmd;
5151 }
5252
53−/*
54− * This function checks for proper alignment of input addr and len parameters.
55− */
56−int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
57−{
58− if (len & ~HPAGE_MASK)
59− return -EINVAL;
60− if (addr & ~HPAGE_MASK)
61− return -EINVAL;
62− return 0;
63−}
64−
6553 int pmd_huge(pmd_t pmd)
6654 {
6755 return (pmd_val(pmd) & _PAGE_HUGE) != 0;
arch/loongarch/mm/ioremap.c+1−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 */
55
66 #include <asm/io.h>
7+#include <asm-generic/early_ioremap.h>
78
89 void __init __iomem *early_ioremap(u64 phys_addr, unsigned long size)
910 {
arch/loongarch/mm/kasan_init.c+51−0
@@ -35,6 +35,57 @@ static pgd_t kasan_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); · 34 unmodified lines
3535
3636 bool kasan_early_stage = true;
3737
38+void *kasan_mem_to_shadow(const void *addr)
39+{
40+ if (!kasan_arch_is_ready()) {
41+ return (void *)(kasan_early_shadow_page);
42+ } else {
43+ unsigned long maddr = (unsigned long)addr;
44+ unsigned long xrange = (maddr >> XRANGE_SHIFT) & 0xffff;
45+ unsigned long offset = 0;
46+
47+ maddr &= XRANGE_SHADOW_MASK;
48+ switch (xrange) {
49+ case XKPRANGE_CC_SEG:
50+ offset = XKPRANGE_CC_SHADOW_OFFSET;
51+ break;
52+ case XKPRANGE_UC_SEG:
53+ offset = XKPRANGE_UC_SHADOW_OFFSET;
54+ break;
55+ case XKVRANGE_VC_SEG:
56+ offset = XKVRANGE_VC_SHADOW_OFFSET;
57+ break;
58+ default:
59+ WARN_ON(1);
60+ return NULL;
61+ }
62+
63+ return (void *)((maddr >> KASAN_SHADOW_SCALE_SHIFT) + offset);
64+ }
65+}
66+
67+const void *kasan_shadow_to_mem(const void *shadow_addr)
68+{
69+ unsigned long addr = (unsigned long)shadow_addr;
70+
71+ if (unlikely(addr > KASAN_SHADOW_END) ||
72+ unlikely(addr < KASAN_SHADOW_START)) {
73+ WARN_ON(1);
74+ return NULL;
75+ }
76+
77+ if (addr >= XKVRANGE_VC_SHADOW_OFFSET)
78+ return (void *)(((addr - XKVRANGE_VC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKVRANGE_VC_START);
79+ else if (addr >= XKPRANGE_UC_SHADOW_OFFSET)
80+ return (void *)(((addr - XKPRANGE_UC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKPRANGE_UC_START);
81+ else if (addr >= XKPRANGE_CC_SHADOW_OFFSET)
82+ return (void *)(((addr - XKPRANGE_CC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKPRANGE_CC_START);
83+ else {
84+ WARN_ON(1);
85+ return NULL;
86+ }
87+}
88+
3889 /*
3990 * Alloc memory for shadow memory page table.
4091 */
arch/loongarch/mm/tlb.c+1−1
@@ -261,7 +261,7 @@ unsigned long pcpu_handlers[NR_CPUS]; · 260 unmodified lines
261261 #endif
262262 extern long exception_handlers[VECSIZE * 128 / sizeof(long)];
263263
264−void setup_tlb_handler(int cpu)
264+static void setup_tlb_handler(int cpu)
265265 {
266266 setup_ptwalker();
267267 local_flush_tlb_all();
arch/mips/alchemy/devboards/db1000.c+4−0
@@ -164,6 +164,7 @@ static struct platform_device db1x00_audio_dev = { · 163 unmodified lines
164164
165165 /******************************************************************************/
166166
167+#ifdef CONFIG_MMC_AU1X
167168 static irqreturn_t db1100_mmc_cd(int irq, void *ptr)
168169 {
169170 mmc_detect_change(ptr, msecs_to_jiffies(500));
@@ -369,6 +370,7 @@ static struct platform_device db1100_mmc1_dev = { · 199 unmodified lines
369370 .num_resources = ARRAY_SIZE(au1100_mmc1_res),
370371 .resource = au1100_mmc1_res,
371372 };
373+#endif /* CONFIG_MMC_AU1X */
372374
373375 /******************************************************************************/
374376
@@ -440,8 +442,10 @@ static struct platform_device *db1x00_devs[] = { · 65 unmodified lines
440442
441443 static struct platform_device *db1100_devs[] = {
442444 &au1100_lcd_device,
445+#ifdef CONFIG_MMC_AU1X
443446 &db1100_mmc0_dev,
444447 &db1100_mmc1_dev,
448+#endif
445449 };
446450
447451 int __init db1000_dev_setup(void)
arch/mips/alchemy/devboards/db1200.c+6−0
@@ -326,6 +326,7 @@ static struct platform_device db1200_ide_dev = { · 325 unmodified lines
326326
327327 /**********************************************************************/
328328
329+#ifdef CONFIG_MMC_AU1X
329330 /* SD carddetects: they're supposed to be edge-triggered, but ack
330331 * doesn't seem to work (CPLD Rev 2). Instead, the screaming one
331332 * is disabled and its counterpart enabled. The 200ms timeout is
@@ -584,6 +585,7 @@ static struct platform_device pb1200_mmc1_dev = { · 252 unmodified lines
584585 .num_resources = ARRAY_SIZE(au1200_mmc1_res),
585586 .resource = au1200_mmc1_res,
586587 };
588+#endif /* CONFIG_MMC_AU1X */
587589
588590 /**********************************************************************/
589591
@@ -751,7 +753,9 @@ static struct platform_device db1200_audiodma_dev = { · 161 unmodified lines
751753 static struct platform_device *db1200_devs[] __initdata = {
752754 NULL, /* PSC0, selected by S6.8 */
753755 &db1200_ide_dev,
756+#ifdef CONFIG_MMC_AU1X
754757 &db1200_mmc0_dev,
758+#endif
755759 &au1200_lcd_dev,
756760 &db1200_eth_dev,
757761 &db1200_nand_dev,
@@ -762,7 +766,9 @@ static struct platform_device *db1200_devs[] __initdata = { · 4 unmodified lines
762766 };
763767
764768 static struct platform_device *pb1200_devs[] __initdata = {
769+#ifdef CONFIG_MMC_AU1X
765770 &pb1200_mmc1_dev,
771+#endif
766772 };
767773
768774 /* Some peripheral base addresses differ on the PB1200 */
arch/mips/alchemy/devboards/db1300.c+4−0
@@ -450,6 +450,7 @@ static struct platform_device db1300_ide_dev = { · 449 unmodified lines
450450
451451 /**********************************************************************/
452452
453+#ifdef CONFIG_MMC_AU1X
453454 static irqreturn_t db1300_mmc_cd(int irq, void *ptr)
454455 {
455456 disable_irq_nosync(irq);
@@ -632,6 +633,7 @@ static struct platform_device db1300_sd0_dev = { · 176 unmodified lines
632633 .resource = au1300_sd0_res,
633634 .num_resources = ARRAY_SIZE(au1300_sd0_res),
634635 };
636+#endif /* CONFIG_MMC_AU1X */
635637
636638 /**********************************************************************/
637639
@@ -767,8 +769,10 @@ static struct platform_device *db1300_dev[] __initdata = { · 129 unmodified lines
767769 &db1300_5waysw_dev,
768770 &db1300_nand_dev,
769771 &db1300_ide_dev,
772+#ifdef CONFIG_MMC_AU1X
770773 &db1300_sd0_dev,
771774 &db1300_sd1_dev,
775+#endif
772776 &db1300_lcd_dev,
773777 &db1300_ac97_dev,
774778 &db1300_i2s_dev,
arch/parisc/include/asm/hugetlb.h+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66
77 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
88 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
9− pte_t *ptep, pte_t pte);
9+ pte_t *ptep, pte_t pte, unsigned long sz);
1010
1111 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
1212 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
arch/parisc/mm/hugetlbpage.c+1−1
@@ -140,7 +140,7 @@ static void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 139 unmodified lines
140140 }
141141
142142 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
143− pte_t *ptep, pte_t entry)
143+ pte_t *ptep, pte_t entry, unsigned long sz)
144144 {
145145 __set_huge_pte_at(mm, addr, ptep, entry);
146146 }
arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h+2−1
@@ -46,7 +46,8 @@ static inline int check_and_get_huge_psize(int shift) · 45 unmodified lines
4646 }
4747
4848 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
49−void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte);
49+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
50+ pte_t pte, unsigned long sz);
5051
5152 #define __HAVE_ARCH_HUGE_PTE_CLEAR
5253 static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
arch/powerpc/kernel/stacktrace.c+5−22
@@ -73,29 +73,12 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum · 72 unmodified lines
7373 bool firstframe;
7474
7575 stack_end = stack_page + THREAD_SIZE;
76− if (!is_idle_task(task)) {
77− /*
78− * For user tasks, this is the SP value loaded on
79− * kernel entry, see "PACAKSAVE(r13)" in _switch() and
80− * system_call_common().
81− *
82− * Likewise for non-swapper kernel threads,
83− * this also happens to be the top of the stack
84− * as setup by copy_thread().
85− *
86− * Note that stack backlinks are not properly setup by
87− * copy_thread() and thus, a forked task() will have
88− * an unreliable stack trace until it's been
89− * _switch()'ed to for the first time.
90− */
91− stack_end -= STACK_USER_INT_FRAME_SIZE;
92− } else {
93− /*
94− * idle tasks have a custom stack layout,
95− * c.f. cpu_idle_thread_init().
96− */
76+
77+ // See copy_thread() for details.
78+ if (task->flags & PF_KTHREAD)
9779 stack_end -= STACK_FRAME_MIN_SIZE;
98− }
80+ else
81+ stack_end -= STACK_USER_INT_FRAME_SIZE;
9982
10083 if (task == current)
10184 sp = current_stack_frame();
arch/powerpc/mm/book3s64/hugetlbpage.c+4−1
@@ -143,11 +143,14 @@ pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, · 142 unmodified lines
143143 void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
144144 pte_t *ptep, pte_t old_pte, pte_t pte)
145145 {
146+ unsigned long psize;
146147
147148 if (radix_enabled())
148149 return radix__huge_ptep_modify_prot_commit(vma, addr, ptep,
149150 old_pte, pte);
150− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
151+
152+ psize = huge_page_size(hstate_vma(vma));
153+ set_huge_pte_at(vma->vm_mm, addr, ptep, pte, psize);
151154 }
152155
153156 void __init hugetlbpage_init_defaultsize(void)
arch/powerpc/mm/book3s64/radix_hugetlbpage.c+2−1
@@ -47,6 +47,7 @@ void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, · 46 unmodified lines
4747 pte_t old_pte, pte_t pte)
4848 {
4949 struct mm_struct *mm = vma->vm_mm;
50+ unsigned long psize = huge_page_size(hstate_vma(vma));
5051
5152 /*
5253 * POWER9 NMMU must flush the TLB after clearing the PTE before
@@ -58,5 +59,5 @@ void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, · 5 unmodified lines
5859 atomic_read(&mm->context.copros) > 0)
5960 radix__flush_hugetlb_page(vma, addr);
6061
61− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
62+ set_huge_pte_at(vma->vm_mm, addr, ptep, pte, psize);
6263 }
arch/powerpc/mm/nohash/8xx.c+2−1
@@ -91,7 +91,8 @@ static int __ref __early_map_kernel_hugepage(unsigned long va, phys_addr_t pa, · 90 unmodified lines
9191 if (new && WARN_ON(pte_present(*ptep) && pgprot_val(prot)))
9292 return -EINVAL;
9393
94− set_huge_pte_at(&init_mm, va, ptep, pte_mkhuge(pfn_pte(pa >> PAGE_SHIFT, prot)));
94+ set_huge_pte_at(&init_mm, va, ptep,
95+ pte_mkhuge(pfn_pte(pa >> PAGE_SHIFT, prot)), psize);
9596
9697 return 0;
9798 }
arch/powerpc/mm/pgtable.c+2−1
@@ -288,7 +288,8 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma, · 287 unmodified lines
288288 }
289289
290290 #if defined(CONFIG_PPC_8xx)
291−void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte)
291+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
292+ pte_t pte, unsigned long sz)
292293 {
293294 pmd_t *pmd = pmd_off(mm, addr);
294295 pte_basic_t val;
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi+26−25
@@ -262,7 +262,7 @@ · 261 unmodified lines
262262 reg = <0x100000 0x400000>;
263263 };
264264 reserved-data@600000 {
265− reg = <0x600000 0x1000000>;
265+ reg = <0x600000 0xa00000>;
266266 };
267267 };
268268 };
@@ -440,30 +440,6 @@ · 171 unmodified lines
440440 };
441441 };
442442
443− uart0_pins: uart0-0 {
444− tx-pins {
445− pinmux = <GPIOMUX(5, GPOUT_SYS_UART0_TX,
446− GPOEN_ENABLE,
447− GPI_NONE)>;
448− bias-disable;
449− drive-strength = <12>;
450− input-disable;
451− input-schmitt-disable;
452− slew-rate = <0>;
453− };
454−
455− rx-pins {
456− pinmux = <GPIOMUX(6, GPOUT_LOW,
457− GPOEN_DISABLE,
458− GPI_SYS_UART0_RX)>;
459− bias-disable; /* external pull-up */
460− drive-strength = <2>;
461− input-enable;
462− input-schmitt-enable;
463− slew-rate = <0>;
464− };
465− };
466−
467443 tdm_pins: tdm-0 {
468444 tx-pins {
469445 pinmux = <GPIOMUX(44, GPOUT_SYS_TDM_TXD,
@@ -497,6 +473,30 @@ · 27 unmodified lines
497473 input-enable;
498474 };
499475 };
476+
477+ uart0_pins: uart0-0 {
478+ tx-pins {
479+ pinmux = <GPIOMUX(5, GPOUT_SYS_UART0_TX,
480+ GPOEN_ENABLE,
481+ GPI_NONE)>;
482+ bias-disable;
483+ drive-strength = <12>;
484+ input-disable;
485+ input-schmitt-disable;
486+ slew-rate = <0>;
487+ };
488+
489+ rx-pins {
490+ pinmux = <GPIOMUX(6, GPOUT_LOW,
491+ GPOEN_DISABLE,
492+ GPI_SYS_UART0_RX)>;
493+ bias-disable; /* external pull-up */
494+ drive-strength = <2>;
495+ input-enable;
496+ input-schmitt-enable;
497+ slew-rate = <0>;
498+ };
499+ };
500500 };
501501
502502 &tdm {
@@ -513,6 +513,7 @@ · 10 unmodified lines
513513
514514 &usb0 {
515515 dr_mode = "peripheral";
516+ status = "okay";
516517 };
517518
518519 &U74_1 {
arch/riscv/include/asm/hugetlb.h+2−1
@@ -18,7 +18,8 @@ void huge_pte_clear(struct mm_struct *mm, unsigned long addr, · 17 unmodified lines
1818
1919 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
2020 void set_huge_pte_at(struct mm_struct *mm,
21− unsigned long addr, pte_t *ptep, pte_t pte);
21+ unsigned long addr, pte_t *ptep, pte_t pte,
22+ unsigned long sz);
2223
2324 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
2425 pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
arch/riscv/kvm/vcpu_onereg.c+5−2
@@ -460,8 +460,11 @@ static int riscv_vcpu_get_isa_ext_single(struct kvm_vcpu *vcpu, · 459 unmodified lines
460460 reg_num >= ARRAY_SIZE(kvm_isa_ext_arr))
461461 return -ENOENT;
462462
463− *reg_val = 0;
464463 host_isa_ext = kvm_isa_ext_arr[reg_num];
464+ if (!__riscv_isa_extension_available(NULL, host_isa_ext))
465+ return -ENOENT;
466+
467+ *reg_val = 0;
465468 if (__riscv_isa_extension_available(vcpu->arch.isa, host_isa_ext))
466469 *reg_val = 1; /* Mark the given extension as available */
467470
@@ -842,7 +845,7 @@ static int copy_isa_ext_reg_indices(const struct kvm_vcpu *vcpu, · 374 unmodified lines
842845 u64 reg = KVM_REG_RISCV | size | KVM_REG_RISCV_ISA_EXT | i;
843846
844847 isa_ext = kvm_isa_ext_arr[i];
845− if (!__riscv_isa_extension_available(vcpu->arch.isa, isa_ext))
848+ if (!__riscv_isa_extension_available(NULL, isa_ext))
846849 continue;
847850
848851 if (uindices) {
arch/riscv/mm/hugetlbpage.c+2−1
@@ -180,7 +180,8 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags) · 179 unmodified lines
180180 void set_huge_pte_at(struct mm_struct *mm,
181181 unsigned long addr,
182182 pte_t *ptep,
183− pte_t pte)
183+ pte_t pte,
184+ unsigned long sz)
184185 {
185186 int i, pte_num;
186187
arch/s390/configs/debug_defconfig+10−4
@@ -40,23 +40,25 @@ CONFIG_SCHED_AUTOGROUP=y · 39 unmodified lines
4040 CONFIG_EXPERT=y
4141 # CONFIG_SYSFS_SYSCALL is not set
4242 CONFIG_PROFILING=y
43+CONFIG_KEXEC_FILE=y
44+CONFIG_KEXEC_SIG=y
45+CONFIG_CRASH_DUMP=y
4346 CONFIG_LIVEPATCH=y
4447 CONFIG_MARCH_ZEC12=y
4548 CONFIG_TUNE_ZEC12=y
4649 CONFIG_NR_CPUS=512
4750 CONFIG_NUMA=y
4851 CONFIG_HZ_100=y
49−CONFIG_KEXEC_FILE=y
50−CONFIG_KEXEC_SIG=y
52+CONFIG_CERT_STORE=y
5153 CONFIG_EXPOLINE=y
5254 CONFIG_EXPOLINE_AUTO=y
5355 CONFIG_CHSC_SCH=y
5456 CONFIG_VFIO_CCW=m
5557 CONFIG_VFIO_AP=m
56−CONFIG_CRASH_DUMP=y
5758 CONFIG_PROTECTED_VIRTUALIZATION_GUEST=y
5859 CONFIG_CMM=m
5960 CONFIG_APPLDATA_BASE=y
61+CONFIG_S390_HYPFS_FS=y
6062 CONFIG_KVM=m
6163 CONFIG_S390_UNWIND_SELFTEST=m
6264 CONFIG_S390_KPROBES_SANITY_TEST=m
@@ -434,6 +436,7 @@ CONFIG_SCSI_DH_EMC=m · 371 unmodified lines
434436 CONFIG_SCSI_DH_ALUA=m
435437 CONFIG_MD=y
436438 CONFIG_BLK_DEV_MD=y
439+# CONFIG_MD_BITMAP_FILE is not set
437440 CONFIG_MD_LINEAR=m
438441 CONFIG_MD_MULTIPATH=m
439442 CONFIG_MD_FAULTY=m
@@ -577,6 +580,7 @@ CONFIG_SOFT_WATCHDOG=m · 137 unmodified lines
577580 CONFIG_DIAG288_WATCHDOG=m
578581 # CONFIG_DRM_DEBUG_MODESET_LOCK is not set
579582 CONFIG_FB=y
583+# CONFIG_FB_DEVICE is not set
580584 CONFIG_FRAMEBUFFER_CONSOLE=y
581585 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
582586 # CONFIG_HID_SUPPORT is not set
@@ -647,6 +651,7 @@ CONFIG_PROC_KCORE=y · 64 unmodified lines
647651 CONFIG_TMPFS=y
648652 CONFIG_TMPFS_POSIX_ACL=y
649653 CONFIG_TMPFS_INODE64=y
654+CONFIG_TMPFS_QUOTA=y
650655 CONFIG_HUGETLBFS=y
651656 CONFIG_ECRYPT_FS=m
652657 CONFIG_CRAMFS=m
@@ -703,6 +708,7 @@ CONFIG_IMA_WRITE_POLICY=y · 50 unmodified lines
703708 CONFIG_IMA_APPRAISE=y
704709 CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"
705710 CONFIG_INIT_STACK_NONE=y
711+CONFIG_BUG_ON_DATA_CORRUPTION=y
706712 CONFIG_CRYPTO_USER=m
707713 # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
708714 CONFIG_CRYPTO_PCRYPT=m
@@ -825,9 +831,9 @@ CONFIG_LOCK_STAT=y · 116 unmodified lines
825831 CONFIG_DEBUG_ATOMIC_SLEEP=y
826832 CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
827833 CONFIG_DEBUG_IRQFLAGS=y
834+CONFIG_DEBUG_LIST=y
828835 CONFIG_DEBUG_SG=y
829836 CONFIG_DEBUG_NOTIFIERS=y
830−CONFIG_BUG_ON_DATA_CORRUPTION=y
831837 CONFIG_DEBUG_CREDENTIALS=y
832838 CONFIG_RCU_TORTURE_TEST=m
833839 CONFIG_RCU_REF_SCALE_TEST=m
arch/s390/configs/defconfig+9−4
@@ -38,23 +38,25 @@ CONFIG_SCHED_AUTOGROUP=y · 37 unmodified lines
3838 CONFIG_EXPERT=y
3939 # CONFIG_SYSFS_SYSCALL is not set
4040 CONFIG_PROFILING=y
41+CONFIG_KEXEC_FILE=y
42+CONFIG_KEXEC_SIG=y
43+CONFIG_CRASH_DUMP=y
4144 CONFIG_LIVEPATCH=y
4245 CONFIG_MARCH_ZEC12=y
4346 CONFIG_TUNE_ZEC12=y
4447 CONFIG_NR_CPUS=512
4548 CONFIG_NUMA=y
4649 CONFIG_HZ_100=y
47−CONFIG_KEXEC_FILE=y
48−CONFIG_KEXEC_SIG=y
50+CONFIG_CERT_STORE=y
4951 CONFIG_EXPOLINE=y
5052 CONFIG_EXPOLINE_AUTO=y
5153 CONFIG_CHSC_SCH=y
5254 CONFIG_VFIO_CCW=m
5355 CONFIG_VFIO_AP=m
54−CONFIG_CRASH_DUMP=y
5556 CONFIG_PROTECTED_VIRTUALIZATION_GUEST=y
5657 CONFIG_CMM=m
5758 CONFIG_APPLDATA_BASE=y
59+CONFIG_S390_HYPFS_FS=y
5860 CONFIG_KVM=m
5961 CONFIG_S390_UNWIND_SELFTEST=m
6062 CONFIG_S390_KPROBES_SANITY_TEST=m
@@ -424,6 +426,7 @@ CONFIG_SCSI_DH_EMC=m · 363 unmodified lines
424426 CONFIG_SCSI_DH_ALUA=m
425427 CONFIG_MD=y
426428 CONFIG_BLK_DEV_MD=y
429+# CONFIG_MD_BITMAP_FILE is not set
427430 CONFIG_MD_LINEAR=m
428431 CONFIG_MD_MULTIPATH=m
429432 CONFIG_MD_FAULTY=m
@@ -566,6 +569,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y · 136 unmodified lines
566569 CONFIG_SOFT_WATCHDOG=m
567570 CONFIG_DIAG288_WATCHDOG=m
568571 CONFIG_FB=y
572+# CONFIG_FB_DEVICE is not set
569573 CONFIG_FRAMEBUFFER_CONSOLE=y
570574 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
571575 # CONFIG_HID_SUPPORT is not set
@@ -632,6 +636,7 @@ CONFIG_PROC_KCORE=y · 60 unmodified lines
632636 CONFIG_TMPFS=y
633637 CONFIG_TMPFS_POSIX_ACL=y
634638 CONFIG_TMPFS_INODE64=y
639+CONFIG_TMPFS_QUOTA=y
635640 CONFIG_HUGETLBFS=y
636641 CONFIG_CONFIGFS_FS=m
637642 CONFIG_ECRYPT_FS=m
@@ -687,6 +692,7 @@ CONFIG_IMA_WRITE_POLICY=y · 49 unmodified lines
687692 CONFIG_IMA_APPRAISE=y
688693 CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"
689694 CONFIG_INIT_STACK_NONE=y
695+CONFIG_BUG_ON_DATA_CORRUPTION=y
690696 CONFIG_CRYPTO_FIPS=y
691697 CONFIG_CRYPTO_USER=m
692698 # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
@@ -781,7 +787,6 @@ CONFIG_PTDUMP_DEBUGFS=y · 88 unmodified lines
781787 CONFIG_DEBUG_MEMORY_INIT=y
782788 CONFIG_PANIC_ON_OOPS=y
783789 CONFIG_TEST_LOCKUP=m
784−CONFIG_BUG_ON_DATA_CORRUPTION=y
785790 CONFIG_RCU_TORTURE_TEST=m
786791 CONFIG_RCU_REF_SCALE_TEST=m
787792 CONFIG_RCU_CPU_STALL_TIMEOUT=60
arch/s390/configs/zfcpdump_defconfig+2−2
@@ -8,6 +8,7 @@ CONFIG_BPF_SYSCALL=y · 7 unmodified lines
88 # CONFIG_NET_NS is not set
99 CONFIG_BLK_DEV_INITRD=y
1010 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
11+CONFIG_CRASH_DUMP=y
1112 CONFIG_MARCH_ZEC12=y
1213 CONFIG_TUNE_ZEC12=y
1314 # CONFIG_COMPAT is not set
@@ -15,9 +16,8 @@ CONFIG_NR_CPUS=2 · 1 unmodified line
1516 CONFIG_HZ_100=y
1617 # CONFIG_CHSC_SCH is not set
1718 # CONFIG_SCM_BUS is not set
18−CONFIG_CRASH_DUMP=y
1919 # CONFIG_PFAULT is not set
20−# CONFIG_S390_HYPFS_FS is not set
20+# CONFIG_S390_HYPFS is not set
2121 # CONFIG_VIRTUALIZATION is not set
2222 # CONFIG_S390_GUEST is not set
2323 # CONFIG_SECCOMP is not set
arch/s390/include/asm/hugetlb.h+4−2
@@ -16,6 +16,8 @@ · 15 unmodified lines
1616 #define hugepages_supported() (MACHINE_HAS_EDAT1)
1717
1818 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
19+ pte_t *ptep, pte_t pte, unsigned long sz);
20+void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
1921 pte_t *ptep, pte_t pte);
2022 pte_t huge_ptep_get(pte_t *ptep);
2123 pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
@@ -65,7 +67,7 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, · 43 unmodified lines
6567 int changed = !pte_same(huge_ptep_get(ptep), pte);
6668 if (changed) {
6769 huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
68− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
70+ __set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
6971 }
7072 return changed;
7173 }
@@ -74,7 +76,7 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, · 2 unmodified lines
7476 unsigned long addr, pte_t *ptep)
7577 {
7678 pte_t pte = huge_ptep_get_and_clear(mm, addr, ptep);
77− set_huge_pte_at(mm, addr, ptep, pte_wrprotect(pte));
79+ __set_huge_pte_at(mm, addr, ptep, pte_wrprotect(pte));
7880 }
7981
8082 static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
arch/s390/kernel/cert_store.c+4−3
@@ -432,15 +432,16 @@ static char *get_key_description(struct vcssb *vcssb, const struct vce *vce) · 431 unmodified lines
432432 char *desc;
433433
434434 cs_token = vcssb->cs_token;
435− /* Description string contains "%64s:%04u:%08u\0". */
435+ /* Description string contains "%64s:%05u:%010u\0". */
436436 name_len = sizeof(vce->vce_hdr.vc_name);
437− len = name_len + 1 + 4 + 1 + 8 + 1;
437+ len = name_len + 1 + 5 + 1 + 10 + 1;
438438 desc = kmalloc(len, GFP_KERNEL);
439439 if (!desc)
440440 return NULL;
441441
442442 memcpy(desc, vce->vce_hdr.vc_name, name_len);
443− sprintf(desc + name_len, ":%04u:%08u", vce->vce_hdr.vc_index, cs_token);
443+ snprintf(desc + name_len, len - name_len, ":%05u:%010u",
444+ vce->vce_hdr.vc_index, cs_token);
444445
445446 return desc;
446447 }
arch/s390/mm/hugetlbpage.c+7−1
@@ -142,7 +142,7 @@ static void clear_huge_pte_skeys(struct mm_struct *mm, unsigned long rste) · 141 unmodified lines
142142 __storage_key_init_range(paddr, paddr + size - 1);
143143 }
144144
145−void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
145+void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
146146 pte_t *ptep, pte_t pte)
147147 {
148148 unsigned long rste;
@@ -163,6 +163,12 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 14 unmodified lines
163163 set_pte(ptep, __pte(rste));
164164 }
165165
166+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
167+ pte_t *ptep, pte_t pte, unsigned long sz)
168+{
169+ __set_huge_pte_at(mm, addr, ptep, pte);
170+}
171+
166172 pte_t huge_ptep_get(pte_t *ptep)
167173 {
168174 return __rste_to_pte(pte_val(*ptep));
arch/s390/net/bpf_jit_comp.c+1−1
@@ -2513,7 +2513,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, · 2512 unmodified lines
25132513 return -E2BIG;
25142514 }
25152515
2516− return ret;
2516+ return tjit.common.prg;
25172517 }
25182518
25192519 bool bpf_jit_supports_subprog_tailcalls(void)
arch/sh/mm/ioremap.c+2−2
@@ -72,8 +72,8 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot) · 71 unmodified lines
7272 #define __ioremap_29bit(offset, size, prot) NULL
7373 #endif /* CONFIG_29BIT */
7474
75−void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
76− unsigned long prot)
75+void __iomem __ref *ioremap_prot(phys_addr_t phys_addr, size_t size,
76+ unsigned long prot)
7777 {
7878 void __iomem *mapped;
7979 pgprot_t pgprot = __pgprot(prot);
arch/sparc/include/asm/hugetlb.h+4−2
@@ -14,6 +14,8 @@ extern struct pud_huge_patch_entry __pud_huge_patch, __pud_huge_patch_end; · 13 unmodified lines
1414
1515 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
1616 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
17+ pte_t *ptep, pte_t pte, unsigned long sz);
18+void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
1719 pte_t *ptep, pte_t pte);
1820
1921 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
@@ -32,7 +34,7 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, · 12 unmodified lines
3234 unsigned long addr, pte_t *ptep)
3335 {
3436 pte_t old_pte = *ptep;
35− set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
37+ __set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
3638 }
3739
3840 #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
@@ -42,7 +44,7 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, · 3 unmodified lines
4244 {
4345 int changed = !pte_same(*ptep, pte);
4446 if (changed) {
45− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
47+ __set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
4648 flush_tlb_page(vma, addr);
4749 }
4850 return changed;
arch/sparc/mm/hugetlbpage.c+7−1
@@ -328,7 +328,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm, · 327 unmodified lines
328328 return pte_offset_huge(pmd, addr);
329329 }
330330
331−void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
331+void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
332332 pte_t *ptep, pte_t entry)
333333 {
334334 unsigned int nptes, orig_shift, shift;
@@ -364,6 +364,12 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 29 unmodified lines
364364 orig_shift);
365365 }
366366
367+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
368+ pte_t *ptep, pte_t entry, unsigned long sz)
369+{
370+ __set_huge_pte_at(mm, addr, ptep, entry);
371+}
372+
367373 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
368374 pte_t *ptep)
369375 {
arch/x86/events/amd/core.c+17−7
@@ -534,8 +534,12 @@ static void amd_pmu_cpu_reset(int cpu) · 533 unmodified lines
534534 /* Clear enable bits i.e. PerfCntrGlobalCtl.PerfCntrEn */
535535 wrmsrl(MSR_AMD64_PERF_CNTR_GLOBAL_CTL, 0);
536536
537− /* Clear overflow bits i.e. PerfCntrGLobalStatus.PerfCntrOvfl */
538− wrmsrl(MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR, amd_pmu_global_cntr_mask);
537+ /*
538+ * Clear freeze and overflow bits i.e. PerfCntrGLobalStatus.LbrFreeze
539+ * and PerfCntrGLobalStatus.PerfCntrOvfl
540+ */
541+ wrmsrl(MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR,
542+ GLOBAL_STATUS_LBRS_FROZEN | amd_pmu_global_cntr_mask);
539543 }
540544
541545 static int amd_pmu_cpu_prepare(int cpu)
@@ -570,6 +574,7 @@ static void amd_pmu_cpu_starting(int cpu) · 28 unmodified lines
570574 int i, nb_id;
571575
572576 cpuc->perf_ctr_virt_mask = AMD64_EVENTSEL_HOSTONLY;
577+ amd_pmu_cpu_reset(cpu);
573578
574579 if (!x86_pmu.amd_nb_constraints)
575580 return;
@@ -591,8 +596,6 @@ static void amd_pmu_cpu_starting(int cpu) · 15 unmodified lines
591596
592597 cpuc->amd_nb->nb_id = nb_id;
593598 cpuc->amd_nb->refcnt++;
594−
595− amd_pmu_cpu_reset(cpu);
596599 }
597600
598601 static void amd_pmu_cpu_dead(int cpu)
@@ -601,6 +604,7 @@ static void amd_pmu_cpu_dead(int cpu) · 2 unmodified lines
601604
602605 kfree(cpuhw->lbr_sel);
603606 cpuhw->lbr_sel = NULL;
607+ amd_pmu_cpu_reset(cpu);
604608
605609 if (!x86_pmu.amd_nb_constraints)
606610 return;
@@ -613,8 +617,6 @@ static void amd_pmu_cpu_dead(int cpu) · 6 unmodified lines
613617
614618 cpuhw->amd_nb = NULL;
615619 }
616−
617− amd_pmu_cpu_reset(cpu);
618620 }
619621
620622 static inline void amd_pmu_set_global_ctl(u64 ctl)
@@ -884,7 +886,7 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs) · 263 unmodified lines
884886 struct hw_perf_event *hwc;
885887 struct perf_event *event;
886888 int handled = 0, idx;
887− u64 status, mask;
889+ u64 reserved, status, mask;
888890 bool pmu_enabled;
889891
890892 /*
@@ -909,6 +911,14 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs) · 18 unmodified lines
909911 status &= ~GLOBAL_STATUS_LBRS_FROZEN;
910912 }
911913
914+ reserved = status & ~amd_pmu_global_cntr_mask;
915+ if (reserved)
916+ pr_warn_once("Reserved PerfCntrGlobalStatus bits are set (0x%llx), please consider updating microcode\n",
917+ reserved);
918+
919+ /* Clear any reserved bits set by buggy microcode */
920+ status &= amd_pmu_global_cntr_mask;
921+
912922 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
913923 if (!test_bit(idx, cpuc->active_mask))
914924 continue;
arch/x86/include/asm/kvm_host.h+1−2
@@ -1419,7 +1419,6 @@ struct kvm_arch { · 1418 unmodified lines
14191419 * the thread holds the MMU lock in write mode.
14201420 */
14211421 spinlock_t tdp_mmu_pages_lock;
1422− struct workqueue_struct *tdp_mmu_zap_wq;
14231422 #endif /* CONFIG_X86_64 */
14241423
14251424 /*
@@ -1835,7 +1834,7 @@ void kvm_mmu_vendor_module_exit(void); · 409 unmodified lines
18351834
18361835 void kvm_mmu_destroy(struct kvm_vcpu *vcpu);
18371836 int kvm_mmu_create(struct kvm_vcpu *vcpu);
1838−int kvm_mmu_init_vm(struct kvm *kvm);
1837+void kvm_mmu_init_vm(struct kvm *kvm);
18391838 void kvm_mmu_uninit_vm(struct kvm *kvm);
18401839
18411840 void kvm_mmu_after_set_cpuid(struct kvm_vcpu *vcpu);
arch/x86/include/asm/linkage.h+7−0
@@ -105,6 +105,13 @@ · 104 unmodified lines
105105 CFI_POST_PADDING \
106106 SYM_FUNC_END(__cfi_##name)
107107
108+/* UML needs to be able to override memcpy() and friends for KASAN. */
109+#ifdef CONFIG_UML
110+# define SYM_FUNC_ALIAS_MEMFUNC SYM_FUNC_ALIAS_WEAK
111+#else
112+# define SYM_FUNC_ALIAS_MEMFUNC SYM_FUNC_ALIAS
113+#endif
114+
108115 /* SYM_TYPED_FUNC_START -- use for indirectly called globals, w/ CFI type */
109116 #define SYM_TYPED_FUNC_START(name) \
110117 SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_F_ALIGN) \
arch/x86/include/asm/mmu_context.h+1−2
@@ -186,8 +186,7 @@ do { \ · 185 unmodified lines
186186 #else
187187 #define deactivate_mm(tsk, mm) \
188188 do { \
189− if (!tsk->vfork_done) \
190− shstk_free(tsk); \
189+ shstk_free(tsk); \
191190 load_gs_index(0); \
192191 loadsegment(fs, 0); \
193192 } while (0)
arch/x86/include/asm/pgtable.h+8−0
@@ -955,6 +955,14 @@ static inline int pte_same(pte_t a, pte_t b) · 954 unmodified lines
955955 return a.pte == b.pte;
956956 }
957957
958+static inline pte_t pte_next_pfn(pte_t pte)
959+{
960+ if (__pte_needs_invert(pte_val(pte)))
961+ return __pte(pte_val(pte) - (1UL << PFN_PTE_SHIFT));
962+ return __pte(pte_val(pte) + (1UL << PFN_PTE_SHIFT));
963+}
964+#define pte_next_pfn pte_next_pfn
965+
958966 static inline int pte_present(pte_t a)
959967 {
960968 return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE);
arch/x86/include/asm/processor.h+0−2
@@ -683,13 +683,11 @@ extern u16 get_llc_id(unsigned int cpu); · 682 unmodified lines
683683 #ifdef CONFIG_CPU_SUP_AMD
684684 extern u32 amd_get_nodes_per_socket(void);
685685 extern u32 amd_get_highest_perf(void);
686−extern bool cpu_has_ibpb_brtype_microcode(void);
687686 extern void amd_clear_divider(void);
688687 extern void amd_check_microcode(void);
689688 #else
690689 static inline u32 amd_get_nodes_per_socket(void) { return 0; }
691690 static inline u32 amd_get_highest_perf(void) { return 0; }
692−static inline bool cpu_has_ibpb_brtype_microcode(void) { return false; }
693691 static inline void amd_clear_divider(void) { }
694692 static inline void amd_check_microcode(void) { }
695693 #endif
arch/x86/kernel/alternative.c+2−7
@@ -720,13 +720,8 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end) · 719 unmodified lines
720720 {
721721 s32 *s;
722722
723− /*
724− * Do not patch out the default return thunks if those needed are the
725− * ones generated by the compiler.
726− */
727− if (cpu_feature_enabled(X86_FEATURE_RETHUNK) &&
728− (x86_return_thunk == __x86_return_thunk))
729− return;
723+ if (cpu_feature_enabled(X86_FEATURE_RETHUNK))
724+ static_call_force_reinit();
730725
731726 for (s = start; s < end; s++) {
732727 void *dest = NULL, *addr = (void *)s + *s;
arch/x86/kernel/callthunks.c+0−1
@@ -272,7 +272,6 @@ void __init callthunks_patch_builtin_calls(void) · 271 unmodified lines
272272 pr_info("Setting up call depth tracking\n");
273273 mutex_lock(&text_mutex);
274274 callthunks_setup(&cs, &builtin_coretext);
275− static_call_force_reinit();
276275 thunks_initialized = true;
277276 mutex_unlock(&text_mutex);
278277 }
arch/x86/kernel/cpu/amd.c+9−19
@@ -766,6 +766,15 @@ static void early_init_amd(struct cpuinfo_x86 *c) · 765 unmodified lines
766766
767767 if (cpu_has(c, X86_FEATURE_TOPOEXT))
768768 smp_num_siblings = ((cpuid_ebx(0x8000001e) >> 8) & 0xff) + 1;
769+
770+ if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && !cpu_has(c, X86_FEATURE_IBPB_BRTYPE)) {
771+ if (c->x86 == 0x17 && boot_cpu_has(X86_FEATURE_AMD_IBPB))
772+ setup_force_cpu_cap(X86_FEATURE_IBPB_BRTYPE);
773+ else if (c->x86 >= 0x19 && !wrmsrl_safe(MSR_IA32_PRED_CMD, PRED_CMD_SBPB)) {
774+ setup_force_cpu_cap(X86_FEATURE_IBPB_BRTYPE);
775+ setup_force_cpu_cap(X86_FEATURE_SBPB);
776+ }
777+ }
769778 }
770779
771780 static void init_amd_k8(struct cpuinfo_x86 *c)
@@ -1301,25 +1310,6 @@ void amd_check_microcode(void) · 529 unmodified lines
13011310 on_each_cpu(zenbleed_check_cpu, NULL, 1);
13021311 }
13031312
1304−bool cpu_has_ibpb_brtype_microcode(void)
1305−{
1306− switch (boot_cpu_data.x86) {
1307− /* Zen1/2 IBPB flushes branch type predictions too. */
1308− case 0x17:
1309− return boot_cpu_has(X86_FEATURE_AMD_IBPB);
1310− case 0x19:
1311− /* Poke the MSR bit on Zen3/4 to check its presence. */
1312− if (!wrmsrl_safe(MSR_IA32_PRED_CMD, PRED_CMD_SBPB)) {
1313− setup_force_cpu_cap(X86_FEATURE_SBPB);
1314− return true;
1315− } else {
1316− return false;
1317− }
1318− default:
1319− return false;
1320− }
1321−}
1322−
13231313 /*
13241314 * Issue a DIV 0/1 insn to clear any division data from previous DIV
13251315 * operations.
arch/x86/kernel/cpu/bugs.c+3−14
@@ -2404,26 +2404,15 @@ early_param("spec_rstack_overflow", srso_parse_cmdline); · 2403 unmodified lines
24042404
24052405 static void __init srso_select_mitigation(void)
24062406 {
2407− bool has_microcode;
2407+ bool has_microcode = boot_cpu_has(X86_FEATURE_IBPB_BRTYPE);
24082408
24092409 if (!boot_cpu_has_bug(X86_BUG_SRSO) || cpu_mitigations_off())
24102410 goto pred_cmd;
24112411
2412− /*
2413− * The first check is for the kernel running as a guest in order
2414− * for guests to verify whether IBPB is a viable mitigation.
2415− */
2416− has_microcode = boot_cpu_has(X86_FEATURE_IBPB_BRTYPE) || cpu_has_ibpb_brtype_microcode();
24172412 if (!has_microcode) {
24182413 pr_warn("IBPB-extending microcode not applied!\n");
24192414 pr_warn(SRSO_NOTICE);
24202415 } else {
2421− /*
2422− * Enable the synthetic (even if in a real CPUID leaf)
2423− * flags for guests.
2424− */
2425− setup_force_cpu_cap(X86_FEATURE_IBPB_BRTYPE);
2426−
24272416 /*
24282417 * Zen1/2 with SMT off aren't vulnerable after the right
24292418 * IBPB microcode has been applied.
@@ -2444,7 +2433,7 @@ static void __init srso_select_mitigation(void) · 14 unmodified lines
24442433
24452434 switch (srso_cmd) {
24462435 case SRSO_CMD_OFF:
2447− return;
2436+ goto pred_cmd;
24482437
24492438 case SRSO_CMD_MICROCODE:
24502439 if (has_microcode) {
@@ -2717,7 +2706,7 @@ static ssize_t srso_show_state(char *buf) · 266 unmodified lines
27172706
27182707 return sysfs_emit(buf, "%s%s\n",
27192708 srso_strings[srso_mitigation],
2720− (cpu_has_ibpb_brtype_microcode() ? "" : ", no microcode"));
2709+ boot_cpu_has(X86_FEATURE_IBPB_BRTYPE) ? "" : ", no microcode");
27212710 }
27222711
27232712 static ssize_t gds_show_state(char *buf)
arch/x86/kernel/cpu/common.c+1−1
@@ -1303,7 +1303,7 @@ static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst = { · 1302 unmodified lines
13031303 VULNBL_AMD(0x15, RETBLEED),
13041304 VULNBL_AMD(0x16, RETBLEED),
13051305 VULNBL_AMD(0x17, RETBLEED | SMT_RSB | SRSO),
1306− VULNBL_HYGON(0x18, RETBLEED | SMT_RSB),
1306+ VULNBL_HYGON(0x18, RETBLEED | SMT_RSB | SRSO),
13071307 VULNBL_AMD(0x19, SRSO),
13081308 {}
13091309 };
arch/x86/kernel/cpu/sgx/encl.c+25−5
@@ -235,6 +235,21 @@ static struct sgx_epc_page *sgx_encl_eldu(struct sgx_encl_page *encl_page, · 234 unmodified lines
235235 return epc_page;
236236 }
237237
238+/*
239+ * Ensure the SECS page is not swapped out. Must be called with encl->lock
240+ * to protect the enclave states including SECS and ensure the SECS page is
241+ * not swapped out again while being used.
242+ */
243+static struct sgx_epc_page *sgx_encl_load_secs(struct sgx_encl *encl)
244+{
245+ struct sgx_epc_page *epc_page = encl->secs.epc_page;
246+
247+ if (!epc_page)
248+ epc_page = sgx_encl_eldu(&encl->secs, NULL);
249+
250+ return epc_page;
251+}
252+
238253 static struct sgx_encl_page *__sgx_encl_load_page(struct sgx_encl *encl,
239254 struct sgx_encl_page *entry)
240255 {
@@ -248,11 +263,9 @@ static struct sgx_encl_page *__sgx_encl_load_page(struct sgx_encl *encl, · 7 unmodified lines
248263 return entry;
249264 }
250265
251− if (!(encl->secs.epc_page)) {
252− epc_page = sgx_encl_eldu(&encl->secs, NULL);
253− if (IS_ERR(epc_page))
254− return ERR_CAST(epc_page);
255− }
266+ epc_page = sgx_encl_load_secs(encl);
267+ if (IS_ERR(epc_page))
268+ return ERR_CAST(epc_page);
256269
257270 epc_page = sgx_encl_eldu(entry, encl->secs.epc_page);
258271 if (IS_ERR(epc_page))
@@ -339,6 +352,13 @@ static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma, · 80 unmodified lines
339352
340353 mutex_lock(&encl->lock);
341354
355+ epc_page = sgx_encl_load_secs(encl);
356+ if (IS_ERR(epc_page)) {
357+ if (PTR_ERR(epc_page) == -EBUSY)
358+ vmret = VM_FAULT_NOPAGE;
359+ goto err_out_unlock;
360+ }
361+
342362 epc_page = sgx_alloc_epc_page(encl_page, false);
343363 if (IS_ERR(epc_page)) {
344364 if (PTR_ERR(epc_page) == -EBUSY)
arch/x86/kernel/kgdb.c+0−1
@@ -695,7 +695,6 @@ void kgdb_arch_exit(void) · 694 unmodified lines
695695 }
696696
697697 /**
698− *
699698 * kgdb_skipexception - Bail out of KGDB when we've been triggered.
700699 * @exception: Exception vector number
701700 * @regs: Current &struct pt_regs.
arch/x86/kernel/process.c+0−7
@@ -257,13 +257,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) · 256 unmodified lines
257257 if (!ret && unlikely(test_tsk_thread_flag(current, TIF_IO_BITMAP)))
258258 io_bitmap_share(p);
259259
260− /*
261− * If copy_thread() if failing, don't leak the shadow stack possibly
262− * allocated in shstk_alloc_thread_stack() above.
263− */
264− if (ret)
265− shstk_free(p);
266−
267260 return ret;
268261 }
269262
arch/x86/kernel/setup.c+2−6
@@ -358,15 +358,11 @@ static void __init add_early_ima_buffer(u64 phys_addr) · 357 unmodified lines
358358 #if defined(CONFIG_HAVE_IMA_KEXEC) && !defined(CONFIG_OF_FLATTREE)
359359 int __init ima_free_kexec_buffer(void)
360360 {
361− int rc;
362−
363361 if (!ima_kexec_buffer_size)
364362 return -ENOENT;
365363
366− rc = memblock_phys_free(ima_kexec_buffer_phys,
367− ima_kexec_buffer_size);
368− if (rc)
369− return rc;
364+ memblock_free_late(ima_kexec_buffer_phys,
365+ ima_kexec_buffer_size);
370366
371367 ima_kexec_buffer_phys = 0;
372368 ima_kexec_buffer_size = 0;
arch/x86/kernel/shstk.c+31−2
@@ -205,10 +205,21 @@ unsigned long shstk_alloc_thread_stack(struct task_struct *tsk, unsigned long cl · 204 unmodified lines
205205 return 0;
206206
207207 /*
208− * For CLONE_VM, except vfork, the child needs a separate shadow
208+ * For CLONE_VFORK the child will share the parents shadow stack.
209+ * Make sure to clear the internal tracking of the thread shadow
210+ * stack so the freeing logic run for child knows to leave it alone.
211+ */
212+ if (clone_flags & CLONE_VFORK) {
213+ shstk->base = 0;
214+ shstk->size = 0;
215+ return 0;
216+ }
217+
218+ /*
219+ * For !CLONE_VM the child will use a copy of the parents shadow
209220 * stack.
210221 */
211− if ((clone_flags & (CLONE_VFORK | CLONE_VM)) != CLONE_VM)
222+ if (!(clone_flags & CLONE_VM))
212223 return 0;
213224
214225 size = adjust_shstk_size(stack_size);
@@ -408,7 +419,25 @@ void shstk_free(struct task_struct *tsk) · 193 unmodified lines
408419 if (!tsk->mm || tsk->mm != current->mm)
409420 return;
410421
422+ /*
423+ * If shstk->base is NULL, then this task is not managing its
424+ * own shadow stack (CLONE_VFORK). So skip freeing it.
425+ */
426+ if (!shstk->base)
427+ return;
428+
429+ /*
430+ * shstk->base is NULL for CLONE_VFORK child tasks, and so is
431+ * normal. But size = 0 on a shstk->base is not normal and
432+ * indicated an attempt to free the thread shadow stack twice.
433+ * Warn about it.
434+ */
435+ if (WARN_ON(!shstk->size))
436+ return;
437+
411438 unmap_shadow_stack(shstk->base, shstk->size);
439+
440+ shstk->size = 0;
412441 }
413442
414443 static int wrss_control(bool enable)
arch/x86/kvm/mmu/mmu.c+5−16
@@ -6167,20 +6167,15 @@ static bool kvm_has_zapped_obsolete_pages(struct kvm *kvm) · 6166 unmodified lines
61676167 return unlikely(!list_empty_careful(&kvm->arch.zapped_obsolete_pages));
61686168 }
61696169
6170−int kvm_mmu_init_vm(struct kvm *kvm)
6170+void kvm_mmu_init_vm(struct kvm *kvm)
61716171 {
6172− int r;
6173−
61746172 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);
61756173 INIT_LIST_HEAD(&kvm->arch.zapped_obsolete_pages);
61766174 INIT_LIST_HEAD(&kvm->arch.possible_nx_huge_pages);
61776175 spin_lock_init(&kvm->arch.mmu_unsync_pages_lock);
61786176
6179− if (tdp_mmu_enabled) {
6180− r = kvm_mmu_init_tdp_mmu(kvm);
6181− if (r < 0)
6182− return r;
6183− }
6177+ if (tdp_mmu_enabled)
6178+ kvm_mmu_init_tdp_mmu(kvm);
61846179
61856180 kvm->arch.split_page_header_cache.kmem_cache = mmu_page_header_cache;
61866181 kvm->arch.split_page_header_cache.gfp_zero = __GFP_ZERO;
@@ -6189,8 +6184,6 @@ int kvm_mmu_init_vm(struct kvm *kvm) · 2 unmodified lines
61896184
61906185 kvm->arch.split_desc_cache.kmem_cache = pte_list_desc_cache;
61916186 kvm->arch.split_desc_cache.gfp_zero = __GFP_ZERO;
6192−
6193− return 0;
61946187 }
61956188
61966189 static void mmu_free_vm_memory_caches(struct kvm *kvm)
@@ -6246,7 +6239,6 @@ static bool kvm_rmap_zap_gfn_range(struct kvm *kvm, gfn_t gfn_start, gfn_t gfn_e · 49 unmodified lines
62466239 void kvm_zap_gfn_range(struct kvm *kvm, gfn_t gfn_start, gfn_t gfn_end)
62476240 {
62486241 bool flush;
6249− int i;
62506242
62516243 if (WARN_ON_ONCE(gfn_end <= gfn_start))
62526244 return;
@@ -6257,11 +6249,8 @@ void kvm_zap_gfn_range(struct kvm *kvm, gfn_t gfn_start, gfn_t gfn_end) · 4 unmodified lines
62576249
62586250 flush = kvm_rmap_zap_gfn_range(kvm, gfn_start, gfn_end);
62596251
6260− if (tdp_mmu_enabled) {
6261− for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++)
6262− flush = kvm_tdp_mmu_zap_leafs(kvm, i, gfn_start,
6263− gfn_end, true, flush);
6264− }
6252+ if (tdp_mmu_enabled)
6253+ flush = kvm_tdp_mmu_zap_leafs(kvm, gfn_start, gfn_end, flush);
62656254
62666255 if (flush)
62676256 kvm_flush_remote_tlbs_range(kvm, gfn_start, gfn_end - gfn_start);
arch/x86/kvm/mmu/mmu_internal.h+7−8
@@ -58,7 +58,12 @@ struct kvm_mmu_page { · 57 unmodified lines
5858
5959 bool tdp_mmu_page;
6060 bool unsync;
61− u8 mmu_valid_gen;
61+ union {
62+ u8 mmu_valid_gen;
63+
64+ /* Only accessed under slots_lock. */
65+ bool tdp_mmu_scheduled_root_to_zap;
66+ };
6267
6368 /*
6469 * The shadow page can't be replaced by an equivalent huge page
@@ -100,13 +105,7 @@ struct kvm_mmu_page { · 35 unmodified lines
100105 struct kvm_rmap_head parent_ptes; /* rmap pointers to parent sptes */
101106 tdp_ptep_t ptep;
102107 };
103− union {
104− DECLARE_BITMAP(unsync_child_bitmap, 512);
105− struct {
106− struct work_struct tdp_mmu_async_work;
107− void *tdp_mmu_async_data;
108− };
109− };
108+ DECLARE_BITMAP(unsync_child_bitmap, 512);
110109
111110 /*
112111 * Tracks shadow pages that, if zapped, would allow KVM to create an NX
arch/x86/kvm/mmu/tdp_mmu.c+67−85
@@ -12,18 +12,10 @@ · 11 unmodified lines
1212 #include <trace/events/kvm.h>
1313
1414 /* Initializes the TDP MMU for the VM, if enabled. */
15−int kvm_mmu_init_tdp_mmu(struct kvm *kvm)
15+void kvm_mmu_init_tdp_mmu(struct kvm *kvm)
1616 {
17− struct workqueue_struct *wq;
18−
19− wq = alloc_workqueue("kvm", WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE, 0);
20− if (!wq)
21− return -ENOMEM;
22−
2317 INIT_LIST_HEAD(&kvm->arch.tdp_mmu_roots);
2418 spin_lock_init(&kvm->arch.tdp_mmu_pages_lock);
25− kvm->arch.tdp_mmu_zap_wq = wq;
26− return 1;
2719 }
2820
2921 /* Arbitrarily returns true so that this may be used in if statements. */
@@ -46,20 +38,15 @@ void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm) · 16 unmodified lines
4638 * ultimately frees all roots.
4739 */
4840 kvm_tdp_mmu_invalidate_all_roots(kvm);
49−
50− /*
51− * Destroying a workqueue also first flushes the workqueue, i.e. no
52− * need to invoke kvm_tdp_mmu_zap_invalidated_roots().
53− */
54− destroy_workqueue(kvm->arch.tdp_mmu_zap_wq);
41+ kvm_tdp_mmu_zap_invalidated_roots(kvm);
5542
5643 WARN_ON(atomic64_read(&kvm->arch.tdp_mmu_pages));
5744 WARN_ON(!list_empty(&kvm->arch.tdp_mmu_roots));
5845
5946 /*
6047 * Ensure that all the outstanding RCU callbacks to free shadow pages
61− * can run before the VM is torn down. Work items on tdp_mmu_zap_wq
62− * can call kvm_tdp_mmu_put_root and create new callbacks.
48+ * can run before the VM is torn down. Putting the last reference to
49+ * zapped roots will create new callbacks.
6350 */
6451 rcu_barrier();
6552 }
@@ -86,46 +73,6 @@ static void tdp_mmu_free_sp_rcu_callback(struct rcu_head *head) · 20 unmodified lines
8673 tdp_mmu_free_sp(sp);
8774 }
8875
89−static void tdp_mmu_zap_root(struct kvm *kvm, struct kvm_mmu_page *root,
90− bool shared);
91−
92−static void tdp_mmu_zap_root_work(struct work_struct *work)
93−{
94− struct kvm_mmu_page *root = container_of(work, struct kvm_mmu_page,
95− tdp_mmu_async_work);
96− struct kvm *kvm = root->tdp_mmu_async_data;
97−
98− read_lock(&kvm->mmu_lock);
99−
100− /*
101− * A TLB flush is not necessary as KVM performs a local TLB flush when
102− * allocating a new root (see kvm_mmu_load()), and when migrating vCPU
103− * to a different pCPU. Note, the local TLB flush on reuse also
104− * invalidates any paging-structure-cache entries, i.e. TLB entries for
105− * intermediate paging structures, that may be zapped, as such entries
106− * are associated with the ASID on both VMX and SVM.
107− */
108− tdp_mmu_zap_root(kvm, root, true);
109−
110− /*
111− * Drop the refcount using kvm_tdp_mmu_put_root() to test its logic for
112− * avoiding an infinite loop. By design, the root is reachable while
113− * it's being asynchronously zapped, thus a different task can put its
114− * last reference, i.e. flowing through kvm_tdp_mmu_put_root() for an
115− * asynchronously zapped root is unavoidable.
116− */
117− kvm_tdp_mmu_put_root(kvm, root, true);
118−
119− read_unlock(&kvm->mmu_lock);
120−}
121−
122−static void tdp_mmu_schedule_zap_root(struct kvm *kvm, struct kvm_mmu_page *root)
123−{
124− root->tdp_mmu_async_data = kvm;
125− INIT_WORK(&root->tdp_mmu_async_work, tdp_mmu_zap_root_work);
126− queue_work(kvm->arch.tdp_mmu_zap_wq, &root->tdp_mmu_async_work);
127−}
128−
12976 void kvm_tdp_mmu_put_root(struct kvm *kvm, struct kvm_mmu_page *root,
13077 bool shared)
13178 {
@@ -211,8 +158,12 @@ static struct kvm_mmu_page *tdp_mmu_next_root(struct kvm *kvm, · 79 unmodified lines
211158 #define for_each_valid_tdp_mmu_root_yield_safe(_kvm, _root, _as_id, _shared) \
212159 __for_each_tdp_mmu_root_yield_safe(_kvm, _root, _as_id, _shared, true)
213160
214−#define for_each_tdp_mmu_root_yield_safe(_kvm, _root, _as_id) \
215− __for_each_tdp_mmu_root_yield_safe(_kvm, _root, _as_id, false, false)
161+#define for_each_tdp_mmu_root_yield_safe(_kvm, _root, _shared) \
162+ for (_root = tdp_mmu_next_root(_kvm, NULL, _shared, false); \
163+ _root; \
164+ _root = tdp_mmu_next_root(_kvm, _root, _shared, false)) \
165+ if (!kvm_lockdep_assert_mmu_lock_held(_kvm, _shared)) { \
166+ } else
216167
217168 /*
218169 * Iterate over all TDP MMU roots. Requires that mmu_lock be held for write,
@@ -292,7 +243,7 @@ hpa_t kvm_tdp_mmu_get_vcpu_root_hpa(struct kvm_vcpu *vcpu) · 73 unmodified lines
292243 * by a memslot update or by the destruction of the VM. Initialize the
293244 * refcount to two; one reference for the vCPU, and one reference for
294245 * the TDP MMU itself, which is held until the root is invalidated and
295− * is ultimately put by tdp_mmu_zap_root_work().
246+ * is ultimately put by kvm_tdp_mmu_zap_invalidated_roots().
296247 */
297248 refcount_set(&root->tdp_mmu_root_count, 2);
298249
@@ -877,13 +828,12 @@ static bool tdp_mmu_zap_leafs(struct kvm *kvm, struct kvm_mmu_page *root, · 578 unmodified lines
877828 * true if a TLB flush is needed before releasing the MMU lock, i.e. if one or
878829 * more SPTEs were zapped since the MMU lock was last acquired.
879830 */
880−bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, int as_id, gfn_t start, gfn_t end,
881− bool can_yield, bool flush)
831+bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, gfn_t start, gfn_t end, bool flush)
882832 {
883833 struct kvm_mmu_page *root;
884834
885− for_each_tdp_mmu_root_yield_safe(kvm, root, as_id)
886− flush = tdp_mmu_zap_leafs(kvm, root, start, end, can_yield, flush);
835+ for_each_tdp_mmu_root_yield_safe(kvm, root, false)
836+ flush = tdp_mmu_zap_leafs(kvm, root, start, end, true, flush);
887837
888838 return flush;
889839 }
@@ -891,7 +841,6 @@ bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, int as_id, gfn_t start, gfn_t end, · 1 unmodified line
891841 void kvm_tdp_mmu_zap_all(struct kvm *kvm)
892842 {
893843 struct kvm_mmu_page *root;
894− int i;
895844
896845 /*
897846 * Zap all roots, including invalid roots, as all SPTEs must be dropped
@@ -905,10 +854,8 @@ void kvm_tdp_mmu_zap_all(struct kvm *kvm) · 7 unmodified lines
905854 * is being destroyed or the userspace VMM has exited. In both cases,
906855 * KVM_RUN is unreachable, i.e. no vCPUs will ever service the request.
907856 */
908− for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {
909− for_each_tdp_mmu_root_yield_safe(kvm, root, i)
910− tdp_mmu_zap_root(kvm, root, false);
911− }
857+ for_each_tdp_mmu_root_yield_safe(kvm, root, false)
858+ tdp_mmu_zap_root(kvm, root, false);
912859 }
913860
914861 /*
@@ -917,18 +864,47 @@ void kvm_tdp_mmu_zap_all(struct kvm *kvm) · 2 unmodified lines
917864 */
918865 void kvm_tdp_mmu_zap_invalidated_roots(struct kvm *kvm)
919866 {
920− flush_workqueue(kvm->arch.tdp_mmu_zap_wq);
867+ struct kvm_mmu_page *root;
868+
869+ read_lock(&kvm->mmu_lock);
870+
871+ for_each_tdp_mmu_root_yield_safe(kvm, root, true) {
872+ if (!root->tdp_mmu_scheduled_root_to_zap)
873+ continue;
874+
875+ root->tdp_mmu_scheduled_root_to_zap = false;
876+ KVM_BUG_ON(!root->role.invalid, kvm);
877+
878+ /*
879+ * A TLB flush is not necessary as KVM performs a local TLB
880+ * flush when allocating a new root (see kvm_mmu_load()), and
881+ * when migrating a vCPU to a different pCPU. Note, the local
882+ * TLB flush on reuse also invalidates paging-structure-cache
883+ * entries, i.e. TLB entries for intermediate paging structures,
884+ * that may be zapped, as such entries are associated with the
885+ * ASID on both VMX and SVM.
886+ */
887+ tdp_mmu_zap_root(kvm, root, true);
888+
889+ /*
890+ * The referenced needs to be put *after* zapping the root, as
891+ * the root must be reachable by mmu_notifiers while it's being
892+ * zapped
893+ */
894+ kvm_tdp_mmu_put_root(kvm, root, true);
895+ }
896+
897+ read_unlock(&kvm->mmu_lock);
921898 }
922899
923900 /*
924901 * Mark each TDP MMU root as invalid to prevent vCPUs from reusing a root that
925902 * is about to be zapped, e.g. in response to a memslots update. The actual
926− * zapping is performed asynchronously. Using a separate workqueue makes it
927− * easy to ensure that the destruction is performed before the "fast zap"
928− * completes, without keeping a separate list of invalidated roots; the list is
929− * effectively the list of work items in the workqueue.
903+ * zapping is done separately so that it happens with mmu_lock with read,
904+ * whereas invalidating roots must be done with mmu_lock held for write (unless
905+ * the VM is being destroyed).
930906 *
931− * Note, the asynchronous worker is gifted the TDP MMU's reference.
907+ * Note, kvm_tdp_mmu_zap_invalidated_roots() is gifted the TDP MMU's reference.
932908 * See kvm_tdp_mmu_get_vcpu_root_hpa().
933909 */
934910 void kvm_tdp_mmu_invalidate_all_roots(struct kvm *kvm)
@@ -953,19 +929,20 @@ void kvm_tdp_mmu_invalidate_all_roots(struct kvm *kvm) · 18 unmodified lines
953929 /*
954930 * As above, mmu_lock isn't held when destroying the VM! There can't
955931 * be other references to @kvm, i.e. nothing else can invalidate roots
956− * or be consuming roots, but walking the list of roots does need to be
957− * guarded against roots being deleted by the asynchronous zap worker.
932+ * or get/put references to roots.
958933 */
959− rcu_read_lock();
960−
961− list_for_each_entry_rcu(root, &kvm->arch.tdp_mmu_roots, link) {
934+ list_for_each_entry(root, &kvm->arch.tdp_mmu_roots, link) {
935+ /*
936+ * Note, invalid roots can outlive a memslot update! Invalid
937+ * roots must be *zapped* before the memslot update completes,
938+ * but a different task can acquire a reference and keep the
939+ * root alive after its been zapped.
940+ */
962941 if (!root->role.invalid) {
942+ root->tdp_mmu_scheduled_root_to_zap = true;
963943 root->role.invalid = true;
964− tdp_mmu_schedule_zap_root(kvm, root);
965944 }
966945 }
967−
968− rcu_read_unlock();
969946 }
970947
971948 /*
@@ -1146,8 +1123,13 @@ retry: · 174 unmodified lines
11461123 bool kvm_tdp_mmu_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range,
11471124 bool flush)
11481125 {
1149− return kvm_tdp_mmu_zap_leafs(kvm, range->slot->as_id, range->start,
1150− range->end, range->may_block, flush);
1126+ struct kvm_mmu_page *root;
1127+
1128+ __for_each_tdp_mmu_root_yield_safe(kvm, root, range->slot->as_id, false, false)
1129+ flush = tdp_mmu_zap_leafs(kvm, root, range->start, range->end,
1130+ range->may_block, flush);
1131+
1132+ return flush;
11511133 }
11521134
11531135 typedef bool (*tdp_handler_t)(struct kvm *kvm, struct tdp_iter *iter,
arch/x86/kvm/mmu/tdp_mmu.h+2−3
@@ -7,7 +7,7 @@ · 6 unmodified lines
77
88 #include "spte.h"
99
10−int kvm_mmu_init_tdp_mmu(struct kvm *kvm);
10+void kvm_mmu_init_tdp_mmu(struct kvm *kvm);
1111 void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm);
1212
1313 hpa_t kvm_tdp_mmu_get_vcpu_root_hpa(struct kvm_vcpu *vcpu);
@@ -20,8 +20,7 @@ __must_check static inline bool kvm_tdp_mmu_get_root(struct kvm_mmu_page *root) · 6 unmodified lines
2020 void kvm_tdp_mmu_put_root(struct kvm *kvm, struct kvm_mmu_page *root,
2121 bool shared);
2222
23−bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, int as_id, gfn_t start,
24− gfn_t end, bool can_yield, bool flush);
23+bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, gfn_t start, gfn_t end, bool flush);
2524 bool kvm_tdp_mmu_zap_sp(struct kvm *kvm, struct kvm_mmu_page *sp);
2625 void kvm_tdp_mmu_zap_all(struct kvm *kvm);
2726 void kvm_tdp_mmu_invalidate_all_roots(struct kvm *kvm);
arch/x86/kvm/svm/sev.c+26−8
@@ -2962,6 +2962,32 @@ int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in) · 2961 unmodified lines
29622962 count, in);
29632963 }
29642964
2965+static void sev_es_vcpu_after_set_cpuid(struct vcpu_svm *svm)
2966+{
2967+ struct kvm_vcpu *vcpu = &svm->vcpu;
2968+
2969+ if (boot_cpu_has(X86_FEATURE_V_TSC_AUX)) {
2970+ bool v_tsc_aux = guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP) ||
2971+ guest_cpuid_has(vcpu, X86_FEATURE_RDPID);
2972+
2973+ set_msr_interception(vcpu, svm->msrpm, MSR_TSC_AUX, v_tsc_aux, v_tsc_aux);
2974+ }
2975+}
2976+
2977+void sev_vcpu_after_set_cpuid(struct vcpu_svm *svm)
2978+{
2979+ struct kvm_vcpu *vcpu = &svm->vcpu;
2980+ struct kvm_cpuid_entry2 *best;
2981+
2982+ /* For sev guests, the memory encryption bit is not reserved in CR3. */
2983+ best = kvm_find_cpuid_entry(vcpu, 0x8000001F);
2984+ if (best)
2985+ vcpu->arch.reserved_gpa_bits &= ~(1UL << (best->ebx & 0x3f));
2986+
2987+ if (sev_es_guest(svm->vcpu.kvm))
2988+ sev_es_vcpu_after_set_cpuid(svm);
2989+}
2990+
29652991 static void sev_es_init_vmcb(struct vcpu_svm *svm)
29662992 {
29672993 struct vmcb *vmcb = svm->vmcb01.ptr;
@@ -3024,14 +3050,6 @@ static void sev_es_init_vmcb(struct vcpu_svm *svm) · 56 unmodified lines
30243050 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTBRANCHTOIP, 1, 1);
30253051 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTINTFROMIP, 1, 1);
30263052 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTINTTOIP, 1, 1);
3027−
3028− if (boot_cpu_has(X86_FEATURE_V_TSC_AUX) &&
3029− (guest_cpuid_has(&svm->vcpu, X86_FEATURE_RDTSCP) ||
3030− guest_cpuid_has(&svm->vcpu, X86_FEATURE_RDPID))) {
3031− set_msr_interception(vcpu, svm->msrpm, MSR_TSC_AUX, 1, 1);
3032− if (guest_cpuid_has(&svm->vcpu, X86_FEATURE_RDTSCP))
3033− svm_clr_intercept(svm, INTERCEPT_RDTSCP);
3034− }
30353053 }
30363054
30373055 void sev_init_vmcb(struct vcpu_svm *svm)
arch/x86/kvm/svm/svm.c+35−8
@@ -683,6 +683,21 @@ static int svm_hardware_enable(void) · 682 unmodified lines
683683
684684 amd_pmu_enable_virt();
685685
686+ /*
687+ * If TSC_AUX virtualization is supported, TSC_AUX becomes a swap type
688+ * "B" field (see sev_es_prepare_switch_to_guest()) for SEV-ES guests.
689+ * Since Linux does not change the value of TSC_AUX once set, prime the
690+ * TSC_AUX field now to avoid a RDMSR on every vCPU run.
691+ */
692+ if (boot_cpu_has(X86_FEATURE_V_TSC_AUX)) {
693+ struct sev_es_save_area *hostsa;
694+ u32 msr_hi;
695+
696+ hostsa = (struct sev_es_save_area *)(page_address(sd->save_area) + 0x400);
697+
698+ rdmsr(MSR_TSC_AUX, hostsa->tsc_aux, msr_hi);
699+ }
700+
686701 return 0;
687702 }
688703
@@ -1532,7 +1547,14 @@ static void svm_prepare_switch_to_guest(struct kvm_vcpu *vcpu) · 843 unmodified lines
15321547 if (tsc_scaling)
15331548 __svm_write_tsc_multiplier(vcpu->arch.tsc_scaling_ratio);
15341549
1535− if (likely(tsc_aux_uret_slot >= 0))
1550+ /*
1551+ * TSC_AUX is always virtualized for SEV-ES guests when the feature is
1552+ * available. The user return MSR support is not required in this case
1553+ * because TSC_AUX is restored on #VMEXIT from the host save area
1554+ * (which has been initialized in svm_hardware_enable()).
1555+ */
1556+ if (likely(tsc_aux_uret_slot >= 0) &&
1557+ (!boot_cpu_has(X86_FEATURE_V_TSC_AUX) || !sev_es_guest(vcpu->kvm)))
15361558 kvm_set_user_return_msr(tsc_aux_uret_slot, svm->tsc_aux, -1ull);
15371559
15381560 svm->guest_state_loaded = true;
@@ -3086,6 +3108,16 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) · 1547 unmodified lines
30863108 svm->sysenter_esp_hi = guest_cpuid_is_intel(vcpu) ? (data >> 32) : 0;
30873109 break;
30883110 case MSR_TSC_AUX:
3111+ /*
3112+ * TSC_AUX is always virtualized for SEV-ES guests when the
3113+ * feature is available. The user return MSR support is not
3114+ * required in this case because TSC_AUX is restored on #VMEXIT
3115+ * from the host save area (which has been initialized in
3116+ * svm_hardware_enable()).
3117+ */
3118+ if (boot_cpu_has(X86_FEATURE_V_TSC_AUX) && sev_es_guest(vcpu->kvm))
3119+ break;
3120+
30893121 /*
30903122 * TSC_AUX is usually changed only during boot and never read
30913123 * directly. Intercept TSC_AUX instead of exposing it to the
@@ -4284,7 +4316,6 @@ static bool svm_has_emulated_msr(struct kvm *kvm, u32 index) · 1192 unmodified lines
42844316 static void svm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
42854317 {
42864318 struct vcpu_svm *svm = to_svm(vcpu);
4287− struct kvm_cpuid_entry2 *best;
42884319
42894320 /*
42904321 * SVM doesn't provide a way to disable just XSAVES in the guest, KVM
@@ -4328,12 +4359,8 @@ static void svm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · 37 unmodified lines
43284359 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_FLUSH_CMD, 0,
43294360 !!guest_cpuid_has(vcpu, X86_FEATURE_FLUSH_L1D));
43304361
4331− /* For sev guests, the memory encryption bit is not reserved in CR3. */
4332− if (sev_guest(vcpu->kvm)) {
4333− best = kvm_find_cpuid_entry(vcpu, 0x8000001F);
4334− if (best)
4335− vcpu->arch.reserved_gpa_bits &= ~(1UL << (best->ebx & 0x3f));
4336− }
4362+ if (sev_guest(vcpu->kvm))
4363+ sev_vcpu_after_set_cpuid(svm);
43374364
43384365 init_vmcb_after_set_cpuid(vcpu);
43394366 }
arch/x86/kvm/svm/svm.h+1−0
@@ -684,6 +684,7 @@ void __init sev_hardware_setup(void); · 683 unmodified lines
684684 void sev_hardware_unsetup(void);
685685 int sev_cpu_init(struct svm_cpu_data *sd);
686686 void sev_init_vmcb(struct vcpu_svm *svm);
687+void sev_vcpu_after_set_cpuid(struct vcpu_svm *svm);
687688 void sev_free_vcpu(struct kvm_vcpu *vcpu);
688689 int sev_handle_vmgexit(struct kvm_vcpu *vcpu);
689690 int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in);
arch/x86/kvm/x86.c+1−4
@@ -12308,9 +12308,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 12307 unmodified lines
1230812308 if (ret)
1230912309 goto out;
1231012310
12311− ret = kvm_mmu_init_vm(kvm);
12312− if (ret)
12313− goto out_page_track;
12311+ kvm_mmu_init_vm(kvm);
1231412312
1231512313 ret = static_call(kvm_x86_vm_init)(kvm);
1231612314 if (ret)
@@ -12355,7 +12353,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 38 unmodified lines
1235512353
1235612354 out_uninit_mmu:
1235712355 kvm_mmu_uninit_vm(kvm);
12358−out_page_track:
1235912356 kvm_page_track_cleanup(kvm);
1236012357 out:
1236112358 return ret;
arch/x86/lib/memcpy_64.S+1−1
@@ -40,7 +40,7 @@ SYM_TYPED_FUNC_START(__memcpy) · 39 unmodified lines
4040 SYM_FUNC_END(__memcpy)
4141 EXPORT_SYMBOL(__memcpy)
4242
43−SYM_FUNC_ALIAS(memcpy, __memcpy)
43+SYM_FUNC_ALIAS_MEMFUNC(memcpy, __memcpy)
4444 EXPORT_SYMBOL(memcpy)
4545
4646 SYM_FUNC_START_LOCAL(memcpy_orig)
arch/x86/lib/memmove_64.S+1−1
@@ -212,5 +212,5 @@ SYM_FUNC_START(__memmove) · 211 unmodified lines
212212 SYM_FUNC_END(__memmove)
213213 EXPORT_SYMBOL(__memmove)
214214
215−SYM_FUNC_ALIAS(memmove, __memmove)
215+SYM_FUNC_ALIAS_MEMFUNC(memmove, __memmove)
216216 EXPORT_SYMBOL(memmove)
arch/x86/lib/memset_64.S+1−1
@@ -40,7 +40,7 @@ SYM_FUNC_START(__memset) · 39 unmodified lines
4040 SYM_FUNC_END(__memset)
4141 EXPORT_SYMBOL(__memset)
4242
43−SYM_FUNC_ALIAS(memset, __memset)
43+SYM_FUNC_ALIAS_MEMFUNC(memset, __memset)
4444 EXPORT_SYMBOL(memset)
4545
4646 SYM_FUNC_START_LOCAL(memset_orig)
arch/xtensa/boot/Makefile+1−2
@@ -9,8 +9,7 @@ · 8 unmodified lines
99
1010
1111 # KBUILD_CFLAGS used when building rest of boot (takes effect recursively)
12−KBUILD_CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include
13−HOSTFLAGS += -Iarch/$(ARCH)/boot/include
12+KBUILD_CFLAGS += -fno-builtin
1413
1514 subdir-y := lib
1615 targets += vmlinux.bin vmlinux.bin.gz
arch/xtensa/boot/lib/zmem.c+3−2
@@ -4,13 +4,14 @@ · 3 unmodified lines
44 /* bits taken from ppc */
55
66 extern void *avail_ram, *end_avail;
7+void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp);
78
8−void exit (void)
9+static void exit(void)
910 {
1011 for (;;);
1112 }
1213
13−void *zalloc(unsigned size)
14+static void *zalloc(unsigned int size)
1415 {
1516 void *p = avail_ram;
1617
arch/xtensa/include/asm/core.h+4−0
@@ -6,6 +6,10 @@ · 5 unmodified lines
66
77 #include <variant/core.h>
88
9+#ifndef XCHAL_HAVE_DIV32
10+#define XCHAL_HAVE_DIV32 0
11+#endif
12+
913 #ifndef XCHAL_HAVE_EXCLUSIVE
1014 #define XCHAL_HAVE_EXCLUSIVE 0
1115 #endif
arch/xtensa/include/asm/hw_breakpoint.h+1−0
@@ -48,6 +48,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp); · 47 unmodified lines
4848 void hw_breakpoint_pmu_read(struct perf_event *bp);
4949 int check_hw_breakpoint(struct pt_regs *regs);
5050 void clear_ptrace_hw_breakpoint(struct task_struct *tsk);
51+void restore_dbreak(void);
5152
5253 #else
5354
arch/xtensa/include/asm/processor.h+5−0
@@ -14,6 +14,8 @@ · 13 unmodified lines
1414
1515 #include <linux/compiler.h>
1616 #include <linux/stringify.h>
17+
18+#include <asm/bootparam.h>
1719 #include <asm/ptrace.h>
1820 #include <asm/types.h>
1921 #include <asm/regs.h>
@@ -217,6 +219,9 @@ struct mm_struct; · 197 unmodified lines
217219
218220 extern unsigned long __get_wchan(struct task_struct *p);
219221
222+void init_arch(bp_tag_t *bp_start);
223+void do_notify_resume(struct pt_regs *regs);
224+
220225 #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
221226 #define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1])
222227
arch/xtensa/include/asm/ptrace.h+3−0
@@ -106,6 +106,9 @@ static inline unsigned long regs_return_value(struct pt_regs *regs) · 105 unmodified lines
106106 return regs->areg[2];
107107 }
108108
109+int do_syscall_trace_enter(struct pt_regs *regs);
110+void do_syscall_trace_leave(struct pt_regs *regs);
111+
109112 #else /* __ASSEMBLY__ */
110113
111114 # include <asm/asm-offsets.h>
arch/xtensa/include/asm/smp.h+1−0
@@ -23,6 +23,7 @@ struct cpumask; · 22 unmodified lines
2323 void arch_send_call_function_ipi_mask(const struct cpumask *mask);
2424 void arch_send_call_function_single_ipi(int cpu);
2525
26+void secondary_start_kernel(void);
2627 void smp_init_cpus(void);
2728 void secondary_init_irq(void);
2829 void ipi_init(void);
arch/xtensa/include/asm/tlb.h+2−0
@@ -18,4 +18,6 @@ · 17 unmodified lines
1818
1919 #define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte)
2020
21+void check_tlb_sanity(void);
22+
2123 #endif /* _XTENSA_TLB_H */
arch/xtensa/kernel/hw_breakpoint.c+1−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/percpu.h>
1414 #include <linux/perf_event.h>
1515 #include <asm/core.h>
16+#include <asm/hw_breakpoint.h>
1617
1718 /* Breakpoint currently in use for each IBREAKA. */
1819 static DEFINE_PER_CPU(struct perf_event *, bp_on_reg[XCHAL_NUM_IBREAK]);
arch/xtensa/kernel/irq.c+1−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <asm/mxregs.h>
2929 #include <linux/uaccess.h>
3030 #include <asm/platform.h>
31+#include <asm/traps.h>
3132
3233 DECLARE_PER_CPU(unsigned long, nmi_count);
3334
arch/xtensa/kernel/ptrace.c+0−1
@@ -541,7 +541,6 @@ long arch_ptrace(struct task_struct *child, long request, · 540 unmodified lines
541541 return ret;
542542 }
543543
544−void do_syscall_trace_leave(struct pt_regs *regs);
545544 int do_syscall_trace_enter(struct pt_regs *regs)
546545 {
547546 if (regs->syscall == NO_SYSCALL)
arch/xtensa/kernel/signal.c+2−0
@@ -26,6 +26,8 @@ · 25 unmodified lines
2626 #include <linux/uaccess.h>
2727 #include <asm/cacheflush.h>
2828 #include <asm/coprocessor.h>
29+#include <asm/processor.h>
30+#include <asm/syscall.h>
2931 #include <asm/unistd.h>
3032
3133 extern struct task_struct *coproc_owners[];
arch/xtensa/kernel/smp.c+1−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/irq.h>
2222 #include <linux/kdebug.h>
2323 #include <linux/module.h>
24+#include <linux/profile.h>
2425 #include <linux/sched/mm.h>
2526 #include <linux/sched/hotplug.h>
2627 #include <linux/sched/task_stack.h>
arch/xtensa/kernel/stacktrace.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/sched.h>
1313 #include <linux/stacktrace.h>
1414
15+#include <asm/ftrace.h>
1516 #include <asm/stacktrace.h>
1617 #include <asm/traps.h>
1718 #include <linux/uaccess.h>
arch/xtensa/kernel/traps.c+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 * for more details.
2424 */
2525
26+#include <linux/cpu.h>
2627 #include <linux/kernel.h>
2728 #include <linux/sched/signal.h>
2829 #include <linux/sched/debug.h>
arch/xtensa/lib/umulsidi3.S+3−1
@@ -3,7 +3,9 @@ · 2 unmodified lines
33 #include <asm/asmmacro.h>
44 #include <asm/core.h>
55
6−#if !XCHAL_HAVE_MUL16 && !XCHAL_HAVE_MUL32 && !XCHAL_HAVE_MAC16
6+#if XCHAL_HAVE_MUL16 || XCHAL_HAVE_MUL32 || XCHAL_HAVE_MAC16
7+#define XCHAL_NO_MUL 0
8+#else
79 #define XCHAL_NO_MUL 1
810 #endif
911
arch/xtensa/mm/fault.c+1−0
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <asm/mmu_context.h>
2121 #include <asm/cacheflush.h>
2222 #include <asm/hardirq.h>
23+#include <asm/traps.h>
2324
2425 void bad_page_fault(struct pt_regs*, unsigned long, int);
2526
arch/xtensa/mm/tlb.c+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/mm.h>
1818 #include <asm/processor.h>
1919 #include <asm/mmu_context.h>
20+#include <asm/tlb.h>
2021 #include <asm/tlbflush.h>
2122 #include <asm/cacheflush.h>
2223
arch/xtensa/platforms/iss/network.c+2−2
@@ -201,7 +201,7 @@ static int tuntap_write(struct iss_net_private *lp, struct sk_buff **skb) · 200 unmodified lines
201201 return simc_write(lp->tp.info.tuntap.fd, (*skb)->data, (*skb)->len);
202202 }
203203
204−unsigned short tuntap_protocol(struct sk_buff *skb)
204+static unsigned short tuntap_protocol(struct sk_buff *skb)
205205 {
206206 return eth_type_trans(skb, skb->dev);
207207 }
@@ -441,7 +441,7 @@ static int iss_net_change_mtu(struct net_device *dev, int new_mtu) · 233 unmodified lines
441441 return -EINVAL;
442442 }
443443
444−void iss_net_user_timer_expire(struct timer_list *unused)
444+static void iss_net_user_timer_expire(struct timer_list *unused)
445445 {
446446 }
447447
block/blk-rq-qos.c+1−1
@@ -270,7 +270,7 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data, · 269 unmodified lines
270270 finish_wait(&rqw->wait, &data.wq);
271271
272272 /*
273− * We raced with wbt_wake_function() getting a token,
273+ * We raced with rq_qos_wake_function() getting a token,
274274 * which means we now have two. Put our local token
275275 * and wake anyone else potentially waiting for one.
276276 */
block/disk-events.c+0−1
@@ -290,7 +290,6 @@ EXPORT_SYMBOL(disk_check_media_change); · 289 unmodified lines
290290 /**
291291 * disk_force_media_change - force a media change event
292292 * @disk: the disk which will raise the event
293− * @events: the events to raise
294293 *
295294 * Should be called when the media changes for @disk. Generates a uevent
296295 * and attempts to free all dentries and inodes and invalidates all block
crypto/sm2.c+5−1
@@ -278,10 +278,14 @@ int sm2_compute_z_digest(struct shash_desc *desc, · 277 unmodified lines
278278 if (!ec)
279279 return -ENOMEM;
280280
281− err = __sm2_set_pub_key(ec, key, keylen);
281+ err = sm2_ec_ctx_init(ec);
282282 if (err)
283283 goto out_free_ec;
284284
285+ err = __sm2_set_pub_key(ec, key, keylen);
286+ if (err)
287+ goto out_deinit_ec;
288+
285289 bits_len = SM2_DEFAULT_USERID_LEN * 8;
286290 entl[0] = bits_len >> 8;
287291 entl[1] = bits_len & 0xff;
drivers/accel/ivpu/ivpu_drv.c+2−1
@@ -327,7 +327,7 @@ static int ivpu_wait_for_ready(struct ivpu_device *vdev) · 326 unmodified lines
327327 }
328328
329329 if (!ret)
330− ivpu_info(vdev, "VPU ready message received successfully\n");
330+ ivpu_dbg(vdev, PM, "VPU ready message received successfully\n");
331331 else
332332 ivpu_hw_diagnose_failure(vdev);
333333
@@ -634,6 +634,7 @@ static void ivpu_dev_fini(struct ivpu_device *vdev) · 300 unmodified lines
634634
635635 static struct pci_device_id ivpu_pci_ids[] = {
636636 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_MTL) },
637+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_ARL) },
637638 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_LNL) },
638639 { }
639640 };
drivers/accel/ivpu/ivpu_drv.h+2−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #define DRIVER_DATE "20230117"
2424
2525 #define PCI_DEVICE_ID_MTL 0x7d1d
26+#define PCI_DEVICE_ID_ARL 0xad1d
2627 #define PCI_DEVICE_ID_LNL 0x643e
2728
2829 #define IVPU_HW_37XX 37
@@ -165,6 +166,7 @@ static inline int ivpu_hw_gen(struct ivpu_device *vdev) · 136 unmodified lines
165166 {
166167 switch (ivpu_device_id(vdev)) {
167168 case PCI_DEVICE_ID_MTL:
169+ case PCI_DEVICE_ID_ARL:
168170 return IVPU_HW_37XX;
169171 case PCI_DEVICE_ID_LNL:
170172 return IVPU_HW_40XX;
drivers/accel/ivpu/ivpu_fw.c+5−3
@@ -220,7 +220,8 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev) · 219 unmodified lines
220220 if (ret)
221221 return ret;
222222
223− fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size, DRM_IVPU_BO_WC);
223+ fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size,
224+ DRM_IVPU_BO_CACHED | DRM_IVPU_BO_NOSNOOP);
224225 if (!fw->mem) {
225226 ivpu_err(vdev, "Failed to allocate firmware runtime memory\n");
226227 return -ENOMEM;
@@ -330,7 +331,7 @@ int ivpu_fw_load(struct ivpu_device *vdev) · 103 unmodified lines
330331 memset(start, 0, size);
331332 }
332333
333− wmb(); /* Flush WC buffers after writing fw->mem */
334+ clflush_cache_range(fw->mem->kvaddr, fw->mem->base.size);
334335
335336 return 0;
336337 }
@@ -432,6 +433,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params · 95 unmodified lines
432433 if (!ivpu_fw_is_cold_boot(vdev)) {
433434 boot_params->save_restore_ret_address = 0;
434435 vdev->pm->is_warmboot = true;
436+ clflush_cache_range(vdev->fw->mem->kvaddr, SZ_4K);
435437 return;
436438 }
437439
@@ -493,7 +495,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params · 55 unmodified lines
493495 boot_params->punit_telemetry_sram_size = ivpu_hw_reg_telemetry_size_get(vdev);
494496 boot_params->vpu_telemetry_enable = ivpu_hw_reg_telemetry_enable_get(vdev);
495497
496− wmb(); /* Flush WC buffers after writing bootparams */
498+ clflush_cache_range(vdev->fw->mem->kvaddr, SZ_4K);
497499
498500 ivpu_fw_boot_params_print(vdev, boot_params);
499501 }
drivers/accel/ivpu/ivpu_gem.h+5−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #include <drm/drm_gem.h>
99 #include <drm/drm_mm.h>
1010
11+#define DRM_IVPU_BO_NOSNOOP 0x10000000
12+
1113 struct dma_buf;
1214 struct ivpu_bo_ops;
1315 struct ivpu_file_priv;
@@ -83,6 +85,9 @@ static inline u32 ivpu_bo_cache_mode(struct ivpu_bo *bo) · 69 unmodified lines
8385
8486 static inline bool ivpu_bo_is_snooped(struct ivpu_bo *bo)
8587 {
88+ if (bo->flags & DRM_IVPU_BO_NOSNOOP)
89+ return false;
90+
8691 return ivpu_bo_cache_mode(bo) == DRM_IVPU_BO_CACHED;
8792 }
8893
drivers/accel/ivpu/ivpu_hw_40xx.c+23−4
@@ -57,8 +57,7 @@ · 56 unmodified lines
5757
5858 #define ICB_0_1_IRQ_MASK ((((u64)ICB_1_IRQ_MASK) << 32) | ICB_0_IRQ_MASK)
5959
60−#define BUTTRESS_IRQ_MASK ((REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, FREQ_CHANGE)) | \
61− (REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, ATS_ERR)) | \
60+#define BUTTRESS_IRQ_MASK ((REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, ATS_ERR)) | \
6261 (REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, CFI0_ERR)) | \
6362 (REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, CFI1_ERR)) | \
6463 (REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, IMR0_ERR)) | \
@@ -196,6 +195,14 @@ static int ivpu_pll_wait_for_status_ready(struct ivpu_device *vdev) · 131 unmodified lines
196195 return REGB_POLL_FLD(VPU_40XX_BUTTRESS_VPU_STATUS, READY, 1, PLL_TIMEOUT_US);
197196 }
198197
198+static int ivpu_wait_for_clock_own_resource_ack(struct ivpu_device *vdev)
199+{
200+ if (ivpu_is_simics(vdev))
201+ return 0;
202+
203+ return REGB_POLL_FLD(VPU_40XX_BUTTRESS_VPU_STATUS, CLOCK_RESOURCE_OWN_ACK, 1, TIMEOUT_US);
204+}
205+
199206 static void ivpu_pll_init_frequency_ratios(struct ivpu_device *vdev)
200207 {
201208 struct ivpu_hw_info *hw = vdev->hw;
@@ -556,6 +563,12 @@ static int ivpu_boot_pwr_domain_enable(struct ivpu_device *vdev) · 354 unmodified lines
556563 {
557564 int ret;
558565
566+ ret = ivpu_wait_for_clock_own_resource_ack(vdev);
567+ if (ret) {
568+ ivpu_err(vdev, "Timed out waiting for clock own resource ACK\n");
569+ return ret;
570+ }
571+
559572 ivpu_boot_pwr_island_trickle_drive(vdev, true);
560573 ivpu_boot_pwr_island_drive(vdev, true);
561574
@@ -1046,8 +1059,6 @@ static irqreturn_t ivpu_hw_40xx_irqb_handler(struct ivpu_device *vdev, int irq) · 484 unmodified lines
10461059 if (status == 0)
10471060 return IRQ_NONE;
10481061
1049− REGB_WR32(VPU_40XX_BUTTRESS_INTERRUPT_STAT, status);
1050−
10511062 if (REG_TEST_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, FREQ_CHANGE, status))
10521063 ivpu_dbg(vdev, IRQ, "FREQ_CHANGE");
10531064
@@ -1092,6 +1103,9 @@ static irqreturn_t ivpu_hw_40xx_irqb_handler(struct ivpu_device *vdev, int irq) · 38 unmodified lines
10921103 schedule_recovery = true;
10931104 }
10941105
1106+ /* This must be done after interrupts are cleared at the source. */
1107+ REGB_WR32(VPU_40XX_BUTTRESS_INTERRUPT_STAT, status);
1108+
10951109 if (schedule_recovery)
10961110 ivpu_pm_schedule_recovery(vdev);
10971111
@@ -1103,9 +1117,14 @@ static irqreturn_t ivpu_hw_40xx_irq_handler(int irq, void *ptr) · 5 unmodified lines
11031117 struct ivpu_device *vdev = ptr;
11041118 irqreturn_t ret = IRQ_NONE;
11051119
1120+ REGB_WR32(VPU_40XX_BUTTRESS_GLOBAL_INT_MASK, 0x1);
1121+
11061122 ret |= ivpu_hw_40xx_irqv_handler(vdev, irq);
11071123 ret |= ivpu_hw_40xx_irqb_handler(vdev, irq);
11081124
1125+ /* Re-enable global interrupts to re-trigger MSI for pending interrupts */
1126+ REGB_WR32(VPU_40XX_BUTTRESS_GLOBAL_INT_MASK, 0x0);
1127+
11091128 if (ret & IRQ_WAKE_THREAD)
11101129 return IRQ_WAKE_THREAD;
11111130
drivers/accel/ivpu/ivpu_hw_40xx_reg.h+2−0
@@ -70,6 +70,8 @@ · 69 unmodified lines
7070 #define VPU_40XX_BUTTRESS_VPU_STATUS_READY_MASK BIT_MASK(0)
7171 #define VPU_40XX_BUTTRESS_VPU_STATUS_IDLE_MASK BIT_MASK(1)
7272 #define VPU_40XX_BUTTRESS_VPU_STATUS_DUP_IDLE_MASK BIT_MASK(2)
73+#define VPU_40XX_BUTTRESS_VPU_STATUS_CLOCK_RESOURCE_OWN_ACK_MASK BIT_MASK(6)
74+#define VPU_40XX_BUTTRESS_VPU_STATUS_POWER_RESOURCE_OWN_ACK_MASK BIT_MASK(7)
7375 #define VPU_40XX_BUTTRESS_VPU_STATUS_PERF_CLK_MASK BIT_MASK(11)
7476 #define VPU_40XX_BUTTRESS_VPU_STATUS_DISABLE_CLK_RELINQUISH_MASK BIT_MASK(12)
7577
drivers/accel/ivpu/ivpu_ipc.c+4−7
@@ -209,10 +209,10 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, · 208 unmodified lines
209209 struct ivpu_ipc_rx_msg *rx_msg;
210210 int wait_ret, ret = 0;
211211
212− wait_ret = wait_event_interruptible_timeout(cons->rx_msg_wq,
213− (IS_KTHREAD() && kthread_should_stop()) ||
214− !list_empty(&cons->rx_msg_list),
215− msecs_to_jiffies(timeout_ms));
212+ wait_ret = wait_event_timeout(cons->rx_msg_wq,
213+ (IS_KTHREAD() && kthread_should_stop()) ||
214+ !list_empty(&cons->rx_msg_list),
215+ msecs_to_jiffies(timeout_ms));
216216
217217 if (IS_KTHREAD() && kthread_should_stop())
218218 return -EINTR;
@@ -220,9 +220,6 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, · 1 unmodified line
220220 if (wait_ret == 0)
221221 return -ETIMEDOUT;
222222
223− if (wait_ret < 0)
224− return -ERESTARTSYS;
225−
226223 spin_lock_irq(&cons->rx_msg_lock);
227224 rx_msg = list_first_entry_or_null(&cons->rx_msg_list, struct ivpu_ipc_rx_msg, link);
228225 if (!rx_msg) {
drivers/acpi/acpi_video.c+5−2
@@ -2057,7 +2057,9 @@ static int acpi_video_bus_add(struct acpi_device *device) · 2056 unmodified lines
20572057 !auto_detect)
20582058 acpi_video_bus_register_backlight(video);
20592059
2060− acpi_video_bus_add_notify_handler(video);
2060+ error = acpi_video_bus_add_notify_handler(video);
2061+ if (error)
2062+ goto err_del;
20612063
20622064 error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
20632065 acpi_video_bus_notify);
@@ -2067,10 +2069,11 @@ static int acpi_video_bus_add(struct acpi_device *device) · 3 unmodified lines
20672069 return 0;
20682070
20692071 err_remove:
2072+ acpi_video_bus_remove_notify_handler(video);
2073+err_del:
20702074 mutex_lock(&video_list_lock);
20712075 list_del(&video->entry);
20722076 mutex_unlock(&video_list_lock);
2073− acpi_video_bus_remove_notify_handler(video);
20742077 acpi_video_bus_unregister_backlight(video);
20752078 err_put_video:
20762079 acpi_video_bus_put_devices(video);
drivers/acpi/nfit/core.c+1−1
@@ -855,7 +855,7 @@ static size_t sizeof_idt(struct acpi_nfit_interleave *idt) · 854 unmodified lines
855855 {
856856 if (idt->header.length < sizeof(*idt))
857857 return 0;
858− return sizeof(*idt) + sizeof(u32) * (idt->line_count - 1);
858+ return sizeof(*idt) + sizeof(u32) * idt->line_count;
859859 }
860860
861861 static bool add_idt(struct acpi_nfit_desc *acpi_desc,
drivers/acpi/processor_pdc.c+1−0
@@ -19,6 +19,7 @@ static void acpi_set_pdc_bits(u32 *buf) · 18 unmodified lines
1919 {
2020 buf[0] = ACPI_PDC_REVISION_ID;
2121 buf[1] = 1;
22+ buf[2] = 0;
2223
2324 /* Twiddle arch-specific bits needed for _PDC */
2425 arch_acpi_set_proc_cap_bits(&buf[2]);
drivers/ata/libata-core.c+137−12
@@ -1972,6 +1972,96 @@ retry: · 1971 unmodified lines
19721972 return rc;
19731973 }
19741974
1975+/**
1976+ * ata_dev_power_set_standby - Set a device power mode to standby
1977+ * @dev: target device
1978+ *
1979+ * Issue a STANDBY IMMEDIATE command to set a device power mode to standby.
1980+ * For an HDD device, this spins down the disks.
1981+ *
1982+ * LOCKING:
1983+ * Kernel thread context (may sleep).
1984+ */
1985+void ata_dev_power_set_standby(struct ata_device *dev)
1986+{
1987+ unsigned long ap_flags = dev->link->ap->flags;
1988+ struct ata_taskfile tf;
1989+ unsigned int err_mask;
1990+
1991+ /* Issue STANDBY IMMEDIATE command only if supported by the device */
1992+ if (dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ZAC)
1993+ return;
1994+
1995+ /*
1996+ * Some odd clown BIOSes issue spindown on power off (ACPI S4 or S5)
1997+ * causing some drives to spin up and down again. For these, do nothing
1998+ * if we are being called on shutdown.
1999+ */
2000+ if ((ap_flags & ATA_FLAG_NO_POWEROFF_SPINDOWN) &&
2001+ system_state == SYSTEM_POWER_OFF)
2002+ return;
2003+
2004+ if ((ap_flags & ATA_FLAG_NO_HIBERNATE_SPINDOWN) &&
2005+ system_entering_hibernation())
2006+ return;
2007+
2008+ ata_tf_init(dev, &tf);
2009+ tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
2010+ tf.protocol = ATA_PROT_NODATA;
2011+ tf.command = ATA_CMD_STANDBYNOW1;
2012+
2013+ ata_dev_notice(dev, "Entering standby power mode\n");
2014+
2015+ err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2016+ if (err_mask)
2017+ ata_dev_err(dev, "STANDBY IMMEDIATE failed (err_mask=0x%x)\n",
2018+ err_mask);
2019+}
2020+
2021+/**
2022+ * ata_dev_power_set_active - Set a device power mode to active
2023+ * @dev: target device
2024+ *
2025+ * Issue a VERIFY command to enter to ensure that the device is in the
2026+ * active power mode. For a spun-down HDD (standby or idle power mode),
2027+ * the VERIFY command will complete after the disk spins up.
2028+ *
2029+ * LOCKING:
2030+ * Kernel thread context (may sleep).
2031+ */
2032+void ata_dev_power_set_active(struct ata_device *dev)
2033+{
2034+ struct ata_taskfile tf;
2035+ unsigned int err_mask;
2036+
2037+ /*
2038+ * Issue READ VERIFY SECTORS command for 1 sector at lba=0 only
2039+ * if supported by the device.
2040+ */
2041+ if (dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ZAC)
2042+ return;
2043+
2044+ ata_tf_init(dev, &tf);
2045+ tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
2046+ tf.protocol = ATA_PROT_NODATA;
2047+ tf.command = ATA_CMD_VERIFY;
2048+ tf.nsect = 1;
2049+ if (dev->flags & ATA_DFLAG_LBA) {
2050+ tf.flags |= ATA_TFLAG_LBA;
2051+ tf.device |= ATA_LBA;
2052+ } else {
2053+ /* CHS */
2054+ tf.lbal = 0x1; /* sect */
2055+ }
2056+
2057+ ata_dev_notice(dev, "Entering active power mode\n");
2058+
2059+ err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2060+ if (err_mask)
2061+ ata_dev_err(dev, "VERIFY failed (err_mask=0x%x)\n",
2062+ err_mask);
2063+}
2064+
19752065 /**
19762066 * ata_read_log_page - read a specific log page
19772067 * @dev: target device
@@ -2529,7 +2619,7 @@ static int ata_dev_config_lba(struct ata_device *dev) · 551 unmodified lines
25292619 {
25302620 const u16 *id = dev->id;
25312621 const char *lba_desc;
2532− char ncq_desc[24];
2622+ char ncq_desc[32];
25332623 int ret;
25342624
25352625 dev->flags |= ATA_DFLAG_LBA;
@@ -5037,17 +5127,19 @@ static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, · 2501 unmodified lines
50375127 struct ata_link *link;
50385128 unsigned long flags;
50395129
5040− /* Previous resume operation might still be in
5041− * progress. Wait for PM_PENDING to clear.
5130+ spin_lock_irqsave(ap->lock, flags);
5131+
5132+ /*
5133+ * A previous PM operation might still be in progress. Wait for
5134+ * ATA_PFLAG_PM_PENDING to clear.
50425135 */
50435136 if (ap->pflags & ATA_PFLAG_PM_PENDING) {
5137+ spin_unlock_irqrestore(ap->lock, flags);
50445138 ata_port_wait_eh(ap);
5045− WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
5139+ spin_lock_irqsave(ap->lock, flags);
50465140 }
50475141
5048− /* request PM ops to EH */
5049− spin_lock_irqsave(ap->lock, flags);
5050−
5142+ /* Request PM operation to EH */
50515143 ap->pm_mesg = mesg;
50525144 ap->pflags |= ATA_PFLAG_PM_PENDING;
50535145 ata_for_each_link(link, ap, HOST_FIRST) {
@@ -5059,10 +5151,8 @@ static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, · 5 unmodified lines
50595151
50605152 spin_unlock_irqrestore(ap->lock, flags);
50615153
5062− if (!async) {
5154+ if (!async)
50635155 ata_port_wait_eh(ap);
5064− WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
5065− }
50665156 }
50675157
50685158 /*
@@ -5078,11 +5168,27 @@ static const unsigned int ata_port_suspend_ehi = ATA_EHI_QUIET · 9 unmodified lines
50785168
50795169 static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg)
50805170 {
5171+ /*
5172+ * We are about to suspend the port, so we do not care about
5173+ * scsi_rescan_device() calls scheduled by previous resume operations.
5174+ * The next resume will schedule the rescan again. So cancel any rescan
5175+ * that is not done yet.
5176+ */
5177+ cancel_delayed_work_sync(&ap->scsi_rescan_task);
5178+
50815179 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, false);
50825180 }
50835181
50845182 static void ata_port_suspend_async(struct ata_port *ap, pm_message_t mesg)
50855183 {
5184+ /*
5185+ * We are about to suspend the port, so we do not care about
5186+ * scsi_rescan_device() calls scheduled by previous resume operations.
5187+ * The next resume will schedule the rescan again. So cancel any rescan
5188+ * that is not done yet.
5189+ */
5190+ cancel_delayed_work_sync(&ap->scsi_rescan_task);
5191+
50865192 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, true);
50875193 }
50885194
@@ -5229,7 +5335,7 @@ EXPORT_SYMBOL_GPL(ata_host_resume); · 140 unmodified lines
52295335 #endif
52305336
52315337 const struct device_type ata_port_type = {
5232− .name = "ata_port",
5338+ .name = ATA_PORT_TYPE_NAME,
52335339 #ifdef CONFIG_PM
52345340 .pm = &ata_port_pm_ops,
52355341 #endif
@@ -5948,11 +6054,30 @@ static void ata_port_detach(struct ata_port *ap) · 712 unmodified lines
59486054 struct ata_link *link;
59496055 struct ata_device *dev;
59506056
5951− /* tell EH we're leaving & flush EH */
6057+ /* Wait for any ongoing EH */
6058+ ata_port_wait_eh(ap);
6059+
6060+ mutex_lock(&ap->scsi_scan_mutex);
59526061 spin_lock_irqsave(ap->lock, flags);
6062+
6063+ /* Remove scsi devices */
6064+ ata_for_each_link(link, ap, HOST_FIRST) {
6065+ ata_for_each_dev(dev, link, ALL) {
6066+ if (dev->sdev) {
6067+ spin_unlock_irqrestore(ap->lock, flags);
6068+ scsi_remove_device(dev->sdev);
6069+ spin_lock_irqsave(ap->lock, flags);
6070+ dev->sdev = NULL;
6071+ }
6072+ }
6073+ }
6074+
6075+ /* Tell EH to disable all devices */
59536076 ap->pflags |= ATA_PFLAG_UNLOADING;
59546077 ata_port_schedule_eh(ap);
6078+
59556079 spin_unlock_irqrestore(ap->lock, flags);
6080+ mutex_unlock(&ap->scsi_scan_mutex);
59566081
59576082 /* wait till EH commits suicide */
59586083 ata_port_wait_eh(ap);
drivers/ata/libata-eh.c+46−2
@@ -147,6 +147,8 @@ ata_eh_cmd_timeout_table[ATA_EH_CMD_TIMEOUT_TABLE_SIZE] = { · 146 unmodified lines
147147 .timeouts = ata_eh_other_timeouts, },
148148 { .commands = CMDS(ATA_CMD_FLUSH, ATA_CMD_FLUSH_EXT),
149149 .timeouts = ata_eh_flush_timeouts },
150+ { .commands = CMDS(ATA_CMD_VERIFY),
151+ .timeouts = ata_eh_reset_timeouts },
150152 };
151153 #undef CMDS
152154
@@ -498,7 +500,19 @@ static void ata_eh_unload(struct ata_port *ap) · 345 unmodified lines
498500 struct ata_device *dev;
499501 unsigned long flags;
500502
501− /* Restore SControl IPM and SPD for the next driver and
503+ /*
504+ * Unless we are restarting, transition all enabled devices to
505+ * standby power mode.
506+ */
507+ if (system_state != SYSTEM_RESTART) {
508+ ata_for_each_link(link, ap, PMP_FIRST) {
509+ ata_for_each_dev(dev, link, ENABLED)
510+ ata_dev_power_set_standby(dev);
511+ }
512+ }
513+
514+ /*
515+ * Restore SControl IPM and SPD for the next driver and
502516 * disable attached devices.
503517 */
504518 ata_for_each_link(link, ap, PMP_FIRST) {
@@ -684,6 +698,10 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) · 179 unmodified lines
684698 ehc->saved_xfer_mode[devno] = dev->xfer_mode;
685699 if (ata_ncq_enabled(dev))
686700 ehc->saved_ncq_enabled |= 1 << devno;
701+
702+ /* If we are resuming, wake up the device */
703+ if (ap->pflags & ATA_PFLAG_RESUMING)
704+ ehc->i.dev_action[devno] |= ATA_EH_SET_ACTIVE;
687705 }
688706 }
689707
@@ -743,6 +761,8 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) · 53 unmodified lines
743761 /* clean up */
744762 spin_lock_irqsave(ap->lock, flags);
745763
764+ ap->pflags &= ~ATA_PFLAG_RESUMING;
765+
746766 if (ap->pflags & ATA_PFLAG_LOADING)
747767 ap->pflags &= ~ATA_PFLAG_LOADING;
748768 else if ((ap->pflags & ATA_PFLAG_SCSI_HOTPLUG) &&
@@ -1218,6 +1238,13 @@ void ata_eh_detach_dev(struct ata_device *dev) · 469 unmodified lines
12181238 struct ata_eh_context *ehc = &link->eh_context;
12191239 unsigned long flags;
12201240
1241+ /*
1242+ * If the device is still enabled, transition it to standby power mode
1243+ * (i.e. spin down HDDs).
1244+ */
1245+ if (ata_dev_enabled(dev))
1246+ ata_dev_power_set_standby(dev);
1247+
12211248 ata_dev_disable(dev);
12221249
12231250 spin_lock_irqsave(ap->lock, flags);
@@ -2305,7 +2332,7 @@ static void ata_eh_link_report(struct ata_link *link) · 1081 unmodified lines
23052332 struct ata_eh_context *ehc = &link->eh_context;
23062333 struct ata_queued_cmd *qc;
23072334 const char *frozen, *desc;
2308− char tries_buf[6] = "";
2335+ char tries_buf[16] = "";
23092336 int tag, nr_failed = 0;
23102337
23112338 if (ehc->i.flags & ATA_EHI_QUIET)
@@ -3016,6 +3043,15 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, · 704 unmodified lines
30163043 if (ehc->i.flags & ATA_EHI_DID_RESET)
30173044 readid_flags |= ATA_READID_POSTRESET;
30183045
3046+ /*
3047+ * When resuming, before executing any command, make sure to
3048+ * transition the device to the active power mode.
3049+ */
3050+ if ((action & ATA_EH_SET_ACTIVE) && ata_dev_enabled(dev)) {
3051+ ata_dev_power_set_active(dev);
3052+ ata_eh_done(link, dev, ATA_EH_SET_ACTIVE);
3053+ }
3054+
30193055 if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) {
30203056 WARN_ON(dev->class == ATA_DEV_PMP);
30213057
@@ -3989,6 +4025,7 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap) · 967 unmodified lines
39894025 unsigned long flags;
39904026 int rc = 0;
39914027 struct ata_device *dev;
4028+ struct ata_link *link;
39924029
39934030 /* are we suspending? */
39944031 spin_lock_irqsave(ap->lock, flags);
@@ -4001,6 +4038,12 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap) · 6 unmodified lines
40014038
40024039 WARN_ON(ap->pflags & ATA_PFLAG_SUSPENDED);
40034040
4041+ /* Set all devices attached to the port in standby mode */
4042+ ata_for_each_link(link, ap, HOST_FIRST) {
4043+ ata_for_each_dev(dev, link, ENABLED)
4044+ ata_dev_power_set_standby(dev);
4045+ }
4046+
40044047 /*
40054048 * If we have a ZPODD attached, check its zero
40064049 * power ready status before the port is frozen.
@@ -4083,6 +4126,7 @@ static void ata_eh_handle_port_resume(struct ata_port *ap) · 76 unmodified lines
40834126 /* update the flags */
40844127 spin_lock_irqsave(ap->lock, flags);
40854128 ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED);
4129+ ap->pflags |= ATA_PFLAG_RESUMING;
40864130 spin_unlock_irqrestore(ap->lock, flags);
40874131 }
40884132 #endif /* CONFIG_PM */
drivers/ata/libata-scsi.c+67−33
@@ -1050,14 +1050,13 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) · 1049 unmodified lines
10501050 }
10511051 } else {
10521052 sdev->sector_size = ata_id_logical_sector_size(dev->id);
1053+
10531054 /*
1054− * Stop the drive on suspend but do not issue START STOP UNIT
1055− * on resume as this is not necessary and may fail: the device
1056− * will be woken up by ata_port_pm_resume() with a port reset
1057− * and device revalidation.
1055+ * Ask the sd driver to issue START STOP UNIT on runtime suspend
1056+ * and resume only. For system level suspend/resume, devices
1057+ * power state is handled directly by libata EH.
10581058 */
1059− sdev->manage_start_stop = 1;
1060− sdev->no_start_on_resume = 1;
1059+ sdev->manage_runtime_start_stop = true;
10611060 }
10621061
10631062 /*
@@ -1089,6 +1088,42 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) · 25 unmodified lines
10891088 return 0;
10901089 }
10911090
1091+/**
1092+ * ata_scsi_slave_alloc - Early setup of SCSI device
1093+ * @sdev: SCSI device to examine
1094+ *
1095+ * This is called from scsi_alloc_sdev() when the scsi device
1096+ * associated with an ATA device is scanned on a port.
1097+ *
1098+ * LOCKING:
1099+ * Defined by SCSI layer. We don't really care.
1100+ */
1101+
1102+int ata_scsi_slave_alloc(struct scsi_device *sdev)
1103+{
1104+ struct ata_port *ap = ata_shost_to_port(sdev->host);
1105+ struct device_link *link;
1106+
1107+ ata_scsi_sdev_config(sdev);
1108+
1109+ /*
1110+ * Create a link from the ata_port device to the scsi device to ensure
1111+ * that PM does suspend/resume in the correct order: the scsi device is
1112+ * consumer (child) and the ata port the supplier (parent).
1113+ */
1114+ link = device_link_add(&sdev->sdev_gendev, &ap->tdev,
1115+ DL_FLAG_STATELESS |
1116+ DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE);
1117+ if (!link) {
1118+ ata_port_err(ap, "Failed to create link to scsi device %s\n",
1119+ dev_name(&sdev->sdev_gendev));
1120+ return -ENODEV;
1121+ }
1122+
1123+ return 0;
1124+}
1125+EXPORT_SYMBOL_GPL(ata_scsi_slave_alloc);
1126+
10921127 /**
10931128 * ata_scsi_slave_config - Set SCSI device attributes
10941129 * @sdev: SCSI device to examine
@@ -1105,14 +1140,11 @@ int ata_scsi_slave_config(struct scsi_device *sdev) · 10 unmodified lines
11051140 {
11061141 struct ata_port *ap = ata_shost_to_port(sdev->host);
11071142 struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
1108− int rc = 0;
1109−
1110− ata_scsi_sdev_config(sdev);
11111143
11121144 if (dev)
1113− rc = ata_scsi_dev_config(sdev, dev);
1145+ return ata_scsi_dev_config(sdev, dev);
11141146
1115− return rc;
1147+ return 0;
11161148 }
11171149 EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
11181150
@@ -1136,6 +1168,8 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev) · 17 unmodified lines
11361168 unsigned long flags;
11371169 struct ata_device *dev;
11381170
1171+ device_link_remove(&sdev->sdev_gendev, &ap->tdev);
1172+
11391173 spin_lock_irqsave(ap->lock, flags);
11401174 dev = __ata_scsi_find_dev(ap, sdev);
11411175 if (dev && dev->sdev) {
@@ -1195,7 +1229,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) · 53 unmodified lines
11951229 }
11961230
11971231 if (cdb[4] & 0x1) {
1198− tf->nsect = 1; /* 1 sector, lba=0 */
1232+ tf->nsect = 1; /* 1 sector, lba=0 */
11991233
12001234 if (qc->dev->flags & ATA_DFLAG_LBA) {
12011235 tf->flags |= ATA_TFLAG_LBA;
@@ -1211,7 +1245,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) · 9 unmodified lines
12111245 tf->lbah = 0x0; /* cyl high */
12121246 }
12131247
1214− tf->command = ATA_CMD_VERIFY; /* READ VERIFY */
1248+ tf->command = ATA_CMD_VERIFY; /* READ VERIFY */
12151249 } else {
12161250 /* Some odd clown BIOSen issue spindown on power off (ACPI S4
12171251 * or S5) causing some drives to spin up and down again.
@@ -1221,7 +1255,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) · 3 unmodified lines
12211255 goto skip;
12221256
12231257 if ((qc->ap->flags & ATA_FLAG_NO_HIBERNATE_SPINDOWN) &&
1224− system_entering_hibernation())
1258+ system_entering_hibernation())
12251259 goto skip;
12261260
12271261 /* Issue ATA STANDBY IMMEDIATE command */
@@ -1835,6 +1869,9 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) · 607 unmodified lines
18351869 hdr[2] = 0x7; /* claim SPC-5 version compatibility */
18361870 }
18371871
1872+ if (args->dev->flags & ATA_DFLAG_CDL)
1873+ hdr[2] = 0xd; /* claim SPC-6 version compatibility */
1874+
18381875 memcpy(rbuf, hdr, sizeof(hdr));
18391876 memcpy(&rbuf[8], "ATA ", 8);
18401877 ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
@@ -4312,7 +4349,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) · 2471 unmodified lines
43124349 break;
43134350
43144351 case MAINTENANCE_IN:
4315− if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES)
4352+ if ((scsicmd[1] & 0x1f) == MI_REPORT_SUPPORTED_OPERATION_CODES)
43164353 ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in);
43174354 else
43184355 ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
@@ -4722,7 +4759,7 @@ void ata_scsi_dev_rescan(struct work_struct *work) · 403 unmodified lines
47224759 struct ata_link *link;
47234760 struct ata_device *dev;
47244761 unsigned long flags;
4725− bool delay_rescan = false;
4762+ int ret = 0;
47264763
47274764 mutex_lock(&ap->scsi_scan_mutex);
47284765 spin_lock_irqsave(ap->lock, flags);
@@ -4731,37 +4768,34 @@ void ata_scsi_dev_rescan(struct work_struct *work) · 2 unmodified lines
47314768 ata_for_each_dev(dev, link, ENABLED) {
47324769 struct scsi_device *sdev = dev->sdev;
47334770
4771+ /*
4772+ * If the port was suspended before this was scheduled,
4773+ * bail out.
4774+ */
4775+ if (ap->pflags & ATA_PFLAG_SUSPENDED)
4776+ goto unlock;
4777+
47344778 if (!sdev)
47354779 continue;
47364780 if (scsi_device_get(sdev))
47374781 continue;
47384782
4739− /*
4740− * If the rescan work was scheduled because of a resume
4741− * event, the port is already fully resumed, but the
4742− * SCSI device may not yet be fully resumed. In such
4743− * case, executing scsi_rescan_device() may cause a
4744− * deadlock with the PM code on device_lock(). Prevent
4745− * this by giving up and retrying rescan after a short
4746− * delay.
4747− */
4748− delay_rescan = sdev->sdev_gendev.power.is_suspended;
4749− if (delay_rescan) {
4750− scsi_device_put(sdev);
4751− break;
4752− }
4753−
47544783 spin_unlock_irqrestore(ap->lock, flags);
4755− scsi_rescan_device(sdev);
4784+ ret = scsi_rescan_device(sdev);
47564785 scsi_device_put(sdev);
47574786 spin_lock_irqsave(ap->lock, flags);
4787+
4788+ if (ret)
4789+ goto unlock;
47584790 }
47594791 }
47604792
4793+unlock:
47614794 spin_unlock_irqrestore(ap->lock, flags);
47624795 mutex_unlock(&ap->scsi_scan_mutex);
47634796
4764− if (delay_rescan)
4797+ /* Reschedule with a delay if scsi_rescan_device() returned an error */
4798+ if (ret)
47654799 schedule_delayed_work(&ap->scsi_rescan_task,
47664800 msecs_to_jiffies(5));
47674801 }
drivers/ata/libata-transport.c+8−1
@@ -266,6 +266,10 @@ void ata_tport_delete(struct ata_port *ap) · 265 unmodified lines
266266 put_device(dev);
267267 }
268268
269+static const struct device_type ata_port_sas_type = {
270+ .name = ATA_PORT_TYPE_NAME,
271+};
272+
269273 /** ata_tport_add - initialize a transport ATA port structure
270274 *
271275 * @parent: parent device
@@ -283,7 +287,10 @@ int ata_tport_add(struct device *parent, · 11 unmodified lines
283287 struct device *dev = &ap->tdev;
284288
285289 device_initialize(dev);
286− dev->type = &ata_port_type;
290+ if (ap->flags & ATA_FLAG_SAS_HOST)
291+ dev->type = &ata_port_sas_type;
292+ else
293+ dev->type = &ata_port_type;
287294
288295 dev->parent = parent;
289296 ata_host_get(ap->host);
drivers/ata/libata.h+4−0
@@ -30,6 +30,8 @@ enum { · 29 unmodified lines
3030 ATA_DNXFER_QUIET = (1 << 31),
3131 };
3232
33+#define ATA_PORT_TYPE_NAME "ata_port"
34+
3335 extern atomic_t ata_print_id;
3436 extern int atapi_passthru16;
3537 extern int libata_fua;
@@ -60,6 +62,8 @@ extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags); · 24 unmodified lines
6062 extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
6163 unsigned int readid_flags);
6264 extern int ata_dev_configure(struct ata_device *dev);
65+extern void ata_dev_power_set_standby(struct ata_device *dev);
66+extern void ata_dev_power_set_active(struct ata_device *dev);
6367 extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit);
6468 extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel);
6569 extern unsigned int ata_dev_set_feature(struct ata_device *dev,
drivers/base/regmap/regcache-rbtree.c+2−1
@@ -453,7 +453,8 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg, · 452 unmodified lines
453453 if (!rbnode)
454454 return -ENOMEM;
455455 regcache_rbtree_set_register(map, rbnode,
456− reg - rbnode->base_reg, value);
456+ (reg - rbnode->base_reg) / map->reg_stride,
457+ value);
457458 regcache_rbtree_insert(map, &rbtree_ctx->root, rbnode);
458459 rbtree_ctx->cached_rbnode = rbnode;
459460 }
drivers/block/rbd.c+225−187
@@ -632,9 +632,8 @@ void rbd_warn(struct rbd_device *rbd_dev, const char *fmt, ...) · 631 unmodified lines
632632 static void rbd_dev_remove_parent(struct rbd_device *rbd_dev);
633633
634634 static int rbd_dev_refresh(struct rbd_device *rbd_dev);
635−static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev);
636−static int rbd_dev_header_info(struct rbd_device *rbd_dev);
637−static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev);
635+static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev,
636+ struct rbd_image_header *header);
638637 static const char *rbd_dev_v2_snap_name(struct rbd_device *rbd_dev,
639638 u64 snap_id);
640639 static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id,
@@ -995,15 +994,24 @@ static void rbd_init_layout(struct rbd_device *rbd_dev) · 354 unmodified lines
995994 RCU_INIT_POINTER(rbd_dev->layout.pool_ns, NULL);
996995 }
997996
997+static void rbd_image_header_cleanup(struct rbd_image_header *header)
998+{
999+ kfree(header->object_prefix);
1000+ ceph_put_snap_context(header->snapc);
1001+ kfree(header->snap_sizes);
1002+ kfree(header->snap_names);
1003+
1004+ memset(header, 0, sizeof(*header));
1005+}
1006+
9981007 /*
9991008 * Fill an rbd image header with information from the given format 1
10001009 * on-disk header.
10011010 */
1002−static int rbd_header_from_disk(struct rbd_device *rbd_dev,
1003− struct rbd_image_header_ondisk *ondisk)
1011+static int rbd_header_from_disk(struct rbd_image_header *header,
1012+ struct rbd_image_header_ondisk *ondisk,
1013+ bool first_time)
10041014 {
1005− struct rbd_image_header *header = &rbd_dev->header;
1006− bool first_time = header->object_prefix == NULL;
10071015 struct ceph_snap_context *snapc;
10081016 char *object_prefix = NULL;
10091017 char *snap_names = NULL;
@@ -1070,11 +1078,6 @@ static int rbd_header_from_disk(struct rbd_device *rbd_dev, · 60 unmodified lines
10701078 if (first_time) {
10711079 header->object_prefix = object_prefix;
10721080 header->obj_order = ondisk->options.order;
1073− rbd_init_layout(rbd_dev);
1074− } else {
1075− ceph_put_snap_context(header->snapc);
1076− kfree(header->snap_names);
1077− kfree(header->snap_sizes);
10781081 }
10791082
10801083 /* The remaining fields always get updated (when we refresh) */
@@ -4859,7 +4862,9 @@ out_req: · 3778 unmodified lines
48594862 * return, the rbd_dev->header field will contain up-to-date
48604863 * information about the image.
48614864 */
4862−static int rbd_dev_v1_header_info(struct rbd_device *rbd_dev)
4865+static int rbd_dev_v1_header_info(struct rbd_device *rbd_dev,
4866+ struct rbd_image_header *header,
4867+ bool first_time)
48634868 {
48644869 struct rbd_image_header_ondisk *ondisk = NULL;
48654870 u32 snap_count = 0;
@@ -4907,7 +4912,7 @@ static int rbd_dev_v1_header_info(struct rbd_device *rbd_dev) · 41 unmodified lines
49074912 snap_count = le32_to_cpu(ondisk->snap_count);
49084913 } while (snap_count != want_count);
49094914
4910− ret = rbd_header_from_disk(rbd_dev, ondisk);
4915+ ret = rbd_header_from_disk(header, ondisk, first_time);
49114916 out:
49124917 kfree(ondisk);
49134918
@@ -4931,39 +4936,6 @@ static void rbd_dev_update_size(struct rbd_device *rbd_dev) · 17 unmodified lines
49314936 }
49324937 }
49334938
4934−static int rbd_dev_refresh(struct rbd_device *rbd_dev)
4935−{
4936− u64 mapping_size;
4937− int ret;
4938−
4939− down_write(&rbd_dev->header_rwsem);
4940− mapping_size = rbd_dev->mapping.size;
4941−
4942− ret = rbd_dev_header_info(rbd_dev);
4943− if (ret)
4944− goto out;
4945−
4946− /*
4947− * If there is a parent, see if it has disappeared due to the
4948− * mapped image getting flattened.
4949− */
4950− if (rbd_dev->parent) {
4951− ret = rbd_dev_v2_parent_info(rbd_dev);
4952− if (ret)
4953− goto out;
4954− }
4955−
4956− rbd_assert(!rbd_is_snap(rbd_dev));
4957− rbd_dev->mapping.size = rbd_dev->header.image_size;
4958−
4959−out:
4960− up_write(&rbd_dev->header_rwsem);
4961− if (!ret && mapping_size != rbd_dev->mapping.size)
4962− rbd_dev_update_size(rbd_dev);
4963−
4964− return ret;
4965−}
4966−
49674939 static const struct blk_mq_ops rbd_mq_ops = {
49684940 .queue_rq = rbd_queue_rq,
49694941 };
@@ -5503,17 +5475,12 @@ static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id, · 533 unmodified lines
55035475 return 0;
55045476 }
55055477
5506−static int rbd_dev_v2_image_size(struct rbd_device *rbd_dev)
5507−{
5508− return _rbd_dev_v2_snap_size(rbd_dev, CEPH_NOSNAP,
5509− &rbd_dev->header.obj_order,
5510− &rbd_dev->header.image_size);
5511−}
5512−
5513−static int rbd_dev_v2_object_prefix(struct rbd_device *rbd_dev)
5478+static int rbd_dev_v2_object_prefix(struct rbd_device *rbd_dev,
5479+ char **pobject_prefix)
55145480 {
55155481 size_t size;
55165482 void *reply_buf;
5483+ char *object_prefix;
55175484 int ret;
55185485 void *p;
55195486
@@ -5531,16 +5498,16 @@ static int rbd_dev_v2_object_prefix(struct rbd_device *rbd_dev) · 11 unmodified lines
55315498 goto out;
55325499
55335500 p = reply_buf;
5534− rbd_dev->header.object_prefix = ceph_extract_encoded_string(&p,
5535− p + ret, NULL, GFP_NOIO);
5501+ object_prefix = ceph_extract_encoded_string(&p, p + ret, NULL,
5502+ GFP_NOIO);
5503+ if (IS_ERR(object_prefix)) {
5504+ ret = PTR_ERR(object_prefix);
5505+ goto out;
5506+ }
55365507 ret = 0;
55375508
5538− if (IS_ERR(rbd_dev->header.object_prefix)) {
5539− ret = PTR_ERR(rbd_dev->header.object_prefix);
5540− rbd_dev->header.object_prefix = NULL;
5541− } else {
5542− dout(" object_prefix = %s\n", rbd_dev->header.object_prefix);
5543− }
5509+ *pobject_prefix = object_prefix;
5510+ dout(" object_prefix = %s\n", object_prefix);
55445511 out:
55455512 kfree(reply_buf);
55465513
@@ -5591,13 +5558,6 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id, · 44 unmodified lines
55915558 return 0;
55925559 }
55935560
5594−static int rbd_dev_v2_features(struct rbd_device *rbd_dev)
5595−{
5596− return _rbd_dev_v2_snap_features(rbd_dev, CEPH_NOSNAP,
5597− rbd_is_ro(rbd_dev),
5598− &rbd_dev->header.features);
5599−}
5600−
56015561 /*
56025562 * These are generic image flags, but since they are used only for
56035563 * object map, store them in rbd_dev->object_map_flags.
@@ -5634,6 +5594,14 @@ struct parent_image_info { · 30 unmodified lines
56345594 u64 overlap;
56355595 };
56365596
5597+static void rbd_parent_info_cleanup(struct parent_image_info *pii)
5598+{
5599+ kfree(pii->pool_ns);
5600+ kfree(pii->image_id);
5601+
5602+ memset(pii, 0, sizeof(*pii));
5603+}
5604+
56375605 /*
56385606 * The caller is responsible for @pii.
56395607 */
@@ -5703,6 +5671,9 @@ static int __get_parent_info(struct rbd_device *rbd_dev, · 63 unmodified lines
57035671 if (pii->has_overlap)
57045672 ceph_decode_64_safe(&p, end, pii->overlap, e_inval);
57055673
5674+ dout("%s pool_id %llu pool_ns %s image_id %s snap_id %llu has_overlap %d overlap %llu\n",
5675+ __func__, pii->pool_id, pii->pool_ns, pii->image_id, pii->snap_id,
5676+ pii->has_overlap, pii->overlap);
57065677 return 0;
57075678
57085679 e_inval:
@@ -5741,14 +5712,17 @@ static int __get_parent_info_legacy(struct rbd_device *rbd_dev, · 32 unmodified lines
57415712 pii->has_overlap = true;
57425713 ceph_decode_64_safe(&p, end, pii->overlap, e_inval);
57435714
5715+ dout("%s pool_id %llu pool_ns %s image_id %s snap_id %llu has_overlap %d overlap %llu\n",
5716+ __func__, pii->pool_id, pii->pool_ns, pii->image_id, pii->snap_id,
5717+ pii->has_overlap, pii->overlap);
57445718 return 0;
57455719
57465720 e_inval:
57475721 return -EINVAL;
57485722 }
57495723
5750−static int get_parent_info(struct rbd_device *rbd_dev,
5751− struct parent_image_info *pii)
5724+static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev,
5725+ struct parent_image_info *pii)
57525726 {
57535727 struct page *req_page, *reply_page;
57545728 void *p;
@@ -5776,7 +5750,7 @@ static int get_parent_info(struct rbd_device *rbd_dev, · 21 unmodified lines
57765750 return ret;
57775751 }
57785752
5779−static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
5753+static int rbd_dev_setup_parent(struct rbd_device *rbd_dev)
57805754 {
57815755 struct rbd_spec *parent_spec;
57825756 struct parent_image_info pii = { 0 };
@@ -5786,37 +5760,12 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) · 3 unmodified lines
57865760 if (!parent_spec)
57875761 return -ENOMEM;
57885762
5789− ret = get_parent_info(rbd_dev, &pii);
5763+ ret = rbd_dev_v2_parent_info(rbd_dev, &pii);
57905764 if (ret)
57915765 goto out_err;
57925766
5793− dout("%s pool_id %llu pool_ns %s image_id %s snap_id %llu has_overlap %d overlap %llu\n",
5794− __func__, pii.pool_id, pii.pool_ns, pii.image_id, pii.snap_id,
5795− pii.has_overlap, pii.overlap);
5796−
5797− if (pii.pool_id == CEPH_NOPOOL || !pii.has_overlap) {
5798− /*
5799− * Either the parent never existed, or we have
5800− * record of it but the image got flattened so it no
5801− * longer has a parent. When the parent of a
5802− * layered image disappears we immediately set the
5803− * overlap to 0. The effect of this is that all new
5804− * requests will be treated as if the image had no
5805− * parent.
5806− *
5807− * If !pii.has_overlap, the parent image spec is not
5808− * applicable. It's there to avoid duplication in each
5809− * snapshot record.
5810− */
5811− if (rbd_dev->parent_overlap) {
5812− rbd_dev->parent_overlap = 0;
5813− rbd_dev_parent_put(rbd_dev);
5814− pr_info("%s: clone image has been flattened\n",
5815− rbd_dev->disk->disk_name);
5816− }
5817−
5767+ if (pii.pool_id == CEPH_NOPOOL || !pii.has_overlap)
58185768 goto out; /* No parent? No problem. */
5819− }
58205769
58215770 /* The ceph file layout needs to fit pool id in 32 bits */
58225771
@@ -5828,58 +5777,46 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) · 5 unmodified lines
58285777 }
58295778
58305779 /*
5831− * The parent won't change (except when the clone is
5832− * flattened, already handled that). So we only need to
5833− * record the parent spec we have not already done so.
5780+ * The parent won't change except when the clone is flattened,
5781+ * so we only need to record the parent image spec once.
58345782 */
5835− if (!rbd_dev->parent_spec) {
5836− parent_spec->pool_id = pii.pool_id;
5837− if (pii.pool_ns && *pii.pool_ns) {
5838− parent_spec->pool_ns = pii.pool_ns;
5839− pii.pool_ns = NULL;
5840− }
5841− parent_spec->image_id = pii.image_id;
5842− pii.image_id = NULL;
5843− parent_spec->snap_id = pii.snap_id;
5844−
5845− rbd_dev->parent_spec = parent_spec;
5846− parent_spec = NULL; /* rbd_dev now owns this */
5783+ parent_spec->pool_id = pii.pool_id;
5784+ if (pii.pool_ns && *pii.pool_ns) {
5785+ parent_spec->pool_ns = pii.pool_ns;
5786+ pii.pool_ns = NULL;
58475787 }
5788+ parent_spec->image_id = pii.image_id;
5789+ pii.image_id = NULL;
5790+ parent_spec->snap_id = pii.snap_id;
5791+
5792+ rbd_assert(!rbd_dev->parent_spec);
5793+ rbd_dev->parent_spec = parent_spec;
5794+ parent_spec = NULL; /* rbd_dev now owns this */
58485795
58495796 /*
5850− * We always update the parent overlap. If it's zero we issue
5851− * a warning, as we will proceed as if there was no parent.
5797+ * Record the parent overlap. If it's zero, issue a warning as
5798+ * we will proceed as if there is no parent.
58525799 */
5853− if (!pii.overlap) {
5854− if (parent_spec) {
5855− /* refresh, careful to warn just once */
5856− if (rbd_dev->parent_overlap)
5857− rbd_warn(rbd_dev,
5858− "clone now standalone (overlap became 0)");
5859− } else {
5860− /* initial probe */
5861− rbd_warn(rbd_dev, "clone is standalone (overlap 0)");
5862− }
5863− }
5800+ if (!pii.overlap)
5801+ rbd_warn(rbd_dev, "clone is standalone (overlap 0)");
58645802 rbd_dev->parent_overlap = pii.overlap;
58655803
58665804 out:
58675805 ret = 0;
58685806 out_err:
5869− kfree(pii.pool_ns);
5870− kfree(pii.image_id);
5807+ rbd_parent_info_cleanup(&pii);
58715808 rbd_spec_put(parent_spec);
58725809 return ret;
58735810 }
58745811
5875−static int rbd_dev_v2_striping_info(struct rbd_device *rbd_dev)
5812+static int rbd_dev_v2_striping_info(struct rbd_device *rbd_dev,
5813+ u64 *stripe_unit, u64 *stripe_count)
58765814 {
58775815 struct {
58785816 __le64 stripe_unit;
58795817 __le64 stripe_count;
58805818 } __attribute__ ((packed)) striping_info_buf = { 0 };
58815819 size_t size = sizeof (striping_info_buf);
5882− void *p;
58835820 int ret;
58845821
58855822 ret = rbd_obj_method_sync(rbd_dev, &rbd_dev->header_oid,
@@ -5891,27 +5828,33 @@ static int rbd_dev_v2_striping_info(struct rbd_device *rbd_dev) · 5 unmodified lines
58915828 if (ret < size)
58925829 return -ERANGE;
58935830
5894− p = &striping_info_buf;
5895− rbd_dev->header.stripe_unit = ceph_decode_64(&p);
5896− rbd_dev->header.stripe_count = ceph_decode_64(&p);
5831+ *stripe_unit = le64_to_cpu(striping_info_buf.stripe_unit);
5832+ *stripe_count = le64_to_cpu(striping_info_buf.stripe_count);
5833+ dout(" stripe_unit = %llu stripe_count = %llu\n", *stripe_unit,
5834+ *stripe_count);
5835+
58975836 return 0;
58985837 }
58995838
5900−static int rbd_dev_v2_data_pool(struct rbd_device *rbd_dev)
5839+static int rbd_dev_v2_data_pool(struct rbd_device *rbd_dev, s64 *data_pool_id)
59015840 {
5902− __le64 data_pool_id;
5841+ __le64 data_pool_buf;
59035842 int ret;
59045843
59055844 ret = rbd_obj_method_sync(rbd_dev, &rbd_dev->header_oid,
59065845 &rbd_dev->header_oloc, "get_data_pool",
5907− NULL, 0, &data_pool_id, sizeof(data_pool_id));
5846+ NULL, 0, &data_pool_buf,
5847+ sizeof(data_pool_buf));
5848+ dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret);
59085849 if (ret < 0)
59095850 return ret;
5910− if (ret < sizeof(data_pool_id))
5851+ if (ret < sizeof(data_pool_buf))
59115852 return -EBADMSG;
59125853
5913− rbd_dev->header.data_pool_id = le64_to_cpu(data_pool_id);
5914− WARN_ON(rbd_dev->header.data_pool_id == CEPH_NOPOOL);
5854+ *data_pool_id = le64_to_cpu(data_pool_buf);
5855+ dout(" data_pool_id = %lld\n", *data_pool_id);
5856+ WARN_ON(*data_pool_id == CEPH_NOPOOL);
5857+
59155858 return 0;
59165859 }
59175860
@@ -6103,7 +6046,8 @@ out_err: · 185 unmodified lines
61036046 return ret;
61046047 }
61056048
6106−static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev)
6049+static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev,
6050+ struct ceph_snap_context **psnapc)
61076051 {
61086052 size_t size;
61096053 int ret;
@@ -6164,9 +6108,7 @@ static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev) · 54 unmodified lines
61646108 for (i = 0; i < snap_count; i++)
61656109 snapc->snaps[i] = ceph_decode_64(&p);
61666110
6167− ceph_put_snap_context(rbd_dev->header.snapc);
6168− rbd_dev->header.snapc = snapc;
6169−
6111+ *psnapc = snapc;
61706112 dout(" snap context seq = %llu, snap_count = %u\n",
61716113 (unsigned long long)seq, (unsigned int)snap_count);
61726114 out:
@@ -6215,38 +6157,42 @@ out: · 42 unmodified lines
62156157 return snap_name;
62166158 }
62176159
6218−static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev)
6160+static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev,
6161+ struct rbd_image_header *header,
6162+ bool first_time)
62196163 {
6220− bool first_time = rbd_dev->header.object_prefix == NULL;
62216164 int ret;
62226165
6223− ret = rbd_dev_v2_image_size(rbd_dev);
6166+ ret = _rbd_dev_v2_snap_size(rbd_dev, CEPH_NOSNAP,
6167+ first_time ? &header->obj_order : NULL,
6168+ &header->image_size);
62246169 if (ret)
62256170 return ret;
62266171
62276172 if (first_time) {
6228− ret = rbd_dev_v2_header_onetime(rbd_dev);
6173+ ret = rbd_dev_v2_header_onetime(rbd_dev, header);
62296174 if (ret)
62306175 return ret;
62316176 }
62326177
6233− ret = rbd_dev_v2_snap_context(rbd_dev);
6234− if (ret && first_time) {
6235− kfree(rbd_dev->header.object_prefix);
6236− rbd_dev->header.object_prefix = NULL;
6237− }
6178+ ret = rbd_dev_v2_snap_context(rbd_dev, &header->snapc);
6179+ if (ret)
6180+ return ret;
62386181
6239− return ret;
6182+ return 0;
62406183 }
62416184
6242−static int rbd_dev_header_info(struct rbd_device *rbd_dev)
6185+static int rbd_dev_header_info(struct rbd_device *rbd_dev,
6186+ struct rbd_image_header *header,
6187+ bool first_time)
62436188 {
62446189 rbd_assert(rbd_image_format_valid(rbd_dev->image_format));
6190+ rbd_assert(!header->object_prefix && !header->snapc);
62456191
62466192 if (rbd_dev->image_format == 1)
6247− return rbd_dev_v1_header_info(rbd_dev);
6193+ return rbd_dev_v1_header_info(rbd_dev, header, first_time);
62486194
6249− return rbd_dev_v2_header_info(rbd_dev);
6195+ return rbd_dev_v2_header_info(rbd_dev, header, first_time);
62506196 }
62516197
62526198 /*
@@ -6734,60 +6680,49 @@ out: · 481 unmodified lines
67346680 */
67356681 static void rbd_dev_unprobe(struct rbd_device *rbd_dev)
67366682 {
6737− struct rbd_image_header *header;
6738−
67396683 rbd_dev_parent_put(rbd_dev);
67406684 rbd_object_map_free(rbd_dev);
67416685 rbd_dev_mapping_clear(rbd_dev);
67426686
67436687 /* Free dynamic fields from the header, then zero it out */
67446688
6745− header = &rbd_dev->header;
6746− ceph_put_snap_context(header->snapc);
6747− kfree(header->snap_sizes);
6748− kfree(header->snap_names);
6749− kfree(header->object_prefix);
6750− memset(header, 0, sizeof (*header));
6689+ rbd_image_header_cleanup(&rbd_dev->header);
67516690 }
67526691
6753−static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev)
6692+static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev,
6693+ struct rbd_image_header *header)
67546694 {
67556695 int ret;
67566696
6757− ret = rbd_dev_v2_object_prefix(rbd_dev);
6697+ ret = rbd_dev_v2_object_prefix(rbd_dev, &header->object_prefix);
67586698 if (ret)
6759− goto out_err;
6699+ return ret;
67606700
67616701 /*
67626702 * Get the and check features for the image. Currently the
67636703 * features are assumed to never change.
67646704 */
6765− ret = rbd_dev_v2_features(rbd_dev);
6705+ ret = _rbd_dev_v2_snap_features(rbd_dev, CEPH_NOSNAP,
6706+ rbd_is_ro(rbd_dev), &header->features);
67666707 if (ret)
6767− goto out_err;
6708+ return ret;
67686709
67696710 /* If the image supports fancy striping, get its parameters */
67706711
6771− if (rbd_dev->header.features & RBD_FEATURE_STRIPINGV2) {
6772− ret = rbd_dev_v2_striping_info(rbd_dev);
6773− if (ret < 0)
6774− goto out_err;
6712+ if (header->features & RBD_FEATURE_STRIPINGV2) {
6713+ ret = rbd_dev_v2_striping_info(rbd_dev, &header->stripe_unit,
6714+ &header->stripe_count);
6715+ if (ret)
6716+ return ret;
67756717 }
67766718
6777− if (rbd_dev->header.features & RBD_FEATURE_DATA_POOL) {
6778− ret = rbd_dev_v2_data_pool(rbd_dev);
6719+ if (header->features & RBD_FEATURE_DATA_POOL) {
6720+ ret = rbd_dev_v2_data_pool(rbd_dev, &header->data_pool_id);
67796721 if (ret)
6780− goto out_err;
6722+ return ret;
67816723 }
67826724
6783− rbd_init_layout(rbd_dev);
67846725 return 0;
6785−
6786−out_err:
6787− rbd_dev->header.features = 0;
6788− kfree(rbd_dev->header.object_prefix);
6789− rbd_dev->header.object_prefix = NULL;
6790− return ret;
67916726 }
67926727
67936728 /*
@@ -6982,13 +6917,15 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) · 188 unmodified lines
69826917 if (!depth)
69836918 down_write(&rbd_dev->header_rwsem);
69846919
6985− ret = rbd_dev_header_info(rbd_dev);
6920+ ret = rbd_dev_header_info(rbd_dev, &rbd_dev->header, true);
69866921 if (ret) {
69876922 if (ret == -ENOENT && !need_watch)
69886923 rbd_print_dne(rbd_dev, false);
69896924 goto err_out_probe;
69906925 }
69916926
6927+ rbd_init_layout(rbd_dev);
6928+
69926929 /*
69936930 * If this image is the one being mapped, we have pool name and
69946931 * id, image name and id, and snap name - need to fill snap id.
@@ -7017,7 +6954,7 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) · 22 unmodified lines
70176954 }
70186955
70196956 if (rbd_dev->header.features & RBD_FEATURE_LAYERING) {
7020− ret = rbd_dev_v2_parent_info(rbd_dev);
6957+ ret = rbd_dev_setup_parent(rbd_dev);
70216958 if (ret)
70226959 goto err_out_probe;
70236960 }
@@ -7043,6 +6980,107 @@ err_out_format: · 19 unmodified lines
70436980 return ret;
70446981 }
70456982
6983+static void rbd_dev_update_header(struct rbd_device *rbd_dev,
6984+ struct rbd_image_header *header)
6985+{
6986+ rbd_assert(rbd_image_format_valid(rbd_dev->image_format));
6987+ rbd_assert(rbd_dev->header.object_prefix); /* !first_time */
6988+
6989+ if (rbd_dev->header.image_size != header->image_size) {
6990+ rbd_dev->header.image_size = header->image_size;
6991+
6992+ if (!rbd_is_snap(rbd_dev)) {
6993+ rbd_dev->mapping.size = header->image_size;
6994+ rbd_dev_update_size(rbd_dev);
6995+ }
6996+ }
6997+
6998+ ceph_put_snap_context(rbd_dev->header.snapc);
6999+ rbd_dev->header.snapc = header->snapc;
7000+ header->snapc = NULL;
7001+
7002+ if (rbd_dev->image_format == 1) {
7003+ kfree(rbd_dev->header.snap_names);
7004+ rbd_dev->header.snap_names = header->snap_names;
7005+ header->snap_names = NULL;
7006+
7007+ kfree(rbd_dev->header.snap_sizes);
7008+ rbd_dev->header.snap_sizes = header->snap_sizes;
7009+ header->snap_sizes = NULL;
7010+ }
7011+}
7012+
7013+static void rbd_dev_update_parent(struct rbd_device *rbd_dev,
7014+ struct parent_image_info *pii)
7015+{
7016+ if (pii->pool_id == CEPH_NOPOOL || !pii->has_overlap) {
7017+ /*
7018+ * Either the parent never existed, or we have
7019+ * record of it but the image got flattened so it no
7020+ * longer has a parent. When the parent of a
7021+ * layered image disappears we immediately set the
7022+ * overlap to 0. The effect of this is that all new
7023+ * requests will be treated as if the image had no
7024+ * parent.
7025+ *
7026+ * If !pii.has_overlap, the parent image spec is not
7027+ * applicable. It's there to avoid duplication in each
7028+ * snapshot record.
7029+ */
7030+ if (rbd_dev->parent_overlap) {
7031+ rbd_dev->parent_overlap = 0;
7032+ rbd_dev_parent_put(rbd_dev);
7033+ pr_info("%s: clone has been flattened\n",
7034+ rbd_dev->disk->disk_name);
7035+ }
7036+ } else {
7037+ rbd_assert(rbd_dev->parent_spec);
7038+
7039+ /*
7040+ * Update the parent overlap. If it became zero, issue
7041+ * a warning as we will proceed as if there is no parent.
7042+ */
7043+ if (!pii->overlap && rbd_dev->parent_overlap)
7044+ rbd_warn(rbd_dev,
7045+ "clone has become standalone (overlap 0)");
7046+ rbd_dev->parent_overlap = pii->overlap;
7047+ }
7048+}
7049+
7050+static int rbd_dev_refresh(struct rbd_device *rbd_dev)
7051+{
7052+ struct rbd_image_header header = { 0 };
7053+ struct parent_image_info pii = { 0 };
7054+ int ret;
7055+
7056+ dout("%s rbd_dev %p\n", __func__, rbd_dev);
7057+
7058+ ret = rbd_dev_header_info(rbd_dev, &header, false);
7059+ if (ret)
7060+ goto out;
7061+
7062+ /*
7063+ * If there is a parent, see if it has disappeared due to the
7064+ * mapped image getting flattened.
7065+ */
7066+ if (rbd_dev->parent) {
7067+ ret = rbd_dev_v2_parent_info(rbd_dev, &pii);
7068+ if (ret)
7069+ goto out;
7070+ }
7071+
7072+ down_write(&rbd_dev->header_rwsem);
7073+ rbd_dev_update_header(rbd_dev, &header);
7074+ if (rbd_dev->parent)
7075+ rbd_dev_update_parent(rbd_dev, &pii);
7076+ up_write(&rbd_dev->header_rwsem);
7077+
7078+out:
7079+ rbd_parent_info_cleanup(&pii);
7080+ rbd_image_header_cleanup(&header);
7081+ return ret;
7082+}
7083+
70467084 static ssize_t do_rbd_add(const char *buf, size_t count)
70477085 {
70487086 struct rbd_device *rbd_dev = NULL;
drivers/bluetooth/btusb.c+1−0
@@ -4419,6 +4419,7 @@ static int btusb_probe(struct usb_interface *intf, · 4418 unmodified lines
44194419
44204420 if (id->driver_info & BTUSB_QCA_ROME) {
44214421 data->setup_on_usb = btusb_setup_qca;
4422+ hdev->shutdown = btusb_shutdown_qca;
44224423 hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
44234424 hdev->cmd_timeout = btusb_qca_cmd_timeout;
44244425 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
drivers/bus/ti-sysc.c+22−9
@@ -38,6 +38,7 @@ enum sysc_soc { · 37 unmodified lines
3838 SOC_2420,
3939 SOC_2430,
4040 SOC_3430,
41+ SOC_AM35,
4142 SOC_3630,
4243 SOC_4430,
4344 SOC_4460,
@@ -1097,6 +1098,11 @@ static int sysc_enable_module(struct device *dev) · 1053 unmodified lines
10971098 if (ddata->cfg.quirks & (SYSC_QUIRK_SWSUP_SIDLE |
10981099 SYSC_QUIRK_SWSUP_SIDLE_ACT)) {
10991100 best_mode = SYSC_IDLE_NO;
1101+
1102+ /* Clear WAKEUP */
1103+ if (regbits->enwkup_shift >= 0 &&
1104+ ddata->cfg.sysc_val & BIT(regbits->enwkup_shift))
1105+ reg &= ~BIT(regbits->enwkup_shift);
11001106 } else {
11011107 best_mode = fls(ddata->cfg.sidlemodes) - 1;
11021108 if (best_mode > SYSC_IDLE_MASK) {
@@ -1224,6 +1230,13 @@ set_sidle: · 121 unmodified lines
12241230 }
12251231 }
12261232
1233+ if (ddata->cfg.quirks & SYSC_QUIRK_SWSUP_SIDLE_ACT) {
1234+ /* Set WAKEUP */
1235+ if (regbits->enwkup_shift >= 0 &&
1236+ ddata->cfg.sysc_val & BIT(regbits->enwkup_shift))
1237+ reg |= BIT(regbits->enwkup_shift);
1238+ }
1239+
12271240 reg &= ~(SYSC_IDLE_MASK << regbits->sidle_shift);
12281241 reg |= best_mode << regbits->sidle_shift;
12291242 if (regbits->autoidle_shift >= 0 &&
@@ -1518,16 +1531,16 @@ struct sysc_revision_quirk { · 288 unmodified lines
15181531 static const struct sysc_revision_quirk sysc_revision_quirks[] = {
15191532 /* These drivers need to be fixed to not use pm_runtime_irq_safe() */
15201533 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000046, 0xffffffff,
1521− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
1534+ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
15221535 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff,
1523− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
1536+ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
15241537 /* Uarts on omap4 and later */
15251538 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffff00ff,
1526− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
1539+ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
15271540 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47422e03, 0xffffffff,
1528− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
1541+ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
15291542 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47424e03, 0xffffffff,
1530− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
1543+ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
15311544
15321545 /* Quirks that need to be set based on the module address */
15331546 SYSC_QUIRK("mcpdm", 0x40132000, 0, 0x10, -ENODEV, 0x50000800, 0xffffffff,
@@ -1862,7 +1875,7 @@ static void sysc_pre_reset_quirk_dss(struct sysc *ddata) · 328 unmodified lines
18621875 dev_warn(ddata->dev, "%s: timed out %08x !+ %08x\n",
18631876 __func__, val, irq_mask);
18641877
1865− if (sysc_soc->soc == SOC_3430) {
1878+ if (sysc_soc->soc == SOC_3430 || sysc_soc->soc == SOC_AM35) {
18661879 /* Clear DSS_SDI_CONTROL */
18671880 sysc_write(ddata, 0x44, 0);
18681881
@@ -2150,8 +2163,7 @@ static int sysc_reset(struct sysc *ddata) · 281 unmodified lines
21502163 }
21512164
21522165 if (ddata->cfg.srst_udelay)
2153− usleep_range(ddata->cfg.srst_udelay,
2154− ddata->cfg.srst_udelay * 2);
2166+ fsleep(ddata->cfg.srst_udelay);
21552167
21562168 if (ddata->post_reset_quirk)
21572169 ddata->post_reset_quirk(ddata);
@@ -3025,6 +3037,7 @@ static void ti_sysc_idle(struct work_struct *work) · 867 unmodified lines
30253037 static const struct soc_device_attribute sysc_soc_match[] = {
30263038 SOC_FLAG("OMAP242*", SOC_2420),
30273039 SOC_FLAG("OMAP243*", SOC_2430),
3040+ SOC_FLAG("AM35*", SOC_AM35),
30283041 SOC_FLAG("OMAP3[45]*", SOC_3430),
30293042 SOC_FLAG("OMAP3[67]*", SOC_3630),
30303043 SOC_FLAG("OMAP443*", SOC_4430),
@@ -3229,7 +3242,7 @@ static int sysc_check_active_timer(struct sysc *ddata) · 198 unmodified lines
32293242 * can be dropped if we stop supporting old beagleboard revisions
32303243 * A to B4 at some point.
32313244 */
3232− if (sysc_soc->soc == SOC_3430)
3245+ if (sysc_soc->soc == SOC_3430 || sysc_soc->soc == SOC_AM35)
32333246 error = -ENXIO;
32343247 else
32353248 error = -EBUSY;
drivers/clk/clk-si521xx.c+5−4
@@ -96,7 +96,7 @@ static int si521xx_regmap_i2c_write(void *context, unsigned int reg, · 95 unmodified lines
9696 unsigned int val)
9797 {
9898 struct i2c_client *i2c = context;
99− const u8 data[3] = { reg, 1, val };
99+ const u8 data[2] = { reg, val };
100100 const int count = ARRAY_SIZE(data);
101101 int ret;
102102
@@ -146,7 +146,7 @@ static int si521xx_regmap_i2c_read(void *context, unsigned int reg, · 43 unmodified lines
146146 static const struct regmap_config si521xx_regmap_config = {
147147 .reg_bits = 8,
148148 .val_bits = 8,
149− .cache_type = REGCACHE_NONE,
149+ .cache_type = REGCACHE_FLAT,
150150 .max_register = SI521XX_REG_DA,
151151 .rd_table = &si521xx_readable_table,
152152 .wr_table = &si521xx_writeable_table,
@@ -281,9 +281,10 @@ static int si521xx_probe(struct i2c_client *client) · 128 unmodified lines
281281 {
282282 const u16 chip_info = (u16)(uintptr_t)device_get_match_data(&client->dev);
283283 const struct clk_parent_data clk_parent_data = { .index = 0 };
284− struct si521xx *si;
284+ const u8 data[3] = { SI521XX_REG_BC, 1, 1 };
285285 unsigned char name[6] = "DIFF0";
286286 struct clk_init_data init = {};
287+ struct si521xx *si;
287288 int i, ret;
288289
289290 if (!chip_info)
@@ -308,7 +309,7 @@ static int si521xx_probe(struct i2c_client *client) · 18 unmodified lines
308309 "Failed to allocate register map\n");
309310
310311 /* Always read back 1 Byte via I2C */
311− ret = regmap_write(si->regmap, SI521XX_REG_BC, 1);
312+ ret = i2c_master_send(client, data, ARRAY_SIZE(data));
312313 if (ret < 0)
313314 return ret;
314315
drivers/clk/clk-versaclock3.c+40−41
@@ -118,21 +118,21 @@ enum vc3_div { · 117 unmodified lines
118118 VC3_DIV5,
119119 };
120120
121−enum vc3_clk_mux {
122− VC3_DIFF2_MUX,
123− VC3_DIFF1_MUX,
124− VC3_SE3_MUX,
125− VC3_SE2_MUX,
126− VC3_SE1_MUX,
127−};
128−
129121 enum vc3_clk {
130− VC3_DIFF2,
131− VC3_DIFF1,
132− VC3_SE3,
133− VC3_SE2,
134− VC3_SE1,
135122 VC3_REF,
123+ VC3_SE1,
124+ VC3_SE2,
125+ VC3_SE3,
126+ VC3_DIFF1,
127+ VC3_DIFF2,
128+};
129+
130+enum vc3_clk_mux {
131+ VC3_SE1_MUX = VC3_SE1 - 1,
132+ VC3_SE2_MUX = VC3_SE2 - 1,
133+ VC3_SE3_MUX = VC3_SE3 - 1,
134+ VC3_DIFF1_MUX = VC3_DIFF1 - 1,
135+ VC3_DIFF2_MUX = VC3_DIFF2 - 1,
136136 };
137137
138138 struct vc3_clk_data {
@@ -401,11 +401,10 @@ static long vc3_pll_round_rate(struct clk_hw *hw, unsigned long rate, · 262 unmodified lines
401401 /* Determine best fractional part, which is 16 bit wide */
402402 div_frc = rate % *parent_rate;
403403 div_frc *= BIT(16) - 1;
404− do_div(div_frc, *parent_rate);
405404
406− vc3->div_frc = (u32)div_frc;
405+ vc3->div_frc = min_t(u64, div64_ul(div_frc, *parent_rate), U16_MAX);
407406 rate = (*parent_rate *
408− (vc3->div_int * VC3_2_POW_16 + div_frc) / VC3_2_POW_16);
407+ (vc3->div_int * VC3_2_POW_16 + vc3->div_frc) / VC3_2_POW_16);
409408 } else {
410409 rate = *parent_rate * vc3->div_int;
411410 }
@@ -897,33 +896,33 @@ static struct vc3_hw_data clk_div[] = { · 485 unmodified lines
897896 };
898897
899898 static struct vc3_hw_data clk_mux[] = {
900− [VC3_DIFF2_MUX] = {
899+ [VC3_SE1_MUX] = {
901900 .data = &(struct vc3_clk_data) {
902− .offs = VC3_DIFF2_CTRL_REG,
903− .bitmsk = VC3_DIFF2_CTRL_REG_DIFF2_CLK_SEL
901+ .offs = VC3_SE1_DIV4_CTRL,
902+ .bitmsk = VC3_SE1_DIV4_CTRL_SE1_CLK_SEL
904903 },
905904 .hw.init = &(struct clk_init_data){
906− .name = "diff2_mux",
905+ .name = "se1_mux",
907906 .ops = &vc3_clk_mux_ops,
908907 .parent_hws = (const struct clk_hw *[]) {
909− &clk_div[VC3_DIV1].hw,
910− &clk_div[VC3_DIV3].hw
908+ &clk_div[VC3_DIV5].hw,
909+ &clk_div[VC3_DIV4].hw
911910 },
912911 .num_parents = 2,
913912 .flags = CLK_SET_RATE_PARENT
914913 }
915914 },
916− [VC3_DIFF1_MUX] = {
915+ [VC3_SE2_MUX] = {
917916 .data = &(struct vc3_clk_data) {
918− .offs = VC3_DIFF1_CTRL_REG,
919− .bitmsk = VC3_DIFF1_CTRL_REG_DIFF1_CLK_SEL
917+ .offs = VC3_SE2_CTRL_REG0,
918+ .bitmsk = VC3_SE2_CTRL_REG0_SE2_CLK_SEL
920919 },
921920 .hw.init = &(struct clk_init_data){
922− .name = "diff1_mux",
921+ .name = "se2_mux",
923922 .ops = &vc3_clk_mux_ops,
924923 .parent_hws = (const struct clk_hw *[]) {
925− &clk_div[VC3_DIV1].hw,
926− &clk_div[VC3_DIV3].hw
924+ &clk_div[VC3_DIV5].hw,
925+ &clk_div[VC3_DIV4].hw
927926 },
928927 .num_parents = 2,
929928 .flags = CLK_SET_RATE_PARENT
@@ -945,33 +944,33 @@ static struct vc3_hw_data clk_mux[] = { · 15 unmodified lines
945944 .flags = CLK_SET_RATE_PARENT
946945 }
947946 },
948− [VC3_SE2_MUX] = {
947+ [VC3_DIFF1_MUX] = {
949948 .data = &(struct vc3_clk_data) {
950− .offs = VC3_SE2_CTRL_REG0,
951− .bitmsk = VC3_SE2_CTRL_REG0_SE2_CLK_SEL
949+ .offs = VC3_DIFF1_CTRL_REG,
950+ .bitmsk = VC3_DIFF1_CTRL_REG_DIFF1_CLK_SEL
952951 },
953952 .hw.init = &(struct clk_init_data){
954− .name = "se2_mux",
953+ .name = "diff1_mux",
955954 .ops = &vc3_clk_mux_ops,
956955 .parent_hws = (const struct clk_hw *[]) {
957− &clk_div[VC3_DIV5].hw,
958− &clk_div[VC3_DIV4].hw
956+ &clk_div[VC3_DIV1].hw,
957+ &clk_div[VC3_DIV3].hw
959958 },
960959 .num_parents = 2,
961960 .flags = CLK_SET_RATE_PARENT
962961 }
963962 },
964− [VC3_SE1_MUX] = {
963+ [VC3_DIFF2_MUX] = {
965964 .data = &(struct vc3_clk_data) {
966− .offs = VC3_SE1_DIV4_CTRL,
967− .bitmsk = VC3_SE1_DIV4_CTRL_SE1_CLK_SEL
965+ .offs = VC3_DIFF2_CTRL_REG,
966+ .bitmsk = VC3_DIFF2_CTRL_REG_DIFF2_CLK_SEL
968967 },
969968 .hw.init = &(struct clk_init_data){
970− .name = "se1_mux",
969+ .name = "diff2_mux",
971970 .ops = &vc3_clk_mux_ops,
972971 .parent_hws = (const struct clk_hw *[]) {
973− &clk_div[VC3_DIV5].hw,
974− &clk_div[VC3_DIV4].hw
972+ &clk_div[VC3_DIV1].hw,
973+ &clk_div[VC3_DIV3].hw
975974 },
976975 .num_parents = 2,
977976 .flags = CLK_SET_RATE_PARENT
@@ -1110,7 +1109,7 @@ static int vc3_probe(struct i2c_client *client) · 132 unmodified lines
11101109 name, 0, CLK_SET_RATE_PARENT, 1, 1);
11111110 else
11121111 clk_out[i] = devm_clk_hw_register_fixed_factor_parent_hw(dev,
1113− name, &clk_mux[i].hw, CLK_SET_RATE_PARENT, 1, 1);
1112+ name, &clk_mux[i - 1].hw, CLK_SET_RATE_PARENT, 1, 1);
11141113
11151114 if (IS_ERR(clk_out[i]))
11161115 return PTR_ERR(clk_out[i]);
drivers/clk/sprd/ums512-clk.c+1−1
@@ -800,7 +800,7 @@ static SPRD_MUX_CLK_DATA(uart1_clk, "uart1-clk", uart_parents, · 799 unmodified lines
800800 0x250, 0, 3, UMS512_MUX_FLAG);
801801
802802 static const struct clk_parent_data thm_parents[] = {
803− { .fw_name = "ext-32m" },
803+ { .fw_name = "ext-32k" },
804804 { .hw = &clk_250k.hw },
805805 };
806806 static SPRD_MUX_CLK_DATA(thm0_clk, "thm0-clk", thm_parents,
drivers/clk/tegra/clk-bpmp.c+1−1
@@ -159,7 +159,7 @@ static unsigned long tegra_bpmp_clk_recalc_rate(struct clk_hw *hw, · 158 unmodified lines
159159
160160 err = tegra_bpmp_clk_transfer(clk->bpmp, &msg);
161161 if (err < 0)
162− return err;
162+ return 0;
163163
164164 return response.rate;
165165 }
drivers/cxl/acpi.c+2−2
@@ -14,7 +14,7 @@ · 13 unmodified lines
1414
1515 struct cxl_cxims_data {
1616 int nr_maps;
17− u64 xormaps[];
17+ u64 xormaps[] __counted_by(nr_maps);
1818 };
1919
2020 /*
@@ -112,9 +112,9 @@ static int cxl_parse_cxims(union acpi_subtable_headers *header, void *arg, · 91 unmodified lines
112112 GFP_KERNEL);
113113 if (!cximsd)
114114 return -ENOMEM;
115+ cximsd->nr_maps = nr_maps;
115116 memcpy(cximsd->xormaps, cxims->xormap_list,
116117 nr_maps * sizeof(*cximsd->xormaps));
117− cximsd->nr_maps = nr_maps;
118118 cxlrd->platform_data = cximsd;
119119
120120 return 0;
drivers/cxl/core/mbox.c+12−11
@@ -715,24 +715,25 @@ static void cxl_walk_cel(struct cxl_memdev_state *mds, size_t size, u8 *cel) · 714 unmodified lines
715715 for (i = 0; i < cel_entries; i++) {
716716 u16 opcode = le16_to_cpu(cel_entry[i].opcode);
717717 struct cxl_mem_command *cmd = cxl_mem_find_command(opcode);
718+ int enabled = 0;
718719
719− if (!cmd && (!cxl_is_poison_command(opcode) ||
720− !cxl_is_security_command(opcode))) {
721− dev_dbg(dev,
722− "Opcode 0x%04x unsupported by driver\n", opcode);
723− continue;
724− }
725−
726− if (cmd)
720+ if (cmd) {
727721 set_bit(cmd->info.id, mds->enabled_cmds);
722+ enabled++;
723+ }
728724
729− if (cxl_is_poison_command(opcode))
725+ if (cxl_is_poison_command(opcode)) {
730726 cxl_set_poison_cmd_enabled(&mds->poison, opcode);
727+ enabled++;
728+ }
731729
732− if (cxl_is_security_command(opcode))
730+ if (cxl_is_security_command(opcode)) {
733731 cxl_set_security_cmd_enabled(&mds->security, opcode);
732+ enabled++;
733+ }
734734
735− dev_dbg(dev, "Opcode 0x%04x enabled\n", opcode);
735+ dev_dbg(dev, "Opcode 0x%04x %s\n", opcode,
736+ enabled ? "enabled" : "unsupported by driver");
736737 }
737738 }
738739
drivers/cxl/core/port.c+9−4
@@ -1,5 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22 /* Copyright(c) 2020 Intel Corporation. All rights reserved. */
3+#include <linux/platform_device.h>
34 #include <linux/memregion.h>
45 #include <linux/workqueue.h>
56 #include <linux/debugfs.h>
@@ -706,16 +707,20 @@ static int cxl_setup_comp_regs(struct device *dev, struct cxl_register_map *map, · 700 unmodified lines
706707 return cxl_setup_regs(map);
707708 }
708709
709−static inline int cxl_port_setup_regs(struct cxl_port *port,
710− resource_size_t component_reg_phys)
710+static int cxl_port_setup_regs(struct cxl_port *port,
711+ resource_size_t component_reg_phys)
711712 {
713+ if (dev_is_platform(port->uport_dev))
714+ return 0;
712715 return cxl_setup_comp_regs(&port->dev, &port->comp_map,
713716 component_reg_phys);
714717 }
715718
716−static inline int cxl_dport_setup_regs(struct cxl_dport *dport,
717− resource_size_t component_reg_phys)
719+static int cxl_dport_setup_regs(struct cxl_dport *dport,
720+ resource_size_t component_reg_phys)
718721 {
722+ if (dev_is_platform(dport->dport_dev))
723+ return 0;
719724 return cxl_setup_comp_regs(dport->dport_dev, &dport->comp_map,
720725 component_reg_phys);
721726 }
drivers/cxl/core/region.c+31−10
@@ -717,13 +717,35 @@ static int match_free_decoder(struct device *dev, void *data) · 716 unmodified lines
717717 return 0;
718718 }
719719
720+static int match_auto_decoder(struct device *dev, void *data)
721+{
722+ struct cxl_region_params *p = data;
723+ struct cxl_decoder *cxld;
724+ struct range *r;
725+
726+ if (!is_switch_decoder(dev))
727+ return 0;
728+
729+ cxld = to_cxl_decoder(dev);
730+ r = &cxld->hpa_range;
731+
732+ if (p->res && p->res->start == r->start && p->res->end == r->end)
733+ return 1;
734+
735+ return 0;
736+}
737+
720738 static struct cxl_decoder *cxl_region_find_decoder(struct cxl_port *port,
721739 struct cxl_region *cxlr)
722740 {
723741 struct device *dev;
724742 int id = 0;
725743
726− dev = device_find_child(&port->dev, &id, match_free_decoder);
744+ if (test_bit(CXL_REGION_F_AUTO, &cxlr->flags))
745+ dev = device_find_child(&port->dev, &cxlr->params,
746+ match_auto_decoder);
747+ else
748+ dev = device_find_child(&port->dev, &id, match_free_decoder);
727749 if (!dev)
728750 return NULL;
729751 /*
@@ -1154,16 +1176,15 @@ static int cxl_port_setup_targets(struct cxl_port *port, · 424 unmodified lines
11541176 }
11551177
11561178 /*
1157− * If @parent_port is masking address bits, pick the next unused address
1158− * bit to route @port's targets.
1179+ * Interleave granularity is a multiple of @parent_port granularity.
1180+ * Multiplier is the parent port interleave ways.
11591181 */
1160− if (parent_iw > 1 && cxl_rr->nr_targets > 1) {
1161− u32 address_bit = max(peig + peiw, eiw + peig);
1162−
1163− eig = address_bit - eiw + 1;
1164− } else {
1165− eiw = peiw;
1166− eig = peig;
1182+ rc = granularity_to_eig(parent_ig * parent_iw, &eig);
1183+ if (rc) {
1184+ dev_dbg(&cxlr->dev,
1185+ "%s: invalid granularity calculation (%d * %d)\n",
1186+ dev_name(&parent_port->dev), parent_ig, parent_iw);
1187+ return rc;
11671188 }
11681189
11691190 rc = eig_to_granularity(eig, &ig);
drivers/cxl/pci.c+3−4
@@ -529,7 +529,6 @@ static int cxl_pci_setup_regs(struct pci_dev *pdev, enum cxl_regloc_type type, · 528 unmodified lines
529529
530530 static int cxl_pci_ras_unmask(struct pci_dev *pdev)
531531 {
532− struct pci_host_bridge *host_bridge = pci_find_host_bridge(pdev->bus);
533532 struct cxl_dev_state *cxlds = pci_get_drvdata(pdev);
534533 void __iomem *addr;
535534 u32 orig_val, val, mask;
@@ -541,9 +540,9 @@ static int cxl_pci_ras_unmask(struct pci_dev *pdev) · 5 unmodified lines
541540 return 0;
542541 }
543542
544− /* BIOS has CXL error control */
545− if (!host_bridge->native_cxl_error)
546− return -ENXIO;
543+ /* BIOS has PCIe AER error control */
544+ if (!pcie_aer_is_native(pdev))
545+ return 0;
547546
548547 rc = pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &cap);
549548 if (rc)
drivers/dma/ti/k3-udma-glue.c+3−0
@@ -558,6 +558,9 @@ int k3_udma_glue_tx_get_irq(struct k3_udma_glue_tx_channel *tx_chn) · 557 unmodified lines
558558 tx_chn->virq = k3_ringacc_get_ring_irq_num(tx_chn->ringtxcq);
559559 }
560560
561+ if (!tx_chn->virq)
562+ return -ENXIO;
563+
561564 return tx_chn->virq;
562565 }
563566 EXPORT_SYMBOL_GPL(k3_udma_glue_tx_get_irq);
drivers/firewire/sbp2.c+6−3
@@ -81,7 +81,8 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device " · 80 unmodified lines
8181 *
8282 * - power condition
8383 * Set the power condition field in the START STOP UNIT commands sent by
84− * sd_mod on suspend, resume, and shutdown (if manage_start_stop is on).
84+ * sd_mod on suspend, resume, and shutdown (if manage_system_start_stop or
85+ * manage_runtime_start_stop is on).
8586 * Some disks need this to spin down or to resume properly.
8687 *
8788 * - override internal blacklist
@@ -1517,8 +1518,10 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev) · 1429 unmodified lines
15171518
15181519 sdev->use_10_for_rw = 1;
15191520
1520− if (sbp2_param_exclusive_login)
1521− sdev->manage_start_stop = 1;
1521+ if (sbp2_param_exclusive_login) {
1522+ sdev->manage_system_start_stop = true;
1523+ sdev->manage_runtime_start_stop = true;
1524+ }
15221525
15231526 if (sdev->type == TYPE_ROM)
15241527 sdev->use_10_for_ms = 1;
drivers/firmware/arm_ffa/driver.c+14−2
@@ -397,6 +397,19 @@ static u32 ffa_get_num_pages_sg(struct scatterlist *sg) · 396 unmodified lines
397397 return num_pages;
398398 }
399399
400+static u8 ffa_memory_attributes_get(u32 func_id)
401+{
402+ /*
403+ * For the memory lend or donate operation, if the receiver is a PE or
404+ * a proxy endpoint, the owner/sender must not specify the attributes
405+ */
406+ if (func_id == FFA_FN_NATIVE(MEM_LEND) ||
407+ func_id == FFA_MEM_LEND)
408+ return 0;
409+
410+ return FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK | FFA_MEM_INNER_SHAREABLE;
411+}
412+
400413 static int
401414 ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize,
402415 struct ffa_mem_ops_args *args)
@@ -413,8 +426,7 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, · 10 unmodified lines
413426 mem_region->tag = args->tag;
414427 mem_region->flags = args->flags;
415428 mem_region->sender_id = drv_info->vm_id;
416− mem_region->attributes = FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK |
417− FFA_MEM_INNER_SHAREABLE;
429+ mem_region->attributes = ffa_memory_attributes_get(func_id);
418430 ep_mem_access = &mem_region->ep_mem_access[0];
419431
420432 for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) {
drivers/firmware/arm_scmi/perf.c+2−2
@@ -1080,6 +1080,8 @@ static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph) · 1079 unmodified lines
10801080 if (!pinfo)
10811081 return -ENOMEM;
10821082
1083+ pinfo->version = version;
1084+
10831085 ret = scmi_perf_attributes_get(ph, pinfo);
10841086 if (ret)
10851087 return ret;
@@ -1104,8 +1106,6 @@ static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph) · 18 unmodified lines
11041106 if (ret)
11051107 return ret;
11061108
1107− pinfo->version = version;
1108−
11091109 return ph->set_priv(ph, pinfo);
11101110 }
11111111
drivers/firmware/efi/efi.c+29−3
@@ -623,6 +623,34 @@ static __init int match_config_table(const efi_guid_t *guid, · 622 unmodified lines
623623 return 0;
624624 }
625625
626+/**
627+ * reserve_unaccepted - Map and reserve unaccepted configuration table
628+ * @unaccepted: Pointer to unaccepted memory table
629+ *
630+ * memblock_add() makes sure that the table is mapped in direct mapping. During
631+ * normal boot it happens automatically because the table is allocated from
632+ * usable memory. But during crashkernel boot only memory specifically reserved
633+ * for crash scenario is mapped. memblock_add() forces the table to be mapped
634+ * in crashkernel case.
635+ *
636+ * Align the range to the nearest page borders. Ranges smaller than page size
637+ * are not going to be mapped.
638+ *
639+ * memblock_reserve() makes sure that future allocations will not touch the
640+ * table.
641+ */
642+
643+static __init void reserve_unaccepted(struct efi_unaccepted_memory *unaccepted)
644+{
645+ phys_addr_t start, size;
646+
647+ start = PAGE_ALIGN_DOWN(efi.unaccepted);
648+ size = PAGE_ALIGN(sizeof(*unaccepted) + unaccepted->size);
649+
650+ memblock_add(start, size);
651+ memblock_reserve(start, size);
652+}
653+
626654 int __init efi_config_parse_tables(const efi_config_table_t *config_tables,
627655 int count,
628656 const efi_config_table_type_t *arch_tables)
@@ -751,11 +779,9 @@ int __init efi_config_parse_tables(const efi_config_table_t *config_tables, · 122 unmodified lines
751779
752780 unaccepted = early_memremap(efi.unaccepted, sizeof(*unaccepted));
753781 if (unaccepted) {
754− unsigned long size;
755782
756783 if (unaccepted->version == 1) {
757− size = sizeof(*unaccepted) + unaccepted->size;
758− memblock_reserve(efi.unaccepted, size);
784+ reserve_unaccepted(unaccepted);
759785 } else {
760786 efi.unaccepted = EFI_INVALID_TABLE_ADDR;
761787 }
drivers/firmware/imx/imx-dsp.c+1−0
@@ -114,6 +114,7 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) · 113 unmodified lines
114114 dsp_chan->idx = i % 2;
115115 dsp_chan->ch = mbox_request_channel_byname(cl, chan_name);
116116 if (IS_ERR(dsp_chan->ch)) {
117+ kfree(dsp_chan->name);
117118 ret = PTR_ERR(dsp_chan->ch);
118119 if (ret != -EPROBE_DEFER)
119120 dev_err(dev, "Failed to request mbox chan %s ret %d\n",
drivers/gpio/gpio-pmic-eic-sprd.c+1−0
@@ -352,6 +352,7 @@ static int sprd_pmic_eic_probe(struct platform_device *pdev) · 351 unmodified lines
352352 pmic_eic->chip.set_config = sprd_pmic_eic_set_config;
353353 pmic_eic->chip.set = sprd_pmic_eic_set;
354354 pmic_eic->chip.get = sprd_pmic_eic_get;
355+ pmic_eic->chip.can_sleep = true;
355356
356357 irq = &pmic_eic->chip.irq;
357358 gpio_irq_chip_set_chip(irq, &pmic_eic_irq_chip);
drivers/gpio/gpio-sim.c+23−37
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/irq.h>
2020 #include <linux/irq_sim.h>
2121 #include <linux/list.h>
22+#include <linux/minmax.h>
2223 #include <linux/mod_devicetable.h>
2324 #include <linux/module.h>
2425 #include <linux/mutex.h>
@@ -685,52 +686,32 @@ gpio_sim_device_config_live_show(struct config_item *item, char *page) · 660 unmodified lines
685686 return sprintf(page, "%c\n", live ? '1' : '0');
686687 }
687688
688−static char **gpio_sim_make_line_names(struct gpio_sim_bank *bank,
689− unsigned int *line_names_size)
689+static unsigned int gpio_sim_get_line_names_size(struct gpio_sim_bank *bank)
690690 {
691− unsigned int max_offset = 0;
692− bool has_line_names = false;
693691 struct gpio_sim_line *line;
694− char **line_names;
692+ unsigned int size = 0;
695693
696694 list_for_each_entry(line, &bank->line_list, siblings) {
697− if (line->offset >= bank->num_lines)
695+ if (!line->name || (line->offset >= bank->num_lines))
698696 continue;
699697
700− if (line->name) {
701− if (line->offset > max_offset)
702− max_offset = line->offset;
703−
704− /*
705− * max_offset can stay at 0 so it's not an indicator
706− * of whether line names were configured at all.
707− */
708− has_line_names = true;
709− }
698+ size = max(size, line->offset + 1);
710699 }
711700
712− if (!has_line_names)
713− /*
714− * This is not an error - NULL means, there are no line
715− * names configured.
716− */
717− return NULL;
718−
719− *line_names_size = max_offset + 1;
701+ return size;
702+}
720703
721− line_names = kcalloc(*line_names_size, sizeof(*line_names), GFP_KERNEL);
722− if (!line_names)
723− return ERR_PTR(-ENOMEM);
704+static void
705+gpio_sim_set_line_names(struct gpio_sim_bank *bank, char **line_names)
706+{
707+ struct gpio_sim_line *line;
724708
725709 list_for_each_entry(line, &bank->line_list, siblings) {
726− if (line->offset >= bank->num_lines)
710+ if (!line->name || (line->offset >= bank->num_lines))
727711 continue;
728712
729− if (line->name && (line->offset <= max_offset))
730− line_names[line->offset] = line->name;
713+ line_names[line->offset] = line->name;
731714 }
732−
733− return line_names;
734715 }
735716
736717 static void gpio_sim_remove_hogs(struct gpio_sim_device *dev)
@@ -834,7 +815,7 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, · 97 unmodified lines
834815 struct fwnode_handle *parent)
835816 {
836817 struct property_entry properties[GPIO_SIM_PROP_MAX];
837− unsigned int prop_idx = 0, line_names_size = 0;
818+ unsigned int prop_idx = 0, line_names_size;
838819 char **line_names __free(kfree) = NULL;
839820
840821 memset(properties, 0, sizeof(properties));
@@ -845,14 +826,19 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, · 4 unmodified lines
845826 properties[prop_idx++] = PROPERTY_ENTRY_STRING("gpio-sim,label",
846827 bank->label);
847828
848− line_names = gpio_sim_make_line_names(bank, &line_names_size);
849− if (IS_ERR(line_names))
850− return ERR_CAST(line_names);
829+ line_names_size = gpio_sim_get_line_names_size(bank);
830+ if (line_names_size) {
831+ line_names = kcalloc(line_names_size, sizeof(*line_names),
832+ GFP_KERNEL);
833+ if (!line_names)
834+ return ERR_PTR(-ENOMEM);
835+
836+ gpio_sim_set_line_names(bank, line_names);
851837
852− if (line_names)
853838 properties[prop_idx++] = PROPERTY_ENTRY_STRING_ARRAY_LEN(
854839 "gpio-line-names",
855840 line_names, line_names_size);
841+ }
856842
857843 return fwnode_create_software_node(properties, parent);
858844 }
drivers/gpio/gpio-tb10x.c+5−1
@@ -195,7 +195,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev) · 194 unmodified lines
195195 handle_edge_irq, IRQ_NOREQUEST, IRQ_NOPROBE,
196196 IRQ_GC_INIT_MASK_CACHE);
197197 if (ret)
198− return ret;
198+ goto err_remove_domain;
199199
200200 gc = tb10x_gpio->domain->gc->gc[0];
201201 gc->reg_base = tb10x_gpio->base;
@@ -209,6 +209,10 @@ static int tb10x_gpio_probe(struct platform_device *pdev) · 7 unmodified lines
209209 }
210210
211211 return 0;
212+
213+err_remove_domain:
214+ irq_domain_remove(tb10x_gpio->domain);
215+ return ret;
212216 }
213217
214218 static int tb10x_gpio_remove(struct platform_device *pdev)
drivers/gpio/gpio-timberdale.c+3−2
@@ -43,9 +43,10 @@ static int timbgpio_update_bit(struct gpio_chip *gpio, unsigned index, · 42 unmodified lines
4343 unsigned offset, bool enabled)
4444 {
4545 struct timbgpio *tgpio = gpiochip_get_data(gpio);
46+ unsigned long flags;
4647 u32 reg;
4748
48− spin_lock(&tgpio->lock);
49+ spin_lock_irqsave(&tgpio->lock, flags);
4950 reg = ioread32(tgpio->membase + offset);
5051
5152 if (enabled)
@@ -54,7 +55,7 @@ static int timbgpio_update_bit(struct gpio_chip *gpio, unsigned index, · 2 unmodified lines
5455 reg &= ~(1 << index);
5556
5657 iowrite32(reg, tgpio->membase + offset);
57− spin_unlock(&tgpio->lock);
58+ spin_unlock_irqrestore(&tgpio->lock, flags);
5859
5960 return 0;
6061 }
drivers/gpu/drm/Kconfig+1−1
@@ -136,7 +136,7 @@ config DRM_FBDEV_EMULATION · 135 unmodified lines
136136 bool "Enable legacy fbdev support for your modesetting driver"
137137 depends on DRM
138138 select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
139− default y
139+ default FB
140140 help
141141 Choose this option if you have a need for the legacy fbdev
142142 support. Note that this support also provides the linux console
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c+1−1
@@ -1776,7 +1776,7 @@ static ssize_t amdgpu_atombios_get_vbios_version(struct device *dev, · 1775 unmodified lines
17761776 struct amdgpu_device *adev = drm_to_adev(ddev);
17771777 struct atom_context *ctx = adev->mode_info.atom_context;
17781778
1779− return sysfs_emit(buf, "%s\n", ctx->vbios_ver_str);
1779+ return sysfs_emit(buf, "%s\n", ctx->vbios_pn);
17801780 }
17811781
17821782 static DEVICE_ATTR(vbios_version, 0444, amdgpu_atombios_get_vbios_version,
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c+1−0
@@ -801,6 +801,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev, · 800 unmodified lines
801801 enable ? "enable":"disable",
802802 get_ras_block_str(head),
803803 amdgpu_ras_is_poison_mode_supported(adev), ret);
804+ kfree(info);
804805 return ret;
805806 }
806807
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c+1−1
@@ -216,7 +216,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q, · 215 unmodified lines
216216
217217 if (q->wptr_bo) {
218218 wptr_addr_off = (uint64_t)q->properties.write_ptr & (PAGE_SIZE - 1);
219− queue_input.wptr_mc_addr = ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) + wptr_addr_off;
219+ queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo) + wptr_addr_off;
220220 }
221221
222222 queue_input.is_kfd_process = 1;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+2−2
@@ -6098,8 +6098,6 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · 6097 unmodified lines
60986098
60996099 if (recalculate_timing)
61006100 drm_mode_set_crtcinfo(&saved_mode, 0);
6101− else if (!old_stream)
6102− drm_mode_set_crtcinfo(&mode, 0);
61036101
61046102 /*
61056103 * If scaling is enabled and refresh rate didn't change
@@ -6661,6 +6659,8 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec · 555 unmodified lines
66616659 goto fail;
66626660 }
66636661
6662+ drm_mode_set_crtcinfo(mode, 0);
6663+
66646664 stream = create_validate_stream_for_sink(aconnector, mode,
66656665 to_dm_connector_state(connector->state),
66666666 NULL);
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+17−13
@@ -1178,12 +1178,15 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx) · 1177 unmodified lines
11781178 dto_params.otg_inst = tg->inst;
11791179 dto_params.timing = &pipe_ctx->stream->timing;
11801180 dp_hpo_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
1181− dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
1182− dccg->funcs->disable_symclk32_se(dccg, dp_hpo_inst);
1183− dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst, dp_hpo_inst);
1184− } else if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST && dccg->funcs->disable_symclk_se)
1181+ if (dccg) {
1182+ dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
1183+ dccg->funcs->disable_symclk32_se(dccg, dp_hpo_inst);
1184+ dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst, dp_hpo_inst);
1185+ }
1186+ } else if (dccg && dccg->funcs->disable_symclk_se) {
11851187 dccg->funcs->disable_symclk_se(dccg, stream_enc->stream_enc_inst,
11861188 link_enc->transmitter - TRANSMITTER_UNIPHY_A);
1189+ }
11871190
11881191 if (dc->link_srv->dp_is_128b_132b_signal(pipe_ctx)) {
11891192 /* TODO: This looks like a bug to me as we are disabling HPO IO when
@@ -2658,11 +2661,11 @@ void dce110_prepare_bandwidth( · 1468 unmodified lines
26582661 struct clk_mgr *dccg = dc->clk_mgr;
26592662
26602663 dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool);
2661−
2662− dccg->funcs->update_clocks(
2663− dccg,
2664− context,
2665− false);
2664+ if (dccg)
2665+ dccg->funcs->update_clocks(
2666+ dccg,
2667+ context,
2668+ false);
26662669 }
26672670
26682671 void dce110_optimize_bandwidth(
@@ -2673,10 +2676,11 @@ void dce110_optimize_bandwidth( · 4 unmodified lines
26732676
26742677 dce110_set_displaymarks(dc, context);
26752678
2676− dccg->funcs->update_clocks(
2677− dccg,
2678− context,
2679− true);
2679+ if (dccg)
2680+ dccg->funcs->update_clocks(
2681+ dccg,
2682+ context,
2683+ true);
26802684 }
26812685
26822686 static void dce110_program_front_end_for_pipe(
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c+2−6
@@ -2692,8 +2692,6 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx) · 2691 unmodified lines
26922692 struct dce_hwseq *hws = dc->hwseq;
26932693 unsigned int k1_div = PIXEL_RATE_DIV_NA;
26942694 unsigned int k2_div = PIXEL_RATE_DIV_NA;
2695− struct link_encoder *link_enc = link_enc_cfg_get_link_enc(pipe_ctx->stream->link);
2696− struct stream_encoder *stream_enc = pipe_ctx->stream_res.stream_enc;
26972695
26982696 if (dc->link_srv->dp_is_128b_132b_signal(pipe_ctx)) {
26992697 if (dc->hwseq->funcs.setup_hpo_hw_control)
@@ -2713,10 +2711,8 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx) · 13 unmodified lines
27132711 dto_params.timing = &pipe_ctx->stream->timing;
27142712 dto_params.ref_dtbclk_khz = dc->clk_mgr->funcs->get_dtb_ref_clk_frequency(dc->clk_mgr);
27152713 dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
2716− } else if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST && dccg->funcs->enable_symclk_se)
2717− dccg->funcs->enable_symclk_se(dccg,
2718− stream_enc->stream_enc_inst, link_enc->transmitter - TRANSMITTER_UNIPHY_A);
2719−
2714+ } else {
2715+ }
27202716 if (hws->funcs.calculate_dccg_k1_k2_values && dc->res_pool->dccg->funcs->set_pixel_rate_div) {
27212717 hws->funcs.calculate_dccg_k1_k2_values(pipe_ctx, &k1_div, &k2_div);
27222718
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mpc.c+1−1
@@ -75,7 +75,7 @@ void mpc32_power_on_blnd_lut( · 74 unmodified lines
7575 if (power_on) {
7676 REG_UPDATE(MPCC_MCM_MEM_PWR_CTRL[mpcc_id], MPCC_MCM_1DLUT_MEM_PWR_FORCE, 0);
7777 REG_WAIT(MPCC_MCM_MEM_PWR_CTRL[mpcc_id], MPCC_MCM_1DLUT_MEM_PWR_STATE, 0, 1, 5);
78− } else {
78+ } else if (!mpc->ctx->dc->debug.disable_mem_low_power) {
7979 ASSERT(false);
8080 /* TODO: change to mpc
8181 * dpp_base->ctx->dc->optimized_required = true;
drivers/gpu/drm/i915/gem/i915_gem_shmem.c+7−4
@@ -100,6 +100,7 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st, · 99 unmodified lines
100100 st->nents = 0;
101101 for (i = 0; i < page_count; i++) {
102102 struct folio *folio;
103+ unsigned long nr_pages;
103104 const unsigned int shrink[] = {
104105 I915_SHRINK_BOUND | I915_SHRINK_UNBOUND,
105106 0,
@@ -150,6 +151,8 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st, · 44 unmodified lines
150151 }
151152 } while (1);
152153
154+ nr_pages = min_t(unsigned long,
155+ folio_nr_pages(folio), page_count - i);
153156 if (!i ||
154157 sg->length >= max_segment ||
155158 folio_pfn(folio) != next_pfn) {
@@ -157,13 +160,13 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st, · 1 unmodified line
157160 sg = sg_next(sg);
158161
159162 st->nents++;
160− sg_set_folio(sg, folio, folio_size(folio), 0);
163+ sg_set_folio(sg, folio, nr_pages * PAGE_SIZE, 0);
161164 } else {
162165 /* XXX: could overflow? */
163− sg->length += folio_size(folio);
166+ sg->length += nr_pages * PAGE_SIZE;
164167 }
165− next_pfn = folio_pfn(folio) + folio_nr_pages(folio);
166− i += folio_nr_pages(folio) - 1;
168+ next_pfn = folio_pfn(folio) + nr_pages;
169+ i += nr_pages - 1;
167170
168171 /* Check that the i965g/gm workaround works. */
169172 GEM_BUG_ON(gfp & __GFP_DMA32 && next_pfn >= 0x00100000UL);
drivers/gpu/drm/i915/gt/intel_engine_cs.c+0−1
@@ -558,7 +558,6 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id, · 557 unmodified lines
558558 DRIVER_CAPS(i915)->has_logical_contexts = true;
559559
560560 ewma__engine_latency_init(&engine->latency);
561− seqcount_init(&engine->stats.execlists.lock);
562561
563562 ATOMIC_INIT_NOTIFIER_HEAD(&engine->context_status_notifier);
564563
drivers/gpu/drm/i915/gt/intel_execlists_submission.c+2−0
@@ -3550,6 +3550,8 @@ int intel_execlists_submission_setup(struct intel_engine_cs *engine) · 3549 unmodified lines
35503550 logical_ring_default_vfuncs(engine);
35513551 logical_ring_default_irqs(engine);
35523552
3553+ seqcount_init(&engine->stats.execlists.lock);
3554+
35533555 if (engine->flags & I915_ENGINE_HAS_RCS_REG_STATE)
35543556 rcs_submission_override(engine);
35553557
drivers/gpu/drm/i915/gt/intel_ggtt.c+17−6
@@ -511,20 +511,31 @@ void intel_ggtt_unbind_vma(struct i915_address_space *vm, · 510 unmodified lines
511511 vm->clear_range(vm, vma_res->start, vma_res->vma_size);
512512 }
513513
514+/*
515+ * Reserve the top of the GuC address space for firmware images. Addresses
516+ * beyond GUC_GGTT_TOP in the GuC address space are inaccessible by GuC,
517+ * which makes for a suitable range to hold GuC/HuC firmware images if the
518+ * size of the GGTT is 4G. However, on a 32-bit platform the size of the GGTT
519+ * is limited to 2G, which is less than GUC_GGTT_TOP, but we reserve a chunk
520+ * of the same size anyway, which is far more than needed, to keep the logic
521+ * in uc_fw_ggtt_offset() simple.
522+ */
523+#define GUC_TOP_RESERVE_SIZE (SZ_4G - GUC_GGTT_TOP)
524+
514525 static int ggtt_reserve_guc_top(struct i915_ggtt *ggtt)
515526 {
516− u64 size;
527+ u64 offset;
517528 int ret;
518529
519530 if (!intel_uc_uses_guc(&ggtt->vm.gt->uc))
520531 return 0;
521532
522− GEM_BUG_ON(ggtt->vm.total <= GUC_GGTT_TOP);
523− size = ggtt->vm.total - GUC_GGTT_TOP;
533+ GEM_BUG_ON(ggtt->vm.total <= GUC_TOP_RESERVE_SIZE);
534+ offset = ggtt->vm.total - GUC_TOP_RESERVE_SIZE;
524535
525− ret = i915_gem_gtt_reserve(&ggtt->vm, NULL, &ggtt->uc_fw, size,
526− GUC_GGTT_TOP, I915_COLOR_UNEVICTABLE,
527− PIN_NOEVICT);
536+ ret = i915_gem_gtt_reserve(&ggtt->vm, NULL, &ggtt->uc_fw,
537+ GUC_TOP_RESERVE_SIZE, offset,
538+ I915_COLOR_UNEVICTABLE, PIN_NOEVICT);
528539 if (ret)
529540 drm_dbg(&ggtt->vm.i915->drm,
530541 "Failed to reserve top of GGTT for GuC\n");
drivers/gpu/drm/i915/gt/intel_lrc.c+3−2
@@ -1094,6 +1094,9 @@ __lrc_alloc_state(struct intel_context *ce, struct intel_engine_cs *engine) · 1093 unmodified lines
10941094 I915_BO_ALLOC_PM_VOLATILE);
10951095 if (IS_ERR(obj)) {
10961096 obj = i915_gem_object_create_shmem(engine->i915, context_size);
1097+ if (IS_ERR(obj))
1098+ return ERR_CAST(obj);
1099+
10971100 /*
10981101 * Wa_22016122933: For Media version 13.0, all Media GT shared
10991102 * memory needs to be mapped as WC on CPU side and UC (PAT
@@ -1102,8 +1105,6 @@ __lrc_alloc_state(struct intel_context *ce, struct intel_engine_cs *engine) · 2 unmodified lines
11021105 if (intel_gt_needs_wa_22016122933(engine->gt))
11031106 i915_gem_object_set_cache_coherency(obj, I915_CACHE_NONE);
11041107 }
1105− if (IS_ERR(obj))
1106− return ERR_CAST(obj);
11071108
11081109 vma = i915_vma_instance(obj, &engine->gt->ggtt->vm, NULL);
11091110 if (IS_ERR(vma)) {
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c+35−3
@@ -1432,6 +1432,36 @@ static void guc_timestamp_ping(struct work_struct *wrk) · 1431 unmodified lines
14321432 unsigned long index;
14331433 int srcu, ret;
14341434
1435+ /*
1436+ * Ideally the busyness worker should take a gt pm wakeref because the
1437+ * worker only needs to be active while gt is awake. However, the
1438+ * gt_park path cancels the worker synchronously and this complicates
1439+ * the flow if the worker is also running at the same time. The cancel
1440+ * waits for the worker and when the worker releases the wakeref, that
1441+ * would call gt_park and would lead to a deadlock.
1442+ *
1443+ * The resolution is to take the global pm wakeref if runtime pm is
1444+ * already active. If not, we don't need to update the busyness stats as
1445+ * the stats would already be updated when the gt was parked.
1446+ *
1447+ * Note:
1448+ * - We do not requeue the worker if we cannot take a reference to runtime
1449+ * pm since intel_guc_busyness_unpark would requeue the worker in the
1450+ * resume path.
1451+ *
1452+ * - If the gt was parked longer than time taken for GT timestamp to roll
1453+ * over, we ignore those rollovers since we don't care about tracking
1454+ * the exact GT time. We only care about roll overs when the gt is
1455+ * active and running workloads.
1456+ *
1457+ * - There is a window of time between gt_park and runtime suspend,
1458+ * where the worker may run. This is acceptable since the worker will
1459+ * not find any new data to update busyness.
1460+ */
1461+ wakeref = intel_runtime_pm_get_if_active(&gt->i915->runtime_pm);
1462+ if (!wakeref)
1463+ return;
1464+
14351465 /*
14361466 * Synchronize with gt reset to make sure the worker does not
14371467 * corrupt the engine/guc stats. NB: can't actually block waiting
@@ -1440,10 +1470,9 @@ static void guc_timestamp_ping(struct work_struct *wrk) · 2 unmodified lines
14401470 */
14411471 ret = intel_gt_reset_trylock(gt, &srcu);
14421472 if (ret)
1443− return;
1473+ goto err_trylock;
14441474
1445− with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
1446− __update_guc_busyness_stats(guc);
1475+ __update_guc_busyness_stats(guc);
14471476
14481477 /* adjust context stats for overflow */
14491478 xa_for_each(&guc->context_lookup, index, ce)
@@ -1452,6 +1481,9 @@ static void guc_timestamp_ping(struct work_struct *wrk) · 2 unmodified lines
14521481 intel_gt_reset_unlock(gt, srcu);
14531482
14541483 guc_enable_busyness_worker(guc);
1484+
1485+err_trylock:
1486+ intel_runtime_pm_put(&gt->i915->runtime_pm, wakeref);
14551487 }
14561488
14571489 static int guc_action_enable_usage_stats(struct intel_guc *guc)
drivers/gpu/drm/meson/meson_encoder_hdmi.c+2−0
@@ -334,6 +334,8 @@ static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge, · 333 unmodified lines
334334 return;
335335
336336 cec_notifier_set_phys_addr_from_edid(encoder_hdmi->cec_notifier, edid);
337+
338+ kfree(edid);
337339 } else
338340 cec_notifier_phys_addr_invalidate(encoder_hdmi->cec_notifier);
339341 }
drivers/gpu/drm/nouveau/nouveau_drv.h+5−14
@@ -189,21 +189,12 @@ u_free(void *addr) · 188 unmodified lines
189189 static inline void *
190190 u_memcpya(uint64_t user, unsigned int nmemb, unsigned int size)
191191 {
192− void *mem;
193− void __user *userptr = (void __force __user *)(uintptr_t)user;
192+ void __user *userptr = u64_to_user_ptr(user);
193+ size_t bytes;
194194
195− size *= nmemb;
196−
197− mem = kvmalloc(size, GFP_KERNEL);
198− if (!mem)
199− return ERR_PTR(-ENOMEM);
200−
201− if (copy_from_user(mem, userptr, size)) {
202− u_free(mem);
203− return ERR_PTR(-EFAULT);
204− }
205−
206− return mem;
195+ if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
196+ return ERR_PTR(-EOVERFLOW);
197+ return vmemdup_user(userptr, bytes);
207198 }
208199
209200 #include <nvif/object.h>
drivers/gpu/drm/nouveau/nouveau_exec.c+1−1
@@ -213,7 +213,7 @@ nouveau_exec_job_timeout(struct nouveau_job *job) · 212 unmodified lines
213213
214214 nouveau_sched_entity_fini(job->entity);
215215
216− return DRM_GPU_SCHED_STAT_ENODEV;
216+ return DRM_GPU_SCHED_STAT_NOMINAL;
217217 }
218218
219219 static struct nouveau_job_ops nouveau_exec_job_ops = {
drivers/gpu/drm/nouveau/nouveau_fence.c+1−1
@@ -207,7 +207,7 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha · 206 unmodified lines
207207 int
208208 nouveau_fence_emit(struct nouveau_fence *fence)
209209 {
210− struct nouveau_channel *chan = fence->channel;
210+ struct nouveau_channel *chan = unrcu_pointer(fence->channel);
211211 struct nouveau_fence_chan *fctx = chan->fence;
212212 struct nouveau_fence_priv *priv = (void*)chan->drm->fence;
213213 int ret;
drivers/gpu/drm/nouveau/nouveau_sched.c+9−3
@@ -375,14 +375,20 @@ nouveau_sched_run_job(struct drm_sched_job *sched_job) · 374 unmodified lines
375375 static enum drm_gpu_sched_stat
376376 nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
377377 {
378+ struct drm_gpu_scheduler *sched = sched_job->sched;
378379 struct nouveau_job *job = to_nouveau_job(sched_job);
380+ enum drm_gpu_sched_stat stat = DRM_GPU_SCHED_STAT_NOMINAL;
379381
380− NV_PRINTK(warn, job->cli, "Job timed out.\n");
382+ drm_sched_stop(sched, sched_job);
381383
382384 if (job->ops->timeout)
383− return job->ops->timeout(job);
385+ stat = job->ops->timeout(job);
386+ else
387+ NV_PRINTK(warn, job->cli, "Generic job timeout.\n");
388+
389+ drm_sched_start(sched, true);
384390
385− return DRM_GPU_SCHED_STAT_ENODEV;
391+ return stat;
386392 }
387393
388394 static void
drivers/gpu/drm/tests/drm_mm_test.c+1−1
@@ -939,7 +939,7 @@ static void drm_test_mm_insert_range(struct kunit *test) · 938 unmodified lines
939939 KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max - 1));
940940 KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max / 2));
941941 KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
942− max / 2, max / 2));
942+ max / 2, max));
943943 KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
944944 max / 4 + 1, 3 * max / 4 - 1));
945945
drivers/gpu/drm/virtio/virtgpu_submit.c+0−1
@@ -361,7 +361,6 @@ static void virtio_gpu_complete_submit(struct virtio_gpu_submit *submit) · 360 unmodified lines
361361 submit->buf = NULL;
362362 submit->buflist = NULL;
363363 submit->sync_file = NULL;
364− submit->out_fence = NULL;
365364 submit->out_fence_fd = -1;
366365 }
367366
drivers/i2c/busses/i2c-designware-common.c+17−0
@@ -441,8 +441,25 @@ err_release_lock: · 440 unmodified lines
441441
442442 void __i2c_dw_disable(struct dw_i2c_dev *dev)
443443 {
444+ unsigned int raw_intr_stats;
445+ unsigned int enable;
444446 int timeout = 100;
447+ bool abort_needed;
445448 unsigned int status;
449+ int ret;
450+
451+ regmap_read(dev->map, DW_IC_RAW_INTR_STAT, &raw_intr_stats);
452+ regmap_read(dev->map, DW_IC_ENABLE, &enable);
453+
454+ abort_needed = raw_intr_stats & DW_IC_INTR_MST_ON_HOLD;
455+ if (abort_needed) {
456+ regmap_write(dev->map, DW_IC_ENABLE, enable | DW_IC_ENABLE_ABORT);
457+ ret = regmap_read_poll_timeout(dev->map, DW_IC_ENABLE, enable,
458+ !(enable & DW_IC_ENABLE_ABORT), 10,
459+ 100);
460+ if (ret)
461+ dev_err(dev->dev, "timeout while trying to abort current transfer\n");
462+ }
446463
447464 do {
448465 __i2c_dw_disable_nowait(dev);
drivers/i2c/busses/i2c-designware-core.h+3−0
@@ -98,6 +98,7 @@ · 97 unmodified lines
9898 #define DW_IC_INTR_START_DET BIT(10)
9999 #define DW_IC_INTR_GEN_CALL BIT(11)
100100 #define DW_IC_INTR_RESTART_DET BIT(12)
101+#define DW_IC_INTR_MST_ON_HOLD BIT(13)
101102
102103 #define DW_IC_INTR_DEFAULT_MASK (DW_IC_INTR_RX_FULL | \
103104 DW_IC_INTR_TX_ABRT | \
@@ -108,6 +109,8 @@ · 4 unmodified lines
108109 DW_IC_INTR_RX_UNDER | \
109110 DW_IC_INTR_RD_REQ)
110111
112+#define DW_IC_ENABLE_ABORT BIT(1)
113+
111114 #define DW_IC_STATUS_ACTIVITY BIT(0)
112115 #define DW_IC_STATUS_TFE BIT(2)
113116 #define DW_IC_STATUS_RFNE BIT(3)
drivers/i2c/busses/i2c-i801.c+1−0
@@ -1754,6 +1754,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) · 1753 unmodified lines
17541754 "SMBus I801 adapter at %04lx", priv->smba);
17551755 err = i2c_add_adapter(&priv->adapter);
17561756 if (err) {
1757+ platform_device_unregister(priv->tco_pdev);
17571758 i801_acpi_remove(priv);
17581759 return err;
17591760 }
drivers/i2c/busses/i2c-npcm7xx.c+7−10
@@ -694,6 +694,7 @@ static void npcm_i2c_callback(struct npcm_i2c *bus, · 693 unmodified lines
694694 {
695695 struct i2c_msg *msgs;
696696 int msgs_num;
697+ bool do_complete = false;
697698
698699 msgs = bus->msgs;
699700 msgs_num = bus->msgs_num;
@@ -722,23 +723,17 @@ static void npcm_i2c_callback(struct npcm_i2c *bus, · 22 unmodified lines
722723 msgs[1].flags & I2C_M_RD)
723724 msgs[1].len = info;
724725 }
725− if (completion_done(&bus->cmd_complete) == false)
726− complete(&bus->cmd_complete);
727− break;
728−
726+ do_complete = true;
727+ break;
729728 case I2C_NACK_IND:
730729 /* MASTER transmit got a NACK before tx all bytes */
731730 bus->cmd_err = -ENXIO;
732− if (bus->master_or_slave == I2C_MASTER)
733− complete(&bus->cmd_complete);
734−
731+ do_complete = true;
735732 break;
736733 case I2C_BUS_ERR_IND:
737734 /* Bus error */
738735 bus->cmd_err = -EAGAIN;
739− if (bus->master_or_slave == I2C_MASTER)
740− complete(&bus->cmd_complete);
741−
736+ do_complete = true;
742737 break;
743738 case I2C_WAKE_UP_IND:
744739 /* I2C wake up */
@@ -752,6 +747,8 @@ static void npcm_i2c_callback(struct npcm_i2c *bus, · 7 unmodified lines
752747 if (bus->slave)
753748 bus->master_or_slave = I2C_SLAVE;
754749 #endif
750+ if (do_complete)
751+ complete(&bus->cmd_complete);
755752 }
756753
757754 static u8 npcm_i2c_fifo_usage(struct npcm_i2c *bus)
drivers/i2c/busses/i2c-xiic.c+1−1
@@ -710,7 +710,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id) · 709 unmodified lines
710710 * reset the IP instead of just flush fifos
711711 */
712712 ret = xiic_reinit(i2c);
713− if (!ret)
713+ if (ret < 0)
714714 dev_dbg(i2c->adap.dev.parent, "reinit failed\n");
715715
716716 if (i2c->rx_msg) {
drivers/i2c/i2c-mux.c+1−1
@@ -341,7 +341,7 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc, · 340 unmodified lines
341341 priv->adap.lock_ops = &i2c_parent_lock_ops;
342342
343343 /* Sanity check on class */
344− if (i2c_mux_parent_classes(parent) & class)
344+ if (i2c_mux_parent_classes(parent) & class & ~I2C_CLASS_DEPRECATED)
345345 dev_err(&parent->dev,
346346 "Segment %d behind mux can't share classes with ancestors\n",
347347 chan_id);
drivers/i2c/muxes/i2c-demux-pinctrl.c+4−0
@@ -243,6 +243,10 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) · 242 unmodified lines
243243
244244 props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL);
245245 props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL);
246+ if (!props[i].name || !props[i].value) {
247+ err = -ENOMEM;
248+ goto err_rollback;
249+ }
246250 props[i].length = 3;
247251
248252 of_changeset_init(&priv->chan[i].chgset);
drivers/i2c/muxes/i2c-mux-gpio.c+3−1
@@ -105,8 +105,10 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, · 104 unmodified lines
105105
106106 } else if (is_acpi_node(child)) {
107107 rc = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), values + i);
108− if (rc)
108+ if (rc) {
109+ fwnode_handle_put(child);
109110 return dev_err_probe(dev, rc, "Cannot get address\n");
111+ }
110112 }
111113
112114 i++;
drivers/iommu/apple-dart.c+1−2
@@ -671,8 +671,7 @@ static int apple_dart_attach_dev(struct iommu_domain *domain, · 670 unmodified lines
671671 return ret;
672672
673673 switch (domain->type) {
674− case IOMMU_DOMAIN_DMA:
675− case IOMMU_DOMAIN_UNMANAGED:
674+ default:
676675 ret = apple_dart_domain_add_streams(dart_domain, cfg);
677676 if (ret)
678677 return ret;
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c+16−2
@@ -186,6 +186,15 @@ static void arm_smmu_free_shared_cd(struct arm_smmu_ctx_desc *cd) · 185 unmodified lines
186186 }
187187 }
188188
189+/*
190+ * Cloned from the MAX_TLBI_OPS in arch/arm64/include/asm/tlbflush.h, this
191+ * is used as a threshold to replace per-page TLBI commands to issue in the
192+ * command queue with an address-space TLBI command, when SMMU w/o a range
193+ * invalidation feature handles too many per-page TLBI commands, which will
194+ * otherwise result in a soft lockup.
195+ */
196+#define CMDQ_MAX_TLBI_OPS (1 << (PAGE_SHIFT - 3))
197+
189198 static void arm_smmu_mm_arch_invalidate_secondary_tlbs(struct mmu_notifier *mn,
190199 struct mm_struct *mm,
191200 unsigned long start,
@@ -201,8 +210,13 @@ static void arm_smmu_mm_arch_invalidate_secondary_tlbs(struct mmu_notifier *mn, · 9 unmodified lines
201210 * range. So do a simple translation here by calculating size correctly.
202211 */
203212 size = end - start;
204− if (size == ULONG_MAX)
205− size = 0;
213+ if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_RANGE_INV)) {
214+ if (size >= CMDQ_MAX_TLBI_OPS * PAGE_SIZE)
215+ size = 0;
216+ } else {
217+ if (size == ULONG_MAX)
218+ size = 0;
219+ }
206220
207221 if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_BTM)) {
208222 if (!size)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c+10−5
@@ -1895,18 +1895,23 @@ static void __arm_smmu_tlb_inv_range(struct arm_smmu_cmdq_ent *cmd, · 1894 unmodified lines
18951895 /* Get the leaf page size */
18961896 tg = __ffs(smmu_domain->domain.pgsize_bitmap);
18971897
1898+ num_pages = size >> tg;
1899+
18981900 /* Convert page size of 12,14,16 (log2) to 1,2,3 */
18991901 cmd->tlbi.tg = (tg - 10) / 2;
19001902
19011903 /*
1902− * Determine what level the granule is at. For non-leaf, io-pgtable
1903− * assumes .tlb_flush_walk can invalidate multiple levels at once,
1904− * so ignore the nominal last-level granule and leave TTL=0.
1904+ * Determine what level the granule is at. For non-leaf, both
1905+ * io-pgtable and SVA pass a nominal last-level granule because
1906+ * they don't know what level(s) actually apply, so ignore that
1907+ * and leave TTL=0. However for various errata reasons we still
1908+ * want to use a range command, so avoid the SVA corner case
1909+ * where both scale and num could be 0 as well.
19051910 */
19061911 if (cmd->tlbi.leaf)
19071912 cmd->tlbi.ttl = 4 - ((ilog2(granule) - 3) / (tg - 3));
1908−
1909− num_pages = size >> tg;
1913+ else if ((num_pages & CMDQ_TLBI_RANGE_NUM_MAX) == 1)
1914+ num_pages++;
19101915 }
19111916
19121917 cmds.num = 0;
drivers/iommu/intel/iommu.c+0−16
@@ -2998,13 +2998,6 @@ static int iommu_suspend(void) · 2997 unmodified lines
29982998 struct intel_iommu *iommu = NULL;
29992999 unsigned long flag;
30003000
3001− for_each_active_iommu(iommu, drhd) {
3002− iommu->iommu_state = kcalloc(MAX_SR_DMAR_REGS, sizeof(u32),
3003− GFP_KERNEL);
3004− if (!iommu->iommu_state)
3005− goto nomem;
3006− }
3007−
30083001 iommu_flush_all();
30093002
30103003 for_each_active_iommu(iommu, drhd) {
@@ -3024,12 +3017,6 @@ static int iommu_suspend(void) · 13 unmodified lines
30243017 raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
30253018 }
30263019 return 0;
3027−
3028−nomem:
3029− for_each_active_iommu(iommu, drhd)
3030− kfree(iommu->iommu_state);
3031−
3032− return -ENOMEM;
30333020 }
30343021
30353022 static void iommu_resume(void)
@@ -3061,9 +3048,6 @@ static void iommu_resume(void) · 25 unmodified lines
30613048
30623049 raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
30633050 }
3064−
3065− for_each_active_iommu(iommu, drhd)
3066− kfree(iommu->iommu_state);
30673051 }
30683052
30693053 static struct syscore_ops iommu_syscore_ops = {
drivers/iommu/intel/iommu.h+1−1
@@ -681,7 +681,7 @@ struct intel_iommu { · 680 unmodified lines
681681 struct iopf_queue *iopf_queue;
682682 unsigned char iopfq_name[16];
683683 struct q_inval *qi; /* Queued invalidation info */
684− u32 *iommu_state; /* Store iommu states between suspend and resume.*/
684+ u32 iommu_state[MAX_SR_DMAR_REGS]; /* Store iommu states between suspend and resume.*/
685685
686686 #ifdef CONFIG_IRQ_REMAP
687687 struct ir_table *ir_table; /* Interrupt remapping info */
drivers/iommu/mtk_iommu.c+4−5
@@ -262,7 +262,7 @@ struct mtk_iommu_data { · 261 unmodified lines
262262 struct device *smicomm_dev;
263263
264264 struct mtk_iommu_bank_data *bank;
265− struct mtk_iommu_domain *share_dom; /* For 2 HWs share pgtable */
265+ struct mtk_iommu_domain *share_dom;
266266
267267 struct regmap *pericfg;
268268 struct mutex mutex; /* Protect m4u_group/m4u_dom above */
@@ -643,8 +643,8 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom, · 374 unmodified lines
643643 struct mtk_iommu_domain *share_dom = data->share_dom;
644644 const struct mtk_iommu_iova_region *region;
645645
646− /* Always use share domain in sharing pgtable case */
647− if (MTK_IOMMU_HAS_FLAG(data->plat_data, SHARE_PGTABLE) && share_dom) {
646+ /* Share pgtable when 2 MM IOMMU share the pgtable or one IOMMU use multiple iova ranges */
647+ if (share_dom) {
648648 dom->iop = share_dom->iop;
649649 dom->cfg = share_dom->cfg;
650650 dom->domain.pgsize_bitmap = share_dom->cfg.pgsize_bitmap;
@@ -677,8 +677,7 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom, · 26 unmodified lines
677677 /* Update our support page sizes bitmap */
678678 dom->domain.pgsize_bitmap = dom->cfg.pgsize_bitmap;
679679
680− if (MTK_IOMMU_HAS_FLAG(data->plat_data, SHARE_PGTABLE))
681− data->share_dom = dom;
680+ data->share_dom = dom;
682681
683682 update_iova_region:
684683 /* Update the iova region for this domain */
drivers/irqchip/irq-xtensa-mx.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/irqdomain.h>
1313 #include <linux/irq.h>
1414 #include <linux/irqchip.h>
15+#include <linux/irqchip/xtensa-mx.h>
1516 #include <linux/of.h>
1617
1718 #include <asm/mxregs.h>
drivers/leds/led-core.c+0−4
@@ -479,10 +479,6 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data, · 478 unmodified lines
479479
480480 led_parse_fwnode_props(dev, fwnode, &props);
481481
482− /* We want to label LEDs that can produce full range of colors
483− * as RGB, not multicolor */
484− BUG_ON(props.color == LED_COLOR_ID_MULTI);
485−
486482 if (props.label) {
487483 /*
488484 * If init_data.devicename is NULL, then it indicates that
drivers/mfd/Kconfig+1−0
@@ -241,6 +241,7 @@ config MFD_CS42L43 · 240 unmodified lines
241241 tristate
242242 select MFD_CORE
243243 select REGMAP
244+ select REGMAP_IRQ
244245
245246 config MFD_CS42L43_I2C
246247 tristate "Cirrus Logic CS42L43 (I2C)"
drivers/mfd/cs42l43.c+2−2
@@ -1178,8 +1178,8 @@ err: · 1177 unmodified lines
11781178 }
11791179
11801180 EXPORT_NS_GPL_DEV_PM_OPS(cs42l43_pm_ops, MFD_CS42L43) = {
1181− SET_SYSTEM_SLEEP_PM_OPS(cs42l43_suspend, cs42l43_resume)
1182− SET_RUNTIME_PM_OPS(cs42l43_runtime_suspend, cs42l43_runtime_resume, NULL)
1181+ SYSTEM_SLEEP_PM_OPS(cs42l43_suspend, cs42l43_resume)
1182+ RUNTIME_PM_OPS(cs42l43_runtime_suspend, cs42l43_runtime_resume, NULL)
11831183 };
11841184
11851185 MODULE_DESCRIPTION("CS42L43 Core Driver");
drivers/misc/cardreader/rts5227.c+6−49
@@ -83,63 +83,20 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr *pcr) · 82 unmodified lines
8383
8484 static void rts5227_init_from_cfg(struct rtsx_pcr *pcr)
8585 {
86− struct pci_dev *pdev = pcr->pci;
87− int l1ss;
88− u32 lval;
8986 struct rtsx_cr_option *option = &pcr->option;
9087
91− l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
92− if (!l1ss)
93− return;
94−
95− pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
96−
9788 if (CHK_PCI_PID(pcr, 0x522A)) {
98− if (0 == (lval & 0x0F))
99− rtsx_pci_enable_oobs_polling(pcr);
100− else
89+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
90+ | PM_L1_1_EN | PM_L1_2_EN))
10191 rtsx_pci_disable_oobs_polling(pcr);
92+ else
93+ rtsx_pci_enable_oobs_polling(pcr);
10294 }
10395
104− if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
105− rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
106− else
107− rtsx_clear_dev_flag(pcr, ASPM_L1_1_EN);
108−
109− if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
110− rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
111− else
112− rtsx_clear_dev_flag(pcr, ASPM_L1_2_EN);
113−
114− if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
115− rtsx_set_dev_flag(pcr, PM_L1_1_EN);
116− else
117− rtsx_clear_dev_flag(pcr, PM_L1_1_EN);
118−
119− if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
120− rtsx_set_dev_flag(pcr, PM_L1_2_EN);
121− else
122− rtsx_clear_dev_flag(pcr, PM_L1_2_EN);
123−
12496 if (option->ltr_en) {
125− u16 val;
126−
127− pcie_capability_read_word(pcr->pci, PCI_EXP_DEVCTL2, &val);
128− if (val & PCI_EXP_DEVCTL2_LTR_EN) {
129− option->ltr_enabled = true;
130− option->ltr_active = true;
97+ if (option->ltr_enabled)
13198 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
132− } else {
133− option->ltr_enabled = false;
134− }
13599 }
136−
137− if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
138− | PM_L1_1_EN | PM_L1_2_EN))
139− option->force_clkreq_0 = false;
140− else
141− option->force_clkreq_0 = true;
142−
143100 }
144101
145102 static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
@@ -195,7 +152,7 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) · 49 unmodified lines
195152 }
196153 }
197154
198− if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG)
155+ if (option->force_clkreq_0)
199156 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG,
200157 FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
201158 else
drivers/misc/cardreader/rts5228.c+17−40
@@ -386,59 +386,25 @@ static void rts5228_process_ocp(struct rtsx_pcr *pcr) · 385 unmodified lines
386386
387387 static void rts5228_init_from_cfg(struct rtsx_pcr *pcr)
388388 {
389− struct pci_dev *pdev = pcr->pci;
390− int l1ss;
391− u32 lval;
392389 struct rtsx_cr_option *option = &pcr->option;
393390
394− l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
395− if (!l1ss)
396− return;
397−
398− pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
399−
400− if (0 == (lval & 0x0F))
401− rtsx_pci_enable_oobs_polling(pcr);
402− else
391+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
392+ | PM_L1_1_EN | PM_L1_2_EN))
403393 rtsx_pci_disable_oobs_polling(pcr);
404−
405− if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
406− rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
407− else
408− rtsx_clear_dev_flag(pcr, ASPM_L1_1_EN);
409−
410− if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
411− rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
412− else
413− rtsx_clear_dev_flag(pcr, ASPM_L1_2_EN);
414−
415− if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
416− rtsx_set_dev_flag(pcr, PM_L1_1_EN);
417394 else
418− rtsx_clear_dev_flag(pcr, PM_L1_1_EN);
419−
420− if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
421− rtsx_set_dev_flag(pcr, PM_L1_2_EN);
422− else
423− rtsx_clear_dev_flag(pcr, PM_L1_2_EN);
395+ rtsx_pci_enable_oobs_polling(pcr);
424396
425397 rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0);
426− if (option->ltr_en) {
427− u16 val;
428398
429− pcie_capability_read_word(pcr->pci, PCI_EXP_DEVCTL2, &val);
430− if (val & PCI_EXP_DEVCTL2_LTR_EN) {
431− option->ltr_enabled = true;
432− option->ltr_active = true;
399+ if (option->ltr_en) {
400+ if (option->ltr_enabled)
433401 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
434− } else {
435− option->ltr_enabled = false;
436− }
437402 }
438403 }
439404
440405 static int rts5228_extra_init_hw(struct rtsx_pcr *pcr)
441406 {
407+ struct rtsx_cr_option *option = &pcr->option;
442408
443409 rtsx_pci_write_register(pcr, RTS5228_AUTOLOAD_CFG1,
444410 CD_RESUME_EN_MASK, CD_RESUME_EN_MASK);
@@ -469,6 +435,17 @@ static int rts5228_extra_init_hw(struct rtsx_pcr *pcr) · 24 unmodified lines
469435 else
470436 rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00);
471437
438+ /*
439+ * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
440+ * to drive low, and we forcibly request clock.
441+ */
442+ if (option->force_clkreq_0)
443+ rtsx_pci_write_register(pcr, PETXCFG,
444+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
445+ else
446+ rtsx_pci_write_register(pcr, PETXCFG,
447+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
448+
472449 rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB);
473450
474451 if (pcr->rtd3_en) {
drivers/misc/cardreader/rts5249.c+7−49
@@ -86,64 +86,22 @@ static void rtsx_base_fetch_vendor_settings(struct rtsx_pcr *pcr) · 85 unmodified lines
8686
8787 static void rts5249_init_from_cfg(struct rtsx_pcr *pcr)
8888 {
89− struct pci_dev *pdev = pcr->pci;
90− int l1ss;
9189 struct rtsx_cr_option *option = &(pcr->option);
92− u32 lval;
93−
94− l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
95− if (!l1ss)
96− return;
97−
98− pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
9990
10091 if (CHK_PCI_PID(pcr, PID_524A) || CHK_PCI_PID(pcr, PID_525A)) {
101− if (0 == (lval & 0x0F))
102− rtsx_pci_enable_oobs_polling(pcr);
103− else
92+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
93+ | PM_L1_1_EN | PM_L1_2_EN))
10494 rtsx_pci_disable_oobs_polling(pcr);
95+ else
96+ rtsx_pci_enable_oobs_polling(pcr);
10597 }
10698
107−
108− if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
109− rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
110−
111− if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
112− rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
113−
114− if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
115− rtsx_set_dev_flag(pcr, PM_L1_1_EN);
116−
117− if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
118− rtsx_set_dev_flag(pcr, PM_L1_2_EN);
119−
12099 if (option->ltr_en) {
121− u16 val;
122−
123− pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &val);
124− if (val & PCI_EXP_DEVCTL2_LTR_EN) {
125− option->ltr_enabled = true;
126− option->ltr_active = true;
100+ if (option->ltr_enabled)
127101 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
128− } else {
129− option->ltr_enabled = false;
130− }
131102 }
132103 }
133104
134−static int rts5249_init_from_hw(struct rtsx_pcr *pcr)
135−{
136− struct rtsx_cr_option *option = &(pcr->option);
137−
138− if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
139− | PM_L1_1_EN | PM_L1_2_EN))
140− option->force_clkreq_0 = false;
141− else
142− option->force_clkreq_0 = true;
143−
144− return 0;
145−}
146−
147105 static void rts52xa_force_power_down(struct rtsx_pcr *pcr, u8 pm_state, bool runtime)
148106 {
149107 /* Set relink_time to 0 */
@@ -276,7 +234,6 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr) · 126 unmodified lines
276234 struct rtsx_cr_option *option = &(pcr->option);
277235
278236 rts5249_init_from_cfg(pcr);
279− rts5249_init_from_hw(pcr);
280237
281238 rtsx_pci_init_cmd(pcr);
282239
@@ -327,11 +284,12 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr) · 44 unmodified lines
327284 }
328285 }
329286
287+
330288 /*
331289 * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
332290 * to drive low, and we forcibly request clock.
333291 */
334− if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG)
292+ if (option->force_clkreq_0)
335293 rtsx_pci_write_register(pcr, PETXCFG,
336294 FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
337295 else
drivers/misc/cardreader/rts5260.c+13−30
@@ -480,47 +480,19 @@ static void rts5260_pwr_saving_setting(struct rtsx_pcr *pcr) · 479 unmodified lines
480480
481481 static void rts5260_init_from_cfg(struct rtsx_pcr *pcr)
482482 {
483− struct pci_dev *pdev = pcr->pci;
484− int l1ss;
485483 struct rtsx_cr_option *option = &pcr->option;
486− u32 lval;
487−
488− l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
489− if (!l1ss)
490− return;
491−
492− pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
493−
494− if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
495− rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
496−
497− if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
498− rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
499−
500− if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
501− rtsx_set_dev_flag(pcr, PM_L1_1_EN);
502−
503− if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
504− rtsx_set_dev_flag(pcr, PM_L1_2_EN);
505484
506485 rts5260_pwr_saving_setting(pcr);
507486
508487 if (option->ltr_en) {
509− u16 val;
510−
511− pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &val);
512− if (val & PCI_EXP_DEVCTL2_LTR_EN) {
513− option->ltr_enabled = true;
514− option->ltr_active = true;
488+ if (option->ltr_enabled)
515489 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
516− } else {
517− option->ltr_enabled = false;
518− }
519490 }
520491 }
521492
522493 static int rts5260_extra_init_hw(struct rtsx_pcr *pcr)
523494 {
495+ struct rtsx_cr_option *option = &pcr->option;
524496
525497 /* Set mcu_cnt to 7 to ensure data can be sampled properly */
526498 rtsx_pci_write_register(pcr, 0xFC03, 0x7F, 0x07);
@@ -539,6 +511,17 @@ static int rts5260_extra_init_hw(struct rtsx_pcr *pcr) · 12 unmodified lines
539511
540512 rts5260_init_hw(pcr);
541513
514+ /*
515+ * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
516+ * to drive low, and we forcibly request clock.
517+ */
518+ if (option->force_clkreq_0)
519+ rtsx_pci_write_register(pcr, PETXCFG,
520+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
521+ else
522+ rtsx_pci_write_register(pcr, PETXCFG,
523+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
524+
542525 rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x10, 0x00);
543526
544527 return 0;
drivers/misc/cardreader/rts5261.c+13−39
@@ -454,54 +454,17 @@ static void rts5261_init_from_hw(struct rtsx_pcr *pcr) · 453 unmodified lines
454454
455455 static void rts5261_init_from_cfg(struct rtsx_pcr *pcr)
456456 {
457− struct pci_dev *pdev = pcr->pci;
458− int l1ss;
459− u32 lval;
460457 struct rtsx_cr_option *option = &pcr->option;
461458
462− l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
463− if (!l1ss)
464− return;
465−
466− pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
467−
468− if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
469− rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
470− else
471− rtsx_clear_dev_flag(pcr, ASPM_L1_1_EN);
472−
473− if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
474− rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
475− else
476− rtsx_clear_dev_flag(pcr, ASPM_L1_2_EN);
477−
478− if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
479− rtsx_set_dev_flag(pcr, PM_L1_1_EN);
480− else
481− rtsx_clear_dev_flag(pcr, PM_L1_1_EN);
482−
483− if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
484− rtsx_set_dev_flag(pcr, PM_L1_2_EN);
485− else
486− rtsx_clear_dev_flag(pcr, PM_L1_2_EN);
487−
488− rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0);
489459 if (option->ltr_en) {
490− u16 val;
491−
492− pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &val);
493− if (val & PCI_EXP_DEVCTL2_LTR_EN) {
494− option->ltr_enabled = true;
495− option->ltr_active = true;
460+ if (option->ltr_enabled)
496461 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
497− } else {
498− option->ltr_enabled = false;
499− }
500462 }
501463 }
502464
503465 static int rts5261_extra_init_hw(struct rtsx_pcr *pcr)
504466 {
467+ struct rtsx_cr_option *option = &pcr->option;
505468 u32 val;
506469
507470 rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG1,
@@ -547,6 +510,17 @@ static int rts5261_extra_init_hw(struct rtsx_pcr *pcr) · 39 unmodified lines
547510 else
548511 rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00);
549512
513+ /*
514+ * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
515+ * to drive low, and we forcibly request clock.
516+ */
517+ if (option->force_clkreq_0)
518+ rtsx_pci_write_register(pcr, PETXCFG,
519+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
520+ else
521+ rtsx_pci_write_register(pcr, PETXCFG,
522+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
523+
550524 rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB);
551525
552526 if (pcr->rtd3_en) {
drivers/misc/cardreader/rtsx_pcr.c+46−5
@@ -1326,11 +1326,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) · 1325 unmodified lines
13261326 return err;
13271327 }
13281328
1329− if (pcr->aspm_mode == ASPM_MODE_REG) {
1329+ if (pcr->aspm_mode == ASPM_MODE_REG)
13301330 rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0x30, 0x30);
1331− rtsx_pci_write_register(pcr, PETXCFG,
1332− FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
1333− }
13341331
13351332 /* No CD interrupt if probing driver with card inserted.
13361333 * So we need to initialize pcr->card_exist here.
@@ -1345,7 +1342,9 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) · 8 unmodified lines
13451342
13461343 static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
13471344 {
1348− int err;
1345+ struct rtsx_cr_option *option = &(pcr->option);
1346+ int err, l1ss;
1347+ u32 lval;
13491348 u16 cfg_val;
13501349 u8 val;
13511350
@@ -1430,6 +1429,48 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr) · 78 unmodified lines
14301429 pcr->aspm_enabled = true;
14311430 }
14321431
1432+ l1ss = pci_find_ext_capability(pcr->pci, PCI_EXT_CAP_ID_L1SS);
1433+ if (l1ss) {
1434+ pci_read_config_dword(pcr->pci, l1ss + PCI_L1SS_CTL1, &lval);
1435+
1436+ if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
1437+ rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
1438+ else
1439+ rtsx_clear_dev_flag(pcr, ASPM_L1_1_EN);
1440+
1441+ if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
1442+ rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
1443+ else
1444+ rtsx_clear_dev_flag(pcr, ASPM_L1_2_EN);
1445+
1446+ if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
1447+ rtsx_set_dev_flag(pcr, PM_L1_1_EN);
1448+ else
1449+ rtsx_clear_dev_flag(pcr, PM_L1_1_EN);
1450+
1451+ if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
1452+ rtsx_set_dev_flag(pcr, PM_L1_2_EN);
1453+ else
1454+ rtsx_clear_dev_flag(pcr, PM_L1_2_EN);
1455+
1456+ pcie_capability_read_word(pcr->pci, PCI_EXP_DEVCTL2, &cfg_val);
1457+ if (cfg_val & PCI_EXP_DEVCTL2_LTR_EN) {
1458+ option->ltr_enabled = true;
1459+ option->ltr_active = true;
1460+ } else {
1461+ option->ltr_enabled = false;
1462+ }
1463+
1464+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
1465+ | PM_L1_1_EN | PM_L1_2_EN))
1466+ option->force_clkreq_0 = false;
1467+ else
1468+ option->force_clkreq_0 = true;
1469+ } else {
1470+ option->ltr_enabled = false;
1471+ option->force_clkreq_0 = true;
1472+ }
1473+
14331474 if (pcr->ops->fetch_vendor_settings)
14341475 pcr->ops->fetch_vendor_settings(pcr);
14351476
drivers/mtd/ubi/build.c+7−0
@@ -894,6 +894,13 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, · 893 unmodified lines
894894 return -EINVAL;
895895 }
896896
897+ /* UBI cannot work on flashes with zero erasesize. */
898+ if (!mtd->erasesize) {
899+ pr_err("ubi: refuse attaching mtd%d - zero erasesize flash is not supported\n",
900+ mtd->index);
901+ return -EINVAL;
902+ }
903+
897904 if (ubi_num == UBI_DEV_NUM_AUTO) {
898905 /* Search for an empty slot in the @ubi_devices array */
899906 for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++)
drivers/net/dsa/mv88e6xxx/chip.c+4−2
@@ -2958,14 +2958,16 @@ static void mv88e6xxx_hardware_reset(struct mv88e6xxx_chip *chip) · 2957 unmodified lines
29582958 * from the wrong location resulting in the switch booting
29592959 * to wrong mode and inoperable.
29602960 */
2961− mv88e6xxx_g1_wait_eeprom_done(chip);
2961+ if (chip->info->ops->get_eeprom)
2962+ mv88e6xxx_g2_eeprom_wait(chip);
29622963
29632964 gpiod_set_value_cansleep(gpiod, 1);
29642965 usleep_range(10000, 20000);
29652966 gpiod_set_value_cansleep(gpiod, 0);
29662967 usleep_range(10000, 20000);
29672968
2968− mv88e6xxx_g1_wait_eeprom_done(chip);
2969+ if (chip->info->ops->get_eeprom)
2970+ mv88e6xxx_g2_eeprom_wait(chip);
29692971 }
29702972 }
29712973
drivers/net/dsa/mv88e6xxx/global1.c+0−31
@@ -75,37 +75,6 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip) · 74 unmodified lines
7575 return mv88e6xxx_g1_wait_bit(chip, MV88E6XXX_G1_STS, bit, 1);
7676 }
7777
78−void mv88e6xxx_g1_wait_eeprom_done(struct mv88e6xxx_chip *chip)
79−{
80− const unsigned long timeout = jiffies + 1 * HZ;
81− u16 val;
82− int err;
83−
84− /* Wait up to 1 second for the switch to finish reading the
85− * EEPROM.
86− */
87− while (time_before(jiffies, timeout)) {
88− err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &val);
89− if (err) {
90− dev_err(chip->dev, "Error reading status");
91− return;
92− }
93−
94− /* If the switch is still resetting, it may not
95− * respond on the bus, and so MDIO read returns
96− * 0xffff. Differentiate between that, and waiting for
97− * the EEPROM to be done by bit 0 being set.
98− */
99− if (val != 0xffff &&
100− val & BIT(MV88E6XXX_G1_STS_IRQ_EEPROM_DONE))
101− return;
102−
103− usleep_range(1000, 2000);
104− }
105−
106− dev_err(chip->dev, "Timeout waiting for EEPROM done");
107−}
108−
10978 /* Offset 0x01: Switch MAC Address Register Bytes 0 & 1
11079 * Offset 0x02: Switch MAC Address Register Bytes 2 & 3
11180 * Offset 0x03: Switch MAC Address Register Bytes 4 & 5
drivers/net/dsa/mv88e6xxx/global1.h+0−1
@@ -282,7 +282,6 @@ int mv88e6xxx_g1_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr); · 281 unmodified lines
282282 int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip);
283283 int mv88e6352_g1_reset(struct mv88e6xxx_chip *chip);
284284 int mv88e6250_g1_reset(struct mv88e6xxx_chip *chip);
285−void mv88e6xxx_g1_wait_eeprom_done(struct mv88e6xxx_chip *chip);
286285
287286 int mv88e6185_g1_ppu_enable(struct mv88e6xxx_chip *chip);
288287 int mv88e6185_g1_ppu_disable(struct mv88e6xxx_chip *chip);
drivers/net/dsa/mv88e6xxx/global2.c+1−1
@@ -340,7 +340,7 @@ int mv88e6xxx_g2_pot_clear(struct mv88e6xxx_chip *chip) · 339 unmodified lines
340340 * Offset 0x15: EEPROM Addr (for 8-bit data access)
341341 */
342342
343−static int mv88e6xxx_g2_eeprom_wait(struct mv88e6xxx_chip *chip)
343+int mv88e6xxx_g2_eeprom_wait(struct mv88e6xxx_chip *chip)
344344 {
345345 int bit = __bf_shf(MV88E6XXX_G2_EEPROM_CMD_BUSY);
346346 int err;
drivers/net/dsa/mv88e6xxx/global2.h+1−0
@@ -365,6 +365,7 @@ int mv88e6xxx_g2_trunk_clear(struct mv88e6xxx_chip *chip); · 364 unmodified lines
365365
366366 int mv88e6xxx_g2_device_mapping_write(struct mv88e6xxx_chip *chip, int target,
367367 int port);
368+int mv88e6xxx_g2_eeprom_wait(struct mv88e6xxx_chip *chip);
368369
369370 extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops;
370371 extern const struct mv88e6xxx_irq_ops mv88e6250_watchdog_ops;
drivers/net/ethernet/ibm/ibmveth.c+12−13
@@ -1303,24 +1303,23 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb, · 1302 unmodified lines
13031303 * the user space for finding a flow. During this process, OVS computes
13041304 * checksum on the first packet when CHECKSUM_PARTIAL flag is set.
13051305 *
1306− * So, re-compute TCP pseudo header checksum when configured for
1307− * trunk mode.
1306+ * So, re-compute TCP pseudo header checksum.
13081307 */
1308+
13091309 if (iph_proto == IPPROTO_TCP) {
13101310 struct tcphdr *tcph = (struct tcphdr *)(skb->data + iphlen);
1311+
13111312 if (tcph->check == 0x0000) {
13121313 /* Recompute TCP pseudo header checksum */
1313− if (adapter->is_active_trunk) {
1314− tcphdrlen = skb->len - iphlen;
1315− if (skb_proto == ETH_P_IP)
1316− tcph->check =
1317− ~csum_tcpudp_magic(iph->saddr,
1318− iph->daddr, tcphdrlen, iph_proto, 0);
1319− else if (skb_proto == ETH_P_IPV6)
1320− tcph->check =
1321− ~csum_ipv6_magic(&iph6->saddr,
1322− &iph6->daddr, tcphdrlen, iph_proto, 0);
1323− }
1314+ tcphdrlen = skb->len - iphlen;
1315+ if (skb_proto == ETH_P_IP)
1316+ tcph->check =
1317+ ~csum_tcpudp_magic(iph->saddr,
1318+ iph->daddr, tcphdrlen, iph_proto, 0);
1319+ else if (skb_proto == ETH_P_IPV6)
1320+ tcph->check =
1321+ ~csum_ipv6_magic(&iph6->saddr,
1322+ &iph6->daddr, tcphdrlen, iph_proto, 0);
13241323 /* Setup SKB fields for checksum offload */
13251324 skb_partial_csum_set(skb, iphlen,
13261325 offsetof(struct tcphdr, check));
drivers/net/ethernet/intel/ice/ice_virtchnl.c+7−5
@@ -2655,12 +2655,14 @@ static int ice_vc_query_rxdid(struct ice_vf *vf) · 2654 unmodified lines
26552655 goto err;
26562656 }
26572657
2658− /* Read flexiflag registers to determine whether the
2659− * corresponding RXDID is configured and supported or not.
2660− * Since Legacy 16byte descriptor format is not supported,
2661− * start from Legacy 32byte descriptor.
2658+ /* RXDIDs supported by DDP package can be read from the register
2659+ * to get the supported RXDID bitmap. But the legacy 32byte RXDID
2660+ * is not listed in DDP package, add it in the bitmap manually.
2661+ * Legacy 16byte descriptor is not supported.
26622662 */
2663− for (i = ICE_RXDID_LEGACY_1; i < ICE_FLEX_DESC_RXDID_MAX_NUM; i++) {
2663+ rxdid->supported_rxdids |= BIT(ICE_RXDID_LEGACY_1);
2664+
2665+ for (i = ICE_RXDID_FLEX_NIC; i < ICE_FLEX_DESC_RXDID_MAX_NUM; i++) {
26642666 regval = rd32(hw, GLFLXP_RXDID_FLAGS(i, 0));
26652667 if ((regval >> GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_S)
26662668 & GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_M)
drivers/net/ethernet/marvell/sky2.h+1−1
@@ -2195,7 +2195,7 @@ struct rx_ring_info { · 2194 unmodified lines
21952195 struct sk_buff *skb;
21962196 dma_addr_t data_addr;
21972197 DEFINE_DMA_UNMAP_LEN(data_size);
2198− dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT];
2198+ dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT ?: 1];
21992199 };
22002200
22012201 enum flow_control {
drivers/net/ethernet/mediatek/mtk_eth_soc.c+2−2
@@ -3172,8 +3172,8 @@ static irqreturn_t mtk_handle_irq_rx(int irq, void *_eth) · 3171 unmodified lines
31723172
31733173 eth->rx_events++;
31743174 if (likely(napi_schedule_prep(&eth->rx_napi))) {
3175− __napi_schedule(&eth->rx_napi);
31763175 mtk_rx_irq_disable(eth, eth->soc->txrx.rx_irq_done_mask);
3176+ __napi_schedule(&eth->rx_napi);
31773177 }
31783178
31793179 return IRQ_HANDLED;
@@ -3185,8 +3185,8 @@ static irqreturn_t mtk_handle_irq_tx(int irq, void *_eth) · 5 unmodified lines
31853185
31863186 eth->tx_events++;
31873187 if (likely(napi_schedule_prep(&eth->tx_napi))) {
3188− __napi_schedule(&eth->tx_napi);
31893188 mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
3189+ __napi_schedule(&eth->tx_napi);
31903190 }
31913191
31923192 return IRQ_HANDLED;
drivers/net/ethernet/microchip/Kconfig+1−0
@@ -46,6 +46,7 @@ config LAN743X · 45 unmodified lines
4646 tristate "LAN743x support"
4747 depends on PCI
4848 depends on PTP_1588_CLOCK_OPTIONAL
49+ select PHYLIB
4950 select FIXED_PHY
5051 select CRC16
5152 select CRC32
drivers/net/ethernet/microsoft/mana/mana_en.c+146−65
@@ -91,63 +91,137 @@ static unsigned int mana_checksum_info(struct sk_buff *skb) · 90 unmodified lines
9191 return 0;
9292 }
9393
94+static void mana_add_sge(struct mana_tx_package *tp, struct mana_skb_head *ash,
95+ int sg_i, dma_addr_t da, int sge_len, u32 gpa_mkey)
96+{
97+ ash->dma_handle[sg_i] = da;
98+ ash->size[sg_i] = sge_len;
99+
100+ tp->wqe_req.sgl[sg_i].address = da;
101+ tp->wqe_req.sgl[sg_i].mem_key = gpa_mkey;
102+ tp->wqe_req.sgl[sg_i].size = sge_len;
103+}
104+
94105 static int mana_map_skb(struct sk_buff *skb, struct mana_port_context *apc,
95− struct mana_tx_package *tp)
106+ struct mana_tx_package *tp, int gso_hs)
96107 {
97108 struct mana_skb_head *ash = (struct mana_skb_head *)skb->head;
109+ int hsg = 1; /* num of SGEs of linear part */
98110 struct gdma_dev *gd = apc->ac->gdma_dev;
111+ int skb_hlen = skb_headlen(skb);
112+ int sge0_len, sge1_len = 0;
99113 struct gdma_context *gc;
100114 struct device *dev;
101115 skb_frag_t *frag;
102116 dma_addr_t da;
117+ int sg_i;
103118 int i;
104119
105120 gc = gd->gdma_context;
106121 dev = gc->dev;
107− da = dma_map_single(dev, skb->data, skb_headlen(skb), DMA_TO_DEVICE);
108122
123+ if (gso_hs && gso_hs < skb_hlen) {
124+ sge0_len = gso_hs;
125+ sge1_len = skb_hlen - gso_hs;
126+ } else {
127+ sge0_len = skb_hlen;
128+ }
129+
130+ da = dma_map_single(dev, skb->data, sge0_len, DMA_TO_DEVICE);
109131 if (dma_mapping_error(dev, da))
110132 return -ENOMEM;
111133
112− ash->dma_handle[0] = da;
113− ash->size[0] = skb_headlen(skb);
134+ mana_add_sge(tp, ash, 0, da, sge0_len, gd->gpa_mkey);
114135
115− tp->wqe_req.sgl[0].address = ash->dma_handle[0];
116− tp->wqe_req.sgl[0].mem_key = gd->gpa_mkey;
117− tp->wqe_req.sgl[0].size = ash->size[0];
136+ if (sge1_len) {
137+ sg_i = 1;
138+ da = dma_map_single(dev, skb->data + sge0_len, sge1_len,
139+ DMA_TO_DEVICE);
140+ if (dma_mapping_error(dev, da))
141+ goto frag_err;
142+
143+ mana_add_sge(tp, ash, sg_i, da, sge1_len, gd->gpa_mkey);
144+ hsg = 2;
145+ }
118146
119147 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
148+ sg_i = hsg + i;
149+
120150 frag = &skb_shinfo(skb)->frags[i];
121151 da = skb_frag_dma_map(dev, frag, 0, skb_frag_size(frag),
122152 DMA_TO_DEVICE);
123−
124153 if (dma_mapping_error(dev, da))
125154 goto frag_err;
126155
127− ash->dma_handle[i + 1] = da;
128− ash->size[i + 1] = skb_frag_size(frag);
129−
130− tp->wqe_req.sgl[i + 1].address = ash->dma_handle[i + 1];
131− tp->wqe_req.sgl[i + 1].mem_key = gd->gpa_mkey;
132− tp->wqe_req.sgl[i + 1].size = ash->size[i + 1];
156+ mana_add_sge(tp, ash, sg_i, da, skb_frag_size(frag),
157+ gd->gpa_mkey);
133158 }
134159
135160 return 0;
136161
137162 frag_err:
138− for (i = i - 1; i >= 0; i--)
139− dma_unmap_page(dev, ash->dma_handle[i + 1], ash->size[i + 1],
163+ for (i = sg_i - 1; i >= hsg; i--)
164+ dma_unmap_page(dev, ash->dma_handle[i], ash->size[i],
140165 DMA_TO_DEVICE);
141166
142− dma_unmap_single(dev, ash->dma_handle[0], ash->size[0], DMA_TO_DEVICE);
167+ for (i = hsg - 1; i >= 0; i--)
168+ dma_unmap_single(dev, ash->dma_handle[i], ash->size[i],
169+ DMA_TO_DEVICE);
143170
144171 return -ENOMEM;
145172 }
146173
174+/* Handle the case when GSO SKB linear length is too large.
175+ * MANA NIC requires GSO packets to put only the packet header to SGE0.
176+ * So, we need 2 SGEs for the skb linear part which contains more than the
177+ * header.
178+ * Return a positive value for the number of SGEs, or a negative value
179+ * for an error.
180+ */
181+static int mana_fix_skb_head(struct net_device *ndev, struct sk_buff *skb,
182+ int gso_hs)
183+{
184+ int num_sge = 1 + skb_shinfo(skb)->nr_frags;
185+ int skb_hlen = skb_headlen(skb);
186+
187+ if (gso_hs < skb_hlen) {
188+ num_sge++;
189+ } else if (gso_hs > skb_hlen) {
190+ if (net_ratelimit())
191+ netdev_err(ndev,
192+ "TX nonlinear head: hs:%d, skb_hlen:%d\n",
193+ gso_hs, skb_hlen);
194+
195+ return -EINVAL;
196+ }
197+
198+ return num_sge;
199+}
200+
201+/* Get the GSO packet's header size */
202+static int mana_get_gso_hs(struct sk_buff *skb)
203+{
204+ int gso_hs;
205+
206+ if (skb->encapsulation) {
207+ gso_hs = skb_inner_tcp_all_headers(skb);
208+ } else {
209+ if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
210+ gso_hs = skb_transport_offset(skb) +
211+ sizeof(struct udphdr);
212+ } else {
213+ gso_hs = skb_tcp_all_headers(skb);
214+ }
215+ }
216+
217+ return gso_hs;
218+}
219+
147220 netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
148221 {
149222 enum mana_tx_pkt_format pkt_fmt = MANA_SHORT_PKT_FMT;
150223 struct mana_port_context *apc = netdev_priv(ndev);
224+ int gso_hs = 0; /* zero for non-GSO pkts */
151225 u16 txq_idx = skb_get_queue_mapping(skb);
152226 struct gdma_dev *gd = apc->ac->gdma_dev;
153227 bool ipv4 = false, ipv6 = false;
@@ -159,7 +233,6 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 5 unmodified lines
159233 struct mana_txq *txq;
160234 struct mana_cq *cq;
161235 int err, len;
162− u16 ihs;
163236
164237 if (unlikely(!apc->port_is_up))
165238 goto tx_drop;
@@ -209,19 +282,6 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 43 unmodified lines
209282 pkg.wqe_req.client_data_unit = 0;
210283
211284 pkg.wqe_req.num_sge = 1 + skb_shinfo(skb)->nr_frags;
212− WARN_ON_ONCE(pkg.wqe_req.num_sge > MAX_TX_WQE_SGL_ENTRIES);
213−
214− if (pkg.wqe_req.num_sge <= ARRAY_SIZE(pkg.sgl_array)) {
215− pkg.wqe_req.sgl = pkg.sgl_array;
216− } else {
217− pkg.sgl_ptr = kmalloc_array(pkg.wqe_req.num_sge,
218− sizeof(struct gdma_sge),
219− GFP_ATOMIC);
220− if (!pkg.sgl_ptr)
221− goto tx_drop_count;
222−
223− pkg.wqe_req.sgl = pkg.sgl_ptr;
224− }
225285
226286 if (skb->protocol == htons(ETH_P_IP))
227287 ipv4 = true;
@@ -229,6 +289,26 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 1 unmodified line
229289 ipv6 = true;
230290
231291 if (skb_is_gso(skb)) {
292+ int num_sge;
293+
294+ gso_hs = mana_get_gso_hs(skb);
295+
296+ num_sge = mana_fix_skb_head(ndev, skb, gso_hs);
297+ if (num_sge > 0)
298+ pkg.wqe_req.num_sge = num_sge;
299+ else
300+ goto tx_drop_count;
301+
302+ u64_stats_update_begin(&tx_stats->syncp);
303+ if (skb->encapsulation) {
304+ tx_stats->tso_inner_packets++;
305+ tx_stats->tso_inner_bytes += skb->len - gso_hs;
306+ } else {
307+ tx_stats->tso_packets++;
308+ tx_stats->tso_bytes += skb->len - gso_hs;
309+ }
310+ u64_stats_update_end(&tx_stats->syncp);
311+
232312 pkg.tx_oob.s_oob.is_outer_ipv4 = ipv4;
233313 pkg.tx_oob.s_oob.is_outer_ipv6 = ipv6;
234314
@@ -252,28 +332,6 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 17 unmodified lines
252332 &ipv6_hdr(skb)->daddr, 0,
253333 IPPROTO_TCP, 0);
254334 }
255−
256− if (skb->encapsulation) {
257− ihs = skb_inner_tcp_all_headers(skb);
258− u64_stats_update_begin(&tx_stats->syncp);
259− tx_stats->tso_inner_packets++;
260− tx_stats->tso_inner_bytes += skb->len - ihs;
261− u64_stats_update_end(&tx_stats->syncp);
262− } else {
263− if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
264− ihs = skb_transport_offset(skb) + sizeof(struct udphdr);
265− } else {
266− ihs = skb_tcp_all_headers(skb);
267− if (ipv6_has_hopopt_jumbo(skb))
268− ihs -= sizeof(struct hop_jumbo_hdr);
269− }
270−
271− u64_stats_update_begin(&tx_stats->syncp);
272− tx_stats->tso_packets++;
273− tx_stats->tso_bytes += skb->len - ihs;
274− u64_stats_update_end(&tx_stats->syncp);
275− }
276−
277335 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
278336 csum_type = mana_checksum_info(skb);
279337
@@ -296,11 +354,25 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 16 unmodified lines
296354 } else {
297355 /* Can't do offload of this type of checksum */
298356 if (skb_checksum_help(skb))
299− goto free_sgl_ptr;
357+ goto tx_drop_count;
300358 }
301359 }
302360
303− if (mana_map_skb(skb, apc, &pkg)) {
361+ WARN_ON_ONCE(pkg.wqe_req.num_sge > MAX_TX_WQE_SGL_ENTRIES);
362+
363+ if (pkg.wqe_req.num_sge <= ARRAY_SIZE(pkg.sgl_array)) {
364+ pkg.wqe_req.sgl = pkg.sgl_array;
365+ } else {
366+ pkg.sgl_ptr = kmalloc_array(pkg.wqe_req.num_sge,
367+ sizeof(struct gdma_sge),
368+ GFP_ATOMIC);
369+ if (!pkg.sgl_ptr)
370+ goto tx_drop_count;
371+
372+ pkg.wqe_req.sgl = pkg.sgl_ptr;
373+ }
374+
375+ if (mana_map_skb(skb, apc, &pkg, gso_hs)) {
304376 u64_stats_update_begin(&tx_stats->syncp);
305377 tx_stats->mana_map_err++;
306378 u64_stats_update_end(&tx_stats->syncp);
@@ -1258,11 +1330,16 @@ static void mana_unmap_skb(struct sk_buff *skb, struct mana_port_context *apc) · 951 unmodified lines
12581330 struct mana_skb_head *ash = (struct mana_skb_head *)skb->head;
12591331 struct gdma_context *gc = apc->ac->gdma_dev->gdma_context;
12601332 struct device *dev = gc->dev;
1261− int i;
1333+ int hsg, i;
12621334
1263− dma_unmap_single(dev, ash->dma_handle[0], ash->size[0], DMA_TO_DEVICE);
1335+ /* Number of SGEs of linear part */
1336+ hsg = (skb_is_gso(skb) && skb_headlen(skb) > ash->size[0]) ? 2 : 1;
12641337
1265− for (i = 1; i < skb_shinfo(skb)->nr_frags + 1; i++)
1338+ for (i = 0; i < hsg; i++)
1339+ dma_unmap_single(dev, ash->dma_handle[i], ash->size[i],
1340+ DMA_TO_DEVICE);
1341+
1342+ for (i = hsg; i < skb_shinfo(skb)->nr_frags + hsg; i++)
12661343 dma_unmap_page(dev, ash->dma_handle[i], ash->size[i],
12671344 DMA_TO_DEVICE);
12681345 }
@@ -1317,19 +1394,23 @@ static void mana_poll_tx_cq(struct mana_cq *cq) · 48 unmodified lines
13171394 case CQE_TX_VPORT_IDX_OUT_OF_RANGE:
13181395 case CQE_TX_VPORT_DISABLED:
13191396 case CQE_TX_VLAN_TAGGING_VIOLATION:
1320− WARN_ONCE(1, "TX: CQE error %d: ignored.\n",
1321− cqe_oob->cqe_hdr.cqe_type);
1397+ if (net_ratelimit())
1398+ netdev_err(ndev, "TX: CQE error %d\n",
1399+ cqe_oob->cqe_hdr.cqe_type);
1400+
13221401 apc->eth_stats.tx_cqe_err++;
13231402 break;
13241403
13251404 default:
1326− /* If the CQE type is unexpected, log an error, assert,
1327− * and go through the error path.
1405+ /* If the CQE type is unknown, log an error,
1406+ * and still free the SKB, update tail, etc.
13281407 */
1329− WARN_ONCE(1, "TX: Unexpected CQE type %d: HW BUG?\n",
1330− cqe_oob->cqe_hdr.cqe_type);
1408+ if (net_ratelimit())
1409+ netdev_err(ndev, "TX: unknown CQE type %d\n",
1410+ cqe_oob->cqe_hdr.cqe_type);
1411+
13311412 apc->eth_stats.tx_cqe_unknown_type++;
1332− return;
1413+ break;
13331414 }
13341415
13351416 if (WARN_ON_ONCE(txq->gdma_txq_id != completions[i].wq_num))
drivers/net/ethernet/qlogic/qed/qed_ll2.h+1−1
@@ -110,9 +110,9 @@ struct qed_ll2_info { · 109 unmodified lines
110110 enum core_tx_dest tx_dest;
111111 u8 tx_stats_en;
112112 bool main_func_queue;
113+ struct qed_ll2_cbs cbs;
113114 struct qed_ll2_rx_queue rx_queue;
114115 struct qed_ll2_tx_queue tx_queue;
115− struct qed_ll2_cbs cbs;
116116 };
117117
118118 extern const struct qed_ll2_ops qed_ll2_ops_pass;
drivers/net/ethernet/renesas/rswitch.c+12−1
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 * Copyright (C) 2022 Renesas Electronics Corporation
55 */
66
7+#include <linux/clk.h>
78 #include <linux/dma-mapping.h>
89 #include <linux/err.h>
910 #include <linux/etherdevice.h>
@@ -1049,7 +1050,7 @@ static void rswitch_rmac_setting(struct rswitch_etha *etha, const u8 *mac) · 1039 unmodified lines
10491050 static void rswitch_etha_enable_mii(struct rswitch_etha *etha)
10501051 {
10511052 rswitch_modify(etha->addr, MPIC, MPIC_PSMCS_MASK | MPIC_PSMHT_MASK,
1052− MPIC_PSMCS(0x05) | MPIC_PSMHT(0x06));
1053+ MPIC_PSMCS(etha->psmcs) | MPIC_PSMHT(0x06));
10531054 rswitch_modify(etha->addr, MPSM, 0, MPSM_MFF_C45);
10541055 }
10551056
@@ -1693,6 +1694,12 @@ static void rswitch_etha_init(struct rswitch_private *priv, int index) · 637 unmodified lines
16931694 etha->index = index;
16941695 etha->addr = priv->addr + RSWITCH_ETHA_OFFSET + index * RSWITCH_ETHA_SIZE;
16951696 etha->coma_addr = priv->addr;
1697+
1698+ /* MPIC.PSMCS = (clk [MHz] / (MDC frequency [MHz] * 2) - 1.
1699+ * Calculating PSMCS value as MDC frequency = 2.5MHz. So, multiply
1700+ * both the numerator and the denominator by 10.
1701+ */
1702+ etha->psmcs = clk_get_rate(priv->clk) / 100000 / (25 * 2) - 1;
16961703 }
16971704
16981705 static int rswitch_device_alloc(struct rswitch_private *priv, int index)
@@ -1900,6 +1907,10 @@ static int renesas_eth_sw_probe(struct platform_device *pdev) · 201 unmodified lines
19001907 return -ENOMEM;
19011908 spin_lock_init(&priv->lock);
19021909
1910+ priv->clk = devm_clk_get(&pdev->dev, NULL);
1911+ if (IS_ERR(priv->clk))
1912+ return PTR_ERR(priv->clk);
1913+
19031914 attr = soc_device_match(rswitch_soc_no_speed_change);
19041915 if (attr)
19051916 priv->etha_no_runtime_change = true;
drivers/net/ethernet/renesas/rswitch.h+2−0
@@ -915,6 +915,7 @@ struct rswitch_etha { · 914 unmodified lines
915915 bool external_phy;
916916 struct mii_bus *mii;
917917 phy_interface_t phy_interface;
918+ u32 psmcs;
918919 u8 mac_addr[MAX_ADDR_LEN];
919920 int link;
920921 int speed;
@@ -1012,6 +1013,7 @@ struct rswitch_private { · 91 unmodified lines
10121013 struct rswitch_mfwd mfwd;
10131014
10141015 spinlock_t lock; /* lock interrupt registers' control */
1016+ struct clk *clk;
10151017
10161018 bool etha_no_runtime_change;
10171019 bool gwca_halt;
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c+5−2
@@ -104,6 +104,7 @@ struct stm32_ops { · 103 unmodified lines
104104 int (*parse_data)(struct stm32_dwmac *dwmac,
105105 struct device *dev);
106106 u32 syscfg_eth_mask;
107+ bool clk_rx_enable_in_suspend;
107108 };
108109
109110 static int stm32_dwmac_init(struct plat_stmmacenet_data *plat_dat)
@@ -121,7 +122,8 @@ static int stm32_dwmac_init(struct plat_stmmacenet_data *plat_dat) · 11 unmodified lines
121122 if (ret)
122123 return ret;
123124
124− if (!dwmac->dev->power.is_suspended) {
125+ if (!dwmac->ops->clk_rx_enable_in_suspend ||
126+ !dwmac->dev->power.is_suspended) {
125127 ret = clk_prepare_enable(dwmac->clk_rx);
126128 if (ret) {
127129 clk_disable_unprepare(dwmac->clk_tx);
@@ -508,7 +510,8 @@ static struct stm32_ops stm32mp1_dwmac_data = { · 380 unmodified lines
508510 .suspend = stm32mp1_suspend,
509511 .resume = stm32mp1_resume,
510512 .parse_data = stm32mp1_parse_data,
511− .syscfg_eth_mask = SYSCFG_MP1_ETH_MASK
513+ .syscfg_eth_mask = SYSCFG_MP1_ETH_MASK,
514+ .clk_rx_enable_in_suspend = true
512515 };
513516
514517 static const struct of_device_id stm32_dwmac_match[] = {
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+0−30
@@ -6012,33 +6012,6 @@ static irqreturn_t stmmac_msi_intr_rx(int irq, void *data) · 6011 unmodified lines
60126012 return IRQ_HANDLED;
60136013 }
60146014
6015−#ifdef CONFIG_NET_POLL_CONTROLLER
6016−/* Polling receive - used by NETCONSOLE and other diagnostic tools
6017− * to allow network I/O with interrupts disabled.
6018− */
6019−static void stmmac_poll_controller(struct net_device *dev)
6020−{
6021− struct stmmac_priv *priv = netdev_priv(dev);
6022− int i;
6023−
6024− /* If adapter is down, do nothing */
6025− if (test_bit(STMMAC_DOWN, &priv->state))
6026− return;
6027−
6028− if (priv->plat->flags & STMMAC_FLAG_MULTI_MSI_EN) {
6029− for (i = 0; i < priv->plat->rx_queues_to_use; i++)
6030− stmmac_msi_intr_rx(0, &priv->dma_conf.rx_queue[i]);
6031−
6032− for (i = 0; i < priv->plat->tx_queues_to_use; i++)
6033− stmmac_msi_intr_tx(0, &priv->dma_conf.tx_queue[i]);
6034− } else {
6035− disable_irq(dev->irq);
6036− stmmac_interrupt(dev->irq, dev);
6037− enable_irq(dev->irq);
6038− }
6039−}
6040−#endif
6041−
60426015 /**
60436016 * stmmac_ioctl - Entry point for the Ioctl
60446017 * @dev: Device pointer.
@@ -6999,9 +6972,6 @@ static const struct net_device_ops stmmac_netdev_ops = { · 954 unmodified lines
69996972 .ndo_get_stats64 = stmmac_get_stats64,
70006973 .ndo_setup_tc = stmmac_setup_tc,
70016974 .ndo_select_queue = stmmac_select_queue,
7002−#ifdef CONFIG_NET_POLL_CONTROLLER
7003− .ndo_poll_controller = stmmac_poll_controller,
7004−#endif
70056975 .ndo_set_mac_address = stmmac_set_mac_address,
70066976 .ndo_vlan_rx_add_vid = stmmac_vlan_rx_add_vid,
70076977 .ndo_vlan_rx_kill_vid = stmmac_vlan_rx_kill_vid,
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c+1−1
@@ -874,7 +874,7 @@ static int __maybe_unused stmmac_pltfr_resume(struct device *dev) · 873 unmodified lines
874874 struct platform_device *pdev = to_platform_device(dev);
875875 int ret;
876876
877− ret = stmmac_pltfr_init(pdev, priv->plat->bsp_priv);
877+ ret = stmmac_pltfr_init(pdev, priv->plat);
878878 if (ret)
879879 return ret;
880880
drivers/net/ethernet/ti/am65-cpsw-nuss.c+2−1
@@ -1747,9 +1747,10 @@ static int am65_cpsw_nuss_init_tx_chns(struct am65_cpsw_common *common) · 1746 unmodified lines
17471747 }
17481748
17491749 tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
1750− if (tx_chn->irq <= 0) {
1750+ if (tx_chn->irq < 0) {
17511751 dev_err(dev, "Failed to get tx dma irq %d\n",
17521752 tx_chn->irq);
1753+ ret = tx_chn->irq;
17531754 goto err;
17541755 }
17551756
drivers/net/ethernet/ti/icssg/icssg_prueth.c+3−3
@@ -316,12 +316,12 @@ static int prueth_init_tx_chns(struct prueth_emac *emac) · 315 unmodified lines
316316 goto fail;
317317 }
318318
319− tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
320− if (tx_chn->irq <= 0) {
321− ret = -EINVAL;
319+ ret = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
320+ if (ret < 0) {
322321 netdev_err(ndev, "failed to get tx irq\n");
323322 goto fail;
324323 }
324+ tx_chn->irq = ret;
325325
326326 snprintf(tx_chn->name, sizeof(tx_chn->name), "%s-tx%d",
327327 dev_name(dev), tx_chn->id);
drivers/net/usb/smsc75xx.c+3−1
@@ -90,7 +90,9 @@ static int __must_check __smsc75xx_read_reg(struct usbnet *dev, u32 index, · 89 unmodified lines
9090 ret = fn(dev, USB_VENDOR_REQUEST_READ_REGISTER, USB_DIR_IN
9191 | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
9292 0, index, &buf, 4);
93− if (unlikely(ret < 0)) {
93+ if (unlikely(ret < 4)) {
94+ ret = ret < 0 ? ret : -ENODATA;
95+
9496 netdev_warn(dev->net, "Failed to read reg index 0x%08x: %d\n",
9597 index, ret);
9698 return ret;
drivers/net/wan/fsl_ucc_hdlc.c+10−2
@@ -34,6 +34,8 @@ · 33 unmodified lines
3434 #define TDM_PPPOHT_SLIC_MAXIN
3535 #define RX_BD_ERRORS (R_CD_S | R_OV_S | R_CR_S | R_AB_S | R_NO_S | R_LG_S)
3636
37+static int uhdlc_close(struct net_device *dev);
38+
3739 static struct ucc_tdm_info utdm_primary_info = {
3840 .uf_info = {
3941 .tsa = 0,
@@ -708,6 +710,7 @@ static int uhdlc_open(struct net_device *dev) · 668 unmodified lines
708710 hdlc_device *hdlc = dev_to_hdlc(dev);
709711 struct ucc_hdlc_private *priv = hdlc->priv;
710712 struct ucc_tdm *utdm = priv->utdm;
713+ int rc = 0;
711714
712715 if (priv->hdlc_busy != 1) {
713716 if (request_irq(priv->ut_info->uf_info.irq,
@@ -731,10 +734,13 @@ static int uhdlc_open(struct net_device *dev) · 17 unmodified lines
731734 napi_enable(&priv->napi);
732735 netdev_reset_queue(dev);
733736 netif_start_queue(dev);
734− hdlc_open(dev);
737+
738+ rc = hdlc_open(dev);
739+ if (rc)
740+ uhdlc_close(dev);
735741 }
736742
737− return 0;
743+ return rc;
738744 }
739745
740746 static void uhdlc_memclean(struct ucc_hdlc_private *priv)
@@ -824,6 +830,8 @@ static int uhdlc_close(struct net_device *dev) · 83 unmodified lines
824830 netdev_reset_queue(dev);
825831 priv->hdlc_busy = 0;
826832
833+ hdlc_close(dev);
834+
827835 return 0;
828836 }
829837
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h+7−2
@@ -442,7 +442,12 @@ struct brcmf_scan_params_v2_le { · 441 unmodified lines
442442 * fixed parameter portion is assumed, otherwise
443443 * ssid in the fixed portion is ignored
444444 */
445− __le16 channel_list[1]; /* list of chanspecs */
445+ union {
446+ __le16 padding; /* Reserve space for at least 1 entry for abort
447+ * which uses an on stack brcmf_scan_params_v2_le
448+ */
449+ DECLARE_FLEX_ARRAY(__le16, channel_list); /* chanspecs */
450+ };
446451 };
447452
448453 struct brcmf_scan_results {
@@ -702,7 +707,7 @@ struct brcmf_sta_info_le { · 253 unmodified lines
702707
703708 struct brcmf_chanspec_list {
704709 __le32 count; /* # of entries */
705− __le32 element[1]; /* variable length uint32 list */
710+ __le32 element[]; /* variable length uint32 list */
706711 };
707712
708713 /*
drivers/net/wireless/intel/iwlwifi/fw/error-dump.h+3−3
@@ -310,9 +310,9 @@ struct iwl_fw_ini_fifo_hdr { · 309 unmodified lines
310310 struct iwl_fw_ini_error_dump_range {
311311 __le32 range_data_size;
312312 union {
313− __le32 internal_base_addr;
314− __le64 dram_base_addr;
315− __le32 page_num;
313+ __le32 internal_base_addr __packed;
314+ __le64 dram_base_addr __packed;
315+ __le32 page_num __packed;
316316 struct iwl_fw_ini_fifo_hdr fifo_hdr;
317317 struct iwl_cmd_header fw_pkt_hdr;
318318 };
drivers/net/wireless/intel/iwlwifi/mvm/fw.c+1−1
@@ -802,7 +802,7 @@ out: · 801 unmodified lines
802802 mvm->nvm_data->bands[0].n_channels = 1;
803803 mvm->nvm_data->bands[0].n_bitrates = 1;
804804 mvm->nvm_data->bands[0].bitrates =
805− (void *)((u8 *)mvm->nvm_data->channels + 1);
805+ (void *)(mvm->nvm_data->channels + 1);
806806 mvm->nvm_data->bands[0].bitrates->hw_value = 10;
807807 }
808808
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c+63−58
@@ -731,73 +731,78 @@ static void iwl_mvm_mld_vif_cfg_changed_station(struct iwl_mvm *mvm, · 730 unmodified lines
731731
732732 mvmvif->associated = vif->cfg.assoc;
733733
734− if (!(changes & BSS_CHANGED_ASSOC))
735− return;
736−
737− if (vif->cfg.assoc) {
738− /* clear statistics to get clean beacon counter */
739− iwl_mvm_request_statistics(mvm, true);
740− iwl_mvm_sf_update(mvm, vif, false);
741− iwl_mvm_power_vif_assoc(mvm, vif);
742−
743− for_each_mvm_vif_valid_link(mvmvif, i) {
744− memset(&mvmvif->link[i]->beacon_stats, 0,
745− sizeof(mvmvif->link[i]->beacon_stats));
734+ if (changes & BSS_CHANGED_ASSOC) {
735+ if (vif->cfg.assoc) {
736+ /* clear statistics to get clean beacon counter */
737+ iwl_mvm_request_statistics(mvm, true);
738+ iwl_mvm_sf_update(mvm, vif, false);
739+ iwl_mvm_power_vif_assoc(mvm, vif);
740+
741+ for_each_mvm_vif_valid_link(mvmvif, i) {
742+ memset(&mvmvif->link[i]->beacon_stats, 0,
743+ sizeof(mvmvif->link[i]->beacon_stats));
744+
745+ if (vif->p2p) {
746+ iwl_mvm_update_smps(mvm, vif,
747+ IWL_MVM_SMPS_REQ_PROT,
748+ IEEE80211_SMPS_DYNAMIC, i);
749+ }
750+
751+ rcu_read_lock();
752+ link_conf = rcu_dereference(vif->link_conf[i]);
753+ if (link_conf && !link_conf->dtim_period)
754+ protect = true;
755+ rcu_read_unlock();
756+ }
746757
747− if (vif->p2p) {
748− iwl_mvm_update_smps(mvm, vif,
749− IWL_MVM_SMPS_REQ_PROT,
750− IEEE80211_SMPS_DYNAMIC, i);
758+ if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
759+ protect) {
760+ /* If we're not restarting and still haven't
761+ * heard a beacon (dtim period unknown) then
762+ * make sure we still have enough minimum time
763+ * remaining in the time event, since the auth
764+ * might actually have taken quite a while
765+ * (especially for SAE) and so the remaining
766+ * time could be small without us having heard
767+ * a beacon yet.
768+ */
769+ iwl_mvm_protect_assoc(mvm, vif, 0);
751770 }
752771
753− rcu_read_lock();
754− link_conf = rcu_dereference(vif->link_conf[i]);
755− if (link_conf && !link_conf->dtim_period)
756− protect = true;
757− rcu_read_unlock();
758− }
772+ iwl_mvm_sf_update(mvm, vif, false);
773+
774+ /* FIXME: need to decide about misbehaving AP handling */
775+ iwl_mvm_power_vif_assoc(mvm, vif);
776+ } else if (iwl_mvm_mld_vif_have_valid_ap_sta(mvmvif)) {
777+ iwl_mvm_mei_host_disassociated(mvm);
759778
760− if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
761− protect) {
762− /* If we're not restarting and still haven't
763− * heard a beacon (dtim period unknown) then
764− * make sure we still have enough minimum time
765− * remaining in the time event, since the auth
766− * might actually have taken quite a while
767− * (especially for SAE) and so the remaining
768− * time could be small without us having heard
769− * a beacon yet.
779+ /* If update fails - SF might be running in associated
780+ * mode while disassociated - which is forbidden.
770781 */
771− iwl_mvm_protect_assoc(mvm, vif, 0);
782+ ret = iwl_mvm_sf_update(mvm, vif, false);
783+ WARN_ONCE(ret &&
784+ !test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
785+ &mvm->status),
786+ "Failed to update SF upon disassociation\n");
787+
788+ /* If we get an assert during the connection (after the
789+ * station has been added, but before the vif is set
790+ * to associated), mac80211 will re-add the station and
791+ * then configure the vif. Since the vif is not
792+ * associated, we would remove the station here and
793+ * this would fail the recovery.
794+ */
795+ iwl_mvm_mld_vif_delete_all_stas(mvm, vif);
772796 }
773797
774− iwl_mvm_sf_update(mvm, vif, false);
775−
776− /* FIXME: need to decide about misbehaving AP handling */
777− iwl_mvm_power_vif_assoc(mvm, vif);
778− } else if (iwl_mvm_mld_vif_have_valid_ap_sta(mvmvif)) {
779− iwl_mvm_mei_host_disassociated(mvm);
780−
781− /* If update fails - SF might be running in associated
782− * mode while disassociated - which is forbidden.
783− */
784− ret = iwl_mvm_sf_update(mvm, vif, false);
785− WARN_ONCE(ret &&
786− !test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
787− &mvm->status),
788− "Failed to update SF upon disassociation\n");
789−
790− /* If we get an assert during the connection (after the
791− * station has been added, but before the vif is set
792− * to associated), mac80211 will re-add the station and
793− * then configure the vif. Since the vif is not
794− * associated, we would remove the station here and
795− * this would fail the recovery.
796− */
797− iwl_mvm_mld_vif_delete_all_stas(mvm, vif);
798+ iwl_mvm_bss_info_changed_station_assoc(mvm, vif, changes);
798799 }
799800
800− iwl_mvm_bss_info_changed_station_assoc(mvm, vif, changes);
801+ if (changes & BSS_CHANGED_PS) {
802+ ret = iwl_mvm_power_update_mac(mvm);
803+ if (ret)
804+ IWL_ERR(mvm, "failed to update power mode\n");
805+ }
801806 }
802807
803808 static void
drivers/net/wireless/intel/iwlwifi/mvm/scan.c+1−1
@@ -2342,7 +2342,7 @@ iwl_mvm_scan_umac_fill_general_p_v12(struct iwl_mvm *mvm, · 2341 unmodified lines
23422342 if (gen_flags & IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2)
23432343 gp->num_of_fragments[SCAN_HB_LMAC_IDX] = IWL_SCAN_NUM_OF_FRAGS;
23442344
2345− if (version < 12) {
2345+ if (version < 16) {
23462346 gp->scan_start_mac_or_link_id = scan_vif->id;
23472347 } else {
23482348 struct iwl_mvm_vif_link_info *link_info;
drivers/net/wireless/intel/iwlwifi/mvm/tx.c+3−0
@@ -1612,6 +1612,7 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 1611 unmodified lines
16121612 iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]);
16131613
16141614 memset(&info->status, 0, sizeof(info->status));
1615+ info->flags &= ~(IEEE80211_TX_STAT_ACK | IEEE80211_TX_STAT_TX_FILTERED);
16151616
16161617 /* inform mac80211 about what happened with the frame */
16171618 switch (status & TX_STATUS_MSK) {
@@ -1964,6 +1965,8 @@ static void iwl_mvm_tx_reclaim(struct iwl_mvm *mvm, int sta_id, int tid, · 346 unmodified lines
19641965 */
19651966 if (!is_flush)
19661967 info->flags |= IEEE80211_TX_STAT_ACK;
1968+ else
1969+ info->flags &= ~IEEE80211_TX_STAT_ACK;
19671970 }
19681971
19691972 /*
drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c+19−3
@@ -918,9 +918,17 @@ void mwifiex_11n_rxba_sync_event(struct mwifiex_private *priv, · 917 unmodified lines
918918
919919 mwifiex_dbg_dump(priv->adapter, EVT_D, "RXBA_SYNC event:",
920920 event_buf, len);
921− while (tlv_buf_left >= sizeof(*tlv_rxba)) {
921+ while (tlv_buf_left > sizeof(*tlv_rxba)) {
922922 tlv_type = le16_to_cpu(tlv_rxba->header.type);
923923 tlv_len = le16_to_cpu(tlv_rxba->header.len);
924+ if (size_add(sizeof(tlv_rxba->header), tlv_len) > tlv_buf_left) {
925+ mwifiex_dbg(priv->adapter, WARN,
926+ "TLV size (%zu) overflows event_buf buf_left=%d\n",
927+ size_add(sizeof(tlv_rxba->header), tlv_len),
928+ tlv_buf_left);
929+ return;
930+ }
931+
924932 if (tlv_type != TLV_TYPE_RXBA_SYNC) {
925933 mwifiex_dbg(priv->adapter, ERROR,
926934 "Wrong TLV id=0x%x\n", tlv_type);
@@ -929,6 +937,14 @@ void mwifiex_11n_rxba_sync_event(struct mwifiex_private *priv, · 2 unmodified lines
929937
930938 tlv_seq_num = le16_to_cpu(tlv_rxba->seq_num);
931939 tlv_bitmap_len = le16_to_cpu(tlv_rxba->bitmap_len);
940+ if (size_add(sizeof(*tlv_rxba), tlv_bitmap_len) > tlv_buf_left) {
941+ mwifiex_dbg(priv->adapter, WARN,
942+ "TLV size (%zu) overflows event_buf buf_left=%d\n",
943+ size_add(sizeof(*tlv_rxba), tlv_bitmap_len),
944+ tlv_buf_left);
945+ return;
946+ }
947+
932948 mwifiex_dbg(priv->adapter, INFO,
933949 "%pM tid=%d seq_num=%d bitmap_len=%d\n",
934950 tlv_rxba->mac, tlv_rxba->tid, tlv_seq_num,
@@ -965,8 +981,8 @@ void mwifiex_11n_rxba_sync_event(struct mwifiex_private *priv, · 30 unmodified lines
965981 }
966982 }
967983
968− tlv_buf_left -= (sizeof(*tlv_rxba) + tlv_len);
969− tmp = (u8 *)tlv_rxba + tlv_len + sizeof(*tlv_rxba);
984+ tlv_buf_left -= (sizeof(tlv_rxba->header) + tlv_len);
985+ tmp = (u8 *)tlv_rxba + sizeof(tlv_rxba->header) + tlv_len;
970986 tlv_rxba = (struct mwifiex_ie_types_rxba_sync *)tmp;
971987 }
972988 }
drivers/net/wireless/marvell/mwifiex/fw.h+1−1
@@ -779,7 +779,7 @@ struct mwifiex_ie_types_rxba_sync { · 778 unmodified lines
779779 u8 reserved;
780780 __le16 seq_num;
781781 __le16 bitmap_len;
782− u8 bitmap[1];
782+ u8 bitmap[];
783783 } __packed;
784784
785785 struct chan_band_param_set {
drivers/net/wireless/marvell/mwifiex/sta_rx.c+9−7
@@ -86,7 +86,8 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv, · 85 unmodified lines
8686 rx_pkt_len = le16_to_cpu(local_rx_pd->rx_pkt_length);
8787 rx_pkt_hdr = (void *)local_rx_pd + rx_pkt_off;
8888
89− if (sizeof(*rx_pkt_hdr) + rx_pkt_off > skb->len) {
89+ if (sizeof(rx_pkt_hdr->eth803_hdr) + sizeof(rfc1042_header) +
90+ rx_pkt_off > skb->len) {
9091 mwifiex_dbg(priv->adapter, ERROR,
9192 "wrong rx packet offset: len=%d, rx_pkt_off=%d\n",
9293 skb->len, rx_pkt_off);
@@ -95,12 +96,13 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv, · 2 unmodified lines
9596 return -1;
9697 }
9798
98− if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
99− sizeof(bridge_tunnel_header))) ||
100− (!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
101− sizeof(rfc1042_header)) &&
102− ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_AARP &&
103− ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_IPX)) {
99+ if (sizeof(*rx_pkt_hdr) + rx_pkt_off <= skb->len &&
100+ ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
101+ sizeof(bridge_tunnel_header))) ||
102+ (!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
103+ sizeof(rfc1042_header)) &&
104+ ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_AARP &&
105+ ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_IPX))) {
104106 /*
105107 * Replace the 803 header and rfc1042 header (llc/snap) with an
106108 * EthernetII header, keep the src/dst and snap_type
drivers/net/wireless/mediatek/mt76/dma.c+4−4
@@ -93,13 +93,13 @@ __mt76_get_rxwi(struct mt76_dev *dev) · 92 unmodified lines
9393 {
9494 struct mt76_txwi_cache *t = NULL;
9595
96− spin_lock(&dev->wed_lock);
96+ spin_lock_bh(&dev->wed_lock);
9797 if (!list_empty(&dev->rxwi_cache)) {
9898 t = list_first_entry(&dev->rxwi_cache, struct mt76_txwi_cache,
9999 list);
100100 list_del(&t->list);
101101 }
102− spin_unlock(&dev->wed_lock);
102+ spin_unlock_bh(&dev->wed_lock);
103103
104104 return t;
105105 }
@@ -145,9 +145,9 @@ mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t) · 39 unmodified lines
145145 if (!t)
146146 return;
147147
148− spin_lock(&dev->wed_lock);
148+ spin_lock_bh(&dev->wed_lock);
149149 list_add(&t->list, &dev->rxwi_cache);
150− spin_unlock(&dev->wed_lock);
150+ spin_unlock_bh(&dev->wed_lock);
151151 }
152152 EXPORT_SYMBOL_GPL(mt76_put_rxwi);
153153
drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c+0−7
@@ -131,15 +131,8 @@ u8 mt76x02_get_lna_gain(struct mt76x02_dev *dev, · 130 unmodified lines
131131 s8 *lna_2g, s8 *lna_5g,
132132 struct ieee80211_channel *chan)
133133 {
134− u16 val;
135134 u8 lna;
136135
137− val = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1);
138− if (val & MT_EE_NIC_CONF_1_LNA_EXT_2G)
139− *lna_2g = 0;
140− if (val & MT_EE_NIC_CONF_1_LNA_EXT_5G)
141− memset(lna_5g, 0, sizeof(s8) * 3);
142−
143136 if (chan->band == NL80211_BAND_2GHZ)
144137 lna = *lna_2g;
145138 else if (chan->hw_value <= 64)
drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c+11−2
@@ -256,7 +256,8 @@ void mt76x2_read_rx_gain(struct mt76x02_dev *dev) · 255 unmodified lines
256256 struct ieee80211_channel *chan = dev->mphy.chandef.chan;
257257 int channel = chan->hw_value;
258258 s8 lna_5g[3], lna_2g;
259− u8 lna;
259+ bool use_lna;
260+ u8 lna = 0;
260261 u16 val;
261262
262263 if (chan->band == NL80211_BAND_2GHZ)
@@ -275,7 +276,15 @@ void mt76x2_read_rx_gain(struct mt76x02_dev *dev) · 12 unmodified lines
275276 dev->cal.rx.mcu_gain |= (lna_5g[1] & 0xff) << 16;
276277 dev->cal.rx.mcu_gain |= (lna_5g[2] & 0xff) << 24;
277278
278− lna = mt76x02_get_lna_gain(dev, &lna_2g, lna_5g, chan);
279+ val = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1);
280+ if (chan->band == NL80211_BAND_2GHZ)
281+ use_lna = !(val & MT_EE_NIC_CONF_1_LNA_EXT_2G);
282+ else
283+ use_lna = !(val & MT_EE_NIC_CONF_1_LNA_EXT_5G);
284+
285+ if (use_lna)
286+ lna = mt76x02_get_lna_gain(dev, &lna_2g, lna_5g, chan);
287+
279288 dev->cal.rx.lna_gain = mt76x02_sign_extend(lna, 8);
280289 }
281290 EXPORT_SYMBOL_GPL(mt76x2_read_rx_gain);
drivers/net/wireless/realtek/rtw88/rtw8723d.h+1−0
@@ -46,6 +46,7 @@ struct rtw8723du_efuse { · 45 unmodified lines
4646 u8 vender_id[2]; /* 0x100 */
4747 u8 product_id[2]; /* 0x102 */
4848 u8 usb_option; /* 0x104 */
49+ u8 res5[2]; /* 0x105 */
4950 u8 mac_addr[ETH_ALEN]; /* 0x107 */
5051 };
5152
drivers/pci/pcie/aer.c+1−0
@@ -229,6 +229,7 @@ int pcie_aer_is_native(struct pci_dev *dev) · 228 unmodified lines
229229
230230 return pcie_ports_native || host->native_aer;
231231 }
232+EXPORT_SYMBOL_NS_GPL(pcie_aer_is_native, CXL);
232233
233234 static int pci_enable_pcie_error_reporting(struct pci_dev *dev)
234235 {
drivers/pci/pcie/portdrv.h+0−2
@@ -29,10 +29,8 @@ extern bool pcie_ports_dpc_native; · 28 unmodified lines
2929
3030 #ifdef CONFIG_PCIEAER
3131 int pcie_aer_init(void);
32−int pcie_aer_is_native(struct pci_dev *dev);
3332 #else
3433 static inline int pcie_aer_init(void) { return 0; }
35−static inline int pcie_aer_is_native(struct pci_dev *dev) { return 0; }
3634 #endif
3735
3836 #ifdef CONFIG_HOTPLUG_PCI_PCIE
drivers/platform/x86/intel_scu_ipc.c+40−26
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/init.h>
2020 #include <linux/interrupt.h>
2121 #include <linux/io.h>
22+#include <linux/iopoll.h>
2223 #include <linux/module.h>
2324 #include <linux/slab.h>
2425
@@ -231,19 +232,15 @@ static inline u32 ipc_data_readl(struct intel_scu_ipc_dev *scu, u32 offset) · 206 unmodified lines
231232 /* Wait till scu status is busy */
232233 static inline int busy_loop(struct intel_scu_ipc_dev *scu)
233234 {
234− unsigned long end = jiffies + IPC_TIMEOUT;
235−
236− do {
237− u32 status;
238−
239− status = ipc_read_status(scu);
240− if (!(status & IPC_STATUS_BUSY))
241− return (status & IPC_STATUS_ERR) ? -EIO : 0;
235+ u8 status;
236+ int err;
242237
243− usleep_range(50, 100);
244− } while (time_before(jiffies, end));
238+ err = readx_poll_timeout(ipc_read_status, scu, status, !(status & IPC_STATUS_BUSY),
239+ 100, jiffies_to_usecs(IPC_TIMEOUT));
240+ if (err)
241+ return err;
245242
246− return -ETIMEDOUT;
243+ return (status & IPC_STATUS_ERR) ? -EIO : 0;
247244 }
248245
249246 /* Wait till ipc ioc interrupt is received or timeout in 10 HZ */
@@ -251,10 +248,12 @@ static inline int ipc_wait_for_interrupt(struct intel_scu_ipc_dev *scu) · 1 unmodified line
251248 {
252249 int status;
253250
254− if (!wait_for_completion_timeout(&scu->cmd_complete, IPC_TIMEOUT))
255− return -ETIMEDOUT;
251+ wait_for_completion_timeout(&scu->cmd_complete, IPC_TIMEOUT);
256252
257253 status = ipc_read_status(scu);
254+ if (status & IPC_STATUS_BUSY)
255+ return -ETIMEDOUT;
256+
258257 if (status & IPC_STATUS_ERR)
259258 return -EIO;
260259
@@ -266,6 +265,24 @@ static int intel_scu_ipc_check_status(struct intel_scu_ipc_dev *scu) · 5 unmodified lines
266265 return scu->irq > 0 ? ipc_wait_for_interrupt(scu) : busy_loop(scu);
267266 }
268267
268+static struct intel_scu_ipc_dev *intel_scu_ipc_get(struct intel_scu_ipc_dev *scu)
269+{
270+ u8 status;
271+
272+ if (!scu)
273+ scu = ipcdev;
274+ if (!scu)
275+ return ERR_PTR(-ENODEV);
276+
277+ status = ipc_read_status(scu);
278+ if (status & IPC_STATUS_BUSY) {
279+ dev_dbg(&scu->dev, "device is busy\n");
280+ return ERR_PTR(-EBUSY);
281+ }
282+
283+ return scu;
284+}
285+
269286 /* Read/Write power control(PMIC in Langwell, MSIC in PenWell) registers */
270287 static int pwr_reg_rdwr(struct intel_scu_ipc_dev *scu, u16 *addr, u8 *data,
271288 u32 count, u32 op, u32 id)
@@ -279,11 +296,10 @@ static int pwr_reg_rdwr(struct intel_scu_ipc_dev *scu, u16 *addr, u8 *data, · 7 unmodified lines
279296 memset(cbuf, 0, sizeof(cbuf));
280297
281298 mutex_lock(&ipclock);
282− if (!scu)
283− scu = ipcdev;
284− if (!scu) {
299+ scu = intel_scu_ipc_get(scu);
300+ if (IS_ERR(scu)) {
285301 mutex_unlock(&ipclock);
286− return -ENODEV;
302+ return PTR_ERR(scu);
287303 }
288304
289305 for (nc = 0; nc < count; nc++, offset += 2) {
@@ -438,13 +454,12 @@ int intel_scu_ipc_dev_simple_command(struct intel_scu_ipc_dev *scu, int cmd, · 148 unmodified lines
438454 int err;
439455
440456 mutex_lock(&ipclock);
441− if (!scu)
442− scu = ipcdev;
443− if (!scu) {
457+ scu = intel_scu_ipc_get(scu);
458+ if (IS_ERR(scu)) {
444459 mutex_unlock(&ipclock);
445− return -ENODEV;
460+ return PTR_ERR(scu);
446461 }
447− scu = ipcdev;
462+
448463 cmdval = sub << 12 | cmd;
449464 ipc_command(scu, cmdval);
450465 err = intel_scu_ipc_check_status(scu);
@@ -484,11 +499,10 @@ int intel_scu_ipc_dev_command_with_size(struct intel_scu_ipc_dev *scu, int cmd, · 33 unmodified lines
484499 return -EINVAL;
485500
486501 mutex_lock(&ipclock);
487− if (!scu)
488− scu = ipcdev;
489− if (!scu) {
502+ scu = intel_scu_ipc_get(scu);
503+ if (IS_ERR(scu)) {
490504 mutex_unlock(&ipclock);
491− return -ENODEV;
505+ return PTR_ERR(scu);
492506 }
493507
494508 memcpy(inbuf, in, inlen);
drivers/platform/x86/thinkpad_acpi.c+2−0
@@ -4116,9 +4116,11 @@ static void hotkey_resume(void) · 4115 unmodified lines
41164116 {
41174117 tpacpi_disable_brightness_delay();
41184118
4119+ mutex_lock(&hotkey_mutex);
41194120 if (hotkey_status_set(true) < 0 ||
41204121 hotkey_mask_set(hotkey_acpi_mask) < 0)
41214122 pr_err("error while attempting to reset the event firmware interface\n");
4123+ mutex_unlock(&hotkey_mutex);
41224124
41234125 tpacpi_send_radiosw_update();
41244126 tpacpi_input_send_tabletsw();
drivers/power/reset/Kconfig+1−1
@@ -300,7 +300,7 @@ config NVMEM_REBOOT_MODE · 299 unmodified lines
300300
301301 config POWER_MLXBF
302302 tristate "Mellanox BlueField power handling driver"
303− depends on (GPIO_MLXBF2 && ACPI)
303+ depends on (GPIO_MLXBF2 || GPIO_MLXBF3) && ACPI
304304 help
305305 This driver supports reset or low power mode handling for Mellanox BlueField.
306306
drivers/power/reset/pwr-mlxbf.c+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0-only or BSD-3-Clause
1+// SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
22
33 /*
44 * Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES.
drivers/power/reset/vexpress-poweroff.c+1−1
@@ -121,7 +121,7 @@ static int vexpress_reset_probe(struct platform_device *pdev) · 120 unmodified lines
121121 return PTR_ERR(regmap);
122122 dev_set_drvdata(&pdev->dev, regmap);
123123
124− switch ((enum vexpress_reset_func)match->data) {
124+ switch ((uintptr_t)match->data) {
125125 case FUNC_SHUTDOWN:
126126 vexpress_power_off_device = &pdev->dev;
127127 pm_power_off = vexpress_power_off;
drivers/power/supply/Kconfig+1−0
@@ -769,6 +769,7 @@ config BATTERY_RT5033 · 768 unmodified lines
769769 config CHARGER_RT5033
770770 tristate "RT5033 battery charger support"
771771 depends on MFD_RT5033
772+ depends on EXTCON || !EXTCON
772773 help
773774 This adds support for battery charger in Richtek RT5033 PMIC.
774775 The device supports pre-charge mode, fast charge mode and
drivers/power/supply/ab8500_btemp.c+1−8
@@ -115,7 +115,6 @@ struct ab8500_btemp { · 114 unmodified lines
115115 static enum power_supply_property ab8500_btemp_props[] = {
116116 POWER_SUPPLY_PROP_PRESENT,
117117 POWER_SUPPLY_PROP_ONLINE,
118− POWER_SUPPLY_PROP_TECHNOLOGY,
119118 POWER_SUPPLY_PROP_TEMP,
120119 };
121120
@@ -532,12 +531,6 @@ static int ab8500_btemp_get_property(struct power_supply *psy, · 410 unmodified lines
532531 else
533532 val->intval = 1;
534533 break;
535− case POWER_SUPPLY_PROP_TECHNOLOGY:
536− if (di->bm->bi)
537− val->intval = di->bm->bi->technology;
538− else
539− val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
540− break;
541534 case POWER_SUPPLY_PROP_TEMP:
542535 val->intval = ab8500_btemp_get_temp(di);
543536 break;
@@ -662,7 +655,7 @@ static char *supply_interface[] = { · 118 unmodified lines
662655
663656 static const struct power_supply_desc ab8500_btemp_desc = {
664657 .name = "ab8500_btemp",
665− .type = POWER_SUPPLY_TYPE_BATTERY,
658+ .type = POWER_SUPPLY_TYPE_UNKNOWN,
666659 .properties = ab8500_btemp_props,
667660 .num_properties = ARRAY_SIZE(ab8500_btemp_props),
668661 .get_property = ab8500_btemp_get_property,
drivers/power/supply/ab8500_chargalg.c+1−1
@@ -1720,7 +1720,7 @@ static char *supply_interface[] = { · 1719 unmodified lines
17201720
17211721 static const struct power_supply_desc ab8500_chargalg_desc = {
17221722 .name = "ab8500_chargalg",
1723− .type = POWER_SUPPLY_TYPE_BATTERY,
1723+ .type = POWER_SUPPLY_TYPE_UNKNOWN,
17241724 .properties = ab8500_chargalg_props,
17251725 .num_properties = ARRAY_SIZE(ab8500_chargalg_props),
17261726 .get_property = ab8500_chargalg_get_property,
drivers/power/supply/mt6370-charger.c+1−1
@@ -324,7 +324,7 @@ static int mt6370_chg_toggle_cfo(struct mt6370_priv *priv) · 323 unmodified lines
324324
325325 if (fl_strobe) {
326326 dev_err(priv->dev, "Flash led is still in strobe mode\n");
327− return ret;
327+ return -EINVAL;
328328 }
329329
330330 /* cfo off */
drivers/power/supply/power_supply_sysfs.c+7−0
@@ -482,6 +482,13 @@ int power_supply_uevent(const struct device *dev, struct kobj_uevent_env *env) · 481 unmodified lines
482482 if (ret)
483483 return ret;
484484
485+ /*
486+ * Kernel generates KOBJ_REMOVE uevent in device removal path, after
487+ * resources have been freed. Exit early to avoid use-after-free.
488+ */
489+ if (psy->removing)
490+ return 0;
491+
485492 prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
486493 if (!prop_buf)
487494 return -ENOMEM;
drivers/power/supply/rk817_charger.c+13−3
@@ -1045,6 +1045,13 @@ static void rk817_charging_monitor(struct work_struct *work) · 1044 unmodified lines
10451045 queue_delayed_work(system_wq, &charger->work, msecs_to_jiffies(8000));
10461046 }
10471047
1048+static void rk817_cleanup_node(void *data)
1049+{
1050+ struct device_node *node = data;
1051+
1052+ of_node_put(node);
1053+}
1054+
10481055 static int rk817_charger_probe(struct platform_device *pdev)
10491056 {
10501057 struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
@@ -1061,11 +1068,13 @@ static int rk817_charger_probe(struct platform_device *pdev) · 10 unmodified lines
10611068 if (!node)
10621069 return -ENODEV;
10631070
1071+ ret = devm_add_action_or_reset(&pdev->dev, rk817_cleanup_node, node);
1072+ if (ret)
1073+ return ret;
1074+
10641075 charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL);
1065− if (!charger) {
1066− of_node_put(node);
1076+ if (!charger)
10671077 return -ENOMEM;
1068− }
10691078
10701079 charger->rk808 = rk808;
10711080
@@ -1211,3 +1220,4 @@ MODULE_DESCRIPTION("Battery power supply driver for RK817 PMIC"); · 139 unmodified lines
12111220 MODULE_AUTHOR("Maya Matuszczyk <maccraft123mc@gmail.com>");
12121221 MODULE_AUTHOR("Chris Morgan <macromorgan@hotmail.com>");
12131222 MODULE_LICENSE("GPL");
1223+MODULE_ALIAS("platform:rk817-charger");
drivers/power/supply/rt9467-charger.c+2−2
@@ -598,8 +598,8 @@ static int rt9467_run_aicl(struct rt9467_chg_data *data) · 597 unmodified lines
598598
599599 reinit_completion(&data->aicl_done);
600600 ret = wait_for_completion_timeout(&data->aicl_done, msecs_to_jiffies(3500));
601− if (ret)
602− return ret;
601+ if (ret == 0)
602+ return -ETIMEDOUT;
603603
604604 ret = rt9467_get_value_from_ranges(data, F_IAICR, RT9467_RANGE_IAICR, &aicr_get);
605605 if (ret) {
drivers/power/supply/ucs1002_power.c+2−1
@@ -384,7 +384,8 @@ static int ucs1002_get_property(struct power_supply *psy, · 383 unmodified lines
384384 case POWER_SUPPLY_PROP_USB_TYPE:
385385 return ucs1002_get_usb_type(info, val);
386386 case POWER_SUPPLY_PROP_HEALTH:
387− return val->intval = info->health;
387+ val->intval = info->health;
388+ return 0;
388389 case POWER_SUPPLY_PROP_PRESENT:
389390 val->intval = info->present;
390391 return 0;
drivers/ptp/ptp_ocp.c+0−1
@@ -4046,7 +4046,6 @@ ptp_ocp_device_init(struct ptp_ocp *bp, struct pci_dev *pdev) · 4045 unmodified lines
40464046 return 0;
40474047
40484048 out:
4049− ptp_ocp_dev_release(&bp->dev);
40504049 put_device(&bp->dev);
40514050 return err;
40524051 }
drivers/regulator/core.c+3−7
@@ -5542,6 +5542,8 @@ regulator_register(struct device *dev, · 5541 unmodified lines
55425542 goto rinse;
55435543 }
55445544 device_initialize(&rdev->dev);
5545+ dev_set_drvdata(&rdev->dev, rdev);
5546+ rdev->dev.class = &regulator_class;
55455547 spin_lock_init(&rdev->err_lock);
55465548
55475549 /*
@@ -5603,11 +5605,9 @@ regulator_register(struct device *dev, · 55 unmodified lines
56035605 rdev->supply_name = regulator_desc->supply_name;
56045606
56055607 /* register with sysfs */
5606− rdev->dev.class = &regulator_class;
56075608 rdev->dev.parent = config->dev;
56085609 dev_set_name(&rdev->dev, "regulator.%lu",
56095610 (unsigned long) atomic_inc_return(&regulator_no));
5610− dev_set_drvdata(&rdev->dev, rdev);
56115611
56125612 /* set regulator constraints */
56135613 if (init_data)
@@ -5724,15 +5724,11 @@ wash: · 110 unmodified lines
57245724 mutex_lock(&regulator_list_mutex);
57255725 regulator_ena_gpio_free(rdev);
57265726 mutex_unlock(&regulator_list_mutex);
5727− put_device(&rdev->dev);
5728− rdev = NULL;
57295727 clean:
57305728 if (dangling_of_gpiod)
57315729 gpiod_put(config->ena_gpiod);
5732− if (rdev && rdev->dev.of_node)
5733− of_node_put(rdev->dev.of_node);
5734− kfree(rdev);
57355730 kfree(config);
5731+ put_device(&rdev->dev);
57365732 rinse:
57375733 if (dangling_cfg_gpiod)
57385734 gpiod_put(cfg->ena_gpiod);
drivers/regulator/mt6358-regulator.c+15−3
@@ -43,7 +43,7 @@ struct mt6358_regulator_info { · 42 unmodified lines
4343 .desc = { \
4444 .name = #vreg, \
4545 .of_match = of_match_ptr(match), \
46− .ops = &mt6358_volt_range_ops, \
46+ .ops = &mt6358_buck_ops, \
4747 .type = REGULATOR_VOLTAGE, \
4848 .id = MT6358_ID_##vreg, \
4949 .owner = THIS_MODULE, \
@@ -139,7 +139,7 @@ struct mt6358_regulator_info { · 89 unmodified lines
139139 .desc = { \
140140 .name = #vreg, \
141141 .of_match = of_match_ptr(match), \
142− .ops = &mt6358_volt_range_ops, \
142+ .ops = &mt6358_buck_ops, \
143143 .type = REGULATOR_VOLTAGE, \
144144 .id = MT6366_ID_##vreg, \
145145 .owner = THIS_MODULE, \
@@ -450,7 +450,7 @@ static unsigned int mt6358_regulator_get_mode(struct regulator_dev *rdev) · 304 unmodified lines
450450 }
451451 }
452452
453−static const struct regulator_ops mt6358_volt_range_ops = {
453+static const struct regulator_ops mt6358_buck_ops = {
454454 .list_voltage = regulator_list_voltage_linear,
455455 .map_voltage = regulator_map_voltage_linear,
456456 .set_voltage_sel = regulator_set_voltage_sel_regmap,
@@ -464,6 +464,18 @@ static const struct regulator_ops mt6358_volt_range_ops = { · 7 unmodified lines
464464 .get_mode = mt6358_regulator_get_mode,
465465 };
466466
467+static const struct regulator_ops mt6358_volt_range_ops = {
468+ .list_voltage = regulator_list_voltage_linear,
469+ .map_voltage = regulator_map_voltage_linear,
470+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
471+ .get_voltage_sel = mt6358_get_buck_voltage_sel,
472+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
473+ .enable = regulator_enable_regmap,
474+ .disable = regulator_disable_regmap,
475+ .is_enabled = regulator_is_enabled_regmap,
476+ .get_status = mt6358_get_status,
477+};
478+
467479 static const struct regulator_ops mt6358_volt_table_ops = {
468480 .list_voltage = regulator_list_voltage_table,
469481 .map_voltage = regulator_map_voltage_iterate,
drivers/s390/scsi/zfcp_aux.c+5−4
@@ -518,12 +518,12 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, · 517 unmodified lines
518518 if (port) {
519519 put_device(&port->dev);
520520 retval = -EEXIST;
521− goto err_out;
521+ goto err_put;
522522 }
523523
524524 port = kzalloc(sizeof(struct zfcp_port), GFP_KERNEL);
525525 if (!port)
526− goto err_out;
526+ goto err_put;
527527
528528 rwlock_init(&port->unit_list_lock);
529529 INIT_LIST_HEAD(&port->unit_list);
@@ -546,7 +546,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, · 16 unmodified lines
546546
547547 if (dev_set_name(&port->dev, "0x%016llx", (unsigned long long)wwpn)) {
548548 kfree(port);
549− goto err_out;
549+ goto err_put;
550550 }
551551 retval = -EINVAL;
552552
@@ -563,7 +563,8 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, · 10 unmodified lines
563563
564564 return port;
565565
566−err_out:
566+err_put:
567567 zfcp_ccw_adapter_put(adapter);
568+err_out:
568569 return ERR_PTR(retval);
569570 }
drivers/scsi/fnic/fnic.h+3−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727
2828 #define DRV_NAME "fnic"
2929 #define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
30−#define DRV_VERSION "1.6.0.56"
30+#define DRV_VERSION "1.6.0.57"
3131 #define PFX DRV_NAME ": "
3232 #define DFX DRV_NAME "%d: "
3333
@@ -237,6 +237,8 @@ struct fnic { · 203 unmodified lines
237237 unsigned int cq_count;
238238
239239 struct mutex sgreset_mutex;
240+ spinlock_t sgreset_lock; /* lock for sgreset */
241+ struct scsi_cmnd *sgreset_sc;
240242 struct dentry *fnic_stats_debugfs_host;
241243 struct dentry *fnic_stats_debugfs_file;
242244 struct dentry *fnic_reset_debugfs_file;
drivers/scsi/fnic/fnic_io.h+2−0
@@ -52,6 +52,8 @@ struct fnic_io_req { · 51 unmodified lines
5252 unsigned long start_time; /* in jiffies */
5353 struct completion *abts_done; /* completion for abts */
5454 struct completion *dr_done; /* completion for device reset */
55+ unsigned int tag;
56+ struct scsi_cmnd *sc; /* midlayer's cmd pointer */
5557 };
5658
5759 enum fnic_port_speeds {
drivers/scsi/fnic/fnic_main.c+2−0
@@ -754,6 +754,8 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 753 unmodified lines
754754 for (i = 0; i < FNIC_IO_LOCKS; i++)
755755 spin_lock_init(&fnic->io_req_lock[i]);
756756
757+ spin_lock_init(&fnic->sgreset_lock);
758+
757759 err = -ENOMEM;
758760 fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache);
759761 if (!fnic->io_req_pool)
drivers/scsi/fnic/fnic_scsi.c+47−17
@@ -1047,9 +1047,9 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, · 1046 unmodified lines
10471047 {
10481048 u8 type;
10491049 u8 hdr_status;
1050− struct fcpio_tag tag;
1050+ struct fcpio_tag ftag;
10511051 u32 id;
1052− struct scsi_cmnd *sc;
1052+ struct scsi_cmnd *sc = NULL;
10531053 struct fnic_io_req *io_req;
10541054 struct fnic_stats *fnic_stats = &fnic->fnic_stats;
10551055 struct abort_stats *abts_stats = &fnic->fnic_stats.abts_stats;
@@ -1058,27 +1058,43 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, · 2 unmodified lines
10581058 unsigned long flags;
10591059 spinlock_t *io_lock;
10601060 unsigned long start_time;
1061+ unsigned int tag;
10611062
1062− fcpio_header_dec(&desc->hdr, &type, &hdr_status, &tag);
1063− fcpio_tag_id_dec(&tag, &id);
1063+ fcpio_header_dec(&desc->hdr, &type, &hdr_status, &ftag);
1064+ fcpio_tag_id_dec(&ftag, &id);
10641065
1065− if ((id & FNIC_TAG_MASK) >= fnic->fnic_max_tag_id) {
1066+ tag = id & FNIC_TAG_MASK;
1067+ if (tag == fnic->fnic_max_tag_id) {
1068+ if (!(id & FNIC_TAG_DEV_RST)) {
1069+ shost_printk(KERN_ERR, fnic->lport->host,
1070+ "Tag out of range id 0x%x hdr status = %s\n",
1071+ id, fnic_fcpio_status_to_str(hdr_status));
1072+ return;
1073+ }
1074+ } else if (tag > fnic->fnic_max_tag_id) {
10661075 shost_printk(KERN_ERR, fnic->lport->host,
1067− "Tag out of range tag %x hdr status = %s\n",
1068− id, fnic_fcpio_status_to_str(hdr_status));
1076+ "Tag out of range tag 0x%x hdr status = %s\n",
1077+ tag, fnic_fcpio_status_to_str(hdr_status));
10691078 return;
10701079 }
10711080
1072− sc = scsi_host_find_tag(fnic->lport->host, id & FNIC_TAG_MASK);
1081+ if ((tag == fnic->fnic_max_tag_id) && (id & FNIC_TAG_DEV_RST)) {
1082+ sc = fnic->sgreset_sc;
1083+ io_lock = &fnic->sgreset_lock;
1084+ } else {
1085+ sc = scsi_host_find_tag(fnic->lport->host, id & FNIC_TAG_MASK);
1086+ io_lock = fnic_io_lock_hash(fnic, sc);
1087+ }
1088+
10731089 WARN_ON_ONCE(!sc);
10741090 if (!sc) {
10751091 atomic64_inc(&fnic_stats->io_stats.sc_null);
10761092 shost_printk(KERN_ERR, fnic->lport->host,
10771093 "itmf_cmpl sc is null - hdr status = %s tag = 0x%x\n",
1078− fnic_fcpio_status_to_str(hdr_status), id);
1094+ fnic_fcpio_status_to_str(hdr_status), tag);
10791095 return;
10801096 }
1081− io_lock = fnic_io_lock_hash(fnic, sc);
1097+
10821098 spin_lock_irqsave(io_lock, flags);
10831099 io_req = fnic_priv(sc)->io_req;
10841100 WARN_ON_ONCE(!io_req);
@@ -1089,7 +1105,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, · 4 unmodified lines
10891105 shost_printk(KERN_ERR, fnic->lport->host,
10901106 "itmf_cmpl io_req is null - "
10911107 "hdr status = %s tag = 0x%x sc 0x%p\n",
1092− fnic_fcpio_status_to_str(hdr_status), id, sc);
1108+ fnic_fcpio_status_to_str(hdr_status), tag, sc);
10931109 return;
10941110 }
10951111 start_time = io_req->start_time;
@@ -1938,6 +1954,10 @@ static inline int fnic_queue_dr_io_req(struct fnic *fnic, · 842 unmodified lines
19381954 struct scsi_lun fc_lun;
19391955 int ret = 0;
19401956 unsigned long intr_flags;
1957+ unsigned int tag = scsi_cmd_to_rq(sc)->tag;
1958+
1959+ if (tag == SCSI_NO_TAG)
1960+ tag = io_req->tag;
19411961
19421962 spin_lock_irqsave(host->host_lock, intr_flags);
19431963 if (unlikely(fnic_chk_state_flags_locked(fnic,
@@ -1964,7 +1984,8 @@ static inline int fnic_queue_dr_io_req(struct fnic *fnic, · 20 unmodified lines
19641984 /* fill in the lun info */
19651985 int_to_scsilun(sc->device->lun, &fc_lun);
19661986
1967− fnic_queue_wq_copy_desc_itmf(wq, scsi_cmd_to_rq(sc)->tag | FNIC_TAG_DEV_RST,
1987+ tag |= FNIC_TAG_DEV_RST;
1988+ fnic_queue_wq_copy_desc_itmf(wq, tag,
19681989 0, FCPIO_ITMF_LUN_RESET, SCSI_NO_TAG,
19691990 fc_lun.scsi_lun, io_req->port_id,
19701991 fnic->config.ra_tov, fnic->config.ed_tov);
@@ -2146,8 +2167,7 @@ static int fnic_clean_pending_aborts(struct fnic *fnic, · 175 unmodified lines
21462167 .ret = SUCCESS,
21472168 };
21482169
2149− if (new_sc)
2150− iter_data.lr_sc = lr_sc;
2170+ iter_data.lr_sc = lr_sc;
21512171
21522172 scsi_host_busy_iter(fnic->lport->host,
21532173 fnic_pending_aborts_iter, &iter_data);
@@ -2230,8 +2250,14 @@ int fnic_device_reset(struct scsi_cmnd *sc) · 76 unmodified lines
22302250 mutex_lock(&fnic->sgreset_mutex);
22312251 tag = fnic->fnic_max_tag_id;
22322252 new_sc = 1;
2233− }
2234− io_lock = fnic_io_lock_hash(fnic, sc);
2253+ fnic->sgreset_sc = sc;
2254+ io_lock = &fnic->sgreset_lock;
2255+ FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host,
2256+ "fcid: 0x%x lun: 0x%llx flags: 0x%x tag: 0x%x Issuing sgreset\n",
2257+ rport->port_id, sc->device->lun, fnic_priv(sc)->flags, tag);
2258+ } else
2259+ io_lock = fnic_io_lock_hash(fnic, sc);
2260+
22352261 spin_lock_irqsave(io_lock, flags);
22362262 io_req = fnic_priv(sc)->io_req;
22372263
@@ -2247,6 +2273,8 @@ int fnic_device_reset(struct scsi_cmnd *sc) · 9 unmodified lines
22472273 }
22482274 memset(io_req, 0, sizeof(*io_req));
22492275 io_req->port_id = rport->port_id;
2276+ io_req->tag = tag;
2277+ io_req->sc = sc;
22502278 fnic_priv(sc)->io_req = io_req;
22512279 }
22522280 io_req->dr_done = &tm_done;
@@ -2400,8 +2428,10 @@ fnic_device_reset_end: · 147 unmodified lines
24002428 (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
24012429 fnic_flags_and_state(sc));
24022430
2403− if (new_sc)
2431+ if (new_sc) {
2432+ fnic->sgreset_sc = NULL;
24042433 mutex_unlock(&fnic->sgreset_mutex);
2434+ }
24052435
24062436 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
24072437 "Returning from device reset %s\n",
drivers/scsi/scsi.c+11−0
@@ -613,6 +613,17 @@ void scsi_cdl_check(struct scsi_device *sdev) · 612 unmodified lines
613613 bool cdl_supported;
614614 unsigned char *buf;
615615
616+ /*
617+ * Support for CDL was defined in SPC-5. Ignore devices reporting an
618+ * lower SPC version. This also avoids problems with old drives choking
619+ * on MAINTENANCE_IN / MI_REPORT_SUPPORTED_OPERATION_CODES with a
620+ * service action specified, as done in scsi_cdl_check_cmd().
621+ */
622+ if (sdev->scsi_level < SCSI_SPC_5) {
623+ sdev->cdl_supported = 0;
624+ return;
625+ }
626+
616627 buf = kmalloc(SCSI_CDL_CHECK_BUF_LEN, GFP_KERNEL);
617628 if (!buf) {
618629 sdev->cdl_supported = 0;
drivers/scsi/scsi_scan.c+18−2
@@ -822,7 +822,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, · 821 unmodified lines
822822 * device is attached at LUN 0 (SCSI_SCAN_TARGET_PRESENT) so
823823 * non-zero LUNs can be scanned.
824824 */
825− sdev->scsi_level = inq_result[2] & 0x07;
825+ sdev->scsi_level = inq_result[2] & 0x0f;
826826 if (sdev->scsi_level >= 2 ||
827827 (sdev->scsi_level == 1 && (inq_result[3] & 0x0f) == 1))
828828 sdev->scsi_level++;
@@ -1619,12 +1619,24 @@ int scsi_add_device(struct Scsi_Host *host, uint channel, · 790 unmodified lines
16191619 }
16201620 EXPORT_SYMBOL(scsi_add_device);
16211621
1622−void scsi_rescan_device(struct scsi_device *sdev)
1622+int scsi_rescan_device(struct scsi_device *sdev)
16231623 {
16241624 struct device *dev = &sdev->sdev_gendev;
1625+ int ret = 0;
16251626
16261627 device_lock(dev);
16271628
1629+ /*
1630+ * Bail out if the device is not running. Otherwise, the rescan may
1631+ * block waiting for commands to be executed, with us holding the
1632+ * device lock. This can result in a potential deadlock in the power
1633+ * management core code when system resume is on-going.
1634+ */
1635+ if (sdev->sdev_state != SDEV_RUNNING) {
1636+ ret = -EWOULDBLOCK;
1637+ goto unlock;
1638+ }
1639+
16281640 scsi_attach_vpd(sdev);
16291641 scsi_cdl_check(sdev);
16301642
@@ -1638,7 +1650,11 @@ void scsi_rescan_device(struct scsi_device *sdev) · 7 unmodified lines
16381650 drv->rescan(dev);
16391651 module_put(dev->driver->owner);
16401652 }
1653+
1654+unlock:
16411655 device_unlock(dev);
1656+
1657+ return ret;
16421658 }
16431659 EXPORT_SYMBOL(scsi_rescan_device);
16441660
drivers/scsi/sd.c+82−19
@@ -201,18 +201,32 @@ cache_type_store(struct device *dev, struct device_attribute *attr, · 200 unmodified lines
201201 }
202202
203203 static ssize_t
204−manage_start_stop_show(struct device *dev, struct device_attribute *attr,
205− char *buf)
204+manage_start_stop_show(struct device *dev,
205+ struct device_attribute *attr, char *buf)
206206 {
207207 struct scsi_disk *sdkp = to_scsi_disk(dev);
208208 struct scsi_device *sdp = sdkp->device;
209209
210− return sprintf(buf, "%u\n", sdp->manage_start_stop);
210+ return sysfs_emit(buf, "%u\n",
211+ sdp->manage_system_start_stop &&
212+ sdp->manage_runtime_start_stop);
211213 }
214+static DEVICE_ATTR_RO(manage_start_stop);
212215
213216 static ssize_t
214−manage_start_stop_store(struct device *dev, struct device_attribute *attr,
215− const char *buf, size_t count)
217+manage_system_start_stop_show(struct device *dev,
218+ struct device_attribute *attr, char *buf)
219+{
220+ struct scsi_disk *sdkp = to_scsi_disk(dev);
221+ struct scsi_device *sdp = sdkp->device;
222+
223+ return sysfs_emit(buf, "%u\n", sdp->manage_system_start_stop);
224+}
225+
226+static ssize_t
227+manage_system_start_stop_store(struct device *dev,
228+ struct device_attribute *attr,
229+ const char *buf, size_t count)
216230 {
217231 struct scsi_disk *sdkp = to_scsi_disk(dev);
218232 struct scsi_device *sdp = sdkp->device;
@@ -224,11 +238,42 @@ manage_start_stop_store(struct device *dev, struct device_attribute *attr, · 5 unmodified lines
224238 if (kstrtobool(buf, &v))
225239 return -EINVAL;
226240
227− sdp->manage_start_stop = v;
241+ sdp->manage_system_start_stop = v;
228242
229243 return count;
230244 }
231−static DEVICE_ATTR_RW(manage_start_stop);
245+static DEVICE_ATTR_RW(manage_system_start_stop);
246+
247+static ssize_t
248+manage_runtime_start_stop_show(struct device *dev,
249+ struct device_attribute *attr, char *buf)
250+{
251+ struct scsi_disk *sdkp = to_scsi_disk(dev);
252+ struct scsi_device *sdp = sdkp->device;
253+
254+ return sysfs_emit(buf, "%u\n", sdp->manage_runtime_start_stop);
255+}
256+
257+static ssize_t
258+manage_runtime_start_stop_store(struct device *dev,
259+ struct device_attribute *attr,
260+ const char *buf, size_t count)
261+{
262+ struct scsi_disk *sdkp = to_scsi_disk(dev);
263+ struct scsi_device *sdp = sdkp->device;
264+ bool v;
265+
266+ if (!capable(CAP_SYS_ADMIN))
267+ return -EACCES;
268+
269+ if (kstrtobool(buf, &v))
270+ return -EINVAL;
271+
272+ sdp->manage_runtime_start_stop = v;
273+
274+ return count;
275+}
276+static DEVICE_ATTR_RW(manage_runtime_start_stop);
232277
233278 static ssize_t
234279 allow_restart_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -560,6 +605,8 @@ static struct attribute *sd_disk_attrs[] = { · 325 unmodified lines
560605 &dev_attr_FUA.attr,
561606 &dev_attr_allow_restart.attr,
562607 &dev_attr_manage_start_stop.attr,
608+ &dev_attr_manage_system_start_stop.attr,
609+ &dev_attr_manage_runtime_start_stop.attr,
563610 &dev_attr_protection_type.attr,
564611 &dev_attr_protection_mode.attr,
565612 &dev_attr_app_tag_own.attr,
@@ -3694,7 +3741,8 @@ static int sd_remove(struct device *dev) · 3128 unmodified lines
36943741
36953742 device_del(&sdkp->disk_dev);
36963743 del_gendisk(sdkp->disk);
3697− sd_shutdown(dev);
3744+ if (!sdkp->suspended)
3745+ sd_shutdown(dev);
36983746
36993747 put_disk(sdkp->disk);
37003748 return 0;
@@ -3771,13 +3819,20 @@ static void sd_shutdown(struct device *dev) · 70 unmodified lines
37713819 sd_sync_cache(sdkp, NULL);
37723820 }
37733821
3774− if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) {
3822+ if (system_state != SYSTEM_RESTART &&
3823+ sdkp->device->manage_system_start_stop) {
37753824 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
37763825 sd_start_stop_device(sdkp, 0);
37773826 }
37783827 }
37793828
3780−static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)
3829+static inline bool sd_do_start_stop(struct scsi_device *sdev, bool runtime)
3830+{
3831+ return (sdev->manage_system_start_stop && !runtime) ||
3832+ (sdev->manage_runtime_start_stop && runtime);
3833+}
3834+
3835+static int sd_suspend_common(struct device *dev, bool runtime)
37813836 {
37823837 struct scsi_disk *sdkp = dev_get_drvdata(dev);
37833838 struct scsi_sense_hdr sshdr;
@@ -3809,15 +3864,18 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors) · 25 unmodified lines
38093864 }
38103865 }
38113866
3812− if (sdkp->device->manage_start_stop) {
3867+ if (sd_do_start_stop(sdkp->device, runtime)) {
38133868 if (!sdkp->device->silence_suspend)
38143869 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
38153870 /* an error is not worth aborting a system sleep */
38163871 ret = sd_start_stop_device(sdkp, 0);
3817− if (ignore_stop_errors)
3872+ if (!runtime)
38183873 ret = 0;
38193874 }
38203875
3876+ if (!ret)
3877+ sdkp->suspended = true;
3878+
38213879 return ret;
38223880 }
38233881
@@ -3826,15 +3884,15 @@ static int sd_suspend_system(struct device *dev) · 2 unmodified lines
38263884 if (pm_runtime_suspended(dev))
38273885 return 0;
38283886
3829− return sd_suspend_common(dev, true);
3887+ return sd_suspend_common(dev, false);
38303888 }
38313889
38323890 static int sd_suspend_runtime(struct device *dev)
38333891 {
3834− return sd_suspend_common(dev, false);
3892+ return sd_suspend_common(dev, true);
38353893 }
38363894
3837−static int sd_resume(struct device *dev)
3895+static int sd_resume(struct device *dev, bool runtime)
38383896 {
38393897 struct scsi_disk *sdkp = dev_get_drvdata(dev);
38403898 int ret = 0;
@@ -3842,16 +3900,21 @@ static int sd_resume(struct device *dev) · 1 unmodified line
38423900 if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */
38433901 return 0;
38443902
3845− if (!sdkp->device->manage_start_stop)
3903+ if (!sd_do_start_stop(sdkp->device, runtime)) {
3904+ sdkp->suspended = false;
38463905 return 0;
3906+ }
38473907
38483908 if (!sdkp->device->no_start_on_resume) {
38493909 sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
38503910 ret = sd_start_stop_device(sdkp, 1);
38513911 }
38523912
3853− if (!ret)
3913+ if (!ret) {
38543914 opal_unlock_from_suspend(sdkp->opal_dev);
3915+ sdkp->suspended = false;
3916+ }
3917+
38553918 return ret;
38563919 }
38573920
@@ -3860,7 +3923,7 @@ static int sd_resume_system(struct device *dev) · 2 unmodified lines
38603923 if (pm_runtime_suspended(dev))
38613924 return 0;
38623925
3863− return sd_resume(dev);
3926+ return sd_resume(dev, false);
38643927 }
38653928
38663929 static int sd_resume_runtime(struct device *dev)
@@ -3887,7 +3950,7 @@ static int sd_resume_runtime(struct device *dev) · 20 unmodified lines
38873950 "Failed to clear sense data\n");
38883951 }
38893952
3890− return sd_resume(dev);
3953+ return sd_resume(dev, true);
38913954 }
38923955
38933956 static const struct dev_pm_ops sd_pm_ops = {
drivers/scsi/sd.h+1−0
@@ -131,6 +131,7 @@ struct scsi_disk { · 130 unmodified lines
131131 u8 provisioning_mode;
132132 u8 zeroing_mode;
133133 u8 nr_actuators; /* Number of actuators */
134+ bool suspended; /* Disk is suspended (stopped) */
134135 unsigned ATO : 1; /* state of disk ATO bit */
135136 unsigned cache_override : 1; /* temp override of WCE,RCD */
136137 unsigned WCE : 1; /* state of disk WCE bit */
drivers/soc/imx/soc-imx8m.c+10−0
@@ -100,6 +100,7 @@ static void __init imx8mm_soc_uid(void) · 99 unmodified lines
100100 {
101101 void __iomem *ocotp_base;
102102 struct device_node *np;
103+ struct clk *clk;
103104 u32 offset = of_machine_is_compatible("fsl,imx8mp") ?
104105 IMX8MP_OCOTP_UID_OFFSET : 0;
105106
@@ -109,11 +110,20 @@ static void __init imx8mm_soc_uid(void) · 3 unmodified lines
109110
110111 ocotp_base = of_iomap(np, 0);
111112 WARN_ON(!ocotp_base);
113+ clk = of_clk_get_by_name(np, NULL);
114+ if (IS_ERR(clk)) {
115+ WARN_ON(IS_ERR(clk));
116+ return;
117+ }
118+
119+ clk_prepare_enable(clk);
112120
113121 soc_uid = readl_relaxed(ocotp_base + OCOTP_UID_HIGH + offset);
114122 soc_uid <<= 32;
115123 soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW + offset);
116124
125+ clk_disable_unprepare(clk);
126+ clk_put(clk);
117127 iounmap(ocotp_base);
118128 of_node_put(np);
119129 }
drivers/soc/loongson/Kconfig+1−0
@@ -20,6 +20,7 @@ config LOONGSON2_GUTS · 19 unmodified lines
2020 config LOONGSON2_PM
2121 bool "Loongson-2 SoC Power Management Controller Driver"
2222 depends on LOONGARCH && OF
23+ depends on INPUT=y
2324 help
2425 The Loongson-2's power management controller was ACPI, supports ACPI
2526 S2Idle (Suspend To Idle), ACPI S3 (Suspend To RAM), ACPI S4 (Suspend To
drivers/soc/loongson/loongson2_guts.c+2−4
@@ -70,7 +70,7 @@ static const struct loongson2_soc_die_attr *loongson2_soc_die_match( · 69 unmodified lines
7070 if (matches->svr == (svr & matches->mask))
7171 return matches;
7272 matches++;
73− };
73+ }
7474
7575 return NULL;
7676 }
@@ -94,7 +94,6 @@ static int loongson2_guts_probe(struct platform_device *pdev) · 17 unmodified lines
9494 {
9595 struct device_node *root, *np = pdev->dev.of_node;
9696 struct device *dev = &pdev->dev;
97− struct resource *res;
9897 const struct loongson2_soc_die_attr *soc_die;
9998 const char *machine;
10099 u32 svr;
@@ -106,8 +105,7 @@ static int loongson2_guts_probe(struct platform_device *pdev) · 5 unmodified lines
106105
107106 guts->little_endian = of_property_read_bool(np, "little-endian");
108107
109− res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
110− guts->regs = ioremap(res->start, res->end - res->start + 1);
108+ guts->regs = devm_platform_ioremap_resource(pdev, 0);
111109 if (IS_ERR(guts->regs))
112110 return PTR_ERR(guts->regs);
113111
drivers/soc/loongson/loongson2_pm.c+6−1
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/input.h>
1212 #include <linux/suspend.h>
1313 #include <linux/interrupt.h>
14+#include <linux/of_platform.h>
1415 #include <linux/pm_wakeirq.h>
1516 #include <linux/platform_device.h>
1617 #include <asm/bootinfo.h>
@@ -192,12 +193,16 @@ static int loongson2_pm_probe(struct platform_device *pdev) · 175 unmodified lines
192193 if (loongson_sysconf.suspend_addr)
193194 suspend_set_ops(&loongson2_suspend_ops);
194195
196+ /* Populate children */
197+ retval = devm_of_platform_populate(dev);
198+ if (retval)
199+ dev_err(dev, "Error populating children, reboot and poweroff might not work properly\n");
200+
195201 return 0;
196202 }
197203
198204 static const struct of_device_id loongson2_pm_match[] = {
199205 { .compatible = "loongson,ls2k0500-pmc", },
200− { .compatible = "loongson,ls2k1000-pmc", },
201206 {},
202207 };
203208
drivers/spi/spi-cs42l43.c+0−1
@@ -256,7 +256,6 @@ static int cs42l43_spi_probe(struct platform_device *pdev) · 255 unmodified lines
256256
257257 ret = devm_spi_register_controller(priv->dev, priv->ctlr);
258258 if (ret) {
259− pm_runtime_disable(priv->dev);
260259 dev_err(priv->dev, "Failed to register SPI controller: %d\n", ret);
261260 }
262261
drivers/spi/spi-gxp.c+1−1
@@ -194,7 +194,7 @@ static ssize_t gxp_spi_write(struct gxp_spi_chip *chip, const struct spi_mem_op · 193 unmodified lines
194194 return ret;
195195 }
196196
197− return write_len;
197+ return 0;
198198 }
199199
200200 static int do_gxp_exec_mem_op(struct spi_mem *mem, const struct spi_mem_op *op)
drivers/target/target_core_device.c+4−7
@@ -843,7 +843,6 @@ sector_t target_to_linux_sector(struct se_device *dev, sector_t lb) · 842 unmodified lines
843843 EXPORT_SYMBOL(target_to_linux_sector);
844844
845845 struct devices_idr_iter {
846− struct config_item *prev_item;
847846 int (*fn)(struct se_device *dev, void *data);
848847 void *data;
849848 };
@@ -853,11 +852,9 @@ static int target_devices_idr_iter(int id, void *p, void *data) · 3 unmodified lines
853852 {
854853 struct devices_idr_iter *iter = data;
855854 struct se_device *dev = p;
855+ struct config_item *item;
856856 int ret;
857857
858− config_item_put(iter->prev_item);
859− iter->prev_item = NULL;
860−
861858 /*
862859 * We add the device early to the idr, so it can be used
863860 * by backend modules during configuration. We do not want
@@ -867,12 +864,13 @@ static int target_devices_idr_iter(int id, void *p, void *data) · 3 unmodified lines
867864 if (!target_dev_configured(dev))
868865 return 0;
869866
870− iter->prev_item = config_item_get_unless_zero(&dev->dev_group.cg_item);
871− if (!iter->prev_item)
867+ item = config_item_get_unless_zero(&dev->dev_group.cg_item);
868+ if (!item)
872869 return 0;
873870 mutex_unlock(&device_mutex);
874871
875872 ret = iter->fn(dev, iter->data);
873+ config_item_put(item);
876874
877875 mutex_lock(&device_mutex);
878876 return ret;
@@ -895,7 +893,6 @@ int target_for_each_device(int (*fn)(struct se_device *dev, void *data), · 16 unmodified lines
895893 mutex_lock(&device_mutex);
896894 ret = idr_for_each(&devices_idr, target_devices_idr_iter, &iter);
897895 mutex_unlock(&device_mutex);
898− config_item_put(iter.prev_item);
899896 return ret;
900897 }
901898
drivers/tee/optee/optee_private.h+0−2
@@ -238,8 +238,6 @@ int optee_notif_send(struct optee *optee, u_int key); · 237 unmodified lines
238238 u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,
239239 struct tee_param *param);
240240
241−int optee_supp_read(struct tee_context *ctx, void __user *buf, size_t len);
242−int optee_supp_write(struct tee_context *ctx, void __user *buf, size_t len);
243241 void optee_supp_init(struct optee_supp *supp);
244242 void optee_supp_uninit(struct optee_supp *supp);
245243 void optee_supp_release(struct optee_supp *supp);
drivers/tee/tee_private.h+0−2
@@ -47,8 +47,6 @@ struct tee_device { · 46 unmodified lines
4747 struct tee_shm_pool *pool;
4848 };
4949
50−int tee_shm_init(void);
51−
5250 int tee_shm_get_fd(struct tee_shm *shm);
5351
5452 bool tee_device_get(struct tee_device *teedev);
drivers/thermal/thermal_sysfs.c+5−4
@@ -185,9 +185,6 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr, · 184 unmodified lines
185185 if (sscanf(attr->attr.name, "trip_point_%d_hyst", &trip_id) != 1)
186186 return -EINVAL;
187187
188− if (kstrtoint(buf, 10, &trip.hysteresis))
189− return -EINVAL;
190−
191188 mutex_lock(&tz->lock);
192189
193190 if (!device_is_registered(dev)) {
@@ -198,7 +195,11 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr, · 4 unmodified lines
198195 ret = __thermal_zone_get_trip(tz, trip_id, &trip);
199196 if (ret)
200197 goto unlock;
201−
198+
199+ ret = kstrtoint(buf, 10, &trip.hysteresis);
200+ if (ret)
201+ goto unlock;
202+
202203 ret = thermal_zone_set_trip(tz, trip_id, &trip);
203204 unlock:
204205 mutex_unlock(&tz->lock);
drivers/tty/n_gsm.c+1−3
@@ -3097,10 +3097,8 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool disc) · 3096 unmodified lines
30973097 gsm->has_devices = false;
30983098 }
30993099 for (i = NUM_DLCI - 1; i >= 0; i--)
3100− if (gsm->dlci[i]) {
3100+ if (gsm->dlci[i])
31013101 gsm_dlci_release(gsm->dlci[i]);
3102− gsm->dlci[i] = NULL;
3103− }
31043102 mutex_unlock(&gsm->mutex);
31053103 /* Now wipe the queues */
31063104 tty_ldisc_flush(gsm->tty);
drivers/tty/serial/8250/8250_port.c+4−1
@@ -1936,7 +1936,10 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir) · 1935 unmodified lines
19361936 skip_rx = true;
19371937
19381938 if (status & (UART_LSR_DR | UART_LSR_BI) && !skip_rx) {
1939− if (irqd_is_wakeup_set(irq_get_irq_data(port->irq)))
1939+ struct irq_data *d;
1940+
1941+ d = irq_get_irq_data(port->irq);
1942+ if (d && irqd_is_wakeup_set(d))
19401943 pm_wakeup_event(tport->tty->dev, 0);
19411944 if (!up->dma || handle_rx_dma(up, iir))
19421945 status = serial8250_rx_chars(up, status);
drivers/vfio/mdev/mdev_sysfs.c+2−1
@@ -233,7 +233,8 @@ int parent_create_sysfs_files(struct mdev_parent *parent) · 232 unmodified lines
233233 out_err:
234234 while (--i >= 0)
235235 mdev_type_remove(parent->types[i]);
236− return 0;
236+ kset_unregister(parent->mdev_types_kset);
237+ return ret;
237238 }
238239
239240 static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
drivers/vfio/pci/pds/Kconfig+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33
44 config PDS_VFIO_PCI
55 tristate "VFIO support for PDS PCI devices"
6− depends on PDS_CORE
6+ depends on PDS_CORE && PCI_IOV
77 select VFIO_PCI_CORE
88 help
99 This provides generic PCI support for PDS devices using the VFIO
drivers/vfio/pci/pds/vfio_dev.c+1−1
@@ -162,7 +162,7 @@ static int pds_vfio_init_device(struct vfio_device *vdev) · 161 unmodified lines
162162 pci_id = PCI_DEVID(pdev->bus->number, pdev->devfn);
163163 dev_dbg(&pdev->dev,
164164 "%s: PF %#04x VF %#04x vf_id %d domain %d pds_vfio %p\n",
165− __func__, pci_dev_id(pdev->physfn), pci_id, vf_id,
165+ __func__, pci_dev_id(pci_physfn(pdev)), pci_id, vf_id,
166166 pci_domain_nr(pdev->bus), pds_vfio);
167167
168168 return 0;
drivers/vhost/vringh.c+11−1
@@ -123,8 +123,18 @@ static inline ssize_t vringh_iov_xfer(struct vringh *vrh, · 122 unmodified lines
123123 done += partlen;
124124 len -= partlen;
125125 ptr += partlen;
126+ iov->consumed += partlen;
127+ iov->iov[iov->i].iov_len -= partlen;
128+ iov->iov[iov->i].iov_base += partlen;
126129
127− vringh_kiov_advance(iov, partlen);
130+ if (!iov->iov[iov->i].iov_len) {
131+ /* Fix up old iov element then increment. */
132+ iov->iov[iov->i].iov_len = iov->consumed;
133+ iov->iov[iov->i].iov_base -= iov->consumed;
134+
135+ iov->consumed = 0;
136+ iov->i++;
137+ }
128138 }
129139 return done;
130140 }
drivers/video/console/Kconfig+1−0
@@ -73,6 +73,7 @@ config DUMMY_CONSOLE_ROWS · 72 unmodified lines
7373 config FRAMEBUFFER_CONSOLE
7474 bool "Framebuffer Console support"
7575 depends on FB_CORE && !UML
76+ default DRM_FBDEV_EMULATION
7677 select VT_HW_CONSOLE_BINDING
7778 select CRC32
7879 select FONT_SUPPORT
drivers/video/fbdev/Kconfig+1−1
@@ -1762,7 +1762,7 @@ config FB_COBALT · 1761 unmodified lines
17621762
17631763 config FB_SH7760
17641764 bool "SH7760/SH7763/SH7720/SH7721 LCDC support"
1765− depends on FB && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \
1765+ depends on FB=y && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \
17661766 || CPU_SUBTYPE_SH7720 || CPU_SUBTYPE_SH7721)
17671767 select FB_IOMEM_HELPERS
17681768 help
drivers/video/fbdev/core/Kconfig+1−1
@@ -28,7 +28,7 @@ config FIRMWARE_EDID · 27 unmodified lines
2828 config FB_DEVICE
2929 bool "Provide legacy /dev/fb* device"
3030 depends on FB_CORE
31− default y
31+ default FB
3232 help
3333 Say Y here if you want the legacy /dev/fb* device file and
3434 interfaces within sysfs anc procfs. It is only required if you
fs/aio.c+1−1
@@ -80,7 +80,7 @@ struct aio_ring { · 79 unmodified lines
8080 struct kioctx_table {
8181 struct rcu_head rcu;
8282 unsigned nr;
83− struct kioctx __rcu *table[];
83+ struct kioctx __rcu *table[] __counted_by(nr);
8484 };
8585
8686 struct kioctx_cpu {
fs/binfmt_elf_fdpic.c+2−3
@@ -345,10 +345,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm) · 344 unmodified lines
345345 /* there's now no turning back... the old userspace image is dead,
346346 * defunct, deceased, etc.
347347 */
348+ SET_PERSONALITY(exec_params.hdr);
348349 if (elf_check_fdpic(&exec_params.hdr))
349− set_personality(PER_LINUX_FDPIC);
350− else
351− set_personality(PER_LINUX);
350+ current->personality |= PER_LINUX_FDPIC;
352351 if (elf_read_implies_exec(&exec_params.hdr, executable_stack))
353352 current->personality |= READ_IMPLIES_EXEC;
354353
fs/btrfs/delayed-ref.c+35−11
@@ -103,24 +103,17 @@ void btrfs_update_delayed_refs_rsv(struct btrfs_trans_handle *trans) · 102 unmodified lines
103103 * Transfer bytes to our delayed refs rsv.
104104 *
105105 * @fs_info: the filesystem
106− * @src: source block rsv to transfer from
107106 * @num_bytes: number of bytes to transfer
108107 *
109− * This transfers up to the num_bytes amount from the src rsv to the
108+ * This transfers up to the num_bytes amount, previously reserved, to the
110109 * delayed_refs_rsv. Any extra bytes are returned to the space info.
111110 */
112111 void btrfs_migrate_to_delayed_refs_rsv(struct btrfs_fs_info *fs_info,
113− struct btrfs_block_rsv *src,
114112 u64 num_bytes)
115113 {
116114 struct btrfs_block_rsv *delayed_refs_rsv = &fs_info->delayed_refs_rsv;
117115 u64 to_free = 0;
118116
119− spin_lock(&src->lock);
120− src->reserved -= num_bytes;
121− src->size -= num_bytes;
122− spin_unlock(&src->lock);
123−
124117 spin_lock(&delayed_refs_rsv->lock);
125118 if (delayed_refs_rsv->size > delayed_refs_rsv->reserved) {
126119 u64 delta = delayed_refs_rsv->size -
@@ -163,6 +156,8 @@ int btrfs_delayed_refs_rsv_refill(struct btrfs_fs_info *fs_info, · 36 unmodified lines
163156 struct btrfs_block_rsv *block_rsv = &fs_info->delayed_refs_rsv;
164157 u64 limit = btrfs_calc_delayed_ref_bytes(fs_info, 1);
165158 u64 num_bytes = 0;
159+ u64 refilled_bytes;
160+ u64 to_free;
166161 int ret = -ENOSPC;
167162
168163 spin_lock(&block_rsv->lock);
@@ -178,9 +173,38 @@ int btrfs_delayed_refs_rsv_refill(struct btrfs_fs_info *fs_info, · 9 unmodified lines
178173 ret = btrfs_reserve_metadata_bytes(fs_info, block_rsv, num_bytes, flush);
179174 if (ret)
180175 return ret;
181− btrfs_block_rsv_add_bytes(block_rsv, num_bytes, false);
182− trace_btrfs_space_reservation(fs_info, "delayed_refs_rsv",
183− 0, num_bytes, 1);
176+
177+ /*
178+ * We may have raced with someone else, so check again if we the block
179+ * reserve is still not full and release any excess space.
180+ */
181+ spin_lock(&block_rsv->lock);
182+ if (block_rsv->reserved < block_rsv->size) {
183+ u64 needed = block_rsv->size - block_rsv->reserved;
184+
185+ if (num_bytes >= needed) {
186+ block_rsv->reserved += needed;
187+ block_rsv->full = true;
188+ to_free = num_bytes - needed;
189+ refilled_bytes = needed;
190+ } else {
191+ block_rsv->reserved += num_bytes;
192+ to_free = 0;
193+ refilled_bytes = num_bytes;
194+ }
195+ } else {
196+ to_free = num_bytes;
197+ refilled_bytes = 0;
198+ }
199+ spin_unlock(&block_rsv->lock);
200+
201+ if (to_free > 0)
202+ btrfs_space_info_free_bytes_may_use(fs_info, block_rsv->space_info,
203+ to_free);
204+
205+ if (refilled_bytes > 0)
206+ trace_btrfs_space_reservation(fs_info, "delayed_refs_rsv", 0,
207+ refilled_bytes, 1);
184208 return 0;
185209 }
186210
fs/btrfs/delayed-ref.h+0−1
@@ -407,7 +407,6 @@ void btrfs_update_delayed_refs_rsv(struct btrfs_trans_handle *trans); · 406 unmodified lines
407407 int btrfs_delayed_refs_rsv_refill(struct btrfs_fs_info *fs_info,
408408 enum btrfs_reserve_flush_enum flush);
409409 void btrfs_migrate_to_delayed_refs_rsv(struct btrfs_fs_info *fs_info,
410− struct btrfs_block_rsv *src,
411410 u64 num_bytes);
412411 bool btrfs_check_space_for_delayed_refs(struct btrfs_fs_info *fs_info);
413412
fs/btrfs/extent-tree.c+10−8
@@ -1514,15 +1514,14 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, · 1513 unmodified lines
15141514 btrfs_release_path(path);
15151515
15161516 /* now insert the actual backref */
1517− if (owner < BTRFS_FIRST_FREE_OBJECTID) {
1518− BUG_ON(refs_to_add != 1);
1517+ if (owner < BTRFS_FIRST_FREE_OBJECTID)
15191518 ret = insert_tree_block_ref(trans, path, bytenr, parent,
15201519 root_objectid);
1521− } else {
1520+ else
15221521 ret = insert_extent_data_ref(trans, path, bytenr, parent,
15231522 root_objectid, owner, offset,
15241523 refs_to_add);
1525− }
1524+
15261525 if (ret)
15271526 btrfs_abort_transaction(trans, ret);
15281527 out:
@@ -1656,7 +1655,10 @@ again: · 127 unmodified lines
16561655 goto again;
16571656 }
16581657 } else {
1659− err = -EIO;
1658+ err = -EUCLEAN;
1659+ btrfs_err(fs_info,
1660+ "missing extent item for extent %llu num_bytes %llu level %d",
1661+ head->bytenr, head->num_bytes, extent_op->level);
16601662 goto out;
16611663 }
16621664 }
@@ -1699,12 +1701,12 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans, · 36 unmodified lines
16991701 parent = ref->parent;
17001702 ref_root = ref->root;
17011703
1702− if (node->ref_mod != 1) {
1704+ if (unlikely(node->ref_mod != 1)) {
17031705 btrfs_err(trans->fs_info,
1704− "btree block(%llu) has %d references rather than 1: action %d ref_root %llu parent %llu",
1706+ "btree block %llu has %d references rather than 1: action %d ref_root %llu parent %llu",
17051707 node->bytenr, node->ref_mod, node->action, ref_root,
17061708 parent);
1707− return -EIO;
1709+ return -EUCLEAN;
17081710 }
17091711 if (node->action == BTRFS_ADD_DELAYED_REF && insert_reserved) {
17101712 BUG_ON(!extent_op || !extent_op->update_flags);
fs/btrfs/extent_io.c+7−1
@@ -3995,8 +3995,14 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dstv, · 3994 unmodified lines
39953995 char *dst = (char *)dstv;
39963996 unsigned long i = get_eb_page_index(start);
39973997
3998− if (check_eb_range(eb, start, len))
3998+ if (check_eb_range(eb, start, len)) {
3999+ /*
4000+ * Invalid range hit, reset the memory, so callers won't get
4001+ * some random garbage for their uninitialzed memory.
4002+ */
4003+ memset(dstv, 0, len);
39994004 return;
4005+ }
40004006
40014007 offset = get_eb_offset_in_page(eb, start);
40024008
fs/btrfs/super.c+1−1
@@ -2117,7 +2117,7 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf) · 2116 unmodified lines
21172117 * calculated f_bavail.
21182118 */
21192119 if (!mixed && block_rsv->space_info->full &&
2120− total_free_meta - thresh < block_rsv->size)
2120+ (total_free_meta < thresh || total_free_meta - thresh < block_rsv->size))
21212121 buf->f_bavail = 0;
21222122
21232123 buf->f_type = BTRFS_SUPER_MAGIC;
fs/btrfs/transaction.c+3−3
@@ -631,14 +631,14 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, · 630 unmodified lines
631631 reloc_reserved = true;
632632 }
633633
634− ret = btrfs_block_rsv_add(fs_info, rsv, num_bytes, flush);
634+ ret = btrfs_reserve_metadata_bytes(fs_info, rsv, num_bytes, flush);
635635 if (ret)
636636 goto reserve_fail;
637637 if (delayed_refs_bytes) {
638− btrfs_migrate_to_delayed_refs_rsv(fs_info, rsv,
639− delayed_refs_bytes);
638+ btrfs_migrate_to_delayed_refs_rsv(fs_info, delayed_refs_bytes);
640639 num_bytes -= delayed_refs_bytes;
641640 }
641+ btrfs_block_rsv_add_bytes(rsv, num_bytes, true);
642642
643643 if (rsv->space_info->force_alloc)
644644 do_chunk_alloc = true;
fs/btrfs/tree-log.c+1−1
@@ -4722,7 +4722,7 @@ static int btrfs_log_prealloc_extents(struct btrfs_trans_handle *trans, · 4721 unmodified lines
47224722 struct extent_buffer *leaf;
47234723 int slot;
47244724 int ins_nr = 0;
4725− int start_slot;
4725+ int start_slot = 0;
47264726 int ret;
47274727
47284728 if (!(inode->flags & BTRFS_INODE_PREALLOC))
fs/btrfs/volumes.c+6−7
@@ -1594,7 +1594,7 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes, · 1593 unmodified lines
15941594 u64 search_start;
15951595 u64 hole_size;
15961596 u64 max_hole_start;
1597− u64 max_hole_size;
1597+ u64 max_hole_size = 0;
15981598 u64 extent_end;
15991599 u64 search_end = device->total_bytes;
16001600 int ret;
@@ -1602,17 +1602,16 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes, · 1 unmodified line
16021602 struct extent_buffer *l;
16031603
16041604 search_start = dev_extent_search_start(device);
1605+ max_hole_start = search_start;
16051606
16061607 WARN_ON(device->zone_info &&
16071608 !IS_ALIGNED(num_bytes, device->zone_info->zone_size));
16081609
16091610 path = btrfs_alloc_path();
1610− if (!path)
1611− return -ENOMEM;
1612−
1613− max_hole_start = search_start;
1614− max_hole_size = 0;
1615−
1611+ if (!path) {
1612+ ret = -ENOMEM;
1613+ goto out;
1614+ }
16161615 again:
16171616 if (search_start >= search_end ||
16181617 test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state)) {
fs/buffer.c+24−12
@@ -2011,7 +2011,7 @@ void folio_zero_new_buffers(struct folio *folio, size_t from, size_t to) · 2010 unmodified lines
20112011 }
20122012 EXPORT_SYMBOL(folio_zero_new_buffers);
20132013
2014−static void
2014+static int
20152015 iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
20162016 const struct iomap *iomap)
20172017 {
@@ -2025,7 +2025,8 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, · 7 unmodified lines
20252025 * current block, then do not map the buffer and let the caller
20262026 * handle it.
20272027 */
2028− BUG_ON(offset >= iomap->offset + iomap->length);
2028+ if (offset >= iomap->offset + iomap->length)
2029+ return -EIO;
20292030
20302031 switch (iomap->type) {
20312032 case IOMAP_HOLE:
@@ -2037,7 +2038,7 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, · 5 unmodified lines
20372038 if (!buffer_uptodate(bh) ||
20382039 (offset >= i_size_read(inode)))
20392040 set_buffer_new(bh);
2040− break;
2041+ return 0;
20412042 case IOMAP_DELALLOC:
20422043 if (!buffer_uptodate(bh) ||
20432044 (offset >= i_size_read(inode)))
@@ -2045,7 +2046,7 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, · 1 unmodified line
20452046 set_buffer_uptodate(bh);
20462047 set_buffer_mapped(bh);
20472048 set_buffer_delay(bh);
2048− break;
2049+ return 0;
20492050 case IOMAP_UNWRITTEN:
20502051 /*
20512052 * For unwritten regions, we always need to ensure that regions
@@ -2057,12 +2058,24 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, · 5 unmodified lines
20572058 fallthrough;
20582059 case IOMAP_MAPPED:
20592060 if ((iomap->flags & IOMAP_F_NEW) ||
2060− offset >= i_size_read(inode))
2061+ offset >= i_size_read(inode)) {
2062+ /*
2063+ * This can happen if truncating the block device races
2064+ * with the check in the caller as i_size updates on
2065+ * block devices aren't synchronized by i_rwsem for
2066+ * block devices.
2067+ */
2068+ if (S_ISBLK(inode->i_mode))
2069+ return -EIO;
20612070 set_buffer_new(bh);
2071+ }
20622072 bh->b_blocknr = (iomap->addr + offset - iomap->offset) >>
20632073 inode->i_blkbits;
20642074 set_buffer_mapped(bh);
2065− break;
2075+ return 0;
2076+ default:
2077+ WARN_ON_ONCE(1);
2078+ return -EIO;
20662079 }
20672080 }
20682081
@@ -2103,13 +2116,12 @@ int __block_write_begin_int(struct folio *folio, loff_t pos, unsigned len, · 34 unmodified lines
21032116 clear_buffer_new(bh);
21042117 if (!buffer_mapped(bh)) {
21052118 WARN_ON(bh->b_size != blocksize);
2106− if (get_block) {
2119+ if (get_block)
21072120 err = get_block(inode, block, bh, 1);
2108− if (err)
2109− break;
2110− } else {
2111− iomap_to_bh(inode, block, bh, iomap);
2112− }
2121+ else
2122+ err = iomap_to_bh(inode, block, bh, iomap);
2123+ if (err)
2124+ break;
21132125
21142126 if (buffer_new(bh)) {
21152127 clean_bdev_bh_alias(bh);
fs/ceph/crypto.c+2−4
@@ -249,11 +249,9 @@ static struct inode *parse_longname(const struct inode *parent, · 248 unmodified lines
249249 if (!dir) {
250250 /* This can happen if we're not mounting cephfs on the root */
251251 dir = ceph_get_inode(parent->i_sb, vino, NULL);
252− if (!dir)
253− dir = ERR_PTR(-ENOENT);
252+ if (IS_ERR(dir))
253+ dout("Can't find inode %s (%s)\n", inode_number, name);
254254 }
255− if (IS_ERR(dir))
256− dout("Can't find inode %s (%s)\n", inode_number, name);
257255
258256 out:
259257 kfree(inode_number);
fs/fs-writeback.c+8−3
@@ -1535,10 +1535,15 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb, · 1534 unmodified lines
15351535
15361536 if (wbc->pages_skipped) {
15371537 /*
1538− * writeback is not making progress due to locked
1539− * buffers. Skip this inode for now.
1538+ * Writeback is not making progress due to locked buffers.
1539+ * Skip this inode for now. Although having skipped pages
1540+ * is odd for clean inodes, it can happen for some
1541+ * filesystems so handle that gracefully.
15401542 */
1541− redirty_tail_locked(inode, wb);
1543+ if (inode->i_state & I_DIRTY_ALL)
1544+ redirty_tail_locked(inode, wb);
1545+ else
1546+ inode_cgwb_move_to_attached(inode, wb);
15421547 return;
15431548 }
15441549
fs/iomap/buffered-io.c+19−13
@@ -640,11 +640,13 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos, · 639 unmodified lines
640640 size_t poff, plen;
641641
642642 /*
643− * If the write completely overlaps the current folio, then
643+ * If the write or zeroing completely overlaps the current folio, then
644644 * entire folio will be dirtied so there is no need for
645645 * per-block state tracking structures to be attached to this folio.
646+ * For the unshare case, we must read in the ondisk contents because we
647+ * are not changing pagecache contents.
646648 */
647− if (pos <= folio_pos(folio) &&
649+ if (!(iter->flags & IOMAP_UNSHARE) && pos <= folio_pos(folio) &&
648650 pos + len >= folio_pos(folio) + folio_size(folio))
649651 return 0;
650652
@@ -1047,7 +1049,7 @@ static int iomap_write_delalloc_punch(struct inode *inode, struct folio *folio, · 396 unmodified lines
10471049
10481050 /*
10491051 * Scan the data range passed to us for dirty page cache folios. If we find a
1050− * dirty folio, punch out the preceeding range and update the offset from which
1052+ * dirty folio, punch out the preceding range and update the offset from which
10511053 * the next punch will start from.
10521054 *
10531055 * We can punch out storage reservations under clean pages because they either
@@ -1261,7 +1263,6 @@ static loff_t iomap_unshare_iter(struct iomap_iter *iter) · 207 unmodified lines
12611263 const struct iomap *srcmap = iomap_iter_srcmap(iter);
12621264 loff_t pos = iter->pos;
12631265 loff_t length = iomap_length(iter);
1264− long status = 0;
12651266 loff_t written = 0;
12661267
12671268 /* don't bother with blocks that are not shared to start with */
@@ -1272,28 +1273,33 @@ static loff_t iomap_unshare_iter(struct iomap_iter *iter) · 4 unmodified lines
12721273 return length;
12731274
12741275 do {
1275− unsigned long offset = offset_in_page(pos);
1276− unsigned long bytes = min_t(loff_t, PAGE_SIZE - offset, length);
12771276 struct folio *folio;
1277+ int status;
1278+ size_t offset;
1279+ size_t bytes = min_t(u64, SIZE_MAX, length);
12781280
12791281 status = iomap_write_begin(iter, pos, bytes, &folio);
12801282 if (unlikely(status))
12811283 return status;
1282− if (iter->iomap.flags & IOMAP_F_STALE)
1284+ if (iomap->flags & IOMAP_F_STALE)
12831285 break;
12841286
1285− status = iomap_write_end(iter, pos, bytes, bytes, folio);
1286− if (WARN_ON_ONCE(status == 0))
1287+ offset = offset_in_folio(folio, pos);
1288+ if (bytes > folio_size(folio) - offset)
1289+ bytes = folio_size(folio) - offset;
1290+
1291+ bytes = iomap_write_end(iter, pos, bytes, bytes, folio);
1292+ if (WARN_ON_ONCE(bytes == 0))
12871293 return -EIO;
12881294
12891295 cond_resched();
12901296
1291− pos += status;
1292− written += status;
1293− length -= status;
1297+ pos += bytes;
1298+ written += bytes;
1299+ length -= bytes;
12941300
12951301 balance_dirty_pages_ratelimited(iter->inode->i_mapping);
1296− } while (length);
1302+ } while (length > 0);
12971303
12981304 return written;
12991305 }
fs/libfs.c+1−0
@@ -1903,6 +1903,7 @@ ssize_t direct_write_fallback(struct kiocb *iocb, struct iov_iter *iter, · 1902 unmodified lines
19031903 * We don't know how much we wrote, so just return the number of
19041904 * bytes which were direct-written
19051905 */
1906+ iocb->ki_pos -= buffered_written;
19061907 if (direct_written)
19071908 return direct_written;
19081909 return err;
fs/nfs/nfs4proc.c+3−1
@@ -10622,7 +10622,9 @@ static void nfs4_disable_swap(struct inode *inode) · 10621 unmodified lines
1062210622 */
1062310623 struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
1062410624
10625− nfs4_schedule_state_manager(clp);
10625+ set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
10626+ clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
10627+ wake_up_var(&clp->cl_state);
1062610628 }
1062710629
1062810630 static const struct inode_operations nfs4_dir_inode_operations = {
fs/nfs/nfs4state.c+33−12
@@ -1209,16 +1209,26 @@ void nfs4_schedule_state_manager(struct nfs_client *clp) · 1208 unmodified lines
12091209 {
12101210 struct task_struct *task;
12111211 char buf[INET6_ADDRSTRLEN + sizeof("-manager") + 1];
1212+ struct rpc_clnt *clnt = clp->cl_rpcclient;
1213+ bool swapon = false;
12121214
1213− if (clp->cl_rpcclient->cl_shutdown)
1215+ if (clnt->cl_shutdown)
12141216 return;
12151217
12161218 set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
1217− if (test_and_set_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state) != 0) {
1218− wake_up_var(&clp->cl_state);
1219− return;
1219+
1220+ if (atomic_read(&clnt->cl_swapper)) {
1221+ swapon = !test_and_set_bit(NFS4CLNT_MANAGER_AVAILABLE,
1222+ &clp->cl_state);
1223+ if (!swapon) {
1224+ wake_up_var(&clp->cl_state);
1225+ return;
1226+ }
12201227 }
1221− set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state);
1228+
1229+ if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0)
1230+ return;
1231+
12221232 __module_get(THIS_MODULE);
12231233 refcount_inc(&clp->cl_count);
12241234
@@ -1235,8 +1245,9 @@ void nfs4_schedule_state_manager(struct nfs_client *clp) · 10 unmodified lines
12351245 __func__, PTR_ERR(task));
12361246 if (!nfs_client_init_is_complete(clp))
12371247 nfs_mark_client_ready(clp, PTR_ERR(task));
1248+ if (swapon)
1249+ clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
12381250 nfs4_clear_state_manager_bit(clp);
1239− clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
12401251 nfs_put_client(clp);
12411252 module_put(THIS_MODULE);
12421253 }
@@ -2703,6 +2714,13 @@ static void nfs4_state_manager(struct nfs_client *clp) · 1460 unmodified lines
27032714 nfs4_end_drain_session(clp);
27042715 nfs4_clear_state_manager_bit(clp);
27052716
2717+ if (test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
2718+ !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING,
2719+ &clp->cl_state)) {
2720+ memflags = memalloc_nofs_save();
2721+ continue;
2722+ }
2723+
27062724 if (!test_and_set_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state)) {
27072725 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
27082726 nfs_client_return_marked_delegations(clp);
@@ -2741,22 +2759,25 @@ static int nfs4_run_state_manager(void *ptr) · 32 unmodified lines
27412759
27422760 allow_signal(SIGKILL);
27432761 again:
2744− set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state);
27452762 nfs4_state_manager(clp);
2746− if (atomic_read(&cl->cl_swapper)) {
2763+
2764+ if (test_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state) &&
2765+ !test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state)) {
27472766 wait_var_event_interruptible(&clp->cl_state,
27482767 test_bit(NFS4CLNT_RUN_MANAGER,
27492768 &clp->cl_state));
2750− if (atomic_read(&cl->cl_swapper) &&
2751− test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state))
2769+ if (!atomic_read(&cl->cl_swapper))
2770+ clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
2771+ if (refcount_read(&clp->cl_count) > 1 && !signalled() &&
2772+ !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state))
27522773 goto again;
27532774 /* Either no longer a swapper, or were signalled */
2775+ clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
27542776 }
2755− clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
27562777
27572778 if (refcount_read(&clp->cl_count) > 1 && !signalled() &&
27582779 test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
2759− !test_and_set_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state))
2780+ !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state))
27602781 goto again;
27612782
27622783 nfs_put_client(clp);
fs/nfs/write.c+1−1
@@ -802,8 +802,8 @@ static void nfs_inode_remove_request(struct nfs_page *req) · 801 unmodified lines
802802 }
803803
804804 if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) {
805− nfs_release_request(req);
806805 atomic_long_dec(&NFS_I(nfs_page_to_inode(req))->nrequests);
806+ nfs_release_request(req);
807807 }
808808 }
809809
fs/nfsd/nfs4xdr.c+2−2
@@ -4113,6 +4113,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, · 4112 unmodified lines
41134113 struct file *file, unsigned long maxcount)
41144114 {
41154115 struct xdr_stream *xdr = resp->xdr;
4116+ unsigned int base = xdr->buf->page_len & ~PAGE_MASK;
41164117 unsigned int starting_len = xdr->buf->len;
41174118 __be32 zero = xdr_zero;
41184119 __be32 nfserr;
@@ -4121,8 +4122,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, · 2 unmodified lines
41214122 return nfserr_resource;
41224123
41234124 nfserr = nfsd_iter_read(resp->rqstp, read->rd_fhp, file,
4124− read->rd_offset, &maxcount,
4125− xdr->buf->page_len & ~PAGE_MASK,
4125+ read->rd_offset, &maxcount, base,
41264126 &read->rd_eof);
41274127 read->rd_length = maxcount;
41284128 if (nfserr)
fs/nilfs2/gcinode.c+3−3
@@ -73,10 +73,8 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff, · 72 unmodified lines
7373 struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
7474
7575 err = nilfs_dat_translate(nilfs->ns_dat, vbn, &pbn);
76− if (unlikely(err)) { /* -EIO, -ENOMEM, -ENOENT */
77− brelse(bh);
76+ if (unlikely(err)) /* -EIO, -ENOMEM, -ENOENT */
7877 goto failed;
79− }
8078 }
8179
8280 lock_buffer(bh);
@@ -102,6 +100,8 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff, · 19 unmodified lines
102100 failed:
103101 unlock_page(bh->b_page);
104102 put_page(bh->b_page);
103+ if (unlikely(err))
104+ brelse(bh);
105105 return err;
106106 }
107107
fs/ntfs3/super.c+1−0
@@ -1562,6 +1562,7 @@ load_root: · 1561 unmodified lines
15621562 put_inode_out:
15631563 iput(inode);
15641564 out:
1565+ ntfs3_put_sbi(sbi);
15651566 kfree(boot2);
15661567 return err;
15671568 }
fs/overlayfs/copy_up.c+1−1
@@ -337,7 +337,7 @@ static int ovl_set_timestamps(struct ovl_fs *ofs, struct dentry *upperdentry, · 336 unmodified lines
337337 {
338338 struct iattr attr = {
339339 .ia_valid =
340− ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET,
340+ ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_CTIME,
341341 .ia_atime = stat->atime,
342342 .ia_mtime = stat->mtime,
343343 };
fs/overlayfs/export.c+1−1
@@ -188,7 +188,7 @@ static int ovl_check_encode_origin(struct dentry *dentry) · 187 unmodified lines
188188
189189 /* Lower file handle for non-upper non-decodable */
190190 if (!ovl_dentry_upper(dentry) && !decodable)
191− return 0;
191+ return 1;
192192
193193 /* Upper file handle for pure upper */
194194 if (!ovl_dentry_lower(dentry))
fs/overlayfs/file.c+6−2
@@ -341,7 +341,6 @@ static ssize_t ovl_read_iter(struct kiocb *iocb, struct iov_iter *iter) · 340 unmodified lines
341341 if (!aio_req)
342342 goto out;
343343
344− real.flags = 0;
345344 aio_req->orig_iocb = iocb;
346345 kiocb_clone(&aio_req->iocb, iocb, get_file(real.file));
347346 aio_req->iocb.ki_complete = ovl_aio_rw_complete;
@@ -391,6 +390,12 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) · 43 unmodified lines
391390 if (!ovl_should_sync(OVL_FS(inode->i_sb)))
392391 ifl &= ~(IOCB_DSYNC | IOCB_SYNC);
393392
393+ /*
394+ * Overlayfs doesn't support deferred completions, don't copy
395+ * this property in case it is set by the issuer.
396+ */
397+ ifl &= ~IOCB_DIO_CALLER_COMP;
398+
394399 old_cred = ovl_override_creds(file_inode(file)->i_sb);
395400 if (is_sync_kiocb(iocb)) {
396401 file_start_write(real.file);
@@ -407,7 +412,6 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) · 10 unmodified lines
407412 if (!aio_req)
408413 goto out;
409414
410− real.flags = 0;
411415 aio_req->orig_iocb = iocb;
412416 kiocb_clone(&aio_req->iocb, iocb, get_file(real.file));
413417 aio_req->iocb.ki_flags = ifl;
fs/overlayfs/ovl_entry.h+1−9
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 struct ovl_config {
99 char *upperdir;
1010 char *workdir;
11+ char **lowerdirs;
1112 bool default_permissions;
1213 int redirect_mode;
1314 int verity_mode;
@@ -39,17 +40,8 @@ struct ovl_layer { · 25 unmodified lines
3940 int idx;
4041 /* One fsid per unique underlying sb (upper fsid == 0) */
4142 int fsid;
42− char *name;
4343 };
4444
45−/*
46− * ovl_free_fs() relies on @mnt being the first member when unmounting
47− * the private mounts created for each layer. Let's check both the
48− * offset and type.
49− */
50−static_assert(offsetof(struct ovl_layer, mnt) == 0);
51−static_assert(__same_type(typeof_member(struct ovl_layer, mnt), struct vfsmount *));
52−
5345 struct ovl_path {
5446 const struct ovl_layer *layer;
5547 struct dentry *dentry;
fs/overlayfs/params.c+9−8
@@ -752,12 +752,12 @@ void ovl_free_fs(struct ovl_fs *ofs) · 751 unmodified lines
752752 if (ofs->upperdir_locked)
753753 ovl_inuse_unlock(ovl_upper_mnt(ofs)->mnt_root);
754754
755− /* Hack! Reuse ofs->layers as a vfsmount array before freeing it */
756− mounts = (struct vfsmount **) ofs->layers;
755+ /* Reuse ofs->config.lowerdirs as a vfsmount array before freeing it */
756+ mounts = (struct vfsmount **) ofs->config.lowerdirs;
757757 for (i = 0; i < ofs->numlayer; i++) {
758758 iput(ofs->layers[i].trap);
759+ kfree(ofs->config.lowerdirs[i]);
759760 mounts[i] = ofs->layers[i].mnt;
760− kfree(ofs->layers[i].name);
761761 }
762762 kern_unmount_array(mounts, ofs->numlayer);
763763 kfree(ofs->layers);
@@ -765,6 +765,7 @@ void ovl_free_fs(struct ovl_fs *ofs) · 1 unmodified line
765765 free_anon_bdev(ofs->fs[i].pseudo_dev);
766766 kfree(ofs->fs);
767767
768+ kfree(ofs->config.lowerdirs);
768769 kfree(ofs->config.upperdir);
769770 kfree(ofs->config.workdir);
770771 if (ofs->creator_cred)
@@ -949,16 +950,16 @@ int ovl_show_options(struct seq_file *m, struct dentry *dentry) · 178 unmodified lines
949950 struct super_block *sb = dentry->d_sb;
950951 struct ovl_fs *ofs = OVL_FS(sb);
951952 size_t nr, nr_merged_lower = ofs->numlayer - ofs->numdatalayer;
952− const struct ovl_layer *data_layers = &ofs->layers[nr_merged_lower];
953+ char **lowerdatadirs = &ofs->config.lowerdirs[nr_merged_lower];
953954
954− /* ofs->layers[0] is the upper layer */
955− seq_printf(m, ",lowerdir=%s", ofs->layers[1].name);
955+ /* lowerdirs[] starts from offset 1 */
956+ seq_printf(m, ",lowerdir=%s", ofs->config.lowerdirs[1]);
956957 /* dump regular lower layers */
957958 for (nr = 2; nr < nr_merged_lower; nr++)
958− seq_printf(m, ":%s", ofs->layers[nr].name);
959+ seq_printf(m, ":%s", ofs->config.lowerdirs[nr]);
959960 /* dump data lower layers */
960961 for (nr = 0; nr < ofs->numdatalayer; nr++)
961− seq_printf(m, "::%s", data_layers[nr].name);
962+ seq_printf(m, "::%s", lowerdatadirs[nr]);
962963 if (ofs->config.upperdir) {
963964 seq_show_option(m, "upperdir", ofs->config.upperdir);
964965 seq_show_option(m, "workdir", ofs->config.workdir);
fs/overlayfs/super.c+17−10
@@ -104,8 +104,8 @@ static int ovl_revalidate_real(struct dentry *d, unsigned int flags, bool weak) · 103 unmodified lines
104104 static int ovl_dentry_revalidate_common(struct dentry *dentry,
105105 unsigned int flags, bool weak)
106106 {
107− struct ovl_entry *oe = OVL_E(dentry);
108− struct ovl_path *lowerstack = ovl_lowerstack(oe);
107+ struct ovl_entry *oe;
108+ struct ovl_path *lowerstack;
109109 struct inode *inode = d_inode_rcu(dentry);
110110 struct dentry *upper;
111111 unsigned int i;
@@ -115,6 +115,8 @@ static int ovl_dentry_revalidate_common(struct dentry *dentry, · 3 unmodified lines
115115 if (!inode)
116116 return -ECHILD;
117117
118+ oe = OVL_I_E(inode);
119+ lowerstack = ovl_lowerstack(oe);
118120 upper = ovl_i_dentry_upper(inode);
119121 if (upper)
120122 ret = ovl_revalidate_real(upper, flags, weak);
@@ -167,6 +169,7 @@ static void ovl_free_inode(struct inode *inode) · 46 unmodified lines
167169 struct ovl_inode *oi = OVL_I(inode);
168170
169171 kfree(oi->redirect);
172+ kfree(oi->oe);
170173 mutex_destroy(&oi->lock);
171174 kmem_cache_free(ovl_inode_cachep, oi);
172175 }
@@ -176,7 +179,7 @@ static void ovl_destroy_inode(struct inode *inode) · 3 unmodified lines
176179 struct ovl_inode *oi = OVL_I(inode);
177180
178181 dput(oi->__upperdentry);
179− ovl_free_entry(oi->oe);
182+ ovl_stack_put(ovl_lowerstack(oi->oe), ovl_numlower(oi->oe));
180183 if (S_ISDIR(inode->i_mode))
181184 ovl_dir_cache_free(inode);
182185 else
@@ -569,11 +572,6 @@ static int ovl_get_upper(struct super_block *sb, struct ovl_fs *ofs, · 386 unmodified lines
569572 upper_layer->idx = 0;
570573 upper_layer->fsid = 0;
571574
572− err = -ENOMEM;
573− upper_layer->name = kstrdup(ofs->config.upperdir, GFP_KERNEL);
574− if (!upper_layer->name)
575− goto out;
576−
577575 /*
578576 * Inherit SB_NOSEC flag from upperdir.
579577 *
@@ -1122,7 +1120,8 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs, · 542 unmodified lines
11221120 layers[ofs->numlayer].idx = ofs->numlayer;
11231121 layers[ofs->numlayer].fsid = fsid;
11241122 layers[ofs->numlayer].fs = &ofs->fs[fsid];
1125− layers[ofs->numlayer].name = l->name;
1123+ /* Store for printing lowerdir=... in ovl_show_options() */
1124+ ofs->config.lowerdirs[ofs->numlayer] = l->name;
11261125 l->name = NULL;
11271126 ofs->numlayer++;
11281127 ofs->fs[fsid].is_lower = true;
@@ -1367,8 +1366,16 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc) · 238 unmodified lines
13671366 if (!layers)
13681367 goto out_err;
13691368
1369+ ofs->config.lowerdirs = kcalloc(ctx->nr + 1, sizeof(char *), GFP_KERNEL);
1370+ if (!ofs->config.lowerdirs) {
1371+ kfree(layers);
1372+ goto out_err;
1373+ }
13701374 ofs->layers = layers;
1371− /* Layer 0 is reserved for upper even if there's no upper */
1375+ /*
1376+ * Layer 0 is reserved for upper even if there's no upper.
1377+ * For consistency, config.lowerdirs[0] is NULL.
1378+ */
13721379 ofs->numlayer = 1;
13731380
13741381 sb->s_stack_depth = 0;
fs/pipe.c+0−1
@@ -537,7 +537,6 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) · 536 unmodified lines
537537 break;
538538 }
539539 ret += copied;
540− buf->offset = 0;
541540 buf->len = copied;
542541
543542 if (!iov_iter_count(from))
fs/proc/internal.h+0−2
@@ -289,9 +289,7 @@ struct proc_maps_private { · 288 unmodified lines
289289 struct inode *inode;
290290 struct task_struct *task;
291291 struct mm_struct *mm;
292−#ifdef CONFIG_MMU
293292 struct vma_iterator iter;
294−#endif
295293 #ifdef CONFIG_NUMA
296294 struct mempolicy *task_mempolicy;
297295 #endif
fs/proc/task_nommu.c+37−27
@@ -175,15 +175,28 @@ static int show_map(struct seq_file *m, void *_p) · 174 unmodified lines
175175 return nommu_vma_show(m, _p);
176176 }
177177
178−static void *m_start(struct seq_file *m, loff_t *pos)
178+static struct vm_area_struct *proc_get_vma(struct proc_maps_private *priv,
179+ loff_t *ppos)
180+{
181+ struct vm_area_struct *vma = vma_next(&priv->iter);
182+
183+ if (vma) {
184+ *ppos = vma->vm_start;
185+ } else {
186+ *ppos = -1UL;
187+ }
188+
189+ return vma;
190+}
191+
192+static void *m_start(struct seq_file *m, loff_t *ppos)
179193 {
180194 struct proc_maps_private *priv = m->private;
195+ unsigned long last_addr = *ppos;
181196 struct mm_struct *mm;
182− struct vm_area_struct *vma;
183− unsigned long addr = *pos;
184197
185− /* See m_next(). Zero at the start or after lseek. */
186− if (addr == -1UL)
198+ /* See proc_get_vma(). Zero at the start or after lseek. */
199+ if (last_addr == -1UL)
187200 return NULL;
188201
189202 /* pin the task and mm whilst we play with them */
@@ -192,44 +205,41 @@ static void *m_start(struct seq_file *m, loff_t *pos) · 2 unmodified lines
192205 return ERR_PTR(-ESRCH);
193206
194207 mm = priv->mm;
195− if (!mm || !mmget_not_zero(mm))
208+ if (!mm || !mmget_not_zero(mm)) {
209+ put_task_struct(priv->task);
210+ priv->task = NULL;
196211 return NULL;
212+ }
197213
198214 if (mmap_read_lock_killable(mm)) {
199215 mmput(mm);
216+ put_task_struct(priv->task);
217+ priv->task = NULL;
200218 return ERR_PTR(-EINTR);
201219 }
202220
203− /* start the next element from addr */
204− vma = find_vma(mm, addr);
205− if (vma)
206− return vma;
221+ vma_iter_init(&priv->iter, mm, last_addr);
207222
208− mmap_read_unlock(mm);
209− mmput(mm);
210− return NULL;
223+ return proc_get_vma(priv, ppos);
211224 }
212225
213−static void m_stop(struct seq_file *m, void *_vml)
226+static void m_stop(struct seq_file *m, void *v)
214227 {
215228 struct proc_maps_private *priv = m->private;
229+ struct mm_struct *mm = priv->mm;
216230
217− if (!IS_ERR_OR_NULL(_vml)) {
218− mmap_read_unlock(priv->mm);
219− mmput(priv->mm);
220− }
221− if (priv->task) {
222− put_task_struct(priv->task);
223− priv->task = NULL;
224− }
231+ if (!priv->task)
232+ return;
233+
234+ mmap_read_unlock(mm);
235+ mmput(mm);
236+ put_task_struct(priv->task);
237+ priv->task = NULL;
225238 }
226239
227−static void *m_next(struct seq_file *m, void *_p, loff_t *pos)
240+static void *m_next(struct seq_file *m, void *_p, loff_t *ppos)
228241 {
229− struct vm_area_struct *vma = _p;
230−
231− *pos = vma->vm_end;
232− return find_vma(vma->vm_mm, vma->vm_end);
242+ return proc_get_vma(m->private, ppos);
233243 }
234244
235245 static const struct seq_operations proc_pid_maps_ops = {
fs/reiserfs/reiserfs.h+3−3
@@ -2699,7 +2699,7 @@ struct reiserfs_iget_args { · 2698 unmodified lines
26992699 #define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12)
27002700
27012701 #define journal_trans_half(blocksize) \
2702− ((blocksize - sizeof (struct reiserfs_journal_desc) + sizeof (__u32) - 12) / sizeof (__u32))
2702+ ((blocksize - sizeof(struct reiserfs_journal_desc) - 12) / sizeof(__u32))
27032703
27042704 /* journal.c see journal.c for all the comments here */
27052705
@@ -2711,7 +2711,7 @@ struct reiserfs_journal_desc { · 5 unmodified lines
27112711 __le32 j_len;
27122712
27132713 __le32 j_mount_id; /* mount id of this trans */
2714− __le32 j_realblock[1]; /* real locations for each block */
2714+ __le32 j_realblock[]; /* real locations for each block */
27152715 };
27162716
27172717 #define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id)
@@ -2726,7 +2726,7 @@ struct reiserfs_journal_desc { · 8 unmodified lines
27262726 struct reiserfs_journal_commit {
27272727 __le32 j_trans_id; /* must match j_trans_id from the desc block */
27282728 __le32 j_len; /* ditto */
2729− __le32 j_realblock[1]; /* real locations for each block */
2729+ __le32 j_realblock[]; /* real locations for each block */
27302730 };
27312731
27322732 #define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id)
fs/smb/client/cached_dir.c+6−0
@@ -452,6 +452,9 @@ void invalidate_all_cached_dirs(struct cifs_tcon *tcon) · 451 unmodified lines
452452 struct cached_fid *cfid, *q;
453453 LIST_HEAD(entry);
454454
455+ if (cfids == NULL)
456+ return;
457+
455458 spin_lock(&cfids->cfid_list_lock);
456459 list_for_each_entry_safe(cfid, q, &cfids->entries, entry) {
457460 list_move(&cfid->entry, &entry);
@@ -651,6 +654,9 @@ void free_cached_dirs(struct cached_fids *cfids) · 193 unmodified lines
651654 struct cached_fid *cfid, *q;
652655 LIST_HEAD(entry);
653656
657+ if (cfids == NULL)
658+ return;
659+
654660 if (cfids->laundromat) {
655661 kthread_stop(cfids->laundromat);
656662 cfids->laundromat = NULL;
fs/smb/client/cifsglob.h+2−1
@@ -1807,6 +1807,7 @@ static inline bool is_retryable_error(int error) · 1806 unmodified lines
18071807 #define MID_RETRY_NEEDED 8 /* session closed while this request out */
18081808 #define MID_RESPONSE_MALFORMED 0x10
18091809 #define MID_SHUTDOWN 0x20
1810+#define MID_RESPONSE_READY 0x40 /* ready for other process handle the rsp */
18101811
18111812 /* Flags */
18121813 #define MID_WAIT_CANCELLED 1 /* Cancelled while waiting for response */
@@ -1943,7 +1944,7 @@ require use of the stronger protocol */ · 130 unmodified lines
19431944 * cifsInodeInfo->lock_sem cifsInodeInfo->llist cifs_init_once
19441945 * ->can_cache_brlcks
19451946 * cifsInodeInfo->deferred_lock cifsInodeInfo->deferred_closes cifsInodeInfo_alloc
1946− * cached_fid->fid_mutex cifs_tcon->crfid tconInfoAlloc
1947+ * cached_fid->fid_mutex cifs_tcon->crfid tcon_info_alloc
19471948 * cifsFileInfo->fh_mutex cifsFileInfo cifs_new_fileinfo
19481949 * cifsFileInfo->file_info_lock cifsFileInfo->count cifs_new_fileinfo
19491950 * ->invalidHandle initiate_cifs_search
fs/smb/client/cifsproto.h+1−1
@@ -512,7 +512,7 @@ extern int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses); · 511 unmodified lines
512512
513513 extern struct cifs_ses *sesInfoAlloc(void);
514514 extern void sesInfoFree(struct cifs_ses *);
515−extern struct cifs_tcon *tconInfoAlloc(void);
515+extern struct cifs_tcon *tcon_info_alloc(bool dir_leases_enabled);
516516 extern void tconInfoFree(struct cifs_tcon *);
517517
518518 extern int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
fs/smb/client/connect.c+6−2
@@ -1882,7 +1882,8 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx) · 1881 unmodified lines
18821882 }
18831883 }
18841884
1885− tcon = tconInfoAlloc();
1885+ /* no need to setup directory caching on IPC share, so pass in false */
1886+ tcon = tcon_info_alloc(false);
18861887 if (tcon == NULL)
18871888 return -ENOMEM;
18881889
@@ -2492,7 +2493,10 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) · 603 unmodified lines
24922493 goto out_fail;
24932494 }
24942495
2495− tcon = tconInfoAlloc();
2496+ if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING)
2497+ tcon = tcon_info_alloc(true);
2498+ else
2499+ tcon = tcon_info_alloc(false);
24962500 if (tcon == NULL) {
24972501 rc = -ENOMEM;
24982502 goto out_fail;
fs/smb/client/fs_context.c+1−0
@@ -1541,6 +1541,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, · 1540 unmodified lines
15411541
15421542 cifs_parse_mount_err:
15431543 kfree_sensitive(ctx->password);
1544+ ctx->password = NULL;
15441545 return -EINVAL;
15451546 }
15461547
fs/smb/client/misc.c+9−5
@@ -113,18 +113,22 @@ sesInfoFree(struct cifs_ses *buf_to_free) · 112 unmodified lines
113113 }
114114
115115 struct cifs_tcon *
116−tconInfoAlloc(void)
116+tcon_info_alloc(bool dir_leases_enabled)
117117 {
118118 struct cifs_tcon *ret_buf;
119119
120120 ret_buf = kzalloc(sizeof(*ret_buf), GFP_KERNEL);
121121 if (!ret_buf)
122122 return NULL;
123− ret_buf->cfids = init_cached_dirs();
124− if (!ret_buf->cfids) {
125− kfree(ret_buf);
126− return NULL;
123+
124+ if (dir_leases_enabled == true) {
125+ ret_buf->cfids = init_cached_dirs();
126+ if (!ret_buf->cfids) {
127+ kfree(ret_buf);
128+ return NULL;
129+ }
127130 }
131+ /* else ret_buf->cfids is already set to NULL above */
128132
129133 atomic_inc(&tconInfoAllocCount);
130134 ret_buf->status = TID_NEW;
fs/smb/client/smb2inode.c+3−0
@@ -539,6 +539,9 @@ static int parse_create_response(struct cifs_open_info_data *data, · 538 unmodified lines
539539 int rc = 0;
540540
541541 switch (rsp->hdr.Status) {
542+ case STATUS_IO_REPARSE_TAG_NOT_HANDLED:
543+ reparse_point = true;
544+ break;
542545 case STATUS_STOPPED_ON_SYMLINK:
543546 rc = smb2_parse_symlink_response(cifs_sb, iov,
544547 &data->symlink_target);
fs/smb/client/smb2maperror.c+0−2
@@ -877,8 +877,6 @@ static const struct status_to_posix_error smb2_error_map_table[] = { · 876 unmodified lines
877877 "STATUS_IO_REPARSE_TAG_MISMATCH"},
878878 {STATUS_IO_REPARSE_DATA_INVALID, -EIO,
879879 "STATUS_IO_REPARSE_DATA_INVALID"},
880− {STATUS_IO_REPARSE_TAG_NOT_HANDLED, -EIO,
881− "STATUS_IO_REPARSE_TAG_NOT_HANDLED"},
882880 {STATUS_REPARSE_POINT_NOT_RESOLVED, -EIO,
883881 "STATUS_REPARSE_POINT_NOT_RESOLVED"},
884882 {STATUS_DIRECTORY_IS_A_REPARSE_POINT, -EIO,
fs/smb/client/smb2pdu.c+2−2
@@ -848,7 +848,7 @@ add_posix_context(struct kvec *iov, unsigned int *num_iovec, umode_t mode) · 847 unmodified lines
848848
849849 iov[num].iov_base = create_posix_buf(mode);
850850 if (mode == ACL_NO_MODE)
851− cifs_dbg(FYI, "Invalid mode\n");
851+ cifs_dbg(FYI, "%s: no mode\n", __func__);
852852 if (iov[num].iov_base == NULL)
853853 return -ENOMEM;
854854 iov[num].iov_len = sizeof(struct create_posix);
@@ -3878,7 +3878,7 @@ void smb2_reconnect_server(struct work_struct *work) · 3023 unmodified lines
38783878 goto done;
38793879
38803880 /* allocate a dummy tcon struct used for reconnect */
3881− tcon = tconInfoAlloc();
3881+ tcon = tcon_info_alloc(false);
38823882 if (!tcon) {
38833883 resched = true;
38843884 list_for_each_entry_safe(ses, ses2, &tmp_ses_list, rlist) {
fs/smb/client/smbdirect.c+6−3
@@ -1401,10 +1401,13 @@ create_conn: · 1400 unmodified lines
14011401 server->smbd_conn = smbd_get_connection(
14021402 server, (struct sockaddr *) &server->dstaddr);
14031403
1404− if (server->smbd_conn)
1404+ if (server->smbd_conn) {
14051405 cifs_dbg(VFS, "RDMA transport re-established\n");
1406−
1407− return server->smbd_conn ? 0 : -ENOENT;
1406+ trace_smb3_smbd_connect_done(server->hostname, server->conn_id, &server->dstaddr);
1407+ return 0;
1408+ }
1409+ trace_smb3_smbd_connect_err(server->hostname, server->conn_id, &server->dstaddr);
1410+ return -ENOENT;
14081411 }
14091412
14101413 static void destroy_caches_and_workqueue(struct smbd_connection *info)
fs/smb/client/trace.h+2−0
@@ -935,6 +935,8 @@ DEFINE_EVENT(smb3_connect_class, smb3_##name, \ · 934 unmodified lines
935935 TP_ARGS(hostname, conn_id, addr))
936936
937937 DEFINE_SMB3_CONNECT_EVENT(connect_done);
938+DEFINE_SMB3_CONNECT_EVENT(smbd_connect_done);
939+DEFINE_SMB3_CONNECT_EVENT(smbd_connect_err);
938940
939941 DECLARE_EVENT_CLASS(smb3_connect_err_class,
940942 TP_PROTO(char *hostname, __u64 conn_id,
fs/smb/client/transport.c+23−11
@@ -35,6 +35,8 @@ · 34 unmodified lines
3535 void
3636 cifs_wake_up_task(struct mid_q_entry *mid)
3737 {
38+ if (mid->mid_state == MID_RESPONSE_RECEIVED)
39+ mid->mid_state = MID_RESPONSE_READY;
3840 wake_up_process(mid->callback_data);
3941 }
4042
@@ -87,7 +89,8 @@ static void __release_mid(struct kref *refcount) · 46 unmodified lines
8789 struct TCP_Server_Info *server = midEntry->server;
8890
8991 if (midEntry->resp_buf && (midEntry->mid_flags & MID_WAIT_CANCELLED) &&
90− midEntry->mid_state == MID_RESPONSE_RECEIVED &&
92+ (midEntry->mid_state == MID_RESPONSE_RECEIVED ||
93+ midEntry->mid_state == MID_RESPONSE_READY) &&
9194 server->ops->handle_cancelled_mid)
9295 server->ops->handle_cancelled_mid(midEntry, server);
9396
@@ -737,7 +740,8 @@ wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ) · 643 unmodified lines
737740 int error;
738741
739742 error = wait_event_state(server->response_q,
740− midQ->mid_state != MID_REQUEST_SUBMITTED,
743+ midQ->mid_state != MID_REQUEST_SUBMITTED &&
744+ midQ->mid_state != MID_RESPONSE_RECEIVED,
741745 (TASK_KILLABLE|TASK_FREEZABLE_UNSAFE));
742746 if (error < 0)
743747 return -ERESTARTSYS;
@@ -890,7 +894,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) · 146 unmodified lines
890894
891895 spin_lock(&server->mid_lock);
892896 switch (mid->mid_state) {
893− case MID_RESPONSE_RECEIVED:
897+ case MID_RESPONSE_READY:
894898 spin_unlock(&server->mid_lock);
895899 return rc;
896900 case MID_RETRY_NEEDED:
@@ -989,6 +993,9 @@ cifs_compound_callback(struct mid_q_entry *mid) · 92 unmodified lines
989993 credits.instance = server->reconnect_instance;
990994
991995 add_credits(server, &credits, mid->optype);
996+
997+ if (mid->mid_state == MID_RESPONSE_RECEIVED)
998+ mid->mid_state = MID_RESPONSE_READY;
992999 }
9931000
9941001 static void
@@ -1209,7 +1216,8 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 214 unmodified lines
12091216 send_cancel(server, &rqst[i], midQ[i]);
12101217 spin_lock(&server->mid_lock);
12111218 midQ[i]->mid_flags |= MID_WAIT_CANCELLED;
1212− if (midQ[i]->mid_state == MID_REQUEST_SUBMITTED) {
1219+ if (midQ[i]->mid_state == MID_REQUEST_SUBMITTED ||
1220+ midQ[i]->mid_state == MID_RESPONSE_RECEIVED) {
12131221 midQ[i]->callback = cifs_cancelled_callback;
12141222 cancelled_mid[i] = true;
12151223 credits[i].value = 0;
@@ -1230,7 +1238,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 14 unmodified lines
12301238 }
12311239
12321240 if (!midQ[i]->resp_buf ||
1233− midQ[i]->mid_state != MID_RESPONSE_RECEIVED) {
1241+ midQ[i]->mid_state != MID_RESPONSE_READY) {
12341242 rc = -EIO;
12351243 cifs_dbg(FYI, "Bad MID state?\n");
12361244 goto out;
@@ -1417,7 +1425,8 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, · 180 unmodified lines
14171425 if (rc != 0) {
14181426 send_cancel(server, &rqst, midQ);
14191427 spin_lock(&server->mid_lock);
1420− if (midQ->mid_state == MID_REQUEST_SUBMITTED) {
1428+ if (midQ->mid_state == MID_REQUEST_SUBMITTED ||
1429+ midQ->mid_state == MID_RESPONSE_RECEIVED) {
14211430 /* no longer considered to be "in-flight" */
14221431 midQ->callback = release_mid;
14231432 spin_unlock(&server->mid_lock);
@@ -1434,7 +1443,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, · 10 unmodified lines
14341443 }
14351444
14361445 if (!midQ->resp_buf || !out_buf ||
1437− midQ->mid_state != MID_RESPONSE_RECEIVED) {
1446+ midQ->mid_state != MID_RESPONSE_READY) {
14381447 rc = -EIO;
14391448 cifs_server_dbg(VFS, "Bad MID state?\n");
14401449 goto out;
@@ -1558,14 +1567,16 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, · 117 unmodified lines
15581567
15591568 /* Wait for a reply - allow signals to interrupt. */
15601569 rc = wait_event_interruptible(server->response_q,
1561− (!(midQ->mid_state == MID_REQUEST_SUBMITTED)) ||
1570+ (!(midQ->mid_state == MID_REQUEST_SUBMITTED ||
1571+ midQ->mid_state == MID_RESPONSE_RECEIVED)) ||
15621572 ((server->tcpStatus != CifsGood) &&
15631573 (server->tcpStatus != CifsNew)));
15641574
15651575 /* Were we interrupted by a signal ? */
15661576 spin_lock(&server->srv_lock);
15671577 if ((rc == -ERESTARTSYS) &&
1568− (midQ->mid_state == MID_REQUEST_SUBMITTED) &&
1578+ (midQ->mid_state == MID_REQUEST_SUBMITTED ||
1579+ midQ->mid_state == MID_RESPONSE_RECEIVED) &&
15691580 ((server->tcpStatus == CifsGood) ||
15701581 (server->tcpStatus == CifsNew))) {
15711582 spin_unlock(&server->srv_lock);
@@ -1596,7 +1607,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, · 24 unmodified lines
15961607 if (rc) {
15971608 send_cancel(server, &rqst, midQ);
15981609 spin_lock(&server->mid_lock);
1599− if (midQ->mid_state == MID_REQUEST_SUBMITTED) {
1610+ if (midQ->mid_state == MID_REQUEST_SUBMITTED ||
1611+ midQ->mid_state == MID_RESPONSE_RECEIVED) {
16001612 /* no longer considered to be "in-flight" */
16011613 midQ->callback = release_mid;
16021614 spin_unlock(&server->mid_lock);
@@ -1616,7 +1628,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, · 13 unmodified lines
16161628 return rc;
16171629
16181630 /* rcvd frame is ok */
1619− if (out_buf == NULL || midQ->mid_state != MID_RESPONSE_RECEIVED) {
1631+ if (out_buf == NULL || midQ->mid_state != MID_RESPONSE_READY) {
16201632 rc = -EIO;
16211633 cifs_tcon_dbg(VFS, "Bad MID state?\n");
16221634 goto out;
fs/smb/server/connection.c+3−0
@@ -197,6 +197,9 @@ int ksmbd_conn_write(struct ksmbd_work *work) · 196 unmodified lines
197197 if (work->send_no_response)
198198 return 0;
199199
200+ if (!work->iov_idx)
201+ return -EINVAL;
202+
200203 ksmbd_conn_lock(conn);
201204 sent = conn->transport->ops->writev(conn->transport, work->iov,
202205 work->iov_cnt,
fs/smb/server/server.c+3−1
@@ -115,8 +115,10 @@ static int __process_request(struct ksmbd_work *work, struct ksmbd_conn *conn, · 114 unmodified lines
115115 if (check_conn_state(work))
116116 return SERVER_HANDLER_CONTINUE;
117117
118− if (ksmbd_verify_smb_message(work))
118+ if (ksmbd_verify_smb_message(work)) {
119+ conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER);
119120 return SERVER_HANDLER_ABORT;
121+ }
120122
121123 command = conn->ops->get_cmd_val(work);
122124 *cmd = command;
fs/smb/server/smb2misc.c+1−3
@@ -440,10 +440,8 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work) · 439 unmodified lines
440440
441441 validate_credit:
442442 if ((work->conn->vals->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU) &&
443− smb2_validate_credit_charge(work->conn, hdr)) {
444− work->conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER);
443+ smb2_validate_credit_charge(work->conn, hdr))
445444 return 1;
446− }
447445
448446 return 0;
449447 }
fs/tracefs/event_inode.c+70−17
@@ -70,6 +70,7 @@ static struct dentry *eventfs_root_lookup(struct inode *dir, · 69 unmodified lines
7070 struct dentry *dentry,
7171 unsigned int flags);
7272 static int dcache_dir_open_wrapper(struct inode *inode, struct file *file);
73+static int dcache_readdir_wrapper(struct file *file, struct dir_context *ctx);
7374 static int eventfs_release(struct inode *inode, struct file *file);
7475
7576 static const struct inode_operations eventfs_root_dir_inode_operations = {
@@ -79,7 +80,7 @@ static const struct inode_operations eventfs_root_dir_inode_operations = { · 3 unmodified lines
7980 static const struct file_operations eventfs_file_operations = {
8081 .open = dcache_dir_open_wrapper,
8182 .read = generic_read_dir,
82− .iterate_shared = dcache_readdir,
83+ .iterate_shared = dcache_readdir_wrapper,
8384 .llseek = generic_file_llseek,
8485 .release = eventfs_release,
8586 };
@@ -396,6 +397,11 @@ static struct dentry *eventfs_root_lookup(struct inode *dir, · 310 unmodified lines
396397 return ret;
397398 }
398399
400+struct dentry_list {
401+ void *cursor;
402+ struct dentry **dentries;
403+};
404+
399405 /**
400406 * eventfs_release - called to release eventfs file/dir
401407 * @inode: inode to be released
@@ -404,26 +410,25 @@ static struct dentry *eventfs_root_lookup(struct inode *dir, · 2 unmodified lines
404410 static int eventfs_release(struct inode *inode, struct file *file)
405411 {
406412 struct tracefs_inode *ti;
407− struct eventfs_inode *ei;
408− struct eventfs_file *ef;
409− struct dentry *dentry;
410− int idx;
413+ struct dentry_list *dlist = file->private_data;
414+ void *cursor;
415+ int i;
411416
412417 ti = get_tracefs(inode);
413418 if (!(ti->flags & TRACEFS_EVENT_INODE))
414419 return -EINVAL;
415420
416− ei = ti->private;
417− idx = srcu_read_lock(&eventfs_srcu);
418− list_for_each_entry_srcu(ef, &ei->e_top_files, list,
419− srcu_read_lock_held(&eventfs_srcu)) {
420− mutex_lock(&eventfs_mutex);
421− dentry = ef->dentry;
422− mutex_unlock(&eventfs_mutex);
423− if (dentry)
424− dput(dentry);
421+ if (WARN_ON_ONCE(!dlist))
422+ return -EINVAL;
423+
424+ for (i = 0; dlist->dentries && dlist->dentries[i]; i++) {
425+ dput(dlist->dentries[i]);
425426 }
426− srcu_read_unlock(&eventfs_srcu, idx);
427+
428+ cursor = dlist->cursor;
429+ kfree(dlist->dentries);
430+ kfree(dlist);
431+ file->private_data = cursor;
427432 return dcache_dir_close(inode, file);
428433 }
429434
@@ -442,22 +447,70 @@ static int dcache_dir_open_wrapper(struct inode *inode, struct file *file) · 12 unmodified lines
442447 struct tracefs_inode *ti;
443448 struct eventfs_inode *ei;
444449 struct eventfs_file *ef;
450+ struct dentry_list *dlist;
451+ struct dentry **dentries = NULL;
445452 struct dentry *dentry = file_dentry(file);
453+ struct dentry *d;
446454 struct inode *f_inode = file_inode(file);
455+ int cnt = 0;
447456 int idx;
457+ int ret;
448458
449459 ti = get_tracefs(f_inode);
450460 if (!(ti->flags & TRACEFS_EVENT_INODE))
451461 return -EINVAL;
452462
463+ if (WARN_ON_ONCE(file->private_data))
464+ return -EINVAL;
465+
466+ dlist = kmalloc(sizeof(*dlist), GFP_KERNEL);
467+ if (!dlist)
468+ return -ENOMEM;
469+
453470 ei = ti->private;
454471 idx = srcu_read_lock(&eventfs_srcu);
455472 list_for_each_entry_srcu(ef, &ei->e_top_files, list,
456473 srcu_read_lock_held(&eventfs_srcu)) {
457− create_dentry(ef, dentry, false);
474+ d = create_dentry(ef, dentry, false);
475+ if (d) {
476+ struct dentry **tmp;
477+
478+ tmp = krealloc(dentries, sizeof(d) * (cnt + 2), GFP_KERNEL);
479+ if (!tmp)
480+ break;
481+ tmp[cnt] = d;
482+ tmp[cnt + 1] = NULL;
483+ cnt++;
484+ dentries = tmp;
485+ }
458486 }
459487 srcu_read_unlock(&eventfs_srcu, idx);
460− return dcache_dir_open(inode, file);
488+ ret = dcache_dir_open(inode, file);
489+
490+ /*
491+ * dcache_dir_open() sets file->private_data to a dentry cursor.
492+ * Need to save that but also save all the dentries that were
493+ * opened by this function.
494+ */
495+ dlist->cursor = file->private_data;
496+ dlist->dentries = dentries;
497+ file->private_data = dlist;
498+ return ret;
499+}
500+
501+/*
502+ * This just sets the file->private_data back to the cursor and back.
503+ */
504+static int dcache_readdir_wrapper(struct file *file, struct dir_context *ctx)
505+{
506+ struct dentry_list *dlist = file->private_data;
507+ int ret;
508+
509+ file->private_data = dlist->cursor;
510+ ret = dcache_readdir(file, ctx);
511+ dlist->cursor = file->private_data;
512+ file->private_data = dlist;
513+ return ret;
461514 }
462515
463516 /**
fs/xfs/Kconfig+1−1
@@ -147,7 +147,7 @@ config XFS_ONLINE_SCRUB_STATS · 146 unmodified lines
147147 bool "XFS online metadata check usage data collection"
148148 default y
149149 depends on XFS_ONLINE_SCRUB
150− select FS_DEBUG
150+ select XFS_DEBUG
151151 help
152152 If you say Y here, the kernel will gather usage data about
153153 the online metadata check subsystem. This includes the number
fs/xfs/libxfs/xfs_log_recover.h+22−0
@@ -131,4 +131,26 @@ void xlog_check_buf_cancel_table(struct xlog *log); · 130 unmodified lines
131131 #define xlog_check_buf_cancel_table(log) do { } while (0)
132132 #endif
133133
134+/*
135+ * Transform a regular reservation into one suitable for recovery of a log
136+ * intent item.
137+ *
138+ * Intent recovery only runs a single step of the transaction chain and defers
139+ * the rest to a separate transaction. Therefore, we reduce logcount to 1 here
140+ * to avoid livelocks if the log grant space is nearly exhausted due to the
141+ * recovered intent pinning the tail. Keep the same logflags to avoid tripping
142+ * asserts elsewhere. Struct copies abound below.
143+ */
144+static inline struct xfs_trans_res
145+xlog_recover_resv(const struct xfs_trans_res *r)
146+{
147+ struct xfs_trans_res ret = {
148+ .tr_logres = r->tr_logres,
149+ .tr_logcount = 1,
150+ .tr_logflags = r->tr_logflags,
151+ };
152+
153+ return ret;
154+}
155+
134156 #endif /* __XFS_LOG_RECOVER_H__ */
fs/xfs/libxfs/xfs_sb.c+2−1
@@ -266,7 +266,8 @@ xfs_validate_sb_write( · 265 unmodified lines
266266 return -EFSCORRUPTED;
267267 }
268268
269− if (xfs_sb_has_ro_compat_feature(sbp, XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) {
269+ if (!xfs_is_readonly(mp) &&
270+ xfs_sb_has_ro_compat_feature(sbp, XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) {
270271 xfs_alert(mp,
271272 "Corruption detected in superblock read-only compatible features (0x%x)!",
272273 (sbp->sb_features_ro_compat &
fs/xfs/scrub/scrub.c+2−2
@@ -588,6 +588,8 @@ out_nofix: · 587 unmodified lines
588588 out_teardown:
589589 error = xchk_teardown(sc, error);
590590 out_sc:
591+ if (error != -ENOENT)
592+ xchk_stats_merge(mp, sm, &run);
591593 kfree(sc);
592594 out:
593595 trace_xchk_done(XFS_I(file_inode(file)), sm, error);
@@ -595,8 +597,6 @@ out: · 1 unmodified line
595597 sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
596598 error = 0;
597599 }
598− if (error != -ENOENT)
599− xchk_stats_merge(mp, sm, &run);
600600 return error;
601601 need_drain:
602602 error = xchk_teardown(sc, 0);
fs/xfs/scrub/stats.c+4−1
@@ -185,7 +185,10 @@ xchk_stats_merge_one( · 184 unmodified lines
185185 {
186186 struct xchk_scrub_stats *css;
187187
188− ASSERT(sm->sm_type < XFS_SCRUB_TYPE_NR);
188+ if (sm->sm_type >= XFS_SCRUB_TYPE_NR) {
189+ ASSERT(sm->sm_type < XFS_SCRUB_TYPE_NR);
190+ return;
191+ }
189192
190193 css = &cs->cs_stats[sm->sm_type];
191194 spin_lock(&css->css_lock);
fs/xfs/xfs_attr_inactive.c+0−1
@@ -333,7 +333,6 @@ xfs_attr_inactive( · 332 unmodified lines
333333 int error = 0;
334334
335335 mp = dp->i_mount;
336− ASSERT(! XFS_NOT_DQATTACHED(mp, dp));
337336
338337 xfs_ilock(dp, lock_mode);
339338 if (!xfs_inode_has_attr_fork(dp))
fs/xfs/xfs_attr_item.c+4−3
@@ -547,7 +547,7 @@ xfs_attri_item_recover( · 546 unmodified lines
547547 struct xfs_inode *ip;
548548 struct xfs_da_args *args;
549549 struct xfs_trans *tp;
550− struct xfs_trans_res tres;
550+ struct xfs_trans_res resv;
551551 struct xfs_attri_log_format *attrp;
552552 struct xfs_attri_log_nameval *nv = attrip->attri_nameval;
553553 int error;
@@ -618,8 +618,9 @@ xfs_attri_item_recover( · 64 unmodified lines
618618 goto out;
619619 }
620620
621− xfs_init_attr_trans(args, &tres, &total);
622− error = xfs_trans_alloc(mp, &tres, total, 0, XFS_TRANS_RESERVE, &tp);
621+ xfs_init_attr_trans(args, &resv, &total);
622+ resv = xlog_recover_resv(&resv);
623+ error = xfs_trans_alloc(mp, &resv, total, 0, XFS_TRANS_RESERVE, &tp);
623624 if (error)
624625 goto out;
625626
fs/xfs/xfs_bmap_item.c+3−1
@@ -490,6 +490,7 @@ xfs_bui_item_recover( · 489 unmodified lines
490490 struct list_head *capture_list)
491491 {
492492 struct xfs_bmap_intent fake = { };
493+ struct xfs_trans_res resv;
493494 struct xfs_bui_log_item *buip = BUI_ITEM(lip);
494495 struct xfs_trans *tp;
495496 struct xfs_inode *ip = NULL;
@@ -515,7 +516,8 @@ xfs_bui_item_recover( · 19 unmodified lines
515516 return error;
516517
517518 /* Allocate transaction and do the work. */
518− error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
519+ resv = xlog_recover_resv(&M_RES(mp)->tr_itruncate);
520+ error = xfs_trans_alloc(mp, &resv,
519521 XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK), 0, 0, &tp);
520522 if (error)
521523 goto err_rele;
fs/xfs/xfs_export.c+14−0
@@ -146,6 +146,20 @@ xfs_nfs_get_inode( · 145 unmodified lines
146146 return ERR_PTR(error);
147147 }
148148
149+ /*
150+ * Reload the incore unlinked list to avoid failure in inodegc.
151+ * Use an unlocked check here because unrecovered unlinked inodes
152+ * should be somewhat rare.
153+ */
154+ if (xfs_inode_unlinked_incomplete(ip)) {
155+ error = xfs_inode_reload_unlinked(ip);
156+ if (error) {
157+ xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
158+ xfs_irele(ip);
159+ return ERR_PTR(error);
160+ }
161+ }
162+
149163 if (VFS_I(ip)->i_generation != generation) {
150164 xfs_irele(ip);
151165 return ERR_PTR(-ESTALE);
fs/xfs/xfs_extfree_item.c+3−1
@@ -660,6 +660,7 @@ xfs_efi_item_recover( · 659 unmodified lines
660660 struct xfs_log_item *lip,
661661 struct list_head *capture_list)
662662 {
663+ struct xfs_trans_res resv;
663664 struct xfs_efi_log_item *efip = EFI_ITEM(lip);
664665 struct xfs_mount *mp = lip->li_log->l_mp;
665666 struct xfs_efd_log_item *efdp;
@@ -683,7 +684,8 @@ xfs_efi_item_recover( · 17 unmodified lines
683684 }
684685 }
685686
686− error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
687+ resv = xlog_recover_resv(&M_RES(mp)->tr_itruncate);
688+ error = xfs_trans_alloc(mp, &resv, 0, 0, 0, &tp);
687689 if (error)
688690 return error;
689691 efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents);
fs/xfs/xfs_fsmap.c+18−7
@@ -565,6 +565,19 @@ err: · 564 unmodified lines
565565 }
566566 #endif /* CONFIG_XFS_RT */
567567
568+static inline bool
569+rmap_not_shareable(struct xfs_mount *mp, const struct xfs_rmap_irec *r)
570+{
571+ if (!xfs_has_reflink(mp))
572+ return true;
573+ if (XFS_RMAP_NON_INODE_OWNER(r->rm_owner))
574+ return true;
575+ if (r->rm_flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK |
576+ XFS_RMAP_UNWRITTEN))
577+ return true;
578+ return false;
579+}
580+
568581 /* Execute a getfsmap query against the regular data device. */
569582 STATIC int
570583 __xfs_getfsmap_datadev(
@@ -598,7 +611,6 @@ __xfs_getfsmap_datadev( · 27 unmodified lines
598611 * low to the fsmap low key and max out the high key to the end
599612 * of the AG.
600613 */
601− info->low.rm_startblock = XFS_FSB_TO_AGBNO(mp, start_fsb);
602614 info->low.rm_offset = XFS_BB_TO_FSBT(mp, keys[0].fmr_offset);
603615 error = xfs_fsmap_owner_to_rmap(&info->low, &keys[0]);
604616 if (error)
@@ -608,12 +620,9 @@ __xfs_getfsmap_datadev( · 3 unmodified lines
608620
609621 /* Adjust the low key if we are continuing from where we left off. */
610622 if (info->low.rm_blockcount == 0) {
611− /* empty */
612− } else if (XFS_RMAP_NON_INODE_OWNER(info->low.rm_owner) ||
613− (info->low.rm_flags & (XFS_RMAP_ATTR_FORK |
614− XFS_RMAP_BMBT_BLOCK |
615− XFS_RMAP_UNWRITTEN))) {
616− info->low.rm_startblock += info->low.rm_blockcount;
623+ /* No previous record from which to continue */
624+ } else if (rmap_not_shareable(mp, &info->low)) {
625+ /* Last record seen was an unshareable extent */
617626 info->low.rm_owner = 0;
618627 info->low.rm_offset = 0;
619628
@@ -621,8 +630,10 @@ __xfs_getfsmap_datadev( · 1 unmodified line
621630 if (XFS_FSB_TO_DADDR(mp, start_fsb) >= eofs)
622631 return 0;
623632 } else {
633+ /* Last record seen was a shareable file data extent */
624634 info->low.rm_offset += info->low.rm_blockcount;
625635 }
636+ info->low.rm_startblock = XFS_FSB_TO_AGBNO(mp, start_fsb);
626637
627638 info->high.rm_startblock = -1U;
628639 info->high.rm_owner = ULLONG_MAX;
fs/xfs/xfs_icache.c+29−51
@@ -113,7 +113,7 @@ xfs_inode_alloc( · 112 unmodified lines
113113 INIT_LIST_HEAD(&ip->i_ioend_list);
114114 spin_lock_init(&ip->i_ioend_lock);
115115 ip->i_next_unlinked = NULLAGINO;
116− ip->i_prev_unlinked = NULLAGINO;
116+ ip->i_prev_unlinked = 0;
117117
118118 return ip;
119119 }
@@ -443,7 +443,7 @@ xfs_inodegc_queue_all( · 323 unmodified lines
443443 int cpu;
444444 bool ret = false;
445445
446− for_each_online_cpu(cpu) {
446+ for_each_cpu(cpu, &mp->m_inodegc_cpumask) {
447447 gc = per_cpu_ptr(mp->m_inodegc, cpu);
448448 if (!llist_empty(&gc->list)) {
449449 mod_delayed_work_on(cpu, mp->m_inodegc_wq, &gc->work, 0);
@@ -463,7 +463,7 @@ xfs_inodegc_wait_all( · 13 unmodified lines
463463 int error = 0;
464464
465465 flush_workqueue(mp->m_inodegc_wq);
466− for_each_online_cpu(cpu) {
466+ for_each_cpu(cpu, &mp->m_inodegc_cpumask) {
467467 struct xfs_inodegc *gc;
468468
469469 gc = per_cpu_ptr(mp->m_inodegc, cpu);
@@ -1845,9 +1845,17 @@ xfs_inodegc_worker( · 1375 unmodified lines
18451845 struct xfs_inodegc, work);
18461846 struct llist_node *node = llist_del_all(&gc->list);
18471847 struct xfs_inode *ip, *n;
1848+ struct xfs_mount *mp = gc->mp;
18481849 unsigned int nofs_flag;
18491850
1850− ASSERT(gc->cpu == smp_processor_id());
1851+ /*
1852+ * Clear the cpu mask bit and ensure that we have seen the latest
1853+ * update of the gc structure associated with this CPU. This matches
1854+ * with the release semantics used when setting the cpumask bit in
1855+ * xfs_inodegc_queue.
1856+ */
1857+ cpumask_clear_cpu(gc->cpu, &mp->m_inodegc_cpumask);
1858+ smp_mb__after_atomic();
18511859
18521860 WRITE_ONCE(gc->items, 0);
18531861
@@ -1862,7 +1870,7 @@ xfs_inodegc_worker( · 8 unmodified lines
18621870 nofs_flag = memalloc_nofs_save();
18631871
18641872 ip = llist_entry(node, struct xfs_inode, i_gclist);
1865− trace_xfs_inodegc_worker(ip->i_mount, READ_ONCE(gc->shrinker_hits));
1873+ trace_xfs_inodegc_worker(mp, READ_ONCE(gc->shrinker_hits));
18661874
18671875 WRITE_ONCE(gc->shrinker_hits, 0);
18681876 llist_for_each_entry_safe(ip, n, node, i_gclist) {
@@ -2057,6 +2065,7 @@ xfs_inodegc_queue( · 188 unmodified lines
20572065 struct xfs_inodegc *gc;
20582066 int items;
20592067 unsigned int shrinker_hits;
2068+ unsigned int cpu_nr;
20602069 unsigned long queue_delay = 1;
20612070
20622071 trace_xfs_inode_set_need_inactive(ip);
@@ -2064,18 +2073,28 @@ xfs_inodegc_queue( · 1 unmodified line
20642073 ip->i_flags |= XFS_NEED_INACTIVE;
20652074 spin_unlock(&ip->i_flags_lock);
20662075
2067− gc = get_cpu_ptr(mp->m_inodegc);
2076+ cpu_nr = get_cpu();
2077+ gc = this_cpu_ptr(mp->m_inodegc);
20682078 llist_add(&ip->i_gclist, &gc->list);
20692079 items = READ_ONCE(gc->items);
20702080 WRITE_ONCE(gc->items, items + 1);
20712081 shrinker_hits = READ_ONCE(gc->shrinker_hits);
20722082
2083+ /*
2084+ * Ensure the list add is always seen by anyone who finds the cpumask
2085+ * bit set. This effectively gives the cpumask bit set operation
2086+ * release ordering semantics.
2087+ */
2088+ smp_mb__before_atomic();
2089+ if (!cpumask_test_cpu(cpu_nr, &mp->m_inodegc_cpumask))
2090+ cpumask_test_and_set_cpu(cpu_nr, &mp->m_inodegc_cpumask);
2091+
20732092 /*
20742093 * We queue the work while holding the current CPU so that the work
20752094 * is scheduled to run on this CPU.
20762095 */
20772096 if (!xfs_is_inodegc_enabled(mp)) {
2078− put_cpu_ptr(gc);
2097+ put_cpu();
20792098 return;
20802099 }
20812100
@@ -2085,7 +2104,7 @@ xfs_inodegc_queue( · 3 unmodified lines
20852104 trace_xfs_inodegc_queue(mp, __return_address);
20862105 mod_delayed_work_on(current_cpu(), mp->m_inodegc_wq, &gc->work,
20872106 queue_delay);
2088− put_cpu_ptr(gc);
2107+ put_cpu();
20892108
20902109 if (xfs_inodegc_want_flush_work(ip, items, shrinker_hits)) {
20912110 trace_xfs_inodegc_throttle(mp, __return_address);
@@ -2093,47 +2112,6 @@ xfs_inodegc_queue( · 1 unmodified line
20932112 }
20942113 }
20952114
2096−/*
2097− * Fold the dead CPU inodegc queue into the current CPUs queue.
2098− */
2099−void
2100−xfs_inodegc_cpu_dead(
2101− struct xfs_mount *mp,
2102− unsigned int dead_cpu)
2103−{
2104− struct xfs_inodegc *dead_gc, *gc;
2105− struct llist_node *first, *last;
2106− unsigned int count = 0;
2107−
2108− dead_gc = per_cpu_ptr(mp->m_inodegc, dead_cpu);
2109− cancel_delayed_work_sync(&dead_gc->work);
2110−
2111− if (llist_empty(&dead_gc->list))
2112− return;
2113−
2114− first = dead_gc->list.first;
2115− last = first;
2116− while (last->next) {
2117− last = last->next;
2118− count++;
2119− }
2120− dead_gc->list.first = NULL;
2121− dead_gc->items = 0;
2122−
2123− /* Add pending work to current CPU */
2124− gc = get_cpu_ptr(mp->m_inodegc);
2125− llist_add_batch(first, last, &gc->list);
2126− count += READ_ONCE(gc->items);
2127− WRITE_ONCE(gc->items, count);
2128−
2129− if (xfs_is_inodegc_enabled(mp)) {
2130− trace_xfs_inodegc_queue(mp, __return_address);
2131− mod_delayed_work_on(current_cpu(), mp->m_inodegc_wq, &gc->work,
2132− 0);
2133− }
2134− put_cpu_ptr(gc);
2135−}
2136−
21372115 /*
21382116 * We set the inode flag atomically with the radix tree tag. Once we get tag
21392117 * lookups on the radix tree, this inode flag can go away.
@@ -2195,7 +2173,7 @@ xfs_inodegc_shrinker_count( · 55 unmodified lines
21952173 if (!xfs_is_inodegc_enabled(mp))
21962174 return 0;
21972175
2198− for_each_online_cpu(cpu) {
2176+ for_each_cpu(cpu, &mp->m_inodegc_cpumask) {
21992177 gc = per_cpu_ptr(mp->m_inodegc, cpu);
22002178 if (!llist_empty(&gc->list))
22012179 return XFS_INODEGC_SHRINKER_COUNT;
@@ -2220,7 +2198,7 @@ xfs_inodegc_shrinker_scan( · 18 unmodified lines
22202198
22212199 trace_xfs_inodegc_shrinker_scan(mp, sc, __return_address);
22222200
2223− for_each_online_cpu(cpu) {
2201+ for_each_cpu(cpu, &mp->m_inodegc_cpumask) {
22242202 gc = per_cpu_ptr(mp->m_inodegc, cpu);
22252203 if (!llist_empty(&gc->list)) {
22262204 unsigned int h = READ_ONCE(gc->shrinker_hits);
fs/xfs/xfs_icache.h+0−1
@@ -79,7 +79,6 @@ void xfs_inodegc_push(struct xfs_mount *mp); · 78 unmodified lines
7979 int xfs_inodegc_flush(struct xfs_mount *mp);
8080 void xfs_inodegc_stop(struct xfs_mount *mp);
8181 void xfs_inodegc_start(struct xfs_mount *mp);
82−void xfs_inodegc_cpu_dead(struct xfs_mount *mp, unsigned int cpu);
8382 int xfs_inodegc_register_shrinker(struct xfs_mount *mp);
8483
8584 #endif
fs/xfs/xfs_inode.c+218−13
@@ -1642,8 +1642,11 @@ xfs_inode_needs_inactive( · 1641 unmodified lines
16421642 if (VFS_I(ip)->i_mode == 0)
16431643 return false;
16441644
1645− /* If this is a read-only mount, don't do this (would generate I/O) */
1646− if (xfs_is_readonly(mp))
1645+ /*
1646+ * If this is a read-only mount, don't do this (would generate I/O)
1647+ * unless we're in log recovery and cleaning the iunlinked list.
1648+ */
1649+ if (xfs_is_readonly(mp) && !xlog_recovery_needed(mp->m_log))
16471650 return false;
16481651
16491652 /* If the log isn't running, push inodes straight to reclaim. */
@@ -1703,8 +1706,11 @@ xfs_inactive( · 53 unmodified lines
17031706 mp = ip->i_mount;
17041707 ASSERT(!xfs_iflags_test(ip, XFS_IRECOVERY));
17051708
1706− /* If this is a read-only mount, don't do this (would generate I/O) */
1707− if (xfs_is_readonly(mp))
1709+ /*
1710+ * If this is a read-only mount, don't do this (would generate I/O)
1711+ * unless we're in log recovery and cleaning the iunlinked list.
1712+ */
1713+ if (xfs_is_readonly(mp) && !xlog_recovery_needed(mp->m_log))
17081714 goto out;
17091715
17101716 /* Metadata inodes require explicit resource cleanup. */
@@ -1736,9 +1742,21 @@ xfs_inactive( · 25 unmodified lines
17361742 ip->i_df.if_nextents > 0 || ip->i_delayed_blks > 0))
17371743 truncate = 1;
17381744
1739− error = xfs_qm_dqattach(ip);
1740− if (error)
1741− goto out;
1745+ if (xfs_iflags_test(ip, XFS_IQUOTAUNCHECKED)) {
1746+ /*
1747+ * If this inode is being inactivated during a quotacheck and
1748+ * has not yet been scanned by quotacheck, we /must/ remove
1749+ * the dquots from the inode before inactivation changes the
1750+ * block and inode counts. Most probably this is a result of
1751+ * reloading the incore iunlinked list to purge unrecovered
1752+ * unlinked inodes.
1753+ */
1754+ xfs_qm_dqdetach(ip);
1755+ } else {
1756+ error = xfs_qm_dqattach(ip);
1757+ if (error)
1758+ goto out;
1759+ }
17421760
17431761 if (S_ISLNK(VFS_I(ip)->i_mode))
17441762 error = xfs_inactive_symlink(ip);
@@ -1822,12 +1840,17 @@ xfs_iunlink_lookup( · 77 unmodified lines
18221840
18231841 rcu_read_lock();
18241842 ip = radix_tree_lookup(&pag->pag_ici_root, agino);
1843+ if (!ip) {
1844+ /* Caller can handle inode not being in memory. */
1845+ rcu_read_unlock();
1846+ return NULL;
1847+ }
18251848
18261849 /*
1827− * Inode not in memory or in RCU freeing limbo should not happen.
1828− * Warn about this and let the caller handle the failure.
1850+ * Inode in RCU freeing limbo should not happen. Warn about this and
1851+ * let the caller handle the failure.
18291852 */
1830− if (WARN_ON_ONCE(!ip || !ip->i_ino)) {
1853+ if (WARN_ON_ONCE(!ip->i_ino)) {
18311854 rcu_read_unlock();
18321855 return NULL;
18331856 }
@@ -1836,7 +1859,10 @@ xfs_iunlink_lookup( · 2 unmodified lines
18361859 return ip;
18371860 }
18381861
1839−/* Update the prev pointer of the next agino. */
1862+/*
1863+ * Update the prev pointer of the next agino. Returns -ENOLINK if the inode
1864+ * is not in cache.
1865+ */
18401866 static int
18411867 xfs_iunlink_update_backref(
18421868 struct xfs_perag *pag,
@@ -1851,7 +1877,8 @@ xfs_iunlink_update_backref( · 8 unmodified lines
18511877
18521878 ip = xfs_iunlink_lookup(pag, next_agino);
18531879 if (!ip)
1854− return -EFSCORRUPTED;
1880+ return -ENOLINK;
1881+
18551882 ip->i_prev_unlinked = prev_agino;
18561883 return 0;
18571884 }
@@ -1895,6 +1922,64 @@ xfs_iunlink_update_bucket( · 37 unmodified lines
18951922 return 0;
18961923 }
18971924
1925+/*
1926+ * Load the inode @next_agino into the cache and set its prev_unlinked pointer
1927+ * to @prev_agino. Caller must hold the AGI to synchronize with other changes
1928+ * to the unlinked list.
1929+ */
1930+STATIC int
1931+xfs_iunlink_reload_next(
1932+ struct xfs_trans *tp,
1933+ struct xfs_buf *agibp,
1934+ xfs_agino_t prev_agino,
1935+ xfs_agino_t next_agino)
1936+{
1937+ struct xfs_perag *pag = agibp->b_pag;
1938+ struct xfs_mount *mp = pag->pag_mount;
1939+ struct xfs_inode *next_ip = NULL;
1940+ xfs_ino_t ino;
1941+ int error;
1942+
1943+ ASSERT(next_agino != NULLAGINO);
1944+
1945+#ifdef DEBUG
1946+ rcu_read_lock();
1947+ next_ip = radix_tree_lookup(&pag->pag_ici_root, next_agino);
1948+ ASSERT(next_ip == NULL);
1949+ rcu_read_unlock();
1950+#endif
1951+
1952+ xfs_info_ratelimited(mp,
1953+ "Found unrecovered unlinked inode 0x%x in AG 0x%x. Initiating recovery.",
1954+ next_agino, pag->pag_agno);
1955+
1956+ /*
1957+ * Use an untrusted lookup just to be cautious in case the AGI has been
1958+ * corrupted and now points at a free inode. That shouldn't happen,
1959+ * but we'd rather shut down now since we're already running in a weird
1960+ * situation.
1961+ */
1962+ ino = XFS_AGINO_TO_INO(mp, pag->pag_agno, next_agino);
1963+ error = xfs_iget(mp, tp, ino, XFS_IGET_UNTRUSTED, 0, &next_ip);
1964+ if (error)
1965+ return error;
1966+
1967+ /* If this is not an unlinked inode, something is very wrong. */
1968+ if (VFS_I(next_ip)->i_nlink != 0) {
1969+ error = -EFSCORRUPTED;
1970+ goto rele;
1971+ }
1972+
1973+ next_ip->i_prev_unlinked = prev_agino;
1974+ trace_xfs_iunlink_reload_next(next_ip);
1975+rele:
1976+ ASSERT(!(VFS_I(next_ip)->i_state & I_DONTCACHE));
1977+ if (xfs_is_quotacheck_running(mp) && next_ip)
1978+ xfs_iflags_set(next_ip, XFS_IQUOTAUNCHECKED);
1979+ xfs_irele(next_ip);
1980+ return error;
1981+}
1982+
18981983 static int
18991984 xfs_iunlink_insert_inode(
19001985 struct xfs_trans *tp,
@@ -1926,6 +2011,8 @@ xfs_iunlink_insert_inode( · 25 unmodified lines
19262011 * inode.
19272012 */
19282013 error = xfs_iunlink_update_backref(pag, agino, next_agino);
2014+ if (error == -ENOLINK)
2015+ error = xfs_iunlink_reload_next(tp, agibp, agino, next_agino);
19292016 if (error)
19302017 return error;
19312018
@@ -1941,6 +2028,7 @@ xfs_iunlink_insert_inode( · 9 unmodified lines
19412028 }
19422029
19432030 /* Point the head of the list to point to this inode. */
2031+ ip->i_prev_unlinked = NULLAGINO;
19442032 return xfs_iunlink_update_bucket(tp, pag, agibp, bucket_index, agino);
19452033 }
19462034
@@ -2020,6 +2108,9 @@ xfs_iunlink_remove_inode( · 73 unmodified lines
20202108 */
20212109 error = xfs_iunlink_update_backref(pag, ip->i_prev_unlinked,
20222110 ip->i_next_unlinked);
2111+ if (error == -ENOLINK)
2112+ error = xfs_iunlink_reload_next(tp, agibp, ip->i_prev_unlinked,
2113+ ip->i_next_unlinked);
20232114 if (error)
20242115 return error;
20252116
@@ -2040,7 +2131,7 @@ xfs_iunlink_remove_inode( · 14 unmodified lines
20402131 }
20412132
20422133 ip->i_next_unlinked = NULLAGINO;
2043− ip->i_prev_unlinked = NULLAGINO;
2134+ ip->i_prev_unlinked = 0;
20442135 return error;
20452136 }
20462137
@@ -3529,3 +3620,117 @@ xfs_iunlock2_io_mmap( · 1482 unmodified lines
35293620 if (ip1 != ip2)
35303621 inode_unlock(VFS_I(ip1));
35313622 }
3623+
3624+/*
3625+ * Reload the incore inode list for this inode. Caller should ensure that
3626+ * the link count cannot change, either by taking ILOCK_SHARED or otherwise
3627+ * preventing other threads from executing.
3628+ */
3629+int
3630+xfs_inode_reload_unlinked_bucket(
3631+ struct xfs_trans *tp,
3632+ struct xfs_inode *ip)
3633+{
3634+ struct xfs_mount *mp = tp->t_mountp;
3635+ struct xfs_buf *agibp;
3636+ struct xfs_agi *agi;
3637+ struct xfs_perag *pag;
3638+ xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, ip->i_ino);
3639+ xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
3640+ xfs_agino_t prev_agino, next_agino;
3641+ unsigned int bucket;
3642+ bool foundit = false;
3643+ int error;
3644+
3645+ /* Grab the first inode in the list */
3646+ pag = xfs_perag_get(mp, agno);
3647+ error = xfs_ialloc_read_agi(pag, tp, &agibp);
3648+ xfs_perag_put(pag);
3649+ if (error)
3650+ return error;
3651+
3652+ /*
3653+ * We've taken ILOCK_SHARED and the AGI buffer lock to stabilize the
3654+ * incore unlinked list pointers for this inode. Check once more to
3655+ * see if we raced with anyone else to reload the unlinked list.
3656+ */
3657+ if (!xfs_inode_unlinked_incomplete(ip)) {
3658+ foundit = true;
3659+ goto out_agibp;
3660+ }
3661+
3662+ bucket = agino % XFS_AGI_UNLINKED_BUCKETS;
3663+ agi = agibp->b_addr;
3664+
3665+ trace_xfs_inode_reload_unlinked_bucket(ip);
3666+
3667+ xfs_info_ratelimited(mp,
3668+ "Found unrecovered unlinked inode 0x%x in AG 0x%x. Initiating list recovery.",
3669+ agino, agno);
3670+
3671+ prev_agino = NULLAGINO;
3672+ next_agino = be32_to_cpu(agi->agi_unlinked[bucket]);
3673+ while (next_agino != NULLAGINO) {
3674+ struct xfs_inode *next_ip = NULL;
3675+
3676+ /* Found this caller's inode, set its backlink. */
3677+ if (next_agino == agino) {
3678+ next_ip = ip;
3679+ next_ip->i_prev_unlinked = prev_agino;
3680+ foundit = true;
3681+ goto next_inode;
3682+ }
3683+
3684+ /* Try in-memory lookup first. */
3685+ next_ip = xfs_iunlink_lookup(pag, next_agino);
3686+ if (next_ip)
3687+ goto next_inode;
3688+
3689+ /* Inode not in memory, try reloading it. */
3690+ error = xfs_iunlink_reload_next(tp, agibp, prev_agino,
3691+ next_agino);
3692+ if (error)
3693+ break;
3694+
3695+ /* Grab the reloaded inode. */
3696+ next_ip = xfs_iunlink_lookup(pag, next_agino);
3697+ if (!next_ip) {
3698+ /* No incore inode at all? We reloaded it... */
3699+ ASSERT(next_ip != NULL);
3700+ error = -EFSCORRUPTED;
3701+ break;
3702+ }
3703+
3704+next_inode:
3705+ prev_agino = next_agino;
3706+ next_agino = next_ip->i_next_unlinked;
3707+ }
3708+
3709+out_agibp:
3710+ xfs_trans_brelse(tp, agibp);
3711+ /* Should have found this inode somewhere in the iunlinked bucket. */
3712+ if (!error && !foundit)
3713+ error = -EFSCORRUPTED;
3714+ return error;
3715+}
3716+
3717+/* Decide if this inode is missing its unlinked list and reload it. */
3718+int
3719+xfs_inode_reload_unlinked(
3720+ struct xfs_inode *ip)
3721+{
3722+ struct xfs_trans *tp;
3723+ int error;
3724+
3725+ error = xfs_trans_alloc_empty(ip->i_mount, &tp);
3726+ if (error)
3727+ return error;
3728+
3729+ xfs_ilock(ip, XFS_ILOCK_SHARED);
3730+ if (xfs_inode_unlinked_incomplete(ip))
3731+ error = xfs_inode_reload_unlinked_bucket(tp, ip);
3732+ xfs_iunlock(ip, XFS_ILOCK_SHARED);
3733+ xfs_trans_cancel(tp);
3734+
3735+ return error;
3736+}
fs/xfs/xfs_inode.h+32−2
@@ -68,8 +68,21 @@ typedef struct xfs_inode { · 67 unmodified lines
6868 uint64_t i_diflags2; /* XFS_DIFLAG2_... */
6969 struct timespec64 i_crtime; /* time created */
7070
71− /* unlinked list pointers */
71+ /*
72+ * Unlinked list pointers. These point to the next and previous inodes
73+ * in the AGI unlinked bucket list, respectively. These fields can
74+ * only be updated with the AGI locked.
75+ *
76+ * i_next_unlinked caches di_next_unlinked.
77+ */
7278 xfs_agino_t i_next_unlinked;
79+
80+ /*
81+ * If the inode is not on an unlinked list, this field is zero. If the
82+ * inode is the first element in an unlinked list, this field is
83+ * NULLAGINO. Otherwise, i_prev_unlinked points to the previous inode
84+ * in the unlinked list.
85+ */
7386 xfs_agino_t i_prev_unlinked;
7487
7588 /* VFS inode */
@@ -81,6 +94,11 @@ typedef struct xfs_inode { · 5 unmodified lines
8194 struct list_head i_ioend_list;
8295 } xfs_inode_t;
8396
97+static inline bool xfs_inode_on_unlinked_list(const struct xfs_inode *ip)
98+{
99+ return ip->i_prev_unlinked != 0;
100+}
101+
84102 static inline bool xfs_inode_has_attr_fork(struct xfs_inode *ip)
85103 {
86104 return ip->i_forkoff > 0;
@@ -326,6 +344,9 @@ static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip) · 239 unmodified lines
326344 */
327345 #define XFS_INACTIVATING (1 << 13)
328346
347+/* Quotacheck is running but inode has not been added to quota counts. */
348+#define XFS_IQUOTAUNCHECKED (1 << 14)
349+
329350 /* All inode state flags related to inode reclaim. */
330351 #define XFS_ALL_IRECLAIM_FLAGS (XFS_IRECLAIMABLE | \
331352 XFS_IRECLAIM | \
@@ -340,7 +361,7 @@ static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip) · 8 unmodified lines
340361 #define XFS_IRECLAIM_RESET_FLAGS \
341362 (XFS_IRECLAIMABLE | XFS_IRECLAIM | \
342363 XFS_IDIRTY_RELEASE | XFS_ITRUNCATED | XFS_NEED_INACTIVE | \
343− XFS_INACTIVATING)
364+ XFS_INACTIVATING | XFS_IQUOTAUNCHECKED)
344365
345366 /*
346367 * Flags for inode locking.
@@ -575,4 +596,13 @@ void xfs_end_io(struct work_struct *work); · 228 unmodified lines
575596 int xfs_ilock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2);
576597 void xfs_iunlock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2);
577598
599+static inline bool
600+xfs_inode_unlinked_incomplete(
601+ struct xfs_inode *ip)
602+{
603+ return VFS_I(ip)->i_nlink == 0 && !xfs_inode_on_unlinked_list(ip);
604+}
605+int xfs_inode_reload_unlinked_bucket(struct xfs_trans *tp, struct xfs_inode *ip);
606+int xfs_inode_reload_unlinked(struct xfs_inode *ip);
607+
578608 #endif /* __XFS_INODE_H__ */
fs/xfs/xfs_itable.c+11−0
@@ -80,6 +80,17 @@ xfs_bulkstat_one_int( · 79 unmodified lines
8080 if (error)
8181 goto out;
8282
83+ /* Reload the incore unlinked list to avoid failure in inodegc. */
84+ if (xfs_inode_unlinked_incomplete(ip)) {
85+ error = xfs_inode_reload_unlinked_bucket(tp, ip);
86+ if (error) {
87+ xfs_iunlock(ip, XFS_ILOCK_SHARED);
88+ xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
89+ xfs_irele(ip);
90+ return error;
91+ }
92+ }
93+
8394 ASSERT(ip != NULL);
8495 ASSERT(ip->i_imap.im_blkno != 0);
8596 inode = VFS_I(ip);
fs/xfs/xfs_log.c+0−17
@@ -715,15 +715,7 @@ xfs_log_mount( · 714 unmodified lines
715715 * just worked.
716716 */
717717 if (!xfs_has_norecovery(mp)) {
718− /*
719− * log recovery ignores readonly state and so we need to clear
720− * mount-based read only state so it can write to disk.
721− */
722− bool readonly = test_and_clear_bit(XFS_OPSTATE_READONLY,
723− &mp->m_opstate);
724718 error = xlog_recover(log);
725− if (readonly)
726− set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
727719 if (error) {
728720 xfs_warn(mp, "log mount/recovery failed: error %d",
729721 error);
@@ -772,7 +764,6 @@ xfs_log_mount_finish( · 42 unmodified lines
772764 struct xfs_mount *mp)
773765 {
774766 struct xlog *log = mp->m_log;
775− bool readonly;
776767 int error = 0;
777768
778769 if (xfs_has_norecovery(mp)) {
@@ -780,12 +771,6 @@ xfs_log_mount_finish( · 1 unmodified line
780771 return 0;
781772 }
782773
783− /*
784− * log recovery ignores readonly state and so we need to clear
785− * mount-based read only state so it can write to disk.
786− */
787− readonly = test_and_clear_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
788−
789774 /*
790775 * During the second phase of log recovery, we need iget and
791776 * iput to behave like they do for an active filesystem.
@@ -835,8 +820,6 @@ xfs_log_mount_finish( · 43 unmodified lines
835820 xfs_buftarg_drain(mp->m_ddev_targp);
836821
837822 clear_bit(XLOG_RECOVERY_NEEDED, &log->l_opstate);
838− if (readonly)
839− set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
840823
841824 /* Make sure the log is dead if we're returning failure. */
842825 ASSERT(!error || xlog_is_shutdown(log));
fs/xfs/xfs_log_cil.c+16−36
@@ -124,7 +124,7 @@ xlog_cil_push_pcp_aggregate( · 123 unmodified lines
124124 struct xlog_cil_pcp *cilpcp;
125125 int cpu;
126126
127− for_each_online_cpu(cpu) {
127+ for_each_cpu(cpu, &ctx->cil_pcpmask) {
128128 cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
129129
130130 ctx->ticket->t_curr_res += cilpcp->space_reserved;
@@ -165,7 +165,13 @@ xlog_cil_insert_pcp_aggregate( · 34 unmodified lines
165165 if (!test_and_clear_bit(XLOG_CIL_PCP_SPACE, &cil->xc_flags))
166166 return;
167167
168− for_each_online_cpu(cpu) {
168+ /*
169+ * We can race with other cpus setting cil_pcpmask. However, we've
170+ * atomically cleared PCP_SPACE which forces other threads to add to
171+ * the global space used count. cil_pcpmask is a superset of cilpcp
172+ * structures that could have a nonzero space_used.
173+ */
174+ for_each_cpu(cpu, &ctx->cil_pcpmask) {
169175 int old, prev;
170176
171177 cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
@@ -554,6 +560,7 @@ xlog_cil_insert_items( · 382 unmodified lines
554560 int iovhdr_res = 0, split_res = 0, ctx_res = 0;
555561 int space_used;
556562 int order;
563+ unsigned int cpu_nr;
557564 struct xlog_cil_pcp *cilpcp;
558565
559566 ASSERT(tp);
@@ -577,7 +584,12 @@ xlog_cil_insert_items( · 17 unmodified lines
577584 * can't be scheduled away between split sample/update operations that
578585 * are done without outside locking to serialise them.
579586 */
580− cilpcp = get_cpu_ptr(cil->xc_pcp);
587+ cpu_nr = get_cpu();
588+ cilpcp = this_cpu_ptr(cil->xc_pcp);
589+
590+ /* Tell the future push that there was work added by this CPU. */
591+ if (!cpumask_test_cpu(cpu_nr, &ctx->cil_pcpmask))
592+ cpumask_test_and_set_cpu(cpu_nr, &ctx->cil_pcpmask);
581593
582594 /*
583595 * We need to take the CIL checkpoint unit reservation on the first
@@ -663,7 +675,7 @@ xlog_cil_insert_items( · 79 unmodified lines
663675 continue;
664676 list_add_tail(&lip->li_cil, &cilpcp->log_items);
665677 }
666− put_cpu_ptr(cilpcp);
678+ put_cpu();
667679
668680 /*
669681 * If we've overrun the reservation, dump the tx details before we move
@@ -1790,38 +1802,6 @@ out_shutdown: · 1120 unmodified lines
17901802 return 0;
17911803 }
17921804
1793−/*
1794− * Move dead percpu state to the relevant CIL context structures.
1795− *
1796− * We have to lock the CIL context here to ensure that nothing is modifying
1797− * the percpu state, either addition or removal. Both of these are done under
1798− * the CIL context lock, so grabbing that exclusively here will ensure we can
1799− * safely drain the cilpcp for the CPU that is dying.
1800− */
1801−void
1802−xlog_cil_pcp_dead(
1803− struct xlog *log,
1804− unsigned int cpu)
1805−{
1806− struct xfs_cil *cil = log->l_cilp;
1807− struct xlog_cil_pcp *cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
1808− struct xfs_cil_ctx *ctx;
1809−
1810− down_write(&cil->xc_ctx_lock);
1811− ctx = cil->xc_ctx;
1812− if (ctx->ticket)
1813− ctx->ticket->t_curr_res += cilpcp->space_reserved;
1814− cilpcp->space_reserved = 0;
1815−
1816− if (!list_empty(&cilpcp->log_items))
1817− list_splice_init(&cilpcp->log_items, &ctx->log_items);
1818− if (!list_empty(&cilpcp->busy_extents))
1819− list_splice_init(&cilpcp->busy_extents, &ctx->busy_extents);
1820− atomic_add(cilpcp->space_used, &ctx->space_used);
1821− cilpcp->space_used = 0;
1822− up_write(&cil->xc_ctx_lock);
1823−}
1824−
18251805 /*
18261806 * Perform initial CIL structure initialisation.
18271807 */
fs/xfs/xfs_log_priv.h+6−8
@@ -231,6 +231,12 @@ struct xfs_cil_ctx { · 230 unmodified lines
231231 struct work_struct discard_endio_work;
232232 struct work_struct push_work;
233233 atomic_t order_id;
234+
235+ /*
236+ * CPUs that could have added items to the percpu CIL data. Access is
237+ * coordinated with xc_ctx_lock.
238+ */
239+ struct cpumask cil_pcpmask;
234240 };
235241
236242 /*
@@ -278,9 +284,6 @@ struct xfs_cil { · 41 unmodified lines
278284 wait_queue_head_t xc_push_wait; /* background push throttle */
279285
280286 void __percpu *xc_pcp; /* percpu CIL structures */
281−#ifdef CONFIG_HOTPLUG_CPU
282− struct list_head xc_pcp_list;
283−#endif
284287 } ____cacheline_aligned_in_smp;
285288
286289 /* xc_flags bit values */
@@ -705,9 +708,4 @@ xlog_kvmalloc( · 418 unmodified lines
705708 return p;
706709 }
707710
708−/*
709− * CIL CPU dead notifier
710− */
711−void xlog_cil_pcp_dead(struct xlog *log, unsigned int cpu);
712−
713711 #endif /* __XFS_LOG_PRIV_H__ */
fs/xfs/xfs_log_recover.c+2−2
@@ -329,7 +329,7 @@ xlog_find_verify_cycle( · 328 unmodified lines
329329 * try a smaller size. We need to be able to read at least
330330 * a log sector, or we're out of luck.
331331 */
332− bufblks = 1 << ffs(nbblks);
332+ bufblks = roundup_pow_of_two(nbblks);
333333 while (bufblks > log->l_logBBsize)
334334 bufblks >>= 1;
335335 while (!(buffer = xlog_alloc_buffer(log, bufblks))) {
@@ -1528,7 +1528,7 @@ xlog_write_log_records( · 1192 unmodified lines
15281528 * a smaller size. We need to be able to write at least a
15291529 * log sector, or we're out of luck.
15301530 */
1531− bufblks = 1 << ffs(blocks);
1531+ bufblks = roundup_pow_of_two(blocks);
15321532 while (bufblks > log->l_logBBsize)
15331533 bufblks >>= 1;
15341534 while (!(buffer = xlog_alloc_buffer(log, bufblks))) {
fs/xfs/xfs_mount.h+13−4
@@ -60,6 +60,7 @@ struct xfs_error_cfg { · 59 unmodified lines
6060 * Per-cpu deferred inode inactivation GC lists.
6161 */
6262 struct xfs_inodegc {
63+ struct xfs_mount *mp;
6364 struct llist_head list;
6465 struct delayed_work work;
6566 int error;
@@ -67,9 +68,7 @@ struct xfs_inodegc { · 1 unmodified line
6768 /* approximate count of inodes in the list */
6869 unsigned int items;
6970 unsigned int shrinker_hits;
70−#if defined(DEBUG) || defined(XFS_WARN)
7171 unsigned int cpu;
72−#endif
7372 };
7473
7574 /*
@@ -98,7 +97,6 @@ typedef struct xfs_mount { · 22 unmodified lines
9897 xfs_buftarg_t *m_ddev_targp; /* saves taking the address */
9998 xfs_buftarg_t *m_logdev_targp;/* ptr to log device */
10099 xfs_buftarg_t *m_rtdev_targp; /* ptr to rt device */
101− struct list_head m_mount_list; /* global mount list */
102100 void __percpu *m_inodegc; /* percpu inodegc structures */
103101
104102 /*
@@ -249,6 +247,9 @@ typedef struct xfs_mount { · 144 unmodified lines
249247 unsigned int *m_errortag;
250248 struct xfs_kobj m_errortag_kobj;
251249 #endif
250+
251+ /* cpus that have inodes queued for inactivation */
252+ struct cpumask m_inodegc_cpumask;
252253 } xfs_mount_t;
253254
254255 #define M_IGEO(mp) (&(mp)->m_ino_geo)
@@ -404,6 +405,8 @@ __XFS_HAS_FEAT(nouuid, NOUUID) · 149 unmodified lines
404405 #define XFS_OPSTATE_WARNED_SHRINK 8
405406 /* Kernel has logged a warning about logged xattr updates being used. */
406407 #define XFS_OPSTATE_WARNED_LARP 9
408+/* Mount time quotacheck is running */
409+#define XFS_OPSTATE_QUOTACHECK_RUNNING 10
407410
408411 #define __XFS_IS_OPSTATE(name, NAME) \
409412 static inline bool xfs_is_ ## name (struct xfs_mount *mp) \
@@ -426,6 +429,11 @@ __XFS_IS_OPSTATE(inode32, INODE32) · 16 unmodified lines
426429 __XFS_IS_OPSTATE(readonly, READONLY)
427430 __XFS_IS_OPSTATE(inodegc_enabled, INODEGC_ENABLED)
428431 __XFS_IS_OPSTATE(blockgc_enabled, BLOCKGC_ENABLED)
432+#ifdef CONFIG_XFS_QUOTA
433+__XFS_IS_OPSTATE(quotacheck_running, QUOTACHECK_RUNNING)
434+#else
435+# define xfs_is_quotacheck_running(mp) (false)
436+#endif
429437
430438 static inline bool
431439 xfs_should_warn(struct xfs_mount *mp, long nr)
@@ -443,7 +451,8 @@ xfs_should_warn(struct xfs_mount *mp, long nr) · 11 unmodified lines
443451 { (1UL << XFS_OPSTATE_BLOCKGC_ENABLED), "blockgc" }, \
444452 { (1UL << XFS_OPSTATE_WARNED_SCRUB), "wscrub" }, \
445453 { (1UL << XFS_OPSTATE_WARNED_SHRINK), "wshrink" }, \
446− { (1UL << XFS_OPSTATE_WARNED_LARP), "wlarp" }
454+ { (1UL << XFS_OPSTATE_WARNED_LARP), "wlarp" }, \
455+ { (1UL << XFS_OPSTATE_QUOTACHECK_RUNNING), "quotacheck" }
447456
448457 /*
449458 * Max and min values for mount-option defined I/O
fs/xfs/xfs_qm.c+16−0
@@ -1160,6 +1160,19 @@ xfs_qm_dqusage_adjust( · 1159 unmodified lines
11601160 if (error)
11611161 return error;
11621162
1163+ /*
1164+ * Reload the incore unlinked list to avoid failure in inodegc.
1165+ * Use an unlocked check here because unrecovered unlinked inodes
1166+ * should be somewhat rare.
1167+ */
1168+ if (xfs_inode_unlinked_incomplete(ip)) {
1169+ error = xfs_inode_reload_unlinked(ip);
1170+ if (error) {
1171+ xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
1172+ goto error0;
1173+ }
1174+ }
1175+
11631176 ASSERT(ip->i_delayed_blks == 0);
11641177
11651178 if (XFS_IS_REALTIME_INODE(ip)) {
@@ -1173,6 +1186,7 @@ xfs_qm_dqusage_adjust( · 7 unmodified lines
11731186 }
11741187
11751188 nblks = (xfs_qcnt_t)ip->i_nblocks - rtblks;
1189+ xfs_iflags_clear(ip, XFS_IQUOTAUNCHECKED);
11761190
11771191 /*
11781192 * Add the (disk blocks and inode) resources occupied by this
@@ -1319,8 +1333,10 @@ xfs_qm_quotacheck( · 140 unmodified lines
13191333 flags |= XFS_PQUOTA_CHKD;
13201334 }
13211335
1336+ xfs_set_quotacheck_running(mp);
13221337 error = xfs_iwalk_threaded(mp, 0, 0, xfs_qm_dqusage_adjust, 0, true,
13231338 NULL);
1339+ xfs_clear_quotacheck_running(mp);
13241340
13251341 /*
13261342 * On error, the inode walk may have partially populated the dquot
fs/xfs/xfs_refcount_item.c+4−2
@@ -477,6 +477,7 @@ xfs_cui_item_recover( · 476 unmodified lines
477477 struct xfs_log_item *lip,
478478 struct list_head *capture_list)
479479 {
480+ struct xfs_trans_res resv;
480481 struct xfs_cui_log_item *cuip = CUI_ITEM(lip);
481482 struct xfs_cud_log_item *cudp;
482483 struct xfs_trans *tp;
@@ -514,8 +515,9 @@ xfs_cui_item_recover( · 31 unmodified lines
514515 * doesn't fit. We need to reserve enough blocks to handle a
515516 * full btree split on either end of the refcount range.
516517 */
517− error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
518− mp->m_refc_maxlevels * 2, 0, XFS_TRANS_RESERVE, &tp);
518+ resv = xlog_recover_resv(&M_RES(mp)->tr_itruncate);
519+ error = xfs_trans_alloc(mp, &resv, mp->m_refc_maxlevels * 2, 0,
520+ XFS_TRANS_RESERVE, &tp);
519521 if (error)
520522 return error;
521523
fs/xfs/xfs_rmap_item.c+4−2
@@ -507,6 +507,7 @@ xfs_rui_item_recover( · 506 unmodified lines
507507 struct xfs_log_item *lip,
508508 struct list_head *capture_list)
509509 {
510+ struct xfs_trans_res resv;
510511 struct xfs_rui_log_item *ruip = RUI_ITEM(lip);
511512 struct xfs_rud_log_item *rudp;
512513 struct xfs_trans *tp;
@@ -530,8 +531,9 @@ xfs_rui_item_recover( · 17 unmodified lines
530531 }
531532 }
532533
533− error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
534− mp->m_rmap_maxlevels, 0, XFS_TRANS_RESERVE, &tp);
534+ resv = xlog_recover_resv(&M_RES(mp)->tr_itruncate);
535+ error = xfs_trans_alloc(mp, &resv, mp->m_rmap_maxlevels, 0,
536+ XFS_TRANS_RESERVE, &tp);
535537 if (error)
536538 return error;
537539 rudp = xfs_trans_get_rud(tp, ruip);
fs/xfs/xfs_super.c+2−84
@@ -56,28 +56,6 @@ static struct kset *xfs_kset; /* top-level xfs sysfs dir */ · 55 unmodified lines
5656 static struct xfs_kobj xfs_dbg_kobj; /* global debug sysfs attrs */
5757 #endif
5858
59−#ifdef CONFIG_HOTPLUG_CPU
60−static LIST_HEAD(xfs_mount_list);
61−static DEFINE_SPINLOCK(xfs_mount_list_lock);
62−
63−static inline void xfs_mount_list_add(struct xfs_mount *mp)
64−{
65− spin_lock(&xfs_mount_list_lock);
66− list_add(&mp->m_mount_list, &xfs_mount_list);
67− spin_unlock(&xfs_mount_list_lock);
68−}
69−
70−static inline void xfs_mount_list_del(struct xfs_mount *mp)
71−{
72− spin_lock(&xfs_mount_list_lock);
73− list_del(&mp->m_mount_list);
74− spin_unlock(&xfs_mount_list_lock);
75−}
76−#else /* !CONFIG_HOTPLUG_CPU */
77−static inline void xfs_mount_list_add(struct xfs_mount *mp) {}
78−static inline void xfs_mount_list_del(struct xfs_mount *mp) {}
79−#endif
80−
8159 enum xfs_dax_mode {
8260 XFS_DAX_INODE = 0,
8361 XFS_DAX_ALWAYS = 1,
@@ -1135,9 +1113,8 @@ xfs_inodegc_init_percpu( · 1051 unmodified lines
11351113
11361114 for_each_possible_cpu(cpu) {
11371115 gc = per_cpu_ptr(mp->m_inodegc, cpu);
1138−#if defined(DEBUG) || defined(XFS_WARN)
11391116 gc->cpu = cpu;
1140−#endif
1117+ gc->mp = mp;
11411118 init_llist_head(&gc->list);
11421119 gc->items = 0;
11431120 gc->error = 0;
@@ -1168,7 +1145,6 @@ xfs_fs_put_super( · 24 unmodified lines
11681145 xfs_freesb(mp);
11691146 xchk_mount_stats_free(mp);
11701147 free_percpu(mp->m_stats.xs_stats);
1171− xfs_mount_list_del(mp);
11721148 xfs_inodegc_free_percpu(mp);
11731149 xfs_destroy_percpu_counters(mp);
11741150 xfs_destroy_mount_workqueues(mp);
@@ -1577,13 +1553,6 @@ xfs_fs_fill_super( · 402 unmodified lines
15771553 if (error)
15781554 goto out_destroy_counters;
15791555
1580− /*
1581− * All percpu data structures requiring cleanup when a cpu goes offline
1582− * must be allocated before adding this @mp to the cpu-dead handler's
1583− * mount list.
1584− */
1585− xfs_mount_list_add(mp);
1586−
15871556 /* Allocate stats memory before we do operations that might use it */
15881557 mp->m_stats.xs_stats = alloc_percpu(struct xfsstats);
15891558 if (!mp->m_stats.xs_stats) {
@@ -1781,7 +1750,6 @@ xfs_fs_fill_super( · 191 unmodified lines
17811750 out_free_stats:
17821751 free_percpu(mp->m_stats.xs_stats);
17831752 out_destroy_inodegc:
1784− xfs_mount_list_del(mp);
17851753 xfs_inodegc_free_percpu(mp);
17861754 out_destroy_counters:
17871755 xfs_destroy_percpu_counters(mp);
@@ -2326,49 +2294,6 @@ xfs_destroy_workqueues(void) · 538 unmodified lines
23262294 destroy_workqueue(xfs_alloc_wq);
23272295 }
23282296
2329−#ifdef CONFIG_HOTPLUG_CPU
2330−static int
2331−xfs_cpu_dead(
2332− unsigned int cpu)
2333−{
2334− struct xfs_mount *mp, *n;
2335−
2336− spin_lock(&xfs_mount_list_lock);
2337− list_for_each_entry_safe(mp, n, &xfs_mount_list, m_mount_list) {
2338− spin_unlock(&xfs_mount_list_lock);
2339− xfs_inodegc_cpu_dead(mp, cpu);
2340− xlog_cil_pcp_dead(mp->m_log, cpu);
2341− spin_lock(&xfs_mount_list_lock);
2342− }
2343− spin_unlock(&xfs_mount_list_lock);
2344− return 0;
2345−}
2346−
2347−static int __init
2348−xfs_cpu_hotplug_init(void)
2349−{
2350− int error;
2351−
2352− error = cpuhp_setup_state_nocalls(CPUHP_XFS_DEAD, "xfs:dead", NULL,
2353− xfs_cpu_dead);
2354− if (error < 0)
2355− xfs_alert(NULL,
2356−"Failed to initialise CPU hotplug, error %d. XFS is non-functional.",
2357− error);
2358− return error;
2359−}
2360−
2361−static void
2362−xfs_cpu_hotplug_destroy(void)
2363−{
2364− cpuhp_remove_state_nocalls(CPUHP_XFS_DEAD);
2365−}
2366−
2367−#else /* !CONFIG_HOTPLUG_CPU */
2368−static inline int xfs_cpu_hotplug_init(void) { return 0; }
2369−static inline void xfs_cpu_hotplug_destroy(void) {}
2370−#endif
2371−
23722297 STATIC int __init
23732298 init_xfs_fs(void)
23742299 {
@@ -2385,13 +2310,9 @@ init_xfs_fs(void) · 10 unmodified lines
23852310
23862311 xfs_dir_startup();
23872312
2388− error = xfs_cpu_hotplug_init();
2389− if (error)
2390− goto out;
2391−
23922313 error = xfs_init_caches();
23932314 if (error)
2394− goto out_destroy_hp;
2315+ goto out;
23952316
23962317 error = xfs_init_workqueues();
23972318 if (error)
@@ -2475,8 +2396,6 @@ init_xfs_fs(void) · 77 unmodified lines
24752396 xfs_destroy_workqueues();
24762397 out_destroy_caches:
24772398 xfs_destroy_caches();
2478− out_destroy_hp:
2479− xfs_cpu_hotplug_destroy();
24802399 out:
24812400 return error;
24822401 }
@@ -2500,7 +2419,6 @@ exit_xfs_fs(void) · 17 unmodified lines
25002419 xfs_destroy_workqueues();
25012420 xfs_destroy_caches();
25022421 xfs_uuid_table_free();
2503− xfs_cpu_hotplug_destroy();
25042422 }
25052423
25062424 module_init(init_xfs_fs);
fs/xfs/xfs_trace.h+45−0
@@ -3824,6 +3824,51 @@ TRACE_EVENT(xfs_iunlink_update_dinode, · 3823 unmodified lines
38243824 __entry->new_ptr)
38253825 );
38263826
3827+TRACE_EVENT(xfs_iunlink_reload_next,
3828+ TP_PROTO(struct xfs_inode *ip),
3829+ TP_ARGS(ip),
3830+ TP_STRUCT__entry(
3831+ __field(dev_t, dev)
3832+ __field(xfs_agnumber_t, agno)
3833+ __field(xfs_agino_t, agino)
3834+ __field(xfs_agino_t, prev_agino)
3835+ __field(xfs_agino_t, next_agino)
3836+ ),
3837+ TP_fast_assign(
3838+ __entry->dev = ip->i_mount->m_super->s_dev;
3839+ __entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3840+ __entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3841+ __entry->prev_agino = ip->i_prev_unlinked;
3842+ __entry->next_agino = ip->i_next_unlinked;
3843+ ),
3844+ TP_printk("dev %d:%d agno 0x%x agino 0x%x prev_unlinked 0x%x next_unlinked 0x%x",
3845+ MAJOR(__entry->dev), MINOR(__entry->dev),
3846+ __entry->agno,
3847+ __entry->agino,
3848+ __entry->prev_agino,
3849+ __entry->next_agino)
3850+);
3851+
3852+TRACE_EVENT(xfs_inode_reload_unlinked_bucket,
3853+ TP_PROTO(struct xfs_inode *ip),
3854+ TP_ARGS(ip),
3855+ TP_STRUCT__entry(
3856+ __field(dev_t, dev)
3857+ __field(xfs_agnumber_t, agno)
3858+ __field(xfs_agino_t, agino)
3859+ ),
3860+ TP_fast_assign(
3861+ __entry->dev = ip->i_mount->m_super->s_dev;
3862+ __entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3863+ __entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3864+ ),
3865+ TP_printk("dev %d:%d agno 0x%x agino 0x%x bucket %u",
3866+ MAJOR(__entry->dev), MINOR(__entry->dev),
3867+ __entry->agno,
3868+ __entry->agino,
3869+ __entry->agino % XFS_AGI_UNLINKED_BUCKETS)
3870+);
3871+
38273872 DECLARE_EVENT_CLASS(xfs_ag_inode_class,
38283873 TP_PROTO(struct xfs_inode *ip),
38293874 TP_ARGS(ip),
fs/xfs/xfs_xattr.c+11−0
@@ -46,6 +46,17 @@ xfs_attr_grab_log_assist( · 45 unmodified lines
4646 if (xfs_sb_version_haslogxattrs(&mp->m_sb))
4747 return 0;
4848
49+ /*
50+ * Check if the filesystem featureset is new enough to set this log
51+ * incompat feature bit. Strictly speaking, the minimum requirement is
52+ * a V5 filesystem for the superblock field, but we'll require rmap
53+ * or reflink to avoid having to deal with really old kernels.
54+ */
55+ if (!xfs_has_reflink(mp) && !xfs_has_rmapbt(mp)) {
56+ error = -EOPNOTSUPP;
57+ goto drop_incompat;
58+ }
59+
4960 /* Enable log-assisted xattrs. */
5061 error = xfs_add_incompat_log_feature(mp,
5162 XFS_SB_FEAT_INCOMPAT_LOG_XATTRS);
include/asm-generic/hugetlb.h+1−1
@@ -76,7 +76,7 @@ static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, · 75 unmodified lines
7676
7777 #ifndef __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
7878 static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
79− pte_t *ptep, pte_t pte)
79+ pte_t *ptep, pte_t pte, unsigned long sz)
8080 {
8181 set_pte_at(mm, addr, ptep, pte);
8282 }
include/asm-generic/vmlinux.lds.h+0−7
@@ -138,13 +138,6 @@ · 137 unmodified lines
138138 * are handled as text/data or they can be discarded (which
139139 * often happens at runtime)
140140 */
141−#ifdef CONFIG_HOTPLUG_CPU
142−#define CPU_KEEP(sec) *(.cpu##sec)
143−#define CPU_DISCARD(sec)
144−#else
145−#define CPU_KEEP(sec)
146−#define CPU_DISCARD(sec) *(.cpu##sec)
147−#endif
148141
149142 #if defined(CONFIG_MEMORY_HOTPLUG)
150143 #define MEM_KEEP(sec) *(.mem##sec)
include/linux/aer.h+2−0
@@ -42,11 +42,13 @@ struct aer_capability_regs { · 41 unmodified lines
4242
4343 #if defined(CONFIG_PCIEAER)
4444 int pci_aer_clear_nonfatal_status(struct pci_dev *dev);
45+int pcie_aer_is_native(struct pci_dev *dev);
4546 #else
4647 static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
4748 {
4849 return -EINVAL;
4950 }
51+static inline int pcie_aer_is_native(struct pci_dev *dev) { return 0; }
5052 #endif
5153
5254 void cper_print_aer(struct pci_dev *dev, int aer_severity,
include/linux/arm-smccc.h+2−0
@@ -67,6 +67,8 @@ · 66 unmodified lines
6767 #define ARM_SMCCC_VERSION_1_3 0x10003
6868
6969 #define ARM_SMCCC_1_3_SVE_HINT 0x10000
70+#define ARM_SMCCC_CALL_HINTS ARM_SMCCC_1_3_SVE_HINT
71+
7072
7173 #define ARM_SMCCC_VERSION_FUNC_ID \
7274 ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
include/linux/atomic/atomic-arch-fallback.h+1−9
@@ -459,8 +459,6 @@ raw_atomic_read_acquire(const atomic_t *v) · 458 unmodified lines
459459 {
460460 #if defined(arch_atomic_read_acquire)
461461 return arch_atomic_read_acquire(v);
462−#elif defined(arch_atomic_read)
463− return arch_atomic_read(v);
464462 #else
465463 int ret;
466464
@@ -508,8 +506,6 @@ raw_atomic_set_release(atomic_t *v, int i) · 41 unmodified lines
508506 {
509507 #if defined(arch_atomic_set_release)
510508 arch_atomic_set_release(v, i);
511−#elif defined(arch_atomic_set)
512− arch_atomic_set(v, i);
513509 #else
514510 if (__native_word(atomic_t)) {
515511 smp_store_release(&(v)->counter, i);
@@ -2575,8 +2571,6 @@ raw_atomic64_read_acquire(const atomic64_t *v) · 2059 unmodified lines
25752571 {
25762572 #if defined(arch_atomic64_read_acquire)
25772573 return arch_atomic64_read_acquire(v);
2578−#elif defined(arch_atomic64_read)
2579− return arch_atomic64_read(v);
25802574 #else
25812575 s64 ret;
25822576
@@ -2624,8 +2618,6 @@ raw_atomic64_set_release(atomic64_t *v, s64 i) · 41 unmodified lines
26242618 {
26252619 #if defined(arch_atomic64_set_release)
26262620 arch_atomic64_set_release(v, i);
2627−#elif defined(arch_atomic64_set)
2628− arch_atomic64_set(v, i);
26292621 #else
26302622 if (__native_word(atomic64_t)) {
26312623 smp_store_release(&(v)->counter, i);
@@ -4657,4 +4649,4 @@ raw_atomic64_dec_if_positive(atomic64_t *v) · 2025 unmodified lines
46574649 }
46584650
46594651 #endif /* _LINUX_ATOMIC_FALLBACK_H */
4660−// 202b45c7db600ce36198eb1f1fc2c2d5268ace2d
4652+// 2fdd6702823fa842f9cea57a002e6e4476ae780c
include/linux/bpf.h+1−1
@@ -1318,7 +1318,7 @@ static inline int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, · 1317 unmodified lines
13181318 static inline struct bpf_trampoline *bpf_trampoline_get(u64 key,
13191319 struct bpf_attach_target_info *tgt_info)
13201320 {
1321− return ERR_PTR(-EOPNOTSUPP);
1321+ return NULL;
13221322 }
13231323 static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {}
13241324 #define DEFINE_BPF_DISPATCHER(name)
include/linux/ceph/ceph_fs.h+11−13
@@ -467,19 +467,17 @@ union ceph_mds_request_args { · 466 unmodified lines
467467 } __attribute__ ((packed));
468468
469469 union ceph_mds_request_args_ext {
470− union {
471− union ceph_mds_request_args old;
472− struct {
473− __le32 mode;
474− __le32 uid;
475− __le32 gid;
476− struct ceph_timespec mtime;
477− struct ceph_timespec atime;
478− __le64 size, old_size; /* old_size needed by truncate */
479− __le32 mask; /* CEPH_SETATTR_* */
480− struct ceph_timespec btime;
481− } __attribute__ ((packed)) setattr_ext;
482− };
470+ union ceph_mds_request_args old;
471+ struct {
472+ __le32 mode;
473+ __le32 uid;
474+ __le32 gid;
475+ struct ceph_timespec mtime;
476+ struct ceph_timespec atime;
477+ __le64 size, old_size; /* old_size needed by truncate */
478+ __le32 mask; /* CEPH_SETATTR_* */
479+ struct ceph_timespec btime;
480+ } __attribute__ ((packed)) setattr_ext;
483481 };
484482
485483 #define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */
include/linux/cpuhotplug.h+0−1
@@ -90,7 +90,6 @@ enum cpuhp_state { · 89 unmodified lines
9090 CPUHP_FS_BUFF_DEAD,
9191 CPUHP_PRINTK_DEAD,
9292 CPUHP_MM_MEMCQ_DEAD,
93− CPUHP_XFS_DEAD,
9493 CPUHP_PERCPU_CNT_DEAD,
9594 CPUHP_RADIX_DEAD,
9695 CPUHP_PAGE_ALLOC,
include/linux/hugetlb.h+4−2
@@ -984,7 +984,9 @@ static inline void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, · 983 unmodified lines
984984 unsigned long addr, pte_t *ptep,
985985 pte_t old_pte, pte_t pte)
986986 {
987− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
987+ unsigned long psize = huge_page_size(hstate_vma(vma));
988+
989+ set_huge_pte_at(vma->vm_mm, addr, ptep, pte, psize);
988990 }
989991 #endif
990992
@@ -1173,7 +1175,7 @@ static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma, · 182 unmodified lines
11731175 }
11741176
11751177 static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
1176− pte_t *ptep, pte_t pte)
1178+ pte_t *ptep, pte_t pte, unsigned long sz)
11771179 {
11781180 }
11791181
include/linux/interrupt.h+5−1
@@ -569,8 +569,12 @@ enum · 568 unmodified lines
569569 * 2) rcu_report_dead() reports the final quiescent states.
570570 *
571571 * _ IRQ_POLL: irq_poll_cpu_dead() migrates the queue
572+ *
573+ * _ (HR)TIMER_SOFTIRQ: (hr)timers_dead_cpu() migrates the queue
572574 */
573−#define SOFTIRQ_HOTPLUG_SAFE_MASK (BIT(RCU_SOFTIRQ) | BIT(IRQ_POLL_SOFTIRQ))
575+#define SOFTIRQ_HOTPLUG_SAFE_MASK (BIT(TIMER_SOFTIRQ) | BIT(IRQ_POLL_SOFTIRQ) |\
576+ BIT(HRTIMER_SOFTIRQ) | BIT(RCU_SOFTIRQ))
577+
574578
575579 /* map softirq index to softirq name. update 'softirq_to_name' in
576580 * kernel/softirq.c when adding a new softirq.
include/linux/kasan.h+1−1
@@ -54,7 +54,7 @@ extern p4d_t kasan_early_shadow_p4d[MAX_PTRS_PER_P4D]; · 53 unmodified lines
5454 int kasan_populate_early_shadow(const void *shadow_start,
5555 const void *shadow_end);
5656
57−#ifndef __HAVE_ARCH_SHADOW_MAP
57+#ifndef kasan_mem_to_shadow
5858 static inline void *kasan_mem_to_shadow(const void *addr)
5959 {
6060 return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT)
include/linux/libata.h+7−3
@@ -192,6 +192,7 @@ enum { · 191 unmodified lines
192192 ATA_PFLAG_UNLOADING = (1 << 9), /* driver is being unloaded */
193193 ATA_PFLAG_UNLOADED = (1 << 10), /* driver is unloaded */
194194
195+ ATA_PFLAG_RESUMING = (1 << 16), /* port is being resumed */
195196 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
196197 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
197198 ATA_PFLAG_INIT_GTM_VALID = (1 << 19), /* initial gtm data valid */
@@ -259,7 +260,7 @@ enum { · 61 unmodified lines
259260 * advised to wait only for the following duration before
260261 * doing SRST.
261262 */
262− ATA_TMOUT_PMP_SRST_WAIT = 5000,
263+ ATA_TMOUT_PMP_SRST_WAIT = 10000,
263264
264265 /* When the LPM policy is set to ATA_LPM_MAX_POWER, there might
265266 * be a spurious PHY event, so ignore the first PHY event that
@@ -318,9 +319,10 @@ enum { · 52 unmodified lines
318319 ATA_EH_ENABLE_LINK = (1 << 3),
319320 ATA_EH_PARK = (1 << 5), /* unload heads and stop I/O */
320321 ATA_EH_GET_SUCCESS_SENSE = (1 << 6), /* Get sense data for successful cmd */
322+ ATA_EH_SET_ACTIVE = (1 << 7), /* Set a device to active power mode */
321323
322324 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_PARK |
323− ATA_EH_GET_SUCCESS_SENSE,
325+ ATA_EH_GET_SUCCESS_SENSE | ATA_EH_SET_ACTIVE,
324326 ATA_EH_ALL_ACTIONS = ATA_EH_REVALIDATE | ATA_EH_RESET |
325327 ATA_EH_ENABLE_LINK,
326328
@@ -357,7 +359,7 @@ enum { · 30 unmodified lines
357359 /* This should match the actual table size of
358360 * ata_eh_cmd_timeout_table in libata-eh.c.
359361 */
360− ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 7,
362+ ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 8,
361363
362364 /* Horkage types. May be set by libata or controller on drives
363365 (some horkage may be drive/controller pair dependent */
@@ -1148,6 +1150,7 @@ extern int ata_std_bios_param(struct scsi_device *sdev, · 784 unmodified lines
11481150 struct block_device *bdev,
11491151 sector_t capacity, int geom[]);
11501152 extern void ata_scsi_unlock_native_capacity(struct scsi_device *sdev);
1153+extern int ata_scsi_slave_alloc(struct scsi_device *sdev);
11511154 extern int ata_scsi_slave_config(struct scsi_device *sdev);
11521155 extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
11531156 extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
@@ -1396,6 +1399,7 @@ extern const struct attribute_group *ata_common_sdev_groups[]; · 242 unmodified lines
13961399 .this_id = ATA_SHT_THIS_ID, \
13971400 .emulated = ATA_SHT_EMULATED, \
13981401 .proc_name = drv_name, \
1402+ .slave_alloc = ata_scsi_slave_alloc, \
13991403 .slave_destroy = ata_scsi_slave_destroy, \
14001404 .bios_param = ata_std_bios_param, \
14011405 .unlock_native_capacity = ata_scsi_unlock_native_capacity,\
include/linux/maple_tree.h+11−0
@@ -428,6 +428,8 @@ struct ma_wr_state { · 427 unmodified lines
428428 #define MAS_ROOT ((struct maple_enode *)5UL)
429429 #define MAS_NONE ((struct maple_enode *)9UL)
430430 #define MAS_PAUSE ((struct maple_enode *)17UL)
431+#define MAS_OVERFLOW ((struct maple_enode *)33UL)
432+#define MAS_UNDERFLOW ((struct maple_enode *)65UL)
431433 #define MA_ERROR(err) \
432434 ((struct maple_enode *)(((unsigned long)err << 2) | 2UL))
433435
@@ -511,6 +513,15 @@ static inline bool mas_is_paused(const struct ma_state *mas) · 77 unmodified lines
511513 return mas->node == MAS_PAUSE;
512514 }
513515
516+/* Check if the mas is pointing to a node or not */
517+static inline bool mas_is_active(struct ma_state *mas)
518+{
519+ if ((unsigned long)mas->node >= MAPLE_RESERVED_RANGE)
520+ return true;
521+
522+ return false;
523+}
524+
514525 /**
515526 * mas_reset() - Reset a Maple Tree operation state.
516527 * @mas: Maple Tree operation state.
include/linux/memcontrol.h+2−2
@@ -920,7 +920,7 @@ unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, · 919 unmodified lines
920920 return READ_ONCE(mz->lru_zone_size[zone_idx][lru]);
921921 }
922922
923−void mem_cgroup_handle_over_high(void);
923+void mem_cgroup_handle_over_high(gfp_t gfp_mask);
924924
925925 unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg);
926926
@@ -1458,7 +1458,7 @@ static inline void mem_cgroup_unlock_pages(void) · 531 unmodified lines
14581458 rcu_read_unlock();
14591459 }
14601460
1461−static inline void mem_cgroup_handle_over_high(void)
1461+static inline void mem_cgroup_handle_over_high(gfp_t gfp_mask)
14621462 {
14631463 }
14641464
include/linux/netfilter/nf_conntrack_sctp.h+1−0
@@ -9,6 +9,7 @@ struct ip_ct_sctp { · 8 unmodified lines
99 enum sctp_conntrack state;
1010
1111 __be32 vtag[IP_CT_DIR_MAX];
12+ u8 init[IP_CT_DIR_MAX];
1213 u8 last_dir;
1314 u8 flags;
1415 };
include/linux/pgtable.h+9−1
@@ -206,6 +206,14 @@ static inline int pmd_young(pmd_t pmd) · 205 unmodified lines
206206 #endif
207207
208208 #ifndef set_ptes
209+
210+#ifndef pte_next_pfn
211+static inline pte_t pte_next_pfn(pte_t pte)
212+{
213+ return __pte(pte_val(pte) + (1UL << PFN_PTE_SHIFT));
214+}
215+#endif
216+
209217 /**
210218 * set_ptes - Map consecutive pages to a contiguous range of addresses.
211219 * @mm: Address space to map the pages into.
@@ -231,7 +239,7 @@ static inline void set_ptes(struct mm_struct *mm, unsigned long addr, · 19 unmodified lines
231239 if (--nr == 0)
232240 break;
233241 ptep++;
234− pte = __pte(pte_val(pte) + (1UL << PFN_PTE_SHIFT));
242+ pte = pte_next_pfn(pte);
235243 }
236244 arch_leave_lazy_mmu_mode();
237245 }
include/linux/resume_user_mode.h+1−1
@@ -55,7 +55,7 @@ static inline void resume_user_mode_work(struct pt_regs *regs) · 54 unmodified lines
5555 }
5656 #endif
5757
58− mem_cgroup_handle_over_high();
58+ mem_cgroup_handle_over_high(GFP_KERNEL);
5959 blkcg_maybe_throttle_current();
6060
6161 rseq_handle_notify_resume(NULL, regs);
include/linux/seqlock.h+1−1
@@ -512,8 +512,8 @@ do { \ · 511 unmodified lines
512512
513513 static inline void do_write_seqcount_begin_nested(seqcount_t *s, int subclass)
514514 {
515− do_raw_write_seqcount_begin(s);
516515 seqcount_acquire(&s->dep_map, subclass, 0, _RET_IP_);
516+ do_raw_write_seqcount_begin(s);
517517 }
518518
519519 /**
include/linux/swiotlb.h+16−7
@@ -172,14 +172,23 @@ static inline bool is_swiotlb_buffer(struct device *dev, phys_addr_t paddr) · 171 unmodified lines
172172 if (!mem)
173173 return false;
174174
175− if (IS_ENABLED(CONFIG_SWIOTLB_DYNAMIC)) {
176− /* Pairs with smp_wmb() in swiotlb_find_slots() and
177− * swiotlb_dyn_alloc(), which modify the RCU lists.
178− */
179− smp_rmb();
180− return swiotlb_find_pool(dev, paddr);
181− }
175+#ifdef CONFIG_SWIOTLB_DYNAMIC
176+ /*
177+ * All SWIOTLB buffer addresses must have been returned by
178+ * swiotlb_tbl_map_single() and passed to a device driver.
179+ * If a SWIOTLB address is checked on another CPU, then it was
180+ * presumably loaded by the device driver from an unspecified private
181+ * data structure. Make sure that this load is ordered before reading
182+ * dev->dma_uses_io_tlb here and mem->pools in swiotlb_find_pool().
183+ *
184+ * This barrier pairs with smp_mb() in swiotlb_find_slots().
185+ */
186+ smp_rmb();
187+ return READ_ONCE(dev->dma_uses_io_tlb) &&
188+ swiotlb_find_pool(dev, paddr);
189+#else
182190 return paddr >= mem->defpool.start && paddr < mem->defpool.end;
191+#endif
183192 }
184193
185194 static inline bool is_swiotlb_force_bounce(struct device *dev)
include/net/bluetooth/hci_core.h+1−1
@@ -350,7 +350,7 @@ struct hci_dev { · 349 unmodified lines
350350 struct list_head list;
351351 struct mutex lock;
352352
353− char name[8];
353+ const char *name;
354354 unsigned long flags;
355355 __u16 id;
356356 __u8 bus;
include/net/cfg80211.h+4−2
@@ -5941,6 +5941,7 @@ void wiphy_delayed_work_cancel(struct wiphy *wiphy, · 5940 unmodified lines
59415941 * @event_lock: (private) lock for event list
59425942 * @owner_nlportid: (private) owner socket port ID
59435943 * @nl_owner_dead: (private) owner socket went away
5944+ * @cqm_rssi_work: (private) CQM RSSI reporting work
59445945 * @cqm_config: (private) nl80211 RSSI monitor state
59455946 * @pmsr_list: (private) peer measurement requests
59465947 * @pmsr_lock: (private) peer measurements requests/results lock
@@ -6013,7 +6014,8 @@ struct wireless_dev { · 66 unmodified lines
60136014 } wext;
60146015 #endif
60156016
6016− struct cfg80211_cqm_config *cqm_config;
6017+ struct wiphy_work cqm_rssi_work;
6018+ struct cfg80211_cqm_config __rcu *cqm_config;
60176019
60186020 struct list_head pmsr_list;
60196021 spinlock_t pmsr_lock;
@@ -7231,7 +7233,7 @@ struct cfg80211_rx_assoc_resp { · 1211 unmodified lines
72317233 int uapsd_queues;
72327234 const u8 *ap_mld_addr;
72337235 struct {
7234− const u8 *addr;
7236+ u8 addr[ETH_ALEN] __aligned(2);
72357237 struct cfg80211_bss *bss;
72367238 u16 status;
72377239 } links[IEEE80211_MLD_MAX_NUM_LINKS];
include/net/ip_fib.h+1−0
@@ -154,6 +154,7 @@ struct fib_info { · 153 unmodified lines
154154 int fib_nhs;
155155 bool fib_nh_is_v6;
156156 bool nh_updated;
157+ bool pfsrc_removed;
157158 struct nexthop *nh;
158159 struct rcu_head rcu;
159160 struct fib_nh fib_nh[] __counted_by(fib_nhs);
include/net/mana/mana.h+3−2
@@ -103,9 +103,10 @@ struct mana_txq { · 102 unmodified lines
103103
104104 /* skb data and frags dma mappings */
105105 struct mana_skb_head {
106− dma_addr_t dma_handle[MAX_SKB_FRAGS + 1];
106+ /* GSO pkts may have 2 SGEs for the linear part*/
107+ dma_addr_t dma_handle[MAX_SKB_FRAGS + 2];
107108
108− u32 size[MAX_SKB_FRAGS + 1];
109+ u32 size[MAX_SKB_FRAGS + 2];
109110 };
110111
111112 #define MANA_HEADROOM sizeof(struct mana_skb_head)
include/net/neighbour.h+1−1
@@ -539,7 +539,7 @@ static inline int neigh_output(struct neighbour *n, struct sk_buff *skb, · 538 unmodified lines
539539 READ_ONCE(hh->hh_len))
540540 return neigh_hh_output(hh, skb);
541541
542− return n->output(n, skb);
542+ return READ_ONCE(n->output)(n, skb);
543543 }
544544
545545 static inline struct neighbour *
include/net/page_pool/helpers.h+3−3
@@ -16,13 +16,13 @@ · 15 unmodified lines
1616 * page_pool_alloc_pages() call. Drivers should use
1717 * page_pool_dev_alloc_pages() replacing dev_alloc_pages().
1818 *
19− * API keeps track of in-flight pages, in order to let API user know
19+ * The API keeps track of in-flight pages, in order to let API users know
2020 * when it is safe to free a page_pool object. Thus, API users
2121 * must call page_pool_put_page() to free the page, or attach
22− * the page to a page_pool-aware objects like skbs marked with
22+ * the page to a page_pool-aware object like skbs marked with
2323 * skb_mark_for_recycle().
2424 *
25− * API user must call page_pool_put_page() once on a page, as it
25+ * API users must call page_pool_put_page() once on a page, as it
2626 * will either recycle the page, or in case of refcnt > 1, it will
2727 * release the DMA mapping and in-flight state accounting.
2828 */
include/net/tcp.h+4−2
@@ -348,12 +348,14 @@ ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, · 347 unmodified lines
348348 struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, gfp_t gfp,
349349 bool force_schedule);
350350
351−static inline void tcp_dec_quickack_mode(struct sock *sk,
352− const unsigned int pkts)
351+static inline void tcp_dec_quickack_mode(struct sock *sk)
353352 {
354353 struct inet_connection_sock *icsk = inet_csk(sk);
355354
356355 if (icsk->icsk_ack.quick) {
356+ /* How many ACKs S/ACKing new data have we sent? */
357+ const unsigned int pkts = inet_csk_ack_scheduled(sk) ? 1 : 0;
358+
357359 if (pkts >= icsk->icsk_ack.quick) {
358360 icsk->icsk_ack.quick = 0;
359361 /* Leaving quickack mode we deflate ATO. */
include/scsi/scsi.h+3−0
@@ -157,6 +157,9 @@ enum scsi_disposition { · 156 unmodified lines
157157 #define SCSI_3 4 /* SPC */
158158 #define SCSI_SPC_2 5
159159 #define SCSI_SPC_3 6
160+#define SCSI_SPC_4 7
161+#define SCSI_SPC_5 8
162+#define SCSI_SPC_6 14
160163
161164 /*
162165 * INQ PERIPHERAL QUALIFIERS
include/scsi/scsi_device.h+4−1
@@ -161,6 +161,10 @@ struct scsi_device { · 160 unmodified lines
161161 * pass settings from slave_alloc to scsi
162162 * core. */
163163 unsigned int eh_timeout; /* Error handling timeout */
164+
165+ bool manage_system_start_stop; /* Let HLD (sd) manage system start/stop */
166+ bool manage_runtime_start_stop; /* Let HLD (sd) manage runtime start/stop */
167+
164168 unsigned removable:1;
165169 unsigned changed:1; /* Data invalid due to media change */
166170 unsigned busy:1; /* Used to prevent races */
@@ -193,7 +197,6 @@ struct scsi_device { · 26 unmodified lines
193197 unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
194198 unsigned no_start_on_add:1; /* do not issue start on add */
195199 unsigned allow_restart:1; /* issue START_UNIT in error handler */
196− unsigned manage_start_stop:1; /* Let HLD (sd) manage start/stop */
197200 unsigned no_start_on_resume:1; /* Do not issue START_STOP_UNIT on resume */
198201 unsigned start_stop_pwr_cond:1; /* Set power cond. in START_STOP_UNIT */
199202 unsigned no_uld_attach:1; /* disable connecting to upper level drivers */
include/scsi/scsi_host.h+1−1
@@ -764,7 +764,7 @@ scsi_template_proc_dir(const struct scsi_host_template *sht); · 763 unmodified lines
764764 #define scsi_template_proc_dir(sht) NULL
765765 #endif
766766 extern void scsi_scan_host(struct Scsi_Host *);
767−extern void scsi_rescan_device(struct scsi_device *);
767+extern int scsi_rescan_device(struct scsi_device *sdev);
768768 extern void scsi_remove_host(struct Scsi_Host *);
769769 extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
770770 extern int scsi_host_busy(struct Scsi_Host *shost);
include/uapi/linux/stddef.h+7−0
@@ -29,6 +29,11 @@ · 28 unmodified lines
2929 struct TAG { MEMBERS } ATTRS NAME; \
3030 }
3131
32+#ifdef __cplusplus
33+/* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */
34+#define __DECLARE_FLEX_ARRAY(T, member) \
35+ T member[0]
36+#else
3237 /**
3338 * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
3439 *
@@ -49,3 +54,5 @@ · 14 unmodified lines
4954 #ifndef __counted_by
5055 #define __counted_by(m)
5156 #endif
57+
58+#endif /* _UAPI_LINUX_STDDEF_H */
io_uring/fs.c+1−1
@@ -243,7 +243,7 @@ int io_linkat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 242 unmodified lines
243243 struct io_link *lnk = io_kiocb_to_cmd(req, struct io_link);
244244 const char __user *oldf, *newf;
245245
246− if (sqe->rw_flags || sqe->buf_index || sqe->splice_fd_in)
246+ if (sqe->buf_index || sqe->splice_fd_in)
247247 return -EINVAL;
248248 if (unlikely(req->flags & REQ_F_FIXED_FILE))
249249 return -EBADF;
kernel/bpf/memalloc.c+19−25
@@ -973,37 +973,31 @@ void notrace *bpf_mem_cache_alloc_flags(struct bpf_mem_alloc *ma, gfp_t flags) · 972 unmodified lines
973973 return !ret ? NULL : ret + LLIST_NODE_SZ;
974974 }
975975
976−/* Most of the logic is taken from setup_kmalloc_cache_index_table() */
977976 static __init int bpf_mem_cache_adjust_size(void)
978977 {
979− unsigned int size, index;
978+ unsigned int size;
980979
981− /* Normally KMALLOC_MIN_SIZE is 8-bytes, but it can be
982− * up-to 256-bytes.
980+ /* Adjusting the indexes in size_index() according to the object_size
981+ * of underlying slab cache, so bpf_mem_alloc() will select a
982+ * bpf_mem_cache with unit_size equal to the object_size of
983+ * the underlying slab cache.
984+ *
985+ * The maximal value of KMALLOC_MIN_SIZE and __kmalloc_minalign() is
986+ * 256-bytes, so only do adjustment for [8-bytes, 192-bytes].
983987 */
984− size = KMALLOC_MIN_SIZE;
985− if (size <= 192)
986− index = size_index[(size - 1) / 8];
987− else
988− index = fls(size - 1) - 1;
989− for (size = 8; size < KMALLOC_MIN_SIZE && size <= 192; size += 8)
990− size_index[(size - 1) / 8] = index;
988+ for (size = 192; size >= 8; size -= 8) {
989+ unsigned int kmalloc_size, index;
991990
992− /* The minimal alignment is 64-bytes, so disable 96-bytes cache and
993− * use 128-bytes cache instead.
994− */
995− if (KMALLOC_MIN_SIZE >= 64) {
996− index = size_index[(128 - 1) / 8];
997− for (size = 64 + 8; size <= 96; size += 8)
998− size_index[(size - 1) / 8] = index;
999− }
991+ kmalloc_size = kmalloc_size_roundup(size);
992+ if (kmalloc_size == size)
993+ continue;
1000994
1001− /* The minimal alignment is 128-bytes, so disable 192-bytes cache and
1002− * use 256-bytes cache instead.
1003− */
1004− if (KMALLOC_MIN_SIZE >= 128) {
1005− index = fls(256 - 1) - 1;
1006− for (size = 128 + 8; size <= 192; size += 8)
995+ if (kmalloc_size <= 192)
996+ index = size_index[(kmalloc_size - 1) / 8];
997+ else
998+ index = fls(kmalloc_size - 1) - 1;
999+ /* Only overwrite if necessary */
1000+ if (size_index[(size - 1) / 8] != index)
10071001 size_index[(size - 1) / 8] = index;
10081002 }
10091003
kernel/bpf/mprog.c+3−0
@@ -253,6 +253,9 @@ int bpf_mprog_attach(struct bpf_mprog_entry *entry, · 252 unmodified lines
253253 goto out;
254254 }
255255 idx = tidx;
256+ } else if (bpf_mprog_total(entry) == bpf_mprog_max()) {
257+ ret = -ERANGE;
258+ goto out;
256259 }
257260 if (flags & BPF_F_BEFORE) {
258261 tidx = bpf_mprog_pos_before(entry, &rtuple);
kernel/bpf/verifier.c+3−5
@@ -4132,11 +4132,9 @@ static int __mark_chain_precision(struct bpf_verifier_env *env, int regno) · 4131 unmodified lines
41324132 bitmap_from_u64(mask, bt_reg_mask(bt));
41334133 for_each_set_bit(i, mask, 32) {
41344134 reg = &st->frame[0]->regs[i];
4135− if (reg->type != SCALAR_VALUE) {
4136− bt_clear_reg(bt, i);
4137− continue;
4138− }
4139− reg->precise = true;
4135+ bt_clear_reg(bt, i);
4136+ if (reg->type == SCALAR_VALUE)
4137+ reg->precise = true;
41404138 }
41414139 return 0;
41424140 }
kernel/crash_core.c+17−0
@@ -739,6 +739,17 @@ subsys_initcall(crash_notes_memory_init); · 738 unmodified lines
739739 #undef pr_fmt
740740 #define pr_fmt(fmt) "crash hp: " fmt
741741
742+/*
743+ * Different than kexec/kdump loading/unloading/jumping/shrinking which
744+ * usually rarely happen, there will be many crash hotplug events notified
745+ * during one short period, e.g one memory board is hot added and memory
746+ * regions are online. So mutex lock __crash_hotplug_lock is used to
747+ * serialize the crash hotplug handling specifically.
748+ */
749+DEFINE_MUTEX(__crash_hotplug_lock);
750+#define crash_hotplug_lock() mutex_lock(&__crash_hotplug_lock)
751+#define crash_hotplug_unlock() mutex_unlock(&__crash_hotplug_lock)
752+
742753 /*
743754 * This routine utilized when the crash_hotplug sysfs node is read.
744755 * It reflects the kernel's ability/permission to update the crash
@@ -748,9 +759,11 @@ int crash_check_update_elfcorehdr(void) · 3 unmodified lines
748759 {
749760 int rc = 0;
750761
762+ crash_hotplug_lock();
751763 /* Obtain lock while reading crash information */
752764 if (!kexec_trylock()) {
753765 pr_info("kexec_trylock() failed, elfcorehdr may be inaccurate\n");
766+ crash_hotplug_unlock();
754767 return 0;
755768 }
756769 if (kexec_crash_image) {
@@ -761,6 +774,7 @@ int crash_check_update_elfcorehdr(void) · 4 unmodified lines
761774 }
762775 /* Release lock now that update complete */
763776 kexec_unlock();
777+ crash_hotplug_unlock();
764778
765779 return rc;
766780 }
@@ -783,9 +797,11 @@ static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu) · 16 unmodified lines
783797 {
784798 struct kimage *image;
785799
800+ crash_hotplug_lock();
786801 /* Obtain lock while changing crash information */
787802 if (!kexec_trylock()) {
788803 pr_info("kexec_trylock() failed, elfcorehdr may be inaccurate\n");
804+ crash_hotplug_unlock();
789805 return;
790806 }
791807
@@ -852,6 +868,7 @@ static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu) · 60 unmodified lines
852868 out:
853869 /* Release lock now that update complete */
854870 kexec_unlock();
871+ crash_hotplug_unlock();
855872 }
856873
857874 static int crash_memhp_notifier(struct notifier_block *nb, unsigned long val, void *v)
kernel/dma/swiotlb.c+22−9
@@ -399,14 +399,13 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags, · 398 unmodified lines
399399 }
400400
401401 mem->areas = memblock_alloc(array_size(sizeof(struct io_tlb_area),
402− default_nareas), SMP_CACHE_BYTES);
402+ nareas), SMP_CACHE_BYTES);
403403 if (!mem->areas) {
404404 pr_warn("%s: Failed to allocate mem->areas.\n", __func__);
405405 return;
406406 }
407407
408− swiotlb_init_io_tlb_pool(mem, __pa(tlb), nslabs, false,
409− default_nareas);
408+ swiotlb_init_io_tlb_pool(mem, __pa(tlb), nslabs, false, nareas);
410409 add_mem_pool(&io_tlb_default_mem, mem);
411410
412411 if (flags & SWIOTLB_VERBOSE)
@@ -729,9 +728,6 @@ static void swiotlb_dyn_alloc(struct work_struct *work) · 316 unmodified lines
729728 }
730729
731730 add_mem_pool(mem, pool);
732−
733− /* Pairs with smp_rmb() in is_swiotlb_buffer(). */
734− smp_wmb();
735731 }
736732
737733 /**
@@ -1152,9 +1148,26 @@ static int swiotlb_find_slots(struct device *dev, phys_addr_t orig_addr, · 414 unmodified lines
11521148 spin_unlock_irqrestore(&dev->dma_io_tlb_lock, flags);
11531149
11541150 found:
1155− dev->dma_uses_io_tlb = true;
1156− /* Pairs with smp_rmb() in is_swiotlb_buffer() */
1157− smp_wmb();
1151+ WRITE_ONCE(dev->dma_uses_io_tlb, true);
1152+
1153+ /*
1154+ * The general barrier orders reads and writes against a presumed store
1155+ * of the SWIOTLB buffer address by a device driver (to a driver private
1156+ * data structure). It serves two purposes.
1157+ *
1158+ * First, the store to dev->dma_uses_io_tlb must be ordered before the
1159+ * presumed store. This guarantees that the returned buffer address
1160+ * cannot be passed to another CPU before updating dev->dma_uses_io_tlb.
1161+ *
1162+ * Second, the load from mem->pools must be ordered before the same
1163+ * presumed store. This guarantees that the returned buffer address
1164+ * cannot be observed by another CPU before an update of the RCU list
1165+ * that was made by swiotlb_dyn_alloc() on a third CPU (cf. multicopy
1166+ * atomicity).
1167+ *
1168+ * See also the comment in is_swiotlb_buffer().
1169+ */
1170+ smp_mb();
11581171
11591172 *retpool = pool;
11601173 return index;
kernel/pid.c+1−1
@@ -609,7 +609,7 @@ int pidfd_create(struct pid *pid, unsigned int flags) · 608 unmodified lines
609609 }
610610
611611 /**
612− * pidfd_open() - Open new pid file descriptor.
612+ * sys_pidfd_open() - Open new pid file descriptor.
613613 *
614614 * @pid: pid for which to retrieve a pidfd
615615 * @flags: flags to pass
kernel/sched/core.c+1−1
@@ -9269,7 +9269,7 @@ void __init init_idle(struct task_struct *idle, int cpu) · 9268 unmodified lines
92699269 * PF_KTHREAD should already be set at this point; regardless, make it
92709270 * look like a proper per-CPU kthread.
92719271 */
9272− idle->flags |= PF_IDLE | PF_KTHREAD | PF_NO_SETAFFINITY;
9272+ idle->flags |= PF_KTHREAD | PF_NO_SETAFFINITY;
92739273 kthread_set_per_cpu(idle, cpu);
92749274
92759275 #ifdef CONFIG_SMP
kernel/sched/cpupri.c+1−0
@@ -101,6 +101,7 @@ static inline int __cpupri_find(struct cpupri *cp, struct task_struct *p, · 100 unmodified lines
101101
102102 if (lowest_mask) {
103103 cpumask_and(lowest_mask, &p->cpus_mask, vec->mask);
104+ cpumask_and(lowest_mask, lowest_mask, cpu_active_mask);
104105
105106 /*
106107 * We have to ensure that we have at least one bit
kernel/sched/idle.c+1−0
@@ -373,6 +373,7 @@ EXPORT_SYMBOL_GPL(play_idle_precise); · 372 unmodified lines
373373
374374 void cpu_startup_entry(enum cpuhp_state state)
375375 {
376+ current->flags |= PF_IDLE;
376377 arch_cpu_idle_prepare();
377378 cpuhp_online_idle(state);
378379 while (1)
kernel/task_work.c+1−0
@@ -78,6 +78,7 @@ int task_work_add(struct task_struct *task, struct callback_head *work, · 77 unmodified lines
7878 * task_work_cancel_match - cancel a pending work added by task_work_add()
7979 * @task: the task which should execute the work
8080 * @match: match function to call
81+ * @data: data to be passed in to match function
8182 *
8283 * RETURNS:
8384 * The found work or NULL if not found.
kernel/trace/ring_buffer.c+18−13
@@ -354,6 +354,11 @@ static void rb_init_page(struct buffer_data_page *bpage) · 353 unmodified lines
354354 local_set(&bpage->commit, 0);
355355 }
356356
357+static __always_inline unsigned int rb_page_commit(struct buffer_page *bpage)
358+{
359+ return local_read(&bpage->page->commit);
360+}
361+
357362 static void free_buffer_page(struct buffer_page *bpage)
358363 {
359364 free_page((unsigned long)bpage->page);
@@ -1132,6 +1137,9 @@ __poll_t ring_buffer_poll_wait(struct trace_buffer *buffer, int cpu, · 772 unmodified lines
11321137 if (full) {
11331138 poll_wait(filp, &work->full_waiters, poll_table);
11341139 work->full_waiters_pending = true;
1140+ if (!cpu_buffer->shortest_full ||
1141+ cpu_buffer->shortest_full > full)
1142+ cpu_buffer->shortest_full = full;
11351143 } else {
11361144 poll_wait(filp, &work->waiters, poll_table);
11371145 work->waiters_pending = true;
@@ -2003,7 +2011,7 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages) · 865 unmodified lines
20032011 * Increment overrun to account for the lost events.
20042012 */
20052013 local_add(page_entries, &cpu_buffer->overrun);
2006− local_sub(BUF_PAGE_SIZE, &cpu_buffer->entries_bytes);
2014+ local_sub(rb_page_commit(to_remove_page), &cpu_buffer->entries_bytes);
20072015 local_inc(&cpu_buffer->pages_lost);
20082016 }
20092017
@@ -2367,11 +2375,6 @@ rb_reader_event(struct ring_buffer_per_cpu *cpu_buffer) · 357 unmodified lines
23672375 cpu_buffer->reader_page->read);
23682376 }
23692377
2370−static __always_inline unsigned rb_page_commit(struct buffer_page *bpage)
2371−{
2372− return local_read(&bpage->page->commit);
2373−}
2374−
23752378 static struct ring_buffer_event *
23762379 rb_iter_head_event(struct ring_buffer_iter *iter)
23772380 {
@@ -2517,7 +2520,7 @@ rb_handle_head_page(struct ring_buffer_per_cpu *cpu_buffer, · 139 unmodified lines
25172520 * the counters.
25182521 */
25192522 local_add(entries, &cpu_buffer->overrun);
2520− local_sub(BUF_PAGE_SIZE, &cpu_buffer->entries_bytes);
2523+ local_sub(rb_page_commit(next_page), &cpu_buffer->entries_bytes);
25212524 local_inc(&cpu_buffer->pages_lost);
25222525
25232526 /*
@@ -2660,9 +2663,6 @@ rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer, · 136 unmodified lines
26602663
26612664 event = __rb_page_index(tail_page, tail);
26622665
2663− /* account for padding bytes */
2664− local_add(BUF_PAGE_SIZE - tail, &cpu_buffer->entries_bytes);
2665−
26662666 /*
26672667 * Save the original length to the meta data.
26682668 * This will be used by the reader to add lost event
@@ -2676,7 +2676,8 @@ rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer, · 7 unmodified lines
26762676 * write counter enough to allow another writer to slip
26772677 * in on this page.
26782678 * We put in a discarded commit instead, to make sure
2679− * that this space is not used again.
2679+ * that this space is not used again, and this space will
2680+ * not be accounted into 'entries_bytes'.
26802681 *
26812682 * If we are less than the minimum size, we don't need to
26822683 * worry about it.
@@ -2701,6 +2702,9 @@ rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer, · 18 unmodified lines
27012702 /* time delta must be non zero */
27022703 event->time_delta = 1;
27032704
2705+ /* account for padding bytes */
2706+ local_add(BUF_PAGE_SIZE - tail, &cpu_buffer->entries_bytes);
2707+
27042708 /* Make sure the padding is visible before the tail_page->write update */
27052709 smp_wmb();
27062710
@@ -4215,7 +4219,7 @@ u64 ring_buffer_oldest_event_ts(struct trace_buffer *buffer, int cpu) · 1508 unmodified lines
42154219 EXPORT_SYMBOL_GPL(ring_buffer_oldest_event_ts);
42164220
42174221 /**
4218− * ring_buffer_bytes_cpu - get the number of bytes consumed in a cpu buffer
4222+ * ring_buffer_bytes_cpu - get the number of bytes unconsumed in a cpu buffer
42194223 * @buffer: The ring buffer
42204224 * @cpu: The per CPU buffer to read from.
42214225 */
@@ -4723,6 +4727,7 @@ static void rb_advance_reader(struct ring_buffer_per_cpu *cpu_buffer) · 501 unmodified lines
47234727
47244728 length = rb_event_length(event);
47254729 cpu_buffer->reader_page->read += length;
4730+ cpu_buffer->read_bytes += length;
47264731 }
47274732
47284733 static void rb_advance_iter(struct ring_buffer_iter *iter)
@@ -5816,7 +5821,7 @@ int ring_buffer_read_page(struct trace_buffer *buffer, · 1087 unmodified lines
58165821 } else {
58175822 /* update the entry counter */
58185823 cpu_buffer->read += rb_page_entries(reader);
5819− cpu_buffer->read_bytes += BUF_PAGE_SIZE;
5824+ cpu_buffer->read_bytes += rb_page_commit(reader);
58205825
58215826 /* swap the pages */
58225827 rb_init_page(bpage);
kernel/trace/trace_events.c+1−0
@@ -2770,6 +2770,7 @@ void trace_event_eval_update(struct trace_eval_map **map, int len) · 2769 unmodified lines
27702770 update_event_fields(call, map[i]);
27712771 }
27722772 }
2773+ cond_resched();
27732774 }
27742775 up_write(&trace_event_sem);
27752776 }
kernel/trace/trace_events_user.c+51−7
@@ -127,8 +127,13 @@ struct user_event_enabler { · 126 unmodified lines
127127 /* Bit 7 is for freeing status of enablement */
128128 #define ENABLE_VAL_FREEING_BIT 7
129129
130−/* Only duplicate the bit value */
131−#define ENABLE_VAL_DUP_MASK ENABLE_VAL_BIT_MASK
130+/* Bit 8 is for marking 32-bit on 64-bit */
131+#define ENABLE_VAL_32_ON_64_BIT 8
132+
133+#define ENABLE_VAL_COMPAT_MASK (1 << ENABLE_VAL_32_ON_64_BIT)
134+
135+/* Only duplicate the bit and compat values */
136+#define ENABLE_VAL_DUP_MASK (ENABLE_VAL_BIT_MASK | ENABLE_VAL_COMPAT_MASK)
132137
133138 #define ENABLE_BITOPS(e) (&(e)->values)
134139
@@ -174,6 +179,30 @@ struct user_event_validator { · 39 unmodified lines
174179 int flags;
175180 };
176181
182+static inline void align_addr_bit(unsigned long *addr, int *bit,
183+ unsigned long *flags)
184+{
185+ if (IS_ALIGNED(*addr, sizeof(long))) {
186+#ifdef __BIG_ENDIAN
187+ /* 32 bit on BE 64 bit requires a 32 bit offset when aligned. */
188+ if (test_bit(ENABLE_VAL_32_ON_64_BIT, flags))
189+ *bit += 32;
190+#endif
191+ return;
192+ }
193+
194+ *addr = ALIGN_DOWN(*addr, sizeof(long));
195+
196+ /*
197+ * We only support 32 and 64 bit values. The only time we need
198+ * to align is a 32 bit value on a 64 bit kernel, which on LE
199+ * is always 32 bits, and on BE requires no change when unaligned.
200+ */
201+#ifdef __LITTLE_ENDIAN
202+ *bit += 32;
203+#endif
204+}
205+
177206 typedef void (*user_event_func_t) (struct user_event *user, struct iov_iter *i,
178207 void *tpdata, bool *faulted);
179208
@@ -482,6 +511,7 @@ static int user_event_enabler_write(struct user_event_mm *mm, · 302 unmodified lines
482511 unsigned long *ptr;
483512 struct page *page;
484513 void *kaddr;
514+ int bit = ENABLE_BIT(enabler);
485515 int ret;
486516
487517 lockdep_assert_held(&event_mutex);
@@ -497,6 +527,8 @@ static int user_event_enabler_write(struct user_event_mm *mm, · 9 unmodified lines
497527 test_bit(ENABLE_VAL_FREEING_BIT, ENABLE_BITOPS(enabler))))
498528 return -EBUSY;
499529
530+ align_addr_bit(&uaddr, &bit, ENABLE_BITOPS(enabler));
531+
500532 ret = pin_user_pages_remote(mm->mm, uaddr, 1, FOLL_WRITE | FOLL_NOFAULT,
501533 &page, NULL);
502534
@@ -515,9 +547,9 @@ static int user_event_enabler_write(struct user_event_mm *mm, · 12 unmodified lines
515547
516548 /* Update bit atomically, user tracers must be atomic as well */
517549 if (enabler->event && enabler->event->status)
518− set_bit(ENABLE_BIT(enabler), ptr);
550+ set_bit(bit, ptr);
519551 else
520− clear_bit(ENABLE_BIT(enabler), ptr);
552+ clear_bit(bit, ptr);
521553
522554 kunmap_local(kaddr);
523555 unpin_user_pages_dirty_lock(&page, 1, true);
@@ -849,6 +881,12 @@ static struct user_event_enabler · 325 unmodified lines
849881 enabler->event = user;
850882 enabler->addr = uaddr;
851883 enabler->values = reg->enable_bit;
884+
885+#if BITS_PER_LONG >= 64
886+ if (reg->enable_size == 4)
887+ set_bit(ENABLE_VAL_32_ON_64_BIT, ENABLE_BITOPS(enabler));
888+#endif
889+
852890 retry:
853891 /* Prevents state changes from racing with new enablers */
854892 mutex_lock(&event_mutex);
@@ -2377,7 +2415,8 @@ static long user_unreg_get(struct user_unreg __user *ureg, · 1522 unmodified lines
23772415 }
23782416
23792417 static int user_event_mm_clear_bit(struct user_event_mm *user_mm,
2380− unsigned long uaddr, unsigned char bit)
2418+ unsigned long uaddr, unsigned char bit,
2419+ unsigned long flags)
23812420 {
23822421 struct user_event_enabler enabler;
23832422 int result;
@@ -2385,7 +2424,7 @@ static int user_event_mm_clear_bit(struct user_event_mm *user_mm, · 1 unmodified line
23852424
23862425 memset(&enabler, 0, sizeof(enabler));
23872426 enabler.addr = uaddr;
2388− enabler.values = bit;
2427+ enabler.values = bit | flags;
23892428 retry:
23902429 /* Prevents state changes from racing with new enablers */
23912430 mutex_lock(&event_mutex);
@@ -2415,6 +2454,7 @@ static long user_events_ioctl_unreg(unsigned long uarg) · 23 unmodified lines
24152454 struct user_event_mm *mm = current->user_event_mm;
24162455 struct user_event_enabler *enabler, *next;
24172456 struct user_unreg reg;
2457+ unsigned long flags;
24182458 long ret;
24192459
24202460 ret = user_unreg_get(ureg, &reg);
@@ -2425,6 +2465,7 @@ static long user_events_ioctl_unreg(unsigned long uarg) · 4 unmodified lines
24252465 if (!mm)
24262466 return -ENOENT;
24272467
2468+ flags = 0;
24282469 ret = -ENOENT;
24292470
24302471 /*
@@ -2441,6 +2482,9 @@ static long user_events_ioctl_unreg(unsigned long uarg) · 10 unmodified lines
24412482 ENABLE_BIT(enabler) == reg.disable_bit) {
24422483 set_bit(ENABLE_VAL_FREEING_BIT, ENABLE_BITOPS(enabler));
24432484
2485+ /* We must keep compat flags for the clear */
2486+ flags |= enabler->values & ENABLE_VAL_COMPAT_MASK;
2487+
24442488 if (!test_bit(ENABLE_VAL_FAULTING_BIT, ENABLE_BITOPS(enabler)))
24452489 user_event_enabler_destroy(enabler, true);
24462490
@@ -2454,7 +2498,7 @@ static long user_events_ioctl_unreg(unsigned long uarg) · 7 unmodified lines
24542498 /* Ensure bit is now cleared for user, regardless of event status */
24552499 if (!ret)
24562500 ret = user_event_mm_clear_bit(mm, reg.disable_addr,
2457− reg.disable_bit);
2501+ reg.disable_bit, flags);
24582502
24592503 return ret;
24602504 }
kernel/workqueue.c+3−6
@@ -6535,9 +6535,6 @@ void __init workqueue_init_early(void) · 6534 unmodified lines
65356535
65366536 BUG_ON(!zalloc_cpumask_var_node(&pt->pod_cpus[0], GFP_KERNEL, NUMA_NO_NODE));
65376537
6538− wq_update_pod_attrs_buf = alloc_workqueue_attrs();
6539− BUG_ON(!wq_update_pod_attrs_buf);
6540−
65416538 pt->nr_pods = 1;
65426539 cpumask_copy(pt->pod_cpus[0], cpu_possible_mask);
65436540 pt->pod_node[0] = NUMA_NO_NODE;
@@ -6605,13 +6602,13 @@ static void __init wq_cpu_intensive_thresh_init(void) · 61 unmodified lines
66056602 unsigned long thresh;
66066603 unsigned long bogo;
66076604
6605+ pwq_release_worker = kthread_create_worker(0, "pool_workqueue_release");
6606+ BUG_ON(IS_ERR(pwq_release_worker));
6607+
66086608 /* if the user set it to a specific value, keep it */
66096609 if (wq_cpu_intensive_thresh_us != ULONG_MAX)
66106610 return;
66116611
6612− pwq_release_worker = kthread_create_worker(0, "pool_workqueue_release");
6613− BUG_ON(IS_ERR(pwq_release_worker));
6614−
66156612 /*
66166613 * The default of 10ms is derived from the fact that most modern (as of
66176614 * 2023) processors can do a lot in 10ms and that it's just below what
lib/argv_split.c+2−2
@@ -28,7 +28,7 @@ static int count_argc(const char *str) · 27 unmodified lines
2828
2929 /**
3030 * argv_free - free an argv
31− * @argv - the argument vector to be freed
31+ * @argv: the argument vector to be freed
3232 *
3333 * Frees an argv and the strings it points to.
3434 */
@@ -46,7 +46,7 @@ EXPORT_SYMBOL(argv_free); · 11 unmodified lines
4646 * @str: the string to be split
4747 * @argcp: returned argument count
4848 *
49− * Returns an array of pointers to strings which are split out from
49+ * Returns: an array of pointers to strings which are split out from
5050 * @str. This is performed by strictly splitting on white-space; no
5151 * quote processing is performed. Multiple whitespace characters are
5252 * considered to be a single argument separator. The returned array
lib/maple_tree.c+163−58
@@ -256,6 +256,22 @@ bool mas_is_err(struct ma_state *mas) · 255 unmodified lines
256256 return xa_is_err(mas->node);
257257 }
258258
259+static __always_inline bool mas_is_overflow(struct ma_state *mas)
260+{
261+ if (unlikely(mas->node == MAS_OVERFLOW))
262+ return true;
263+
264+ return false;
265+}
266+
267+static __always_inline bool mas_is_underflow(struct ma_state *mas)
268+{
269+ if (unlikely(mas->node == MAS_UNDERFLOW))
270+ return true;
271+
272+ return false;
273+}
274+
259275 static inline bool mas_searchable(struct ma_state *mas)
260276 {
261277 if (mas_is_none(mas))
@@ -4415,10 +4431,13 @@ no_entry: · 4153 unmodified lines
44154431 *
44164432 * @mas: The maple state
44174433 * @max: The minimum starting range
4434+ * @empty: Can be empty
4435+ * @set_underflow: Set the @mas->node to underflow state on limit.
44184436 *
44194437 * Return: The entry in the previous slot which is possibly NULL
44204438 */
4421−static void *mas_prev_slot(struct ma_state *mas, unsigned long min, bool empty)
4439+static void *mas_prev_slot(struct ma_state *mas, unsigned long min, bool empty,
4440+ bool set_underflow)
44224441 {
44234442 void *entry;
44244443 void __rcu **slots;
@@ -4435,7 +4454,6 @@ retry: · 10 unmodified lines
44354454 if (unlikely(mas_rewalk_if_dead(mas, node, save_point)))
44364455 goto retry;
44374456
4438−again:
44394457 if (mas->min <= min) {
44404458 pivot = mas_safe_min(mas, pivots, mas->offset);
44414459
@@ -4443,9 +4461,10 @@ again: · 1 unmodified line
44434461 goto retry;
44444462
44454463 if (pivot <= min)
4446− return NULL;
4464+ goto underflow;
44474465 }
44484466
4467+again:
44494468 if (likely(mas->offset)) {
44504469 mas->offset--;
44514470 mas->last = mas->index - 1;
@@ -4457,7 +4476,7 @@ again: · 5 unmodified lines
44574476 }
44584477
44594478 if (mas_is_none(mas))
4460− return NULL;
4479+ goto underflow;
44614480
44624481 mas->last = mas->max;
44634482 node = mas_mn(mas);
@@ -4474,10 +4493,19 @@ again: · 10 unmodified lines
44744493 if (likely(entry))
44754494 return entry;
44764495
4477− if (!empty)
4496+ if (!empty) {
4497+ if (mas->index <= min)
4498+ goto underflow;
4499+
44784500 goto again;
4501+ }
44794502
44804503 return entry;
4504+
4505+underflow:
4506+ if (set_underflow)
4507+ mas->node = MAS_UNDERFLOW;
4508+ return NULL;
44814509 }
44824510
44834511 /*
@@ -4567,10 +4595,13 @@ no_entry: · 83 unmodified lines
45674595 * @mas: The maple state
45684596 * @max: The maximum starting range
45694597 * @empty: Can be empty
4598+ * @set_overflow: Should @mas->node be set to overflow when the limit is
4599+ * reached.
45704600 *
45714601 * Return: The entry in the next slot which is possibly NULL
45724602 */
4573−static void *mas_next_slot(struct ma_state *mas, unsigned long max, bool empty)
4603+static void *mas_next_slot(struct ma_state *mas, unsigned long max, bool empty,
4604+ bool set_overflow)
45744605 {
45754606 void __rcu **slots;
45764607 unsigned long *pivots;
@@ -4589,22 +4620,22 @@ retry: · 12 unmodified lines
45894620 if (unlikely(mas_rewalk_if_dead(mas, node, save_point)))
45904621 goto retry;
45914622
4592−again:
45934623 if (mas->max >= max) {
45944624 if (likely(mas->offset < data_end))
45954625 pivot = pivots[mas->offset];
45964626 else
4597− return NULL; /* must be mas->max */
4627+ goto overflow;
45984628
45994629 if (unlikely(mas_rewalk_if_dead(mas, node, save_point)))
46004630 goto retry;
46014631
46024632 if (pivot >= max)
4603− return NULL;
4633+ goto overflow;
46044634 }
46054635
46064636 if (likely(mas->offset < data_end)) {
46074637 mas->index = pivots[mas->offset] + 1;
4638+again:
46084639 mas->offset++;
46094640 if (likely(mas->offset < data_end))
46104641 mas->last = pivots[mas->offset];
@@ -4616,8 +4647,11 @@ again: · 5 unmodified lines
46164647 goto retry;
46174648 }
46184649
4619− if (mas_is_none(mas))
4650+ if (WARN_ON_ONCE(mas_is_none(mas))) {
4651+ mas->node = MAS_OVERFLOW;
46204652 return NULL;
4653+ goto overflow;
4654+ }
46214655
46224656 mas->offset = 0;
46234657 mas->index = mas->min;
@@ -4636,12 +4670,20 @@ again: · 12 unmodified lines
46364670 return entry;
46374671
46384672 if (!empty) {
4639− if (!mas->offset)
4640− data_end = 2;
4673+ if (mas->last >= max)
4674+ goto overflow;
4675+
4676+ mas->index = mas->last + 1;
4677+ /* Node cannot end on NULL, so it's safe to short-cut here */
46414678 goto again;
46424679 }
46434680
46444681 return entry;
4682+
4683+overflow:
4684+ if (set_overflow)
4685+ mas->node = MAS_OVERFLOW;
4686+ return NULL;
46454687 }
46464688
46474689 /*
@@ -4651,17 +4693,20 @@ again: · 3 unmodified lines
46514693 *
46524694 * Set the @mas->node to the next entry and the range_start to
46534695 * the beginning value for the entry. Does not check beyond @limit.
4654− * Sets @mas->index and @mas->last to the limit if it is hit.
4696+ * Sets @mas->index and @mas->last to the range, Does not update @mas->index and
4697+ * @mas->last on overflow.
46554698 * Restarts on dead nodes.
46564699 *
46574700 * Return: the next entry or %NULL.
46584701 */
46594702 static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit)
46604703 {
4661− if (mas->last >= limit)
4704+ if (mas->last >= limit) {
4705+ mas->node = MAS_OVERFLOW;
46624706 return NULL;
4707+ }
46634708
4664− return mas_next_slot(mas, limit, false);
4709+ return mas_next_slot(mas, limit, false, true);
46654710 }
46664711
46674712 /*
@@ -4837,7 +4882,7 @@ void *mas_walk(struct ma_state *mas) · 169 unmodified lines
48374882 {
48384883 void *entry;
48394884
4840− if (mas_is_none(mas) || mas_is_paused(mas) || mas_is_ptr(mas))
4885+ if (!mas_is_active(mas) || !mas_is_start(mas))
48414886 mas->node = MAS_START;
48424887 retry:
48434888 entry = mas_state_walk(mas);
@@ -5294,14 +5339,22 @@ static inline void mte_destroy_walk(struct maple_enode *enode, · 450 unmodified lines
52945339
52955340 static void mas_wr_store_setup(struct ma_wr_state *wr_mas)
52965341 {
5297− if (mas_is_start(wr_mas->mas))
5298− return;
5342+ if (!mas_is_active(wr_mas->mas)) {
5343+ if (mas_is_start(wr_mas->mas))
5344+ return;
52995345
5300− if (unlikely(mas_is_paused(wr_mas->mas)))
5301− goto reset;
5346+ if (unlikely(mas_is_paused(wr_mas->mas)))
5347+ goto reset;
53025348
5303− if (unlikely(mas_is_none(wr_mas->mas)))
5304− goto reset;
5349+ if (unlikely(mas_is_none(wr_mas->mas)))
5350+ goto reset;
5351+
5352+ if (unlikely(mas_is_overflow(wr_mas->mas)))
5353+ goto reset;
5354+
5355+ if (unlikely(mas_is_underflow(wr_mas->mas)))
5356+ goto reset;
5357+ }
53055358
53065359 /*
53075360 * A less strict version of mas_is_span_wr() where we allow spanning
@@ -5595,8 +5648,25 @@ static inline bool mas_next_setup(struct ma_state *mas, unsigned long max, · 287 unmodified lines
55955648 {
55965649 bool was_none = mas_is_none(mas);
55975650
5598− if (mas_is_none(mas) || mas_is_paused(mas))
5651+ if (unlikely(mas->last >= max)) {
5652+ mas->node = MAS_OVERFLOW;
5653+ return true;
5654+ }
5655+
5656+ if (mas_is_active(mas))
5657+ return false;
5658+
5659+ if (mas_is_none(mas) || mas_is_paused(mas)) {
5660+ mas->node = MAS_START;
5661+ } else if (mas_is_overflow(mas)) {
5662+ /* Overflowed before, but the max changed */
55995663 mas->node = MAS_START;
5664+ } else if (mas_is_underflow(mas)) {
5665+ mas->node = MAS_START;
5666+ *entry = mas_walk(mas);
5667+ if (*entry)
5668+ return true;
5669+ }
56005670
56015671 if (mas_is_start(mas))
56025672 *entry = mas_walk(mas); /* Retries on dead nodes handled by mas_walk */
@@ -5615,6 +5685,7 @@ static inline bool mas_next_setup(struct ma_state *mas, unsigned long max, · 12 unmodified lines
56155685
56165686 if (mas_is_none(mas))
56175687 return true;
5688+
56185689 return false;
56195690 }
56205691
@@ -5637,7 +5708,7 @@ void *mas_next(struct ma_state *mas, unsigned long max) · 16 unmodified lines
56375708 return entry;
56385709
56395710 /* Retries on dead nodes handled by mas_next_slot */
5640− return mas_next_slot(mas, max, false);
5711+ return mas_next_slot(mas, max, false, true);
56415712 }
56425713 EXPORT_SYMBOL_GPL(mas_next);
56435714
@@ -5660,7 +5731,7 @@ void *mas_next_range(struct ma_state *mas, unsigned long max) · 16 unmodified lines
56605731 return entry;
56615732
56625733 /* Retries on dead nodes handled by mas_next_slot */
5663− return mas_next_slot(mas, max, true);
5734+ return mas_next_slot(mas, max, true, true);
56645735 }
56655736 EXPORT_SYMBOL_GPL(mas_next_range);
56665737
@@ -5691,18 +5762,31 @@ EXPORT_SYMBOL_GPL(mt_next); · 24 unmodified lines
56915762 static inline bool mas_prev_setup(struct ma_state *mas, unsigned long min,
56925763 void **entry)
56935764 {
5694− if (mas->index <= min)
5695− goto none;
5765+ if (unlikely(mas->index <= min)) {
5766+ mas->node = MAS_UNDERFLOW;
5767+ return true;
5768+ }
56965769
5697− if (mas_is_none(mas) || mas_is_paused(mas))
5770+ if (mas_is_active(mas))
5771+ return false;
5772+
5773+ if (mas_is_overflow(mas)) {
56985774 mas->node = MAS_START;
5775+ *entry = mas_walk(mas);
5776+ if (*entry)
5777+ return true;
5778+ }
56995779
5700− if (mas_is_start(mas)) {
5701− mas_walk(mas);
5702− if (!mas->index)
5703− goto none;
5780+ if (mas_is_none(mas) || mas_is_paused(mas)) {
5781+ mas->node = MAS_START;
5782+ } else if (mas_is_underflow(mas)) {
5783+ /* underflowed before but the min changed */
5784+ mas->node = MAS_START;
57045785 }
57055786
5787+ if (mas_is_start(mas))
5788+ mas_walk(mas);
5789+
57065790 if (unlikely(mas_is_ptr(mas))) {
57075791 if (!mas->index)
57085792 goto none;
@@ -5747,7 +5831,7 @@ void *mas_prev(struct ma_state *mas, unsigned long min) · 38 unmodified lines
57475831 if (mas_prev_setup(mas, min, &entry))
57485832 return entry;
57495833
5750− return mas_prev_slot(mas, min, false);
5834+ return mas_prev_slot(mas, min, false, true);
57515835 }
57525836 EXPORT_SYMBOL_GPL(mas_prev);
57535837
@@ -5770,7 +5854,7 @@ void *mas_prev_range(struct ma_state *mas, unsigned long min) · 16 unmodified lines
57705854 if (mas_prev_setup(mas, min, &entry))
57715855 return entry;
57725856
5773− return mas_prev_slot(mas, min, true);
5857+ return mas_prev_slot(mas, min, true, true);
57745858 }
57755859 EXPORT_SYMBOL_GPL(mas_prev_range);
57765860
@@ -5828,24 +5912,35 @@ EXPORT_SYMBOL_GPL(mas_pause); · 51 unmodified lines
58285912 static inline bool mas_find_setup(struct ma_state *mas, unsigned long max,
58295913 void **entry)
58305914 {
5831− *entry = NULL;
5915+ if (mas_is_active(mas)) {
5916+ if (mas->last < max)
5917+ return false;
58325918
5833− if (unlikely(mas_is_none(mas))) {
5919+ return true;
5920+ }
5921+
5922+ if (mas_is_paused(mas)) {
58345923 if (unlikely(mas->last >= max))
58355924 return true;
58365925
5837− mas->index = mas->last;
5926+ mas->index = ++mas->last;
58385927 mas->node = MAS_START;
5839− } else if (unlikely(mas_is_paused(mas))) {
5928+ } else if (mas_is_none(mas)) {
58405929 if (unlikely(mas->last >= max))
58415930 return true;
58425931
5932+ mas->index = mas->last;
58435933 mas->node = MAS_START;
5844− mas->index = ++mas->last;
5845− } else if (unlikely(mas_is_ptr(mas)))
5846− goto ptr_out_of_range;
5934+ } else if (mas_is_overflow(mas) || mas_is_underflow(mas)) {
5935+ if (mas->index > max) {
5936+ mas->node = MAS_OVERFLOW;
5937+ return true;
5938+ }
5939+
5940+ mas->node = MAS_START;
5941+ }
58475942
5848− if (unlikely(mas_is_start(mas))) {
5943+ if (mas_is_start(mas)) {
58495944 /* First run or continue */
58505945 if (mas->index > max)
58515946 return true;
@@ -5895,7 +5990,7 @@ void *mas_find(struct ma_state *mas, unsigned long max) · 43 unmodified lines
58955990 return entry;
58965991
58975992 /* Retries on dead nodes handled by mas_next_slot */
5898− return mas_next_slot(mas, max, false);
5993+ return mas_next_slot(mas, max, false, false);
58995994 }
59005995 EXPORT_SYMBOL_GPL(mas_find);
59015996
@@ -5913,13 +6008,13 @@ EXPORT_SYMBOL_GPL(mas_find); · 11 unmodified lines
59136008 */
59146009 void *mas_find_range(struct ma_state *mas, unsigned long max)
59156010 {
5916− void *entry;
6011+ void *entry = NULL;
59176012
59186013 if (mas_find_setup(mas, max, &entry))
59196014 return entry;
59206015
59216016 /* Retries on dead nodes handled by mas_next_slot */
5922− return mas_next_slot(mas, max, true);
6017+ return mas_next_slot(mas, max, true, false);
59236018 }
59246019 EXPORT_SYMBOL_GPL(mas_find_range);
59256020
@@ -5934,26 +6029,36 @@ EXPORT_SYMBOL_GPL(mas_find_range); · 8 unmodified lines
59346029 static inline bool mas_find_rev_setup(struct ma_state *mas, unsigned long min,
59356030 void **entry)
59366031 {
5937− *entry = NULL;
5938−
5939− if (unlikely(mas_is_none(mas))) {
5940− if (mas->index <= min)
5941− goto none;
6032+ if (mas_is_active(mas)) {
6033+ if (mas->index > min)
6034+ return false;
59426035
5943− mas->last = mas->index;
5944− mas->node = MAS_START;
6036+ return true;
59456037 }
59466038
5947− if (unlikely(mas_is_paused(mas))) {
6039+ if (mas_is_paused(mas)) {
59486040 if (unlikely(mas->index <= min)) {
59496041 mas->node = MAS_NONE;
59506042 return true;
59516043 }
59526044 mas->node = MAS_START;
59536045 mas->last = --mas->index;
6046+ } else if (mas_is_none(mas)) {
6047+ if (mas->index <= min)
6048+ goto none;
6049+
6050+ mas->last = mas->index;
6051+ mas->node = MAS_START;
6052+ } else if (mas_is_underflow(mas) || mas_is_overflow(mas)) {
6053+ if (mas->last <= min) {
6054+ mas->node = MAS_UNDERFLOW;
6055+ return true;
6056+ }
6057+
6058+ mas->node = MAS_START;
59546059 }
59556060
5956− if (unlikely(mas_is_start(mas))) {
6061+ if (mas_is_start(mas)) {
59576062 /* First run or continue */
59586063 if (mas->index < min)
59596064 return true;
@@ -6004,13 +6109,13 @@ none: · 44 unmodified lines
60046109 */
60056110 void *mas_find_rev(struct ma_state *mas, unsigned long min)
60066111 {
6007− void *entry;
6112+ void *entry = NULL;
60086113
60096114 if (mas_find_rev_setup(mas, min, &entry))
60106115 return entry;
60116116
60126117 /* Retries on dead nodes handled by mas_prev_slot */
6013− return mas_prev_slot(mas, min, false);
6118+ return mas_prev_slot(mas, min, false, false);
60146119
60156120 }
60166121 EXPORT_SYMBOL_GPL(mas_find_rev);
@@ -6030,13 +6135,13 @@ EXPORT_SYMBOL_GPL(mas_find_rev); · 13 unmodified lines
60306135 */
60316136 void *mas_find_range_rev(struct ma_state *mas, unsigned long min)
60326137 {
6033− void *entry;
6138+ void *entry = NULL;
60346139
60356140 if (mas_find_rev_setup(mas, min, &entry))
60366141 return entry;
60376142
60386143 /* Retries on dead nodes handled by mas_prev_slot */
6039− return mas_prev_slot(mas, min, true);
6144+ return mas_prev_slot(mas, min, true, false);
60406145 }
60416146 EXPORT_SYMBOL_GPL(mas_find_range_rev);
60426147
lib/scatterlist.c+3−1
@@ -265,7 +265,8 @@ EXPORT_SYMBOL(sg_free_table); · 264 unmodified lines
265265 * @table: The sg table header to use
266266 * @nents: Number of entries in sg list
267267 * @max_ents: The maximum number of entries the allocator returns per call
268− * @nents_first_chunk: Number of entries int the (preallocated) first
268+ * @first_chunk: first SGL if preallocated (may be %NULL)
269+ * @nents_first_chunk: Number of entries in the (preallocated) first
269270 * scatterlist chunk, 0 means no such preallocated chunk provided by user
270271 * @gfp_mask: GFP allocation mask
271272 * @alloc_fn: Allocator to use
@@ -788,6 +789,7 @@ EXPORT_SYMBOL(__sg_page_iter_dma_next); · 516 unmodified lines
788789 * @miter: sg mapping iter to be started
789790 * @sgl: sg list to iterate over
790791 * @nents: number of sg entries
792+ * @flags: sg iterator flags
791793 *
792794 * Description:
793795 * Starts mapping iterator @miter.
lib/test_maple_tree.c+72−15
@@ -2166,7 +2166,7 @@ static noinline void __init next_prev_test(struct maple_tree *mt) · 2165 unmodified lines
21662166 MT_BUG_ON(mt, val != NULL);
21672167 MT_BUG_ON(mt, mas.index != 0);
21682168 MT_BUG_ON(mt, mas.last != 5);
2169− MT_BUG_ON(mt, mas.node != MAS_NONE);
2169+ MT_BUG_ON(mt, mas.node != MAS_UNDERFLOW);
21702170
21712171 mas.index = 0;
21722172 mas.last = 5;
@@ -2917,6 +2917,7 @@ static noinline void __init check_empty_area_fill(struct maple_tree *mt) · 744 unmodified lines
29172917 * exists MAS_NONE active range
29182918 * exists active active range
29192919 * DNE active active set to last range
2920+ * ERANGE active MAS_OVERFLOW last range
29202921 *
29212922 * Function ENTRY Start Result index & last
29222923 * mas_prev()
@@ -2945,6 +2946,7 @@ static noinline void __init check_empty_area_fill(struct maple_tree *mt) · 22 unmodified lines
29452946 * any MAS_ROOT MAS_NONE 0
29462947 * exists active active range
29472948 * DNE active active last range
2949+ * ERANGE active MAS_UNDERFLOW last range
29482950 *
29492951 * Function ENTRY Start Result index & last
29502952 * mas_find()
@@ -2955,7 +2957,7 @@ static noinline void __init check_empty_area_fill(struct maple_tree *mt) · 4 unmodified lines
29552957 * DNE MAS_START MAS_NONE 0
29562958 * DNE MAS_PAUSE MAS_NONE 0
29572959 * DNE MAS_ROOT MAS_NONE 0
2958− * DNE MAS_NONE MAS_NONE 0
2960+ * DNE MAS_NONE MAS_NONE 1
29592961 * if index == 0
29602962 * exists MAS_START MAS_ROOT 0
29612963 * exists MAS_PAUSE MAS_ROOT 0
@@ -2967,7 +2969,7 @@ static noinline void __init check_empty_area_fill(struct maple_tree *mt) · 5 unmodified lines
29672969 * DNE MAS_START active set to max
29682970 * exists MAS_PAUSE active range
29692971 * DNE MAS_PAUSE active set to max
2970− * exists MAS_NONE active range
2972+ * exists MAS_NONE active range (start at last)
29712973 * exists active active range
29722974 * DNE active active last range (max < last)
29732975 *
@@ -2992,7 +2994,7 @@ static noinline void __init check_empty_area_fill(struct maple_tree *mt) · 18 unmodified lines
29922994 * DNE MAS_START active set to min
29932995 * exists MAS_PAUSE active range
29942996 * DNE MAS_PAUSE active set to min
2995− * exists MAS_NONE active range
2997+ * exists MAS_NONE active range (start at index)
29962998 * exists active active range
29972999 * DNE active active last range (min > index)
29983000 *
@@ -3039,10 +3041,10 @@ static noinline void __init check_state_handling(struct maple_tree *mt) · 40 unmodified lines
30393041 mtree_store_range(mt, 0, 0, ptr, GFP_KERNEL);
30403042
30413043 mas_lock(&mas);
3042− /* prev: Start -> none */
3044+ /* prev: Start -> underflow*/
30433045 entry = mas_prev(&mas, 0);
30443046 MT_BUG_ON(mt, entry != NULL);
3045− MT_BUG_ON(mt, mas.node != MAS_NONE);
3047+ MT_BUG_ON(mt, mas.node != MAS_UNDERFLOW);
30463048
30473049 /* prev: Start -> root */
30483050 mas_set(&mas, 10);
@@ -3069,7 +3071,7 @@ static noinline void __init check_state_handling(struct maple_tree *mt) · 20 unmodified lines
30693071 MT_BUG_ON(mt, entry != NULL);
30703072 MT_BUG_ON(mt, mas.node != MAS_NONE);
30713073
3072− /* next: start -> none */
3074+ /* next: start -> none*/
30733075 mas_set(&mas, 10);
30743076 entry = mas_next(&mas, ULONG_MAX);
30753077 MT_BUG_ON(mt, mas.index != 1);
@@ -3268,25 +3270,46 @@ static noinline void __init check_state_handling(struct maple_tree *mt) · 192 unmodified lines
32683270 MT_BUG_ON(mt, mas.last != 0x2500);
32693271 MT_BUG_ON(mt, !mas_active(mas));
32703272
3271− /* next:active -> active out of range*/
3273+ /* next:active -> active beyond data */
32723274 entry = mas_next(&mas, 0x2999);
32733275 MT_BUG_ON(mt, entry != NULL);
32743276 MT_BUG_ON(mt, mas.index != 0x2501);
32753277 MT_BUG_ON(mt, mas.last != 0x2fff);
32763278 MT_BUG_ON(mt, !mas_active(mas));
32773279
3278− /* Continue after out of range*/
3280+ /* Continue after last range ends after max */
32793281 entry = mas_next(&mas, ULONG_MAX);
32803282 MT_BUG_ON(mt, entry != ptr3);
32813283 MT_BUG_ON(mt, mas.index != 0x3000);
32823284 MT_BUG_ON(mt, mas.last != 0x3500);
32833285 MT_BUG_ON(mt, !mas_active(mas));
32843286
3285− /* next:active -> active out of range*/
3287+ /* next:active -> active continued */
3288+ entry = mas_next(&mas, ULONG_MAX);
3289+ MT_BUG_ON(mt, entry != NULL);
3290+ MT_BUG_ON(mt, mas.index != 0x3501);
3291+ MT_BUG_ON(mt, mas.last != ULONG_MAX);
3292+ MT_BUG_ON(mt, !mas_active(mas));
3293+
3294+ /* next:active -> overflow */
32863295 entry = mas_next(&mas, ULONG_MAX);
32873296 MT_BUG_ON(mt, entry != NULL);
32883297 MT_BUG_ON(mt, mas.index != 0x3501);
32893298 MT_BUG_ON(mt, mas.last != ULONG_MAX);
3299+ MT_BUG_ON(mt, mas.node != MAS_OVERFLOW);
3300+
3301+ /* next:overflow -> overflow */
3302+ entry = mas_next(&mas, ULONG_MAX);
3303+ MT_BUG_ON(mt, entry != NULL);
3304+ MT_BUG_ON(mt, mas.index != 0x3501);
3305+ MT_BUG_ON(mt, mas.last != ULONG_MAX);
3306+ MT_BUG_ON(mt, mas.node != MAS_OVERFLOW);
3307+
3308+ /* prev:overflow -> active */
3309+ entry = mas_prev(&mas, 0);
3310+ MT_BUG_ON(mt, entry != ptr3);
3311+ MT_BUG_ON(mt, mas.index != 0x3000);
3312+ MT_BUG_ON(mt, mas.last != 0x3500);
32903313 MT_BUG_ON(mt, !mas_active(mas));
32913314
32923315 /* next: none -> active, skip value at location */
@@ -3307,11 +3330,46 @@ static noinline void __init check_state_handling(struct maple_tree *mt) · 14 unmodified lines
33073330 MT_BUG_ON(mt, mas.last != 0x1500);
33083331 MT_BUG_ON(mt, !mas_active(mas));
33093332
3310− /* prev:active -> active out of range*/
3333+ /* prev:active -> active spanning end range */
3334+ entry = mas_prev(&mas, 0x0100);
3335+ MT_BUG_ON(mt, entry != NULL);
3336+ MT_BUG_ON(mt, mas.index != 0);
3337+ MT_BUG_ON(mt, mas.last != 0x0FFF);
3338+ MT_BUG_ON(mt, !mas_active(mas));
3339+
3340+ /* prev:active -> underflow */
3341+ entry = mas_prev(&mas, 0);
3342+ MT_BUG_ON(mt, entry != NULL);
3343+ MT_BUG_ON(mt, mas.index != 0);
3344+ MT_BUG_ON(mt, mas.last != 0x0FFF);
3345+ MT_BUG_ON(mt, mas.node != MAS_UNDERFLOW);
3346+
3347+ /* prev:underflow -> underflow */
33113348 entry = mas_prev(&mas, 0);
33123349 MT_BUG_ON(mt, entry != NULL);
33133350 MT_BUG_ON(mt, mas.index != 0);
33143351 MT_BUG_ON(mt, mas.last != 0x0FFF);
3352+ MT_BUG_ON(mt, mas.node != MAS_UNDERFLOW);
3353+
3354+ /* next:underflow -> active */
3355+ entry = mas_next(&mas, ULONG_MAX);
3356+ MT_BUG_ON(mt, entry != ptr);
3357+ MT_BUG_ON(mt, mas.index != 0x1000);
3358+ MT_BUG_ON(mt, mas.last != 0x1500);
3359+ MT_BUG_ON(mt, !mas_active(mas));
3360+
3361+ /* prev:first value -> underflow */
3362+ entry = mas_prev(&mas, 0x1000);
3363+ MT_BUG_ON(mt, entry != NULL);
3364+ MT_BUG_ON(mt, mas.index != 0x1000);
3365+ MT_BUG_ON(mt, mas.last != 0x1500);
3366+ MT_BUG_ON(mt, mas.node != MAS_UNDERFLOW);
3367+
3368+ /* find:underflow -> first value */
3369+ entry = mas_find(&mas, ULONG_MAX);
3370+ MT_BUG_ON(mt, entry != ptr);
3371+ MT_BUG_ON(mt, mas.index != 0x1000);
3372+ MT_BUG_ON(mt, mas.last != 0x1500);
33153373 MT_BUG_ON(mt, !mas_active(mas));
33163374
33173375 /* prev: pause ->active */
@@ -3325,14 +3383,14 @@ static noinline void __init check_state_handling(struct maple_tree *mt) · 7 unmodified lines
33253383 MT_BUG_ON(mt, mas.last != 0x2500);
33263384 MT_BUG_ON(mt, !mas_active(mas));
33273385
3328− /* prev:active -> active out of range*/
3386+ /* prev:active -> active spanning min */
33293387 entry = mas_prev(&mas, 0x1600);
33303388 MT_BUG_ON(mt, entry != NULL);
33313389 MT_BUG_ON(mt, mas.index != 0x1501);
33323390 MT_BUG_ON(mt, mas.last != 0x1FFF);
33333391 MT_BUG_ON(mt, !mas_active(mas));
33343392
3335− /* prev: active ->active, continue*/
3393+ /* prev: active ->active, continue */
33363394 entry = mas_prev(&mas, 0);
33373395 MT_BUG_ON(mt, entry != ptr);
33383396 MT_BUG_ON(mt, mas.index != 0x1000);
@@ -3379,7 +3437,7 @@ static noinline void __init check_state_handling(struct maple_tree *mt) · 40 unmodified lines
33793437 MT_BUG_ON(mt, mas.last != 0x2FFF);
33803438 MT_BUG_ON(mt, !mas_active(mas));
33813439
3382− /* find: none ->active */
3440+ /* find: overflow ->active */
33833441 entry = mas_find(&mas, 0x5000);
33843442 MT_BUG_ON(mt, entry != ptr3);
33853443 MT_BUG_ON(mt, mas.index != 0x3000);
@@ -3778,7 +3836,6 @@ static int __init maple_tree_seed(void) · 392 unmodified lines
37783836 check_empty_area_fill(&tree);
37793837 mtree_destroy(&tree);
37803838
3781−
37823839 mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE);
37833840 check_state_handling(&tree);
37843841 mtree_destroy(&tree);
mm/damon/vaddr-test.h+2−0
@@ -148,6 +148,8 @@ static void damon_do_test_apply_three_regions(struct kunit *test, · 147 unmodified lines
148148 KUNIT_EXPECT_EQ(test, r->ar.start, expected[i * 2]);
149149 KUNIT_EXPECT_EQ(test, r->ar.end, expected[i * 2 + 1]);
150150 }
151+
152+ damon_destroy_target(t);
151153 }
152154
153155 /*
mm/damon/vaddr.c+2−1
@@ -341,13 +341,14 @@ static void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm, · 340 unmodified lines
341341 bool referenced = false;
342342 pte_t entry = huge_ptep_get(pte);
343343 struct folio *folio = pfn_folio(pte_pfn(entry));
344+ unsigned long psize = huge_page_size(hstate_vma(vma));
344345
345346 folio_get(folio);
346347
347348 if (pte_young(entry)) {
348349 referenced = true;
349350 entry = pte_mkold(entry);
350− set_huge_pte_at(mm, addr, pte, entry);
351+ set_huge_pte_at(mm, addr, pte, entry, psize);
351352 }
352353
353354 #ifdef CONFIG_MMU_NOTIFIER
mm/filemap.c+50−23
@@ -3475,13 +3475,11 @@ skip: · 3474 unmodified lines
34753475 */
34763476 static vm_fault_t filemap_map_folio_range(struct vm_fault *vmf,
34773477 struct folio *folio, unsigned long start,
3478− unsigned long addr, unsigned int nr_pages)
3478+ unsigned long addr, unsigned int nr_pages,
3479+ unsigned int *mmap_miss)
34793480 {
34803481 vm_fault_t ret = 0;
3481− struct vm_area_struct *vma = vmf->vma;
3482− struct file *file = vma->vm_file;
34833482 struct page *page = folio_page(folio, start);
3484− unsigned int mmap_miss = READ_ONCE(file->f_ra.mmap_miss);
34853483 unsigned int count = 0;
34863484 pte_t *old_ptep = vmf->pte;
34873485
@@ -3489,8 +3487,7 @@ static vm_fault_t filemap_map_folio_range(struct vm_fault *vmf, · 1 unmodified line
34893487 if (PageHWPoison(page + count))
34903488 goto skip;
34913489
3492− if (mmap_miss > 0)
3493− mmap_miss--;
3490+ (*mmap_miss)++;
34943491
34953492 /*
34963493 * NOTE: If there're PTE markers, we'll leave them to be
@@ -3506,7 +3503,7 @@ skip: · 9 unmodified lines
35063503 if (count) {
35073504 set_pte_range(vmf, folio, page, count, addr);
35083505 folio_ref_add(folio, count);
3509− if (in_range(vmf->address, addr, count))
3506+ if (in_range(vmf->address, addr, count * PAGE_SIZE))
35103507 ret = VM_FAULT_NOPAGE;
35113508 }
35123509
@@ -3520,12 +3517,40 @@ skip: · 7 unmodified lines
35203517 if (count) {
35213518 set_pte_range(vmf, folio, page, count, addr);
35223519 folio_ref_add(folio, count);
3523− if (in_range(vmf->address, addr, count))
3520+ if (in_range(vmf->address, addr, count * PAGE_SIZE))
35243521 ret = VM_FAULT_NOPAGE;
35253522 }
35263523
35273524 vmf->pte = old_ptep;
3528− WRITE_ONCE(file->f_ra.mmap_miss, mmap_miss);
3525+
3526+ return ret;
3527+}
3528+
3529+static vm_fault_t filemap_map_order0_folio(struct vm_fault *vmf,
3530+ struct folio *folio, unsigned long addr,
3531+ unsigned int *mmap_miss)
3532+{
3533+ vm_fault_t ret = 0;
3534+ struct page *page = &folio->page;
3535+
3536+ if (PageHWPoison(page))
3537+ return ret;
3538+
3539+ (*mmap_miss)++;
3540+
3541+ /*
3542+ * NOTE: If there're PTE markers, we'll leave them to be
3543+ * handled in the specific fault path, and it'll prohibit
3544+ * the fault-around logic.
3545+ */
3546+ if (!pte_none(ptep_get(vmf->pte)))
3547+ return ret;
3548+
3549+ if (vmf->address == addr)
3550+ ret = VM_FAULT_NOPAGE;
3551+
3552+ set_pte_range(vmf, folio, page, 1, addr);
3553+ folio_ref_inc(folio);
35293554
35303555 return ret;
35313556 }
@@ -3541,7 +3566,7 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf, · 9 unmodified lines
35413566 XA_STATE(xas, &mapping->i_pages, start_pgoff);
35423567 struct folio *folio;
35433568 vm_fault_t ret = 0;
3544− int nr_pages = 0;
3569+ unsigned int nr_pages = 0, mmap_miss = 0, mmap_miss_saved;
35453570
35463571 rcu_read_lock();
35473572 folio = next_uptodate_folio(&xas, mapping, end_pgoff);
@@ -3569,25 +3594,27 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf, · 21 unmodified lines
35693594 end = folio->index + folio_nr_pages(folio) - 1;
35703595 nr_pages = min(end, end_pgoff) - xas.xa_index + 1;
35713596
3572− /*
3573− * NOTE: If there're PTE markers, we'll leave them to be
3574− * handled in the specific fault path, and it'll prohibit the
3575− * fault-around logic.
3576− */
3577− if (!pte_none(ptep_get(vmf->pte)))
3578− goto unlock;
3579−
3580− ret |= filemap_map_folio_range(vmf, folio,
3581− xas.xa_index - folio->index, addr, nr_pages);
3597+ if (!folio_test_large(folio))
3598+ ret |= filemap_map_order0_folio(vmf,
3599+ folio, addr, &mmap_miss);
3600+ else
3601+ ret |= filemap_map_folio_range(vmf, folio,
3602+ xas.xa_index - folio->index, addr,
3603+ nr_pages, &mmap_miss);
35823604
3583−unlock:
35843605 folio_unlock(folio);
35853606 folio_put(folio);
3586− folio = next_uptodate_folio(&xas, mapping, end_pgoff);
3587− } while (folio);
3607+ } while ((folio = next_uptodate_folio(&xas, mapping, end_pgoff)) != NULL);
35883608 pte_unmap_unlock(vmf->pte, vmf->ptl);
35893609 out:
35903610 rcu_read_unlock();
3611+
3612+ mmap_miss_saved = READ_ONCE(file->f_ra.mmap_miss);
3613+ if (mmap_miss >= mmap_miss_saved)
3614+ WRITE_ONCE(file->f_ra.mmap_miss, 0);
3615+ else
3616+ WRITE_ONCE(file->f_ra.mmap_miss, mmap_miss_saved - mmap_miss);
3617+
35913618 return ret;
35923619 }
35933620 EXPORT_SYMBOL(filemap_map_pages);
mm/hugetlb.c+24−19
@@ -4980,7 +4980,7 @@ static bool is_hugetlb_entry_hwpoisoned(pte_t pte) · 4979 unmodified lines
49804980
49814981 static void
49824982 hugetlb_install_folio(struct vm_area_struct *vma, pte_t *ptep, unsigned long addr,
4983− struct folio *new_folio, pte_t old)
4983+ struct folio *new_folio, pte_t old, unsigned long sz)
49844984 {
49854985 pte_t newpte = make_huge_pte(vma, &new_folio->page, 1);
49864986
@@ -4988,7 +4988,7 @@ hugetlb_install_folio(struct vm_area_struct *vma, pte_t *ptep, unsigned long add · 1 unmodified line
49884988 hugepage_add_new_anon_rmap(new_folio, vma, addr);
49894989 if (userfaultfd_wp(vma) && huge_pte_uffd_wp(old))
49904990 newpte = huge_pte_mkuffd_wp(newpte);
4991− set_huge_pte_at(vma->vm_mm, addr, ptep, newpte);
4991+ set_huge_pte_at(vma->vm_mm, addr, ptep, newpte, sz);
49924992 hugetlb_count_add(pages_per_huge_page(hstate_vma(vma)), vma->vm_mm);
49934993 folio_set_hugetlb_migratable(new_folio);
49944994 }
@@ -5065,7 +5065,7 @@ again: · 70 unmodified lines
50655065 } else if (unlikely(is_hugetlb_entry_hwpoisoned(entry))) {
50665066 if (!userfaultfd_wp(dst_vma))
50675067 entry = huge_pte_clear_uffd_wp(entry);
5068− set_huge_pte_at(dst, addr, dst_pte, entry);
5068+ set_huge_pte_at(dst, addr, dst_pte, entry, sz);
50695069 } else if (unlikely(is_hugetlb_entry_migration(entry))) {
50705070 swp_entry_t swp_entry = pte_to_swp_entry(entry);
50715071 bool uffd_wp = pte_swp_uffd_wp(entry);
@@ -5080,18 +5080,18 @@ again: · 8 unmodified lines
50805080 entry = swp_entry_to_pte(swp_entry);
50815081 if (userfaultfd_wp(src_vma) && uffd_wp)
50825082 entry = pte_swp_mkuffd_wp(entry);
5083− set_huge_pte_at(src, addr, src_pte, entry);
5083+ set_huge_pte_at(src, addr, src_pte, entry, sz);
50845084 }
50855085 if (!userfaultfd_wp(dst_vma))
50865086 entry = huge_pte_clear_uffd_wp(entry);
5087− set_huge_pte_at(dst, addr, dst_pte, entry);
5087+ set_huge_pte_at(dst, addr, dst_pte, entry, sz);
50885088 } else if (unlikely(is_pte_marker(entry))) {
50895089 pte_marker marker = copy_pte_marker(
50905090 pte_to_swp_entry(entry), dst_vma);
50915091
50925092 if (marker)
50935093 set_huge_pte_at(dst, addr, dst_pte,
5094− make_pte_marker(marker));
5094+ make_pte_marker(marker), sz);
50955095 } else {
50965096 entry = huge_ptep_get(src_pte);
50975097 pte_folio = page_folio(pte_page(entry));
@@ -5145,7 +5145,7 @@ again: · 47 unmodified lines
51455145 goto again;
51465146 }
51475147 hugetlb_install_folio(dst_vma, dst_pte, addr,
5148− new_folio, src_pte_old);
5148+ new_folio, src_pte_old, sz);
51495149 spin_unlock(src_ptl);
51505150 spin_unlock(dst_ptl);
51515151 continue;
@@ -5166,7 +5166,7 @@ again: · 14 unmodified lines
51665166 if (!userfaultfd_wp(dst_vma))
51675167 entry = huge_pte_clear_uffd_wp(entry);
51685168
5169− set_huge_pte_at(dst, addr, dst_pte, entry);
5169+ set_huge_pte_at(dst, addr, dst_pte, entry, sz);
51705170 hugetlb_count_add(npages, dst);
51715171 }
51725172 spin_unlock(src_ptl);
@@ -5184,7 +5184,8 @@ again: · 11 unmodified lines
51845184 }
51855185
51865186 static void move_huge_pte(struct vm_area_struct *vma, unsigned long old_addr,
5187− unsigned long new_addr, pte_t *src_pte, pte_t *dst_pte)
5187+ unsigned long new_addr, pte_t *src_pte, pte_t *dst_pte,
5188+ unsigned long sz)
51885189 {
51895190 struct hstate *h = hstate_vma(vma);
51905191 struct mm_struct *mm = vma->vm_mm;
@@ -5202,7 +5203,7 @@ static void move_huge_pte(struct vm_area_struct *vma, unsigned long old_addr, · 11 unmodified lines
52025203 spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
52035204
52045205 pte = huge_ptep_get_and_clear(mm, old_addr, src_pte);
5205− set_huge_pte_at(mm, new_addr, dst_pte, pte);
5206+ set_huge_pte_at(mm, new_addr, dst_pte, pte, sz);
52065207
52075208 if (src_ptl != dst_ptl)
52085209 spin_unlock(src_ptl);
@@ -5259,7 +5260,7 @@ int move_hugetlb_page_tables(struct vm_area_struct *vma, · 50 unmodified lines
52595260 if (!dst_pte)
52605261 break;
52615262
5262− move_huge_pte(vma, old_addr, new_addr, src_pte, dst_pte);
5263+ move_huge_pte(vma, old_addr, new_addr, src_pte, dst_pte, sz);
52635264 }
52645265
52655266 if (shared_pmd)
@@ -5337,7 +5338,8 @@ static void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct · 71 unmodified lines
53375338 if (pte_swp_uffd_wp_any(pte) &&
53385339 !(zap_flags & ZAP_FLAG_DROP_MARKER))
53395340 set_huge_pte_at(mm, address, ptep,
5340− make_pte_marker(PTE_MARKER_UFFD_WP));
5341+ make_pte_marker(PTE_MARKER_UFFD_WP),
5342+ sz);
53415343 else
53425344 huge_pte_clear(mm, address, ptep, sz);
53435345 spin_unlock(ptl);
@@ -5371,7 +5373,8 @@ static void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct · 27 unmodified lines
53715373 if (huge_pte_uffd_wp(pte) &&
53725374 !(zap_flags & ZAP_FLAG_DROP_MARKER))
53735375 set_huge_pte_at(mm, address, ptep,
5374− make_pte_marker(PTE_MARKER_UFFD_WP));
5376+ make_pte_marker(PTE_MARKER_UFFD_WP),
5377+ sz);
53755378 hugetlb_count_sub(pages_per_huge_page(h), mm);
53765379 page_remove_rmap(page, vma, true);
53775380
@@ -5676,7 +5679,7 @@ retry_avoidcopy: · 298 unmodified lines
56765679 hugepage_add_new_anon_rmap(new_folio, vma, haddr);
56775680 if (huge_pte_uffd_wp(pte))
56785681 newpte = huge_pte_mkuffd_wp(newpte);
5679− set_huge_pte_at(mm, haddr, ptep, newpte);
5682+ set_huge_pte_at(mm, haddr, ptep, newpte, huge_page_size(h));
56805683 folio_set_hugetlb_migratable(new_folio);
56815684 /* Make the old page be freed below */
56825685 new_folio = old_folio;
@@ -5972,7 +5975,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, · 289 unmodified lines
59725975 */
59735976 if (unlikely(pte_marker_uffd_wp(old_pte)))
59745977 new_pte = huge_pte_mkuffd_wp(new_pte);
5975− set_huge_pte_at(mm, haddr, ptep, new_pte);
5978+ set_huge_pte_at(mm, haddr, ptep, new_pte, huge_page_size(h));
59765979
59775980 hugetlb_count_add(pages_per_huge_page(h), mm);
59785981 if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) {
@@ -6261,7 +6264,8 @@ int hugetlb_mfill_atomic_pte(pte_t *dst_pte, · 282 unmodified lines
62616264 }
62626265
62636266 _dst_pte = make_pte_marker(PTE_MARKER_POISONED);
6264− set_huge_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte);
6267+ set_huge_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte,
6268+ huge_page_size(h));
62656269
62666270 /* No need to invalidate - it was non-present before */
62676271 update_mmu_cache(dst_vma, dst_addr, dst_pte);
@@ -6412,7 +6416,7 @@ int hugetlb_mfill_atomic_pte(pte_t *dst_pte, · 144 unmodified lines
64126416 if (wp_enabled)
64136417 _dst_pte = huge_pte_mkuffd_wp(_dst_pte);
64146418
6415− set_huge_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte);
6419+ set_huge_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte, huge_page_size(h));
64166420
64176421 hugetlb_count_add(pages_per_huge_page(h), dst_mm);
64186422
@@ -6598,7 +6602,7 @@ long hugetlb_change_protection(struct vm_area_struct *vma, · 179 unmodified lines
65986602 else if (uffd_wp_resolve)
65996603 newpte = pte_swp_clear_uffd_wp(newpte);
66006604 if (!pte_same(pte, newpte))
6601− set_huge_pte_at(mm, address, ptep, newpte);
6605+ set_huge_pte_at(mm, address, ptep, newpte, psize);
66026606 } else if (unlikely(is_pte_marker(pte))) {
66036607 /* No other markers apply for now. */
66046608 WARN_ON_ONCE(!pte_marker_uffd_wp(pte));
@@ -6623,7 +6627,8 @@ long hugetlb_change_protection(struct vm_area_struct *vma, · 18 unmodified lines
66236627 if (unlikely(uffd_wp))
66246628 /* Safe to modify directly (none->non-present). */
66256629 set_huge_pte_at(mm, address, ptep,
6626− make_pte_marker(PTE_MARKER_UFFD_WP));
6630+ make_pte_marker(PTE_MARKER_UFFD_WP),
6631+ psize);
66276632 }
66286633 spin_unlock(ptl);
66296634 }
mm/kasan/kasan.h+3−5
@@ -291,7 +291,7 @@ struct kasan_stack_ring { · 290 unmodified lines
291291
292292 #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
293293
294−#ifndef __HAVE_ARCH_SHADOW_MAP
294+#ifndef kasan_shadow_to_mem
295295 static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
296296 {
297297 return (void *)(((unsigned long)shadow_addr - KASAN_SHADOW_OFFSET)
@@ -299,15 +299,13 @@ static inline const void *kasan_shadow_to_mem(const void *shadow_addr) · 1 unmodified line
299299 }
300300 #endif
301301
302+#ifndef addr_has_metadata
302303 static __always_inline bool addr_has_metadata(const void *addr)
303304 {
304−#ifdef __HAVE_ARCH_SHADOW_MAP
305− return (kasan_mem_to_shadow((void *)addr) != NULL);
306−#else
307305 return (kasan_reset_tag(addr) >=
308306 kasan_shadow_to_mem((void *)KASAN_SHADOW_START));
309−#endif
310307 }
308+#endif
311309
312310 /**
313311 * kasan_check_range - Check memory region, and report if invalid access.
mm/memcontrol.c+16−3
@@ -2555,7 +2555,7 @@ static unsigned long calculate_high_delay(struct mem_cgroup *memcg, · 2554 unmodified lines
25552555 * Scheduled by try_charge() to be executed from the userland return path
25562556 * and reclaims memory over the high limit.
25572557 */
2558−void mem_cgroup_handle_over_high(void)
2558+void mem_cgroup_handle_over_high(gfp_t gfp_mask)
25592559 {
25602560 unsigned long penalty_jiffies;
25612561 unsigned long pflags;
@@ -2583,7 +2583,7 @@ retry_reclaim: · 21 unmodified lines
25832583 */
25842584 nr_reclaimed = reclaim_high(memcg,
25852585 in_retry ? SWAP_CLUSTER_MAX : nr_pages,
2586− GFP_KERNEL);
2586+ gfp_mask);
25872587
25882588 /*
25892589 * memory.high is breached and reclaim is unable to keep up. Throttle
@@ -2819,7 +2819,7 @@ done_restock: · 229 unmodified lines
28192819 if (current->memcg_nr_pages_over_high > MEMCG_CHARGE_BATCH &&
28202820 !(current->flags & PF_MEMALLOC) &&
28212821 gfpflags_allow_blocking(gfp_mask)) {
2822− mem_cgroup_handle_over_high();
2822+ mem_cgroup_handle_over_high(gfp_mask);
28232823 }
28242824 return 0;
28252825 }
@@ -3867,6 +3867,13 @@ static ssize_t mem_cgroup_write(struct kernfs_open_file *of, · 1041 unmodified lines
38673867 case _MEMSWAP:
38683868 ret = mem_cgroup_resize_max(memcg, nr_pages, true);
38693869 break;
3870+ case _KMEM:
3871+ pr_warn_once("kmem.limit_in_bytes is deprecated and will be removed. "
3872+ "Writing any value to this file has no effect. "
3873+ "Please report your usecase to linux-mm@kvack.org if you "
3874+ "depend on this functionality.\n");
3875+ ret = 0;
3876+ break;
38703877 case _TCP:
38713878 ret = memcg_update_tcp_max(memcg, nr_pages);
38723879 break;
@@ -5077,6 +5084,12 @@ static struct cftype mem_cgroup_legacy_files[] = { · 1204 unmodified lines
50775084 .seq_show = memcg_numa_stat_show,
50785085 },
50795086 #endif
5087+ {
5088+ .name = "kmem.limit_in_bytes",
5089+ .private = MEMFILE_PRIVATE(_KMEM, RES_LIMIT),
5090+ .write = mem_cgroup_write,
5091+ .read_u64 = mem_cgroup_read_u64,
5092+ },
50805093 {
50815094 .name = "kmem.usage_in_bytes",
50825095 .private = MEMFILE_PRIVATE(_KMEM, RES_USAGE),
mm/mempolicy.c+19−20
@@ -426,6 +426,7 @@ struct queue_pages { · 425 unmodified lines
426426 unsigned long start;
427427 unsigned long end;
428428 struct vm_area_struct *first;
429+ bool has_unmovable;
429430 };
430431
431432 /*
@@ -446,9 +447,8 @@ static inline bool queue_folio_required(struct folio *folio, · 14 unmodified lines
446447 /*
447448 * queue_folios_pmd() has three possible return values:
448449 * 0 - folios are placed on the right node or queued successfully, or
449− * special page is met, i.e. huge zero page.
450− * 1 - there is unmovable folio, and MPOL_MF_MOVE* & MPOL_MF_STRICT were
451− * specified.
450+ * special page is met, i.e. zero page, or unmovable page is found
451+ * but continue walking (indicated by queue_pages.has_unmovable).
452452 * -EIO - is migration entry or only MPOL_MF_STRICT was specified and an
453453 * existing folio was already on a node that does not follow the
454454 * policy.
@@ -479,7 +479,7 @@ static int queue_folios_pmd(pmd_t *pmd, spinlock_t *ptl, unsigned long addr, · 24 unmodified lines
479479 if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) {
480480 if (!vma_migratable(walk->vma) ||
481481 migrate_folio_add(folio, qp->pagelist, flags)) {
482− ret = 1;
482+ qp->has_unmovable = true;
483483 goto unlock;
484484 }
485485 } else
@@ -495,9 +495,8 @@ unlock: · 9 unmodified lines
495495 *
496496 * queue_folios_pte_range() has three possible return values:
497497 * 0 - folios are placed on the right node or queued successfully, or
498− * special page is met, i.e. zero page.
499− * 1 - there is unmovable folio, and MPOL_MF_MOVE* & MPOL_MF_STRICT were
500− * specified.
498+ * special page is met, i.e. zero page, or unmovable page is found
499+ * but continue walking (indicated by queue_pages.has_unmovable).
501500 * -EIO - only MPOL_MF_STRICT was specified and an existing folio was already
502501 * on a node that does not follow the policy.
503502 */
@@ -508,7 +507,6 @@ static int queue_folios_pte_range(pmd_t *pmd, unsigned long addr, · 4 unmodified lines
508507 struct folio *folio;
509508 struct queue_pages *qp = walk->private;
510509 unsigned long flags = qp->flags;
511− bool has_unmovable = false;
512510 pte_t *pte, *mapped_pte;
513511 pte_t ptent;
514512 spinlock_t *ptl;
@@ -538,11 +536,12 @@ static int queue_folios_pte_range(pmd_t *pmd, unsigned long addr, · 23 unmodified lines
538536 if (!queue_folio_required(folio, qp))
539537 continue;
540538 if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) {
541− /* MPOL_MF_STRICT must be specified if we get here */
542− if (!vma_migratable(vma)) {
543− has_unmovable = true;
544− break;
545− }
539+ /*
540+ * MPOL_MF_STRICT must be specified if we get here.
541+ * Continue walking vmas due to MPOL_MF_MOVE* flags.
542+ */
543+ if (!vma_migratable(vma))
544+ qp->has_unmovable = true;
546545
547546 /*
548547 * Do not abort immediately since there may be
@@ -550,16 +549,13 @@ static int queue_folios_pte_range(pmd_t *pmd, unsigned long addr, · 1 unmodified line
550549 * need migrate other LRU pages.
551550 */
552551 if (migrate_folio_add(folio, qp->pagelist, flags))
553− has_unmovable = true;
552+ qp->has_unmovable = true;
554553 } else
555554 break;
556555 }
557556 pte_unmap_unlock(mapped_pte, ptl);
558557 cond_resched();
559558
560− if (has_unmovable)
561− return 1;
562−
563559 return addr != end ? -EIO : 0;
564560 }
565561
@@ -599,7 +595,7 @@ static int queue_folios_hugetlb(pte_t *pte, unsigned long hmask, · 33 unmodified lines
599595 * Detecting misplaced folio but allow migrating folios which
600596 * have been queued.
601597 */
602− ret = 1;
598+ qp->has_unmovable = true;
603599 goto unlock;
604600 }
605601
@@ -620,7 +616,7 @@ static int queue_folios_hugetlb(pte_t *pte, unsigned long hmask, · 14 unmodified lines
620616 * Failed to isolate folio but allow migrating pages
621617 * which have been queued.
622618 */
623− ret = 1;
619+ qp->has_unmovable = true;
624620 }
625621 unlock:
626622 spin_unlock(ptl);
@@ -756,12 +752,15 @@ queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end, · 129 unmodified lines
756752 .start = start,
757753 .end = end,
758754 .first = NULL,
755+ .has_unmovable = false,
759756 };
760757 const struct mm_walk_ops *ops = lock_vma ?
761758 &queue_pages_lock_vma_walk_ops : &queue_pages_walk_ops;
762759
763760 err = walk_page_range(mm, start, end, ops, &qp);
764761
762+ if (qp.has_unmovable)
763+ err = 1;
765764 if (!qp.first)
766765 /* whole range in hole */
767766 err = -EFAULT;
@@ -1358,7 +1357,7 @@ static long do_mbind(unsigned long start, unsigned long len, · 590 unmodified lines
13581357 putback_movable_pages(&pagelist);
13591358 }
13601359
1361− if ((ret > 0) || (nr_failed && (flags & MPOL_MF_STRICT)))
1360+ if (((ret > 0) || nr_failed) && (flags & MPOL_MF_STRICT))
13621361 err = -EIO;
13631362 } else {
13641363 up_out:
mm/migrate.c+5−2
@@ -243,7 +243,9 @@ static bool remove_migration_pte(struct folio *folio, · 242 unmodified lines
243243
244244 #ifdef CONFIG_HUGETLB_PAGE
245245 if (folio_test_hugetlb(folio)) {
246− unsigned int shift = huge_page_shift(hstate_vma(vma));
246+ struct hstate *h = hstate_vma(vma);
247+ unsigned int shift = huge_page_shift(h);
248+ unsigned long psize = huge_page_size(h);
247249
248250 pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
249251 if (folio_test_anon(folio))
@@ -251,7 +253,8 @@ static bool remove_migration_pte(struct folio *folio, · 1 unmodified line
251253 rmap_flags);
252254 else
253255 page_dup_file_rmap(new, true);
254− set_huge_pte_at(vma->vm_mm, pvmw.address, pvmw.pte, pte);
256+ set_huge_pte_at(vma->vm_mm, pvmw.address, pvmw.pte, pte,
257+ psize);
255258 } else
256259 #endif
257260 {
mm/page_alloc.c+6−6
@@ -2400,7 +2400,7 @@ void free_unref_page(struct page *page, unsigned int order) · 2399 unmodified lines
24002400 struct per_cpu_pages *pcp;
24012401 struct zone *zone;
24022402 unsigned long pfn = page_to_pfn(page);
2403− int migratetype;
2403+ int migratetype, pcpmigratetype;
24042404
24052405 if (!free_unref_page_prepare(page, pfn, order))
24062406 return;
@@ -2408,24 +2408,24 @@ void free_unref_page(struct page *page, unsigned int order) · 1 unmodified line
24082408 /*
24092409 * We only track unmovable, reclaimable and movable on pcp lists.
24102410 * Place ISOLATE pages on the isolated list because they are being
2411− * offlined but treat HIGHATOMIC as movable pages so we can get those
2412− * areas back if necessary. Otherwise, we may have to free
2411+ * offlined but treat HIGHATOMIC and CMA as movable pages so we can
2412+ * get those areas back if necessary. Otherwise, we may have to free
24132413 * excessively into the page allocator
24142414 */
2415− migratetype = get_pcppage_migratetype(page);
2415+ migratetype = pcpmigratetype = get_pcppage_migratetype(page);
24162416 if (unlikely(migratetype >= MIGRATE_PCPTYPES)) {
24172417 if (unlikely(is_migrate_isolate(migratetype))) {
24182418 free_one_page(page_zone(page), page, pfn, order, migratetype, FPI_NONE);
24192419 return;
24202420 }
2421− migratetype = MIGRATE_MOVABLE;
2421+ pcpmigratetype = MIGRATE_MOVABLE;
24222422 }
24232423
24242424 zone = page_zone(page);
24252425 pcp_trylock_prepare(UP_flags);
24262426 pcp = pcp_spin_trylock(zone->per_cpu_pageset);
24272427 if (pcp) {
2428− free_unref_page_commit(zone, pcp, page, migratetype, order);
2428+ free_unref_page_commit(zone, pcp, page, pcpmigratetype, order);
24292429 pcp_spin_unlock(pcp);
24302430 } else {
24312431 free_one_page(zone, page, pfn, order, migratetype, FPI_NONE);
mm/rmap.c+18−5
@@ -1480,6 +1480,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, · 1479 unmodified lines
14801480 struct mmu_notifier_range range;
14811481 enum ttu_flags flags = (enum ttu_flags)(long)arg;
14821482 unsigned long pfn;
1483+ unsigned long hsz = 0;
14831484
14841485 /*
14851486 * When racing against e.g. zap_pte_range() on another cpu,
@@ -1511,6 +1512,9 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, · 25 unmodified lines
15111512 */
15121513 adjust_range_if_pmd_sharing_possible(vma, &range.start,
15131514 &range.end);
1515+
1516+ /* We need the huge page size for set_huge_pte_at() */
1517+ hsz = huge_page_size(hstate_vma(vma));
15141518 }
15151519 mmu_notifier_invalidate_range_start(&range);
15161520
@@ -1628,7 +1632,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, · 111 unmodified lines
16281632 pteval = swp_entry_to_pte(make_hwpoison_entry(subpage));
16291633 if (folio_test_hugetlb(folio)) {
16301634 hugetlb_count_sub(folio_nr_pages(folio), mm);
1631− set_huge_pte_at(mm, address, pvmw.pte, pteval);
1635+ set_huge_pte_at(mm, address, pvmw.pte, pteval,
1636+ hsz);
16321637 } else {
16331638 dec_mm_counter(mm, mm_counter(&folio->page));
16341639 set_pte_at(mm, address, pvmw.pte, pteval);
@@ -1820,6 +1825,7 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, · 185 unmodified lines
18201825 struct mmu_notifier_range range;
18211826 enum ttu_flags flags = (enum ttu_flags)(long)arg;
18221827 unsigned long pfn;
1828+ unsigned long hsz = 0;
18231829
18241830 /*
18251831 * When racing against e.g. zap_pte_range() on another cpu,
@@ -1855,6 +1861,9 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, · 29 unmodified lines
18551861 */
18561862 adjust_range_if_pmd_sharing_possible(vma, &range.start,
18571863 &range.end);
1864+
1865+ /* We need the huge page size for set_huge_pte_at() */
1866+ hsz = huge_page_size(hstate_vma(vma));
18581867 }
18591868 mmu_notifier_invalidate_range_start(&range);
18601869
@@ -2020,7 +2029,8 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, · 159 unmodified lines
20202029 pteval = swp_entry_to_pte(make_hwpoison_entry(subpage));
20212030 if (folio_test_hugetlb(folio)) {
20222031 hugetlb_count_sub(folio_nr_pages(folio), mm);
2023− set_huge_pte_at(mm, address, pvmw.pte, pteval);
2032+ set_huge_pte_at(mm, address, pvmw.pte, pteval,
2033+ hsz);
20242034 } else {
20252035 dec_mm_counter(mm, mm_counter(&folio->page));
20262036 set_pte_at(mm, address, pvmw.pte, pteval);
@@ -2044,7 +2054,8 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, · 17 unmodified lines
20442054
20452055 if (arch_unmap_one(mm, vma, address, pteval) < 0) {
20462056 if (folio_test_hugetlb(folio))
2047− set_huge_pte_at(mm, address, pvmw.pte, pteval);
2057+ set_huge_pte_at(mm, address, pvmw.pte,
2058+ pteval, hsz);
20482059 else
20492060 set_pte_at(mm, address, pvmw.pte, pteval);
20502061 ret = false;
@@ -2058,7 +2069,8 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, · 7 unmodified lines
20582069 if (anon_exclusive &&
20592070 page_try_share_anon_rmap(subpage)) {
20602071 if (folio_test_hugetlb(folio))
2061− set_huge_pte_at(mm, address, pvmw.pte, pteval);
2072+ set_huge_pte_at(mm, address, pvmw.pte,
2073+ pteval, hsz);
20622074 else
20632075 set_pte_at(mm, address, pvmw.pte, pteval);
20642076 ret = false;
@@ -2090,7 +2102,8 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, · 25 unmodified lines
20902102 if (pte_uffd_wp(pteval))
20912103 swp_pte = pte_swp_mkuffd_wp(swp_pte);
20922104 if (folio_test_hugetlb(folio))
2093− set_huge_pte_at(mm, address, pvmw.pte, swp_pte);
2105+ set_huge_pte_at(mm, address, pvmw.pte, swp_pte,
2106+ hsz);
20942107 else
20952108 set_pte_at(mm, address, pvmw.pte, swp_pte);
20962109 trace_set_migration_pte(address, pte_val(swp_pte),
mm/slab_common.c+18−18
@@ -479,7 +479,7 @@ void slab_kmem_cache_release(struct kmem_cache *s) · 478 unmodified lines
479479
480480 void kmem_cache_destroy(struct kmem_cache *s)
481481 {
482− int refcnt;
482+ int err = -EBUSY;
483483 bool rcu_set;
484484
485485 if (unlikely(!s) || !kasan_check_byte(s))
@@ -490,17 +490,17 @@ void kmem_cache_destroy(struct kmem_cache *s) · 4 unmodified lines
490490
491491 rcu_set = s->flags & SLAB_TYPESAFE_BY_RCU;
492492
493− refcnt = --s->refcount;
494− if (refcnt)
493+ s->refcount--;
494+ if (s->refcount)
495495 goto out_unlock;
496496
497− WARN(shutdown_cache(s),
498− "%s %s: Slab cache still has objects when called from %pS",
497+ err = shutdown_cache(s);
498+ WARN(err, "%s %s: Slab cache still has objects when called from %pS",
499499 __func__, s->name, (void *)_RET_IP_);
500500 out_unlock:
501501 mutex_unlock(&slab_mutex);
502502 cpus_read_unlock();
503− if (!refcnt && !rcu_set)
503+ if (!err && !rcu_set)
504504 kmem_cache_release(s);
505505 }
506506 EXPORT_SYMBOL(kmem_cache_destroy);
@@ -745,24 +745,24 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags, unsigned long caller) · 238 unmodified lines
745745
746746 size_t kmalloc_size_roundup(size_t size)
747747 {
748− struct kmem_cache *c;
748+ if (size && size <= KMALLOC_MAX_CACHE_SIZE) {
749+ /*
750+ * The flags don't matter since size_index is common to all.
751+ * Neither does the caller for just getting ->object_size.
752+ */
753+ return kmalloc_slab(size, GFP_KERNEL, 0)->object_size;
754+ }
749755
750− /* Short-circuit the 0 size case. */
751− if (unlikely(size == 0))
752− return 0;
753− /* Short-circuit saturated "too-large" case. */
754− if (unlikely(size == SIZE_MAX))
755− return SIZE_MAX;
756756 /* Above the smaller buckets, size is a multiple of page size. */
757− if (size > KMALLOC_MAX_CACHE_SIZE)
757+ if (size && size <= KMALLOC_MAX_SIZE)
758758 return PAGE_SIZE << get_order(size);
759759
760760 /*
761− * The flags don't matter since size_index is common to all.
762− * Neither does the caller for just getting ->object_size.
761+ * Return 'size' for 0 - kmalloc() returns ZERO_SIZE_PTR
762+ * and very large size - kmalloc() may fail.
763763 */
764− c = kmalloc_slab(size, GFP_KERNEL, 0);
765− return c ? c->object_size : 0;
764+ return size;
765+
766766 }
767767 EXPORT_SYMBOL(kmalloc_size_roundup);
768768
mm/vmalloc.c+1−1
@@ -111,7 +111,7 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, · 110 unmodified lines
111111 pte_t entry = pfn_pte(pfn, prot);
112112
113113 entry = arch_make_huge_pte(entry, ilog2(size), 0);
114− set_huge_pte_at(&init_mm, addr, pte, entry);
114+ set_huge_pte_at(&init_mm, addr, pte, entry, size);
115115 pfn += PFN_DOWN(size);
116116 continue;
117117 }
mm/zswap.c+20−0
@@ -1218,6 +1218,19 @@ bool zswap_store(struct folio *folio) · 1217 unmodified lines
12181218 if (!zswap_enabled || !tree)
12191219 return false;
12201220
1221+ /*
1222+ * If this is a duplicate, it must be removed before attempting to store
1223+ * it, otherwise, if the store fails the old page won't be removed from
1224+ * the tree, and it might be written back overriding the new data.
1225+ */
1226+ spin_lock(&tree->lock);
1227+ dupentry = zswap_rb_search(&tree->rbroot, offset);
1228+ if (dupentry) {
1229+ zswap_duplicate_entry++;
1230+ zswap_invalidate_entry(tree, dupentry);
1231+ }
1232+ spin_unlock(&tree->lock);
1233+
12211234 /*
12221235 * XXX: zswap reclaim does not work with cgroups yet. Without a
12231236 * cgroup-aware entry LRU, we will push out entries system-wide based on
@@ -1333,7 +1346,14 @@ insert_entry: · 109 unmodified lines
13331346
13341347 /* map */
13351348 spin_lock(&tree->lock);
1349+ /*
1350+ * A duplicate entry should have been removed at the beginning of this
1351+ * function. Since the swap entry should be pinned, if a duplicate is
1352+ * found again here it means that something went wrong in the swap
1353+ * cache.
1354+ */
13361355 while (zswap_rb_insert(&tree->rbroot, entry, &dupentry) == -EEXIST) {
1356+ WARN_ON(1);
13371357 zswap_duplicate_entry++;
13381358 zswap_invalidate_entry(tree, dupentry);
13391359 }
net/bluetooth/hci_conn.c+35−28
@@ -2413,34 +2413,41 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type, · 2412 unmodified lines
24132413 if (!test_bit(HCI_CONN_AUTH, &conn->flags))
24142414 goto auth;
24152415
2416− /* An authenticated FIPS approved combination key has sufficient
2417− * security for security level 4. */
2418− if (conn->key_type == HCI_LK_AUTH_COMBINATION_P256 &&
2419− sec_level == BT_SECURITY_FIPS)
2420− goto encrypt;
2421−
2422− /* An authenticated combination key has sufficient security for
2423− security level 3. */
2424− if ((conn->key_type == HCI_LK_AUTH_COMBINATION_P192 ||
2425− conn->key_type == HCI_LK_AUTH_COMBINATION_P256) &&
2426− sec_level == BT_SECURITY_HIGH)
2427− goto encrypt;
2428−
2429− /* An unauthenticated combination key has sufficient security for
2430− security level 1 and 2. */
2431− if ((conn->key_type == HCI_LK_UNAUTH_COMBINATION_P192 ||
2432− conn->key_type == HCI_LK_UNAUTH_COMBINATION_P256) &&
2433− (sec_level == BT_SECURITY_MEDIUM || sec_level == BT_SECURITY_LOW))
2434− goto encrypt;
2435−
2436− /* A combination key has always sufficient security for the security
2437− levels 1 or 2. High security level requires the combination key
2438− is generated using maximum PIN code length (16).
2439− For pre 2.1 units. */
2440− if (conn->key_type == HCI_LK_COMBINATION &&
2441− (sec_level == BT_SECURITY_MEDIUM || sec_level == BT_SECURITY_LOW ||
2442− conn->pin_length == 16))
2443− goto encrypt;
2416+ switch (conn->key_type) {
2417+ case HCI_LK_AUTH_COMBINATION_P256:
2418+ /* An authenticated FIPS approved combination key has
2419+ * sufficient security for security level 4 or lower.
2420+ */
2421+ if (sec_level <= BT_SECURITY_FIPS)
2422+ goto encrypt;
2423+ break;
2424+ case HCI_LK_AUTH_COMBINATION_P192:
2425+ /* An authenticated combination key has sufficient security for
2426+ * security level 3 or lower.
2427+ */
2428+ if (sec_level <= BT_SECURITY_HIGH)
2429+ goto encrypt;
2430+ break;
2431+ case HCI_LK_UNAUTH_COMBINATION_P192:
2432+ case HCI_LK_UNAUTH_COMBINATION_P256:
2433+ /* An unauthenticated combination key has sufficient security
2434+ * for security level 2 or lower.
2435+ */
2436+ if (sec_level <= BT_SECURITY_MEDIUM)
2437+ goto encrypt;
2438+ break;
2439+ case HCI_LK_COMBINATION:
2440+ /* A combination key has always sufficient security for the
2441+ * security levels 2 or lower. High security level requires the
2442+ * combination key is generated using maximum PIN code length
2443+ * (16). For pre 2.1 units.
2444+ */
2445+ if (sec_level <= BT_SECURITY_MEDIUM || conn->pin_length == 16)
2446+ goto encrypt;
2447+ break;
2448+ default:
2449+ break;
2450+ }
24442451
24452452 auth:
24462453 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
net/bluetooth/hci_core.c+11−3
@@ -2617,7 +2617,11 @@ int hci_register_dev(struct hci_dev *hdev) · 2616 unmodified lines
26172617 if (id < 0)
26182618 return id;
26192619
2620− snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
2620+ error = dev_set_name(&hdev->dev, "hci%u", id);
2621+ if (error)
2622+ return error;
2623+
2624+ hdev->name = dev_name(&hdev->dev);
26212625 hdev->id = id;
26222626
26232627 BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
@@ -2639,8 +2643,6 @@ int hci_register_dev(struct hci_dev *hdev) · 15 unmodified lines
26392643 if (!IS_ERR_OR_NULL(bt_debugfs))
26402644 hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs);
26412645
2642− dev_set_name(&hdev->dev, "%s", hdev->name);
2643−
26442646 error = device_add(&hdev->dev);
26452647 if (error < 0)
26462648 goto err_wqueue;
@@ -2784,6 +2786,7 @@ void hci_release_dev(struct hci_dev *hdev) · 137 unmodified lines
27842786 hci_conn_params_clear_all(hdev);
27852787 hci_discovery_filter_clear(hdev);
27862788 hci_blocked_keys_clear(hdev);
2789+ hci_codec_list_clear(&hdev->local_codecs);
27872790 hci_dev_unlock(hdev);
27882791
27892792 ida_simple_remove(&hci_index_ida, hdev->id);
@@ -3418,7 +3421,12 @@ static void hci_link_tx_to(struct hci_dev *hdev, __u8 type) · 628 unmodified lines
34183421 if (c->type == type && c->sent) {
34193422 bt_dev_err(hdev, "killing stalled connection %pMR",
34203423 &c->dst);
3424+ /* hci_disconnect might sleep, so, we have to release
3425+ * the RCU read lock before calling it.
3426+ */
3427+ rcu_read_unlock();
34213428 hci_disconnect(c, HCI_ERROR_REMOTE_USER_TERM);
3429+ rcu_read_lock();
34223430 }
34233431 }
34243432
net/bluetooth/hci_event.c+1−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333
3434 #include "hci_request.h"
3535 #include "hci_debugfs.h"
36+#include "hci_codec.h"
3637 #include "a2mp.h"
3738 #include "amp.h"
3839 #include "smp.h"
net/bluetooth/hci_request.h+0−2
@@ -71,7 +71,5 @@ struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen, · 70 unmodified lines
7171 void hci_req_add_le_scan_disable(struct hci_request *req, bool rpa_le_conn);
7272 void hci_req_add_le_passive_scan(struct hci_request *req);
7373
74−void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next);
75−
7674 void hci_request_setup(struct hci_dev *hdev);
7775 void hci_request_cancel_all(struct hci_dev *hdev);
net/bluetooth/hci_sync.c+5−9
@@ -413,11 +413,6 @@ static int hci_le_scan_restart_sync(struct hci_dev *hdev) · 412 unmodified lines
413413 LE_SCAN_FILTER_DUP_ENABLE);
414414 }
415415
416−static int le_scan_restart_sync(struct hci_dev *hdev, void *data)
417−{
418− return hci_le_scan_restart_sync(hdev);
419−}
420−
421416 static void le_scan_restart(struct work_struct *work)
422417 {
423418 struct hci_dev *hdev = container_of(work, struct hci_dev,
@@ -427,15 +422,15 @@ static void le_scan_restart(struct work_struct *work) · 3 unmodified lines
427422
428423 bt_dev_dbg(hdev, "");
429424
430− hci_dev_lock(hdev);
431−
432− status = hci_cmd_sync_queue(hdev, le_scan_restart_sync, NULL, NULL);
425+ status = hci_le_scan_restart_sync(hdev);
433426 if (status) {
434427 bt_dev_err(hdev, "failed to restart LE scan: status %d",
435428 status);
436− goto unlock;
429+ return;
437430 }
438431
432+ hci_dev_lock(hdev);
433+
439434 if (!test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) ||
440435 !hdev->discovery.scan_start)
441436 goto unlock;
@@ -5079,6 +5074,7 @@ int hci_dev_close_sync(struct hci_dev *hdev) · 4637 unmodified lines
50795074 memset(hdev->eir, 0, sizeof(hdev->eir));
50805075 memset(hdev->dev_class, 0, sizeof(hdev->dev_class));
50815076 bacpy(&hdev->random_addr, BDADDR_ANY);
5077+ hci_codec_list_clear(&hdev->local_codecs);
50825078
50835079 hci_dev_put(hdev);
50845080 return err;
net/bluetooth/iso.c+6−3
@@ -502,7 +502,7 @@ drop: · 501 unmodified lines
502502 }
503503
504504 /* -------- Socket interface ---------- */
505−static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *ba)
505+static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *src, bdaddr_t *dst)
506506 {
507507 struct sock *sk;
508508
@@ -510,7 +510,10 @@ static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *ba) · 1 unmodified line
510510 if (sk->sk_state != BT_LISTEN)
511511 continue;
512512
513− if (!bacmp(&iso_pi(sk)->src, ba))
513+ if (bacmp(&iso_pi(sk)->dst, dst))
514+ continue;
515+
516+ if (!bacmp(&iso_pi(sk)->src, src))
514517 return sk;
515518 }
516519
@@ -952,7 +955,7 @@ static int iso_listen_cis(struct sock *sk) · 435 unmodified lines
952955
953956 write_lock(&iso_sk_list.lock);
954957
955− if (__iso_get_sock_listen_by_addr(&iso_pi(sk)->src))
958+ if (__iso_get_sock_listen_by_addr(&iso_pi(sk)->src, &iso_pi(sk)->dst))
956959 err = -EADDRINUSE;
957960
958961 write_unlock(&iso_sk_list.lock);
net/bridge/br_netfilter_hooks.c+1−1
@@ -294,7 +294,7 @@ int br_nf_pre_routing_finish_bridge(struct net *net, struct sock *sk, struct sk_ · 293 unmodified lines
294294 /* tell br_dev_xmit to continue with forwarding */
295295 nf_bridge->bridged_dnat = 1;
296296 /* FIXME Need to refragment */
297− ret = neigh->output(neigh, skb);
297+ ret = READ_ONCE(neigh->output)(neigh, skb);
298298 }
299299 neigh_release(neigh);
300300 return ret;
net/core/neighbour.c+8−6
@@ -410,7 +410,7 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev, · 409 unmodified lines
410410 */
411411 __skb_queue_purge(&n->arp_queue);
412412 n->arp_queue_len_bytes = 0;
413− n->output = neigh_blackhole;
413+ WRITE_ONCE(n->output, neigh_blackhole);
414414 if (n->nud_state & NUD_VALID)
415415 n->nud_state = NUD_NOARP;
416416 else
@@ -920,7 +920,7 @@ static void neigh_suspect(struct neighbour *neigh) · 503 unmodified lines
920920 {
921921 neigh_dbg(2, "neigh %p is suspected\n", neigh);
922922
923− neigh->output = neigh->ops->output;
923+ WRITE_ONCE(neigh->output, neigh->ops->output);
924924 }
925925
926926 /* Neighbour state is OK;
@@ -932,7 +932,7 @@ static void neigh_connect(struct neighbour *neigh) · 5 unmodified lines
932932 {
933933 neigh_dbg(2, "neigh %p is connected\n", neigh);
934934
935− neigh->output = neigh->ops->connected_output;
935+ WRITE_ONCE(neigh->output, neigh->ops->connected_output);
936936 }
937937
938938 static void neigh_periodic_work(struct work_struct *work)
@@ -988,7 +988,9 @@ static void neigh_periodic_work(struct work_struct *work) · 49 unmodified lines
988988 (state == NUD_FAILED ||
989989 !time_in_range_open(jiffies, n->used,
990990 n->used + NEIGH_VAR(n->parms, GC_STALETIME)))) {
991− *np = n->next;
991+ rcu_assign_pointer(*np,
992+ rcu_dereference_protected(n->next,
993+ lockdep_is_held(&tbl->lock)));
992994 neigh_mark_dead(n);
993995 write_unlock(&n->lock);
994996 neigh_cleanup_and_release(n);
@@ -1447,7 +1449,7 @@ static int __neigh_update(struct neighbour *neigh, const u8 *lladdr, · 452 unmodified lines
14471449 if (n2)
14481450 n1 = n2;
14491451 }
1450− n1->output(n1, skb);
1452+ READ_ONCE(n1->output)(n1, skb);
14511453 if (n2)
14521454 neigh_release(n2);
14531455 rcu_read_unlock();
@@ -3153,7 +3155,7 @@ int neigh_xmit(int index, struct net_device *dev, · 1699 unmodified lines
31533155 rcu_read_unlock();
31543156 goto out_kfree_skb;
31553157 }
3156− err = neigh->output(neigh, skb);
3158+ err = READ_ONCE(neigh->output)(neigh, skb);
31573159 rcu_read_unlock();
31583160 }
31593161 else if (index == NEIGH_LINK_TABLE) {
net/core/sock_map.c+4−0
@@ -668,6 +668,8 @@ BPF_CALL_4(bpf_msg_redirect_map, struct sk_msg *, msg, · 667 unmodified lines
668668 sk = __sock_map_lookup_elem(map, key);
669669 if (unlikely(!sk || !sock_map_redirect_allowed(sk)))
670670 return SK_DROP;
671+ if (!(flags & BPF_F_INGRESS) && !sk_is_tcp(sk))
672+ return SK_DROP;
671673
672674 msg->flags = flags;
673675 msg->sk_redir = sk;
@@ -1267,6 +1269,8 @@ BPF_CALL_4(bpf_msg_redirect_hash, struct sk_msg *, msg, · 593 unmodified lines
12671269 sk = __sock_hash_lookup_elem(map, key);
12681270 if (unlikely(!sk || !sock_map_redirect_allowed(sk)))
12691271 return SK_DROP;
1272+ if (!(flags & BPF_F_INGRESS) && !sk_is_tcp(sk))
1273+ return SK_DROP;
12701274
12711275 msg->flags = flags;
12721276 msg->sk_redir = sk;
net/ethtool/plca.c+29−16
@@ -21,16 +21,6 @@ struct plca_reply_data { · 20 unmodified lines
2121 #define PLCA_REPDATA(__reply_base) \
2222 container_of(__reply_base, struct plca_reply_data, base)
2323
24−static void plca_update_sint(int *dst, const struct nlattr *attr,
25− bool *mod)
26−{
27− if (!attr)
28− return;
29−
30− *dst = nla_get_u32(attr);
31− *mod = true;
32−}
33−
3424 // PLCA get configuration message ------------------------------------------- //
3525
3626 const struct nla_policy ethnl_plca_get_cfg_policy[] = {
@@ -38,6 +28,29 @@ const struct nla_policy ethnl_plca_get_cfg_policy[] = { · 1 unmodified line
3828 NLA_POLICY_NESTED(ethnl_header_policy),
3929 };
4030
31+static void plca_update_sint(int *dst, struct nlattr **tb, u32 attrid,
32+ bool *mod)
33+{
34+ const struct nlattr *attr = tb[attrid];
35+
36+ if (!attr ||
37+ WARN_ON_ONCE(attrid >= ARRAY_SIZE(ethnl_plca_set_cfg_policy)))
38+ return;
39+
40+ switch (ethnl_plca_set_cfg_policy[attrid].type) {
41+ case NLA_U8:
42+ *dst = nla_get_u8(attr);
43+ break;
44+ case NLA_U32:
45+ *dst = nla_get_u32(attr);
46+ break;
47+ default:
48+ WARN_ON_ONCE(1);
49+ }
50+
51+ *mod = true;
52+}
53+
4154 static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base,
4255 struct ethnl_reply_data *reply_base,
4356 const struct genl_info *info)
@@ -144,13 +157,13 @@ ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info) · 100 unmodified lines
144157 return -EOPNOTSUPP;
145158
146159 memset(&plca_cfg, 0xff, sizeof(plca_cfg));
147− plca_update_sint(&plca_cfg.enabled, tb[ETHTOOL_A_PLCA_ENABLED], &mod);
148− plca_update_sint(&plca_cfg.node_id, tb[ETHTOOL_A_PLCA_NODE_ID], &mod);
149− plca_update_sint(&plca_cfg.node_cnt, tb[ETHTOOL_A_PLCA_NODE_CNT], &mod);
150− plca_update_sint(&plca_cfg.to_tmr, tb[ETHTOOL_A_PLCA_TO_TMR], &mod);
151− plca_update_sint(&plca_cfg.burst_cnt, tb[ETHTOOL_A_PLCA_BURST_CNT],
160+ plca_update_sint(&plca_cfg.enabled, tb, ETHTOOL_A_PLCA_ENABLED, &mod);
161+ plca_update_sint(&plca_cfg.node_id, tb, ETHTOOL_A_PLCA_NODE_ID, &mod);
162+ plca_update_sint(&plca_cfg.node_cnt, tb, ETHTOOL_A_PLCA_NODE_CNT, &mod);
163+ plca_update_sint(&plca_cfg.to_tmr, tb, ETHTOOL_A_PLCA_TO_TMR, &mod);
164+ plca_update_sint(&plca_cfg.burst_cnt, tb, ETHTOOL_A_PLCA_BURST_CNT,
152165 &mod);
153− plca_update_sint(&plca_cfg.burst_tmr, tb[ETHTOOL_A_PLCA_BURST_TMR],
166+ plca_update_sint(&plca_cfg.burst_tmr, tb, ETHTOOL_A_PLCA_BURST_TMR,
154167 &mod);
155168 if (!mod)
156169 return 0;
net/ipv4/fib_semantics.c+1−0
@@ -1887,6 +1887,7 @@ int fib_sync_down_addr(struct net_device *dev, __be32 local) · 1886 unmodified lines
18871887 continue;
18881888 if (fi->fib_prefsrc == local) {
18891889 fi->fib_flags |= RTNH_F_DEAD;
1890+ fi->pfsrc_removed = true;
18901891 ret++;
18911892 }
18921893 }
net/ipv4/fib_trie.c+4−0
@@ -2027,6 +2027,7 @@ void fib_table_flush_external(struct fib_table *tb) · 2026 unmodified lines
20272027 int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all)
20282028 {
20292029 struct trie *t = (struct trie *)tb->tb_data;
2030+ struct nl_info info = { .nl_net = net };
20302031 struct key_vector *pn = t->kv;
20312032 unsigned long cindex = 1;
20322033 struct hlist_node *tmp;
@@ -2089,6 +2090,9 @@ int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all) · 56 unmodified lines
20892090
20902091 fib_notify_alias_delete(net, n->key, &n->leaf, fa,
20912092 NULL);
2093+ if (fi->pfsrc_removed)
2094+ rtmsg_fib(RTM_DELROUTE, htonl(n->key), fa,
2095+ KEYLENGTH - fa->fa_slen, tb->tb_id, &info, 0);
20922096 hlist_del_rcu(&fa->fa_list);
20932097 fib_release_info(fa->fa_info);
20942098 alias_free_mem_rcu(fa);
net/ipv4/route.c+2−0
@@ -3417,6 +3417,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, · 3416 unmodified lines
34173417 fa->fa_type == fri.type) {
34183418 fri.offload = READ_ONCE(fa->offload);
34193419 fri.trap = READ_ONCE(fa->trap);
3420+ fri.offload_failed =
3421+ READ_ONCE(fa->offload_failed);
34203422 break;
34213423 }
34223424 }
net/ipv4/tcp.c+2−8
@@ -1621,16 +1621,13 @@ EXPORT_SYMBOL(tcp_read_sock); · 1620 unmodified lines
16211621
16221622 int tcp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
16231623 {
1624− struct tcp_sock *tp = tcp_sk(sk);
1625− u32 seq = tp->copied_seq;
16261624 struct sk_buff *skb;
16271625 int copied = 0;
1628− u32 offset;
16291626
16301627 if (sk->sk_state == TCP_LISTEN)
16311628 return -ENOTCONN;
16321629
1633− while ((skb = tcp_recv_skb(sk, seq, &offset)) != NULL) {
1630+ while ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) {
16341631 u8 tcp_flags;
16351632 int used;
16361633
@@ -1643,13 +1640,10 @@ int tcp_read_skb(struct sock *sk, skb_read_actor_t recv_actor) · 6 unmodified lines
16431640 copied = used;
16441641 break;
16451642 }
1646− seq += used;
16471643 copied += used;
16481644
1649− if (tcp_flags & TCPHDR_FIN) {
1650− ++seq;
1645+ if (tcp_flags & TCPHDR_FIN)
16511646 break;
1652− }
16531647 }
16541648 return copied;
16551649 }
net/ipv4/tcp_bpf.c+3−1
@@ -222,6 +222,7 @@ static int tcp_bpf_recvmsg_parser(struct sock *sk, · 221 unmodified lines
222222 int *addr_len)
223223 {
224224 struct tcp_sock *tcp = tcp_sk(sk);
225+ int peek = flags & MSG_PEEK;
225226 u32 seq = tcp->copied_seq;
226227 struct sk_psock *psock;
227228 int copied = 0;
@@ -311,7 +312,8 @@ msg_bytes_ready: · 83 unmodified lines
311312 copied = -EAGAIN;
312313 }
313314 out:
314− WRITE_ONCE(tcp->copied_seq, seq);
315+ if (!peek)
316+ WRITE_ONCE(tcp->copied_seq, seq);
315317 tcp_rcv_space_adjust(sk);
316318 if (copied > 0)
317319 __tcp_cleanup_rbuf(sk, copied);
net/ipv4/tcp_input.c+13−0
@@ -253,6 +253,19 @@ static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb) · 252 unmodified lines
253253 if (unlikely(len > icsk->icsk_ack.rcv_mss +
254254 MAX_TCP_OPTION_SPACE))
255255 tcp_gro_dev_warn(sk, skb, len);
256+ /* If the skb has a len of exactly 1*MSS and has the PSH bit
257+ * set then it is likely the end of an application write. So
258+ * more data may not be arriving soon, and yet the data sender
259+ * may be waiting for an ACK if cwnd-bound or using TX zero
260+ * copy. So we set ICSK_ACK_PUSHED here so that
261+ * tcp_cleanup_rbuf() will send an ACK immediately if the app
262+ * reads all of the data and is not ping-pong. If len > MSS
263+ * then this logic does not matter (and does not hurt) because
264+ * tcp_cleanup_rbuf() will always ACK immediately if the app
265+ * reads data and there is more than an MSS of unACKed data.
266+ */
267+ if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_PSH)
268+ icsk->icsk_ack.pending |= ICSK_ACK_PUSHED;
256269 } else {
257270 /* Otherwise, we make more careful check taking into account,
258271 * that SACKs block is variable.
net/ipv4/tcp_output.c+3−4
@@ -177,8 +177,7 @@ static void tcp_event_data_sent(struct tcp_sock *tp, · 176 unmodified lines
177177 }
178178
179179 /* Account for an ACK we sent. */
180−static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts,
181− u32 rcv_nxt)
180+static inline void tcp_event_ack_sent(struct sock *sk, u32 rcv_nxt)
182181 {
183182 struct tcp_sock *tp = tcp_sk(sk);
184183
@@ -192,7 +191,7 @@ static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts, · 7 unmodified lines
192191
193192 if (unlikely(rcv_nxt != tp->rcv_nxt))
194193 return; /* Special ACK sent by DCTCP to reflect ECN */
195− tcp_dec_quickack_mode(sk, pkts);
194+ tcp_dec_quickack_mode(sk);
196195 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
197196 }
198197
@@ -1380,7 +1379,7 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, · 1181 unmodified lines
13801379 sk, skb);
13811380
13821381 if (likely(tcb->tcp_flags & TCPHDR_ACK))
1383− tcp_event_ack_sent(sk, tcp_skb_pcount(skb), rcv_nxt);
1382+ tcp_event_ack_sent(sk, rcv_nxt);
13841383
13851384 if (skb->len != tcp_header_size) {
13861385 tcp_event_data_sent(tp, sk);
net/ipv6/tcp_ipv6.c+7−3
@@ -1639,9 +1639,12 @@ process: · 1638 unmodified lines
16391639 struct sock *nsk;
16401640
16411641 sk = req->rsk_listener;
1642− drop_reason = tcp_inbound_md5_hash(sk, skb,
1643− &hdr->saddr, &hdr->daddr,
1644− AF_INET6, dif, sdif);
1642+ if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
1643+ drop_reason = SKB_DROP_REASON_XFRM_POLICY;
1644+ else
1645+ drop_reason = tcp_inbound_md5_hash(sk, skb,
1646+ &hdr->saddr, &hdr->daddr,
1647+ AF_INET6, dif, sdif);
16451648 if (drop_reason) {
16461649 sk_drops_add(sk, skb);
16471650 reqsk_put(req);
@@ -1688,6 +1691,7 @@ process: · 40 unmodified lines
16881691 }
16891692 goto discard_and_relse;
16901693 }
1694+ nf_reset_ct(skb);
16911695 if (nsk == sk) {
16921696 reqsk_put(req);
16931697 tcp_v6_restore_cb(skb);
net/l2tp/l2tp_ip6.c+1−1
@@ -507,7 +507,6 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) · 506 unmodified lines
507507 */
508508 if (len > INT_MAX - transhdrlen)
509509 return -EMSGSIZE;
510− ulen = len + transhdrlen;
511510
512511 /* Mirror BSD error message compatibility */
513512 if (msg->msg_flags & MSG_OOB)
@@ -628,6 +627,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) · 114 unmodified lines
628627
629628 back_from_confirm:
630629 lock_sock(sk);
630+ ulen = len + skb_queue_empty(&sk->sk_write_queue) ? transhdrlen : 0;
631631 err = ip6_append_data(sk, ip_generic_getfrag, msg,
632632 ulen, transhdrlen, &ipc6,
633633 &fl6, (struct rt6_info *)dst,
net/mac80211/cfg.c+5−1
@@ -566,6 +566,9 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 565 unmodified lines
566566 }
567567
568568 err = ieee80211_key_link(key, link, sta);
569+ /* KRACK protection, shouldn't happen but just silently accept key */
570+ if (err == -EALREADY)
571+ err = 0;
569572
570573 out_unlock:
571574 mutex_unlock(&local->sta_mtx);
@@ -1857,7 +1860,8 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, · 1285 unmodified lines
18571860 /* VHT can override some HT caps such as the A-MSDU max length */
18581861 if (params->vht_capa)
18591862 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
1860− params->vht_capa, link_sta);
1863+ params->vht_capa, NULL,
1864+ link_sta);
18611865
18621866 if (params->he_capa)
18631867 ieee80211_he_cap_ie_to_sta_he_cap(sdata, sband,
net/mac80211/ibss.c+1−1
@@ -1072,7 +1072,7 @@ static void ieee80211_update_sta_info(struct ieee80211_sub_if_data *sdata, · 1071 unmodified lines
10721072 &chandef);
10731073 memcpy(&cap_ie, elems->vht_cap_elem, sizeof(cap_ie));
10741074 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
1075− &cap_ie,
1075+ &cap_ie, NULL,
10761076 &sta->deflink);
10771077 if (memcmp(&cap, &sta->sta.deflink.vht_cap, sizeof(cap)))
10781078 rates_updated |= true;
net/mac80211/ieee80211_i.h+2−1
@@ -676,7 +676,7 @@ struct ieee80211_if_mesh { · 675 unmodified lines
676676 struct timer_list mesh_path_root_timer;
677677
678678 unsigned long wrkq_flags;
679− unsigned long mbss_changed;
679+ unsigned long mbss_changed[64 / BITS_PER_LONG];
680680
681681 bool userspace_handles_dfs;
682682
@@ -2141,6 +2141,7 @@ void · 1458 unmodified lines
21412141 ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
21422142 struct ieee80211_supported_band *sband,
21432143 const struct ieee80211_vht_cap *vht_cap_ie,
2144+ const struct ieee80211_vht_cap *vht_cap_ie2,
21442145 struct link_sta_info *link_sta);
21452146 enum ieee80211_sta_rx_bandwidth
21462147 ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta);
net/mac80211/key.c+16−6
@@ -802,6 +802,9 @@ static void ieee80211_key_destroy(struct ieee80211_key *key, · 801 unmodified lines
802802
803803 void ieee80211_key_free_unused(struct ieee80211_key *key)
804804 {
805+ if (!key)
806+ return;
807+
805808 WARN_ON(key->sdata || key->local);
806809 ieee80211_key_free_common(key);
807810 }
@@ -854,7 +857,7 @@ int ieee80211_key_link(struct ieee80211_key *key, · 46 unmodified lines
854857 * can cause warnings to appear.
855858 */
856859 bool delay_tailroom = sdata->vif.type == NL80211_IFTYPE_STATION;
857− int ret = -EOPNOTSUPP;
860+ int ret;
858861
859862 mutex_lock(&sdata->local->key_mtx);
860863
@@ -868,8 +871,10 @@ int ieee80211_key_link(struct ieee80211_key *key, · 7 unmodified lines
868871 * the same cipher. Enforce the assumption for pairwise keys.
869872 */
870873 if ((alt_key && alt_key->conf.cipher != key->conf.cipher) ||
871− (old_key && old_key->conf.cipher != key->conf.cipher))
874+ (old_key && old_key->conf.cipher != key->conf.cipher)) {
875+ ret = -EOPNOTSUPP;
872876 goto out;
877+ }
873878 } else if (sta) {
874879 struct link_sta_info *link_sta = &sta->deflink;
875880 int link_id = key->conf.link_id;
@@ -895,8 +900,10 @@ int ieee80211_key_link(struct ieee80211_key *key, · 19 unmodified lines
895900
896901 /* Non-pairwise keys must also not switch the cipher on rekey */
897902 if (!pairwise) {
898− if (old_key && old_key->conf.cipher != key->conf.cipher)
903+ if (old_key && old_key->conf.cipher != key->conf.cipher) {
904+ ret = -EOPNOTSUPP;
899905 goto out;
906+ }
900907 }
901908
902909 /*
@@ -904,9 +911,8 @@ int ieee80211_key_link(struct ieee80211_key *key, · 1 unmodified line
904911 * new version of the key to avoid nonce reuse or replay issues.
905912 */
906913 if (ieee80211_key_identical(sdata, old_key, key)) {
907− ieee80211_key_free_unused(key);
908− ret = 0;
909− goto out;
914+ ret = -EALREADY;
915+ goto unlock;
910916 }
911917
912918 key->local = sdata->local;
@@ -930,7 +936,11 @@ int ieee80211_key_link(struct ieee80211_key *key, · 17 unmodified lines
930936 ieee80211_key_free(key, delay_tailroom);
931937 }
932938
939+ key = NULL;
940+
933941 out:
942+ ieee80211_key_free_unused(key);
943+ unlock:
934944 mutex_unlock(&sdata->local->key_mtx);
935945
936946 return ret;
net/mac80211/mesh.c+4−4
@@ -1175,7 +1175,7 @@ void ieee80211_mbss_info_change_notify(struct ieee80211_sub_if_data *sdata, · 1174 unmodified lines
11751175
11761176 /* if we race with running work, worst case this work becomes a noop */
11771177 for_each_set_bit(bit, &bits, sizeof(changed) * BITS_PER_BYTE)
1178− set_bit(bit, &ifmsh->mbss_changed);
1178+ set_bit(bit, ifmsh->mbss_changed);
11791179 set_bit(MESH_WORK_MBSS_CHANGED, &ifmsh->wrkq_flags);
11801180 wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work);
11811181 }
@@ -1257,7 +1257,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) · 75 unmodified lines
12571257
12581258 /* clear any mesh work (for next join) we may have accrued */
12591259 ifmsh->wrkq_flags = 0;
1260− ifmsh->mbss_changed = 0;
1260+ memset(ifmsh->mbss_changed, 0, sizeof(ifmsh->mbss_changed));
12611261
12621262 local->fif_other_bss--;
12631263 atomic_dec(&local->iff_allmultis);
@@ -1724,9 +1724,9 @@ static void mesh_bss_info_changed(struct ieee80211_sub_if_data *sdata) · 460 unmodified lines
17241724 u32 bit;
17251725 u64 changed = 0;
17261726
1727− for_each_set_bit(bit, &ifmsh->mbss_changed,
1727+ for_each_set_bit(bit, ifmsh->mbss_changed,
17281728 sizeof(changed) * BITS_PER_BYTE) {
1729− clear_bit(bit, &ifmsh->mbss_changed);
1729+ clear_bit(bit, ifmsh->mbss_changed);
17301730 changed |= BIT(bit);
17311731 }
17321732
net/mac80211/mesh_plink.c+1−1
@@ -451,7 +451,7 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, · 450 unmodified lines
451451 changed |= IEEE80211_RC_BW_CHANGED;
452452
453453 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
454− elems->vht_cap_elem,
454+ elems->vht_cap_elem, NULL,
455455 &sta->deflink);
456456
457457 ieee80211_he_cap_ie_to_sta_he_cap(sdata, sband, elems->he_cap,
net/mac80211/mlme.c+35−10
@@ -4202,10 +4202,33 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link, · 4201 unmodified lines
42024202 elems->ht_cap_elem,
42034203 link_sta);
42044204
4205− if (elems->vht_cap_elem && !(link->u.mgd.conn_flags & IEEE80211_CONN_DISABLE_VHT))
4205+ if (elems->vht_cap_elem &&
4206+ !(link->u.mgd.conn_flags & IEEE80211_CONN_DISABLE_VHT)) {
4207+ const struct ieee80211_vht_cap *bss_vht_cap = NULL;
4208+ const struct cfg80211_bss_ies *ies;
4209+
4210+ /*
4211+ * Cisco AP module 9115 with FW 17.3 has a bug and sends a
4212+ * too large maximum MPDU length in the association response
4213+ * (indicating 12k) that it cannot actually process ...
4214+ * Work around that.
4215+ */
4216+ rcu_read_lock();
4217+ ies = rcu_dereference(cbss->ies);
4218+ if (ies) {
4219+ const struct element *elem;
4220+
4221+ elem = cfg80211_find_elem(WLAN_EID_VHT_CAPABILITY,
4222+ ies->data, ies->len);
4223+ if (elem && elem->datalen >= sizeof(*bss_vht_cap))
4224+ bss_vht_cap = (const void *)elem->data;
4225+ }
4226+
42064227 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
42074228 elems->vht_cap_elem,
4208− link_sta);
4229+ bss_vht_cap, link_sta);
4230+ rcu_read_unlock();
4231+ }
42094232
42104233 if (elems->he_operation && !(link->u.mgd.conn_flags & IEEE80211_CONN_DISABLE_HE) &&
42114234 elems->he_cap) {
@@ -5107,9 +5130,10 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, · 895 unmodified lines
51075130 continue;
51085131
51095132 valid_links |= BIT(link_id);
5110− if (assoc_data->link[link_id].disabled) {
5133+ if (assoc_data->link[link_id].disabled)
51115134 dormant_links |= BIT(link_id);
5112− } else if (link_id != assoc_data->assoc_link_id) {
5135+
5136+ if (link_id != assoc_data->assoc_link_id) {
51135137 err = ieee80211_sta_allocate_link(sta, link_id);
51145138 if (err)
51155139 goto out_err;
@@ -5124,7 +5148,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, · 8 unmodified lines
51245148 struct ieee80211_link_data *link;
51255149 struct link_sta_info *link_sta;
51265150
5127− if (!cbss || assoc_data->link[link_id].disabled)
5151+ if (!cbss)
51285152 continue;
51295153
51305154 link = sdata_dereference(sdata->link[link_id], sdata);
@@ -5429,17 +5453,18 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 298 unmodified lines
54295453 for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) {
54305454 struct ieee80211_link_data *link;
54315455
5432− link = sdata_dereference(sdata->link[link_id], sdata);
5433− if (!link)
5434− continue;
5435−
54365456 if (!assoc_data->link[link_id].bss)
54375457 continue;
54385458
54395459 resp.links[link_id].bss = assoc_data->link[link_id].bss;
5440− resp.links[link_id].addr = link->conf->addr;
5460+ ether_addr_copy(resp.links[link_id].addr,
5461+ assoc_data->link[link_id].addr);
54415462 resp.links[link_id].status = assoc_data->link[link_id].status;
54425463
5464+ link = sdata_dereference(sdata->link[link_id], sdata);
5465+ if (!link)
5466+ continue;
5467+
54435468 /* get uapsd queues configuration - same for all links */
54445469 resp.uapsd_queues = 0;
54455470 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
net/mac80211/tx.c+2−1
@@ -665,7 +665,8 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) · 664 unmodified lines
665665 }
666666
667667 if (unlikely(tx->key && tx->key->flags & KEY_FLAG_TAINTED &&
668− !ieee80211_is_deauth(hdr->frame_control)))
668+ !ieee80211_is_deauth(hdr->frame_control)) &&
669+ tx->skb->protocol != tx->sdata->control_port_protocol)
669670 return TX_DROP;
670671
671672 if (!skip_hw && tx->key &&
net/mac80211/vht.c+14−2
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 *
55 * Portions of this file
66 * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
7− * Copyright (C) 2018 - 2022 Intel Corporation
7+ * Copyright (C) 2018 - 2023 Intel Corporation
88 */
99
1010 #include <linux/ieee80211.h>
@@ -116,12 +116,14 @@ void · 105 unmodified lines
116116 ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
117117 struct ieee80211_supported_band *sband,
118118 const struct ieee80211_vht_cap *vht_cap_ie,
119+ const struct ieee80211_vht_cap *vht_cap_ie2,
119120 struct link_sta_info *link_sta)
120121 {
121122 struct ieee80211_sta_vht_cap *vht_cap = &link_sta->pub->vht_cap;
122123 struct ieee80211_sta_vht_cap own_cap;
123124 u32 cap_info, i;
124125 bool have_80mhz;
126+ u32 mpdu_len;
125127
126128 memset(vht_cap, 0, sizeof(*vht_cap));
127129
@@ -317,11 +319,21 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, · 189 unmodified lines
317319
318320 link_sta->pub->bandwidth = ieee80211_sta_cur_vht_bw(link_sta);
319321
322+ /*
323+ * Work around the Cisco 9115 FW 17.3 bug by taking the min of
324+ * both reported MPDU lengths.
325+ */
326+ mpdu_len = vht_cap->cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK;
327+ if (vht_cap_ie2)
328+ mpdu_len = min_t(u32, mpdu_len,
329+ le32_get_bits(vht_cap_ie2->vht_cap_info,
330+ IEEE80211_VHT_CAP_MAX_MPDU_MASK));
331+
320332 /*
321333 * FIXME - should the amsdu len be per link? store per link
322334 * and maintain a minimum?
323335 */
324− switch (vht_cap->cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK) {
336+ switch (mpdu_len) {
325337 case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454:
326338 link_sta->pub->agg.max_amsdu_len = IEEE80211_MAX_MPDU_LEN_VHT_11454;
327339 break;
net/mptcp/pm_userspace.c+0−6
@@ -307,12 +307,6 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info) · 306 unmodified lines
307307 goto create_err;
308308 }
309309
310− if (addr_l.id == 0) {
311− NL_SET_ERR_MSG_ATTR(info->extack, laddr, "missing local addr id");
312− err = -EINVAL;
313− goto create_err;
314− }
315−
316310 err = mptcp_pm_parse_addr(raddr, info, &addr_r);
317311 if (err < 0) {
318312 NL_SET_ERR_MSG_ATTR(info->extack, raddr, "error parsing remote addr");
net/mptcp/protocol.c+14−14
@@ -3425,24 +3425,21 @@ static void schedule_3rdack_retransmission(struct sock *ssk) · 3424 unmodified lines
34253425 sk_reset_timer(ssk, &icsk->icsk_delack_timer, timeout);
34263426 }
34273427
3428−void mptcp_subflow_process_delegated(struct sock *ssk)
3428+void mptcp_subflow_process_delegated(struct sock *ssk, long status)
34293429 {
34303430 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
34313431 struct sock *sk = subflow->conn;
34323432
3433− if (test_bit(MPTCP_DELEGATE_SEND, &subflow->delegated_status)) {
3433+ if (status & BIT(MPTCP_DELEGATE_SEND)) {
34343434 mptcp_data_lock(sk);
34353435 if (!sock_owned_by_user(sk))
34363436 __mptcp_subflow_push_pending(sk, ssk, true);
34373437 else
34383438 __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags);
34393439 mptcp_data_unlock(sk);
3440− mptcp_subflow_delegated_done(subflow, MPTCP_DELEGATE_SEND);
34413440 }
3442− if (test_bit(MPTCP_DELEGATE_ACK, &subflow->delegated_status)) {
3441+ if (status & BIT(MPTCP_DELEGATE_ACK))
34433442 schedule_3rdack_retransmission(ssk);
3444− mptcp_subflow_delegated_done(subflow, MPTCP_DELEGATE_ACK);
3445− }
34463443 }
34473444
34483445 static int mptcp_hash(struct sock *sk)
@@ -3968,14 +3965,17 @@ static int mptcp_napi_poll(struct napi_struct *napi, int budget) · 519 unmodified lines
39683965 struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
39693966
39703967 bh_lock_sock_nested(ssk);
3971− if (!sock_owned_by_user(ssk) &&
3972− mptcp_subflow_has_delegated_action(subflow))
3973− mptcp_subflow_process_delegated(ssk);
3974− /* ... elsewhere tcp_release_cb_override already processed
3975− * the action or will do at next release_sock().
3976− * In both case must dequeue the subflow here - on the same
3977− * CPU that scheduled it.
3978− */
3968+ if (!sock_owned_by_user(ssk)) {
3969+ mptcp_subflow_process_delegated(ssk, xchg(&subflow->delegated_status, 0));
3970+ } else {
3971+ /* tcp_release_cb_override already processed
3972+ * the action or will do at next release_sock().
3973+ * In both case must dequeue the subflow here - on the same
3974+ * CPU that scheduled it.
3975+ */
3976+ smp_wmb();
3977+ clear_bit(MPTCP_DELEGATE_SCHEDULED, &subflow->delegated_status);
3978+ }
39793979 bh_unlock_sock(ssk);
39803980 sock_put(ssk);
39813981
net/mptcp/protocol.h+12−23
@@ -444,9 +444,11 @@ struct mptcp_delegated_action { · 443 unmodified lines
444444
445445 DECLARE_PER_CPU(struct mptcp_delegated_action, mptcp_delegated_actions);
446446
447−#define MPTCP_DELEGATE_SEND 0
448−#define MPTCP_DELEGATE_ACK 1
447+#define MPTCP_DELEGATE_SCHEDULED 0
448+#define MPTCP_DELEGATE_SEND 1
449+#define MPTCP_DELEGATE_ACK 2
449450
451+#define MPTCP_DELEGATE_ACTIONS_MASK (~BIT(MPTCP_DELEGATE_SCHEDULED))
450452 /* MPTCP subflow context */
451453 struct mptcp_subflow_context {
452454 struct list_head node;/* conn_list of subflows */
@@ -564,23 +566,24 @@ mptcp_subflow_get_mapped_dsn(const struct mptcp_subflow_context *subflow) · 111 unmodified lines
564566 return subflow->map_seq + mptcp_subflow_get_map_offset(subflow);
565567 }
566568
567−void mptcp_subflow_process_delegated(struct sock *ssk);
569+void mptcp_subflow_process_delegated(struct sock *ssk, long actions);
568570
569571 static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *subflow, int action)
570572 {
573+ long old, set_bits = BIT(MPTCP_DELEGATE_SCHEDULED) | BIT(action);
571574 struct mptcp_delegated_action *delegated;
572575 bool schedule;
573576
574577 /* the caller held the subflow bh socket lock */
575578 lockdep_assert_in_softirq();
576579
577− /* The implied barrier pairs with mptcp_subflow_delegated_done(), and
578− * ensures the below list check sees list updates done prior to status
579− * bit changes
580+ /* The implied barrier pairs with tcp_release_cb_override()
581+ * mptcp_napi_poll(), and ensures the below list check sees list
582+ * updates done prior to delegated status bits changes
580583 */
581− if (!test_and_set_bit(action, &subflow->delegated_status)) {
582− /* still on delegated list from previous scheduling */
583− if (!list_empty(&subflow->delegated_node))
584+ old = set_mask_bits(&subflow->delegated_status, 0, set_bits);
585+ if (!(old & BIT(MPTCP_DELEGATE_SCHEDULED))) {
586+ if (WARN_ON_ONCE(!list_empty(&subflow->delegated_node)))
584587 return;
585588
586589 delegated = this_cpu_ptr(&mptcp_delegated_actions);
@@ -605,20 +608,6 @@ mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated) · 18 unmodified lines
605608 return ret;
606609 }
607610
608−static inline bool mptcp_subflow_has_delegated_action(const struct mptcp_subflow_context *subflow)
609−{
610− return !!READ_ONCE(subflow->delegated_status);
611−}
612−
613−static inline void mptcp_subflow_delegated_done(struct mptcp_subflow_context *subflow, int action)
614−{
615− /* pairs with mptcp_subflow_delegate, ensures delegate_node is updated before
616− * touching the status bit
617− */
618− smp_wmb();
619− clear_bit(action, &subflow->delegated_status);
620−}
621−
622611 int mptcp_is_enabled(const struct net *net);
623612 unsigned int mptcp_get_add_addr_timeout(const struct net *net);
624613 int mptcp_is_checksum_enabled(const struct net *net);
net/mptcp/subflow.c+8−2
@@ -1956,9 +1956,15 @@ static void subflow_ulp_clone(const struct request_sock *req, · 1955 unmodified lines
19561956 static void tcp_release_cb_override(struct sock *ssk)
19571957 {
19581958 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
1959+ long status;
19591960
1960− if (mptcp_subflow_has_delegated_action(subflow))
1961− mptcp_subflow_process_delegated(ssk);
1961+ /* process and clear all the pending actions, but leave the subflow into
1962+ * the napi queue. To respect locking, only the same CPU that originated
1963+ * the action can touch the list. mptcp_napi_poll will take care of it.
1964+ */
1965+ status = set_mask_bits(&subflow->delegated_status, MPTCP_DELEGATE_ACTIONS_MASK, 0);
1966+ if (status)
1967+ mptcp_subflow_process_delegated(ssk, status);
19621968
19631969 tcp_release_cb(ssk);
19641970 }
net/netfilter/ipvs/ip_vs_sync.c+4−4
@@ -1435,7 +1435,7 @@ static int bind_mcastif_addr(struct socket *sock, struct net_device *dev) · 1434 unmodified lines
14351435 sin.sin_addr.s_addr = addr;
14361436 sin.sin_port = 0;
14371437
1438− return sock->ops->bind(sock, (struct sockaddr*)&sin, sizeof(sin));
1438+ return kernel_bind(sock, (struct sockaddr *)&sin, sizeof(sin));
14391439 }
14401440
14411441 static void get_mcast_sockaddr(union ipvs_sockaddr *sa, int *salen,
@@ -1501,8 +1501,8 @@ static int make_send_sock(struct netns_ipvs *ipvs, int id, · 59 unmodified lines
15011501 }
15021502
15031503 get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->mcfg, id);
1504− result = sock->ops->connect(sock, (struct sockaddr *) &mcast_addr,
1505− salen, 0);
1504+ result = kernel_connect(sock, (struct sockaddr *)&mcast_addr,
1505+ salen, 0);
15061506 if (result < 0) {
15071507 pr_err("Error connecting to the multicast addr\n");
15081508 goto error;
@@ -1542,7 +1542,7 @@ static int make_receive_sock(struct netns_ipvs *ipvs, int id, · 33 unmodified lines
15421542
15431543 get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->bcfg, id);
15441544 sock->sk->sk_bound_dev_if = dev->ifindex;
1545− result = sock->ops->bind(sock, (struct sockaddr *)&mcast_addr, salen);
1545+ result = kernel_bind(sock, (struct sockaddr *)&mcast_addr, salen);
15461546 if (result < 0) {
15471547 pr_err("Error binding to the multicast addr\n");
15481548 goto error;
net/netfilter/nf_conntrack_proto_sctp.c+33−10
@@ -112,7 +112,7 @@ static const u8 sctp_conntracks[2][11][SCTP_CONNTRACK_MAX] = { · 111 unmodified lines
112112 /* shutdown_ack */ {sSA, sCL, sCW, sCE, sES, sSA, sSA, sSA, sSA},
113113 /* error */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL},/* Can't have Stale cookie*/
114114 /* cookie_echo */ {sCL, sCL, sCE, sCE, sES, sSS, sSR, sSA, sCL},/* 5.2.4 - Big TODO */
115−/* cookie_ack */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL},/* Can't come in orig dir */
115+/* cookie_ack */ {sCL, sCL, sCW, sES, sES, sSS, sSR, sSA, sCL},/* Can't come in orig dir */
116116 /* shutdown_comp*/ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sCL, sCL},
117117 /* heartbeat */ {sHS, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS},
118118 /* heartbeat_ack*/ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS},
@@ -126,7 +126,7 @@ static const u8 sctp_conntracks[2][11][SCTP_CONNTRACK_MAX] = { · 7 unmodified lines
126126 /* shutdown */ {sIV, sCL, sCW, sCE, sSR, sSS, sSR, sSA, sIV},
127127 /* shutdown_ack */ {sIV, sCL, sCW, sCE, sES, sSA, sSA, sSA, sIV},
128128 /* error */ {sIV, sCL, sCW, sCL, sES, sSS, sSR, sSA, sIV},
129−/* cookie_echo */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sIV},/* Can't come in reply dir */
129+/* cookie_echo */ {sIV, sCL, sCE, sCE, sES, sSS, sSR, sSA, sIV},/* Can't come in reply dir */
130130 /* cookie_ack */ {sIV, sCL, sCW, sES, sES, sSS, sSR, sSA, sIV},
131131 /* shutdown_comp*/ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sCL, sIV},
132132 /* heartbeat */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS},
@@ -412,6 +412,9 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 279 unmodified lines
412412 /* (D) vtag must be same as init_vtag as found in INIT_ACK */
413413 if (sh->vtag != ct->proto.sctp.vtag[dir])
414414 goto out_unlock;
415+ } else if (sch->type == SCTP_CID_COOKIE_ACK) {
416+ ct->proto.sctp.init[dir] = 0;
417+ ct->proto.sctp.init[!dir] = 0;
415418 } else if (sch->type == SCTP_CID_HEARTBEAT) {
416419 if (ct->proto.sctp.vtag[dir] == 0) {
417420 pr_debug("Setting %d vtag %x for dir %d\n", sch->type, sh->vtag, dir);
@@ -461,16 +464,18 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 43 unmodified lines
461464 }
462465
463466 /* If it is an INIT or an INIT ACK note down the vtag */
464− if (sch->type == SCTP_CID_INIT ||
465− sch->type == SCTP_CID_INIT_ACK) {
466− struct sctp_inithdr _inithdr, *ih;
467+ if (sch->type == SCTP_CID_INIT) {
468+ struct sctp_inithdr _ih, *ih;
467469
468− ih = skb_header_pointer(skb, offset + sizeof(_sch),
469− sizeof(_inithdr), &_inithdr);
470− if (ih == NULL)
470+ ih = skb_header_pointer(skb, offset + sizeof(_sch), sizeof(*ih), &_ih);
471+ if (!ih)
471472 goto out_unlock;
472− pr_debug("Setting vtag %x for dir %d\n",
473− ih->init_tag, !dir);
473+
474+ if (ct->proto.sctp.init[dir] && ct->proto.sctp.init[!dir])
475+ ct->proto.sctp.init[!dir] = 0;
476+ ct->proto.sctp.init[dir] = 1;
477+
478+ pr_debug("Setting vtag %x for dir %d\n", ih->init_tag, !dir);
474479 ct->proto.sctp.vtag[!dir] = ih->init_tag;
475480
476481 /* don't renew timeout on init retransmit so
@@ -481,6 +486,24 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 4 unmodified lines
481486 old_state == SCTP_CONNTRACK_CLOSED &&
482487 nf_ct_is_confirmed(ct))
483488 ignore = true;
489+ } else if (sch->type == SCTP_CID_INIT_ACK) {
490+ struct sctp_inithdr _ih, *ih;
491+ __be32 vtag;
492+
493+ ih = skb_header_pointer(skb, offset + sizeof(_sch), sizeof(*ih), &_ih);
494+ if (!ih)
495+ goto out_unlock;
496+
497+ vtag = ct->proto.sctp.vtag[!dir];
498+ if (!ct->proto.sctp.init[!dir] && vtag && vtag != ih->init_tag)
499+ goto out_unlock;
500+ /* collision */
501+ if (ct->proto.sctp.init[dir] && ct->proto.sctp.init[!dir] &&
502+ vtag != ih->init_tag)
503+ goto out_unlock;
504+
505+ pr_debug("Setting vtag %x for dir %d\n", ih->init_tag, !dir);
506+ ct->proto.sctp.vtag[!dir] = ih->init_tag;
484507 }
485508
486509 ct->proto.sctp.state = new_state;
net/netfilter/nf_tables_api.c+28−16
@@ -7879,24 +7879,14 @@ static int nf_tables_delobj(struct sk_buff *skb, const struct nfnl_info *info, · 7878 unmodified lines
78797879 return nft_delobj(&ctx, obj);
78807880 }
78817881
7882−void nft_obj_notify(struct net *net, const struct nft_table *table,
7883− struct nft_object *obj, u32 portid, u32 seq, int event,
7884− u16 flags, int family, int report, gfp_t gfp)
7882+static void
7883+__nft_obj_notify(struct net *net, const struct nft_table *table,
7884+ struct nft_object *obj, u32 portid, u32 seq, int event,
7885+ u16 flags, int family, int report, gfp_t gfp)
78857886 {
78867887 struct nftables_pernet *nft_net = nft_pernet(net);
78877888 struct sk_buff *skb;
78887889 int err;
7889− char *buf = kasprintf(gfp, "%s:%u",
7890− table->name, nft_net->base_seq);
7891−
7892− audit_log_nfcfg(buf,
7893− family,
7894− obj->handle,
7895− event == NFT_MSG_NEWOBJ ?
7896− AUDIT_NFT_OP_OBJ_REGISTER :
7897− AUDIT_NFT_OP_OBJ_UNREGISTER,
7898− gfp);
7899− kfree(buf);
79007890
79017891 if (!report &&
79027892 !nfnetlink_has_listeners(net, NFNLGRP_NFTABLES))
@@ -7919,13 +7909,35 @@ void nft_obj_notify(struct net *net, const struct nft_table *table, · 16 unmodified lines
79197909 err:
79207910 nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
79217911 }
7912+
7913+void nft_obj_notify(struct net *net, const struct nft_table *table,
7914+ struct nft_object *obj, u32 portid, u32 seq, int event,
7915+ u16 flags, int family, int report, gfp_t gfp)
7916+{
7917+ struct nftables_pernet *nft_net = nft_pernet(net);
7918+ char *buf = kasprintf(gfp, "%s:%u",
7919+ table->name, nft_net->base_seq);
7920+
7921+ audit_log_nfcfg(buf,
7922+ family,
7923+ obj->handle,
7924+ event == NFT_MSG_NEWOBJ ?
7925+ AUDIT_NFT_OP_OBJ_REGISTER :
7926+ AUDIT_NFT_OP_OBJ_UNREGISTER,
7927+ gfp);
7928+ kfree(buf);
7929+
7930+ __nft_obj_notify(net, table, obj, portid, seq, event,
7931+ flags, family, report, gfp);
7932+}
79227933 EXPORT_SYMBOL_GPL(nft_obj_notify);
79237934
79247935 static void nf_tables_obj_notify(const struct nft_ctx *ctx,
79257936 struct nft_object *obj, int event)
79267937 {
7927− nft_obj_notify(ctx->net, ctx->table, obj, ctx->portid, ctx->seq, event,
7928− ctx->flags, ctx->family, ctx->report, GFP_KERNEL);
7938+ __nft_obj_notify(ctx->net, ctx->table, obj, ctx->portid,
7939+ ctx->seq, event, ctx->flags, ctx->family,
7940+ ctx->report, GFP_KERNEL);
79297941 }
79307942
79317943 /*
net/netfilter/nft_payload.c+12−1
@@ -154,6 +154,17 @@ int nft_payload_inner_offset(const struct nft_pktinfo *pkt) · 153 unmodified lines
154154 return pkt->inneroff;
155155 }
156156
157+static bool nft_payload_need_vlan_copy(const struct nft_payload *priv)
158+{
159+ unsigned int len = priv->offset + priv->len;
160+
161+ /* data past ether src/dst requested, copy needed */
162+ if (len > offsetof(struct ethhdr, h_proto))
163+ return true;
164+
165+ return false;
166+}
167+
157168 void nft_payload_eval(const struct nft_expr *expr,
158169 struct nft_regs *regs,
159170 const struct nft_pktinfo *pkt)
@@ -172,7 +183,7 @@ void nft_payload_eval(const struct nft_expr *expr, · 12 unmodified lines
172183 goto err;
173184
174185 if (skb_vlan_tag_present(skb) &&
175− priv->offset >= offsetof(struct ethhdr, h_proto)) {
186+ nft_payload_need_vlan_copy(priv)) {
176187 if (!nft_payload_copy_vlan(dest, skb,
177188 priv->offset, priv->len))
178189 goto err;
net/netfilter/nft_set_rbtree.c+29−17
@@ -233,10 +233,9 @@ static void nft_rbtree_gc_remove(struct net *net, struct nft_set *set, · 232 unmodified lines
233233 rb_erase(&rbe->node, &priv->root);
234234 }
235235
236−static int nft_rbtree_gc_elem(const struct nft_set *__set,
237− struct nft_rbtree *priv,
238− struct nft_rbtree_elem *rbe,
239− u8 genmask)
236+static const struct nft_rbtree_elem *
237+nft_rbtree_gc_elem(const struct nft_set *__set, struct nft_rbtree *priv,
238+ struct nft_rbtree_elem *rbe, u8 genmask)
240239 {
241240 struct nft_set *set = (struct nft_set *)__set;
242241 struct rb_node *prev = rb_prev(&rbe->node);
@@ -246,7 +245,7 @@ static int nft_rbtree_gc_elem(const struct nft_set *__set, · 3 unmodified lines
246245
247246 gc = nft_trans_gc_alloc(set, 0, GFP_ATOMIC);
248247 if (!gc)
249− return -ENOMEM;
248+ return ERR_PTR(-ENOMEM);
250249
251250 /* search for end interval coming before this element.
252251 * end intervals don't carry a timeout extension, they
@@ -261,6 +260,7 @@ static int nft_rbtree_gc_elem(const struct nft_set *__set, · 8 unmodified lines
261260 prev = rb_prev(prev);
262261 }
263262
263+ rbe_prev = NULL;
264264 if (prev) {
265265 rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node);
266266 nft_rbtree_gc_remove(net, set, priv, rbe_prev);
@@ -272,7 +272,7 @@ static int nft_rbtree_gc_elem(const struct nft_set *__set, · 5 unmodified lines
272272 */
273273 gc = nft_trans_gc_queue_sync(gc, GFP_ATOMIC);
274274 if (WARN_ON_ONCE(!gc))
275− return -ENOMEM;
275+ return ERR_PTR(-ENOMEM);
276276
277277 nft_trans_gc_elem_add(gc, rbe_prev);
278278 }
@@ -280,13 +280,13 @@ static int nft_rbtree_gc_elem(const struct nft_set *__set, · 1 unmodified line
280280 nft_rbtree_gc_remove(net, set, priv, rbe);
281281 gc = nft_trans_gc_queue_sync(gc, GFP_ATOMIC);
282282 if (WARN_ON_ONCE(!gc))
283− return -ENOMEM;
283+ return ERR_PTR(-ENOMEM);
284284
285285 nft_trans_gc_elem_add(gc, rbe);
286286
287287 nft_trans_gc_queue_sync_done(gc);
288288
289− return 0;
289+ return rbe_prev;
290290 }
291291
292292 static bool nft_rbtree_update_first(const struct nft_set *set,
@@ -314,7 +314,7 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 21 unmodified lines
314314 struct nft_rbtree *priv = nft_set_priv(set);
315315 u8 cur_genmask = nft_genmask_cur(net);
316316 u8 genmask = nft_genmask_next(net);
317− int d, err;
317+ int d;
318318
319319 /* Descend the tree to search for an existing element greater than the
320320 * key value to insert that is greater than the new element. This is the
@@ -363,9 +363,14 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 42 unmodified lines
363363 */
364364 if (nft_set_elem_expired(&rbe->ext) &&
365365 nft_set_elem_active(&rbe->ext, cur_genmask)) {
366− err = nft_rbtree_gc_elem(set, priv, rbe, genmask);
367− if (err < 0)
368− return err;
366+ const struct nft_rbtree_elem *removed_end;
367+
368+ removed_end = nft_rbtree_gc_elem(set, priv, rbe, genmask);
369+ if (IS_ERR(removed_end))
370+ return PTR_ERR(removed_end);
371+
372+ if (removed_end == rbe_le || removed_end == rbe_ge)
373+ return -EAGAIN;
369374
370375 continue;
371376 }
@@ -486,11 +491,18 @@ static int nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 114 unmodified lines
486491 struct nft_rbtree_elem *rbe = elem->priv;
487492 int err;
488493
489− write_lock_bh(&priv->lock);
490− write_seqcount_begin(&priv->count);
491− err = __nft_rbtree_insert(net, set, rbe, ext);
492− write_seqcount_end(&priv->count);
493− write_unlock_bh(&priv->lock);
494+ do {
495+ if (fatal_signal_pending(current))
496+ return -EINTR;
497+
498+ cond_resched();
499+
500+ write_lock_bh(&priv->lock);
501+ write_seqcount_begin(&priv->count);
502+ err = __nft_rbtree_insert(net, set, rbe, ext);
503+ write_seqcount_end(&priv->count);
504+ write_unlock_bh(&priv->lock);
505+ } while (err == -EAGAIN);
494506
495507 return err;
496508 }
net/netlink/af_netlink.c+4−4
@@ -352,7 +352,7 @@ static void netlink_overrun(struct sock *sk) · 351 unmodified lines
352352 if (!nlk_test_bit(RECV_NO_ENOBUFS, sk)) {
353353 if (!test_and_set_bit(NETLINK_S_CONGESTED,
354354 &nlk_sk(sk)->state)) {
355− sk->sk_err = ENOBUFS;
355+ WRITE_ONCE(sk->sk_err, ENOBUFS);
356356 sk_error_report(sk);
357357 }
358358 }
@@ -1605,7 +1605,7 @@ static int do_one_set_err(struct sock *sk, struct netlink_set_err_data *p) · 1246 unmodified lines
16051605 goto out;
16061606 }
16071607
1608− sk->sk_err = p->code;
1608+ WRITE_ONCE(sk->sk_err, p->code);
16091609 sk_error_report(sk);
16101610 out:
16111611 return ret;
@@ -1991,7 +1991,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, · 379 unmodified lines
19911991 atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) {
19921992 ret = netlink_dump(sk);
19931993 if (ret) {
1994− sk->sk_err = -ret;
1994+ WRITE_ONCE(sk->sk_err, -ret);
19951995 sk_error_report(sk);
19961996 }
19971997 }
@@ -2511,7 +2511,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, · 513 unmodified lines
25112511 err_bad_put:
25122512 nlmsg_free(skb);
25132513 err_skb:
2514− NETLINK_CB(in_skb).sk->sk_err = ENOBUFS;
2514+ WRITE_ONCE(NETLINK_CB(in_skb).sk->sk_err, ENOBUFS);
25152515 sk_error_report(NETLINK_CB(in_skb).sk);
25162516 }
25172517 EXPORT_SYMBOL(netlink_ack);
net/nfc/llcp_core.c+2−0
@@ -1636,7 +1636,9 @@ int nfc_llcp_register_device(struct nfc_dev *ndev) · 1635 unmodified lines
16361636 timer_setup(&local->sdreq_timer, nfc_llcp_sdreq_timer, 0);
16371637 INIT_WORK(&local->sdreq_timeout_work, nfc_llcp_sdreq_timeout_work);
16381638
1639+ spin_lock(&llcp_devices_lock);
16391640 list_add(&local->list, &llcp_devices);
1641+ spin_unlock(&llcp_devices_lock);
16401642
16411643 return 0;
16421644 }
net/rds/tcp_connect.c+2−2
@@ -145,7 +145,7 @@ int rds_tcp_conn_path_connect(struct rds_conn_path *cp) · 144 unmodified lines
145145 addrlen = sizeof(sin);
146146 }
147147
148− ret = sock->ops->bind(sock, addr, addrlen);
148+ ret = kernel_bind(sock, addr, addrlen);
149149 if (ret) {
150150 rdsdebug("bind failed with %d at address %pI6c\n",
151151 ret, &conn->c_laddr);
@@ -173,7 +173,7 @@ int rds_tcp_conn_path_connect(struct rds_conn_path *cp) · 21 unmodified lines
173173 * own the socket
174174 */
175175 rds_tcp_set_callbacks(sock, cp);
176− ret = sock->ops->connect(sock, addr, addrlen, O_NONBLOCK);
176+ ret = kernel_connect(sock, addr, addrlen, O_NONBLOCK);
177177
178178 rdsdebug("connect to address %pI6c returned %d\n", &conn->c_faddr, ret);
179179 if (ret == -EINPROGRESS)
net/rds/tcp_listen.c+1−1
@@ -306,7 +306,7 @@ struct socket *rds_tcp_listen_init(struct net *net, bool isv6) · 305 unmodified lines
306306 addr_len = sizeof(*sin);
307307 }
308308
309− ret = sock->ops->bind(sock, (struct sockaddr *)&ss, addr_len);
309+ ret = kernel_bind(sock, (struct sockaddr *)&ss, addr_len);
310310 if (ret < 0) {
311311 rdsdebug("could not bind %s listener socket: %d\n",
312312 isv6 ? "IPv6" : "IPv4", ret);
net/rfkill/core.c+26−6
@@ -48,6 +48,7 @@ struct rfkill { · 47 unmodified lines
4848 bool persistent;
4949 bool polling_paused;
5050 bool suspended;
51+ bool need_sync;
5152
5253 const struct rfkill_ops *ops;
5354 void *data;
@@ -368,6 +369,17 @@ static void rfkill_set_block(struct rfkill *rfkill, bool blocked) · 314 unmodified lines
368369 rfkill_event(rfkill);
369370 }
370371
372+static void rfkill_sync(struct rfkill *rfkill)
373+{
374+ lockdep_assert_held(&rfkill_global_mutex);
375+
376+ if (!rfkill->need_sync)
377+ return;
378+
379+ rfkill_set_block(rfkill, rfkill_global_states[rfkill->type].cur);
380+ rfkill->need_sync = false;
381+}
382+
371383 static void rfkill_update_global_state(enum rfkill_type type, bool blocked)
372384 {
373385 int i;
@@ -730,6 +742,10 @@ static ssize_t soft_show(struct device *dev, struct device_attribute *attr, · 356 unmodified lines
730742 {
731743 struct rfkill *rfkill = to_rfkill(dev);
732744
745+ mutex_lock(&rfkill_global_mutex);
746+ rfkill_sync(rfkill);
747+ mutex_unlock(&rfkill_global_mutex);
748+
733749 return sysfs_emit(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_SW) ? 1 : 0);
734750 }
735751
@@ -751,6 +767,7 @@ static ssize_t soft_store(struct device *dev, struct device_attribute *attr, · 15 unmodified lines
751767 return -EINVAL;
752768
753769 mutex_lock(&rfkill_global_mutex);
770+ rfkill_sync(rfkill);
754771 rfkill_set_block(rfkill, state);
755772 mutex_unlock(&rfkill_global_mutex);
756773
@@ -783,6 +800,10 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr, · 26 unmodified lines
783800 {
784801 struct rfkill *rfkill = to_rfkill(dev);
785802
803+ mutex_lock(&rfkill_global_mutex);
804+ rfkill_sync(rfkill);
805+ mutex_unlock(&rfkill_global_mutex);
806+
786807 return sysfs_emit(buf, "%d\n", user_state_from_blocked(rfkill->state));
787808 }
788809
@@ -805,6 +826,7 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr, · 16 unmodified lines
805826 return -EINVAL;
806827
807828 mutex_lock(&rfkill_global_mutex);
829+ rfkill_sync(rfkill);
808830 rfkill_set_block(rfkill, state == RFKILL_USER_STATE_SOFT_BLOCKED);
809831 mutex_unlock(&rfkill_global_mutex);
810832
@@ -1032,14 +1054,10 @@ static void rfkill_uevent_work(struct work_struct *work) · 221 unmodified lines
10321054
10331055 static void rfkill_sync_work(struct work_struct *work)
10341056 {
1035− struct rfkill *rfkill;
1036− bool cur;
1037−
1038− rfkill = container_of(work, struct rfkill, sync_work);
1057+ struct rfkill *rfkill = container_of(work, struct rfkill, sync_work);
10391058
10401059 mutex_lock(&rfkill_global_mutex);
1041− cur = rfkill_global_states[rfkill->type].cur;
1042− rfkill_set_block(rfkill, cur);
1060+ rfkill_sync(rfkill);
10431061 mutex_unlock(&rfkill_global_mutex);
10441062 }
10451063
@@ -1087,6 +1105,7 @@ int __must_check rfkill_register(struct rfkill *rfkill) · 41 unmodified lines
10871105 round_jiffies_relative(POLL_INTERVAL));
10881106
10891107 if (!rfkill->persistent || rfkill_epo_lock_active) {
1108+ rfkill->need_sync = true;
10901109 schedule_work(&rfkill->sync_work);
10911110 } else {
10921111 #ifdef CONFIG_RFKILL_INPUT
@@ -1171,6 +1190,7 @@ static int rfkill_fop_open(struct inode *inode, struct file *file) · 78 unmodified lines
11711190 ev = kzalloc(sizeof(*ev), GFP_KERNEL);
11721191 if (!ev)
11731192 goto free;
1193+ rfkill_sync(rfkill);
11741194 rfkill_fill_event(&ev->ev, rfkill, RFKILL_OP_ADD);
11751195 list_add_tail(&ev->list, &data->events);
11761196 }
net/sctp/associola.c+1−2
@@ -1159,8 +1159,7 @@ int sctp_assoc_update(struct sctp_association *asoc, · 1158 unmodified lines
11591159 /* Add any peer addresses from the new association. */
11601160 list_for_each_entry(trans, &new->peer.transport_addr_list,
11611161 transports)
1162− if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr) &&
1163− !sctp_assoc_add_peer(asoc, &trans->ipaddr,
1162+ if (!sctp_assoc_add_peer(asoc, &trans->ipaddr,
11641163 GFP_ATOMIC, trans->state))
11651164 return -ENOMEM;
11661165
net/sctp/socket.c+1−0
@@ -2450,6 +2450,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, · 2449 unmodified lines
24502450 if (trans) {
24512451 trans->hbinterval =
24522452 msecs_to_jiffies(params->spp_hbinterval);
2453+ sctp_transport_reset_hb_timer(trans);
24532454 } else if (asoc) {
24542455 asoc->hbinterval =
24552456 msecs_to_jiffies(params->spp_hbinterval);
net/socket.c+29−7
@@ -737,6 +737,14 @@ static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg) · 736 unmodified lines
737737 return ret;
738738 }
739739
740+static int __sock_sendmsg(struct socket *sock, struct msghdr *msg)
741+{
742+ int err = security_socket_sendmsg(sock, msg,
743+ msg_data_left(msg));
744+
745+ return err ?: sock_sendmsg_nosec(sock, msg);
746+}
747+
740748 /**
741749 * sock_sendmsg - send a message through @sock
742750 * @sock: socket
@@ -747,10 +755,19 @@ static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg) · 4 unmodified lines
747755 */
748756 int sock_sendmsg(struct socket *sock, struct msghdr *msg)
749757 {
750− int err = security_socket_sendmsg(sock, msg,
751− msg_data_left(msg));
758+ struct sockaddr_storage *save_addr = (struct sockaddr_storage *)msg->msg_name;
759+ struct sockaddr_storage address;
760+ int ret;
752761
753− return err ?: sock_sendmsg_nosec(sock, msg);
762+ if (msg->msg_name) {
763+ memcpy(&address, msg->msg_name, msg->msg_namelen);
764+ msg->msg_name = &address;
765+ }
766+
767+ ret = __sock_sendmsg(sock, msg);
768+ msg->msg_name = save_addr;
769+
770+ return ret;
754771 }
755772 EXPORT_SYMBOL(sock_sendmsg);
756773
@@ -1138,7 +1155,7 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from) · 381 unmodified lines
11381155 if (sock->type == SOCK_SEQPACKET)
11391156 msg.msg_flags |= MSG_EOR;
11401157
1141− res = sock_sendmsg(sock, &msg);
1158+ res = __sock_sendmsg(sock, &msg);
11421159 *from = msg.msg_iter;
11431160 return res;
11441161 }
@@ -2174,7 +2191,7 @@ int __sys_sendto(int fd, void __user *buff, size_t len, unsigned int flags, · 1029 unmodified lines
21742191 if (sock->file->f_flags & O_NONBLOCK)
21752192 flags |= MSG_DONTWAIT;
21762193 msg.msg_flags = flags;
2177− err = sock_sendmsg(sock, &msg);
2194+ err = __sock_sendmsg(sock, &msg);
21782195
21792196 out_put:
21802197 fput_light(sock->file, fput_needed);
@@ -2538,7 +2555,7 @@ static int ____sys_sendmsg(struct socket *sock, struct msghdr *msg_sys, · 357 unmodified lines
25382555 err = sock_sendmsg_nosec(sock, msg_sys);
25392556 goto out_freectl;
25402557 }
2541− err = sock_sendmsg(sock, msg_sys);
2558+ err = __sock_sendmsg(sock, msg_sys);
25422559 /*
25432560 * If this is sendmmsg() and sending to current destination address was
25442561 * successful, remember it.
@@ -3499,7 +3516,12 @@ static long compat_sock_ioctl(struct file *file, unsigned int cmd, · 954 unmodified lines
34993516
35003517 int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen)
35013518 {
3502− return READ_ONCE(sock->ops)->bind(sock, addr, addrlen);
3519+ struct sockaddr_storage address;
3520+
3521+ memcpy(&address, addr, addrlen);
3522+
3523+ return READ_ONCE(sock->ops)->bind(sock, (struct sockaddr *)&address,
3524+ addrlen);
35033525 }
35043526 EXPORT_SYMBOL(kernel_bind);
35053527
net/sunrpc/auth.c+8−3
@@ -769,9 +769,14 @@ int rpcauth_wrap_req(struct rpc_task *task, struct xdr_stream *xdr) · 768 unmodified lines
769769 * @task: controlling RPC task
770770 * @xdr: xdr_stream containing RPC Reply header
771771 *
772− * On success, @xdr is updated to point past the verifier and
773− * zero is returned. Otherwise, @xdr is in an undefined state
774− * and a negative errno is returned.
772+ * Return values:
773+ * %0: Verifier is valid. @xdr now points past the verifier.
774+ * %-EIO: Verifier is corrupted or message ended early.
775+ * %-EACCES: Verifier is intact but not valid.
776+ * %-EPROTONOSUPPORT: Server does not support the requested auth type.
777+ *
778+ * When a negative errno is returned, @xdr is left in an undefined
779+ * state.
775780 */
776781 int
777782 rpcauth_checkverf(struct rpc_task *task, struct xdr_stream *xdr)
net/sunrpc/auth_tls.c+2−2
@@ -129,9 +129,9 @@ static int tls_validate(struct rpc_task *task, struct xdr_stream *xdr) · 128 unmodified lines
129129 if (*p != rpc_auth_null)
130130 return -EIO;
131131 if (xdr_stream_decode_opaque_inline(xdr, &str, starttls_len) != starttls_len)
132− return -EIO;
132+ return -EPROTONOSUPPORT;
133133 if (memcmp(str, starttls_token, starttls_len))
134− return -EIO;
134+ return -EPROTONOSUPPORT;
135135 return 0;
136136 }
137137
net/sunrpc/clnt.c+10−3
@@ -2476,8 +2476,7 @@ call_status(struct rpc_task *task) · 2475 unmodified lines
24762476 goto out_exit;
24772477 }
24782478 task->tk_action = call_encode;
2479− if (status != -ECONNRESET && status != -ECONNABORTED)
2480− rpc_check_timeout(task);
2479+ rpc_check_timeout(task);
24812480 return;
24822481 out_exit:
24832482 rpc_call_rpcerror(task, status);
@@ -2725,7 +2724,15 @@ out_unparsable: · 241 unmodified lines
27252724
27262725 out_verifier:
27272726 trace_rpc_bad_verifier(task);
2728− goto out_garbage;
2727+ switch (error) {
2728+ case -EPROTONOSUPPORT:
2729+ goto out_err;
2730+ case -EACCES:
2731+ /* Re-encode with a fresh cred */
2732+ fallthrough;
2733+ default:
2734+ goto out_garbage;
2735+ }
27292736
27302737 out_msg_denied:
27312738 error = -EACCES;
net/sunrpc/xprtsock.c+6−0
@@ -2672,6 +2672,10 @@ static void xs_tcp_tls_setup_socket(struct work_struct *work) · 2671 unmodified lines
26722672 rcu_read_lock();
26732673 lower_xprt = rcu_dereference(lower_clnt->cl_xprt);
26742674 rcu_read_unlock();
2675+
2676+ if (wait_on_bit_lock(&lower_xprt->state, XPRT_LOCKED, TASK_KILLABLE))
2677+ goto out_unlock;
2678+
26752679 status = xs_tls_handshake_sync(lower_xprt, &upper_xprt->xprtsec);
26762680 if (status) {
26772681 trace_rpc_tls_not_started(upper_clnt, upper_xprt);
@@ -2681,6 +2685,7 @@ static void xs_tcp_tls_setup_socket(struct work_struct *work) · 3 unmodified lines
26812685 status = xs_tcp_tls_finish_connecting(lower_xprt, upper_transport);
26822686 if (status)
26832687 goto out_close;
2688+ xprt_release_write(lower_xprt, NULL);
26842689
26852690 trace_rpc_socket_connect(upper_xprt, upper_transport->sock, 0);
26862691 if (!xprt_test_and_set_connected(upper_xprt)) {
@@ -2702,6 +2707,7 @@ out_unlock: · 15 unmodified lines
27022707 return;
27032708
27042709 out_close:
2710+ xprt_release_write(lower_xprt, NULL);
27052711 rpc_shutdown_client(lower_clnt);
27062712
27072713 /* xprt_force_disconnect() wakes tasks with a fixed tk_status code.
net/tipc/crypto.c+2−2
@@ -1441,14 +1441,14 @@ static int tipc_crypto_key_revoke(struct net *net, u8 tx_key) · 1440 unmodified lines
14411441 struct tipc_crypto *tx = tipc_net(net)->crypto_tx;
14421442 struct tipc_key key;
14431443
1444− spin_lock(&tx->lock);
1444+ spin_lock_bh(&tx->lock);
14451445 key = tx->key;
14461446 WARN_ON(!key.active || tx_key != key.active);
14471447
14481448 /* Free the active key */
14491449 tipc_crypto_key_set_state(tx, key.passive, 0, key.pending);
14501450 tipc_crypto_key_detach(tx->aead[key.active], &tx->lock);
1451− spin_unlock(&tx->lock);
1451+ spin_unlock_bh(&tx->lock);
14521452
14531453 pr_warn("%s: key is revoked\n", tx->name);
14541454 return -EKEYREVOKED;
net/wireless/core.c+7−7
@@ -1181,16 +1181,11 @@ void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked, · 1180 unmodified lines
11811181 }
11821182 EXPORT_SYMBOL(wiphy_rfkill_set_hw_state_reason);
11831183
1184−void cfg80211_cqm_config_free(struct wireless_dev *wdev)
1185−{
1186− kfree(wdev->cqm_config);
1187− wdev->cqm_config = NULL;
1188−}
1189−
11901184 static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,
11911185 bool unregister_netdev)
11921186 {
11931187 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1188+ struct cfg80211_cqm_config *cqm_config;
11941189 unsigned int link_id;
11951190
11961191 ASSERT_RTNL();
@@ -1227,7 +1222,10 @@ static void _cfg80211_unregister_wdev(struct wireless_dev *wdev, · 30 unmodified lines
12271222 kfree_sensitive(wdev->wext.keys);
12281223 wdev->wext.keys = NULL;
12291224 #endif
1230− cfg80211_cqm_config_free(wdev);
1225+ wiphy_work_cancel(wdev->wiphy, &wdev->cqm_rssi_work);
1226+ /* deleted from the list, so can't be found from nl80211 any more */
1227+ cqm_config = rcu_access_pointer(wdev->cqm_config);
1228+ kfree_rcu(cqm_config, rcu_head);
12311229
12321230 /*
12331231 * Ensure that all events have been processed and
@@ -1379,6 +1377,8 @@ void cfg80211_init_wdev(struct wireless_dev *wdev) · 145 unmodified lines
13791377 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
13801378 #endif
13811379
1380+ wiphy_work_init(&wdev->cqm_rssi_work, cfg80211_cqm_rssi_notify_work);
1381+
13821382 if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
13831383 wdev->ps = true;
13841384 else
net/wireless/core.h+5−2
@@ -295,12 +295,17 @@ struct cfg80211_beacon_registration { · 294 unmodified lines
295295 };
296296
297297 struct cfg80211_cqm_config {
298+ struct rcu_head rcu_head;
298299 u32 rssi_hyst;
299300 s32 last_rssi_event_value;
301+ enum nl80211_cqm_rssi_threshold_event last_rssi_event_type;
300302 int n_rssi_thresholds;
301303 s32 rssi_thresholds[] __counted_by(n_rssi_thresholds);
302304 };
303305
306+void cfg80211_cqm_rssi_notify_work(struct wiphy *wiphy,
307+ struct wiphy_work *work);
308+
304309 void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev);
305310
306311 /* free object */
@@ -566,8 +571,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, · 259 unmodified lines
566571 #define CFG80211_DEV_WARN_ON(cond) ({bool __r = (cond); __r; })
567572 #endif
568573
569−void cfg80211_cqm_config_free(struct wireless_dev *wdev);
570−
571574 void cfg80211_release_pmsr(struct wireless_dev *wdev, u32 portid);
572575 void cfg80211_pmsr_wdev_down(struct wireless_dev *wdev);
573576 void cfg80211_pmsr_free_wk(struct work_struct *work);
net/wireless/mlme.c+2−1
@@ -52,7 +52,8 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, · 51 unmodified lines
5252 cr.links[link_id].bssid = data->links[link_id].bss->bssid;
5353 cr.links[link_id].addr = data->links[link_id].addr;
5454 /* need to have local link addresses for MLO connections */
55− WARN_ON(cr.ap_mld_addr && !cr.links[link_id].addr);
55+ WARN_ON(cr.ap_mld_addr &&
56+ !is_valid_ether_addr(cr.links[link_id].addr));
5657
5758 BUG_ON(!cr.links[link_id].bss->channel);
5859
net/wireless/nl80211.c+81−33
@@ -5909,6 +5909,21 @@ out: · 5908 unmodified lines
59095909 nlmsg_free(msg);
59105910 }
59115911
5912+static int nl80211_validate_ap_phy_operation(struct cfg80211_ap_settings *params)
5913+{
5914+ struct ieee80211_channel *channel = params->chandef.chan;
5915+
5916+ if ((params->he_cap || params->he_oper) &&
5917+ (channel->flags & IEEE80211_CHAN_NO_HE))
5918+ return -EOPNOTSUPP;
5919+
5920+ if ((params->eht_cap || params->eht_oper) &&
5921+ (channel->flags & IEEE80211_CHAN_NO_EHT))
5922+ return -EOPNOTSUPP;
5923+
5924+ return 0;
5925+}
5926+
59125927 static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
59135928 {
59145929 struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -6178,6 +6193,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) · 263 unmodified lines
61786193 if (err)
61796194 goto out_unlock;
61806195
6196+ err = nl80211_validate_ap_phy_operation(params);
6197+ if (err)
6198+ goto out_unlock;
6199+
61816200 if (info->attrs[NL80211_ATTR_AP_SETTINGS_FLAGS])
61826201 params->flags = nla_get_u32(
61836202 info->attrs[NL80211_ATTR_AP_SETTINGS_FLAGS]);
@@ -8482,7 +8501,7 @@ static int nl80211_update_mesh_config(struct sk_buff *skb, · 2298 unmodified lines
84828501 struct cfg80211_registered_device *rdev = info->user_ptr[0];
84838502 struct net_device *dev = info->user_ptr[1];
84848503 struct wireless_dev *wdev = dev->ieee80211_ptr;
8485− struct mesh_config cfg;
8504+ struct mesh_config cfg = {};
84868505 u32 mask;
84878506 int err;
84888507
@@ -12796,7 +12815,8 @@ static int nl80211_set_cqm_txe(struct genl_info *info, · 4307 unmodified lines
1279612815 }
1279712816
1279812817 static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev,
12799− struct net_device *dev)
12818+ struct net_device *dev,
12819+ struct cfg80211_cqm_config *cqm_config)
1280012820 {
1280112821 struct wireless_dev *wdev = dev->ieee80211_ptr;
1280212822 s32 last, low, high;
@@ -12805,7 +12825,7 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, · 2 unmodified lines
1280512825 int err;
1280612826
1280712827 /* RSSI reporting disabled? */
12808− if (!wdev->cqm_config)
12828+ if (!cqm_config)
1280912829 return rdev_set_cqm_rssi_range_config(rdev, dev, 0, 0);
1281012830
1281112831 /*
@@ -12814,7 +12834,7 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, · 2 unmodified lines
1281412834 * connection is established and enough beacons received to calculate
1281512835 * the average.
1281612836 */
12817− if (!wdev->cqm_config->last_rssi_event_value &&
12837+ if (!cqm_config->last_rssi_event_value &&
1281812838 wdev->links[0].client.current_bss &&
1281912839 rdev->ops->get_station) {
1282012840 struct station_info sinfo = {};
@@ -12828,30 +12848,30 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, · 7 unmodified lines
1282812848
1282912849 cfg80211_sinfo_release_content(&sinfo);
1283012850 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG))
12831− wdev->cqm_config->last_rssi_event_value =
12851+ cqm_config->last_rssi_event_value =
1283212852 (s8) sinfo.rx_beacon_signal_avg;
1283312853 }
1283412854
12835− last = wdev->cqm_config->last_rssi_event_value;
12836− hyst = wdev->cqm_config->rssi_hyst;
12837− n = wdev->cqm_config->n_rssi_thresholds;
12855+ last = cqm_config->last_rssi_event_value;
12856+ hyst = cqm_config->rssi_hyst;
12857+ n = cqm_config->n_rssi_thresholds;
1283812858
1283912859 for (i = 0; i < n; i++) {
1284012860 i = array_index_nospec(i, n);
12841− if (last < wdev->cqm_config->rssi_thresholds[i])
12861+ if (last < cqm_config->rssi_thresholds[i])
1284212862 break;
1284312863 }
1284412864
1284512865 low_index = i - 1;
1284612866 if (low_index >= 0) {
1284712867 low_index = array_index_nospec(low_index, n);
12848− low = wdev->cqm_config->rssi_thresholds[low_index] - hyst;
12868+ low = cqm_config->rssi_thresholds[low_index] - hyst;
1284912869 } else {
1285012870 low = S32_MIN;
1285112871 }
1285212872 if (i < n) {
1285312873 i = array_index_nospec(i, n);
12854− high = wdev->cqm_config->rssi_thresholds[i] + hyst - 1;
12874+ high = cqm_config->rssi_thresholds[i] + hyst - 1;
1285512875 } else {
1285612876 high = S32_MAX;
1285712877 }
@@ -12864,6 +12884,7 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, · 6 unmodified lines
1286412884 u32 hysteresis)
1286512885 {
1286612886 struct cfg80211_registered_device *rdev = info->user_ptr[0];
12887+ struct cfg80211_cqm_config *cqm_config = NULL, *old;
1286712888 struct net_device *dev = info->user_ptr[1];
1286812889 struct wireless_dev *wdev = dev->ieee80211_ptr;
1286912890 int i, err;
@@ -12881,10 +12902,6 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, · 11 unmodified lines
1288112902 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
1288212903 return -EOPNOTSUPP;
1288312904
12884− wdev_lock(wdev);
12885− cfg80211_cqm_config_free(wdev);
12886− wdev_unlock(wdev);
12887−
1288812905 if (n_thresholds <= 1 && rdev->ops->set_cqm_rssi_config) {
1288912906 if (n_thresholds == 0 || thresholds[0] == 0) /* Disabling */
1289012907 return rdev_set_cqm_rssi_config(rdev, dev, 0, 0);
@@ -12901,9 +12918,10 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, · 10 unmodified lines
1290112918 n_thresholds = 0;
1290212919
1290312920 wdev_lock(wdev);
12904− if (n_thresholds) {
12905− struct cfg80211_cqm_config *cqm_config;
12921+ old = rcu_dereference_protected(wdev->cqm_config,
12922+ lockdep_is_held(&wdev->mtx));
1290612923
12924+ if (n_thresholds) {
1290712925 cqm_config = kzalloc(struct_size(cqm_config, rssi_thresholds,
1290812926 n_thresholds),
1290912927 GFP_KERNEL);
@@ -12918,11 +12936,18 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, · 8 unmodified lines
1291812936 flex_array_size(cqm_config, rssi_thresholds,
1291912937 n_thresholds));
1292012938
12921− wdev->cqm_config = cqm_config;
12939+ rcu_assign_pointer(wdev->cqm_config, cqm_config);
12940+ } else {
12941+ RCU_INIT_POINTER(wdev->cqm_config, NULL);
1292212942 }
1292312943
12924− err = cfg80211_cqm_rssi_update(rdev, dev);
12925−
12944+ err = cfg80211_cqm_rssi_update(rdev, dev, cqm_config);
12945+ if (err) {
12946+ rcu_assign_pointer(wdev->cqm_config, old);
12947+ kfree_rcu(cqm_config, rcu_head);
12948+ } else {
12949+ kfree_rcu(old, rcu_head);
12950+ }
1292612951 unlock:
1292712952 wdev_unlock(wdev);
1292812953
@@ -19073,9 +19098,8 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, · 6144 unmodified lines
1907319098 enum nl80211_cqm_rssi_threshold_event rssi_event,
1907419099 s32 rssi_level, gfp_t gfp)
1907519100 {
19076− struct sk_buff *msg;
1907719101 struct wireless_dev *wdev = dev->ieee80211_ptr;
19078− struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
19102+ struct cfg80211_cqm_config *cqm_config;
1907919103
1908019104 trace_cfg80211_cqm_rssi_notify(dev, rssi_event, rssi_level);
1908119105
@@ -19083,18 +19107,41 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, · 1 unmodified line
1908319107 rssi_event != NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH))
1908419108 return;
1908519109
19086− if (wdev->cqm_config) {
19087− wdev->cqm_config->last_rssi_event_value = rssi_level;
19110+ rcu_read_lock();
19111+ cqm_config = rcu_dereference(wdev->cqm_config);
19112+ if (cqm_config) {
19113+ cqm_config->last_rssi_event_value = rssi_level;
19114+ cqm_config->last_rssi_event_type = rssi_event;
19115+ wiphy_work_queue(wdev->wiphy, &wdev->cqm_rssi_work);
19116+ }
19117+ rcu_read_unlock();
19118+}
19119+EXPORT_SYMBOL(cfg80211_cqm_rssi_notify);
1908819120
19089− cfg80211_cqm_rssi_update(rdev, dev);
19121+void cfg80211_cqm_rssi_notify_work(struct wiphy *wiphy, struct wiphy_work *work)
19122+{
19123+ struct wireless_dev *wdev = container_of(work, struct wireless_dev,
19124+ cqm_rssi_work);
19125+ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
19126+ enum nl80211_cqm_rssi_threshold_event rssi_event;
19127+ struct cfg80211_cqm_config *cqm_config;
19128+ struct sk_buff *msg;
19129+ s32 rssi_level;
1909019130
19091− if (rssi_level == 0)
19092− rssi_level = wdev->cqm_config->last_rssi_event_value;
19093− }
19131+ wdev_lock(wdev);
19132+ cqm_config = rcu_dereference_protected(wdev->cqm_config,
19133+ lockdep_is_held(&wdev->mtx));
19134+ if (!wdev->cqm_config)
19135+ goto unlock;
1909419136
19095− msg = cfg80211_prepare_cqm(dev, NULL, gfp);
19137+ cfg80211_cqm_rssi_update(rdev, wdev->netdev, cqm_config);
19138+
19139+ rssi_level = cqm_config->last_rssi_event_value;
19140+ rssi_event = cqm_config->last_rssi_event_type;
19141+
19142+ msg = cfg80211_prepare_cqm(wdev->netdev, NULL, GFP_KERNEL);
1909619143 if (!msg)
19097− return;
19144+ goto unlock;
1909819145
1909919146 if (nla_put_u32(msg, NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT,
1910019147 rssi_event))
@@ -19104,14 +19151,15 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, · 3 unmodified lines
1910419151 rssi_level))
1910519152 goto nla_put_failure;
1910619153
19107− cfg80211_send_cqm(msg, gfp);
19154+ cfg80211_send_cqm(msg, GFP_KERNEL);
1910819155
19109− return;
19156+ goto unlock;
1911019157
1911119158 nla_put_failure:
1911219159 nlmsg_free(msg);
19160+ unlock:
19161+ wdev_unlock(wdev);
1911319162 }
19114−EXPORT_SYMBOL(cfg80211_cqm_rssi_notify);
1911519163
1911619164 void cfg80211_cqm_txe_notify(struct net_device *dev,
1911719165 const u8 *peer, u32 num_packets,
net/wireless/scan.c+4−0
@@ -908,6 +908,10 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev) · 907 unmodified lines
908908 !cfg80211_find_ssid_match(ap, request))
909909 continue;
910910
911+ if (!is_broadcast_ether_addr(request->bssid) &&
912+ !ether_addr_equal(request->bssid, ap->bssid))
913+ continue;
914+
911915 if (!request->n_ssids && ap->multi_bss && !ap->transmitted_bssid)
912916 continue;
913917
scripts/Makefile.modinst+1−1
@@ -144,7 +144,7 @@ endif · 143 unmodified lines
144144 quiet_cmd_gzip = GZIP $@
145145 cmd_gzip = $(KGZIP) -n -f $<
146146 quiet_cmd_xz = XZ $@
147− cmd_xz = $(XZ) --lzma2=dict=2MiB -f $<
147+ cmd_xz = $(XZ) --check=crc32 --lzma2=dict=1MiB -f $<
148148 quiet_cmd_zstd = ZSTD $@
149149 cmd_zstd = $(ZSTD) -T0 --rm -f -q $<
150150
scripts/atomic/gen-atomic-fallback.sh+1−1
@@ -102,7 +102,7 @@ gen_proto_order_variant() · 101 unmodified lines
102102 fi
103103
104104 # Allow ACQUIRE/RELEASE/RELAXED ops to be defined in terms of FULL ops
105− if [ ! -z "${order}" ]; then
105+ if [ ! -z "${order}" ] && ! meta_is_implicitly_relaxed "${meta}"; then
106106 printf "#elif defined(arch_${basename})\n"
107107 printf "\t${retstmt}arch_${basename}(${args});\n"
108108 fi
scripts/gdb/linux/symbols.py+2−21
@@ -111,12 +111,11 @@ lx-symbols command.""" · 110 unmodified lines
111111 return "{textaddr} {sections}".format(
112112 textaddr=textaddr, sections="".join(args))
113113
114− def load_module_symbols(self, module, module_file=None):
114+ def load_module_symbols(self, module):
115115 module_name = module['name'].string()
116116 module_addr = str(module['mem'][constants.LX_MOD_TEXT]['base']).split()[0]
117117
118− if not module_file:
119− module_file = self._get_module_file(module_name)
118+ module_file = self._get_module_file(module_name)
120119 if not module_file and not self.module_files_updated:
121120 self._update_module_files()
122121 module_file = self._get_module_file(module_name)
@@ -139,19 +138,6 @@ lx-symbols command.""" · 16 unmodified lines
139138 else:
140139 gdb.write("no module object found for '{0}'\n".format(module_name))
141140
142− def load_ko_symbols(self, mod_path):
143− self.loaded_modules = []
144− module_list = modules.module_list()
145−
146− for module in module_list:
147− module_name = module['name'].string()
148− module_pattern = ".*/{0}\.ko(?:.debug)?$".format(
149− module_name.replace("_", r"[_\-]"))
150− if re.match(module_pattern, mod_path) and os.path.exists(mod_path):
151− self.load_module_symbols(module, mod_path)
152− return
153− raise gdb.GdbError("%s is not a valid .ko\n" % mod_path)
154−
155141 def load_all_symbols(self):
156142 gdb.write("loading vmlinux\n")
157143
@@ -190,11 +176,6 @@ lx-symbols command.""" · 32 unmodified lines
190176 self.module_files = []
191177 self.module_files_updated = False
192178
193− argv = gdb.string_to_argv(arg)
194− if len(argv) == 1:
195− self.load_ko_symbols(argv[0])
196− return
197−
198179 self.load_all_symbols()
199180
200181 if hasattr(gdb, 'Breakpoint'):
scripts/mod/file2alias.c+1−1
@@ -1604,7 +1604,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, · 1603 unmodified lines
16041604 /* First handle the "special" cases */
16051605 if (sym_is(name, namelen, "usb"))
16061606 do_usb_table(symval, sym->st_size, mod);
1607− if (sym_is(name, namelen, "of"))
1607+ else if (sym_is(name, namelen, "of"))
16081608 do_of_table(symval, sym->st_size, mod);
16091609 else if (sym_is(name, namelen, "pnp"))
16101610 do_pnp_device_entry(symval, sym->st_size, mod);
scripts/mod/modpost.c+13−2
@@ -1015,9 +1015,20 @@ static int secref_whitelist(const char *fromsec, const char *fromsym, · 1014 unmodified lines
10151015 "*_console")))
10161016 return 0;
10171017
1018− /* symbols in data sections that may refer to meminit/exit sections */
1018+ /* symbols in data sections that may refer to meminit sections */
10191019 if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
1020− match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
1020+ match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_XXXEXIT_SECTIONS)) &&
1021+ match(fromsym, PATTERNS("*driver")))
1022+ return 0;
1023+
1024+ /*
1025+ * symbols in data sections must not refer to .exit.*, but there are
1026+ * quite a few offenders, so hide these unless for W=1 builds until
1027+ * these are fixed.
1028+ */
1029+ if (!extra_warn &&
1030+ match(fromsec, PATTERNS(DATA_SECTIONS)) &&
1031+ match(tosec, PATTERNS(EXIT_SECTIONS)) &&
10211032 match(fromsym, PATTERNS("*driver")))
10221033 return 0;
10231034
scripts/package/builddeb+0−1
@@ -64,7 +64,6 @@ install_linux_image () { · 63 unmodified lines
6464
6565 ${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${pdir}" modules_install
6666 rm -f "${pdir}/lib/modules/${KERNELRELEASE}/build"
67− rm -f "${pdir}/lib/modules/${KERNELRELEASE}/source"
6867
6968 # Install the kernel
7069 if [ "${ARCH}" = um ] ; then
scripts/package/kernel.spec+0−3
@@ -68,7 +68,6 @@ cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEA · 67 unmodified lines
6868 cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE}
6969 cp .config %{buildroot}/boot/config-%{KERNELRELEASE}
7070 ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
71−ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/source
7271 %if %{with_devel}
7372 %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
7473 %endif
@@ -101,7 +100,6 @@ fi · 26 unmodified lines
101100 %defattr (-, root, root)
102101 /lib/modules/%{KERNELRELEASE}
103102 %exclude /lib/modules/%{KERNELRELEASE}/build
104−%exclude /lib/modules/%{KERNELRELEASE}/source
105103 /boot/*
106104
107105 %files headers
@@ -113,5 +111,4 @@ fi · 5 unmodified lines
113111 %defattr (-, root, root)
114112 /usr/src/kernels/%{KERNELRELEASE}
115113 /lib/modules/%{KERNELRELEASE}/build
116−/lib/modules/%{KERNELRELEASE}/source
117114 %endif
security/integrity/ima/Kconfig+8−14
@@ -29,9 +29,11 @@ config IMA · 28 unmodified lines
2929 to learn more about IMA.
3030 If unsure, say N.
3131
32+if IMA
33+
3234 config IMA_KEXEC
3335 bool "Enable carrying the IMA measurement list across a soft boot"
34− depends on IMA && TCG_TPM && HAVE_IMA_KEXEC
36+ depends on TCG_TPM && HAVE_IMA_KEXEC
3537 default n
3638 help
3739 TPM PCRs are only reset on a hard reboot. In order to validate
@@ -43,7 +45,6 @@ config IMA_KEXEC · 5 unmodified lines
4345
4446 config IMA_MEASURE_PCR_IDX
4547 int
46− depends on IMA
4748 range 8 14
4849 default 10
4950 help
@@ -53,7 +54,7 @@ config IMA_MEASURE_PCR_IDX · 3 unmodified lines
5354
5455 config IMA_LSM_RULES
5556 bool
56− depends on IMA && AUDIT && (SECURITY_SELINUX || SECURITY_SMACK || SECURITY_APPARMOR)
57+ depends on AUDIT && (SECURITY_SELINUX || SECURITY_SMACK || SECURITY_APPARMOR)
5758 default y
5859 help
5960 Disabling this option will disregard LSM based policy rules.
@@ -61,7 +62,6 @@ config IMA_LSM_RULES · 1 unmodified line
6162 choice
6263 prompt "Default template"
6364 default IMA_NG_TEMPLATE
64− depends on IMA
6565 help
6666 Select the default IMA measurement template.
6767
@@ -80,14 +80,12 @@ endchoice · 12 unmodified lines
8080
8181 config IMA_DEFAULT_TEMPLATE
8282 string
83− depends on IMA
8483 default "ima-ng" if IMA_NG_TEMPLATE
8584 default "ima-sig" if IMA_SIG_TEMPLATE
8685
8786 choice
8887 prompt "Default integrity hash algorithm"
8988 default IMA_DEFAULT_HASH_SHA1
90− depends on IMA
9189 help
9290 Select the default hash algorithm used for the measurement
9391 list, integrity appraisal and audit log. The compiled default
@@ -117,7 +115,6 @@ endchoice · 23 unmodified lines
117115
118116 config IMA_DEFAULT_HASH
119117 string
120− depends on IMA
121118 default "sha1" if IMA_DEFAULT_HASH_SHA1
122119 default "sha256" if IMA_DEFAULT_HASH_SHA256
123120 default "sha512" if IMA_DEFAULT_HASH_SHA512
@@ -126,7 +123,6 @@ config IMA_DEFAULT_HASH · 2 unmodified lines
126123
127124 config IMA_WRITE_POLICY
128125 bool "Enable multiple writes to the IMA policy"
129− depends on IMA
130126 default n
131127 help
132128 IMA policy can now be updated multiple times. The new rules get
@@ -137,7 +133,6 @@ config IMA_WRITE_POLICY · 4 unmodified lines
137133
138134 config IMA_READ_POLICY
139135 bool "Enable reading back the current IMA policy"
140− depends on IMA
141136 default y if IMA_WRITE_POLICY
142137 default n if !IMA_WRITE_POLICY
143138 help
@@ -147,7 +142,6 @@ config IMA_READ_POLICY · 3 unmodified lines
147142
148143 config IMA_APPRAISE
149144 bool "Appraise integrity measurements"
150− depends on IMA
151145 default n
152146 help
153147 This option enables local measurement integrity appraisal.
@@ -269,7 +263,7 @@ config IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY · 115 unmodified lines
269263 config IMA_BLACKLIST_KEYRING
270264 bool "Create IMA machine owner blacklist keyrings (EXPERIMENTAL)"
271265 depends on SYSTEM_TRUSTED_KEYRING
272− depends on IMA_TRUSTED_KEYRING
266+ depends on INTEGRITY_TRUSTED_KEYRING
273267 default n
274268 help
275269 This option creates an IMA blacklist keyring, which contains all
@@ -279,7 +273,7 @@ config IMA_BLACKLIST_KEYRING · 3 unmodified lines
279273
280274 config IMA_LOAD_X509
281275 bool "Load X509 certificate onto the '.ima' trusted keyring"
282− depends on IMA_TRUSTED_KEYRING
276+ depends on INTEGRITY_TRUSTED_KEYRING
283277 default n
284278 help
285279 File signature verification is based on the public keys
@@ -304,7 +298,6 @@ config IMA_APPRAISE_SIGNED_INIT · 18 unmodified lines
304298
305299 config IMA_MEASURE_ASYMMETRIC_KEYS
306300 bool
307− depends on IMA
308301 depends on ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
309302 default y
310303
@@ -323,7 +316,8 @@ config IMA_SECURE_AND_OR_TRUSTED_BOOT · 12 unmodified lines
323316
324317 config IMA_DISABLE_HTABLE
325318 bool "Disable htable to allow measurement of duplicate records"
326− depends on IMA
327319 default n
328320 help
329321 This option disables htable to allow measurement of duplicate records.
322+
323+endif
tools/arch/x86/include/asm/msr-index.h+12−0
@@ -57,6 +57,7 @@ · 56 unmodified lines
5757
5858 #define MSR_IA32_PRED_CMD 0x00000049 /* Prediction Command */
5959 #define PRED_CMD_IBPB BIT(0) /* Indirect Branch Prediction Barrier */
60+#define PRED_CMD_SBPB BIT(7) /* Selective Branch Prediction Barrier */
6061
6162 #define MSR_PPIN_CTL 0x0000004e
6263 #define MSR_PPIN 0x0000004f
@@ -155,6 +156,15 @@ · 92 unmodified lines
155156 * Not susceptible to Post-Barrier
156157 * Return Stack Buffer Predictions.
157158 */
159+#define ARCH_CAP_GDS_CTRL BIT(25) /*
160+ * CPU is vulnerable to Gather
161+ * Data Sampling (GDS) and
162+ * has controls for mitigation.
163+ */
164+#define ARCH_CAP_GDS_NO BIT(26) /*
165+ * CPU is not vulnerable to Gather
166+ * Data Sampling (GDS).
167+ */
158168
159169 #define ARCH_CAP_XAPIC_DISABLE BIT(21) /*
160170 * IA32_XAPIC_DISABLE_STATUS MSR
@@ -178,6 +188,8 @@ · 17 unmodified lines
178188 #define RNGDS_MITG_DIS BIT(0) /* SRBDS support */
179189 #define RTM_ALLOW BIT(1) /* TSX development mode */
180190 #define FB_CLEAR_DIS BIT(3) /* CPU Fill buffer clear disable */
191+#define GDS_MITG_DIS BIT(4) /* Disable GDS mitigation */
192+#define GDS_MITG_LOCKED BIT(5) /* GDS mitigation locked */
181193
182194 #define MSR_IA32_SYSENTER_CS 0x00000174
183195 #define MSR_IA32_SYSENTER_ESP 0x00000175
tools/include/uapi/asm-generic/unistd.h+4−1
@@ -820,8 +820,11 @@ __SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node) · 819 unmodified lines
820820 #define __NR_cachestat 451
821821 __SYSCALL(__NR_cachestat, sys_cachestat)
822822
823+#define __NR_fchmodat2 452
824+__SYSCALL(__NR_fchmodat2, sys_fchmodat2)
825+
823826 #undef __NR_syscalls
824−#define __NR_syscalls 452
827+#define __NR_syscalls 453
825828
826829 /*
827830 * 32 bit systems traditionally used different
tools/include/uapi/drm/drm.h+69−15
@@ -673,8 +673,11 @@ struct drm_gem_open { · 672 unmodified lines
673673 * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT
674674 * and &DRM_PRIME_CAP_EXPORT.
675675 *
676− * PRIME buffers are exposed as dma-buf file descriptors. See
677− * Documentation/gpu/drm-mm.rst, section "PRIME Buffer Sharing".
676+ * Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and
677+ * &DRM_PRIME_CAP_EXPORT are always advertised.
678+ *
679+ * PRIME buffers are exposed as dma-buf file descriptors.
680+ * See :ref:`prime_buffer_sharing`.
678681 */
679682 #define DRM_CAP_PRIME 0x5
680683 /**
@@ -682,6 +685,8 @@ struct drm_gem_open { · 1 unmodified line
682685 *
683686 * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME
684687 * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.
688+ *
689+ * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
685690 */
686691 #define DRM_PRIME_CAP_IMPORT 0x1
687692 /**
@@ -689,6 +694,8 @@ struct drm_gem_open { · 1 unmodified line
689694 *
690695 * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME
691696 * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.
697+ *
698+ * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
692699 */
693700 #define DRM_PRIME_CAP_EXPORT 0x2
694701 /**
@@ -756,15 +763,14 @@ struct drm_gem_open { · 61 unmodified lines
756763 /**
757764 * DRM_CAP_SYNCOBJ
758765 *
759− * If set to 1, the driver supports sync objects. See
760− * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects".
766+ * If set to 1, the driver supports sync objects. See :ref:`drm_sync_objects`.
761767 */
762768 #define DRM_CAP_SYNCOBJ 0x13
763769 /**
764770 * DRM_CAP_SYNCOBJ_TIMELINE
765771 *
766772 * If set to 1, the driver supports timeline operations on sync objects. See
767− * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects".
773+ * :ref:`drm_sync_objects`.
768774 */
769775 #define DRM_CAP_SYNCOBJ_TIMELINE 0x14
770776
@@ -909,6 +915,27 @@ struct drm_syncobj_timeline_wait { · 138 unmodified lines
909915 __u32 pad;
910916 };
911917
918+/**
919+ * struct drm_syncobj_eventfd
920+ * @handle: syncobj handle.
921+ * @flags: Zero to wait for the point to be signalled, or
922+ * &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be
923+ * available for the point.
924+ * @point: syncobj timeline point (set to zero for binary syncobjs).
925+ * @fd: Existing eventfd to sent events to.
926+ * @pad: Must be zero.
927+ *
928+ * Register an eventfd to be signalled by a syncobj. The eventfd counter will
929+ * be incremented by one.
930+ */
931+struct drm_syncobj_eventfd {
932+ __u32 handle;
933+ __u32 flags;
934+ __u64 point;
935+ __s32 fd;
936+ __u32 pad;
937+};
938+
912939
913940 struct drm_syncobj_array {
914941 __u64 handles;
@@ -1169,6 +1196,8 @@ extern "C" { · 254 unmodified lines
11691196 */
11701197 #define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
11711198
1199+#define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd)
1200+
11721201 /*
11731202 * Device specific ioctls should only be in their respective headers
11741203 * The device specific ioctl range is from 0x40 to 0x9f.
@@ -1180,25 +1209,50 @@ extern "C" { · 5 unmodified lines
11801209 #define DRM_COMMAND_BASE 0x40
11811210 #define DRM_COMMAND_END 0xA0
11821211
1183−/*
1184− * Header for events written back to userspace on the drm fd. The
1185− * type defines the type of event, the length specifies the total
1186− * length of the event (including the header), and user_data is
1187− * typically a 64 bit value passed with the ioctl that triggered the
1188− * event. A read on the drm fd will always only return complete
1189− * events, that is, if for example the read buffer is 100 bytes, and
1190− * there are two 64 byte events pending, only one will be returned.
1212+/**
1213+ * struct drm_event - Header for DRM events
1214+ * @type: event type.
1215+ * @length: total number of payload bytes (including header).
11911216 *
1192− * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and
1193− * up are chipset specific.
1217+ * This struct is a header for events written back to user-space on the DRM FD.
1218+ * A read on the DRM FD will always only return complete events: e.g. if the
1219+ * read buffer is 100 bytes large and there are two 64 byte events pending,
1220+ * only one will be returned.
1221+ *
1222+ * Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and
1223+ * up are chipset specific. Generic DRM events include &DRM_EVENT_VBLANK,
1224+ * &DRM_EVENT_FLIP_COMPLETE and &DRM_EVENT_CRTC_SEQUENCE.
11941225 */
11951226 struct drm_event {
11961227 __u32 type;
11971228 __u32 length;
11981229 };
11991230
1231+/**
1232+ * DRM_EVENT_VBLANK - vertical blanking event
1233+ *
1234+ * This event is sent in response to &DRM_IOCTL_WAIT_VBLANK with the
1235+ * &_DRM_VBLANK_EVENT flag set.
1236+ *
1237+ * The event payload is a struct drm_event_vblank.
1238+ */
12001239 #define DRM_EVENT_VBLANK 0x01
1240+/**
1241+ * DRM_EVENT_FLIP_COMPLETE - page-flip completion event
1242+ *
1243+ * This event is sent in response to an atomic commit or legacy page-flip with
1244+ * the &DRM_MODE_PAGE_FLIP_EVENT flag set.
1245+ *
1246+ * The event payload is a struct drm_event_vblank.
1247+ */
12011248 #define DRM_EVENT_FLIP_COMPLETE 0x02
1249+/**
1250+ * DRM_EVENT_CRTC_SEQUENCE - CRTC sequence event
1251+ *
1252+ * This event is sent in response to &DRM_IOCTL_CRTC_QUEUE_SEQUENCE.
1253+ *
1254+ * The event payload is a struct drm_event_crtc_sequence.
1255+ */
12021256 #define DRM_EVENT_CRTC_SEQUENCE 0x03
12031257
12041258 struct drm_event_vblank {
tools/include/uapi/linux/seccomp.h+157−0
@@ -0,0 +1,157 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+#ifndef _UAPI_LINUX_SECCOMP_H
3+#define _UAPI_LINUX_SECCOMP_H
4+
5+#include <linux/compiler.h>
6+#include <linux/types.h>
7+
8+
9+/* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>) */
10+#define SECCOMP_MODE_DISABLED 0 /* seccomp is not in use. */
11+#define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */
12+#define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */
13+
14+/* Valid operations for seccomp syscall. */
15+#define SECCOMP_SET_MODE_STRICT 0
16+#define SECCOMP_SET_MODE_FILTER 1
17+#define SECCOMP_GET_ACTION_AVAIL 2
18+#define SECCOMP_GET_NOTIF_SIZES 3
19+
20+/* Valid flags for SECCOMP_SET_MODE_FILTER */
21+#define SECCOMP_FILTER_FLAG_TSYNC (1UL << 0)
22+#define SECCOMP_FILTER_FLAG_LOG (1UL << 1)
23+#define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2)
24+#define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3)
25+#define SECCOMP_FILTER_FLAG_TSYNC_ESRCH (1UL << 4)
26+/* Received notifications wait in killable state (only respond to fatal signals) */
27+#define SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV (1UL << 5)
28+
29+/*
30+ * All BPF programs must return a 32-bit value.
31+ * The bottom 16-bits are for optional return data.
32+ * The upper 16-bits are ordered from least permissive values to most,
33+ * as a signed value (so 0x8000000 is negative).
34+ *
35+ * The ordering ensures that a min_t() over composed return values always
36+ * selects the least permissive choice.
37+ */
38+#define SECCOMP_RET_KILL_PROCESS 0x80000000U /* kill the process */
39+#define SECCOMP_RET_KILL_THREAD 0x00000000U /* kill the thread */
40+#define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD
41+#define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */
42+#define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */
43+#define SECCOMP_RET_USER_NOTIF 0x7fc00000U /* notifies userspace */
44+#define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */
45+#define SECCOMP_RET_LOG 0x7ffc0000U /* allow after logging */
46+#define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */
47+
48+/* Masks for the return value sections. */
49+#define SECCOMP_RET_ACTION_FULL 0xffff0000U
50+#define SECCOMP_RET_ACTION 0x7fff0000U
51+#define SECCOMP_RET_DATA 0x0000ffffU
52+
53+/**
54+ * struct seccomp_data - the format the BPF program executes over.
55+ * @nr: the system call number
56+ * @arch: indicates system call convention as an AUDIT_ARCH_* value
57+ * as defined in <linux/audit.h>.
58+ * @instruction_pointer: at the time of the system call.
59+ * @args: up to 6 system call arguments always stored as 64-bit values
60+ * regardless of the architecture.
61+ */
62+struct seccomp_data {
63+ int nr;
64+ __u32 arch;
65+ __u64 instruction_pointer;
66+ __u64 args[6];
67+};
68+
69+struct seccomp_notif_sizes {
70+ __u16 seccomp_notif;
71+ __u16 seccomp_notif_resp;
72+ __u16 seccomp_data;
73+};
74+
75+struct seccomp_notif {
76+ __u64 id;
77+ __u32 pid;
78+ __u32 flags;
79+ struct seccomp_data data;
80+};
81+
82+/*
83+ * Valid flags for struct seccomp_notif_resp
84+ *
85+ * Note, the SECCOMP_USER_NOTIF_FLAG_CONTINUE flag must be used with caution!
86+ * If set by the process supervising the syscalls of another process the
87+ * syscall will continue. This is problematic because of an inherent TOCTOU.
88+ * An attacker can exploit the time while the supervised process is waiting on
89+ * a response from the supervising process to rewrite syscall arguments which
90+ * are passed as pointers of the intercepted syscall.
91+ * It should be absolutely clear that this means that the seccomp notifier
92+ * _cannot_ be used to implement a security policy! It should only ever be used
93+ * in scenarios where a more privileged process supervises the syscalls of a
94+ * lesser privileged process to get around kernel-enforced security
95+ * restrictions when the privileged process deems this safe. In other words,
96+ * in order to continue a syscall the supervising process should be sure that
97+ * another security mechanism or the kernel itself will sufficiently block
98+ * syscalls if arguments are rewritten to something unsafe.
99+ *
100+ * Similar precautions should be applied when stacking SECCOMP_RET_USER_NOTIF
101+ * or SECCOMP_RET_TRACE. For SECCOMP_RET_USER_NOTIF filters acting on the
102+ * same syscall, the most recently added filter takes precedence. This means
103+ * that the new SECCOMP_RET_USER_NOTIF filter can override any
104+ * SECCOMP_IOCTL_NOTIF_SEND from earlier filters, essentially allowing all
105+ * such filtered syscalls to be executed by sending the response
106+ * SECCOMP_USER_NOTIF_FLAG_CONTINUE. Note that SECCOMP_RET_TRACE can equally
107+ * be overriden by SECCOMP_USER_NOTIF_FLAG_CONTINUE.
108+ */
109+#define SECCOMP_USER_NOTIF_FLAG_CONTINUE (1UL << 0)
110+
111+struct seccomp_notif_resp {
112+ __u64 id;
113+ __s64 val;
114+ __s32 error;
115+ __u32 flags;
116+};
117+
118+#define SECCOMP_USER_NOTIF_FD_SYNC_WAKE_UP (1UL << 0)
119+
120+/* valid flags for seccomp_notif_addfd */
121+#define SECCOMP_ADDFD_FLAG_SETFD (1UL << 0) /* Specify remote fd */
122+#define SECCOMP_ADDFD_FLAG_SEND (1UL << 1) /* Addfd and return it, atomically */
123+
124+/**
125+ * struct seccomp_notif_addfd
126+ * @id: The ID of the seccomp notification
127+ * @flags: SECCOMP_ADDFD_FLAG_*
128+ * @srcfd: The local fd number
129+ * @newfd: Optional remote FD number if SETFD option is set, otherwise 0.
130+ * @newfd_flags: The O_* flags the remote FD should have applied
131+ */
132+struct seccomp_notif_addfd {
133+ __u64 id;
134+ __u32 flags;
135+ __u32 srcfd;
136+ __u32 newfd;
137+ __u32 newfd_flags;
138+};
139+
140+#define SECCOMP_IOC_MAGIC '!'
141+#define SECCOMP_IO(nr) _IO(SECCOMP_IOC_MAGIC, nr)
142+#define SECCOMP_IOR(nr, type) _IOR(SECCOMP_IOC_MAGIC, nr, type)
143+#define SECCOMP_IOW(nr, type) _IOW(SECCOMP_IOC_MAGIC, nr, type)
144+#define SECCOMP_IOWR(nr, type) _IOWR(SECCOMP_IOC_MAGIC, nr, type)
145+
146+/* Flags for seccomp notification fd ioctl. */
147+#define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif)
148+#define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \
149+ struct seccomp_notif_resp)
150+#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64)
151+/* On success, the return value is the remote process's added fd number */
152+#define SECCOMP_IOCTL_NOTIF_ADDFD SECCOMP_IOW(3, \
153+ struct seccomp_notif_addfd)
154+
155+#define SECCOMP_IOCTL_NOTIF_SET_FLAGS SECCOMP_IOW(4, __u64)
156+
157+#endif /* _UAPI_LINUX_SECCOMP_H */
tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl+1−0
@@ -366,3 +366,4 @@ · 365 unmodified lines
366366 449 n64 futex_waitv sys_futex_waitv
367367 450 common set_mempolicy_home_node sys_set_mempolicy_home_node
368368 451 n64 cachestat sys_cachestat
369+452 n64 fchmodat2 sys_fchmodat2
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl+1−0
@@ -538,3 +538,4 @@ · 537 unmodified lines
538538 449 common futex_waitv sys_futex_waitv
539539 450 nospu set_mempolicy_home_node sys_set_mempolicy_home_node
540540 451 common cachestat sys_cachestat
541+452 common fchmodat2 sys_fchmodat2
tools/perf/arch/s390/entry/syscalls/syscall.tbl+1−0
@@ -454,3 +454,4 @@ · 453 unmodified lines
454454 449 common futex_waitv sys_futex_waitv sys_futex_waitv
455455 450 common set_mempolicy_home_node sys_set_mempolicy_home_node sys_set_mempolicy_home_node
456456 451 common cachestat sys_cachestat sys_cachestat
457+452 common fchmodat2 sys_fchmodat2 sys_fchmodat2
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl+2−0
@@ -373,6 +373,8 @@ · 372 unmodified lines
373373 449 common futex_waitv sys_futex_waitv
374374 450 common set_mempolicy_home_node sys_set_mempolicy_home_node
375375 451 common cachestat sys_cachestat
376+452 common fchmodat2 sys_fchmodat2
377+453 64 map_shadow_stack sys_map_shadow_stack
376378
377379 #
378380 # Due to a historical design error, certain syscalls are numbered differently
tools/perf/bench/sched-seccomp-notify.c+1−1
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 #include <sys/syscall.h>
1010 #include <sys/ioctl.h>
1111 #include <linux/time64.h>
12−#include <linux/seccomp.h>
12+#include <uapi/linux/seccomp.h>
1313 #include <sys/prctl.h>
1414
1515 #include <unistd.h>
tools/perf/check-headers.sh+1−0
@@ -21,6 +21,7 @@ FILES=( · 20 unmodified lines
2121 "include/uapi/linux/perf_event.h"
2222 "include/uapi/linux/prctl.h"
2323 "include/uapi/linux/sched.h"
24+ "include/uapi/linux/seccomp.h"
2425 "include/uapi/linux/stat.h"
2526 "include/uapi/linux/usbdevice_fs.h"
2627 "include/uapi/linux/vhost.h"
tools/perf/pmu-events/jevents.py+1−1
@@ -991,7 +991,7 @@ const struct pmu_events_table *perf_pmu__find_events_table(struct perf_pmu *pmu) · 990 unmodified lines
991991 }
992992 }
993993 free(cpuid);
994− if (!pmu)
994+ if (!pmu || !table)
995995 return table;
996996
997997 for (i = 0; i < table->num_pmus; i++) {
tools/perf/pmu-events/metric.py+2−2
@@ -413,10 +413,10 @@ def has_event(event: Event) -> Function: · 412 unmodified lines
413413 # pylint: disable=invalid-name
414414 return Function('has_event', event)
415415
416−def strcmp_cpuid_str(event: str) -> Function:
416+def strcmp_cpuid_str(cpuid: Event) -> Function:
417417 # pylint: disable=redefined-builtin
418418 # pylint: disable=invalid-name
419− return Function('strcmp_cpuid_str', event)
419+ return Function('strcmp_cpuid_str', cpuid)
420420
421421 class Metric:
422422 """An individual metric that will specifiable on the perf command line."""
tools/perf/util/bpf-prologue.c+0−508
@@ -1,508 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0
2−/*
3− * bpf-prologue.c
4− *
5− * Copyright (C) 2015 He Kuang <hekuang@huawei.com>
6− * Copyright (C) 2015 Wang Nan <wangnan0@huawei.com>
7− * Copyright (C) 2015 Huawei Inc.
8− */
9−
10−#include <bpf/libbpf.h>
11−#include "debug.h"
12−#include "bpf-loader.h"
13−#include "bpf-prologue.h"
14−#include "probe-finder.h"
15−#include <errno.h>
16−#include <stdlib.h>
17−#include <dwarf-regs.h>
18−#include <linux/filter.h>
19−
20−#define BPF_REG_SIZE 8
21−
22−#define JMP_TO_ERROR_CODE -1
23−#define JMP_TO_SUCCESS_CODE -2
24−#define JMP_TO_USER_CODE -3
25−
26−struct bpf_insn_pos {
27− struct bpf_insn *begin;
28− struct bpf_insn *end;
29− struct bpf_insn *pos;
30−};
31−
32−static inline int
33−pos_get_cnt(struct bpf_insn_pos *pos)
34−{
35− return pos->pos - pos->begin;
36−}
37−
38−static int
39−append_insn(struct bpf_insn new_insn, struct bpf_insn_pos *pos)
40−{
41− if (!pos->pos)
42− return -BPF_LOADER_ERRNO__PROLOGUE2BIG;
43−
44− if (pos->pos + 1 >= pos->end) {
45− pr_err("bpf prologue: prologue too long\n");
46− pos->pos = NULL;
47− return -BPF_LOADER_ERRNO__PROLOGUE2BIG;
48− }
49−
50− *(pos->pos)++ = new_insn;
51− return 0;
52−}
53−
54−static int
55−check_pos(struct bpf_insn_pos *pos)
56−{
57− if (!pos->pos || pos->pos >= pos->end)
58− return -BPF_LOADER_ERRNO__PROLOGUE2BIG;
59− return 0;
60−}
61−
62−/*
63− * Convert type string (u8/u16/u32/u64/s8/s16/s32/s64 ..., see
64− * Documentation/trace/kprobetrace.rst) to size field of BPF_LDX_MEM
65− * instruction (BPF_{B,H,W,DW}).
66− */
67−static int
68−argtype_to_ldx_size(const char *type)
69−{
70− int arg_size = type ? atoi(&type[1]) : 64;
71−
72− switch (arg_size) {
73− case 8:
74− return BPF_B;
75− case 16:
76− return BPF_H;
77− case 32:
78− return BPF_W;
79− case 64:
80− default:
81− return BPF_DW;
82− }
83−}
84−
85−static const char *
86−insn_sz_to_str(int insn_sz)
87−{
88− switch (insn_sz) {
89− case BPF_B:
90− return "BPF_B";
91− case BPF_H:
92− return "BPF_H";
93− case BPF_W:
94− return "BPF_W";
95− case BPF_DW:
96− return "BPF_DW";
97− default:
98− return "UNKNOWN";
99− }
100−}
101−
102−/* Give it a shorter name */
103−#define ins(i, p) append_insn((i), (p))
104−
105−/*
106− * Give a register name (in 'reg'), generate instruction to
107− * load register into an eBPF register rd:
108− * 'ldd target_reg, offset(ctx_reg)', where:
109− * ctx_reg is pre initialized to pointer of 'struct pt_regs'.
110− */
111−static int
112−gen_ldx_reg_from_ctx(struct bpf_insn_pos *pos, int ctx_reg,
113− const char *reg, int target_reg)
114−{
115− int offset = regs_query_register_offset(reg);
116−
117− if (offset < 0) {
118− pr_err("bpf: prologue: failed to get register %s\n",
119− reg);
120− return offset;
121− }
122− ins(BPF_LDX_MEM(BPF_DW, target_reg, ctx_reg, offset), pos);
123−
124− return check_pos(pos);
125−}
126−
127−/*
128− * Generate a BPF_FUNC_probe_read function call.
129− *
130− * src_base_addr_reg is a register holding base address,
131− * dst_addr_reg is a register holding dest address (on stack),
132− * result is:
133− *
134− * *[dst_addr_reg] = *([src_base_addr_reg] + offset)
135− *
136− * Arguments of BPF_FUNC_probe_read:
137− * ARG1: ptr to stack (dest)
138− * ARG2: size (8)
139− * ARG3: unsafe ptr (src)
140− */
141−static int
142−gen_read_mem(struct bpf_insn_pos *pos,
143− int src_base_addr_reg,
144− int dst_addr_reg,
145− long offset,
146− int probeid)
147−{
148− /* mov arg3, src_base_addr_reg */
149− if (src_base_addr_reg != BPF_REG_ARG3)
150− ins(BPF_MOV64_REG(BPF_REG_ARG3, src_base_addr_reg), pos);
151− /* add arg3, #offset */
152− if (offset)
153− ins(BPF_ALU64_IMM(BPF_ADD, BPF_REG_ARG3, offset), pos);
154−
155− /* mov arg2, #reg_size */
156− ins(BPF_ALU64_IMM(BPF_MOV, BPF_REG_ARG2, BPF_REG_SIZE), pos);
157−
158− /* mov arg1, dst_addr_reg */
159− if (dst_addr_reg != BPF_REG_ARG1)
160− ins(BPF_MOV64_REG(BPF_REG_ARG1, dst_addr_reg), pos);
161−
162− /* Call probe_read */
163− ins(BPF_EMIT_CALL(probeid), pos);
164− /*
165− * Error processing: if read fail, goto error code,
166− * will be relocated. Target should be the start of
167− * error processing code.
168− */
169− ins(BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, JMP_TO_ERROR_CODE),
170− pos);
171−
172− return check_pos(pos);
173−}
174−
175−/*
176− * Each arg should be bare register. Fetch and save them into argument
177− * registers (r3 - r5).
178− *
179− * BPF_REG_1 should have been initialized with pointer to
180− * 'struct pt_regs'.
181− */
182−static int
183−gen_prologue_fastpath(struct bpf_insn_pos *pos,
184− struct probe_trace_arg *args, int nargs)
185−{
186− int i, err = 0;
187−
188− for (i = 0; i < nargs; i++) {
189− err = gen_ldx_reg_from_ctx(pos, BPF_REG_1, args[i].value,
190− BPF_PROLOGUE_START_ARG_REG + i);
191− if (err)
192− goto errout;
193− }
194−
195− return check_pos(pos);
196−errout:
197− return err;
198−}
199−
200−/*
201− * Slow path:
202− * At least one argument has the form of 'offset($rx)'.
203− *
204− * Following code first stores them into stack, then loads all of then
205− * to r2 - r5.
206− * Before final loading, the final result should be:
207− *
208− * low address
209− * BPF_REG_FP - 24 ARG3
210− * BPF_REG_FP - 16 ARG2
211− * BPF_REG_FP - 8 ARG1
212− * BPF_REG_FP
213− * high address
214− *
215− * For each argument (described as: offn(...off2(off1(reg)))),
216− * generates following code:
217− *
218− * r7 <- fp
219− * r7 <- r7 - stack_offset // Ideal code should initialize r7 using
220− * // fp before generating args. However,
221− * // eBPF won't regard r7 as stack pointer
222− * // if it is generated by minus 8 from
223− * // another stack pointer except fp.
224− * // This is why we have to set r7
225− * // to fp for each variable.
226− * r3 <- value of 'reg'-> generated using gen_ldx_reg_from_ctx()
227− * (r7) <- r3 // skip following instructions for bare reg
228− * r3 <- r3 + off1 . // skip if off1 == 0
229− * r2 <- 8 \
230− * r1 <- r7 |-> generated by gen_read_mem()
231− * call probe_read /
232− * jnei r0, 0, err ./
233− * r3 <- (r7)
234− * r3 <- r3 + off2 . // skip if off2 == 0
235− * r2 <- 8 \ // r2 may be broken by probe_read, so set again
236− * r1 <- r7 |-> generated by gen_read_mem()
237− * call probe_read /
238− * jnei r0, 0, err ./
239− * ...
240− */
241−static int
242−gen_prologue_slowpath(struct bpf_insn_pos *pos,
243− struct probe_trace_arg *args, int nargs)
244−{
245− int err, i, probeid;
246−
247− for (i = 0; i < nargs; i++) {
248− struct probe_trace_arg *arg = &args[i];
249− const char *reg = arg->value;
250− struct probe_trace_arg_ref *ref = NULL;
251− int stack_offset = (i + 1) * -8;
252−
253− pr_debug("prologue: fetch arg %d, base reg is %s\n",
254− i, reg);
255−
256− /* value of base register is stored into ARG3 */
257− err = gen_ldx_reg_from_ctx(pos, BPF_REG_CTX, reg,
258− BPF_REG_ARG3);
259− if (err) {
260− pr_err("prologue: failed to get offset of register %s\n",
261− reg);
262− goto errout;
263− }
264−
265− /* Make r7 the stack pointer. */
266− ins(BPF_MOV64_REG(BPF_REG_7, BPF_REG_FP), pos);
267− /* r7 += -8 */
268− ins(BPF_ALU64_IMM(BPF_ADD, BPF_REG_7, stack_offset), pos);
269− /*
270− * Store r3 (base register) onto stack
271− * Ensure fp[offset] is set.
272− * fp is the only valid base register when storing
273− * into stack. We are not allowed to use r7 as base
274− * register here.
275− */
276− ins(BPF_STX_MEM(BPF_DW, BPF_REG_FP, BPF_REG_ARG3,
277− stack_offset), pos);
278−
279− ref = arg->ref;
280− probeid = BPF_FUNC_probe_read_kernel;
281− while (ref) {
282− pr_debug("prologue: arg %d: offset %ld\n",
283− i, ref->offset);
284−
285− if (ref->user_access)
286− probeid = BPF_FUNC_probe_read_user;
287−
288− err = gen_read_mem(pos, BPF_REG_3, BPF_REG_7,
289− ref->offset, probeid);
290− if (err) {
291− pr_err("prologue: failed to generate probe_read function call\n");
292− goto errout;
293− }
294−
295− ref = ref->next;
296− /*
297− * Load previous result into ARG3. Use
298− * BPF_REG_FP instead of r7 because verifier
299− * allows FP based addressing only.
300− */
301− if (ref)
302− ins(BPF_LDX_MEM(BPF_DW, BPF_REG_ARG3,
303− BPF_REG_FP, stack_offset), pos);
304− }
305− }
306−
307− /* Final pass: read to registers */
308− for (i = 0; i < nargs; i++) {
309− int insn_sz = (args[i].ref) ? argtype_to_ldx_size(args[i].type) : BPF_DW;
310−
311− pr_debug("prologue: load arg %d, insn_sz is %s\n",
312− i, insn_sz_to_str(insn_sz));
313− ins(BPF_LDX_MEM(insn_sz, BPF_PROLOGUE_START_ARG_REG + i,
314− BPF_REG_FP, -BPF_REG_SIZE * (i + 1)), pos);
315− }
316−
317− ins(BPF_JMP_IMM(BPF_JA, BPF_REG_0, 0, JMP_TO_SUCCESS_CODE), pos);
318−
319− return check_pos(pos);
320−errout:
321− return err;
322−}
323−
324−static int
325−prologue_relocate(struct bpf_insn_pos *pos, struct bpf_insn *error_code,
326− struct bpf_insn *success_code, struct bpf_insn *user_code)
327−{
328− struct bpf_insn *insn;
329−
330− if (check_pos(pos))
331− return -BPF_LOADER_ERRNO__PROLOGUE2BIG;
332−
333− for (insn = pos->begin; insn < pos->pos; insn++) {
334− struct bpf_insn *target;
335− u8 class = BPF_CLASS(insn->code);
336− u8 opcode;
337−
338− if (class != BPF_JMP)
339− continue;
340− opcode = BPF_OP(insn->code);
341− if (opcode == BPF_CALL)
342− continue;
343−
344− switch (insn->off) {
345− case JMP_TO_ERROR_CODE:
346− target = error_code;
347− break;
348− case JMP_TO_SUCCESS_CODE:
349− target = success_code;
350− break;
351− case JMP_TO_USER_CODE:
352− target = user_code;
353− break;
354− default:
355− pr_err("bpf prologue: internal error: relocation failed\n");
356− return -BPF_LOADER_ERRNO__PROLOGUE;
357− }
358−
359− insn->off = target - (insn + 1);
360− }
361− return 0;
362−}
363−
364−int bpf__gen_prologue(struct probe_trace_arg *args, int nargs,
365− struct bpf_insn *new_prog, size_t *new_cnt,
366− size_t cnt_space)
367−{
368− struct bpf_insn *success_code = NULL;
369− struct bpf_insn *error_code = NULL;
370− struct bpf_insn *user_code = NULL;
371− struct bpf_insn_pos pos;
372− bool fastpath = true;
373− int err = 0, i;
374−
375− if (!new_prog || !new_cnt)
376− return -EINVAL;
377−
378− if (cnt_space > BPF_MAXINSNS)
379− cnt_space = BPF_MAXINSNS;
380−
381− pos.begin = new_prog;
382− pos.end = new_prog + cnt_space;
383− pos.pos = new_prog;
384−
385− if (!nargs) {
386− ins(BPF_ALU64_IMM(BPF_MOV, BPF_PROLOGUE_FETCH_RESULT_REG, 0),
387− &pos);
388−
389− if (check_pos(&pos))
390− goto errout;
391−
392− *new_cnt = pos_get_cnt(&pos);
393− return 0;
394− }
395−
396− if (nargs > BPF_PROLOGUE_MAX_ARGS) {
397− pr_warning("bpf: prologue: %d arguments are dropped\n",
398− nargs - BPF_PROLOGUE_MAX_ARGS);
399− nargs = BPF_PROLOGUE_MAX_ARGS;
400− }
401−
402− /* First pass: validation */
403− for (i = 0; i < nargs; i++) {
404− struct probe_trace_arg_ref *ref = args[i].ref;
405−
406− if (args[i].value[0] == '@') {
407− /* TODO: fetch global variable */
408− pr_err("bpf: prologue: global %s%+ld not support\n",
409− args[i].value, ref ? ref->offset : 0);
410− return -ENOTSUP;
411− }
412−
413− while (ref) {
414− /* fastpath is true if all args has ref == NULL */
415− fastpath = false;
416−
417− /*
418− * Instruction encodes immediate value using
419− * s32, ref->offset is long. On systems which
420− * can't fill long in s32, refuse to process if
421− * ref->offset too large (or small).
422− */
423−#ifdef __LP64__
424−#define OFFSET_MAX ((1LL << 31) - 1)
425−#define OFFSET_MIN ((1LL << 31) * -1)
426− if (ref->offset > OFFSET_MAX ||
427− ref->offset < OFFSET_MIN) {
428− pr_err("bpf: prologue: offset out of bound: %ld\n",
429− ref->offset);
430− return -BPF_LOADER_ERRNO__PROLOGUEOOB;
431− }
432−#endif
433− ref = ref->next;
434− }
435− }
436− pr_debug("prologue: pass validation\n");
437−
438− if (fastpath) {
439− /* If all variables are registers... */
440− pr_debug("prologue: fast path\n");
441− err = gen_prologue_fastpath(&pos, args, nargs);
442− if (err)
443− goto errout;
444− } else {
445− pr_debug("prologue: slow path\n");
446−
447− /* Initialization: move ctx to a callee saved register. */
448− ins(BPF_MOV64_REG(BPF_REG_CTX, BPF_REG_ARG1), &pos);
449−
450− err = gen_prologue_slowpath(&pos, args, nargs);
451− if (err)
452− goto errout;
453− /*
454− * start of ERROR_CODE (only slow pass needs error code)
455− * mov r2 <- 1 // r2 is error number
456− * mov r3 <- 0 // r3, r4... should be touched or
457− * // verifier would complain
458− * mov r4 <- 0
459− * ...
460− * goto usercode
461− */
462− error_code = pos.pos;
463− ins(BPF_ALU64_IMM(BPF_MOV, BPF_PROLOGUE_FETCH_RESULT_REG, 1),
464− &pos);
465−
466− for (i = 0; i < nargs; i++)
467− ins(BPF_ALU64_IMM(BPF_MOV,
468− BPF_PROLOGUE_START_ARG_REG + i,
469− 0),
470− &pos);
471− ins(BPF_JMP_IMM(BPF_JA, BPF_REG_0, 0, JMP_TO_USER_CODE),
472− &pos);
473− }
474−
475− /*
476− * start of SUCCESS_CODE:
477− * mov r2 <- 0
478− * goto usercode // skip
479− */
480− success_code = pos.pos;
481− ins(BPF_ALU64_IMM(BPF_MOV, BPF_PROLOGUE_FETCH_RESULT_REG, 0), &pos);
482−
483− /*
484− * start of USER_CODE:
485− * Restore ctx to r1
486− */
487− user_code = pos.pos;
488− if (!fastpath) {
489− /*
490− * Only slow path needs restoring of ctx. In fast path,
491− * register are loaded directly from r1.
492− */
493− ins(BPF_MOV64_REG(BPF_REG_ARG1, BPF_REG_CTX), &pos);
494− err = prologue_relocate(&pos, error_code, success_code,
495− user_code);
496− if (err)
497− goto errout;
498− }
499−
500− err = check_pos(&pos);
501− if (err)
502− goto errout;
503−
504− *new_cnt = pos_get_cnt(&pos);
505− return 0;
506−errout:
507− return err;
508−}
tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c+2−0
@@ -23,7 +23,9 @@ · 22 unmodified lines
2323 #define MAX_CPUS 4096
2424
2525 // FIXME: These should come from system headers
26+#ifndef bool
2627 typedef char bool;
28+#endif
2729 typedef int pid_t;
2830 typedef long long int __s64;
2931 typedef __s64 time64_t;
tools/perf/util/hashmap.h+0−10
@@ -80,16 +80,6 @@ struct hashmap { · 79 unmodified lines
8080 size_t sz;
8181 };
8282
83−#define HASHMAP_INIT(hash_fn, equal_fn, ctx) { \
84− .hash_fn = (hash_fn), \
85− .equal_fn = (equal_fn), \
86− .ctx = (ctx), \
87− .buckets = NULL, \
88− .cap = 0, \
89− .cap_bits = 0, \
90− .sz = 0, \
91−}
92−
9383 void hashmap__init(struct hashmap *map, hashmap_hash_fn hash_fn,
9484 hashmap_equal_fn equal_fn, void *ctx);
9585 struct hashmap *hashmap__new(hashmap_hash_fn hash_fn,
tools/perf/util/pmu.c+1−1
@@ -520,7 +520,7 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name, · 519 unmodified lines
520520 pmu_name = pe->pmu;
521521 }
522522
523− alias = malloc(sizeof(*alias));
523+ alias = zalloc(sizeof(*alias));
524524 if (!alias)
525525 return -ENOMEM;
526526
tools/testing/selftests/Makefile+1−1
@@ -92,7 +92,7 @@ endif · 91 unmodified lines
9292 TARGETS += tmpfs
9393 TARGETS += tpm2
9494 TARGETS += tty
95−TARGETS += uevents
95+TARGETS += uevent
9696 TARGETS += user
9797 TARGETS += user_events
9898 TARGETS += vDSO
tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c+2−0
@@ -185,6 +185,8 @@ static void test_cubic(void) · 184 unmodified lines
185185
186186 do_test("bpf_cubic", NULL);
187187
188+ ASSERT_EQ(cubic_skel->bss->bpf_cubic_acked_called, 1, "pkts_acked called");
189+
188190 bpf_link__destroy(link);
189191 bpf_cubic__destroy(cubic_skel);
190192 }
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c+51−0
@@ -475,6 +475,55 @@ out: · 474 unmodified lines
475475 test_sockmap_drop_prog__destroy(drop);
476476 }
477477
478+static void test_sockmap_skb_verdict_peek(void)
479+{
480+ int err, map, verdict, s, c1, p1, zero = 0, sent, recvd, avail;
481+ struct test_sockmap_pass_prog *pass;
482+ char snd[256] = "0123456789";
483+ char rcv[256] = "0";
484+
485+ pass = test_sockmap_pass_prog__open_and_load();
486+ if (!ASSERT_OK_PTR(pass, "open_and_load"))
487+ return;
488+ verdict = bpf_program__fd(pass->progs.prog_skb_verdict);
489+ map = bpf_map__fd(pass->maps.sock_map_rx);
490+
491+ err = bpf_prog_attach(verdict, map, BPF_SK_SKB_STREAM_VERDICT, 0);
492+ if (!ASSERT_OK(err, "bpf_prog_attach"))
493+ goto out;
494+
495+ s = socket_loopback(AF_INET, SOCK_STREAM);
496+ if (!ASSERT_GT(s, -1, "socket_loopback(s)"))
497+ goto out;
498+
499+ err = create_pair(s, AF_INET, SOCK_STREAM, &c1, &p1);
500+ if (!ASSERT_OK(err, "create_pairs(s)"))
501+ goto out;
502+
503+ err = bpf_map_update_elem(map, &zero, &c1, BPF_NOEXIST);
504+ if (!ASSERT_OK(err, "bpf_map_update_elem(c1)"))
505+ goto out_close;
506+
507+ sent = xsend(p1, snd, sizeof(snd), 0);
508+ ASSERT_EQ(sent, sizeof(snd), "xsend(p1)");
509+ recvd = recv(c1, rcv, sizeof(rcv), MSG_PEEK);
510+ ASSERT_EQ(recvd, sizeof(rcv), "recv(c1)");
511+ err = ioctl(c1, FIONREAD, &avail);
512+ ASSERT_OK(err, "ioctl(FIONREAD) error");
513+ ASSERT_EQ(avail, sizeof(snd), "after peek ioctl(FIONREAD)");
514+ recvd = recv(c1, rcv, sizeof(rcv), 0);
515+ ASSERT_EQ(recvd, sizeof(rcv), "recv(p0)");
516+ err = ioctl(c1, FIONREAD, &avail);
517+ ASSERT_OK(err, "ioctl(FIONREAD) error");
518+ ASSERT_EQ(avail, 0, "after read ioctl(FIONREAD)");
519+
520+out_close:
521+ close(c1);
522+ close(p1);
523+out:
524+ test_sockmap_pass_prog__destroy(pass);
525+}
526+
478527 void test_sockmap_basic(void)
479528 {
480529 if (test__start_subtest("sockmap create_update_free"))
@@ -515,4 +564,6 @@ void test_sockmap_basic(void) · 34 unmodified lines
515564 test_sockmap_skb_verdict_fionread(true);
516565 if (test__start_subtest("sockmap skb_verdict fionread on drop"))
517566 test_sockmap_skb_verdict_fionread(false);
567+ if (test__start_subtest("sockmap skb_verdict msg_f_peek"))
568+ test_sockmap_skb_verdict_peek();
518569 }
tools/testing/selftests/bpf/prog_tests/tc_opts.c+84−0
@@ -2378,3 +2378,87 @@ void serial_test_tc_opts_chain_mixed(void) · 2377 unmodified lines
23782378 test_tc_chain_mixed(BPF_TCX_INGRESS);
23792379 test_tc_chain_mixed(BPF_TCX_EGRESS);
23802380 }
2381+
2382+static int generate_dummy_prog(void)
2383+{
2384+ const struct bpf_insn prog_insns[] = {
2385+ BPF_MOV64_IMM(BPF_REG_0, 0),
2386+ BPF_EXIT_INSN(),
2387+ };
2388+ const size_t prog_insn_cnt = sizeof(prog_insns) / sizeof(struct bpf_insn);
2389+ LIBBPF_OPTS(bpf_prog_load_opts, opts);
2390+ const size_t log_buf_sz = 256;
2391+ char *log_buf;
2392+ int fd = -1;
2393+
2394+ log_buf = malloc(log_buf_sz);
2395+ if (!ASSERT_OK_PTR(log_buf, "log_buf_alloc"))
2396+ return fd;
2397+ opts.log_buf = log_buf;
2398+ opts.log_size = log_buf_sz;
2399+
2400+ log_buf[0] = '\0';
2401+ opts.log_level = 0;
2402+ fd = bpf_prog_load(BPF_PROG_TYPE_SCHED_CLS, "tcx_prog", "GPL",
2403+ prog_insns, prog_insn_cnt, &opts);
2404+ ASSERT_STREQ(log_buf, "", "log_0");
2405+ ASSERT_GE(fd, 0, "prog_fd");
2406+ free(log_buf);
2407+ return fd;
2408+}
2409+
2410+static void test_tc_opts_max_target(int target, int flags, bool relative)
2411+{
2412+ int err, ifindex, i, prog_fd, last_fd = -1;
2413+ LIBBPF_OPTS(bpf_prog_attach_opts, opta);
2414+ const int max_progs = 63;
2415+
2416+ ASSERT_OK(system("ip link add dev tcx_opts1 type veth peer name tcx_opts2"), "add veth");
2417+ ifindex = if_nametoindex("tcx_opts1");
2418+ ASSERT_NEQ(ifindex, 0, "non_zero_ifindex");
2419+
2420+ assert_mprog_count_ifindex(ifindex, target, 0);
2421+
2422+ for (i = 0; i < max_progs; i++) {
2423+ prog_fd = generate_dummy_prog();
2424+ if (!ASSERT_GE(prog_fd, 0, "dummy_prog"))
2425+ goto cleanup;
2426+ err = bpf_prog_attach_opts(prog_fd, ifindex, target, &opta);
2427+ if (!ASSERT_EQ(err, 0, "prog_attach"))
2428+ goto cleanup;
2429+ assert_mprog_count_ifindex(ifindex, target, i + 1);
2430+ if (i == max_progs - 1 && relative)
2431+ last_fd = prog_fd;
2432+ else
2433+ close(prog_fd);
2434+ }
2435+
2436+ prog_fd = generate_dummy_prog();
2437+ if (!ASSERT_GE(prog_fd, 0, "dummy_prog"))
2438+ goto cleanup;
2439+ opta.flags = flags;
2440+ if (last_fd > 0)
2441+ opta.relative_fd = last_fd;
2442+ err = bpf_prog_attach_opts(prog_fd, ifindex, target, &opta);
2443+ ASSERT_EQ(err, -ERANGE, "prog_64_attach");
2444+ assert_mprog_count_ifindex(ifindex, target, max_progs);
2445+ close(prog_fd);
2446+cleanup:
2447+ if (last_fd > 0)
2448+ close(last_fd);
2449+ ASSERT_OK(system("ip link del dev tcx_opts1"), "del veth");
2450+ ASSERT_EQ(if_nametoindex("tcx_opts1"), 0, "dev1_removed");
2451+ ASSERT_EQ(if_nametoindex("tcx_opts2"), 0, "dev2_removed");
2452+}
2453+
2454+void serial_test_tc_opts_max(void)
2455+{
2456+ test_tc_opts_max_target(BPF_TCX_INGRESS, 0, false);
2457+ test_tc_opts_max_target(BPF_TCX_EGRESS, 0, false);
2458+
2459+ test_tc_opts_max_target(BPF_TCX_INGRESS, BPF_F_BEFORE, false);
2460+ test_tc_opts_max_target(BPF_TCX_EGRESS, BPF_F_BEFORE, true);
2461+
2462+ test_tc_opts_max_target(BPF_TCX_INGRESS, BPF_F_AFTER, true);
2463+ test_tc_opts_max_target(BPF_TCX_EGRESS, BPF_F_AFTER, false);
2464+}
tools/testing/selftests/bpf/progs/bpf_cubic.c+3−0
@@ -490,6 +490,8 @@ static __always_inline void hystart_update(struct sock *sk, __u32 delay) · 489 unmodified lines
490490 }
491491 }
492492
493+int bpf_cubic_acked_called = 0;
494+
493495 void BPF_STRUCT_OPS(bpf_cubic_acked, struct sock *sk,
494496 const struct ack_sample *sample)
495497 {
@@ -497,6 +499,7 @@ void BPF_STRUCT_OPS(bpf_cubic_acked, struct sock *sk, · 1 unmodified line
497499 struct bictcp *ca = inet_csk_ca(sk);
498500 __u32 delay;
499501
502+ bpf_cubic_acked_called = 1;
500503 /* Some calls are for duplicates without timetamps */
501504 if (sample->rtt_us < 0)
502505 return;
tools/testing/selftests/fchmodat2/Makefile+1−1
@@ -1,6 +1,6 @@
11 # SPDX-License-Identifier: GPL-2.0-or-later
22
3−CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined $(KHDR_INCLUDES)
3+CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan $(KHDR_INCLUDES)
44 TEST_GEN_PROGS := fchmodat2_test
55
66 include ../lib.mk
tools/testing/selftests/kvm/lib/test_util.c+1−1
@@ -387,7 +387,7 @@ char *strdup_printf(const char *fmt, ...) · 386 unmodified lines
387387 char *str;
388388
389389 va_start(ap, fmt);
390− vasprintf(&str, fmt, ap);
390+ TEST_ASSERT(vasprintf(&str, fmt, ap) >= 0, "vasprintf() failed");
391391 va_end(ap);
392392
393393 return str;
tools/testing/selftests/kvm/riscv/get-reg-list.c+42−16
@@ -12,19 +12,37 @@ · 11 unmodified lines
1212
1313 #define REG_MASK (KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK)
1414
15+static bool isa_ext_cant_disable[KVM_RISCV_ISA_EXT_MAX];
16+
1517 bool filter_reg(__u64 reg)
1618 {
19+ switch (reg & ~REG_MASK) {
1720 /*
18− * Some ISA extensions are optional and not present on all host,
19− * but they can't be disabled through ISA_EXT registers when present.
20− * So, to make life easy, just filtering out these kind of registers.
21+ * Same set of ISA_EXT registers are not present on all host because
22+ * ISA_EXT registers are visible to the KVM user space based on the
23+ * ISA extensions available on the host. Also, disabling an ISA
24+ * extension using corresponding ISA_EXT register does not affect
25+ * the visibility of the ISA_EXT register itself.
26+ *
27+ * Based on above, we should filter-out all ISA_EXT registers.
2128 */
22− switch (reg & ~REG_MASK) {
29+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_A:
30+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_C:
31+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_D:
32+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_F:
33+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_H:
34+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_I:
35+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_M:
36+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SVPBMT:
2337 case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SSTC:
2438 case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SVINVAL:
2539 case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZIHINTPAUSE:
40+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICBOM:
41+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICBOZ:
2642 case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZBB:
2743 case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SSAIA:
44+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_V:
45+ case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SVNAPOT:
2846 case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZBA:
2947 case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZBS:
3048 case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICNTR:
@@ -32,6 +50,15 @@ bool filter_reg(__u64 reg) · 1 unmodified line
3250 case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZIFENCEI:
3351 case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZIHPM:
3452 return true;
53+ /* AIA registers are always available when Ssaia can't be disabled */
54+ case KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_AIA | KVM_REG_RISCV_CSR_AIA_REG(siselect):
55+ case KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_AIA | KVM_REG_RISCV_CSR_AIA_REG(iprio1):
56+ case KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_AIA | KVM_REG_RISCV_CSR_AIA_REG(iprio2):
57+ case KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_AIA | KVM_REG_RISCV_CSR_AIA_REG(sieh):
58+ case KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_AIA | KVM_REG_RISCV_CSR_AIA_REG(siph):
59+ case KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_AIA | KVM_REG_RISCV_CSR_AIA_REG(iprio1h):
60+ case KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_AIA | KVM_REG_RISCV_CSR_AIA_REG(iprio2h):
61+ return isa_ext_cant_disable[KVM_RISCV_ISA_EXT_SSAIA];
3562 default:
3663 break;
3764 }
@@ -50,24 +77,27 @@ static inline bool vcpu_has_ext(struct kvm_vcpu *vcpu, int ext) · 12 unmodified lines
5077 unsigned long value;
5178
5279 ret = __vcpu_get_reg(vcpu, RISCV_ISA_EXT_REG(ext), &value);
53− if (ret) {
54− printf("Failed to get ext %d", ext);
55− return false;
56− }
57−
58− return !!value;
80+ return (ret) ? false : !!value;
5981 }
6082
6183 void finalize_vcpu(struct kvm_vcpu *vcpu, struct vcpu_reg_list *c)
6284 {
85+ unsigned long isa_ext_state[KVM_RISCV_ISA_EXT_MAX] = { 0 };
6386 struct vcpu_reg_sublist *s;
87+ int rc;
88+
89+ for (int i = 0; i < KVM_RISCV_ISA_EXT_MAX; i++)
90+ __vcpu_get_reg(vcpu, RISCV_ISA_EXT_REG(i), &isa_ext_state[i]);
6491
6592 /*
6693 * Disable all extensions which were enabled by default
6794 * if they were available in the risc-v host.
6895 */
69− for (int i = 0; i < KVM_RISCV_ISA_EXT_MAX; i++)
70− __vcpu_set_reg(vcpu, RISCV_ISA_EXT_REG(i), 0);
96+ for (int i = 0; i < KVM_RISCV_ISA_EXT_MAX; i++) {
97+ rc = __vcpu_set_reg(vcpu, RISCV_ISA_EXT_REG(i), 0);
98+ if (rc && isa_ext_state[i])
99+ isa_ext_cant_disable[i] = true;
100+ }
71101
72102 for_each_sublist(c, s) {
73103 if (!s->feature)
@@ -506,10 +536,6 @@ static __u64 base_regs[] = { · 432 unmodified lines
506536 KVM_REG_RISCV | KVM_REG_SIZE_U64 | KVM_REG_RISCV_TIMER | KVM_REG_RISCV_TIMER_REG(time),
507537 KVM_REG_RISCV | KVM_REG_SIZE_U64 | KVM_REG_RISCV_TIMER | KVM_REG_RISCV_TIMER_REG(compare),
508538 KVM_REG_RISCV | KVM_REG_SIZE_U64 | KVM_REG_RISCV_TIMER | KVM_REG_RISCV_TIMER_REG(state),
509− KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_A,
510− KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_C,
511− KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_I,
512− KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_M,
513539 KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_SINGLE | KVM_RISCV_SBI_EXT_V01,
514540 KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_SINGLE | KVM_RISCV_SBI_EXT_TIME,
515541 KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_SINGLE | KVM_RISCV_SBI_EXT_IPI,
tools/testing/selftests/mm/charge_reserved_hugetlb.sh+2−2
@@ -25,7 +25,7 @@ if [[ "$1" == "-cgroup-v2" ]]; then · 24 unmodified lines
2525 fi
2626
2727 if [[ $cgroup2 ]]; then
28− cgroup_path=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
28+ cgroup_path=$(mount -t cgroup2 | head -1 | awk '{print $3}')
2929 if [[ -z "$cgroup_path" ]]; then
3030 cgroup_path=/dev/cgroup/memory
3131 mount -t cgroup2 none $cgroup_path
@@ -33,7 +33,7 @@ if [[ $cgroup2 ]]; then · 1 unmodified line
3333 fi
3434 echo "+hugetlb" >$cgroup_path/cgroup.subtree_control
3535 else
36− cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk -e '{print $3}')
36+ cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
3737 if [[ -z "$cgroup_path" ]]; then
3838 cgroup_path=/dev/cgroup/memory
3939 mount -t cgroup memory,hugetlb $cgroup_path
tools/testing/selftests/mm/hugetlb_reparenting_test.sh+2−2
@@ -20,7 +20,7 @@ fi · 19 unmodified lines
2020
2121
2222 if [[ $cgroup2 ]]; then
23− CGROUP_ROOT=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
23+ CGROUP_ROOT=$(mount -t cgroup2 | head -1 | awk '{print $3}')
2424 if [[ -z "$CGROUP_ROOT" ]]; then
2525 CGROUP_ROOT=/dev/cgroup/memory
2626 mount -t cgroup2 none $CGROUP_ROOT
@@ -28,7 +28,7 @@ if [[ $cgroup2 ]]; then · 1 unmodified line
2828 fi
2929 echo "+hugetlb +memory" >$CGROUP_ROOT/cgroup.subtree_control
3030 else
31− CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk -e '{print $3}')
31+ CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
3232 if [[ -z "$CGROUP_ROOT" ]]; then
3333 CGROUP_ROOT=/dev/cgroup/memory
3434 mount -t cgroup memory,hugetlb $CGROUP_ROOT
tools/testing/selftests/netfilter/Makefile+3−2
@@ -6,13 +6,14 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \ · 5 unmodified lines
66 nft_concat_range.sh nft_conntrack_helper.sh \
77 nft_queue.sh nft_meta.sh nf_nat_edemux.sh \
88 ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
9− conntrack_vrf.sh nft_synproxy.sh rpath.sh nft_audit.sh
9+ conntrack_vrf.sh nft_synproxy.sh rpath.sh nft_audit.sh \
10+ conntrack_sctp_collision.sh
1011
1112 HOSTPKG_CONFIG := pkg-config
1213
1314 CFLAGS += $(shell $(HOSTPKG_CONFIG) --cflags libmnl 2>/dev/null)
1415 LDLIBS += $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)
1516
16−TEST_GEN_FILES = nf-queue connect_close audit_logread
17+TEST_GEN_FILES = nf-queue connect_close audit_logread sctp_collision
1718
1819 include ../lib.mk
tools/testing/selftests/netfilter/conntrack_sctp_collision.sh+89−0
@@ -0,0 +1,89 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+#
4+# Testing For SCTP COLLISION SCENARIO as Below:
5+#
6+# 14:35:47.655279 IP CLIENT_IP.PORT > SERVER_IP.PORT: sctp (1) [INIT] [init tag: 2017837359]
7+# 14:35:48.353250 IP SERVER_IP.PORT > CLIENT_IP.PORT: sctp (1) [INIT] [init tag: 1187206187]
8+# 14:35:48.353275 IP CLIENT_IP.PORT > SERVER_IP.PORT: sctp (1) [INIT ACK] [init tag: 2017837359]
9+# 14:35:48.353283 IP SERVER_IP.PORT > CLIENT_IP.PORT: sctp (1) [COOKIE ECHO]
10+# 14:35:48.353977 IP CLIENT_IP.PORT > SERVER_IP.PORT: sctp (1) [COOKIE ACK]
11+# 14:35:48.855335 IP SERVER_IP.PORT > CLIENT_IP.PORT: sctp (1) [INIT ACK] [init tag: 164579970]
12+#
13+# TOPO: SERVER_NS (link0)<--->(link1) ROUTER_NS (link2)<--->(link3) CLIENT_NS
14+
15+CLIENT_NS=$(mktemp -u client-XXXXXXXX)
16+CLIENT_IP="198.51.200.1"
17+CLIENT_PORT=1234
18+
19+SERVER_NS=$(mktemp -u server-XXXXXXXX)
20+SERVER_IP="198.51.100.1"
21+SERVER_PORT=1234
22+
23+ROUTER_NS=$(mktemp -u router-XXXXXXXX)
24+CLIENT_GW="198.51.200.2"
25+SERVER_GW="198.51.100.2"
26+
27+# setup the topo
28+setup() {
29+ ip net add $CLIENT_NS
30+ ip net add $SERVER_NS
31+ ip net add $ROUTER_NS
32+ ip -n $SERVER_NS link add link0 type veth peer name link1 netns $ROUTER_NS
33+ ip -n $CLIENT_NS link add link3 type veth peer name link2 netns $ROUTER_NS
34+
35+ ip -n $SERVER_NS link set link0 up
36+ ip -n $SERVER_NS addr add $SERVER_IP/24 dev link0
37+ ip -n $SERVER_NS route add $CLIENT_IP dev link0 via $SERVER_GW
38+
39+ ip -n $ROUTER_NS link set link1 up
40+ ip -n $ROUTER_NS link set link2 up
41+ ip -n $ROUTER_NS addr add $SERVER_GW/24 dev link1
42+ ip -n $ROUTER_NS addr add $CLIENT_GW/24 dev link2
43+ ip net exec $ROUTER_NS sysctl -wq net.ipv4.ip_forward=1
44+
45+ ip -n $CLIENT_NS link set link3 up
46+ ip -n $CLIENT_NS addr add $CLIENT_IP/24 dev link3
47+ ip -n $CLIENT_NS route add $SERVER_IP dev link3 via $CLIENT_GW
48+
49+ # simulate the delay on OVS upcall by setting up a delay for INIT_ACK with
50+ # tc on $SERVER_NS side
51+ tc -n $SERVER_NS qdisc add dev link0 root handle 1: htb
52+ tc -n $SERVER_NS class add dev link0 parent 1: classid 1:1 htb rate 100mbit
53+ tc -n $SERVER_NS filter add dev link0 parent 1: protocol ip u32 match ip protocol 132 \
54+ 0xff match u8 2 0xff at 32 flowid 1:1
55+ tc -n $SERVER_NS qdisc add dev link0 parent 1:1 handle 10: netem delay 1200ms
56+
57+ # simulate the ctstate check on OVS nf_conntrack
58+ ip net exec $ROUTER_NS iptables -A FORWARD -m state --state INVALID,UNTRACKED -j DROP
59+ ip net exec $ROUTER_NS iptables -A INPUT -p sctp -j DROP
60+
61+ # use a smaller number for assoc's max_retrans to reproduce the issue
62+ modprobe sctp
63+ ip net exec $CLIENT_NS sysctl -wq net.sctp.association_max_retrans=3
64+}
65+
66+cleanup() {
67+ ip net exec $CLIENT_NS pkill sctp_collision 2>&1 >/dev/null
68+ ip net exec $SERVER_NS pkill sctp_collision 2>&1 >/dev/null
69+ ip net del "$CLIENT_NS"
70+ ip net del "$SERVER_NS"
71+ ip net del "$ROUTER_NS"
72+}
73+
74+do_test() {
75+ ip net exec $SERVER_NS ./sctp_collision server \
76+ $SERVER_IP $SERVER_PORT $CLIENT_IP $CLIENT_PORT &
77+ ip net exec $CLIENT_NS ./sctp_collision client \
78+ $CLIENT_IP $CLIENT_PORT $SERVER_IP $SERVER_PORT
79+}
80+
81+# NOTE: one way to work around the issue is set a smaller hb_interval
82+# ip net exec $CLIENT_NS sysctl -wq net.sctp.hb_interval=3500
83+
84+# run the test case
85+trap cleanup EXIT
86+setup && \
87+echo "Test for SCTP Collision in nf_conntrack:" && \
88+do_test && echo "PASS!"
89+exit $?
tools/testing/selftests/netfilter/nft_audit.sh+101−16
@@ -12,10 +12,11 @@ nft --version >/dev/null 2>&1 || { · 11 unmodified lines
1212 }
1313
1414 logfile=$(mktemp)
15+rulefile=$(mktemp)
1516 echo "logging into $logfile"
1617 ./audit_logread >"$logfile" &
1718 logread_pid=$!
18−trap 'kill $logread_pid; rm -f $logfile' EXIT
19+trap 'kill $logread_pid; rm -f $logfile $rulefile' EXIT
1920 exec 3<"$logfile"
2021
2122 do_test() { # (cmd, log)
@@ -26,12 +27,14 @@ do_test() { # (cmd, log) · 4 unmodified lines
2627 res=$(diff -a -u <(echo "$2") - <&3)
2728 [ $? -eq 0 ] && { echo "OK"; return; }
2829 echo "FAIL"
29− echo "$res"
30− ((RC++))
30+ grep -v '^\(---\|+++\|@@\)' <<< "$res"
31+ ((RC--))
3132 }
3233
3334 nft flush ruleset
3435
36+# adding tables, chains and rules
37+
3538 for table in t1 t2; do
3639 do_test "nft add table $table" \
3740 "table=$table family=2 entries=1 op=nft_register_table"
@@ -62,6 +65,48 @@ for table in t1 t2; do · 24 unmodified lines
6265 "table=$table family=2 entries=6 op=nft_register_rule"
6366 done
6467
68+for ((i = 0; i < 500; i++)); do
69+ echo "add rule t2 c3 counter accept comment \"rule $i\""
70+done >$rulefile
71+do_test "nft -f $rulefile" \
72+'table=t2 family=2 entries=500 op=nft_register_rule'
73+
74+# adding sets and elements
75+
76+settype='type inet_service; counter'
77+setelem='{ 22, 80, 443 }'
78+setblock="{ $settype; elements = $setelem; }"
79+do_test "nft add set t1 s $setblock" \
80+"table=t1 family=2 entries=4 op=nft_register_set"
81+
82+do_test "nft add set t1 s2 $setblock; add set t1 s3 { $settype; }" \
83+"table=t1 family=2 entries=5 op=nft_register_set"
84+
85+do_test "nft add element t1 s3 $setelem" \
86+"table=t1 family=2 entries=3 op=nft_register_setelem"
87+
88+# adding counters
89+
90+do_test 'nft add counter t1 c1' \
91+'table=t1 family=2 entries=1 op=nft_register_obj'
92+
93+do_test 'nft add counter t2 c1; add counter t2 c2' \
94+'table=t2 family=2 entries=2 op=nft_register_obj'
95+
96+# adding/updating quotas
97+
98+do_test 'nft add quota t1 q1 { 10 bytes }' \
99+'table=t1 family=2 entries=1 op=nft_register_obj'
100+
101+do_test 'nft add quota t2 q1 { 10 bytes }; add quota t2 q2 { 10 bytes }' \
102+'table=t2 family=2 entries=2 op=nft_register_obj'
103+
104+# changing the quota value triggers obj update path
105+do_test 'nft add quota t1 q1 { 20 bytes }' \
106+'table=t1 family=2 entries=1 op=nft_register_obj'
107+
108+# resetting rules
109+
65110 do_test 'nft reset rules t1 c2' \
66111 'table=t1 family=2 entries=3 op=nft_reset_rule'
67112
@@ -70,19 +115,6 @@ do_test 'nft reset rules table t1' \ · 2 unmodified lines
70115 table=t1 family=2 entries=3 op=nft_reset_rule
71116 table=t1 family=2 entries=3 op=nft_reset_rule'
72117
73−do_test 'nft reset rules' \
74−'table=t1 family=2 entries=3 op=nft_reset_rule
75−table=t1 family=2 entries=3 op=nft_reset_rule
76−table=t1 family=2 entries=3 op=nft_reset_rule
77−table=t2 family=2 entries=3 op=nft_reset_rule
78−table=t2 family=2 entries=3 op=nft_reset_rule
79−table=t2 family=2 entries=3 op=nft_reset_rule'
80−
81−for ((i = 0; i < 500; i++)); do
82− echo "add rule t2 c3 counter accept comment \"rule $i\""
83−done | do_test 'nft -f -' \
84−'table=t2 family=2 entries=500 op=nft_register_rule'
85−
86118 do_test 'nft reset rules t2 c3' \
87119 'table=t2 family=2 entries=189 op=nft_reset_rule
88120 table=t2 family=2 entries=188 op=nft_reset_rule
@@ -105,4 +137,57 @@ table=t2 family=2 entries=180 op=nft_reset_rule · 16 unmodified lines
105137 table=t2 family=2 entries=188 op=nft_reset_rule
106138 table=t2 family=2 entries=135 op=nft_reset_rule'
107139
140+# resetting sets and elements
141+
142+elem=(22 ,80 ,443)
143+relem=""
144+for i in {1..3}; do
145+ relem+="${elem[((i - 1))]}"
146+ do_test "nft reset element t1 s { $relem }" \
147+ "table=t1 family=2 entries=$i op=nft_reset_setelem"
148+done
149+
150+do_test 'nft reset set t1 s' \
151+'table=t1 family=2 entries=3 op=nft_reset_setelem'
152+
153+# deleting rules
154+
155+readarray -t handles < <(nft -a list chain t1 c1 | \
156+ sed -n 's/.*counter.* handle \(.*\)$/\1/p')
157+
158+do_test "nft delete rule t1 c1 handle ${handles[0]}" \
159+'table=t1 family=2 entries=1 op=nft_unregister_rule'
160+
161+cmd='delete rule t1 c1 handle'
162+do_test "nft $cmd ${handles[1]}; $cmd ${handles[2]}" \
163+'table=t1 family=2 entries=2 op=nft_unregister_rule'
164+
165+do_test 'nft flush chain t1 c2' \
166+'table=t1 family=2 entries=3 op=nft_unregister_rule'
167+
168+do_test 'nft flush table t2' \
169+'table=t2 family=2 entries=509 op=nft_unregister_rule'
170+
171+# deleting chains
172+
173+do_test 'nft delete chain t2 c2' \
174+'table=t2 family=2 entries=1 op=nft_unregister_chain'
175+
176+# deleting sets and elements
177+
178+do_test 'nft delete element t1 s { 22 }' \
179+'table=t1 family=2 entries=1 op=nft_unregister_setelem'
180+
181+do_test 'nft delete element t1 s { 80, 443 }' \
182+'table=t1 family=2 entries=2 op=nft_unregister_setelem'
183+
184+do_test 'nft flush set t1 s2' \
185+'table=t1 family=2 entries=3 op=nft_unregister_setelem'
186+
187+do_test 'nft delete set t1 s2' \
188+'table=t1 family=2 entries=1 op=nft_unregister_set'
189+
190+do_test 'nft delete set t1 s3' \
191+'table=t1 family=2 entries=1 op=nft_unregister_set'
192+
108193 exit $RC
tools/testing/selftests/netfilter/sctp_collision.c+99−0
@@ -0,0 +1,99 @@
1+// SPDX-License-Identifier: GPL-2.0
2+
3+#include <stdio.h>
4+#include <stdlib.h>
5+#include <string.h>
6+#include <unistd.h>
7+#include <arpa/inet.h>
8+
9+int main(int argc, char *argv[])
10+{
11+ struct sockaddr_in saddr = {}, daddr = {};
12+ int sd, ret, len = sizeof(daddr);
13+ struct timeval tv = {25, 0};
14+ char buf[] = "hello";
15+
16+ if (argc != 6 || (strcmp(argv[1], "server") && strcmp(argv[1], "client"))) {
17+ printf("%s <server|client> <LOCAL_IP> <LOCAL_PORT> <REMOTE_IP> <REMOTE_PORT>\n",
18+ argv[0]);
19+ return -1;
20+ }
21+
22+ sd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
23+ if (sd < 0) {
24+ printf("Failed to create sd\n");
25+ return -1;
26+ }
27+
28+ saddr.sin_family = AF_INET;
29+ saddr.sin_addr.s_addr = inet_addr(argv[2]);
30+ saddr.sin_port = htons(atoi(argv[3]));
31+
32+ ret = bind(sd, (struct sockaddr *)&saddr, sizeof(saddr));
33+ if (ret < 0) {
34+ printf("Failed to bind to address\n");
35+ goto out;
36+ }
37+
38+ ret = listen(sd, 5);
39+ if (ret < 0) {
40+ printf("Failed to listen on port\n");
41+ goto out;
42+ }
43+
44+ daddr.sin_family = AF_INET;
45+ daddr.sin_addr.s_addr = inet_addr(argv[4]);
46+ daddr.sin_port = htons(atoi(argv[5]));
47+
48+ /* make test shorter than 25s */
49+ ret = setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
50+ if (ret < 0) {
51+ printf("Failed to setsockopt SO_RCVTIMEO\n");
52+ goto out;
53+ }
54+
55+ if (!strcmp(argv[1], "server")) {
56+ sleep(1); /* wait a bit for client's INIT */
57+ ret = connect(sd, (struct sockaddr *)&daddr, len);
58+ if (ret < 0) {
59+ printf("Failed to connect to peer\n");
60+ goto out;
61+ }
62+ ret = recvfrom(sd, buf, sizeof(buf), 0, (struct sockaddr *)&daddr, &len);
63+ if (ret < 0) {
64+ printf("Failed to recv msg %d\n", ret);
65+ goto out;
66+ }
67+ ret = sendto(sd, buf, strlen(buf) + 1, 0, (struct sockaddr *)&daddr, len);
68+ if (ret < 0) {
69+ printf("Failed to send msg %d\n", ret);
70+ goto out;
71+ }
72+ printf("Server: sent! %d\n", ret);
73+ }
74+
75+ if (!strcmp(argv[1], "client")) {
76+ usleep(300000); /* wait a bit for server's listening */
77+ ret = connect(sd, (struct sockaddr *)&daddr, len);
78+ if (ret < 0) {
79+ printf("Failed to connect to peer\n");
80+ goto out;
81+ }
82+ sleep(1); /* wait a bit for server's delayed INIT_ACK to reproduce the issue */
83+ ret = sendto(sd, buf, strlen(buf) + 1, 0, (struct sockaddr *)&daddr, len);
84+ if (ret < 0) {
85+ printf("Failed to send msg %d\n", ret);
86+ goto out;
87+ }
88+ ret = recvfrom(sd, buf, sizeof(buf), 0, (struct sockaddr *)&daddr, &len);
89+ if (ret < 0) {
90+ printf("Failed to recv msg %d\n", ret);
91+ goto out;
92+ }
93+ printf("Client: rcvd! %d\n", ret);
94+ }
95+ ret = 0;
96+out:
97+ close(sd);
98+ return ret;
99+}
tools/testing/selftests/openat2/Makefile+1−1
@@ -1,6 +1,6 @@
11 # SPDX-License-Identifier: GPL-2.0-or-later
22
3−CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined
3+CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan
44 TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test
55
66 include ../lib.mk
tools/testing/selftests/powerpc/Makefile+3−4
@@ -59,12 +59,11 @@ override define INSTALL_RULE · 58 unmodified lines
5959 done;
6060 endef
6161
62−override define EMIT_TESTS
62+emit_tests:
6363 +@for TARGET in $(SUB_DIRS); do \
6464 BUILD_TARGET=$(OUTPUT)/$$TARGET; \
65− $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests;\
65+ $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET $@;\
6666 done;
67−endef
6867
6968 override define CLEAN
7069 +@for TARGET in $(SUB_DIRS); do \
@@ -77,4 +76,4 @@ endef · 6 unmodified lines
7776 tags:
7877 find . -name '*.c' -o -name '*.h' | xargs ctags
7978
80−.PHONY: tags $(SUB_DIRS)
79+.PHONY: tags $(SUB_DIRS) emit_tests
tools/testing/selftests/powerpc/pmu/Makefile+6−5
@@ -30,13 +30,14 @@ override define RUN_TESTS · 29 unmodified lines
3030 +TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests
3131 endef
3232
33−DEFAULT_EMIT_TESTS := $(EMIT_TESTS)
34−override define EMIT_TESTS
35− $(DEFAULT_EMIT_TESTS)
33+emit_tests:
34+ for TEST in $(TEST_GEN_PROGS); do \
35+ BASENAME_TEST=`basename $$TEST`; \
36+ echo "$(COLLECTION):$$BASENAME_TEST"; \
37+ done
3638 +TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
3739 +TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
3840 +TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
39−endef
4041
4142 DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
4243 override define INSTALL_RULE
@@ -64,4 +65,4 @@ sampling_tests: · 21 unmodified lines
6465 event_code_tests:
6566 TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
6667
67−.PHONY: all run_tests ebb sampling_tests event_code_tests
68+.PHONY: all run_tests ebb sampling_tests event_code_tests emit_tests
tools/testing/selftests/proc/proc-empty-vm.c+1−0
@@ -267,6 +267,7 @@ static const char g_smaps_rollup[] = · 266 unmodified lines
267267 "Private_Dirty: 0 kB\n"
268268 "Referenced: 0 kB\n"
269269 "Anonymous: 0 kB\n"
270+"KSM: 0 kB\n"
270271 "LazyFree: 0 kB\n"
271272 "AnonHugePages: 0 kB\n"
272273 "ShmemPmdMapped: 0 kB\n"
tools/testing/selftests/user_events/abi_test.c+3−1
@@ -91,16 +91,18 @@ static int reg_disable(long *enable, int bit) · 90 unmodified lines
9191
9292 FIXTURE(user) {
9393 long check;
94+ bool umount;
9495 };
9596
9697 FIXTURE_SETUP(user) {
97− USER_EVENT_FIXTURE_SETUP(return);
98+ USER_EVENT_FIXTURE_SETUP(return, self->umount);
9899
99100 change_event(false);
100101 self->check = 0;
101102 }
102103
103104 FIXTURE_TEARDOWN(user) {
105+ USER_EVENT_FIXTURE_TEARDOWN(self->umount);
104106 }
105107
106108 TEST_F(user, enablement) {
tools/testing/selftests/user_events/dyn_test.c+4−1
@@ -144,13 +144,16 @@ do { \ · 143 unmodified lines
144144
145145 FIXTURE(user) {
146146 int check;
147+ bool umount;
147148 };
148149
149150 FIXTURE_SETUP(user) {
150− USER_EVENT_FIXTURE_SETUP(return);
151+ USER_EVENT_FIXTURE_SETUP(return, self->umount);
151152 }
152153
153154 FIXTURE_TEARDOWN(user) {
155+ USER_EVENT_FIXTURE_TEARDOWN(self->umount);
156+
154157 wait_for_delete();
155158 }
156159
tools/testing/selftests/user_events/ftrace_test.c+4−1
@@ -204,10 +204,11 @@ FIXTURE(user) { · 203 unmodified lines
204204 int data_fd;
205205 int enable_fd;
206206 int check;
207+ bool umount;
207208 };
208209
209210 FIXTURE_SETUP(user) {
210− USER_EVENT_FIXTURE_SETUP(return);
211+ USER_EVENT_FIXTURE_SETUP(return, self->umount);
211212
212213 self->status_fd = open(status_file, O_RDONLY);
213214 ASSERT_NE(-1, self->status_fd);
@@ -219,6 +220,8 @@ FIXTURE_SETUP(user) { · 5 unmodified lines
219220 }
220221
221222 FIXTURE_TEARDOWN(user) {
223+ USER_EVENT_FIXTURE_TEARDOWN(self->umount);
224+
222225 close(self->status_fd);
223226 close(self->data_fd);
224227
tools/testing/selftests/user_events/perf_test.c+4−1
@@ -111,16 +111,19 @@ static int clear(int *check) · 110 unmodified lines
111111 FIXTURE(user) {
112112 int data_fd;
113113 int check;
114+ bool umount;
114115 };
115116
116117 FIXTURE_SETUP(user) {
117− USER_EVENT_FIXTURE_SETUP(return);
118+ USER_EVENT_FIXTURE_SETUP(return, self->umount);
118119
119120 self->data_fd = open(data_file, O_RDWR);
120121 ASSERT_NE(-1, self->data_fd);
121122 }
122123
123124 FIXTURE_TEARDOWN(user) {
125+ USER_EVENT_FIXTURE_TEARDOWN(self->umount);
126+
124127 close(self->data_fd);
125128
126129 if (clear(&self->check) != 0)
tools/testing/selftests/user_events/user_events_selftests.h+19−5
@@ -11,13 +11,19 @@ · 10 unmodified lines
1111
1212 #include "../kselftest.h"
1313
14−static inline bool tracefs_enabled(char **message, bool *fail)
14+static inline void tracefs_unmount(void)
15+{
16+ umount("/sys/kernel/tracing");
17+}
18+
19+static inline bool tracefs_enabled(char **message, bool *fail, bool *umount)
1520 {
1621 struct stat buf;
1722 int ret;
1823
1924 *message = "";
2025 *fail = false;
26+ *umount = false;
2127
2228 /* Ensure tracefs is installed */
2329 ret = stat("/sys/kernel/tracing", &buf);
@@ -37,6 +43,8 @@ static inline bool tracefs_enabled(char **message, bool *fail) · 13 unmodified lines
3743 return false;
3844 }
3945
46+ *umount = true;
47+
4048 ret = stat("/sys/kernel/tracing/README", &buf);
4149 }
4250
@@ -49,13 +57,14 @@ static inline bool tracefs_enabled(char **message, bool *fail) · 6 unmodified lines
4957 return true;
5058 }
5159
52−static inline bool user_events_enabled(char **message, bool *fail)
60+static inline bool user_events_enabled(char **message, bool *fail, bool *umount)
5361 {
5462 struct stat buf;
5563 int ret;
5664
5765 *message = "";
5866 *fail = false;
67+ *umount = false;
5968
6069 if (getuid() != 0) {
6170 *message = "Must be run as root";
@@ -63,7 +72,7 @@ static inline bool user_events_enabled(char **message, bool *fail) · 1 unmodified line
6372 return false;
6473 }
6574
66− if (!tracefs_enabled(message, fail))
75+ if (!tracefs_enabled(message, fail, umount))
6776 return false;
6877
6978 /* Ensure user_events is installed */
@@ -85,10 +94,10 @@ static inline bool user_events_enabled(char **message, bool *fail) · 15 unmodified lines
8594 return true;
8695 }
8796
88−#define USER_EVENT_FIXTURE_SETUP(statement) do { \
97+#define USER_EVENT_FIXTURE_SETUP(statement, umount) do { \
8998 char *message; \
9099 bool fail; \
91− if (!user_events_enabled(&message, &fail)) { \
100+ if (!user_events_enabled(&message, &fail, &(umount))) { \
92101 if (fail) { \
93102 TH_LOG("Setup failed due to: %s", message); \
94103 ASSERT_FALSE(fail); \
@@ -97,4 +106,9 @@ static inline bool user_events_enabled(char **message, bool *fail) · 2 unmodified lines
97106 } \
98107 } while (0)
99108
109+#define USER_EVENT_FIXTURE_TEARDOWN(umount) do { \
110+ if ((umount)) \
111+ tracefs_unmount(); \
112+} while (0)
113+
100114 #endif /* _USER_EVENTS_SELFTESTS_H */
tools/tracing/rtla/src/timerlat_aa.c+26−6
@@ -159,6 +159,7 @@ static int timerlat_aa_irq_latency(struct timerlat_aa_data *taa_data, · 158 unmodified lines
159159 taa_data->thread_nmi_sum = 0;
160160 taa_data->thread_irq_sum = 0;
161161 taa_data->thread_softirq_sum = 0;
162+ taa_data->thread_thread_sum = 0;
162163 taa_data->thread_blocking_duration = 0;
163164 taa_data->timer_irq_start_time = 0;
164165 taa_data->timer_irq_duration = 0;
@@ -337,7 +338,23 @@ static int timerlat_aa_irq_handler(struct trace_seq *s, struct tep_record *recor · 172 unmodified lines
337338 taa_data->timer_irq_start_time = start;
338339 taa_data->timer_irq_duration = duration;
339340
340− taa_data->timer_irq_start_delay = taa_data->timer_irq_start_time - expected_start;
341+ /*
342+ * We are dealing with two different clock sources: the
343+ * external clock source that timerlat uses as a reference
344+ * and the clock used by the tracer. There are also two
345+ * moments: the time reading the clock and the timer in
346+ * which the event is placed in the buffer (the trace
347+ * event timestamp). If the processor is slow or there
348+ * is some hardware noise, the difference between the
349+ * timestamp and the external clock read can be longer
350+ * than the IRQ handler delay, resulting in a negative
351+ * time. If so, set IRQ start delay as 0. In the end,
352+ * it is less relevant than the noise.
353+ */
354+ if (expected_start < taa_data->timer_irq_start_time)
355+ taa_data->timer_irq_start_delay = taa_data->timer_irq_start_time - expected_start;
356+ else
357+ taa_data->timer_irq_start_delay = 0;
341358
342359 /*
343360 * not exit from idle.
@@ -528,7 +545,7 @@ static int timerlat_aa_kworker_start_handler(struct trace_seq *s, struct tep_rec · 184 unmodified lines
528545 static void timerlat_thread_analysis(struct timerlat_aa_data *taa_data, int cpu,
529546 int irq_thresh, int thread_thresh)
530547 {
531− unsigned long long exp_irq_ts;
548+ long long exp_irq_ts;
532549 int total;
533550 int irq;
534551
@@ -545,12 +562,15 @@ static void timerlat_thread_analysis(struct timerlat_aa_data *taa_data, int cpu, · 10 unmodified lines
545562
546563 /*
547564 * Expected IRQ arrival time using the trace clock as the base.
565+ *
566+ * TODO: Add a list of previous IRQ, and then run the list backwards.
548567 */
549568 exp_irq_ts = taa_data->timer_irq_start_time - taa_data->timer_irq_start_delay;
550−
551− if (exp_irq_ts < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration)
552− printf(" Previous IRQ interference: \t\t up to %9.2f us\n",
553− ns_to_usf(taa_data->prev_irq_duration));
569+ if (exp_irq_ts < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration) {
570+ if (taa_data->prev_irq_timstamp < taa_data->timer_irq_start_time)
571+ printf(" Previous IRQ interference: \t\t up to %9.2f us\n",
572+ ns_to_usf(taa_data->prev_irq_duration));
573+ }
554574
555575 /*
556576 * The delay that the IRQ suffered before starting.
tools/tracing/rtla/src/timerlat_u.c+4−2
@@ -45,7 +45,7 @@ static int timerlat_u_main(int cpu, struct timerlat_u_params *params) · 44 unmodified lines
4545
4646 retval = sched_setaffinity(gettid(), sizeof(set), &set);
4747 if (retval == -1) {
48− err_msg("Error setting user thread affinity\n");
48+ debug_msg("Error setting user thread affinity %d, is the CPU online?\n", cpu);
4949 exit(1);
5050 }
5151
@@ -193,7 +193,9 @@ void *timerlat_u_dispatcher(void *data) · 141 unmodified lines
193193 procs_count--;
194194 }
195195 }
196− break;
196+
197+ if (!procs_count)
198+ break;
197199 }
198200
199201 sleep(1);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t