Linux-perf-users Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] perf trace: Segfault when trying to trace events by cgroup
@ 2020-10-26 13:20 Stanislav Ivanichkin
  2020-10-27  5:10 ` Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Ivanichkin @ 2020-10-26 13:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-perf-users, dmtrmonakhov, namhyung

  v2:
    - struct declaration fixed (Namhyung Kim)

Fixes: 9ea42ba4411ac ("perf trace: Support setting cgroups as targets")
Signed-off-by: Stanislav Ivanichkin <sivanichkin@yandex-team.ru>
---
 tools/perf/builtin-trace.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 44a75f234db1..de80534473af 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -4639,9 +4639,9 @@ static int trace__parse_events_option(const struct option *opt, const char *str,
 	err = 0;
 
 	if (lists[0]) {
-		struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event",
-					       "event selector. use 'perf list' to list available events",
-					       parse_events_option);
+		struct option o = {
+			.value = &trace->evlist,
+		};
 		err = parse_events_option(&o, lists[0], 0);
 	}
 out:
@@ -4655,9 +4655,12 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int u
 {
 	struct trace *trace = opt->value;
 
-	if (!list_empty(&trace->evlist->core.entries))
-		return parse_cgroups(opt, str, unset);
-
+	if (!list_empty(&trace->evlist->core.entries)) {
+		struct option o = {
+			.value = &trace->evlist,
+		};
+		return parse_cgroups(&o, str, unset);
+	}
 	trace->cgroup = evlist__findnew_cgroup(trace->evlist, str);
 
 	return 0;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] perf trace: Segfault when trying to trace events by cgroup
  2020-10-26 13:20 [PATCH v2] perf trace: Segfault when trying to trace events by cgroup Stanislav Ivanichkin
@ 2020-10-27  5:10 ` Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2020-10-27  5:10 UTC (permalink / raw)
  To: Stanislav Ivanichkin; +Cc: linux-kernel, linux-perf-users, Dmitry Monakhov

Hello,

On Mon, Oct 26, 2020 at 10:21 PM Stanislav Ivanichkin
<sivanichkin@yandex-team.ru> wrote:
>
>   v2:
>     - struct declaration fixed (Namhyung Kim)
>
> Fixes: 9ea42ba4411ac ("perf trace: Support setting cgroups as targets")
> Signed-off-by: Stanislav Ivanichkin <sivanichkin@yandex-team.ru>

Looks ok but you'd better add the commit description in v1.

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks
Namhyung

> ---
>  tools/perf/builtin-trace.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 44a75f234db1..de80534473af 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -4639,9 +4639,9 @@ static int trace__parse_events_option(const struct option *opt, const char *str,
>         err = 0;
>
>         if (lists[0]) {
> -               struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event",
> -                                              "event selector. use 'perf list' to list available events",
> -                                              parse_events_option);
> +               struct option o = {
> +                       .value = &trace->evlist,
> +               };
>                 err = parse_events_option(&o, lists[0], 0);
>         }
>  out:
> @@ -4655,9 +4655,12 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int u
>  {
>         struct trace *trace = opt->value;
>
> -       if (!list_empty(&trace->evlist->core.entries))
> -               return parse_cgroups(opt, str, unset);
> -
> +       if (!list_empty(&trace->evlist->core.entries)) {
> +               struct option o = {
> +                       .value = &trace->evlist,
> +               };
> +               return parse_cgroups(&o, str, unset);
> +       }
>         trace->cgroup = evlist__findnew_cgroup(trace->evlist, str);
>
>         return 0;
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 13:20 [PATCH v2] perf trace: Segfault when trying to trace events by cgroup Stanislav Ivanichkin
2020-10-27  5:10 ` Namhyung Kim

Linux-perf-users Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-perf-users/0 linux-perf-users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-perf-users linux-perf-users/ https://lore.kernel.org/linux-perf-users \
		linux-perf-users@vger.kernel.org
	public-inbox-index linux-perf-users

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-perf-users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git