Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1216395

Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no evsel is collected

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Arnaldo Carvalho de Melo <acme@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no evsel is collected
Date Mon, 31 Aug 2015 21:30:03 +0200
Message-ID <q3CWf-ej-29@gated-at.bofh.it> (permalink)
References <q2FWa-7Rj-5@gated-at.bofh.it> <q2FWa-7Rj-11@gated-at.bofh.it>
X-Original-To Jiri Olsa <jolsa@kernel.org>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
X-URL http://acmel.wordpress.com
User-Agent Mutt/1.5.20 (2009-12-10)
X-Scanned-By MIMEDefang 2.68 on 10.5.11.24
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 62
Organization linux.* mail to news gateway
X-Original-Cc Wang Nan <wangnan0@huawei.com>, mingo@kernel.org, ast@plumgrid.com, linux-kernel@vger.kernel.org, lizefan@huawei.com, pi3orama@163.com, Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>, Namhyung Kim <namhyung@kernel.org>
X-Original-Date Mon, 31 Aug 2015 16:20:03 -0300
X-Original-Message-ID <20150831192003.GA2443@redhat.com>
X-Original-References <1440822125-52691-1-git-send-email-wangnan0@huawei.com> <1440822125-52691-3-git-send-email-wangnan0@huawei.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1216395

Show key headers only | View raw


Em Sat, Aug 29, 2015 at 04:21:36AM +0000, Wang Nan escreveu:
> If parse_events__scanner() collects no entry, perf_evlist__last(evlist)
> is invalid. Then setting of cmdline_group_boundary touches invalid.
> 
> It could happend in currect BPF implementation. See [1]. Although it
> can be fixed, for safety reason it whould be better to introduce this
> check.
> 
> Instead of checking number of entries, check data.list instead, so we
> can add dummy evsel here.

Event parsing fixes should have Jiri Olsa on the CC list, Jiri, is this
ok?

From what I can see it looks Ok, my question, just from looking at this
patch, is if it is valid to get to this point with an empty data.list,
i.e. was it ever possible and this is a bug irrespective of eBPF?

- Arnaldo
 
> [1]: http://lkml.kernel.org/n/1436445342-1402-19-git-send-email-wangnan0@huawei.com
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Alexei Starovoitov <ast@plumgrid.com>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Zefan Li <lizefan@huawei.com>
> Cc: pi3orama@163.com
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Link: http://lkml.kernel.org/r/1440742821-44548-3-git-send-email-wangnan0@huawei.com
> ---
>  tools/perf/util/parse-events.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index d826e6f..14cd7e3 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -1143,10 +1143,14 @@ int parse_events(struct perf_evlist *evlist, const char *str,
>  		int entries = data.idx - evlist->nr_entries;
>  		struct perf_evsel *last;
>  
> +		if (!list_empty(&data.list)) {
> +			last = list_entry(data.list.prev,
> +					  struct perf_evsel, node);
> +			last->cmdline_group_boundary = true;
> +		}
> +
>  		perf_evlist__splice_list_tail(evlist, &data.list, entries);
>  		evlist->nr_groups += data.nr_groups;
> -		last = perf_evlist__last(evlist);
> -		last->cmdline_group_boundary = true;
>  
>  		return 0;
>  	}
> -- 
> 2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no evsel is collected Wang Nan <wangnan0@huawei.com> - 2015-08-29 06:30 +0200
  Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no  evsel is collected Arnaldo Carvalho de Melo <acme@redhat.com> - 2015-08-31 21:30 +0200
    Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no  evsel is collected Jiri Olsa <jolsa@redhat.com> - 2015-09-01 12:40 +0200
      Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if  no evsel is collected "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-01 14:50 +0200
    Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if  no evsel is collected "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-01 13:00 +0200
  [PATCH] perf tools: Don't set leader if parser doesn't collect an evsel Wang Nan <wangnan0@huawei.com> - 2015-09-02 05:00 +0200
    Re: [PATCH] perf tools: Don't set leader if parser doesn't collect  an evsel "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-02 05:10 +0200
    RE: [PATCH] perf tools: Don't set leader if parser doesn't collect  an evsel 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-02 08:00 +0200
      Re: [PATCH] perf tools: Don't set leader if parser doesn't collect  an evsel "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-02 08:10 +0200
      Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect  evsel "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-02 09:00 +0200
        RE: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-02 12:40 +0200
        Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Jiri Olsa <jolsa@redhat.com> - 2015-09-02 14:00 +0200
          Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel pi3orama <pi3orama@163.com> - 2015-09-02 14:10 +0200
            Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Jiri Olsa <jolsa@redhat.com> - 2015-09-02 14:50 +0200
            Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Arnaldo Carvalho de Melo <acme@redhat.com> - 2015-09-02 16:00 +0200
              Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel pi3orama <pi3orama@163.com> - 2015-09-02 16:10 +0200
                Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Arnaldo Carvalho de Melo <acme@redhat.com> - 2015-09-02 16:50 +0200
                Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel pi3orama <pi3orama@163.com> - 2015-09-03 00:30 +0200

csiph-web