Re: [PATCH v3 0/2] perf tests: Check for ARM [vectors] page
Hello, Sorry for being so late. On Thu, Dec 27, 2018 at 05:35:17PM -0800, Florian Fainelli wrote: > Le 12/27/18 à 2:55 AM, Namhyung Kim a écrit : > > Hello, > > > > On Thu, Dec 20, 2018 at 07:43:35PM -0800, 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 > > > > Could you please elaborate? > > Sure, I was debugging why perf was segfaulting on my systems and saw > that the faulting address was within 0x_ (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 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
Re: [PATCH v3 0/2] perf tests: Check for ARM [vectors] page
Em Tue, Jan 01, 2019 at 06:39:26PM +0100, Jiri Olsa escreveu: > On Thu, Dec 20, 2018 at 07:43:35PM -0800, Florian Fainelli wrote: > > 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 > > Acked-by: Jiri Olsa Thanks, applied. - Arnaldo
Re: [PATCH v3 0/2] perf tests: Check for ARM [vectors] page
On Thu, Dec 20, 2018 at 07:43:35PM -0800, 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. > > 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 Acked-by: Jiri Olsa thanks, jirka > > 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%) > > -- > 2.17.1 >
Re: [PATCH v3 0/2] perf tests: Check for ARM [vectors] page
Le 12/27/18 à 2:55 AM, Namhyung Kim a écrit : > Hello, > > On Thu, Dec 20, 2018 at 07:43:35PM -0800, 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 > > Could you please elaborate? Sure, I was debugging why perf was segfaulting on my systems and saw that the faulting address was within 0x_ (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! > > Thanks, > Namhyung > > >> 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%) >> >> -- >> 2.17.1 >> -- Florian
Re: [PATCH v3 0/2] perf tests: Check for ARM [vectors] page
Hello, On Thu, Dec 20, 2018 at 07:43:35PM -0800, 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 Could you please elaborate? Thanks, Namhyung > 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%) > > -- > 2.17.1 >
[PATCH v3 0/2] 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%) -- 2.17.1