From: Adrian Hunter <adrian.hunter@intel.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Andi Kleen <ak@linux.intel.com>,
Alexey Budankov <alexey.budankov@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/6] perf tools: Add FIFO file names as alternative options to --control
Date: Mon, 31 Aug 2020 16:27:52 +0300 [thread overview]
Message-ID: <660d6f71-f34d-dd3d-bc3d-3d2b9e868267@intel.com> (raw)
In-Reply-To: <20200831131927.GD406859@krava>
On 31/08/20 4:19 pm, Jiri Olsa wrote:
> On Sat, Aug 29, 2020 at 01:50:13PM +0300, Adrian Hunter wrote:
>
> SNIP
>
>> + *p = '\0';
>> +
>> + /*
>> + * O_RDWR avoids POLLHUPs which is necessary to allow the other
>> + * end of a FIFO to be repeatedly opened and closed.
>> + */
>> + fd = open(s, O_RDWR | O_NONBLOCK | O_CLOEXEC);
>> + if (fd < 0) {
>> + pr_err("Failed to open '%s'\n", s);
>> + ret = -errno;
>> + goto out_free;
>> + }
>> + *ctl_fd = fd;
>> + *ctl_fd_close = true;
>> +
>> + if (p && *++p) {
>> + /* O_RDWR | O_NONBLOCK means the other end need not be open */
>> + fd = open(p, O_RDWR | O_NONBLOCK | O_CLOEXEC);
>> + if (fd < 0) {
>> + pr_err("Failed to open '%s'\n", p);
>> + ret = -errno;
>> + goto out_free;
>> + }
>> + *ctl_fd_ack = fd;
>> + }
>> +
>> +out_free:
>> + free(s);
>> + return ret;
>> +}
>> +
>> +int evlist__parse_control(const char *str, int *ctl_fd, int *ctl_fd_ack, bool *ctl_fd_close)
>> {
>> char *comma = NULL, *endptr = NULL;
>>
>> if (strncmp(str, "fd:", 3))
>> - return -EINVAL;
>> + return evlist__parse_control_names(str, ctl_fd, ctl_fd_ack, ctl_fd_close);
>
> do we want to mention somewhere that the fifo name is everything
> except for 'fd:' ?
It is only mentioned in the documentation i.e.
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -627,7 +627,9 @@ option. The -e option and this one can be mixed and matched. Events
can be grouped using the {} notation.
endif::HAVE_LIBPFM[]
+--control=ctl-fifo[,ack-fifo]::
--control=fd:ctl-fd[,ack-fd]::
+ctl-fifo / ack-fifo are opened and used as ctl-fd / ack-fd as follows.
Listen on ctl-fd descriptor for command to control measurement ('enable': enable events,
'disable': disable events). Measurements can be started with events disabled using
--delay=-1 option. Optionally send control command completion ('ack\n') to ack-fd descriptor
>
> also how likely is that we will add another channel type that
> will need another keyword (likd 'fd:')? I originaly thought
> we'd use 'fifo:filename' for this ... would be great to somehow
> avoid future confusions
Sure, I will add fifo: in V2
next prev parent reply other threads:[~2020-08-31 13:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-29 10:50 [PATCH 0/6] perf tools: Enable AUX area tracing snapshots using a FIFO Adrian Hunter
2020-08-29 10:50 ` [PATCH 1/6] perf tools: Consolidate --control option parsing into one function Adrian Hunter
2020-08-29 10:50 ` [PATCH 2/6] perf tools: Handle read errors from ctl_fd Adrian Hunter
2020-08-29 10:50 ` [PATCH 3/6] perf tools: Use AsciiDoc formatting for --control option documentation Adrian Hunter
2020-08-29 10:50 ` [PATCH 4/6] perf tools: Add FIFO file names as alternative options to --control Adrian Hunter
2020-08-31 13:19 ` Jiri Olsa
2020-08-31 13:27 ` Adrian Hunter [this message]
2020-08-29 10:50 ` [PATCH 5/6] perf record: Add 'snapshot' control command Adrian Hunter
2020-08-31 6:23 ` Andi Kleen
2020-08-31 7:03 ` Adrian Hunter
2020-08-29 10:50 ` [PATCH 6/6] perf intel-pt: Document snapshot " Adrian Hunter
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=660d6f71-f34d-dd3d-bc3d-3d2b9e868267@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexey.budankov@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@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
all inboxes | Powered by JetHome®