From: Adrian Hunter Date: Fri, 29 May 2015 13:33:38 +0000 (+0300) Subject: perf tools: Allow auxtrace data alignment X-Git-Tag: firefly_0821_release~176^2~1467^2~5^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=83b2ea257eb1d43e52f76d756722aeb899a2852c;p=firefly-linux-kernel-4.4.55.git perf tools: Allow auxtrace data alignment Allow auxtrace data to be a multiple of something other than page size. That is needed for BTS where the buffer contains 24-byte records. Signed-off-by: Adrian Hunter Cc: Jiri Olsa Link: http://lkml.kernel.org/r/1432906425-9911-11-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index 3dab006b4a03..7e7405c9b936 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c @@ -1182,6 +1182,13 @@ static int __auxtrace_mmap__read(struct auxtrace_mmap *mm, data2 = NULL; } + if (itr->alignment) { + unsigned int unwanted = len1 % itr->alignment; + + len1 -= unwanted; + size -= unwanted; + } + /* padding must be written by fn() e.g. record__process_auxtrace() */ padding = size & 7; if (padding) diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index a171abbe7301..471aecbc4d68 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h @@ -303,6 +303,7 @@ struct auxtrace_record { const char *str); u64 (*reference)(struct auxtrace_record *itr); int (*read_finish)(struct auxtrace_record *itr, int idx); + unsigned int alignment; }; #ifdef HAVE_AUXTRACE_SUPPORT