Skip to content

[PW_SID:1081352] drivers/perf: riscv: do not restart throttled events after overflow#1770

Closed
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1081352
Closed

[PW_SID:1081352] drivers/perf: riscv: do not restart throttled events after overflow#1770
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1081352

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1081352 applied to workflow__riscv__fixes

Name: drivers/perf: riscv: do not restart throttled events after overflow
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1081352
Version: 1

Perf core uses `event->hw.interrupts == MAX_INTERRUPTS` to keep
throttled events stopped until it explicitly unthrottles them later.

However, current RISC-V Perf/PMU system unconditionally restarts all the
counters at the end of overflow handler, which bypasses the perf core's
throttle mechanism. Therefore, an unreasonable small sampling period
such as `perf top -c 20` may cause an IRQ storm and eventually leads to
soft lockup.

Fix this by filtering the counter start/restart mask: do not restart
counters for events already marked as throttled by the perf core. This
retains the throttle effect and prevents interrupt storms in such
workloads.

Signed-off-by: Zhanpeng Zhang <zhangzhanpeng.jasper@bytedance.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 118.97 seconds
Result: ERROR
Output:

Full log:
W: Support for running offline not available (unshare: unshare failed: Operation not permitted)
I: config: PASS in 0:00:30.400679
I: default: FAIL in 0:01:22.352918
I: kernel: SKIP in 0:00:00.000008
I: xipkernel: SKIP in 0:00:00.000004
I: modules: FAIL in 0:00:00.071278
I: dtbs: PASS in 0:00:01.447710
I: dtbs-legacy: SKIP in 0:00:00.003334
I: debugkernel: SKIP in 0:00:00.000004
I: headers: PASS in 0:00:01.031569
I: build output in /build/tmp.RuFeNVpwpH
tuxmake --download-all-korg-gcc-toolchains --target-arch=riscv --kconfig=rv32_defconfig --toolchain=llvm --wrapper=ccache --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake --environment=KCFLAGS=-ffile-prefix-map=/build/tmp.RuFeNVpwpH/build/= --runtime=null --image=docker.io/tuxmake/riscv_clang CROSS_COMPILE=riscv64-linux- config default kernel xipkernel modules dtbs dtbs-legacy debugkernel headers
make --silent --keep-going --jobs=48 O=/build/tmp.RuFeNVpwpH/build ARCH=riscv CROSS_COMPILE=riscv64-linux- LLVM=1 'CC=ccache clang' 'HOSTCC=ccache clang' rv32_defconfig
make --silent --keep-going --jobs=48 O=/build/tmp.RuFeNVpwpH/build ARCH=riscv CROSS_COMPILE=riscv64-linux- LLVM=1 'CC=ccache clang' 'HOSTCC=ccache clang'
/build/tmpax261cl6/drivers/perf/riscv_pmu_sbi.c:65:33: error: use of undeclared identifier 'MAX_INTERRUPTS'
   65 |         return event->hw.interrupts == MAX_INTERRUPTS;
      |                                        ^
