Avoid writing jitdump code for block data#122274
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue (#120419) where JIT dumps fail when reporting stub blocks whose memory is reserved but not yet committed. The fix prevents writing code bytes for block-level allocations while maintaining backward compatibility for individual method reporting.
- Adds a
reportCodeBlockboolean parameter toPAL_PerfJitDump_LogMethod(defaults totrue) - Updates the stub logging logic to skip code bytes for block-type allocations
- Removes dead code check that would never execute
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/pal/inc/pal.h | Adds reportCodeBlock parameter with default value true to maintain backward compatibility |
| src/coreclr/pal/src/misc/perfjitdump.cpp | Implements conditional code size reporting based on reportCodeBlock parameter; removes dead code check |
| src/coreclr/vm/perfmap.cpp | Updates call site to pass false for block-type stub allocations |
|
Tagging subscribers to this area: @steveisok, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/coreclr/pal/src/misc/perfjitdump.cpp:268
reportedCodeSizecontrols how many bytes are appended to the record, butrecord.code_sizeremains set tocodeSizeeven whenreportCodeBlockis false. Sinceheader.total_sizewill then not equalsizeof(record)+name+code_size, this looks inconsistent and can be confusing for future maintainers and for jitdump consumers. Consider adding an explicit comment here clarifying thatcode_sizedescribes the code region size for symbolization while the native code payload is intentionally omitted (andtotal_sizereflects the actual emitted payload size).
size_t reportedCodeSize = reportCodeBlock ? codeSize : 0;
size_t bytesRemaining = sizeof(JitCodeLoadRecord) + symbolLen + 1 + reportedCodeSize;
record.header.timestamp = GetTimeStampNS();
record.vma = (uint64_t) pCode;
record.code_addr = (uint64_t) pCode;
record.code_size = codeSize;
record.header.total_size = bytesRemaining;
You can also share your feedback on Copilot code review. Take the survey.
|
/ba-g failures are known |
Fixes #120419. The implementation of JIT dumps in the linux
perftool creates dynamic shared objects representing JIT'd methods. In .NET 10, #113943 changed the default granularity for stubs, which now reports the block of memory that stores stubs instead of the individual methods. If the event is fired before the block memory is committed (only is reserved),PerfJitDumpState::LogMethodfails to read the memory from the block and then all subsequent JIT dump events will fail. The linuxperftool will favor jit dumps over perfmaps if jit dumps are available, which breaks DOTNET_PerfMapEnabled=1 or 2 settings. This fix addresses the issue by no longer reporting the code byte for block allocations, which is only enabled when DOTNET_PerfMapStubGranularity is set to 0 or 1.