All of 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
Cc: Mike Leach <mike.leach@linaro.org>,
	acme@kernel.org, suzuki.poulose@arm.com
Subject: [PATCH v4 4/5] coresight: etm: perf: Add default sink selection to etm perf
Date: Tue, 26 May 2020 11:46:41 +0100	[thread overview]
Message-ID: <20200526104642.9526-5-mike.leach@linaro.org> (raw)
In-Reply-To: <20200526104642.9526-1-mike.leach@linaro.org>

Add default sink selection to the perf trace handling in the etm driver.
Uses the select default sink infrastructure to select a sink for the perf
session, if no other sink is specified.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
---
 .../hwtracing/coresight/coresight-etm-perf.c    | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 84f1dcb69827..1a3169e69bb1 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -226,9 +226,6 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
 		sink = coresight_get_enabled_sink(true);
 	}
 
-	if (!sink)
-		goto err;
-
 	mask = &event_data->mask;
 
 	/*
@@ -253,6 +250,16 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
 			continue;
 		}
 
+		/*
+		 * No sink provided - look for a default sink for one of the
+		 * devices. At present we only support topology where all CPUs
+		 * use the same sink [N:1], so only need to find one sink. The
+		 * coresight_build_path later will remove any CPU that does not
+		 * attach to the sink, or if we have not found a sink.
+		 */
+		if (!sink)
+			sink = coresight_find_default_sink(csdev);
+
 		/*
 		 * Building a path doesn't enable it, it simply builds a
 		 * list of devices from source to sink that can be
@@ -267,6 +274,10 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
 		*etm_event_cpu_path_ptr(event_data, cpu) = path;
 	}
 
+	/* no sink found for any CPU - cannot trace */
+	if (!sink)
+		goto err;
+
 	/* If we don't have any CPUs ready for tracing, abort */
 	cpu = cpumask_first(mask);
 	if (cpu >= nr_cpu_ids)
-- 
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:[~2020-05-26 10:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 10:46 [PATCH v4 0/5] Update CoreSight infrastructure to select a default sink Mike Leach
2020-05-26 10:46 ` [PATCH v4 1/5] coresight: Fix comment in main header file Mike Leach
2020-05-26 14:49   ` Suzuki K Poulose
2020-06-04 21:14   ` Mathieu Poirier
2020-05-26 10:46 ` [PATCH v4 2/5] coresight: Add default sink selection to CoreSight base Mike Leach
2020-06-02 10:25   ` Suzuki K Poulose
2020-06-02 14:20     ` Mike Leach
2020-06-04 21:17   ` Mathieu Poirier
2020-05-26 10:46 ` [PATCH v4 3/5] coresight: tmc: Update sink types for default selection Mike Leach
2020-06-02 10:31   ` Suzuki K Poulose
2020-06-04 21:18   ` Mathieu Poirier
2020-05-26 10:46 ` Mike Leach [this message]
2020-06-02 11:45   ` [PATCH v4 4/5] coresight: etm: perf: Add default sink selection to etm perf Suzuki K Poulose
2020-06-02 13:12     ` Mike Leach
2020-06-02 13:29       ` Suzuki K Poulose
2020-06-02 16:59         ` Mathieu Poirier
2020-06-04 21:07           ` Mike Leach
2020-06-04 21:18   ` Mathieu Poirier
2020-05-26 10:46 ` [PATCH v4 5/5] coresight: sysfs: Allow select default sink on source enable Mike Leach
2020-06-02 11:51   ` Suzuki K Poulose
2020-06-04 21:12     ` Mike Leach

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=20200526104642.9526-5-mike.leach@linaro.org \
    --to=mike.leach@linaro.org \
    --cc=acme@kernel.org \
    --cc=coresight@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=suzuki.poulose@arm.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.