50
Networks and Opera/ng Systems Chapter 21: Virtual Machine Monitors (252‐0062‐00) Donald Kossmann & Torsten Hoefler Frühjahrssemester 2013 © Systems Group | Department of Computer Science | ETH Zürich

Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

NetworksandOpera/ngSystemsChapter21:VirtualMachineMonitors

(252‐0062‐00)

DonaldKossmann&TorstenHoeflerFrühjahrssemester2013

©SystemsGroup|DepartmentofComputerScience|ETHZürich

Page 2: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Last/me:I/O

•  Networkstackimplementa/on•  NetworkdevicesandnetworkI/O•  MemorymanagementintheI/Osubsystem

•  Performanceissues– Buffering– Mul/plequeuesandreceive‐sidescaling

Page 3: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

This/me:VirtualMachineMonitors

•  Basicdefini/ons•  Whywouldyouwantone?•  Structure•  Howdoesitwork?– CPU– MMU– Memory– Devices– Network

•  Acknowledgement:ThankstoSteveHandforsomeoftheslides!

Page 4: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

WhatisaVirtualMachineMonitor?

•  Virtualizesanen/re(hardware)machine– ContrastwithOSprocesses–  Interfaceprovidedis“illusionofrealhardware”– Applica/onsarethereforecompleteOpera/ngSystemsthemselves

– Terminology:GuestOpera+ngSystems

•  Oldidea:IBMVM/CMS(1960s)– Recentlyrevived:VMware,Xen,Hyper‐V,kvm,etc.

Page 5: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

VMMsandHypervisors

Realhardware

Hypervisor

Guestopera/ngsystem

App

App

Guestopera/ngsystem

App

App

VMM VMM

Somefolksdis/nguishtheVirtualMachineMonitorfromthe

Hypervisor(wewon’t)

Createsillusionofhardware

Page 6: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Whywouldyouwantone?

•  Diagrams:•  Serverconsolida/on(programassumesownmachine)

•  Performanceisola/on

•  Backwardcompa/bility

•  Cloudcompu/ng(unitofsellingcycles)

•  SomethingundertheOS:replay,audi/ng,trustedcompu/ng,rootkits

Page 7: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Runningmul/pleOSesononemachine

•  Applica/oncompa/bility–  IuseUbuntufor

almosteverything,butIeditslidesinPowerPoint

–  SomepeoplecompileBarrelfishinaDebianVMoverWindows7withHyper‐V

•  Backwardcompa/bility–  Nothingbeatsa

Windows98virtualmachineforplayingoldcomputergames

Realhardware

Hypervisor

App

App

App

App

App

App

Page 8: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Serverconsolida/on

•  Manyapplica/onsassumetheyhavethemachinetothemselves

•  Eachmachineismostlyidle

⇒ ConsolidateserversontoasinglephysicalmachineRealhardware

Hypervisor

App

lica/

on

App

lica/

on

App

lica/

on

Page 9: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Resourceisola/on

•  Surprisingly,modernOSesdonothaveanabstrac/onforasingleapplica/on

•  Performanceisola/oncanbecri/calinsomeenterprises

•  UsevirtualmachinesasresourcecontainersRealhardware

Hypervisor

App

lica/

on

App

lica/

on

App

lica/

on

Page 10: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Cloudcompu/ng

•  Sellingcompu/ngcapacityondemand–  E.g.AmazonEC2,

GoGrid,etc.•  Hypervisors

decouplealloca+onofresources(VMs)fromprovisioningofinfrastructure(physicalmachines)

Realhardware

Hypervisor

App

lica/

on

App

lica/

on

Realhardware

Hypervisor

App

lica/

on

App

lica/

on

Realhardware

Hypervisor

App

lica/

on

App

lica/

on

Realhardware

Hypervisor

App

lica/

on

App

lica/

on

Realhardware

Hypervisor

App

lica/

on

App

lica/

on

Realhardware

Hypervisor

App

lica/

on

App

lica/

on

Page 11: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Opera/ngSystemdevelopment

•  Buildingandtes/nganewOSwithoutneedingtorebootrealhardware

•  VMMomengivesyoumoreinforma/onaboutfaultsthanrealhardwareanywayRealhardware

Hypervisor

Compiler

Edito

r

Visual

Stud

io

Page 12: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Othercoolapplica/ons…

•  Tracing•  Debugging•  Execu/onreplay

•  Lock‐stepexecu/on

•  Livemigra/on•  Rollback•  Specula/on•  Etc….Realhardware

Hypervisor

Tracer

App

lica/

on

App

lica/

on

Page 13: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Howdoesitallwork?

•  Note:ahypervisorisbasicallyanOS– Withan“unusualAPI”

