virtualization - columbia universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is...

34
Virtualization History and Future Trends Christoffer Dall - Candidacy Exam - January 2013 Columbia University - Computer Science Department Saturday, January 19, 13

Upload: others

Post on 20-Apr-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

VirtualizationHistory and Future Trends

Christoffer Dall - Candidacy Exam - January 2013

Columbia University - Computer Science Department

Saturday, January 19, 13

Page 2: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Historical Overview

IBM Mainframe VMs VMwareWorkstation

ParavirtualizationXen

’99‘70s ’03

x86 HardwareSupport

’05 ....

CPU and MemoryOptimizations

’12

I/O andDevice Assignments

VirtualInterrupts

VirtualPower

Saturday, January 19, 13

Page 3: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Taxonomy

[Popek 74]

[Sugerman 01]

[Barham 03]

[Kivity 09]

[Ben-Yehuda 10]

[Colp 11]

[Bugnion 12]

[LeVasseur 04]

[Bugnion 97]

[Stoess 07]

[Nathuji 07]

[Ye 10]

[Tian 10]

[Krishnan 11]

[Hwang 12]

[Andrus 11]

Hardware Support

[Gum 83]

[Uhlig 05]

[Adams 06]

[Bhargava 08]

Virtualization Software Optimizations

[Waldspurger 02]

[Liu 06]

[Willmann 08]

[Russell 08]

[Amit 11]

[Ahmad 11]

[Agesen 12]

[Gordon 12]

Virtualization Software

[Wang 11]

Power

Saturday, January 19, 13

Page 4: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

[Agesen 12]

[Wang 11]

Virtualization

[Popek 74]

[Sugerman 01]

[Barham 03]

[Kivity 09]

[Ben-Yehuda 10]

[Colp 11]

[Bugnion 12]

[LeVasseur 04]

[Bugnion 97]

[Stoess 07]

[Nathuji 07]

[Ye 10]

[Tian 10]

[Krishnan 11]

[Hwang 12]

[Andrus 11]

Hardware Support

[Gum 83]

[Uhlig 05]

[Adams 06]

[Bhargava 08]

Virtualization Software Optimizations

[Waldspurger 02]

[Liu 06]

[Willmann 08]

[Russell 08]

[Amit 11]

[Ahmad 11]

[Gordon 12]

Virtualization Software

[Wang 11]

Power

Saturday, January 19, 13

Page 5: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Virtualization [Popek 74]

• The mechanism through which we facilitate Virtual Machines

• Defined intuitively by Popek and Goldberg [Popek 74] to be:“...an efficient, isolated duplicate of the real machine.”

Saturday, January 19, 13

Page 6: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

VMMs [Popek 74]

• Virtual Machine Monitor (VMM)

• Three properties

1. Efficiency

2. Resource control

3. Equivalence

VMM

Hardware

VM VM

Saturday, January 19, 13

Page 7: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Virtualizable [Popek 74]

• Theorem: “For any conventional third generation computer, a virtual machine monitor may be constructed if the set of sensitive instructions for that computer is a subset of the set of privileged instructions”

• All sensitive instructions trap to the VMM

• Allows for trap-and-emulate

Saturday, January 19, 13

Page 8: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Revitalization in the nineties

• VMware workstation in ’99[Sugerman 01; Bugnion 12]

Kernel

Hardware

VM

vmm driver VMM

User vmx

Saturday, January 19, 13

Page 9: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

New Directions

Kernel

Hardware

VM

KVM

User QEMU

Xen and the art ofVirtualization[Barham 03]

Kernel-Based VM(KVM)

[Kivity 09]

Dom0(QEMU)

Hardware

Dom1

Xen

Dom2

Saturday, January 19, 13

Page 10: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Hardware Support

[Popek 74]

[Sugerman 01]

[Barham 03]

[Kivity 09]

[Ben-Yehuda 10]

[Colp 11]

[Bugnion 12]

