Skip to contentSkip to conversation

perf tests: Check for ARM [vectors] page

PATCH Applied Florian Fainelli 5 participants 10 messages Dec 21, 2018 – Jan 11, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover perf tests: Check for ARM [vectors] page

Hi all,

I just painfully learned that perf would segfault when CONFIG_KUSER_HELPERS is disabled because it unconditionally makes use of it. This patch series adds an ARM test for that by leveraging the existing find_vdso_map() function and making it more generic and capable of location any map within /proc/self/maps.

Changes in v3:

- remove find_vdso_map() call find_map() with VDSO__MAP_NAME

Changes in v2:

- use strlen() instead of sizeof() -1 since we made the page name a parameter
- use TEST_OK/TEST_FAIL in lieu of 0/-1
- added an error message indicating CONFIG_KUSER_HELPERS might be disabled

Florian Fainelli (2):
perf tools: Make find_vdso_map() more modular perf tests: Add a test for the ARM 32-bit [vectors] page

 tools/perf/Makefile.perf                      |  4 ++--
 tools/perf/arch/arm/tests/Build               |  1 +
 tools/perf/arch/arm/tests/arch-tests.c        |  4 ++++
 tools/perf/arch/arm/tests/vectors-page.c      | 24 +++++++++++++++++++
 tools/perf/perf-read-vdso.c                   |  6 ++---
 tools/perf/tests/tests.h                      |  5 ++++
 .../perf/util/{find-vdso-map.c => find-map.c} |  7 +++---
 tools/perf/util/vdso.c                        |  6 ++---
 8 files changed, 45 insertions(+), 12 deletions(-)
 create mode 100644 tools/perf/arch/arm/tests/vectors-page.c
 rename tools/perf/util/{find-vdso-map.c => find-map.c} (71%)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v3 1/2 perf tools: Make find_vdso_map() more modular

In preparation for checking that the vectors page on the ARM architecture, refactor the find_vdso_map() function to accept finding an arbitrary string and create a dedicated helper function for that under util/find-map.c and update the filename to find-map.c and all references to it: perf-read-vdso.c and util/vdso.c.

---
 tools/perf/Makefile.perf                        | 4 ++--
 tools/perf/perf-read-vdso.c                     | 6 +++---
 tools/perf/util/{find-vdso-map.c => find-map.c} | 7 +++----
 tools/perf/util/vdso.c                          | 6 +++---
 4 files changed, 11 insertions(+), 12 deletions(-)
 rename tools/perf/util/{find-vdso-map.c => find-map.c} (71%)
tools/perf/Makefile.perf +2 -2
index d95655489f7e..04e70a664adb 100644
@@ -623,12 +623,12 @@ $(OUTPUT)perf-%: %.o $(PERFLIBS)
 	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
 
 ifndef NO_PERF_READ_VDSO32
-$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-vdso-map.c
+$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-map.c
 	$(QUIET_CC)$(CC) -m32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
 endif
 
 ifndef NO_PERF_READ_VDSOX32
