[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-discuss] Getting The Performance monitoring interrupt fired
From: |
Bandan Das |
Subject: |
Re: [Qemu-discuss] Getting The Performance monitoring interrupt fired |
Date: |
Mon, 06 Feb 2017 18:14:57 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Parfait Tokponnon <address@hidden> writes:
> Hello
>
> I wrote some module in my hobby OS kernel to issue the performance
> monitoring interrupt (PMI) on instructions counter overflow. It works well
> on my machine (Intel core i5). But when I run it on qemu using
>
> qemu-system-x86_64 -enable-kvm -cpu host -m 256 -serial mon:stdio -cdrom
> var/run/hypervisor.iso
>
> the interrupt does never fire. However, Instruction counting works well in
> qemu.
>
> Is there anything I am missing?
>
> Does it require any special configuration to get the PMI fired on qemu?
KVM implements a subset but I think this should work. Could it be that
interrupts
are not firing exactly when you want them ?
I just started a Linux guest with "-cpu host" on a Skylake host and then
ran "perf record -a" in the guest. I can see the "perf interrupt took too long"
message in the guest logs which means that the guest is seeing the PMI.
> This is how I configure msr registers to activate PMI
>
> Msr::write(Msr::MSR_PERF_GLOBAL_CTRL, 0x700000003);
> Msr::write(Msr::MSR_PERF_FIXED_CTRL, 0xa);
> Msr::write(Msr::IA32_PERFEVTSEL0, 0x004100c5);
>
> Program the PMI for 0x1000 instructions
>
> Msr::write(Msr::IA32_PERF_GLOBAL_OVF_CTRL, 1ull << 32);
> Msr::write(Msr::MSR_PERF_FIXED_CTR0, 0xFFFFEFFF | 0xFFFF00000000);
>
> Thanks