linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Andi Kleen <ak@linux.intel.com>
Cc: Wei Wang <wei.w.wang@intel.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	pbonzini@redhat.com, kan.liang@intel.com, mingo@redhat.com,
	rkrcmar@redhat.com, like.xu@intel.com, jannh@google.com,
	arei.gonglei@huawei.com
Subject: Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack
Date: Thu, 20 Sep 2018 18:24:07 +0200	[thread overview]
Message-ID: <20180920162407.GA24124@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180920153035.GB10360@tassilo.jf.intel.com>

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.

That code is a wee bit magical and I didn't take the time to reverse
engineer that. It most certainly needs a comment.

  reply	other threads:[~2018-09-20 16:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20 10:05 [PATCH v3 0/5] Guest LBR Enabling Wei Wang
2018-09-20 10:05 ` [PATCH v3 1/5] perf/x86: add a function to get the lbr stack Wei Wang
2018-09-20 12:05   ` Peter Zijlstra
2018-09-20 12:07   ` Peter Zijlstra
2018-09-20 10:05 ` [PATCH v3 2/5] KVM/x86: KVM_CAP_X86_GUEST_LBR Wei Wang
2018-09-20 10:05 ` [PATCH v3 3/5] KVM/x86: expose MSR_IA32_PERF_CAPABILITIES to the guest Wei Wang
2018-09-20 12:38   ` Wei Wang
2018-09-20 10:05 ` [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack Wei Wang
2018-09-20 12:17   ` Peter Zijlstra
2018-09-20 12:32   ` Peter Zijlstra
2018-09-27 13:45     ` Wang, Wei W
2018-09-20 15:30   ` Andi Kleen
2018-09-20 16:24     ` Peter Zijlstra [this message]
2018-09-27 10:10       ` Wang, Wei W
2018-09-27 10:05     ` Wang, Wei W
2018-09-20 10:05 ` [PATCH v3 5/5] KVM/x86/lbr: lazy save " Wei Wang
2018-09-20 12:07   ` Gonglei (Arei)
2018-09-27 14:11     ` Wang, Wei W
2018-09-20 12:37   ` Peter Zijlstra
2018-09-20 12:58     ` Wei Wang
2018-09-20 12:57       ` Peter Zijlstra
2018-09-20 11:34 ` [PATCH v3 0/5] Guest LBR Enabling Gonglei (Arei)
2018-09-20 12:36   ` Wei Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180920162407.GA24124@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=ak@linux.intel.com \
    --cc=arei.gonglei@huawei.com \
    --cc=jannh@google.com \
    --cc=kan.liang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=wei.w.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).