mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>,
	gregkh@linuxfoundation.org, a.p.zijlstra@chello.nl,
	acme@kernel.org, mingo@redhat.com, corbet@lwn.net
Cc: adrian.hunter@intel.com, zhang.chunyan@linaro.org,
	mike.leach@arm.com, tor@ti.com, al.grant@arm.com,
	pawel.moll@arm.com, linux-arm-kernel@lists.infradead.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 19/20] coresight: etm3x: implementing perf's user/kernel mode
Date: Wed, 30 Sep 2015 13:16:15 +0300	[thread overview]
Message-ID: <87mvw4jjps.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <1442593594-10665-20-git-send-email-mathieu.poirier@linaro.org>

Mathieu Poirier <mathieu.poirier@linaro.org> writes:

> Configure tracers in accordance with the specification conveyed
> by the perf cmd line tool.  For example if only user space is
> requested, configure the address range comparator with the kerne's
> address range and set the 'exclude' bit, which will result in
> tracing everything except the kernel.
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
>  drivers/hwtracing/coresight/coresight-etm3x.c | 36 +++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c
> index 077b49714259..2f818dbde099 100644
> --- a/drivers/hwtracing/coresight/coresight-etm3x.c
> +++ b/drivers/hwtracing/coresight/coresight-etm3x.c
> @@ -320,6 +320,41 @@ static int etm_parse_event_config(struct etm_drvdata *drvdata,
>  {
>  	u64 config = event->attr.config;
>  
> +	if (event->attr.exclude_kernel || event->attr.exclude_user) {
> +		u32 event_encoding;
> +		u32 flags = (1 << 0 | /* instruction execute*/
> +			     3 << 3 | /* ARM instruction */
> +			     0 << 5 | /* No data value comparison */
> +			     0 << 7 | /* No exact mach */
> +			     0 << 8 | /* Ignore context ID */
> +			     0 << 10); /* Security ignored */
> +
> +		/* Bit 0 is address range comparator 1 */
> +		drvdata->enable_ctrl1 = ETMTECR1_ADDR_COMP_1;
> +
> +		/* Bit 24 controls whether the address range should be
> +		 * included or excluded.
> +		 */
> +		if (event->attr.exclude_kernel)
> +			drvdata->enable_ctrl1 |= BIT(24);

Isn't there a privilege level based filtering (OS/USR) in ETM? Shouldn't
ETMACTRn[10:12] have a setting for that?

> +
> +		/* No need to worry about single address comparators */
> +		drvdata->enable_ctrl2 = 0x0;
> +
> +		drvdata->addr_val[0] = (u32) _stext;
> +		drvdata->addr_val[1] = (u32) _etext;

This doesn't cover kernel modules, afaict.

> +		drvdata->addr_acctype[0] = flags;
> +		drvdata->addr_acctype[1] = flags;
> +		drvdata->addr_type[0] = ETM_ADDR_TYPE_RANGE;
> +		drvdata->addr_type[1] = ETM_ADDR_TYPE_RANGE;
> +
> +		event_encoding = 0x00 << 14 | /* Boolean function select A */
> +				 0x01 << 4  | /* Addr range comparator 0-7 */
> +				 0x00 << 0;   /* Addr range comparator 1 */
> +
> +		drvdata->enable_event = event_encoding;
> +	}
> +
>  	/*
>  	 * At this time only cycle accurate and timestamp options are
>  	 * available.  As such clear everything else that may have been
> @@ -362,6 +397,7 @@ static void etm_configure_cpu(void *info)
>  	etm_writel(drvdata, drvdata->startstop_ctrl, ETMTSSCR);
>  	etm_writel(drvdata, drvdata->enable_event, ETMTEEVR);
>  	etm_writel(drvdata, drvdata->enable_ctrl1, ETMTECR1);
> +	etm_writel(drvdata, drvdata->enable_ctrl2, ETMTECR2);
>  	etm_writel(drvdata, drvdata->fifofull_level, ETMFFLR);
>  	for (i = 0; i < drvdata->nr_addr_cmp; i++) {
>  		etm_writel(drvdata, drvdata->addr_val[i], ETMACVRn(i));
> -- 
> 1.9.1

  reply	other threads:[~2015-09-30 10:16 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18 16:26 [RFC PATCH 00/20] Coresight integration with perf Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 01/20] coresight: etm3x: splitting 'etm_enable_hw()' operations Mathieu Poirier
2015-09-30  9:58   ` Alexander Shishkin
2015-10-01 22:26     ` Mathieu Poirier
2015-10-02  4:40       ` Alexander Shishkin
2015-09-18 16:26 ` [RFC PATCH 02/20] coresight: etm3x: implementing 'is_enabled()' API Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 03/20] coresight: etm3x: implementing 'cpu_id()' API Mathieu Poirier
2015-09-30 11:16   ` Alexander Shishkin
2015-10-01 22:43     ` Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 04/20] coresight: etm3x: using chip logic to start/stop traces Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 05/20] coresight: etm3x: adapting default tracer setting for perf Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 06/20] coresight: etm3x: unlocking tracer in default arch init Mathieu Poirier
2015-09-30 11:33   ` Alexander Shishkin
2015-10-01 22:42     ` Mathieu Poirier
2015-10-02  4:47       ` Alexander Shishkin
2015-10-02 17:17         ` Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 07/20] coresight: etb10: implementing the setup_aux() API Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 08/20] coresight: etb10: implementing buffer set and unset APIs Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 09/20] coresight: etb10: implementing buffer update API Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 10/20] coresight: etb10: adding snapshot mode feature Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 11/20] coresight: making coresight_build_paths() public Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 12/20] coresight: keeping track of enabled sink buffers Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 13/20] coresight: etm-perf: new PMU driver for ETM tracers Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 14/20] coresight: etm-perf: implementing 'event_init()' API Mathieu Poirier
2015-09-22 14:29   ` Alexander Shishkin
2015-09-28 21:22     ` Mathieu Poirier
2015-09-30  9:43       ` Alexander Shishkin
2015-10-02 16:52         ` Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 15/20] coresight: etm-perf: implementing 'setup_aux()' API Mathieu Poirier
2015-09-30 11:50   ` Alexander Shishkin
2015-10-01 22:49     ` Mathieu Poirier
2015-10-02  4:50       ` Alexander Shishkin
2015-09-18 16:26 ` [RFC PATCH 16/20] coresight: etm-perf: implementing trace related APIs Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 17/20] coresight: etm-perf: adding symbolic link for CPUs Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 18/20] coresight: etm3x: pushing down perf configuration to tracer Mathieu Poirier
2015-09-30 12:45   ` Alexander Shishkin
2015-09-18 16:26 ` [RFC PATCH 19/20] coresight: etm3x: implementing perf's user/kernel mode Mathieu Poirier
2015-09-30 10:16   ` Alexander Shishkin [this message]
2015-10-01 23:16     ` Mathieu Poirier
2015-09-18 16:26 ` [RFC PATCH 20/20] coresight: updating documentation to reflect integration with perf Mathieu Poirier
2015-09-19 10:09   ` Ingo Molnar
2015-09-30  8:52 ` [RFC PATCH 00/20] Coresight " Alexander Shishkin
2015-10-01 22:07   ` Mathieu Poirier
2015-10-02  4:53     ` Alexander Shishkin
2015-10-02 15:27       ` Mathieu Poirier
2015-09-30  9:01 ` Alexander Shishkin
2015-10-01 22:12   ` Mathieu Poirier
2015-09-30 10:18 ` 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=87mvw4jjps.fsf@ashishki-desk.ger.corp.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=al.grant@arm.com \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@arm.com \
    --cc=mingo@redhat.com \
    --cc=pawel.moll@arm.com \
    --cc=tor@ti.com \
    --cc=zhang.chunyan@linaro.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

all inboxes | Powered by JetHome®