[LeVasseur 04]

[Bugnion 97]

[Stoess 07]

[Nathuji 07]

[Ye 10]

[Tian 10]

[Krishnan 11]

[Hwang 12]

[Andrus 11]

Hardware Support

[Gum 83]

[Uhlig 05]

[Adams 06]

[Bhargava 08]

Virtualization Software Optimizations

[Waldspurger 02]

[Liu 06]

[Willmann 08]

[Russell 08]

[Amit 11]

[Ahmad 11]

[Wang 11]

[Gordon 12]

Virtualization Software

[Agesen 12]

Power

Saturday, January 19, 13

Page 11: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Hardware Support Outline

• Intel VT-x and AMD-V

• Hardware vs. Software

• Hardware Memory Virtualization

Saturday, January 19, 13

Page 12: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Intel VT-x

Non-Root traps sensitive instructions

Root Non-Root (VM)

VM ENTRY

VM EXIT

Saturday, January 19, 13

Page 13: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Intel VT-xNested Page Tables (NPT)

Guest Virtual Address

Guest Physical Address

Host Physical Address

MMUNested Page Tables

Page Tables

Saturday, January 19, 13

Page 14: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Hardware Support

Not a new idea [Gum 83]

Saturday, January 19, 13

Page 15: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Hardware vs. Software

• Benefits not clear cut

• Comparison with software [Adams 06] show that especially IO-bound workloads are actually faster.

• example:in/out instruction sequences rewritten to single exit

Saturday, January 19, 13

Page 16: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Hardware vs. Software

• Hardware extensions have matured

• But, exits are still expensive...

• Still uses combination of hardware/software approach in commercial VMware products [Agesen 12].

• Software methods still useful for nested virtualization[Ben-Yehuda 10]

Saturday, January 19, 13

Page 17: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Nested Page TablesnL41

nL23

nL32

nL14

nL46

nL28

nL37

nL19

nL411

nL213

nL312

nL114

nL416

nL218

nL317

nL119

nL421

nL223

nL322

Nested page tablegVA

gL310

gL215

gL120

gL45

SPA

gCR3

gVA[11:0]

gVA[20:12]

gVA[29:21]

gVA[38:30]

gVA[47:39]

nCR3

TLBEntry Value

VA

L3(PDP)

L2(PD)

L1(PT)

L4(PML4)

VA[11:0]

VA[20:12]

VA[29:21]

VA[38:30]

VA[47:39]

512GB

1GB

2MB

4KB

PA

(a) (b)

GPA

nL124

SPA SPA SPA SPA GPA

Guest page table

TLBEntryValue

gL1

gL2

gL3

gL4

gPA

nL4 nL3 nL2 nL1 G

CR3

PA

Figure 1. (a) Standard x86 page walk. (b) Two-dimensional page walk. Italics indicate column and row names; notations such as {nL1,gPA} and {G,gL1}indicate entries in the indicated columns and rows.

address. This portion of the walk repeats for gL2 and gL1. The gL1

entry at step 20 determines the guest physical address of the baseof the guest data page.

At this point, the guest page table has been traversed, but onefinal nested page walk (steps 21-24) is required to translate theguest physical address of the datum to a usable system physicaladdress.

2.4 Large Page Size

While the diagrams in this paper show four levels of long modetranslation, some workloads have accesses which use only a subsetof them. The most important such case is large page support.1 Largepages provide several advantages in both the native and nestedpaging scenarios, including memory savings, a reduction in TLBpressure, and shorter page walks.

With 4KB pages, an OS must use an entire L1 table, whichoccupies 4KB of memory, to map a contiguous 2MB region ofvirtual memory. If the OS can place all 512 4KB pages of that2MB region into one contiguous, aligned 2MB block of physicalmemory, then the OS can substitute a single large page mappingand thus save the 4KB of memory used by the L1 table.

