Re: [PATCH V2 5/5] powerpc, perf: Enable branch stack sampling framework support with BHRB

2013-04-17 Thread Anshuman Khandual
On 04/17/2013 05:37 PM, Anshuman Khandual wrote:
> On 04/17/2013 12:38 PM, Michael Ellerman wrote:
>> On Tue, Apr 16, 2013 at 09:24:10PM +0530, Anshuman Khandual wrote:
>>> This patch provides basic enablement for perf branch stack sampling 
>>> framework
>>> on POWER8 processor with a new PMU feature called BHRB (Branch History 
>>> Rolling
>>> Buffer).
>>>
>>> Signed-off-by: Anshuman Khandual 
>>> ---
>>>  arch/powerpc/perf/core-book3s.c | 96 
>>> +++--
>>>  arch/powerpc/perf/perf_event_bhrb.c | 85 
>>>  2 files changed, 178 insertions(+), 3 deletions(-)
>>>  create mode 100644 arch/powerpc/perf/perf_event_bhrb.c
>>>
>>> diff --git a/arch/powerpc/perf/core-book3s.c 
>>> b/arch/powerpc/perf/core-book3s.c
>>> index 4ac6e64..f4d1347 100644
>>> --- a/arch/powerpc/perf/core-book3s.c
>>> +++ b/arch/powerpc/perf/core-book3s.c
>>> @@ -19,6 +19,8 @@
>>>  #include 
>>>  #include 
>>>  
>>> +#define BHRB_MAX_ENTRIES   32
>>> +
>>>  struct cpu_hw_events {
>>> int n_events;
>>> int n_percpu;
>>> @@ -38,11 +40,21 @@ struct cpu_hw_events {
>>>  
>>> unsigned int group_flag;
>>> int n_txn_start;
>>> +
>>> +   /* BHRB bits */
>>> +   u64 bhrb_filter;/* BHRB HW branch 
>>> filter */
>>> +   int bhrb_users;
>>> +   void*bhrb_context;
>>> +   struct  perf_branch_stack   bhrb_stack;
>>> +   struct  perf_branch_entry   bhrb_entries[BHRB_MAX_ENTRIES];
>>>  };
>>> +
>>>  DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
>>>  
>>>  struct power_pmu *ppmu;
>>>  
>>> +#include "perf_event_bhrb.c"
>>> +
>>
>> Um, why are you doing that?
>>
> 
> There was no specific reason for that.
> 

Ahh, I remember it now. The function in the new file uses "cpu_hw_events" 
structure
which is passed during "record_and_restart" data capture phase. Right now 
cpu_hw_events is
not defined in the header file but inside core-book3s.c itself. Solution to 
this problem
could be any of these.

(0) Move all the code from the new file perf_event_bhrb.c into core-book3s.c
(1) Move cpu_hw_events structure to perf_event_server.h
(2) Create additional BHRB processing function inside struct power_pmu and
define it for P8 inside power8_pmu.c

Regards
Anshuman

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH V2 5/5] powerpc, perf: Enable branch stack sampling framework support with BHRB

2013-04-17 Thread Anshuman Khandual
On 04/17/2013 12:38 PM, Michael Ellerman wrote:
> On Tue, Apr 16, 2013 at 09:24:10PM +0530, Anshuman Khandual wrote:
>> This patch provides basic enablement for perf branch stack sampling framework
>> on POWER8 processor with a new PMU feature called BHRB (Branch History 
>> Rolling
>> Buffer).
>>
>> Signed-off-by: Anshuman Khandual 
>> ---
>>  arch/powerpc/perf/core-book3s.c | 96 
>> +++--
>>  arch/powerpc/perf/perf_event_bhrb.c | 85 
>>  2 files changed, 178 insertions(+), 3 deletions(-)
>>  create mode 100644 arch/powerpc/perf/perf_event_bhrb.c
>>
>> diff --git a/arch/powerpc/perf/core-book3s.c 
>> b/arch/powerpc/perf/core-book3s.c
>> index 4ac6e64..f4d1347 100644
>> --- a/arch/powerpc/perf/core-book3s.c
>> +++ b/arch/powerpc/perf/core-book3s.c
>> @@ -19,6 +19,8 @@
>>  #include 
>>  #include 
>>  
>> +#define BHRB_MAX_ENTRIES32
>> +
>>  struct cpu_hw_events {
>>  int n_events;
>>  int n_percpu;
>> @@ -38,11 +40,21 @@ struct cpu_hw_events {
>>  
>>  unsigned int group_flag;
>>  int n_txn_start;
>> +
>> +/* BHRB bits */
>> +u64 bhrb_filter;/* BHRB HW branch 
>> filter */
>> +int bhrb_users;
>> +void*bhrb_context;
>> +struct  perf_branch_stack   bhrb_stack;
>> +struct  perf_branch_entry   bhrb_entries[BHRB_MAX_ENTRIES];
>>  };
>> +
>>  DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
>>  
>>  struct power_pmu *ppmu;
>>  
>> +#include "perf_event_bhrb.c"
>> +
> 
> Um, why are you doing that?
> 

There was no specific reason for that.

> If it's code that should be in a header, put it in a header. If it's C
> code, add it to the Makefile.

Sure I would get the new code in the Makefile. Thanks!

Regards
Anshuman

> 
> cheers
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH V2 5/5] powerpc, perf: Enable branch stack sampling framework support with BHRB

2013-04-17 Thread Michael Ellerman
On Tue, Apr 16, 2013 at 09:24:10PM +0530, Anshuman Khandual wrote:
> This patch provides basic enablement for perf branch stack sampling framework
> on POWER8 processor with a new PMU feature called BHRB (Branch History Rolling
> Buffer).
> 
> Signed-off-by: Anshuman Khandual 
> ---
>  arch/powerpc/perf/core-book3s.c | 96 
> +++--
>  arch/powerpc/perf/perf_event_bhrb.c | 85 
>  2 files changed, 178 insertions(+), 3 deletions(-)
>  create mode 100644 arch/powerpc/perf/perf_event_bhrb.c
> 
> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
> index 4ac6e64..f4d1347 100644
> --- a/arch/powerpc/perf/core-book3s.c
> +++ b/arch/powerpc/perf/core-book3s.c
> @@ -19,6 +19,8 @@
>  #include 
>  #include 
>  
> +#define BHRB_MAX_ENTRIES 32
> +
>  struct cpu_hw_events {
>   int n_events;
>   int n_percpu;
> @@ -38,11 +40,21 @@ struct cpu_hw_events {
>  
>   unsigned int group_flag;
>   int n_txn_start;
> +
> + /* BHRB bits */
> + u64 bhrb_filter;/* BHRB HW branch 
> filter */
> + int bhrb_users;
> + void*bhrb_context;
> + struct  perf_branch_stack   bhrb_stack;
> + struct  perf_branch_entry   bhrb_entries[BHRB_MAX_ENTRIES];
>  };
> +
>  DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
>  
>  struct power_pmu *ppmu;
>  
> +#include "perf_event_bhrb.c"
> +

Um, why are you doing that?

If it's code that should be in a header, put it in a header. If it's C
code, add it to the Makefile.

cheers
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev