perf/core: Save the dynamic parts of sample data size
[platform/kernel/linux-starfive.git] / include / linux / perf_event.h
index c6a3bac..16b9800 100644 (file)
@@ -1098,47 +1098,52 @@ extern u64 perf_event_read_value(struct perf_event *event,
 
 struct perf_sample_data {
        /*
-        * Fields set by perf_sample_data_init(), group so as to
-        * minimize the cachelines touched.
+        * Fields set by perf_sample_data_init() unconditionally,
+        * group so as to minimize the cachelines touched.
         */
        u64                             sample_flags;
        u64                             period;
+       u64                             dyn_size;
 
        /*
-        * The other fields, optionally {set,used} by
-        * perf_{prepare,output}_sample().
+        * Fields commonly set by __perf_event_header__init_id(),
+        * group so as to minimize the cachelines touched.
         */
-       struct perf_branch_stack        *br_stack;
-       union perf_sample_weight        weight;
-       union  perf_mem_data_src        data_src;
-       u64                             txn;
-       u64                             addr;
-       struct perf_raw_record          *raw;
-
        u64                             type;
-       u64                             ip;
        struct {
                u32     pid;
                u32     tid;
        }                               tid_entry;
        u64                             time;
        u64                             id;
-       u64                             stream_id;
        struct {
                u32     cpu;
                u32     reserved;
        }                               cpu_entry;
+
+       /*
+        * The other fields, optionally {set,used} by
+        * perf_{prepare,output}_sample().
+        */
+       u64                             ip;
        struct perf_callchain_entry     *callchain;
-       u64                             aux_size;
+       struct perf_raw_record          *raw;
+       struct perf_branch_stack        *br_stack;
+       union perf_sample_weight        weight;
+       union  perf_mem_data_src        data_src;
+       u64                             txn;
 
        struct perf_regs                regs_user;
        struct perf_regs                regs_intr;
        u64                             stack_user_size;
 
-       u64                             phys_addr;
+       u64                             stream_id;
        u64                             cgroup;
+       u64                             addr;
+       u64                             phys_addr;
        u64                             data_page_size;
        u64                             code_page_size;
+       u64                             aux_size;
 } ____cacheline_aligned;
 
 /* default value for data source */
@@ -1154,6 +1159,7 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
        /* remaining struct members initialized in perf_prepare_sample() */
        data->sample_flags = PERF_SAMPLE_PERIOD;
        data->period = period;
+       data->dyn_size = 0;
 
        if (addr) {
                data->addr = addr;
@@ -1724,7 +1730,7 @@ static struct perf_pmu_events_attr _var = {                                   \
                  .id = _id, }                                          \
        })[0].attr.attr)
 
-#define PMU_FORMAT_ATTR(_name, _format)                                        \
+#define PMU_FORMAT_ATTR_SHOW(_name, _format)                           \
 static ssize_t                                                         \
 _name##_show(struct device *dev,                                       \
                               struct device_attribute *attr,           \
@@ -1733,6 +1739,9 @@ _name##_show(struct device *dev,                                  \
        BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE);                     \
        return sprintf(page, _format "\n");                             \
 }                                                                      \
+
+#define PMU_FORMAT_ATTR(_name, _format)                                        \
+       PMU_FORMAT_ATTR_SHOW(_name, _format)                            \
                                                                        \
 static struct device_attribute format_attr_##_name = __ATTR_RO(_name)