From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: peterz@infradead.org, acme@kernel.org
Cc: mingo@redhat.com, tglx@linutronix.de,
alexander.shishkin@linux.intel.com, schwidefsky@de.ibm.com,
heiko.carstens@de.ibm.com, will.deacon@arm.com,
mark.rutland@arm.com, jolsa@redhat.com, namhyung@kernel.org,
adrian.hunter@intel.com, ast@kernel.org,
gregkh@linuxfoundation.org, hpa@zytor.com, kim.phillips@arm.com,
suzuki.poulosi@arm.com, linux-s390@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 7/7] perf tools: Use ioctl function to send sink configuration to kernel
Date: Wed, 18 Jul 2018 15:48:07 -0600 [thread overview]
Message-ID: <1531950487-24554-8-git-send-email-mathieu.poirier@linaro.org> (raw)
In-Reply-To: <1531950487-24554-1-git-send-email-mathieu.poirier@linaro.org>
Using sysFS to communicate sink information for a trace session doesn't
work when more than one CPU is involved in the scenario. As such
communicate the sink information to each event by using the SET_DRV_CONFIG
ioctl command.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
tools/perf/arch/arm/util/cs-etm.c | 54 ++++-----------------------------------
1 file changed, 5 insertions(+), 49 deletions(-)
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index d8081c2e6d44..cb0978eb7181 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -599,55 +599,10 @@ struct auxtrace_record *cs_etm_record_init(int *err)
return NULL;
}
-static FILE *cs_device__open_file(const char *name)
+static int cs_etm_set_drv_config_term(struct perf_evsel *evsel,
+ const char *term)
{
- struct stat st;
- char path[PATH_MAX];
- const char *sysfs;
-
- sysfs = sysfs__mountpoint();
- if (!sysfs)
- return NULL;
-
- snprintf(path, PATH_MAX,
- "%s" CS_BUS_DEVICE_PATH "%s", sysfs, name);
-
- if (stat(path, &st) < 0)
- return NULL;
-
- return fopen(path, "w");
-
-}
-
-static int __printf(2, 3) cs_device__print_file(const char *name, const char *fmt, ...)
-{
- va_list args;
- FILE *file;
- int ret = -EINVAL;
-
- va_start(args, fmt);
- file = cs_device__open_file(name);
- if (file) {
- ret = vfprintf(file, fmt, args);
- fclose(file);
- }
- va_end(args);
- return ret;
-}
-
-static int cs_etm_set_drv_config_term(struct perf_evsel_config_term *term)
-{
- int ret;
- char enable_sink[ENABLE_SINK_MAX];
-
- snprintf(enable_sink, ENABLE_SINK_MAX, "%s/%s",
- term->val.drv_cfg, "enable_sink");
-
- ret = cs_device__print_file(enable_sink, "%d", 1);
- if (ret < 0)
- return ret;
-
- return 0;
+ return perf_evsel__apply_drv_config(evsel, term);
}
int cs_etm_set_drv_config(struct perf_evsel *evsel,
@@ -660,7 +615,8 @@ int cs_etm_set_drv_config(struct perf_evsel *evsel,
if (term->type != PERF_EVSEL__CONFIG_TERM_DRV_CFG)
continue;
- err = cs_etm_set_drv_config_term(term);
+ err = cs_etm_set_drv_config_term(evsel,
+ term->val.drv_cfg);
if (err) {
*err_term = term;
break;
--
2.7.4
next prev parent reply other threads:[~2018-07-18 21:48 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 21:48 [PATCH v3 0/7] perf: Add ioctl for PMU driver configuration Mathieu Poirier
2018-07-18 21:48 ` [PATCH v3 1/7] perf: Introduce ioctl to communicate driver configuration to kernel Mathieu Poirier
2018-07-18 21:48 ` [PATCH v3 2/7] perf/core: Use " Mathieu Poirier
2018-07-18 21:48 ` [PATCH v3 3/7] perf/aux: Make perf_event accessible to setup_aux() Mathieu Poirier
2018-07-18 21:48 ` [PATCH v3 4/7] coresight: Use PMU driver configuration for sink selection Mathieu Poirier
2018-07-18 21:48 ` [PATCH v3 5/7] perf tools: Use ioctl to communicate driver configuration to kernel Mathieu Poirier
2018-07-18 21:48 ` [PATCH v3 6/7] perf tools: Make perf_evsel accessible to PMU driver configuration code Mathieu Poirier
2018-07-18 21:48 ` Mathieu Poirier [this message]
2018-08-13 17:46 ` [PATCH v3 0/7] perf: Add ioctl for PMU driver configuration Kim Phillips
2018-08-14 16:15 ` Mathieu Poirier
2018-08-14 17:09 ` Kim Phillips
2018-08-14 19:42 ` Mathieu Poirier
2018-08-15 9:39 ` Will Deacon
2018-08-15 15:28 ` Kim Phillips
2018-08-16 19:28 ` Mathieu Poirier
2018-08-20 10:03 ` Suzuki K Poulose
2018-08-20 14:22 ` Kim Phillips
2018-08-20 14:36 ` Suzuki K Poulose
2018-08-20 15:25 ` Kim Phillips
2018-08-21 8:39 ` Suzuki K Poulose
2018-08-21 14:47 ` Kim Phillips
2018-08-21 17:16 ` Mathieu Poirier
2018-08-21 19:17 ` Kim Phillips
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=1531950487-24554-8-git-send-email-mathieu.poirier@linaro.org \
--to=mathieu.poirier@linaro.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ast@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=kim.phillips@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=schwidefsky@de.ibm.com \
--cc=suzuki.poulosi@arm.com \
--cc=tglx@linutronix.de \
--cc=will.deacon@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).