-$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-vdso-map.c
+$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-map.c
 	$(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
 endif
 
tools/perf/perf-read-vdso.c +3 -3
index 8c0ca0cc428f..aaa5210ea84a 100644
@@ -5,17 +5,17 @@
 #define VDSO__MAP_NAME "[vdso]"
 
 /*
- * Include definition of find_vdso_map() also used in util/vdso.c for
+ * Include definition of find_map() also used in util/vdso.c for
  * building perf.
  */
-#include "util/find-vdso-map.c"
+#include "util/find-map.c"
 
 int main(void)
 {
 	void *start, *end;
 	size_t size, written;
 
-	if (find_vdso_map(&start, &end))
+	if (find_map(&start, &end, VDSO__MAP_NAME))
 		return 1;
 
 	size = end - start;
tools/perf/util/find-map.c renamed from tools/perf/util/find-vdso-map.c +3 -4
similarity index 71%
rename from tools/perf/util/find-vdso-map.c
rename to tools/perf/util/find-map.c
index d7823e3508fc..7b2300588ece 100644
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-static int find_vdso_map(void **start, void **end)
+static int find_map(void **start, void **end, const char *name)
 {
 	FILE *maps;
 	char line[128];
@@ -7,7 +7,7 @@ static int find_vdso_map(void **start, void **end)
 
 	maps = fopen("/proc/self/maps", "r");
 	if (!maps) {
-		fprintf(stderr, "vdso: cannot open maps\n");
+		fprintf(stderr, "cannot open maps\n");
 		return -1;
 	}
 
@@ -21,8 +21,7 @@ static int find_vdso_map(void **start, void **end)
 		if (m < 0)
 			continue;
 
-		if (!strncmp(&line[m], VDSO__MAP_NAME,
-			     sizeof(VDSO__MAP_NAME) - 1))
+		if (!strncmp(&line[m], name, strlen(name)))
 			found = 1;
 	}
 
tools/perf/util/vdso.c +3 -3
index 741af209b19d..3702cba11d7d 100644
@@ -18,10 +18,10 @@
 #include "debug.h"
 
 /*
- * Include definition of find_vdso_map() also used in perf-read-vdso.c for
+ * Include definition of find_map() also used in perf-read-vdso.c for
  * building perf-read-vdso32 and perf-read-vdsox32.
  */
-#include "find-vdso-map.c"
+#include "find-map.c"
 
 #define VDSO__TEMP_FILE_NAME "/tmp/perf-vdso.so-XXXXXX"
 
@@ -76,7 +76,7 @@ static char *get_file(struct vdso_file *vdso_file)
 	if (vdso_file->found)
 		return vdso_file->temp_file_name;
 
-	if (vdso_file->error || find_vdso_map(&start, &end))
+	if (vdso_file->error || find_map(&start, &end, VDSO__MAP_NAME))
 		return NULL;
 
 	size = end - start;
Signature · 1 line
2.17.1
#2 lore raw

[tip:perf/urgent] perf tools: Make find_vdso_map() more modular

perf tools: Make find_vdso_map() more modular
Commit-ID:  011532379b7c2de6757e129037bdfc8d704bce23
Gitweb:     https://git.kernel.org/tip/011532379b7c2de6757e129037bdfc8d704bce23
Author:     Florian Fainelli <[email protected]>
AuthorDate: Thu, 20 Dec 2018 19:43:36 -0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 8 Jan 2019 13:28:13 -0300

perf tools: Make find_vdso_map() more modular

In preparation for checking that the vectors page on the ARM architecture, refactor the find_vdso_map() function to accept finding an arbitrary string and create a dedicated helper function for that under util/find-map.c and update the filename to find-map.c and all references to it: perf-read-vdso.c and util/vdso.c.

Cc Alexander Shishkin <[email protected]>
Cc Chris Healy <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Kim Phillips <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ravi Bangoria <[email protected]>
Cc Russell King <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Thomas Richter <[email protected]>
---
 tools/perf/Makefile.perf                        | 4 ++--
 tools/perf/perf-read-vdso.c                     | 6 +++---
 tools/perf/util/{find-vdso-map.c => find-map.c} | 7 +++----
 tools/perf/util/vdso.c                          | 6 +++---
 4 files changed, 11 insertions(+), 12 deletions(-)
tools/perf/Makefile.perf +2 -2
index 2921f829a0f4..0ee6795d82cc 100644
@@ -662,12 +662,12 @@ $(OUTPUT)perf-%: %.o $(PERFLIBS)
 	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
 
 ifndef NO_PERF_READ_VDSO32
-$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-vdso-map.c
+$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-map.c
 	$(QUIET_CC)$(CC) -m32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
 endif
 
 ifndef NO_PERF_READ_VDSOX32
-$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-vdso-map.c
+$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-map.c
 	$(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
 endif
 
tools/perf/perf-read-vdso.c +3 -3
index 8c0ca0cc428f..aaa5210ea84a 100644
@@ -5,17 +5,17 @@
 #define VDSO__MAP_NAME "[vdso]"
 
 /*
- * Include definition of find_vdso_map() also used in util/vdso.c for
+ * Include definition of find_map() also used in util/vdso.c for
  * building perf.
  */
-#include "util/find-vdso-map.c"
+#include "util/find-map.c"
 
 int main(void)
 {
 	void *start, *end;
 	size_t size, written;
 
-	if (find_vdso_map(&start, &end))
+	if (find_map(&start, &end, VDSO__MAP_NAME))
 		return 1;
 
 	size = end - start;
tools/perf/util/find-map.c renamed from tools/perf/util/find-vdso-map.c +3 -4
similarity index 71%
rename from tools/perf/util/find-vdso-map.c
rename to tools/perf/util/find-map.c
index d7823e3508fc..7b2300588ece 100644
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-static int find_vdso_map(void **start, void **end)
+static int find_map(void **start, void **end, const char *name)
 {
 	FILE *maps;
 	char line[128];
@@ -7,7 +7,7 @@ static int find_vdso_map(void **start, void **end)
 
 	maps = fopen("/proc/self/maps", "r");
 	if (!maps) {
-		fprintf(stderr, "vdso: cannot open maps\n");
+		fprintf(stderr, "cannot open maps\n");
 		return -1;
 	}
 
@@ -21,8 +21,7 @@ static int find_vdso_map(void **start, void **end)
 		if (m < 0)
 			continue;
 
-		if (!strncmp(&line[m], VDSO__MAP_NAME,
-			     sizeof(VDSO__MAP_NAME) - 1))
+		if (!strncmp(&line[m], name, strlen(name)))
 			found = 1;
 	}
 
tools/perf/util/vdso.c +3 -3
index 741af209b19d..3702cba11d7d 100644
@@ -18,10 +18,10 @@
 #include "debug.h"
 
 /*
- * Include definition of find_vdso_map() also used in perf-read-vdso.c for
+ * Include definition of find_map() also used in perf-read-vdso.c for
  * building perf-read-vdso32 and perf-read-vdsox32.
  */
-#include "find-vdso-map.c"
+#include "find-map.c"
 
 #define VDSO__TEMP_FILE_NAME "/tmp/perf-vdso.so-XXXXXX"
 
@@ -76,7 +76,7 @@ static char *get_file(struct vdso_file *vdso_file)
 	if (vdso_file->found)
 		return vdso_file->temp_file_name;
 
-	if (vdso_file->error || find_vdso_map(&start, &end))
+	if (vdso_file->error || find_map(&start, &end, VDSO__MAP_NAME))
 		return NULL;
 
 	size = end - start;
#3 lore raw

PATCH v3 2/2 perf tests: Add a test for the ARM 32-bit [vectors] page

In reply to Florian Fainelli

perf on ARM requires CONFIG_KUSER_HELPERS to be turned on to allow some independance with respect to the ARM CPU being used. Add a test which tries to locate the [vectors] page, created when CONFIG_KUSER_HELPERS is turned on to help asses the system's health.

---
 tools/perf/arch/arm/tests/Build          |  1 +
 tools/perf/arch/arm/tests/arch-tests.c   |  4 ++++
 tools/perf/arch/arm/tests/vectors-page.c | 24 ++++++++++++++++++++++++
 tools/perf/tests/tests.h                 |  5 +++++
 4 files changed, 34 insertions(+)
 create mode 100644 tools/perf/arch/arm/tests/vectors-page.c
tools/perf/arch/arm/tests/Build +1 -0
index 883c57ff0c08..d9ae2733f9cc 100644
@@ -1,4 +1,5 @@
 libperf-y += regs_load.o
 libperf-y += dwarf-unwind.o
+libperf-y += vectors-page.o
 
 libperf-y += arch-tests.o
tools/perf/arch/arm/tests/arch-tests.c +4 -0
index 5b1543c98022..6848101a855f 100644
@@ -10,6 +10,10 @@ struct test arch_tests[] = {
 		.func = test__dwarf_unwind,
 	},
 #endif
+	{
+		.desc = "Vectors page",
+		.func = test__vectors_page,
+	},
 	{
 		.func = NULL,
 	},
tools/perf/arch/arm/tests/vectors-page.c new file +24 -0
new file mode 100644
index 000000000000..7ffdd79971c8
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <stdio.h>
+#include <string.h>
+#include <linux/compiler.h>
+
+#include "debug.h"
+#include "tests/tests.h"
+#include "util/find-map.c"
+
+#define VECTORS__MAP_NAME "[vectors]"
+
+int test__vectors_page(struct test *test __maybe_unused,
+		       int subtest __maybe_unused)
+{
+	void *start, *end;
+
+	if (find_map(&start, &end, VECTORS__MAP_NAME)) {
+		pr_err("%s not found, is CONFIG_KUSER_HELPERS enabled?\n",
+		       VECTORS__MAP_NAME);
+		return TEST_FAIL;
+	}
+
+	return TEST_OK;
+}
tools/perf/tests/tests.h +5 -0
index b82f55fcc294..399f18ca71a3 100644
@@ -119,4 +119,9 @@ int test__arch_unwind_sample(struct perf_sample *sample,
 			     struct thread *thread);
 #endif
 #endif
+
+#if defined(__arm__)
+int test__vectors_page(struct test *test, int subtest);
+#endif
+
 #endif /* TESTS_H */
Signature · 1 line
2.17.1
#4 lore raw

[tip:perf/urgent] perf tests: Add a test for the ARM 32-bit [vectors] page

perf tests: Add a test for the ARM 32-bit [vectors] page
Commit-ID:  21327c7843e9169d5e2e527713e60e6c9842a56c
Gitweb:     https://git.kernel.org/tip/21327c7843e9169d5e2e527713e60e6c9842a56c
Author:     Florian Fainelli <[email protected]>
AuthorDate: Thu, 20 Dec 2018 19:43:37 -0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 8 Jan 2019 13:28:13 -0300

perf tests: Add a test for the ARM 32-bit [vectors] page

perf on ARM requires CONFIG_KUSER_HELPERS to be turned on to allow some independance with respect to the ARM CPU being used. Add a test which tries to locate the [vectors] page, created when CONFIG_KUSER_HELPERS is turned on to help asses the system's health.

Cc Alexander Shishkin <[email protected]>
Cc Chris Healy <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Kim Phillips <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ravi Bangoria <[email protected]>
Cc Russell King <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Thomas Richter <[email protected]>
---
 tools/perf/arch/arm/tests/Build          |  1 +
 tools/perf/arch/arm/tests/arch-tests.c   |  4 ++++
 tools/perf/arch/arm/tests/vectors-page.c | 24 ++++++++++++++++++++++++
 tools/perf/tests/tests.h                 |  5 +++++
 4 files changed, 34 insertions(+)
tools/perf/arch/arm/tests/Build +1 -0
index 883c57ff0c08..d9ae2733f9cc 100644
@@ -1,4 +1,5 @@
 libperf-y += regs_load.o
 libperf-y += dwarf-unwind.o
+libperf-y += vectors-page.o
 
 libperf-y += arch-tests.o
tools/perf/arch/arm/tests/arch-tests.c +4 -0
index 5b1543c98022..6848101a855f 100644
@@ -10,6 +10,10 @@ struct test arch_tests[] = {
 		.func = test__dwarf_unwind,
 	},
 #endif
+	{
+		.desc = "Vectors page",
+		.func = test__vectors_page,
+	},
 	{
 		.func = NULL,
 	},
tools/perf/arch/arm/tests/vectors-page.c new file +24 -0
new file mode 100644
index 000000000000..7ffdd79971c8
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <stdio.h>
+#include <string.h>
+#include <linux/compiler.h>
+
+#include "debug.h"
+#include "tests/tests.h"
+#include "util/find-map.c"
+
+#define VECTORS__MAP_NAME "[vectors]"
+
+int test__vectors_page(struct test *test __maybe_unused,
+		       int subtest __maybe_unused)
+{
+	void *start, *end;
+
+	if (find_map(&start, &end, VECTORS__MAP_NAME)) {
+		pr_err("%s not found, is CONFIG_KUSER_HELPERS enabled?\n",
+		       VECTORS__MAP_NAME);
+		return TEST_FAIL;
+	}
+
+	return TEST_OK;
+}
tools/perf/tests/tests.h +5 -0
index b82f55fcc294..399f18ca71a3 100644
@@ -119,4 +119,9 @@ int test__arch_unwind_sample(struct perf_sample *sample,
 			     struct thread *thread);
 #endif
 #endif
+
+#if defined(__arm__)
+int test__vectors_page(struct test *test, int subtest);
+#endif
+
 #endif /* TESTS_H */
maintainer
#5 lore raw
In reply to Florian Fainelli

Hello,

Quoted 4 lines · Florian Fainelli

Hi all,

I just painfully learned that perf would segfault when CONFIG_KUSER_HELPERS is disabled because it unconditionally makes use of

Could you please elaborate?

Thanks,
Namhyung

Quoted 35 lines

it. This patch series adds an ARM test for that by leveraging the existing find_vdso_map() function and making it more generic and capable of location any map within /proc/self/maps.

Changes in v3:

- remove find_vdso_map() call find_map() with VDSO__MAP_NAME

Changes in v2:

- use strlen() instead of sizeof() -1 since we made the page name a parameter
- use TEST_OK/TEST_FAIL in lieu of 0/-1
- added an error message indicating CONFIG_KUSER_HELPERS might be disabled

Florian Fainelli (2):
perf tools: Make find_vdso_map() more modular perf tests: Add a test for the ARM 32-bit [vectors] page

 tools/perf/Makefile.perf                      |  4 ++--
 tools/perf/arch/arm/tests/Build               |  1 +
 tools/perf/arch/arm/tests/arch-tests.c        |  4 ++++
 tools/perf/arch/arm/tests/vectors-page.c      | 24 +++++++++++++++++++
 tools/perf/perf-read-vdso.c                   |  6 ++---
 tools/perf/tests/tests.h                      |  5 ++++
 .../perf/util/{find-vdso-map.c => find-map.c} |  7 +++---
 tools/perf/util/vdso.c                        |  6 ++---
 8 files changed, 45 insertions(+), 12 deletions(-)
 create mode 100644 tools/perf/arch/arm/tests/vectors-page.c
 rename tools/perf/util/{find-vdso-map.c => find-map.c} (71%)
Signature · 1 line
2.17.1
#6 lore raw

Le 12/27/18 à 2:55 AM, Namhyung Kim a écrit :

Quoted 9 lines

Hello,

Quoted 4 lines · Florian Fainelli

Hi all,

I just painfully learned that perf would segfault when CONFIG_KUSER_HELPERS is disabled because it unconditionally makes use of

Could you please elaborate?

Sure, I was debugging why perf was segfaulting on my systems and saw that the faulting address was within 0xffff_0000 (high vectors); and because CONFIG_KUSER_HELPERS was not enabled, nothing was mapped at that address so this was a legitimate crash. This was on a variety of ARMv7A systems, Cortex-A9, Cortex-A5 etc.

Later on, I found that in tools/arch/arm/include/asm/barrier.h the barriers are unconditionally defined to make use of the [vectors] page that the ARM kernel only sets up when CONFIG_KUSER_HELPERS is enabled and this is the reason for the crash.

Testing for the page itself is pretty harmless if you think we should make something more robust around checking for HAVE_AUXTRACE_SUPPORT (which appears to be the specific location making use of barriers), let me know.

Thanks!

Quoted 40 lines

Thanks,
Namhyung

Quoted 35 lines

it. This patch series adds an ARM test for that by leveraging the existing find_vdso_map() function and making it more generic and capable of location any map within /proc/self/maps.

Changes in v3:

- remove find_vdso_map() call find_map() with VDSO__MAP_NAME

Changes in v2:

- use strlen() instead of sizeof() -1 since we made the page name a parameter
- use TEST_OK/TEST_FAIL in lieu of 0/-1
- added an error message indicating CONFIG_KUSER_HELPERS might be disabled

Florian Fainelli (2):
perf tools: Make find_vdso_map() more modular perf tests: Add a test for the ARM 32-bit [vectors] page

 tools/perf/Makefile.perf                      |  4 ++--
 tools/perf/arch/arm/tests/Build               |  1 +
 tools/perf/arch/arm/tests/arch-tests.c        |  4 ++++
 tools/perf/arch/arm/tests/vectors-page.c      | 24 +++++++++++++++++++
 tools/perf/perf-read-vdso.c                   |  6 ++---
 tools/perf/tests/tests.h                      |  5 ++++
 .../perf/util/{find-vdso-map.c => find-map.c} |  7 +++---
 tools/perf/util/vdso.c                        |  6 ++---
 8 files changed, 45 insertions(+), 12 deletions(-)
 create mode 100644 tools/perf/arch/arm/tests/vectors-page.c
 rename tools/perf/util/{find-vdso-map.c => find-map.c} (71%)
Signature · 1 line
2.17.1
Signature · 1 line
Florian
maintainer
#7 lore raw

Hello,

Sorry for being so late.

Quoted 22 lines · Florian Fainelli

Le 12/27/18 à 2:55 AM, Namhyung Kim a écrit :

Quoted 9 lines

Hello,

Quoted 4 lines · Florian Fainelli

Hi all,

I just painfully learned that perf would segfault when CONFIG_KUSER_HELPERS is disabled because it unconditionally makes use of

Could you please elaborate?

Sure, I was debugging why perf was segfaulting on my systems and saw that the faulting address was within 0xffff_0000 (high vectors); and because CONFIG_KUSER_HELPERS was not enabled, nothing was mapped at that address so this was a legitimate crash. This was on a variety of ARMv7A systems, Cortex-A9, Cortex-A5 etc.

Later on, I found that in tools/arch/arm/include/asm/barrier.h the barriers are unconditionally defined to make use of the [vectors] page that the ARM kernel only sets up when CONFIG_KUSER_HELPERS is enabled and this is the reason for the crash.

Quoted 4 lines

Testing for the page itself is pretty harmless if you think we should make something more robust around checking for HAVE_AUXTRACE_SUPPORT (which appears to be the specific location making use of barriers), let me know.

Thanks for the explanation.

Is there anything we can do instead if CONFIG_KUSER_HELPERS is not defined?

I think it'd be better making the barriers into functions (probably with "static inline") and configurable depending on a result of runtime checking of the availability (like you did).

The init routine of the auxtrace (or other future users of barriers) should call an arch-specific function to check the availability then.

Thanks,
Namhyung

Acked-by on the v3 series
#8 lore raw
In reply to Florian Fainelli
Quoted 20 lines · Florian Fainelli

Hi all,

I just painfully learned that perf would segfault when CONFIG_KUSER_HELPERS is disabled because it unconditionally makes use of it. This patch series adds an ARM test for that by leveraging the existing find_vdso_map() function and making it more generic and capable of location any map within /proc/self/maps.

Changes in v3:

- remove find_vdso_map() call find_map() with VDSO__MAP_NAME

Changes in v2:

- use strlen() instead of sizeof() -1 since we made the page name a parameter
- use TEST_OK/TEST_FAIL in lieu of 0/-1
- added an error message indicating CONFIG_KUSER_HELPERS might be disabled

Quoted 3 lines

Florian Fainelli (2):
perf tools: Make find_vdso_map() more modular perf tests: Add a test for the ARM 32-bit [vectors] page

thanks,
jirka

Quoted 16 lines
 tools/perf/Makefile.perf                      |  4 ++--
 tools/perf/arch/arm/tests/Build               |  1 +
 tools/perf/arch/arm/tests/arch-tests.c        |  4 ++++
 tools/perf/arch/arm/tests/vectors-page.c      | 24 +++++++++++++++++++
 tools/perf/perf-read-vdso.c                   |  6 ++---
 tools/perf/tests/tests.h                      |  5 ++++
 .../perf/util/{find-vdso-map.c => find-map.c} |  7 +++---
 tools/perf/util/vdso.c                        |  6 ++---
 8 files changed, 45 insertions(+), 12 deletions(-)
 create mode 100644 tools/perf/arch/arm/tests/vectors-page.c
 rename tools/perf/util/{find-vdso-map.c => find-map.c} (71%)
Signature · 1 line
2.17.1
maintainer Applied
#9 lore raw

Em Tue, Jan 01, 2019 at 06:39:26PM +0100, Jiri Olsa escreveu:

Quoted 19 lines · Florian Fainelli
Quoted 18 lines

I just painfully learned that perf would segfault when CONFIG_KUSER_HELPERS is disabled because it unconditionally makes use of it. This patch series adds an ARM test for that by leveraging the existing find_vdso_map() function and making it more generic and capable of location any map within /proc/self/maps.

Changes in v3:

- remove find_vdso_map() call find_map() with VDSO__MAP_NAME

Changes in v2:

- use strlen() instead of sizeof() -1 since we made the page name a parameter
- use TEST_OK/TEST_FAIL in lieu of 0/-1
- added an error message indicating CONFIG_KUSER_HELPERS might be disabled

Quoted 5 lines
Quoted 3 lines

Florian Fainelli (2):
perf tools: Make find_vdso_map() more modular perf tests: Add a test for the ARM 32-bit [vectors] page

Thanks, applied.

- Arnaldo