[PATCH v2] arm64: perf: Use only exclude_kernel attribute when kernel is running in HYP
From: Will Deacon <hidden>
Date: 2017-04-28 16:38:43
Also in:
lkml
Hi guys, On Fri, Apr 28, 2017 at 01:46:24PM +0000, Jayachandran C wrote:
On Thu, Apr 27, 2017 at 06:37:59PM +0100, Will Deacon wrote:quoted
quoted
If my understanding is correct, the sysfs suggestion above is going to add API complexity without solving the issue. Ignoring the exclude_hv if it cannot be honored would be a better solution.Better for HHVM, sure, but I don't think it's better in general. It means that we silently do the opposite of what the user has requested in some configurations.If my understanding is correct, when is_kernel_in_hyp_mode() is true, the kernel is in EL2 and there is no real hypervisor with hvc calls from kernel. Ignoring the exclude_hv would be correct. When kernel is in EL1, it would be correct to consider exclude_hv to skip events in EL2 (reached with hvc). I don't see the issue, can you please give more detail on the config with unexpected behavior?
This got me thinking, so I tried to look at the history of exclude_hv. It
turns out it was added in 0475f9ea8e2c ("perf_counters: allow users to
count user, kernel and/or hypervisor events") for PowerPC, not x86 (where
this doesn't seem to be supported).
Notably, it looks like it's always ignored for the x86 CPU PMU, and ignored
on PowerPC when a hypervisor is not present. I think that backs up your
suggestion that we should ignore it when is_kernel_in_hyp_mode() is true.
In which case, I withdraw my objection to ignoring exclude_hv when running
in hyp mode, but please add a comment explaining the rationale!
Will