gem5-users@gem5.org

The gem5 Users mailing list

View all threads

Multi-threaded program in Gem5 SE mode

PZ
Peng, Ziyang
Wed, Oct 25, 2023 6:53 AM

Hi all,
Earlier this month, I saw an email saying that Gem5 SE mode already supports multi-threaded program. I tested both ARM and X86 program. X86 works well but the ARM one will report below errors when deleting threads(maybe?).

build/ARM/sim/syscall_emul.cc:74: warn: ignoring syscall madvise(...)
terminate called after throwing an instance of 'std::system_error'
what():  Unknown error -4016
build/ARM/sim/syscall_emul.cc:74: warn: ignoring syscall rt_sigaction(...)
build/ARM/sim/faults.cc:102: panic: panic condition !handled && !tc->getSystemPtr()->trapToGdb(GDBSignal::SEGV, tc->contextId()) occurred: Page table fault when accessing virtual address 0x400
Memory Usage: 725464 KBytes
Program aborted at tick 577190732000
--- BEGIN LIBC BACKTRACE ---
/home/pzy/Documents/gem5/build/ARM/gem5.opt(+0x29111b0)[0x55c82b7af1b0]
/home/pzy/Documents/gem5/build/ARM/gem5.opt(+0x29356ec)[0x55c82b7d36ec]

My test program is %GEM5_PATH/tests/test-progs/threads/src/threads.cpp. My building command is aarch64-linux-gnu-g++ threads.cpp -lpthread -lrt -pthread -static -o arm_thread (Note: Nothing changes with/without -lrt and -lpthread).
My Gem5 configuration file is based on %GEM5_PATH/configs/learning_gem5/part1/simple.py. I only modify the core numbers and change the using binary like below:
system.cpu = [ArmTimingSimpleCPU() for i in range(core_num)]
system.membus = SystemXBar()
for i in range(core_num):
system.cpu[i].icache_port = system.membus.cpu_side_ports
system.cpu[i].dcache_port = system.membus.cpu_side_ports
system.cpu[i].createInterruptController()
binary = "arm_thread"
system.workload = SEWorkload.init_compatible(binary)
process = Process()
process.cmd = [binary]
for i in range(core_num):
system.cpu[i].workload = process
system.cpu[i].createThreads()

I'd like to know the reason why this error occurs or if it's just that Gem5 ARM doesn't currently  support multithreaded program. (But from the output, I think the binary is executed on these cores). It would be nice to have an example of this running successfully!

Thanks + regards,
Ziyang

Hi all, Earlier this month, I saw an email saying that Gem5 SE mode already supports multi-threaded program. I tested both ARM and X86 program. X86 works well but the ARM one will report below errors when deleting threads(maybe?). build/ARM/sim/syscall_emul.cc:74: warn: ignoring syscall madvise(...) terminate called after throwing an instance of 'std::system_error' what(): Unknown error -4016 build/ARM/sim/syscall_emul.cc:74: warn: ignoring syscall rt_sigaction(...) build/ARM/sim/faults.cc:102: panic: panic condition !handled && !tc->getSystemPtr()->trapToGdb(GDBSignal::SEGV, tc->contextId()) occurred: Page table fault when accessing virtual address 0x400 Memory Usage: 725464 KBytes Program aborted at tick 577190732000 --- BEGIN LIBC BACKTRACE --- /home/pzy/Documents/gem5/build/ARM/gem5.opt(+0x29111b0)[0x55c82b7af1b0] /home/pzy/Documents/gem5/build/ARM/gem5.opt(+0x29356ec)[0x55c82b7d36ec] My test program is %GEM5_PATH/tests/test-progs/threads/src/threads.cpp. My building command is `aarch64-linux-gnu-g++ threads.cpp -lpthread -lrt -pthread -static -o arm_thread` (Note: Nothing changes with/without -lrt and -lpthread). My Gem5 configuration file is based on %GEM5_PATH/configs/learning_gem5/part1/simple.py. I only modify the core numbers and change the using binary like below: system.cpu = [ArmTimingSimpleCPU() for i in range(core_num)] system.membus = SystemXBar() for i in range(core_num): system.cpu[i].icache_port = system.membus.cpu_side_ports system.cpu[i].dcache_port = system.membus.cpu_side_ports system.cpu[i].createInterruptController() binary = "arm_thread" system.workload = SEWorkload.init_compatible(binary) process = Process() process.cmd = [binary] for i in range(core_num): system.cpu[i].workload = process system.cpu[i].createThreads() I'd like to know the reason why this error occurs or if it's just that Gem5 ARM doesn't currently support multithreaded program. (But from the output, I think the binary is executed on these cores). It would be nice to have an example of this running successfully! Thanks + regards, Ziyang