•  Manyfunc/onsquitesimilar:– Mul/plexingresources– Scheduling,virtualmemory,devicedrivers

•  Different:– Crea/ngtheillusionofhardwareto“applica/ons”– GuestOSesarelessflexibleinresourcerequirements

Page 14: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

HostedVMMs

Realhardware

Hostopera/ngsystem

App

lica/

on

Guestopera/ngsystem

App

App

VMM

App

lica/

on Examples:

•  VMwareworksta/on•  LinuxKVM•  MicrosomHyper‐V

Page 15: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Hypervisor‐basedVMMs

Realhardware

Hypervisor

Console(Mgmt)opera/ngsystem

Console

Mgm

t.

Guestopera/ngsystem

App

App

VMM VMM

Guestopera/ngsystem

App

App

VMM

Examples:•  VMwareESX•  IBMVM/CMS•  Xen

Page 16: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Howtovirtualize…

•  TheCPU(s)?•  TheMMU?

•  Physicalmemory?

•  Devices(disks,etc.)?•  TheNetwork

and?

Page 17: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

VirtualizingtheCPU

•  ACPUarchitectureisstrictlyvirtualizableifitcanbeperfectlyemulatedoveritself,withallnon‐privilegedinstruc/onsexecutedna/vely

•  Privilegedinstruc/ons⇒trap–  Kernel‐mode(i.e.theVMM)emulatesinstruc/on– Guest’skernelmodeisactuallyusermode

•  Oranother,extraprivilegelevel(suchasring1)

•  Examples:IBMS/390,Alpha,PowerPC

Page 18: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

VirtualizingtheCPU

•  Astrictlyvirtualizableprocessorcanexecuteacompletena/veGuestOS– Guestapplica/onsruninusermodeasbefore– Guestkernelworksexactlyasbefore

•  Problem:x86architectureisnotvirtualizable– About20instruc/onsaresensi/vebutnotprivileged– Mostlysegmentloadsandprocessorflagmanipula/on

Page 19: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Non‐virtualizablex86:example

•  PUSHF/POPFinstruc/ons–  Push/popcondi/oncoderegister–  Includesinterruptenableflag(IF)

•  Unprivilegedinstruc/ons:fineinuserspace!–  IFisignoredbyPOPFinusermode,notinkernelmode

⇒VMMcan’tdetermineifGuestOSwantsinterrruptsdisabled!–  Can’tcauseatrapona(privileged)POPF –  Preventscorrectfunc/oningoftheGuestOS

Page 20: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Solu/ons1.  Emula/on:emulateallkernel‐modecodeinsomware

–  Veryslow–par/cularlyforI/Ointensiveworkloads–  Usedby,e.g.,SomPC

2.  Paravirtualiza8on:modifyGuestOSkernel–  Replacewithexplicittrapinstruc/ontoVMM–  Alsocalleda“HyperCall”(usedforallkindsofthings)–  Usedby,e.g.,Xen

3.  Binaryrewri/ng:–  Protectkernelinstruc/onpages,traptoVMMonfirstIFetch–  ScanpageforPOPFinstruc/onsandreplace–  Restartinstruc/oninGuestOSandcon/nue–  Usedby,e.g.VMware

4.  Hardwaresupport:IntelVT‐x,AMD‐V–  ExtraprocessormodecausesPOPFtotrap

Page 21: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

VirtualizingtheMMU

•  HypervisorallocatesmemorytoVMs– Guestassumescontroloverallphysicalmemory

– VMMcan’tletGuestOStoinstallmappings

•  Defini/onsneeded:– Virtualaddress:avirtualaddressintheguest– Physicaladdress:asseenbytheguest– Machineaddress:realphysicaladdress•  AsseenbytheHypervisor

Page 22: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Virtual/Physical/Machine

GuestVirtualAS

GuestPhysicalAS

MachineMemory

5

5

9

2

6

17Guest1:

Guest2:

Page 23: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

MMUVirtualiza/on

•  Cri/calforperformance,challengingtomakefast,especiallySMP– Hot‐unplugunnecessaryvirtualCPUs– Usemul/castTLBflushparavirtualiza/onsetc

•  Xensupports3MMUvirtualiza/onmodes1. Direct(“Writable”)pagetables2. Shadowpagetables3. HardwareAssistedPaging

•  OSParavirtualiza/oncompulsoryfor#1,op/onal(andverybeneficial)for#2&3

Page 24: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Paravirtualiza/onapproach

•  GuestOScreatespagetablesthehardwareuses–  VMMmustvalidateallupdatestopagetables–  Requiresmodifica/onstoGuestOS– Notquiteenough…

