Hi guys,
My gem5 version is the newest v21.0.
I build gem5 with command “scons build/X86_MSI/gem5.debug --default=X86
PROTOCOL=MESI_Three_Level SLICC_HTML=True”
And I write a simple multi-thread program.
#define THREAD 16
uint64_t sharei[8*THREAD]; //1 cachelines each thread
void work(void* arg){
int id = *(int*)arg;
int i=10000;
int status=0;
if(status==0){
sharei[0]=id;
while(i-->0){
;
}
}else{
printf("transaction conflict go to fallback path!!!!\n");
}
printf("id=%d sharei=%ld status:%d\n",id,sharei[0],status);
}
int main(int argc, char *argv[]){
pthread_t t[THREAD];
int tid[THREAD];
for(int i=0;i<THREAD;i++){
tid[i] = i;
pthread_create(&t[i],NULL,(void*)&work,(void*)&tid[i]);
}
for(int i=0;i<THREAD;i++){
pthread_join(t[i],NULL);
}
return 0;
}
It is ok and correct to run on my computer.
I run this program in gem5 with command “./build/X86_MSI/gem5.debug
./configs/example/se.py --ruby --cpu-type=TimingSimpleCPU -n 16 -c
./bench/tx-thread”.
But gem5 reports a panic
“panic: Tried to read unmapped address 0x7ffff01bc9d0.
PC: 0x7ffff7dc8bd8, Instr: MOV_R_M : ld edi, DS:[rdi + 0x2d0]
Memory Usage: 1049152 KBytes
Program aborted at tick 733465000”
Then I add debug flags “X86,Exec,SimpleCPU,Fetch” to see what’s going on. And
the before crash debug messages are below:
733464000: system.cpu00: Fetch
733464000: system.cpu00: Fetch: Inst PC:0x7ffff7dc8bd8, Fetch PC:0x7ffff7dc8bd8
733464000: system.cpu00: Translating address 0x7ffff7dc8bd8
733464000: system.cpu00: Sending fetch for addr 0x7ffff7dc8bd8(pa: 0x8ebd8)
733464000: system.cpu00: -- pkt addr: 0x8ebd8
733464501: system.cpu00.icache_port: Received fetch response 0x8ebd8
733465000: system.cpu00: Complete ICache Fetch for addr 0x8ebd8
733465000: global: MOV_R_M : ld: The address is 0x7ffff01bc9d0
733465000: system.cpu00: T0 : 0x7ffff7dc8bd8 @_end+140737349711768 : mov
edi, DS:[rdi + 0x2d0]
733465000: system.cpu00: T0 : 0x7ffff7dc8bd8 @_end+140737349711768. 0 :
MOV_R_M : ld edi, DS:[rdi + 0x2d0] : MemRead : A=0x7ffff01bc9d0
733465000: system.cpu00: Fault occured. Handling the fault
I notice that the program running in gem5 executes only 15 “printf("id=%d
sharei=%ld status:%d\n” which should be 16.
So I try to add more cpu to gem5 with command “-n 17”. How amazing! It works.
And I try different thread number and CPU number. When the CPU number is one
more than thread number, the program will run success.
I also try to run another multi-thread program from
“https://www.gem5.org/documentation/learning_gem5/part3/running/“. But the
trick that add one more cpu does not work in this program. The gem5 reports
that “fatal: Ruby functional read failed for address 0x160928
Memory Usage: 954460 KBytes"
Anyone know what is going on? Could give me some advice to debug?
Thanks!
_______________________________________________
gem5-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s