In addition to the memory savings, large pages can reduce TLBpressure. Each large page table entry can be stored in a single TLBentry, while the corresponding regular page entries require 5124KB TLB entries to map the same 2MB range of virtual addresses.Large page use allows the page walk hardware to skip L1 entirelyand use the L2 page entry directly to map a 2MB page, reducingpage walk latency due to the number of page entry references. Alarge page entry encountered at L2 causes an early exit from thestandard walk shown in Figure 1(a) and a bypass from {G,gL2} tostep 21 in Figure 1(b).

In a nested paging environment, large pages can potentiallyprovide the same benefits in both dimensions of the 2D walk.However, most large page benefits are neutralized if a guest usesa large page to map a block of memory that the nested pagetable maps with smaller pages. For correctness, the TLB mustconsider the page size for a given translation to be the smaller

1 While AMD64 now adds support for a 1GB page size, this paper uses large pageinterchangeably with 2MB page.

of the nested and guest page sizes, referred to as splintering [4].This has important performance implications (discussed further inSection 6.5), as a splintered 2MB page in the guest could require asmany as 512 4KB TLB entries.

3. Page Walk CharacterizationThis section discusses the performance cost of page walks andshows that guest and nested page entries exhibit both a high degreeof reuse and a reasonable amount of spatial locality, making themgood candidates for caching.

3.1 Page Walk Cost

Translation requests that miss in the TLB can degrade performance.Thus, understanding the characteristics of how the TLB behaves invirtualization workloads is key to improving paging performance.Table 1 provides some basic information about TLB behavior.The simulation parameters, methodology, and benchmarks used toproduce this data are discussed in detail in Section 5.

Table 1. TLB miss frequency, latency, and performance impactInstruction and Data Translations

Walk Perfect TLBTLB Misses Latency Opportunity

(Per 100K Inst.) 2D/Native Native 2D

MiscServer 294.3 4.01X 14.0% 75.7%

WebServer 129.0 3.90X 4.7% 44.4%

JavaServer 257.0 3.91X 13.5% 89.0%

IntCpu 70.4 4.57X 11.4% 48.6%

FpCpu 18.2 4.43X 5.7% 27.5%

These statistics were gathered on a model with no specialized page caching hardwareother than standard TLBs. Native refers to unvirtualized execution. The geometricmean is used within the benchmark suites.

The TLB Misses column shows the average number of TLBaccesses that result in a page walk per 100,000 retired instructionsin each suite. This value applies to both native and virtualized guestexecution. The Walk Latency column shows the relative slowdownof a 2D page walk with no page walk caching as compared toa native table walk with no page walk caching. The slowdowns

28

Some concerning results [Bhargava 08]

Saturday, January 19, 13

Page 18: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

[Agesen 12]

Hardware Support

[Popek 74]

[Sugerman 01]

[Barham 03]

[Kivity 09]

[Ben-Yehuda 10]

[Colp 11]

[Bugnion 12]

[LeVasseur 04]

[Bugnion 97]

[Stoess 07]

[Nathuji 07]

[Ye 10]

[Tian 10]

[Krishnan 11]

[Hwang 12]

[Andrus 11]

Hardware Support

[Gum 83]

[Uhlig 05]

[Adams 06]

[Bhargava 08]

Virtualization Software Optimizations

[Waldspurger 02]

[Liu 06]

[Willmann 08]

[Russell 08]

[Amit 11]

[Ahmad 11]

[Gordon 12]

Virtualization Software

[Wang 11]

Power

Saturday, January 19, 13

Page 19: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Optimizations

• Memory Consumption

• Paravirtualized drivers

• Direct Device Assignment

• Virtual Interrupts

Saturday, January 19, 13

Page 20: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Direct Device Assignment

• One major bottleneck is I/O

• Still far from bare metal

• Direct Device Assignment is a potential solution

Saturday, January 19, 13

Page 21: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Direct Device Assignment

• Liu et al. [Liu 06] propose to simply assign a device directly to a VM

