TCG Enhancements on Powerpc
Total Page:16
File Type:pdf, Size:1020Kb
TCG enhancements on PowerPC Nikunj A. Dadhania KVM Forum [email protected] Linux Technology Center, India, IBM 25th August 2016 About me . Guest firmware(SLOF) developer . QEMU user/developer © 2015 IBM Corporation 2/27 Agenda . QEMU TCG – Qui ! look . "ower #S$ %&' Support . "owerNV "latform . "owerPC support *or Multi+threaded TCG . Ot,er Optimizatio.s © 2015 IBM Corporation . Future work 3/27 How is emulation done ? PowerPC POWER ISA Machine Code addi r9,r9,127 Translate x86 Intel ISA Machine Code add $0x7f,%rbp Runs© 2015On IBM Corporation LAPTOP(x86) Credits: Alexander Graf’s QEMU’s Recompilation Engine 4/27 More architectures ! ARM PowerPC X86 Binary Binary Binary X86 Instructions © 2015 IBM Corporation X86 Hardware Credits: Alexander Graf’s QEMU’s Recompilation Engine 5/27 N x N Support: Very complex ARM PowerPC X86 Binary Binary Binary PowerPC X86 ARM Instructions Instructions Instructions © 2015 IBM Corporation PowerPC X86 ARM Hardware Hardware Hardware Credits: Alexander Graf’s QEMU’s Recompilation Engine 6/27 QEMU TCG – Tiny Code Generator ARM PowerPC x86 S390 Target Binary Binary Binary Binary TCG tcg micro ops Machine Independent Intermediate notation © 2015 IBM Corporation ARM PowerPC x86 S390 Host Hardware Hardware Hardware Hardware Credits: Alexander Graf’s QEMU’s Recompilation Engine 7/27 8 / 27 QEMU Avatar – – linux-user Avatar QEMU TCG Laptop(x86) ppc64 program arm program Linux Syscall … ppc program © 2015 IBM Corporation IBM 2015 © . Can 1e used to de1ug user pro0rams Emulates target #S$ "rovides Linux s2stem call emulatio. #nput: Tar0et 1inar2 and libraries POWER ISA 3.0 © 2015 IBM Corporation 9/27 POWER ISA 3.0 . "O4ER ("erforma. e Optimization Wit, E.,a. ed RISC) . $dds 678' new i.stru tions . )arious i.stru tio.s added i. di9ere.t classes Atomic memory operatio.s :ashi.g support operatio.s Stri.g operatio.s ( ,ara ter testi.g, stri.g pro essin0) © 2015 IBM Corporation Arit,metic operatio.s(multiply-add; modulo) <<&&& . http://ibm.bi /po!er-isa# (.eeds re0istratio.) 10/27 Status - POWER ISA 3.0 . 24 instru tions ?ueued in pp +*or-2&8 Modulo, Spe ial ompare )e tor absolute; ompare; shi*t . 24 instru tions posted u.der review Load/Store ve tor/s alar )e tor insert; e3tra t; ou.t© 2015 IBM traili.0 Corporation -eros . 25 instru tions u.der test . https://github.com/nikunjad/qemu/commits/p9-tcg 11/27 Challenges: POWER ISA 3.0 . Testi.g and veri*2i.0 t,e i.stru tions Corre t.ess 5epeata1ilit2 (e0ative test ases . Can use/ kvm-u.it-test © 2015 IBM Corporation QEMU ?test . $.to. Blan ,ardBs i.stru tion fu-zer Compares p,2sical CPU to QEMU emulatio. 12/27 PowerNV Platform © 2015 IBM Corporation 13/27 14 / 27 QEMU Avatar – – Avatar QEMU TCG VM1 - PPC64 Laptop(x86) Guest Firmware VM2 - x86 Emulated Devices Emulated DISK VGA SoftMMU Network Input System Emulation VMn – ARM © 2015 IBM Corporation IBM 2015 © . !er.el; et & et !er.el; firmware; de1ug to be used Can e spa memory ow. its i. isolated Ru.s pseries) ,i.e (+ma ,i.es ma as #.voked 15 / 27 pSeries pSeries TCG VM1 (ppc64le) pSeries MachinepSeries Laptop(x86) Devices: VIO Emulated VM2 (ppc64le) Machine Emulation SLOF MMU RTAS XICS VMn (ppc64) © 2015 IBM Corporation IBM 2015 © . :as bee. supported si. e ae w,ile si. :as bee. supported guest Para-virtuali-ed based :yper-Call Emulation Guest sta.dard s"$"R Based on 16 / 27 PowerNV PowerNV TCG VM1 (ppc64le) PowerNVMachine Laptop(x86) BMC MMU VM2 (ppc64le) Machine Emulation skiboot INTC OCC VMn (ppc64) © 2015 IBM Corporation IBM 2015 © . Support IPMI Support early bri.gup i. $ssists 0uest nested ru. Can mode Hypervisor Supports (BMC) Boardcontroller Model Ma.ageme.t platform Bare MetalPO4ER Emulate Status: PowerNV . #.itiated 12 Be.Cami. Herre.s ,midt . CDdri Le Goater developi.g a.d pus,i.g pat ,es upstream . "owerN) 6@' preparatory pat ,es upstream "O4E58 :ypervisor SPRs Split I.stru tion and Data ca ,es Bat ,i.0 TLB flus,es © 2015 IBM Corporation G#CS rework to support new native model 17/27 PowerPC support for Multi-threaded TCG © 2015 IBM Corporation 18/27 System emulation - runs vCPUs serially . Emulates multi-processor )M: 1ut vCPUn seriall2& ... vC"Us ru. in rou.d robin mode vCPU2 VNC . Ca.’t emulate conc$rrent behavio$r vCPU1 IO © 2015 IBM Corporation CPU 1 CPU 2 CPU 3 CPU 4 …. CPU 8 PowerPC Emulation on X86 Credits: Alex Bennée Towards Multithreaded TCG 19/27 QEMU Multi-threaded TCG . QEMU for multi+ ore system bri.gup . Commu.ity e9ort i. progress . C,alle.ges: Atomi s; Memory Barriers; TLB Flus,; et & VNC vCPU1 vCPU2 vCPU3 vCPU4 IO © 2015 IBM Corporation CPU 1 CPU 2 CPU 3 CPU 4 …. CPU 8 PowerPC Emulation on X86 Credits: Alex Bennée Towards Multithreaded TCG 20/27 Status – PPC support for MTTCG . Based on MTTCG 1ase pat ,es and atomic cmp3 ,0 . Take iot,read locks during ,calls . Load wit, reservation(lwar3 and famil2) . Store onditional(stw 3& and family) wit, atomi cmp3 ,g micro-ops . Booted )M wit, > vC"Us . E1i--y per*orma. e (ebi--2 -S %'' -t 7H) Single-Threaded TCG © 2015 IBM Corporation Multi-Threaded TCG Single Core, 4 Threads Single Core, 4 Threads 1514 records/s 3.5x 5415 records/s real 300.00 s real 300.00 s user 222.74 s user 420.01 s sys 976.80 s sys 778.93 s 21/27 Challenges: PPC support for MTTCG . Still u.stable ,ttps://git,u1& om/niku.Cad/qemu/commits/pseriesImtt 0Iwip . pSeries uses h all for page table update/i.validate& . Memory barriers . Supporti.0 Power() platform © 2015 IBM Corporation 22/27 Misc TCG Improvements . Load/Store improveme.ts – Be.Cami. Herre.s ,midt . E3 eptio. handli.g improveme.ts – Be.Cami. Herre.s ,midt . Load/Store co.solidation – Ni!u.C © 2015 IBM Corporation 23/27 Future . Complete "OWE5 #SA 3&' support . Upstreami.0 Power() i. QEMU . Future - POWE5J Power(V support . Sta1ilize MTTCG o. POWE5 . 7=81it Load/Store support© 2015 in IBM TCG Corporation . Testi.0 mec,anism for i.stru tio.s 24/27 Credits . BenCamin Herrens ,midt . Cédri Le Goater . $lexander Gra* – QEMU’s 5e ompilatio. E.0ine ,ttps://dl.drop1o3userco.te.t.com/u/8JKH8>=/TCG.pd* . $lex Bennée – Towards Multithreaded TCG © 2015 IBM Corporation ,ttp://www.li.u3+!vm.org/images/c/cf/'=3'=+$le3IAe.ee+TowardsIMultit,readedITCG&pd* 25/27 Legal statement . T,is work represe.ts t,e views of t,e aut,or, a.d does .ot .e essaril2 represe.t t,e view of #AM . #AM and #AM (lo0o) are trademar! of #.ter.atio.al Ausiness Ma ,ines i. t,e U.ited States and/or ot,er& . Linu3 is a re0istered trademark of Linus Torvalds . Ot,er ompa.2, produ t, lo0os a.d service .ames ma2 1e trademar!s or service marks of ot,ers © 2015 IBM Corporation . T,is do ume.t is provided “AS #SM; wit, .o e3press or implied warra.ties. Use t,e informatio. in t,is do ume.t at 2our ow. risk . 5esults me.tio.ed i. t,e prese.tatio. is for refere. e purposes o.ly, a.d are .ot to 1e relied o. in a.2 ma..er. 26/27 धꅍयव픾द Thank you © 2015 IBM Corporation 27/27.