lkml.org 
[lkml]   [2021]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH V3 1/5] perf/core: Add PERF_SAMPLE_WEIGHT_STRUCT
Hi Kan,

On Sat, Jan 30, 2021 at 2:25 AM Liang, Kan <kan.liang@linux.intel.com> wrote:
[SNIP]
> diff --git a/include/uapi/linux/perf_event.h
> b/include/uapi/linux/perf_event.h
> index b15e344..c50718a 100644
> --- a/include/uapi/linux/perf_event.h
> +++ b/include/uapi/linux/perf_event.h
> @@ -145,12 +145,14 @@ enum perf_event_sample_format {
> PERF_SAMPLE_CGROUP = 1U << 21,
> PERF_SAMPLE_DATA_PAGE_SIZE = 1U << 22,
> PERF_SAMPLE_CODE_PAGE_SIZE = 1U << 23,
> + PERF_SAMPLE_WEIGHT_STRUCT = 1U << 24,
>
> - PERF_SAMPLE_MAX = 1U << 24, /* non-ABI */
> + PERF_SAMPLE_MAX = 1U << 25, /* non-ABI */
>
> __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, /* non-ABI; internal use */
> };
>
> +#define PERF_SAMPLE_WEIGHT_TYPE (PERF_SAMPLE_WEIGHT |
> PERF_SAMPLE_WEIGHT_STRUCT)

I'm not sure you want to expose it in the uapi header as it's not
intended to be used IMHO.

Thanks,
Namhyung


> /*
> * values to program into branch_sample_type when PERF_SAMPLE_BRANCH
> is set
> *
> @@ -890,7 +892,25 @@ enum perf_event_type {
> * char data[size];
> * u64 dyn_size; } && PERF_SAMPLE_STACK_USER
> *
> - * { u64 weight; } && PERF_SAMPLE_WEIGHT
> + * { union perf_sample_weight
> + * {
> + * u64 full; && PERF_SAMPLE_WEIGHT
> + * #if defined(__LITTLE_ENDIAN_BITFIELD)
> + * struct {
> + * u32 var1_dw;
> + * u16 var2_w;
> + * u16 var3_w;
> + * } && PERF_SAMPLE_WEIGHT_STRUCT
> + * #elif defined(__BIG_ENDIAN_BITFIELD)
> + * struct {
> + * u16 var3_w;
> + * u16 var2_w;
> + * u32 var1_dw;
> + * } && PERF_SAMPLE_WEIGHT_STRUCT
> + * #endif
> + *
> + * }
> + * }
> * { u64 data_src; } && PERF_SAMPLE_DATA_SRC
> * { u64 transaction; } && PERF_SAMPLE_TRANSACTION
> * { u64 abi; # enum perf_sample_regs_abi
> @@ -1248,4 +1268,29 @@ struct perf_branch_entry {
> reserved:40;
> };
>
> +#if defined(__LITTLE_ENDIAN_BITFIELD)
> +union perf_sample_weight {
> + __u64 full;
> + struct {
> + __u32 var1_dw;
> + __u16 var2_w;
> + __u16 var3_w;
> + };
> +};
> +
> +#elif defined(__BIG_ENDIAN_BITFIELD)
> +
> +union perf_sample_weight {
> + __u64 full;
> + struct {
> + __u16 var3_w;
> + __u16 var2_w;
> + __u32 var1_dw;
> + };
> +};
> +
> +#else
> +#error "Unknown endianness"
> +#endif
> +
> #endif /* _UAPI_LINUX_PERF_EVENT_H */

\
 
 \ /
  Last update: 2021-02-04 15:07    [W:0.123 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site