[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <286AC319A985734F985F78AFA26841F7397FCAD0@shsmsx102.ccr.corp.intel.com>
Date: Thu, 27 Sep 2018 10:05:48 +0000
From: "Wang, Wei W" <wei.w.wang@...el.com>
To: Andi Kleen <ak@...ux.intel.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"Liang, Kan" <kan.liang@...el.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"rkrcmar@...hat.com" <rkrcmar@...hat.com>,
"Xu, Like" <like.xu@...el.com>,
"jannh@...gle.com" <jannh@...gle.com>,
"arei.gonglei@...wei.com" <arei.gonglei@...wei.com>
Subject: RE: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host
save/restore the guest lbr stack
On Thursday, September 20, 2018 11:31 PM, Andi Kleen wrote:
> > +int intel_pmu_enable_save_guest_lbr(struct kvm_vcpu *vcpu) {
> > + struct kvm_pmu *pmu = vcpu_to_pmu(vcpu);
> > + struct perf_event *event;
> > + struct perf_event_attr attr = {
> > + .type = PERF_TYPE_RAW,
> > + .size = sizeof(attr),
> > + .pinned = true,
> > + .exclude_host = true,
> > + .sample_type = PERF_SAMPLE_BRANCH_STACK,
> > + .branch_sample_type = PERF_SAMPLE_BRANCH_CALL_STACK
> |
> > + PERF_SAMPLE_BRANCH_USER |
> > + PERF_SAMPLE_BRANCH_KERNEL,
Sorry for my late response (I was digging into some of the details).
> I think that will allocate an extra perfmon counter, right?
>
> So if the guest wants to use all perfmon counters we would start to multiplex,
> which would be bad
Right. The host side counter allocation is not necessary.
> Would need to fix perf core to not allocate a perfmon counter in this case, if
> no period and no event count is requested.
>
If no period (i.e. .sample_period = 0), the current code still uses one counter with the period set to the max period.
If we change that to do no counter allocation, would that break any of the existing usages (I didn't find the reason why the existing code not avoid that allocation for a non-sampling event)?
Best,
Wei
Powered by blists - more mailing lists