Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1332313

[PATCH v4 20/23] arm64: perf: Count EL2 events if the kernel is running in HYP

From Marc Zyngier <marc.zyngier@arm.com>
Newsgroups linux.kernel
Subject [PATCH v4 20/23] arm64: perf: Count EL2 events if the kernel is running in HYP
Date 2016-02-11 19:50 +0100
Message-ID <r14tu-4eC-63@gated-at.bofh.it> (permalink)
References <r14tr-4eC-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When the kernel is running in HYP (with VHE), it is necessary to
include EL2 events if the user requests counting kernel or
hypervisor events.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm64/kernel/perf_event.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index f7ab14c..6013a38 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -20,6 +20,7 @@
  */
 
 #include <asm/irq_regs.h>
+#include <asm/virt.h>
 
 #include <linux/of.h>
 #include <linux/perf/arm_pmu.h>
@@ -693,10 +694,15 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event,
 		return -EPERM;
 	if (attr->exclude_user)
 		config_base |= ARMV8_EXCLUDE_EL0;
-	if (attr->exclude_kernel)
-		config_base |= ARMV8_EXCLUDE_EL1;
-	if (!attr->exclude_hv)
-		config_base |= ARMV8_INCLUDE_EL2;
+	if (is_kernel_in_hyp_mode()) {
+		if (!attr->exclude_kernel || !attr->exclude_hv)
+			config_base |= ARMV8_INCLUDE_EL2;
+	} else {
+		if (attr->exclude_kernel)
+			config_base |= ARMV8_EXCLUDE_EL1;
+		if (!attr->exclude_hv)
+			config_base |= ARMV8_INCLUDE_EL2;
+	}
 
 	/*
 	 * Install the filter into config_base as this is used to
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 00/23] arm64: Virtualization Host Extension support Marc Zyngier <marc.zyngier@arm.com> - 2016-02-11 19:50 +0100
  [PATCH v4 21/23] arm64: hw_breakpoint: Allow EL2 breakpoints if running in HYP Marc Zyngier <marc.zyngier@arm.com> - 2016-02-11 19:50 +0100
    Re: [PATCH v4 21/23] arm64: hw_breakpoint: Allow EL2 breakpoints if  running in HYP Catalin Marinas <catalin.marinas@arm.com> - 2016-02-15 11:30 +0100
    Re: [PATCH v4 21/23] arm64: hw_breakpoint: Allow EL2 breakpoints if  running in HYP Will Deacon <will.deacon@arm.com> - 2016-02-15 18:50 +0100
      Re: [PATCH v4 21/23] arm64: hw_breakpoint: Allow EL2 breakpoints if  running in HYP Will Deacon <will.deacon@arm.com> - 2016-02-15 20:10 +0100
        Re: [PATCH v4 21/23] arm64: hw_breakpoint: Allow EL2 breakpoints if  running in HYP Marc Zyngier <marc.zyngier@arm.com> - 2016-02-16 11:00 +0100
    [PATCH v4.1] arm64: perf: Count EL2 events if the kernel is running in HYP Marc Zyngier <marc.zyngier@arm.com> - 2016-02-17 19:00 +0100
      Re: [PATCH v4.1] arm64: perf: Count EL2 events if the kernel is  running in HYP Will Deacon <will.deacon@arm.com> - 2016-02-19 15:40 +0100
  [PATCH v4 19/23] arm64: KVM: Move most of the fault decoding to C Marc Zyngier <marc.zyngier@arm.com> - 2016-02-11 19:50 +0100
  [PATCH v4 20/23] arm64: perf: Count EL2 events if the kernel is running in HYP Marc Zyngier <marc.zyngier@arm.com> - 2016-02-11 19:50 +0100
    Re: [PATCH v4 20/23] arm64: perf: Count EL2 events if the kernel is  running in HYP Will Deacon <will.deacon@arm.com> - 2016-02-15 18:30 +0100
      Re: [PATCH v4 20/23] arm64: perf: Count EL2 events if the kernel is  running in HYP Will Deacon <will.deacon@arm.com> - 2016-02-15 19:30 +0100
      Re: [PATCH v4 20/23] arm64: perf: Count EL2 events if the kernel is  running in HYP Marc Zyngier <marc.zyngier@arm.com> - 2016-02-15 19:30 +0100
  [PATCH v4 14/23] arm64: KVM: VHE: Make __fpsimd_enabled VHE aware Marc Zyngier <marc.zyngier@arm.com> - 2016-02-11 19:50 +0100
  [PATCH v4 13/23] arm64: KVM: VHE: Enable minimal sysreg save/restore Marc Zyngier <marc.zyngier@arm.com> - 2016-02-11 19:50 +0100
  Re: [PATCH v4 00/23] arm64: Virtualization Host Extension support Christoffer Dall <christoffer.dall@linaro.org> - 2016-02-11 20:10 +0100
    Re: [PATCH v4 00/23] arm64: Virtualization Host Extension support Marc Zyngier <marc.zyngier@arm.com> - 2016-02-11 20:20 +0100
      Re: [PATCH v4 00/23] arm64: Virtualization Host Extension support Catalin Marinas <catalin.marinas@arm.com> - 2016-02-15 11:30 +0100
        Re: [PATCH v4 00/23] arm64: Virtualization Host Extension support Marc Zyngier <marc.zyngier@arm.com> - 2016-02-15 11:40 +0100

csiph-web