qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: Haibo Xu <haibo.xu@linaro.org>, peter.maydell@linaro.org
Cc: Andrew Murray <andrew.murray@arm.com>,
	Andrew Jones <drjones@redhat.com>,
	qemu-arm@nongnu.org, philmd@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH 0/7] target/arm: Add vSPE support to KVM guest
Date: Mon, 31 Aug 2020 09:56:47 +0200	[thread overview]
Message-ID: <070de656-5550-62b7-faf9-8c4beec56531@redhat.com> (raw)
In-Reply-To: <cover.1596768588.git.haibo.xu@linaro.org>

Hi Haibo,

On 8/7/20 10:10 AM, Haibo Xu wrote:
> This series add support for SPE(Statistical Profiling Extension)[1]
> in KVM guest. It's based on Andrew Murray's kernel KVM patches V2[2],
> and has been tested to ensure that guest can use SPE with valid data.
> E.g.
> 
> In host:
> $ ./qemu-system-aarch64 \
>         -cpu host -M virt,accel=kvm,gic-version=3 -nographic -m 2048M \
>         -kernel ./Image-new \
>         -initrd /boot/initrd.img-5.6.0-rc2+ \
>         -append "root=/dev/vda rw console=ttyAMA0" -nodefaults -serial stdio\
>         -drive if=none,file=./xenial.rootfs.ext4,id=hd0,format=raw \
>         -device virtio-blk-device,drive=hd0  \
> 
> In guest:
> $ perf record -e arm_spe/ts_enable=1,pa_enable=1,pct_enable=1/ \
>         dd if=/dev/zero of=/dev/null count=1000
> $ perf report --dump-raw-trace > spe_buf.txt
> 
> The spe_buf.txt should contain similar data as below:
> 
> . ... ARM SPE data: size 135944 bytes
> .  00000000:  b0 f4 d3 29 10 00 80 ff a0                      PC 0xff80001029d3f4 el1 ns=1
> .  00000009:  99 0b 00                                        LAT 11 ISSUE
> .  0000000c:  98 0d 00                                        LAT 13 TOT
> .  0000000f:  52 16 00                                        EV RETIRED L1D-ACCESS TLB-ACCESS
> .  00000012:  49 00                                           LD
> .  00000014:  b2 d0 40 d8 70 00 00 ff 00                      VA 0xff000070d840d0
> .  0000001d:  9a 01 00                                        LAT 1 XLAT
> .  00000020:  00 00 00                                        PAD
> .  00000023:  71 a5 1f b3 20 14 00 00 00                      TS 86447955877
> .  0000002c:  b0 7c f9 29 10 00 80 ff a0                      PC 0xff80001029f97c el1 ns=1
> .  00000035:  99 02 00                                        LAT 2 ISSUE
> .  00000038:  98 03 00                                        LAT 3 TOT
> .  0000003b:  52 02 00                                        EV RETIRED
> .  0000003e:  48 00                                           INSN-OTHER
> .  00000040:  00 00 00                                        PAD
> .  00000043:  71 ef 1f b3 20 14 00 00 00                      TS 86447955951
> .  0000004c:  b0 f0 e9 29 10 00 80 ff a0                      PC 0xff80001029e9f0 el1 ns=1
> .  00000055:  99 02 00                                        LAT 2 ISSUE
> .  00000058:  98 03 00                                        LAT 3 TOT
> .  0000005b:  52 02 00                                        EV RETIRED
> 
> If you want to disable the vSPE support, you can use the 'spe=off' cpu
> property:
> 
> ./qemu-system-aarch64 \
>         -cpu host,spe=off -M virt,accel=kvm,gic-version=3 -nographic -m 2048M \
>         -kernel ./Image-new \
>         -initrd /boot/initrd.img-5.6.0-rc2+ \
>         -append "root=/dev/vda rw console=ttyAMA0" -nodefaults -serial stdio\
>         -drive if=none,file=./xenial.rootfs.ext4,id=hd0,format=raw \
>         -device virtio-blk-device,drive=hd0  \
> 
> Note:
> (1) Since the kernel patches are still under review, some of the macros
>     in the header files may be changed after merging. We may need to
>     update them accordingly.
to be more explicit one needs to replace on the kernel 5.5-rc2 based series

-#define KVM_CAP_ARM_SPE_V1 179
+#define KVM_CAP_ARM_SPE_V1 184

I got misleaded ;-)

+ Andrew in CC as he contributed the kernel part.

For information, I have been working on a kvm unit test series for
testing SPE. I will send an RFC, most probably this week. At the moment
I still face some weirdness such as some unexpected Service state in the
syndrome register. Anyway I will share the existing code so that we can
discuss the issues.

Are there any plans to respin the kernel series

