This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Secondary Cache Dump
ClosedPublic

Authored by frs513 on Jun 21 2023, 4:47 PM.

Details

Summary

Dumped some basic info about what is being cached and about the cache
itself. Output of test below:

...
Stats: MapAllocatorCache: EntriesCount: 33, MaxEntriesCount: 64, MaxEntrySize: 1048576
StartBlockAddress: 0x6d342c1000, EndBlockAddress: 0x6d342d2000, BlockSize: 69632
StartBlockAddress: 0x6fc45ff000, EndBlockAddress: 0x6fc462f000, BlockSize: 196608
...

Diff Detail

Event Timeline

frs513 created this revision.Jun 21 2023, 4:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2023, 4:47 PM
Herald added subscribers: yaneury, Enna1. · View Herald Transcript
frs513 requested review of this revision.Jun 21 2023, 4:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2023, 4:47 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
Chia-hungDuan added inline comments.Jun 22 2023, 11:02 AM
compiler-rt/lib/scudo/standalone/secondary.h
144

Can we use %d here? If we do need casting, static_cast is preferred.

Same comment as the following casting.

147

I think having the end of address will be useful too. Like we can get the idea of whether two cached blocks is adjacent.

338

Can you try to rebase? I think this should be included in other CLs.

frs513 updated this revision to Diff 533819.Jun 22 2023, 4:56 PM
frs513 marked 2 inline comments as done.

[scudo] Secondary Cache Dump Revision

Changed casting method to static_cast<> and type of appended values.
Included ending block address so we could see if cache blocks are adjacent.

Have you updated the commit message to include the EndBlockAddress? You may also want to update the description in the summary here in Phabricator

compiler-rt/lib/scudo/standalone/secondary.h
144

Once we use %d here, I think we don't need the casting here? Sorry I may not make it clear.

Use the proper placeholders (%d, %zu, .etc) if possible, otherwise, casting with static_cast.

Like this, https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/scudo/standalone/report.cpp#L60-L61

frs513 updated this revision to Diff 534112.Jun 23 2023, 4:11 PM

Expanded cache dump

added the ending address of each cache block and fixed the formatting of
str->append(...) so that the correct types were being used and so that
we could avoid casting as much as possible.

Chia-hungDuan accepted this revision.Jun 23 2023, 4:26 PM

LGTM! One last thing, you may want to update the commit message to include the EndBlockAddress as well

This revision is now accepted and ready to land.Jun 23 2023, 4:26 PM
frs513 edited the summary of this revision. (Show Details)Jun 26 2023, 10:46 AM
frs513 updated this revision to Diff 534768.Jun 26 2023, 3:40 PM

ran the clang formatter

This revision was landed with ongoing or failed builds.Jun 26 2023, 3:44 PM
This revision was automatically updated to reflect the committed changes.