From b2c47874d4fd2b2ba976729fa31d7429c63f1a66 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Tue, 8 Aug 2023 21:44:14 -0400 Subject: [PATCH] Fixes for 5.4 Signed-off-by: Sasha Levin --- queue-5.4/arm-dts-imx-add-usb-alias.patch | 127 ++++++++ ...n-l2-cache-controller-nodename-with-.patch | 93 ++++++ ...ts-imx6sll-fixup-of-operating-points.patch | 59 ++++ ...make-ssi-node-name-same-as-other-pla.patch | 60 ++++ ...sll-fix-wrong-property-name-in-usbph.patch | 36 +++ ...x10-fix-incorrect-i2c-property-for-s.patch | 36 +++ ...eph-defer-stopping-mdsc-delayed_work.patch | 88 ++++++ ...waiting-on-caps-in-debugfs-caps-file.patch | 134 ++++++++ .../ceph-use-kill_anon_super-helper.patch | 52 ++++ ...pm-sleep-wakeirq-fix-wake-irq-arming.patch | 95 ++++++ ...rt-enabling-wake-up-irq-after-runtim.patch | 290 ++++++++++++++++++ ...heck-if-libc-rseq-support-is-registe.patch | 44 +++ ...lay-nice-with-binaries-statically-li.patch | 84 +++++ queue-5.4/series | 13 + 14 files changed, 1211 insertions(+) create mode 100644 queue-5.4/arm-dts-imx-add-usb-alias.patch create mode 100644 queue-5.4/arm-dts-imx-align-l2-cache-controller-nodename-with-.patch create mode 100644 queue-5.4/arm-dts-imx6sll-fixup-of-operating-points.patch create mode 100644 queue-5.4/arm-dts-imx6sll-make-ssi-node-name-same-as-other-pla.patch create mode 100644 queue-5.4/arm-dts-nxp-imx6sll-fix-wrong-property-name-in-usbph.patch create mode 100644 queue-5.4/arm64-dts-stratix10-fix-incorrect-i2c-property-for-s.patch create mode 100644 queue-5.4/ceph-defer-stopping-mdsc-delayed_work.patch create mode 100644 queue-5.4/ceph-show-tasks-waiting-on-caps-in-debugfs-caps-file.patch create mode 100644 queue-5.4/ceph-use-kill_anon_super-helper.patch create mode 100644 queue-5.4/pm-sleep-wakeirq-fix-wake-irq-arming.patch create mode 100644 queue-5.4/pm-wakeirq-support-enabling-wake-up-irq-after-runtim.patch create mode 100644 queue-5.4/selftests-rseq-check-if-libc-rseq-support-is-registe.patch create mode 100644 queue-5.4/selftests-rseq-play-nice-with-binaries-statically-li.patch diff --git a/queue-5.4/arm-dts-imx-add-usb-alias.patch b/queue-5.4/arm-dts-imx-add-usb-alias.patch new file mode 100644 index 00000000000..1656a619bff --- /dev/null +++ b/queue-5.4/arm-dts-imx-add-usb-alias.patch @@ -0,0 +1,127 @@ +From b715b667bfec8c1046771a68f66830b75afb7294 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 1 Nov 2020 19:29:53 +0800 +Subject: ARM: dts: imx: add usb alias + +From: Peng Fan + +[ Upstream commit 5c8b3b8a182cbc1ccdfcdeea9b25dd2c12a8148f ] + +Add usb alias for bootloader searching the controller in correct order. + +Signed-off-by: Peng Fan +Signed-off-by: Shawn Guo +Stable-dep-of: ee70b908f77a ("ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node") +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/imx6qdl.dtsi | 4 ++++ + arch/arm/boot/dts/imx6sl.dtsi | 3 +++ + arch/arm/boot/dts/imx6sll.dtsi | 2 ++ + arch/arm/boot/dts/imx6sx.dtsi | 3 +++ + arch/arm/boot/dts/imx6ul.dtsi | 2 ++ + arch/arm/boot/dts/imx7d.dtsi | 6 ++++++ + arch/arm/boot/dts/imx7s.dtsi | 2 ++ + 7 files changed, 22 insertions(+) + +diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi +index 9105e614fe5c6..bb02923bc2e5b 100644 +--- a/arch/arm/boot/dts/imx6qdl.dtsi ++++ b/arch/arm/boot/dts/imx6qdl.dtsi +@@ -45,6 +45,10 @@ aliases { + spi1 = &ecspi2; + spi2 = &ecspi3; + spi3 = &ecspi4; ++ usb0 = &usbotg; ++ usb1 = &usbh1; ++ usb2 = &usbh2; ++ usb3 = &usbh3; + usbphy0 = &usbphy1; + usbphy1 = &usbphy2; + }; +diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi +index 452a77552e3d0..3cf1da06e7f04 100644 +--- a/arch/arm/boot/dts/imx6sl.dtsi ++++ b/arch/arm/boot/dts/imx6sl.dtsi +@@ -39,6 +39,9 @@ aliases { + spi1 = &ecspi2; + spi2 = &ecspi3; + spi3 = &ecspi4; ++ usb0 = &usbotg1; ++ usb1 = &usbotg2; ++ usb2 = &usbh; + usbphy0 = &usbphy1; + usbphy1 = &usbphy2; + }; +diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi +index 27c253d0fdde2..4c29fb9e35dce 100644 +--- a/arch/arm/boot/dts/imx6sll.dtsi ++++ b/arch/arm/boot/dts/imx6sll.dtsi +@@ -36,6 +36,8 @@ aliases { + spi1 = &ecspi2; + spi3 = &ecspi3; + spi4 = &ecspi4; ++ usb0 = &usbotg1; ++ usb1 = &usbotg2; + usbphy0 = &usbphy1; + usbphy1 = &usbphy2; + }; +diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi +index 072d5fc9c6db9..790cc88c8b1ae 100644 +--- a/arch/arm/boot/dts/imx6sx.dtsi ++++ b/arch/arm/boot/dts/imx6sx.dtsi +@@ -49,6 +49,9 @@ aliases { + spi2 = &ecspi3; + spi3 = &ecspi4; + spi4 = &ecspi5; ++ usb0 = &usbotg1; ++ usb1 = &usbotg2; ++ usb2 = &usbh; + usbphy0 = &usbphy1; + usbphy1 = &usbphy2; + }; +diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi +index ae0722b93b9d7..05390cc2a3b3b 100644 +--- a/arch/arm/boot/dts/imx6ul.dtsi ++++ b/arch/arm/boot/dts/imx6ul.dtsi +@@ -47,6 +47,8 @@ aliases { + spi1 = &ecspi2; + spi2 = &ecspi3; + spi3 = &ecspi4; ++ usb0 = &usbotg1; ++ usb1 = &usbotg2; + usbphy0 = &usbphy1; + usbphy1 = &usbphy2; + }; +diff --git a/arch/arm/boot/dts/imx7d.dtsi b/arch/arm/boot/dts/imx7d.dtsi +index 9c8dd32cc035f..8b65ca8b5f30f 100644 +--- a/arch/arm/boot/dts/imx7d.dtsi ++++ b/arch/arm/boot/dts/imx7d.dtsi +@@ -7,6 +7,12 @@ + #include + + / { ++ aliases { ++ usb0 = &usbotg1; ++ usb1 = &usbotg2; ++ usb2 = &usbh; ++ }; ++ + cpus { + cpu0: cpu@0 { + clock-frequency = <996000000>; +diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi +index 1ef076b64de26..e5151a7849d6b 100644 +--- a/arch/arm/boot/dts/imx7s.dtsi ++++ b/arch/arm/boot/dts/imx7s.dtsi +@@ -47,6 +47,8 @@ aliases { + spi1 = &ecspi2; + spi2 = &ecspi3; + spi3 = &ecspi4; ++ usb0 = &usbotg1; ++ usb1 = &usbh; + }; + + cpus { +-- +2.40.1 + diff --git a/queue-5.4/arm-dts-imx-align-l2-cache-controller-nodename-with-.patch b/queue-5.4/arm-dts-imx-align-l2-cache-controller-nodename-with-.patch new file mode 100644 index 00000000000..ce293877a57 --- /dev/null +++ b/queue-5.4/arm-dts-imx-align-l2-cache-controller-nodename-with-.patch @@ -0,0 +1,93 @@ +From 37061d171adc775be6bf5741c8c6230fce7e7152 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 26 Jun 2020 10:06:31 +0200 +Subject: ARM: dts: imx: Align L2 cache-controller nodename with dtschema + +From: Krzysztof Kozlowski + +[ Upstream commit 69cc1502a87f5ed12e27dbe5fe2bfdd5540826c7 ] + +Fix dtschema validator warnings like: + l2-cache@a02000: $nodename:0: + 'l2-cache@a02000' does not match '^(cache-controller|cpu)(@[0-9a-f,]+)*$' + +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Shawn Guo +Stable-dep-of: ee70b908f77a ("ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node") +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/imx35.dtsi | 2 +- + arch/arm/boot/dts/imx6qdl.dtsi | 2 +- + arch/arm/boot/dts/imx6sl.dtsi | 2 +- + arch/arm/boot/dts/imx6sll.dtsi | 2 +- + arch/arm/boot/dts/imx6sx.dtsi | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi +index 9cbdc1a15cda2..d326b18333d15 100644 +--- a/arch/arm/boot/dts/imx35.dtsi ++++ b/arch/arm/boot/dts/imx35.dtsi +@@ -59,7 +59,7 @@ soc { + interrupt-parent = <&avic>; + ranges; + +- L2: l2-cache@30000000 { ++ L2: cache-controller@30000000 { + compatible = "arm,l210-cache"; + reg = <0x30000000 0x1000>; + cache-unified; +diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi +index e9955ef12e02d..9105e614fe5c6 100644 +--- a/arch/arm/boot/dts/imx6qdl.dtsi ++++ b/arch/arm/boot/dts/imx6qdl.dtsi +@@ -255,7 +255,7 @@ intc: interrupt-controller@a01000 { + interrupt-parent = <&intc>; + }; + +- L2: l2-cache@a02000 { ++ L2: cache-controller@a02000 { + compatible = "arm,pl310-cache"; + reg = <0x00a02000 0x1000>; + interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>; +diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi +index 852f66944c7d4..452a77552e3d0 100644 +--- a/arch/arm/boot/dts/imx6sl.dtsi ++++ b/arch/arm/boot/dts/imx6sl.dtsi +@@ -136,7 +136,7 @@ intc: interrupt-controller@a01000 { + interrupt-parent = <&intc>; + }; + +- L2: l2-cache@a02000 { ++ L2: cache-controller@a02000 { + compatible = "arm,pl310-cache"; + reg = <0x00a02000 0x1000>; + interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>; +diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi +index cf81c7b949e62..27c253d0fdde2 100644 +--- a/arch/arm/boot/dts/imx6sll.dtsi ++++ b/arch/arm/boot/dts/imx6sll.dtsi +@@ -137,7 +137,7 @@ intc: interrupt-controller@a01000 { + interrupt-parent = <&intc>; + }; + +- L2: l2-cache@a02000 { ++ L2: cache-controller@a02000 { + compatible = "arm,pl310-cache"; + reg = <0x00a02000 0x1000>; + interrupts = ; +diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi +index b3e24d8bd2994..072d5fc9c6db9 100644 +--- a/arch/arm/boot/dts/imx6sx.dtsi ++++ b/arch/arm/boot/dts/imx6sx.dtsi +@@ -187,7 +187,7 @@ intc: interrupt-controller@a01000 { + interrupt-parent = <&intc>; + }; + +- L2: l2-cache@a02000 { ++ L2: cache-controller@a02000 { + compatible = "arm,pl310-cache"; + reg = <0x00a02000 0x1000>; + interrupts = ; +-- +2.40.1 + diff --git a/queue-5.4/arm-dts-imx6sll-fixup-of-operating-points.patch b/queue-5.4/arm-dts-imx6sll-fixup-of-operating-points.patch new file mode 100644 index 00000000000..b3d2421b989 --- /dev/null +++ b/queue-5.4/arm-dts-imx6sll-fixup-of-operating-points.patch @@ -0,0 +1,59 @@ +From 8cbbbc4d857d74cc0ba8d0c077a0b73364e88304 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Sep 2021 11:14:37 +0200 +Subject: ARM: dts: imx6sll: fixup of operating points + +From: Andreas Kemnade + +[ Upstream commit 1875903019ea6e32e6e544c1631b119e4fd60b20 ] + +Make operating point definitions comply with binding +specifications. + +Signed-off-by: Andreas Kemnade +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Shawn Guo +Stable-dep-of: ee70b908f77a ("ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node") +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/imx6sll.dtsi | 22 ++++++++++------------ + 1 file changed, 10 insertions(+), 12 deletions(-) + +diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi +index 4c29fb9e35dce..e8623d77eb42b 100644 +--- a/arch/arm/boot/dts/imx6sll.dtsi ++++ b/arch/arm/boot/dts/imx6sll.dtsi +@@ -51,20 +51,18 @@ cpu0: cpu@0 { + device_type = "cpu"; + reg = <0>; + next-level-cache = <&L2>; +- operating-points = < ++ operating-points = + /* kHz uV */ +- 996000 1275000 +- 792000 1175000 +- 396000 1075000 +- 198000 975000 +- >; +- fsl,soc-operating-points = < ++ <996000 1275000>, ++ <792000 1175000>, ++ <396000 1075000>, ++ <198000 975000>; ++ fsl,soc-operating-points = + /* ARM kHz SOC-PU uV */ +- 996000 1175000 +- 792000 1175000 +- 396000 1175000 +- 198000 1175000 +- >; ++ <996000 1175000>, ++ <792000 1175000>, ++ <396000 1175000>, ++ <198000 1175000>; + clock-latency = <61036>; /* two CLK32 periods */ + #cooling-cells = <2>; + clocks = <&clks IMX6SLL_CLK_ARM>, +-- +2.40.1 + diff --git a/queue-5.4/arm-dts-imx6sll-make-ssi-node-name-same-as-other-pla.patch b/queue-5.4/arm-dts-imx6sll-make-ssi-node-name-same-as-other-pla.patch new file mode 100644 index 00000000000..c54ac74fc6c --- /dev/null +++ b/queue-5.4/arm-dts-imx6sll-make-ssi-node-name-same-as-other-pla.patch @@ -0,0 +1,60 @@ +From 88da4658c09452c0681e4a63889a66d1811af408 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Jun 2020 18:44:50 +0800 +Subject: ARM: dts: imx6sll: Make ssi node name same as other platforms + +From: Shengjiu Wang + +[ Upstream commit 5da1b522cf7dc51f7fde2cca8d90406b0291c503 ] + +In imx6sll.dtsi, the ssi node name is different with other +platforms (imx6qdl, imx6sl, imx6sx), but the +sound/soc/fsl/fsl-asoc-card.c machine driver needs to check +ssi node name for audmux configuration, then different ssi +node name causes issue on imx6sll platform. + +So we change ssi node name to make all platforms have same +name. + +Signed-off-by: Shengjiu Wang +Signed-off-by: Shawn Guo +Stable-dep-of: ee70b908f77a ("ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node") +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/imx6sll.dtsi | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi +index 39500b84673b9..cf81c7b949e62 100644 +--- a/arch/arm/boot/dts/imx6sll.dtsi ++++ b/arch/arm/boot/dts/imx6sll.dtsi +@@ -272,7 +272,7 @@ uart2: serial@2024000 { + status = "disabled"; + }; + +- ssi1: ssi-controller@2028000 { ++ ssi1: ssi@2028000 { + compatible = "fsl,imx6sl-ssi", "fsl,imx51-ssi"; + reg = <0x02028000 0x4000>; + interrupts = ; +@@ -285,7 +285,7 @@ ssi1: ssi-controller@2028000 { + status = "disabled"; + }; + +- ssi2: ssi-controller@202c000 { ++ ssi2: ssi@202c000 { + compatible = "fsl,imx6sl-ssi", "fsl,imx51-ssi"; + reg = <0x0202c000 0x4000>; + interrupts = ; +@@ -298,7 +298,7 @@ ssi2: ssi-controller@202c000 { + status = "disabled"; + }; + +- ssi3: ssi-controller@2030000 { ++ ssi3: ssi@2030000 { + compatible = "fsl,imx6sl-ssi", "fsl,imx51-ssi"; + reg = <0x02030000 0x4000>; + interrupts = ; +-- +2.40.1 + diff --git a/queue-5.4/arm-dts-nxp-imx6sll-fix-wrong-property-name-in-usbph.patch b/queue-5.4/arm-dts-nxp-imx6sll-fix-wrong-property-name-in-usbph.patch new file mode 100644 index 00000000000..7f6b1ab6e91 --- /dev/null +++ b/queue-5.4/arm-dts-nxp-imx6sll-fix-wrong-property-name-in-usbph.patch @@ -0,0 +1,36 @@ +From 48bfb3f24d462dd3c2a22a8f4dc668390c5eb7e4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Jul 2023 10:28:33 +0800 +Subject: ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node + +From: Xu Yang + +[ Upstream commit ee70b908f77a9d8f689dea986f09e6d7dc481934 ] + +Property name "phy-3p0-supply" is used instead of "phy-reg_3p0-supply". + +Fixes: 9f30b6b1a957 ("ARM: dts: imx: Add basic dtsi file for imx6sll") +cc: +Signed-off-by: Xu Yang +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/imx6sll.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi +index e8623d77eb42b..ad3deb82a50ac 100644 +--- a/arch/arm/boot/dts/imx6sll.dtsi ++++ b/arch/arm/boot/dts/imx6sll.dtsi +@@ -550,7 +550,7 @@ usbphy2: usb-phy@20ca000 { + reg = <0x020ca000 0x1000>; + interrupts = ; + clocks = <&clks IMX6SLL_CLK_USBPHY2>; +- phy-reg_3p0-supply = <®_3p0>; ++ phy-3p0-supply = <®_3p0>; + fsl,anatop = <&anatop>; + }; + +-- +2.40.1 + diff --git a/queue-5.4/arm64-dts-stratix10-fix-incorrect-i2c-property-for-s.patch b/queue-5.4/arm64-dts-stratix10-fix-incorrect-i2c-property-for-s.patch new file mode 100644 index 00000000000..ee04ca1caae --- /dev/null +++ b/queue-5.4/arm64-dts-stratix10-fix-incorrect-i2c-property-for-s.patch @@ -0,0 +1,36 @@ +From de265b1085dfdc7f5e6a569601433774852bd66f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Jul 2023 15:44:30 -0500 +Subject: arm64: dts: stratix10: fix incorrect I2C property for SCL signal + +From: Dinh Nguyen + +[ Upstream commit db66795f61354c373ecdadbdae1ed253a96c47cb ] + +The correct dts property for the SCL falling time is +"i2c-scl-falling-time-ns". + +Fixes: c8da1d15b8a4 ("arm64: dts: stratix10: i2c clock running out of spec") +Cc: stable@vger.kernel.org +Signed-off-by: Dinh Nguyen +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts +index 2c8c2b322c727..33f1fb9fd161f 100644 +--- a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts ++++ b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts +@@ -129,7 +129,7 @@ &i2c1 { + status = "okay"; + clock-frequency = <100000>; + i2c-sda-falling-time-ns = <890>; /* hcnt */ +- i2c-sdl-falling-time-ns = <890>; /* lcnt */ ++ i2c-scl-falling-time-ns = <890>; /* lcnt */ + + adc@14 { + compatible = "lltc,ltc2497"; +-- +2.40.1 + diff --git a/queue-5.4/ceph-defer-stopping-mdsc-delayed_work.patch b/queue-5.4/ceph-defer-stopping-mdsc-delayed_work.patch new file mode 100644 index 00000000000..b4cda6207d9 --- /dev/null +++ b/queue-5.4/ceph-defer-stopping-mdsc-delayed_work.patch @@ -0,0 +1,88 @@ +From 1b955d8f1e8b096b446555103934705d1052f63e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jul 2023 12:03:59 +0800 +Subject: ceph: defer stopping mdsc delayed_work + +From: Xiubo Li + +[ Upstream commit e7e607bd00481745550389a29ecabe33e13d67cf ] + +Flushing the dirty buffer may take a long time if the cluster is +overloaded or if there is network issue. So we should ping the +MDSs periodically to keep alive, else the MDS will blocklist +the kclient. + +Cc: stable@vger.kernel.org +Link: https://tracker.ceph.com/issues/61843 +Signed-off-by: Xiubo Li +Reviewed-by: Milind Changire +Signed-off-by: Ilya Dryomov +Signed-off-by: Sasha Levin +--- + fs/ceph/mds_client.c | 4 ++-- + fs/ceph/mds_client.h | 5 +++++ + fs/ceph/super.c | 10 ++++++++++ + 3 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c +index 6ceda2a4791c4..f7acf9680c9b6 100644 +--- a/fs/ceph/mds_client.c ++++ b/fs/ceph/mds_client.c +@@ -4074,7 +4074,7 @@ static void delayed_work(struct work_struct *work) + + dout("mdsc delayed_work\n"); + +- if (mdsc->stopping) ++ if (mdsc->stopping >= CEPH_MDSC_STOPPING_FLUSHED) + return; + + mutex_lock(&mdsc->mutex); +@@ -4246,7 +4246,7 @@ static void wait_requests(struct ceph_mds_client *mdsc) + void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc) + { + dout("pre_umount\n"); +- mdsc->stopping = 1; ++ mdsc->stopping = CEPH_MDSC_STOPPING_BEGIN; + + lock_unlock_sessions(mdsc); + ceph_flush_dirty_caps(mdsc); +diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h +index 14c7e8c49970a..4fbbc33023c97 100644 +--- a/fs/ceph/mds_client.h ++++ b/fs/ceph/mds_client.h +@@ -348,6 +348,11 @@ struct cap_wait { + int want; + }; + ++enum { ++ CEPH_MDSC_STOPPING_BEGIN = 1, ++ CEPH_MDSC_STOPPING_FLUSHED = 2, ++}; ++ + /* + * mds client state + */ +diff --git a/fs/ceph/super.c b/fs/ceph/super.c +index 279334f955702..0e38678d5adda 100644 +--- a/fs/ceph/super.c ++++ b/fs/ceph/super.c +@@ -1180,6 +1180,16 @@ static void ceph_kill_sb(struct super_block *s) + ceph_mdsc_pre_umount(fsc->mdsc); + flush_fs_workqueues(fsc); + ++ /* ++ * Though the kill_anon_super() will finally trigger the ++ * sync_filesystem() anyway, we still need to do it here ++ * and then bump the stage of shutdown to stop the work ++ * queue as earlier as possible. ++ */ ++ sync_filesystem(s); ++ ++ fsc->mdsc->stopping = CEPH_MDSC_STOPPING_FLUSHED; ++ + kill_anon_super(s); + + fsc->client->extra_mon_dispatch = NULL; +-- +2.40.1 + diff --git a/queue-5.4/ceph-show-tasks-waiting-on-caps-in-debugfs-caps-file.patch b/queue-5.4/ceph-show-tasks-waiting-on-caps-in-debugfs-caps-file.patch new file mode 100644 index 00000000000..9e984013169 --- /dev/null +++ b/queue-5.4/ceph-show-tasks-waiting-on-caps-in-debugfs-caps-file.patch @@ -0,0 +1,134 @@ +From fd9e7abd7fa46fb25a2e67db89382ade84965de1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Nov 2019 12:00:59 -0500 +Subject: ceph: show tasks waiting on caps in debugfs caps file + +From: Jeff Layton + +[ Upstream commit 3a3430affce5de301fc8e6e50fa3543d7597820e ] + +Add some visibility of tasks that are waiting for caps to the "caps" +debugfs file. Display the tgid of the waiting task, inode number, and +the caps the task needs and wants. + +Signed-off-by: Jeff Layton +Reviewed-by: "Yan, Zheng" +Signed-off-by: Ilya Dryomov +Stable-dep-of: e7e607bd0048 ("ceph: defer stopping mdsc delayed_work") +Signed-off-by: Sasha Levin +--- + fs/ceph/caps.c | 17 +++++++++++++++++ + fs/ceph/debugfs.c | 13 +++++++++++++ + fs/ceph/mds_client.c | 1 + + fs/ceph/mds_client.h | 9 +++++++++ + 4 files changed, 40 insertions(+) + +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c +index 243e246cb5046..4e88cb9907230 100644 +--- a/fs/ceph/caps.c ++++ b/fs/ceph/caps.c +@@ -2790,7 +2790,19 @@ int ceph_get_caps(struct file *filp, int need, int want, + if (ret == -EAGAIN) + continue; + if (!ret) { ++ struct ceph_mds_client *mdsc = fsc->mdsc; ++ struct cap_wait cw; + DEFINE_WAIT_FUNC(wait, woken_wake_function); ++ ++ cw.ino = inode->i_ino; ++ cw.tgid = current->tgid; ++ cw.need = need; ++ cw.want = want; ++ ++ spin_lock(&mdsc->caps_list_lock); ++ list_add(&cw.list, &mdsc->cap_wait_list); ++ spin_unlock(&mdsc->caps_list_lock); ++ + add_wait_queue(&ci->i_cap_wq, &wait); + + flags |= NON_BLOCKING; +@@ -2804,6 +2816,11 @@ int ceph_get_caps(struct file *filp, int need, int want, + } + + remove_wait_queue(&ci->i_cap_wq, &wait); ++ ++ spin_lock(&mdsc->caps_list_lock); ++ list_del(&cw.list); ++ spin_unlock(&mdsc->caps_list_lock); ++ + if (ret == -EAGAIN) + continue; + } +diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c +index facb387c27356..c281f32b54f7b 100644 +--- a/fs/ceph/debugfs.c ++++ b/fs/ceph/debugfs.c +@@ -139,6 +139,7 @@ static int caps_show(struct seq_file *s, void *p) + struct ceph_fs_client *fsc = s->private; + struct ceph_mds_client *mdsc = fsc->mdsc; + int total, avail, used, reserved, min, i; ++ struct cap_wait *cw; + + ceph_reservation_status(fsc, &total, &avail, &used, &reserved, &min); + seq_printf(s, "total\t\t%d\n" +@@ -166,6 +167,18 @@ static int caps_show(struct seq_file *s, void *p) + } + mutex_unlock(&mdsc->mutex); + ++ seq_printf(s, "\n\nWaiters:\n--------\n"); ++ seq_printf(s, "tgid ino need want\n"); ++ seq_printf(s, "-----------------------------------------------------\n"); ++ ++ spin_lock(&mdsc->caps_list_lock); ++ list_for_each_entry(cw, &mdsc->cap_wait_list, list) { ++ seq_printf(s, "%-13d0x%-17lx%-17s%-17s\n", cw->tgid, cw->ino, ++ ceph_cap_string(cw->need), ++ ceph_cap_string(cw->want)); ++ } ++ spin_unlock(&mdsc->caps_list_lock); ++ + return 0; + } + +diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c +index 3bf81fe5f10a3..6ceda2a4791c4 100644 +--- a/fs/ceph/mds_client.c ++++ b/fs/ceph/mds_client.c +@@ -4174,6 +4174,7 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) + INIT_DELAYED_WORK(&mdsc->delayed_work, delayed_work); + mdsc->last_renew_caps = jiffies; + INIT_LIST_HEAD(&mdsc->cap_delay_list); ++ INIT_LIST_HEAD(&mdsc->cap_wait_list); + spin_lock_init(&mdsc->cap_delay_lock); + INIT_LIST_HEAD(&mdsc->snap_flush_list); + spin_lock_init(&mdsc->snap_flush_lock); +diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h +index 5cd131b41d84f..14c7e8c49970a 100644 +--- a/fs/ceph/mds_client.h ++++ b/fs/ceph/mds_client.h +@@ -340,6 +340,14 @@ struct ceph_quotarealm_inode { + struct inode *inode; + }; + ++struct cap_wait { ++ struct list_head list; ++ unsigned long ino; ++ pid_t tgid; ++ int need; ++ int want; ++}; ++ + /* + * mds client state + */ +@@ -416,6 +424,7 @@ struct ceph_mds_client { + spinlock_t caps_list_lock; + struct list_head caps_list; /* unused (reserved or + unreserved) */ ++ struct list_head cap_wait_list; + int caps_total_count; /* total caps allocated */ + int caps_use_count; /* in use */ + int caps_use_max; /* max used caps */ +-- +2.40.1 + diff --git a/queue-5.4/ceph-use-kill_anon_super-helper.patch b/queue-5.4/ceph-use-kill_anon_super-helper.patch new file mode 100644 index 00000000000..d6dd2d3f09e --- /dev/null +++ b/queue-5.4/ceph-use-kill_anon_super-helper.patch @@ -0,0 +1,52 @@ +From 2f22d19ba3619587f1ec07b768391239ab942fcc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 11 Sep 2020 15:19:00 -0400 +Subject: ceph: use kill_anon_super helper + +From: Jeff Layton + +[ Upstream commit 470a5c77eac0e07bfe60413fb3d314b734392bc3 ] + +ceph open-codes this around some other activity and the rationale +for it isn't clear. There is no need to delay free_anon_bdev until +the end of kill_sb. + +Signed-off-by: Jeff Layton +Signed-off-by: Ilya Dryomov +Stable-dep-of: e7e607bd0048 ("ceph: defer stopping mdsc delayed_work") +Signed-off-by: Sasha Levin +--- + fs/ceph/super.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/fs/ceph/super.c b/fs/ceph/super.c +index d40658d5e8089..279334f955702 100644 +--- a/fs/ceph/super.c ++++ b/fs/ceph/super.c +@@ -1174,14 +1174,13 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type, + static void ceph_kill_sb(struct super_block *s) + { + struct ceph_fs_client *fsc = ceph_sb_to_client(s); +- dev_t dev = s->s_dev; + + dout("kill_sb %p\n", s); + + ceph_mdsc_pre_umount(fsc->mdsc); + flush_fs_workqueues(fsc); + +- generic_shutdown_super(s); ++ kill_anon_super(s); + + fsc->client->extra_mon_dispatch = NULL; + ceph_fs_debugfs_cleanup(fsc); +@@ -1189,7 +1188,6 @@ static void ceph_kill_sb(struct super_block *s) + ceph_fscache_unregister_fs(fsc); + + destroy_fs_client(fsc); +- free_anon_bdev(dev); + } + + static struct file_system_type ceph_fs_type = { +-- +2.40.1 + diff --git a/queue-5.4/pm-sleep-wakeirq-fix-wake-irq-arming.patch b/queue-5.4/pm-sleep-wakeirq-fix-wake-irq-arming.patch new file mode 100644 index 00000000000..4eee2c626b9 --- /dev/null +++ b/queue-5.4/pm-sleep-wakeirq-fix-wake-irq-arming.patch @@ -0,0 +1,95 @@ +From 0acecff12fadb912b6c454f9d5201518c7a503bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 Jul 2023 16:57:39 +0200 +Subject: PM: sleep: wakeirq: fix wake irq arming + +From: Johan Hovold + +[ Upstream commit 8527beb12087238d4387607597b4020bc393c4b4 ] + +The decision whether to enable a wake irq during suspend can not be done +based on the runtime PM state directly as a driver may use wake irqs +without implementing runtime PM. Such drivers specifically leave the +state set to the default 'suspended' and the wake irq is thus never +enabled at suspend. + +Add a new wake irq flag to track whether a dedicated wake irq has been +enabled at runtime suspend and therefore must not be enabled at system +suspend. + +Note that pm_runtime_enabled() can not be used as runtime PM is always +disabled during late suspend. + +Fixes: 69728051f5bf ("PM / wakeirq: Fix unbalanced IRQ enable for wakeirq") +Cc: 4.16+ # 4.16+ +Signed-off-by: Johan Hovold +Reviewed-by: Tony Lindgren +Tested-by: Tony Lindgren +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/base/power/power.h | 1 + + drivers/base/power/wakeirq.c | 12 ++++++++---- + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h +index 24772075235f6..310abe7251fc3 100644 +--- a/drivers/base/power/power.h ++++ b/drivers/base/power/power.h +@@ -29,6 +29,7 @@ extern u64 pm_runtime_active_time(struct device *dev); + #define WAKE_IRQ_DEDICATED_MASK (WAKE_IRQ_DEDICATED_ALLOCATED | \ + WAKE_IRQ_DEDICATED_MANAGED | \ + WAKE_IRQ_DEDICATED_REVERSE) ++#define WAKE_IRQ_DEDICATED_ENABLED BIT(3) + + struct wake_irq { + struct device *dev; +diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c +index 327fdc8e8ebde..46654adf00a10 100644 +--- a/drivers/base/power/wakeirq.c ++++ b/drivers/base/power/wakeirq.c +@@ -317,8 +317,10 @@ void dev_pm_enable_wake_irq_check(struct device *dev, + return; + + enable: +- if (!can_change_status || !(wirq->status & WAKE_IRQ_DEDICATED_REVERSE)) ++ if (!can_change_status || !(wirq->status & WAKE_IRQ_DEDICATED_REVERSE)) { + enable_irq(wirq->irq); ++ wirq->status |= WAKE_IRQ_DEDICATED_ENABLED; ++ } + } + + /** +@@ -339,8 +341,10 @@ void dev_pm_disable_wake_irq_check(struct device *dev, bool cond_disable) + if (cond_disable && (wirq->status & WAKE_IRQ_DEDICATED_REVERSE)) + return; + +- if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED) ++ if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED) { ++ wirq->status &= ~WAKE_IRQ_DEDICATED_ENABLED; + disable_irq_nosync(wirq->irq); ++ } + } + + /** +@@ -379,7 +383,7 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq) + + if (device_may_wakeup(wirq->dev)) { + if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED && +- !pm_runtime_status_suspended(wirq->dev)) ++ !(wirq->status & WAKE_IRQ_DEDICATED_ENABLED)) + enable_irq(wirq->irq); + + enable_irq_wake(wirq->irq); +@@ -402,7 +406,7 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq) + disable_irq_wake(wirq->irq); + + if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED && +- !pm_runtime_status_suspended(wirq->dev)) ++ !(wirq->status & WAKE_IRQ_DEDICATED_ENABLED)) + disable_irq_nosync(wirq->irq); + } + } +-- +2.40.1 + diff --git a/queue-5.4/pm-wakeirq-support-enabling-wake-up-irq-after-runtim.patch b/queue-5.4/pm-wakeirq-support-enabling-wake-up-irq-after-runtim.patch new file mode 100644 index 00000000000..450900e6d66 --- /dev/null +++ b/queue-5.4/pm-wakeirq-support-enabling-wake-up-irq-after-runtim.patch @@ -0,0 +1,290 @@ +From f7ec5cb7887dd7d4980eeadaf4a026762f92447b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Oct 2021 15:01:53 +0800 +Subject: PM / wakeirq: support enabling wake-up irq after runtime_suspend + called + +From: Chunfeng Yun + +[ Upstream commit 259714100d98b50bf04d36a21bf50ca8b829fc11 ] + +When the dedicated wake IRQ is level trigger, and it uses the +device's low-power status as the wakeup source, that means if the +device is not in low-power state, the wake IRQ will be triggered +if enabled; For this case, need enable the wake IRQ after running +the device's ->runtime_suspend() which make it enter low-power state. + +e.g. +Assume the wake IRQ is a low level trigger type, and the wakeup +signal comes from the low-power status of the device. +The wakeup signal is low level at running time (0), and becomes +high level when the device enters low-power state (runtime_suspend +(1) is called), a wakeup event at (2) make the device exit low-power +state, then the wakeup signal also becomes low level. + + ------------------ + | ^ ^| +---------------- | | -------------- + |<---(0)--->|<--(1)--| (3) (2) (4) + +if enable the wake IRQ before running runtime_suspend during (0), +a wake IRQ will arise, it causes resume immediately; +it works if enable wake IRQ ( e.g. at (3) or (4)) after running +->runtime_suspend(). + +This patch introduces a new status WAKE_IRQ_DEDICATED_REVERSE to +optionally support enabling wake IRQ after running ->runtime_suspend(). + +Suggested-by: Rafael J. Wysocki +Signed-off-by: Chunfeng Yun +Signed-off-by: Rafael J. Wysocki +Stable-dep-of: 8527beb12087 ("PM: sleep: wakeirq: fix wake irq arming") +Signed-off-by: Sasha Levin +--- + drivers/base/power/power.h | 7 ++- + drivers/base/power/runtime.c | 6 ++- + drivers/base/power/wakeirq.c | 101 +++++++++++++++++++++++++++-------- + include/linux/pm_wakeirq.h | 9 +++- + 4 files changed, 96 insertions(+), 27 deletions(-) + +diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h +index 39a06a0cfdaa8..24772075235f6 100644 +--- a/drivers/base/power/power.h ++++ b/drivers/base/power/power.h +@@ -25,8 +25,10 @@ extern u64 pm_runtime_active_time(struct device *dev); + + #define WAKE_IRQ_DEDICATED_ALLOCATED BIT(0) + #define WAKE_IRQ_DEDICATED_MANAGED BIT(1) ++#define WAKE_IRQ_DEDICATED_REVERSE BIT(2) + #define WAKE_IRQ_DEDICATED_MASK (WAKE_IRQ_DEDICATED_ALLOCATED | \ +- WAKE_IRQ_DEDICATED_MANAGED) ++ WAKE_IRQ_DEDICATED_MANAGED | \ ++ WAKE_IRQ_DEDICATED_REVERSE) + + struct wake_irq { + struct device *dev; +@@ -39,7 +41,8 @@ extern void dev_pm_arm_wake_irq(struct wake_irq *wirq); + extern void dev_pm_disarm_wake_irq(struct wake_irq *wirq); + extern void dev_pm_enable_wake_irq_check(struct device *dev, + bool can_change_status); +-extern void dev_pm_disable_wake_irq_check(struct device *dev); ++extern void dev_pm_disable_wake_irq_check(struct device *dev, bool cond_disable); ++extern void dev_pm_enable_wake_irq_complete(struct device *dev); + + #ifdef CONFIG_PM_SLEEP + +diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c +index 9ee58bf49d133..d5c2d86fbecd4 100644 +--- a/drivers/base/power/runtime.c ++++ b/drivers/base/power/runtime.c +@@ -659,6 +659,8 @@ static int rpm_suspend(struct device *dev, int rpmflags) + if (retval) + goto fail; + ++ dev_pm_enable_wake_irq_complete(dev); ++ + no_callback: + __update_runtime_status(dev, RPM_SUSPENDED); + pm_runtime_deactivate_timer(dev); +@@ -704,7 +706,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) + return retval; + + fail: +- dev_pm_disable_wake_irq_check(dev); ++ dev_pm_disable_wake_irq_check(dev, true); + __update_runtime_status(dev, RPM_ACTIVE); + dev->power.deferred_resume = false; + wake_up_all(&dev->power.wait_queue); +@@ -887,7 +889,7 @@ static int rpm_resume(struct device *dev, int rpmflags) + + callback = RPM_GET_CALLBACK(dev, runtime_resume); + +- dev_pm_disable_wake_irq_check(dev); ++ dev_pm_disable_wake_irq_check(dev, false); + retval = rpm_callback(callback, dev); + if (retval) { + __update_runtime_status(dev, RPM_SUSPENDED); +diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c +index 5ce77d1ef9fc3..327fdc8e8ebde 100644 +--- a/drivers/base/power/wakeirq.c ++++ b/drivers/base/power/wakeirq.c +@@ -145,24 +145,7 @@ static irqreturn_t handle_threaded_wake_irq(int irq, void *_wirq) + return IRQ_HANDLED; + } + +-/** +- * dev_pm_set_dedicated_wake_irq - Request a dedicated wake-up interrupt +- * @dev: Device entry +- * @irq: Device wake-up interrupt +- * +- * Unless your hardware has separate wake-up interrupts in addition +- * to the device IO interrupts, you don't need this. +- * +- * Sets up a threaded interrupt handler for a device that has +- * a dedicated wake-up interrupt in addition to the device IO +- * interrupt. +- * +- * The interrupt starts disabled, and needs to be managed for +- * the device by the bus code or the device driver using +- * dev_pm_enable_wake_irq() and dev_pm_disable_wake_irq() +- * functions. +- */ +-int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) ++static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned int flag) + { + struct wake_irq *wirq; + int err; +@@ -200,7 +183,7 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) + if (err) + goto err_free_irq; + +- wirq->status = WAKE_IRQ_DEDICATED_ALLOCATED; ++ wirq->status = WAKE_IRQ_DEDICATED_ALLOCATED | flag; + + return err; + +@@ -213,8 +196,57 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) + + return err; + } ++ ++ ++/** ++ * dev_pm_set_dedicated_wake_irq - Request a dedicated wake-up interrupt ++ * @dev: Device entry ++ * @irq: Device wake-up interrupt ++ * ++ * Unless your hardware has separate wake-up interrupts in addition ++ * to the device IO interrupts, you don't need this. ++ * ++ * Sets up a threaded interrupt handler for a device that has ++ * a dedicated wake-up interrupt in addition to the device IO ++ * interrupt. ++ * ++ * The interrupt starts disabled, and needs to be managed for ++ * the device by the bus code or the device driver using ++ * dev_pm_enable_wake_irq*() and dev_pm_disable_wake_irq*() ++ * functions. ++ */ ++int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) ++{ ++ return __dev_pm_set_dedicated_wake_irq(dev, irq, 0); ++} + EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq); + ++/** ++ * dev_pm_set_dedicated_wake_irq_reverse - Request a dedicated wake-up interrupt ++ * with reverse enable ordering ++ * @dev: Device entry ++ * @irq: Device wake-up interrupt ++ * ++ * Unless your hardware has separate wake-up interrupts in addition ++ * to the device IO interrupts, you don't need this. ++ * ++ * Sets up a threaded interrupt handler for a device that has a dedicated ++ * wake-up interrupt in addition to the device IO interrupt. It sets ++ * the status of WAKE_IRQ_DEDICATED_REVERSE to tell rpm_suspend() ++ * to enable dedicated wake-up interrupt after running the runtime suspend ++ * callback for @dev. ++ * ++ * The interrupt starts disabled, and needs to be managed for ++ * the device by the bus code or the device driver using ++ * dev_pm_enable_wake_irq*() and dev_pm_disable_wake_irq*() ++ * functions. ++ */ ++int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq) ++{ ++ return __dev_pm_set_dedicated_wake_irq(dev, irq, WAKE_IRQ_DEDICATED_REVERSE); ++} ++EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq_reverse); ++ + /** + * dev_pm_enable_wake_irq - Enable device wake-up interrupt + * @dev: Device +@@ -285,27 +317,54 @@ void dev_pm_enable_wake_irq_check(struct device *dev, + return; + + enable: +- enable_irq(wirq->irq); ++ if (!can_change_status || !(wirq->status & WAKE_IRQ_DEDICATED_REVERSE)) ++ enable_irq(wirq->irq); + } + + /** + * dev_pm_disable_wake_irq_check - Checks and disables wake-up interrupt + * @dev: Device ++ * @cond_disable: if set, also check WAKE_IRQ_DEDICATED_REVERSE + * + * Disables wake-up interrupt conditionally based on status. + * Should be only called from rpm_suspend() and rpm_resume() path. + */ +-void dev_pm_disable_wake_irq_check(struct device *dev) ++void dev_pm_disable_wake_irq_check(struct device *dev, bool cond_disable) + { + struct wake_irq *wirq = dev->power.wakeirq; + + if (!wirq || !((wirq->status & WAKE_IRQ_DEDICATED_MASK))) + return; + ++ if (cond_disable && (wirq->status & WAKE_IRQ_DEDICATED_REVERSE)) ++ return; ++ + if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED) + disable_irq_nosync(wirq->irq); + } + ++/** ++ * dev_pm_enable_wake_irq_complete - enable wake IRQ not enabled before ++ * @dev: Device using the wake IRQ ++ * ++ * Enable wake IRQ conditionally based on status, mainly used if want to ++ * enable wake IRQ after running ->runtime_suspend() which depends on ++ * WAKE_IRQ_DEDICATED_REVERSE. ++ * ++ * Should be only called from rpm_suspend() path. ++ */ ++void dev_pm_enable_wake_irq_complete(struct device *dev) ++{ ++ struct wake_irq *wirq = dev->power.wakeirq; ++ ++ if (!wirq || !(wirq->status & WAKE_IRQ_DEDICATED_MASK)) ++ return; ++ ++ if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED && ++ wirq->status & WAKE_IRQ_DEDICATED_REVERSE) ++ enable_irq(wirq->irq); ++} ++ + /** + * dev_pm_arm_wake_irq - Arm device wake-up + * @wirq: Device wake-up interrupt +diff --git a/include/linux/pm_wakeirq.h b/include/linux/pm_wakeirq.h +index cd5b62db90845..e63a63aa47a37 100644 +--- a/include/linux/pm_wakeirq.h ++++ b/include/linux/pm_wakeirq.h +@@ -17,8 +17,8 @@ + #ifdef CONFIG_PM + + extern int dev_pm_set_wake_irq(struct device *dev, int irq); +-extern int dev_pm_set_dedicated_wake_irq(struct device *dev, +- int irq); ++extern int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq); ++extern int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq); + extern void dev_pm_clear_wake_irq(struct device *dev); + extern void dev_pm_enable_wake_irq(struct device *dev); + extern void dev_pm_disable_wake_irq(struct device *dev); +@@ -35,6 +35,11 @@ static inline int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) + return 0; + } + ++static inline int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq) ++{ ++ return 0; ++} ++ + static inline void dev_pm_clear_wake_irq(struct device *dev) + { + } +-- +2.40.1 + diff --git a/queue-5.4/selftests-rseq-check-if-libc-rseq-support-is-registe.patch b/queue-5.4/selftests-rseq-check-if-libc-rseq-support-is-registe.patch new file mode 100644 index 00000000000..6ef7a055be1 --- /dev/null +++ b/queue-5.4/selftests-rseq-check-if-libc-rseq-support-is-registe.patch @@ -0,0 +1,44 @@ +From 57e63db694545148d2acbcd9180e98b93790a51f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jun 2022 11:48:30 -0400 +Subject: selftests/rseq: check if libc rseq support is registered + +From: Michael Jeanson + +[ Upstream commit d1a997ba4c1bf65497d956aea90de42a6398f73a ] + +When checking for libc rseq support in the library constructor, don't +only depend on the symbols presence, check that the registration was +completed. + +This targets a scenario where the libc has rseq support but it is not +wired for the current architecture in 'bits/rseq.h', we want to fallback +to our internal registration mechanism. + +Signed-off-by: Michael Jeanson +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Mathieu Desnoyers +Link: https://lore.kernel.org/r/20220614154830.1367382-4-mjeanson@efficios.com +Stable-dep-of: 3bcbc20942db ("selftests/rseq: Play nice with binaries statically linked against glibc 2.35+") +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/rseq/rseq.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/rseq/rseq.c b/tools/testing/selftests/rseq/rseq.c +index 986b9458efb26..4177f9507bbee 100644 +--- a/tools/testing/selftests/rseq/rseq.c ++++ b/tools/testing/selftests/rseq/rseq.c +@@ -111,7 +111,8 @@ void rseq_init(void) + libc_rseq_offset_p = dlsym(RTLD_NEXT, "__rseq_offset"); + libc_rseq_size_p = dlsym(RTLD_NEXT, "__rseq_size"); + libc_rseq_flags_p = dlsym(RTLD_NEXT, "__rseq_flags"); +- if (libc_rseq_size_p && libc_rseq_offset_p && libc_rseq_flags_p) { ++ if (libc_rseq_size_p && libc_rseq_offset_p && libc_rseq_flags_p && ++ *libc_rseq_size_p != 0) { + /* rseq registration owned by glibc */ + rseq_offset = *libc_rseq_offset_p; + rseq_size = *libc_rseq_size_p; +-- +2.40.1 + diff --git a/queue-5.4/selftests-rseq-play-nice-with-binaries-statically-li.patch b/queue-5.4/selftests-rseq-play-nice-with-binaries-statically-li.patch new file mode 100644 index 00000000000..8ff8f14042a --- /dev/null +++ b/queue-5.4/selftests-rseq-play-nice-with-binaries-statically-li.patch @@ -0,0 +1,84 @@ +From 4a94bd4d6954a1e36bd93517de86be252b6c1bd5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 15:33:52 -0700 +Subject: selftests/rseq: Play nice with binaries statically linked against + glibc 2.35+ + +From: Sean Christopherson + +[ Upstream commit 3bcbc20942db5d738221cca31a928efc09827069 ] + +To allow running rseq and KVM's rseq selftests as statically linked +binaries, initialize the various "trampoline" pointers to point directly +at the expect glibc symbols, and skip the dlysm() lookups if the rseq +size is non-zero, i.e. the binary is statically linked *and* the libc +registered its own rseq. + +Define weak versions of the symbols so as not to break linking against +libc versions that don't support rseq in any capacity. + +The KVM selftests in particular are often statically linked so that they +can be run on targets with very limited runtime environments, i.e. test +machines. + +Fixes: 233e667e1ae3 ("selftests/rseq: Uplift rseq selftests for compatibility with glibc-2.35") +Cc: Aaron Lewis +Cc: kvm@vger.kernel.org +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Message-Id: <20230721223352.2333911-1-seanjc@google.com> +Signed-off-by: Paolo Bonzini +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/rseq/rseq.c | 28 ++++++++++++++++++++++------ + 1 file changed, 22 insertions(+), 6 deletions(-) + +diff --git a/tools/testing/selftests/rseq/rseq.c b/tools/testing/selftests/rseq/rseq.c +index 4177f9507bbee..b736a5169aad0 100644 +--- a/tools/testing/selftests/rseq/rseq.c ++++ b/tools/testing/selftests/rseq/rseq.c +@@ -32,9 +32,17 @@ + #include "../kselftest.h" + #include "rseq.h" + +-static const ptrdiff_t *libc_rseq_offset_p; +-static const unsigned int *libc_rseq_size_p; +-static const unsigned int *libc_rseq_flags_p; ++/* ++ * Define weak versions to play nice with binaries that are statically linked ++ * against a libc that doesn't support registering its own rseq. ++ */ ++__weak ptrdiff_t __rseq_offset; ++__weak unsigned int __rseq_size; ++__weak unsigned int __rseq_flags; ++ ++static const ptrdiff_t *libc_rseq_offset_p = &__rseq_offset; ++static const unsigned int *libc_rseq_size_p = &__rseq_size; ++static const unsigned int *libc_rseq_flags_p = &__rseq_flags; + + /* Offset from the thread pointer to the rseq area. */ + ptrdiff_t rseq_offset; +@@ -108,9 +116,17 @@ int rseq_unregister_current_thread(void) + static __attribute__((constructor)) + void rseq_init(void) + { +- libc_rseq_offset_p = dlsym(RTLD_NEXT, "__rseq_offset"); +- libc_rseq_size_p = dlsym(RTLD_NEXT, "__rseq_size"); +- libc_rseq_flags_p = dlsym(RTLD_NEXT, "__rseq_flags"); ++ /* ++ * If the libc's registered rseq size isn't already valid, it may be ++ * because the binary is dynamically linked and not necessarily due to ++ * libc not having registered a restartable sequence. Try to find the ++ * symbols if that's the case. ++ */ ++ if (!*libc_rseq_size_p) { ++ libc_rseq_offset_p = dlsym(RTLD_NEXT, "__rseq_offset"); ++ libc_rseq_size_p = dlsym(RTLD_NEXT, "__rseq_size"); ++ libc_rseq_flags_p = dlsym(RTLD_NEXT, "__rseq_flags"); ++ } + if (libc_rseq_size_p && libc_rseq_offset_p && libc_rseq_flags_p && + *libc_rseq_size_p != 0) { + /* rseq registration owned by glibc */ +-- +2.40.1 + diff --git a/queue-5.4/series b/queue-5.4/series index c32f1f09c46..a42c47ef8a3 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -135,3 +135,16 @@ test_firmware-prevent-race-conditions-by-a-correct-implementation-of-locking.pat test_firmware-return-enomem-instead-of-enospc-on-failed-memory-allocation.patch mtd-rawnand-omap_elm-fix-incorrect-type-in-assignmen.patch powerpc-mm-altmap-fix-altmap-boundary-check.patch +selftests-rseq-check-if-libc-rseq-support-is-registe.patch +selftests-rseq-play-nice-with-binaries-statically-li.patch +pm-wakeirq-support-enabling-wake-up-irq-after-runtim.patch +pm-sleep-wakeirq-fix-wake-irq-arming.patch +ceph-show-tasks-waiting-on-caps-in-debugfs-caps-file.patch +ceph-use-kill_anon_super-helper.patch +ceph-defer-stopping-mdsc-delayed_work.patch +arm64-dts-stratix10-fix-incorrect-i2c-property-for-s.patch +arm-dts-imx6sll-make-ssi-node-name-same-as-other-pla.patch +arm-dts-imx-align-l2-cache-controller-nodename-with-.patch +arm-dts-imx-add-usb-alias.patch +arm-dts-imx6sll-fixup-of-operating-points.patch +arm-dts-nxp-imx6sll-fix-wrong-property-name-in-usbph.patch -- 2.47.3