[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1583431025-19802-5-git-send-email-luwei.kang@intel.com>
Date: Fri, 6 Mar 2020 01:56:58 +0800
From: Luwei Kang <luwei.kang@...el.com>
To: x86@...nel.org, linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...hat.com, namhyung@...nel.org, tglx@...utronix.de,
bp@...en8.de, hpa@...or.com, pbonzini@...hat.com,
sean.j.christopherson@...el.com, vkuznets@...hat.com,
wanpengli@...cent.com, jmattson@...gle.com, joro@...tes.org,
pawan.kumar.gupta@...ux.intel.com, ak@...ux.intel.com,
thomas.lendacky@....com, fenghua.yu@...el.com,
kan.liang@...ux.intel.com, like.xu@...ux.intel.com
Subject: [PATCH v1 04/11] KVM: x86/pmu: Decouple event enablement from event creation
From: Kan Liang <kan.liang@...ux.intel.com>
KVM needs to specially configure the event before enabling the event, e.g.
set event to assign a dedicated counter and handle auto-reload flags.
Set disabled = 1 when allocating the event. So perf will not enable the
event by default. Then enable the event explicitly. Previously, the process
is creating and enabling. Now, it's creating, KVM configure, and enabling.
Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
---
arch/x86/kvm/pmu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index bcc6a73..b4f9e97 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -109,6 +109,7 @@ static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type,
.exclude_user = exclude_user,
.exclude_kernel = exclude_kernel,
.config = config,
+ .disabled = 1,
};
attr.sample_period = (-pmc->counter) & pmc_bitmask(pmc);
@@ -136,6 +137,7 @@ static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type,
pmc->perf_event = event;
pmc_to_pmu(pmc)->event_count++;
+ perf_event_enable(event);
clear_bit(pmc->idx, pmc_to_pmu(pmc)->reprogram_pmi);
}
--
1.8.3.1
Powered by blists - more mailing lists