[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YN799S5hwWqsbY/h@hirez.programming.kicks-ass.net>
Date: Fri, 2 Jul 2021 13:52:21 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Zhu Lingshan <lingshan.zhu@...el.com>
Cc: pbonzini@...hat.com, bp@...en8.de, seanjc@...gle.com,
vkuznets@...hat.com, wanpengli@...cent.com, jmattson@...gle.com,
joro@...tes.org, weijiang.yang@...el.com,
kan.liang@...ux.intel.com, ak@...ux.intel.com,
wei.w.wang@...el.com, eranian@...gle.com, liuxiangdong5@...wei.com,
linux-kernel@...r.kernel.org, x86@...nel.org, kvm@...r.kernel.org,
like.xu.linux@...il.com, Like Xu <like.xu@...ux.intel.com>
Subject: Re: [PATCH V7 11/18] KVM: x86/pmu: Add IA32_DS_AREA MSR emulation to
support guest DS
On Tue, Jun 22, 2021 at 05:42:59PM +0800, Zhu Lingshan wrote:
> diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
> index 190d8d98abf0..b336bcaad626 100644
> --- a/arch/x86/events/intel/core.c
> +++ b/arch/x86/events/intel/core.c
> @@ -21,6 +21,7 @@
> #include <asm/intel_pt.h>
> #include <asm/apic.h>
> #include <asm/cpu_device_id.h>
> +#include <asm/kvm_host.h>
>
> #include "../perf_event.h"
>
> @@ -3915,6 +3916,7 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data)
> {
> struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
> struct perf_guest_switch_msr *arr = cpuc->guest_switch_msrs;
> + struct kvm_pmu *pmu = (struct kvm_pmu *)data;
> u64 intel_ctrl = hybrid(cpuc->pmu, intel_ctrl);
> u64 pebs_mask = cpuc->pebs_enabled & x86_pmu.pebs_capable;
>
> @@ -3945,9 +3947,15 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data)
> return arr;
> }
>
> - if (!x86_pmu.pebs_vmx)
> + if (!pmu || !x86_pmu.pebs_vmx)
> return arr;
>
> + arr[(*nr)++] = (struct perf_guest_switch_msr){
> + .msr = MSR_IA32_DS_AREA,
> + .host = (unsigned long)cpuc->ds,
> + .guest = pmu->ds_area,
> + };
> +
> arr[*nr] = (struct perf_guest_switch_msr){
> .msr = MSR_IA32_PEBS_ENABLE,
> .host = cpuc->pebs_enabled & ~cpuc->intel_ctrl_guest_mask,
s/pmu/kvm_pmu/ or something. pmu is normally a struct pmu *, and having
it be kvm_pmu here is super confusing.
Powered by blists - more mailing lists