All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf kvm: Fix RISC-V VM-exit duration accounting
@ 2026-11-02  9:18 ` lirongqing
  0 siblings, 0 replies; 3+ messages in thread
From: lirongqing @ 2026-11-02  9:18 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Li RongQing,
	Atish Patra, Anup Patel, Shenlin Liang, linux-perf-users,
	linux-kernel, linux-riscv

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] perf kvm: Fix RISC-V VM-exit duration accounting
@ 2026-11-02  9:18 ` lirongqing
  0 siblings, 0 replies; 3+ messages in thread
From: lirongqing @ 2026-11-02  9:18 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Li RongQing,
	Atish Patra, Anup Patel, Shenlin Liang, linux-perf-users,
	linux-kernel, linux-riscv

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>
---
 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


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf kvm: Fix RISC-V VM-exit duration accounting
  2026-11-02  9:18 ` lirongqing
  (?)
@ 2026-11-02  9:22 ` sashiko-bot
  -1 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-02  9:22 UTC (permalink / raw)
  To: lirongqing, linux-perf-users

> 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>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261102091809.2215-1-lirongqing@baidu.com?part=1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-02  9:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-02  9:18 [PATCH] perf kvm: Fix RISC-V VM-exit duration accounting lirongqing
2026-11-02  9:18 ` lirongqing
2026-11-02  9:22 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.