RESOLVED FIXED189893
[JSC][Linux] Support Perf JITDump logging
https://bugs.webkit.org/show_bug.cgi?id=189893
Summary [JSC][Linux] Support Perf JITDump logging
Yusuke Suzuki
Reported 2018-09-23 02:52:45 PDT
[JSC][Linux] Support Perf JITDump logging
Attachments
Patch (21.29 KB, patch)
2018-09-23 02:58 PDT, Yusuke Suzuki
no flags
Screenshot #1 (614.12 KB, image/png)
2018-09-23 02:59 PDT, Yusuke Suzuki
no flags
Screenshot #2 (482.93 KB, image/png)
2018-09-23 03:00 PDT, Yusuke Suzuki
no flags
Patch (21.54 KB, patch)
2018-09-23 04:32 PDT, Yusuke Suzuki
no flags
Patch (21.71 KB, patch)
2018-09-23 04:34 PDT, Yusuke Suzuki
no flags
Patch (21.71 KB, patch)
2018-09-23 04:36 PDT, Yusuke Suzuki
no flags
Patch (24.93 KB, patch)
2018-09-23 07:22 PDT, Yusuke Suzuki
mark.lam: review+
Yusuke Suzuki
Comment 1 2018-09-23 02:58:30 PDT
Yusuke Suzuki
Comment 2 2018-09-23 02:59:46 PDT
Created attachment 350558 [details] Screenshot #1
Yusuke Suzuki
Comment 3 2018-09-23 03:00:06 PDT
Created attachment 350559 [details] Screenshot #2
EWS Watchlist
Comment 4 2018-09-23 03:00:42 PDT
Attachment 350557 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/assembler/LinkBuffer.h:356: Wrong number of spaces before statement. (expected: 12) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/assembler/LinkBuffer.h:358: Wrong number of spaces before statement. (expected: 16) [whitespace/indent] [4] Total errors found: 2 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 5 2018-09-23 04:32:51 PDT
EWS Watchlist
Comment 6 2018-09-23 04:33:57 PDT
Attachment 350562 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/assembler/LinkBuffer.h:356: Wrong number of spaces before statement. (expected: 12) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/assembler/LinkBuffer.h:358: Wrong number of spaces before statement. (expected: 16) [whitespace/indent] [4] Total errors found: 2 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 7 2018-09-23 04:34:58 PDT
Yusuke Suzuki
Comment 8 2018-09-23 04:36:50 PDT
EWS Watchlist
Comment 9 2018-09-23 04:40:06 PDT
Attachment 350564 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/assembler/LinkBuffer.h:356: Wrong number of spaces before statement. (expected: 12) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/assembler/LinkBuffer.h:358: Wrong number of spaces before statement. (expected: 16) [whitespace/indent] [4] Total errors found: 2 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 10 2018-09-23 06:15:18 PDT
Comment on attachment 350564 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=350564&action=review > Source/JavaScriptCore/ChangeLog:20 > + Currently, due to perf inject command's bug (maybe), some JIT code information is not attached, > + but it should be fixed in perf command's side. I've found that this is because perf's MMAP record is a bit tricky if we use `mmap(..., PROT_NONE, ...)`. The simple workaround is that using the normal protection in OSAllocator::reserveUncommitted OS(LINUX) code if perf is enabled.
Yusuke Suzuki
Comment 11 2018-09-23 06:21:59 PDT
Comment on attachment 350564 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=350564&action=review > Source/JavaScriptCore/assembler/PerfLog.cpp:185 > + if (!size) { > + dataLogLnIf(PerfLogInternal::verbose, "0 size record ", name, " ", RawPointer(executableAddress)); > + return; > + } If we have 0-sized record, `perf inject` command's fixing up overlapping map region gets stuck! So, recording 0-sized code load is not allowed.
Yusuke Suzuki
Comment 12 2018-09-23 07:22:21 PDT
EWS Watchlist
Comment 13 2018-09-23 07:23:39 PDT
Attachment 350565 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/assembler/LinkBuffer.h:356: Wrong number of spaces before statement. (expected: 12) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/assembler/LinkBuffer.h:358: Wrong number of spaces before statement. (expected: 16) [whitespace/indent] [4] Total errors found: 2 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 14 2018-10-05 12:23:32 PDT
Ping?
Mark Lam
Comment 15 2018-10-05 12:46:56 PDT
Comment on attachment 350565 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=350565&action=review r=me with fixes. > Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:1162 > + E45E4CF7243D4BFF924852DC /* PerfLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CF028A1ED94468C977A3BB2 /* PerfLog.h */; settings = {ATTRIBUTES = (Private, ); }; }; Do we need to add to JavaScriptCore.xcodeproj/project.pbxproj at all given this is a linux only feature? If you can build on Mac without this, then let's leave it out. > Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:2205 > + 1AEC53058BC44112AF424E00 /* PerfLog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerfLog.cpp; sourceTree = "<group>"; }; Ditto. > Source/JavaScriptCore/assembler/LinkBuffer.h:357 > + : (UNLIKELY(JSC::Options::logJITCodeForPerf()) \ > + ? (linkBufferReference).finalizeCodeWithDisassembly<resultPtrTag>(false, __VA_ARGS__) \ Can you wrap this in #if OS(LINUX)? > Source/JavaScriptCore/assembler/PerfLog.cpp:210 > +#endif nit: Add // ENABLE(ASSEMBLER) && OS(LINUX) > Source/JavaScriptCore/assembler/PerfLog.h:57 > +#endif nit: Add ENABLE(ASSEMBLER) && OS(LINUX) > Source/JavaScriptCore/runtime/Options.h:182 > + v(bool, logJITCodeForPerf, false, Normal, nullptr) \ Since this feature is linux only, can you make this Configurable instead of Normal, and disable it completely for anything other than linux. See the useSigillCrashAnalyzer option for an example. This way, we won't falsely advertise that its an available option.
Yusuke Suzuki
Comment 16 2018-10-05 12:58:46 PDT
Comment on attachment 350565 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=350565&action=review Thank you! >> Source/JavaScriptCore/assembler/LinkBuffer.h:357 >> + ? (linkBufferReference).finalizeCodeWithDisassembly<resultPtrTag>(false, __VA_ARGS__) \ > > Can you wrap this in #if OS(LINUX)? Fixed. >> Source/JavaScriptCore/assembler/PerfLog.cpp:210 >> +#endif > > nit: Add // ENABLE(ASSEMBLER) && OS(LINUX) Fixed. >> Source/JavaScriptCore/assembler/PerfLog.h:57 >> +#endif > > nit: Add ENABLE(ASSEMBLER) && OS(LINUX) Fixed. >> Source/JavaScriptCore/runtime/Options.h:182 >> + v(bool, logJITCodeForPerf, false, Normal, nullptr) \ > > Since this feature is linux only, can you make this Configurable instead of Normal, and disable it completely for anything other than linux. See the useSigillCrashAnalyzer option for an example. This way, we won't falsely advertise that its an available option. Nice, fixed.
Yusuke Suzuki
Comment 17 2018-10-05 12:59:10 PDT
Radar WebKit Bug Importer
Comment 18 2018-10-05 13:01:46 PDT
Note You need to log in before you can comment on or make changes to this bug.