• Requires device support

• Control messages trap to VMM

• IOMMUs can help[Willmann 08; Amit 11]

Hardware

VMM

VM VM

Device

Driver

Saturday, January 19, 13

Page 22: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

• Interrupts can limit CPU performance and I/O throughput

• Worse in VMs due to VMEXITs

• Especially bad on systems with high IRQ frequency

Virtual Interrupts

Saturday, January 19, 13

Page 23: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Virtual Interrupts

• ELI [Gordon 12]: VMs handle interrupts for certain devices

• ELI uses a shadow Interrupt Descriptor Table (IDT) to let guest handle interrupts directly, while remaining in control of host devices

IRQ Device NP Handler

Host Device 1

Host Device 1

Host Device 1

Guest Device 0 handle_disk_irq()

Host Device 1

Guest Device 0 handle_nic_irq()

Saturday, January 19, 13

Page 24: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Virtual Interrupts

Saturday, January 19, 13

Page 25: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

[Agesen 12]

Hardware Support

Power

[Popek 74]

[Sugerman 01]

[Barham 03]

[Kivity 09]

[Ben-Yehuda 10]

[Colp 11]

[Bugnion 12]

[LeVasseur 04]

[Bugnion 97]

[Stoess 07]

[Nathuji 07]

[Ye 10]

[Tian 10]

[Krishnan 11]

[Hwang 12]

[Andrus 11]

Hardware Support

[Gum 83]

[Uhlig 05]

[Adams 06]

[Bhargava 08]

Virtualization Software Optimizations

[Waldspurger 02]

[Liu 06]

[Willmann 08]

[Russell 08]

[Amit 11]

[Ahmad 11]

[Gordon 12]

Virtualization Software

[Wang 11]

Saturday, January 19, 13

Page 26: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Data Centers

Amazon AWS hosts 46,000 servers8 MW power consumption at $88 million / year

Saturday, January 19, 13

Page 27: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Power Architecture for VMs

• Accounting model [Stoess 07]

• Problem is that VMMs are uninformed about VMs and VMs don’t know their real power consumption (VMEXITs)

• Accounting model suggests passing allocation hints up the stack, and statistics down the stack

2 Distributed Energy Management

The following section presents the design principleswe consider to be essential for distributed energymanagement. We begin with formulating the goalsof our work. We then describe the unified energymodel that serves as a foundation for the rest of ourapproach. We finally describe the overall structureof our distributed energy management framework.

2.1 Design Goals

The increasing number of layers, components, andsubsystems in modern OS structures demands for adistributed approach to control the energy spent inthe system. The approach must perform e!ectivelyacross protection boundaries, and it must comprisedi!erent types of activities, software abstractions,and hardware resources. Furthermore, the approachmust be flexible enough to support diversity in en-ergy management paradigms. The desire to controlpower and energy e!ects of a computer system stemsfrom a variety of objectives: Failure rates typicallyincrease with the temperature of a computer node ordevice; reliability requirements or limited cooling ca-pacities thus directly translate into temperature con-straints, which are to be obeyed for the hardware tooperate correctly. Specific power limits, in turn, aretypically imposed by battery or backup generators,or by contracts with the power supplier. Controllingpower consumption on a per-user base finally enablesaccountable computing, where customers are billedfor the energy consumed by their applications, butalso receive a guaranteed level or quality of service.However, not only the objectives for power manage-ment are diverse; there also exists a variety of al-gorithms to achieve those objectives. Some of themuse real temperature sensors, whereas others rely onestimation models [3, 12]. To reach their goals, thealgorithms employ di!erent mechanisms, like throt-tling resource usage, request batching, or migratingof execution [4, 9, 17]. Hence, a valid solution mustbe flexible and extensible enough to suit a diversityof goals and algorithms.

2.2 Unified Energy Model

