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


Groups > linux.kernel > #1486453 > unrolled thread

[PATCH 01/61] perf symbols: Do not open device files again

Started byJiri Olsa <jolsa@kernel.org>
First post2016-09-19 15:20 +0200
Last post2016-09-20 23:50 +0200
Articles 5 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 01/61] perf symbols: Do not open device files again Jiri Olsa <jolsa@kernel.org> - 2016-09-19 15:20 +0200
    Re: [PATCH 01/61] perf symbols: Do not open device files again Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 17:30 +0200
      Re: [PATCH 01/61] perf symbols: Do not open device files again Jiri Olsa <jolsa@redhat.com> - 2016-09-20 17:40 +0200
        [PATCHv2 01/61] perf symbols: Do not open device files Jiri Olsa <jolsa@redhat.com> - 2016-09-20 18:20 +0200
          [tip:perf/core] perf symbols: Do not open device files tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-09-20 23:50 +0200

#1486453 — [PATCH 01/61] perf symbols: Do not open device files again

FromJiri Olsa <jolsa@kernel.org>
Date2016-09-19 15:20 +0200
Subject[PATCH 01/61] perf symbols: Do not open device files again
Message-ID<sj6Ei-5Vj-49@gated-at.bofh.it>
Moving the regular file check into the entry
of the dso__read_binary_type_filename function.

This way we can eliminate some calls and extend
the file check for all cases.

