Repository navigation
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 |
|
/backport to release/10.0 |
|
Started backporting to |
|
@steveisok backporting to git am output$ git cherry-pick fec510711cda38dc02759c5f03d01bf1249a6e60
Auto-merging src/coreclr/pal/inc/pal.h
Auto-merging src/coreclr/vm/perfmap.cpp
CONFLICT (content): Merge conflict in src/coreclr/vm/perfmap.cpp
error: could not apply fec510711cd... Avoid writing jitdump code for block data (#122274)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Avoid writing jitdump code for block data
Applying: Address PR feedback
Applying: Address PR feedback
Using index info to reconstruct a base tree...
M src/coreclr/pal/inc/pal.h
M src/coreclr/vm/perfmap.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/pal/inc/pal.h
Auto-merging src/coreclr/vm/perfmap.cpp
CONFLICT (content): Merge conflict in src/coreclr/vm/perfmap.cpp
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0003 Address PR feedback
Error: The process '/usr/bin/git' failed with exit code 128 |
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.