•  VMMmustcheckallwritestoPTEs– Write‐protectallPTEstotheGuestkernel– AddaHyperCalltoupdatePTEs–  Batchupdatestoavoidtrapoverhead– OSisnowawareofmachineaddresses–  Significantoverhead!

Page 25: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Para‐VirtualizingtheMMU

•  GuestOSesallocateandmanageownPTs–  HypercalltochangePTbase

•  VMMmustvalidatePTupdatesbeforeuse–  Allowsincrementalupdates,avoidsrevalida/on

•  Valida/onrulesappliedtoeachPTE:–  1.Guestmayonlymappagesitowns*

–  2.PagetablepagesmayonlybemappedRO

•  VMMtrapsPTEupdatesandemulates,or‘unhooks’PTEpageforbulkupdates

Page 26: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

WriteablePageTables:1–Writefault

MMU

GuestOS

VMM

Hardware

pagefault

firstguestwrite

guestreads

Virtual→Machine

Page 27: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

WriteablePageTables:2–Emulate?

GuestOS

VMM

Hardware

firstguestwrite

guestreads

Virtual→Machine

emulate?

yes

MMU

Page 28: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

WriteablePageTables:3‐Unhook

GuestOS

VMM

Hardware

guestwrites

guestreads

Virtual→MachineX

MMU

Page 29: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

WriteablePageTables:4‐FirstUse

GuestOS

VMM

Hardware

pagefault

guestwrites

guestreads

Virtual→MachineX

MMU

Page 30: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

WriteablePageTables:5–Re‐hook

GuestOS

VMM

Hardware

validate

guestwrites

guestreads

Virtual→Machine

MMU

Page 31: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Writeablepagetablesrequireparavirtualiza/on

GuestVirtualAS

MachineMemory

5

5

9

2

6

17Guest1:

Guest2:

GuestsdirectlyshareMachineMemory

Page 32: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

ShadowPageTables

•  GuestOSsetsupitsownpagetables– Notusedbythehardware!

•  VMMmaintainsshadowpagetables– MapdirectlyfromGuestVAstoMachineAddresses– HardwareswitchedwheneverGuestreloadsPTPR

•  VMMmustkeepV→MtableconsistentwithGuestV→Ptableandit’sownP→Mtable–  VMMwrite‐protectsallguestpagetables– Write⇒trap:applywritetoshadowtableaswell–  Significantoverhead!

Page 33: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

ShadowPageTables

GuestVirtualAS

GuestPhysicalAS

MachineMemory

5

5

9

2

6

17Guest1:

Guest2:

Shadowpagetablemappings

Page 34: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Shadowpagetables

MMU

GuestOS

VMM

Hardware

accessedanddirtybits

guestwrites

guestreads

Virtual→Guest‐Physical

Virtual→Machine

updates

•  Guestchangesop/onal,buthelpwithbatching,knowingwhentounshadow

•  Latestalgorithmsworkremarkablywell

Page 35: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Hardwaresupport

•  “Nestedpagetables”–  Rela/velynewinAMD(NPT)andIntel(EPT)hardware

•  Two‐leveltransla/onofaddressesintheMMU– Hardwareknowsabout:

•  V→Ptables(intheGuest)•  P→Mtables(intheHypervisor)

–  TaggedTLBstoavoidexpensiveflushonaVMentry/exit

•  Veryniceandeasytocodeto– Onereasonkvmissosmall

•  Significantperformanceoverhead…

Page 36: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Memoryalloca/on

•  GuestOSisnotexpec/ngphysicalmemorytochangeinsize!

•  Twoproblems:– HypervisorwantstoovercommitRAM– Howtoreallocate(machine)memorybetweenVMs

•  Phenomenon:DoublePaging– Hypervisorpagesoutmemory– GuestOSdecidestopageoutphysicalframe–  (Unwivngly)faultsitinviatheHypervisor,onlytowriteitoutagain

Page 37: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Ballooning

•  TechniquetoreclaimmemoryfromaGuest•  Installa“balloondriver”inGuestkernel– Canallocateandfreekernelphysicalmemory•  Justlikeanyotherpartofthekernel

– UsesHyperCallstoreturnframestotheHypervisor,andhavethemreturned•  GuestOSisunware,simplyallocatesphysicalmemory

Page 38: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Ballooning:takingRAMawayfromaVM

1.  VMMasksballoondriverformemory

2.  BalloondriverasksGuestOSkernelformoreframes–  “inflatestheballoon”

3.  BalloondriversendsphysicalframenumberstoVMM

4.  VMMtranslatesintomachineaddressandclaimstheframes

Balloon

Guestphysicaladdressspace

Balloondriver

Page 39: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Ballooning:takingRAMawayfromaVM

