public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, adrian.hunter@intel.com,
	x86@kernel.org, hpa@zytor.com, acme@infradead.org
Subject: Re: [PATCH 1/3] perf/x86/intel/pt: Add new timing packet enables
Date: Thu, 30 Jul 2015 12:40:46 +0200	[thread overview]
Message-ID: <20150730104046.GV19282@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1437140050-23363-2-git-send-email-alexander.shishkin@linux.intel.com>

On Fri, Jul 17, 2015 at 04:34:08PM +0300, Alexander Shishkin wrote:
> +#define PT_CONFIG_MASK (RTIT_CTL_TSC_EN     |	\
> +			RTIT_CTL_DISRETC    |	\
> +			RTIT_CTL_CYCLEACC   |	\
> +			RTIT_CTL_MTC_EN     |	\
> +			RTIT_CTL_MTC_RANGE  |	\
> +			RTIT_CTL_CYC_THRESH |   \
> +			RTIT_CTL_PSB_FREQ)
>  

#define RTIT_CTL_CYC (RTIT_CTL_CYCLEACC   | \
		      RTIT_CTL_CYC_THRESH | \
		      RTIT_CTL_PSB_FREQ)

#define RTIT_CTL_MTC (RTIT_CTL_MTC_EN | \
		      RTIT_CTL_MTC_RANGE)

#define PT_CONFIG_MASK (RTIT_CTL_TSC_EN     | \
			RTIT_CTL_DISRETC    | \
			RTIT_CTL_CYC	    | \
			RTIT_CTL_MTC)

>  static bool pt_event_valid(struct perf_event *event)
>  {
>  	u64 config = event->attr.config;
> +	u64 allowed, requested;
>  
>  	if ((config & PT_CONFIG_MASK) != config)
>  		return false;
>  
> +	if (config &
> +	    (RTIT_CTL_CYCLEACC | RTIT_CTL_CYC_THRESH | RTIT_CTL_PSB_FREQ)) {

	if (config & RTIT_CTL_CYC) {

> +		if (!pt_cap_get(PT_CAP_psb_cyc))
> +			return false;
> +
> +		allowed = pt_cap_get(PT_CAP_psb_periods);
> +		requested = (config & RTIT_CTL_PSB_FREQ) >>
> +			RTIT_CTL_PSB_FREQ_OFFSET;
> +		if (requested && (!(allowed & BIT(requested))))
> +			return false;
> +
> +		allowed = pt_cap_get(PT_CAP_cycle_thresholds);
> +		requested = (config & RTIT_CTL_CYC_THRESH) >>
> +			RTIT_CTL_CYC_THRESH_OFFSET;
> +		if (requested && (!(allowed & BIT(requested))))
> +			return false;
> +	}
> +
> +	if (config & (RTIT_CTL_MTC_EN | RTIT_CTL_MTC_RANGE)) {

	if (config & RTIT_CTL_MTC) {

> +		allowed = pt_cap_get(PT_CAP_mtc_periods);
> +
> +		if (!allowed)
> +			return false;
> +
> +		requested = (config & RTIT_CTL_MTC_RANGE) >>
> +			RTIT_CTL_MTC_RANGE_OFFSET;
> +
> +		if (!(allowed & BIT(requested)))
> +			return false;
> +	}
> +
>  	return true;
>  }

Would that make sense?

  reply	other threads:[~2015-07-30 10:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-17 13:34 [PATCH 0/3] perf/x86/intel/pt: Add new packet enables Alexander Shishkin
2015-07-17 13:34 ` [PATCH 1/3] perf/x86/intel/pt: Add new timing " Alexander Shishkin
2015-07-30 10:40   ` Peter Zijlstra [this message]
2015-07-30 11:57     ` Alexander Shishkin
2015-07-30 12:14       ` Peter Zijlstra
2015-07-30 13:15         ` [PATCH v1] " Alexander Shishkin
2015-08-04  8:55           ` [tip:perf/core] " tip-bot for Alexander Shishkin
2015-07-17 13:34 ` [PATCH 2/3] perf/x86/intel/pt: Add an option to not force PSB+ on every schedule-in Alexander Shishkin
2015-07-30 10:43   ` Peter Zijlstra
2015-07-30 11:53     ` Alexander Shishkin
2015-07-30 12:13       ` Peter Zijlstra
2015-07-30 12:49         ` Alexander Shishkin
2015-07-30 13:36           ` Alexander Shishkin
2015-07-30 13:48         ` [PATCH v1] perf/x86/intel/pt: Do not force sync packets " Alexander Shishkin
2015-07-30 15:24           ` Alexander Shishkin
2015-08-04  8:55           ` [tip:perf/core] " tip-bot for Alexander Shishkin
2015-07-31 11:47         ` [PATCH v2] " Alexander Shishkin
2015-07-17 13:34 ` [PATCH 3/3] perf/x86/intel/bts: Set itrace_started in pmu::start to match the new logic Alexander Shishkin
2015-09-08 12:02   ` Alexander Shishkin
2015-09-08 12:28     ` Peter Zijlstra
2015-09-13 10:56   ` [tip:perf/core] perf/x86/intel/bts: Set event-> hw.itrace_started " tip-bot for Alexander Shishkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150730104046.GV19282@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@infradead.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox