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

From: Chen Pei

Date: Tue Sep 29 2026 - 05:17:59 EST


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