stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] KVM: arm64: Fix host-programmed guest events in nVHE
       [not found] <20240305184840.636212-1-oliver.upton@linux.dev>
@ 2024-03-05 18:48 ` Oliver Upton
  2024-03-06  9:59   ` Marc Zyngier
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Upton @ 2024-03-05 18:48 UTC (permalink / raw)
  To: kvmarm
  Cc: Marc Zyngier, James Morse, Suzuki K Poulose, Zenghui Yu,
	Will Deacon, Oliver Upton, stable

Programming PMU events in the host that count during guest execution is
a feature supported by perf, e.g.

  perf stat -e cpu_cycles:G ./lkvm run

While this works for VHE, the guest/host event bitmaps are not carried
through to the hypervisor in the nVHE configuration. Make
kvm_pmu_update_vcpu_events() conditional on whether or not _hardware_
supports PMUv3 rather than if the vCPU as vPMU enabled.

Cc: stable@vger.kernel.org
Fixes: 84d751a019a9 ("KVM: arm64: Pass pmu events to hyp via vcpu")
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
---
 include/kvm/arm_pmu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/kvm/arm_pmu.h b/include/kvm/arm_pmu.h
index 4b9d8fb393a8..df32355e3e38 100644
--- a/include/kvm/arm_pmu.h
+++ b/include/kvm/arm_pmu.h
@@ -86,7 +86,7 @@ void kvm_vcpu_pmu_resync_el0(void);
  */
 #define kvm_pmu_update_vcpu_events(vcpu)				\
 	do {								\
-		if (!has_vhe() && kvm_vcpu_has_pmu(vcpu))		\
+		if (!has_vhe() && kvm_arm_support_pmu_v3())		\
 			vcpu->arch.pmu.events = *kvm_get_pmu_events();	\
 	} while (0)
 
-- 
2.44.0.278.ge034bb2e1d-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] KVM: arm64: Fix host-programmed guest events in nVHE
  2024-03-05 18:48 ` [PATCH 2/3] KVM: arm64: Fix host-programmed guest events in nVHE Oliver Upton
@ 2024-03-06  9:59   ` Marc Zyngier
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2024-03-06  9:59 UTC (permalink / raw)
  To: Oliver Upton
  Cc: kvmarm, James Morse, Suzuki K Poulose, Zenghui Yu, Will Deacon,
	stable

On Tue, 05 Mar 2024 18:48:39 +0000,
Oliver Upton <oliver.upton@linux.dev> wrote:
> 
> Programming PMU events in the host that count during guest execution is
> a feature supported by perf, e.g.
> 
>   perf stat -e cpu_cycles:G ./lkvm run
> 
> While this works for VHE, the guest/host event bitmaps are not carried
> through to the hypervisor in the nVHE configuration. Make
> kvm_pmu_update_vcpu_events() conditional on whether or not _hardware_
> supports PMUv3 rather than if the vCPU as vPMU enabled.
> 
> Cc: stable@vger.kernel.org
> Fixes: 84d751a019a9 ("KVM: arm64: Pass pmu events to hyp via vcpu")
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
>  include/kvm/arm_pmu.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/kvm/arm_pmu.h b/include/kvm/arm_pmu.h
> index 4b9d8fb393a8..df32355e3e38 100644
> --- a/include/kvm/arm_pmu.h
> +++ b/include/kvm/arm_pmu.h
> @@ -86,7 +86,7 @@ void kvm_vcpu_pmu_resync_el0(void);
>   */
>  #define kvm_pmu_update_vcpu_events(vcpu)				\
>  	do {								\
> -		if (!has_vhe() && kvm_vcpu_has_pmu(vcpu))		\
> +		if (!has_vhe() && kvm_arm_support_pmu_v3())		\
>  			vcpu->arch.pmu.events = *kvm_get_pmu_events();	\
>  	} while (0)
>  

Reviewed-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-06 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240305184840.636212-1-oliver.upton@linux.dev>
2024-03-05 18:48 ` [PATCH 2/3] KVM: arm64: Fix host-programmed guest events in nVHE Oliver Upton
2024-03-06  9:59   ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).