Re: [PATCH 1/1] perf/x86: filter branches for PEBS event

Stephane Eranian
2015-03-27T15:28:45Z

On Fri, Mar 27, 2015 at 5:10 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Thu, Mar 26, 2015 at 12:40:14PM -0700, Stephane Eranian wrote:
>> You are addressing one of the problems of this routine. But I think
>> there is a more serious issue which is not addressed here. The
>> intel_shared_regs_constraints() assumes that the associated event is
>> necessarily unconstrained:
>>
>> __intel_shared_reg_get_constraints()
>> {
>> struct event_constraint *c = &emptyconstraint;
>> ...
>> }
>
> emptyconstraint != unconstrained.
>
> Note how that function only returns emptyconstraint if its rejecting the
> event, otherwise it returns NULL such that we continue calling
> x86_get_event_constraint().
>
Ah, yes, I had forgotten about that. Then everything is fine.

>> This is true for offcore_response, but for LBR this may not always be the case.
>> I may want to use LBR on the L1D_PEND_MISS event and it would need to
>> be on counter 2.
>
>> But I believe that the current code could place it on counter 0 simply
>> because you return if shared_reg_get_constraint() is successful, but
>> it looks only at the LBR constraint not the event constraint. I think
>> in the presence of LBR, you always need to call share_get_reg() and
>> x86_get_event_constraint().
>
> Which, I think it does.

Indeed.