Dear All:
After digging into eventq.cc, I solved my problem by rescheduling my
component with the cycle number at which the checkpoint is created.
Specifically, I did this:
MyComponent::MyComponent(){
...
scheduleEventAbsolute(m_net_ptr->clockEdge(Cycles(CHECKPOINT_TICK/clockPeriod()));
...
}
MyComponents::wakeup(){
...
scheduleEvent(Cycles(A_PERIOD));
...
}
Now the code works.
Date: Tue, 30 Jun 2015 19:23:53 +0000
From: "Cagdas Dirik (cdirik)" <[email protected]<mailto:[email protected]>>
To: gem5 users mailing list <[email protected]<mailto:[email protected]>>
Subject: Re: [gem5-users] Wakeup after restoring checkpoint
Message-ID:
<[email protected]<mailto:[email protected]>>
Content-Type: text/plain; charset="us-ascii"
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
------------------------------
Message: 3
Date: Tue, 30 Jun 2015 21:59:58 +0100
From: Andreas Hansson <[email protected]>
To: gem5 users mailing list <[email protected]>
Subject: Re: [gem5-users] Wakeup after restoring checkpoint
Message-ID: <d1b85129.27762%[email protected]>
Content-Type: text/plain; charset="utf-8"
Hi all,
Have a look at http://www.gem5.org/SimObject_Initialization and
src/sim/sim_object.hh. In general, I would recommend to not schedule events in
init(), and rather do so in initState, loadState or startup.
Andreas
From: gem5-users
<[email protected]<mailto:[email protected]>> on behalf of
Erfan Azarkhish <[email protected]<mailto:[email protected]>>
Reply-To: gem5 users mailing list
<[email protected]<mailto:[email protected]>>
Date: Tuesday, 30 June 2015 07:42
To: gem5 users mailing list <[email protected]<mailto:[email protected]>>
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
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient,
please notify the sender immediately and do not disclose the contents to any
other person, use it for any purpose, or store or copy the information in any
medium. Thank you.
ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered
in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
Registered in England & Wales, Company No: 2548782
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://m5sim.org/cgi-bin/mailman/private/gem5-users/attachments/20150630/c430770b/attachment-0001.html>
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]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users