Issue |
120782
|
Summary |
perf2bolt crashes using Amazon Linux 2 on AArch64
|
Labels |
new issue
|
Assignees |
|
Reporter |
salvatoredipietro
|
### Description
When attempting to use BOLT on Amazon Linux 2 (AL2) using an AArch64 instance (AWS m7g.4xlarge), the `perf2bolt` command fails with an assertion error.
### Environment
- Operating System: Amazon Linux 2 (kernel: 5.10.228-219.884.amzn2.aarch64)
- Hardware: AWS m7g.4xlarge instance (ARM-based)
- BOLT version: d33a2c58112bdd74225b0ff4f07acc49bed7e6ea
- Application used: PostgreSQL (build locally)
### Steps to Reproduce
1. Build BOLT on Amazon Linux 2
```bash
# BOLT Installation on AL2
sudo yum install -y gcc10 gcc10-*
export CC=`which gcc10-gcc`
export CXX=`which gcc10-g++`
export LD=`which gcc10-gcc`
export CMAKE_CXX_COMPILER=`which gcc10-g++`
export CMAKE_C_COMPILER=`which gcc10-gcc`
# CMAKE
curl -L "https://github.com/Kitware/CMake/releases/download/v3.31.2/cmake-3.31.2-linux-`uname -p`.tar.gz" | tar xzC /opt && mv /opt/cmake-3.31.2-linux-`uname -p` /opt/cmake3
source <(echo 'export PATH="/opt/cmake3/bin:$PATH"' | tee -a ~/.bashrc) && cmake –version
# NINJA
curl -L https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux$([ `uname -m` == aarch64 ] && echo -`uname -m`).zip -o /opt/ninja-linux.zip && unzip /opt/ninja-linux.zip -d /opt
source <(echo 'export PATH="/opt/:$PATH"' | tee -a ~/.bashrc) && ninja --version
# BOLT
sudo yum install -y perf
git clone https://github.com/llvm/llvm-project.git
mkdir build && cd build
cmake -G Ninja ../llvm-project/llvm -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS="bolt"
ninja bolt
```
2. Run the following command:
```bash
# Get perf information
sudo perf record -e cycles:u -u postgres -o perf.data -a -- sleep 300
# Run perf2bolt cmd
sudo ~/build/bin/perf2bolt -p perf.data -o perf.boltdata --nl /path/to/postgres
```
### Error Message
```bash
sudo ~/build/bin/perf2bolt -p perf.data -o perf.boltdata --nl /home/ec2-user/usr/bin/postgres
PERF2BOLT: Starting data aggregation job for perf.data
PERF2BOLT: spawning perf job to read events without LBR
PERF2BOLT: spawning perf job to read mem events
PERF2BOLT: spawning perf job to read process events
PERF2BOLT: spawning perf job to read task events
BOLT-INFO: Target architecture: aarch64
BOLT-INFO: BOLT version: d33a2c58112bdd74225b0ff4f07acc49bed7e6ea
BOLT-INFO: first alloc address is 0x400000
BOLT-INFO: creating new program header table at address 0xe00000, offset 0xa00000
BOLT-INFO: enabling relocation mode
BOLT-INFO: enabling strict relocation mode for aggregation purposes
BOLT-WARNING: ignoring symbol __bss_start at 0xc88a5a, which lies outside .bss
BOLT-WARNING: ignoring symbol __bss_start__ at 0xc88a5a, which lies outside .bss
BOLT-INFO: pre-processing profile using perf data aggregator
BOLT-INFO: binary build-id is: cced2a14ed88302024b2d4d7e74d98246ba9a86a
PERF2BOLT: spawning perf job to read buildid list
PERF2BOLT: matched build-id and file name
PERF2BOLT: waiting for perf mmap events collection to finish...
PERF2BOLT: parsing perf-script mmap events output
PERF2BOLT: waiting for perf task events collection to finish...
PERF2BOLT: parsing perf-script task events output
PERF2BOLT: input binary is associated with 11987 PID(s)
PERF2BOLT: waiting for perf events collection to finish...
PERF2BOLT: parsing basic events (without LBR)...
PERF2BOLT: waiting for perf mem events collection to finish...
perf2bolt: /home/ec2-user/llvm-project/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp:785: bool {anonymous}::AArch64MCPlusBuilder::analyzeIndirectBranchFragment(const llvm::MCInst&, llvm::DenseMap<const llvm::MCInst*, llvm::SmallVector<llvm::MCInst*, 4> >&, const llvm::MCExpr*&, int64_t&, int64_t&, llvm::MCInst*&) const: Assertion `DefJTBaseAdd->getOpcode() == AArch64::ADDXri && "Failed to match jump table base address pattern! (1)"' failed.
#0 0x0000000000e40df0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (.localalias) (/home/ec2-user/build/bin/perf2bolt+0xe40df0)
#1 0x0000000000e3e89c SignalHandler(int) (/home/ec2-user/build/bin/perf2bolt+0xe3e89c)
#2 0x0000ffff96ce8850 (linux-vdso.so.1+0x850)
#3 0x0000ffff96807834 raise (/lib64/libc.so.6+0x32834)
#4 0x0000ffff96809140 abort (/lib64/libc.so.6+0x34140)
#5 0x0000ffff96800780 __assert_fail_base (/lib64/libc.so.6+0x2b780)
#6 0x0000ffff968007fc (/lib64/libc.so.6+0x2b7fc)
#7 0x0000000001584ecc (anonymous namespace)::AArch64MCPlusBuilder::analyzeIndirectBranch(llvm::MCInst&, llvm::bolt::MCPlusBuilder::InstructionIterator, llvm::bolt::MCPlusBuilder::InstructionIterator, unsigned int, llvm::MCInst*&, unsigned int&, unsigned int&, long&, llvm::MCExpr const*&, llvm::MCInst*&, llvm::MCInst*&) const (/home/ec2-user/build/bin/perf2bolt+0x1584ecc)
#8 0x00000000015e087c llvm::bolt::BinaryFunction::processIndirectBranch(llvm::MCInst&, unsigned int, unsigned long, unsigned long&) (.localalias) (/home/ec2-user/build/bin/perf2bolt+0x15e087c)
#9 0x00000000015f428c llvm::bolt::BinaryFunction::handleIndirectBranch(llvm::MCInst&, unsigned long, unsigned long) (.localalias) (/home/ec2-user/build/bin/perf2bolt+0x15f428c)
#10 0x00000000015f5458 llvm::bolt::BinaryFunction::disassemble() (/home/ec2-user/build/bin/perf2bolt+0x15f5458)
#11 0x0000000000ef2a94 llvm::bolt::RewriteInstance::disassembleFunctions() (.localalias) (/home/ec2-user/build/bin/perf2bolt+0xef2a94)
#12 0x0000000000f211e4 llvm::bolt::RewriteInstance::run() (/home/ec2-user/build/bin/perf2bolt+0xf211e4)
#13 0x000000000040aae0 main (/home/ec2-user/build/bin/perf2bolt+0x40aae0)
#14 0x0000ffff967f4da4 __libc_start_main (/lib64/libc.so.6+0x1fda4)
#15 0x0000000000484bd0 _start (/home/ec2-user/build/bin/perf2bolt+0x484bd0)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/ec2-user/build/bin/perf2bolt -p perf.data -o perf.boltdata --nl /home/ec2-user/usr/bin/postgres
Aborted
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs