Re: [PATCH V4 09/10] power8, perf: Change BHRB branch filterconfiguration

From: Michael Ellerman
Date: Tue Dec 17 2013 - 19:08:14 EST


On Fri, 2013-12-13 at 13:50 +0530, Anshuman Khandual wrote:
> On 12/09/2013 11:51 AM, Michael Ellerman wrote:
> >
> > As I said in my comments on version 3 which you ignored:
> >
> > I think it would be clearer if we actually checked for the possibilities we
> > allow and let everything else fall through, eg:
> >
> > Ã Ã Ã Ã Ã Ã Ã Ã /* Ignore user/kernel/hv bits */
> > Ã Ã Ã Ã Ã Ã Ã Ã branch_sample_type &= ~PERF_SAMPLE_BRANCH_PLM_ALL;
> >
> > Ã Ã Ã Ã Ã Ã Ã Ã if (branch_sample_type == PERF_SAMPLE_BRANCH_ANY)
> > Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã return 0;
> >
> > Ã Ã Ã Ã Ã Ã Ã Ã if (branch_sample_type == PERF_SAMPLE_BRANCH_ANY_CALL)
> > Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã return POWER8_MMCRA_IFM1;
> > Ã
> > Ã Ã Ã Ã Ã Ã Ã Ã if (branch_sample_type == PERF_SAMPLE_BRANCH_COND)
> > Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã return POWER8_MMCRA_IFM3;
> > Ã Ã Ã Ã Ã Ã Ã Ã
> > Ã Ã Ã Ã Ã Ã Ã Ã return -1;
> >
>
> Hey Michael,
>
> This patch only adds support for the PERF_SAMPLE_BRANCH_COND filter, if the
> over all code flow does not clearly suggest that all combinations of any of
> these HW filters are invalid, then we can go with one more patch to clean
> that up before or after this patch but not here in this patch. Finally the
> code section here will look something like this. Does it sound good ?

Better, but not quite.

> 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
> * in the basic PMC configuration of the accompanying regular
> * PMU event, we ignore any separate BHRB specific request.
> */
>
> /* Ignore user, kernel, hv bits */
> branch_sample_type &= ~PERF_SAMPLE_BRANCH_PLM_ALL;
>
> if (branch_sample_type == PERF_SAMPLE_BRANCH_ANY)
> return pmu_bhrb_filter;

return 0;

>
>
> if (branch_sample_type == PERF_SAMPLE_BRANCH_ANY_CALL) {
> pmu_bhrb_filter |= POWER8_MMCRA_IFM1;
> return pmu_bhrb_filter;

return POWER8_MMCRA_IFM1;

> }
>
> if (branch_sample_type == PERF_SAMPLE_BRANCH_COND) {
> pmu_bhrb_filter |= POWER8_MMCRA_IFM3;
> return pmu_bhrb_filter;

return POWER8_MMCRA_IFM3;

> }
>
> /* Every thing else is unsupported */
> return -1;
> }

cheers


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/