OSDN Git Service

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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:47:57 +0000 (19:47 +0200)
commitbffb84bf5a63288a65cbdbd0be860b780322f857
tree81b59ef745aef3a8a22aa3cd5601bf7e5044188f
parent3743e05f5d4084d0d08a1490118a4996080def87
arm64: perf: Ignore exclude_hv when kernel is running in HYP

[ Upstream commit 78a19cfdf37d19002c83c8790853c1cc10feccdc ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kernel/perf_event.c