PhD Slides

4,016 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,016
On SlideShare
0
From Embeds
0
Number of Embeds
1,590
Actions
Shares
0
Downloads
43
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

PhD Slides

  1. 1. Checkpointing for Virtual Platforms and SystemC-TLM-2.0 Màrius Montón Directors: Dr. Mark Burton Dr. Jordi Carrabina December 2010 Univ. Autònoma Barcelona
  2. 2. Outline <ul><li>Introduction
  3. 3. Objectives
  4. 4. Virtual Platforms and SystemC
  5. 5. Checkpointing for SystemC
  6. 6. Conclusions </li></ul>
  7. 7. <ul><li>Introduction
  8. 8. Objectives
  9. 9. Virtual Platforms and SystemC
  10. 10. Checkpointing for SystemC
  11. 11. Conclusions </li></ul>Introduction
  12. 12. Introduction – Virtual Platforms <ul><li>Functional models of physical platforms
  13. 13. Target SW unable to distinguish virtual platform from real HW
  14. 14. Run SW or OS on Virtual HW
  15. 15. Develop SW for non-existing HW
  16. 16. Simulate complex system interconnectivity </li></ul>
  17. 17. Introduction – Virtual Platforms
  18. 18. Introduction – Virtual Platforms
  19. 19. Introduction – Virtual Platforms
  20. 20. Introduction – Virtual Platforms
  21. 21. Virtual Platform Design Hardware Software Integration & Test time Engineering Resources © WindRiver (Virtutech)
  22. 22. Virtual Platform Design Hardware Software Integration & Test time Engineering Resources time Engineering Resources Resources Time to Market Hardware Software Integration & Test © WindRiver (Virtutech)
  23. 23. Generic Virtual Platform Diagram Virtual Platform ISS ISS VP Back-end functions Devices Devices Memories Target Drivers Boot code Target Operating System User User User
  24. 24. Introduction – SystemC & TLM-2 <ul><li>SystemC language for systems description (HW mainly)
  25. 25. OSCI simulator
  26. 26. TLM-2 standarizes communication model </li><ul><li>Sockets to emulate any memory-mapped bus </li></ul><li>De facto standard for system modeling </li></ul>
  27. 27. Introduction – Checkpointing <ul><li>Ability to stop a execution and save it to disk
  28. 28. Retrieve the execution from a disk
  29. 29. Useful for simulations of large systems </li><ul><li>avoid repetitive tasks (boot OS)
  30. 30. bug fixing (modify a simulation value & continue)
  31. 31. reverse execution
  32. 32. multi-site development teams </li></ul></ul>
  33. 33. Introduction – VP Languages <ul><li>Different Virtual Platforms uses different languages (C, C++, DLM, ...) and APIs
  34. 34. HW engineers know (or should) SystemC, not other languages
  35. 35. Different VP -> Rewrite own models
  36. 36. No interoperability </li></ul>
  37. 37. <ul><li>Introduction
  38. 38. Objectives
  39. 39. Virtual Platforms and SystemC
  40. 40. Checkpointing for SystemC
  41. 41. Conclusions </li></ul>Objectives
  42. 42. <ul><li>Introduction
  43. 43. Objectives
  44. 44. Virtual Platforms and SystemC
  45. 45. Checkpointing for SystemC
  46. 46. Conclusions </li></ul>Objectives
  47. 47. Objectives <ul><li>Add SystemC-TLM to any Virtual Platform </li><ul><li>Different strategies to add two simulators
  48. 48. Add SystemC-TLM support to an open-sourced VP </li></ul><li>Add checkpointing support to SystemC </li><ul><li>C++ not checkpointable
  49. 49. Overcome limitations </li></ul></ul>
  50. 50. Generic Virtual Platform Diagram Virtual Platform ISS ISS VP Back-end functions Devices Devices Memories Target Drivers Boot code Target Operating System User User User SystemC SystemC Devices Sync
  51. 51. <ul><li>Introduction
  52. 52. Objectives
  53. 53. Virtual Platforms and SystemC
  54. 54. Checkpointing for SystemC
  55. 55. Conclusions </li></ul>Virtual Platforms and SystemC
  56. 56. <ul><li>Introduction
  57. 57. Objectives
  58. 58. Virtual Platforms and SystemC
  59. 59. Checkpointing for SystemC
  60. 60. Conclusions </li></ul>Virtual Platforms and SystemC
  61. 61. Virtual Platforms and SystemC <ul><li>Link together two simulators
  62. 62. Synchronization strategy
  63. 63. Generic bridge
  64. 64. Support for generic TLM-2 devices </li><ul><li>LT, AT, DMI... </li></ul></ul>
  65. 65. <ul><li>Link together two simulators </li></ul>Virtual Platforms and SystemC Synch VP SystemC Virtual time
  66. 66. Virtual Platforms and SystemC Execution time Synch VP SystemC Virtual execution
  67. 67. QEMU-SC <ul><li>Transition from RTL to TLM
  68. 68. Generic fabric bus (TLM) -> any architecture
  69. 69. QEMU simul. master and SystemC slave </li><ul><li>QEMU manages simulation </li></ul><li>Focus on few SystemC devices </li></ul>
  70. 70. QEMU-SC Linux Driver VP SystemC module SC_Bridge SC_Link TLM Socket Application
  71. 71. Synchronization <ul><li>Only synchronize when needed ( sc_start() ) </li><ul><li>When SystemC devices are accessed
  72. 72. When pending event in current simulation time </li><ul><li>SystemC events list </li></ul><li>When I/O to/from SystemC device </li><ul><li>Capture or notify all I/O in SystemC device </li></ul><li>QuantumKeeper asks to </li><ul><li>To adhere to standard </li></ul></ul></ul>
  73. 73. Communication <ul><li>QEMU works with zero-delay communication </li><ul><li>CPU accesses one device and the device responds immediately </li></ul><li>Fit to LT devices
  74. 74. Need to manage AT devices </li><ul><li>Special synchronization
  75. 75. Finish all protocol phases before return to VP </li></ul></ul>
  76. 76. Communication - LT
  77. 77. Communication - AT
  78. 78. Synchronization <ul><li>Manage external I/O from/to SC device </li><ul><li>Devices use QEMU callbacks for I/O
  79. 79. Bridge knows when a I/O is performed </li><ul><li>Synchronize simulators </li></ul></ul><li>Continue SystemC simulation when </li><ul><li>VP time arrives to first SC event
  80. 80. Every quantum time (TLM-2) </li></ul><li>Advance SystemC time until transaction ends </li></ul>
  81. 81. QBox <ul><li>Change simulation manager </li><ul><li>QEMU becomes simulator slave </li></ul><li>SystemC manages simulation
  82. 82. QEMU is a TLM-2 Initiator module
  83. 83. Easy integration
  84. 84. Focus on many SystemC
  85. 85. models </li></ul>
  86. 86. QBox
  87. 87. QBox internal architecture
  88. 88. QBox complex example QEMU Wrapper NIC TILE TILE TILE QEMU NoC
  89. 89. Test & results <ul><li>Different tests and examples </li><ul><li>Validate implementation
  90. 90. Extract performance metrics </li></ul><li>Results for performance </li><ul><li>relatives to same system in native language </li><ul><li>C in QEMU & Qbox </li></ul></ul></ul>
  91. 91. QEMU-SC Test System TLM Socket QEMU SystemC iDCT acc. SC_Bridge SC_Link DMI Pointer Reg. File IRQ IRQ Linux Driver MPEG accelerator irq_event MPEG-2 decoder
  92. 92. QEMU-SC Results <ul><li>No acc.
  93. 93. No acc. w/ drivers
  94. 94. QEMU style 1 acc.
  95. 95. SystemC 1 acc.
  96. 96. QEMU style 2 acc.
  97. 97. SystemC 2 acc.
  98. 98. SystemC skel. (1 acc.)
  99. 99. SystemC skel. (2 acc.) </li></ul>
  100. 100. QEMU-SC Results <ul><li>No acc.
  101. 101. No acc. w/ drivers
  102. 102. QEMU style 1 acc.
  103. 103. SystemC 1 acc.
  104. 104. QEMU style 2 acc.
  105. 105. SystemC 2 acc.
  106. 106. SystemC skel. (1 acc.)
  107. 107. SystemC skel. (2 acc.) </li></ul>Penalty 8% ~ 14%
  108. 108. Complex QBox system DMI Pointer TLM 2 Socket SignalSocket (IRQ) QEMU Wrapper GreenRouter TLM 2 Socket (Ethernet) Linux QEMU NE2000 NE2000 Testbench
  109. 109. QBox Test System TLM Socket SystemC iDCT acc. Reg. File IRQ SignalSocket (IRQ) QEMU Wrapper GreenRouter Linux Driver irq_event QEMU MPEG-2 decoder
  110. 110. QBox Results <ul><li>No acc.
  111. 111. No acc. w/ drivers
  112. 112. QEMU style 1 acc.
  113. 113. SystemC 1 acc.
  114. 114. QEMU style 2 acc.
  115. 115. SystemC 2 acc.
  116. 116. SystemC skel. (1 acc.)
  117. 117. SystemC skel. (2 acc.) </li></ul>
  118. 118. QBox Results <ul><li>No acc.
  119. 119. No acc. w/ drivers
  120. 120. QEMU style 1 acc.
  121. 121. SystemC 1 acc.
  122. 122. QEMU style 2 acc.
  123. 123. SystemC 2 acc.
  124. 124. SystemC skel. (1 acc.)
  125. 125. SystemC skel. (2 acc.) </li></ul>Penalty ~ 100%!!!
  126. 126. QBox Test System TLM Socket SystemC iDCT acc. Reg. File IRQ SignalSocket (IRQ) QEMU Wrapper GreenRouter Linux Driver irq_event QEMU MPEG-2 decoder Penalty ~ 100%!!!
  127. 127. <ul><li>Introduction
  128. 128. Objectives
  129. 129. Virtual Platforms and SystemC
  130. 130. Checkpointing for SystemC
  131. 131. Conclusions </li></ul><ul>Checkpointing for SystemC </ul>
  132. 132. <ul><li>Introduction
  133. 133. Objectives
  134. 134. Virtual Platforms and SystemC
  135. 135. Checkpointing for SystemC
  136. 136. Conclusions </li></ul><ul>Checkpointing for SystemC </ul>
  137. 137. <ul>Checkpointing for SystemC </ul><ul><li>Add checkpointing capabilities to SystemC language
  138. 138. Two approaches </li><ul><li>Process save and restore
  139. 139. State-variables save and restore </li></ul></ul>
  140. 140. Process save checkpointing Save Restore O.S. HW O.S. HW VP VP
  141. 141. Process save checkpointing Save Restore O.S. HW O.S. HW HW VP VP
  142. 142. Process save checkpointing Save Restore O.S. HW O.S. HW HW VP VP
  143. 143. Process save checkpointing Save Restore O.S. HW O.S. HW HW O.S. VP VP
  144. 144. Process save checkpointing Save Restore O.S. HW O.S. HW HW O.S. VP VP
  145. 145. State save checkpointing Save Restore O.S. HW O.S. HW VP VP chkp_mng chkp_mng
  146. 146. State save checkpointing Save Restore O.S. HW O.S. HW VP VP chkp_mng chkp_mng
  147. 147. State save checkpointing Save Restore O.S. HW O.S. HW HW VP VP chkp_mng chkp_mng
  148. 148. State save checkpointing Save Restore O.S. HW O.S. HW HW O.S. VP VP chkp_mng chkp_mng
  149. 149. Checkpointing for SystemC <ul><li>Inspection to OSCI kernel to get/set: </li><ul><li>Dynamic & static SC_METHOD events list </li><ul><li>Non-destructive access
  150. 150. Text conversion for easy management </li></ul><li>Channels (SC_FIFO<>, SC_MUTEX, etc.) </li><ul><li>state
  151. 151. stored values </li></ul></ul></ul>
  152. 152. Checkpointing for SystemC <ul><li>User code needs to give its internal state
  153. 153. Implicit </li><ul><li>Designer use special types to publish state variables </li><ul><li>gs_param<> from GreenSocs </li></ul></ul><li>Explicit </li><ul><li>Designer use special callbacks to publish state variables </li><ul><li>do_checkpoint()
  154. 154. do_restore() </li></ul></ul></ul>
  155. 155. Checkpoint manager <ul><li>New class to OSCI kernel
  156. 156. Offers simulation checkpoint to external control </li><ul><li>checkpoint()
  157. 157. restore() </li></ul></ul>
  158. 158. chk_mng::checkpoint() <ul><li>Collects data from: </li><ul><li>Module state variables
  159. 159. Channels state and data
  160. 160. Pending events lists (for SC_METHOD) </li><ul><li>Static sensibility
  161. 161. Dynamic sensibility </li></ul></ul><li>Converts al l data to text </li><ul><li>Portable
  162. 162. Editable </li></ul></ul>
  163. 163. chk_mng::restore() <ul><li>Restores all data, converting from text to: </li><ul><li>module state variables
  164. 164. channels state and data
  165. 165. events (for SC_METHOD) </li><ul><li>Static sensibility
  166. 166. Dynamic sensibility </li></ul></ul><li>Simulation state ready to continue </li><ul><li>sc_start() again </li></ul></ul>
  167. 167. Checkpointing for SystemC <ul><li>Restrictions to device modeling style </li><ul><li>SC_METHOD only
  168. 168. SC_THREAD left to designer </li></ul><li>Guidelines </li><ul><li>To model FSM using SC_METHOD
  169. 169. Avoid usage of SC_THREAD (in literature) </li></ul><li>Enough for VP modeling </li></ul>
  170. 170. Checkpointing for SystemC VP Device Reg. File <ul><li>Member Variables </li><ul><li>gs_param<>
  171. 171. Callbacks functions </li></ul></ul>
  172. 172. Checkpointing for SystemC VP Device Reg. File <ul><li>Member Variables </li><ul><li>gs_param<>
  173. 173. Callbacks functions </li></ul></ul>
  174. 174. Checkpointing for SystemC VP Device Reg. File <ul><li>FSM </li><ul><li>SC_THREAD to SC_METHOD </li></ul></ul><ul><li>Member Variables </li></ul>S3 S1 S2
  175. 175. Checkpointing for SystemC VP Device Reg. File <ul><li>FSM </li><ul><li>SC_THREAD to SC_METHOD </li></ul></ul><ul><li>Member Variables </li></ul>S3 S1 S2
  176. 176. Checkpointing for SystemC VP Device Reg. File IRQ <ul><li>FSM </li></ul><ul><li>Member Variables </li></ul><ul><li>Events </li><ul><li>from OSCI events lists </li></ul></ul>IRQ generator S3 S1 S2
  177. 177. Checkpointing for SystemC VP Device Reg. File IRQ <ul><li>FSM </li></ul><ul><li>Member Variables </li></ul><ul><li>Events </li></ul><ul><li>I/O </li><ul><li>Save Channels </li></ul></ul>IRQ generator I/O manag S3 S1 S2
  178. 178. Simulation time <ul><li>No performance penalty on OSCI kernel </li><ul><li>New functions only used when doing checkpointing </li></ul><li>Main performance loss is due to overhead in gs_param<> </li><ul><li>Mosts cases less than 1%
  179. 179. Other cases about a 50% </li></ul></ul>
  180. 180. Checkpoint data size <ul><li>Checkpoint data depends on </li><ul><li>state variable
  181. 181. pending events
  182. 182. channels data </li></ul><li>Usually order of ~kB vs ~GB other solutions </li><ul><li>Easily portable
  183. 183. Fast saving to disk time
  184. 184. Reverse execution </li></ul></ul>
  185. 185. Checkpoint data # OSCI data 55000 60000;Initiator.initiator_func; # FIFO “my_fifo” Target.my_fifo=14;Target.my_fifo=0; Target.my_fifo=0.5;Target.my_fifo=1; ... Target.my_fifo=6.5; # gs_params Initiator.initiator_func_fsm_param 0 Initiator.int_param 6 Target.data_gs_param {&quot;0&quot; &quot;0.5&quot; &quot;1&quot; &quot;1.5&quot; &quot;2&quot; &quot;2.5&quot; &quot;0&quot; &quot;0&quot; &quot;0&quot; &quot;0&quot;} Target.data_gs_paramB.0 0 Target.data_gs_paramB.1 0.5 Target.data_gs_paramB.2 1 Target.data_gs_paramB.3 1.5 Target.data_gs_paramB.4 2 ... Target.data_gs_paramB.9 0 OSCI kernel data Channels data User modules data
  186. 186. <ul><li>Introduction
  187. 187. Objectives
  188. 188. Virtual Platforms and SystemC
  189. 189. Checkpointing for SystemC
  190. 190. Conclusions </li></ul>Conclusions
  191. 191. <ul><li>Introduction
  192. 192. Objectives
  193. 193. Virtual Platforms and SystemC
  194. 194. Checkpointing for SystemC
  195. 195. Conclusions </li></ul>Conclusions
  196. 196. <ul><li>Joined SystemC to two Virtual Platforms
  197. 197. Tested two different strategies for joining two simulators </li><ul><li>QEMU-SC
  198. 198. QBox </li></ul><li>Minor performance impact SystemC bridge
  199. 199. Published as open-sourced projects www.greensocs.com </li></ul>Conclusions – SystemC
  200. 200. Conclusions – SystemC Simulation Manager Penalty System for QEMU-SC Yes 10% SW QBox No 25~30% HW
  201. 201. Conclusions – Simics Virtutech <ul><li>Add SystemC capabilities to a commercial VP
  202. 202. Close source -> new device manages SystemC
  203. 203. Same strategy than QEMU-SC </li></ul>
  204. 204. Conclusions – Simics Results <ul><li>SystemC QT = 1 sec.
  205. 205. SystemC QT = 1 ms.
  206. 206. SystemC QT = 1 μ s.
  207. 207. Simics DML </li></ul>Microbenchmark
  208. 208. Conclusions – Simics Results <ul><li>SystemC QT = 1 sec.
  209. 209. SystemC QT = 1 ms.
  210. 210. SystemC QT = 1 μ s.
  211. 211. Simics DML </li></ul>Microbenchmark Penalty ~ 5%
  212. 212. Conclusions – Industry <ul><li>R&D from university to industry
  213. 213. Industry project involves PhD </li><ul><li>Commercial tool: Simics </li></ul><li>Other vendors using our work </li><ul><li>Synopsys Innovator and QBox </li></ul></ul>
  214. 214. Conclusions – Checkpointing <ul><li>Added checkpointing to SystemC
  215. 215. Saving only necessary data, not the entire process
  216. 216. Focused on VP modeling
  217. 217. With limitations but enough for VP devices
  218. 218. No simulation speed penalty due to Checkpointing </li><ul><li>Use of callbacks
  219. 219. Inspect OSCI kernel when checkpointing </li></ul></ul>
  220. 220. Future Work (light) <ul><li>Automagic configuration of QBox systems </li><ul><li>Manage map-address in QEMU, Router, BIOS, etc. </li></ul><li>Enhance QEMU time management </li><ul><li>Hard to measure virtual time in QEMU </li></ul><li>Add multiple instances from QEMU </li><ul><li>Current QBox library allows one </li></ul><li>Explore QEMU user mode </li><ul><li>Simplified version, only ISS, run applications </li></ul></ul>
  221. 221. Future Work (medium) <ul><li>Merge SystemC methods into QEMU kernel </li><ul><li>Remove OSCI simulator and write an API SystemC <-> QEMU </li></ul><li>Merge QEMU functionality into OSCI kernel </li><ul><li>Make QEMU a truly SystemC ISS </li></ul><li>Both merges increase simulation speed due to removed synchronization </li></ul>
  222. 222. Future Work (hard) <ul><li>Develop an automatic tool for SC_THREAD to SC_METHOD translation
  223. 223. Build a SystemC Virtual Machine </li><ul><li>allows native checkpointing
  224. 224. performance issues </li></ul></ul>
  225. 225. Thank you! Questions?
  226. 226. BACKUP SLIDES
  227. 227. Conclusions – Simics Virtutech
  228. 228. QEMU ecosystem

×