From: Shenlin Liang <liangshenlin@eswincomputing.com>
To: kvm-riscv@lists.infradead.org
Subject: [PATCH 0/2] perf kvm: Add kvm stat support on riscv
Date: Thu, 28 Mar 2024 03:12:18 +0000 [thread overview]
Message-ID: <20240328031220.1287-1-liangshenlin@eswincomputing.com> (raw)
'perf kvm stat report/record' generates a statistical analysis of KVM
events and can be used to analyze guest exit reasons. This patch tries
to add stat support on riscv.
Map the return value of trace_kvm_exit() to the specific cause of the
exception, and export it to userspace.
It records on two available KVM tracepoints for riscv: "kvm:kvm_entry"
and "kvm:kvm_exit", and reports statistical data which includes events
handles time, samples, and so on.
Simple tests go below:
# ./perf kvm record -e "kvm:kvm_entry" -e "kvm:kvm_exit"
Lowering default frequency rate from 4000 to 2500.
Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
[ perf record: Woken up 18 times to write data ]
[ perf record: Captured and wrote 5.433 MB perf.data.guest (62519 samples)
# ./perf kvm report
31K kvm:kvm_entry
31K kvm:kvm_exit
# ./perf kvm stat record -a
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 8.502 MB perf.data.guest (99338 samples) ]
# ./perf kvm stat report --event=vmexit
Event name Samples Sample% Time (ns) Time% Max Time (ns) Min Time (ns) Mean Time (ns)
STORE_GUEST_PAGE_FAULT 26968 54.00% 2003031800 40.00% 3361400 27600 74274
LOAD_GUEST_PAGE_FAULT 17645 35.00% 1153338100 23.00% 2513400 30800 65363
VIRTUAL_INST_FAULT 1247 2.00% 340820800 6.00% 1190800 43300 273312
INST_GUEST_PAGE_FAULT 1128 2.00% 340645800 6.00% 2123200 30200 301990
SUPERVISOR_SYSCALL 1019 2.00% 245989900 4.00% 1851500 29300 241403
LOAD_ACCESS 986 1.00% 671556200 13.00% 4180200 100700 681091
INST_ACCESS 655 1.00% 170054800 3.00% 1808300 54600 259625
HYPERVISOR_SYSCALL 21 0.00% 4276400 0.00% 716500 116000 203638
Shenlin Liang (2):
RISCV: KVM: add tracepoints for entry and exit events
perf kvm/riscv: Port perf kvm stat to RISC-V
arch/riscv/kvm/trace_riscv.h | 60 ++++++++++++++
arch/riscv/kvm/vcpu.c | 7 ++
tools/perf/arch/riscv/Makefile | 1 +
tools/perf/arch/riscv/util/Build | 1 +
tools/perf/arch/riscv/util/kvm-stat.c | 78 +++++++++++++++++++
.../arch/riscv/util/riscv_exception_types.h | 41 ++++++++++
6 files changed, 188 insertions(+)
create mode 100644 arch/riscv/kvm/trace_riscv.h
create mode 100644 tools/perf/arch/riscv/util/kvm-stat.c
create mode 100644 tools/perf/arch/riscv/util/riscv_exception_types.h
--
2.37.2
WARNING: multiple messages have this Message-ID (diff)
From: Shenlin Liang <liangshenlin@eswincomputing.com>
To: anup@brainfault.org, atishp@atishpatra.org,
paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, kvm@vger.kernel.org,
kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@redhat.com, acme@kernel.org, namhyung@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
linux-perf-users@vger.kernel.org
Cc: Shenlin Liang <liangshenlin@eswincomputing.com>
Subject: [PATCH 0/2] perf kvm: Add kvm stat support on riscv
Date: Thu, 28 Mar 2024 03:12:18 +0000 [thread overview]
Message-ID: <20240328031220.1287-1-liangshenlin@eswincomputing.com> (raw)
'perf kvm stat report/record' generates a statistical analysis of KVM
events and can be used to analyze guest exit reasons. This patch tries
to add stat support on riscv.
Map the return value of trace_kvm_exit() to the specific cause of the
exception, and export it to userspace.
It records on two available KVM tracepoints for riscv: "kvm:kvm_entry"
and "kvm:kvm_exit", and reports statistical data which includes events
handles time, samples, and so on.
Simple tests go below:
# ./perf kvm record -e "kvm:kvm_entry" -e "kvm:kvm_exit"
Lowering default frequency rate from 4000 to 2500.
Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
[ perf record: Woken up 18 times to write data ]
[ perf record: Captured and wrote 5.433 MB perf.data.guest (62519 samples)
# ./perf kvm report
31K kvm:kvm_entry
31K kvm:kvm_exit
# ./perf kvm stat record -a
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 8.502 MB perf.data.guest (99338 samples) ]
# ./perf kvm stat report --event=vmexit
Event name Samples Sample% Time (ns) Time% Max Time (ns) Min Time (ns) Mean Time (ns)
STORE_GUEST_PAGE_FAULT 26968 54.00% 2003031800 40.00% 3361400 27600 74274
LOAD_GUEST_PAGE_FAULT 17645 35.00% 1153338100 23.00% 2513400 30800 65363
VIRTUAL_INST_FAULT 1247 2.00% 340820800 6.00% 1190800 43300 273312
INST_GUEST_PAGE_FAULT 1128 2.00% 340645800 6.00% 2123200 30200 301990
SUPERVISOR_SYSCALL 1019 2.00% 245989900 4.00% 1851500 29300 241403
LOAD_ACCESS 986 1.00% 671556200 13.00% 4180200 100700 681091
INST_ACCESS 655 1.00% 170054800 3.00% 1808300 54600 259625
HYPERVISOR_SYSCALL 21 0.00% 4276400 0.00% 716500 116000 203638
Shenlin Liang (2):
RISCV: KVM: add tracepoints for entry and exit events
perf kvm/riscv: Port perf kvm stat to RISC-V
arch/riscv/kvm/trace_riscv.h | 60 ++++++++++++++
arch/riscv/kvm/vcpu.c | 7 ++
tools/perf/arch/riscv/Makefile | 1 +
tools/perf/arch/riscv/util/Build | 1 +
tools/perf/arch/riscv/util/kvm-stat.c | 78 +++++++++++++++++++
.../arch/riscv/util/riscv_exception_types.h | 41 ++++++++++
6 files changed, 188 insertions(+)
create mode 100644 arch/riscv/kvm/trace_riscv.h
create mode 100644 tools/perf/arch/riscv/util/kvm-stat.c
create mode 100644 tools/perf/arch/riscv/util/riscv_exception_types.h
--
2.37.2
WARNING: multiple messages have this Message-ID (diff)
From: Shenlin Liang <liangshenlin@eswincomputing.com>
To: anup@brainfault.org, atishp@atishpatra.org,
paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, kvm@vger.kernel.org,
kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@redhat.com, acme@kernel.org, namhyung@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
linux-perf-users@vger.kernel.org
Cc: Shenlin Liang <liangshenlin@eswincomputing.com>
Subject: [PATCH 0/2] perf kvm: Add kvm stat support on riscv
Date: Thu, 28 Mar 2024 03:12:18 +0000 [thread overview]
Message-ID: <20240328031220.1287-1-liangshenlin@eswincomputing.com> (raw)
'perf kvm stat report/record' generates a statistical analysis of KVM
events and can be used to analyze guest exit reasons. This patch tries
to add stat support on riscv.
Map the return value of trace_kvm_exit() to the specific cause of the
exception, and export it to userspace.
It records on two available KVM tracepoints for riscv: "kvm:kvm_entry"
and "kvm:kvm_exit", and reports statistical data which includes events
handles time, samples, and so on.
Simple tests go below:
# ./perf kvm record -e "kvm:kvm_entry" -e "kvm:kvm_exit"
Lowering default frequency rate from 4000 to 2500.
Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
[ perf record: Woken up 18 times to write data ]
[ perf record: Captured and wrote 5.433 MB perf.data.guest (62519 samples)
# ./perf kvm report
31K kvm:kvm_entry
31K kvm:kvm_exit
# ./perf kvm stat record -a
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 8.502 MB perf.data.guest (99338 samples) ]
# ./perf kvm stat report --event=vmexit
Event name Samples Sample% Time (ns) Time% Max Time (ns) Min Time (ns) Mean Time (ns)
STORE_GUEST_PAGE_FAULT 26968 54.00% 2003031800 40.00% 3361400 27600 74274
LOAD_GUEST_PAGE_FAULT 17645 35.00% 1153338100 23.00% 2513400 30800 65363
VIRTUAL_INST_FAULT 1247 2.00% 340820800 6.00% 1190800 43300 273312
INST_GUEST_PAGE_FAULT 1128 2.00% 340645800 6.00% 2123200 30200 301990
SUPERVISOR_SYSCALL 1019 2.00% 245989900 4.00% 1851500 29300 241403
LOAD_ACCESS 986 1.00% 671556200 13.00% 4180200 100700 681091
INST_ACCESS 655 1.00% 170054800 3.00% 1808300 54600 259625
HYPERVISOR_SYSCALL 21 0.00% 4276400 0.00% 716500 116000 203638
Shenlin Liang (2):
RISCV: KVM: add tracepoints for entry and exit events
perf kvm/riscv: Port perf kvm stat to RISC-V
arch/riscv/kvm/trace_riscv.h | 60 ++++++++++++++
arch/riscv/kvm/vcpu.c | 7 ++
tools/perf/arch/riscv/Makefile | 1 +
tools/perf/arch/riscv/util/Build | 1 +
tools/perf/arch/riscv/util/kvm-stat.c | 78 +++++++++++++++++++
.../arch/riscv/util/riscv_exception_types.h | 41 ++++++++++
6 files changed, 188 insertions(+)
create mode 100644 arch/riscv/kvm/trace_riscv.h
create mode 100644 tools/perf/arch/riscv/util/kvm-stat.c
create mode 100644 tools/perf/arch/riscv/util/riscv_exception_types.h
--
2.37.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2024-03-28 3:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 3:12 Shenlin Liang [this message]
2024-03-28 3:12 ` [PATCH 0/2] perf kvm: Add kvm stat support on riscv Shenlin Liang
2024-03-28 3:12 ` Shenlin Liang
2024-03-28 3:12 ` [PATCH 1/2] RISCV: KVM: add tracepoints for entry and exit events Shenlin Liang
2024-03-28 3:12 ` Shenlin Liang
2024-03-28 3:12 ` Shenlin Liang
2024-04-08 12:07 ` Anup Patel
2024-04-08 12:07 ` Anup Patel
2024-04-08 12:07 ` Anup Patel
2024-04-11 7:24 ` Shenlin Liang
2024-04-11 7:24 ` Shenlin Liang
2024-04-11 7:24 ` Shenlin Liang
2024-04-10 7:12 ` Eric Cheng
2024-04-10 7:12 ` Eric Cheng
2024-04-10 7:12 ` Eric Cheng
2024-04-11 7:24 ` Shenlin Liang
2024-04-11 7:24 ` Shenlin Liang
2024-04-11 7:24 ` Shenlin Liang
2024-03-28 3:12 ` [PATCH 2/2] perf kvm/riscv: Port perf kvm stat to RISC-V Shenlin Liang
2024-03-28 3:12 ` Shenlin Liang
2024-03-28 3:12 ` Shenlin Liang
2024-04-07 2:31 ` [PATCH 0/2] perf kvm: Add kvm stat support on riscv Shenlin Liang
2024-04-07 2:31 ` Shenlin Liang
2024-04-07 2:31 ` Shenlin Liang
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=20240328031220.1287-1-liangshenlin@eswincomputing.com \
--to=liangshenlin@eswincomputing.com \
--cc=kvm-riscv@lists.infradead.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 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.