-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8253909: Implement detailed map file for CDS #474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
Webrevs
|
tstuefe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a full review, just some drive-by comments.
|
|
||
| // Dump all the data [base...top). Pretend that the base address | ||
| // will be mapped to runtime_base at run-time. | ||
| static void write_data(address base, address top, address runtime_base) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider printing the data with os::print_hex_dump() instead. Would slim down this coding.
| } else { | ||
| log_info(cds, map)("Log level = info"); | ||
| log_info(cds, map)("Run with -Xlog:cds+map=debug for more detailed information"); | ||
| log_info(cds, map)("Run with -Xlog:cds+map=trace for even more detailed information"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matter of taste, but I do not think usage information belongs into a log.
| void write(ArchiveBuilder* builder, FileMapInfo* mapinfo, | ||
| GrowableArray<MemRegion> *closed_heap_regions, | ||
| GrowableArray<MemRegion> *open_heap_regions, | ||
| char* bitmap, size_t bitmap_size_in_bytes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider, instead of directly writing to UL, writing to an outputStream*. That would make the code more versatile and reusable. You can then use LogStream to print to UL with the same result.
| // a different location at runtime. At dump time, the buffers may be at arbitrary locations | ||
| // picked by the OS. At runtime, we try to map at a fixed location (SharedBaseAddress). For | ||
| // consistency, we log everything using runtime addresses. | ||
| class ArchiveBuilder::CDSMapLogger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AllStatic?
| address header = address(mapinfo->header()); | ||
| address header_end = header + mapinfo->header()->header_size(); | ||
| write_region("header", header, header_end, 0); | ||
| write_data(header, header_end, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider writing out the header members human-readable, that would be more useful than a hexdump. I'd also print them already at Info level, since often the header info is the only thing interesting.
| void write_region(int region, char* base, size_t size, | ||
| bool read_only, bool allow_exec); | ||
| void write_bitmap_region(const CHeapBitMap* ptrmap, | ||
| char* write_bitmap_region(const CHeapBitMap* ptrmap, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment here and in MetaspaceShared::write_core_archive_regions() that the returned bitmap is c-heap allocated and needs to be freed?
|
Mailing list message from Ioi Lam on hotspot-runtime-dev: Hi Thomas, Thanks for the review! On 10/1/20 11:26 PM, Thomas Stuefe wrote:
Fixed. I had to modify os::print_hex_dump() to optionally print a
Removed
UL allows several logging levels. I don't know how to do that with
Fixed
Done. I attached the updated example logs to the bug report.
Fixed. Thanks |
| st->print_cr("- use_full_module_graph %d", _use_full_module_graph); | ||
| st->print_cr("- ptrmap_size_in_bits: " SIZE_FORMAT, _ptrmap_size_in_bits); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thank you!
| static void print_hex_dump(outputStream* st, address start, address end, int unitsize, | ||
| int bytes_per_line, address logical_start); | ||
| static void print_hex_dump(outputStream* st, address start, address end, int unitsize) { | ||
| print_hex_dump(st, start, end, unitsize, /*bytes_per_line=*/16, /*logical_start=*/start); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit unclear. Could we do it like this instead:
// Print a hex dump from [start .. end). Output lines are prefixed with addresses.
static void print_hex_dump(outputStream* st, address start, address end, int unitsize)
// Print a hex dump from [base+start .. base+end). Output lines are prefixed with offset in relation to base.
static void print_hex_dump(outputStream* st, address base, intx start, intx end, int unitsize)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is not what I want. I am calling with parameters like:
print_hex_dump(st, /*start=*/0x7ffff0000, end, unitsize, bytes_per_line, /*logical_start=*/0x800000000);
So my buffer is at some random address, but I want the print out to pretend that it started at 0x800000000.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. A bit special, usually one would base it at 0 (e.g. printing network packets or similar). I think its okay then. We can revisit this later if needed.
| CDSMapLogger logger; | ||
| logger.write(this, mapinfo, closed_heap_regions,open_heap_regions, | ||
| bitmap, bitmap_size_in_bytes); | ||
| CDSMapLogger::write(this, mapinfo, closed_heap_regions,open_heap_regions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a space before open_heap_regions.
calvinccheung
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit in archiveBuilder.cpp.
|
@iklam This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 3 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
src/hotspot/share/memory/filemap.cpp
Outdated
| } | ||
|
|
||
| write_region(MetaspaceShared::bm, (char*)buffer, size_in_bytes, /*read_only=*/true, /*allow_exec=*/false); | ||
| return (char*)buffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buffer is declared as char*, no need to typecast.
tstuefe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
/integrate |
1 similar comment
|
/integrate |
|
@iklam Since your change was applied there have been 6 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit d1e94ee. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
For analyzing the contents of a CDS archive, we need a "map file" that describes the archive in different levels of detail. This can be done using unified logging. E.g.,
For example, we can use the map file for troubleshooting JDK-8253495
(runtime/cds/DeterministicDump.java broken). We can diff two different cds.map files to see where the non-deterministic contents come from.
See attachments in JDK-8253909 for example map files at the info/debug/trace levels.
Progress
Testing
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/474/head:pull/474$ git checkout pull/474