Skip to content

Commit fa592fc

Browse files
ahunter6gregkh
authored andcommitted
perf auxtrace: Define auxtrace record alignment
commit c3fcadf upstream. Define auxtrace record alignment so that it can be referenced elsewhere. Note this is preparation for patch "perf intel-pt: Fix overlap calculation for padding" Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20190206103947.15750-2-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d8f691f commit fa592fc

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎tools/perf/util/auxtrace.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,9 +1273,9 @@ static int __auxtrace_mmap__read(struct auxtrace_mmap *mm,
12731273
}
12741274

12751275
/* padding must be written by fn() e.g. record__process_auxtrace() */
1276-
padding = size & 7;
1276+
padding = size & (PERF_AUXTRACE_RECORD_ALIGNMENT - 1);
12771277
if (padding)
1278-
padding = 8 - padding;
1278+
padding = PERF_AUXTRACE_RECORD_ALIGNMENT - padding;
12791279

12801280
memset(&ev, 0, sizeof(ev));
12811281
ev.auxtrace.header.type = PERF_RECORD_AUXTRACE;

‎tools/perf/util/auxtrace.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ struct record_opts;
3838
struct auxtrace_info_event;
3939
struct events_stats;
4040

41+
/* Auxtrace records must have the same alignment as perf event records */
42+
#define PERF_AUXTRACE_RECORD_ALIGNMENT 8
43+
4144
enum auxtrace_type {
4245
PERF_AUXTRACE_UNKNOWN,
4346
PERF_AUXTRACE_INTEL_PT,

0 commit comments

Comments
 (0)