diff options
-rw-r--r-- | include/linux/perf_event.h | 5 | ||||
-rw-r--r-- | include/uapi/linux/perf_event.h | 25 | ||||
-rw-r--r-- | kernel/events/core.c | 6 |
3 files changed, 35 insertions, 1 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index c8ba627c1d60..2e069d1288df 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -584,6 +584,10 @@ struct perf_sample_data { | |||
584 | struct perf_regs_user regs_user; | 584 | struct perf_regs_user regs_user; |
585 | u64 stack_user_size; | 585 | u64 stack_user_size; |
586 | u64 weight; | 586 | u64 weight; |
587 | /* | ||
588 | * Transaction flags for abort events: | ||
589 | */ | ||
590 | u64 txn; | ||
587 | }; | 591 | }; |
588 | 592 | ||
589 | static inline void perf_sample_data_init(struct perf_sample_data *data, | 593 | static inline void perf_sample_data_init(struct perf_sample_data *data, |
@@ -599,6 +603,7 @@ static inline void perf_sample_data_init(struct perf_sample_data *data, | |||
599 | data->stack_user_size = 0; | 603 | data->stack_user_size = 0; |
600 | data->weight = 0; | 604 | data->weight = 0; |
601 | data->data_src.val = 0; | 605 | data->data_src.val = 0; |
606 | data->txn = 0; | ||
602 | } | 607 | } |
603 | 608 | ||
604 | extern void perf_output_sample(struct perf_output_handle *handle, | 609 | extern void perf_output_sample(struct perf_output_handle *handle, |
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 009a655a5d35..da48837d617d 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h | |||
@@ -136,8 +136,9 @@ enum perf_event_sample_format { | |||
136 | PERF_SAMPLE_WEIGHT = 1U << 14, | 136 | PERF_SAMPLE_WEIGHT = 1U << 14, |
137 | PERF_SAMPLE_DATA_SRC = 1U << 15, | 137 | PERF_SAMPLE_DATA_SRC = 1U << 15, |
138 | PERF_SAMPLE_IDENTIFIER = 1U << 16, | 138 | PERF_SAMPLE_IDENTIFIER = 1U << 16, |
139 | PERF_SAMPLE_TRANSACTION = 1U << 17, | ||
139 | 140 | ||
140 | PERF_SAMPLE_MAX = 1U << 17, /* non-ABI */ | 141 | PERF_SAMPLE_MAX = 1U << 18, /* non-ABI */ |
141 | }; | 142 | }; |
142 | 143 | ||
143 | /* | 144 | /* |
@@ -181,6 +182,28 @@ enum perf_sample_regs_abi { | |||
181 | }; | 182 | }; |
182 | 183 | ||
183 | /* | 184 | /* |
185 | * Values for the memory transaction event qualifier, mostly for | ||
186 | * abort events. Multiple bits can be set. | ||
187 | */ | ||
188 | enum { | ||
189 | PERF_TXN_ELISION = (1 << 0), /* From elision */ | ||
190 | PERF_TXN_TRANSACTION = (1 << 1), /* From transaction */ | ||
191 | PERF_TXN_SYNC = (1 << 2), /* Instruction is related */ | ||
192 | PERF_TXN_ASYNC = (1 << 3), /* Instruction not related */ | ||
193 | PERF_TXN_RETRY = (1 << 4), /* Retry possible */ | ||
194 | PERF_TXN_CONFLICT = (1 << 5), /* Conflict abort */ | ||
195 | PERF_TXN_CAPACITY_WRITE = (1 << 6), /* Capacity write abort */ | ||
196 | PERF_TXN_CAPACITY_READ = (1 << 7), /* Capacity read abort */ | ||
197 | |||
198 | PERF_TXN_MAX = (1 << 8), /* non-ABI */ | ||
199 | |||
200 | /* bits 32..63 are reserved for the abort code */ | ||
201 | |||
202 | PERF_TXN_ABORT_MASK = (0xffffffffULL << 32), | ||
203 | PERF_TXN_ABORT_SHIFT = 32, | ||
204 | }; | ||
205 | |||
206 | /* | ||
184 | * The format of the data returned by read() on a perf event fd, | 207 | * The format of the data returned by read() on a perf event fd, |
185 | * as specified by attr.read_format: | 208 | * as specified by attr.read_format: |
186 | * | 209 | * |
diff --git a/kernel/events/core.c b/kernel/events/core.c index b25d65ce7106..c716385f6483 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -1201,6 +1201,9 @@ static void perf_event__header_size(struct perf_event *event) | |||
1201 | if (sample_type & PERF_SAMPLE_DATA_SRC) | 1201 | if (sample_type & PERF_SAMPLE_DATA_SRC) |
1202 | size += sizeof(data->data_src.val); | 1202 | size += sizeof(data->data_src.val); |
1203 | 1203 | ||
1204 | if (sample_type & PERF_SAMPLE_TRANSACTION) | ||
1205 | size += sizeof(data->txn); | ||
1206 | |||
1204 | event->header_size = size; | 1207 | event->header_size = size; |
1205 | } | 1208 | } |
1206 | 1209 | ||
@@ -4572,6 +4575,9 @@ void perf_output_sample(struct perf_output_handle *handle, | |||
4572 | if (sample_type & PERF_SAMPLE_DATA_SRC) | 4575 | if (sample_type & PERF_SAMPLE_DATA_SRC) |
4573 | perf_output_put(handle, data->data_src.val); | 4576 | perf_output_put(handle, data->data_src.val); |
4574 | 4577 | ||
4578 | if (sample_type & PERF_SAMPLE_TRANSACTION) | ||
4579 | perf_output_put(handle, data->txn); | ||
4580 | |||
4575 | if (!event->attr.watermark) { | 4581 | if (!event->attr.watermark) { |
4576 | int wakeup_events = event->attr.wakeup_events; | 4582 | int wakeup_events = event->attr.wakeup_events; |
4577 | 4583 | ||