I believe there are timers that already do what you are trying to do - that at 
checkpoint time save their state (time till next time to tick), and on restore 
generate an event with an offset.

I8254 timer is a good example to take a look at.
src/dev/x86/i8254.cc

Cagdas
________________________________________
From: gem5-users [[email protected]] on behalf of Erfan Azarkhish 
[[email protected]]
Sent: Tuesday, June 30, 2015 7:42 AM
To: gem5 users mailing list
Subject: Re: [gem5-users] Wakeup after restoring checkpoint

Dear Yuan,

I faced the same issue, and I solved it using a not very clean trick. So, I 
would really appreciate it if someone could tell us the proper solution to 
address this issue.
Here is how I fixed it:

1. In the init() method of my component, I check whether this is a "fresh 
execution" or a "checkpoint resume". (I pass this information MANUALLY to gem5 
by creation of a file and checking whether it exists).
  Now in the init() method, I schedule my periodic event ONLY if the execution 
is fresh, otherwise I won't schedule it (see below).
2. I override the drain() method of my component, and I make sure that there 
are no in-flight transactions in my component (You can see an example of how 
this method is used in the existing components).
3. I override the drainResume() method, and there, I schedule my periodic event.

This way the periodic event works both with fresh execution, and with 
checkpoint resuming.

I hope that this helps,

Best,

On Fri, Jun 19, 2015 at 12:23 PM, Yuan Yao 
<[email protected]<mailto:[email protected]>> wrote:
Hi All:
    Recently I wrote a new component in Garnet, which wakes itself up when 
initialized. After that, it re-shedules periodically.
    Below is the code for this purpose:

    MyComponent::MyComponent(){
        ...
        scheduleEventAbsolute(m_net_ptr->clockEdge(Cycles(1)));
        ...
    }

    MyComponents::wakeup(){
        ...
        scheduleEvent(Cycles(A_PERIOD));
        ...
    }

    The code works fine when I start a full system simulation afresh. However, 
when I restore from a checkpoint, MyComponent never wakes up.
    I guess the problem is in the event queue. It seems the wake up event of 
MyComponent is not registered successfully. But I am not sure about this...
    Based on this observation, my question is:

        - How to wake up your own component after restoring from a checkpoint?

Best Regards
==================================

Yuan Yao (Mr.)
PhD Candidate in Electronic and Computer Systems

School of ICT
KTH Royal Institute of Technology

[email protected]<mailto:[email protected]>







_______________________________________________
gem5-users mailing list
[email protected]<mailto:[email protected]>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users



--
Erfan Azarkhish
Micrel Lab - Viale Carlo Pepoli 3/2 - 40123, Bologna
DEI - University of Bologna, Italy
https://www.linkedin.com/in/erfanazarkhish
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to