Thanks

Eric

> (2) These patches only add vSPE support in KVM mode, for TCG mode, I'm
>     not sure whether we need to support it.
> (3) Just followed the 'pmu' property, we only allow this feature to be
>     removed from CPUs which enable it by default. But since the SPE is
>     an optional feature extension for Armv8.2, I think a better way may
>     be to disable it by default, and only enable it when the host cpu
>     do have the feature.
> 
> [1]https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/
>    posts/statistical-profiling-extension-for-armv8-a
> [2]https://www.spinics.net/lists/arm-kernel/msg776228.html
> 
> Haibo Xu (7):
>   update Linux headers with new vSPE macros
>   target/arm/kvm: spe: Add helper to detect SPE when using KVM
>   target/arm/cpu: spe: Add an option to turn on/off vSPE support
>   target/arm/kvm: spe: Unify device attr operatioin helper
>   target/arm/kvm: spe: Add device init and set_irq operations
>   hw/arm/virt: spe: Add SPE fdt binding for virt machine
>   target/arm/cpu: spe: Enable spe to work with host cpu
> 
>  hw/arm/virt-acpi-build.c      |  3 +++
>  hw/arm/virt.c                 | 42 ++++++++++++++++++++++++++++++
>  include/hw/acpi/acpi-defs.h   |  1 +
>  include/hw/arm/virt.h         |  1 +
>  linux-headers/asm-arm64/kvm.h |  4 +++
>  linux-headers/linux/kvm.h     |  2 ++
>  target/arm/cpu.c              | 34 +++++++++++++++++++++++++
>  target/arm/cpu.h              |  5 ++++
>  target/arm/kvm.c              | 11 ++++++++
>  target/arm/kvm64.c            | 48 ++++++++++++++++++++++++++++++++---
>  target/arm/kvm_arm.h          | 18 +++++++++++++
>  11 files changed, 166 insertions(+), 3 deletions(-)
> 



  parent reply	other threads:[~2020-08-31  7:57 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07  8:10 [PATCH 0/7] target/arm: Add vSPE support to KVM guest Haibo Xu
2020-08-07  8:10 ` [PATCH 1/7] update Linux headers with new vSPE macros Haibo Xu
2020-08-07  8:10 ` [PATCH 2/7] target/arm/kvm: spe: Add helper to detect SPE when using KVM Haibo Xu
2020-08-14 19:16   ` Richard Henderson
2020-08-07  8:10 ` [PATCH 3/7] target/arm/cpu: spe: Add an option to turn on/off vSPE support Haibo Xu
2020-08-07  8:28   ` Philippe Mathieu-Daudé
2020-08-10  3:03     ` Haibo Xu
2020-08-10 10:14       ` Philippe Mathieu-Daudé
2020-08-10 10:50   ` Andrew Jones
2020-08-14 19:03     ` Richard Henderson
2020-08-14 19:15   ` Richard Henderson
2020-08-07  8:10 ` [PATCH 4/7] target/arm/kvm: spe: Unify device attr operatioin helper Haibo Xu
2020-08-07  8:19   ` Philippe Mathieu-Daudé
2020-08-10  2:48     ` Haibo Xu
2020-08-10 10:29       ` Andrew Jones
2020-08-11  1:13         ` Haibo Xu
2020-08-07  8:10 ` [PATCH 5/7] target/arm/kvm: spe: Add device init and set_irq operations Haibo Xu
2020-08-07  8:10 ` [PATCH 6/7] hw/arm/virt: spe: Add SPE fdt binding for virt machine Haibo Xu
2020-08-10 11:05   ` Andrew Jones
2020-08-11  2:38     ` Haibo Xu
2020-08-11 16:38       ` Andrew Jones
2020-08-12  0:42         ` Haibo Xu
2020-08-29 15:21   ` Auger Eric
2020-08-31  6:27     ` Haibo Xu
2020-08-07  8:10 ` [PATCH 7/7] target/arm/cpu: spe: Enable spe to work with host cpu Haibo Xu
2020-08-10 11:16   ` Andrew Jones
2020-08-11  3:15     ` Haibo Xu
2020-08-11 16:49       ` Andrew Jones
2020-08-12  0:54         ` Haibo Xu
2020-08-14 19:28         ` Richard Henderson
2020-08-15  7:17           ` Andrew Jones
2020-08-10 10:43 ` [PATCH 0/7] target/arm: Add vSPE support to KVM guest Andrew Jones
2020-08-31  7:56 ` Auger Eric [this message]
2020-09-01  2:26   ` Haibo Xu

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=070de656-5550-62b7-faf9-8c4beec56531@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=andrew.murray@arm.com \
    --cc=drjones@redhat.com \
    --cc=haibo.xu@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).