360 likes | 576 Views
We are living in a New Virtualized World. Sorav Bansal IIT Delhi Feb 26, 2011. Old Virtualized World. App. App. App. App. App. App. OS. OS. OS. VMM. IBM Mainframe. IBM Mainframes (circa 1960). New Virtualized World. App. App. App. App. App. App. OS. OS. OS. “Cloud-OS”.
E N D
We are living in aNew Virtualized World SoravBansal IIT Delhi Feb 26, 2011
Old Virtualized World App App App App App • App OS OS OS VMM IBM Mainframe IBM Mainframes (circa 1960)
New Virtualized World App App App App App • App OS OS OS “Cloud-OS”
“Cloud-OS”(stuff that you have heard many times before… uh yawn…) • Infrastructure Layer (slave) + Management layer (master) • Divide hardware into resource pools • Unit of abstraction = VM • Efficient • Effective Isolation • Dynamic • Fault-Tolerant
“Cloud-OS”(more exciting stuff) • Dynamic Performance Optimizations • Compiler Optimizations • OS-level Optimizations • Providing Determinism • Efficient Para-virtual Record/Replay • Improving Reliability • Micro-Replays
“Cloud-OS”(more exciting stuff) • Security • VMM-level security checks • Efficient Thin Clients • Remote Desktopping using VM Record/Replay
Performance Optimizations • Dynamic Binary Translation (Compiler Optimizations) • Translation Blocks • Direct Jump Chaining • Peephole Optimizations • Trace Optimizations • Exception rollbacks • Interrupt delays
Performance Optimizations • Dynamic Binary Translation (OS-level Optimizations) • Eliminate traps from system calls • Better TLB/cache locality by using dedicated OS cores
Traditional Picture Application 1 Application 2 OS Hardware
Virtualized Picture Application 1 Application 2 OS Optimizing VMM
Some Initial Results Lower is Better
Providing Determinism: Record/Replay • Uniprocessor • Non-determinism is quite low. Can be efficiently recorded. • Multiprocessor • Non-determinism high due to shared memory. • Recording overhead scales poorly with multiple processors • Assuming we can patch the guest in some way, can we improve this situation?
Micro-Replays Recording non-determinism Replay Hit a Bug (e.g., assertion failure) Snapshot Choose a rollback point. Also guess bug-inducing non-deterministic choice Execution timeline Potentially bug-free execution
Tolerating Non-deterministic Bugsusing Record/Replay VMM records an execution On assert failure, the VMM interposes and rolls back the execution a few milliseconds VMM guesses the non-deterministic choices that could have caused the failure (e.g., instruction at timer interrupt) VMM replays the execution avoiding the previous non-deterministic choices In this example, VMM infers the critical section after a few runs and avoids interrupting it debit = 0; credit = total; void transfer(void) { for(i = 0; i < 1000; i++) { debit--; credit++; assert(debit + credit == total); } } for (t = 0; t < max_threads; t++) { thread_create(transfer); } shared vars unprotected critical section
Number of Replays Required? Technical Report: Micro-Replays: Improving Reliability in Presence of Non-deterministic Software Bugs http://www.cse.iitd.ac.in/~sbansal/pubs/micro_replays.pdf
Security ExampleA Simple Scheme to Prevent Stack-Overflows … push ra, shadow … call … ra pop ra1pop shadow if (ra != ra1) error … ret
Remote Desktop Using Streaming VM Record/Replay Typical Remote Desktop
Remote Desktop Using Streaming VM Record/Replay Record Replay Remote Desktop using Streaming VM Rec/Rep
Bandwidth Comparison Cumulative Data Transfer as function of time
Steady-state Bandwidth Comparison Rate (MiB/s) Steady State Bandwidth Requirement
Conclusions • We are living in a new virtualized world • Many implications in different application areas
Translation Blocks • Divide code into “translation blocks” • A translation block ends if • Reach a control-flow instruction • Or, MAX_INSNS instructions have been translated
A Simple Scheme x: tx: Original code fragment Translated code fragment Binary Translator
Use a Cache x: tx: Original code fragment Translated code fragment Binary Translator save Lookup using x found Translation Cache not-found
Direct Jump Chaining Ta a lookup(b) lookup(c) b c Tb Tc d lookup(d) lookup(d) Td
Indirect Jumps push b jmp Tf call Ta Tf f a b tmp JTABLE[retaddr & MASK] if (tmp.src == retaddr) goto tmp.dst ret pop retaddr lookup(retaddr) Tb
logarithmic scale printf Overheads
Effect of Maximum Size of Translation Block Overhead Max Size of Translation Block
clock Effect of Translation Cache Size random Overhead Number of 4k pages in Translation Cache
Optimizations • Peephole Optimizations • Trace Optimizations • Cross-layer optimizations
An Example ld M, r1 ld M, r0 ld M, r0 mov r0, r1
Interrupts ld M, r1 ld M, r0 ld M, r0 mov r0, r1 Delay Interrupt delivery till end of current translation
Precise Exceptions ret ld (sp),t0 add $4, sp … jmp t0 Page fault rollback code sub $4, sp restore t0 page fault handler