Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1571459

Re: [PATCH 2/2] perf/x86/intel/pt: Allow disabling branch tracing

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] perf/x86/intel/pt: Allow disabling branch tracing
Date 2017-02-01 11:20 +0100
Message-ID <t60b9-4DF-41@gated-at.bofh.it> (permalink)
References <t4gDo-5Qo-19@gated-at.bofh.it> <t4gN5-5TS-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Alexander Shishkin <alexander.shishkin@linux.intel.com> wrote:

> Now that Intel PT supports more types of trace content than just branch
> tracing, it may be useful to allow the user to disable branch tracing
> when it is not needed.
> 
> The special case is BDW, where not setting BranchEn is not supported.
> 
> This patch adds 'no_branch' event format string to PT events, which
> will disable setting BranchEn bit in the hardware trace configuration.

> +	/* trying to unset BRANCH_EN where it is not supported */

Please capitalize comments consistently and use the typical tense. This one should 
be something like:

	/* Try to unset BRANCH_EN where it is not supported: */

>  
>  	reg = pt_config_filters(event);
> -	reg |= RTIT_CTL_TOPA | RTIT_CTL_BRANCH_EN | RTIT_CTL_TRACEEN;
> +	reg |= RTIT_CTL_TOPA | RTIT_CTL_TRACEEN;
> +
> +	/*
> +	 * Previously, we had BRANCH_EN on by default, but now that PT has
> +	 * grown features outside of branch tracing, it is useful to allow
> +	 * the user to disable it. So, to keep compatibility, setting
> +	 * BRANCH_EN bit in the event config (no_branch=1) will have the
> +	 * reverse effect and *not* set BRANCH_EN in the hardware
> +	 * configuration.
> +	 */
> +	if (!(event->attr.config & RTIT_CTL_BRANCH_EN))
> +		reg |= RTIT_CTL_BRANCH_EN;
> +	else
> +		event->attr.config &= ~RTIT_CTL_BRANCH_EN;


So I really hate this ABI hack - it's these unclean approaches how ABIs degrade 
over time, by death of a thousand cuts...

Any reason why we couldn't add a separate pt_feature_branch_disable and 
pt_feature_trace_disable bits and interpret them in a straightforward way, or 
something like that?

( This means two more bits, but that's our punishment for not anticipating 
  extensions to the hardware feature. )

Also, rename "RTIT_CTL_BRANCH_EN" to "RTIT_CTL_PT_EN" (but without changing the 
ABI), to more clearly express what that bit realy does.

I.e. we'd have a hierarchy of flags:

	- the old RTIT_CTL_BRANCH_EN bit (now RTIT_CTL_PT_EN) enables all of PT, 
	  with all features

	- individual feature disabling bits, which default to 0 (i.e. the feature 
	  is enabled) in the attr structure control the finegrained 
	  enabling/disabling of PT features. Currently there are two bits: 
	  pt_feature_branch_disable and pt_feature_branch_enable. More are added 
	  in the future if PT grows even more features.

or so?

Thanks,

	Ingo

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/2] perf/x86/intel/pt: Allow disabling branch tracing Ingo Molnar <mingo@kernel.org> - 2017-02-01 11:20 +0100
  Re: [PATCH 2/2] perf/x86/intel/pt: Allow disabling branch tracing Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-01 17:50 +0100
    Re: [PATCH 2/2] perf/x86/intel/pt: Allow disabling branch tracing Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-02 11:20 +0100
      [PATCH] perf/x86/intel/pt: Allow disabling branch tracing Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-06 15:50 +0100
        Re: [PATCH] perf/x86/intel/pt: Allow disabling branch tracing Andi Kleen <andi@firstfloor.org> - 2017-02-06 17:00 +0100
          Re: [PATCH] perf/x86/intel/pt: Allow disabling branch tracing Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-06 17:10 +0100
            Re: [PATCH] perf/x86/intel/pt: Allow disabling branch tracing Andi Kleen <andi@firstfloor.org> - 2017-02-06 18:20 +0100

csiph-web