cwhsueh@csie ntu edu tw http www csie ntu edu tw cwhsueh 100 fall nov 4 fri 678 dth 104 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
薛智文 cwhsueh@csie.ntu.edu.tw http://www.csie.ntu.edu.tw/~cwhsueh/ 100 Fall , Nov 4, Fri 678, DTH 104 PowerPoint Presentation
Download Presentation
薛智文 cwhsueh@csie.ntu.edu.tw http://www.csie.ntu.edu.tw/~cwhsueh/ 100 Fall , Nov 4, Fri 678, DTH 104

Loading in 2 Seconds...

play fullscreen
1 / 29

薛智文 cwhsueh@csie.ntu.edu.tw http://www.csie.ntu.edu.tw/~cwhsueh/ 100 Fall , Nov 4, Fri 678, DTH 104 - PowerPoint PPT Presentation


  • 436 Views
  • Uploaded on

前瞻 資訊科技 - 虛擬 化 (2) - Virtualization( V12N ) . 薛智文 cwhsueh@csie.ntu.edu.tw http://www.csie.ntu.edu.tw/~cwhsueh/ 100 Fall , Nov 4, Fri 678, DTH 104. Outline. Introduction Xen Architecture Hypercall CPU Virtualization Memory Virtualization I/O Device Virtualization

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about '薛智文 cwhsueh@csie.ntu.edu.tw http://www.csie.ntu.edu.tw/~cwhsueh/ 100 Fall , Nov 4, Fri 678, DTH 104' - candid


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cwhsueh@csie ntu edu tw http www csie ntu edu tw cwhsueh 100 fall nov 4 fri 678 dth 104

前瞻資訊科技

-虛擬化 (2)

-Virtualization(V12N)

薛智文

cwhsueh@csie.ntu.edu.tw

http://www.csie.ntu.edu.tw/~cwhsueh/

100 Fall,Nov 4, Fri 678, DTH 104

outline
Outline
  • Introduction
  • Xen
    • Architecture
    • Hypercall
    • CPU Virtualization
    • Memory Virtualization
    • I/O Device Virtualization
    • Hardware Virtual Machine
    • Benchmark
  • Domain 1
  • Summary

/28

how to virtualize
How to Virtualize ?
  • Binary translation
  • Hypercall

Trap and emulate

Full Virtualization

Para Virtualization

Hardware Assisted Virtualization

Intel VT-x & AMD SVM

/28

virtual machine monitor vmm hypervisor
Virtual Machine Monitor (VMM)Hypervisor

VM : Virtual Machine,

Guest OS + Virtual Devices

VM0

VM1

VMN

Hosted VMM, e.g. VMware

VM0

VM1

VMN

Hypervisor, e.g. Xen

Host Operating System

Hardware

Hardware

Type I - Hypervisor

Type II – Hosted VMM

/28

hypervisor vmm type
Hypervisor (VMM) Type

Type I

  • Type I + Microkernel
    • Xen (open source, Citrix),
    • Microsoft Hyper-V
  • Type I + Integrated kernel
    • VMware ESX,
    • KVM (kernel-base VM)
  • Type II (Host OS + Guest OS)
    • VMware GSX, workstation,
    • Microsoft virtual PC,
    • Microsoft virtual server,
    • Sun Virtual Box

Type II

/28

xen architecture 1 2
Xen Architecture (1/2)

Domain U

Domain U

Domain 0

Domain U

/28

xen architecture 2 2
Xen Architecture (2/2)
  • Compare to common Linux

/28

hyper call
Hyper Call

System Call

  • int 0x80
  • int 0x82

01

02

03

04

05

06

07

// linux/include/asm/unistd.h

#define __NR_restart_syscall 0

#define __NR_exit 1

#define __NR_fork 2

#define __NR_read 3

Guest OS

Hypervisor

HYPERVOSIR_sched_op

int 82h

hypercall

Hypercall_table

do_sched_op

iret

Hyper Call

resume Guest OS

01

02

03

04

05

06

07

// xen/include/public/xen.h

#define __HYPERVISOR_set_trap_table 0

#define __HYPERVISOR_mmu_update 1

#define __HYPERVISOR_set_gdt 2

#define __HYPERVISOR_stack_switch 3

/28

grant table
Grant Table

Domain A

Domain B

Domain A

Domain B

create GR

create GR

send GR

send GR

map page

transfer page

access page

inform

receive page

unmap page

release GR

inform

release GR

  • Page mapping & Page transferring
  • Page as a unit
  • Grant reference (GR)  Grant entry

/28

event channel
Event Channel

IDC

IPI

IPI

vIRQ

pIRQ

  • A lightweight signal mechanism
    • Use “ports” as identifers (pending+mask)
  • Four major purposes

