From: Marc Zyngier <marc.zyngier@arm.com>
To: Shannon Zhao <zhaoshenglong@huawei.com>,
kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org
Cc: kvm@vger.kernel.org, will.deacon@arm.com,
linux-arm-kernel@lists.infradead.org, shannon.zhao@linaro.org
Subject: Re: [PATCH v5 00/21] KVM: ARM64: Add guest PMU support
Date: Mon, 07 Dec 2015 14:11:11 +0000 [thread overview]
Message-ID: <5665937F.90507@arm.com> (raw)
In-Reply-To: <1449123091-20252-1-git-send-email-zhaoshenglong@huawei.com>
Shannon,
On 03/12/15 06:11, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> This patchset adds guest PMU support for KVM on ARM64. It takes
> trap-and-emulate approach. When guest wants to monitor one event, it
> will be trapped by KVM and KVM will call perf_event API to create a perf
> event and call relevant perf_event APIs to get the count value of event.
>
> Use perf to test this patchset in guest. When using "perf list", it
> shows the list of the hardware events and hardware cache events perf
> supports. Then use "perf stat -e EVENT" to monitor some event. For
> example, use "perf stat -e cycles" to count cpu cycles and
> "perf stat -e cache-misses" to count cache misses.
>
> Below are the outputs of "perf stat -r 5 sleep 5" when running in host
> and guest.
>
> Host:
> Performance counter stats for 'sleep 5' (5 runs):
>
> 0.510276 task-clock (msec) # 0.000 CPUs utilized ( +- 1.57% )
> 1 context-switches # 0.002 M/sec
> 0 cpu-migrations # 0.000 K/sec
> 49 page-faults # 0.096 M/sec ( +- 0.77% )
> 1064117 cycles # 2.085 GHz ( +- 1.56% )
> <not supported> stalled-cycles-frontend
> <not supported> stalled-cycles-backend
> 529051 instructions # 0.50 insns per cycle ( +- 0.55% )
> <not supported> branches
> 9894 branch-misses # 19.390 M/sec ( +- 1.70% )
>
> 5.000853900 seconds time elapsed ( +- 0.00% )
>
> Guest:
> Performance counter stats for 'sleep 5' (5 runs):
>
> 0.642456 task-clock (msec) # 0.000 CPUs utilized ( +- 1.81% )
> 1 context-switches # 0.002 M/sec
> 0 cpu-migrations # 0.000 K/sec
> 49 page-faults # 0.076 M/sec ( +- 1.64% )
> 1322717 cycles # 2.059 GHz ( +- 1.88% )
> <not supported> stalled-cycles-frontend
> <not supported> stalled-cycles-backend
> 640944 instructions # 0.48 insns per cycle ( +- 1.10% )
> <not supported> branches
> 10665 branch-misses # 16.600 M/sec ( +- 2.23% )
>
> 5.001181452 seconds time elapsed ( +- 0.00% )
>
> Have a cycle counter read test like below in guest and host:
>
> static void test(void)
> {
> unsigned long count, count1, count2;
> count1 = read_cycles();
> count++;
> count2 = read_cycles();
> }
>
> Host:
> count1: 3046186213
> count2: 3046186347
> delta: 134
>
> Guest:
> count1: 5645797121
> count2: 5645797270
> delta: 149
>
> The gap between guest and host is very small. One reason for this I
> think is that it doesn't count the cycles in EL2 and host since we add
> exclude_hv = 1. So the cycles spent to store/restore registers which
> happens at EL2 are not included.
>
> This patchset can be fetched from [1] and the relevant QEMU version for
> test can be fetched from [2].
>
> The results of 'perf test' can be found from [3][4].
> The results of perf_event_tests test suite can be found from [5][6].
>
> Also, I have tested "perf top" in two VMs and host at the same time. It
> works well.
I've commented on more issues I've found. Hopefully you'll be able to
respin this quickly enough, and end-up with a simpler code base (state
duplication is a bit messy).
Another thing I have noticed is that you have dropped the vgic changes
that were configuring the interrupt. It feels like they should be
included, and configure the PPI as a LEVEL interrupt. Also, looking at
your QEMU code, you seem to configure the interrupt as EDGE, which is
now how yor emulated HW behaves.
Looking forward to reviewing the next version.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
WARNING: multiple messages have this Message-ID (diff)
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 00/21] KVM: ARM64: Add guest PMU support
Date: Mon, 07 Dec 2015 14:11:11 +0000 [thread overview]
Message-ID: <5665937F.90507@arm.com> (raw)
In-Reply-To: <1449123091-20252-1-git-send-email-zhaoshenglong@huawei.com>
Shannon,
On 03/12/15 06:11, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> This patchset adds guest PMU support for KVM on ARM64. It takes
> trap-and-emulate approach. When guest wants to monitor one event, it
> will be trapped by KVM and KVM will call perf_event API to create a perf
> event and call relevant perf_event APIs to get the count value of event.
>
> Use perf to test this patchset in guest. When using "perf list", it
> shows the list of the hardware events and hardware cache events perf
> supports. Then use "perf stat -e EVENT" to monitor some event. For
> example, use "perf stat -e cycles" to count cpu cycles and
> "perf stat -e cache-misses" to count cache misses.
>
> Below are the outputs of "perf stat -r 5 sleep 5" when running in host
> and guest.
>
> Host:
> Performance counter stats for 'sleep 5' (5 runs):
>
> 0.510276 task-clock (msec) # 0.000 CPUs utilized ( +- 1.57% )
> 1 context-switches # 0.002 M/sec
> 0 cpu-migrations # 0.000 K/sec
> 49 page-faults # 0.096 M/sec ( +- 0.77% )
> 1064117 cycles # 2.085 GHz ( +- 1.56% )
> <not supported> stalled-cycles-frontend
> <not supported> stalled-cycles-backend
> 529051 instructions # 0.50 insns per cycle ( +- 0.55% )
> <not supported> branches
> 9894 branch-misses # 19.390 M/sec ( +- 1.70% )
>
> 5.000853900 seconds time elapsed ( +- 0.00% )
>
> Guest:
> Performance counter stats for 'sleep 5' (5 runs):
>
> 0.642456 task-clock (msec) # 0.000 CPUs utilized ( +- 1.81% )
> 1 context-switches # 0.002 M/sec
> 0 cpu-migrations # 0.000 K/sec
> 49 page-faults # 0.076 M/sec ( +- 1.64% )
> 1322717 cycles # 2.059 GHz ( +- 1.88% )
> <not supported> stalled-cycles-frontend
> <not supported> stalled-cycles-backend
> 640944 instructions # 0.48 insns per cycle ( +- 1.10% )
> <not supported> branches
> 10665 branch-misses # 16.600 M/sec ( +- 2.23% )
>
> 5.001181452 seconds time elapsed ( +- 0.00% )
>
> Have a cycle counter read test like below in guest and host:
>
> static void test(void)
> {
> unsigned long count, count1, count2;
> count1 = read_cycles();
> count++;
> count2 = read_cycles();
> }
>
> Host:
> count1: 3046186213
> count2: 3046186347
> delta: 134
>
> Guest:
> count1: 5645797121
> count2: 5645797270
> delta: 149
>
> The gap between guest and host is very small. One reason for this I
> think is that it doesn't count the cycles in EL2 and host since we add
> exclude_hv = 1. So the cycles spent to store/restore registers which
> happens at EL2 are not included.
>
> This patchset can be fetched from [1] and the relevant QEMU version for
> test can be fetched from [2].
>
> The results of 'perf test' can be found from [3][4].
> The results of perf_event_tests test suite can be found from [5][6].
>
> Also, I have tested "perf top" in two VMs and host at the same time. It
> works well.
I've commented on more issues I've found. Hopefully you'll be able to
respin this quickly enough, and end-up with a simpler code base (state
duplication is a bit messy).
Another thing I have noticed is that you have dropped the vgic changes
that were configuring the interrupt. It feels like they should be
included, and configure the PPI as a LEVEL interrupt. Also, looking at
your QEMU code, you seem to configure the interrupt as EDGE, which is
now how yor emulated HW behaves.
Looking forward to reviewing the next version.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2015-12-07 14:09 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-03 6:11 [PATCH v5 00/21] KVM: ARM64: Add guest PMU support Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 01/21] ARM64: Move PMU register related defines to asm/pmu.h Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 02/21] KVM: ARM64: Define PMU data structure for each vcpu Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-07 15:05 ` Marc Zyngier
2015-12-07 15:05 ` Marc Zyngier
2015-12-07 16:42 ` Marc Zyngier
2015-12-07 16:42 ` Marc Zyngier
2015-12-03 6:11 ` [PATCH v5 03/21] KVM: ARM64: Add offset defines for PMU registers Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-07 14:06 ` Marc Zyngier
2015-12-07 14:06 ` Marc Zyngier
2015-12-07 14:31 ` Shannon Zhao
2015-12-07 14:31 ` Shannon Zhao
2015-12-07 14:55 ` Marc Zyngier
2015-12-07 14:55 ` Marc Zyngier
2015-12-08 8:09 ` Shannon Zhao
2015-12-08 8:09 ` Shannon Zhao
2015-12-08 8:09 ` Shannon Zhao
2015-12-08 9:02 ` Marc Zyngier
2015-12-08 9:02 ` Marc Zyngier
2015-12-03 6:11 ` [PATCH v5 04/21] KVM: ARM64: Add reset and access handlers for PMCR_EL0 register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-07 13:28 ` Marc Zyngier
2015-12-07 13:28 ` Marc Zyngier
2015-12-03 6:11 ` [PATCH v5 05/21] KVM: ARM64: Add reset and access handlers for PMSELR register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 06/21] KVM: ARM64: Add reset and access handlers for PMCEID0 and PMCEID1 register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 07/21] KVM: ARM64: PMU: Add perf event map and introduce perf event creating function Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 08/21] KVM: ARM64: Add reset and access handlers for PMXEVTYPER register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-07 13:38 ` Marc Zyngier
2015-12-07 13:38 ` Marc Zyngier
2015-12-03 6:11 ` [PATCH v5 09/21] KVM: ARM64: Add reset and access handlers for PMXEVCNTR register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 10/21] KVM: ARM64: Add reset and access handlers for PMCCNTR register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 11/21] KVM: ARM64: Add reset and access handlers for PMCNTENSET and PMCNTENCLR register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-07 13:42 ` Marc Zyngier
2015-12-07 13:42 ` Marc Zyngier
2015-12-03 6:11 ` [PATCH v5 12/21] KVM: ARM64: Add reset and access handlers for PMINTENSET and PMINTENCLR register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 13/21] KVM: ARM64: Add reset and access handlers for PMOVSSET and PMOVSCLR register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 14/21] KVM: ARM64: Add reset and access handlers for PMUSERENR register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 15/21] KVM: ARM64: Add reset and access handlers for PMSWINC register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 16/21] KVM: ARM64: Add access handlers for PMEVCNTRn and PMEVTYPERn register Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 17/21] KVM: ARM64: Add helper to handle PMCR register bits Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 18/21] KVM: ARM64: Add PMU overflow interrupt routing Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 19/21] KVM: ARM64: Reset PMU state when resetting vcpu Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 20/21] KVM: ARM64: Free perf event of PMU when destroying vcpu Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` [PATCH v5 21/21] KVM: ARM64: Add a new kvm ARM PMU device Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-03 6:11 ` Shannon Zhao
2015-12-07 13:56 ` Marc Zyngier
2015-12-07 13:56 ` Marc Zyngier
2015-12-07 14:37 ` Shannon Zhao
2015-12-07 14:37 ` Shannon Zhao
2015-12-07 15:06 ` Marc Zyngier
2015-12-07 15:06 ` Marc Zyngier
2015-12-07 14:11 ` Marc Zyngier [this message]
2015-12-07 14:11 ` [PATCH v5 00/21] KVM: ARM64: Add guest PMU support Marc Zyngier
2015-12-07 14:47 ` Shannon Zhao
2015-12-07 14:47 ` Shannon Zhao
2015-12-07 15:09 ` Marc Zyngier
2015-12-07 15:09 ` Marc Zyngier
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=5665937F.90507@arm.com \
--to=marc.zyngier@arm.com \
--cc=christoffer.dall@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=shannon.zhao@linaro.org \
--cc=will.deacon@arm.com \
--cc=zhaoshenglong@huawei.com \
/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.