Re: [PATCH V8 04/10] powerpc, perf: Re organize PMU based branch filter processing in POWER8

2015-06-10 Thread Anshuman Khandual
On 06/10/2015 10:37 AM, Daniel Axtens wrote:
 
  /* Every thing else is unsupported */
  return -1;
 You're returning -1 as a unsigned 64bit number. Other code that reads
 this value tests for -1 and I think it works everywhere just because it
 wraps around consistently. But I would still rather not do this and I'm
 surprised it doesn't throw a warning.

Thats the existing code which is going away with this patch series.


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

Re: [PATCH V8 04/10] powerpc, perf: Re organize PMU based branch filter processing in POWER8

2015-06-09 Thread Daniel Axtens

   /* Every thing else is unsupported */
   return -1;
You're returning -1 as a unsigned 64bit number. Other code that reads
this value tests for -1 and I think it works everywhere just because it
wraps around consistently. But I would still rather not do this and I'm
surprised it doesn't throw a warning.

Regards,
Daniel


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH V8 04/10] powerpc, perf: Re organize PMU based branch filter processing in POWER8

2015-06-08 Thread Anshuman Khandual
This patch does some code re-arrangements to make it clear that it ignores
any separate privilege level branch filter request and does not support
any combinations of HW PMU branch filters.

Signed-off-by: Anshuman Khandual khand...@linux.vnet.ibm.com
---
 arch/powerpc/perf/power8-pmu.c | 22 +++---
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c
index 396351d..a6c6a2c 100644
--- a/arch/powerpc/perf/power8-pmu.c
+++ b/arch/powerpc/perf/power8-pmu.c
@@ -656,8 +656,6 @@ static int power8_generic_events[] = {
 
 static u64 power8_bhrb_filter_map(u64 branch_sample_type)
 {
-   u64 pmu_bhrb_filter = 0;
-
/* BHRB and regular PMU events share the same privilege state
 * filter configuration. BHRB is always recorded along with a
 * regular PMU event. As the privilege state filter is handled
@@ -665,21 +663,15 @@ static u64 power8_bhrb_filter_map(u64 branch_sample_type)
 * PMU event, we ignore any separate BHRB specific request.
 */
 
-   /* No branch filter requested */
-   if (branch_sample_type  PERF_SAMPLE_BRANCH_ANY)
-   return pmu_bhrb_filter;
-
-   /* Invalid branch filter options - HW does not support */
-   if (branch_sample_type  PERF_SAMPLE_BRANCH_ANY_RETURN)
-   return -1;
+   /* Ignore user, kernel, hv bits */
+   branch_sample_type = ~PERF_SAMPLE_BRANCH_PLM_ALL;
 
-   if (branch_sample_type  PERF_SAMPLE_BRANCH_IND_CALL)
-   return -1;
+   /* No branch filter requested */
+   if (branch_sample_type == PERF_SAMPLE_BRANCH_ANY)
+   return 0;
 
-   if (branch_sample_type  PERF_SAMPLE_BRANCH_ANY_CALL) {
-   pmu_bhrb_filter |= POWER8_MMCRA_IFM1;
-   return pmu_bhrb_filter;
-   }
+   if (branch_sample_type == PERF_SAMPLE_BRANCH_ANY_CALL)
+   return POWER8_MMCRA_IFM1;
 
/* Every thing else is unsupported */
return -1;
-- 
2.1.0

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