Skip to contentSkip to conversation

perf: Do not require /lib/modules/* on a guest

PATCH In review Jason Wessel 3 participants 3 messages Jul 15, 2013 – Aug 12, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: Do not require /lib/modules/* on a guest

For some types of work loads and special guest environments, you might have a kernel that has no kernel modules. The perf kvm record tool fails instantiate vmlinux maps when the kernel modules directory cannot be opened, even though the kallsyms has been properly processed. This leads to a perf kvm report that has no guest symbols resolved.

This patch changes the failure to locate kernel modules to be non-fatal.

---
 tools/perf/util/machine.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/machine.c +4 -1
index b2ecad6..eb9ebd6 100644
@@ -808,7 +808,10 @@ static int machine__create_modules(struct machine *machine)
 	free(line);
 	fclose(file);
 
-	return machine__set_modules_path(machine);
+	if (machine__set_modules_path(machine) < 0) {
+		pr_debug("Problems setting modules path maps, continuing anyway...\n");
+	}
+	return 0;
 
 out_delete_line:
 	free(line);
Signature · 1 line
1.7.9.5
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jason Wessel

For some types of work loads and special guest environments, you might have a kernel that has no kernel modules. The perf kvm record tool fails instantiate vmlinux maps when the kernel modules directory cannot be opened, even though the kallsyms has been properly processed. This leads to a perf kvm report that has no guest symbols resolved.

Theoretically, use of modules is an option:

    if (symbol_conf.use_modules && machine__create_modules(machine) < 0) {
...
    }

But, the use_modules option was flipped from false to true by b32d133a back in 2009. And the lack of complaints suggests this ominous warning in perf-report, diff and annotate is moot:

OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules,
"load module symbols - WARNING: use only with -k and LIVE
kernel"),

Quoted 15 lines

This patch changes the failure to locate kernel modules to be non-fatal.

---
  tools/perf/util/machine.c |    5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/machine.c +0 -0
index b2ecad6..eb9ebd6 100644
@@ -808,7 +808,10 @@ static int machine__create_modules(struct machine *machine)
  	free(line);

tools/perf/util/machine.c static int machine__create_modules(struct machine *machine) · line 817

Quoted 10 lines
tools/perf/util/machine.c +4 -1
  	fclose(file);
 
-	return machine__set_modules_path(machine);
+	if (machine__set_modules_path(machine) < 0) {
+		pr_debug("Problems setting modules path maps, continuing anyway...\n");
+	}
+	return 0;
 
  out_delete_line:
  	free(line);
#2 lore raw

[tip:perf/core] perf machine: Do not require /lib/modules/ * on a guest

In reply to Jason Wessel
perf machine: Do not require /lib/modules/* on a guest
Commit-ID:  8f76fcd902e3b3a7d6f6c695cc8bc053579eb179
Gitweb:     http://git.kernel.org/tip/8f76fcd902e3b3a7d6f6c695cc8bc053579eb179
Author:     Jason Wessel <[email protected]>
AuthorDate: Mon, 15 Jul 2013 15:27:53 -0500
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 7 Aug 2013 17:35:41 -0300

perf machine: Do not require /lib/modules/* on a guest

For some types of work loads and special guest environments, you might have a kernel that has no kernel modules. The perf kvm record tool fails instantiate vmlinux maps when the kernel modules directory cannot be opened, even though the kallsyms has been properly processed. This leads to a perf kvm report that has no guest symbols resolved.

This patch changes the failure to locate kernel modules to be non-fatal.

---
 tools/perf/util/machine.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/machine.c +4 -1
index ef3b49c..6fcc358 100644
@@ -806,7 +806,10 @@ static int machine__create_modules(struct machine *machine)
 	free(line);
 	fclose(file);
 
-	return machine__set_modules_path(machine);
+	if (machine__set_modules_path(machine) < 0) {
+		pr_debug("Problems setting modules path maps, continuing anyway...\n");
+	}
+	return 0;
 
 out_delete_line:
 	free(line);