* [PATCH 0/2] perf tests: Check for ARM [vectors] page @ 2018-10-25 0:09 ` Florian Fainelli 0 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 0:09 UTC (permalink / raw) To: linux-arm-kernel 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. 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/arch/arm/tests/Build | 1 + tools/perf/arch/arm/tests/arch-tests.c | 4 +++ tools/perf/arch/arm/tests/vectors-page.c | 20 +++++++++++++++ tools/perf/tests/tests.h | 5 ++++ tools/perf/util/find-map.c | 31 ++++++++++++++++++++++++ tools/perf/util/find-vdso-map.c | 30 +++-------------------- 6 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 tools/perf/arch/arm/tests/vectors-page.c create mode 100644 tools/perf/util/find-map.c -- 2.17.1 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 0/2] perf tests: Check for ARM [vectors] page @ 2018-10-25 0:09 ` Florian Fainelli 0 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 0:09 UTC (permalink / raw) To: linux-arm-kernel Cc: Florian Fainelli, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Kim Phillips, Greg Kroah-Hartman, Thomas Gleixner, Ravi Bangoria, Thomas Richter, open list, rmk+kernel, l.stach 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. 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/arch/arm/tests/Build | 1 + tools/perf/arch/arm/tests/arch-tests.c | 4 +++ tools/perf/arch/arm/tests/vectors-page.c | 20 +++++++++++++++ tools/perf/tests/tests.h | 5 ++++ tools/perf/util/find-map.c | 31 ++++++++++++++++++++++++ tools/perf/util/find-vdso-map.c | 30 +++-------------------- 6 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 tools/perf/arch/arm/tests/vectors-page.c create mode 100644 tools/perf/util/find-map.c -- 2.17.1 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/2] perf tools: Make find_vdso_map() more modular 2018-10-25 0:09 ` Florian Fainelli @ 2018-10-25 0:09 ` Florian Fainelli -1 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 0:09 UTC (permalink / raw) To: linux-arm-kernel 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 find_vdso_map() to use it. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- tools/perf/util/find-map.c | 31 +++++++++++++++++++++++++++++++ tools/perf/util/find-vdso-map.c | 30 +++--------------------------- 2 files changed, 34 insertions(+), 27 deletions(-) create mode 100644 tools/perf/util/find-map.c diff --git a/tools/perf/util/find-map.c b/tools/perf/util/find-map.c new file mode 100644 index 000000000000..42533fc21108 --- /dev/null +++ b/tools/perf/util/find-map.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 +static int find_map(void **start, void **end, const char *name) +{ + FILE *maps; + char line[128]; + int found = 0; + + maps = fopen("/proc/self/maps", "r"); + if (!maps) { + fprintf(stderr, "vdso: cannot open maps\n"); + return -1; + } + + while (!found && fgets(line, sizeof(line), maps)) { + int m = -1; + + /* We care only about private r-x mappings. */ + if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n", + start, end, &m)) + continue; + if (m < 0) + continue; + + if (!strncmp(&line[m], name, sizeof(name) - 1)) + found = 1; + } + + fclose(maps); + return !found; +} + diff --git a/tools/perf/util/find-vdso-map.c b/tools/perf/util/find-vdso-map.c index d7823e3508fc..840d7d6e29e2 100644 --- a/tools/perf/util/find-vdso-map.c +++ b/tools/perf/util/find-vdso-map.c @@ -1,31 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 +#include "find-map.c" + static int find_vdso_map(void **start, void **end) { - FILE *maps; - char line[128]; - int found = 0; - - maps = fopen("/proc/self/maps", "r"); - if (!maps) { - fprintf(stderr, "vdso: cannot open maps\n"); - return -1; - } - - while (!found && fgets(line, sizeof(line), maps)) { - int m = -1; - - /* We care only about private r-x mappings. */ - if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n", - start, end, &m)) - continue; - if (m < 0) - continue; - - if (!strncmp(&line[m], VDSO__MAP_NAME, - sizeof(VDSO__MAP_NAME) - 1)) - found = 1; - } - - fclose(maps); - return !found; + return find_map(start, end, VDSO__MAP_NAME); } -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 1/2] perf tools: Make find_vdso_map() more modular @ 2018-10-25 0:09 ` Florian Fainelli 0 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 0:09 UTC (permalink / raw) To: linux-arm-kernel Cc: Florian Fainelli, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Kim Phillips, Greg Kroah-Hartman, Thomas Gleixner, Ravi Bangoria, Thomas Richter, open list, rmk+kernel, l.stach 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 find_vdso_map() to use it. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- tools/perf/util/find-map.c | 31 +++++++++++++++++++++++++++++++ tools/perf/util/find-vdso-map.c | 30 +++--------------------------- 2 files changed, 34 insertions(+), 27 deletions(-) create mode 100644 tools/perf/util/find-map.c diff --git a/tools/perf/util/find-map.c b/tools/perf/util/find-map.c new file mode 100644 index 000000000000..42533fc21108 --- /dev/null +++ b/tools/perf/util/find-map.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 +static int find_map(void **start, void **end, const char *name) +{ + FILE *maps; + char line[128]; + int found = 0; + + maps = fopen("/proc/self/maps", "r"); + if (!maps) { + fprintf(stderr, "vdso: cannot open maps\n"); + return -1; + } + + while (!found && fgets(line, sizeof(line), maps)) { + int m = -1; + + /* We care only about private r-x mappings. */ + if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n", + start, end, &m)) + continue; + if (m < 0) + continue; + + if (!strncmp(&line[m], name, sizeof(name) - 1)) + found = 1; + } + + fclose(maps); + return !found; +} + diff --git a/tools/perf/util/find-vdso-map.c b/tools/perf/util/find-vdso-map.c index d7823e3508fc..840d7d6e29e2 100644 --- a/tools/perf/util/find-vdso-map.c +++ b/tools/perf/util/find-vdso-map.c @@ -1,31 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 +#include "find-map.c" + static int find_vdso_map(void **start, void **end) { - FILE *maps; - char line[128]; - int found = 0; - - maps = fopen("/proc/self/maps", "r"); - if (!maps) { - fprintf(stderr, "vdso: cannot open maps\n"); - return -1; - } - - while (!found && fgets(line, sizeof(line), maps)) { - int m = -1; - - /* We care only about private r-x mappings. */ - if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n", - start, end, &m)) - continue; - if (m < 0) - continue; - - if (!strncmp(&line[m], VDSO__MAP_NAME, - sizeof(VDSO__MAP_NAME) - 1)) - found = 1; - } - - fclose(maps); - return !found; + return find_map(start, end, VDSO__MAP_NAME); } -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 1/2] perf tools: Make find_vdso_map() more modular 2018-10-25 0:09 ` Florian Fainelli @ 2018-10-25 0:14 ` Florian Fainelli -1 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 0:14 UTC (permalink / raw) To: linux-arm-kernel On 10/24/18 5:09 PM, Florian Fainelli wrote: > 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 find_vdso_map() to use it. > > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> > --- > tools/perf/util/find-map.c | 31 +++++++++++++++++++++++++++++++ > tools/perf/util/find-vdso-map.c | 30 +++--------------------------- > 2 files changed, 34 insertions(+), 27 deletions(-) > create mode 100644 tools/perf/util/find-map.c > > diff --git a/tools/perf/util/find-map.c b/tools/perf/util/find-map.c > new file mode 100644 > index 000000000000..42533fc21108 > --- /dev/null > +++ b/tools/perf/util/find-map.c > @@ -0,0 +1,31 @@ > +// SPDX-License-Identifier: GPL-2.0 > +static int find_map(void **start, void **end, const char *name) > +{ > + FILE *maps; > + char line[128]; > + int found = 0; > + > + maps = fopen("/proc/self/maps", "r"); > + if (!maps) { > + fprintf(stderr, "vdso: cannot open maps\n"); > + return -1; > + } > + > + while (!found && fgets(line, sizeof(line), maps)) { > + int m = -1; > + > + /* We care only about private r-x mappings. */ > + if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n", > + start, end, &m)) > + continue; > + if (m < 0) > + continue; > + > + if (!strncmp(&line[m], name, sizeof(name) - 1)) Meh, this should be strlen() now, but I would like to hear comments before submitting a v2 of this anyway. Thanks! -- Florian ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2] perf tools: Make find_vdso_map() more modular @ 2018-10-25 0:14 ` Florian Fainelli 0 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 0:14 UTC (permalink / raw) To: linux-arm-kernel Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Kim Phillips, Greg Kroah-Hartman, Thomas Gleixner, Ravi Bangoria, Thomas Richter, open list, rmk+kernel, l.stach On 10/24/18 5:09 PM, Florian Fainelli wrote: > 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 find_vdso_map() to use it. > > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> > --- > tools/perf/util/find-map.c | 31 +++++++++++++++++++++++++++++++ > tools/perf/util/find-vdso-map.c | 30 +++--------------------------- > 2 files changed, 34 insertions(+), 27 deletions(-) > create mode 100644 tools/perf/util/find-map.c > > diff --git a/tools/perf/util/find-map.c b/tools/perf/util/find-map.c > new file mode 100644 > index 000000000000..42533fc21108 > --- /dev/null > +++ b/tools/perf/util/find-map.c > @@ -0,0 +1,31 @@ > +// SPDX-License-Identifier: GPL-2.0 > +static int find_map(void **start, void **end, const char *name) > +{ > + FILE *maps; > + char line[128]; > + int found = 0; > + > + maps = fopen("/proc/self/maps", "r"); > + if (!maps) { > + fprintf(stderr, "vdso: cannot open maps\n"); > + return -1; > + } > + > + while (!found && fgets(line, sizeof(line), maps)) { > + int m = -1; > + > + /* We care only about private r-x mappings. */ > + if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n", > + start, end, &m)) > + continue; > + if (m < 0) > + continue; > + > + if (!strncmp(&line[m], name, sizeof(name) - 1)) Meh, this should be strlen() now, but I would like to hear comments before submitting a v2 of this anyway. Thanks! -- Florian ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page 2018-10-25 0:09 ` Florian Fainelli @ 2018-10-25 0:09 ` Florian Fainelli -1 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 0:09 UTC (permalink / raw) To: linux-arm-kernel 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. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- tools/perf/arch/arm/tests/Build | 1 + tools/perf/arch/arm/tests/arch-tests.c | 4 ++++ tools/perf/arch/arm/tests/vectors-page.c | 20 ++++++++++++++++++++ tools/perf/tests/tests.h | 5 +++++ 4 files changed, 30 insertions(+) create mode 100644 tools/perf/arch/arm/tests/vectors-page.c diff --git a/tools/perf/arch/arm/tests/Build b/tools/perf/arch/arm/tests/Build index 883c57ff0c08..d9ae2733f9cc 100644 --- a/tools/perf/arch/arm/tests/Build +++ b/tools/perf/arch/arm/tests/Build @@ -1,4 +1,5 @@ libperf-y += regs_load.o libperf-y += dwarf-unwind.o +libperf-y += vectors-page.o libperf-y += arch-tests.o diff --git a/tools/perf/arch/arm/tests/arch-tests.c b/tools/perf/arch/arm/tests/arch-tests.c index 5b1543c98022..6848101a855f 100644 --- a/tools/perf/arch/arm/tests/arch-tests.c +++ b/tools/perf/arch/arm/tests/arch-tests.c @@ -10,6 +10,10 @@ struct test arch_tests[] = { .func = test__dwarf_unwind, }, #endif + { + .desc = "Vectors page", + .func = test__vectors_page, + }, { .func = NULL, }, diff --git a/tools/perf/arch/arm/tests/vectors-page.c b/tools/perf/arch/arm/tests/vectors-page.c new file mode 100644 index 000000000000..e44223cbf0df --- /dev/null +++ b/tools/perf/arch/arm/tests/vectors-page.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <stdio.h> +#include <string.h> +#include <linux/compiler.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)) + return -1; + + return 0; +} diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h index b82f55fcc294..399f18ca71a3 100644 --- a/tools/perf/tests/tests.h +++ b/tools/perf/tests/tests.h @@ -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 */ -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page @ 2018-10-25 0:09 ` Florian Fainelli 0 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 0:09 UTC (permalink / raw) To: linux-arm-kernel Cc: Florian Fainelli, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Kim Phillips, Greg Kroah-Hartman, Thomas Gleixner, Ravi Bangoria, Thomas Richter, open list, rmk+kernel, l.stach 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. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- tools/perf/arch/arm/tests/Build | 1 + tools/perf/arch/arm/tests/arch-tests.c | 4 ++++ tools/perf/arch/arm/tests/vectors-page.c | 20 ++++++++++++++++++++ tools/perf/tests/tests.h | 5 +++++ 4 files changed, 30 insertions(+) create mode 100644 tools/perf/arch/arm/tests/vectors-page.c diff --git a/tools/perf/arch/arm/tests/Build b/tools/perf/arch/arm/tests/Build index 883c57ff0c08..d9ae2733f9cc 100644 --- a/tools/perf/arch/arm/tests/Build +++ b/tools/perf/arch/arm/tests/Build @@ -1,4 +1,5 @@ libperf-y += regs_load.o libperf-y += dwarf-unwind.o +libperf-y += vectors-page.o libperf-y += arch-tests.o diff --git a/tools/perf/arch/arm/tests/arch-tests.c b/tools/perf/arch/arm/tests/arch-tests.c index 5b1543c98022..6848101a855f 100644 --- a/tools/perf/arch/arm/tests/arch-tests.c +++ b/tools/perf/arch/arm/tests/arch-tests.c @@ -10,6 +10,10 @@ struct test arch_tests[] = { .func = test__dwarf_unwind, }, #endif + { + .desc = "Vectors page", + .func = test__vectors_page, + }, { .func = NULL, }, diff --git a/tools/perf/arch/arm/tests/vectors-page.c b/tools/perf/arch/arm/tests/vectors-page.c new file mode 100644 index 000000000000..e44223cbf0df --- /dev/null +++ b/tools/perf/arch/arm/tests/vectors-page.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <stdio.h> +#include <string.h> +#include <linux/compiler.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)) + return -1; + + return 0; +} diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h index b82f55fcc294..399f18ca71a3 100644 --- a/tools/perf/tests/tests.h +++ b/tools/perf/tests/tests.h @@ -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 */ -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page 2018-10-25 0:09 ` Florian Fainelli @ 2018-10-25 2:10 ` Andrew Lunn -1 siblings, 0 replies; 20+ messages in thread From: Andrew Lunn @ 2018-10-25 2:10 UTC (permalink / raw) To: linux-arm-kernel On Wed, Oct 24, 2018 at 05:09:05PM -0700, Florian Fainelli wrote: > 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. Hi Florian I've suffered the pain from missing CONFIG_KUSER_HELPERS. The segfaults give little clue as to what is going wrong,and gdb is not much use either. What i don't see here is any clue to CONFIG_KUSER_HELPERS. If the test fails, could you print a message suggesting CONFIG_KUSER_HELPERS on ARM? Andrew ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page @ 2018-10-25 2:10 ` Andrew Lunn 0 siblings, 0 replies; 20+ messages in thread From: Andrew Lunn @ 2018-10-25 2:10 UTC (permalink / raw) To: Florian Fainelli Cc: linux-arm-kernel, Ravi Bangoria, Peter Zijlstra, Kim Phillips, Thomas Richter, open list, Arnaldo Carvalho de Melo, Alexander Shishkin, rmk+kernel, Ingo Molnar, Greg Kroah-Hartman, Namhyung Kim, Thomas Gleixner, Jiri Olsa, l.stach On Wed, Oct 24, 2018 at 05:09:05PM -0700, Florian Fainelli wrote: > 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. Hi Florian I've suffered the pain from missing CONFIG_KUSER_HELPERS. The segfaults give little clue as to what is going wrong,and gdb is not much use either. What i don't see here is any clue to CONFIG_KUSER_HELPERS. If the test fails, could you print a message suggesting CONFIG_KUSER_HELPERS on ARM? Andrew ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page 2018-10-25 2:10 ` Andrew Lunn @ 2018-10-25 17:19 ` Florian Fainelli -1 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 17:19 UTC (permalink / raw) To: linux-arm-kernel On 10/24/18 7:10 PM, Andrew Lunn wrote: > On Wed, Oct 24, 2018 at 05:09:05PM -0700, Florian Fainelli wrote: >> 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. > > Hi Florian > > I've suffered the pain from missing CONFIG_KUSER_HELPERS. The > segfaults give little clue as to what is going wrong,and gdb is not > much use either. If you have a working backtrace, you can typically see the virtual address being in 0xffff_xxxx which gives a bit of a clue, but yes, this is not particularly helpful. > > What i don't see here is any clue to CONFIG_KUSER_HELPERS. If the test > fails, could you print a message suggesting CONFIG_KUSER_HELPERS on > ARM? Sure, sounds reasonable, thanks for taking a look. -- Florian ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page @ 2018-10-25 17:19 ` Florian Fainelli 0 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 17:19 UTC (permalink / raw) To: Andrew Lunn Cc: linux-arm-kernel, Ravi Bangoria, Peter Zijlstra, Kim Phillips, Thomas Richter, open list, Arnaldo Carvalho de Melo, Alexander Shishkin, rmk+kernel, Ingo Molnar, Greg Kroah-Hartman, Namhyung Kim, Thomas Gleixner, Jiri Olsa, l.stach On 10/24/18 7:10 PM, Andrew Lunn wrote: > On Wed, Oct 24, 2018 at 05:09:05PM -0700, Florian Fainelli wrote: >> 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. > > Hi Florian > > I've suffered the pain from missing CONFIG_KUSER_HELPERS. The > segfaults give little clue as to what is going wrong,and gdb is not > much use either. If you have a working backtrace, you can typically see the virtual address being in 0xffff_xxxx which gives a bit of a clue, but yes, this is not particularly helpful. > > What i don't see here is any clue to CONFIG_KUSER_HELPERS. If the test > fails, could you print a message suggesting CONFIG_KUSER_HELPERS on > ARM? Sure, sounds reasonable, thanks for taking a look. -- Florian ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page 2018-10-25 17:19 ` Florian Fainelli @ 2018-10-25 17:32 ` Russell King - ARM Linux -1 siblings, 0 replies; 20+ messages in thread From: Russell King - ARM Linux @ 2018-10-25 17:32 UTC (permalink / raw) To: linux-arm-kernel On Thu, Oct 25, 2018 at 10:19:54AM -0700, Florian Fainelli wrote: > On 10/24/18 7:10 PM, Andrew Lunn wrote: > > On Wed, Oct 24, 2018 at 05:09:05PM -0700, Florian Fainelli wrote: > >> 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. > > > > Hi Florian > > > > I've suffered the pain from missing CONFIG_KUSER_HELPERS. The > > segfaults give little clue as to what is going wrong,and gdb is not > > much use either. > > If you have a working backtrace, you can typically see the virtual > address being in 0xffff_xxxx which gives a bit of a clue, but yes, this > is not particularly helpful. > > > > > What i don't see here is any clue to CONFIG_KUSER_HELPERS. If the test > > fails, could you print a message suggesting CONFIG_KUSER_HELPERS on > > ARM? > > Sure, sounds reasonable, thanks for taking a look. An alternative would be rather than adding this to user programs, to have the kernel detect it and print a warning itself. BTW, I note that the help text for CONFIG_KUSER_HELPERS needs to be updated. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page @ 2018-10-25 17:32 ` Russell King - ARM Linux 0 siblings, 0 replies; 20+ messages in thread From: Russell King - ARM Linux @ 2018-10-25 17:32 UTC (permalink / raw) To: Florian Fainelli Cc: Andrew Lunn, linux-arm-kernel, Ravi Bangoria, Peter Zijlstra, Kim Phillips, Thomas Richter, open list, Arnaldo Carvalho de Melo, Alexander Shishkin, Ingo Molnar, Greg Kroah-Hartman, Namhyung Kim, Thomas Gleixner, Jiri Olsa, l.stach On Thu, Oct 25, 2018 at 10:19:54AM -0700, Florian Fainelli wrote: > On 10/24/18 7:10 PM, Andrew Lunn wrote: > > On Wed, Oct 24, 2018 at 05:09:05PM -0700, Florian Fainelli wrote: > >> 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. > > > > Hi Florian > > > > I've suffered the pain from missing CONFIG_KUSER_HELPERS. The > > segfaults give little clue as to what is going wrong,and gdb is not > > much use either. > > If you have a working backtrace, you can typically see the virtual > address being in 0xffff_xxxx which gives a bit of a clue, but yes, this > is not particularly helpful. > > > > > What i don't see here is any clue to CONFIG_KUSER_HELPERS. If the test > > fails, could you print a message suggesting CONFIG_KUSER_HELPERS on > > ARM? > > Sure, sounds reasonable, thanks for taking a look. An alternative would be rather than adding this to user programs, to have the kernel detect it and print a warning itself. BTW, I note that the help text for CONFIG_KUSER_HELPERS needs to be updated. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page 2018-10-25 17:32 ` Russell King - ARM Linux @ 2018-10-25 17:53 ` Florian Fainelli -1 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 17:53 UTC (permalink / raw) To: linux-arm-kernel On 10/25/18 10:32 AM, Russell King - ARM Linux wrote: > On Thu, Oct 25, 2018 at 10:19:54AM -0700, Florian Fainelli wrote: >> On 10/24/18 7:10 PM, Andrew Lunn wrote: >>> On Wed, Oct 24, 2018 at 05:09:05PM -0700, Florian Fainelli wrote: >>>> 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. >>> >>> Hi Florian >>> >>> I've suffered the pain from missing CONFIG_KUSER_HELPERS. The >>> segfaults give little clue as to what is going wrong,and gdb is not >>> much use either. >> >> If you have a working backtrace, you can typically see the virtual >> address being in 0xffff_xxxx which gives a bit of a clue, but yes, this >> is not particularly helpful. >> >>> >>> What i don't see here is any clue to CONFIG_KUSER_HELPERS. If the test >>> fails, could you print a message suggesting CONFIG_KUSER_HELPERS on >>> ARM? >> >> Sure, sounds reasonable, thanks for taking a look. > > An alternative would be rather than adding this to user programs, to > have the kernel detect it and print a warning itself. Something like this below? It does not have to be an alternative solution, I would find it useful for perf to make sure the vectors page is present in the virtual address space by having an explicit test. perf maintains, what do you think? diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index f4ea4c62c613..b045b48d368d 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -173,6 +173,11 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, show_regs(regs); } #endif +#ifndef CONFIG_KUSER_HELPERS + if (((addr & PAGE_MASK) == 0xffff0000) && (sig == SIGSEGV)) + printk(KERN_DEBUG "%s: CONFIG_KUSER_HELPERS disabled at 0x%08lx\n", + tsk->comm, addr); +#endif tsk->thread.address = addr; tsk->thread.error_code = fsr; > > BTW, I note that the help text for CONFIG_KUSER_HELPERS needs to be > updated. > -- Florian ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page @ 2018-10-25 17:53 ` Florian Fainelli 0 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-25 17:53 UTC (permalink / raw) To: Russell King - ARM Linux Cc: Andrew Lunn, linux-arm-kernel, Ravi Bangoria, Peter Zijlstra, Kim Phillips, Thomas Richter, open list, Arnaldo Carvalho de Melo, Alexander Shishkin, Ingo Molnar, Greg Kroah-Hartman, Namhyung Kim, Thomas Gleixner, Jiri Olsa, l.stach On 10/25/18 10:32 AM, Russell King - ARM Linux wrote: > On Thu, Oct 25, 2018 at 10:19:54AM -0700, Florian Fainelli wrote: >> On 10/24/18 7:10 PM, Andrew Lunn wrote: >>> On Wed, Oct 24, 2018 at 05:09:05PM -0700, Florian Fainelli wrote: >>>> 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. >>> >>> Hi Florian >>> >>> I've suffered the pain from missing CONFIG_KUSER_HELPERS. The >>> segfaults give little clue as to what is going wrong,and gdb is not >>> much use either. >> >> If you have a working backtrace, you can typically see the virtual >> address being in 0xffff_xxxx which gives a bit of a clue, but yes, this >> is not particularly helpful. >> >>> >>> What i don't see here is any clue to CONFIG_KUSER_HELPERS. If the test >>> fails, could you print a message suggesting CONFIG_KUSER_HELPERS on >>> ARM? >> >> Sure, sounds reasonable, thanks for taking a look. > > An alternative would be rather than adding this to user programs, to > have the kernel detect it and print a warning itself. Something like this below? It does not have to be an alternative solution, I would find it useful for perf to make sure the vectors page is present in the virtual address space by having an explicit test. perf maintains, what do you think? diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index f4ea4c62c613..b045b48d368d 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -173,6 +173,11 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, show_regs(regs); } #endif +#ifndef CONFIG_KUSER_HELPERS + if (((addr & PAGE_MASK) == 0xffff0000) && (sig == SIGSEGV)) + printk(KERN_DEBUG "%s: CONFIG_KUSER_HELPERS disabled at 0x%08lx\n", + tsk->comm, addr); +#endif tsk->thread.address = addr; tsk->thread.error_code = fsr; > > BTW, I note that the help text for CONFIG_KUSER_HELPERS needs to be > updated. > -- Florian ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page 2018-10-25 17:53 ` Florian Fainelli @ 2018-10-25 18:03 ` Russell King - ARM Linux -1 siblings, 0 replies; 20+ messages in thread From: Russell King - ARM Linux @ 2018-10-25 18:03 UTC (permalink / raw) To: linux-arm-kernel On Thu, Oct 25, 2018 at 10:53:12AM -0700, Florian Fainelli wrote: > Something like this below? It does not have to be an alternative > solution, I would find it useful for perf to make sure the vectors page > is present in the virtual address space by having an explicit test. perf > maintains, what do you think? Yep, I'd swap the two tests merely because the check for 'sig' will be slightly cheaper than the mask-and-test of addr, but it probably doesn't make that much difference. > > diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c > index f4ea4c62c613..b045b48d368d 100644 > --- a/arch/arm/mm/fault.c > +++ b/arch/arm/mm/fault.c > @@ -173,6 +173,11 @@ __do_user_fault(struct task_struct *tsk, unsigned > long addr, > show_regs(regs); > } > #endif > +#ifndef CONFIG_KUSER_HELPERS > + if (((addr & PAGE_MASK) == 0xffff0000) && (sig == SIGSEGV)) > + printk(KERN_DEBUG "%s: CONFIG_KUSER_HELPERS disabled at > 0x%08lx\n", > + tsk->comm, addr); > +#endif > > tsk->thread.address = addr; > tsk->thread.error_code = fsr; > > > > > > BTW, I note that the help text for CONFIG_KUSER_HELPERS needs to be > > updated. > > > > > -- > Florian -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page @ 2018-10-25 18:03 ` Russell King - ARM Linux 0 siblings, 0 replies; 20+ messages in thread From: Russell King - ARM Linux @ 2018-10-25 18:03 UTC (permalink / raw) To: Florian Fainelli Cc: Andrew Lunn, linux-arm-kernel, Ravi Bangoria, Peter Zijlstra, Kim Phillips, Thomas Richter, open list, Arnaldo Carvalho de Melo, Alexander Shishkin, Ingo Molnar, Greg Kroah-Hartman, Namhyung Kim, Thomas Gleixner, Jiri Olsa, l.stach On Thu, Oct 25, 2018 at 10:53:12AM -0700, Florian Fainelli wrote: > Something like this below? It does not have to be an alternative > solution, I would find it useful for perf to make sure the vectors page > is present in the virtual address space by having an explicit test. perf > maintains, what do you think? Yep, I'd swap the two tests merely because the check for 'sig' will be slightly cheaper than the mask-and-test of addr, but it probably doesn't make that much difference. > > diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c > index f4ea4c62c613..b045b48d368d 100644 > --- a/arch/arm/mm/fault.c > +++ b/arch/arm/mm/fault.c > @@ -173,6 +173,11 @@ __do_user_fault(struct task_struct *tsk, unsigned > long addr, > show_regs(regs); > } > #endif > +#ifndef CONFIG_KUSER_HELPERS > + if (((addr & PAGE_MASK) == 0xffff0000) && (sig == SIGSEGV)) > + printk(KERN_DEBUG "%s: CONFIG_KUSER_HELPERS disabled at > 0x%08lx\n", > + tsk->comm, addr); > +#endif > > tsk->thread.address = addr; > tsk->thread.error_code = fsr; > > > > > > BTW, I note that the help text for CONFIG_KUSER_HELPERS needs to be > > updated. > > > > > -- > Florian -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 0/2] perf tests: Check for ARM [vectors] page 2018-10-25 0:09 ` Florian Fainelli @ 2018-10-31 22:21 ` Florian Fainelli -1 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-31 22:21 UTC (permalink / raw) To: linux-arm-kernel On 10/24/18 5:09 PM, Florian Fainelli wrote: > 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. Any feedback on this? > > 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/arch/arm/tests/Build | 1 + > tools/perf/arch/arm/tests/arch-tests.c | 4 +++ > tools/perf/arch/arm/tests/vectors-page.c | 20 +++++++++++++++ > tools/perf/tests/tests.h | 5 ++++ > tools/perf/util/find-map.c | 31 ++++++++++++++++++++++++ > tools/perf/util/find-vdso-map.c | 30 +++-------------------- > 6 files changed, 64 insertions(+), 27 deletions(-) > create mode 100644 tools/perf/arch/arm/tests/vectors-page.c > create mode 100644 tools/perf/util/find-map.c > -- Florian ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/2] perf tests: Check for ARM [vectors] page @ 2018-10-31 22:21 ` Florian Fainelli 0 siblings, 0 replies; 20+ messages in thread From: Florian Fainelli @ 2018-10-31 22:21 UTC (permalink / raw) To: linux-arm-kernel Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Kim Phillips, Greg Kroah-Hartman, Thomas Gleixner, Ravi Bangoria, Thomas Richter, open list, rmk+kernel, l.stach On 10/24/18 5:09 PM, Florian Fainelli wrote: > 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. Any feedback on this? > > 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/arch/arm/tests/Build | 1 + > tools/perf/arch/arm/tests/arch-tests.c | 4 +++ > tools/perf/arch/arm/tests/vectors-page.c | 20 +++++++++++++++ > tools/perf/tests/tests.h | 5 ++++ > tools/perf/util/find-map.c | 31 ++++++++++++++++++++++++ > tools/perf/util/find-vdso-map.c | 30 +++-------------------- > 6 files changed, 64 insertions(+), 27 deletions(-) > create mode 100644 tools/perf/arch/arm/tests/vectors-page.c > create mode 100644 tools/perf/util/find-map.c > -- Florian ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2018-10-31 22:21 UTC | newest] Thread overview: 20+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-10-25 0:09 [PATCH 0/2] perf tests: Check for ARM [vectors] page Florian Fainelli 2018-10-25 0:09 ` Florian Fainelli 2018-10-25 0:09 ` [PATCH 1/2] perf tools: Make find_vdso_map() more modular Florian Fainelli 2018-10-25 0:09 ` Florian Fainelli 2018-10-25 0:14 ` Florian Fainelli 2018-10-25 0:14 ` Florian Fainelli 2018-10-25 0:09 ` [PATCH 2/2] perf tests: Add a test for the ARM 32-bit [vectors] page Florian Fainelli 2018-10-25 0:09 ` Florian Fainelli 2018-10-25 2:10 ` Andrew Lunn 2018-10-25 2:10 ` Andrew Lunn 2018-10-25 17:19 ` Florian Fainelli 2018-10-25 17:19 ` Florian Fainelli 2018-10-25 17:32 ` Russell King - ARM Linux 2018-10-25 17:32 ` Russell King - ARM Linux 2018-10-25 17:53 ` Florian Fainelli 2018-10-25 17:53 ` Florian Fainelli 2018-10-25 18:03 ` Russell King - ARM Linux 2018-10-25 18:03 ` Russell King - ARM Linux 2018-10-31 22:21 ` [PATCH 0/2] perf tests: Check for ARM " Florian Fainelli 2018-10-31 22:21 ` Florian Fainelli
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.