Hi,
And thanks for the fast replies.
>The PMU emulation works by creating a perf event in the host, however it is
>pinned to the KVM process, so the the real PMU counters are stopped and
>started as the KVM process is >scheduled in and out. This means that it will
>include any CPU time associated with that process of which your guest is only
>a subset of.
Thanks for the clarification.
As this is the case, the counted cycles from the host should deliver a larger
number than the executed instructions inside the guest.
>The patchset that James refers to will ensure that the underlying real PMU
>counters underlying the guest only events will only be enabled upon entering
>the guest (and disabled on >leaving). Thus you will need to apply this (to
>your host) for more accurate counting. (You could also then use the perf
>modifiers in the host to counter guest cycles, e.g. perf -e >instructions:G).
So I applied your patch to a 4.19.5 kernel and also your other Patchseries for
the perf events in the host [0].
So what I do now is running :
perf stat -e instructions:G -- ./run_loop_in_kvm.
Run_loop_in_kvm is a small c program who starts a vm and executes a little loop
in the guest and then exits.
I get a output from perf like the following:
159732 instructions:Gu
....
My Problem is, I am still not sure how to interpret these values as my bare
metal code runs a loop for 1048577 times
which executes 3 instructions in every run.
My question is how comes this discrepancy of the counted values.
The perf counting from the host delivers a value significantly smaller than the
number of instructions in the guest.
I am struggling to interpret the perf counter values as an indication how many
instructions my guest performed.
What am I missing?
Also I get the following output for perf stat -e cycles:G ls: 647284 cyles:Gu.
Is this a indicator that my guest/host modifiers do not work or am I
misunderstanding the whole concept here?
Sorry for the silly question and thanks in advance!
>Also you may want to refer to kvm-unit-tests are there are test cases that
>demonstrate bare metal code for PMU enabling.
Thanks for the hint, these tests are very useful examples!
[0]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-November/614985.html
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm