libperf: fix alignment trap in perf stat
PATCH 1/1 libperf: fix alignment trap in perf stat
Following the patch 'perf stat: Fix --no-scale', an alignment trap happens in process_counter_values() on ARMv7 platforms due to the attempt to copy non 64 bits aligned double words (pointed by 'count') via a NEON vectored instruction ('vld1' with 64 bits alignment constraint).
This patch sets a 64 bits alignment constraint on 'contents[]' field in 'struct xyarray' since the 'count' pointer used above points to such a structure.
--- tools/perf/lib/include/internal/xyarray.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/lib/include/internal/xyarray.h +2 -1
@@ -2,6 +2,7 @@#ifndef __LIBPERF_INTERNAL_XYARRAY_H#define __LIBPERF_INTERNAL_XYARRAY_H +#include <linux/compiler.h> #include <sys/types.h> struct xyarray {
@@ -10,7 +11,7 @@ struct xyarray {size_t entries;size_t max_x;size_t max_y; -char contents[]; +char contents[]__aligned(8) ; };struct xyarray *xyarray__new (int xlen,int ylen,size_t entry_size);
Signature · 1 line
2.7.4
Em Thu, Aug 22, 2019 at 09:07:01AM +0000, Gerald BAEZA escreveu:
Quoted 11 lines
Following the patch 'perf stat: Fix --no-scale', an alignment trap happens in
process_counter_values()on ARMv7 platforms due to the attempt to copy non 64 bits aligned double words (pointed by 'count') via a NEON vectored instruction ('vld1' with 64 bits alignment constraint).This patch sets a 64 bits alignment constraint on 'contents[]' field in 'struct xyarray' since the 'count' pointer used above points to such a structure.
You forgot to add Mathieu and Andi, which I just did.
I think this is ok and I'm applying, please holler anyone if think this isn't the case,
- Arnaldo
Quoted 28 lines
Signed-off-by Gerald Baeza <[email protected]>--- tools/perf/lib/include/internal/xyarray.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/perf/lib/include/internal/xyarray.h +2
-1@@ -2,6 +2,7 @@#ifndef __LIBPERF_INTERNAL_XYARRAY_H#define __LIBPERF_INTERNAL_XYARRAY_H +#include <linux/compiler.h> #include <sys/types.h> struct xyarray {@@ -10,7 +11,7 @@ struct xyarray {size_t entries;size_t max_x;size_t max_y; -char contents[]; +char contents[]__aligned(8) ; };struct xyarray *xyarray__new (int xlen,int ylen,size_t entry_size);Signature · 1 line
2.7.4
Signature · 1 line
- Arnaldo
[tip: perf/core] libperf: Fix alignment trap with xyarray contents in 'perf stat'
In reply to Gerald BAEZAThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: d9c5c083416500e95da098c01be092b937def7fa Gitweb: https://git.kernel.org/tip/d9c5c083416500e95da098c01be092b937def7fa Author: Gerald BAEZA <[email protected]> AuthorDate: Thu, 22 Aug 2019 09:07:01 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Thu, 22 Aug 2019 17:16:57 -03:00
libperf: Fix alignment trap with xyarray contents in 'perf stat'
Following the patch 'perf stat: Fix --no-scale', an alignment trap happens in process_counter_values() on ARMv7 platforms due to the attempt to copy non 64 bits aligned double words (pointed by 'count') via a NEON vectored instruction ('vld1' with 64 bits alignment constraint).
This patch sets a 64 bits alignment constraint on 'contents[]' field in 'struct xyarray' since the 'count' pointer used above points to such a structure.
--- tools/perf/lib/include/internal/xyarray.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/lib/include/internal/xyarray.h +2 -1
@@ -2,6 +2,7 @@#ifndef __LIBPERF_INTERNAL_XYARRAY_H#define __LIBPERF_INTERNAL_XYARRAY_H +#include <linux/compiler.h> #include <sys/types.h> struct xyarray {
@@ -10,7 +11,7 @@ struct xyarray {size_t entries;size_t max_x;size_t max_y; -char contents[]; +char contents[]__aligned(8) ; };struct xyarray *xyarray__new (int xlen,int ylen,size_t entry_size);