Link: http://lkml.kernel.org/n/tip-np802m7jwzd7fu09vx2tp23y@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/dso.c    | 8 +++-----
 tools/perf/util/symbol.c | 3 ---
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 774f6ec884d5..9a027a0cc037 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -43,6 +43,9 @@ int dso__read_binary_type_filename(const struct dso *dso,
 	int ret = 0;
 	size_t len;
 
+	if (!is_regular_file(filename))
+		return -1;
+
 	switch (type) {
 	case DSO_BINARY_TYPE__DEBUGLINK: {
 		char *debuglink;
@@ -53,11 +56,6 @@ int dso__read_binary_type_filename(const struct dso *dso,
 			debuglink--;
 		if (*debuglink == '/')
 			debuglink++;
-
-		ret = -1;
-		if (!is_regular_file(filename))
-			break;
-
 		ret = filename__read_debuglink(filename, debuglink,
 					       size - (debuglink - filename));
 		}
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 19c9c558454f..827a58ce29f0 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1466,9 +1466,6 @@ int dso__load(struct dso *dso, struct map *map)
 						   root_dir, name, PATH_MAX))
 			continue;
 
-		if (!is_regular_file(name))
-			continue;
-
 		/* Name is now the name of the next image to try */
 		if (symsrc__init(ss, dso, name, symtab_type) < 0)
 			continue;
-- 
2.7.4

[toc] | [next] | [standalone]


#1487430

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-09-20 17:30 +0200
Message-ID<sjv9D-4MD-5@gated-at.bofh.it>
In reply to#1486453
Em Mon, Sep 19, 2016 at 03:09:10PM +0200, Jiri Olsa escreveu:
> Moving the regular file check into the entry
> of the dso__read_binary_type_filename function.
> 
> This way we can eliminate some calls and extend
> the file check for all cases.

Bzzt:

[root@jouet ~]# perf test "Test dso" 
 8: Test dso data read      : FAILED!
 9: Test dso data cache     : FAILED!
10: Test dso data reopen    : FAILED!
[root@jouet ~]#

git bisect pointed to this patch, removing it for now, haven't tried to
fix, please take a look.

- Arnaldo
 
> Link: http://lkml.kernel.org/n/tip-np802m7jwzd7fu09vx2tp23y@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/util/dso.c    | 8 +++-----
>  tools/perf/util/symbol.c | 3 ---
>  2 files changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> index 774f6ec884d5..9a027a0cc037 100644
> --- a/tools/perf/util/dso.c
> +++ b/tools/perf/util/dso.c
> @@ -43,6 +43,9 @@ int dso__read_binary_type_filename(const struct dso *dso,
>  	int ret = 0;
>  	size_t len;
>  
> +	if (!is_regular_file(filename))
> +		return -1;
> +
>  	switch (type) {
>  	case DSO_BINARY_TYPE__DEBUGLINK: {
>  		char *debuglink;
> @@ -53,11 +56,6 @@ int dso__read_binary_type_filename(const struct dso *dso,
>  			debuglink--;
>  		if (*debuglink == '/')
>  			debuglink++;
> -
> -		ret = -1;
> -		if (!is_regular_file(filename))
> -			break;
> -
>  		ret = filename__read_debuglink(filename, debuglink,
>  					       size - (debuglink - filename));
>  		}
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 19c9c558454f..827a58ce29f0 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1466,9 +1466,6 @@ int dso__load(struct dso *dso, struct map *map)
>  						   root_dir, name, PATH_MAX))
>  			continue;
>  
> -		if (!is_regular_file(name))
> -			continue;
> -
>  		/* Name is now the name of the next image to try */
>  		if (symsrc__init(ss, dso, name, symtab_type) < 0)
>  			continue;
> -- 
> 2.7.4

[toc] | [prev] | [next] | [standalone]


#1487444

FromJiri Olsa <jolsa@redhat.com>
Date2016-09-20 17:40 +0200
Message-ID<sjvjk-4Q2-25@gated-at.bofh.it>
In reply to#1487430
On Tue, Sep 20, 2016 at 12:28:03PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Sep 19, 2016 at 03:09:10PM +0200, Jiri Olsa escreveu:
> > Moving the regular file check into the entry
> > of the dso__read_binary_type_filename function.
> > 
> > This way we can eliminate some calls and extend
> > the file check for all cases.
> 
> Bzzt:
> 
> [root@jouet ~]# perf test "Test dso" 
>  8: Test dso data read      : FAILED!
>  9: Test dso data cache     : FAILED!
> 10: Test dso data reopen    : FAILED!
> [root@jouet ~]#

ugh, will check.. thanks

jirka

[toc] | [prev] | [next] | [standalone]


#1487504 — [PATCHv2 01/61] perf symbols: Do not open device files

FromJiri Olsa <jolsa@redhat.com>
Date2016-09-20 18:20 +0200
Subject[PATCHv2 01/61] perf symbols: Do not open device files
Message-ID<sjvW2-5lT-41@gated-at.bofh.it>
In reply to#1487444
On Tue, Sep 20, 2016 at 05:36:47PM +0200, Jiri Olsa wrote:
> On Tue, Sep 20, 2016 at 12:28:03PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Sep 19, 2016 at 03:09:10PM +0200, Jiri Olsa escreveu:
> > > Moving the regular file check into the entry
> > > of the dso__read_binary_type_filename function.
> > > 
> > > This way we can eliminate some calls and extend
> > > the file check for all cases.
> > 
> > Bzzt:
> > 
> > [root@jouet ~]# perf test "Test dso" 
> >  8: Test dso data read      : FAILED!
> >  9: Test dso data cache     : FAILED!
> > 10: Test dso data reopen    : FAILED!
> > [root@jouet ~]#
> 
> ugh, will check.. thanks

ook, I confused this one with earlier version, sry.. correct version attached
it's pushed in the perf/c2c branch now

thanks,
jirka


---
The dso__read_binary_type_filename gets the dso's file name
to open. We need to check it for regular file before trying
to open it, otherwise we might get stuck with device file.

Link: http://lkml.kernel.org/n/tip-twbp391v8v9f5idp584hlfov@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/dso.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 774f6ec884d5..d2c6cdd9d42b 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -363,6 +363,9 @@ static int __open_dso(struct dso *dso, struct machine *machine)
 		return -EINVAL;
 	}
 
+	if (!is_regular_file(name))
+		return -EINVAL;
+
 	fd = do_open(name);
 	free(name);
 	return fd;
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1487668 — [tip:perf/core] perf symbols: Do not open device files

Fromtip-bot for Jiri Olsa <tipbot@zytor.com>
Date2016-09-20 23:50 +0200
Subject[tip:perf/core] perf symbols: Do not open device files
Message-ID<sjB5o-8g-37@gated-at.bofh.it>
In reply to#1487504
Commit-ID:  3c028a0cb5b71f47d523bc8ad2c597cb257f41fb
Gitweb:     http://git.kernel.org/tip/3c028a0cb5b71f47d523bc8ad2c597cb257f41fb
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Tue, 20 Sep 2016 18:12:45 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 20 Sep 2016 16:20:21 -0300

perf symbols: Do not open device files

The dso__read_binary_type_filename gets the dso's file name to open. We
need to check it for regular file before trying to open it, otherwise we
might get stuck with device file.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20160920161245.GA8995@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/dso.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 774f6ec..d2c6cdd 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -363,6 +363,9 @@ static int __open_dso(struct dso *dso, struct machine *machine)
 		return -EINVAL;
 	}
 
+	if (!is_regular_file(name))
+		return -EINVAL;
+
 	fd = do_open(name);
 	free(name);
 	return fd;

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web