From: Sasha Levin Date: Thu, 30 May 2024 18:48:12 +0000 (-0400) Subject: Fixes for 6.1 X-Git-Tag: v6.1.93~65 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6d48ed6f72f6ac4b9b21d3f18a5ab8adb26c4c14;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.1 Signed-off-by: Sasha Levin --- diff --git a/queue-6.1/arm-add-multi_v7_lpae_defconfig.patch b/queue-6.1/arm-add-multi_v7_lpae_defconfig.patch new file mode 100644 index 00000000000..0c426e8c004 --- /dev/null +++ b/queue-6.1/arm-add-multi_v7_lpae_defconfig.patch @@ -0,0 +1,65 @@ +From 5a82cd5a3b9b17da8ff8cbc4565c1491cf3bcc99 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Jan 2023 12:02:13 +0100 +Subject: ARM: add multi_v7_lpae_defconfig + +From: Nicolas Saenz Julienne + +[ Upstream commit e9faf9b0b07a317f6ac40ab67e5490a1c4df5fc6 ] + +The only missing configuration option preventing us from using +multi_v7_defconfig with the Raspberry Pi 4 is ARM_LPAE. It's needed as +the PCIe controller found on the SoC depends on 64bit addressing, yet +can't be included as not all v7 boards support LPAE. + +Introduce multi_v7_lpae_defconfig, built off multi_v7_defconfig, which will +avoid us having to duplicate and maintain multiple similar configurations. + +Needless to say the Raspberry Pi 4 is not the only platform that can +benefit from this new configuration. + +Signed-off-by: Nicolas Saenz Julienne +Signed-off-by: Alexander Stein +Link: https://lore.kernel.org/r/20230124110213.3221264-11-alexander.stein@ew.tq-group.com +Signed-off-by: Arnd Bergmann +Stable-dep-of: fc2f5f10f9bc ("s390/vdso: Create .build-id links for unstripped vdso files") +Signed-off-by: Sasha Levin +--- + arch/arm/Makefile | 6 ++++++ + arch/arm/configs/lpae.config | 2 ++ + 2 files changed, 8 insertions(+) + create mode 100644 arch/arm/configs/lpae.config + +diff --git a/arch/arm/Makefile b/arch/arm/Makefile +index c846119c448f0..ce1d873c8986a 100644 +--- a/arch/arm/Makefile ++++ b/arch/arm/Makefile +@@ -310,6 +310,10 @@ endif + # My testing targets (bypasses dependencies) + bp:; $(Q)$(MAKE) $(build)=$(boot) $(boot)/bootpImage + ++include $(srctree)/scripts/Makefile.defconf ++PHONY += multi_v7_lpae_defconfig ++multi_v7_lpae_defconfig: ++ $(call merge_into_defconfig,multi_v7_defconfig,lpae) + + define archhelp + echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' +@@ -325,4 +329,6 @@ define archhelp + echo ' (distribution) /sbin/$(INSTALLKERNEL) or' + echo ' install to $$(INSTALL_PATH) and run lilo' + echo ' vdso_install - Install unstripped vdso.so to $$(INSTALL_MOD_PATH)/vdso' ++ echo ++ echo ' multi_v7_lpae_defconfig - multi_v7_defconfig with CONFIG_ARM_LPAE enabled' + endef +diff --git a/arch/arm/configs/lpae.config b/arch/arm/configs/lpae.config +new file mode 100644 +index 0000000000000..a6d6f7ab3c01a +--- /dev/null ++++ b/arch/arm/configs/lpae.config +@@ -0,0 +1,2 @@ ++CONFIG_ARM_LPAE=y ++CONFIG_VMSPLIT_2G=y +-- +2.43.0 + diff --git a/queue-6.1/arm64-configs-add-virtconfig.patch b/queue-6.1/arm64-configs-add-virtconfig.patch new file mode 100644 index 00000000000..e1cb5f83175 --- /dev/null +++ b/queue-6.1/arm64-configs-add-virtconfig.patch @@ -0,0 +1,96 @@ +From 477be48627d9d383c22a15b3032f30c423019d41 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Feb 2023 19:52:49 +0000 +Subject: arm64: configs: Add virtconfig + +From: Mark Brown + +[ Upstream commit c6cd63f5af3921c484be5789cf23e0f276de3a2f ] + +Provide a slimline configuration intended to be booted on virtual +machines, with the goal of providing a light configuration which will +boot on and enable features available in mach-virt. This is defined in +terms of the standard defconfig, with an additional virt.config fragment +which disables options unneeded in a virtual configuration. + +As a first step we just disable all the ARCH_ configuration options, +disabling the build of all the SoC specific drivers. This results in a +kernel that builds about 25% faster in my testing, if this approach +works for people we can add further options. + +Signed-off-by: Mark Brown +Link: https://lore.kernel.org/r/20230203-arm64-defconfigs-v1-3-cd0694a05f13@kernel.org +Signed-off-by: Arnd Bergmann +Stable-dep-of: fc2f5f10f9bc ("s390/vdso: Create .build-id links for unstripped vdso files") +Signed-off-by: Sasha Levin +--- + arch/arm64/Makefile | 6 ++++++ + arch/arm64/configs/virt.config | 39 ++++++++++++++++++++++++++++++++++ + 2 files changed, 45 insertions(+) + create mode 100644 arch/arm64/configs/virt.config + +diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile +index c9496539c3351..bd4d9a001c612 100644 +--- a/arch/arm64/Makefile ++++ b/arch/arm64/Makefile +@@ -204,6 +204,12 @@ ifdef CONFIG_COMPAT_VDSO + endif + endif + ++include $(srctree)/scripts/Makefile.defconf ++ ++PHONY += virtconfig ++virtconfig: ++ $(call merge_into_defconfig_override,defconfig,virt) ++ + define archhelp + echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)' + echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)' +diff --git a/arch/arm64/configs/virt.config b/arch/arm64/configs/virt.config +new file mode 100644 +index 0000000000000..6ef0a739717ff +--- /dev/null ++++ b/arch/arm64/configs/virt.config +@@ -0,0 +1,39 @@ ++# CONFIG_ARCH_ACTIONS is not set ++# CONFIG_ARCH_SUNXI is not set ++# CONFIG_ARCH_ALPINE is not set ++# CONFIG_ARCH_APPLE is not set ++# CONFIG_ARCH_BCM is not set ++# CONFIG_ARCH_BCM2835 is not set ++# CONFIG_ARCH_BCMBCA is not set ++# CONFIG_ARCH_BCM_IPROC is not set ++# CONFIG_ARCH_BERLIN is not set ++# CONFIG_ARCH_BRCMSTB is not set ++# CONFIG_ARCH_EXYNOS is not set ++# CONFIG_ARCH_K3 is not set ++# CONFIG_ARCH_LAYERSCAPE is not set ++# CONFIG_ARCH_LG1K is not set ++# CONFIG_ARCH_HISI is not set ++# CONFIG_ARCH_KEEMBAY is not set ++# CONFIG_ARCH_MEDIATEK is not set ++# CONFIG_ARCH_MESON is not set ++# CONFIG_ARCH_MVEBU is not set ++# CONFIG_ARCH_NXP is not set ++# CONFIG_ARCH_MXC is not set ++# CONFIG_ARCH_NPCM is not set ++# CONFIG_ARCH_QCOM is not set ++# CONFIG_ARCH_RENESAS is not set ++# CONFIG_ARCH_ROCKCHIP is not set ++# CONFIG_ARCH_S32 is not set ++# CONFIG_ARCH_SEATTLE is not set ++# CONFIG_ARCH_INTEL_SOCFPGA is not set ++# CONFIG_ARCH_SYNQUACER is not set ++# CONFIG_ARCH_TEGRA is not set ++# CONFIG_ARCH_TESLA_FSD is not set ++# CONFIG_ARCH_SPRD is not set ++# CONFIG_ARCH_THUNDER is not set ++# CONFIG_ARCH_THUNDER2 is not set ++# CONFIG_ARCH_UNIPHIER is not set ++# CONFIG_ARCH_VEXPRESS is not set ++# CONFIG_ARCH_VISCONTI is not set ++# CONFIG_ARCH_XGENE is not set ++# CONFIG_ARCH_ZYNQMP is not set +-- +2.43.0 + diff --git a/queue-6.1/arm64-dts-meson-fix-s4-power-controller-node.patch b/queue-6.1/arm64-dts-meson-fix-s4-power-controller-node.patch new file mode 100644 index 00000000000..75560e1d049 --- /dev/null +++ b/queue-6.1/arm64-dts-meson-fix-s4-power-controller-node.patch @@ -0,0 +1,49 @@ +From b6e7f1a16139869aa074f098c869c1d932115ea7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Apr 2024 16:42:30 +0800 +Subject: arm64: dts: meson: fix S4 power-controller node + +From: Xianwei Zhao + +[ Upstream commit 72907de9051dc2aa7b55c2a020e2872184ac17cd ] + +The power-controller module works well by adding its parent +node secure-monitor. + +Fixes: 085f7a298a14 ("arm64: dts: add support for S4 power domain controller") +Signed-off-by: Xianwei Zhao +Reviewed-by: Neil Armstrong +Link: https://lore.kernel.org/r/20240412-fix-secpwr-s4-v2-1-3802fd936d77@amlogic.com +Signed-off-by: Neil Armstrong +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-s4.dtsi b/arch/arm64/boot/dts/amlogic/meson-s4.dtsi +index 372a03762d69b..a1c55b047708c 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-s4.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-s4.dtsi +@@ -61,10 +61,15 @@ xtal: xtal-clk { + #clock-cells = <0>; + }; + +- pwrc: power-controller { +- compatible = "amlogic,meson-s4-pwrc"; +- #power-domain-cells = <1>; +- status = "okay"; ++ firmware { ++ sm: secure-monitor { ++ compatible = "amlogic,meson-gxbb-sm"; ++ ++ pwrc: power-controller { ++ compatible = "amlogic,meson-s4-pwrc"; ++ #power-domain-cells = <1>; ++ }; ++ }; + }; + + soc { +-- +2.43.0 + diff --git a/queue-6.1/coresight-etm4x-do-not-hardcode-iomem-access-for-reg.patch b/queue-6.1/coresight-etm4x-do-not-hardcode-iomem-access-for-reg.patch new file mode 100644 index 00000000000..8f2c724b9ee --- /dev/null +++ b/queue-6.1/coresight-etm4x-do-not-hardcode-iomem-access-for-reg.patch @@ -0,0 +1,44 @@ +From 6ce802dd6d230232875dbc82a40a03b6008fb49f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Apr 2024 15:26:59 +0100 +Subject: coresight: etm4x: Do not hardcode IOMEM access for register restore + +From: Suzuki K Poulose + +[ Upstream commit 1e7ba33fa591de1cf60afffcabb45600b3607025 ] + +When we restore the register state for ETM4x, while coming back +from CPU idle, we hardcode IOMEM access. This is wrong and could +blow up for an ETM with system instructions access (and for ETE). + +Fixes: f5bd523690d2 ("coresight: etm4x: Convert all register accesses") +Reported-by: Yabin Cui +Reviewed-by: Mike Leach +Signed-off-by: Suzuki K Poulose +Tested-by: Yabin Cui +Link: https://lore.kernel.org/r/20240412142702.2882478-2-suzuki.poulose@arm.com +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index 63fe506a60314..e8adee6017714 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -1726,8 +1726,10 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata) + { + int i; + struct etmv4_save_state *state = drvdata->save_state; +- struct csdev_access tmp_csa = CSDEV_ACCESS_IOMEM(drvdata->base); +- struct csdev_access *csa = &tmp_csa; ++ struct csdev_access *csa = &drvdata->csdev->access; ++ ++ if (WARN_ON(!drvdata->csdev)) ++ return; + + etm4_cs_unlock(drvdata, csa); + etm4x_relaxed_write32(csa, state->trcclaimset, TRCCLAIMSET); +-- +2.43.0 + diff --git a/queue-6.1/coresight-etm4x-do-not-save-restore-data-trace-contr.patch b/queue-6.1/coresight-etm4x-do-not-save-restore-data-trace-contr.patch new file mode 100644 index 00000000000..b61ca0230fc --- /dev/null +++ b/queue-6.1/coresight-etm4x-do-not-save-restore-data-trace-contr.patch @@ -0,0 +1,119 @@ +From 4df3e8823894e1540525857c6b2483476858b331 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Apr 2024 15:27:00 +0100 +Subject: coresight: etm4x: Do not save/restore Data trace control registers + +From: Suzuki K Poulose + +[ Upstream commit 5eb3a0c2c52368cb9902e9a6ea04888e093c487d ] + +ETM4x doesn't support Data trace on A class CPUs. As such do not access the +Data trace control registers during CPU idle. This could cause problems for +ETE. While at it, remove all references to the Data trace control registers. + +Fixes: f188b5e76aae ("coresight: etm4x: Save/restore state across CPU low power states") +Reported-by: Yabin Cui +Reviewed-by: Mike Leach +Signed-off-by: Suzuki K Poulose +Tested-by: Yabin Cui +Link: https://lore.kernel.org/r/20240412142702.2882478-3-suzuki.poulose@arm.com +Signed-off-by: Sasha Levin +--- + .../coresight/coresight-etm4x-core.c | 6 ---- + drivers/hwtracing/coresight/coresight-etm4x.h | 28 ------------------- + 2 files changed, 34 deletions(-) + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index e8adee6017714..a84f6f63e8d61 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -1622,9 +1622,6 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) + state->trcvissctlr = etm4x_read32(csa, TRCVISSCTLR); + if (drvdata->nr_pe_cmp) + state->trcvipcssctlr = etm4x_read32(csa, TRCVIPCSSCTLR); +- state->trcvdctlr = etm4x_read32(csa, TRCVDCTLR); +- state->trcvdsacctlr = etm4x_read32(csa, TRCVDSACCTLR); +- state->trcvdarcctlr = etm4x_read32(csa, TRCVDARCCTLR); + + for (i = 0; i < drvdata->nrseqstate - 1; i++) + state->trcseqevr[i] = etm4x_read32(csa, TRCSEQEVRn(i)); +@@ -1755,9 +1752,6 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata) + etm4x_relaxed_write32(csa, state->trcvissctlr, TRCVISSCTLR); + if (drvdata->nr_pe_cmp) + etm4x_relaxed_write32(csa, state->trcvipcssctlr, TRCVIPCSSCTLR); +- etm4x_relaxed_write32(csa, state->trcvdctlr, TRCVDCTLR); +- etm4x_relaxed_write32(csa, state->trcvdsacctlr, TRCVDSACCTLR); +- etm4x_relaxed_write32(csa, state->trcvdarcctlr, TRCVDARCCTLR); + + for (i = 0; i < drvdata->nrseqstate - 1; i++) + etm4x_relaxed_write32(csa, state->trcseqevr[i], TRCSEQEVRn(i)); +diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h +index d8e4d902b01ad..ff2a643fb54d4 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x.h ++++ b/drivers/hwtracing/coresight/coresight-etm4x.h +@@ -43,9 +43,6 @@ + #define TRCVIIECTLR 0x084 + #define TRCVISSCTLR 0x088 + #define TRCVIPCSSCTLR 0x08C +-#define TRCVDCTLR 0x0A0 +-#define TRCVDSACCTLR 0x0A4 +-#define TRCVDARCCTLR 0x0A8 + /* Derived resources registers */ + #define TRCSEQEVRn(n) (0x100 + (n * 4)) /* n = 0-2 */ + #define TRCSEQRSTEVR 0x118 +@@ -90,9 +87,6 @@ + /* Address Comparator registers n = 0-15 */ + #define TRCACVRn(n) (0x400 + (n * 8)) + #define TRCACATRn(n) (0x480 + (n * 8)) +-/* Data Value Comparator Value registers, n = 0-7 */ +-#define TRCDVCVRn(n) (0x500 + (n * 16)) +-#define TRCDVCMRn(n) (0x580 + (n * 16)) + /* ContextID/Virtual ContextID comparators, n = 0-7 */ + #define TRCCIDCVRn(n) (0x600 + (n * 8)) + #define TRCVMIDCVRn(n) (0x640 + (n * 8)) +@@ -272,9 +266,6 @@ + /* List of registers accessible via System instructions */ + #define ETM4x_ONLY_SYSREG_LIST(op, val) \ + CASE_##op((val), TRCPROCSELR) \ +- CASE_##op((val), TRCVDCTLR) \ +- CASE_##op((val), TRCVDSACCTLR) \ +- CASE_##op((val), TRCVDARCCTLR) \ + CASE_##op((val), TRCOSLAR) + + #define ETM_COMMON_SYSREG_LIST(op, val) \ +@@ -422,22 +413,6 @@ + CASE_##op((val), TRCACATRn(13)) \ + CASE_##op((val), TRCACATRn(14)) \ + CASE_##op((val), TRCACATRn(15)) \ +- CASE_##op((val), TRCDVCVRn(0)) \ +- CASE_##op((val), TRCDVCVRn(1)) \ +- CASE_##op((val), TRCDVCVRn(2)) \ +- CASE_##op((val), TRCDVCVRn(3)) \ +- CASE_##op((val), TRCDVCVRn(4)) \ +- CASE_##op((val), TRCDVCVRn(5)) \ +- CASE_##op((val), TRCDVCVRn(6)) \ +- CASE_##op((val), TRCDVCVRn(7)) \ +- CASE_##op((val), TRCDVCMRn(0)) \ +- CASE_##op((val), TRCDVCMRn(1)) \ +- CASE_##op((val), TRCDVCMRn(2)) \ +- CASE_##op((val), TRCDVCMRn(3)) \ +- CASE_##op((val), TRCDVCMRn(4)) \ +- CASE_##op((val), TRCDVCMRn(5)) \ +- CASE_##op((val), TRCDVCMRn(6)) \ +- CASE_##op((val), TRCDVCMRn(7)) \ + CASE_##op((val), TRCCIDCVRn(0)) \ + CASE_##op((val), TRCCIDCVRn(1)) \ + CASE_##op((val), TRCCIDCVRn(2)) \ +@@ -905,9 +880,6 @@ struct etmv4_save_state { + u32 trcviiectlr; + u32 trcvissctlr; + u32 trcvipcssctlr; +- u32 trcvdctlr; +- u32 trcvdsacctlr; +- u32 trcvdarcctlr; + + u32 trcseqevr[ETM_MAX_SEQ_STATES]; + u32 trcseqrstevr; +-- +2.43.0 + diff --git a/queue-6.1/coresight-etm4x-fix-access-to-resource-selector-regi.patch b/queue-6.1/coresight-etm4x-fix-access-to-resource-selector-regi.patch new file mode 100644 index 00000000000..69409b23d56 --- /dev/null +++ b/queue-6.1/coresight-etm4x-fix-access-to-resource-selector-regi.patch @@ -0,0 +1,51 @@ +From b4f8aad44b1e819ef044410a7741ccb956a36c68 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Apr 2024 15:27:02 +0100 +Subject: coresight: etm4x: Fix access to resource selector registers + +From: Suzuki K Poulose + +[ Upstream commit d6fc00d0f640d6010b51054aa8b0fd191177dbc9 ] + +Resource selector pair 0 is always implemented and reserved. We must not +touch it, even during save/restore for CPU Idle. Rest of the driver is +well behaved. Fix the offending ones. + +Reported-by: Yabin Cui +Fixes: f188b5e76aae ("coresight: etm4x: Save/restore state across CPU low power states") +Signed-off-by: Suzuki K Poulose +Tested-by: Yabin Cui +Reviewed-by: Mike Leach +Link: https://lore.kernel.org/r/20240412142702.2882478-5-suzuki.poulose@arm.com +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index e2e5b1422cdb7..354267edcb45f 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -1641,7 +1641,8 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) + state->trccntvr[i] = etm4x_read32(csa, TRCCNTVRn(i)); + } + +- for (i = 0; i < drvdata->nr_resource * 2; i++) ++ /* Resource selector pair 0 is reserved */ ++ for (i = 2; i < drvdata->nr_resource * 2; i++) + state->trcrsctlr[i] = etm4x_read32(csa, TRCRSCTLRn(i)); + + for (i = 0; i < drvdata->nr_ss_cmp; i++) { +@@ -1772,7 +1773,8 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata) + etm4x_relaxed_write32(csa, state->trccntvr[i], TRCCNTVRn(i)); + } + +- for (i = 0; i < drvdata->nr_resource * 2; i++) ++ /* Resource selector pair 0 is reserved */ ++ for (i = 2; i < drvdata->nr_resource * 2; i++) + etm4x_relaxed_write32(csa, state->trcrsctlr[i], TRCRSCTLRn(i)); + + for (i = 0; i < drvdata->nr_ss_cmp; i++) { +-- +2.43.0 + diff --git a/queue-6.1/coresight-etm4x-fix-unbalanced-pm_runtime_enable.patch b/queue-6.1/coresight-etm4x-fix-unbalanced-pm_runtime_enable.patch new file mode 100644 index 00000000000..7b3138a02cb --- /dev/null +++ b/queue-6.1/coresight-etm4x-fix-unbalanced-pm_runtime_enable.patch @@ -0,0 +1,66 @@ +From 835bbbaf949eab1a6ff21d7adf7d88efa0377f9c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Mar 2024 11:28:33 +0530 +Subject: coresight: etm4x: Fix unbalanced pm_runtime_enable() + +From: Anshuman Khandual + +[ Upstream commit caa41c47dab7e1054f587e592ab21296e3a6781c ] + +There is an unbalanced pm_runtime_enable() in etm4_probe_platform_dev() +when etm4_probe() fails. This problem can be observed via the coresight +etm4 module's (load -> unload -> load) sequence when etm4_probe() fails +in etm4_probe_platform_dev(). + +[ 63.379943] coresight-etm4x 7040000.etm: Unbalanced pm_runtime_enable! +[ 63.393630] coresight-etm4x 7140000.etm: Unbalanced pm_runtime_enable! +[ 63.407455] coresight-etm4x 7240000.etm: Unbalanced pm_runtime_enable! +[ 63.420983] coresight-etm4x 7340000.etm: Unbalanced pm_runtime_enable! +[ 63.420999] coresight-etm4x 7440000.etm: Unbalanced pm_runtime_enable! +[ 63.441209] coresight-etm4x 7540000.etm: Unbalanced pm_runtime_enable! +[ 63.454689] coresight-etm4x 7640000.etm: Unbalanced pm_runtime_enable! +[ 63.474982] coresight-etm4x 7740000.etm: Unbalanced pm_runtime_enable! + +This fixes the above problem - with an explicit pm_runtime_disable() call +when etm4_probe() fails during etm4_probe_platform_dev(). + +Cc: Lorenzo Pieralisi +Cc: Hanjun Guo +Cc: Sudeep Holla +Cc: "Rafael J. Wysocki" +Cc: Len Brown +Cc: Suzuki K Poulose +Cc: Mike Leach +Cc: James Clark +Cc: Leo Yan +Cc: linux-acpi@vger.kernel.org +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-kernel@vger.kernel.org +Cc: coresight@lists.linaro.org +Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices") +Reviewed-by: James Clark +Signed-off-by: Anshuman Khandual +Signed-off-by: Suzuki K Poulose +Link: https://lore.kernel.org/r/20240314055843.2625883-2-anshuman.khandual@arm.com +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/coresight-etm4x-core.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index fda48a0afc1a5..63fe506a60314 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -2053,6 +2053,9 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) + ret = etm4_probe(&pdev->dev, NULL, 0); + + pm_runtime_put(&pdev->dev); ++ if (ret) ++ pm_runtime_disable(&pdev->dev); ++ + return ret; + } + +-- +2.43.0 + diff --git a/queue-6.1/coresight-etm4x-safe-access-for-trcqcltr.patch b/queue-6.1/coresight-etm4x-safe-access-for-trcqcltr.patch new file mode 100644 index 00000000000..e42858615cf --- /dev/null +++ b/queue-6.1/coresight-etm4x-safe-access-for-trcqcltr.patch @@ -0,0 +1,90 @@ +From d311ce8d16e160de9fc319a508f471bd8fbfea49 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Apr 2024 15:27:01 +0100 +Subject: coresight: etm4x: Safe access for TRCQCLTR + +From: Suzuki K Poulose + +[ Upstream commit 46bf8d7cd8530eca607379033b9bc4ac5590a0cd ] + +ETM4x implements TRCQCLTR only when the Q elements are supported +and the Q element filtering is supported (TRCIDR0.QFILT). Access +to the register otherwise could be fatal. Fix this by tracking the +availability, like the others. + +Fixes: f188b5e76aae ("coresight: etm4x: Save/restore state across CPU low power states") +Reported-by: Yabin Cui +Reviewed-by: Mike Leach +Signed-off-by: Suzuki K Poulose +Tested-by: Yabin Cui +Link: https://lore.kernel.org/r/20240412142702.2882478-4-suzuki.poulose@arm.com +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/coresight-etm4x-core.c | 8 ++++++-- + drivers/hwtracing/coresight/coresight-etm4x.h | 3 +++ + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index a84f6f63e8d61..e2e5b1422cdb7 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -1120,6 +1120,8 @@ static void etm4_init_arch_data(void *info) + drvdata->nr_event = FIELD_GET(TRCIDR0_NUMEVENT_MASK, etmidr0); + /* QSUPP, bits[16:15] Q element support field */ + drvdata->q_support = FIELD_GET(TRCIDR0_QSUPP_MASK, etmidr0); ++ if (drvdata->q_support) ++ drvdata->q_filt = !!(etmidr0 & TRCIDR0_QFILT); + /* TSSIZE, bits[28:24] Global timestamp size field */ + drvdata->ts_size = FIELD_GET(TRCIDR0_TSSIZE_MASK, etmidr0); + +@@ -1615,7 +1617,8 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) + state->trcccctlr = etm4x_read32(csa, TRCCCCTLR); + state->trcbbctlr = etm4x_read32(csa, TRCBBCTLR); + state->trctraceidr = etm4x_read32(csa, TRCTRACEIDR); +- state->trcqctlr = etm4x_read32(csa, TRCQCTLR); ++ if (drvdata->q_filt) ++ state->trcqctlr = etm4x_read32(csa, TRCQCTLR); + + state->trcvictlr = etm4x_read32(csa, TRCVICTLR); + state->trcviiectlr = etm4x_read32(csa, TRCVIIECTLR); +@@ -1745,7 +1748,8 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata) + etm4x_relaxed_write32(csa, state->trcccctlr, TRCCCCTLR); + etm4x_relaxed_write32(csa, state->trcbbctlr, TRCBBCTLR); + etm4x_relaxed_write32(csa, state->trctraceidr, TRCTRACEIDR); +- etm4x_relaxed_write32(csa, state->trcqctlr, TRCQCTLR); ++ if (drvdata->q_filt) ++ etm4x_relaxed_write32(csa, state->trcqctlr, TRCQCTLR); + + etm4x_relaxed_write32(csa, state->trcvictlr, TRCVICTLR); + etm4x_relaxed_write32(csa, state->trcviiectlr, TRCVIIECTLR); +diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h +index ff2a643fb54d4..31754173091b9 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x.h ++++ b/drivers/hwtracing/coresight/coresight-etm4x.h +@@ -135,6 +135,7 @@ + #define TRCIDR0_TRCCCI BIT(7) + #define TRCIDR0_RETSTACK BIT(9) + #define TRCIDR0_NUMEVENT_MASK GENMASK(11, 10) ++#define TRCIDR0_QFILT BIT(14) + #define TRCIDR0_QSUPP_MASK GENMASK(16, 15) + #define TRCIDR0_TSSIZE_MASK GENMASK(28, 24) + +@@ -951,6 +952,7 @@ struct etmv4_save_state { + * @os_unlock: True if access to management registers is allowed. + * @instrp0: Tracing of load and store instructions + * as P0 elements is supported. ++ * @q_filt: Q element filtering support, if Q elements are supported. + * @trcbb: Indicates if the trace unit supports branch broadcast tracing. + * @trccond: If the trace unit supports conditional + * instruction tracing. +@@ -1013,6 +1015,7 @@ struct etmv4_drvdata { + bool boot_enable; + bool os_unlock; + bool instrp0; ++ bool q_filt; + bool trcbb; + bool trccond; + bool retstack; +-- +2.43.0 + diff --git a/queue-6.1/counter-linux-counter.h-fix-excess-kernel-doc-descri.patch b/queue-6.1/counter-linux-counter.h-fix-excess-kernel-doc-descri.patch new file mode 100644 index 00000000000..7c22b587d9d --- /dev/null +++ b/queue-6.1/counter-linux-counter.h-fix-excess-kernel-doc-descri.patch @@ -0,0 +1,37 @@ +From 8ea4981017cbb8ffba36d166817ec87381dfcb8c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 22 Dec 2023 21:05:11 -0800 +Subject: counter: linux/counter.h: fix Excess kernel-doc description warning + +From: Randy Dunlap + +[ Upstream commit 416bdb89605d960405178b9bf04df512d1ace1a3 ] + +Remove the @priv: line to prevent the kernel-doc warning: + +include/linux/counter.h:400: warning: Excess struct member 'priv' description in 'counter_device' + +Signed-off-by: Randy Dunlap +Fixes: f2ee4759fb70 ("counter: remove old and now unused registration API") +Link: https://lore.kernel.org/r/20231223050511.13849-1-rdunlap@infradead.org +Signed-off-by: William Breathitt Gray +Signed-off-by: Sasha Levin +--- + include/linux/counter.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/include/linux/counter.h b/include/linux/counter.h +index b63746637de2a..246711b76e548 100644 +--- a/include/linux/counter.h ++++ b/include/linux/counter.h +@@ -359,7 +359,6 @@ struct counter_ops { + * @num_counts: number of Counts specified in @counts + * @ext: optional array of Counter device extensions + * @num_ext: number of Counter device extensions specified in @ext +- * @priv: optional private data supplied by driver + * @dev: internal device structure + * @chrdev: internal character device structure + * @events_list: list of current watching Counter events +-- +2.43.0 + diff --git a/queue-6.1/dmaengine-idma64-add-check-for-dma_set_max_seg_size.patch b/queue-6.1/dmaengine-idma64-add-check-for-dma_set_max_seg_size.patch new file mode 100644 index 00000000000..fb541ed07c5 --- /dev/null +++ b/queue-6.1/dmaengine-idma64-add-check-for-dma_set_max_seg_size.patch @@ -0,0 +1,40 @@ +From b5c59afc6cc60b95f05b1186c36ade99b32cef8d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Apr 2024 02:49:32 +0000 +Subject: dmaengine: idma64: Add check for dma_set_max_seg_size + +From: Chen Ni + +[ Upstream commit 2b1c1cf08a0addb6df42f16b37133dc7a351de29 ] + +As the possible failure of the dma_set_max_seg_size(), it should be +better to check the return value of the dma_set_max_seg_size(). + +Fixes: e3fdb1894cfa ("dmaengine: idma64: set maximum allowed segment size for DMA") +Signed-off-by: Chen Ni +Acked-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20240403024932.3342606-1-nichen@iscas.ac.cn +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/idma64.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c +index af8777a1ec2e3..89e4a3e1d5198 100644 +--- a/drivers/dma/idma64.c ++++ b/drivers/dma/idma64.c +@@ -594,7 +594,9 @@ static int idma64_probe(struct idma64_chip *chip) + + idma64->dma.dev = chip->sysdev; + +- dma_set_max_seg_size(idma64->dma.dev, IDMA64C_CTLH_BLOCK_TS_MASK); ++ ret = dma_set_max_seg_size(idma64->dma.dev, IDMA64C_CTLH_BLOCK_TS_MASK); ++ if (ret) ++ return ret; + + ret = dma_async_device_register(&idma64->dma); + if (ret) +-- +2.43.0 + diff --git a/queue-6.1/dt-bindings-pci-rcar-pci-host-add-missing-iommu-prop.patch b/queue-6.1/dt-bindings-pci-rcar-pci-host-add-missing-iommu-prop.patch new file mode 100644 index 00000000000..f92d6f2cd6c --- /dev/null +++ b/queue-6.1/dt-bindings-pci-rcar-pci-host-add-missing-iommu-prop.patch @@ -0,0 +1,47 @@ +From 1baaf0ebe13bf5bbe8c11cfcd416595eede89cb1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 1 Feb 2024 16:52:01 +0100 +Subject: dt-bindings: PCI: rcar-pci-host: Add missing IOMMU properties +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Geert Uytterhoeven + +[ Upstream commit 78d212851f0e56b7d7083c4d5014aa7fa8b77e20 ] + +make dtbs_check: + + arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb: pcie@fe000000: Unevaluated properties are not allowed ('iommu-map', 'iommu-map-mask' were unexpected) + from schema $id: http://devicetree.org/schemas/pci/rcar-pci-host.yaml# + +Fix this by adding the missing IOMMU-related properties. + +[kwilczynski: added missing Fixes: tag] +Fixes: 0d69ce3c2c63 ("dt-bindings: PCI: rcar-pci-host: Convert bindings to json-schema") +Link: https://lore.kernel.org/linux-pci/babc878a93cb6461a5d39331f8ecfa654dfda921.1706802597.git.geert+renesas@glider.be +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Krzysztof Wilczyński +Acked-by: Conor Dooley +Signed-off-by: Sasha Levin +--- + Documentation/devicetree/bindings/pci/rcar-pci-host.yaml | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml b/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml +index b6a7cb32f61e5..835b6db00c279 100644 +--- a/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml ++++ b/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml +@@ -77,6 +77,9 @@ properties: + vpcie12v-supply: + description: The 12v regulator to use for PCIe. + ++ iommu-map: true ++ iommu-map-mask: true ++ + required: + - compatible + - reg +-- +2.43.0 + diff --git a/queue-6.1/dt-bindings-pci-rcar-pci-host-add-optional-regulator.patch b/queue-6.1/dt-bindings-pci-rcar-pci-host-add-optional-regulator.patch new file mode 100644 index 00000000000..d5812541602 --- /dev/null +++ b/queue-6.1/dt-bindings-pci-rcar-pci-host-add-optional-regulator.patch @@ -0,0 +1,57 @@ +From b9aa87b2743dd2f671b746c01fd81a733dc85b07 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 5 Nov 2023 10:29:07 +0100 +Subject: dt-bindings: PCI: rcar-pci-host: Add optional regulators +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Wolfram Sang + +[ Upstream commit b952f96a57e6fb4528c1d6be19e941c3322f9905 ] + +Support regulators found on the KingFisher board for miniPCIe (1.5 and +3.3v). For completeness, describe a 12v regulator while we are here. + +Link: https://lore.kernel.org/linux-pci/20231105092908.3792-2-wsa+renesas@sang-engineering.com +Signed-off-by: Wolfram Sang +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: Geert Uytterhoeven +Acked-by: Krzysztof Kozlowski +Stable-dep-of: 78d212851f0e ("dt-bindings: PCI: rcar-pci-host: Add missing IOMMU properties") +Signed-off-by: Sasha Levin +--- + .../devicetree/bindings/pci/rcar-pci-host.yaml | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml b/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml +index 8fdfbc763d704..b6a7cb32f61e5 100644 +--- a/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml ++++ b/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml +@@ -68,6 +68,15 @@ properties: + phy-names: + const: pcie + ++ vpcie1v5-supply: ++ description: The 1.5v regulator to use for PCIe. ++ ++ vpcie3v3-supply: ++ description: The 3.3v regulator to use for PCIe. ++ ++ vpcie12v-supply: ++ description: The 12v regulator to use for PCIe. ++ + required: + - compatible + - reg +@@ -121,5 +130,7 @@ examples: + clock-names = "pcie", "pcie_bus"; + power-domains = <&sysc R8A7791_PD_ALWAYS_ON>; + resets = <&cpg 319>; ++ vpcie3v3-supply = <&pcie_3v3>; ++ vpcie12v-supply = <&pcie_12v>; + }; + }; +-- +2.43.0 + diff --git a/queue-6.1/dt-bindings-pinctrl-mediatek-mt7622-fix-array-proper.patch b/queue-6.1/dt-bindings-pinctrl-mediatek-mt7622-fix-array-proper.patch new file mode 100644 index 00000000000..f6c46de382d --- /dev/null +++ b/queue-6.1/dt-bindings-pinctrl-mediatek-mt7622-fix-array-proper.patch @@ -0,0 +1,168 @@ +From df739177364d92af100dc9d7c32e9f07228c1257 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Apr 2024 06:55:01 +0200 +Subject: dt-bindings: pinctrl: mediatek: mt7622: fix array properties +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Rafał Miłecki + +[ Upstream commit 61fcbbf3ca038c048c942ce31bb3d3c846c87581 ] + +Some properties (function groups & pins) are meant to be arrays and +should allow multiple entries out of enum sets. Use "items" for those. + +Mistake was noticed during validation of in-kernel DTS files. + +Fixes: b9ffc18c6388 ("dt-bindings: mediatek: convert pinctrl to yaml") +Signed-off-by: Rafał Miłecki +Acked-by: Rob Herring +Message-ID: <20240423045502.7778-1-zajec5@gmail.com> +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + .../pinctrl/mediatek,mt7622-pinctrl.yaml | 92 ++++++++++--------- + 1 file changed, 49 insertions(+), 43 deletions(-) + +diff --git a/Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml +index c9ea0cad489b7..3767981409005 100644 +--- a/Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml ++++ b/Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml +@@ -97,7 +97,8 @@ patternProperties: + then: + properties: + groups: +- enum: [emmc, emmc_rst] ++ items: ++ enum: [emmc, emmc_rst] + - if: + properties: + function: +@@ -105,8 +106,9 @@ patternProperties: + then: + properties: + groups: +- enum: [esw, esw_p0_p1, esw_p2_p3_p4, rgmii_via_esw, +- rgmii_via_gmac1, rgmii_via_gmac2, mdc_mdio] ++ items: ++ enum: [esw, esw_p0_p1, esw_p2_p3_p4, rgmii_via_esw, ++ rgmii_via_gmac1, rgmii_via_gmac2, mdc_mdio] + - if: + properties: + function: +@@ -123,10 +125,11 @@ patternProperties: + then: + properties: + groups: +- enum: [i2s_in_mclk_bclk_ws, i2s1_in_data, i2s2_in_data, +- i2s3_in_data, i2s4_in_data, i2s_out_mclk_bclk_ws, +- i2s1_out_data, i2s2_out_data, i2s3_out_data, +- i2s4_out_data] ++ items: ++ enum: [i2s_in_mclk_bclk_ws, i2s1_in_data, i2s2_in_data, ++ i2s3_in_data, i2s4_in_data, i2s_out_mclk_bclk_ws, ++ i2s1_out_data, i2s2_out_data, i2s3_out_data, ++ i2s4_out_data] + - if: + properties: + function: +@@ -159,10 +162,11 @@ patternProperties: + then: + properties: + groups: +- enum: [pcie0_0_waken, pcie0_1_waken, pcie1_0_waken, +- pcie0_0_clkreq, pcie0_1_clkreq, pcie1_0_clkreq, +- pcie0_pad_perst, pcie1_pad_perst, pcie_pereset, +- pcie_wake, pcie_clkreq] ++ items: ++ enum: [pcie0_0_waken, pcie0_1_waken, pcie1_0_waken, ++ pcie0_0_clkreq, pcie0_1_clkreq, pcie1_0_clkreq, ++ pcie0_pad_perst, pcie1_pad_perst, pcie_pereset, ++ pcie_wake, pcie_clkreq] + - if: + properties: + function: +@@ -178,11 +182,12 @@ patternProperties: + then: + properties: + groups: +- enum: [pwm_ch1_0, pwm_ch1_1, pwm_ch1_2, pwm_ch2_0, pwm_ch2_1, +- pwm_ch2_2, pwm_ch3_0, pwm_ch3_1, pwm_ch3_2, pwm_ch4_0, +- pwm_ch4_1, pwm_ch4_2, pwm_ch4_3, pwm_ch5_0, pwm_ch5_1, +- pwm_ch5_2, pwm_ch6_0, pwm_ch6_1, pwm_ch6_2, pwm_ch6_3, +- pwm_ch7_0, pwm_0, pwm_1] ++ items: ++ enum: [pwm_ch1_0, pwm_ch1_1, pwm_ch1_2, pwm_ch2_0, pwm_ch2_1, ++ pwm_ch2_2, pwm_ch3_0, pwm_ch3_1, pwm_ch3_2, pwm_ch4_0, ++ pwm_ch4_1, pwm_ch4_2, pwm_ch4_3, pwm_ch5_0, pwm_ch5_1, ++ pwm_ch5_2, pwm_ch6_0, pwm_ch6_1, pwm_ch6_2, pwm_ch6_3, ++ pwm_ch7_0, pwm_0, pwm_1] + - if: + properties: + function: +@@ -260,33 +265,34 @@ patternProperties: + pins: + description: | + An array of strings. Each string contains the name of a pin. +- enum: [GPIO_A, I2S1_IN, I2S1_OUT, I2S_BCLK, I2S_WS, I2S_MCLK, TXD0, +- RXD0, SPI_WP, SPI_HOLD, SPI_CLK, SPI_MOSI, SPI_MISO, SPI_CS, +- I2C_SDA, I2C_SCL, I2S2_IN, I2S3_IN, I2S4_IN, I2S2_OUT, +- I2S3_OUT, I2S4_OUT, GPIO_B, MDC, MDIO, G2_TXD0, G2_TXD1, +- G2_TXD2, G2_TXD3, G2_TXEN, G2_TXC, G2_RXD0, G2_RXD1, G2_RXD2, +- G2_RXD3, G2_RXDV, G2_RXC, NCEB, NWEB, NREB, NDL4, NDL5, NDL6, +- NDL7, NRB, NCLE, NALE, NDL0, NDL1, NDL2, NDL3, MDI_TP_P0, +- MDI_TN_P0, MDI_RP_P0, MDI_RN_P0, MDI_TP_P1, MDI_TN_P1, +- MDI_RP_P1, MDI_RN_P1, MDI_RP_P2, MDI_RN_P2, MDI_TP_P2, +- MDI_TN_P2, MDI_TP_P3, MDI_TN_P3, MDI_RP_P3, MDI_RN_P3, +- MDI_RP_P4, MDI_RN_P4, MDI_TP_P4, MDI_TN_P4, PMIC_SCL, +- PMIC_SDA, SPIC1_CLK, SPIC1_MOSI, SPIC1_MISO, SPIC1_CS, +- GPIO_D, WATCHDOG, RTS3_N, CTS3_N, TXD3, RXD3, PERST0_N, +- PERST1_N, WLED_N, EPHY_LED0_N, AUXIN0, AUXIN1, AUXIN2, +- AUXIN3, TXD4, RXD4, RTS4_N, CST4_N, PWM1, PWM2, PWM3, PWM4, +- PWM5, PWM6, PWM7, GPIO_E, TOP_5G_CLK, TOP_5G_DATA, +- WF0_5G_HB0, WF0_5G_HB1, WF0_5G_HB2, WF0_5G_HB3, WF0_5G_HB4, +- WF0_5G_HB5, WF0_5G_HB6, XO_REQ, TOP_RST_N, SYS_WATCHDOG, +- EPHY_LED0_N_JTDO, EPHY_LED1_N_JTDI, EPHY_LED2_N_JTMS, +- EPHY_LED3_N_JTCLK, EPHY_LED4_N_JTRST_N, WF2G_LED_N, +- WF5G_LED_N, GPIO_9, GPIO_10, GPIO_11, GPIO_12, UART1_TXD, +- UART1_RXD, UART1_CTS, UART1_RTS, UART2_TXD, UART2_RXD, +- UART2_CTS, UART2_RTS, SMI_MDC, SMI_MDIO, PCIE_PERESET_N, +- PWM_0, GPIO_0, GPIO_1, GPIO_2, GPIO_3, GPIO_4, GPIO_5, +- GPIO_6, GPIO_7, GPIO_8, UART0_TXD, UART0_RXD, TOP_2G_CLK, +- TOP_2G_DATA, WF0_2G_HB0, WF0_2G_HB1, WF0_2G_HB2, WF0_2G_HB3, +- WF0_2G_HB4, WF0_2G_HB5, WF0_2G_HB6] ++ items: ++ enum: [GPIO_A, I2S1_IN, I2S1_OUT, I2S_BCLK, I2S_WS, I2S_MCLK, TXD0, ++ RXD0, SPI_WP, SPI_HOLD, SPI_CLK, SPI_MOSI, SPI_MISO, SPI_CS, ++ I2C_SDA, I2C_SCL, I2S2_IN, I2S3_IN, I2S4_IN, I2S2_OUT, ++ I2S3_OUT, I2S4_OUT, GPIO_B, MDC, MDIO, G2_TXD0, G2_TXD1, ++ G2_TXD2, G2_TXD3, G2_TXEN, G2_TXC, G2_RXD0, G2_RXD1, G2_RXD2, ++ G2_RXD3, G2_RXDV, G2_RXC, NCEB, NWEB, NREB, NDL4, NDL5, NDL6, ++ NDL7, NRB, NCLE, NALE, NDL0, NDL1, NDL2, NDL3, MDI_TP_P0, ++ MDI_TN_P0, MDI_RP_P0, MDI_RN_P0, MDI_TP_P1, MDI_TN_P1, ++ MDI_RP_P1, MDI_RN_P1, MDI_RP_P2, MDI_RN_P2, MDI_TP_P2, ++ MDI_TN_P2, MDI_TP_P3, MDI_TN_P3, MDI_RP_P3, MDI_RN_P3, ++ MDI_RP_P4, MDI_RN_P4, MDI_TP_P4, MDI_TN_P4, PMIC_SCL, ++ PMIC_SDA, SPIC1_CLK, SPIC1_MOSI, SPIC1_MISO, SPIC1_CS, ++ GPIO_D, WATCHDOG, RTS3_N, CTS3_N, TXD3, RXD3, PERST0_N, ++ PERST1_N, WLED_N, EPHY_LED0_N, AUXIN0, AUXIN1, AUXIN2, ++ AUXIN3, TXD4, RXD4, RTS4_N, CST4_N, PWM1, PWM2, PWM3, PWM4, ++ PWM5, PWM6, PWM7, GPIO_E, TOP_5G_CLK, TOP_5G_DATA, ++ WF0_5G_HB0, WF0_5G_HB1, WF0_5G_HB2, WF0_5G_HB3, WF0_5G_HB4, ++ WF0_5G_HB5, WF0_5G_HB6, XO_REQ, TOP_RST_N, SYS_WATCHDOG, ++ EPHY_LED0_N_JTDO, EPHY_LED1_N_JTDI, EPHY_LED2_N_JTMS, ++ EPHY_LED3_N_JTCLK, EPHY_LED4_N_JTRST_N, WF2G_LED_N, ++ WF5G_LED_N, GPIO_9, GPIO_10, GPIO_11, GPIO_12, UART1_TXD, ++ UART1_RXD, UART1_CTS, UART1_RTS, UART2_TXD, UART2_RXD, ++ UART2_CTS, UART2_RTS, SMI_MDC, SMI_MDIO, PCIE_PERESET_N, ++ PWM_0, GPIO_0, GPIO_1, GPIO_2, GPIO_3, GPIO_4, GPIO_5, ++ GPIO_6, GPIO_7, GPIO_8, UART0_TXD, UART0_RXD, TOP_2G_CLK, ++ TOP_2G_DATA, WF0_2G_HB0, WF0_2G_HB1, WF0_2G_HB2, WF0_2G_HB3, ++ WF0_2G_HB4, WF0_2G_HB5, WF0_2G_HB6] + + bias-disable: true + +-- +2.43.0 + diff --git a/queue-6.1/extcon-max8997-select-irq_domain-instead-of-dependin.patch b/queue-6.1/extcon-max8997-select-irq_domain-instead-of-dependin.patch new file mode 100644 index 00000000000..70ffb4a4fd2 --- /dev/null +++ b/queue-6.1/extcon-max8997-select-irq_domain-instead-of-dependin.patch @@ -0,0 +1,47 @@ +From fb507579a428bae8ba343b31c2938424aa6fa270 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 12 Feb 2024 22:00:28 -0800 +Subject: extcon: max8997: select IRQ_DOMAIN instead of depending on it + +From: Randy Dunlap + +[ Upstream commit b1781d0a1458070d40134e4f3412ec9d70099bec ] + +IRQ_DOMAIN is a hidden (not user visible) symbol. Users cannot set +it directly thru "make *config", so drivers should select it instead +of depending on it if they need it. +Relying on it being set for a dependency is risky. + +Consistently using "select" or "depends on" can also help reduce +Kconfig circular dependency issues. + +Therefore, change EXTCON_MAX8997's use of "depends on" for +IRQ_DOMAIN to "select". + +Link: https://lore.kernel.org/lkml/20240213060028.9744-1-rdunlap@infradead.org/ +Fixes: dca1a71e4108 ("extcon: Add support irq domain for MAX8997 muic") +Signed-off-by: Randy Dunlap +Acked-by: Arnd Bergmann +Signed-off-by: Chanwoo Choi +Signed-off-by: Sasha Levin +--- + drivers/extcon/Kconfig | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig +index 4dd52a6a5b48d..e54e5e64d9abe 100644 +--- a/drivers/extcon/Kconfig ++++ b/drivers/extcon/Kconfig +@@ -116,7 +116,8 @@ config EXTCON_MAX77843 + + config EXTCON_MAX8997 + tristate "Maxim MAX8997 EXTCON Support" +- depends on MFD_MAX8997 && IRQ_DOMAIN ++ depends on MFD_MAX8997 ++ select IRQ_DOMAIN + help + If you say yes here you get support for the MUIC device of + Maxim MAX8997 PMIC. The MAX8997 MUIC is a USB port accessory +-- +2.43.0 + diff --git a/queue-6.1/f2fs-compress-don-t-allow-unaligned-truncation-on-re.patch b/queue-6.1/f2fs-compress-don-t-allow-unaligned-truncation-on-re.patch new file mode 100644 index 00000000000..202e7aff640 --- /dev/null +++ b/queue-6.1/f2fs-compress-don-t-allow-unaligned-truncation-on-re.patch @@ -0,0 +1,65 @@ +From 779969887c4725aa515afd99515328b7fbf73587 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 May 2024 11:33:39 +0800 +Subject: f2fs: compress: don't allow unaligned truncation on released compress + inode + +From: Chao Yu + +[ Upstream commit 29ed2b5dd521ce7c5d8466cd70bf0cc9d07afeee ] + +f2fs image may be corrupted after below testcase: +- mkfs.f2fs -O extra_attr,compression -f /dev/vdb +- mount /dev/vdb /mnt/f2fs +- touch /mnt/f2fs/file +- f2fs_io setflags compression /mnt/f2fs/file +- dd if=/dev/zero of=/mnt/f2fs/file bs=4k count=4 +- f2fs_io release_cblocks /mnt/f2fs/file +- truncate -s 8192 /mnt/f2fs/file +- umount /mnt/f2fs +- fsck.f2fs /dev/vdb + +[ASSERT] (fsck_chk_inode_blk:1256) --> ino: 0x5 has i_blocks: 0x00000002, but has 0x3 blocks +[FSCK] valid_block_count matching with CP [Fail] [0x4, 0x5] +[FSCK] other corrupted bugs [Fail] + +The reason is: partial truncation assume compressed inode has reserved +blocks, after partial truncation, valid block count may change w/o +.i_blocks and .total_valid_block_count update, result in corruption. + +This patch only allow cluster size aligned truncation on released +compress inode for fixing. + +Fixes: c61404153eb6 ("f2fs: introduce FI_COMPRESS_RELEASED instead of using IMMUTABLE bit") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/file.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index 2b0f8408917bb..1d73582d1f63d 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -940,9 +940,14 @@ int f2fs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, + ATTR_GID | ATTR_TIMES_SET)))) + return -EPERM; + +- if ((attr->ia_valid & ATTR_SIZE) && +- !f2fs_is_compress_backend_ready(inode)) +- return -EOPNOTSUPP; ++ if ((attr->ia_valid & ATTR_SIZE)) { ++ if (!f2fs_is_compress_backend_ready(inode)) ++ return -EOPNOTSUPP; ++ if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED) && ++ !IS_ALIGNED(attr->ia_size, ++ F2FS_BLK_TO_BYTES(F2FS_I(inode)->i_cluster_size))) ++ return -EINVAL; ++ } + + err = setattr_prepare(mnt_userns, dentry, attr); + if (err) +-- +2.43.0 + diff --git a/queue-6.1/f2fs-compress-fix-to-cover-reserve-release-_compress.patch b/queue-6.1/f2fs-compress-fix-to-cover-reserve-release-_compress.patch new file mode 100644 index 00000000000..ea261eb84ac --- /dev/null +++ b/queue-6.1/f2fs-compress-fix-to-cover-reserve-release-_compress.patch @@ -0,0 +1,75 @@ +From dedc25789f4060b8d6540be5e65d984330370c29 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 May 2024 18:41:39 +0800 +Subject: f2fs: compress: fix to cover {reserve,release}_compress_blocks() w/ + cp_rwsem lock + +From: Chao Yu + +[ Upstream commit 0a4ed2d97cb6d044196cc3e726b6699222b41019 ] + +It needs to cover {reserve,release}_compress_blocks() w/ cp_rwsem lock +to avoid racing with checkpoint, otherwise, filesystem metadata including +blkaddr in dnode, inode fields and .total_valid_block_count may be +corrupted after SPO case. + +Fixes: ef8d563f184e ("f2fs: introduce F2FS_IOC_RELEASE_COMPRESS_BLOCKS") +Fixes: c75488fb4d82 ("f2fs: introduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/file.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index 69023b8fc67a7..2b0f8408917bb 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -3515,9 +3515,12 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg) + struct dnode_of_data dn; + pgoff_t end_offset, count; + ++ f2fs_lock_op(sbi); ++ + set_new_dnode(&dn, inode, NULL, NULL, 0); + ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); + if (ret) { ++ f2fs_unlock_op(sbi); + if (ret == -ENOENT) { + page_idx = f2fs_get_next_page_offset(&dn, + page_idx); +@@ -3535,6 +3538,8 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg) + + f2fs_put_dnode(&dn); + ++ f2fs_unlock_op(sbi); ++ + if (ret < 0) + break; + +@@ -3687,9 +3692,12 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg) + struct dnode_of_data dn; + pgoff_t end_offset, count; + ++ f2fs_lock_op(sbi); ++ + set_new_dnode(&dn, inode, NULL, NULL, 0); + ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); + if (ret) { ++ f2fs_unlock_op(sbi); + if (ret == -ENOENT) { + page_idx = f2fs_get_next_page_offset(&dn, + page_idx); +@@ -3707,6 +3715,8 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg) + + f2fs_put_dnode(&dn); + ++ f2fs_unlock_op(sbi); ++ + if (ret < 0) + break; + +-- +2.43.0 + diff --git a/queue-6.1/f2fs-compress-fix-to-relocate-check-condition-in-f2f.patch b/queue-6.1/f2fs-compress-fix-to-relocate-check-condition-in-f2f.patch new file mode 100644 index 00000000000..94b95f39428 --- /dev/null +++ b/queue-6.1/f2fs-compress-fix-to-relocate-check-condition-in-f2f.patch @@ -0,0 +1,70 @@ +From 6a8ff4f07ecb95401403bb6143f387d01c8d1894 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 7 Apr 2024 15:26:03 +0800 +Subject: f2fs: compress: fix to relocate check condition in + f2fs_{release,reserve}_compress_blocks() + +From: Chao Yu + +[ Upstream commit 7c5dffb3d90c5921b91981cc663e02757d90526e ] + +Compress flag should be checked after inode lock held to avoid +racing w/ f2fs_setflags_common(), fix it. + +Fixes: 4c8ff7095bef ("f2fs: support data compression") +Reported-by: Zhiguo Niu +Closes: https://lore.kernel.org/linux-f2fs-devel/CAHJ8P3LdZXLc2rqeYjvymgYHr2+YLuJ0sLG9DdsJZmwO7deuhw@mail.gmail.com +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/file.c | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index 9b325290d6a54..b321f0da1bd70 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -3468,9 +3468,6 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg) + if (!f2fs_sb_has_compression(sbi)) + return -EOPNOTSUPP; + +- if (!f2fs_compressed_file(inode)) +- return -EINVAL; +- + if (f2fs_readonly(sbi->sb)) + return -EROFS; + +@@ -3489,7 +3486,8 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg) + goto out; + } + +- if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { ++ if (!f2fs_compressed_file(inode) || ++ is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { + ret = -EINVAL; + goto out; + } +@@ -3650,9 +3648,6 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg) + if (!f2fs_sb_has_compression(sbi)) + return -EOPNOTSUPP; + +- if (!f2fs_compressed_file(inode)) +- return -EINVAL; +- + if (f2fs_readonly(sbi->sb)) + return -EROFS; + +@@ -3664,7 +3659,8 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg) + + inode_lock(inode); + +- if (!is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { ++ if (!f2fs_compressed_file(inode) || ++ !is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { + ret = -EINVAL; + goto unlock_inode; + } +-- +2.43.0 + diff --git a/queue-6.1/f2fs-compress-fix-to-relocate-check-condition-in-f2f.patch-3517 b/queue-6.1/f2fs-compress-fix-to-relocate-check-condition-in-f2f.patch-3517 new file mode 100644 index 00000000000..cca4660f361 --- /dev/null +++ b/queue-6.1/f2fs-compress-fix-to-relocate-check-condition-in-f2f.patch-3517 @@ -0,0 +1,70 @@ +From d7959034ac7224762d998a81b56b0d5301a40f0b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 7 Apr 2024 15:26:04 +0800 +Subject: f2fs: compress: fix to relocate check condition in + f2fs_ioc_{,de}compress_file() + +From: Chao Yu + +[ Upstream commit bd9ae4ae9e585061acfd4a169f2321706f900246 ] + +Compress flag should be checked after inode lock held to avoid +racing w/ f2fs_setflags_common() , fix it. + +Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE") +Reported-by: Zhiguo Niu +Closes: https://lore.kernel.org/linux-f2fs-devel/CAHJ8P3LdZXLc2rqeYjvymgYHr2+YLuJ0sLG9DdsJZmwO7deuhw@mail.gmail.com +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/file.c | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index b321f0da1bd70..46b6f06a4a76a 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -4064,9 +4064,6 @@ static int f2fs_ioc_decompress_file(struct file *filp, unsigned long arg) + if (!(filp->f_mode & FMODE_WRITE)) + return -EBADF; + +- if (!f2fs_compressed_file(inode)) +- return -EINVAL; +- + f2fs_balance_fs(sbi, true); + + file_start_write(filp); +@@ -4077,7 +4074,8 @@ static int f2fs_ioc_decompress_file(struct file *filp, unsigned long arg) + goto out; + } + +- if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { ++ if (!f2fs_compressed_file(inode) || ++ is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { + ret = -EINVAL; + goto out; + } +@@ -4136,9 +4134,6 @@ static int f2fs_ioc_compress_file(struct file *filp, unsigned long arg) + if (!(filp->f_mode & FMODE_WRITE)) + return -EBADF; + +- if (!f2fs_compressed_file(inode)) +- return -EINVAL; +- + f2fs_balance_fs(sbi, true); + + file_start_write(filp); +@@ -4149,7 +4144,8 @@ static int f2fs_ioc_compress_file(struct file *filp, unsigned long arg) + goto out; + } + +- if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { ++ if (!f2fs_compressed_file(inode) || ++ is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { + ret = -EINVAL; + goto out; + } +-- +2.43.0 + diff --git a/queue-6.1/f2fs-compress-fix-to-update-i_compr_blocks-correctly.patch b/queue-6.1/f2fs-compress-fix-to-update-i_compr_blocks-correctly.patch new file mode 100644 index 00000000000..b1d0b5de04e --- /dev/null +++ b/queue-6.1/f2fs-compress-fix-to-update-i_compr_blocks-correctly.patch @@ -0,0 +1,82 @@ +From d067b762fc8ccb56197a78d504f2b5253bd5b3d7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 May 2024 18:41:36 +0800 +Subject: f2fs: compress: fix to update i_compr_blocks correctly + +From: Chao Yu + +[ Upstream commit 186e7d71534df4589405925caca5597af7626c12 ] + +Previously, we account reserved blocks and compressed blocks into +@compr_blocks, then, f2fs_i_compr_blocks_update(,compr_blocks) will +update i_compr_blocks incorrectly, fix it. + +Meanwhile, for the case all blocks in cluster were reserved, fix to +update dn->ofs_in_node correctly. + +Fixes: eb8fbaa53374 ("f2fs: compress: fix to check unreleased compressed cluster") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/file.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index 1c47c7cbcd6cd..69023b8fc67a7 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -3588,7 +3588,8 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count, + + while (count) { + int compr_blocks = 0; +- blkcnt_t reserved; ++ blkcnt_t reserved = 0; ++ blkcnt_t to_reserved; + int ret; + + for (i = 0; i < cluster_size; i++) { +@@ -3608,20 +3609,26 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count, + * fails in release_compress_blocks(), so NEW_ADDR + * is a possible case. + */ +- if (blkaddr == NEW_ADDR || +- __is_valid_data_blkaddr(blkaddr)) { ++ if (blkaddr == NEW_ADDR) { ++ reserved++; ++ continue; ++ } ++ if (__is_valid_data_blkaddr(blkaddr)) { + compr_blocks++; + continue; + } + } + +- reserved = cluster_size - compr_blocks; ++ to_reserved = cluster_size - compr_blocks - reserved; + + /* for the case all blocks in cluster were reserved */ +- if (reserved == 1) ++ if (to_reserved == 1) { ++ dn->ofs_in_node += cluster_size; + goto next; ++ } + +- ret = inc_valid_block_count(sbi, dn->inode, &reserved, false); ++ ret = inc_valid_block_count(sbi, dn->inode, ++ &to_reserved, false); + if (unlikely(ret)) + return ret; + +@@ -3632,7 +3639,7 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count, + + f2fs_i_compr_blocks_update(dn->inode, compr_blocks, true); + +- *reserved_blocks += reserved; ++ *reserved_blocks += to_reserved; + next: + count -= cluster_size; + } +-- +2.43.0 + diff --git a/queue-6.1/f2fs-fix-to-add-missing-iput-in-gc_data_segment.patch b/queue-6.1/f2fs-fix-to-add-missing-iput-in-gc_data_segment.patch new file mode 100644 index 00000000000..eea9a2a4efd --- /dev/null +++ b/queue-6.1/f2fs-fix-to-add-missing-iput-in-gc_data_segment.patch @@ -0,0 +1,46 @@ +From 32a26a3fa53b8d74ccf9944fb3b493b714db11b0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 May 2024 11:43:33 +0800 +Subject: f2fs: fix to add missing iput() in gc_data_segment() + +From: Chao Yu + +[ Upstream commit a798ff17cd2dabe47d5d4ed3d509631793c36e19 ] + +During gc_data_segment(), if inode state is abnormal, it missed to call +iput(), fix it. + +Fixes: b73e52824c89 ("f2fs: reposition unlock_new_inode to prevent accessing invalid inode") +Fixes: 9056d6489f5a ("f2fs: fix to do sanity check on inode type during garbage collection") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/gc.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c +index d4662ccb94c8f..5a661a0e76632 100644 +--- a/fs/f2fs/gc.c ++++ b/fs/f2fs/gc.c +@@ -1566,10 +1566,15 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, + int err; + + inode = f2fs_iget(sb, dni.ino); +- if (IS_ERR(inode) || is_bad_inode(inode) || +- special_file(inode->i_mode)) ++ if (IS_ERR(inode)) + continue; + ++ if (is_bad_inode(inode) || ++ special_file(inode->i_mode)) { ++ iput(inode); ++ continue; ++ } ++ + err = f2fs_gc_pinned_control(inode, gc_type, segno); + if (err == -EAGAIN) { + iput(inode); +-- +2.43.0 + diff --git a/queue-6.1/f2fs-fix-to-check-pinfile-flag-in-f2fs_move_file_ran.patch b/queue-6.1/f2fs-fix-to-check-pinfile-flag-in-f2fs_move_file_ran.patch new file mode 100644 index 00000000000..0171fd01f45 --- /dev/null +++ b/queue-6.1/f2fs-fix-to-check-pinfile-flag-in-f2fs_move_file_ran.patch @@ -0,0 +1,37 @@ +From bb910af7457835ca5d8441cc5aac48e78e8cfb75 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Apr 2024 22:24:20 +0800 +Subject: f2fs: fix to check pinfile flag in f2fs_move_file_range() + +From: Chao Yu + +[ Upstream commit e07230da0500e0919a765037c5e81583b519be2c ] + +ioctl(F2FS_IOC_MOVE_RANGE) can truncate or punch hole on pinned file, +fix to disallow it. + +Fixes: 5fed0be8583f ("f2fs: do not allow partial truncation on pinned file") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/file.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index 1a7ee769f9389..1c47c7cbcd6cd 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -2816,7 +2816,8 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, + goto out; + } + +- if (f2fs_compressed_file(src) || f2fs_compressed_file(dst)) { ++ if (f2fs_compressed_file(src) || f2fs_compressed_file(dst) || ++ f2fs_is_pinned_file(src) || f2fs_is_pinned_file(dst)) { + ret = -EOPNOTSUPP; + goto out_unlock; + } +-- +2.43.0 + diff --git a/queue-6.1/f2fs-fix-to-release-node-block-count-in-error-path-o.patch b/queue-6.1/f2fs-fix-to-release-node-block-count-in-error-path-o.patch new file mode 100644 index 00000000000..f0d147daea6 --- /dev/null +++ b/queue-6.1/f2fs-fix-to-release-node-block-count-in-error-path-o.patch @@ -0,0 +1,44 @@ +From f7c904f0641236eeeab1066125d336e547b87524 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 May 2024 11:31:00 +0800 +Subject: f2fs: fix to release node block count in error path of + f2fs_new_node_page() + +From: Chao Yu + +[ Upstream commit 0fa4e57c1db263effd72d2149d4e21da0055c316 ] + +It missed to call dec_valid_node_count() to release node block count +in error path, fix it. + +Fixes: 141170b759e0 ("f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/node.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c +index fcf22a50ff5db..745ecf5523c9b 100644 +--- a/fs/f2fs/node.c ++++ b/fs/f2fs/node.c +@@ -1307,6 +1307,7 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) + } + if (unlikely(new_ni.blk_addr != NULL_ADDR)) { + err = -EFSCORRUPTED; ++ dec_valid_node_count(sbi, dn->inode, !ofs); + set_sbi_flag(sbi, SBI_NEED_FSCK); + f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR); + goto fail; +@@ -1333,7 +1334,6 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) + if (ofs == 0) + inc_valid_inode_count(sbi); + return page; +- + fail: + clear_node_page_dirty(page); + f2fs_put_page(page, 1); +-- +2.43.0 + diff --git a/queue-6.1/f2fs-fix-to-relocate-check-condition-in-f2fs_falloca.patch b/queue-6.1/f2fs-fix-to-relocate-check-condition-in-f2fs_falloca.patch new file mode 100644 index 00000000000..1a0e2dd23ce --- /dev/null +++ b/queue-6.1/f2fs-fix-to-relocate-check-condition-in-f2fs_falloca.patch @@ -0,0 +1,62 @@ +From 837de93902464a8f5c205f29dd6d9566a1e22fd3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Apr 2024 22:24:19 +0800 +Subject: f2fs: fix to relocate check condition in f2fs_fallocate() + +From: Chao Yu + +[ Upstream commit 278a6253a673611dbc8ab72a3b34b151a8e75822 ] + +compress and pinfile flag should be checked after inode lock held to +avoid race condition, fix it. + +Fixes: 4c8ff7095bef ("f2fs: support data compression") +Fixes: 5fed0be8583f ("f2fs: do not allow partial truncation on pinned file") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/file.c | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index 423b9150dc0a8..1a7ee769f9389 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -1804,15 +1804,6 @@ static long f2fs_fallocate(struct file *file, int mode, + (mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE))) + return -EOPNOTSUPP; + +- /* +- * Pinned file should not support partial truncation since the block +- * can be used by applications. +- */ +- if ((f2fs_compressed_file(inode) || f2fs_is_pinned_file(inode)) && +- (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE | +- FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE))) +- return -EOPNOTSUPP; +- + if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE | + FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE | + FALLOC_FL_INSERT_RANGE)) +@@ -1820,6 +1811,17 @@ static long f2fs_fallocate(struct file *file, int mode, + + inode_lock(inode); + ++ /* ++ * Pinned file should not support partial truncation since the block ++ * can be used by applications. ++ */ ++ if ((f2fs_compressed_file(inode) || f2fs_is_pinned_file(inode)) && ++ (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE | ++ FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE))) { ++ ret = -EOPNOTSUPP; ++ goto out; ++ } ++ + ret = file_modified(file); + if (ret) + goto out; +-- +2.43.0 + diff --git a/queue-6.1/f2fs-fix-to-wait-on-page-writeback-in-__clone_blkadd.patch b/queue-6.1/f2fs-fix-to-wait-on-page-writeback-in-__clone_blkadd.patch new file mode 100644 index 00000000000..9e5757ffb44 --- /dev/null +++ b/queue-6.1/f2fs-fix-to-wait-on-page-writeback-in-__clone_blkadd.patch @@ -0,0 +1,53 @@ +From 3e25b7659ab1a4ef0789e2422e373a576d71a627 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 Mar 2024 19:28:45 +0800 +Subject: f2fs: fix to wait on page writeback in __clone_blkaddrs() + +From: Chao Yu + +[ Upstream commit d3876e34e7e789e2cbdd782360fef2a777391082 ] + +In below race condition, dst page may become writeback status +in __clone_blkaddrs(), it needs to wait writeback before update, +fix it. + +Thread A GC Thread +- f2fs_move_file_range + - filemap_write_and_wait_range(dst) + - gc_data_segment + - f2fs_down_write(dst) + - move_data_page + - set_page_writeback(dst_page) + - f2fs_submit_page_write + - f2fs_up_write(dst) + - f2fs_down_write(dst) + - __exchange_data_block + - __clone_blkaddrs + - f2fs_get_new_data_page + - memcpy_page + +Fixes: 0a2aa8fbb969 ("f2fs: refactor __exchange_data_block for speed up") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/file.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index 2fbc8d89c600b..9b325290d6a54 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -1314,6 +1314,9 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode, + f2fs_put_page(psrc, 1); + return PTR_ERR(pdst); + } ++ ++ f2fs_wait_on_page_writeback(pdst, DATA, true, true); ++ + memcpy_page(pdst, 0, psrc, 0, PAGE_SIZE); + set_page_dirty(pdst); + set_page_private_gcing(pdst); +-- +2.43.0 + diff --git a/queue-6.1/f2fs-fix-typos-in-comments.patch b/queue-6.1/f2fs-fix-typos-in-comments.patch new file mode 100644 index 00000000000..98c2914914a --- /dev/null +++ b/queue-6.1/f2fs-fix-typos-in-comments.patch @@ -0,0 +1,183 @@ +From 91dcc7b7062c7f13a472a8fe940f23c19e8034bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Feb 2023 20:56:00 +0900 +Subject: f2fs: fix typos in comments + +From: Jinyoung CHOI + +[ Upstream commit 146949defda868378992171b9e42318b06fcd482 ] + +This patch is to fix typos in f2fs files. + +Signed-off-by: Jinyoung Choi +Reviewed-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Stable-dep-of: 278a6253a673 ("f2fs: fix to relocate check condition in f2fs_fallocate()") +Signed-off-by: Sasha Levin +--- + fs/f2fs/checkpoint.c | 4 ++-- + fs/f2fs/compress.c | 2 +- + fs/f2fs/data.c | 8 ++++---- + fs/f2fs/extent_cache.c | 4 ++-- + fs/f2fs/file.c | 6 +++--- + fs/f2fs/namei.c | 2 +- + fs/f2fs/segment.c | 2 +- + 7 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c +index 3ec203bbd5593..13d8774706758 100644 +--- a/fs/f2fs/checkpoint.c ++++ b/fs/f2fs/checkpoint.c +@@ -797,7 +797,7 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk) + */ + head = &im->ino_list; + +- /* loop for each orphan inode entry and write them in Jornal block */ ++ /* loop for each orphan inode entry and write them in journal block */ + list_for_each_entry(orphan, head, list) { + if (!page) { + page = f2fs_grab_meta_page(sbi, start_blk++); +@@ -1127,7 +1127,7 @@ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type, + } else { + /* + * We should submit bio, since it exists several +- * wribacking dentry pages in the freeing inode. ++ * writebacking dentry pages in the freeing inode. + */ + f2fs_submit_merged_write(sbi, DATA); + cond_resched(); +diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c +index df6dfd7de6d0d..84585dba86a57 100644 +--- a/fs/f2fs/compress.c ++++ b/fs/f2fs/compress.c +@@ -1264,7 +1264,7 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc, + int i, err; + bool quota_inode = IS_NOQUOTA(inode); + +- /* we should bypass data pages to proceed the kworkder jobs */ ++ /* we should bypass data pages to proceed the kworker jobs */ + if (unlikely(f2fs_cp_error(sbi))) { + mapping_set_error(cc->rpages[0]->mapping, -EIO); + goto out_free; +diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c +index ea9b78b5a1ebe..0b0e3d44e158e 100644 +--- a/fs/f2fs/data.c ++++ b/fs/f2fs/data.c +@@ -2363,7 +2363,7 @@ static int f2fs_mpage_readpages(struct inode *inode, + + #ifdef CONFIG_F2FS_FS_COMPRESSION + if (f2fs_compressed_file(inode)) { +- /* there are remained comressed pages, submit them */ ++ /* there are remained compressed pages, submit them */ + if (!f2fs_cluster_can_merge_page(&cc, page->index)) { + ret = f2fs_read_multi_pages(&cc, &bio, + max_nr_pages, +@@ -2779,7 +2779,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, + + trace_f2fs_writepage(page, DATA); + +- /* we should bypass data pages to proceed the kworkder jobs */ ++ /* we should bypass data pages to proceed the kworker jobs */ + if (unlikely(f2fs_cp_error(sbi))) { + mapping_set_error(page->mapping, -EIO); + /* +@@ -2898,7 +2898,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, + redirty_out: + redirty_page_for_writepage(wbc, page); + /* +- * pageout() in MM traslates EAGAIN, so calls handle_write_error() ++ * pageout() in MM translates EAGAIN, so calls handle_write_error() + * -> mapping_set_error() -> set_bit(AS_EIO, ...). + * file_write_and_wait_range() will see EIO error, which is critical + * to return value of fsync() followed by atomic_write failure to user. +@@ -2932,7 +2932,7 @@ static int f2fs_write_data_page(struct page *page, + } + + /* +- * This function was copied from write_cche_pages from mm/page-writeback.c. ++ * This function was copied from write_cache_pages from mm/page-writeback.c. + * The major change is making write step of cold data page separately from + * warm/hot data page. + */ +diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c +index 16692c96e7650..c55359267d438 100644 +--- a/fs/f2fs/extent_cache.c ++++ b/fs/f2fs/extent_cache.c +@@ -205,7 +205,7 @@ struct rb_node **f2fs_lookup_rb_tree_for_insert(struct f2fs_sb_info *sbi, + * @prev_ex: extent before ofs + * @next_ex: extent after ofs + * @insert_p: insert point for new extent at ofs +- * in order to simpfy the insertion after. ++ * in order to simplify the insertion after. + * tree must stay unchanged between lookup and insertion. + */ + struct rb_entry *f2fs_lookup_rb_tree_ret(struct rb_root_cached *root, +@@ -662,7 +662,7 @@ static void __update_extent_tree_range(struct inode *inode, + if (!en) + en = next_en; + +- /* 2. invlidate all extent nodes in range [fofs, fofs + len - 1] */ ++ /* 2. invalidate all extent nodes in range [fofs, fofs + len - 1] */ + while (en && en->ei.fofs < end) { + unsigned int org_end; + int parts = 0; /* # of parts current extent split into */ +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index 46b6f06a4a76a..423b9150dc0a8 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -305,7 +305,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, + * for OPU case, during fsync(), node can be persisted before + * data when lower device doesn't support write barrier, result + * in data corruption after SPO. +- * So for strict fsync mode, force to use atomic write sematics ++ * So for strict fsync mode, force to use atomic write semantics + * to keep write order in between data/node and last node to + * avoid potential data corruption. + */ +@@ -1805,7 +1805,7 @@ static long f2fs_fallocate(struct file *file, int mode, + return -EOPNOTSUPP; + + /* +- * Pinned file should not support partial trucation since the block ++ * Pinned file should not support partial truncation since the block + * can be used by applications. + */ + if ((f2fs_compressed_file(inode) || f2fs_is_pinned_file(inode)) && +@@ -1855,7 +1855,7 @@ static long f2fs_fallocate(struct file *file, int mode, + static int f2fs_release_file(struct inode *inode, struct file *filp) + { + /* +- * f2fs_relase_file is called at every close calls. So we should ++ * f2fs_release_file is called at every close calls. So we should + * not drop any inmemory pages by close called by other process. + */ + if (!(filp->f_mode & FMODE_WRITE) || +diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c +index 328cd20b16a54..6dcc73ca32172 100644 +--- a/fs/f2fs/namei.c ++++ b/fs/f2fs/namei.c +@@ -970,7 +970,7 @@ static int f2fs_rename(struct user_namespace *mnt_userns, struct inode *old_dir, + + /* + * If new_inode is null, the below renaming flow will +- * add a link in old_dir which can conver inline_dir. ++ * add a link in old_dir which can convert inline_dir. + * After then, if we failed to get the entry due to other + * reasons like ENOMEM, we had to remove the new entry. + * Instead of adding such the error handling routine, let's +diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c +index 205216c1db91f..e19b569d938d8 100644 +--- a/fs/f2fs/segment.c ++++ b/fs/f2fs/segment.c +@@ -3615,7 +3615,7 @@ void f2fs_wait_on_page_writeback(struct page *page, + + /* submit cached LFS IO */ + f2fs_submit_merged_write_cond(sbi, NULL, page, 0, type); +- /* sbumit cached IPU IO */ ++ /* submit cached IPU IO */ + f2fs_submit_merged_ipu_write(sbi, NULL, page); + if (ordered) { + wait_on_page_writeback(page); +-- +2.43.0 + diff --git a/queue-6.1/f2fs-multidev-fix-to-recognize-valid-zero-block-addr.patch b/queue-6.1/f2fs-multidev-fix-to-recognize-valid-zero-block-addr.patch new file mode 100644 index 00000000000..4122ae22a27 --- /dev/null +++ b/queue-6.1/f2fs-multidev-fix-to-recognize-valid-zero-block-addr.patch @@ -0,0 +1,119 @@ +From c58fe2a6996470a71d0f86b20a195b11149b5a91 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Mar 2024 15:42:23 +0800 +Subject: f2fs: multidev: fix to recognize valid zero block address + +From: Chao Yu + +[ Upstream commit 33e62cd7b4c281cd737c62e5d8c4f0e602a8c5c5 ] + +As reported by Yi Zhang in mailing list [1], kernel warning was catched +during zbd/010 test as below: + +./check zbd/010 +zbd/010 (test gap zone support with F2FS) [failed] + runtime ... 3.752s + something found in dmesg: + [ 4378.146781] run blktests zbd/010 at 2024-02-18 11:31:13 + [ 4378.192349] null_blk: module loaded + [ 4378.209860] null_blk: disk nullb0 created + [ 4378.413285] scsi_debug:sdebug_driver_probe: scsi_debug: trim +poll_queues to 0. poll_q/nr_hw = (0/1) + [ 4378.422334] scsi host15: scsi_debug: version 0191 [20210520] + dev_size_mb=1024, opts=0x0, submit_queues=1, statistics=0 + [ 4378.434922] scsi 15:0:0:0: Direct-Access-ZBC Linux +scsi_debug 0191 PQ: 0 ANSI: 7 + [ 4378.443343] scsi 15:0:0:0: Power-on or device reset occurred + [ 4378.449371] sd 15:0:0:0: Attached scsi generic sg5 type 20 + [ 4378.449418] sd 15:0:0:0: [sdf] Host-managed zoned block device + ... + (See '/mnt/tests/gitlab.com/api/v4/projects/19168116/repository/archive.zip/storage/blktests/blk/blktests/results/nodev/zbd/010.dmesg' + +WARNING: CPU: 22 PID: 44011 at fs/iomap/iter.c:51 +CPU: 22 PID: 44011 Comm: fio Not tainted 6.8.0-rc3+ #1 +RIP: 0010:iomap_iter+0x32b/0x350 +Call Trace: + + __iomap_dio_rw+0x1df/0x830 + f2fs_file_read_iter+0x156/0x3d0 [f2fs] + aio_read+0x138/0x210 + io_submit_one+0x188/0x8c0 + __x64_sys_io_submit+0x8c/0x1a0 + do_syscall_64+0x86/0x170 + entry_SYSCALL_64_after_hwframe+0x6e/0x76 + +Shinichiro Kawasaki helps to analyse this issue and proposes a potential +fixing patch in [2]. + +Quoted from reply of Shinichiro Kawasaki: + +"I confirmed that the trigger commit is dbf8e63f48af as Yi reported. I took a +look in the commit, but it looks fine to me. So I thought the cause is not +in the commit diff. + +I found the WARN is printed when the f2fs is set up with multiple devices, +and read requests are mapped to the very first block of the second device in the +direct read path. In this case, f2fs_map_blocks() and f2fs_map_blocks_cached() +modify map->m_pblk as the physical block address from each block device. It +becomes zero when it is mapped to the first block of the device. However, +f2fs_iomap_begin() assumes that map->m_pblk is the physical block address of the +whole f2fs, across the all block devices. It compares map->m_pblk against +NULL_ADDR == 0, then go into the unexpected branch and sets the invalid +iomap->length. The WARN catches the invalid iomap->length. + +This WARN is printed even for non-zoned block devices, by following steps. + + - Create two (non-zoned) null_blk devices memory backed with 128MB size each: + nullb0 and nullb1. + # mkfs.f2fs /dev/nullb0 -c /dev/nullb1 + # mount -t f2fs /dev/nullb0 "${mount_dir}" + # dd if=/dev/zero of="${mount_dir}/test.dat" bs=1M count=192 + # dd if="${mount_dir}/test.dat" of=/dev/null bs=1M count=192 iflag=direct + +..." + +So, the root cause of this issue is: when multi-devices feature is on, +f2fs_map_blocks() may return zero blkaddr in non-primary device, which is +a verified valid block address, however, f2fs_iomap_begin() treats it as +an invalid block address, and then it triggers the warning in iomap +framework code. + +Finally, as discussed, we decide to use a more simple and direct way that +checking (map.m_flags & F2FS_MAP_MAPPED) condition instead of +(map.m_pblk != NULL_ADDR) to fix this issue. + +Thanks a lot for the effort of Yi Zhang and Shinichiro Kawasaki on this +issue. + +[1] https://lore.kernel.org/linux-f2fs-devel/CAHj4cs-kfojYC9i0G73PRkYzcxCTex=-vugRFeP40g_URGvnfQ@mail.gmail.com/ +[2] https://lore.kernel.org/linux-f2fs-devel/gngdj77k4picagsfdtiaa7gpgnup6fsgwzsltx6milmhegmjff@iax2n4wvrqye/ + +Reported-by: Yi Zhang +Closes: https://lore.kernel.org/linux-f2fs-devel/CAHj4cs-kfojYC9i0G73PRkYzcxCTex=-vugRFeP40g_URGvnfQ@mail.gmail.com/ +Tested-by: Shin'ichiro Kawasaki +Tested-by: Yi Zhang +Fixes: 1517c1a7a445 ("f2fs: implement iomap operations") +Fixes: 8d3c1fa3fa5e ("f2fs: don't rely on F2FS_MAP_* in f2fs_iomap_begin") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/data.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c +index b83b8ac29f430..ea9b78b5a1ebe 100644 +--- a/fs/f2fs/data.c ++++ b/fs/f2fs/data.c +@@ -4195,7 +4195,7 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, + if (WARN_ON_ONCE(map.m_pblk == COMPRESS_ADDR)) + return -EINVAL; + +- if (map.m_pblk != NULL_ADDR) { ++ if (map.m_flags & F2FS_MAP_MAPPED) { + iomap->length = blks_to_bytes(inode, map.m_len); + iomap->type = IOMAP_MAPPED; + iomap->flags |= IOMAP_F_MERGED; +-- +2.43.0 + diff --git a/queue-6.1/firmware-dmi-id-add-a-release-callback-function.patch b/queue-6.1/firmware-dmi-id-add-a-release-callback-function.patch new file mode 100644 index 00000000000..979d06f704f --- /dev/null +++ b/queue-6.1/firmware-dmi-id-add-a-release-callback-function.patch @@ -0,0 +1,50 @@ +From 39accca24c12e413c420f2b733ceeb1c65796d41 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 8 Apr 2024 09:34:24 +0200 +Subject: firmware: dmi-id: add a release callback function + +From: Arnd Bergmann + +[ Upstream commit cf770af5645a41a753c55a053fa1237105b0964a ] + +dmi_class uses kfree() as the .release function, but that now causes +a warning with clang-16 as it violates control flow integrity (KCFI) +rules: + +drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict] + 174 | .dev_release = (void(*)(struct device *)) kfree, + +Add an explicit function to call kfree() instead. + +Fixes: 4f5c791a850e ("DMI-based module autoloading") +Link: https://lore.kernel.org/lkml/20240213100238.456912-1-arnd@kernel.org/ +Signed-off-by: Arnd Bergmann +Signed-off-by: Jean Delvare +Signed-off-by: Sasha Levin +--- + drivers/firmware/dmi-id.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c +index 940ddf916202a..77a8d43e65d3c 100644 +--- a/drivers/firmware/dmi-id.c ++++ b/drivers/firmware/dmi-id.c +@@ -169,9 +169,14 @@ static int dmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env) + return 0; + } + ++static void dmi_dev_release(struct device *dev) ++{ ++ kfree(dev); ++} ++ + static struct class dmi_class = { + .name = "dmi", +- .dev_release = (void(*)(struct device *)) kfree, ++ .dev_release = dmi_dev_release, + .dev_uevent = dmi_dev_uevent, + }; + +-- +2.43.0 + diff --git a/queue-6.1/fpga-region-add-owner-module-and-take-its-refcount.patch b/queue-6.1/fpga-region-add-owner-module-and-take-its-refcount.patch new file mode 100644 index 00000000000..f885096d57f --- /dev/null +++ b/queue-6.1/fpga-region-add-owner-module-and-take-its-refcount.patch @@ -0,0 +1,210 @@ +From 74d8e9c2d53f15956db110be4e300381f8aaf5e3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 19 Apr 2024 10:35:59 +0200 +Subject: fpga: region: add owner module and take its refcount + +From: Marco Pagani + +[ Upstream commit b7c0e1ecee403a43abc89eb3e75672b01ff2ece9 ] + +The current implementation of the fpga region assumes that the low-level +module registers a driver for the parent device and uses its owner pointer +to take the module's refcount. This approach is problematic since it can +lead to a null pointer dereference while attempting to get the region +during programming if the parent device does not have a driver. + +To address this problem, add a module owner pointer to the fpga_region +struct and use it to take the module's refcount. Modify the functions for +registering a region to take an additional owner module parameter and +rename them to avoid conflicts. Use the old function names for helper +macros that automatically set the module that registers the region as the +owner. This ensures compatibility with existing low-level control modules +and reduces the chances of registering a region without setting the owner. + +Also, update the documentation to keep it consistent with the new interface +for registering an fpga region. + +Fixes: 0fa20cdfcc1f ("fpga: fpga-region: device tree control for FPGA") +Suggested-by: Greg Kroah-Hartman +Suggested-by: Xu Yilun +Reviewed-by: Russ Weight +Signed-off-by: Marco Pagani +Acked-by: Xu Yilun +Link: https://lore.kernel.org/r/20240419083601.77403-1-marpagan@redhat.com +Signed-off-by: Xu Yilun +Signed-off-by: Sasha Levin +--- + Documentation/driver-api/fpga/fpga-region.rst | 13 ++++++---- + drivers/fpga/fpga-region.c | 24 +++++++++++-------- + include/linux/fpga/fpga-region.h | 13 +++++++--- + 3 files changed, 32 insertions(+), 18 deletions(-) + +diff --git a/Documentation/driver-api/fpga/fpga-region.rst b/Documentation/driver-api/fpga/fpga-region.rst +index dc55d60a0b4a5..2d03b5fb76575 100644 +--- a/Documentation/driver-api/fpga/fpga-region.rst ++++ b/Documentation/driver-api/fpga/fpga-region.rst +@@ -46,13 +46,16 @@ API to add a new FPGA region + ---------------------------- + + * struct fpga_region - The FPGA region struct +-* struct fpga_region_info - Parameter structure for fpga_region_register_full() +-* fpga_region_register_full() - Create and register an FPGA region using the ++* struct fpga_region_info - Parameter structure for __fpga_region_register_full() ++* __fpga_region_register_full() - Create and register an FPGA region using the + fpga_region_info structure to provide the full flexibility of options +-* fpga_region_register() - Create and register an FPGA region using standard ++* __fpga_region_register() - Create and register an FPGA region using standard + arguments + * fpga_region_unregister() - Unregister an FPGA region + ++Helper macros ``fpga_region_register()`` and ``fpga_region_register_full()`` ++automatically set the module that registers the FPGA region as the owner. ++ + The FPGA region's probe function will need to get a reference to the FPGA + Manager it will be using to do the programming. This usually would happen + during the region's probe function. +@@ -82,10 +85,10 @@ following APIs to handle building or tearing down that list. + :functions: fpga_region_info + + .. kernel-doc:: drivers/fpga/fpga-region.c +- :functions: fpga_region_register_full ++ :functions: __fpga_region_register_full + + .. kernel-doc:: drivers/fpga/fpga-region.c +- :functions: fpga_region_register ++ :functions: __fpga_region_register + + .. kernel-doc:: drivers/fpga/fpga-region.c + :functions: fpga_region_unregister +diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c +index 27ff9dea04ae3..3aefd9d89356e 100644 +--- a/drivers/fpga/fpga-region.c ++++ b/drivers/fpga/fpga-region.c +@@ -52,7 +52,7 @@ static struct fpga_region *fpga_region_get(struct fpga_region *region) + } + + get_device(dev); +- if (!try_module_get(dev->parent->driver->owner)) { ++ if (!try_module_get(region->ops_owner)) { + put_device(dev); + mutex_unlock(®ion->mutex); + return ERR_PTR(-ENODEV); +@@ -74,7 +74,7 @@ static void fpga_region_put(struct fpga_region *region) + + dev_dbg(dev, "put\n"); + +- module_put(dev->parent->driver->owner); ++ module_put(region->ops_owner); + put_device(dev); + mutex_unlock(®ion->mutex); + } +@@ -180,14 +180,16 @@ static struct attribute *fpga_region_attrs[] = { + ATTRIBUTE_GROUPS(fpga_region); + + /** +- * fpga_region_register_full - create and register an FPGA Region device ++ * __fpga_region_register_full - create and register an FPGA Region device + * @parent: device parent + * @info: parameters for FPGA Region ++ * @owner: module containing the get_bridges function + * + * Return: struct fpga_region or ERR_PTR() + */ + struct fpga_region * +-fpga_region_register_full(struct device *parent, const struct fpga_region_info *info) ++__fpga_region_register_full(struct device *parent, const struct fpga_region_info *info, ++ struct module *owner) + { + struct fpga_region *region; + int id, ret = 0; +@@ -212,6 +214,7 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info * + region->compat_id = info->compat_id; + region->priv = info->priv; + region->get_bridges = info->get_bridges; ++ region->ops_owner = owner; + + mutex_init(®ion->mutex); + INIT_LIST_HEAD(®ion->bridge_list); +@@ -240,13 +243,14 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info * + + return ERR_PTR(ret); + } +-EXPORT_SYMBOL_GPL(fpga_region_register_full); ++EXPORT_SYMBOL_GPL(__fpga_region_register_full); + + /** +- * fpga_region_register - create and register an FPGA Region device ++ * __fpga_region_register - create and register an FPGA Region device + * @parent: device parent + * @mgr: manager that programs this region + * @get_bridges: optional function to get bridges to a list ++ * @owner: module containing the get_bridges function + * + * This simple version of the register function should be sufficient for most users. + * The fpga_region_register_full() function is available for users that need to +@@ -255,17 +259,17 @@ EXPORT_SYMBOL_GPL(fpga_region_register_full); + * Return: struct fpga_region or ERR_PTR() + */ + struct fpga_region * +-fpga_region_register(struct device *parent, struct fpga_manager *mgr, +- int (*get_bridges)(struct fpga_region *)) ++__fpga_region_register(struct device *parent, struct fpga_manager *mgr, ++ int (*get_bridges)(struct fpga_region *), struct module *owner) + { + struct fpga_region_info info = { 0 }; + + info.mgr = mgr; + info.get_bridges = get_bridges; + +- return fpga_region_register_full(parent, &info); ++ return __fpga_region_register_full(parent, &info, owner); + } +-EXPORT_SYMBOL_GPL(fpga_region_register); ++EXPORT_SYMBOL_GPL(__fpga_region_register); + + /** + * fpga_region_unregister - unregister an FPGA region +diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h +index 9d4d32909340a..5fbc05fe70a6b 100644 +--- a/include/linux/fpga/fpga-region.h ++++ b/include/linux/fpga/fpga-region.h +@@ -36,6 +36,7 @@ struct fpga_region_info { + * @mgr: FPGA manager + * @info: FPGA image info + * @compat_id: FPGA region id for compatibility check. ++ * @ops_owner: module containing the get_bridges function + * @priv: private data + * @get_bridges: optional function to get bridges to a list + */ +@@ -46,6 +47,7 @@ struct fpga_region { + struct fpga_manager *mgr; + struct fpga_image_info *info; + struct fpga_compat_id *compat_id; ++ struct module *ops_owner; + void *priv; + int (*get_bridges)(struct fpga_region *region); + }; +@@ -58,12 +60,17 @@ fpga_region_class_find(struct device *start, const void *data, + + int fpga_region_program_fpga(struct fpga_region *region); + ++#define fpga_region_register_full(parent, info) \ ++ __fpga_region_register_full(parent, info, THIS_MODULE) + struct fpga_region * +-fpga_region_register_full(struct device *parent, const struct fpga_region_info *info); ++__fpga_region_register_full(struct device *parent, const struct fpga_region_info *info, ++ struct module *owner); + ++#define fpga_region_register(parent, mgr, get_bridges) \ ++ __fpga_region_register(parent, mgr, get_bridges, THIS_MODULE) + struct fpga_region * +-fpga_region_register(struct device *parent, struct fpga_manager *mgr, +- int (*get_bridges)(struct fpga_region *)); ++__fpga_region_register(struct device *parent, struct fpga_manager *mgr, ++ int (*get_bridges)(struct fpga_region *), struct module *owner); + void fpga_region_unregister(struct fpga_region *region); + + #endif /* _FPGA_REGION_H */ +-- +2.43.0 + diff --git a/queue-6.1/greybus-arche-ctrl-move-device-table-to-its-right-lo.patch b/queue-6.1/greybus-arche-ctrl-move-device-table-to-its-right-lo.patch new file mode 100644 index 00000000000..8d77eccca3e --- /dev/null +++ b/queue-6.1/greybus-arche-ctrl-move-device-table-to-its-right-lo.patch @@ -0,0 +1,66 @@ +From 011b71d10806e046b4eb7e571699e54fb485c1c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Apr 2024 10:06:35 +0200 +Subject: greybus: arche-ctrl: move device table to its right location + +From: Arnd Bergmann + +[ Upstream commit 6a0b8c0da8d8d418cde6894a104cf74e6098ddfa ] + +The arche-ctrl has two platform drivers and three of_device_id tables, +but one table is only used for the the module loader, while the other +two seem to be associated with their drivers. + +This leads to a W=1 warning when the driver is built-in: + +drivers/staging/greybus/arche-platform.c:623:34: error: 'arche_combined_id' defined but not used [-Werror=unused-const-variable=] + 623 | static const struct of_device_id arche_combined_id[] = { + +Drop the extra table and register both tables that are actually +used as the ones for the module loader instead. + +Fixes: 7b62b61c752a ("greybus: arche-ctrl: Don't expose driver internals to arche-platform driver") +Signed-off-by: Arnd Bergmann +Link: https://lore.kernel.org/r/20240403080702.3509288-18-arnd@kernel.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/staging/greybus/arche-apb-ctrl.c | 1 + + drivers/staging/greybus/arche-platform.c | 9 +-------- + 2 files changed, 2 insertions(+), 8 deletions(-) + +diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c +index 45afa208d0044..4f9403f3d0cdd 100644 +--- a/drivers/staging/greybus/arche-apb-ctrl.c ++++ b/drivers/staging/greybus/arche-apb-ctrl.c +@@ -468,6 +468,7 @@ static const struct of_device_id arche_apb_ctrl_of_match[] = { + { .compatible = "usbffff,2", }, + { }, + }; ++MODULE_DEVICE_TABLE(of, arche_apb_ctrl_of_match); + + static struct platform_driver arche_apb_ctrl_device_driver = { + .probe = arche_apb_ctrl_probe, +diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c +index fcbd5f71eff27..4850bc64d3fd7 100644 +--- a/drivers/staging/greybus/arche-platform.c ++++ b/drivers/staging/greybus/arche-platform.c +@@ -620,14 +620,7 @@ static const struct of_device_id arche_platform_of_match[] = { + { .compatible = "google,arche-platform", }, + { }, + }; +- +-static const struct of_device_id arche_combined_id[] = { +- /* Use PID/VID of SVC device */ +- { .compatible = "google,arche-platform", }, +- { .compatible = "usbffff,2", }, +- { }, +-}; +-MODULE_DEVICE_TABLE(of, arche_combined_id); ++MODULE_DEVICE_TABLE(of, arche_platform_of_match); + + static struct platform_driver arche_platform_device_driver = { + .probe = arche_platform_probe, +-- +2.43.0 + diff --git a/queue-6.1/greybus-lights-check-return-of-get_channel_from_mode.patch b/queue-6.1/greybus-lights-check-return-of-get_channel_from_mode.patch new file mode 100644 index 00000000000..51b3ae26d47 --- /dev/null +++ b/queue-6.1/greybus-lights-check-return-of-get_channel_from_mode.patch @@ -0,0 +1,59 @@ +From ed8025aaa868b8b15b998b910938f33439a13034 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Mar 2024 22:09:55 +0000 +Subject: greybus: lights: check return of get_channel_from_mode + +From: Rui Miguel Silva + +[ Upstream commit a1ba19a1ae7cd1e324685ded4ab563e78fe68648 ] + +If channel for the given node is not found we return null from +get_channel_from_mode. Make sure we validate the return pointer +before using it in two of the missing places. + +This was originally reported in [0]: +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +[0] https://lore.kernel.org/all/20240301190425.120605-1-m.lobanov@rosalinux.ru + +Fixes: 2870b52bae4c ("greybus: lights: add lights implementation") +Reported-by: Mikhail Lobanov +Suggested-by: Mikhail Lobanov +Suggested-by: Alex Elder +Signed-off-by: Rui Miguel Silva +Link: https://lore.kernel.org/r/20240325221549.2185265-1-rmfrfs@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/staging/greybus/light.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c +index c6bd86a5335ab..9999f84016992 100644 +--- a/drivers/staging/greybus/light.c ++++ b/drivers/staging/greybus/light.c +@@ -147,6 +147,9 @@ static int __gb_lights_flash_brightness_set(struct gb_channel *channel) + channel = get_channel_from_mode(channel->light, + GB_CHANNEL_MODE_TORCH); + ++ if (!channel) ++ return -EINVAL; ++ + /* For not flash we need to convert brightness to intensity */ + intensity = channel->intensity_uA.min + + (channel->intensity_uA.step * channel->led->brightness); +@@ -549,7 +552,10 @@ static int gb_lights_light_v4l2_register(struct gb_light *light) + } + + channel_flash = get_channel_from_mode(light, GB_CHANNEL_MODE_FLASH); +- WARN_ON(!channel_flash); ++ if (!channel_flash) { ++ dev_err(dev, "failed to get flash channel from mode\n"); ++ return -EINVAL; ++ } + + fled = &channel_flash->fled; + +-- +2.43.0 + diff --git a/queue-6.1/iio-adc-stm32-fixing-err-code-to-not-indicate-succes.patch b/queue-6.1/iio-adc-stm32-fixing-err-code-to-not-indicate-succes.patch new file mode 100644 index 00000000000..35c5460837c --- /dev/null +++ b/queue-6.1/iio-adc-stm32-fixing-err-code-to-not-indicate-succes.patch @@ -0,0 +1,36 @@ +From fb161bf106c97f525943cd63ad2d6101dc3367a5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 30 Mar 2024 18:53:00 +0000 +Subject: iio: adc: stm32: Fixing err code to not indicate success + +From: Jonathan Cameron + +[ Upstream commit 3735ca0b072656c3aa2cedc617a5e639b583a472 ] + +This path would result in returning 0 / success on an error path. + +Cc: Olivier Moysan +Fixes: 95bc818404b2 ("iio: adc: stm32-adc: add support of generic channels binding") +Reviewed-by: Fabrice Gasnier +Link: https://lore.kernel.org/r/20240330185305.1319844-4-jic23@kernel.org +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/adc/stm32-adc.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c +index a5d5b7b3823bc..6fede34091cc2 100644 +--- a/drivers/iio/adc/stm32-adc.c ++++ b/drivers/iio/adc/stm32-adc.c +@@ -2079,6 +2079,7 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev, + if (vin[0] != val || vin[1] >= adc_info->max_channels) { + dev_err(&indio_dev->dev, "Invalid channel in%d-in%d\n", + vin[0], vin[1]); ++ ret = -EINVAL; + goto err; + } + } else if (ret != -EINVAL) { +-- +2.43.0 + diff --git a/queue-6.1/iio-core-leave-private-pointer-null-when-no-private-.patch b/queue-6.1/iio-core-leave-private-pointer-null-when-no-private-.patch new file mode 100644 index 00000000000..a9a31b4268b --- /dev/null +++ b/queue-6.1/iio-core-leave-private-pointer-null-when-no-private-.patch @@ -0,0 +1,43 @@ +From 1002a3732e47c721f4e33f03d7ff4ffb4845406f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Mar 2024 16:04:32 +0200 +Subject: iio: core: Leave private pointer NULL when no private data supplied + +From: Andy Shevchenko + +[ Upstream commit f0245ab389330cbc1d187e358a5b890d9f5383db ] + +In iio_device_alloc() when size of the private data is 0, +the private pointer is calculated to point behind the valid data. +Leave it NULL when no private data supplied. + +Fixes: 6d4ebd565d15 ("iio: core: wrap IIO device into an iio_dev_opaque object") +Signed-off-by: Andy Shevchenko +Reviewed-by: David Lechner +Link: https://lore.kernel.org/r/20240304140650.977784-2-andriy.shevchenko@linux.intel.com +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/industrialio-core.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c +index a2f8278f00856..135a86fc94531 100644 +--- a/drivers/iio/industrialio-core.c ++++ b/drivers/iio/industrialio-core.c +@@ -1670,8 +1670,10 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv) + return NULL; + + indio_dev = &iio_dev_opaque->indio_dev; +- indio_dev->priv = (char *)iio_dev_opaque + +- ALIGN(sizeof(struct iio_dev_opaque), IIO_DMA_MINALIGN); ++ ++ if (sizeof_priv) ++ indio_dev->priv = (char *)iio_dev_opaque + ++ ALIGN(sizeof(*iio_dev_opaque), IIO_DMA_MINALIGN); + + indio_dev->dev.parent = parent; + indio_dev->dev.type = &iio_device_type; +-- +2.43.0 + diff --git a/queue-6.1/iio-pressure-dps310-support-negative-temperature-val.patch b/queue-6.1/iio-pressure-dps310-support-negative-temperature-val.patch new file mode 100644 index 00000000000..904829421c0 --- /dev/null +++ b/queue-6.1/iio-pressure-dps310-support-negative-temperature-val.patch @@ -0,0 +1,67 @@ +From 6717ff3da8122928e2dfafe7d63a5a65e9761baf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 15 Apr 2024 12:50:27 +0200 +Subject: iio: pressure: dps310: support negative temperature values + +From: Thomas Haemmerle + +[ Upstream commit 9dd6b32e76ff714308964cd9ec91466a343dcb8b ] + +The current implementation interprets negative values returned from +`dps310_calculate_temp` as error codes. +This has a side effect that when negative temperature values are +calculated, they are interpreted as error. + +Fix this by using the return value only for error handling and passing a +pointer for the value. + +Fixes: ba6ec48e76bc ("iio: Add driver for Infineon DPS310") +Signed-off-by: Thomas Haemmerle +Link: https://lore.kernel.org/r/20240415105030.1161770-2-thomas.haemmerle@leica-geosystems.com +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/pressure/dps310.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/iio/pressure/dps310.c b/drivers/iio/pressure/dps310.c +index db1b1e48225aa..519fcd425b6a3 100644 +--- a/drivers/iio/pressure/dps310.c ++++ b/drivers/iio/pressure/dps310.c +@@ -730,7 +730,7 @@ static int dps310_read_pressure(struct dps310_data *data, int *val, int *val2, + } + } + +-static int dps310_calculate_temp(struct dps310_data *data) ++static int dps310_calculate_temp(struct dps310_data *data, int *val) + { + s64 c0; + s64 t; +@@ -746,7 +746,9 @@ static int dps310_calculate_temp(struct dps310_data *data) + t = c0 + ((s64)data->temp_raw * (s64)data->c1); + + /* Convert to milliCelsius and scale the temperature */ +- return (int)div_s64(t * 1000LL, kt); ++ *val = (int)div_s64(t * 1000LL, kt); ++ ++ return 0; + } + + static int dps310_read_temp(struct dps310_data *data, int *val, int *val2, +@@ -768,11 +770,10 @@ static int dps310_read_temp(struct dps310_data *data, int *val, int *val2, + if (rc) + return rc; + +- rc = dps310_calculate_temp(data); +- if (rc < 0) ++ rc = dps310_calculate_temp(data, val); ++ if (rc) + return rc; + +- *val = rc; + return IIO_VAL_INT; + + case IIO_CHAN_INFO_OVERSAMPLING_RATIO: +-- +2.43.0 + diff --git a/queue-6.1/interconnect-qcom-qcm2290-fix-mas_snoc_bimc-qos-port.patch b/queue-6.1/interconnect-qcom-qcm2290-fix-mas_snoc_bimc-qos-port.patch new file mode 100644 index 00000000000..5b3e4358c38 --- /dev/null +++ b/queue-6.1/interconnect-qcom-qcm2290-fix-mas_snoc_bimc-qos-port.patch @@ -0,0 +1,37 @@ +From d59cedce839552d6a18f3f3a78f44a6c535d734f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 Mar 2024 20:42:33 +0100 +Subject: interconnect: qcom: qcm2290: Fix mas_snoc_bimc QoS port assignment + +From: Konrad Dybcio + +[ Upstream commit 230d05b1179f6ce6f8dc8a2b99eba92799ac22d7 ] + +The value was wrong, resulting in misprogramming of the hardware. +Fix it. + +Fixes: 1a14b1ac3935 ("interconnect: qcom: Add QCM2290 driver support") +Signed-off-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20240326-topic-rpm_icc_qos_cleanup-v1-2-357e736792be@linaro.org +Signed-off-by: Georgi Djakov +Signed-off-by: Sasha Levin +--- + drivers/interconnect/qcom/qcm2290.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/interconnect/qcom/qcm2290.c b/drivers/interconnect/qcom/qcm2290.c +index 82a2698ad66b1..ca7ad37ea6777 100644 +--- a/drivers/interconnect/qcom/qcm2290.c ++++ b/drivers/interconnect/qcom/qcm2290.c +@@ -164,7 +164,7 @@ static struct qcom_icc_node mas_snoc_bimc = { + .name = "mas_snoc_bimc", + .buswidth = 16, + .qos.ap_owned = true, +- .qos.qos_port = 2, ++ .qos.qos_port = 6, + .qos.qos_mode = NOC_QOS_MODE_BYPASS, + .mas_rpm_id = 164, + .slv_rpm_id = -1, +-- +2.43.0 + diff --git a/queue-6.1/kbuild-fix-build-id-symlinks-to-installed-debug-vdso.patch b/queue-6.1/kbuild-fix-build-id-symlinks-to-installed-debug-vdso.patch new file mode 100644 index 00000000000..be3e8a48817 --- /dev/null +++ b/queue-6.1/kbuild-fix-build-id-symlinks-to-installed-debug-vdso.patch @@ -0,0 +1,36 @@ +From 90f27ae41a894e0d9da46a8b0fbef58bd78833e3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Dec 2023 17:18:33 +0900 +Subject: kbuild: fix build ID symlinks to installed debug VDSO files + +From: Masahiro Yamada + +[ Upstream commit c1a8627164dbe8b92958aea10c7c0848105a3d7f ] + +Commit 56769ba4b297 ("kbuild: unify vdso_install rules") accidentally +dropped the '.debug' suffix from the build ID symlinks. + +Fixes: 56769ba4b297 ("kbuild: unify vdso_install rules") +Signed-off-by: Masahiro Yamada +Stable-dep-of: fc2f5f10f9bc ("s390/vdso: Create .build-id links for unstripped vdso files") +Signed-off-by: Sasha Levin +--- + scripts/Makefile.vdsoinst | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/Makefile.vdsoinst b/scripts/Makefile.vdsoinst +index 1022d9fdd976d..c477d17b0aa5b 100644 +--- a/scripts/Makefile.vdsoinst ++++ b/scripts/Makefile.vdsoinst +@@ -22,7 +22,7 @@ $$(dest): $$(src) FORCE + + # Some architectures create .build-id symlinks + ifneq ($(filter arm sparc x86, $(SRCARCH)),) +-link := $(install-dir)/.build-id/$$(shell $(READELF) -n $$(src) | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p') ++link := $(install-dir)/.build-id/$$(shell $(READELF) -n $$(src) | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p').debug + + __default: $$(link) + $$(link): $$(dest) FORCE +-- +2.43.0 + diff --git a/queue-6.1/kbuild-unify-vdso_install-rules.patch b/queue-6.1/kbuild-unify-vdso_install-rules.patch new file mode 100644 index 00000000000..807d44ea2e1 --- /dev/null +++ b/queue-6.1/kbuild-unify-vdso_install-rules.patch @@ -0,0 +1,585 @@ +From d255d15f5581dc48bfbb442da60af2709f35e43e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 14 Oct 2023 19:54:35 +0900 +Subject: kbuild: unify vdso_install rules + +From: Masahiro Yamada + +[ Upstream commit 56769ba4b297a629148eb24d554aef72d1ddfd9e ] + +Currently, there is no standard implementation for vdso_install, +leading to various issues: + + 1. Code duplication + + Many architectures duplicate similar code just for copying files + to the install destination. + + Some architectures (arm, sparc, x86) create build-id symlinks, + introducing more code duplication. + + 2. Unintended updates of in-tree build artifacts + + The vdso_install rule depends on the vdso files to install. + It may update in-tree build artifacts. This can be problematic, + as explained in commit 19514fc665ff ("arm, kbuild: make + "make install" not depend on vmlinux"). + + 3. Broken code in some architectures + + Makefile code is often copied from one architecture to another + without proper adaptation. + + 'make vdso_install' for parisc does not work. + + 'make vdso_install' for s390 installs vdso64, but not vdso32. + +To address these problems, this commit introduces a generic vdso_install +rule. + +Architectures that support vdso_install need to define vdso-install-y +in arch/*/Makefile. vdso-install-y lists the files to install. + +For example, arch/x86/Makefile looks like this: + + vdso-install-$(CONFIG_X86_64) += arch/x86/entry/vdso/vdso64.so.dbg + vdso-install-$(CONFIG_X86_X32_ABI) += arch/x86/entry/vdso/vdsox32.so.dbg + vdso-install-$(CONFIG_X86_32) += arch/x86/entry/vdso/vdso32.so.dbg + vdso-install-$(CONFIG_IA32_EMULATION) += arch/x86/entry/vdso/vdso32.so.dbg + +These files will be installed to $(MODLIB)/vdso/ with the .dbg suffix, +if exists, stripped away. + +vdso-install-y can optionally take the second field after the colon +separator. This is needed because some architectures install a vdso +file as a different base name. + +The following is a snippet from arch/arm64/Makefile. + + vdso-install-$(CONFIG_COMPAT_VDSO) += arch/arm64/kernel/vdso32/vdso.so.dbg:vdso32.so + +This will rename vdso.so.dbg to vdso32.so during installation. If such +architectures change their implementation so that the base names match, +this workaround will go away. + +Signed-off-by: Masahiro Yamada +Acked-by: Sven Schnelle # s390 +Reviewed-by: Nicolas Schier +Reviewed-by: Guo Ren +Acked-by: Helge Deller # parisc +Acked-by: Catalin Marinas +Acked-by: Russell King (Oracle) +Stable-dep-of: fc2f5f10f9bc ("s390/vdso: Create .build-id links for unstripped vdso files") +Signed-off-by: Sasha Levin +--- + Makefile | 9 ++++++ + arch/arm/Makefile | 7 +--- + arch/arm/vdso/Makefile | 25 -------------- + arch/arm64/Makefile | 9 ++---- + arch/arm64/kernel/vdso/Makefile | 10 ------ + arch/arm64/kernel/vdso32/Makefile | 10 ------ + arch/loongarch/Makefile | 4 +-- + arch/loongarch/vdso/Makefile | 10 ------ + arch/parisc/Makefile | 8 ++--- + arch/riscv/Makefile | 9 ++---- + arch/riscv/kernel/compat_vdso/Makefile | 10 ------ + arch/riscv/kernel/vdso/Makefile | 10 ------ + arch/s390/Makefile | 6 ++-- + arch/s390/kernel/vdso32/Makefile | 10 ------ + arch/s390/kernel/vdso64/Makefile | 10 ------ + arch/sparc/Makefile | 5 ++- + arch/sparc/vdso/Makefile | 27 ---------------- + arch/x86/Makefile | 7 ++-- + arch/x86/entry/vdso/Makefile | 27 ---------------- + scripts/Makefile.vdsoinst | 45 ++++++++++++++++++++++++++ + 20 files changed, 73 insertions(+), 185 deletions(-) + create mode 100644 scripts/Makefile.vdsoinst + +diff --git a/Makefile b/Makefile +index 0be668057cb2a..fa1d08d2dbc7a 100644 +--- a/Makefile ++++ b/Makefile +@@ -1400,6 +1400,14 @@ scripts_unifdef: scripts_basic + quiet_cmd_install = INSTALL $(INSTALL_PATH) + cmd_install = unset sub_make_done; $(srctree)/scripts/install.sh + ++# --------------------------------------------------------------------------- ++# vDSO install ++ ++PHONY += vdso_install ++vdso_install: export INSTALL_FILES = $(vdso-install-y) ++vdso_install: ++ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vdsoinst ++ + # --------------------------------------------------------------------------- + # Tools + +@@ -1675,6 +1683,7 @@ help: + @echo '* vmlinux - Build the bare kernel' + @echo '* modules - Build all modules' + @echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)' ++ @echo ' vdso_install - Install unstripped vdso to INSTALL_MOD_PATH (default: /)' + @echo ' dir/ - Build all files in dir and below' + @echo ' dir/file.[ois] - Build specified target only' + @echo ' dir/file.ll - Build the LLVM assembly file' +diff --git a/arch/arm/Makefile b/arch/arm/Makefile +index ce1d873c8986a..0088198525b19 100644 +--- a/arch/arm/Makefile ++++ b/arch/arm/Makefile +@@ -301,11 +301,7 @@ $(INSTALL_TARGETS): KBUILD_IMAGE = $(boot)/$(patsubst %install,%Image,$@) + $(INSTALL_TARGETS): + $(call cmd,install) + +-PHONY += vdso_install +-vdso_install: +-ifeq ($(CONFIG_VDSO),y) +- $(Q)$(MAKE) $(build)=arch/arm/vdso $@ +-endif ++vdso-install-$(CONFIG_VDSO) += arch/arm/vdso/vdso.so.dbg + + # My testing targets (bypasses dependencies) + bp:; $(Q)$(MAKE) $(build)=$(boot) $(boot)/bootpImage +@@ -328,7 +324,6 @@ define archhelp + echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or' + echo ' (distribution) /sbin/$(INSTALLKERNEL) or' + echo ' install to $$(INSTALL_PATH) and run lilo' +- echo ' vdso_install - Install unstripped vdso.so to $$(INSTALL_MOD_PATH)/vdso' + echo + echo ' multi_v7_lpae_defconfig - multi_v7_defconfig with CONFIG_ARM_LPAE enabled' + endef +diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile +index 8ca1c9f262a22..9f76ba65d9c65 100644 +--- a/arch/arm/vdso/Makefile ++++ b/arch/arm/vdso/Makefile +@@ -64,28 +64,3 @@ quiet_cmd_vdsold_and_vdso_check = LD $@ + + quiet_cmd_vdsomunge = MUNGE $@ + cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@ +- +-# +-# Install the unstripped copy of vdso.so.dbg. If our toolchain +-# supports build-id, install .build-id links as well. +-# +-# Cribbed from arch/x86/vdso/Makefile. +-# +-quiet_cmd_vdso_install = INSTALL $< +-define cmd_vdso_install +- cp $< "$(MODLIB)/vdso/vdso.so"; \ +- if readelf -n $< | grep -q 'Build ID'; then \ +- buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ +- first=`echo $$buildid | cut -b-2`; \ +- last=`echo $$buildid | cut -b3-`; \ +- mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ +- ln -sf "../../vdso.so" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ +- fi +-endef +- +-$(MODLIB)/vdso: FORCE +- @mkdir -p $(MODLIB)/vdso +- +-PHONY += vdso_install +-vdso_install: $(obj)/vdso.so.dbg $(MODLIB)/vdso +- $(call cmd,vdso_install) +diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile +index bd4d9a001c612..5cca6567daacf 100644 +--- a/arch/arm64/Makefile ++++ b/arch/arm64/Makefile +@@ -168,12 +168,6 @@ install: KBUILD_IMAGE := $(boot)/Image + install zinstall: + $(call cmd,install) + +-PHONY += vdso_install +-vdso_install: +- $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@ +- $(if $(CONFIG_COMPAT_VDSO), \ +- $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@) +- + archprepare: + $(Q)$(MAKE) $(build)=arch/arm64/tools kapi + ifeq ($(CONFIG_ARM64_ERRATUM_843419),y) +@@ -204,6 +198,9 @@ ifdef CONFIG_COMPAT_VDSO + endif + endif + ++vdso-install-y += arch/arm64/kernel/vdso/vdso.so.dbg ++vdso-install-$(CONFIG_COMPAT_VDSO) += arch/arm64/kernel/vdso32/vdso.so.dbg:vdso32.so ++ + include $(srctree)/scripts/Makefile.defconf + + PHONY += virtconfig +diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile +index 619e2dc7ee14c..e4b72db35eb81 100644 +--- a/arch/arm64/kernel/vdso/Makefile ++++ b/arch/arm64/kernel/vdso/Makefile +@@ -80,13 +80,3 @@ include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE + # Actual build commands + quiet_cmd_vdsold_and_vdso_check = LD $@ + cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check) +- +-# Install commands for the unstripped file +-quiet_cmd_vdso_install = INSTALL $@ +- cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ +- +-vdso.so: $(obj)/vdso.so.dbg +- @mkdir -p $(MODLIB)/vdso +- $(call cmd,vdso_install) +- +-vdso_install: vdso.so +diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile +index d513533cc922f..694ff1dd4b0f2 100644 +--- a/arch/arm64/kernel/vdso32/Makefile ++++ b/arch/arm64/kernel/vdso32/Makefile +@@ -175,13 +175,3 @@ gen-vdsosym := $(srctree)/$(src)/../vdso/gen_vdso_offsets.sh + quiet_cmd_vdsosym = VDSOSYM $@ + # The AArch64 nm should be able to read an AArch32 binary + cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ +- +-# Install commands for the unstripped file +-quiet_cmd_vdso_install = INSTALL32 $@ +- cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/vdso32.so +- +-vdso.so: $(obj)/vdso.so.dbg +- @mkdir -p $(MODLIB)/vdso +- $(call cmd,vdso_install) +- +-vdso_install: vdso.so +diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile +index ed47a3a87768e..6f618fb3863a4 100644 +--- a/arch/loongarch/Makefile ++++ b/arch/loongarch/Makefile +@@ -110,9 +110,7 @@ vdso_prepare: prepare0 + $(Q)$(MAKE) $(build)=arch/loongarch/vdso include/generated/vdso-offsets.h + endif + +-PHONY += vdso_install +-vdso_install: +- $(Q)$(MAKE) $(build)=arch/loongarch/vdso $@ ++vdso-install-y += arch/loongarch/vdso/vdso.so.dbg + + all: $(notdir $(KBUILD_IMAGE)) + +diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile +index d89e2ac75f7b8..8b308b7edadd8 100644 +--- a/arch/loongarch/vdso/Makefile ++++ b/arch/loongarch/vdso/Makefile +@@ -85,13 +85,3 @@ $(obj)/vdso.so: $(obj)/vdso.so.dbg FORCE + obj-y += vdso.o + + $(obj)/vdso.o : $(obj)/vdso.so +- +-# install commands for the unstripped file +-quiet_cmd_vdso_install = INSTALL $@ +- cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ +- +-vdso.so: $(obj)/vdso.so.dbg +- @mkdir -p $(MODLIB)/vdso +- $(call cmd,vdso_install) +- +-vdso_install: vdso.so +diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile +index a2d8600521f93..dffe5f7382146 100644 +--- a/arch/parisc/Makefile ++++ b/arch/parisc/Makefile +@@ -175,12 +175,8 @@ vdso_prepare: prepare0 + $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h + endif + +-PHONY += vdso_install +- +-vdso_install: +- $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso $@ +- $(if $(CONFIG_COMPAT_VDSO), \ +- $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 $@) ++vdso-install-y += arch/parisc/kernel/vdso32/vdso32.so ++vdso-install-$(CONFIG_64BIT) += arch/parisc/kernel/vdso64/vdso64.so + + install: KBUILD_IMAGE := vmlinux + zinstall: KBUILD_IMAGE := vmlinuz +diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile +index 3cb876f83187d..9711d2b0df051 100644 +--- a/arch/riscv/Makefile ++++ b/arch/riscv/Makefile +@@ -129,12 +129,6 @@ endif + libs-y += arch/riscv/lib/ + libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a + +-PHONY += vdso_install +-vdso_install: +- $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ +- $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ +- $(build)=arch/riscv/kernel/compat_vdso compat_$@) +- + ifeq ($(KBUILD_EXTMOD),) + ifeq ($(CONFIG_MMU),y) + prepare: vdso_prepare +@@ -146,6 +140,9 @@ vdso_prepare: prepare0 + endif + endif + ++vdso-install-y += arch/riscv/kernel/vdso/vdso.so.dbg ++vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so ++ + ifneq ($(CONFIG_XIP_KERNEL),y) + ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAAN),yy) + KBUILD_IMAGE := $(boot)/loader.bin +diff --git a/arch/riscv/kernel/compat_vdso/Makefile b/arch/riscv/kernel/compat_vdso/Makefile +index 737c0857b14cd..bd6eb768070f9 100644 +--- a/arch/riscv/kernel/compat_vdso/Makefile ++++ b/arch/riscv/kernel/compat_vdso/Makefile +@@ -76,13 +76,3 @@ quiet_cmd_compat_vdsold = VDSOLD $@ + # actual build commands + quiet_cmd_compat_vdsoas = VDSOAS $@ + cmd_compat_vdsoas = $(COMPAT_CC) $(a_flags) $(COMPAT_CC_FLAGS) -c -o $@ $< +- +-# install commands for the unstripped file +-quiet_cmd_compat_vdso_install = INSTALL $@ +- cmd_compat_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/compat_vdso/$@ +- +-compat_vdso.so: $(obj)/compat_vdso.so.dbg +- @mkdir -p $(MODLIB)/compat_vdso +- $(call cmd,compat_vdso_install) +- +-compat_vdso_install: compat_vdso.so +diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile +index 06e6b27f3bcc9..f4983bf149816 100644 +--- a/arch/riscv/kernel/vdso/Makefile ++++ b/arch/riscv/kernel/vdso/Makefile +@@ -71,13 +71,3 @@ quiet_cmd_vdsold = VDSOLD $@ + cmd_vdsold = $(LD) $(ld_flags) -T $(filter-out FORCE,$^) -o $@.tmp && \ + $(OBJCOPY) $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \ + rm $@.tmp +- +-# install commands for the unstripped file +-quiet_cmd_vdso_install = INSTALL $@ +- cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ +- +-vdso.so: $(obj)/vdso.so.dbg +- @mkdir -p $(MODLIB)/vdso +- $(call cmd,vdso_install) +- +-vdso_install: vdso.so +diff --git a/arch/s390/Makefile b/arch/s390/Makefile +index 5ed242897b0d2..23f39c3cd536d 100644 +--- a/arch/s390/Makefile ++++ b/arch/s390/Makefile +@@ -139,9 +139,6 @@ bzImage: vmlinux + zfcpdump: + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ + +-vdso_install: +- $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ +- + archheaders: + $(Q)$(MAKE) $(build)=$(syscalls) uapi + +@@ -161,6 +158,9 @@ vdso_prepare: prepare0 + $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ + $(build)=arch/s390/kernel/vdso32 include/generated/vdso32-offsets.h) + ++vdso-install-y += arch/s390/kernel/vdso64/vdso64.so.dbg ++vdso-install-$(CONFIG_COMPAT) += arch/s390/kernel/vdso32/vdso32.so.dbg ++ + ifdef CONFIG_EXPOLINE_EXTERN + modules_prepare: expoline_prepare + expoline_prepare: scripts +diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile +index 66f7b0c8e6117..bf30997657ac8 100644 +--- a/arch/s390/kernel/vdso32/Makefile ++++ b/arch/s390/kernel/vdso32/Makefile +@@ -60,16 +60,6 @@ quiet_cmd_vdso32as = VDSO32A $@ + quiet_cmd_vdso32cc = VDSO32C $@ + cmd_vdso32cc = $(CC) $(c_flags) -c -o $@ $< + +-# install commands for the unstripped file +-quiet_cmd_vdso_install = INSTALL $@ +- cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ +- +-vdso32.so: $(obj)/vdso32.so.dbg +- @mkdir -p $(MODLIB)/vdso +- $(call cmd,vdso_install) +- +-vdso_install: vdso32.so +- + # Generate VDSO offsets using helper script + gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh + quiet_cmd_vdsosym = VDSOSYM $@ +diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile +index e520c548d303e..f8643d50ba6a6 100644 +--- a/arch/s390/kernel/vdso64/Makefile ++++ b/arch/s390/kernel/vdso64/Makefile +@@ -70,16 +70,6 @@ quiet_cmd_vdso64as = VDSO64A $@ + quiet_cmd_vdso64cc = VDSO64C $@ + cmd_vdso64cc = $(CC) $(c_flags) -c -o $@ $< + +-# install commands for the unstripped file +-quiet_cmd_vdso_install = INSTALL $@ +- cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ +- +-vdso64.so: $(obj)/vdso64.so.dbg +- @mkdir -p $(MODLIB)/vdso +- $(call cmd,vdso_install) +- +-vdso_install: vdso64.so +- + # Generate VDSO offsets using helper script + gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh + quiet_cmd_vdsosym = VDSOSYM $@ +diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile +index a4ea5b05f2885..d0f2224d5600d 100644 +--- a/arch/sparc/Makefile ++++ b/arch/sparc/Makefile +@@ -75,9 +75,8 @@ install: + archheaders: + $(Q)$(MAKE) $(build)=arch/sparc/kernel/syscalls all + +-PHONY += vdso_install +-vdso_install: +- $(Q)$(MAKE) $(build)=arch/sparc/vdso $@ ++vdso-install-$(CONFIG_SPARC64) += arch/sparc/vdso/vdso64.so.dbg ++vdso-install-$(CONFIG_COMPAT) += arch/sparc/vdso/vdso32.so.dbg + + # This is the image used for packaging + KBUILD_IMAGE := $(boot)/zImage +diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile +index 77d7b9032158c..d08c3a0443f3a 100644 +--- a/arch/sparc/vdso/Makefile ++++ b/arch/sparc/vdso/Makefile +@@ -116,30 +116,3 @@ quiet_cmd_vdso = VDSO $@ + + VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic + GCOV_PROFILE := n +- +-# +-# Install the unstripped copies of vdso*.so. If our toolchain supports +-# build-id, install .build-id links as well. +-# +-quiet_cmd_vdso_install = INSTALL $(@:install_%=%) +-define cmd_vdso_install +- cp $< "$(MODLIB)/vdso/$(@:install_%=%)"; \ +- if readelf -n $< |grep -q 'Build ID'; then \ +- buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ +- first=`echo $$buildid | cut -b-2`; \ +- last=`echo $$buildid | cut -b3-`; \ +- mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ +- ln -sf "../../$(@:install_%=%)" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ +- fi +-endef +- +-vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) +- +-$(MODLIB)/vdso: FORCE +- @mkdir -p $(MODLIB)/vdso +- +-$(vdso_img_insttargets): install_%: $(obj)/%.dbg $(MODLIB)/vdso FORCE +- $(call cmd,vdso_install) +- +-PHONY += vdso_install $(vdso_img_insttargets) +-vdso_install: $(vdso_img_insttargets) FORCE +diff --git a/arch/x86/Makefile b/arch/x86/Makefile +index 3419ffa2a3507..1f22efb16212d 100644 +--- a/arch/x86/Makefile ++++ b/arch/x86/Makefile +@@ -285,9 +285,10 @@ PHONY += install + install: + $(call cmd,install) + +-PHONY += vdso_install +-vdso_install: +- $(Q)$(MAKE) $(build)=arch/x86/entry/vdso $@ ++vdso-install-$(CONFIG_X86_64) += arch/x86/entry/vdso/vdso64.so.dbg ++vdso-install-$(CONFIG_X86_X32_ABI) += arch/x86/entry/vdso/vdsox32.so.dbg ++vdso-install-$(CONFIG_X86_32) += arch/x86/entry/vdso/vdso32.so.dbg ++vdso-install-$(CONFIG_IA32_EMULATION) += arch/x86/entry/vdso/vdso32.so.dbg + + archprepare: checkbin + checkbin: +diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile +index 3e88b9df8c8f1..4ee8c3c320586 100644 +--- a/arch/x86/entry/vdso/Makefile ++++ b/arch/x86/entry/vdso/Makefile +@@ -190,31 +190,4 @@ GCOV_PROFILE := n + quiet_cmd_vdso_and_check = VDSO $@ + cmd_vdso_and_check = $(cmd_vdso); $(cmd_vdso_check) + +-# +-# Install the unstripped copies of vdso*.so. If our toolchain supports +-# build-id, install .build-id links as well. +-# +-quiet_cmd_vdso_install = INSTALL $(@:install_%=%) +-define cmd_vdso_install +- cp $< "$(MODLIB)/vdso/$(@:install_%=%)"; \ +- if readelf -n $< |grep -q 'Build ID'; then \ +- buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ +- first=`echo $$buildid | cut -b-2`; \ +- last=`echo $$buildid | cut -b3-`; \ +- mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ +- ln -sf "../../$(@:install_%=%)" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ +- fi +-endef +- +-vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) +- +-$(MODLIB)/vdso: FORCE +- @mkdir -p $(MODLIB)/vdso +- +-$(vdso_img_insttargets): install_%: $(obj)/%.dbg $(MODLIB)/vdso +- $(call cmd,vdso_install) +- +-PHONY += vdso_install $(vdso_img_insttargets) +-vdso_install: $(vdso_img_insttargets) +- + clean-files := vdso32.so vdso32.so.dbg vdso64* vdso-image-*.c vdsox32.so* +diff --git a/scripts/Makefile.vdsoinst b/scripts/Makefile.vdsoinst +new file mode 100644 +index 0000000000000..1022d9fdd976d +--- /dev/null ++++ b/scripts/Makefile.vdsoinst +@@ -0,0 +1,45 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++# ========================================================================== ++# Install unstripped copies of vDSO ++# ========================================================================== ++ ++PHONY := __default ++__default: ++ @: ++ ++include $(srctree)/scripts/Kbuild.include ++ ++install-dir := $(MODLIB)/vdso ++ ++define gen_install_rules ++ ++src := $$(firstword $$(subst :,$(space),$(1))) ++dest := $(install-dir)/$$(or $$(word 2,$$(subst :,$(space),$(1))),$$(patsubst %.dbg,%,$$(notdir $(1)))) ++ ++__default: $$(dest) ++$$(dest): $$(src) FORCE ++ $$(call cmd,install) ++ ++# Some architectures create .build-id symlinks ++ifneq ($(filter arm sparc x86, $(SRCARCH)),) ++link := $(install-dir)/.build-id/$$(shell $(READELF) -n $$(src) | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p') ++ ++__default: $$(link) ++$$(link): $$(dest) FORCE ++ $$(call cmd,symlink) ++endif ++ ++endef ++ ++$(foreach x, $(sort $(INSTALL_FILES)), $(eval $(call gen_install_rules,$(x)))) ++ ++quiet_cmd_install = INSTALL $@ ++ cmd_install = mkdir -p $(dir $@); cp $< $@ ++ ++quiet_cmd_symlink = SYMLINK $@ ++ cmd_symlink = mkdir -p $(dir $@); ln -sf --relative $< $@ ++ ++PHONY += FORCE ++FORCE: ++ ++.PHONY: $(PHONY) +-- +2.43.0 + diff --git a/queue-6.1/libsubcmd-fix-parse-options-memory-leak.patch b/queue-6.1/libsubcmd-fix-parse-options-memory-leak.patch new file mode 100644 index 00000000000..654dd465fb2 --- /dev/null +++ b/queue-6.1/libsubcmd-fix-parse-options-memory-leak.patch @@ -0,0 +1,61 @@ +From be1bf1bfbcecd945e20cde5e24635a20aa4043be Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 May 2024 22:20:15 -0700 +Subject: libsubcmd: Fix parse-options memory leak + +From: Ian Rogers + +[ Upstream commit 230a7a71f92212e723fa435d4ca5922de33ec88a ] + +If a usage string is built in parse_options_subcommand, also free it. + +Fixes: 901421a5bdf605d2 ("perf tools: Remove subcmd dependencies on strbuf") +Signed-off-by: Ian Rogers +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Josh Poimboeuf +Cc: Kan Liang +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20240509052015.1914670-1-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/lib/subcmd/parse-options.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c +index 9fa75943f2ed1..d943d78b787ed 100644 +--- a/tools/lib/subcmd/parse-options.c ++++ b/tools/lib/subcmd/parse-options.c +@@ -633,11 +633,10 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o + const char *const subcommands[], const char *usagestr[], int flags) + { + struct parse_opt_ctx_t ctx; ++ char *buf = NULL; + + /* build usage string if it's not provided */ + if (subcommands && !usagestr[0]) { +- char *buf = NULL; +- + astrcatf(&buf, "%s %s [] {", subcmd_config.exec_name, argv[0]); + + for (int i = 0; subcommands[i]; i++) { +@@ -679,7 +678,10 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o + astrcatf(&error_buf, "unknown switch `%c'", *ctx.opt); + usage_with_options(usagestr, options); + } +- ++ if (buf) { ++ usagestr[0] = NULL; ++ free(buf); ++ } + return parse_options_end(&ctx); + } + +-- +2.43.0 + diff --git a/queue-6.1/loongarch-fix-callchain-parse-error-with-kernel-trac.patch b/queue-6.1/loongarch-fix-callchain-parse-error-with-kernel-trac.patch new file mode 100644 index 00000000000..6d48d069d44 --- /dev/null +++ b/queue-6.1/loongarch-fix-callchain-parse-error-with-kernel-trac.patch @@ -0,0 +1,71 @@ +From 02129730187195596c43810c2b126baf557538ab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 May 2024 12:24:18 +0800 +Subject: LoongArch: Fix callchain parse error with kernel tracepoint events + again + +From: Huacai Chen + +[ Upstream commit d6af2c76399f98444a5b4de96baf4b362d9f102b ] + +With commit d3119bc985fb645 ("LoongArch: Fix callchain parse error with +kernel tracepoint events"), perf can parse kernel callchain, but not +complete and sometimes maybe error. The reason is LoongArch's unwinders +(guess, prologue and orc) don't really need fp (i.e., regs[22]), and +they use sp (i.e., regs[3]) as the frame address rather than the current +stack pointer. + +Fix that by removing the assignment of regs[22], and instead assign the +__builtin_frame_address(0) to regs[3]. + +Without fix: + + Children Self Command Shared Object Symbol + ........ ........ ............. ................. ................ + 33.91% 33.91% swapper [kernel.vmlinux] [k] __schedule + | + |--33.04%--__schedule + | + --0.87%--__arch_cpu_idle + __schedule + +With this fix: + + Children Self Command Shared Object Symbol + ........ ........ ............. ................. ................ + 31.16% 31.16% swapper [kernel.vmlinux] [k] __schedule + | + |--20.63%--smpboot_entry + | cpu_startup_entry + | schedule_idle + | __schedule + | + --10.53%--start_kernel + cpu_startup_entry + schedule_idle + __schedule + +Fixes: d3119bc985fb645 ("LoongArch: Fix callchain parse error with kernel tracepoint events") +Signed-off-by: Huacai Chen +Signed-off-by: Sasha Levin +--- + arch/loongarch/include/asm/perf_event.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/arch/loongarch/include/asm/perf_event.h b/arch/loongarch/include/asm/perf_event.h +index 52b638059e40b..f948a0676daf8 100644 +--- a/arch/loongarch/include/asm/perf_event.h ++++ b/arch/loongarch/include/asm/perf_event.h +@@ -13,8 +13,7 @@ + + #define perf_arch_fetch_caller_regs(regs, __ip) { \ + (regs)->csr_era = (__ip); \ +- (regs)->regs[3] = current_stack_pointer; \ +- (regs)->regs[22] = (unsigned long) __builtin_frame_address(0); \ ++ (regs)->regs[3] = (unsigned long) __builtin_frame_address(0); \ + } + + #endif /* __LOONGARCH_PERF_EVENT_H__ */ +-- +2.43.0 + diff --git a/queue-6.1/microblaze-remove-early-printk-call-from-cpuinfo-sta.patch b/queue-6.1/microblaze-remove-early-printk-call-from-cpuinfo-sta.patch new file mode 100644 index 00000000000..a81b3fb9f5b --- /dev/null +++ b/queue-6.1/microblaze-remove-early-printk-call-from-cpuinfo-sta.patch @@ -0,0 +1,37 @@ +From bd28a7f094b360882a41282574ff06a22e0e4103 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 11 Apr 2024 10:27:21 +0200 +Subject: microblaze: Remove early printk call from cpuinfo-static.c + +From: Michal Simek + +[ Upstream commit 58d647506c92ccd3cfa0c453c68ddd14f40bf06f ] + +Early printk has been removed already that's why also remove calling it. +Similar change has been done in cpuinfo-pvr-full.c by commit cfbd8d1979af +("microblaze: Remove early printk setup"). + +Fixes: 96f0e6fcc9ad ("microblaze: remove redundant early_printk support") +Signed-off-by: Michal Simek +Link: https://lore.kernel.org/r/2f10db506be8188fa07b6ec331caca01af1b10f8.1712824039.git.michal.simek@amd.com +Signed-off-by: Sasha Levin +--- + arch/microblaze/kernel/cpu/cpuinfo-static.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/microblaze/kernel/cpu/cpuinfo-static.c b/arch/microblaze/kernel/cpu/cpuinfo-static.c +index 85dbda4a08a81..03da36dc6d9c9 100644 +--- a/arch/microblaze/kernel/cpu/cpuinfo-static.c ++++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c +@@ -18,7 +18,7 @@ static const char family_string[] = CONFIG_XILINX_MICROBLAZE0_FAMILY; + static const char cpu_ver_string[] = CONFIG_XILINX_MICROBLAZE0_HW_VER; + + #define err_printk(x) \ +- early_printk("ERROR: Microblaze " x "-different for kernel and DTS\n"); ++ pr_err("ERROR: Microblaze " x "-different for kernel and DTS\n"); + + void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu) + { +-- +2.43.0 + diff --git a/queue-6.1/microblaze-remove-gcc-flag-for-non-existing-early_pr.patch b/queue-6.1/microblaze-remove-gcc-flag-for-non-existing-early_pr.patch new file mode 100644 index 00000000000..ee805a670f3 --- /dev/null +++ b/queue-6.1/microblaze-remove-gcc-flag-for-non-existing-early_pr.patch @@ -0,0 +1,36 @@ +From 4574797a32b1f42a30591f3bdf77ddb7b2ebe18c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 11 Apr 2024 10:21:44 +0200 +Subject: microblaze: Remove gcc flag for non existing early_printk.c file + +From: Michal Simek + +[ Upstream commit edc66cf0c4164aa3daf6cc55e970bb94383a6a57 ] + +early_printk support for removed long time ago but compilation flag for +ftrace still points to already removed file that's why remove that line +too. + +Fixes: 96f0e6fcc9ad ("microblaze: remove redundant early_printk support") +Signed-off-by: Michal Simek +Link: https://lore.kernel.org/r/5493467419cd2510a32854e2807bcd263de981a0.1712823702.git.michal.simek@amd.com +Signed-off-by: Sasha Levin +--- + arch/microblaze/kernel/Makefile | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile +index 4393bee64eaf8..85c4d29ef43e9 100644 +--- a/arch/microblaze/kernel/Makefile ++++ b/arch/microblaze/kernel/Makefile +@@ -7,7 +7,6 @@ ifdef CONFIG_FUNCTION_TRACER + # Do not trace early boot code and low level code + CFLAGS_REMOVE_timer.o = -pg + CFLAGS_REMOVE_intc.o = -pg +-CFLAGS_REMOVE_early_printk.o = -pg + CFLAGS_REMOVE_ftrace.o = -pg + CFLAGS_REMOVE_process.o = -pg + endif +-- +2.43.0 + diff --git a/queue-6.1/ovl-remove-upper-umask-handling-from-ovl_create_uppe.patch b/queue-6.1/ovl-remove-upper-umask-handling-from-ovl_create_uppe.patch new file mode 100644 index 00000000000..39d89a68d32 --- /dev/null +++ b/queue-6.1/ovl-remove-upper-umask-handling-from-ovl_create_uppe.patch @@ -0,0 +1,39 @@ +From 2df5f2af50bcd766534a6ba68149dbd486b5b4f8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 May 2024 20:35:57 +0200 +Subject: ovl: remove upper umask handling from ovl_create_upper() + +From: Miklos Szeredi + +[ Upstream commit 096802748ea1dea8b476938e0a8dc16f4bd2f1ad ] + +This is already done by vfs_prepare_mode() when creating the upper object +by vfs_create(), vfs_mkdir() and vfs_mknod(). + +No regressions have been observed in xfstests run with posix acls turned +off for the upper filesystem. + +Fixes: 1639a49ccdce ("fs: move S_ISGID stripping into the vfs_*() helpers") +Signed-off-by: Miklos Szeredi +Signed-off-by: Sasha Levin +--- + fs/overlayfs/dir.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c +index 5339ff08bd0f4..582d4bd50a1fb 100644 +--- a/fs/overlayfs/dir.c ++++ b/fs/overlayfs/dir.c +@@ -327,9 +327,6 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode, + struct dentry *newdentry; + int err; + +- if (!attr->hardlink && !IS_POSIXACL(udir)) +- attr->mode &= ~current_umask(); +- + inode_lock_nested(udir, I_MUTEX_PARENT); + newdentry = ovl_create_real(ofs, udir, + ovl_lookup_upper(ofs, dentry->d_name.name, +-- +2.43.0 + diff --git a/queue-6.1/pci-edr-align-edr_port_dpc_enable_dsm-with-pci-firmw.patch b/queue-6.1/pci-edr-align-edr_port_dpc_enable_dsm-with-pci-firmw.patch new file mode 100644 index 00000000000..ee89d58714d --- /dev/null +++ b/queue-6.1/pci-edr-align-edr_port_dpc_enable_dsm-with-pci-firmw.patch @@ -0,0 +1,71 @@ +From 9e2501bace5e2f95605a5f8a51e5a5d0acd7762d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 May 2024 02:25:43 +0000 +Subject: PCI/EDR: Align EDR_PORT_DPC_ENABLE_DSM with PCI Firmware r3.3 + +From: Kuppuswamy Sathyanarayanan + +[ Upstream commit f24ba846133d0edec785ac6430d4daf6e9c93a09 ] + +The "Downstream Port Containment related Enhancements" ECN of Jan 28, 2019 +(document 12888 below), defined the EDR_PORT_DPC_ENABLE_DSM function with +Revision ID 5 with Arg3 being an integer. But when the ECN was integrated +into PCI Firmware r3.3, sec 4.6.12, it was defined as Revision ID 6 with +Arg3 being a package containing an integer. + +The implementation in acpi_enable_dpc() supplies a package as Arg3 (arg4 in +the code), but it previously specified Revision ID 5. Align this with PCI +Firmware r3.3 by using Revision ID 6. + +If firmware implemented per the ECN, its Revision 5 function would receive +a package as Arg3 when it expects an integer, so acpi_enable_dpc() would +likely fail. If such firmware exists and lacks a Revision 6 function that +expects a package, we may have to add support for Revision 5. + +Link: https://lore.kernel.org/r/20240501022543.1626025-1-sathyanarayanan.kuppuswamy@linux.intel.com +Link: https://members.pcisig.com/wg/PCI-SIG/document/12888 +Fixes: ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support") +Signed-off-by: Kuppuswamy Sathyanarayanan +[bhelgaas: split into two patches, update commit log] +Signed-off-by: Bjorn Helgaas +Tested-by: Satish Thatchanamurthy # one platform +Signed-off-by: Sasha Levin +--- + drivers/pci/pcie/edr.c | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +diff --git a/drivers/pci/pcie/edr.c b/drivers/pci/pcie/edr.c +index 87734e4c3c204..5b5a502363c00 100644 +--- a/drivers/pci/pcie/edr.c ++++ b/drivers/pci/pcie/edr.c +@@ -32,10 +32,10 @@ static int acpi_enable_dpc(struct pci_dev *pdev) + int status = 0; + + /* +- * Behavior when calling unsupported _DSM functions is undefined, +- * so check whether EDR_PORT_DPC_ENABLE_DSM is supported. ++ * Per PCI Firmware r3.3, sec 4.6.12, EDR_PORT_DPC_ENABLE_DSM is ++ * optional. Return success if it's not implemented. + */ +- if (!acpi_check_dsm(adev->handle, &pci_acpi_dsm_guid, 5, ++ if (!acpi_check_dsm(adev->handle, &pci_acpi_dsm_guid, 6, + 1ULL << EDR_PORT_DPC_ENABLE_DSM)) + return 0; + +@@ -46,12 +46,7 @@ static int acpi_enable_dpc(struct pci_dev *pdev) + argv4.package.count = 1; + argv4.package.elements = &req; + +- /* +- * Per Downstream Port Containment Related Enhancements ECN to PCI +- * Firmware Specification r3.2, sec 4.6.12, EDR_PORT_DPC_ENABLE_DSM is +- * optional. Return success if it's not implemented. +- */ +- obj = acpi_evaluate_dsm(adev->handle, &pci_acpi_dsm_guid, 5, ++ obj = acpi_evaluate_dsm(adev->handle, &pci_acpi_dsm_guid, 6, + EDR_PORT_DPC_ENABLE_DSM, &argv4); + if (!obj) + return 0; +-- +2.43.0 + diff --git a/queue-6.1/pci-edr-align-edr_port_locate_dsm-with-pci-firmware-.patch b/queue-6.1/pci-edr-align-edr_port_locate_dsm-with-pci-firmware-.patch new file mode 100644 index 00000000000..f8a4cf4d9f4 --- /dev/null +++ b/queue-6.1/pci-edr-align-edr_port_locate_dsm-with-pci-firmware-.patch @@ -0,0 +1,65 @@ +From f8ef2bfb96e1392a48ea4ebbc2f1ffdfd414a383 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 May 2024 14:31:38 -0500 +Subject: PCI/EDR: Align EDR_PORT_LOCATE_DSM with PCI Firmware r3.3 + +From: Kuppuswamy Sathyanarayanan + +[ Upstream commit e2e78a294a8a863898b781dbcf90e087eda3155d ] + +The "Downstream Port Containment related Enhancements" ECN of Jan 28, 2019 +(document 12888 below), defined the EDR_PORT_LOCATE_DSM function with +Revision ID 5 with a return value encoding (Bits 2:0 = Function, Bits 7:3 = +Device, Bits 15:8 = Bus). When the ECN was integrated into PCI Firmware +r3.3, sec 4.6.13, Bit 31 was added to indicate success or failure. + +Check Bit 31 for failure in acpi_dpc_port_get(). + +Link: https://lore.kernel.org/r/20240501022543.1626025-1-sathyanarayanan.kuppuswamy@linux.intel.com +Link: https://members.pcisig.com/wg/PCI-SIG/document/12888 +Fixes: ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support") +Signed-off-by: Kuppuswamy Sathyanarayanan +[bhelgaas: split into two patches, update commit log] +Signed-off-by: Bjorn Helgaas +Tested-by: Satish Thatchanamurthy # one platform +Signed-off-by: Sasha Levin +--- + drivers/pci/pcie/edr.c | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/drivers/pci/pcie/edr.c b/drivers/pci/pcie/edr.c +index 5b5a502363c00..35210007602c5 100644 +--- a/drivers/pci/pcie/edr.c ++++ b/drivers/pci/pcie/edr.c +@@ -80,8 +80,9 @@ static struct pci_dev *acpi_dpc_port_get(struct pci_dev *pdev) + u16 port; + + /* +- * Behavior when calling unsupported _DSM functions is undefined, +- * so check whether EDR_PORT_DPC_ENABLE_DSM is supported. ++ * If EDR_PORT_LOCATE_DSM is not implemented under the target of ++ * EDR, the target is the port that experienced the containment ++ * event (PCI Firmware r3.3, sec 4.6.13). + */ + if (!acpi_check_dsm(adev->handle, &pci_acpi_dsm_guid, 5, + 1ULL << EDR_PORT_LOCATE_DSM)) +@@ -98,6 +99,16 @@ static struct pci_dev *acpi_dpc_port_get(struct pci_dev *pdev) + return NULL; + } + ++ /* ++ * Bit 31 represents the success/failure of the operation. If bit ++ * 31 is set, the operation failed. ++ */ ++ if (obj->integer.value & BIT(31)) { ++ ACPI_FREE(obj); ++ pci_err(pdev, "Locate Port _DSM failed\n"); ++ return NULL; ++ } ++ + /* + * Firmware returns DPC port BDF details in following format: + * 15:8 = bus +-- +2.43.0 + diff --git a/queue-6.1/pci-tegra194-fix-probe-path-for-endpoint-mode.patch b/queue-6.1/pci-tegra194-fix-probe-path-for-endpoint-mode.patch new file mode 100644 index 00000000000..cc04775d20a --- /dev/null +++ b/queue-6.1/pci-tegra194-fix-probe-path-for-endpoint-mode.patch @@ -0,0 +1,48 @@ +From fc84d710c57303fc4d5a793f31a88ae55ce99e38 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 8 Apr 2024 15:00:53 +0530 +Subject: PCI: tegra194: Fix probe path for Endpoint mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Vidya Sagar + +[ Upstream commit 19326006a21da26532d982254677c892dae8f29b ] + +Tegra194 PCIe probe path is taking failure path in success case for +Endpoint mode. Return success from the switch case instead of going +into the failure path. + +Fixes: c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint mode in Tegra194") +Link: https://lore.kernel.org/linux-pci/20240408093053.3948634-1-vidyas@nvidia.com +Signed-off-by: Vidya Sagar +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: Jon Hunter +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/dwc/pcie-tegra194.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c +index 5d1ae2706f6ea..0839454fe4994 100644 +--- a/drivers/pci/controller/dwc/pcie-tegra194.c ++++ b/drivers/pci/controller/dwc/pcie-tegra194.c +@@ -2250,11 +2250,14 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev) + ret = tegra_pcie_config_ep(pcie, pdev); + if (ret < 0) + goto fail; ++ else ++ return 0; + break; + + default: + dev_err(dev, "Invalid PCIe device type %d\n", + pcie->of_data->mode); ++ ret = -EINVAL; + } + + fail: +-- +2.43.0 + diff --git a/queue-6.1/perf-annotate-get-rid-of-duplicate-group-option-item.patch b/queue-6.1/perf-annotate-get-rid-of-duplicate-group-option-item.patch new file mode 100644 index 00000000000..74dfb050653 --- /dev/null +++ b/queue-6.1/perf-annotate-get-rid-of-duplicate-group-option-item.patch @@ -0,0 +1,48 @@ +From c52d36217b07af1872d87df19c07e915bdcf4b4c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 22 Mar 2024 15:43:12 -0700 +Subject: perf annotate: Get rid of duplicate --group option item + +From: Namhyung Kim + +[ Upstream commit 374af9f1f06b5e991c810d2e4983d6f58df32136 ] + +The options array in cmd_annotate() has duplicate --group options. It +only needs one and let's get rid of the other. + + $ perf annotate -h 2>&1 | grep group + --group Show event group information together + --group Show event group information together + +Fixes: 7ebaf4890f63eb90 ("perf annotate: Support '--group' option") +Reviewed-by: Kan Liang +Signed-off-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jin Yao +Cc: Jiri Olsa +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20240322224313.423181-1-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-annotate.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c +index 517d928c00e3f..21d7582608735 100644 +--- a/tools/perf/builtin-annotate.c ++++ b/tools/perf/builtin-annotate.c +@@ -571,8 +571,6 @@ int cmd_annotate(int argc, const char **argv) + "Enable symbol demangling"), + OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, + "Enable kernel symbol demangling"), +- OPT_BOOLEAN(0, "group", &symbol_conf.event_group, +- "Show event group information together"), + OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, + "Show a column with the sum of periods"), + OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, +-- +2.43.0 + diff --git a/queue-6.1/perf-bench-internals-inject-build-id-fix-trap-divide.patch b/queue-6.1/perf-bench-internals-inject-build-id-fix-trap-divide.patch new file mode 100644 index 00000000000..a3a2182a0f7 --- /dev/null +++ b/queue-6.1/perf-bench-internals-inject-build-id-fix-trap-divide.patch @@ -0,0 +1,55 @@ +From b42df468675e8526e3c768b2256ad304d35f28d1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 May 2024 14:50:26 +0800 +Subject: perf bench internals inject-build-id: Fix trap divide when collecting + just one DSO + +From: He Zhe + +[ Upstream commit d9180e23fbfa3875424d3a6b28b71b072862a52a ] + +'perf bench internals inject-build-id' suffers from the following error when +only one DSO is collected. + + # perf bench internals inject-build-id -v + Collected 1 DSOs + traps: internals-injec[2305] trap divide error + ip:557566ba6394 sp:7ffd4de97fe0 error:0 in perf[557566b2a000+23d000] + Build-id injection benchmark + Iteration #1 + Floating point exception + +This patch removes the unnecessary minus one from the divisor which also +corrects the randomization range. + +Signed-off-by: He Zhe +Fixes: 0bf02a0d80427f26 ("perf bench: Add build-id injection benchmark") +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Jiri Olsa +Cc: Mark Rutland +Cc: Namhyung Kim +Link: https://lore.kernel.org/r/20240507065026.2652929-1-zhe.he@windriver.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/bench/inject-buildid.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/bench/inject-buildid.c b/tools/perf/bench/inject-buildid.c +index 17672790f1231..d1672be702f3b 100644 +--- a/tools/perf/bench/inject-buildid.c ++++ b/tools/perf/bench/inject-buildid.c +@@ -361,7 +361,7 @@ static int inject_build_id(struct bench_data *data, u64 *max_rss) + return -1; + + for (i = 0; i < nr_mmaps; i++) { +- int idx = rand() % (nr_dsos - 1); ++ int idx = rand() % nr_dsos; + struct bench_dso *dso = &dsos[idx]; + u64 timestamp = rand() % 1000000; + +-- +2.43.0 + diff --git a/queue-6.1/perf-daemon-fix-file-leak-in-daemon_session__control.patch b/queue-6.1/perf-daemon-fix-file-leak-in-daemon_session__control.patch new file mode 100644 index 00000000000..1e4e69557de --- /dev/null +++ b/queue-6.1/perf-daemon-fix-file-leak-in-daemon_session__control.patch @@ -0,0 +1,59 @@ +From e35140ee5b35ac85670e73de894f2ae3ac021751 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 May 2024 17:34:24 -0700 +Subject: perf daemon: Fix file leak in daemon_session__control + +From: Samasth Norway Ananda + +[ Upstream commit 09541603462c399c7408d50295db99b4b8042eaa ] + +The open() function returns -1 on error. + +The 'control' and 'ack' file descriptors are both initialized with +open() and further validated with 'if' statement. + +'if (!control)' would evaluate to 'true' if returned value on error were +'0' but it is actually '-1'. + +Fixes: edcaa47958c7438b ("perf daemon: Add 'ping' command") +Signed-off-by: Samasth Norway Ananda +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20240510003424.2016914-1-samasth.norway.ananda@oracle.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-daemon.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c +index 6cb3f6cc36d0a..35942256582ab 100644 +--- a/tools/perf/builtin-daemon.c ++++ b/tools/perf/builtin-daemon.c +@@ -523,7 +523,7 @@ static int daemon_session__control(struct daemon_session *session, + session->base, SESSION_CONTROL); + + control = open(control_path, O_WRONLY|O_NONBLOCK); +- if (!control) ++ if (control < 0) + return -1; + + if (do_ack) { +@@ -532,7 +532,7 @@ static int daemon_session__control(struct daemon_session *session, + session->base, SESSION_ACK); + + ack = open(ack_path, O_RDONLY, O_NONBLOCK); +- if (!ack) { ++ if (ack < 0) { + close(control); + return -1; + } +-- +2.43.0 + diff --git a/queue-6.1/perf-docs-document-bpf-event-modifier.patch b/queue-6.1/perf-docs-document-bpf-event-modifier.patch new file mode 100644 index 00000000000..e9d99493ae8 --- /dev/null +++ b/queue-6.1/perf-docs-document-bpf-event-modifier.patch @@ -0,0 +1,48 @@ +From 08d1b42eaf1c21d4dce0628748ffa01508d79330 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 16 Apr 2024 10:00:13 -0700 +Subject: perf docs: Document bpf event modifier + +From: Ian Rogers + +[ Upstream commit eb4d27cf9aef3e6c9bcaf8fa1a1cadc2433d847b ] + +Document that 'b' is used as a modifier to make an event use a BPF +counter. + +Fixes: 01bd8efcec444468 ("perf stat: Introduce ':b' modifier") +Signed-off-by: Ian Rogers +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Athira Rajeev +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Ravi Bangoria +Cc: Song Liu +Cc: Thomas Richter +Link: https://lore.kernel.org/r/20240416170014.985191-1-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/Documentation/perf-list.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt +index 57384a97c04f4..3dae696b748a6 100644 +--- a/tools/perf/Documentation/perf-list.txt ++++ b/tools/perf/Documentation/perf-list.txt +@@ -63,6 +63,7 @@ counted. The following modifiers exist: + D - pin the event to the PMU + W - group is weak and will fallback to non-group if not schedulable, + e - group or event are exclusive and do not share the PMU ++ b - use BPF aggregration (see perf stat --bpf-counters) + + The 'p' modifier can be used for specifying how precise the instruction + address should be. The 'p' modifier can be specified multiple times: +-- +2.43.0 + diff --git a/queue-6.1/perf-intel-pt-fix-unassigned-instruction-op-discover.patch b/queue-6.1/perf-intel-pt-fix-unassigned-instruction-op-discover.patch new file mode 100644 index 00000000000..615e6b08974 --- /dev/null +++ b/queue-6.1/perf-intel-pt-fix-unassigned-instruction-op-discover.patch @@ -0,0 +1,73 @@ +From 170ea0b0d797f0ace93093fbe935a78a4891ade0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 Mar 2024 10:32:23 +0200 +Subject: perf intel-pt: Fix unassigned instruction op (discovered by + MemorySanitizer) + +From: Adrian Hunter + +[ Upstream commit e101a05f79fd4ee3e89d2f3fb716493c33a33708 ] + +MemorySanitizer discovered instances where the instruction op value was +not assigned.: + + WARNING: MemorySanitizer: use-of-uninitialized-value + #0 0x5581c00a76b3 in intel_pt_sample_flags tools/perf/util/intel-pt.c:1527:17 + Uninitialized value was stored to memory at + #0 0x5581c005ddf8 in intel_pt_walk_insn tools/perf/util/intel-pt-decoder/intel-pt-decoder.c:1256:25 + +The op value is used to set branch flags for branch instructions +encountered when walking the code, so fix by setting op to +INTEL_PT_OP_OTHER in other cases. + +Fixes: 4c761d805bb2d2ea ("perf intel-pt: Fix intel_pt_fup_event() assumptions about setting state type") +Reported-by: Ian Rogers +Signed-off-by: Adrian Hunter +Tested-by: Ian Rogers +Cc: Jiri Olsa +Cc: Namhyung Kim +Closes: https://lore.kernel.org/linux-perf-users/20240320162619.1272015-1-irogers@google.com/ +Link: https://lore.kernel.org/r/20240326083223.10883-1-adrian.hunter@intel.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 ++ + tools/perf/util/intel-pt.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +index 7145c5890de02..178baa1e69493 100644 +--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c ++++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +@@ -1319,6 +1319,8 @@ static bool intel_pt_fup_event(struct intel_pt_decoder *decoder, bool no_tip) + bool ret = false; + + decoder->state.type &= ~INTEL_PT_BRANCH; ++ decoder->state.insn_op = INTEL_PT_OP_OTHER; ++ decoder->state.insn_len = 0; + + if (decoder->set_fup_cfe_ip || decoder->set_fup_cfe) { + bool ip = decoder->set_fup_cfe_ip; +diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c +index 6fb64c58b408b..bd09af447eb0d 100644 +--- a/tools/perf/util/intel-pt.c ++++ b/tools/perf/util/intel-pt.c +@@ -755,6 +755,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn, + bool nr; + + intel_pt_insn->length = 0; ++ intel_pt_insn->op = INTEL_PT_OP_OTHER; + + if (to_ip && *ip == to_ip) + goto out_no_cache; +@@ -876,6 +877,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn, + + if (to_ip && *ip == to_ip) { + intel_pt_insn->length = 0; ++ intel_pt_insn->op = INTEL_PT_OP_OTHER; + goto out_no_cache; + } + +-- +2.43.0 + diff --git a/queue-6.1/perf-probe-add-missing-libgen.h-header-needed-for-us.patch b/queue-6.1/perf-probe-add-missing-libgen.h-header-needed-for-us.patch new file mode 100644 index 00000000000..e6316eb0166 --- /dev/null +++ b/queue-6.1/perf-probe-add-missing-libgen.h-header-needed-for-us.patch @@ -0,0 +1,53 @@ +From bf71abf181eb342598c925f60cd31d93d3c26db8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Mar 2024 11:13:30 -0300 +Subject: perf probe: Add missing libgen.h header needed for using basename() + +From: Arnaldo Carvalho de Melo + +[ Upstream commit 581037151910126a7934e369e4b6ac70eda9a703 ] + +This prototype is obtained indirectly, by luck, from some other header +in probe-event.c in most systems, but recently exploded on alpine:edge: + + 8 13.39 alpine:edge : FAIL gcc version 13.2.1 20240309 (Alpine 13.2.1_git20240309) + util/probe-event.c: In function 'convert_exec_to_group': + util/probe-event.c:225:16: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration] + 225 | ptr1 = basename(exec_copy); + | ^~~~~~~~ + util/probe-event.c:225:14: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion] + 225 | ptr1 = basename(exec_copy); + | ^ + cc1: all warnings being treated as errors + make[3]: *** [/git/perf-6.8.0/tools/build/Makefile.build:158: util] Error 2 + +Fix it by adding the libgen.h header where basename() is prototyped. + +Fixes: fb7345bbf7fad9bf ("perf probe: Support basic dwarf-based operations on uprobe events") +Cc: Masami Hiramatsu +Cc: Adrian Hunter +Cc: Ian Rogers +Cc: Jiri Olsa +Cc: Namhyung Kim +Link: https://lore.kernel.org/lkml/ +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/probe-event.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c +index 0c24bc7afbca2..66ff8420ce2b0 100644 +--- a/tools/perf/util/probe-event.c ++++ b/tools/perf/util/probe-event.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.43.0 + diff --git a/queue-6.1/perf-record-delete-session-after-stopping-sideband-t.patch b/queue-6.1/perf-record-delete-session-after-stopping-sideband-t.patch new file mode 100644 index 00000000000..0a08111b68a --- /dev/null +++ b/queue-6.1/perf-record-delete-session-after-stopping-sideband-t.patch @@ -0,0 +1,83 @@ +From 2477b70fd137ae0f1fe5349fda368f0c394d31a7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Feb 2024 23:46:36 -0800 +Subject: perf record: Delete session after stopping sideband thread + +From: Ian Rogers + +[ Upstream commit 88ce0106a1f603bf360cb397e8fe293f8298fabb ] + +The session has a header in it which contains a perf env with +bpf_progs. The bpf_progs are accessed by the sideband thread and so +the sideband thread must be stopped before the session is deleted, to +avoid a use after free. This error was detected by AddressSanitizer +in the following: + + ==2054673==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d000161e00 at pc 0x55769289de54 bp 0x7f9df36d4ab0 sp 0x7f9df36d4aa8 + READ of size 8 at 0x61d000161e00 thread T1 + #0 0x55769289de53 in __perf_env__insert_bpf_prog_info util/env.c:42 + #1 0x55769289dbb1 in perf_env__insert_bpf_prog_info util/env.c:29 + #2 0x557692bbae29 in perf_env__add_bpf_info util/bpf-event.c:483 + #3 0x557692bbb01a in bpf_event__sb_cb util/bpf-event.c:512 + #4 0x5576928b75f4 in perf_evlist__poll_thread util/sideband_evlist.c:68 + #5 0x7f9df96a63eb in start_thread nptl/pthread_create.c:444 + #6 0x7f9df9726a4b in clone3 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81 + + 0x61d000161e00 is located 384 bytes inside of 2136-byte region [0x61d000161c80,0x61d0001624d8) + freed by thread T0 here: + #0 0x7f9dfa6d7288 in __interceptor_free libsanitizer/asan/asan_malloc_linux.cpp:52 + #1 0x557692978d50 in perf_session__delete util/session.c:319 + #2 0x557692673959 in __cmd_record tools/perf/builtin-record.c:2884 + #3 0x55769267a9f0 in cmd_record tools/perf/builtin-record.c:4259 + #4 0x55769286710c in run_builtin tools/perf/perf.c:349 + #5 0x557692867678 in handle_internal_command tools/perf/perf.c:402 + #6 0x557692867a40 in run_argv tools/perf/perf.c:446 + #7 0x557692867fae in main tools/perf/perf.c:562 + #8 0x7f9df96456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 + +Fixes: 657ee5531903339b ("perf evlist: Introduce side band thread") +Signed-off-by: Ian Rogers +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Athira Rajeev +Cc: Christian Brauner +Cc: Disha Goel +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kajol Jain +Cc: Kan Liang +Cc: K Prateek Nayak +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Song Liu +Cc: Tim Chen +Cc: Yicong Yang +Link: https://lore.kernel.org/r/20240301074639.2260708-1-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-record.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c +index b9b0fda8374e2..ee3a5c4b8251e 100644 +--- a/tools/perf/builtin-record.c ++++ b/tools/perf/builtin-record.c +@@ -2843,10 +2843,10 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) + } + #endif + zstd_fini(&session->zstd_data); +- perf_session__delete(session); +- + if (!opts->no_bpf_event) + evlist__stop_sb_thread(rec->sb_evlist); ++ ++ perf_session__delete(session); + return status; + } + +-- +2.43.0 + diff --git a/queue-6.1/perf-report-avoid-segv-in-report__setup_sample_type.patch b/queue-6.1/perf-report-avoid-segv-in-report__setup_sample_type.patch new file mode 100644 index 00000000000..0bdc2e8a0ea --- /dev/null +++ b/queue-6.1/perf-report-avoid-segv-in-report__setup_sample_type.patch @@ -0,0 +1,47 @@ +From 5d790892f5300bdb7899695673e2171b8bd58da0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 May 2024 20:53:00 -0700 +Subject: perf report: Avoid SEGV in report__setup_sample_type() + +From: Ian Rogers + +[ Upstream commit 45b4f402a6b782352c4bafcff682bfb01da9ca05 ] + +In some cases evsel->name is lazily initialized in evsel__name(). If not +initialized passing NULL to strstr() leads to a SEGV. + +Fixes: ccb17caecfbd542f ("perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event") +Signed-off-by: Ian Rogers +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Leo Yan +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20240508035301.1554434-4-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-report.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c +index b6d77d3da64f6..155f119b3db5c 100644 +--- a/tools/perf/builtin-report.c ++++ b/tools/perf/builtin-report.c +@@ -416,7 +416,7 @@ static int report__setup_sample_type(struct report *rep) + * compatibility, set the bit if it's an old perf data file. + */ + evlist__for_each_entry(session->evlist, evsel) { +- if (strstr(evsel->name, "arm_spe") && ++ if (strstr(evsel__name(evsel), "arm_spe") && + !(sample_type & PERF_SAMPLE_DATA_SRC)) { + evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC; + sample_type |= PERF_SAMPLE_DATA_SRC; +-- +2.43.0 + diff --git a/queue-6.1/perf-stat-don-t-display-metric-header-for-non-leader.patch b/queue-6.1/perf-stat-don-t-display-metric-header-for-non-leader.patch new file mode 100644 index 00000000000..c4445f4511a --- /dev/null +++ b/queue-6.1/perf-stat-don-t-display-metric-header-for-non-leader.patch @@ -0,0 +1,90 @@ +From 08a9d6e0d222d95a6f7858d2d6c11d6867d35ddd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 May 2024 22:13:09 -0700 +Subject: perf stat: Don't display metric header for non-leader uncore events + +From: Ian Rogers + +[ Upstream commit 193a9e30207f54777ff42d0d8be8389edc522277 ] + +On an Intel tigerlake laptop a metric like: + + { + "BriefDescription": "Test", + "MetricExpr": "imc_free_running@data_read@ + imc_free_running@data_write@", + "MetricGroup": "Test", + "MetricName": "Test", + "ScaleUnit": "6.103515625e-5MiB" + }, + +Will have 4 events: + + uncore_imc_free_running_0/data_read/ + uncore_imc_free_running_0/data_write/ + uncore_imc_free_running_1/data_read/ + uncore_imc_free_running_1/data_write/ + +If aggregration is disabled with metric-only 2 column headers are +needed: + + $ perf stat -M test --metric-only -A -a sleep 1 + + Performance counter stats for 'system wide': + + MiB Test MiB Test + CPU0 1821.0 1820.5 + +But when not, the counts aggregated in the metric leader and only 1 +column should be shown: + + $ perf stat -M test --metric-only -a sleep 1 + Performance counter stats for 'system wide': + + MiB Test + 5909.4 + + 1.001258915 seconds time elapsed + +Achieve this by skipping events that aren't metric leaders when +printing column headers and aggregation isn't disabled. + +The bug is long standing, the fixes tag is set to a refactor as that +is as far back as is reasonable to backport. + +Fixes: 088519f318be3a41 ("perf stat: Move the display functions to stat-display.c") +Signed-off-by: Ian Rogers +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Kaige Ye +Cc: Kan Liang +Cc: K Prateek Nayak +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Yicong Yang +Link: https://lore.kernel.org/r/20240510051309.2452468-1-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/stat-display.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c +index ef9a3df459657..9053db0dc00a1 100644 +--- a/tools/perf/util/stat-display.c ++++ b/tools/perf/util/stat-display.c +@@ -1162,6 +1162,9 @@ static void print_metric_headers(struct perf_stat_config *config, + + /* Print metrics headers only */ + evlist__for_each_entry(evlist, counter) { ++ if (config->aggr_mode != AGGR_NONE && counter->metric_leader != counter) ++ continue; ++ + os.evsel = counter; + + if (!first && config->json_output) +-- +2.43.0 + diff --git a/queue-6.1/perf-test-add-brstack-test-workload.patch b/queue-6.1/perf-test-add-brstack-test-workload.patch new file mode 100644 index 00000000000..64f6681db20 --- /dev/null +++ b/queue-6.1/perf-test-add-brstack-test-workload.patch @@ -0,0 +1,129 @@ +From b3cf21e52543bcc049155a6d165640b2e32462a1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 16 Nov 2022 15:38:51 -0800 +Subject: perf test: Add 'brstack' test workload + +From: Namhyung Kim + +[ Upstream commit a104f0ea99d846df19aad8a5476eb9bc39fa42ca ] + +The brstack is to run different kinds of branches repeatedly. This is +necessary for brstack test case to verify if it has correct branch info. + + $ perf test -w brstack + +I renamed the internal functions to have brstack_ prefix as it's too +generic name. + +Add a -U_FORTIFY_SOURCE to the brstack CFLAGS, as the main perf flags +set it and it requires building with optimization, and this new test has +a -O0. + +Signed-off-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Athira Jajeev +Cc: German Gomez +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Leo Yan +Cc: Peter Zijlstra +Cc: Zhengjun Xing +Link: https://lore.kernel.org/r/20221116233854.1596378-10-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1") +Signed-off-by: Sasha Levin +--- + tools/perf/tests/builtin-test.c | 1 + + tools/perf/tests/tests.h | 1 + + tools/perf/tests/workloads/Build | 2 ++ + tools/perf/tests/workloads/brstack.c | 40 ++++++++++++++++++++++++++++ + 4 files changed, 44 insertions(+) + create mode 100644 tools/perf/tests/workloads/brstack.c + +diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c +index 9acb7a93eeb97..69fa56939309b 100644 +--- a/tools/perf/tests/builtin-test.c ++++ b/tools/perf/tests/builtin-test.c +@@ -123,6 +123,7 @@ static struct test_workload *workloads[] = { + &workload__thloop, + &workload__leafloop, + &workload__sqrtloop, ++ &workload__brstack, + }; + + static int num_subtests(const struct test_suite *t) +diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h +index 18c40319e67c7..dc96f59cac2ef 100644 +--- a/tools/perf/tests/tests.h ++++ b/tools/perf/tests/tests.h +@@ -204,5 +204,6 @@ DECLARE_WORKLOAD(noploop); + DECLARE_WORKLOAD(thloop); + DECLARE_WORKLOAD(leafloop); + DECLARE_WORKLOAD(sqrtloop); ++DECLARE_WORKLOAD(brstack); + + #endif /* TESTS_H */ +diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build +index 2312a338f01c0..ae06a5538b171 100644 +--- a/tools/perf/tests/workloads/Build ++++ b/tools/perf/tests/workloads/Build +@@ -4,6 +4,8 @@ perf-y += noploop.o + perf-y += thloop.o + perf-y += leafloop.o + perf-y += sqrtloop.o ++perf-y += brstack.o + + CFLAGS_sqrtloop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE + CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE ++CFLAGS_brstack.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE +diff --git a/tools/perf/tests/workloads/brstack.c b/tools/perf/tests/workloads/brstack.c +new file mode 100644 +index 0000000000000..0b60bd37b9d1a +--- /dev/null ++++ b/tools/perf/tests/workloads/brstack.c +@@ -0,0 +1,40 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#include ++#include "../tests.h" ++ ++#define BENCH_RUNS 999999 ++ ++static volatile int cnt; ++ ++static void brstack_bar(void) { ++} /* return */ ++ ++static void brstack_foo(void) { ++ brstack_bar(); /* call */ ++} /* return */ ++ ++static void brstack_bench(void) { ++ void (*brstack_foo_ind)(void) = brstack_foo; ++ ++ if ((cnt++) % 3) /* branch (cond) */ ++ brstack_foo(); /* call */ ++ brstack_bar(); /* call */ ++ brstack_foo_ind(); /* call (ind) */ ++} ++ ++static int brstack(int argc, const char **argv) ++{ ++ int num_loops = BENCH_RUNS; ++ ++ if (argc > 0) ++ num_loops = atoi(argv[0]); ++ ++ while (1) { ++ if ((cnt++) > num_loops) ++ break; ++ brstack_bench();/* call */ ++ } /* branch (uncond) */ ++ return 0; ++} ++ ++DEFINE_WORKLOAD(brstack); +-- +2.43.0 + diff --git a/queue-6.1/perf-test-add-datasym-test-workload.patch b/queue-6.1/perf-test-add-datasym-test-workload.patch new file mode 100644 index 00000000000..3b17d402346 --- /dev/null +++ b/queue-6.1/perf-test-add-datasym-test-workload.patch @@ -0,0 +1,117 @@ +From c4f92720c3ac44becab1cf2f8c06b1006f8ed6d5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 16 Nov 2022 15:38:53 -0800 +Subject: perf test: Add 'datasym' test workload + +From: Namhyung Kim + +[ Upstream commit 3dfc01fe9d12a1e832f49deab37279faa8a9ebc8 ] + +The datasym workload is to check if perf mem command gets the data +addresses precisely. This is needed for data symbol test. + + $ perf test -w datasym + +I had to keep the buf1 in the data section, otherwise it could end +up in the BSS and was mmaped as a separate //anon region, then it +was not symbolized at all. It needs to be fixed separately. + +Committer notes: + +Add a -U _FORTIFY_SOURCE to the datasym CFLAGS, as the main perf flags +set it and it requires building with optimization, and this new test has +a -O0. + +Signed-off-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Athira Jajeev +Cc: German Gomez +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Leo Yan +Cc: Peter Zijlstra +Cc: Zhengjun Xing +Link: https://lore.kernel.org/r/20221116233854.1596378-12-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1") +Signed-off-by: Sasha Levin +--- + tools/perf/tests/builtin-test.c | 1 + + tools/perf/tests/tests.h | 1 + + tools/perf/tests/workloads/Build | 2 ++ + tools/perf/tests/workloads/datasym.c | 24 ++++++++++++++++++++++++ + 4 files changed, 28 insertions(+) + create mode 100644 tools/perf/tests/workloads/datasym.c + +diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c +index 69fa56939309b..4c6ae59a4dfd7 100644 +--- a/tools/perf/tests/builtin-test.c ++++ b/tools/perf/tests/builtin-test.c +@@ -124,6 +124,7 @@ static struct test_workload *workloads[] = { + &workload__leafloop, + &workload__sqrtloop, + &workload__brstack, ++ &workload__datasym, + }; + + static int num_subtests(const struct test_suite *t) +diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h +index dc96f59cac2ef..e15f24cfc9094 100644 +--- a/tools/perf/tests/tests.h ++++ b/tools/perf/tests/tests.h +@@ -205,5 +205,6 @@ DECLARE_WORKLOAD(thloop); + DECLARE_WORKLOAD(leafloop); + DECLARE_WORKLOAD(sqrtloop); + DECLARE_WORKLOAD(brstack); ++DECLARE_WORKLOAD(datasym); + + #endif /* TESTS_H */ +diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build +index ae06a5538b171..a1f34d5861e36 100644 +--- a/tools/perf/tests/workloads/Build ++++ b/tools/perf/tests/workloads/Build +@@ -5,7 +5,9 @@ perf-y += thloop.o + perf-y += leafloop.o + perf-y += sqrtloop.o + perf-y += brstack.o ++perf-y += datasym.o + + CFLAGS_sqrtloop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE + CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE + CFLAGS_brstack.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE ++CFLAGS_datasym.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE +diff --git a/tools/perf/tests/workloads/datasym.c b/tools/perf/tests/workloads/datasym.c +new file mode 100644 +index 0000000000000..ddd40bc63448a +--- /dev/null ++++ b/tools/perf/tests/workloads/datasym.c +@@ -0,0 +1,24 @@ ++#include ++#include "../tests.h" ++ ++typedef struct _buf { ++ char data1; ++ char reserved[55]; ++ char data2; ++} buf __attribute__((aligned(64))); ++ ++static buf buf1 = { ++ /* to have this in the data section */ ++ .reserved[0] = 1, ++}; ++ ++static int datasym(int argc __maybe_unused, const char **argv __maybe_unused) ++{ ++ for (;;) { ++ buf1.data1++; ++ buf1.data2 += buf1.data1; ++ } ++ return 0; ++} ++ ++DEFINE_WORKLOAD(datasym); +-- +2.43.0 + diff --git a/queue-6.1/perf-test-add-leafloop-test-workload.patch b/queue-6.1/perf-test-add-leafloop-test-workload.patch new file mode 100644 index 00000000000..f52426bfe41 --- /dev/null +++ b/queue-6.1/perf-test-add-leafloop-test-workload.patch @@ -0,0 +1,124 @@ +From 4e0b33b57d1adbe099e94add0630b51737c9c5f5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 16 Nov 2022 15:38:47 -0800 +Subject: perf test: Add 'leafloop' test workload + +From: Namhyung Kim + +[ Upstream commit 41522f7442905814c654dbe2ca7b8d3605c7e0cc ] + +The leafloop workload is to run an infinite loop in the test_leaf +function. This is needed for the ARM fp callgraph test to verify if it +gets the correct callchains. + + $ perf test -w leafloop + +Committer notes: + +Add a: + + -U_FORTIFY_SOURCE + +to the leafloop CFLAGS as the main perf flags set it and it requires +building with optimization, and this new test has a -O0. + +Signed-off-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Athira Jajeev +Cc: German Gomez +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Leo Yan +Cc: Peter Zijlstra +Cc: Zhengjun Xing +Link: https://lore.kernel.org/r/20221116233854.1596378-6-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1") +Signed-off-by: Sasha Levin +--- + tools/perf/tests/builtin-test.c | 1 + + tools/perf/tests/tests.h | 1 + + tools/perf/tests/workloads/Build | 3 +++ + tools/perf/tests/workloads/leafloop.c | 34 +++++++++++++++++++++++++++ + 4 files changed, 39 insertions(+) + create mode 100644 tools/perf/tests/workloads/leafloop.c + +diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c +index 161f38476e77b..0ed5ac452f6ee 100644 +--- a/tools/perf/tests/builtin-test.c ++++ b/tools/perf/tests/builtin-test.c +@@ -121,6 +121,7 @@ static struct test_suite **tests[] = { + static struct test_workload *workloads[] = { + &workload__noploop, + &workload__thloop, ++ &workload__leafloop, + }; + + static int num_subtests(const struct test_suite *t) +diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h +index e6edfeeadaeba..86804dd6452b7 100644 +--- a/tools/perf/tests/tests.h ++++ b/tools/perf/tests/tests.h +@@ -202,5 +202,6 @@ struct test_workload workload__##work = { \ + /* The list of test workloads */ + DECLARE_WORKLOAD(noploop); + DECLARE_WORKLOAD(thloop); ++DECLARE_WORKLOAD(leafloop); + + #endif /* TESTS_H */ +diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build +index b8964b1099c0e..03dc675a4a7c8 100644 +--- a/tools/perf/tests/workloads/Build ++++ b/tools/perf/tests/workloads/Build +@@ -2,3 +2,6 @@ + + perf-y += noploop.o + perf-y += thloop.o ++perf-y += leafloop.o ++ ++CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE +diff --git a/tools/perf/tests/workloads/leafloop.c b/tools/perf/tests/workloads/leafloop.c +new file mode 100644 +index 0000000000000..1bf5cc97649b0 +--- /dev/null ++++ b/tools/perf/tests/workloads/leafloop.c +@@ -0,0 +1,34 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#include ++#include ++#include "../tests.h" ++ ++/* We want to check these symbols in perf script */ ++noinline void leaf(volatile int b); ++noinline void parent(volatile int b); ++ ++static volatile int a; ++ ++noinline void leaf(volatile int b) ++{ ++ for (;;) ++ a += b; ++} ++ ++noinline void parent(volatile int b) ++{ ++ leaf(b); ++} ++ ++static int leafloop(int argc, const char **argv) ++{ ++ int c = 1; ++ ++ if (argc > 0) ++ c = atoi(argv[0]); ++ ++ parent(c); ++ return 0; ++} ++ ++DEFINE_WORKLOAD(leafloop); +-- +2.43.0 + diff --git a/queue-6.1/perf-test-add-sqrtloop-test-workload.patch b/queue-6.1/perf-test-add-sqrtloop-test-workload.patch new file mode 100644 index 00000000000..62367c42c04 --- /dev/null +++ b/queue-6.1/perf-test-add-sqrtloop-test-workload.patch @@ -0,0 +1,140 @@ +From c02b308dcf7af8fe53112ab20657f556e8e5e01a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 16 Nov 2022 15:38:49 -0800 +Subject: perf test: Add 'sqrtloop' test workload + +From: Namhyung Kim + +[ Upstream commit 39281709a6e2301ac4c6ac7015c7793392ca2dfe ] + +The sqrtloop creates a child process to run an infinite loop calling +sqrt() with rand(). This is needed for ARM SPE fork test. + + $ perf test -w sqrtloop + +It can take an optional argument to specify how long it will run in +seconds (default: 1). + +Committer notes: + +Explicitely ignored the sqrt() return to fix the build on systems where +the compiler complains it isn't being used. + +And added a sqrtloop specific CFLAGS to disable optimizations to make +this a bit more robust wrt dead code elimination. + +Doing that a -U_FORTIFY_SOURCE needs to be added, as -O0 is incompatible +with it. + +Signed-off-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Athira Jajeev +Cc: German Gomez +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Leo Yan +Cc: Peter Zijlstra +Cc: Zhengjun Xing +Link: https://lore.kernel.org/r/20221116233854.1596378-8-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1") +Signed-off-by: Sasha Levin +--- + tools/perf/tests/builtin-test.c | 1 + + tools/perf/tests/tests.h | 1 + + tools/perf/tests/workloads/Build | 2 ++ + tools/perf/tests/workloads/sqrtloop.c | 45 +++++++++++++++++++++++++++ + 4 files changed, 49 insertions(+) + create mode 100644 tools/perf/tests/workloads/sqrtloop.c + +diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c +index 0ed5ac452f6ee..9acb7a93eeb97 100644 +--- a/tools/perf/tests/builtin-test.c ++++ b/tools/perf/tests/builtin-test.c +@@ -122,6 +122,7 @@ static struct test_workload *workloads[] = { + &workload__noploop, + &workload__thloop, + &workload__leafloop, ++ &workload__sqrtloop, + }; + + static int num_subtests(const struct test_suite *t) +diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h +index 86804dd6452b7..18c40319e67c7 100644 +--- a/tools/perf/tests/tests.h ++++ b/tools/perf/tests/tests.h +@@ -203,5 +203,6 @@ struct test_workload workload__##work = { \ + DECLARE_WORKLOAD(noploop); + DECLARE_WORKLOAD(thloop); + DECLARE_WORKLOAD(leafloop); ++DECLARE_WORKLOAD(sqrtloop); + + #endif /* TESTS_H */ +diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build +index 03dc675a4a7c8..2312a338f01c0 100644 +--- a/tools/perf/tests/workloads/Build ++++ b/tools/perf/tests/workloads/Build +@@ -3,5 +3,7 @@ + perf-y += noploop.o + perf-y += thloop.o + perf-y += leafloop.o ++perf-y += sqrtloop.o + ++CFLAGS_sqrtloop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE + CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE +diff --git a/tools/perf/tests/workloads/sqrtloop.c b/tools/perf/tests/workloads/sqrtloop.c +new file mode 100644 +index 0000000000000..ccc94c6a6676a +--- /dev/null ++++ b/tools/perf/tests/workloads/sqrtloop.c +@@ -0,0 +1,45 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include "../tests.h" ++ ++static volatile sig_atomic_t done; ++ ++static void sighandler(int sig __maybe_unused) ++{ ++ done = 1; ++} ++ ++static int __sqrtloop(int sec) ++{ ++ signal(SIGALRM, sighandler); ++ alarm(sec); ++ ++ while (!done) ++ (void)sqrt(rand()); ++ return 0; ++} ++ ++static int sqrtloop(int argc, const char **argv) ++{ ++ int sec = 1; ++ ++ if (argc > 0) ++ sec = atoi(argv[0]); ++ ++ switch (fork()) { ++ case 0: ++ return __sqrtloop(sec); ++ case -1: ++ return -1; ++ default: ++ wait(NULL); ++ } ++ return 0; ++} ++ ++DEFINE_WORKLOAD(sqrtloop); +-- +2.43.0 + diff --git a/queue-6.1/perf-test-add-thloop-test-workload.patch b/queue-6.1/perf-test-add-thloop-test-workload.patch new file mode 100644 index 00000000000..a6ac36d3a76 --- /dev/null +++ b/queue-6.1/perf-test-add-thloop-test-workload.patch @@ -0,0 +1,135 @@ +From 3d3e3d3f9678ea88d98e5f4a07aa18455ffb0d3d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 16 Nov 2022 15:38:45 -0800 +Subject: perf test: Add 'thloop' test workload + +From: Namhyung Kim + +[ Upstream commit 69b352927885b17f03d3ee4ee38f580699af107a ] + +The thloop is similar to noploop but runs in two threads. This is +needed to verify perf record --per-thread to handle multi-threaded +programs properly. + + $ perf test -w thloop + +It also takes an optional argument to specify runtime in seconds +(default: 1). + +Signed-off-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Athira Jajeev +Cc: German Gomez +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Leo Yan +Cc: Peter Zijlstra +Cc: Zhengjun Xing +Link: https://lore.kernel.org/r/20221116233854.1596378-4-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1") +Signed-off-by: Sasha Levin +--- + tools/perf/tests/builtin-test.c | 1 + + tools/perf/tests/tests.h | 1 + + tools/perf/tests/workloads/Build | 1 + + tools/perf/tests/workloads/thloop.c | 53 +++++++++++++++++++++++++++++ + 4 files changed, 56 insertions(+) + create mode 100644 tools/perf/tests/workloads/thloop.c + +diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c +index ce641ccfcf814..161f38476e77b 100644 +--- a/tools/perf/tests/builtin-test.c ++++ b/tools/perf/tests/builtin-test.c +@@ -120,6 +120,7 @@ static struct test_suite **tests[] = { + + static struct test_workload *workloads[] = { + &workload__noploop, ++ &workload__thloop, + }; + + static int num_subtests(const struct test_suite *t) +diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h +index d315d0d6fc977..e6edfeeadaeba 100644 +--- a/tools/perf/tests/tests.h ++++ b/tools/perf/tests/tests.h +@@ -201,5 +201,6 @@ struct test_workload workload__##work = { \ + + /* The list of test workloads */ + DECLARE_WORKLOAD(noploop); ++DECLARE_WORKLOAD(thloop); + + #endif /* TESTS_H */ +diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build +index f98e968d4633a..b8964b1099c0e 100644 +--- a/tools/perf/tests/workloads/Build ++++ b/tools/perf/tests/workloads/Build +@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0 + + perf-y += noploop.o ++perf-y += thloop.o +diff --git a/tools/perf/tests/workloads/thloop.c b/tools/perf/tests/workloads/thloop.c +new file mode 100644 +index 0000000000000..29193b75717ef +--- /dev/null ++++ b/tools/perf/tests/workloads/thloop.c +@@ -0,0 +1,53 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#include ++#include ++#include ++#include ++#include ++#include "../tests.h" ++ ++static volatile sig_atomic_t done; ++static volatile unsigned count; ++ ++/* We want to check this symbol in perf report */ ++noinline void test_loop(void); ++ ++static void sighandler(int sig __maybe_unused) ++{ ++ done = 1; ++} ++ ++noinline void test_loop(void) ++{ ++ while (!done) ++ count++; ++} ++ ++static void *thfunc(void *arg) ++{ ++ void (*loop_fn)(void) = arg; ++ ++ loop_fn(); ++ return NULL; ++} ++ ++static int thloop(int argc, const char **argv) ++{ ++ int sec = 1; ++ pthread_t th; ++ ++ if (argc > 0) ++ sec = atoi(argv[0]); ++ ++ signal(SIGINT, sighandler); ++ signal(SIGALRM, sighandler); ++ alarm(sec); ++ ++ pthread_create(&th, NULL, thfunc, test_loop); ++ test_loop(); ++ pthread_join(th, NULL); ++ ++ return 0; ++} ++ ++DEFINE_WORKLOAD(thloop); +-- +2.43.0 + diff --git a/queue-6.1/perf-test-add-w-workload-option.patch b/queue-6.1/perf-test-add-w-workload-option.patch new file mode 100644 index 00000000000..c29a567ce04 --- /dev/null +++ b/queue-6.1/perf-test-add-w-workload-option.patch @@ -0,0 +1,196 @@ +From 0bd57a6a44c632c7a54b474aeb515c6fd01765c2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 16 Nov 2022 15:38:43 -0800 +Subject: perf test: Add -w/--workload option + +From: Namhyung Kim + +[ Upstream commit f215054d749b17c56e014fdca2fcc592dac4529c ] + +The -w/--workload option is to run a simple workload used by testing. +This adds a basic framework to run the workloads and 'noploop' workload +as an example. + + $ perf test -w noploop + +The noploop does a loop doing nothing (NOP) for a second by default. +It can have an optional argument to specify the time in seconds. + +Signed-off-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Athira Jajeev +Cc: German Gomez +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Leo Yan +Cc: Peter Zijlstra +Cc: Zhengjun Xing +Link: https://lore.kernel.org/r/20221116233854.1596378-2-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1") +Signed-off-by: Sasha Levin +--- + tools/perf/tests/Build | 2 ++ + tools/perf/tests/builtin-test.c | 24 +++++++++++++++++++++ + tools/perf/tests/tests.h | 22 +++++++++++++++++++ + tools/perf/tests/workloads/Build | 3 +++ + tools/perf/tests/workloads/noploop.c | 32 ++++++++++++++++++++++++++++ + 5 files changed, 83 insertions(+) + create mode 100644 tools/perf/tests/workloads/Build + create mode 100644 tools/perf/tests/workloads/noploop.c + +diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build +index 2064a640facbe..11b69023011b0 100644 +--- a/tools/perf/tests/Build ++++ b/tools/perf/tests/Build +@@ -103,3 +103,5 @@ endif + CFLAGS_attr.o += -DBINDIR="BUILD_STR($(bindir_SQ))" -DPYTHON="BUILD_STR($(PYTHON_WORD))" + CFLAGS_python-use.o += -DPYTHONPATH="BUILD_STR($(OUTPUT)python)" -DPYTHON="BUILD_STR($(PYTHON_WORD))" + CFLAGS_dwarf-unwind.o += -fno-optimize-sibling-calls ++ ++perf-y += workloads/ +diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c +index 7122eae1d98d9..ce641ccfcf814 100644 +--- a/tools/perf/tests/builtin-test.c ++++ b/tools/perf/tests/builtin-test.c +@@ -118,6 +118,10 @@ static struct test_suite **tests[] = { + arch_tests, + }; + ++static struct test_workload *workloads[] = { ++ &workload__noploop, ++}; ++ + static int num_subtests(const struct test_suite *t) + { + int num; +@@ -475,6 +479,21 @@ static int perf_test__list(int argc, const char **argv) + return 0; + } + ++static int run_workload(const char *work, int argc, const char **argv) ++{ ++ unsigned int i = 0; ++ struct test_workload *twl; ++ ++ for (i = 0; i < ARRAY_SIZE(workloads); i++) { ++ twl = workloads[i]; ++ if (!strcmp(twl->name, work)) ++ return twl->func(argc, argv); ++ } ++ ++ pr_info("No workload found: %s\n", work); ++ return -1; ++} ++ + int cmd_test(int argc, const char **argv) + { + const char *test_usage[] = { +@@ -482,12 +501,14 @@ int cmd_test(int argc, const char **argv) + NULL, + }; + const char *skip = NULL; ++ const char *workload = NULL; + const struct option test_options[] = { + OPT_STRING('s', "skip", &skip, "tests", "tests to skip"), + OPT_INCR('v', "verbose", &verbose, + "be more verbose (show symbol address, etc)"), + OPT_BOOLEAN('F', "dont-fork", &dont_fork, + "Do not fork for testcase"), ++ OPT_STRING('w', "workload", &workload, "work", "workload to run for testing"), + OPT_END() + }; + const char * const test_subcommands[] = { "list", NULL }; +@@ -504,6 +525,9 @@ int cmd_test(int argc, const char **argv) + if (argc >= 1 && !strcmp(argv[0], "list")) + return perf_test__list(argc - 1, argv + 1); + ++ if (workload) ++ return run_workload(workload, argc, argv); ++ + symbol_conf.priv_size = sizeof(int); + symbol_conf.sort_by_name = true; + symbol_conf.try_vmlinux_path = true; +diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h +index 5bbb8f6a48fcb..d315d0d6fc977 100644 +--- a/tools/perf/tests/tests.h ++++ b/tools/perf/tests/tests.h +@@ -180,4 +180,26 @@ int test__arch_unwind_sample(struct perf_sample *sample, + DECLARE_SUITE(vectors_page); + #endif + ++/* ++ * Define test workloads to be used in test suites. ++ */ ++typedef int (*workload_fnptr)(int argc, const char **argv); ++ ++struct test_workload { ++ const char *name; ++ workload_fnptr func; ++}; ++ ++#define DECLARE_WORKLOAD(work) \ ++ extern struct test_workload workload__##work ++ ++#define DEFINE_WORKLOAD(work) \ ++struct test_workload workload__##work = { \ ++ .name = #work, \ ++ .func = work, \ ++} ++ ++/* The list of test workloads */ ++DECLARE_WORKLOAD(noploop); ++ + #endif /* TESTS_H */ +diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build +new file mode 100644 +index 0000000000000..f98e968d4633a +--- /dev/null ++++ b/tools/perf/tests/workloads/Build +@@ -0,0 +1,3 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++perf-y += noploop.o +diff --git a/tools/perf/tests/workloads/noploop.c b/tools/perf/tests/workloads/noploop.c +new file mode 100644 +index 0000000000000..940ea5910a84c +--- /dev/null ++++ b/tools/perf/tests/workloads/noploop.c +@@ -0,0 +1,32 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#include ++#include ++#include ++#include ++#include "../tests.h" ++ ++static volatile sig_atomic_t done; ++ ++static void sighandler(int sig __maybe_unused) ++{ ++ done = 1; ++} ++ ++static int noploop(int argc, const char **argv) ++{ ++ int sec = 1; ++ ++ if (argc > 0) ++ sec = atoi(argv[0]); ++ ++ signal(SIGINT, sighandler); ++ signal(SIGALRM, sighandler); ++ alarm(sec); ++ ++ while (!done) ++ continue; ++ ++ return 0; ++} ++ ++DEFINE_WORKLOAD(noploop); +-- +2.43.0 + diff --git a/queue-6.1/perf-tests-make-test-data-symbol-more-robust-on-neov.patch b/queue-6.1/perf-tests-make-test-data-symbol-more-robust-on-neov.patch new file mode 100644 index 00000000000..bfde9ffba51 --- /dev/null +++ b/queue-6.1/perf-tests-make-test-data-symbol-more-robust-on-neov.patch @@ -0,0 +1,69 @@ +From 8dc4a621b5af334dd709b4f388d6d1c061ef6c5d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 10 Apr 2024 11:34:52 +0100 +Subject: perf tests: Make "test data symbol" more robust on Neoverse N1 + +From: James Clark + +[ Upstream commit 256ef072b3842273ce703db18b603b051aca95fe ] + +To prevent anyone from seeing a test failure appear as a regression and +thinking that it was caused by their code change, insert some noise into +the loop which makes it immune to sampling bias issues (errata 1694299). + +The "test data symbol" test can fail with any unrelated change that +shifts the loop into an unfortunate position in the Perf binary which is +almost impossible to debug as the root cause of the test failure. +Ultimately it's caused by the referenced errata. + +Fixes: 60abedb8aa902b06 ("perf test: Introduce script for data symbol testing") +Reviewed-by: Ian Rogers +Signed-off-by: James Clark +Acked-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Athira Rajeev +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Leo Yan +Cc: Mark Rutland +Cc: Peter Zijlstra +Cc: Spoorthy S +Link: https://lore.kernel.org/r/20240410103458.813656-2-james.clark@arm.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/tests/workloads/datasym.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/tools/perf/tests/workloads/datasym.c b/tools/perf/tests/workloads/datasym.c +index ddd40bc63448a..8e08fc75a973e 100644 +--- a/tools/perf/tests/workloads/datasym.c ++++ b/tools/perf/tests/workloads/datasym.c +@@ -16,6 +16,22 @@ static int datasym(int argc __maybe_unused, const char **argv __maybe_unused) + { + for (;;) { + buf1.data1++; ++ if (buf1.data1 == 123) { ++ /* ++ * Add some 'noise' in the loop to work around errata ++ * 1694299 on Arm N1. ++ * ++ * Bias exists in SPE sampling which can cause the load ++ * and store instructions to be skipped entirely. This ++ * comes and goes randomly depending on the offset the ++ * linker places the datasym loop at in the Perf binary. ++ * With an extra branch in the middle of the loop that ++ * isn't always taken, the instruction stream is no ++ * longer a continuous repeating pattern that interacts ++ * badly with the bias. ++ */ ++ buf1.data1++; ++ } + buf1.data2 += buf1.data1; + } + return 0; +-- +2.43.0 + diff --git a/queue-6.1/perf-ui-browser-avoid-segv-on-title.patch b/queue-6.1/perf-ui-browser-avoid-segv-on-title.patch new file mode 100644 index 00000000000..69dde07d49a --- /dev/null +++ b/queue-6.1/perf-ui-browser-avoid-segv-on-title.patch @@ -0,0 +1,46 @@ +From 285e29da38bcb65c28e52e0ad2bf466fa67fc0c3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 May 2024 20:52:58 -0700 +Subject: perf ui browser: Avoid SEGV on title + +From: Ian Rogers + +[ Upstream commit 90f01afb0dfafbc9b094bb61e61a4ac297d9d0d2 ] + +If the title is NULL then it can lead to a SEGV. + +Fixes: 769e6a1e15bdbbaf ("perf ui browser: Don't save pointer to stack memory") +Signed-off-by: Ian Rogers +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Leo Yan +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20240508035301.1554434-2-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/ui/browser.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c +index d09b4cbec6e06..5d6f4f25c33d0 100644 +--- a/tools/perf/ui/browser.c ++++ b/tools/perf/ui/browser.c +@@ -203,7 +203,7 @@ void ui_browser__refresh_dimensions(struct ui_browser *browser) + void ui_browser__handle_resize(struct ui_browser *browser) + { + ui__refresh_dimensions(false); +- ui_browser__show(browser, browser->title, ui_helpline__current); ++ ui_browser__show(browser, browser->title ?: "", ui_helpline__current); + ui_browser__refresh(browser); + } + +-- +2.43.0 + diff --git a/queue-6.1/perf-ui-browser-don-t-save-pointer-to-stack-memory.patch b/queue-6.1/perf-ui-browser-don-t-save-pointer-to-stack-memory.patch new file mode 100644 index 00000000000..5d683d13aeb --- /dev/null +++ b/queue-6.1/perf-ui-browser-don-t-save-pointer-to-stack-memory.patch @@ -0,0 +1,143 @@ +From 8a9a41d9b61a633032b6ae4843af67780754148a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 May 2024 11:35:38 -0700 +Subject: perf ui browser: Don't save pointer to stack memory + +From: Ian Rogers + +[ Upstream commit 769e6a1e15bdbbaf2b0d2f37c24f2c53268bd21f ] + +ui_browser__show() is capturing the input title that is stack allocated +memory in hist_browser__run(). + +Avoid a use after return by strdup-ing the string. + +Committer notes: + +Further explanation from Ian Rogers: + +My command line using tui is: +$ sudo bash -c 'rm /tmp/asan.log*; export +ASAN_OPTIONS="log_path=/tmp/asan.log"; /tmp/perf/perf mem record -a +sleep 1; /tmp/perf/perf mem report' +I then go to the perf annotate view and quit. This triggers the asan +error (from the log file): +``` +==1254591==ERROR: AddressSanitizer: stack-use-after-return on address +0x7f2813331920 at pc 0x7f28180 +65991 bp 0x7fff0a21c750 sp 0x7fff0a21bf10 +READ of size 80 at 0x7f2813331920 thread T0 + #0 0x7f2818065990 in __interceptor_strlen +../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:461 + #1 0x7f2817698251 in SLsmg_write_wrapped_string +(/lib/x86_64-linux-gnu/libslang.so.2+0x98251) + #2 0x7f28176984b9 in SLsmg_write_nstring +(/lib/x86_64-linux-gnu/libslang.so.2+0x984b9) + #3 0x55c94045b365 in ui_browser__write_nstring ui/browser.c:60 + #4 0x55c94045c558 in __ui_browser__show_title ui/browser.c:266 + #5 0x55c94045c776 in ui_browser__show ui/browser.c:288 + #6 0x55c94045c06d in ui_browser__handle_resize ui/browser.c:206 + #7 0x55c94047979b in do_annotate ui/browsers/hists.c:2458 + #8 0x55c94047fb17 in evsel__hists_browse ui/browsers/hists.c:3412 + #9 0x55c940480a0c in perf_evsel_menu__run ui/browsers/hists.c:3527 + #10 0x55c940481108 in __evlist__tui_browse_hists ui/browsers/hists.c:3613 + #11 0x55c9404813f7 in evlist__tui_browse_hists ui/browsers/hists.c:3661 + #12 0x55c93ffa253f in report__browse_hists tools/perf/builtin-report.c:671 + #13 0x55c93ffa58ca in __cmd_report tools/perf/builtin-report.c:1141 + #14 0x55c93ffaf159 in cmd_report tools/perf/builtin-report.c:1805 + #15 0x55c94000c05c in report_events tools/perf/builtin-mem.c:374 + #16 0x55c94000d96d in cmd_mem tools/perf/builtin-mem.c:516 + #17 0x55c9400e44ee in run_builtin tools/perf/perf.c:350 + #18 0x55c9400e4a5a in handle_internal_command tools/perf/perf.c:403 + #19 0x55c9400e4e22 in run_argv tools/perf/perf.c:447 + #20 0x55c9400e53ad in main tools/perf/perf.c:561 + #21 0x7f28170456c9 in __libc_start_call_main +../sysdeps/nptl/libc_start_call_main.h:58 + #22 0x7f2817045784 in __libc_start_main_impl ../csu/libc-start.c:360 + #23 0x55c93ff544c0 in _start (/tmp/perf/perf+0x19a4c0) (BuildId: +84899b0e8c7d3a3eaa67b2eb35e3d8b2f8cd4c93) + +Address 0x7f2813331920 is located in stack of thread T0 at offset 32 in frame + #0 0x55c94046e85e in hist_browser__run ui/browsers/hists.c:746 + + This frame has 1 object(s): + [32, 192) 'title' (line 747) <== Memory access at offset 32 is +inside this variable +HINT: this may be a false positive if your program uses some custom +stack unwind mechanism, swapcontext or vfork +``` +hist_browser__run isn't on the stack so the asan error looks legit. +There's no clean init/exit on struct ui_browser so I may be trading a +use-after-return for a memory leak, but that seems look a good trade +anyway. + +Fixes: 05e8b0804ec4 ("perf ui browser: Stop using 'self'") +Signed-off-by: Ian Rogers +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Andi Kleen +Cc: Athira Rajeev +Cc: Ben Gainey +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kajol Jain +Cc: Kan Liang +Cc: K Prateek Nayak +Cc: Li Dong +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Oliver Upton +Cc: Paran Lee +Cc: Peter Zijlstra +Cc: Ravi Bangoria +Cc: Sun Haiyong +Cc: Tim Chen +Cc: Yanteng Si +Cc: Yicong Yang +Link: https://lore.kernel.org/r/20240507183545.1236093-2-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/ui/browser.c | 4 +++- + tools/perf/ui/browser.h | 2 +- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c +index 78fb01d6ad63f..d09b4cbec6e06 100644 +--- a/tools/perf/ui/browser.c ++++ b/tools/perf/ui/browser.c +@@ -287,7 +287,8 @@ int ui_browser__show(struct ui_browser *browser, const char *title, + mutex_lock(&ui__lock); + __ui_browser__show_title(browser, title); + +- browser->title = title; ++ free(browser->title); ++ browser->title = strdup(title); + zfree(&browser->helpline); + + va_start(ap, helpline); +@@ -304,6 +305,7 @@ void ui_browser__hide(struct ui_browser *browser) + mutex_lock(&ui__lock); + ui_helpline__pop(); + zfree(&browser->helpline); ++ zfree(&browser->title); + mutex_unlock(&ui__lock); + } + +diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h +index 510ce45540501..6e98d5f8f71cc 100644 +--- a/tools/perf/ui/browser.h ++++ b/tools/perf/ui/browser.h +@@ -21,7 +21,7 @@ struct ui_browser { + u8 extra_title_lines; + int current_color; + void *priv; +- const char *title; ++ char *title; + char *helpline; + const char *no_samples_msg; + void (*refresh_dimensions)(struct ui_browser *browser); +-- +2.43.0 + diff --git a/queue-6.1/ppdev-add-an-error-check-in-register_device.patch b/queue-6.1/ppdev-add-an-error-check-in-register_device.patch new file mode 100644 index 00000000000..a74bcdd539d --- /dev/null +++ b/queue-6.1/ppdev-add-an-error-check-in-register_device.patch @@ -0,0 +1,72 @@ +From 40da38479f6bfdf7a94bf5159ab58c134d289c47 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Apr 2024 16:38:40 +0800 +Subject: ppdev: Add an error check in register_device + +From: Huai-Yuan Liu + +[ Upstream commit fbf740aeb86a4fe82ad158d26d711f2f3be79b3e ] + +In register_device, the return value of ida_simple_get is unchecked, +in witch ida_simple_get will use an invalid index value. + +To address this issue, index should be checked after ida_simple_get. When +the index value is abnormal, a warning message should be printed, the port +should be dropped, and the value should be recorded. + +Fixes: 9a69645dde11 ("ppdev: fix registering same device name") +Signed-off-by: Huai-Yuan Liu +Link: https://lore.kernel.org/r/20240412083840.234085-1-qq810974084@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/char/ppdev.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c +index f6024d97fe70b..a97edbf7455a6 100644 +--- a/drivers/char/ppdev.c ++++ b/drivers/char/ppdev.c +@@ -296,28 +296,35 @@ static int register_device(int minor, struct pp_struct *pp) + if (!port) { + pr_warn("%s: no associated port!\n", name); + rc = -ENXIO; +- goto err; ++ goto err_free_name; + } + + index = ida_alloc(&ida_index, GFP_KERNEL); ++ if (index < 0) { ++ pr_warn("%s: failed to get index!\n", name); ++ rc = index; ++ goto err_put_port; ++ } ++ + memset(&ppdev_cb, 0, sizeof(ppdev_cb)); + ppdev_cb.irq_func = pp_irq; + ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0; + ppdev_cb.private = pp; + pdev = parport_register_dev_model(port, name, &ppdev_cb, index); +- parport_put_port(port); + + if (!pdev) { + pr_warn("%s: failed to register device!\n", name); + rc = -ENXIO; + ida_free(&ida_index, index); +- goto err; ++ goto err_put_port; + } + + pp->pdev = pdev; + pp->index = index; + dev_dbg(&pdev->dev, "registered pardevice\n"); +-err: ++err_put_port: ++ parport_put_port(port); ++err_free_name: + kfree(name); + return rc; + } +-- +2.43.0 + diff --git a/queue-6.1/ppdev-remove-usage-of-the-deprecated-ida_simple_xx-a.patch b/queue-6.1/ppdev-remove-usage-of-the-deprecated-ida_simple_xx-a.patch new file mode 100644 index 00000000000..20dbc59e64d --- /dev/null +++ b/queue-6.1/ppdev-remove-usage-of-the-deprecated-ida_simple_xx-a.patch @@ -0,0 +1,57 @@ +From a8536c42291d49c5e7f453dd8f3587b99eede162 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Dec 2023 06:01:47 +0100 +Subject: ppdev: Remove usage of the deprecated ida_simple_xx() API + +From: Christophe JAILLET + +[ Upstream commit d8407f71ebeaeb6f50bd89791837873e44609708 ] + +ida_alloc() and ida_free() should be preferred to the deprecated +ida_simple_get() and ida_simple_remove(). + +This is less verbose. + +Signed-off-by: Christophe JAILLET +Link: https://lore.kernel.org/r/ba9da12fdd5cdb2c28180b7160af5042447d803f.1702962092.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: fbf740aeb86a ("ppdev: Add an error check in register_device") +Signed-off-by: Sasha Levin +--- + drivers/char/ppdev.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c +index 38b46c7d17371..f6024d97fe70b 100644 +--- a/drivers/char/ppdev.c ++++ b/drivers/char/ppdev.c +@@ -299,7 +299,7 @@ static int register_device(int minor, struct pp_struct *pp) + goto err; + } + +- index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL); ++ index = ida_alloc(&ida_index, GFP_KERNEL); + memset(&ppdev_cb, 0, sizeof(ppdev_cb)); + ppdev_cb.irq_func = pp_irq; + ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0; +@@ -310,7 +310,7 @@ static int register_device(int minor, struct pp_struct *pp) + if (!pdev) { + pr_warn("%s: failed to register device!\n", name); + rc = -ENXIO; +- ida_simple_remove(&ida_index, index); ++ ida_free(&ida_index, index); + goto err; + } + +@@ -750,7 +750,7 @@ static int pp_release(struct inode *inode, struct file *file) + + if (pp->pdev) { + parport_unregister_device(pp->pdev); +- ida_simple_remove(&ida_index, pp->index); ++ ida_free(&ida_index, pp->index); + pp->pdev = NULL; + pr_debug(CHRDEV "%x: unregistered pardevice\n", minor); + } +-- +2.43.0 + diff --git a/queue-6.1/s390-boot-remove-alt_stfle_fac_list-from-decompresso.patch b/queue-6.1/s390-boot-remove-alt_stfle_fac_list-from-decompresso.patch new file mode 100644 index 00000000000..e450d726507 --- /dev/null +++ b/queue-6.1/s390-boot-remove-alt_stfle_fac_list-from-decompresso.patch @@ -0,0 +1,49 @@ +From 3864aeb65c97c5eae740ca13e43910f902fdcc2c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 May 2024 09:20:27 +0200 +Subject: s390/boot: Remove alt_stfle_fac_list from decompressor + +From: Sven Schnelle + +[ Upstream commit e7dec0b7926f3cd493c697c4c389df77e8e8a34c ] + +It is nowhere used in the decompressor, therefore remove it. + +Fixes: 17e89e1340a3 ("s390/facilities: move stfl information from lowcore to global data") +Reviewed-by: Heiko Carstens +Signed-off-by: Sven Schnelle +Signed-off-by: Heiko Carstens +Signed-off-by: Sasha Levin +--- + arch/s390/boot/startup.c | 1 - + arch/s390/kernel/setup.c | 2 +- + 2 files changed, 1 insertion(+), 2 deletions(-) + +diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c +index e0863d28759a5..bfb4dec36414a 100644 +--- a/arch/s390/boot/startup.c ++++ b/arch/s390/boot/startup.c +@@ -30,7 +30,6 @@ int __bootdata(is_full_image) = 1; + struct initrd_data __bootdata(initrd_data); + + u64 __bootdata_preserved(stfle_fac_list[16]); +-u64 __bootdata_preserved(alt_stfle_fac_list[16]); + struct oldmem_data __bootdata_preserved(oldmem_data); + + void error(char *x) +diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c +index 2ec5f1e0312fa..1f514557fee9d 100644 +--- a/arch/s390/kernel/setup.c ++++ b/arch/s390/kernel/setup.c +@@ -155,7 +155,7 @@ unsigned int __bootdata_preserved(zlib_dfltcc_support); + EXPORT_SYMBOL(zlib_dfltcc_support); + u64 __bootdata_preserved(stfle_fac_list[16]); + EXPORT_SYMBOL(stfle_fac_list); +-u64 __bootdata_preserved(alt_stfle_fac_list[16]); ++u64 alt_stfle_fac_list[16]; + struct oldmem_data __bootdata_preserved(oldmem_data); + + unsigned long VMALLOC_START; +-- +2.43.0 + diff --git a/queue-6.1/s390-ipl-fix-incorrect-initialization-of-len-fields-.patch b/queue-6.1/s390-ipl-fix-incorrect-initialization-of-len-fields-.patch new file mode 100644 index 00000000000..2c4f4b5ae90 --- /dev/null +++ b/queue-6.1/s390-ipl-fix-incorrect-initialization-of-len-fields-.patch @@ -0,0 +1,42 @@ +From 2aa69757b9823fc3facb225b02891dbbdcdb0583 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 May 2024 12:41:25 +0200 +Subject: s390/ipl: Fix incorrect initialization of len fields in nvme reipl + block + +From: Alexander Egorenkov + +[ Upstream commit 9c922b73acaf39f867668d9cbe5dc69c23511f84 ] + +Use correct symbolic constants IPL_BP_NVME_LEN and IPL_BP0_NVME_LEN +to initialize nvme reipl block when 'scp_data' sysfs attribute is +being updated. This bug had not been detected before because +the corresponding fcp and nvme symbolic constants are equal. + +Fixes: 23a457b8d57d ("s390: nvme reipl") +Reviewed-by: Heiko Carstens +Signed-off-by: Alexander Egorenkov +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/ipl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c +index df5d2ec737d80..b06ec1d8815e3 100644 +--- a/arch/s390/kernel/ipl.c ++++ b/arch/s390/kernel/ipl.c +@@ -834,8 +834,8 @@ static ssize_t reipl_nvme_scpdata_write(struct file *filp, struct kobject *kobj, + scpdata_len += padding; + } + +- reipl_block_nvme->hdr.len = IPL_BP_FCP_LEN + scpdata_len; +- reipl_block_nvme->nvme.len = IPL_BP0_FCP_LEN + scpdata_len; ++ reipl_block_nvme->hdr.len = IPL_BP_NVME_LEN + scpdata_len; ++ reipl_block_nvme->nvme.len = IPL_BP0_NVME_LEN + scpdata_len; + reipl_block_nvme->nvme.scp_data_len = scpdata_len; + + return count; +-- +2.43.0 + diff --git a/queue-6.1/s390-ipl-fix-incorrect-initialization-of-nvme-dump-b.patch b/queue-6.1/s390-ipl-fix-incorrect-initialization-of-nvme-dump-b.patch new file mode 100644 index 00000000000..aecebd35d6a --- /dev/null +++ b/queue-6.1/s390-ipl-fix-incorrect-initialization-of-nvme-dump-b.patch @@ -0,0 +1,43 @@ +From 6177bf3889d8baa387bd91e1103e9c6dde8cc044 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 May 2024 12:41:26 +0200 +Subject: s390/ipl: Fix incorrect initialization of nvme dump block + +From: Alexander Egorenkov + +[ Upstream commit 7faacaeaf6ce12fae78751de5ad869d8f1e1cd7a ] + +Initialize the correct fields of the nvme dump block. +This bug had not been detected before because first, the fcp and nvme fields +of struct ipl_parameter_block are part of the same union and, therefore, +overlap in memory and second, they are identical in structure and size. + +Fixes: d70e38cb1dee ("s390: nvme dump support") +Reviewed-by: Heiko Carstens +Signed-off-by: Alexander Egorenkov +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/ipl.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c +index b06ec1d8815e3..3aa3fff9bde0c 100644 +--- a/arch/s390/kernel/ipl.c ++++ b/arch/s390/kernel/ipl.c +@@ -1604,9 +1604,9 @@ static int __init dump_nvme_init(void) + } + dump_block_nvme->hdr.len = IPL_BP_NVME_LEN; + dump_block_nvme->hdr.version = IPL_PARM_BLOCK_VERSION; +- dump_block_nvme->fcp.len = IPL_BP0_NVME_LEN; +- dump_block_nvme->fcp.pbt = IPL_PBT_NVME; +- dump_block_nvme->fcp.opt = IPL_PB0_NVME_OPT_DUMP; ++ dump_block_nvme->nvme.len = IPL_BP0_NVME_LEN; ++ dump_block_nvme->nvme.pbt = IPL_PBT_NVME; ++ dump_block_nvme->nvme.opt = IPL_PB0_NVME_OPT_DUMP; + dump_capabilities |= DUMP_TYPE_NVME; + return 0; + } +-- +2.43.0 + diff --git a/queue-6.1/s390-vdso-create-.build-id-links-for-unstripped-vdso.patch b/queue-6.1/s390-vdso-create-.build-id-links-for-unstripped-vdso.patch new file mode 100644 index 00000000000..344591b41db --- /dev/null +++ b/queue-6.1/s390-vdso-create-.build-id-links-for-unstripped-vdso.patch @@ -0,0 +1,45 @@ +From e5fcc928a0c3c2fe5e6e2c66a16b7d67334fac02 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Apr 2024 17:02:53 +0200 +Subject: s390/vdso: Create .build-id links for unstripped vdso files + +From: Jens Remus + +[ Upstream commit fc2f5f10f9bc5e58d38e9fda7dae107ac04a799f ] + +Citing Andy Lutomirski from commit dda1e95cee38 ("x86/vdso: Create +.build-id links for unstripped vdso files"): + +"With this change, doing 'make vdso_install' and telling gdb: + +set debug-file-directory /lib/modules/KVER/vdso + +will enable vdso debugging with symbols. This is useful for +testing, but kernel RPM builds will probably want to manually delete +these symlinks or otherwise do something sensible when they strip +the vdso/*.so files." + +Fixes: 4bff8cb54502 ("s390: convert to GENERIC_VDSO") +Signed-off-by: Jens Remus +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + scripts/Makefile.vdsoinst | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/Makefile.vdsoinst b/scripts/Makefile.vdsoinst +index c477d17b0aa5b..a81ca735003e4 100644 +--- a/scripts/Makefile.vdsoinst ++++ b/scripts/Makefile.vdsoinst +@@ -21,7 +21,7 @@ $$(dest): $$(src) FORCE + $$(call cmd,install) + + # Some architectures create .build-id symlinks +-ifneq ($(filter arm sparc x86, $(SRCARCH)),) ++ifneq ($(filter arm s390 sparc x86, $(SRCARCH)),) + link := $(install-dir)/.build-id/$$(shell $(READELF) -n $$(src) | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p').debug + + __default: $$(link) +-- +2.43.0 + diff --git a/queue-6.1/s390-vdso-filter-out-mno-pic-data-is-text-relative-c.patch b/queue-6.1/s390-vdso-filter-out-mno-pic-data-is-text-relative-c.patch new file mode 100644 index 00000000000..45df5a451eb --- /dev/null +++ b/queue-6.1/s390-vdso-filter-out-mno-pic-data-is-text-relative-c.patch @@ -0,0 +1,58 @@ +From 18292a91514a0c4d063ba1b77b02a7fc51ed0648 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Jun 2023 15:12:05 +0200 +Subject: s390/vdso: filter out mno-pic-data-is-text-relative cflag + +From: Sumanth Korikkar + +[ Upstream commit d15e4314abec83e4f910659437bc809b0889e3a5 ] + +cmd_vdso_check checks if there are any dynamic relocations in +vdso64.so.dbg. When kernel is compiled with +-mno-pic-data-is-text-relative, R_390_RELATIVE relocs are generated and +this results in kernel build error. + +kpatch uses -mno-pic-data-is-text-relative option when building the +kernel to prevent relative addressing between code and data. The flag +avoids relocation error when klp text and data are too far apart + +kpatch does not patch vdso code and hence the +mno-pic-data-is-text-relative flag is not essential. + +Signed-off-by: Sumanth Korikkar +Acked-by: Ilya Leoshkevich +Signed-off-by: Alexander Gordeev +Stable-dep-of: 10f705253651 ("s390/vdso: Generate unwind information for C modules") +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/vdso32/Makefile | 1 + + arch/s390/kernel/vdso64/Makefile | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile +index cc513add48eb5..1783e4d335136 100644 +--- a/arch/s390/kernel/vdso32/Makefile ++++ b/arch/s390/kernel/vdso32/Makefile +@@ -20,6 +20,7 @@ KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) + KBUILD_AFLAGS_32 += -m31 -s + + KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) ++KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32)) + KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin + + LDFLAGS_vdso32.so.dbg += -shared -soname=linux-vdso32.so.1 \ +diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile +index 42d918d50a1ff..08e87b083647c 100644 +--- a/arch/s390/kernel/vdso64/Makefile ++++ b/arch/s390/kernel/vdso64/Makefile +@@ -25,6 +25,7 @@ KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS)) + KBUILD_AFLAGS_64 += -m64 -s + + KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) ++KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64)) + KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin + ldflags-y := -shared -soname=linux-vdso64.so.1 \ + --hash-style=both --build-id=sha1 -T +-- +2.43.0 + diff --git a/queue-6.1/s390-vdso-generate-unwind-information-for-c-modules.patch b/queue-6.1/s390-vdso-generate-unwind-information-for-c-modules.patch new file mode 100644 index 00000000000..db56bc51ed0 --- /dev/null +++ b/queue-6.1/s390-vdso-generate-unwind-information-for-c-modules.patch @@ -0,0 +1,55 @@ +From ce5d16c95d1d19fbe217a97505028a0602162fe2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Apr 2024 17:02:52 +0200 +Subject: s390/vdso: Generate unwind information for C modules + +From: Jens Remus + +[ Upstream commit 10f70525365146046dddcc3d36bfaea2aee0376a ] + +GDB fails to unwind vDSO functions with error message "PC not saved", +for instance when stepping through gettimeofday(). + +Add -fasynchronous-unwind-tables to CFLAGS to generate .eh_frame +DWARF unwind information for the vDSO C modules. + +Fixes: 4bff8cb54502 ("s390: convert to GENERIC_VDSO") +Signed-off-by: Jens Remus +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/vdso32/Makefile | 3 ++- + arch/s390/kernel/vdso64/Makefile | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile +index 1783e4d335136..66f7b0c8e6117 100644 +--- a/arch/s390/kernel/vdso32/Makefile ++++ b/arch/s390/kernel/vdso32/Makefile +@@ -21,7 +21,8 @@ KBUILD_AFLAGS_32 += -m31 -s + + KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) + KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32)) +-KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin ++KBUILD_CFLAGS_32 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_32)) ++KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin -fasynchronous-unwind-tables + + LDFLAGS_vdso32.so.dbg += -shared -soname=linux-vdso32.so.1 \ + --hash-style=both --build-id=sha1 -melf_s390 -T +diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile +index e2e031e4d9243..e520c548d303e 100644 +--- a/arch/s390/kernel/vdso64/Makefile ++++ b/arch/s390/kernel/vdso64/Makefile +@@ -27,7 +27,8 @@ KBUILD_AFLAGS_64 += -m64 -s + KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) + KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64)) + KBUILD_CFLAGS_64 := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_64)) +-KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin ++KBUILD_CFLAGS_64 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_64)) ++KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin -fasynchronous-unwind-tables + ldflags-y := -shared -soname=linux-vdso64.so.1 \ + --hash-style=both --build-id=sha1 -T + +-- +2.43.0 + diff --git a/queue-6.1/s390-vdso-use-standard-stack-frame-layout.patch b/queue-6.1/s390-vdso-use-standard-stack-frame-layout.patch new file mode 100644 index 00000000000..e38842ac2b2 --- /dev/null +++ b/queue-6.1/s390-vdso-use-standard-stack-frame-layout.patch @@ -0,0 +1,56 @@ +From 03b346a3bfde9301b45df20f24c3c2f36bacdd5a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Apr 2024 14:28:43 +0200 +Subject: s390/vdso: Use standard stack frame layout + +From: Heiko Carstens + +[ Upstream commit 185445c7c137822ad856aae91a41e199370cb534 ] + +By default user space is compiled with standard stack frame layout and not +with the packed stack layout. The vdso code however inherited the +-mpacked-stack compiler option from the kernel. Remove this option to make +sure the vdso is compiled with standard stack frame layout. + +This makes sure that the stack frame backchain location for vdso generated +stack frames is the same like for calling code (if compiled with default +options). This allows to manually walk stack frames without DWARF +information, like the kernel is doing it e.g. with arch_stack_walk_user(). + +Fixes: 4bff8cb54502 ("s390: convert to GENERIC_VDSO") +Reviewed-by: Jens Remus +Signed-off-by: Heiko Carstens +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/vdso32/Makefile | 1 + + arch/s390/kernel/vdso64/Makefile | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile +index bf30997657ac8..2e1591d97a428 100644 +--- a/arch/s390/kernel/vdso32/Makefile ++++ b/arch/s390/kernel/vdso32/Makefile +@@ -20,6 +20,7 @@ KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) + KBUILD_AFLAGS_32 += -m31 -s + + KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) ++KBUILD_CFLAGS_32 := $(filter-out -mpacked-stack,$(KBUILD_CFLAGS)) + KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32)) + KBUILD_CFLAGS_32 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_32)) + KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin -fasynchronous-unwind-tables +diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile +index f8643d50ba6a6..b260c0bc90125 100644 +--- a/arch/s390/kernel/vdso64/Makefile ++++ b/arch/s390/kernel/vdso64/Makefile +@@ -25,6 +25,7 @@ KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS)) + KBUILD_AFLAGS_64 += -m64 -s + + KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) ++KBUILD_CFLAGS_64 := $(filter-out -mpacked-stack,$(KBUILD_CFLAGS_64)) + KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64)) + KBUILD_CFLAGS_64 := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_64)) + KBUILD_CFLAGS_64 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_64)) +-- +2.43.0 + diff --git a/queue-6.1/s390-vdso64-filter-out-munaligned-symbols-flag-for-v.patch b/queue-6.1/s390-vdso64-filter-out-munaligned-symbols-flag-for-v.patch new file mode 100644 index 00000000000..64ac6b84dd6 --- /dev/null +++ b/queue-6.1/s390-vdso64-filter-out-munaligned-symbols-flag-for-v.patch @@ -0,0 +1,56 @@ +From a3a9b4209cd8d1a897affe36cba6aad8c8f6e0ca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Feb 2024 14:27:31 +0100 +Subject: s390/vdso64: filter out munaligned-symbols flag for vdso + +From: Sumanth Korikkar + +[ Upstream commit 8192a1b3807510d0ed5be1f8988c08f8d41cced9 ] + +Gcc recently implemented an optimization [1] for loading symbols without +explicit alignment, aligning with the IBM Z ELF ABI. This ABI mandates +symbols to reside on a 2-byte boundary, enabling the use of the larl +instruction. However, kernel linker scripts may still generate unaligned +symbols. To address this, a new -munaligned-symbols option has been +introduced [2] in recent gcc versions. + +[1] https://gcc.gnu.org/pipermail/gcc-patches/2023-June/622872.html +[2] https://gcc.gnu.org/pipermail/gcc-patches/2023-August/625986.html + +However, when -munaligned-symbols is used in vdso code, it leads to the +following compilation error: +`.data.rel.ro.local' referenced in section `.text' of +arch/s390/kernel/vdso64/vdso64_generic.o: defined in discarded section +`.data.rel.ro.local' of arch/s390/kernel/vdso64/vdso64_generic.o + +vdso linker script discards .data section to make it lightweight. +However, -munaligned-symbols in vdso object files references literal +pool and accesses _vdso_data. Hence, compile vdso code without +-munaligned-symbols. This means in the future, vdso code should deal +with alignment of newly introduced unaligned linker symbols. + +Acked-by: Vasily Gorbik +Signed-off-by: Sumanth Korikkar +Link: https://lore.kernel.org/r/20240219132734.22881-2-sumanthk@linux.ibm.com +Signed-off-by: Heiko Carstens +Stable-dep-of: 10f705253651 ("s390/vdso: Generate unwind information for C modules") +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/vdso64/Makefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile +index 08e87b083647c..e2e031e4d9243 100644 +--- a/arch/s390/kernel/vdso64/Makefile ++++ b/arch/s390/kernel/vdso64/Makefile +@@ -26,6 +26,7 @@ KBUILD_AFLAGS_64 += -m64 -s + + KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) + KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64)) ++KBUILD_CFLAGS_64 := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_64)) + KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin + ldflags-y := -shared -soname=linux-vdso64.so.1 \ + --hash-style=both --build-id=sha1 -T +-- +2.43.0 + diff --git a/queue-6.1/serial-max3100-fix-bitwise-types.patch b/queue-6.1/serial-max3100-fix-bitwise-types.patch new file mode 100644 index 00000000000..15df0229d1c --- /dev/null +++ b/queue-6.1/serial-max3100-fix-bitwise-types.patch @@ -0,0 +1,53 @@ +From b5d67bb8db2a9cc2efe868b13e236b18dd2bb0ba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Apr 2024 22:50:30 +0300 +Subject: serial: max3100: Fix bitwise types + +From: Andy Shevchenko + +[ Upstream commit e60955dbecb97f080848a57524827e2db29c70fd ] + +Sparse is not happy about misuse of bitwise types: + + .../max3100.c:194:13: warning: incorrect type in assignment (different base types) + .../max3100.c:194:13: expected unsigned short [addressable] [usertype] etx + .../max3100.c:194:13: got restricted __be16 [usertype] + .../max3100.c:202:15: warning: cast to restricted __be16 + +Fix this by choosing proper types for the respective variables. + +Fixes: 7831d56b0a35 ("tty: MAX3100") +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20240402195306.269276-4-andriy.shevchenko@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/max3100.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c +index b71676e1f612f..5d8660fed081e 100644 +--- a/drivers/tty/serial/max3100.c ++++ b/drivers/tty/serial/max3100.c +@@ -45,6 +45,9 @@ + #include + #include + #include ++#include ++ ++#include + + #include + +@@ -191,7 +194,7 @@ static void max3100_timeout(struct timer_list *t) + static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx) + { + struct spi_message message; +- u16 etx, erx; ++ __be16 etx, erx; + int status; + struct spi_transfer tran = { + .tx_buf = &etx, +-- +2.43.0 + diff --git a/queue-6.1/serial-max3100-lock-port-lock-when-calling-uart_hand.patch b/queue-6.1/serial-max3100-lock-port-lock-when-calling-uart_hand.patch new file mode 100644 index 00000000000..9fa3d2efbd6 --- /dev/null +++ b/queue-6.1/serial-max3100-lock-port-lock-when-calling-uart_hand.patch @@ -0,0 +1,66 @@ +From 358aa1afed398d7e5fd356cfdba5272dd198319e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Apr 2024 22:50:28 +0300 +Subject: serial: max3100: Lock port->lock when calling + uart_handle_cts_change() + +From: Andy Shevchenko + +[ Upstream commit 77ab53371a2066fdf9b895246505f5ef5a4b5d47 ] + +uart_handle_cts_change() has to be called with port lock taken, +Since we run it in a separate work, the lock may not be taken at +the time of running. Make sure that it's taken by explicitly doing +that. Without it we got a splat: + + WARNING: CPU: 0 PID: 10 at drivers/tty/serial/serial_core.c:3491 uart_handle_cts_change+0xa6/0xb0 + ... + Workqueue: max3100-0 max3100_work [max3100] + RIP: 0010:uart_handle_cts_change+0xa6/0xb0 + ... + max3100_handlerx+0xc5/0x110 [max3100] + max3100_work+0x12a/0x340 [max3100] + +Fixes: 7831d56b0a35 ("tty: MAX3100") +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20240402195306.269276-2-andriy.shevchenko@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/max3100.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c +index c69602f356fdc..1c4a2b1b1f690 100644 +--- a/drivers/tty/serial/max3100.c ++++ b/drivers/tty/serial/max3100.c +@@ -213,7 +213,7 @@ static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx) + return 0; + } + +-static int max3100_handlerx(struct max3100_port *s, u16 rx) ++static int max3100_handlerx_unlocked(struct max3100_port *s, u16 rx) + { + unsigned int ch, flg, status = 0; + int ret = 0, cts; +@@ -253,6 +253,17 @@ static int max3100_handlerx(struct max3100_port *s, u16 rx) + return ret; + } + ++static int max3100_handlerx(struct max3100_port *s, u16 rx) ++{ ++ unsigned long flags; ++ int ret; ++ ++ uart_port_lock_irqsave(&s->port, &flags); ++ ret = max3100_handlerx_unlocked(s, rx); ++ uart_port_unlock_irqrestore(&s->port, flags); ++ return ret; ++} ++ + static void max3100_work(struct work_struct *w) + { + struct max3100_port *s = container_of(w, struct max3100_port, work); +-- +2.43.0 + diff --git a/queue-6.1/serial-max3100-update-uart_driver_registered-on-driv.patch b/queue-6.1/serial-max3100-update-uart_driver_registered-on-driv.patch new file mode 100644 index 00000000000..72a815b596d --- /dev/null +++ b/queue-6.1/serial-max3100-update-uart_driver_registered-on-driv.patch @@ -0,0 +1,73 @@ +From 0a390869d8b94d0ba5381339402e16bb7b0b3243 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Apr 2024 22:50:29 +0300 +Subject: serial: max3100: Update uart_driver_registered on driver removal +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Andy Shevchenko + +[ Upstream commit 712a1fcb38dc7cac6da63ee79a88708fbf9c45ec ] + +The removal of the last MAX3100 device triggers the removal of +the driver. However, code doesn't update the respective global +variable and after insmod — rmmod — insmod cycle the kernel +oopses: + + max3100 spi-PRP0001:01: max3100_probe: adding port 0 + BUG: kernel NULL pointer dereference, address: 0000000000000408 + ... + RIP: 0010:serial_core_register_port+0xa0/0x840 + ... + max3100_probe+0x1b6/0x280 [max3100] + spi_probe+0x8d/0xb0 + +Update the actual state so next time UART driver will be registered +again. + +Hugo also noticed, that the error path in the probe also affected +by having the variable set, and not cleared. Instead of clearing it +move the assignment after the successfull uart_register_driver() call. + +Fixes: 7831d56b0a35 ("tty: MAX3100") +Signed-off-by: Andy Shevchenko +Reviewed-by: Hugo Villeneuve +Link: https://lore.kernel.org/r/20240402195306.269276-3-andriy.shevchenko@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/max3100.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c +index 1c4a2b1b1f690..b71676e1f612f 100644 +--- a/drivers/tty/serial/max3100.c ++++ b/drivers/tty/serial/max3100.c +@@ -750,13 +750,14 @@ static int max3100_probe(struct spi_device *spi) + mutex_lock(&max3100s_lock); + + if (!uart_driver_registered) { +- uart_driver_registered = 1; + retval = uart_register_driver(&max3100_uart_driver); + if (retval) { + printk(KERN_ERR "Couldn't register max3100 uart driver\n"); + mutex_unlock(&max3100s_lock); + return retval; + } ++ ++ uart_driver_registered = 1; + } + + for (i = 0; i < MAX_MAX3100; i++) +@@ -842,6 +843,7 @@ static void max3100_remove(struct spi_device *spi) + } + pr_debug("removing max3100 driver\n"); + uart_unregister_driver(&max3100_uart_driver); ++ uart_driver_registered = 0; + + mutex_unlock(&max3100s_lock); + } +-- +2.43.0 + diff --git a/queue-6.1/serial-sc16is7xx-add-proper-sched.h-include-for-sche.patch b/queue-6.1/serial-sc16is7xx-add-proper-sched.h-include-for-sche.patch new file mode 100644 index 00000000000..17b337cb704 --- /dev/null +++ b/queue-6.1/serial-sc16is7xx-add-proper-sched.h-include-for-sche.patch @@ -0,0 +1,44 @@ +From 01b37fb90bb782c4f354355cd2757af81a838ab1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 9 Apr 2024 11:42:49 -0400 +Subject: serial: sc16is7xx: add proper sched.h include for sched_set_fifo() + +From: Hugo Villeneuve + +[ Upstream commit 2a8e4ab0c93fad30769479f86849e22d63cd0e12 ] + +Replace incorrect include with the proper one for sched_set_fifo() +declaration. + +Fixes: 28d2f209cd16 ("sched,serial: Convert to sched_set_fifo()") +Signed-off-by: Hugo Villeneuve +Link: https://lore.kernel.org/r/20240409154253.3043822-2-hugo@hugovil.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/sc16is7xx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c +index e331b57d6d7d3..e6eedebf67765 100644 +--- a/drivers/tty/serial/sc16is7xx.c ++++ b/drivers/tty/serial/sc16is7xx.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -25,7 +26,6 @@ + #include + #include + #include +-#include + + #define SC16IS7XX_NAME "sc16is7xx" + #define SC16IS7XX_MAX_DEVS 8 +-- +2.43.0 + diff --git a/queue-6.1/serial-sh-sci-protect-invalidating-rxdma-on-shutdown.patch b/queue-6.1/serial-sh-sci-protect-invalidating-rxdma-on-shutdown.patch new file mode 100644 index 00000000000..c7062bd6a6b --- /dev/null +++ b/queue-6.1/serial-sh-sci-protect-invalidating-rxdma-on-shutdown.patch @@ -0,0 +1,47 @@ +From b8cd12551c8c39b9b9a22a7b4d02e69d634ba8d0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 May 2024 13:40:17 +0200 +Subject: serial: sh-sci: protect invalidating RXDMA on shutdown + +From: Wolfram Sang + +[ Upstream commit aae20f6e34cd0cbd67a1d0e5877561c40109a81b ] + +The to-be-fixed commit removed locking when invalidating the DMA RX +descriptors on shutdown. It overlooked that there is still a rx_timer +running which may still access the protected data. So, re-add the +locking. + +Reported-by: Dirk Behme +Closes: https://lore.kernel.org/r/ee6c9e16-9f29-450e-81da-4a8dceaa8fc7@de.bosch.com +Fixes: 2c4ee23530ff ("serial: sh-sci: Postpone DMA release when falling back to PIO") +Signed-off-by: Wolfram Sang +Link: https://lore.kernel.org/r/20240506114016.30498-7-wsa+renesas@sang-engineering.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/sh-sci.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c +index e67d3a886bf4f..08ad5ae411216 100644 +--- a/drivers/tty/serial/sh-sci.c ++++ b/drivers/tty/serial/sh-sci.c +@@ -1244,9 +1244,14 @@ static void sci_dma_rx_chan_invalidate(struct sci_port *s) + static void sci_dma_rx_release(struct sci_port *s) + { + struct dma_chan *chan = s->chan_rx_saved; ++ struct uart_port *port = &s->port; ++ unsigned long flags; + ++ uart_port_lock_irqsave(port, &flags); + s->chan_rx_saved = NULL; + sci_dma_rx_chan_invalidate(s); ++ uart_port_unlock_irqrestore(port, flags); ++ + dmaengine_terminate_sync(chan); + dma_free_coherent(chan->device->dev, s->buf_len_rx * 2, s->rx_buf[0], + sg_dma_address(&s->sg_rx[0])); +-- +2.43.0 + diff --git a/queue-6.1/series b/queue-6.1/series index 1bad99edb4c..7b3417c524a 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -272,3 +272,92 @@ af_packet-do-not-call-packet_read_pending-from-tpack.patch sched-fair-allow-disabling-sched_balance_newidle-wit.patch sched-core-fix-incorrect-initialization-of-the-burst.patch scsi-ufs-ufs-qcom-clear-qunipro_g4_sel-for-hw-major-.patch +perf-record-delete-session-after-stopping-sideband-t.patch +perf-probe-add-missing-libgen.h-header-needed-for-us.patch +iio-core-leave-private-pointer-null-when-no-private-.patch +greybus-lights-check-return-of-get_channel_from_mode.patch +f2fs-multidev-fix-to-recognize-valid-zero-block-addr.patch +f2fs-fix-to-wait-on-page-writeback-in-__clone_blkadd.patch +counter-linux-counter.h-fix-excess-kernel-doc-descri.patch +perf-annotate-get-rid-of-duplicate-group-option-item.patch +soundwire-cadence-fix-invalid-pdi-offset.patch +dmaengine-idma64-add-check-for-dma_set_max_seg_size.patch +firmware-dmi-id-add-a-release-callback-function.patch +serial-max3100-lock-port-lock-when-calling-uart_hand.patch +serial-max3100-update-uart_driver_registered-on-driv.patch +serial-max3100-fix-bitwise-types.patch +greybus-arche-ctrl-move-device-table-to-its-right-lo.patch +pci-tegra194-fix-probe-path-for-endpoint-mode.patch +serial-sc16is7xx-add-proper-sched.h-include-for-sche.patch +interconnect-qcom-qcm2290-fix-mas_snoc_bimc-qos-port.patch +arm64-dts-meson-fix-s4-power-controller-node.patch +perf-test-add-w-workload-option.patch +perf-test-add-thloop-test-workload.patch +perf-test-add-leafloop-test-workload.patch +perf-test-add-sqrtloop-test-workload.patch +perf-test-add-brstack-test-workload.patch +perf-test-add-datasym-test-workload.patch +perf-tests-make-test-data-symbol-more-robust-on-neov.patch +dt-bindings-pci-rcar-pci-host-add-optional-regulator.patch +dt-bindings-pci-rcar-pci-host-add-missing-iommu-prop.patch +f2fs-compress-fix-to-relocate-check-condition-in-f2f.patch +f2fs-compress-fix-to-relocate-check-condition-in-f2f.patch-3517 +f2fs-fix-typos-in-comments.patch +f2fs-fix-to-relocate-check-condition-in-f2fs_falloca.patch +f2fs-fix-to-check-pinfile-flag-in-f2fs_move_file_ran.patch +iio-adc-stm32-fixing-err-code-to-not-indicate-succes.patch +coresight-etm4x-fix-unbalanced-pm_runtime_enable.patch +perf-docs-document-bpf-event-modifier.patch +iio-pressure-dps310-support-negative-temperature-val.patch +coresight-etm4x-do-not-hardcode-iomem-access-for-reg.patch +coresight-etm4x-do-not-save-restore-data-trace-contr.patch +coresight-etm4x-safe-access-for-trcqcltr.patch +coresight-etm4x-fix-access-to-resource-selector-regi.patch +fpga-region-add-owner-module-and-take-its-refcount.patch +microblaze-remove-gcc-flag-for-non-existing-early_pr.patch +microblaze-remove-early-printk-call-from-cpuinfo-sta.patch +perf-intel-pt-fix-unassigned-instruction-op-discover.patch +ovl-remove-upper-umask-handling-from-ovl_create_uppe.patch +vmci-fix-an-error-handling-path-in-vmci_guest_probe_.patch +dt-bindings-pinctrl-mediatek-mt7622-fix-array-proper.patch +timers-replace-in_irq-with-in_hardirq.patch +timers-split-try_to_-del_timer-_sync-to-prepare-for-.patch +timers-add-shutdown-mechanism-to-the-internal-functi.patch +timers-provide-timer_shutdown-_sync.patch +watchdog-cpu5wdt.c-fix-use-after-free-bug-caused-by-.patch +watchdog-bd9576-drop-always-running-property.patch +watchdog-sa1100-fix-ptr_err_or_zero-vs-null-check-in.patch +usb-gadget-u_audio-fix-race-condition-use-of-control.patch +usb-gadget-u_audio-clear-uac-pointer-when-freed.patch +stm-class-fix-a-double-free-in-stm_register_device.patch +ppdev-remove-usage-of-the-deprecated-ida_simple_xx-a.patch +ppdev-add-an-error-check-in-register_device.patch +perf-bench-internals-inject-build-id-fix-trap-divide.patch +perf-ui-browser-don-t-save-pointer-to-stack-memory.patch +extcon-max8997-select-irq_domain-instead-of-dependin.patch +pci-edr-align-edr_port_dpc_enable_dsm-with-pci-firmw.patch +pci-edr-align-edr_port_locate_dsm-with-pci-firmware-.patch +perf-ui-browser-avoid-segv-on-title.patch +perf-report-avoid-segv-in-report__setup_sample_type.patch +f2fs-compress-fix-to-update-i_compr_blocks-correctly.patch +f2fs-compress-fix-to-cover-reserve-release-_compress.patch +f2fs-fix-to-release-node-block-count-in-error-path-o.patch +f2fs-compress-don-t-allow-unaligned-truncation-on-re.patch +serial-sh-sci-protect-invalidating-rxdma-on-shutdown.patch +libsubcmd-fix-parse-options-memory-leak.patch +perf-daemon-fix-file-leak-in-daemon_session__control.patch +f2fs-fix-to-add-missing-iput-in-gc_data_segment.patch +perf-stat-don-t-display-metric-header-for-non-leader.patch +loongarch-fix-callchain-parse-error-with-kernel-trac.patch +s390-vdso-filter-out-mno-pic-data-is-text-relative-c.patch +s390-vdso64-filter-out-munaligned-symbols-flag-for-v.patch +s390-vdso-generate-unwind-information-for-c-modules.patch +arm-add-multi_v7_lpae_defconfig.patch +arm64-configs-add-virtconfig.patch +kbuild-unify-vdso_install-rules.patch +kbuild-fix-build-id-symlinks-to-installed-debug-vdso.patch +s390-vdso-create-.build-id-links-for-unstripped-vdso.patch +s390-vdso-use-standard-stack-frame-layout.patch +s390-ipl-fix-incorrect-initialization-of-len-fields-.patch +s390-ipl-fix-incorrect-initialization-of-nvme-dump-b.patch +s390-boot-remove-alt_stfle_fac_list-from-decompresso.patch diff --git a/queue-6.1/soundwire-cadence-fix-invalid-pdi-offset.patch b/queue-6.1/soundwire-cadence-fix-invalid-pdi-offset.patch new file mode 100644 index 00000000000..ffbcd2b62a6 --- /dev/null +++ b/queue-6.1/soundwire-cadence-fix-invalid-pdi-offset.patch @@ -0,0 +1,48 @@ +From fd2a521820c3cdf80bf0a9a86ce33b98cd9b2363 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 Mar 2024 09:01:16 +0000 +Subject: soundwire: cadence: fix invalid PDI offset + +From: Pierre-Louis Bossart + +[ Upstream commit 8ee1b439b1540ae543149b15a2a61b9dff937d91 ] + +For some reason, we add an offset to the PDI, presumably to skip the +PDI0 and PDI1 which are reserved for BPT. + +This code is however completely wrong and leads to an out-of-bounds +access. We were just lucky so far since we used only a couple of PDIs +and remained within the PDI array bounds. + +A Fixes: tag is not provided since there are no known platforms where +the out-of-bounds would be accessed, and the initial code had problems +as well. + +A follow-up patch completely removes this useless offset. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Rander Wang +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20240326090122.1051806-2-yung-chuan.liao@linux.intel.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/soundwire/cadence_master.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c +index 7286c9b3be691..5bd874e58dd6e 100644 +--- a/drivers/soundwire/cadence_master.c ++++ b/drivers/soundwire/cadence_master.c +@@ -1847,7 +1847,7 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns, + + /* check if we found a PDI, else find in bi-directional */ + if (!pdi) +- pdi = cdns_find_pdi(cdns, 2, stream->num_bd, stream->bd, ++ pdi = cdns_find_pdi(cdns, 0, stream->num_bd, stream->bd, + dai_id); + + if (pdi) { +-- +2.43.0 + diff --git a/queue-6.1/stm-class-fix-a-double-free-in-stm_register_device.patch b/queue-6.1/stm-class-fix-a-double-free-in-stm_register_device.patch new file mode 100644 index 00000000000..6547a5b9b97 --- /dev/null +++ b/queue-6.1/stm-class-fix-a-double-free-in-stm_register_device.patch @@ -0,0 +1,57 @@ +From 5903a0c1c33c46c4eee1698c4c00b61276b7c9b7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Apr 2024 16:01:05 +0300 +Subject: stm class: Fix a double free in stm_register_device() + +From: Dan Carpenter + +[ Upstream commit 3df463865ba42b8f88a590326f4c9ea17a1ce459 ] + +The put_device(&stm->dev) call will trigger stm_device_release() which +frees "stm" so the vfree(stm) on the next line is a double free. + +Fixes: 389b6699a2aa ("stm class: Fix stm device initialization order") +Signed-off-by: Dan Carpenter +Reviewed-by: Amelie Delaunay +Reviewed-by: Andy Shevchenko +Signed-off-by: Alexander Shishkin +Link: https://lore.kernel.org/r/20240429130119.1518073-2-alexander.shishkin@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/stm/core.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c +index 2712e699ba08c..ae9ea3a1fa2aa 100644 +--- a/drivers/hwtracing/stm/core.c ++++ b/drivers/hwtracing/stm/core.c +@@ -868,8 +868,11 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data, + return -ENOMEM; + + stm->major = register_chrdev(0, stm_data->name, &stm_fops); +- if (stm->major < 0) +- goto err_free; ++ if (stm->major < 0) { ++ err = stm->major; ++ vfree(stm); ++ return err; ++ } + + device_initialize(&stm->dev); + stm->dev.devt = MKDEV(stm->major, 0); +@@ -913,10 +916,8 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data, + err_device: + unregister_chrdev(stm->major, stm_data->name); + +- /* matches device_initialize() above */ ++ /* calls stm_device_release() */ + put_device(&stm->dev); +-err_free: +- vfree(stm); + + return err; + } +-- +2.43.0 + diff --git a/queue-6.1/timers-add-shutdown-mechanism-to-the-internal-functi.patch b/queue-6.1/timers-add-shutdown-mechanism-to-the-internal-functi.patch new file mode 100644 index 00000000000..7eb01183408 --- /dev/null +++ b/queue-6.1/timers-add-shutdown-mechanism-to-the-internal-functi.patch @@ -0,0 +1,186 @@ +From 0a23c8adcd36fd438fc1774d2e8b8511e7f6bc32 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Nov 2022 21:18:52 +0100 +Subject: timers: Add shutdown mechanism to the internal functions + +From: Thomas Gleixner + +[ Upstream commit 0cc04e80458a822300b93f82ed861a513edde194 ] + +Tearing down timers which have circular dependencies to other +functionality, e.g. workqueues, where the timer can schedule work and work +can arm timers, is not trivial. + +In those cases it is desired to shutdown the timer in a way which prevents +rearming of the timer. The mechanism to do so is to set timer->function to +NULL and use this as an indicator for the timer arming functions to ignore +the (re)arm request. + +Add a shutdown argument to the relevant internal functions which makes the +actual deactivation code set timer->function to NULL which in turn prevents +rearming of the timer. + +Co-developed-by: Steven Rostedt +Signed-off-by: Steven Rostedt +Signed-off-by: Thomas Gleixner +Tested-by: Guenter Roeck +Reviewed-by: Jacob Keller +Reviewed-by: Anna-Maria Behnsen +Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home +Link: https://lore.kernel.org/all/20221110064101.429013735@goodmis.org +Link: https://lore.kernel.org/r/20221123201625.253883224@linutronix.de +Stable-dep-of: 573601521277 ("watchdog: cpu5wdt.c: Fix use-after-free bug caused by cpu5wdt_trigger") +Signed-off-by: Sasha Levin +--- + kernel/time/timer.c | 62 +++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 54 insertions(+), 8 deletions(-) + +diff --git a/kernel/time/timer.c b/kernel/time/timer.c +index 7a73802d946f1..d1e90c4f3a384 100644 +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -1257,12 +1257,19 @@ EXPORT_SYMBOL_GPL(add_timer_on); + /** + * __timer_delete - Internal function: Deactivate a timer + * @timer: The timer to be deactivated ++ * @shutdown: If true, this indicates that the timer is about to be ++ * shutdown permanently. ++ * ++ * If @shutdown is true then @timer->function is set to NULL under the ++ * timer base lock which prevents further rearming of the time. In that ++ * case any attempt to rearm @timer after this function returns will be ++ * silently ignored. + * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending and deactivated + */ +-static int __timer_delete(struct timer_list *timer) ++static int __timer_delete(struct timer_list *timer, bool shutdown) + { + struct timer_base *base; + unsigned long flags; +@@ -1270,9 +1277,22 @@ static int __timer_delete(struct timer_list *timer) + + debug_assert_init(timer); + +- if (timer_pending(timer)) { ++ /* ++ * If @shutdown is set then the lock has to be taken whether the ++ * timer is pending or not to protect against a concurrent rearm ++ * which might hit between the lockless pending check and the lock ++ * aquisition. By taking the lock it is ensured that such a newly ++ * enqueued timer is dequeued and cannot end up with ++ * timer->function == NULL in the expiry code. ++ * ++ * If timer->function is currently executed, then this makes sure ++ * that the callback cannot requeue the timer. ++ */ ++ if (timer_pending(timer) || shutdown) { + base = lock_timer_base(timer, &flags); + ret = detach_if_pending(timer, base, true); ++ if (shutdown) ++ timer->function = NULL; + raw_spin_unlock_irqrestore(&base->lock, flags); + } + +@@ -1295,20 +1315,31 @@ static int __timer_delete(struct timer_list *timer) + */ + int timer_delete(struct timer_list *timer) + { +- return __timer_delete(timer); ++ return __timer_delete(timer, false); + } + EXPORT_SYMBOL(timer_delete); + + /** + * __try_to_del_timer_sync - Internal function: Try to deactivate a timer + * @timer: Timer to deactivate ++ * @shutdown: If true, this indicates that the timer is about to be ++ * shutdown permanently. ++ * ++ * If @shutdown is true then @timer->function is set to NULL under the ++ * timer base lock which prevents further rearming of the timer. Any ++ * attempt to rearm @timer after this function returns will be silently ++ * ignored. ++ * ++ * This function cannot guarantee that the timer cannot be rearmed ++ * right after dropping the base lock if @shutdown is false. That ++ * needs to be prevented by the calling code if necessary. + * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending and deactivated + * * %-1 - The timer callback function is running on a different CPU + */ +-static int __try_to_del_timer_sync(struct timer_list *timer) ++static int __try_to_del_timer_sync(struct timer_list *timer, bool shutdown) + { + struct timer_base *base; + unsigned long flags; +@@ -1320,6 +1351,8 @@ static int __try_to_del_timer_sync(struct timer_list *timer) + + if (base->running_timer != timer) + ret = detach_if_pending(timer, base, true); ++ if (shutdown) ++ timer->function = NULL; + + raw_spin_unlock_irqrestore(&base->lock, flags); + +@@ -1344,7 +1377,7 @@ static int __try_to_del_timer_sync(struct timer_list *timer) + */ + int try_to_del_timer_sync(struct timer_list *timer) + { +- return __try_to_del_timer_sync(timer); ++ return __try_to_del_timer_sync(timer, false); + } + EXPORT_SYMBOL(try_to_del_timer_sync); + +@@ -1425,12 +1458,25 @@ static inline void del_timer_wait_running(struct timer_list *timer) { } + * __timer_delete_sync - Internal function: Deactivate a timer and wait + * for the handler to finish. + * @timer: The timer to be deactivated ++ * @shutdown: If true, @timer->function will be set to NULL under the ++ * timer base lock which prevents rearming of @timer ++ * ++ * If @shutdown is not set the timer can be rearmed later. If the timer can ++ * be rearmed concurrently, i.e. after dropping the base lock then the ++ * return value is meaningless. ++ * ++ * If @shutdown is set then @timer->function is set to NULL under timer ++ * base lock which prevents rearming of the timer. Any attempt to rearm ++ * a shutdown timer is silently ignored. ++ * ++ * If the timer should be reused after shutdown it has to be initialized ++ * again. + * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending and deactivated + */ +-static int __timer_delete_sync(struct timer_list *timer) ++static int __timer_delete_sync(struct timer_list *timer, bool shutdown) + { + int ret; + +@@ -1460,7 +1506,7 @@ static int __timer_delete_sync(struct timer_list *timer) + lockdep_assert_preemption_enabled(); + + do { +- ret = __try_to_del_timer_sync(timer); ++ ret = __try_to_del_timer_sync(timer, shutdown); + + if (unlikely(ret < 0)) { + del_timer_wait_running(timer); +@@ -1512,7 +1558,7 @@ static int __timer_delete_sync(struct timer_list *timer) + */ + int timer_delete_sync(struct timer_list *timer) + { +- return __timer_delete_sync(timer); ++ return __timer_delete_sync(timer, false); + } + EXPORT_SYMBOL(timer_delete_sync); + +-- +2.43.0 + diff --git a/queue-6.1/timers-provide-timer_shutdown-_sync.patch b/queue-6.1/timers-provide-timer_shutdown-_sync.patch new file mode 100644 index 00000000000..f8211098586 --- /dev/null +++ b/queue-6.1/timers-provide-timer_shutdown-_sync.patch @@ -0,0 +1,152 @@ +From c5df943f2d459424a02c4898485a674a9be446d3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Nov 2022 21:18:53 +0100 +Subject: timers: Provide timer_shutdown[_sync]() + +From: Thomas Gleixner + +[ Upstream commit f571faf6e443b6011ccb585d57866177af1f643c ] + +Tearing down timers which have circular dependencies to other +functionality, e.g. workqueues, where the timer can schedule work and work +can arm timers, is not trivial. + +In those cases it is desired to shutdown the timer in a way which prevents +rearming of the timer. The mechanism to do so is to set timer->function to +NULL and use this as an indicator for the timer arming functions to ignore +the (re)arm request. + +Expose new interfaces for this: timer_shutdown_sync() and timer_shutdown(). + +timer_shutdown_sync() has the same functionality as timer_delete_sync() +plus the NULL-ification of the timer function. + +timer_shutdown() has the same functionality as timer_delete() plus the +NULL-ification of the timer function. + +In both cases the rearming of the timer is prevented by silently discarding +rearm attempts due to timer->function being NULL. + +Co-developed-by: Steven Rostedt +Signed-off-by: Steven Rostedt +Signed-off-by: Thomas Gleixner +Tested-by: Guenter Roeck +Reviewed-by: Jacob Keller +Reviewed-by: Anna-Maria Behnsen +Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home +Link: https://lore.kernel.org/all/20221110064101.429013735@goodmis.org +Link: https://lore.kernel.org/r/20221123201625.314230270@linutronix.de +Stable-dep-of: 573601521277 ("watchdog: cpu5wdt.c: Fix use-after-free bug caused by cpu5wdt_trigger") +Signed-off-by: Sasha Levin +--- + include/linux/timer.h | 2 ++ + kernel/time/timer.c | 66 +++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 68 insertions(+) + +diff --git a/include/linux/timer.h b/include/linux/timer.h +index e338e173ce8bc..9162f275819a7 100644 +--- a/include/linux/timer.h ++++ b/include/linux/timer.h +@@ -184,6 +184,8 @@ extern void add_timer(struct timer_list *timer); + extern int try_to_del_timer_sync(struct timer_list *timer); + extern int timer_delete_sync(struct timer_list *timer); + extern int timer_delete(struct timer_list *timer); ++extern int timer_shutdown_sync(struct timer_list *timer); ++extern int timer_shutdown(struct timer_list *timer); + + /** + * del_timer_sync - Delete a pending timer and wait for a running callback +diff --git a/kernel/time/timer.c b/kernel/time/timer.c +index d1e90c4f3a384..a98630796da8d 100644 +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -1319,6 +1319,27 @@ int timer_delete(struct timer_list *timer) + } + EXPORT_SYMBOL(timer_delete); + ++/** ++ * timer_shutdown - Deactivate a timer and prevent rearming ++ * @timer: The timer to be deactivated ++ * ++ * The function does not wait for an eventually running timer callback on a ++ * different CPU but it prevents rearming of the timer. Any attempt to arm ++ * @timer after this function returns will be silently ignored. ++ * ++ * This function is useful for teardown code and should only be used when ++ * timer_shutdown_sync() cannot be invoked due to locking or context constraints. ++ * ++ * Return: ++ * * %0 - The timer was not pending ++ * * %1 - The timer was pending ++ */ ++int timer_shutdown(struct timer_list *timer) ++{ ++ return __timer_delete(timer, true); ++} ++EXPORT_SYMBOL_GPL(timer_shutdown); ++ + /** + * __try_to_del_timer_sync - Internal function: Try to deactivate a timer + * @timer: Timer to deactivate +@@ -1552,6 +1573,9 @@ static int __timer_delete_sync(struct timer_list *timer, bool shutdown) + * lock. If there is the possibility of a concurrent rearm then the return + * value of the function is meaningless. + * ++ * If such a guarantee is needed, e.g. for teardown situations then use ++ * timer_shutdown_sync() instead. ++ * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending and deactivated +@@ -1562,6 +1586,48 @@ int timer_delete_sync(struct timer_list *timer) + } + EXPORT_SYMBOL(timer_delete_sync); + ++/** ++ * timer_shutdown_sync - Shutdown a timer and prevent rearming ++ * @timer: The timer to be shutdown ++ * ++ * When the function returns it is guaranteed that: ++ * - @timer is not queued ++ * - The callback function of @timer is not running ++ * - @timer cannot be enqueued again. Any attempt to rearm ++ * @timer is silently ignored. ++ * ++ * See timer_delete_sync() for synchronization rules. ++ * ++ * This function is useful for final teardown of an infrastructure where ++ * the timer is subject to a circular dependency problem. ++ * ++ * A common pattern for this is a timer and a workqueue where the timer can ++ * schedule work and work can arm the timer. On shutdown the workqueue must ++ * be destroyed and the timer must be prevented from rearming. Unless the ++ * code has conditionals like 'if (mything->in_shutdown)' to prevent that ++ * there is no way to get this correct with timer_delete_sync(). ++ * ++ * timer_shutdown_sync() is solving the problem. The correct ordering of ++ * calls in this case is: ++ * ++ * timer_shutdown_sync(&mything->timer); ++ * workqueue_destroy(&mything->workqueue); ++ * ++ * After this 'mything' can be safely freed. ++ * ++ * This obviously implies that the timer is not required to be functional ++ * for the rest of the shutdown operation. ++ * ++ * Return: ++ * * %0 - The timer was not pending ++ * * %1 - The timer was pending ++ */ ++int timer_shutdown_sync(struct timer_list *timer) ++{ ++ return __timer_delete_sync(timer, true); ++} ++EXPORT_SYMBOL_GPL(timer_shutdown_sync); ++ + static void call_timer_fn(struct timer_list *timer, + void (*fn)(struct timer_list *), + unsigned long baseclk) +-- +2.43.0 + diff --git a/queue-6.1/timers-replace-in_irq-with-in_hardirq.patch b/queue-6.1/timers-replace-in_irq-with-in_hardirq.patch new file mode 100644 index 00000000000..5b5261e9691 --- /dev/null +++ b/queue-6.1/timers-replace-in_irq-with-in_hardirq.patch @@ -0,0 +1,38 @@ +From c1c90aae953d392c4a876c82731033982d3c2417 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 Oct 2022 01:26:29 +0000 +Subject: timers: Replace in_irq() with in_hardirq() + +From: ye xingchen + +[ Upstream commit 8be3f96ceddb911539a53d87a66da84a04502366 ] + +Replace the obsolete and ambiguous macro in_irq() with new +macro in_hardirq(). + +Signed-off-by: ye xingchen +Signed-off-by: Thomas Gleixner +Acked-by: John Stultz +Link: https://lore.kernel.org/r/20221012012629.334966-1-ye.xingchen@zte.com.cn +Stable-dep-of: 573601521277 ("watchdog: cpu5wdt.c: Fix use-after-free bug caused by cpu5wdt_trigger") +Signed-off-by: Sasha Levin +--- + kernel/time/timer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/time/timer.c b/kernel/time/timer.c +index e09852be4e638..b2d4cb2373ad6 100644 +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -1453,7 +1453,7 @@ int timer_delete_sync(struct timer_list *timer) + * don't use it in hardirq context, because it + * could lead to deadlock. + */ +- WARN_ON(in_irq() && !(timer->flags & TIMER_IRQSAFE)); ++ WARN_ON(in_hardirq() && !(timer->flags & TIMER_IRQSAFE)); + + /* + * Must be able to sleep on PREEMPT_RT because of the slowpath in +-- +2.43.0 + diff --git a/queue-6.1/timers-split-try_to_-del_timer-_sync-to-prepare-for-.patch b/queue-6.1/timers-split-try_to_-del_timer-_sync-to-prepare-for-.patch new file mode 100644 index 00000000000..a4e78972cf8 --- /dev/null +++ b/queue-6.1/timers-split-try_to_-del_timer-_sync-to-prepare-for-.patch @@ -0,0 +1,254 @@ +From 74bbe4f47f2d114ba411d4d0ead28ffcabfbd316 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Nov 2022 21:18:50 +0100 +Subject: timers: Split [try_to_]del_timer[_sync]() to prepare for shutdown + mode + +From: Thomas Gleixner + +[ Upstream commit 8553b5f2774a66b1f293b7d783934210afb8f23c ] + +Tearing down timers which have circular dependencies to other +functionality, e.g. workqueues, where the timer can schedule work and work +can arm timers, is not trivial. + +In those cases it is desired to shutdown the timer in a way which prevents +rearming of the timer. The mechanism to do so is to set timer->function to +NULL and use this as an indicator for the timer arming functions to ignore +the (re)arm request. + +Split the inner workings of try_do_del_timer_sync(), del_timer_sync() and +del_timer() into helper functions to prepare for implementing the shutdown +functionality. + +No functional change. + +Co-developed-by: Steven Rostedt +Signed-off-by: Steven Rostedt +Signed-off-by: Thomas Gleixner +Tested-by: Guenter Roeck +Reviewed-by: Jacob Keller +Reviewed-by: Anna-Maria Behnsen +Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home +Link: https://lore.kernel.org/all/20221110064101.429013735@goodmis.org +Link: https://lore.kernel.org/r/20221123201625.195147423@linutronix.de +Stable-dep-of: 573601521277 ("watchdog: cpu5wdt.c: Fix use-after-free bug caused by cpu5wdt_trigger") +Signed-off-by: Sasha Levin +--- + kernel/time/timer.c | 143 ++++++++++++++++++++++++++++---------------- + 1 file changed, 92 insertions(+), 51 deletions(-) + +diff --git a/kernel/time/timer.c b/kernel/time/timer.c +index b2d4cb2373ad6..7a73802d946f1 100644 +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -1255,20 +1255,14 @@ void add_timer_on(struct timer_list *timer, int cpu) + EXPORT_SYMBOL_GPL(add_timer_on); + + /** +- * timer_delete - Deactivate a timer ++ * __timer_delete - Internal function: Deactivate a timer + * @timer: The timer to be deactivated + * +- * The function only deactivates a pending timer, but contrary to +- * timer_delete_sync() it does not take into account whether the timer's +- * callback function is concurrently executed on a different CPU or not. +- * It neither prevents rearming of the timer. If @timer can be rearmed +- * concurrently then the return value of this function is meaningless. +- * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending and deactivated + */ +-int timer_delete(struct timer_list *timer) ++static int __timer_delete(struct timer_list *timer) + { + struct timer_base *base; + unsigned long flags; +@@ -1284,25 +1278,37 @@ int timer_delete(struct timer_list *timer) + + return ret; + } +-EXPORT_SYMBOL(timer_delete); + + /** +- * try_to_del_timer_sync - Try to deactivate a timer +- * @timer: Timer to deactivate ++ * timer_delete - Deactivate a timer ++ * @timer: The timer to be deactivated + * +- * This function tries to deactivate a timer. On success the timer is not +- * queued and the timer callback function is not running on any CPU. ++ * The function only deactivates a pending timer, but contrary to ++ * timer_delete_sync() it does not take into account whether the timer's ++ * callback function is concurrently executed on a different CPU or not. ++ * It neither prevents rearming of the timer. If @timer can be rearmed ++ * concurrently then the return value of this function is meaningless. + * +- * This function does not guarantee that the timer cannot be rearmed right +- * after dropping the base lock. That needs to be prevented by the calling +- * code if necessary. ++ * Return: ++ * * %0 - The timer was not pending ++ * * %1 - The timer was pending and deactivated ++ */ ++int timer_delete(struct timer_list *timer) ++{ ++ return __timer_delete(timer); ++} ++EXPORT_SYMBOL(timer_delete); ++ ++/** ++ * __try_to_del_timer_sync - Internal function: Try to deactivate a timer ++ * @timer: Timer to deactivate + * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending and deactivated + * * %-1 - The timer callback function is running on a different CPU + */ +-int try_to_del_timer_sync(struct timer_list *timer) ++static int __try_to_del_timer_sync(struct timer_list *timer) + { + struct timer_base *base; + unsigned long flags; +@@ -1319,6 +1325,27 @@ int try_to_del_timer_sync(struct timer_list *timer) + + return ret; + } ++ ++/** ++ * try_to_del_timer_sync - Try to deactivate a timer ++ * @timer: Timer to deactivate ++ * ++ * This function tries to deactivate a timer. On success the timer is not ++ * queued and the timer callback function is not running on any CPU. ++ * ++ * This function does not guarantee that the timer cannot be rearmed right ++ * after dropping the base lock. That needs to be prevented by the calling ++ * code if necessary. ++ * ++ * Return: ++ * * %0 - The timer was not pending ++ * * %1 - The timer was pending and deactivated ++ * * %-1 - The timer callback function is running on a different CPU ++ */ ++int try_to_del_timer_sync(struct timer_list *timer) ++{ ++ return __try_to_del_timer_sync(timer); ++} + EXPORT_SYMBOL(try_to_del_timer_sync); + + #ifdef CONFIG_PREEMPT_RT +@@ -1395,45 +1422,15 @@ static inline void del_timer_wait_running(struct timer_list *timer) { } + #endif + + /** +- * timer_delete_sync - Deactivate a timer and wait for the handler to finish. ++ * __timer_delete_sync - Internal function: Deactivate a timer and wait ++ * for the handler to finish. + * @timer: The timer to be deactivated + * +- * Synchronization rules: Callers must prevent restarting of the timer, +- * otherwise this function is meaningless. It must not be called from +- * interrupt contexts unless the timer is an irqsafe one. The caller must +- * not hold locks which would prevent completion of the timer's callback +- * function. The timer's handler must not call add_timer_on(). Upon exit +- * the timer is not queued and the handler is not running on any CPU. +- * +- * For !irqsafe timers, the caller must not hold locks that are held in +- * interrupt context. Even if the lock has nothing to do with the timer in +- * question. Here's why:: +- * +- * CPU0 CPU1 +- * ---- ---- +- * +- * call_timer_fn(); +- * base->running_timer = mytimer; +- * spin_lock_irq(somelock); +- * +- * spin_lock(somelock); +- * timer_delete_sync(mytimer); +- * while (base->running_timer == mytimer); +- * +- * Now timer_delete_sync() will never return and never release somelock. +- * The interrupt on the other CPU is waiting to grab somelock but it has +- * interrupted the softirq that CPU0 is waiting to finish. +- * +- * This function cannot guarantee that the timer is not rearmed again by +- * some concurrent or preempting code, right after it dropped the base +- * lock. If there is the possibility of a concurrent rearm then the return +- * value of the function is meaningless. +- * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending and deactivated + */ +-int timer_delete_sync(struct timer_list *timer) ++static int __timer_delete_sync(struct timer_list *timer) + { + int ret; + +@@ -1463,7 +1460,7 @@ int timer_delete_sync(struct timer_list *timer) + lockdep_assert_preemption_enabled(); + + do { +- ret = try_to_del_timer_sync(timer); ++ ret = __try_to_del_timer_sync(timer); + + if (unlikely(ret < 0)) { + del_timer_wait_running(timer); +@@ -1473,6 +1470,50 @@ int timer_delete_sync(struct timer_list *timer) + + return ret; + } ++ ++/** ++ * timer_delete_sync - Deactivate a timer and wait for the handler to finish. ++ * @timer: The timer to be deactivated ++ * ++ * Synchronization rules: Callers must prevent restarting of the timer, ++ * otherwise this function is meaningless. It must not be called from ++ * interrupt contexts unless the timer is an irqsafe one. The caller must ++ * not hold locks which would prevent completion of the timer's callback ++ * function. The timer's handler must not call add_timer_on(). Upon exit ++ * the timer is not queued and the handler is not running on any CPU. ++ * ++ * For !irqsafe timers, the caller must not hold locks that are held in ++ * interrupt context. Even if the lock has nothing to do with the timer in ++ * question. Here's why:: ++ * ++ * CPU0 CPU1 ++ * ---- ---- ++ * ++ * call_timer_fn(); ++ * base->running_timer = mytimer; ++ * spin_lock_irq(somelock); ++ * ++ * spin_lock(somelock); ++ * timer_delete_sync(mytimer); ++ * while (base->running_timer == mytimer); ++ * ++ * Now timer_delete_sync() will never return and never release somelock. ++ * The interrupt on the other CPU is waiting to grab somelock but it has ++ * interrupted the softirq that CPU0 is waiting to finish. ++ * ++ * This function cannot guarantee that the timer is not rearmed again by ++ * some concurrent or preempting code, right after it dropped the base ++ * lock. If there is the possibility of a concurrent rearm then the return ++ * value of the function is meaningless. ++ * ++ * Return: ++ * * %0 - The timer was not pending ++ * * %1 - The timer was pending and deactivated ++ */ ++int timer_delete_sync(struct timer_list *timer) ++{ ++ return __timer_delete_sync(timer); ++} + EXPORT_SYMBOL(timer_delete_sync); + + static void call_timer_fn(struct timer_list *timer, +-- +2.43.0 + diff --git a/queue-6.1/usb-gadget-u_audio-clear-uac-pointer-when-freed.patch b/queue-6.1/usb-gadget-u_audio-clear-uac-pointer-when-freed.patch new file mode 100644 index 00000000000..dcc6bc8bb93 --- /dev/null +++ b/queue-6.1/usb-gadget-u_audio-clear-uac-pointer-when-freed.patch @@ -0,0 +1,40 @@ +From ec910a3715e7e3f9127953d2e08c0b473c57339d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Apr 2024 15:20:20 +0000 +Subject: usb: gadget: u_audio: Clear uac pointer when freed. + +From: Chris Wulff + +[ Upstream commit a2cf936ebef291ef7395172b9e2f624779fb6dc0 ] + +This prevents use of a stale pointer if functions are called after +g_cleanup that shouldn't be. This doesn't fix any races, but converts +a possibly silent kernel memory corruption into an obvious NULL pointer +dereference report. + +Fixes: eb9fecb9e69b ("usb: gadget: f_uac2: split out audio core") +Signed-off-by: Chris Wulff +Link: https://lore.kernel.org/stable/CO1PR17MB54194226DA08BFC9EBD8C163E1172%40CO1PR17MB5419.namprd17.prod.outlook.com +Link: https://lore.kernel.org/r/CO1PR17MB54194226DA08BFC9EBD8C163E1172@CO1PR17MB5419.namprd17.prod.outlook.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/gadget/function/u_audio.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c +index c8e8154c59f50..ec1dceb087293 100644 +--- a/drivers/usb/gadget/function/u_audio.c ++++ b/drivers/usb/gadget/function/u_audio.c +@@ -1419,6 +1419,8 @@ void g_audio_cleanup(struct g_audio *g_audio) + return; + + uac = g_audio->uac; ++ g_audio->uac = NULL; ++ + card = uac->card; + if (card) + snd_card_free_when_closed(card); +-- +2.43.0 + diff --git a/queue-6.1/usb-gadget-u_audio-fix-race-condition-use-of-control.patch b/queue-6.1/usb-gadget-u_audio-fix-race-condition-use-of-control.patch new file mode 100644 index 00000000000..2cbe70a6074 --- /dev/null +++ b/queue-6.1/usb-gadget-u_audio-fix-race-condition-use-of-control.patch @@ -0,0 +1,110 @@ +From 980c23cab1f9021c86db9f7936a3cd45c3b63e33 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Apr 2024 15:18:01 +0000 +Subject: usb: gadget: u_audio: Fix race condition use of controls after free + during gadget unbind. + +From: Chris Wulff + +[ Upstream commit 1b739388aa3f8dfb63a9fca777e6dfa6912d0464 ] + +Hang on to the control IDs instead of pointers since those are correctly +handled with locks. + +Fixes: 8fe9a03f4331 ("usb: gadget: u_audio: Rate ctl notifies about current srate (0=stopped)") +Fixes: c565ad07ef35 ("usb: gadget: u_audio: Support multiple sampling rates") +Fixes: 02de698ca812 ("usb: gadget: u_audio: add bi-directional volume and mute support") +Signed-off-by: Chris Wulff +Link: https://lore.kernel.org/stable/CO1PR17MB5419C2BF44D400E4E620C1ADE1172%40CO1PR17MB5419.namprd17.prod.outlook.com +Link: https://lore.kernel.org/r/CO1PR17MB5419C2BF44D400E4E620C1ADE1172@CO1PR17MB5419.namprd17.prod.outlook.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/gadget/function/u_audio.c | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) + +diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c +index 4a42574b4a7fe..c8e8154c59f50 100644 +--- a/drivers/usb/gadget/function/u_audio.c ++++ b/drivers/usb/gadget/function/u_audio.c +@@ -57,13 +57,13 @@ struct uac_rtd_params { + + /* Volume/Mute controls and their state */ + int fu_id; /* Feature Unit ID */ +- struct snd_kcontrol *snd_kctl_volume; +- struct snd_kcontrol *snd_kctl_mute; ++ struct snd_ctl_elem_id snd_kctl_volume_id; ++ struct snd_ctl_elem_id snd_kctl_mute_id; + s16 volume_min, volume_max, volume_res; + s16 volume; + int mute; + +- struct snd_kcontrol *snd_kctl_rate; /* read-only current rate */ ++ struct snd_ctl_elem_id snd_kctl_rate_id; /* read-only current rate */ + int srate; /* selected samplerate */ + int active; /* playback/capture running */ + +@@ -494,14 +494,13 @@ static inline void free_ep_fback(struct uac_rtd_params *prm, struct usb_ep *ep) + static void set_active(struct uac_rtd_params *prm, bool active) + { + // notifying through the Rate ctrl +- struct snd_kcontrol *kctl = prm->snd_kctl_rate; + unsigned long flags; + + spin_lock_irqsave(&prm->lock, flags); + if (prm->active != active) { + prm->active = active; + snd_ctl_notify(prm->uac->card, SNDRV_CTL_EVENT_MASK_VALUE, +- &kctl->id); ++ &prm->snd_kctl_rate_id); + } + spin_unlock_irqrestore(&prm->lock, flags); + } +@@ -807,7 +806,7 @@ int u_audio_set_volume(struct g_audio *audio_dev, int playback, s16 val) + + if (change) + snd_ctl_notify(uac->card, SNDRV_CTL_EVENT_MASK_VALUE, +- &prm->snd_kctl_volume->id); ++ &prm->snd_kctl_volume_id); + + return 0; + } +@@ -856,7 +855,7 @@ int u_audio_set_mute(struct g_audio *audio_dev, int playback, int val) + + if (change) + snd_ctl_notify(uac->card, SNDRV_CTL_EVENT_MASK_VALUE, +- &prm->snd_kctl_mute->id); ++ &prm->snd_kctl_mute_id); + + return 0; + } +@@ -1331,7 +1330,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, + err = snd_ctl_add(card, kctl); + if (err < 0) + goto snd_fail; +- prm->snd_kctl_mute = kctl; ++ prm->snd_kctl_mute_id = kctl->id; + prm->mute = 0; + } + +@@ -1359,7 +1358,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, + err = snd_ctl_add(card, kctl); + if (err < 0) + goto snd_fail; +- prm->snd_kctl_volume = kctl; ++ prm->snd_kctl_volume_id = kctl->id; + prm->volume = fu->volume_max; + prm->volume_max = fu->volume_max; + prm->volume_min = fu->volume_min; +@@ -1383,7 +1382,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, + err = snd_ctl_add(card, kctl); + if (err < 0) + goto snd_fail; +- prm->snd_kctl_rate = kctl; ++ prm->snd_kctl_rate_id = kctl->id; + } + + strscpy(card->driver, card_name, sizeof(card->driver)); +-- +2.43.0 + diff --git a/queue-6.1/vmci-fix-an-error-handling-path-in-vmci_guest_probe_.patch b/queue-6.1/vmci-fix-an-error-handling-path-in-vmci_guest_probe_.patch new file mode 100644 index 00000000000..e39fc45ea51 --- /dev/null +++ b/queue-6.1/vmci-fix-an-error-handling-path-in-vmci_guest_probe_.patch @@ -0,0 +1,66 @@ +From 537284ed6f668a7fa26cbe2a25ea986afaf7c64f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Apr 2024 14:27:23 +0200 +Subject: VMCI: Fix an error handling path in vmci_guest_probe_device() + +From: Christophe JAILLET + +[ Upstream commit 73df3d6f2e9533e93a5039a33c40dd7216b81801 ] + +After a successful pci_iomap_range() call, pci_iounmap() should be called +in the error handling path, as already done in the remove function. + +Add the missing call. + +The corresponding call was added in the remove function in commit +5ee109828e73 ("VMCI: dma dg: allocate send and receive buffers for DMA +datagrams") + +Fixes: e283a0e8b7ea ("VMCI: dma dg: add MMIO access to registers") +Signed-off-by: Christophe JAILLET +Acked-by: Vishnu Dasa +Link: https://lore.kernel.org/r/a35bbc3876ae1da70e49dafde4435750e1477be3.1713961553.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/vmw_vmci/vmci_guest.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c +index 4f8d962bb5b2a..1300ccab3d21b 100644 +--- a/drivers/misc/vmw_vmci/vmci_guest.c ++++ b/drivers/misc/vmw_vmci/vmci_guest.c +@@ -625,7 +625,8 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, + if (!vmci_dev) { + dev_err(&pdev->dev, + "Can't allocate memory for VMCI device\n"); +- return -ENOMEM; ++ error = -ENOMEM; ++ goto err_unmap_mmio_base; + } + + vmci_dev->dev = &pdev->dev; +@@ -642,7 +643,8 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, + if (!vmci_dev->tx_buffer) { + dev_err(&pdev->dev, + "Can't allocate memory for datagram tx buffer\n"); +- return -ENOMEM; ++ error = -ENOMEM; ++ goto err_unmap_mmio_base; + } + + vmci_dev->data_buffer = dma_alloc_coherent(&pdev->dev, VMCI_DMA_DG_BUFFER_SIZE, +@@ -893,6 +895,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, + err_free_data_buffers: + vmci_free_dg_buffers(vmci_dev); + ++err_unmap_mmio_base: ++ if (mmio_base != NULL) ++ pci_iounmap(pdev, mmio_base); ++ + /* The rest are managed resources and will be freed by PCI core */ + return error; + } +-- +2.43.0 + diff --git a/queue-6.1/watchdog-bd9576-drop-always-running-property.patch b/queue-6.1/watchdog-bd9576-drop-always-running-property.patch new file mode 100644 index 00000000000..9247c46fbce --- /dev/null +++ b/queue-6.1/watchdog-bd9576-drop-always-running-property.patch @@ -0,0 +1,84 @@ +From bb1c99582d2cddbbffe7567c30845aee5f983d03 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 8 Apr 2024 13:02:31 +0300 +Subject: watchdog: bd9576: Drop "always-running" property + +From: Matti Vaittinen + +[ Upstream commit e3b3afd34d84efcbe4543deb966b1990f43584b8 ] + +The always-running (from linux,wdt-gpio.yaml) is abused by the BD9576 +watchdog driver. It's defined meaning is "the watchdog is always running +and can not be stopped". The BD9576 watchdog driver has implemented it +as "start watchdog when loading the module and prevent it from being +stopped". + +Furthermore, the implementation does not set the WDOG_HW_RUNNING when +enabling the watchdog due to the "always-running" at module loading. +This will end up resulting a watchdog timeout if the device is not +opened. + +The culprit was pointed out by Guenter, discussion can be found from +https://lore.kernel.org/lkml/4fa3a64b-60fb-4e5e-8785-0f14da37eea2@roeck-us.net/ + +Drop the invalid "always-running" handling. + +Signed-off-by: Matti Vaittinen +Reported-by: Guenter Roeck +Fixes: b237bcac557a ("wdt: Support wdt on ROHM BD9576MUF and BD9573MUF") +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/ZhPAt76yaJMersXf@fedora +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/bd9576_wdt.c | 12 +----------- + 1 file changed, 1 insertion(+), 11 deletions(-) + +diff --git a/drivers/watchdog/bd9576_wdt.c b/drivers/watchdog/bd9576_wdt.c +index 4a20e07fbb699..f00ea1b4e40b6 100644 +--- a/drivers/watchdog/bd9576_wdt.c ++++ b/drivers/watchdog/bd9576_wdt.c +@@ -29,7 +29,6 @@ struct bd9576_wdt_priv { + struct gpio_desc *gpiod_en; + struct device *dev; + struct regmap *regmap; +- bool always_running; + struct watchdog_device wdd; + }; + +@@ -62,10 +61,7 @@ static int bd9576_wdt_stop(struct watchdog_device *wdd) + { + struct bd9576_wdt_priv *priv = watchdog_get_drvdata(wdd); + +- if (!priv->always_running) +- bd9576_wdt_disable(priv); +- else +- set_bit(WDOG_HW_RUNNING, &wdd->status); ++ bd9576_wdt_disable(priv); + + return 0; + } +@@ -264,9 +260,6 @@ static int bd9576_wdt_probe(struct platform_device *pdev) + if (ret) + return ret; + +- priv->always_running = device_property_read_bool(dev->parent, +- "always-running"); +- + watchdog_set_drvdata(&priv->wdd, priv); + + priv->wdd.info = &bd957x_wdt_ident; +@@ -281,9 +274,6 @@ static int bd9576_wdt_probe(struct platform_device *pdev) + + watchdog_stop_on_reboot(&priv->wdd); + +- if (priv->always_running) +- bd9576_wdt_start(&priv->wdd); +- + return devm_watchdog_register_device(dev, &priv->wdd); + } + +-- +2.43.0 + diff --git a/queue-6.1/watchdog-cpu5wdt.c-fix-use-after-free-bug-caused-by-.patch b/queue-6.1/watchdog-cpu5wdt.c-fix-use-after-free-bug-caused-by-.patch new file mode 100644 index 00000000000..24709b7d43a --- /dev/null +++ b/queue-6.1/watchdog-cpu5wdt.c-fix-use-after-free-bug-caused-by-.patch @@ -0,0 +1,46 @@ +From 64803d86c1894e5a41d7fe94b84a54498c3291f9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 24 Mar 2024 22:04:44 +0800 +Subject: watchdog: cpu5wdt.c: Fix use-after-free bug caused by cpu5wdt_trigger + +From: Duoming Zhou + +[ Upstream commit 573601521277119f2e2ba5f28ae6e87fc594f4d4 ] + +When the cpu5wdt module is removing, the origin code uses del_timer() to +de-activate the timer. If the timer handler is running, del_timer() could +not stop it and will return directly. If the port region is released by +release_region() and then the timer handler cpu5wdt_trigger() calls outb() +to write into the region that is released, the use-after-free bug will +happen. + +Change del_timer() to timer_shutdown_sync() in order that the timer handler +could be finished before the port region is released. + +Fixes: e09d9c3e9f85 ("watchdog: cpu5wdt.c: add missing del_timer call") +Signed-off-by: Duoming Zhou +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20240324140444.119584-1-duoming@zju.edu.cn +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/cpu5wdt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c +index 688b112e712ba..9f279c0e13a66 100644 +--- a/drivers/watchdog/cpu5wdt.c ++++ b/drivers/watchdog/cpu5wdt.c +@@ -252,7 +252,7 @@ static void cpu5wdt_exit(void) + if (cpu5wdt_device.queue) { + cpu5wdt_device.queue = 0; + wait_for_completion(&cpu5wdt_device.stop); +- del_timer(&cpu5wdt_device.timer); ++ timer_shutdown_sync(&cpu5wdt_device.timer); + } + + misc_deregister(&cpu5wdt_misc); +-- +2.43.0 + diff --git a/queue-6.1/watchdog-sa1100-fix-ptr_err_or_zero-vs-null-check-in.patch b/queue-6.1/watchdog-sa1100-fix-ptr_err_or_zero-vs-null-check-in.patch new file mode 100644 index 00000000000..4fb6e1b5a1c --- /dev/null +++ b/queue-6.1/watchdog-sa1100-fix-ptr_err_or_zero-vs-null-check-in.patch @@ -0,0 +1,43 @@ +From 7292676cdd53e9ec4d7eaec450865706c6159c06 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 26 Apr 2024 15:58:08 +0800 +Subject: watchdog: sa1100: Fix PTR_ERR_OR_ZERO() vs NULL check in + sa1100dog_probe() + +From: Chen Ni + +[ Upstream commit 413bf4e857fd79617524d5dcd35f463e9aa2dd41 ] + +devm_ioremap() doesn't return error pointers, it returns NULL on error. +Update the check accordingly. + +Fixes: e86bd43bcfc5 ("watchdog: sa1100: use platform device registration") +Signed-off-by: Chen Ni +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20240426075808.1582678-1-nichen@iscas.ac.cn +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/sa1100_wdt.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c +index 82ac5d19f519e..1745d7cafb762 100644 +--- a/drivers/watchdog/sa1100_wdt.c ++++ b/drivers/watchdog/sa1100_wdt.c +@@ -191,9 +191,8 @@ static int sa1100dog_probe(struct platform_device *pdev) + if (!res) + return -ENXIO; + reg_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); +- ret = PTR_ERR_OR_ZERO(reg_base); +- if (ret) +- return ret; ++ if (!reg_base) ++ return -ENOMEM; + + clk = clk_get(NULL, "OSTIMER0"); + if (IS_ERR(clk)) { +-- +2.43.0 +