* [PATCH] perf machine: Search for modules in %s/lib/modules/%s
@ 2014-04-26 17:17 Richard Yao
2014-04-27 10:05 ` Jiri Olsa
2014-05-01 6:32 ` [tip:perf/core] perf machine: Search for modules in %s/lib/ modules/%s tip-bot for Richard Yao
0 siblings, 2 replies; 10+ messages in thread
From: Richard Yao @ 2014-04-26 17:17 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Paul Mackerras, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, jiri Olsa, Stephane Eranian, Frederic Weisbecker,
linux-kernel, Richard Yao
Modules installed outside of the kernel's build system should go into
"%s/lib/modules/%s/extra", but at present, perf will only look at them
when they are in "%s/lib/modules/%s/kernel". Lets encourage good
citizenship by relaxing this requirement to "%s/lib/modules/%s". This
way open source modules that are out-of-tree have no incentive to start
populating a directory reserved for in-kernel modules and I can stop
hex-editing my system's perf binary when profiling OSS out-of-tree
modules.
Feedback from Namhyung Kim correctly revealed that the hex-edits that I
had been doing meant that perf was also traversing the build and source
symlinks in %s/lib/modules/%s. That is undesireable, so we explicitly
exclude them from traversal with a minor tweak to the traversal routine.
Signed-off-by: Richard Yao <ryao@gentoo.org>
---
tools/perf/util/machine.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index a53cd0b..27c2a5e 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir)
}
static int map_groups__set_modules_path_dir(struct map_groups *mg,
- const char *dir_name)
+ const char *dir_name, int depth)
{
struct dirent *dent;
DIR *dir = opendir(dir_name);
@@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
!strcmp(dent->d_name, ".."))
continue;
- ret = map_groups__set_modules_path_dir(mg, path);
+ /* Do not follow top-level source and build symlinks */
+ if (depth == 0) {
+ if (!strcmp(dent->d_name, "source") ||
+ !strcmp(dent->d_name, "build"))
+ continue;
+ }
+
+ ret = map_groups__set_modules_path_dir(mg, path,
+ depth + 1);
if (ret < 0)
goto out;
} else {
@@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine)
if (!version)
return -1;
- snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel",
+ snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
machine->root_dir, version);
free(version);
- return map_groups__set_modules_path_dir(&machine->kmaps, modules_path);
+ return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0);
}
static int machine__create_module(void *arg, const char *name, u64 start)
--
1.8.3.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] perf machine: Search for modules in %s/lib/modules/%s
2014-04-26 17:17 [PATCH] perf machine: Search for modules in %s/lib/modules/%s Richard Yao
@ 2014-04-27 10:05 ` Jiri Olsa
2014-04-29 8:06 ` Jiri Olsa
2014-05-01 6:32 ` [tip:perf/core] perf machine: Search for modules in %s/lib/ modules/%s tip-bot for Richard Yao
1 sibling, 1 reply; 10+ messages in thread
From: Jiri Olsa @ 2014-04-27 10:05 UTC (permalink / raw)
To: Richard Yao
Cc: Peter Zijlstra, Paul Mackerras, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Stephane Eranian,
Frederic Weisbecker, linux-kernel
On Sat, Apr 26, 2014 at 01:17:55PM -0400, Richard Yao wrote:
> Modules installed outside of the kernel's build system should go into
> "%s/lib/modules/%s/extra", but at present, perf will only look at them
> when they are in "%s/lib/modules/%s/kernel". Lets encourage good
> citizenship by relaxing this requirement to "%s/lib/modules/%s". This
> way open source modules that are out-of-tree have no incentive to start
> populating a directory reserved for in-kernel modules and I can stop
> hex-editing my system's perf binary when profiling OSS out-of-tree
> modules.
>
> Feedback from Namhyung Kim correctly revealed that the hex-edits that I
> had been doing meant that perf was also traversing the build and source
> symlinks in %s/lib/modules/%s. That is undesireable, so we explicitly
> exclude them from traversal with a minor tweak to the traversal routine.
looks good to me, Namhyung?
thanks,
jirka
>
> Signed-off-by: Richard Yao <ryao@gentoo.org>
> ---
> tools/perf/util/machine.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index a53cd0b..27c2a5e 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir)
> }
>
> static int map_groups__set_modules_path_dir(struct map_groups *mg,
> - const char *dir_name)
> + const char *dir_name, int depth)
> {
> struct dirent *dent;
> DIR *dir = opendir(dir_name);
> @@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
> !strcmp(dent->d_name, ".."))
> continue;
>
> - ret = map_groups__set_modules_path_dir(mg, path);
> + /* Do not follow top-level source and build symlinks */
> + if (depth == 0) {
> + if (!strcmp(dent->d_name, "source") ||
> + !strcmp(dent->d_name, "build"))
> + continue;
> + }
> +
> + ret = map_groups__set_modules_path_dir(mg, path,
> + depth + 1);
> if (ret < 0)
> goto out;
> } else {
> @@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine)
> if (!version)
> return -1;
>
> - snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel",
> + snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
> machine->root_dir, version);
> free(version);
>
> - return map_groups__set_modules_path_dir(&machine->kmaps, modules_path);
> + return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0);
> }
>
> static int machine__create_module(void *arg, const char *name, u64 start)
> --
> 1.8.3.2
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] perf machine: Search for modules in %s/lib/modules/%s
2014-04-27 10:05 ` Jiri Olsa
@ 2014-04-29 8:06 ` Jiri Olsa
2014-04-29 23:46 ` Namhyung Kim
0 siblings, 1 reply; 10+ messages in thread
From: Jiri Olsa @ 2014-04-29 8:06 UTC (permalink / raw)
To: Richard Yao
Cc: Peter Zijlstra, Paul Mackerras, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Stephane Eranian,
Frederic Weisbecker, linux-kernel, Namhyung Kim
On Sun, Apr 27, 2014 at 12:05:56PM +0200, Jiri Olsa wrote:
> On Sat, Apr 26, 2014 at 01:17:55PM -0400, Richard Yao wrote:
> > Modules installed outside of the kernel's build system should go into
> > "%s/lib/modules/%s/extra", but at present, perf will only look at them
> > when they are in "%s/lib/modules/%s/kernel". Lets encourage good
> > citizenship by relaxing this requirement to "%s/lib/modules/%s". This
> > way open source modules that are out-of-tree have no incentive to start
> > populating a directory reserved for in-kernel modules and I can stop
> > hex-editing my system's perf binary when profiling OSS out-of-tree
> > modules.
> >
> > Feedback from Namhyung Kim correctly revealed that the hex-edits that I
> > had been doing meant that perf was also traversing the build and source
> > symlinks in %s/lib/modules/%s. That is undesireable, so we explicitly
> > exclude them from traversal with a minor tweak to the traversal routine.
>
> looks good to me, Namhyung?
just realized Namhyung wasn't CC-ed on this one ;-)
jirka
>
> thanks,
> jirka
>
> >
> > Signed-off-by: Richard Yao <ryao@gentoo.org>
> > ---
> > tools/perf/util/machine.c | 16 ++++++++++++----
> > 1 file changed, 12 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> > index a53cd0b..27c2a5e 100644
> > --- a/tools/perf/util/machine.c
> > +++ b/tools/perf/util/machine.c
> > @@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir)
> > }
> >
> > static int map_groups__set_modules_path_dir(struct map_groups *mg,
> > - const char *dir_name)
> > + const char *dir_name, int depth)
> > {
> > struct dirent *dent;
> > DIR *dir = opendir(dir_name);
> > @@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
> > !strcmp(dent->d_name, ".."))
> > continue;
> >
> > - ret = map_groups__set_modules_path_dir(mg, path);
> > + /* Do not follow top-level source and build symlinks */
> > + if (depth == 0) {
> > + if (!strcmp(dent->d_name, "source") ||
> > + !strcmp(dent->d_name, "build"))
> > + continue;
> > + }
> > +
> > + ret = map_groups__set_modules_path_dir(mg, path,
> > + depth + 1);
> > if (ret < 0)
> > goto out;
> > } else {
> > @@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine)
> > if (!version)
> > return -1;
> >
> > - snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel",
> > + snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
> > machine->root_dir, version);
> > free(version);
> >
> > - return map_groups__set_modules_path_dir(&machine->kmaps, modules_path);
> > + return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0);
> > }
> >
> > static int machine__create_module(void *arg, const char *name, u64 start)
> > --
> > 1.8.3.2
> >
> --
> 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/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] perf machine: Search for modules in %s/lib/modules/%s
2014-04-29 8:06 ` Jiri Olsa
@ 2014-04-29 23:46 ` Namhyung Kim
0 siblings, 0 replies; 10+ messages in thread
From: Namhyung Kim @ 2014-04-29 23:46 UTC (permalink / raw)
To: Jiri Olsa
Cc: Richard Yao, Peter Zijlstra, Paul Mackerras,
Arnaldo Carvalho de Melo, Adrian Hunter, David Ahern,
Stephane Eranian, Frederic Weisbecker, linux-kernel
Hi Jiri,
On Tue, 29 Apr 2014 10:06:17 +0200, Jiri Olsa wrote:
> On Sun, Apr 27, 2014 at 12:05:56PM +0200, Jiri Olsa wrote:
>> On Sat, Apr 26, 2014 at 01:17:55PM -0400, Richard Yao wrote:
>> > Modules installed outside of the kernel's build system should go into
>> > "%s/lib/modules/%s/extra", but at present, perf will only look at them
>> > when they are in "%s/lib/modules/%s/kernel". Lets encourage good
>> > citizenship by relaxing this requirement to "%s/lib/modules/%s". This
>> > way open source modules that are out-of-tree have no incentive to start
>> > populating a directory reserved for in-kernel modules and I can stop
>> > hex-editing my system's perf binary when profiling OSS out-of-tree
>> > modules.
>> >
>> > Feedback from Namhyung Kim correctly revealed that the hex-edits that I
>> > had been doing meant that perf was also traversing the build and source
>> > symlinks in %s/lib/modules/%s. That is undesireable, so we explicitly
>> > exclude them from traversal with a minor tweak to the traversal routine.
>>
>> looks good to me, Namhyung?
>
> just realized Namhyung wasn't CC-ed on this one ;-)
:)
Well, I still prefer the symlink check with lstat(), I can live with
this, so:
Acked-by: Namhyung kim <namhyung@kernel.org>
Thanks,
Namhyung
>
>>
>> thanks,
>> jirka
>>
>> >
>> > Signed-off-by: Richard Yao <ryao@gentoo.org>
>> > ---
>> > tools/perf/util/machine.c | 16 ++++++++++++----
>> > 1 file changed, 12 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
>> > index a53cd0b..27c2a5e 100644
>> > --- a/tools/perf/util/machine.c
>> > +++ b/tools/perf/util/machine.c
>> > @@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir)
>> > }
>> >
>> > static int map_groups__set_modules_path_dir(struct map_groups *mg,
>> > - const char *dir_name)
>> > + const char *dir_name, int depth)
>> > {
>> > struct dirent *dent;
>> > DIR *dir = opendir(dir_name);
>> > @@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
>> > !strcmp(dent->d_name, ".."))
>> > continue;
>> >
>> > - ret = map_groups__set_modules_path_dir(mg, path);
>> > + /* Do not follow top-level source and build symlinks */
>> > + if (depth == 0) {
>> > + if (!strcmp(dent->d_name, "source") ||
>> > + !strcmp(dent->d_name, "build"))
>> > + continue;
>> > + }
>> > +
>> > + ret = map_groups__set_modules_path_dir(mg, path,
>> > + depth + 1);
>> > if (ret < 0)
>> > goto out;
>> > } else {
>> > @@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine)
>> > if (!version)
>> > return -1;
>> >
>> > - snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel",
>> > + snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
>> > machine->root_dir, version);
>> > free(version);
>> >
>> > - return map_groups__set_modules_path_dir(&machine->kmaps, modules_path);
>> > + return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0);
>> > }
>> >
>> > static int machine__create_module(void *arg, const char *name, u64 start)
>> > --
>> > 1.8.3.2
>> >
>> --
>> 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/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [tip:perf/core] perf machine: Search for modules in %s/lib/ modules/%s
2014-04-26 17:17 [PATCH] perf machine: Search for modules in %s/lib/modules/%s Richard Yao
2014-04-27 10:05 ` Jiri Olsa
@ 2014-05-01 6:32 ` tip-bot for Richard Yao
1 sibling, 0 replies; 10+ messages in thread
From: tip-bot for Richard Yao @ 2014-05-01 6:32 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, jolsa, ryao, tglx, namhyung
Commit-ID: 61d4290cc1f10588147b76b385875f06827d47ff
Gitweb: http://git.kernel.org/tip/61d4290cc1f10588147b76b385875f06827d47ff
Author: Richard Yao <ryao@gentoo.org>
AuthorDate: Sat, 26 Apr 2014 13:17:55 -0400
Committer: Jiri Olsa <jolsa@kernel.org>
CommitDate: Wed, 30 Apr 2014 16:49:29 +0200
perf machine: Search for modules in %s/lib/modules/%s
Modules installed outside of the kernel's build system should go into
"%s/lib/modules/%s/extra", but at present, perf will only look at them
when they are in "%s/lib/modules/%s/kernel". Lets encourage good
citizenship by relaxing this requirement to "%s/lib/modules/%s". This
way open source modules that are out-of-tree have no incentive to start
populating a directory reserved for in-kernel modules and I can stop
hex-editing my system's perf binary when profiling OSS out-of-tree
modules.
Feedback from Namhyung Kim correctly revealed that the hex-edits that I
had been doing meant that perf was also traversing the build and source
symlinks in %s/lib/modules/%s. That is undesireable, so we explicitly
exclude them from traversal with a minor tweak to the traversal routine.
Signed-off-by: Richard Yao <ryao@gentoo.org>
Acked-by: Namhyung kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1398532675-13684-1-git-send-email-ryao@gentoo.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/machine.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index a53cd0b..27c2a5e 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir)
}
static int map_groups__set_modules_path_dir(struct map_groups *mg,
- const char *dir_name)
+ const char *dir_name, int depth)
{
struct dirent *dent;
DIR *dir = opendir(dir_name);
@@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
!strcmp(dent->d_name, ".."))
continue;
- ret = map_groups__set_modules_path_dir(mg, path);
+ /* Do not follow top-level source and build symlinks */
+ if (depth == 0) {
+ if (!strcmp(dent->d_name, "source") ||
+ !strcmp(dent->d_name, "build"))
+ continue;
+ }
+
+ ret = map_groups__set_modules_path_dir(mg, path,
+ depth + 1);
if (ret < 0)
goto out;
} else {
@@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine)
if (!version)
return -1;
- snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel",
+ snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
machine->root_dir, version);
free(version);
- return map_groups__set_modules_path_dir(&machine->kmaps, modules_path);
+ return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0);
}
static int machine__create_module(void *arg, const char *name, u64 start)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] perf machine: Search for modules in %s/lib/modules/%s
2014-04-15 11:56 ` Jiri Olsa
@ 2014-04-26 17:20 ` Richard Yao
0 siblings, 0 replies; 10+ messages in thread
From: Richard Yao @ 2014-04-26 17:20 UTC (permalink / raw)
To: Jiri Olsa, Namhyung Kim
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
Arnaldo Carvalho de Melo, Adrian Hunter, David Ahern,
Stephane Eranian, Frederic Weisbecker, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]
Dear Jirka,
I have sent an updated patch, but instead of using your white list idea,
I went with a black list. That way things like the historical addon
directory are included and anyone who decides to use a custom directory
for their own in-development modules is free to do so.
Yours truly,
Richard Yao
On 04/15/2014 07:56 AM, Jiri Olsa wrote:
> On Tue, Apr 15, 2014 at 02:44:52PM +0900, Namhyung Kim wrote:
>> Hi Richard,
>>
>> On Thu, 10 Apr 2014 12:52:59 -0400, Richard Yao wrote:
>>> Modules installed outside of the kernel's build system should go into
>>> "%s/lib/modules/%s/extra", but at present, perf will only look at them
>>> when they are in "%s/lib/modules/%s/kernel". Lets encourage good
>>> citizenship by relaxing this requirement to "%s/lib/modules/%s". This
>>> way open source modules that are out-of-tree have no incentive to start
>>> populating a directory reserved for in-kernle modules and I can stop hex
>>> editing my system's perf binary when profiling OSS out-of-tree modules.
>>
>> But it'll make the perf traverses all the source and build directories
>> too, right? I don't think it's a right thing to do.
>>
>> Maybe we can also change stat() in map_groups__set_modules_path_dir() to
>> lstat() so that it cannot go to unwanted directories in that case. Or
>> else, just checking "kernel" and "extra" directories will work.
>
> yay, forgot about source directory.. :-\ looks like lstat should
> help, but hardcoding kernel and extra sounds better to me.
>
> Richard, please send updated patch
>
> thanks,
> jirka
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] perf machine: Search for modules in %s/lib/modules/%s
2014-04-15 5:44 ` Namhyung Kim
@ 2014-04-15 11:56 ` Jiri Olsa
2014-04-26 17:20 ` Richard Yao
0 siblings, 1 reply; 10+ messages in thread
From: Jiri Olsa @ 2014-04-15 11:56 UTC (permalink / raw)
To: Namhyung Kim
Cc: Richard Yao, Peter Zijlstra, Paul Mackerras, Ingo Molnar,
Arnaldo Carvalho de Melo, Adrian Hunter, David Ahern,
Stephane Eranian, Frederic Weisbecker, linux-kernel
On Tue, Apr 15, 2014 at 02:44:52PM +0900, Namhyung Kim wrote:
> Hi Richard,
>
> On Thu, 10 Apr 2014 12:52:59 -0400, Richard Yao wrote:
> > Modules installed outside of the kernel's build system should go into
> > "%s/lib/modules/%s/extra", but at present, perf will only look at them
> > when they are in "%s/lib/modules/%s/kernel". Lets encourage good
> > citizenship by relaxing this requirement to "%s/lib/modules/%s". This
> > way open source modules that are out-of-tree have no incentive to start
> > populating a directory reserved for in-kernle modules and I can stop hex
> > editing my system's perf binary when profiling OSS out-of-tree modules.
>
> But it'll make the perf traverses all the source and build directories
> too, right? I don't think it's a right thing to do.
>
> Maybe we can also change stat() in map_groups__set_modules_path_dir() to
> lstat() so that it cannot go to unwanted directories in that case. Or
> else, just checking "kernel" and "extra" directories will work.
yay, forgot about source directory.. :-\ looks like lstat should
help, but hardcoding kernel and extra sounds better to me.
Richard, please send updated patch
thanks,
jirka
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] perf machine: Search for modules in %s/lib/modules/%s
2014-04-10 16:52 [PATCH] perf machine: Search for modules in %s/lib/modules/%s Richard Yao
2014-04-11 17:19 ` David Ahern
@ 2014-04-15 5:44 ` Namhyung Kim
2014-04-15 11:56 ` Jiri Olsa
1 sibling, 1 reply; 10+ messages in thread
From: Namhyung Kim @ 2014-04-15 5:44 UTC (permalink / raw)
To: Richard Yao
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
Arnaldo Carvalho de Melo, Adrian Hunter, David Ahern, Jiri Olsa,
Stephane Eranian, Frederic Weisbecker, linux-kernel
Hi Richard,
On Thu, 10 Apr 2014 12:52:59 -0400, Richard Yao wrote:
> Modules installed outside of the kernel's build system should go into
> "%s/lib/modules/%s/extra", but at present, perf will only look at them
> when they are in "%s/lib/modules/%s/kernel". Lets encourage good
> citizenship by relaxing this requirement to "%s/lib/modules/%s". This
> way open source modules that are out-of-tree have no incentive to start
> populating a directory reserved for in-kernle modules and I can stop hex
> editing my system's perf binary when profiling OSS out-of-tree modules.
But it'll make the perf traverses all the source and build directories
too, right? I don't think it's a right thing to do.
Maybe we can also change stat() in map_groups__set_modules_path_dir() to
lstat() so that it cannot go to unwanted directories in that case. Or
else, just checking "kernel" and "extra" directories will work.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] perf machine: Search for modules in %s/lib/modules/%s
2014-04-10 16:52 [PATCH] perf machine: Search for modules in %s/lib/modules/%s Richard Yao
@ 2014-04-11 17:19 ` David Ahern
2014-04-15 5:44 ` Namhyung Kim
1 sibling, 0 replies; 10+ messages in thread
From: David Ahern @ 2014-04-11 17:19 UTC (permalink / raw)
To: Richard Yao, Peter Zijlstra
Cc: Paul Mackerras, Ingo Molnar, Arnaldo Carvalho de Melo,
Adrian Hunter, Jiri Olsa, Stephane Eranian, Frederic Weisbecker,
linux-kernel
On 4/10/14, 9:52 AM, Richard Yao wrote:
> Modules installed outside of the kernel's build system should go into
> "%s/lib/modules/%s/extra", but at present, perf will only look at them
> when they are in "%s/lib/modules/%s/kernel". Lets encourage good
> citizenship by relaxing this requirement to "%s/lib/modules/%s". This
> way open source modules that are out-of-tree have no incentive to start
> populating a directory reserved for in-kernle modules and I can stop hex
> editing my system's perf binary when profiling OSS out-of-tree modules.
>
> Signed-off-by: Richard Yao <ryao@gentoo.org>
> ---
> tools/perf/util/machine.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index a53cd0b..116842e 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -786,7 +786,7 @@ static int machine__set_modules_path(struct machine *machine)
> if (!version)
> return -1;
>
> - snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel",
> + snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
> machine->root_dir, version);
> free(version);
>
>
Acked-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] perf machine: Search for modules in %s/lib/modules/%s
@ 2014-04-10 16:52 Richard Yao
2014-04-11 17:19 ` David Ahern
2014-04-15 5:44 ` Namhyung Kim
0 siblings, 2 replies; 10+ messages in thread
From: Richard Yao @ 2014-04-10 16:52 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Paul Mackerras, Ingo Molnar, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Stephane Eranian,
Frederic Weisbecker, linux-kernel, Richard Yao
Modules installed outside of the kernel's build system should go into
"%s/lib/modules/%s/extra", but at present, perf will only look at them
when they are in "%s/lib/modules/%s/kernel". Lets encourage good
citizenship by relaxing this requirement to "%s/lib/modules/%s". This
way open source modules that are out-of-tree have no incentive to start
populating a directory reserved for in-kernle modules and I can stop hex
editing my system's perf binary when profiling OSS out-of-tree modules.
Signed-off-by: Richard Yao <ryao@gentoo.org>
---
tools/perf/util/machine.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index a53cd0b..116842e 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -786,7 +786,7 @@ static int machine__set_modules_path(struct machine *machine)
if (!version)
return -1;
- snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel",
+ snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
machine->root_dir, version);
free(version);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-05-01 6:32 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-26 17:17 [PATCH] perf machine: Search for modules in %s/lib/modules/%s Richard Yao
2014-04-27 10:05 ` Jiri Olsa
2014-04-29 8:06 ` Jiri Olsa
2014-04-29 23:46 ` Namhyung Kim
2014-05-01 6:32 ` [tip:perf/core] perf machine: Search for modules in %s/lib/ modules/%s tip-bot for Richard Yao
-- strict thread matches above, loose matches on Subject: below --
2014-04-10 16:52 [PATCH] perf machine: Search for modules in %s/lib/modules/%s Richard Yao
2014-04-11 17:19 ` David Ahern
2014-04-15 5:44 ` Namhyung Kim
2014-04-15 11:56 ` Jiri Olsa
2014-04-26 17:20 ` Richard Yao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.