[PATCH 2/2] perf tsc: Replace the compile-time TSC support check with a weak hook

Chen Pei cp0613 at linux.alibaba.com
Tue Sep 29 02:08:13 PDT 2026


Hi David,

Thanks a lot for the review.

> If you mark the prototype in the .h file "weak" you don't need a default
> - instead check the symbol for being NULL.
>
> Then you can do:
> 	if (!rdtsc)  {
> 		pr_debug("Test not supported on this architecture\n");
> 		return TEST_SKIP;
> 	}

I've just sent v2, which declares the support from the build system
instead, following the existing PERF_HAVE_JITDUMP pattern, so the
decision is made at compile time and there is no symbol left to test for
NULL.

Keeping the __weak rdtsc() stub also means the callers that already call
it unconditionally don't have to grow a NULL check.

Thanks again for the suggestion.

Best regards,
Pei



More information about the linux-arm-kernel mailing list