Re: [RFC PATCH v3 48/58] perf/x86/intel: Support PERF_PMU_CAP_PASSTHROUGH_VPMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2024-08-01 12:58 a.m., Mingwei Zhang wrote:
> From: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
> 
> Apply the PERF_PMU_CAP_PASSTHROUGH_VPMU for Intel core PMU. It only
> indicates that the perf side of core PMU is ready to support the
> passthrough vPMU.  Besides the capability, the hypervisor should still need
> to check the PMU version and other capabilities to decide whether to enable
> the passthrough vPMU.
> 
> Signed-off-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
> Tested-by: Yongwei Ma <yongwei.ma@xxxxxxxxx>
> Signed-off-by: Mingwei Zhang <mizhang@xxxxxxxxxx>
> ---
>  arch/x86/events/intel/core.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
> index 38c1b1f1deaa..d5bb7d4ed062 100644
> --- a/arch/x86/events/intel/core.c
> +++ b/arch/x86/events/intel/core.c
> @@ -4743,6 +4743,8 @@ static void intel_pmu_check_hybrid_pmus(struct x86_hybrid_pmu *pmu)
>  	else
>  		pmu->pmu.capabilities &= ~PERF_PMU_CAP_AUX_OUTPUT;
>  
> +	pmu->pmu.capabilities |= PERF_PMU_CAP_PASSTHROUGH_VPMU;
> +

Because of the simplification in patch 14, there is only one PASSTHROUGH
vPMU supported on a machine. The flag has to be moved for the hybrid
PMUs. Otherwise, the hybrid PMUs would not be registered even in the
bare metal.

>  	intel_pmu_check_event_constraints(pmu->event_constraints,
>  					  pmu->num_counters,
>  					  pmu->num_counters_fixed,
> @@ -6235,6 +6237,9 @@ __init int intel_pmu_init(void)
>  			pr_cont(" AnyThread deprecated, ");
>  	}
>  
> +	/* The perf side of core PMU is ready to support the passthrough vPMU. */
> +	x86_get_pmu(smp_processor_id())->capabilities |= PERF_PMU_CAP_PASSTHROUGH_VPMU;
> +

It's good enough to only set the flag here.

Thanks,
Kan

>  	/*
>  	 * Install the hw-cache-events table:
>  	 */




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux