RE: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-27 Thread Wang, Wei W
On Thursday, September 20, 2018 8:32 PM, Peter Zijlstra wrote: > On Thu, Sep 20, 2018 at 06:05:58PM +0800, Wei Wang wrote: > How do you deal with that situation, where the LBR is in use by a host event? I guess you were referring to this use case: "perf record -b qemu-system-x86_64..", where the

RE: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-27 Thread Wang, Wei W
On Thursday, September 20, 2018 8:32 PM, Peter Zijlstra wrote: > On Thu, Sep 20, 2018 at 06:05:58PM +0800, Wei Wang wrote: > How do you deal with that situation, where the LBR is in use by a host event? I guess you were referring to this use case: "perf record -b qemu-system-x86_64..", where the

RE: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-27 Thread Wang, Wei W
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

RE: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-27 Thread Wang, Wei W
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

RE: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-27 Thread Wang, Wei W
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, > > +

RE: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-27 Thread Wang, Wei W
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, > > +

Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-20 Thread Peter Zijlstra
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, > > +

Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-20 Thread Peter Zijlstra
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, > > +

Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-20 Thread Andi Kleen
> +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,

Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-20 Thread Andi Kleen
> +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,

Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-20 Thread Peter Zijlstra
On Thu, Sep 20, 2018 at 06:05:58PM +0800, Wei Wang wrote: > diff --git a/arch/x86/kvm/pmu_intel.c b/arch/x86/kvm/pmu_intel.c > index 5ab4a36..97a29d7 100644 > --- a/arch/x86/kvm/pmu_intel.c > +++ b/arch/x86/kvm/pmu_intel.c > @@ -342,6 +342,47 @@ static void intel_pmu_reset(struct kvm_vcpu *vcpu)

Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-20 Thread Peter Zijlstra
On Thu, Sep 20, 2018 at 06:05:58PM +0800, Wei Wang wrote: > diff --git a/arch/x86/kvm/pmu_intel.c b/arch/x86/kvm/pmu_intel.c > index 5ab4a36..97a29d7 100644 > --- a/arch/x86/kvm/pmu_intel.c > +++ b/arch/x86/kvm/pmu_intel.c > @@ -342,6 +342,47 @@ static void intel_pmu_reset(struct kvm_vcpu *vcpu)

Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-20 Thread Peter Zijlstra
On Thu, Sep 20, 2018 at 06:05:58PM +0800, Wei Wang wrote: > diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h > index 1562863..a91fdef 100644 > --- a/arch/x86/events/perf_event.h > +++ b/arch/x86/events/perf_event.h > @@ -223,6 +223,7 @@ struct cpu_hw_events { >*/ >

Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-20 Thread Peter Zijlstra
On Thu, Sep 20, 2018 at 06:05:58PM +0800, Wei Wang wrote: > diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h > index 1562863..a91fdef 100644 > --- a/arch/x86/events/perf_event.h > +++ b/arch/x86/events/perf_event.h > @@ -223,6 +223,7 @@ struct cpu_hw_events { >*/ >