To encompass the diverse demands on energy man-agement, we propose to use the notion of energyas the base abstraction in our system, an approachwhich is similar to the currentcy model in [28]. Thekey advantage of using energy is that it quantifiespower consumption in a partitionable way – unlikeother physical e!ects of power consumption such as

the temperature of a device. Such e!ects can easilybe expressed as energy constraints, by means of athermal model [3, 12]. The energy constraints canthen be partitioned from global notions into local,component-wise ones. Energy constraints also serveas a coherent base metric to unify and integrate man-agement schemes for di!erent hardware devices.

2.3 Distributed Management

Current approaches to OS power management aretailored to single building-block OS design, whereone kernel instance manages all software and hard-ware resources. We instead model the OS as a set ofcomponents, each responsible for controlling a hard-ware device, exporting a service library, or providinga software resource for use by applications.

Our design is guided by the familiar concept ofseparating policy and mechanism. We formulate theprocedure of energy management as a simple feed-back loop: the first step is to determine the currentpower consumption and to account it to the origi-nating activities. The next step is to analyze theaccounting data and to make a decision based ona given policy or goal. The final step is to respondwith allocation or de-allocation of energy consumingresources to the activities, with the goal to align theenergy consumption with the desired constraints.

We observe that mainly the second step is asso-ciated with policy, whereas the two other steps aremechanisms, bound to the respective providers ofthe resource, which we hence call resource drivers.We thus model the second step as an energy man-ager module, which may, but need not reside in aseparate software component or protection domain.Multiple such managers may exist concurrently thesystem, at di!erent position in the hierarchy andwith di!erent scopes.

Energy

manager

Resource driver 1

Resource driver 2

Energy consuming

resource 2

energy accounting

Energy consuming

resource 1

Client

Client

Client

energy allocation

Figure 2: Distributed energy management. Energymanagers may reside in di!erent components or pro-tection domains. Resource drivers consume resourcesthemselves, for which the energy is accounted back tothe original clients.

Each energy manager is responsible for a set ofsubordinate resources and their energy consump-

2007 USENIX Annual Technical ConferenceUSENIX Association 3

Saturday, January 19, 13

Page 28: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

VirtualPower [Nathuji 07]

• Main idea: Present virtual ACPI states to VMs

• How does virtual ACPI states map to hardware states?

• Soft Scaling

• Information from ACPI can be aggregated in data centers with heterogenous hardware

Saturday, January 19, 13

Page 29: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

CPU Consolidation

The Effectiveness of CPU Consolidation [Hwang 12]Interesting related observation about exclusive caches in [Krishnan 2011]

Saturday, January 19, 13

Page 30: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Conclusion

IBM Mainframe VMs VMwareWorkstation

ParavirtualizationXen

’99‘70s ’03

x86 HardwareSupport

’05 ....

CPU and MemoryOptimizations

’12

I/O andDevice Assignments

VirtualInterrupts

VirtualPower

? ?

?ARM

Saturday, January 19, 13

Page 31: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

Saturday, January 19, 13

Page 32: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

VM Power Metering

• Model: Upper and lower bounds on CPU and on Memory[Krishnan 11]

• Power consumption depends on how memory bound

• Depends on cache structures, L1 snooping wakes up other cores

Saturday, January 19, 13

Page 33: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

I/O Power Savings

• Prolong sleep periods of mechanical disks [Ye10]

• Early flushes, and buffering writes

• Expose virtual per-device power state agents to VMs [Tian 10]

Saturday, January 19, 13

Page 34: Virtualization - Columbia Universitycdall/candidacy/candidacy_cdall.pdfvirtualization workloads is key to improving paging performance. Table 1 provides some basic information about

vIC [Ahmad 11]

• Virtual Interrupt Coalescing

• Balance coalescing with latency

• Define a ratio R = Virtual IRQs / Hardware IRQs

• The lower R, the more coalescing

• Dynamically determine R based on Commands-In-Flight (CIF) and estimated IOPS

Saturday, January 19, 13