Messages in this thread | ![/](/images/icornerl.gif) | | Date | Mon, 16 Jan 2023 19:04:12 +0530 | From | Ravi Bangoria <> | Subject | Re: [RFC 3/4] perf tool: Introduce PERF_RECORD_KMOD_SEC_MAP |
| |
Hi Adrian,
On 16-Jan-23 11:44 AM, Adrian Hunter wrote: > On 10/01/23 07:58, Ravi Bangoria wrote: >> Introduce, perf tool only, synthetic event type PERF_RECORD_KMOD_SEC_MAP. >> Also add stub code for it. This event will be used to save/restore kernel >> module section maps to/from perf.data file. This is needed because kernel >> module elfs does not contain program header table and thus there is no >> easy way to find out how kernel would have loaded module sections in the >> memory. > > Currently machine__addnew_module_map() adds a map for a > module, and then perf_event__synthesize_modules() creates > an MMAP/MMAP2 event for it. Why can't we do that for the > sections?
Do you mean why not use MMAP/MMAP2 for module sections as well? I thought about that but: - PERF_RECORD_MMAP has no field which can help segregate normal vs section specific maps. - I can probably introduce special MAP_ flag and use PERF_RECORD_MMAP2. But that flag will be non-standard (perf tool only), which is ugly. - I also need additional hacks while synthesizing section specific MMAP/ MMAP2 (e.g.: store section name and file path in filename[]) and similar hacks while parsing them at perf report time.
So I felt introducing PERF_RECORD_KMOD_SEC_MAP is relatively cleaner approach.
Thanks, Ravi
| ![\](/images/icornerr.gif) |