Guest OS

Guest OS

VCPU

VCPU

VCPU

VCPU

Hypervisor

VirtualMemory

Virtual CPU

Scheduling

Hardware

PhysicalCPU

PhysicalMemory

Eth0

Eth1

/28

cpu virtualization
CPU Virtualization
  • Architecture
  • 2 scheduling algorithms (Non-Work Conserving)
    • Simple Earliest Deadline First (SEDF)
    • Credit

App

App

Guest OS

Guest OS

Hypervisor

VCPU

VCPU

VCPU

Scheduling

PCPU

PCPU

PCPU

/28

interrupt

PIC

PIC

Interrupt
  • Physical interrupt
    • For the hypervisor or for guest OSes
  • Virtual interrupt
    • Ask guest OSes to do
    • 8 for now (max is 24)

Guest OS

Guest OS

event

OS

Hypervisor

ISR

Hardware

Hardware

Device

Device

IRQn

IRQn

/28

memory virtualization 1 2
Memory Virtualization (1/2)
  • Two-level memory
  • Three-level memory
    • Virtual, Pseudo-physical, Machine

hypervisor

Application

- Virtual Memory

OS

Guest OS

-Physical Memory

-Pseudo-Physical Memory

P2M

M2P

Hypervisor

-Machine Memory

/28

memory virtualization 2 2
Memory Virtualization (2/2)

168M memory for hypervisor

0xFC000000

0xFC400000

Heap

0xFFFFFFFF

/28

memory virtualization translation
Memory Virtualization - Translation
  • 4 mechanisms to manipulate page tables
    • Paravirtualized page tables
    • Write page tables (Only level 1 is writable)
    • Shadow page tables
    • Hardware-assisted paging

Virtual Memory

Page Table

Shadow Page Table

MMU

Page Fault !

(VM->PFN)

(VM->MFN or VM->P2M)

Pseudo-Physical Memory

Second Level PagingHAP

P2M

Machine Memory

/28

memory virtualization shared info page
Memory Virtualization - Shared Info Page

Structure

Compare with start_info_page

MAX : 32 VCPUs

event channel

TSC

memory

wall clock

/28

i o device virtualization
I/O Device Virtualization
  • Hypervisor also provides three mechanisms to use devices.
    • Emulated Devices
    • ParavirtualizedDriver
    • Pass-through

/28

i o device virtualization emulated devices
I/O Device Virtualization - Emulated Devices
  • Implemented by QEMU
    • e.g. sound card, ac97, sb16, etc

QEMU-DM

/28

i o device virtualization paravirtualized driver
I/O Device Virtualization - Paravirtualized Driver
  • Split Device Driver Model
  • An example of sending packets

Back-End Driver

Front-End Driver

Native Driver

/28

i o device virtualization i o ring
I/O Device Virtualization - I/O Ring
  • Without data, it only transfers request/reply
  • An example with GR

Dom U

Dom 0

GR

GR

GR

Grant Table

I/O Channel

Hypervisor

Active Grant Table

Device

/28

i o device virtualization pass through
I/O Device Virtualization - Pass-Through
  • Pass and directly use the device

Dom U

Dom 0

Dom U

NativeDriver

NativeDriver

Hypervisor

VirtualMemory

Virtual CPU

Scheduling

Hardware

PhysicalCPU

PhysicalMemory

Eth0

Eth1

/28

hardware virtual machine
Hardware Virtual Machine
  • Intel Virtualization Technology

/28

cpu benchmark 1 2
CPU Benchmark (1/2)

8.3%

Average over 100 tests, Deviation: 0.066~0.128%

/28

cpu benchmark 2 2
CPU Benchmark (2/2)

5%

Calculate the 32M digits of ∏.

/28

network benchmark 1 2
Network Benchmark (1/2)

59%

Testing Time: 180 seconds, Deviation: 0.12~0.26%.

/28

network benchmark 2 2
Network Benchmark (2/2)

Average: 9.82%

Sample Period: 2 seconds

/28

answers for big questions
Answers for Big Questions
  • How fast can virtualization achieve?
    • 95+%  99.9%
  • What kinds of applications?
    • Well …
  • What problems it might incur?
    • Technical
      • Data
    • Security
    • Business
    • Politics
    • Globalization (G11N) =
    • Internationalization (I18N) + Localization (L10N)

/28

summary
Summary
  • Stay hungry to be full [of passion].
  • Stay foolish to be smart [on absorption].
  • 假若真時真亦假
  • Virtualized reality.
  • Real virtualization.
  • Virtualized to go anywhere.
  • Key is the system.
  • System is the key.
    • E.g. Virtual Tape Library

/28