Re: [PATCH v3 1/6] powerpc/perf: Define big-endian version of perf_mem_data_src

From: Michael Ellerman
Date: Wed Apr 19 2017 - 18:16:27 EST


Madhavan Srinivasan <maddy@xxxxxxxxxxxxxxxxxx> writes:
> On Wednesday 19 April 2017 10:20 AM, Michael Ellerman wrote:
>> It also occurred to me that we don't actually have to redefine the whole
>> union, it's only the bitfields that matter, so we could reduce the diff
>> to:
>>
>> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
>> index c66a485a24ac..97152c79df6b 100644
>> --- a/include/uapi/linux/perf_event.h
>> +++ b/include/uapi/linux/perf_event.h
>> @@ -894,12 +894,23 @@ enum perf_callchain_context {
>> union perf_mem_data_src {
>> __u64 val;
>> struct {
>> +#if defined(__LITTLE_ENDIAN_BITFIELD)
>> __u64 mem_op:5, /* type of opcode */
>> mem_lvl:14, /* memory hierarchy level */
>> mem_snoop:5, /* snoop mode */
>> mem_lock:2, /* lock instr */
>> mem_dtlb:7, /* tlb access */
>> mem_rsvd:31;
>> +#elif defined(__BIG_ENDIAN_BITFIELD)
>> + __u64 mem_rsvd:31,
>> + mem_dtlb:7, /* tlb access */
>> + mem_lock:2, /* lock instr */
>> + mem_snoop:5, /* snoop mode */
>> + mem_lvl:14, /* memory hierarchy level */
>> + mem_op:5; /* type of opcode */
>> +#else
>> +#error "Unknown endianness"
>> +#endif
>> };
>> };
>>
>>
>> That looks better to me, thoughts?
>
> Yep. Looks fine to me and also tested the same.

I merged the original version, as that's what Peterz acked and I didn't
want to block the series any longer.

I'll send an incremental patch to do the cleanup.

cheers