Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Andi Kleen
I ran into a similar problem with my PEBS virtualization patchkit. My solution was: basically schedule as normal, but tell the scheduler to force allocate a counter on a specific index. It can be done only with a few lines of change in the scheduler code. -Andi

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Andi Kleen
I ran into a similar problem with my PEBS virtualization patchkit. My solution was: basically schedule as normal, but tell the scheduler to force allocate a counter on a specific index. It can be done only with a few lines of change in the scheduler code. -Andi

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Peter Zijlstra
Please; don't send malformed emails like this. Lines wrap at 78 chars. On Mon, Nov 05, 2018 at 03:37:24PM +, Wang, Wei W wrote: > On Monday, November 5, 2018 8:14 PM, Peter Zijlstra wrote: > > That can only work if the host counter has perf_event_attr::exclude_guest=1, > > any counter

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Peter Zijlstra
Please; don't send malformed emails like this. Lines wrap at 78 chars. On Mon, Nov 05, 2018 at 03:37:24PM +, Wang, Wei W wrote: > On Monday, November 5, 2018 8:14 PM, Peter Zijlstra wrote: > > That can only work if the host counter has perf_event_attr::exclude_guest=1, > > any counter

RE: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Wang, Wei W
On Monday, November 5, 2018 8:14 PM, Peter Zijlstra wrote: > The answer for PEBS is really simple; PEBS does not virtualize (Andi tried and > can tell you why; IIRC it has something to do with how the hardware asks for > a Linear Address instead of a Physical Address). So the problem will not >

RE: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Wang, Wei W
On Monday, November 5, 2018 8:14 PM, Peter Zijlstra wrote: > The answer for PEBS is really simple; PEBS does not virtualize (Andi tried and > can tell you why; IIRC it has something to do with how the hardware asks for > a Linear Address instead of a Physical Address). So the problem will not >

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Peter Zijlstra
On Mon, Nov 05, 2018 at 07:19:01PM +0800, Wei Wang wrote: > On 11/05/2018 05:34 PM, Peter Zijlstra wrote: > > On Fri, Nov 02, 2018 at 05:08:31PM +0800, Wei Wang wrote: > > > On 11/01/2018 10:52 PM, Peter Zijlstra wrote: > > > > > @@ -723,6 +724,9 @@ static void perf_sched_init(struct perf_sched >

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Peter Zijlstra
On Mon, Nov 05, 2018 at 07:19:01PM +0800, Wei Wang wrote: > On 11/05/2018 05:34 PM, Peter Zijlstra wrote: > > On Fri, Nov 02, 2018 at 05:08:31PM +0800, Wei Wang wrote: > > > On 11/01/2018 10:52 PM, Peter Zijlstra wrote: > > > > > @@ -723,6 +724,9 @@ static void perf_sched_init(struct perf_sched >

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Wei Wang
On 11/05/2018 05:34 PM, Peter Zijlstra wrote: On Fri, Nov 02, 2018 at 05:08:31PM +0800, Wei Wang wrote: On 11/01/2018 10:52 PM, Peter Zijlstra wrote: @@ -723,6 +724,9 @@ static void perf_sched_init(struct perf_sched *sched, struct event_constraint ** sched->max_weight= wmax;

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Wei Wang
On 11/05/2018 05:34 PM, Peter Zijlstra wrote: On Fri, Nov 02, 2018 at 05:08:31PM +0800, Wei Wang wrote: On 11/01/2018 10:52 PM, Peter Zijlstra wrote: @@ -723,6 +724,9 @@ static void perf_sched_init(struct perf_sched *sched, struct event_constraint ** sched->max_weight= wmax;

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Peter Zijlstra
On Fri, Nov 02, 2018 at 05:08:31PM +0800, Wei Wang wrote: > On 11/01/2018 10:52 PM, Peter Zijlstra wrote: > > > @@ -723,6 +724,9 @@ static void perf_sched_init(struct perf_sched *sched, > > > struct event_constraint ** > > > sched->max_weight = wmax; > > > sched->max_gp

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-05 Thread Peter Zijlstra
On Fri, Nov 02, 2018 at 05:08:31PM +0800, Wei Wang wrote: > On 11/01/2018 10:52 PM, Peter Zijlstra wrote: > > > @@ -723,6 +724,9 @@ static void perf_sched_init(struct perf_sched *sched, > > > struct event_constraint ** > > > sched->max_weight = wmax; > > > sched->max_gp

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-02 Thread Wei Wang
On 11/01/2018 10:52 PM, Peter Zijlstra wrote: On Thu, Nov 01, 2018 at 06:04:01PM +0800, Wei Wang wrote: Add x86_perf_mask_perf_counters to reserve counters from the host perf subsystem. The masked counters will not be assigned to any host perf events. This can be used by the hypervisor to

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-02 Thread Wei Wang
On 11/01/2018 10:52 PM, Peter Zijlstra wrote: On Thu, Nov 01, 2018 at 06:04:01PM +0800, Wei Wang wrote: Add x86_perf_mask_perf_counters to reserve counters from the host perf subsystem. The masked counters will not be assigned to any host perf events. This can be used by the hypervisor to

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-01 Thread Peter Zijlstra
On Thu, Nov 01, 2018 at 06:04:01PM +0800, Wei Wang wrote: > Add x86_perf_mask_perf_counters to reserve counters from the host perf > subsystem. The masked counters will not be assigned to any host perf > events. This can be used by the hypervisor to reserve perf counters for > a guest to use. > >

Re: [PATCH v1 1/8] perf/x86: add support to mask counters from host

2018-11-01 Thread Peter Zijlstra
On Thu, Nov 01, 2018 at 06:04:01PM +0800, Wei Wang wrote: > Add x86_perf_mask_perf_counters to reserve counters from the host perf > subsystem. The masked counters will not be assigned to any host perf > events. This can be used by the hypervisor to reserve perf counters for > a guest to use. > >