public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Adrian Hunter <adrian.hunter@intel.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, mpetlan@redhat.com
Subject: Re: [PATCH V2 4/6] perf tools: Add FIFO file names as alternative options to --control
Date: Tue, 1 Sep 2020 22:06:55 +0200	[thread overview]
Message-ID: <20200901200655.GC470123@krava> (raw)
In-Reply-To: <20200901093758.32293-5-adrian.hunter@intel.com>

On Tue, Sep 01, 2020 at 12:37:56PM +0300, Adrian Hunter wrote:

SNIP

> +	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);

could you please proactively set *ctl_fd_close = false in here,
so it's obvious.. also evlist__parse_control_fifo might be better
name, other that that it all looks great

we were recently asked to prvide faster intel_pt snapshot control
and we were thinking of putting input_pt support to libperf, but
your change might just fix this

for the patchset:

Acked-by: Jiri Olsa <jolsa@redhat.com>

Alexey, could you please check on this?

thanks,
jirka

>  
>  	*ctl_fd = strtoul(&str[3], &endptr, 0);
>  	if (endptr == &str[3])

SNIP


  reply	other threads:[~2020-09-01 20:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01  9:37 [PATCH V2 0/6] perf tools: Enable AUX area tracing snapshots using a FIFO Adrian Hunter
2020-09-01  9:37 ` [PATCH V2 1/6] perf tools: Consolidate --control option parsing into one function Adrian Hunter
2020-09-02 16:06   ` Alexey Budankov
2020-09-03 20:15     ` Arnaldo Carvalho de Melo
2020-09-01  9:37 ` [PATCH V2 2/6] perf tools: Handle read errors from ctl_fd Adrian Hunter
2020-09-02 16:11   ` Alexey Budankov
2020-09-03 20:16     ` Arnaldo Carvalho de Melo
2020-09-01  9:37 ` [PATCH V2 3/6] perf tools: Use AsciiDoc formatting for --control option documentation Adrian Hunter
2020-09-02 16:12   ` Alexey Budankov
2020-09-03 20:17     ` Arnaldo Carvalho de Melo
2020-09-01  9:37 ` [PATCH V2 4/6] perf tools: Add FIFO file names as alternative options to --control Adrian Hunter
2020-09-01 20:06   ` Jiri Olsa [this message]
2020-09-02 10:57     ` [PATCH V3 " Adrian Hunter
2020-09-02 17:03       ` Alexey Budankov
2020-09-03 10:38         ` Adrian Hunter
2020-09-03 12:29           ` [PATCH] perf tools: Consolidate close_control_option()'s into one function Adrian Hunter
2020-09-04 18:56             ` Arnaldo Carvalho de Melo
2020-09-03 20:21         ` [PATCH V3 4/6] perf tools: Add FIFO file names as alternative options to --control Arnaldo Carvalho de Melo
2020-09-01  9:37 ` [PATCH V2 5/6] perf record: Add 'snapshot' control command Adrian Hunter
2020-09-02 17:03   ` Alexey Budankov
2020-09-03 10:44     ` Adrian Hunter
2020-09-01  9:37 ` [PATCH V2 6/6] perf intel-pt: Document snapshot " Adrian Hunter
2020-09-02 16:53   ` Alexey Budankov

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=20200901200655.GC470123@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpetlan@redhat.com \
    --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