When studying code layout, it is useful to capture the page size of the sampled code address. Add a new sample type for code page size. The new sample type requires collecting the ip. The code page size can be calculated from the NMI-safe perf_get_page_size(). For large PEBS, it's very unlikely that the mapping is gone for the earlier PEBS records. Enable the feature for the large PEBS. The worst case is that page-size '0' is returned.
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -144,8 +144,9 @@ enum perf_event_sample_format { · 143 unmodified lines | |||
| 144 | PERF_SAMPLE_AUX = 1U << 20, | 144 | PERF_SAMPLE_AUX = 1U << 20, |
| 145 | PERF_SAMPLE_CGROUP = 1U << 21, | 145 | PERF_SAMPLE_CGROUP = 1U << 21, |
| 146 | PERF_SAMPLE_DATA_PAGE_SIZE = 1U << 22, | 146 | PERF_SAMPLE_DATA_PAGE_SIZE = 1U << 22, |
| 147 | PERF_SAMPLE_CODE_PAGE_SIZE = 1U << 23, | ||
| 147 | 148 | ||
| 148 | PERF_SAMPLE_MAX = 1U << 23, /* non-ABI */ | 149 | PERF_SAMPLE_MAX = 1U << 24, /* non-ABI */ |
| 149 | 150 | ||
| 150 | __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, /* non-ABI; internal use */ | 151 | __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, /* non-ABI; internal use */ |
| 151 | }; | 152 | }; |
| @@ -898,6 +899,7 @@ enum perf_event_type { · 746 unmodified lines | |||
| 898 | * { u64 size; | 899 | * { u64 size; |
| 899 | * char data[size]; } && PERF_SAMPLE_AUX | 900 | * char data[size]; } && PERF_SAMPLE_AUX |
| 900 | * { u64 data_page_size;} && PERF_SAMPLE_DATA_PAGE_SIZE | 901 | * { u64 data_page_size;} && PERF_SAMPLE_DATA_PAGE_SIZE |
| 902 | * { u64 code_page_size;} && PERF_SAMPLE_CODE_PAGE_SIZE | ||
| 901 | * }; | 903 | * }; |
| 902 | */ | 904 | */ |
| 903 | PERF_RECORD_SAMPLE = 9, | 905 | PERF_RECORD_SAMPLE = 9, |