Re: [PATCH 03/23] perf: Add ability to attach user level registersdump to sample

From: Stephane Eranian
Date: Wed Jun 27 2012 - 11:13:39 EST


On Wed, Jun 27, 2012 at 5:11 PM, Frederic Weisbecker <fweisbec@xxxxxxxxx> wrote:
> On Tue, Jun 19, 2012 at 05:47:54PM +0200, Jiri Olsa wrote:
>> @@ -4061,6 +4105,19 @@ void perf_prepare_sample(struct perf_event_header *header,
>> Â Â Â Â Â Â Â }
>> Â Â Â Â Â Â Â header->size += size;
>> Â Â Â }
>> +
>> + Â Â if (sample_type & PERF_SAMPLE_REGS_USER) {
>> + Â Â Â Â Â Â /* regs dump available bool */
>> + Â Â Â Â Â Â int size = sizeof(u64);
>> +
>> + Â Â Â Â Â Â data->regs_user = perf_sample_regs_user(regs);
>> + Â Â Â Â Â Â if (data->regs_user) {
>> + Â Â Â Â Â Â Â Â Â Â u64 mask = event->attr.sample_regs_user;
>> + Â Â Â Â Â Â Â Â Â Â size += hweight64(mask) * sizeof(u64);
>> + Â Â Â Â Â Â }
>> +
>> + Â Â Â Â Â Â header->size += size;
>
> We'll need to remove the 64 bits registers for compat tasks but other than
> that, it looks ok.
You cannot do this. You cannot remove register values from under the hood.
The only way the user has to parse the sample is the sample_regs_users bitmask.
You have to return 0 for those unexisting regs for compat tasks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/