From: "Li,Rongqing" <lirongqing@baidu.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Paul Walmsley <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
Atish Patra <atishp@rivosinc.com>,
Anup Patel <anup@brainfault.org>,
Shenlin Liang <liangshenlin@eswincomputing.com>,
"linux-perf-users@vger.kernel.org"
<linux-perf-users@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>
Subject: 答复: [PATCH] perf kvm: Fix RISC-V VM-exit duration accounting
Date: Mon, 23 Nov 2026 08:55:43 +0000 [thread overview]
Message-ID: <10d466045b764b7590abaef251df06c1@baidu.com> (raw)
In-Reply-To: <20261102091809.2215-1-lirongqing@baidu.com>
>
> From: Li RongQing <lirongqing@baidu.com>
>
> Use kvm_exit as the start event and the following kvm_entry as the end
> event for RISC-V VM-exit statistics. Keep decoding scause from the exit
> sample.
>
> Before this change, RISC-V measured guest runtime as VM-exit time.
>
> Fixes: da7b1b525e97 ("perf kvm/riscv: Port perf kvm stat to RISC-V")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
ping
[Li,Rongqing]
> ---
> tools/perf/util/kvm-stat-arch/kvm-stat-riscv.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/util/kvm-stat-arch/kvm-stat-riscv.c
> b/tools/perf/util/kvm-stat-arch/kvm-stat-riscv.c
> index 967bba2..09c9c7d 100644
> --- a/tools/perf/util/kvm-stat-arch/kvm-stat-riscv.c
> +++ b/tools/perf/util/kvm-stat-arch/kvm-stat-riscv.c
> @@ -31,13 +31,7 @@ static void event_get_key(struct perf_sample
> *sample, }
>
> static bool event_begin(struct perf_sample *sample,
> - struct event_key *key __maybe_unused)
> -{
> - return evsel__name_is(sample->evsel, kvm_entry_trace(EM_RISCV));
> -}
> -
> -static bool event_end(struct perf_sample *sample,
> - struct event_key *key)
> + struct event_key *key)
> {
> if (evsel__name_is(sample->evsel, kvm_exit_trace(EM_RISCV))) {
> event_get_key(sample, key);
> @@ -46,6 +40,12 @@ static bool event_end(struct perf_sample *sample,
> return false;
> }
>
> +static bool event_end(struct perf_sample *sample,
> + struct event_key *key __maybe_unused) {
> + return evsel__name_is(sample->evsel, kvm_entry_trace(EM_RISCV)); }
> +
> static const struct kvm_events_ops exit_events = {
> .is_begin_event = event_begin,
> .is_end_event = event_end,
> --
> 2.9.4
prev parent reply other threads:[~2026-11-23 8:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 9:18 lirongqing
2026-11-23 8:55 ` Li,Rongqing [this message]
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=10d466045b764b7590abaef251df06c1@baidu.com \
--to=lirongqing@baidu.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alex@ghiti.fr \
--cc=alexander.shishkin@linux.intel.com \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=atishp@rivosinc.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=liangshenlin@eswincomputing.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=palmer@dabbelt.com \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
/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
all inboxes | Powered by JetHome®