This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit bd03fc3a5b6a93817392aad756ee897d5b52525c Author: ouyangxiangzhen <[email protected]> AuthorDate: Tue Apr 28 13:27:09 2026 +0800 testing/ostest: lower spinlock loop scale under MM_KASAN The spinlock/rspinlock/seqcount performance test executes LOOP_TIMES = CONFIG_TEST_LOOP_SCALE * 100000 lock/unlock pairs per thread per lock type. With the default scale of 100 that is 10M operations per lock type, or 30M in total. When CONFIG_MM_KASAN is enabled every spin_lock_irqsave goes through kasan_check_report, which itself takes the global kasan spinlock (g_lock). On single-core QEMU/emulator builds (e.g. goldfish-miwear with CONFIG_SMP_NCPUS=1 + CONFIG_MM_KASAN_GENERIC=y) this serializes each op through one extra spin + atomic RMW. A live GDB snapshot on goldfish-miwear measured ~10K ops/sec, putting the full spinlock_test well past any sensible test-runner timeout and causing ostest to miss the "Exiting with status" pattern. Add a MM_KASAN-conditional default of 5 (= 500K ops, ~150s total for the three lock types on the same board) so instrumented builds finish in time, while non-KASAN builds keep the original 100 scale and retain meaningful throughput numbers. Users can still override via menuconfig/defconfig when needed. Root cause: KASAN per-op overhead made the default LOOP_TIMES infeasible on instrumented QEMU/emulator builds. Fix: add `default 5 if MM_KASAN` to CONFIG_TEST_LOOP_SCALE and document the rationale in ---help---. Assisted-By: mimo-v2.6-pro Signed-off-by: ouyangxiangzhen <[email protected]> --- testing/ostest/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testing/ostest/Kconfig b/testing/ostest/Kconfig index e0e135103..d9c9af48a 100644 --- a/testing/ostest/Kconfig +++ b/testing/ostest/Kconfig @@ -155,6 +155,16 @@ config TESTING_OSTEST_MULTIUSER config TESTING_LOOP_SCALE int "Loop scale of spinlock test (N x 10,000)" + default 5 if MM_KASAN default 100 + ---help--- + Number of iterations per spinlock test thread, expressed as + scale * 10000 (see LOOP_TIMES in spinlock.c). When KASAN is + enabled the per-lock kasan_check_report overhead serializes + through the global kasan spinlock, slowing each op by orders + of magnitude on single-core QEMU/emulator builds. Use a much + smaller default under MM_KASAN so the test completes within + test-runner timeouts. Non-KASAN builds keep the original 100 + scale for meaningful throughput measurement. endif # TESTING_OSTEST
