RE: [PATCH] perf map: fix overlapped map handling

From: Steve MacLean
Date: Fri Sep 27 2019 - 21:32:27 EST


>> An earlier version of this patch used:
>> after->start = map->end;
>> + after->pgoff += map->end - pos->start;
>>
>> Instead of the newer Functionally equivalent:
>> after->start = map->end;
>> + after->pgoff = pos->map_ip(pos, map->end);
>>
>> I preferred the latter form as it made more sense with the assertion that the mapping of map->end should match in pos and after.
>
> So, if they are equivalent then I think its better to use code that ressembles the kernel as much as possible, so that when in doubt we can compare the tools/perf calcs with how the kernel does it, filtering out things like the PAGE_SHIFT, can we go that way?
>
> Also do you have some reproducer, if you have one then we can try and have this as a 'perf test' entry, bolting some more checks into tools/perf/tests/perf-record.c or using it as a start for a test that stresses this code.
>
> This is not a prerequisite for having your fix on, but would help checking that perf doesn't regresses in this area.
>
> - Arnaldo

I have updated the patch to use the earlier version, which more closely matches the kernel.

I have updated the commit message to include the repro info.

I am including a few other patches I have generated while adding support for perf jitdump to coreclr.