1 / 19

PTLsim User Manual Notes

PTLsim User Manual Notes. 2008.07.18. 第一部分. PTLsim User Guide. 1.Introduction. 两种版本 Classic version :单线程, userspace linux application PTLsim/X :支持 full system simulation ,多处理器,多线程( SMT 模型),周期精确的虚拟设备时序模型, deterministic time dilation. 4.Code Base. C + C++ 只用到了 C++ 的模板,类,操作符重载

toyah
Download Presentation

PTLsim User Manual Notes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PTLsim User Manual Notes 2008.07.18

  2. 第一部分 PTLsim User Guide

  3. 1.Introduction • 两种版本 • Classic version:单线程,userspace linux application • PTLsim/X:支持full system simulation,多处理器,多线程(SMT模型),周期精确的虚拟设备时序模型,deterministic time dilation

  4. 4.Code Base • C + C++ • 只用到了C++的模板,类,操作符重载 • 使用了一个自己的模板库SuperSTL取代C++的STL • 暂时跳过

  5. 5.X86 Instructions • 暂时跳过 • 讲了一些x86相关的结构

  6. 6.Decoder Architecture and Basic Block Cache • 暂时跳过

  7. 7.PTLsim Support Subsystems • 讲了一些PTLsim支持的特性,如内存管理,Uop应用,垃圾收集等 • 粗略浏览

  8. 8.Statistics Collection and Analysis • 统计信息可以通过设置-stats filename来获得,输出的将是一个二进制的文件,通过PTLstat来将该文件转换为用户可以阅读的格式 • 建议在stats.h中添加自己的counters,这样就能利用PTLsim的统计功能,一些特殊的注释可以用来帮助输出格式化的信息 • 主要讲了一些PTLsim的统计信息的工具,利用这些工具能够方便的输出图形,表格等。PTLstats使用方法。

  9. 9.Benchmarking Techniques • 讲了怎样使用benchmark,PTLsim的方法是在benchmark的源码中添加ptlsim的函数调用以切换模拟态和native态 • 不能用IPC来比较x86和RISC的处理器性能,甚至不能用IPC来比较x86处理器之间的性能,应该采用实际完成的模拟周期数比较性能。 • PTLsim不支持跳过X条指令执行接下来的N条指令,可以结合trigger point和snapshot的方法实现之。 • Sequential core速度比ooo core要快,不计算

  10. 第二部分 PTLsim Classic: Userspace Linux Simulation

  11. 10.Getting Started with PTLsim • 配置文件可以存在/home/username/.ptlsim下 • 选项: • -logfile filename • -loglevel level • -startlog cycle • -startlogrip rip • PTLsim维持一个事件的缓冲环,通过-ringbuf来enable

  12. 11.PTLsim Classic Internals • PTLsim有自己的内部内存管理和线程管理,不使用标准库。将自己inject到其它进程中以控制它们。与Linux内核联系紧密。 • 在main()开始前先调用ptlsim_preinit()建立自己的内存管理和线程环境 • 实现的方法:fork(),然后用子进程exec() • Simulation:main()调用init_config()读入配置 • Ooo core包括扩展的调试和完整性检查的断言。也可用gdb调试。 • 需要将CPU保持在某个固定的频率上(有的CPU会自动降频) • 也可手动发送linux信号使PTLsim切换运行模式

  13. 11.PTLsim Classic Internals • Address Space:SPAT • 64位机器上,共64KB的bitmap(2^19位)可寻址每页4KB共2GB的空间,顶层共有128K个这样的bitmap,加起来寻址48bit的虚拟内存空间。 • 32位机器上,只有一个128KB的bitmap(2^20位),寻址每页4KB共4GB的空间 • 当从native模式切换成simulation模式时,SPAT要通过resync_with_process_maps()函数与系统的内存映射/proc/self/maps保持一致(不同的内核版本,其内存映射文件格式也不同,可能需要修改resync_with_process_maps()函数)。

  14. 第三部分 PTLsim/X: Full System SMP/SMT Simulation

  15. 12.Background • Full system simulator可分为两种: • Hypervisor:在本机上执行大部分unprivileged指令,模拟privileged指令以保持虚拟机之间的隔离,使虚拟机与真实的CPU之间几乎无区别。例如Xen,VM Ware • VM Ware使用x86—x86的二进制转换技术,对于I/O密集型的负载,性能损失严重。 • ESX是VM Ware在Guest OS下执行的Hypervisor,GSX和Workstation则是用户空间的前端程序,包含各种虚拟设备驱动和二进制翻译器 • Virtual PC和Parallels和VM Ware类似 • KVM是linux内核2.6.19之后集成的一个hypervisor,需要VT技术的支持。性能好。

  16. 12.Background • Full system simulator: • Simulator:使用解释器执行周期精确的x86指令,不在native CPU上执行任何guest指令。 • Bochs:开源,接近RTL级描述,支持从16位到x86-64的指令。慢,不支持周期精确的ooo x86模型 • QEMU:使用x86-x86的二进制翻译,属于hypervisor的范畴 • Simics:闭源,商业,同样使用x86-x86的二进制翻译,不支持x86指令以下的周期精确模型 • SimNow:AMD x86-64模拟器

  17. 12.Background • Xen: • OS必须经过修改以支持一种新的芯片组。这种修改主要考虑页表和中断控制器。

  18. 13.Getting Started with PTLsim/X • ptlctl:在模拟结束后必须给出相应的命令继续执行程序,否则程序将停止,这样就会造成无法输入命令的死锁状态。 • 也可以从别的console输入命令 • 可以从一个snapshot开始模拟 • 时间问题:提供了一系列修正时间膨胀问题的参数

  19. 14.PTLsim/X Architecture Details • PTLsim/X三组件:Xen Modification, PTLsim Monitor, PTLsim Core • Xen Modification

More Related