On 3/2/20 3:25 PM, Peter Zijlstra wrote:
On Mon, Mar 02, 2020 at 10:53:46AM +0530, Ravi Bangoria wrote:
From: Madhavan Srinivasan <ma...@linux.vnet.ibm.com>

Introduce new perf sample_type PERF_SAMPLE_PIPELINE_HAZ to request kernel
to provide cpu pipeline hazard data. Also, introduce arch independent
structure 'perf_pipeline_haz_data' to pass hazard data to userspace. This
is generic structure and arch specific data needs to be converted to this
format.

Signed-off-by: Madhavan Srinivasan <ma...@linux.vnet.ibm.com>
Signed-off-by: Ravi Bangoria <ravi.bango...@linux.ibm.com>
---
  include/linux/perf_event.h            |  7 ++++++
  include/uapi/linux/perf_event.h       | 32 ++++++++++++++++++++++++++-
  kernel/events/core.c                  |  6 +++++
  tools/include/uapi/linux/perf_event.h | 32 ++++++++++++++++++++++++++-
  4 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 547773f5894e..d5b606e3c57d 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1001,6 +1001,7 @@ struct perf_sample_data {
        u64                             stack_user_size;
u64 phys_addr;
+       struct perf_pipeline_haz_data   pipeline_haz;
  } ____cacheline_aligned;
/* default value for data source */
@@ -1021,6 +1022,12 @@ static inline void perf_sample_data_init(struct 
perf_sample_data *data,
        data->weight = 0;
        data->data_src.val = PERF_MEM_NA;
        data->txn = 0;
+       data->pipeline_haz.itype = PERF_HAZ__ITYPE_NA;
+       data->pipeline_haz.icache = PERF_HAZ__ICACHE_NA;
+       data->pipeline_haz.hazard_stage = PERF_HAZ__PIPE_STAGE_NA;
+       data->pipeline_haz.hazard_reason = PERF_HAZ__HREASON_NA;
+       data->pipeline_haz.stall_stage = PERF_HAZ__PIPE_STAGE_NA;
+       data->pipeline_haz.stall_reason = PERF_HAZ__SREASON_NA;
  }
NAK, Don't touch anything outside of the first cacheline here.

My bad, should have looked at the comment in "struct perf_sample_data {".
Will move it to perf_prepare_sample().

Thanks for comments.
Maddy

Reply via email to