All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Leach <mike.leach@linaro.org>
To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org,
	mathieu.poirier@linaro.org, linux-doc@vger.kernel.org,
	suzuki.poulose@arm.com
Cc: yabinc@google.com, corbet@lwn.net, leo.yan@linaro.org,
	alexander.shishkin@linux.intel.com, tingwei@codeaurora.org,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	Mike Leach <mike.leach@linaro.org>
Subject: [PATCH v7 06/10] coresight: etm-perf: Update to activate selected configuration
Date: Wed, 14 Apr 2021 20:18:59 +0100	[thread overview]
Message-ID: <20210414191903.18349-7-mike.leach@linaro.org> (raw)
In-Reply-To: <20210414191903.18349-1-mike.leach@linaro.org>

Add calls to activate the selected configuration as perf starts
and stops the tracing session.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 14 +++++++++++++-
 drivers/hwtracing/coresight/coresight-etm-perf.h |  2 ++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 26b4bca156aa..560baefdfed8 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -215,6 +215,10 @@ static void free_event_data(struct work_struct *work)
 	/* Free the sink buffers, if there are any */
 	free_sink_buffer(event_data);
 
+	/* clear any configuration we were using */
+	if (event_data->cfg_hash)
+		cscfg_deactivate_config(event_data->cfg_hash);
+
 	for_each_cpu(cpu, mask) {
 		struct list_head **ppath;
 
@@ -292,7 +296,7 @@ static bool sinks_compatible(struct coresight_device *a,
 static void *etm_setup_aux(struct perf_event *event, void **pages,
 			   int nr_pages, bool overwrite)
 {
-	u32 id;
+	u32 id, cfg_hash;
 	int cpu = event->cpu;
 	cpumask_t *mask;
 	struct coresight_device *sink = NULL;
@@ -310,6 +314,14 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
 		sink = user_sink = coresight_get_sink_by_id(id);
 	}
 
+	/* check if user wants a coresight configuration selected */
+	cfg_hash = (u32)((event->attr.config2 & GENMASK_ULL(63, 32)) >> 32);
+	if (cfg_hash) {
+		if (cscfg_activate_config(cfg_hash))
+			goto err;
+		event_data->cfg_hash = cfg_hash;
+	}
+
 	mask = &event_data->mask;
 
 	/*
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h
index ba617fe2217e..468f7799ab4f 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.h
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.h
@@ -49,12 +49,14 @@ struct etm_filters {
  * @work:		Handle to free allocated memory outside IRQ context.
  * @mask:		Hold the CPU(s) this event was set for.
  * @snk_config:		The sink configuration.
+ * @cfg_hash:		The hash id of any coresight config selected.
  * @path:		An array of path, each slot for one CPU.
  */
 struct etm_event_data {
 	struct work_struct work;
 	cpumask_t mask;
 	void *snk_config;
+	u32 cfg_hash;
 	struct list_head * __percpu *path;
 };
 
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Mike Leach <mike.leach@linaro.org>
To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org,
	mathieu.poirier@linaro.org, linux-doc@vger.kernel.org,
	suzuki.poulose@arm.com
Cc: yabinc@google.com, corbet@lwn.net, leo.yan@linaro.org,
	alexander.shishkin@linux.intel.com, tingwei@codeaurora.org,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	Mike Leach <mike.leach@linaro.org>
Subject: [PATCH v7 06/10] coresight: etm-perf: Update to activate selected configuration
Date: Wed, 14 Apr 2021 20:18:59 +0100	[thread overview]
Message-ID: <20210414191903.18349-7-mike.leach@linaro.org> (raw)
In-Reply-To: <20210414191903.18349-1-mike.leach@linaro.org>

Add calls to activate the selected configuration as perf starts
and stops the tracing session.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 14 +++++++++++++-
 drivers/hwtracing/coresight/coresight-etm-perf.h |  2 ++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 26b4bca156aa..560baefdfed8 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -215,6 +215,10 @@ static void free_event_data(struct work_struct *work)
 	/* Free the sink buffers, if there are any */
 	free_sink_buffer(event_data);
 
+	/* clear any configuration we were using */
+	if (event_data->cfg_hash)
+		cscfg_deactivate_config(event_data->cfg_hash);
+
 	for_each_cpu(cpu, mask) {
 		struct list_head **ppath;
 
@@ -292,7 +296,7 @@ static bool sinks_compatible(struct coresight_device *a,
 static void *etm_setup_aux(struct perf_event *event, void **pages,
 			   int nr_pages, bool overwrite)
 {
-	u32 id;
+	u32 id, cfg_hash;
 	int cpu = event->cpu;
 	cpumask_t *mask;
 	struct coresight_device *sink = NULL;
@@ -310,6 +314,14 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
 		sink = user_sink = coresight_get_sink_by_id(id);
 	}
 
+	/* check if user wants a coresight configuration selected */
+	cfg_hash = (u32)((event->attr.config2 & GENMASK_ULL(63, 32)) >> 32);
+	if (cfg_hash) {
+		if (cscfg_activate_config(cfg_hash))
+			goto err;
+		event_data->cfg_hash = cfg_hash;
+	}
+
 	mask = &event_data->mask;
 
 	/*
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h
index ba617fe2217e..468f7799ab4f 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.h
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.h
@@ -49,12 +49,14 @@ struct etm_filters {
  * @work:		Handle to free allocated memory outside IRQ context.
  * @mask:		Hold the CPU(s) this event was set for.
  * @snk_config:		The sink configuration.
+ * @cfg_hash:		The hash id of any coresight config selected.
  * @path:		An array of path, each slot for one CPU.
  */
 struct etm_event_data {
 	struct work_struct work;
 	cpumask_t mask;
 	void *snk_config;
+	u32 cfg_hash;
 	struct list_head * __percpu *path;
 };
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-04-14 19:19 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 19:18 [PATCH v7 00/10] CoreSight configuration management; ETM strobing Mike Leach
2021-04-14 19:18 ` Mike Leach
2021-04-14 19:18 ` [PATCH v7 01/10] coresight: syscfg: Initial coresight system configuration Mike Leach
2021-04-14 19:18   ` Mike Leach
2021-04-14 19:18 ` [PATCH v7 02/10] coresight: syscfg: Add registration and feature loading for cs devices Mike Leach
2021-04-14 19:18   ` Mike Leach
2021-04-14 19:18 ` [PATCH v7 03/10] coresight: config: Add configuration and feature generic functions Mike Leach
2021-04-14 19:18   ` Mike Leach
2021-04-14 19:18 ` [PATCH v7 04/10] coresight: etm-perf: update to handle configuration selection Mike Leach
2021-04-14 19:18   ` Mike Leach
2021-04-14 19:18 ` [PATCH v7 05/10] coresight: syscfg: Add API to activate and enable configurations Mike Leach
2021-04-14 19:18   ` Mike Leach
2021-06-10 11:05   ` Branislav Rankov
2021-06-10 11:05     ` Branislav Rankov
2021-06-14 17:02     ` Mathieu Poirier
2021-06-14 17:02       ` Mathieu Poirier
2021-06-25 14:37       ` Mike Leach
2021-06-25 14:37         ` Mike Leach
2021-06-25 15:09         ` Suzuki K Poulose
2021-06-25 15:09           ` Suzuki K Poulose
2021-06-28 13:31           ` Mike Leach
2021-06-28 13:31             ` Mike Leach
2021-06-28 19:56         ` Mathieu Poirier
2021-06-28 19:56           ` Mathieu Poirier
2021-06-29  9:37           ` Mike Leach
2021-06-29  9:37             ` Mike Leach
2021-04-14 19:18 ` Mike Leach [this message]
2021-04-14 19:18   ` [PATCH v7 06/10] coresight: etm-perf: Update to activate selected configuration Mike Leach
2021-04-14 19:19 ` [PATCH v7 07/10] coresight: etm4x: Add complex configuration handlers to etmv4 Mike Leach
2021-04-14 19:19   ` Mike Leach
2021-04-14 19:19 ` [PATCH v7 08/10] coresight: config: Add preloaded configurations Mike Leach
2021-04-14 19:19   ` Mike Leach
2021-04-14 19:19 ` [PATCH v7 09/10] coresight: syscfg: Add initial configfs support Mike Leach
2021-04-14 19:19   ` Mike Leach
2021-04-14 19:19 ` [PATCH v7 10/10] Documentation: coresight: Add documentation for CoreSight config Mike Leach
2021-04-14 19:19   ` Mike Leach
2021-04-15 21:27 ` [PATCH v7 00/10] CoreSight configuration management; ETM strobing Mathieu Poirier
2021-04-15 21:27   ` Mathieu Poirier

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=20210414191903.18349-7-mike.leach@linaro.org \
    --to=mike.leach@linaro.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=coresight@lists.linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=leo.yan@linaro.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=suzuki.poulose@arm.com \
    --cc=tingwei@codeaurora.org \
    --cc=yabinc@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.