> thanks in advance,
> Dean Michael Ancajas
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://m5sim.org/cgi-bin/mailman/private/m5-users/attachments/20080918/c7a931f3/attachment-0001.htm
>
>
> I think you have a misconception about the events. Events can be
> reused, so as long as you don't have more than one event outstanding
> for a specific task (and you really shouldn't ever do this), you
> shouldn't need to dynamically create them.  Of the top of my head I
> can' think of what the copy constructor looks like for an Event, but
> it doesn't seems like it would do what you appear to want it to do. I
> would imagine that the event copying is the root of the problem, that
> or something subtle about using the comInstEventQueue.
>
> Ali


hi Ali,
   I know my reply is late, very sorry. Anyways, I've fixed the thread-ID
error, it turns out I haven't initialized it properly in the constructor
list. So now I can schedule the event to be process()'d at the correct
instruction count in each thread, however I still get a segmentation fault
error when I call suspendContext(tid) or even deactivateThread(tid). Any
tips on how to debug this? And also my reason that I dynamically create
SuspendThreadEvent is because I can only find out the number of
threads(which would be important when Queue-ing the event in the
comInstEventQueue array),instruction count depending on the configuration of
the CPU. I'm fairly new to C++ and after reading about copy constructors I
understand the fundamental problem of my previous code in
scheduleSuspendThreadEvent() method,

so my new scheduleSuspendThreadEvent() is now:

void scheduleSuspendThreadEvent(int _tid,Tick when){
190         // Schedule thread to suspend, regardless of its current state.
191         DPRINTF(Event,"suspend thread:%d \n",_tid);
192
193         new SuspendThreadEvent(comInstEventQueue[_tid],1000,_tid);
//hard-coded to suspend in 1000 instructions each thread; will be changed
later
202         }

I removed the "SuspendThreadEvent suspendThread[Impl::Maxthreads]"(see code
below from previous email) line to prevent issues in copy constructors and
just dyamically created the events(the downside is that I cannot access the
created events after, which I guess is fine as of now). Also, I know that
this is not an M5-related question but a C++ one: Is it possible create an
array of Events in M5 that wouldn't use the standard constructors? The
relevance of my question is that I wanted to pass the thread_id of each
event so that it would be queued in its own comInstEventQueue[].



Thanks in advance!



>
>
> On Sep 18, 2008, at 4:20 AM, Dean Michael Ancajas wrote:
>
> > hi everybody,
> >     I've create d an Event called SuspendThreadEvent(same properties
> > with ActivateThreadEvent in src/o3/cpu.cc) which will call
> > FullO3CPU<Impl>::suspendContext(int tid), to be able to initialize a
> > SuspendThreadEvent instance, I created
> > scheduleSuspendThreadEvent(tid,cpu), the problem is when I passed
> > the correct parameter to scheduleSuspendThreadEvent but according to
> > the generated traces(see below) the value used in the initialization
> > is different.
> >
> > commandline:
> > [EMAIL PROTECTED]:~/m5/repos/smt$ ./m5.debug --trace-file=event2.out --
> > trace-flags=Event tests/run.py quick/01.hello-2T-smt/alpha/tru64/o3-
> > timing
> >
> >
> > in cpu.cc
> >  if( params->max_insts_pause_each_thread == 0 ){ //number of
> > instructiosn has been coded in initialization at cpu.hh
> >  279
> >  280         for(int tid=0;tid < numThreads; tid++){
> >  281
> >  282            DPRINTF(Event,"Num of threads: %d\n",numThreads); //
> > print number of threads
> >  283            DPRINTF(Event,"1. scheduling suspend thread: %d
> > \n",tid); //print out thread # to be suspended
> >  284            scheduleSuspendThreadEvent(tid,params-
> > >max_insts_pause_each_thread);
> >  285            DPRINTF(Event,"2. scheduling suspend thread: %d
> > \n",tid); //double check if value of tid has changed
> >  286         }
> >  287     }
> >
> >
> > in cpu.hh
> >  /** added by dean michael ancajas, Schedule thread to suspend **/
> > 189         void scheduleSuspendThreadEvent(int _tid,Tick when){
> > 190         // Schedule thread to suspend, regardless of its current
> > state.
> > 191         DPRINTF(Event,"suspend thread:%d \n",_tid);
> > 192
> > 193         suspendThreadEvent[_tid] = *(new
> > SuspendThreadEvent(comInstEventQueue[_tid],100)); //for now this is
> > hard-coded to suspend in 100 instructions each thread
> > 194         suspendThreadEvent[_tid].init(_tid,this);
> > 201         }
> >
> >
> > Generated traces from event2.out:
> >
> >    2       0: system.cpu: Num of threads: 2
> >    3       0: system.cpu: 1. scheduling suspend thread: 0
> >    4       0: system.cpu: suspend thread:0
> >    5       0: Event_15: FullO3CPU "Suspend Thread" event scheduled @
> > 100
> >    6       0: Event_15: thread suspend: 0
> >    7       0: system.cpu: 2. scheduling suspend thread: 0
> >    8       0: system.cpu: Num of threads: 2
> >    9       0: system.cpu: 1. scheduling suspend thread: 1
> >   10       0: system.cpu: suspend thread:1
> >   11       0: Event_16: FullO3CPU "Suspend Thread" event scheduled @
> > 100
> >   12       0: Event_16: thread suspend: 9
> >   13       0: system.cpu: 2. scheduling suspend thread: 1
> >   14       0: Event_2: FullO3CPU tick event scheduled @ 0
> >
> >
> > The first SuspendThreadEvent was initialized properly(line 3's
> > thread # and line 6's thread # are equal, but the 2nd is not, line 9
> > says it must suspend thread #1 but in line 12 it passed thread #9.
> > I'm confused as to where the value started to change. As we can also
> > see in line 13, the value of tid in cpu.cc hasn't change after
> > calling the scheduleSuspendThreadEvent. So I guess the culprit must
> > be in the scheduleSuspendThreadEvent.. Any help/ideas would be
> > greatly appreciated.
> >
> > thanks in advance,
> > Dean Michael Ancajas
> >
> > _______________________________________________
> > m5-users mailing list
> > [email protected]
> > http://m5sim.org/cgi-bin/mailman/listinfo/m5-users
>
>
>
> ------------------------------
>
> _______________________________________________
> m5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/m5-users
>
> End of m5-users Digest, Vol 26, Issue 10
> ****************************************
>



-- 
Dean Michael B. Ancajas
_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

Reply via email to