1.  VMMasksballoondriverformemory

2.  BalloondriverasksGuestOSkernelformoreframes–  “inflatestheballoon”

3.  BalloondriversendsphysicalframenumberstoVMM

4.  VMMtranslatesintomachineaddressesandclaimstheframes

Balloon

Guestphysicaladdressspace

Physicalmemoryclaimedby

balloondriver

Balloondriver

Page 40: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

ReturningRAMtoaVM

1.  VMMconvertsmachineaddressintoaphysicaladdresspreviouslyallocatedbytheballoondriver

2.  VMMhandsPFNtoballoondriver

3.  BalloondriverfreesphysicalframebacktoGuestOSkernel–  “deflatestheballoon”

Balloon

Guestphysicaladdressspace

Balloondriver

Page 41: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

VirtualizingDevices

•  Familiarbynow:trap‐and‐emulate–  I/Ospacetraps– Protectmemoryandtrap– “Devicemodel”:somwaremodelofdeviceinVMM

•  Interrupts→upcallstoGuestOS– Emulateinterruptcontroller(APIC)inGuest– EmulateDMAwithcopyintoGuestPAS

•  Significantperformanceoverhead!

Page 42: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Paravirtualizeddevices

•  “Fake”devicedriverswhichcommunicateefficientlywithVMMviahypercalls– Usedforblockdeviceslikediskcontrollers– Networkinterfaces– “VMwaretools”ismostlyaboutthese

•  Drama/callybeyerperformance!

Page 43: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Networking

•  VirtualnetworkdeviceintheGuestVM•  Hypervisorimplementsa“somswitch”– En/revirtualIP/Ethernetnetworkonamachine

•  Manydifferentaddressingop/ons– SeparateIPaddresses– SeparateMACaddresses

– NAT•  Etc.

Page 44: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Wherearetherealdrivers?

1.  IntheHypervisor–  E.g.VMwareESX–  Problem:needtorewritedevicedrivers(newOS)

2.  IntheconsoleOS–  ExportvirtualdevicestootherVMs

3.  In“driverdomains”– Maphardwaredirectlyintoa“trusted”VM

•  DevicePassthrough–  RunyourfavoriteOSjustforthedevicedriver–  UseIOMMUhardwaretoprotectothermemoryfromdriverVM

4.  Use“self‐virtualizingdevices”

Page 45: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Xen3.xArchitecture

XenVirtualMachineMonitorEventChannel VirtualMMUVirtualCPUControlIF

Hardware(SMP,MMU,physicalmemory,Ethernet,SCSI/IDE)

GuestOS(XenLinux)

DeviceManager&Controls/w

Na/veDeviceDrivers

VM0

GuestOS(XenLinux)

UnmodifiedUser

Somware

VM1

SMPGuestOS(XenLinux)

UnmodifiedUser

Somware

Front‐EndDeviceDrivers

VM2

UnmodifiedGuestOS(WinXP)

UnmodifiedUser

Somware

Front‐EndDeviceDrivers

VM3

SafeHWIF

Virtualswitch

Front‐EndDeviceDrivers

ThankstoSteveHandforsomeofthesediagrams

Page 46: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Rememberthiscard?

Page 47: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

SR‐IOV

•  Single‐RootI/OVirtualiza/on•  Keyidea:dynamicallycreatenew“PCIedevices”–  PhysicalFunc/on(PF):originaldevice,fullfunc/onality

–  VirtualFunc/on(VF):extra“device”,limitedfun/onality

–  VFscreated/destroyedviaPFregisters•  Fornetworking:–  Par//onsanetworkcard’sresources– Withdirectassignmentcanimplementpassthrough

Page 48: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

SR‐IOVinac/on

SR‐IOVNICVirtualethernetbridge/switch,packetclassifier

LAN

Virtualfunc/on

Virtualfunc/on

Virtualfunc/on Physicalfunc/on

PCIe

IOMMU

VMM

VM

VFdriver

VM

VFdriver

VM

VFdriver

VM

VNICdrvr

VM

PFdriver

VSwitch

Page 49: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

Self‐virtualizingdevices

•  Candynamicallycreateupto2048dis/nctPCIdevicesondemand!– HypervisorcancreateavirtualNICforeachVM– Somswitchdriverprograms“master”NICtodemuxpacketstoeachvirtualNIC

– PCIbusisvirtualizedineachVM– EachGuestOSappearstohave“real”NIC,talksdirecttotherealhardware

Page 50: Networks and Operang Systems Chapter 21: Virtual ......• “Nested page tables” – Relavely new in AMD (NPT) and Intel (EPT) hardware • Two‐level translaon of addresses in

NextWeek

Reliablestorage

OSResearch/Future™