1 error generated.
make[5]: *** [/build/tmpax261cl6/scripts/Makefile.build:289: drivers/perf/riscv_pmu_sbi.o] Error 1
make[5]: Target 'drivers/perf/' not remade because of errors.
make[4]: *** [/build/tmpax261cl6/scripts/Makefile.build:548: drivers/perf] Error 2
make[4]: Target 'drivers/' not remade because of errors.
make[3]: *** [/build/tmpax261cl6/scripts/Makefile.build:548: drivers] Error 2
make[3]: Target './' not remade because of errors.
make[2]: *** [/build/tmpax261cl6/Makefile:2105: .] Error 2
make[2]: Target '__all' not remade because of errors.
make[1]: *** [/build/tmpax261cl6/Makefile:248: __sub-make] Error 2
make[1]: Target '__all' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2
make: Target '__all' not remade because of errors.
rm -rf /build/tmp.RuFeNVpwpH/build/modinstall
make --silent --keep-going --jobs=48 O=/build/tmp.RuFeNVpwpH/build INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=/build/tmp.RuFeNVpwpH/build/modinstall ARCH=riscv CROSS_COMPILE=riscv64-linux- LLVM=1 'CC=ccache clang' 'HOSTCC=ccache clang' modules_install
make[3]: *** No rule to make target 'modules.order', needed by '/build/tmp.RuFeNVpwpH/build/modinstall/lib/modules/7.0.0-rc5-00015-g5c65b8e99b07/modules.order'.
make[3]: *** No rule to make target 'modules.builtin', needed by '/build/tmp.RuFeNVpwpH/build/modinstall/lib/modules/7.0.0-rc5-00015-g5c65b8e99b07/modules.builtin'.
make[3]: *** No rule to make target 'modules.builtin.modinfo', needed by '/build/tmp.RuFeNVpwpH/build/modinstall/lib/modules/7.0.0-rc5-00015-g5c65b8e99b07/modules.builtin.modinfo'.
make[3]: Target '__modinst' not remade because of errors.
make[2]: *** [/build/tmpax261cl6/Makefile:2011: modules_install] Error 2
make[1]: *** [/build/tmpax261cl6/Makefile:248: __sub-make] Error 2
make[1]: Target 'modules_install' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2
make: Target 'modules_install' not remade because of errors.
make --silent --keep-going --jobs=48 O=/build/tmp.RuFeNVpwpH/build INSTALL_DTBS_PATH=/build/tmp.RuFeNVpwpH/build/dtbsinstall/dtbs ARCH=riscv CROSS_COMPILE=riscv64-linux- LLVM=1 'CC=ccache clang' 'HOSTCC=ccache clang' dtbs
rm -rf /build/tmp.RuFeNVpwpH/build/dtbsinstall
mkdir -p /build/tmp.RuFeNVpwpH/build/dtbsinstall/dtbs
make --silent --keep-going --jobs=48 O=/build/tmp.RuFeNVpwpH/build INSTALL_DTBS_PATH=/build/tmp.RuFeNVpwpH/build/dtbsinstall/dtbs ARCH=riscv CROSS_COMPILE=riscv64-linux- LLVM=1 'CC=ccache clang' 'HOSTCC=ccache clang' dtbs_install
tar --sort=name --owner=tuxmake:1000 --group=tuxmake:1000 --mtime=@1776225276 --clamp-mtime -caf /build/tmp.RuFeNVpwpH/build/dtbs.tar -C /build/tmp.RuFeNVpwpH/build/dtbsinstall dtbs
rm -rf /build/tmp.RuFeNVpwpH/build/install_hdr
make --silent --keep-going --jobs=48 O=/build/tmp.RuFeNVpwpH/build INSTALL_HDR_PATH=/build/tmp.RuFeNVpwpH/build/install_hdr/ ARCH=riscv CROSS_COMPILE=riscv64-linux- LLVM=1 'CC=ccache clang' 'HOSTCC=ccache clang' headers_install
tar --sort=name --owner=tuxmake:1000 --group=tuxmake:1000 --mtime=@1776225276 --clamp-mtime -caf /build/tmp.RuFeNVpwpH/build/headers.tar -C /build/tmp.RuFeNVpwpH/build/install_hdr .
warnings/errors:
/build/tmpax261cl6/drivers/perf/riscv_pmu_sbi.c:65:33: error: use of undeclared identifier 'MAX_INTERRUPTS'


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 723.15 seconds
Result: ERROR
Output:

Redirect to /build/tmp.pRdLwKO4j0 and /build/tmp.v4npVeH6HG
Tree base:
506e7f67b3724 ("Adding CI files")
Building the whole tree with the patch
error:
Warning: /build/tmpax261cl6/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c:244 struct __packed mtk_mfg_opp_entry { __le32 freq_khz; __le32 voltage_core; __le32 voltage_sram; __le32 posdiv; __le32 voltage_margin; __le32 power_mw; }; error: Cannot parse struct or union!
/build/tmpax261cl6/drivers/perf/riscv_pmu_sbi.c:65:33: error: use of undeclared identifier 'MAX_INTERRUPTS'



real	11m56.826s
user	464m24.812s
sys	83m3.405s

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 987.15 seconds
Result: ERROR
Output:

Redirect to /build/tmp.5UdLYTcC5S and /build/tmp.9F3p5mpIwD
Tree base:
506e7f67b3724 ("Adding CI files")
Building the whole tree with the patch
error:
Warning: /build/tmpax261cl6/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c:244 struct __packed mtk_mfg_opp_entry { __le32 freq_khz; __le32 voltage_core; __le32 voltage_sram; __le32 posdiv; __le32 voltage_margin; __le32 power_mw; }; error: Cannot parse struct or union!
/build/tmpax261cl6/drivers/perf/riscv_pmu_sbi.c:65:40: error: 'MAX_INTERRUPTS' undeclared (first use in this function); did you mean 'PTRACE_INTERRUPT'?
/build/tmpax261cl6/drivers/perf/riscv_pmu_sbi.c:66:1: error: control reaches end of non-void function [-Werror=return-type]



real	16m20.499s
user	644m6.426s
sys	101m36.732s

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 24.98 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.42 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.75 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 82.98 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
kdoc
Desc: Detects for kdoc errors
Duration: 0.84 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "drivers/perf: riscv: do not restart throttled events after overflow"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot deleted the pw1081352 branch April 23, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant