Hi all,

I am trying to run a simple pthreads program with MinorCPU, and it seems when 
the program switches back to a thread that has been used before, it will cause 
an error: 

build/ARM/cpu/minor/execute.cc:914: panic: We should never hit the case where 
we try to commit from a suspended thread as the streamSeqNum should not match

This panic does not occur when I use the default CPU type. Another issue is for 
this program I only use 2 threads, but I have to create 5 CPUs, otherwise it 
will fail to create the threads. 
---------------------------------------------
Here is the test program:

#include <iostream>
#include <cstdlib>
#include <pthread.h>

using namespace std;

#define NUM_THREADS 2

void *PrintHello(void *threadid) {
   long tid;
   tid = (long)threadid;
   cout << "Hello World! Thread ID, " << tid << endl;
   pthread_exit(NULL);
}

int main () {
   pthread_t threads[NUM_THREADS];
   int rc;
   int i;
   
   for( i = 0; i < NUM_THREADS; i++ ) {
      cout << "main() : creating thread, " << i << endl;
      rc = pthread_create(&threads[i], NULL, PrintHello, (void *)i);
      
      if (rc) {
         cout << "Error:unable to create thread," << rc << endl;
         exit(-1);
      }
   }

   for( i = 0; i < NUM_THREADS; i++ ) {
      cout << "main() : creating thread, " << i << endl;
      rc = pthread_create(&threads[i], NULL, PrintHello, (void *)i);
      
      if (rc) {
         cout << "Error:unable to create thread," << rc << endl;
         exit(-1);
      }
   }

   pthread_exit(NULL);
}

------------------------------------------
To compile, I use:
aarch64-linux-gnu-g++ -static -pthread -DENABLE_THREADS -g -o test_pthreads 
test_pthreads.cpp

And the configuration for gem5:
build/ARM/gem5.opt configs/example/se.py -c test_pthreads --cpu-type MinorCPU 
-n 5 --l1d_size=64kB --l1i_size=16kB --caches
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to