Re: Using PEBS from qemu-kvm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/30/2024 10:19 PM, Chloe Alverti wrote:
> Hello to all,
>
> I am using qemu to set-up a VM on a Sapphire Rapid server.
> I am running linux kernel 6.6.14 in both guest and host.
> I enable kvm for the guest and I pass the --cpu host flag to qemu.
>
> My understanding is that there is some PEBS virtualization support in
> place within kvm. However in the above set-up if I try:
>
> perf record -e instructions:p ls -- I get back "unchecked MSR access
> error: WRMSR to 0x3f1 (tried to write 0x0000000000000002)"
>
> if I try perf record -e instructions:ppp ls -- I get back that the PMU
> HW does not support sampling.
>
> Also I see in dmesg that in the guest, PEBS has fmt-0 (format)
> configured while in the host it is fmt-4.
>
> In general, I would like to use PEBS within the guest to take a trace
> of sampled instructions that cause LLC misses.
>
> At this point, it is not clear to me if this is even possible.
>
> Could you please let me know if I can use PEBS for my purpose at all,
> and if yes what configuration am I missing?
> Is there some other VMM that I should be using and not qemu?
>
> Thank you very much in advance!
> Best Regards,
> Chloe
>
> P.S.: PEBS sampling works fine in the host.

It looks you need the below qemu patch to enable PEBS related bits in
PERF_CAPABILITIES MSR for host model.

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index f2740d9ab7..ddfbbf3b4b 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1189,9 +1189,9 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         .type = MSR_FEATURE_WORD,
         .feat_names = {
             NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, "full-width-write", NULL, "topdown",
+            NULL, NULL, "pebs-trap", "pebs-arch-reg",
+            "pebs-fmt0", "pebs-fmt1", "pebs-fmt2", "pebs-fmt3",
+            NULL, "full-width-write", "pebs-baseline", "topdown",
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,






[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux