Hello,

I am working on migrating application threads from one core
to another on gem5. I have implemented a pseudo-instruction to trigger
thread migration. When an application thread calls this
pseudo-instruction, I want to migrate the thread to another cpu. My
problem is that I cannot migrate application threads from simulator side
by using _pthread_ library. So I need to migrate all thread context in
simulator side. 

According to this [1] presentation on gem5 web site, I
should use _ drain, switchOut, takeOverFrom_ and _resume_ functions of
gem5. However I do not know how to use them inside the
pseudo-instruction. If you have studied on this issue before, could you
please inform me about how to migrate threads step by step from simuator
side?

I put the codes inside my pseudo-instruction. Without using
_drainResume_() function, the system hangs. With using drainResume()
function, it gives cpu status error.

void 
my_func(ThreadContext *tc)

{

 BaseCPU *oldcpu = tc->getCpuPtr();
 System *sys =
tc->getSystemPtr();
 ThreadContext *other_tc = sys->threadContexts[0];
//migrate from calling cpu to cpu0.
 BaseCPU *newcpu =
other_tc->getCpuPtr();
 oldcpu->drain(NULL); 
 oldcpu->switchOut();


tc->suspend();
 other_tc->takeOverFrom(tc);

 //timing cpu does not have
resume function, instead it has drainResume() function.
//newcpu->drainResume();
}

Thank you in advance for your time and
help.

Best Regards,
Sanem

 

Links:
------
[1]
http://www.m5sim.org/wiki/images/d/da/Gutierrez_gem5_workshop_2012.pdf
_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to