From: sashiko-bot@kernel.org
To: "Chen Pei" <cp0613@linux.alibaba.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 1/2] perf riscv: Implement rdtsc()
Date: Tue, 29 Sep 2026 03:47:12 +0000 [thread overview]
Message-ID: <20260929034713.2D5EB1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929034133.2153-2-cp0613@linux.alibaba.com>
> Perf has no riscv implementation of rdtsc(), so it links against the weak
> stub in util/tsc.c and every caller reads a constant 0 that cannot be
> told apart from a counter standing still.
>
> Implement rdtsc() over the time CSR with rdtime. The time CSR is a TSC
> equivalent on riscv: readable from user mode, constant frequency, and the
> same counter riscv's arch_perf_update_userpage() builds the user page
> conversion fields from, so the counter and perf time share a timebase.
>
> Define it for RV64 only. Reading the counter whole on RV32 takes time and
> timeh in a loop, and no RV32 user in tools/perf needs it that much, so
> RV32 keeps the weak stub.
>
> Reviewed-by: Anup Patel <anup@brainfault.org>
> Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260929034133.2153-1-cp0613@linux.alibaba.com?part=1
next prev parent reply other threads:[~2026-09-29 3:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 3:41 [PATCH v2 0/2] perf riscv: Implement rdtsc() Chen Pei
2026-09-29 3:41 ` [PATCH v2 1/2] " Chen Pei
2026-09-29 3:47 ` sashiko-bot [this message]
2026-10-07 15:28 ` Paul Walmsley
2026-09-29 3:41 ` [PATCH v2 2/2] perf tsc: Declare TSC support from the build system Chen Pei
2026-09-29 3:48 ` sashiko-bot
2026-09-29 9:49 ` Leo Yan
2026-10-06 13:16 ` Adrian Hunter
2026-10-07 15:31 ` Paul Walmsley
2026-10-09 2:24 ` Chen Pei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260929034713.2D5EB1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cp0613@linux.alibaba.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox