Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

perf2bolt Assertion when bolt MySQL #263

Closed
valuenumbering opened this issue Dec 13, 2021 · 3 comments
Closed

perf2bolt Assertion when bolt MySQL #263

valuenumbering opened this issue Dec 13, 2021 · 3 comments

Comments

@valuenumbering
Copy link

valuenumbering commented Dec 13, 2021

I tried bolt to optimize mysql, using GCC 10.2.1 and adding -Wl, -q on Intel platform. But perf2bolt asserted!
Perf version: 4.14.105-1

  1. $ perf record -e cycles:u -j any,u
  2. $ perf2bolt -p /data/perf_data/perf.data -o perf.fdata mysqld
    BOLT-INFO: enabling relocation mode
    PERF2BOLT: read 6670837 samples and 207213185 LBR entries
    PERF2BOLT: 0 samples (0.0%) were ignored
    PERF2BOLT: traces mismatching disassembled function contents: 114656 (0.1%)
    PERF2BOLT: out of range traces involving unknown regions: 36288826 (18.1%)
    perf2bolt: /data/bolt/bolt/lib/Core/BinaryContext.cpp:765: const llvm::MCSymbol* llvm::bolt::BinaryContext::getOrCreateJumpTable(llvm::bolt::BinaryFunction&, uint64_t, llvm::bolt::JumpTable::JumpTableType): Assertion `JT->Parent == &Function && "cannot re-use jump table of a different function"' failed.
 #0 0x0000000000d45440 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000000000d4332e SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f54bab1e630 __restore_rt sigaction.c:0:0
 #3 0x00007f54b970b3d7 raise /usr/src/debug/glibc-2.17-c758a686/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:55:0
 #4 0x00007f54b970cac8 abort /usr/src/debug/glibc-2.17-c758a686/stdlib/abort.c:92:0
 #5 0x00007f54b97041a6 __assert_fail_base /usr/src/debug/glibc-2.17-c758a686/assert/assert.c:92:0
 #6 0x00007f54b9704252 (/lib64/libc.so.6+0x2f252)
 #7 0x0000000001b75b83 llvm::bolt::BinaryContext::getOrCreateJumpTable(llvm::bolt::BinaryFunction&, unsigned long, llvm::bolt::JumpTable::JumpTableType) (/data/bolt_install/bin/perf2bolt+0x1b75b83)
 #8 0x0000000001b75d43 llvm::bolt::BinaryContext::handleAddressRef(unsigned long, llvm::bolt::BinaryFunction&, bool) (/data/bolt_install/bin/perf2bolt+0x1b75d43)
 #9 0x0000000001b8c569 llvm::bolt::BinaryFunction::disassemble()::'lambda'(llvm::MCInst&, unsigned long, unsigned long)::operator()(llvm::MCInst&, unsigned long, unsigned long) const BinaryFunction.cpp:0:0
#10 0x0000000001ba3463 llvm::bolt::BinaryFunction::disassemble() (/data/bolt_install/bin/perf2bolt+0x1ba3463)
#11 0x0000000000b20260 llvm::bolt::RewriteInstance::disassembleFunctions() (/data/bolt_install/bin/perf2bolt+0xb20260)
#12 0x0000000000b78de5 llvm::bolt::RewriteInstance::run() (/data/bolt_install/bin/perf2bolt+0xb78de5)
#13 0x000000000040e0e0 main (/data/bolt_install/bin/perf2bolt+0x40e0e0)
#14 0x00007f54b96f7555 __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/../csu/libc-start.c:300:0
#15 0x00000000004757b5 _start (/data/bolt_install/bin/perf2bolt+0x4757b5)
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.      Program arguments: perf2bolt -p /test/perf.data -o perf.fdata /test/mysqld
Aborted

==
But I try a simple helloworld program, it is OK.
Can anyone know how to debug the issue?

@aaupov
Copy link
Contributor

aaupov commented Dec 13, 2021

Hi @valuenumbering!
I would guess the reason for that assertion is GCC-style split jump tables with entries pointing to the function and the cold fragment.
Did you enable the following gcc flag: -fno-reorder-blocks-and-partition?
If that doesn't fix the issue, please share the exact steps to build mysqld binary.

@valuenumbering
Copy link
Author

valuenumbering commented Dec 15, 2021

Hi @aaupov,
It is OK with -fno-reorder-blocks-and-partition. Thanks a ton!!
Could you help another issue ? :). #264

@aaupov
Copy link
Contributor

aaupov commented Dec 16, 2021

Great!
I've left the comment in #264. Closing this one.

@aaupov aaupov closed this as completed Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants