From 98da7e444c4ca6b16f619768f0720db2dee26c1c Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 10 Dec 2023 14:38:52 -0500 Subject: [PATCH] Fixes for 6.1 Signed-off-by: Sasha Levin --- ...ts-mediatek-add-missing-space-before.patch | 277 +++++++++++ ...-kukui-fix-underscores-in-node-names.patch | 432 ++++++++++++++++++ ...m4x-make-etm4_remove_dev-return-void.patch | 66 +++ ...remove-bogous-__exit-annotation-for-.patch | 72 +++ ...hisi_ptt-add-dummy-callback-pmu-read.patch | 51 +++ ...n-t-sign-extend-function-return-valu.patch | 157 +++++++ ...on-t-sign-extend-memory-load-operand.patch | 159 +++++++ ...c-fix-problem-of-return-eoverflow-in.patch | 38 ++ ...c-return-negative-error-code-in-mei_.patch | 37 ++ ...perand-number-out-of-range-build-err.patch | 37 ++ ...ze-of-the-bug_table-on-64-bit-kernel.patch | 122 +++++ ...e-absolute-timestamp-on-discard-of-e.patch | 71 +++ queue-6.1/series | 14 + ...actual-size-after-ring-buffer-resize.patch | 70 +++ ...-current-tracer-when-resizing-buffer.patch | 73 +++ 15 files changed, 1676 insertions(+) create mode 100644 queue-6.1/arm64-dts-mediatek-add-missing-space-before.patch create mode 100644 queue-6.1/arm64-dts-mt8183-kukui-fix-underscores-in-node-names.patch create mode 100644 queue-6.1/coresight-etm4x-make-etm4_remove_dev-return-void.patch create mode 100644 queue-6.1/coresight-etm4x-remove-bogous-__exit-annotation-for-.patch create mode 100644 queue-6.1/hwtracing-hisi_ptt-add-dummy-callback-pmu-read.patch create mode 100644 queue-6.1/loongarch-bpf-don-t-sign-extend-function-return-valu.patch create mode 100644 queue-6.1/loongarch-bpf-don-t-sign-extend-memory-load-operand.patch create mode 100644 queue-6.1/misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch create mode 100644 queue-6.1/misc-mei-client.c-return-negative-error-code-in-mei_.patch create mode 100644 queue-6.1/parisc-fix-asm-operand-number-out-of-range-build-err.patch create mode 100644 queue-6.1/parisc-reduce-size-of-the-bug_table-on-64-bit-kernel.patch create mode 100644 queue-6.1/ring-buffer-force-absolute-timestamp-on-discard-of-e.patch create mode 100644 queue-6.1/tracing-set-actual-size-after-ring-buffer-resize.patch create mode 100644 queue-6.1/tracing-stop-current-tracer-when-resizing-buffer.patch diff --git a/queue-6.1/arm64-dts-mediatek-add-missing-space-before.patch b/queue-6.1/arm64-dts-mediatek-add-missing-space-before.patch new file mode 100644 index 00000000000..047c887d92f --- /dev/null +++ b/queue-6.1/arm64-dts-mediatek-add-missing-space-before.patch @@ -0,0 +1,277 @@ +From 9f414567d1967ced1f1c0a5cb96d7e8b2796961a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 Jul 2023 17:00:06 +0200 +Subject: arm64: dts: mediatek: add missing space before { + +From: Krzysztof Kozlowski + +[ Upstream commit a9c740c57f977deb41bc53c02d0dae3d0e2f191a ] + +Add missing whitespace between node name/label and opening {. + +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20230705150006.293690-2-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Stable-dep-of: 8980c30141d3 ("arm64: dts: mt8183: kukui: Fix underscores in node names") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8183-evb.dts | 48 +++++++++---------- + .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 12 ++--- + .../boot/dts/mediatek/mt8183-pumpkin.dts | 12 ++--- + 3 files changed, 36 insertions(+), 36 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-evb.dts b/arch/arm64/boot/dts/mediatek/mt8183-evb.dts +index 705af355a64e0..2ca0da51efaa0 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-evb.dts ++++ b/arch/arm64/boot/dts/mediatek/mt8183-evb.dts +@@ -139,8 +139,8 @@ &mmc1 { + }; + + &pio { +- i2c_pins_0: i2c0{ +- pins_i2c{ ++ i2c_pins_0: i2c0 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -148,8 +148,8 @@ pins_i2c{ + }; + }; + +- i2c_pins_1: i2c1{ +- pins_i2c{ ++ i2c_pins_1: i2c1 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -157,8 +157,8 @@ pins_i2c{ + }; + }; + +- i2c_pins_2: i2c2{ +- pins_i2c{ ++ i2c_pins_2: i2c2 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -166,8 +166,8 @@ pins_i2c{ + }; + }; + +- i2c_pins_3: i2c3{ +- pins_i2c{ ++ i2c_pins_3: i2c3 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -175,8 +175,8 @@ pins_i2c{ + }; + }; + +- i2c_pins_4: i2c4{ +- pins_i2c{ ++ i2c_pins_4: i2c4 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -184,8 +184,8 @@ pins_i2c{ + }; + }; + +- i2c_pins_5: i2c5{ +- pins_i2c{ ++ i2c_pins_5: i2c5 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -193,8 +193,8 @@ pins_i2c{ + }; + }; + +- spi_pins_0: spi0{ +- pins_spi{ ++ spi_pins_0: spi0 { ++ pins_spi { + pinmux = , + , + , +@@ -308,8 +308,8 @@ pins_clk { + }; + }; + +- spi_pins_1: spi1{ +- pins_spi{ ++ spi_pins_1: spi1 { ++ pins_spi { + pinmux = , + , + , +@@ -318,8 +318,8 @@ pins_spi{ + }; + }; + +- spi_pins_2: spi2{ +- pins_spi{ ++ spi_pins_2: spi2 { ++ pins_spi { + pinmux = , + , + , +@@ -328,8 +328,8 @@ pins_spi{ + }; + }; + +- spi_pins_3: spi3{ +- pins_spi{ ++ spi_pins_3: spi3 { ++ pins_spi { + pinmux = , + , + , +@@ -338,8 +338,8 @@ pins_spi{ + }; + }; + +- spi_pins_4: spi4{ +- pins_spi{ ++ spi_pins_4: spi4 { ++ pins_spi { + pinmux = , + , + , +@@ -348,8 +348,8 @@ pins_spi{ + }; + }; + +- spi_pins_5: spi5{ +- pins_spi{ ++ spi_pins_5: spi5 { ++ pins_spi { + pinmux = , + , + , +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +index f8bea83d89d6d..b813ce665e5dd 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +@@ -683,7 +683,7 @@ pins_scp_uart { + }; + + spi0_pins: spi0 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + , +@@ -693,7 +693,7 @@ pins_spi{ + }; + + spi1_pins: spi1 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + , +@@ -703,7 +703,7 @@ pins_spi{ + }; + + spi2_pins: spi2 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + ; +@@ -716,7 +716,7 @@ pins_spi_mi { + }; + + spi3_pins: spi3 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + , +@@ -726,7 +726,7 @@ pins_spi{ + }; + + spi4_pins: spi4 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + , +@@ -736,7 +736,7 @@ pins_spi{ + }; + + spi5_pins: spi5 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + , +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts b/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts +index a1d01639df30a..dd8d39861d9ca 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts ++++ b/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts +@@ -178,7 +178,7 @@ &mmc1 { + + &pio { + i2c_pins_0: i2c0 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -187,7 +187,7 @@ pins_i2c{ + }; + + i2c_pins_1: i2c1 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -196,7 +196,7 @@ pins_i2c{ + }; + + i2c_pins_2: i2c2 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -205,7 +205,7 @@ pins_i2c{ + }; + + i2c_pins_3: i2c3 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -214,7 +214,7 @@ pins_i2c{ + }; + + i2c_pins_4: i2c4 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -223,7 +223,7 @@ pins_i2c{ + }; + + i2c_pins_5: i2c5 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +-- +2.42.0 + diff --git a/queue-6.1/arm64-dts-mt8183-kukui-fix-underscores-in-node-names.patch b/queue-6.1/arm64-dts-mt8183-kukui-fix-underscores-in-node-names.patch new file mode 100644 index 00000000000..e47e622ed1e --- /dev/null +++ b/queue-6.1/arm64-dts-mt8183-kukui-fix-underscores-in-node-names.patch @@ -0,0 +1,432 @@ +From f0cf9b3cf7a7e79060169356888d2779572cdf0d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Oct 2023 12:09:10 -0700 +Subject: arm64: dts: mt8183: kukui: Fix underscores in node names + +From: Hsin-Yi Wang + +[ Upstream commit 8980c30141d3986beab815d85762b9c67196ed72 ] + +Replace underscores with hyphens in pinctrl node names both for consistency +and to adhere to the bindings. + +Cc: stable@vger.kernel.org +Fixes: cd894e274b74 ("arm64: dts: mt8183: Add krane-sku176 board") +Fixes: 1652dbf7363a ("arm64: dts: mt8183: add scp node") +Fixes: 27eaf34df364 ("arm64: dts: mt8183: config dsi node") +Signed-off-by: Hsin-Yi Wang +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20231026191343.3345279-2-hsinyi@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + .../dts/mediatek/mt8183-kukui-jacuzzi.dtsi | 6 +- + .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 94 +++++++++---------- + 2 files changed, 50 insertions(+), 50 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi +index 22b806e75401b..dccf367c7ec6c 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi +@@ -439,20 +439,20 @@ pins2 { + }; + + touchscreen_pins: touchscreen-pins { +- touch_int_odl { ++ touch-int-odl { + pinmux = ; + input-enable; + bias-pull-up; + }; + +- touch_rst_l { ++ touch-rst-l { + pinmux = ; + output-high; + }; + }; + + trackpad_pins: trackpad-pins { +- trackpad_int { ++ trackpad-int { + pinmux = ; + input-enable; + bias-disable; /* pulled externally */ +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +index b813ce665e5dd..a428a581c93a8 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +@@ -423,7 +423,7 @@ &mt6358_vsim2_reg { + + &pio { + aud_pins_default: audiopins { +- pins_bus { ++ pins-bus { + pinmux = , + , + , +@@ -445,7 +445,7 @@ pins_bus { + }; + + aud_pins_tdm_out_on: audiotdmouton { +- pins_bus { ++ pins-bus { + pinmux = , + , + , +@@ -457,7 +457,7 @@ pins_bus { + }; + + aud_pins_tdm_out_off: audiotdmoutoff { +- pins_bus { ++ pins-bus { + pinmux = , + , + , +@@ -471,13 +471,13 @@ pins_bus { + }; + + bt_pins: bt-pins { +- pins_bt_en { ++ pins-bt-en { + pinmux = ; + output-low; + }; + }; + +- ec_ap_int_odl: ec_ap_int_odl { ++ ec_ap_int_odl: ec-ap-int-odl { + pins1 { + pinmux = ; + input-enable; +@@ -485,7 +485,7 @@ pins1 { + }; + }; + +- h1_int_od_l: h1_int_od_l { ++ h1_int_od_l: h1-int-od-l { + pins1 { + pinmux = ; + input-enable; +@@ -493,7 +493,7 @@ pins1 { + }; + + i2c0_pins: i2c0 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -502,7 +502,7 @@ pins_bus { + }; + + i2c1_pins: i2c1 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -511,7 +511,7 @@ pins_bus { + }; + + i2c2_pins: i2c2 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + bias-disable; +@@ -520,7 +520,7 @@ pins_bus { + }; + + i2c3_pins: i2c3 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -529,7 +529,7 @@ pins_bus { + }; + + i2c4_pins: i2c4 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + bias-disable; +@@ -538,7 +538,7 @@ pins_bus { + }; + + i2c5_pins: i2c5 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -547,7 +547,7 @@ pins_bus { + }; + + i2c6_pins: i2c6 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + bias-disable; +@@ -555,7 +555,7 @@ pins_bus { + }; + + mmc0_pins_default: mmc0-pins-default { +- pins_cmd_dat { ++ pins-cmd-dat { + pinmux = , + , + , +@@ -570,13 +570,13 @@ pins_cmd_dat { + mediatek,pull-up-adv = <01>; + }; + +- pins_clk { ++ pins-clk { + pinmux = ; + drive-strength = ; + mediatek,pull-down-adv = <10>; + }; + +- pins_rst { ++ pins-rst { + pinmux = ; + drive-strength = ; + mediatek,pull-down-adv = <01>; +@@ -584,7 +584,7 @@ pins_rst { + }; + + mmc0_pins_uhs: mmc0-pins-uhs { +- pins_cmd_dat { ++ pins-cmd-dat { + pinmux = , + , + , +@@ -599,19 +599,19 @@ pins_cmd_dat { + mediatek,pull-up-adv = <01>; + }; + +- pins_clk { ++ pins-clk { + pinmux = ; + drive-strength = ; + mediatek,pull-down-adv = <10>; + }; + +- pins_ds { ++ pins-ds { + pinmux = ; + drive-strength = ; + mediatek,pull-down-adv = <10>; + }; + +- pins_rst { ++ pins-rst { + pinmux = ; + drive-strength = ; + mediatek,pull-up-adv = <01>; +@@ -619,7 +619,7 @@ pins_rst { + }; + + mmc1_pins_default: mmc1-pins-default { +- pins_cmd_dat { ++ pins-cmd-dat { + pinmux = , + , + , +@@ -629,7 +629,7 @@ pins_cmd_dat { + mediatek,pull-up-adv = <10>; + }; + +- pins_clk { ++ pins-clk { + pinmux = ; + input-enable; + mediatek,pull-down-adv = <10>; +@@ -637,7 +637,7 @@ pins_clk { + }; + + mmc1_pins_uhs: mmc1-pins-uhs { +- pins_cmd_dat { ++ pins-cmd-dat { + pinmux = , + , + , +@@ -648,7 +648,7 @@ pins_cmd_dat { + mediatek,pull-up-adv = <10>; + }; + +- pins_clk { ++ pins-clk { + pinmux = ; + drive-strength = ; + mediatek,pull-down-adv = <10>; +@@ -656,15 +656,15 @@ pins_clk { + }; + }; + +- panel_pins_default: panel_pins_default { +- panel_reset { ++ panel_pins_default: panel-pins-default { ++ panel-reset { + pinmux = ; + output-low; + bias-pull-up; + }; + }; + +- pwm0_pin_default: pwm0_pin_default { ++ pwm0_pin_default: pwm0-pin-default { + pins1 { + pinmux = ; + output-high; +@@ -676,14 +676,14 @@ pins2 { + }; + + scp_pins: scp { +- pins_scp_uart { ++ pins-scp-uart { + pinmux = , + ; + }; + }; + + spi0_pins: spi0 { +- pins_spi { ++ pins-spi { + pinmux = , + , + , +@@ -693,7 +693,7 @@ pins_spi { + }; + + spi1_pins: spi1 { +- pins_spi { ++ pins-spi { + pinmux = , + , + , +@@ -703,20 +703,20 @@ pins_spi { + }; + + spi2_pins: spi2 { +- pins_spi { ++ pins-spi { + pinmux = , + , + ; + bias-disable; + }; +- pins_spi_mi { ++ pins-spi-mi { + pinmux = ; + mediatek,pull-down-adv = <00>; + }; + }; + + spi3_pins: spi3 { +- pins_spi { ++ pins-spi { + pinmux = , + , + , +@@ -726,7 +726,7 @@ pins_spi { + }; + + spi4_pins: spi4 { +- pins_spi { ++ pins-spi { + pinmux = , + , + , +@@ -736,7 +736,7 @@ pins_spi { + }; + + spi5_pins: spi5 { +- pins_spi { ++ pins-spi { + pinmux = , + , + , +@@ -746,63 +746,63 @@ pins_spi { + }; + + uart0_pins_default: uart0-pins-default { +- pins_rx { ++ pins-rx { + pinmux = ; + input-enable; + bias-pull-up; + }; +- pins_tx { ++ pins-tx { + pinmux = ; + }; + }; + + uart1_pins_default: uart1-pins-default { +- pins_rx { ++ pins-rx { + pinmux = ; + input-enable; + bias-pull-up; + }; +- pins_tx { ++ pins-tx { + pinmux = ; + }; +- pins_rts { ++ pins-rts { + pinmux = ; + output-enable; + }; +- pins_cts { ++ pins-cts { + pinmux = ; + input-enable; + }; + }; + + uart1_pins_sleep: uart1-pins-sleep { +- pins_rx { ++ pins-rx { + pinmux = ; + input-enable; + bias-pull-up; + }; +- pins_tx { ++ pins-tx { + pinmux = ; + }; +- pins_rts { ++ pins-rts { + pinmux = ; + output-enable; + }; +- pins_cts { ++ pins-cts { + pinmux = ; + input-enable; + }; + }; + + wifi_pins_pwrseq: wifi-pins-pwrseq { +- pins_wifi_enable { ++ pins-wifi-enable { + pinmux = ; + output-low; + }; + }; + + wifi_pins_wakeup: wifi-pins-wakeup { +- pins_wifi_wakeup { ++ pins-wifi-wakeup { + pinmux = ; + input-enable; + }; +-- +2.42.0 + diff --git a/queue-6.1/coresight-etm4x-make-etm4_remove_dev-return-void.patch b/queue-6.1/coresight-etm4x-make-etm4_remove_dev-return-void.patch new file mode 100644 index 00000000000..0160d1c9bbc --- /dev/null +++ b/queue-6.1/coresight-etm4x-make-etm4_remove_dev-return-void.patch @@ -0,0 +1,66 @@ +From 54111a948c2d5f4695267deca6fcaf50101710d2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 May 2023 22:16:29 +0200 +Subject: coresight: etm4x: Make etm4_remove_dev() return void +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit c5f231f1a7e18d28e02b282d33541d31358360e4 ] + +etm4_remove_dev() returned zero unconditionally. Make it return void +instead, which makes it clear in the callers that there is no error to +handle. Simplify etm4_remove_platform_dev() accordingly. + +Signed-off-by: Uwe Kleine-König +Reviewed-by: Anshuman Khandual +Signed-off-by: Suzuki K Poulose +Link: https://lore.kernel.org/r/20230518201629.260672-1-u.kleine-koenig@pengutronix.de +Stable-dep-of: 348ddab81f7b ("coresight: etm4x: Remove bogous __exit annotation for some functions") +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/coresight-etm4x-core.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index 1cf7478da6ee8..fd52fd64c6b13 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -2072,7 +2072,7 @@ static void clear_etmdrvdata(void *info) + etmdrvdata[cpu] = NULL; + } + +-static int __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) ++static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) + { + etm_perf_symlink(drvdata->csdev, false); + /* +@@ -2094,7 +2094,6 @@ static int __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) + cscfg_unregister_csdev(drvdata->csdev); + coresight_unregister(drvdata->csdev); + +- return 0; + } + + static void __exit etm4_remove_amba(struct amba_device *adev) +@@ -2107,13 +2106,12 @@ static void __exit etm4_remove_amba(struct amba_device *adev) + + static int __exit etm4_remove_platform_dev(struct platform_device *pdev) + { +- int ret = 0; + struct etmv4_drvdata *drvdata = dev_get_drvdata(&pdev->dev); + + if (drvdata) +- ret = etm4_remove_dev(drvdata); ++ etm4_remove_dev(drvdata); + pm_runtime_disable(&pdev->dev); +- return ret; ++ return 0; + } + + static const struct amba_id etm4_ids[] = { +-- +2.42.0 + diff --git a/queue-6.1/coresight-etm4x-remove-bogous-__exit-annotation-for-.patch b/queue-6.1/coresight-etm4x-remove-bogous-__exit-annotation-for-.patch new file mode 100644 index 00000000000..8faf613d5f3 --- /dev/null +++ b/queue-6.1/coresight-etm4x-remove-bogous-__exit-annotation-for-.patch @@ -0,0 +1,72 @@ +From a19bea4d2758ef8990d6bce964009c46407260ec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 29 Sep 2023 10:16:37 +0200 +Subject: coresight: etm4x: Remove bogous __exit annotation for some functions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit 348ddab81f7b0983d9fb158df910254f08d3f887 ] + +etm4_platform_driver (which lives in ".data" contains a reference to +etm4_remove_platform_dev(). So the latter must not be marked with __exit +which results in the function being discarded for a build with +CONFIG_CORESIGHT_SOURCE_ETM4X=y which in turn makes the remove pointer +contain invalid data. + +etm4x_amba_driver referencing etm4_remove_amba() has the same issue. + +Drop the __exit annotations for the two affected functions and a third +one that is called by the other two. + +For reasons I don't understand this isn't catched by building with +CONFIG_DEBUG_SECTION_MISMATCH=y. + +Fixes: c23bc382ef0e ("coresight: etm4x: Refactor probing routine") +Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices") +Signed-off-by: Uwe Kleine-König +Reviewed-by: James Clark +Link: https://lore.kernel.org/all/20230929081540.yija47lsj35xtj4v@pengutronix.de/ +Link: https://lore.kernel.org/r/20230929081637.2377335-1-u.kleine-koenig@pengutronix.de +Signed-off-by: Suzuki K Poulose +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index fd52fd64c6b13..fda48a0afc1a5 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -2072,7 +2072,7 @@ static void clear_etmdrvdata(void *info) + etmdrvdata[cpu] = NULL; + } + +-static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) ++static void etm4_remove_dev(struct etmv4_drvdata *drvdata) + { + etm_perf_symlink(drvdata->csdev, false); + /* +@@ -2096,7 +2096,7 @@ static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) + + } + +-static void __exit etm4_remove_amba(struct amba_device *adev) ++static void etm4_remove_amba(struct amba_device *adev) + { + struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); + +@@ -2104,7 +2104,7 @@ static void __exit etm4_remove_amba(struct amba_device *adev) + etm4_remove_dev(drvdata); + } + +-static int __exit etm4_remove_platform_dev(struct platform_device *pdev) ++static int etm4_remove_platform_dev(struct platform_device *pdev) + { + struct etmv4_drvdata *drvdata = dev_get_drvdata(&pdev->dev); + +-- +2.42.0 + diff --git a/queue-6.1/hwtracing-hisi_ptt-add-dummy-callback-pmu-read.patch b/queue-6.1/hwtracing-hisi_ptt-add-dummy-callback-pmu-read.patch new file mode 100644 index 00000000000..921d8d804c5 --- /dev/null +++ b/queue-6.1/hwtracing-hisi_ptt-add-dummy-callback-pmu-read.patch @@ -0,0 +1,51 @@ +From 7c0b12081b74a0bb2e428de336015cc0f0ffd4b2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Oct 2023 16:47:31 +0800 +Subject: hwtracing: hisi_ptt: Add dummy callback pmu::read() + +From: Junhao He + +[ Upstream commit 55e0a2fb0cb5ab7c9c99c1ad4d3e6954de8b73a0 ] + +When start trace with perf option "-C $cpu" and immediately stop it +with SIGTERM or others, the perf core will invoke pmu::read() while +the driver doesn't implement it. Add a dummy pmu::read() to avoid +any issues. + +Fixes: ff0de066b463 ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device") +Signed-off-by: Junhao He +Signed-off-by: Yicong Yang +Acked-by: Jonathan Cameron +Signed-off-by: Suzuki K Poulose +Link: https://lore.kernel.org/r/20231010084731.30450-6-yangyicong@huawei.com +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/ptt/hisi_ptt.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c +index 4140efd664097..016220ba0addd 100644 +--- a/drivers/hwtracing/ptt/hisi_ptt.c ++++ b/drivers/hwtracing/ptt/hisi_ptt.c +@@ -837,6 +837,10 @@ static void hisi_ptt_pmu_del(struct perf_event *event, int flags) + hisi_ptt_pmu_stop(event, PERF_EF_UPDATE); + } + ++static void hisi_ptt_pmu_read(struct perf_event *event) ++{ ++} ++ + static void hisi_ptt_remove_cpuhp_instance(void *hotplug_node) + { + cpuhp_state_remove_instance_nocalls(hisi_ptt_pmu_online, hotplug_node); +@@ -880,6 +884,7 @@ static int hisi_ptt_register_pmu(struct hisi_ptt *hisi_ptt) + .stop = hisi_ptt_pmu_stop, + .add = hisi_ptt_pmu_add, + .del = hisi_ptt_pmu_del, ++ .read = hisi_ptt_pmu_read, + }; + + reg = readl(hisi_ptt->iobase + HISI_PTT_LOCATION); +-- +2.42.0 + diff --git a/queue-6.1/loongarch-bpf-don-t-sign-extend-function-return-valu.patch b/queue-6.1/loongarch-bpf-don-t-sign-extend-function-return-valu.patch new file mode 100644 index 00000000000..4e5dbc73450 --- /dev/null +++ b/queue-6.1/loongarch-bpf-don-t-sign-extend-function-return-valu.patch @@ -0,0 +1,157 @@ +From 4dcdb91b36453f381257c0cd10f3111f27ab0055 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 9 Dec 2023 15:49:16 +0800 +Subject: LoongArch: BPF: Don't sign extend function return value + +From: Hengqi Chen + +[ Upstream commit 5d47ec2e6f4c64e30e392cfe9532df98c9beb106 ] + +The `cls_redirect` test triggers a kernel panic like: + + # ./test_progs -t cls_redirect + Can't find bpf_testmod.ko kernel module: -2 + WARNING! Selftests relying on bpf_testmod.ko will be skipped. + [ 30.938489] CPU 3 Unable to handle kernel paging request at virtual address fffffffffd814de0, era == ffff800002009fb8, ra == ffff800002009f9c + [ 30.939331] Oops[#1]: + [ 30.939513] CPU: 3 PID: 1260 Comm: test_progs Not tainted 6.7.0-rc2-loong-devel-g2f56bb0d2327 #35 a896aca3f4164f09cc346f89f2e09832e07be5f6 + [ 30.939732] Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022 + [ 30.939901] pc ffff800002009fb8 ra ffff800002009f9c tp 9000000104da4000 sp 9000000104da7ab0 + [ 30.940038] a0 fffffffffd814de0 a1 9000000104da7a68 a2 0000000000000000 a3 9000000104da7c10 + [ 30.940183] a4 9000000104da7c14 a5 0000000000000002 a6 0000000000000021 a7 00005555904d7f90 + [ 30.940321] t0 0000000000000110 t1 0000000000000000 t2 fffffffffd814de0 t3 0004c4b400000000 + [ 30.940456] t4 ffffffffffffffff t5 00000000c3f63600 t6 0000000000000000 t7 0000000000000000 + [ 30.940590] t8 000000000006d803 u0 0000000000000020 s9 9000000104da7b10 s0 900000010504c200 + [ 30.940727] s1 fffffffffd814de0 s2 900000010504c200 s3 9000000104da7c10 s4 9000000104da7ad0 + [ 30.940866] s5 0000000000000000 s6 90000000030e65bc s7 9000000104da7b44 s8 90000000044f6fc0 + [ 30.941015] ra: ffff800002009f9c bpf_prog_846803e5ae81417f_cls_redirect+0xa0/0x590 + [ 30.941535] ERA: ffff800002009fb8 bpf_prog_846803e5ae81417f_cls_redirect+0xbc/0x590 + [ 30.941696] CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) + [ 30.942224] PRMD: 00000004 (PPLV0 +PIE -PWE) + [ 30.942330] EUEN: 00000003 (+FPE +SXE -ASXE -BTE) + [ 30.942453] ECFG: 00071c1c (LIE=2-4,10-12 VS=7) + [ 30.942612] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0) + [ 30.942764] BADV: fffffffffd814de0 + [ 30.942854] PRID: 0014c010 (Loongson-64bit, Loongson-3A5000) + [ 30.942974] Modules linked in: + [ 30.943078] Process test_progs (pid: 1260, threadinfo=00000000ce303226, task=000000007d10bb76) + [ 30.943306] Stack : 900000010a064000 90000000044f6fc0 9000000104da7b48 0000000000000000 + [ 30.943495] 0000000000000000 9000000104da7c14 9000000104da7c10 900000010504c200 + [ 30.943626] 0000000000000001 ffff80001b88c000 9000000104da7b70 90000000030e6668 + [ 30.943785] 0000000000000000 9000000104da7b58 ffff80001b88c048 9000000003d05000 + [ 30.943936] 900000000303ac88 0000000000000000 0000000000000000 9000000104da7b70 + [ 30.944091] 0000000000000000 0000000000000001 0000000731eeab00 0000000000000000 + [ 30.944245] ffff80001b88c000 0000000000000000 0000000000000000 54b99959429f83b8 + [ 30.944402] ffff80001b88c000 90000000044f6fc0 9000000101d70000 ffff80001b88c000 + [ 30.944538] 000000000000005a 900000010504c200 900000010a064000 900000010a067000 + [ 30.944697] 9000000104da7d88 0000000000000000 9000000003d05000 90000000030e794c + [ 30.944852] ... + [ 30.944924] Call Trace: + [ 30.945120] [] bpf_prog_846803e5ae81417f_cls_redirect+0xbc/0x590 + [ 30.945650] [<90000000030e6668>] bpf_test_run+0x1ec/0x2f8 + [ 30.945958] [<90000000030e794c>] bpf_prog_test_run_skb+0x31c/0x684 + [ 30.946065] [<90000000026d4f68>] __sys_bpf+0x678/0x2724 + [ 30.946159] [<90000000026d7288>] sys_bpf+0x20/0x2c + [ 30.946253] [<90000000032dd224>] do_syscall+0x7c/0x94 + [ 30.946343] [<9000000002541c5c>] handle_syscall+0xbc/0x158 + [ 30.946492] + [ 30.946549] Code: 0015030e 5c0009c0 5001d000 <28c00304> 02c00484 29c00304 00150009 2a42d2e4 0280200d + [ 30.946793] + [ 30.946971] ---[ end trace 0000000000000000 ]--- + [ 32.093225] Kernel panic - not syncing: Fatal exception in interrupt + [ 32.093526] Kernel relocated by 0x2320000 + [ 32.093630] .text @ 0x9000000002520000 + [ 32.093725] .data @ 0x9000000003400000 + [ 32.093792] .bss @ 0x9000000004413200 + [ 34.971998] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]--- + +This is because we signed-extend function return values. When subprog +mode is enabled, we have: + + cls_redirect() + -> get_global_metrics() returns pcpu ptr 0xfffffefffc00b480 + +The pointer returned is later signed-extended to 0xfffffffffc00b480 at +`BPF_JMP | BPF_EXIT`. During BPF prog run, this triggers unhandled page +fault and a kernel panic. + +Drop the unnecessary signed-extension on return values like other +architectures do. + +With this change, we have: + + # ./test_progs -t cls_redirect + Can't find bpf_testmod.ko kernel module: -2 + WARNING! Selftests relying on bpf_testmod.ko will be skipped. + #51/1 cls_redirect/cls_redirect_inlined:OK + #51/2 cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK + #51/3 cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK + #51/4 cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK + #51/5 cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK + #51/6 cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK + #51/7 cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK + #51/8 cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK + #51/9 cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK + #51/10 cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK + #51/11 cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK + #51/12 cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK + #51/13 cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK + #51/14 cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK + #51/15 cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK + #51/16 cls_redirect/cls_redirect_subprogs:OK + #51/17 cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK + #51/18 cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK + #51/19 cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK + #51/20 cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK + #51/21 cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK + #51/22 cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK + #51/23 cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK + #51/24 cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK + #51/25 cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK + #51/26 cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK + #51/27 cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK + #51/28 cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK + #51/29 cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK + #51/30 cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK + #51/31 cls_redirect/cls_redirect_dynptr:OK + #51/32 cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK + #51/33 cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK + #51/34 cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK + #51/35 cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK + #51/36 cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK + #51/37 cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK + #51/38 cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK + #51/39 cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK + #51/40 cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK + #51/41 cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK + #51/42 cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK + #51/43 cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK + #51/44 cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK + #51/45 cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK + #51 cls_redirect:OK + Summary: 1/45 PASSED, 0 SKIPPED, 0 FAILED + +Fixes: 5dc615520c4d ("LoongArch: Add BPF JIT support") +Signed-off-by: Hengqi Chen +Signed-off-by: Huacai Chen +Signed-off-by: Sasha Levin +--- + arch/loongarch/net/bpf_jit.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c +index 20ad5f3a9bf94..40ed49d9adff5 100644 +--- a/arch/loongarch/net/bpf_jit.c ++++ b/arch/loongarch/net/bpf_jit.c +@@ -796,8 +796,6 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext + + /* function return */ + case BPF_JMP | BPF_EXIT: +- emit_sext_32(ctx, regmap[BPF_REG_0], true); +- + if (i == ctx->prog->len - 1) + break; + +-- +2.42.0 + diff --git a/queue-6.1/loongarch-bpf-don-t-sign-extend-memory-load-operand.patch b/queue-6.1/loongarch-bpf-don-t-sign-extend-memory-load-operand.patch new file mode 100644 index 00000000000..c5f1b6c5bcf --- /dev/null +++ b/queue-6.1/loongarch-bpf-don-t-sign-extend-memory-load-operand.patch @@ -0,0 +1,159 @@ +From e1a2cd3fb46feec3424a41293a854b5c6e492721 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 9 Dec 2023 15:49:16 +0800 +Subject: LoongArch: BPF: Don't sign extend memory load operand + +From: Hengqi Chen + +[ Upstream commit fe5757553bf9ebe45ae8ecab5922f6937c8d8dfc ] + +The `cgrp_local_storage` test triggers a kernel panic like: + + # ./test_progs -t cgrp_local_storage + Can't find bpf_testmod.ko kernel module: -2 + WARNING! Selftests relying on bpf_testmod.ko will be skipped. + [ 550.930632] CPU 1 Unable to handle kernel paging request at virtual address 0000000000000080, era == ffff80000200be34, ra == ffff80000200be00 + [ 550.931781] Oops[#1]: + [ 550.931966] CPU: 1 PID: 1303 Comm: test_progs Not tainted 6.7.0-rc2-loong-devel-g2f56bb0d2327 #35 a896aca3f4164f09cc346f89f2e09832e07be5f6 + [ 550.932215] Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022 + [ 550.932403] pc ffff80000200be34 ra ffff80000200be00 tp 9000000108350000 sp 9000000108353dc0 + [ 550.932545] a0 0000000000000000 a1 0000000000000517 a2 0000000000000118 a3 00007ffffbb15558 + [ 550.932682] a4 00007ffffbb15620 a5 90000001004e7700 a6 0000000000000021 a7 0000000000000118 + [ 550.932824] t0 ffff80000200bdc0 t1 0000000000000517 t2 0000000000000517 t3 00007ffff1c06ee0 + [ 550.932961] t4 0000555578ae04d0 t5 fffffffffffffff8 t6 0000000000000004 t7 0000000000000020 + [ 550.933097] t8 0000000000000040 u0 00000000000007b8 s9 9000000108353e00 s0 90000001004e7700 + [ 550.933241] s1 9000000004005000 s2 0000000000000001 s3 0000000000000000 s4 0000555555eb2ec8 + [ 550.933379] s5 00007ffffbb15bb8 s6 00007ffff1dafd60 s7 000055555663f610 s8 00007ffff1db0050 + [ 550.933520] ra: ffff80000200be00 bpf_prog_98f1b9e767be2a84_on_enter+0x40/0x200 + [ 550.933911] ERA: ffff80000200be34 bpf_prog_98f1b9e767be2a84_on_enter+0x74/0x200 + [ 550.934105] CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) + [ 550.934596] PRMD: 00000004 (PPLV0 +PIE -PWE) + [ 550.934712] EUEN: 00000003 (+FPE +SXE -ASXE -BTE) + [ 550.934836] ECFG: 00071c1c (LIE=2-4,10-12 VS=7) + [ 550.934976] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0) + [ 550.935097] BADV: 0000000000000080 + [ 550.935181] PRID: 0014c010 (Loongson-64bit, Loongson-3A5000) + [ 550.935291] Modules linked in: + [ 550.935391] Process test_progs (pid: 1303, threadinfo=000000006c3b1c41, task=0000000061f84a55) + [ 550.935643] Stack : 00007ffffbb15bb8 0000555555eb2ec8 0000000000000000 0000000000000001 + [ 550.935844] 9000000004005000 ffff80001b864000 00007ffffbb15450 90000000029aa034 + [ 550.935990] 0000000000000000 9000000108353ec0 0000000000000118 d07d9dfb09721a09 + [ 550.936175] 0000000000000001 0000000000000000 9000000108353ec0 0000000000000118 + [ 550.936314] 9000000101d46ad0 900000000290abf0 000055555663f610 0000000000000000 + [ 550.936479] 0000000000000003 9000000108353ec0 00007ffffbb15450 90000000029d7288 + [ 550.936635] 00007ffff1dafd60 000055555663f610 0000000000000000 0000000000000003 + [ 550.936779] 9000000108353ec0 90000000035dd1f0 00007ffff1dafd58 9000000002841c5c + [ 550.936939] 0000000000000119 0000555555eea5a8 00007ffff1d78780 00007ffffbb153e0 + [ 550.937083] ffffffffffffffda 00007ffffbb15518 0000000000000040 00007ffffbb15558 + [ 550.937224] ... + [ 550.937299] Call Trace: + [ 550.937521] [] bpf_prog_98f1b9e767be2a84_on_enter+0x74/0x200 + [ 550.937910] [<90000000029aa034>] bpf_trace_run2+0x90/0x154 + [ 550.938105] [<900000000290abf0>] syscall_trace_enter.isra.0+0x1cc/0x200 + [ 550.938224] [<90000000035dd1f0>] do_syscall+0x48/0x94 + [ 550.938319] [<9000000002841c5c>] handle_syscall+0xbc/0x158 + [ 550.938477] + [ 550.938607] Code: 580009ae 50016000 262402e4 <28c20085> 14092084 03a00084 16000024 03240084 00150006 + [ 550.938851] + [ 550.939021] ---[ end trace 0000000000000000 ]--- + +Further investigation shows that this panic is triggered by memory +load operations: + + ptr = bpf_cgrp_storage_get(&map_a, task->cgroups->dfl_cgrp, 0, + BPF_LOCAL_STORAGE_GET_F_CREATE); + +The expression `task->cgroups->dfl_cgrp` involves two memory load. +Since the field offset fits in imm12 or imm14, we use ldd or ldptrd +instructions. But both instructions have the side effect that it will +signed-extended the imm operand. Finally, we got the wrong addresses +and panics is inevitable. + +Use a generic ldxd instruction to avoid this kind of issues. + +With this change, we have: + + # ./test_progs -t cgrp_local_storage + Can't find bpf_testmod.ko kernel module: -2 + WARNING! Selftests relying on bpf_testmod.ko will be skipped. + test_cgrp_local_storage:PASS:join_cgroup /cgrp_local_storage 0 nsec + #48/1 cgrp_local_storage/tp_btf:OK + test_attach_cgroup:PASS:skel_open 0 nsec + test_attach_cgroup:PASS:prog_attach 0 nsec + test_attach_cgroup:PASS:prog_attach 0 nsec + libbpf: prog 'update_cookie_tracing': failed to attach: ERROR: strerror_r(-524)=22 + test_attach_cgroup:FAIL:prog_attach unexpected error: -524 + #48/2 cgrp_local_storage/attach_cgroup:FAIL + test_recursion:PASS:skel_open_and_load 0 nsec + libbpf: prog 'on_lookup': failed to attach: ERROR: strerror_r(-524)=22 + libbpf: prog 'on_lookup': failed to auto-attach: -524 + test_recursion:FAIL:skel_attach unexpected error: -524 (errno 524) + #48/3 cgrp_local_storage/recursion:FAIL + #48/4 cgrp_local_storage/negative:OK + #48/5 cgrp_local_storage/cgroup_iter_sleepable:OK + test_yes_rcu_lock:PASS:skel_open 0 nsec + test_yes_rcu_lock:PASS:skel_load 0 nsec + libbpf: prog 'yes_rcu_lock': failed to attach: ERROR: strerror_r(-524)=22 + libbpf: prog 'yes_rcu_lock': failed to auto-attach: -524 + test_yes_rcu_lock:FAIL:skel_attach unexpected error: -524 (errno 524) + #48/6 cgrp_local_storage/yes_rcu_lock:FAIL + #48/7 cgrp_local_storage/no_rcu_lock:OK + #48 cgrp_local_storage:FAIL + + All error logs: + test_cgrp_local_storage:PASS:join_cgroup /cgrp_local_storage 0 nsec + test_attach_cgroup:PASS:skel_open 0 nsec + test_attach_cgroup:PASS:prog_attach 0 nsec + test_attach_cgroup:PASS:prog_attach 0 nsec + libbpf: prog 'update_cookie_tracing': failed to attach: ERROR: strerror_r(-524)=22 + test_attach_cgroup:FAIL:prog_attach unexpected error: -524 + #48/2 cgrp_local_storage/attach_cgroup:FAIL + test_recursion:PASS:skel_open_and_load 0 nsec + libbpf: prog 'on_lookup': failed to attach: ERROR: strerror_r(-524)=22 + libbpf: prog 'on_lookup': failed to auto-attach: -524 + test_recursion:FAIL:skel_attach unexpected error: -524 (errno 524) + #48/3 cgrp_local_storage/recursion:FAIL + test_yes_rcu_lock:PASS:skel_open 0 nsec + test_yes_rcu_lock:PASS:skel_load 0 nsec + libbpf: prog 'yes_rcu_lock': failed to attach: ERROR: strerror_r(-524)=22 + libbpf: prog 'yes_rcu_lock': failed to auto-attach: -524 + test_yes_rcu_lock:FAIL:skel_attach unexpected error: -524 (errno 524) + #48/6 cgrp_local_storage/yes_rcu_lock:FAIL + #48 cgrp_local_storage:FAIL + Summary: 0/4 PASSED, 0 SKIPPED, 1 FAILED + +No panics any more (The test still failed because lack of BPF trampoline +which I am actively working on). + +Fixes: 5dc615520c4d ("LoongArch: Add BPF JIT support") +Signed-off-by: Hengqi Chen +Signed-off-by: Huacai Chen +Signed-off-by: Sasha Levin +--- + arch/loongarch/net/bpf_jit.c | 10 ++-------- + 1 file changed, 2 insertions(+), 8 deletions(-) + +diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c +index 82b4402810da0..20ad5f3a9bf94 100644 +--- a/arch/loongarch/net/bpf_jit.c ++++ b/arch/loongarch/net/bpf_jit.c +@@ -844,14 +844,8 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext + } + break; + case BPF_DW: +- if (is_signed_imm12(off)) { +- emit_insn(ctx, ldd, dst, src, off); +- } else if (is_signed_imm14(off)) { +- emit_insn(ctx, ldptrd, dst, src, off); +- } else { +- move_imm(ctx, t1, off, is32); +- emit_insn(ctx, ldxd, dst, src, t1); +- } ++ move_imm(ctx, t1, off, is32); ++ emit_insn(ctx, ldxd, dst, src, t1); + break; + } + break; +-- +2.42.0 + diff --git a/queue-6.1/misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch b/queue-6.1/misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch new file mode 100644 index 00000000000..96717147470 --- /dev/null +++ b/queue-6.1/misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch @@ -0,0 +1,38 @@ +From 2680926ba53ad219c7db58c240b9aded433fc199 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 17:55:26 +0800 +Subject: misc: mei: client.c: fix problem of return '-EOVERFLOW' in + mei_cl_write + +From: Su Hui + +[ Upstream commit ee6236027218f8531916f1c5caa5dc330379f287 ] + +Clang static analyzer complains that value stored to 'rets' is never +read.Let 'buf_len = -EOVERFLOW' to make sure we can return '-EOVERFLOW'. + +Fixes: 8c8d964ce90f ("mei: move hbuf_depth from the mei device to the hw modules") +Signed-off-by: Su Hui +Link: https://lore.kernel.org/r/20231120095523.178385-2-suhui@nfschina.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/mei/client.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c +index 77501e392cdeb..c70c89209fe55 100644 +--- a/drivers/misc/mei/client.c ++++ b/drivers/misc/mei/client.c +@@ -2002,7 +2002,7 @@ ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb) + + hbuf_slots = mei_hbuf_empty_slots(dev); + if (hbuf_slots < 0) { +- rets = -EOVERFLOW; ++ buf_len = -EOVERFLOW; + goto out; + } + +-- +2.42.0 + diff --git a/queue-6.1/misc-mei-client.c-return-negative-error-code-in-mei_.patch b/queue-6.1/misc-mei-client.c-return-negative-error-code-in-mei_.patch new file mode 100644 index 00000000000..a3aa9368922 --- /dev/null +++ b/queue-6.1/misc-mei-client.c-return-negative-error-code-in-mei_.patch @@ -0,0 +1,37 @@ +From 3ae32c6cdc53e471a1f6ffa6350370374d688490 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 17:55:23 +0800 +Subject: misc: mei: client.c: return negative error code in mei_cl_write + +From: Su Hui + +[ Upstream commit 8f06aee8089cf42fd99a20184501bd1347ce61b9 ] + +mei_msg_hdr_init() return negative error code, rets should be +'PTR_ERR(mei_hdr)' rather than '-PTR_ERR(mei_hdr)'. + +Fixes: 0cd7c01a60f8 ("mei: add support for mei extended header.") +Signed-off-by: Su Hui +Link: https://lore.kernel.org/r/20231120095523.178385-1-suhui@nfschina.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/mei/client.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c +index 0b2fbe1335a77..77501e392cdeb 100644 +--- a/drivers/misc/mei/client.c ++++ b/drivers/misc/mei/client.c +@@ -1978,7 +1978,7 @@ ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb) + + mei_hdr = mei_msg_hdr_init(cb); + if (IS_ERR(mei_hdr)) { +- rets = -PTR_ERR(mei_hdr); ++ rets = PTR_ERR(mei_hdr); + mei_hdr = NULL; + goto err; + } +-- +2.42.0 + diff --git a/queue-6.1/parisc-fix-asm-operand-number-out-of-range-build-err.patch b/queue-6.1/parisc-fix-asm-operand-number-out-of-range-build-err.patch new file mode 100644 index 00000000000..1d7f564e0c5 --- /dev/null +++ b/queue-6.1/parisc-fix-asm-operand-number-out-of-range-build-err.patch @@ -0,0 +1,37 @@ +From a689ed7a789e1a4f0aa9d6db8b1784e9824071ae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Nov 2023 10:39:26 +0100 +Subject: parisc: Fix asm operand number out of range build error in bug table + +From: Helge Deller + +[ Upstream commit 487635756198cad563feb47539c6a37ea57f1dae ] + +Build is broken if CONFIG_DEBUG_BUGVERBOSE=n. +Fix it be using the correct asm operand number. + +Signed-off-by: Helge Deller +Reported-by: Linux Kernel Functional Testing +Fixes: fe76a1349f23 ("parisc: Use natural CPU alignment for bug_table") +Cc: stable@vger.kernel.org # v6.0+ +Signed-off-by: Sasha Levin +--- + arch/parisc/include/asm/bug.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h +index 1641ff9a8b83e..833555f74ffa7 100644 +--- a/arch/parisc/include/asm/bug.h ++++ b/arch/parisc/include/asm/bug.h +@@ -71,7 +71,7 @@ + asm volatile("\n" \ + "1:\t" PARISC_BUG_BREAK_ASM "\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ +- "\t.align %2\n" \ ++ "\t.align 4\n" \ + "2:\t" __BUG_REL(1b) "\n" \ + "\t.short %0\n" \ + "\t.blockz %1-4-2\n" \ +-- +2.42.0 + diff --git a/queue-6.1/parisc-reduce-size-of-the-bug_table-on-64-bit-kernel.patch b/queue-6.1/parisc-reduce-size-of-the-bug_table-on-64-bit-kernel.patch new file mode 100644 index 00000000000..0e5f07ef998 --- /dev/null +++ b/queue-6.1/parisc-reduce-size-of-the-bug_table-on-64-bit-kernel.patch @@ -0,0 +1,122 @@ +From e442d959d07f16049be2965dd556948b22877391 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Nov 2023 21:57:19 +0100 +Subject: parisc: Reduce size of the bug_table on 64-bit kernel by half + +From: Helge Deller + +[ Upstream commit 43266838515d30dc0c45d5c7e6e7edacee6cce92 ] + +Enable GENERIC_BUG_RELATIVE_POINTERS which will store 32-bit relative +offsets to the bug address and the source file name instead of 64-bit +absolute addresses. This effectively reduces the size of the +bug_table[] array by half on 64-bit kernels. + +Signed-off-by: Helge Deller +Stable-dep-of: 487635756198 ("parisc: Fix asm operand number out of range build error in bug table") +Signed-off-by: Sasha Levin +--- + arch/parisc/Kconfig | 7 +++++-- + arch/parisc/include/asm/bug.h | 34 +++++++++++++++++----------------- + 2 files changed, 22 insertions(+), 19 deletions(-) + +diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig +index 67c26e81e2150..345d5e021484c 100644 +--- a/arch/parisc/Kconfig ++++ b/arch/parisc/Kconfig +@@ -105,9 +105,12 @@ config ARCH_HAS_ILOG2_U64 + default n + + config GENERIC_BUG +- bool +- default y ++ def_bool y + depends on BUG ++ select GENERIC_BUG_RELATIVE_POINTERS if 64BIT ++ ++config GENERIC_BUG_RELATIVE_POINTERS ++ bool + + config GENERIC_HWEIGHT + bool +diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h +index b9cad0bb4461b..1641ff9a8b83e 100644 +--- a/arch/parisc/include/asm/bug.h ++++ b/arch/parisc/include/asm/bug.h +@@ -17,26 +17,27 @@ + #define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff" + #define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */ + +-#if defined(CONFIG_64BIT) +-#define ASM_WORD_INSN ".dword\t" ++#ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS ++# define __BUG_REL(val) ".word " __stringify(val) " - ." + #else +-#define ASM_WORD_INSN ".word\t" ++# define __BUG_REL(val) ".word " __stringify(val) + #endif + ++ + #ifdef CONFIG_DEBUG_BUGVERBOSE + #define BUG() \ + do { \ + asm volatile("\n" \ + "1:\t" PARISC_BUG_BREAK_ASM "\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ +- "\t.align %4\n" \ +- "2:\t" ASM_WORD_INSN "1b, %c0\n" \ ++ "\t.align 4\n" \ ++ "2:\t" __BUG_REL(1b) "\n" \ ++ "\t" __BUG_REL(%c0) "\n" \ + "\t.short %1, %2\n" \ +- "\t.blockz %3-2*%4-2*2\n" \ ++ "\t.blockz %3-2*4-2*2\n" \ + "\t.popsection" \ + : : "i" (__FILE__), "i" (__LINE__), \ +- "i" (0), "i" (sizeof(struct bug_entry)), \ +- "i" (sizeof(long)) ); \ ++ "i" (0), "i" (sizeof(struct bug_entry)) ); \ + unreachable(); \ + } while(0) + +@@ -54,15 +55,15 @@ + asm volatile("\n" \ + "1:\t" PARISC_BUG_BREAK_ASM "\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ +- "\t.align %4\n" \ +- "2:\t" ASM_WORD_INSN "1b, %c0\n" \ ++ "\t.align 4\n" \ ++ "2:\t" __BUG_REL(1b) "\n" \ ++ "\t" __BUG_REL(%c0) "\n" \ + "\t.short %1, %2\n" \ +- "\t.blockz %3-2*%4-2*2\n" \ ++ "\t.blockz %3-2*4-2*2\n" \ + "\t.popsection" \ + : : "i" (__FILE__), "i" (__LINE__), \ + "i" (BUGFLAG_WARNING|(flags)), \ +- "i" (sizeof(struct bug_entry)), \ +- "i" (sizeof(long)) ); \ ++ "i" (sizeof(struct bug_entry)) ); \ + } while(0) + #else + #define __WARN_FLAGS(flags) \ +@@ -71,13 +72,12 @@ + "1:\t" PARISC_BUG_BREAK_ASM "\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ + "\t.align %2\n" \ +- "2:\t" ASM_WORD_INSN "1b\n" \ ++ "2:\t" __BUG_REL(1b) "\n" \ + "\t.short %0\n" \ +- "\t.blockz %1-%2-2\n" \ ++ "\t.blockz %1-4-2\n" \ + "\t.popsection" \ + : : "i" (BUGFLAG_WARNING|(flags)), \ +- "i" (sizeof(struct bug_entry)), \ +- "i" (sizeof(long)) ); \ ++ "i" (sizeof(struct bug_entry)) ); \ + } while(0) + #endif + +-- +2.42.0 + diff --git a/queue-6.1/ring-buffer-force-absolute-timestamp-on-discard-of-e.patch b/queue-6.1/ring-buffer-force-absolute-timestamp-on-discard-of-e.patch new file mode 100644 index 00000000000..1b4fd4398c0 --- /dev/null +++ b/queue-6.1/ring-buffer-force-absolute-timestamp-on-discard-of-e.patch @@ -0,0 +1,71 @@ +From 1249c67fa9a9b3ae207b53fcbefa8dac3acbc308 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Dec 2023 10:02:44 -0500 +Subject: ring-buffer: Force absolute timestamp on discard of event + +From: Steven Rostedt (Google) + +[ Upstream commit b2dd797543cfa6580eac8408dd67fa02164d9e56 ] + +There's a race where if an event is discarded from the ring buffer and an +interrupt were to happen at that time and insert an event, the time stamp +is still used from the discarded event as an offset. This can screw up the +timings. + +If the event is going to be discarded, set the "before_stamp" to zero. +When a new event comes in, it compares the "before_stamp" with the +"write_stamp" and if they are not equal, it will insert an absolute +timestamp. This will prevent the timings from getting out of sync due to +the discarded event. + +Link: https://lore.kernel.org/linux-trace-kernel/20231206100244.5130f9b3@gandalf.local.home + +Cc: stable@vger.kernel.org +Cc: Masami Hiramatsu +Cc: Mark Rutland +Cc: Mathieu Desnoyers +Fixes: 6f6be606e763f ("ring-buffer: Force before_stamp and write_stamp to be different on discard") +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Sasha Levin +--- + kernel/trace/ring_buffer.c | 19 ++++++++----------- + 1 file changed, 8 insertions(+), 11 deletions(-) + +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c +index f3c4bb54a0485..c02a4cb879913 100644 +--- a/kernel/trace/ring_buffer.c ++++ b/kernel/trace/ring_buffer.c +@@ -3025,22 +3025,19 @@ rb_try_to_discard(struct ring_buffer_per_cpu *cpu_buffer, + local_read(&bpage->write) & ~RB_WRITE_MASK; + unsigned long event_length = rb_event_length(event); + ++ /* ++ * For the before_stamp to be different than the write_stamp ++ * to make sure that the next event adds an absolute ++ * value and does not rely on the saved write stamp, which ++ * is now going to be bogus. ++ */ ++ rb_time_set(&cpu_buffer->before_stamp, 0); ++ + /* Something came in, can't discard */ + if (!rb_time_cmpxchg(&cpu_buffer->write_stamp, + write_stamp, write_stamp - delta)) + return 0; + +- /* +- * It's possible that the event time delta is zero +- * (has the same time stamp as the previous event) +- * in which case write_stamp and before_stamp could +- * be the same. In such a case, force before_stamp +- * to be different than write_stamp. It doesn't +- * matter what it is, as long as its different. +- */ +- if (!delta) +- rb_time_set(&cpu_buffer->before_stamp, 0); +- + /* + * If an event were to come in now, it would see that the + * write_stamp and the before_stamp are different, and assume +-- +2.42.0 + diff --git a/queue-6.1/series b/queue-6.1/series index c4e646387c3..af0011722c3 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -133,3 +133,17 @@ arm64-dts-mediatek-mt8183-fix-unit-address-for-scp-reserved-memory.patch arm64-dts-mediatek-mt8183-move-thermal-zones-to-the-root-node.patch arm64-dts-mediatek-mt8183-evb-fix-unit_address_vs_reg-warning-on-ntc.patch binder-fix-memory-leaks-of-spam-and-pending-work.patch +coresight-etm4x-make-etm4_remove_dev-return-void.patch +coresight-etm4x-remove-bogous-__exit-annotation-for-.patch +hwtracing-hisi_ptt-add-dummy-callback-pmu-read.patch +misc-mei-client.c-return-negative-error-code-in-mei_.patch +misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch +loongarch-bpf-don-t-sign-extend-memory-load-operand.patch +loongarch-bpf-don-t-sign-extend-function-return-valu.patch +ring-buffer-force-absolute-timestamp-on-discard-of-e.patch +tracing-set-actual-size-after-ring-buffer-resize.patch +tracing-stop-current-tracer-when-resizing-buffer.patch +parisc-reduce-size-of-the-bug_table-on-64-bit-kernel.patch +parisc-fix-asm-operand-number-out-of-range-build-err.patch +arm64-dts-mediatek-add-missing-space-before.patch +arm64-dts-mt8183-kukui-fix-underscores-in-node-names.patch diff --git a/queue-6.1/tracing-set-actual-size-after-ring-buffer-resize.patch b/queue-6.1/tracing-set-actual-size-after-ring-buffer-resize.patch new file mode 100644 index 00000000000..eaa8b41a4a2 --- /dev/null +++ b/queue-6.1/tracing-set-actual-size-after-ring-buffer-resize.patch @@ -0,0 +1,70 @@ +From 754d457b405b49276e48e678a77554379d8cb667 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 Jul 2023 08:27:05 +0800 +Subject: tracing: Set actual size after ring buffer resize + +From: Zheng Yejian + +[ Upstream commit 6d98a0f2ac3c021d21be66fa34e992137cd25bcb ] + +Currently we can resize trace ringbuffer by writing a value into file +'buffer_size_kb', then by reading the file, we get the value that is +usually what we wrote. However, this value may be not actual size of +trace ring buffer because of the round up when doing resize in kernel, +and the actual size would be more useful. + +Link: https://lore.kernel.org/linux-trace-kernel/20230705002705.576633-1-zhengyejian1@huawei.com + +Cc: +Signed-off-by: Zheng Yejian +Signed-off-by: Steven Rostedt (Google) +Stable-dep-of: d78ab792705c ("tracing: Stop current tracer when resizing buffer") +Signed-off-by: Sasha Levin +--- + kernel/trace/trace.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c +index 2e1c6fd0d3f17..048728807f265 100644 +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -6215,6 +6215,15 @@ static void set_buffer_entries(struct array_buffer *buf, unsigned long val) + per_cpu_ptr(buf->data, cpu)->entries = val; + } + ++static void update_buffer_entries(struct array_buffer *buf, int cpu) ++{ ++ if (cpu == RING_BUFFER_ALL_CPUS) { ++ set_buffer_entries(buf, ring_buffer_size(buf->buffer, 0)); ++ } else { ++ per_cpu_ptr(buf->data, cpu)->entries = ring_buffer_size(buf->buffer, cpu); ++ } ++} ++ + #ifdef CONFIG_TRACER_MAX_TRACE + /* resize @tr's buffer to the size of @size_tr's entries */ + static int resize_buffer_duplicate_size(struct array_buffer *trace_buf, +@@ -6292,18 +6301,12 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr, + return ret; + } + +- if (cpu == RING_BUFFER_ALL_CPUS) +- set_buffer_entries(&tr->max_buffer, size); +- else +- per_cpu_ptr(tr->max_buffer.data, cpu)->entries = size; ++ update_buffer_entries(&tr->max_buffer, cpu); + + out: + #endif /* CONFIG_TRACER_MAX_TRACE */ + +- if (cpu == RING_BUFFER_ALL_CPUS) +- set_buffer_entries(&tr->array_buffer, size); +- else +- per_cpu_ptr(tr->array_buffer.data, cpu)->entries = size; ++ update_buffer_entries(&tr->array_buffer, cpu); + + return ret; + } +-- +2.42.0 + diff --git a/queue-6.1/tracing-stop-current-tracer-when-resizing-buffer.patch b/queue-6.1/tracing-stop-current-tracer-when-resizing-buffer.patch new file mode 100644 index 00000000000..57c00852bc0 --- /dev/null +++ b/queue-6.1/tracing-stop-current-tracer-when-resizing-buffer.patch @@ -0,0 +1,73 @@ +From f54b359f25147a420e80d96977783600291a587c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Dec 2023 16:52:10 -0500 +Subject: tracing: Stop current tracer when resizing buffer + +From: Steven Rostedt (Google) + +[ Upstream commit d78ab792705c7be1b91243b2544d1a79406a2ad7 ] + +When the ring buffer is being resized, it can cause side effects to the +running tracer. For instance, there's a race with irqsoff tracer that +swaps individual per cpu buffers between the main buffer and the snapshot +buffer. The resize operation modifies the main buffer and then the +snapshot buffer. If a swap happens in between those two operations it will +break the tracer. + +Simply stop the running tracer before resizing the buffers and enable it +again when finished. + +Link: https://lkml.kernel.org/r/20231205220010.748996423@goodmis.org + +Cc: stable@vger.kernel.org +Cc: Masami Hiramatsu +Cc: Mark Rutland +Cc: Mathieu Desnoyers +Cc: Andrew Morton +Fixes: 3928a8a2d9808 ("ftrace: make work with new ring buffer") +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Sasha Levin +--- + kernel/trace/trace.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c +index 048728807f265..d2db4d6f0f2fd 100644 +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -6268,9 +6268,12 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr, + if (!tr->array_buffer.buffer) + return 0; + ++ /* Do not allow tracing while resizng ring buffer */ ++ tracing_stop_tr(tr); ++ + ret = ring_buffer_resize(tr->array_buffer.buffer, size, cpu); + if (ret < 0) +- return ret; ++ goto out_start; + + #ifdef CONFIG_TRACER_MAX_TRACE + if (!tr->current_trace->use_max_tr) +@@ -6298,7 +6301,7 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr, + WARN_ON(1); + tracing_disabled = 1; + } +- return ret; ++ goto out_start; + } + + update_buffer_entries(&tr->max_buffer, cpu); +@@ -6307,7 +6310,8 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr, + #endif /* CONFIG_TRACER_MAX_TRACE */ + + update_buffer_entries(&tr->array_buffer, cpu); +- ++ out_start: ++ tracing_start_tr(tr); + return ret; + } + +-- +2.42.0 + -- 2.47.3