[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <286AC319A985734F985F78AFA26841F7397FCAF8@shsmsx102.ccr.corp.intel.com>
Date: Thu, 27 Sep 2018 10:10:52 +0000
From: "Wang, Wei W" <wei.w.wang@...el.com>
To: Peter Zijlstra <peterz@...radead.org>,
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>,
"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 Friday, September 21, 2018 12:24 AM, Peter Zijlstra wrote:
> On Thu, Sep 20, 2018 at 08:30:35AM -0700, 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,
> >
> > I think that will allocate an extra perfmon counter, right?
>
> I throught the same too, but I think the exclude_host/guest, whichever is the
> right one makes that work for regular counters too.
Sorry for being late.
I'm not sure if exclude_host/guest would be suitable, for example, if the guest wants to use a perf counter, host will create a perf event with "exclude_host=true" to have the counter not count in host. And "exclude_guest=true" is a flag to the perf core that the counter should not count when the guest runs.
What would you think if we add a new flag (e.g. .force_no_counters) to the perf core to indicate not allocating a perf counter?
> That code is a wee bit magical and I didn't take the time to reverse engineer
> that. It most certainly needs a comment.
No problem. I will add more comments in the next version.
Best,
Wei
Powered by blists - more mailing lists