arm64: perf: Ignore exclude_hv when kernel is running in HYP
authorGanapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Tue, 2 May 2017 16:29:34 +0000 (21:59 +0530)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 15 May 2017 17:30:37 +0000 (18:30 +0100)
commit78a19cfdf37d19002c83c8790853c1cc10feccdc
tree6e38f50adf729eac3552bba63eae030b0b07cb97
parent8df728e1ae614f592961e51f65d3e3212ede5a75
arm64: perf: Ignore exclude_hv when kernel is running in HYP

commit d98ecdaca296 ("arm64: perf: Count EL2 events if the kernel is
running in HYP") returns -EINVAL when perf system call perf_event_open is
called with exclude_hv != exclude_kernel. This change breaks applications
on VHE enabled ARMv8.1 platforms. The issue was observed with HHVM
application, which calls perf_event_open with exclude_hv = 1 and
exclude_kernel = 0.

There is no separate hypervisor privilege level when VHE is enabled, the
host kernel runs at EL2. So when VHE is enabled, we should ignore
exclude_hv from the application. This behaviour is consistent with PowerPC
where the exclude_hv is ignored when the hypervisor is not present and with
x86 where this flag is ignored.

Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
[will: added comment to justify the behaviour of exclude_hv]
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/perf_event.c