SlideShare a Scribd company logo
1 of 85
Download to read offline
Bitvisor



                     Tsuyoshi Ozawa




2009   10   7                         1
• x86
                • x86        IO

                • Intel-VT
                • Intel-VT

2009   10   7                     2
x86



2009   10   7         3
x86
                  (                             )
                      Ring3 = User Mode
                      Ring2
                      Ring1
                                          (0        )
                      Ring0
                Kernel Mode               OS   Ring 0



                                           Ring 3


2009   10   7                                           4
1.

                2.




2009   10   7        5
Ring3           Ring0
                        Ring3
                        Ring2
                        Ring1
                        Ring0
                   Kernel Mode




                    User Mode
2009   10   7                           6
Ring3           Ring0
                        Ring3
                        Ring2           out
                        Ring1
                        Ring0
                   Kernel Mode




                    User Mode
2009   10   7                                 6
Ring3           Ring0
                        Ring3
                        Ring2               out
                        Ring1
                        Ring0
                   Kernel Mode



                                        (         )

                    User Mode
2009   10   7                                         6
Ring3           Ring0
                        Ring3
                        Ring2
                                        out
                        Ring1
                        Ring0
                   Kernel Mode




                    User Mode
2009   10   7                                 7
Ring3           Ring0
                        Ring3
                        Ring2
                                        out
                        Ring1
                        Ring0
                   Kernel Mode




                    User Mode
2009   10   7                                 8
x86   IO




2009   10   7              9
x86 IO

                • Memory Mapped IO
                 •
                • IO Mapped IO
                 • IO

2009   10   7                        10
MMIO



                 Kernel             Memory

                                    Mapped IO

                mov %eax,(%ebx)
                                  Physical memory

2009   10   7                                       11
MMIO

       •

       • Datasheet
                Intel G35 Express Chipset

                   http://support.intel.co.jp/design/chipsets/
                   datashts/317607.htm
2009   10   7                                                    12
MMIO

       •

       • Datasheet
                Intel G35 Express Chipset

                   http://support.intel.co.jp/design/chipsets/
                   datashts/317607.htm
2009   10   7                                                    12
IO mapped IO
                                  Memory
                                  address
                                   space

                 Kernel
                                     IO
                                   address
                                    space
                outw %ax,$0xECDF
                               Physical memory

2009   10   7                                    13
IO mapped IO
        •       0x0000 - 0xFFFF           16
                      IO

        •
                                               0x0000
                                                          IO
        •       IO
                                                        address
                TSS(Task State Segment)                  space
                                               0xFFFF




2009   10   7                                                     14
Intel-VT


2009   10   7              15
Intel-VT


                1.
                2.(      )VM
                         CPU




2009   10   7                    16
OS on Hypervisor




                1.          OS

                2.
                     OS



2009   10   7                                17
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         18
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         18
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         18
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         19
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         19
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         19
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         20
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         20
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         20
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         21
Kernel           Kernel
                      Mode             Mode




                Hypervisor on   Guest OS os     CPU
2009   10   7                                         21
?




2009   10   7       22
Xen       VMWare
                      Ring3
                      Ring2
                      Ring1 = Guest Kerel
                      Ring0
                  HyperVisor

                                            OS




2009   10   7                                    23
Xen             VMWare
                       Ring 1    Ring 2                     Ring 1




                       Kernel                      Kernel
                       Mode                        Mode




                Hypervirsor on            Guest kernel on    CPU

2009   10   7                                                        24
Intel-VT




2009   10   7              25
Intel-VT



                       Kernel                  Kernel
                       Mode                    Mode




                Hypervirsor on        Guest kernel on   CPU

2009   10   7                                                 26
Intel-VT
                                 Guest OS


                       Kernel                  Kernel
                       Mode                    Mode




                Hypervirsor on        Guest kernel on   CPU

2009   10   7                                                 27
Intel-VT
                  CPU                     .




                       Kernel                  Kernel
                       Mode                    Mode




                Hypervirsor on        Guest kernel on   CPU

2009   10   7                                                 28
Intel-VT
   VMX Root Mode


                       Kernel                   Kernel
                       Mode                     Mode




                Hypervirsor on         Guest kernel on   CPU

2009   10   7                                                  29
VMX Root Mode


                                 VMXON
                       Kernel          .
                       Mode
                                 A20
                                 VT


                Hypervirsor on

2009   10   7                              30
VMX Root Mode



                                 VMXOFF
                       Kernel
                       Mode      VT   .
                                 VT



                Hypervirsor on

2009   10   7                             31
Intel-VT
                                 VMX non Root Mode


                       Kernel                   Kernel
                       Mode                     Mode




                Hypervirsor on         Guest kernel on   CPU

2009   10   7                                                  32
Intel-VT
                                 VMX non Root Mode


                       Kernel                   Kernel
                       Mode                     Mode


                                 VMEntry
                Hypervirsor on         Guest kernel on   CPU

2009   10   7                                                  32
VMEntry



                          VMLAUNCH
                          VMRESUME

                    VMX non Root Mode


2009   10   7                           33
VMLAUNCH
                               VMRESUME

                1.
                       •Host State         (   )


                2.VMX non Root

                (    )Host State   Intel




2009   10   7                                      34
Host State              ?

                •
                    •   CR0,CR3,CR4
                    •   DR7
                    •   RSP, RIP
                    •                     (CS,SS,DS,ES,FS,GS)
                    •
                        (FS,GS,TR,IDTR)



2009   10   7                                                   35
Host State
                                         ?

                •         OS       OS




                •   Hypervisor
                          OS




2009   10   7                                36
?

                •   VMCS(Virtual Machine Control Structure)
                •         4KB             0 byte
                                                             revison
                                          4 byte
                •   4KB                                VMX-abort indicator
                                          8 byte




                                                           VMCS Data



2009   10   7                                                                37
VMCS
  0 byte
                VMCS revison identifier   VMCS          .
  4 byte

                 VMX-abort indicator     CPU    VMCS
  8 byte




                     VMCS Data

                                         (
                                                )




2009   10   7                                              38
VMCS
  0 byte
                VMCS revison identifier
  4 byte

                 VMX-abort indicator
  8 byte


                                         abort
                     VMCS Data                   abort




2009   10   7                                            39
VMCS
  0 byte
                VMCS revison identifier
  4 byte

                 VMX-abort indicator
  8 byte




                     VMCS Data




                Host State    VMCS Data
2009   10   7                             40
VMCS

                                     Guest
                                     Visible
                                      Area
                Kernel                         Kernel
                                 Memory
                Mode                           Mode

                                     VMCS


                    Hypervirsor on

2009   10   7                                           41
VMCS

                                     Guest
                                     Visible
                                      Area
                Kernel                         Kernel
                                 Memory
                Mode                           Mode

                                     VMCS


                    Hypervirsor on

2009   10   7                                           41
•
                    •   RAX,RBX,RCX...
                    •        -


                •    CR2
                    • Shadow Paging
                •   etc..




2009   10   7                            42
•
                    •   RAX,RBX,RCX...
                    •        -


                •    CR2
                    • Shadow Paging
                •   etc..

                                      (RIP   )


2009   10   7                                    42
Intel-VT
                                 VMExit

                       Kernel                   Kernel
                       Mode                     Mode




                Hypervirsor on         Guest kernel on   CPU

2009   10   7                                                  43
VMExit


                          VMMCALL
                           +


                         VMX Root Mode


2009   10   7                            44
VMExit


                1.
                       •Guest State         (   )


                2.VMX Root

                (    )Guest State   Intel




2009   10   7                                       45
Guest State                       ?
                1.
                 •   CR0,CR3,CR4
                 •   DR7
                 •   RSP, RIP
                 •                        (CS,SS,DS,ES,FS,GS)


                2. Active State
                 •   32bit Active/HLT/Wait for IPI

                3. Interruptibility state
                 •   32bit Active/HLT/Wait for IPI

                4. VMCS Link pointer
                 •          .VMCS 2

2009   10   7                                                       46
•             .
                RDTSC (   )




                •




2009   10   7                     47
•                .
                RDTSC (   )




                •

                          VMCS
2009   10   7                        47
0 byte
                VMCS revison identifier
  4 byte

                 VMX-abort indicator
  8 byte




                     VMCS Data           .




2009   10   7                                48
VMCS

                VMREAD/VMWRITE
                       mov
                       VMExit   ...




2009   10   7                         49
VMWRITE



                Kernel
                Mode                      Memory
                                          VMCS
                         Hypervirsor on

2009   10   7                                      50
VMREAD



                Kernel
                Mode                      Memory
                                          VMCS
                         Hypervirsor on

2009   10   7                                      51
VMWRITE/VMREAD



                 • vmwrite destreg srcreg
                 • vmread destreg srcreg



2009   10   7                               52
VMWRITE/VMREAD



                         • vmwrite destreg srcreg
                         • vmread destreg srcreg

                srcreg



2009   10   7                                       52
srcreg
                                -encoding-
                   Bit Posiotion(s)            Contents
                        31:15            Reserved (must be 0)
                        14:15                  Bit Width
                         12              Reserved (must be 0)
                        11:10                    Type
                         9:1                     Index
                          0           Access Type(32bit or 64bit?)


                • Appendix H.3
2009   10   7                                                        53
•       IO

                      •
                      •
                      •
                          0        OS

                1   VMEXIT

2009   10   7                           54
IO
                    • IO
                     16bit     bitmap
                                        VMCS

                     • 0x0000 - 0xFFFF
                           0            OS

                1     VMEXIT

2009   10   7                                  55
IO
                                  -encoding-
                     Bit Posiotion(s)            Contents
                          31:15            Reserved (must be 0)
                          14:15                  Bit Width
                           12              Reserved (must be 0)
                          11:10                    Type
                           9:1                     Index
                            0           Access Type(32bit or 64bit?)


                • Appendix H.3
2009   10   7                                                          56
IO
                                  -encoding-
                     Bit Posiotion(s)            Contents
                          31:15            Reserved (must be 0)
                          14:15                  Bit Width
                           12              Reserved (must be 0)
                         11:10
                     64 bit access                 Type
                          =2
                           9:1                     Index
                            0           Access Type(32bit or 64bit?)


                • Appendix H.3
2009   10   7                                                          56
IO
                                  -encoding-
                     Bit Posiotion(s)            Contents
                          31:15            Reserved (must be 0)
                          14:15                  Bit Width
                           12              Reserved (must be 0)
                          11:10                    Type
                           9:1                     Index
                            0           Access Type(32bit or 64bit?)


                • Appendix H.3
2009   10   7                                                          57
IO
                                  -encoding-
                     Bit Posiotion(s)            Contents
                          31:15            Reserved (must be 0)
                          14:15                  Bit Width
                           12              Reserved (must be 0)
                          11:10
                      Control = 0                  Type
                       Index = 0
                           9:1                     Index
                            0           Access Type(32bit or 64bit?)


                • Appendix H.3
2009   10   7                                                          57
IO
                             -encoding-


                     mov $bitmaptr, %rax /* val */
                     mov $0x0002000, %rdx /* index */
                     vmwrite %rax,%rdx




2009   10   7                                           58
IO
                           -encoding-



                     core/asm.s
                     core/constants.h
                     core/vt_init.c



2009   10   7                           59
2009   10   7   60
VMCS

                  VMPTRST
                 Current VMCS

                   Current VMCS   .




2009   10   7                         61
VMPTRST



                Kernel
                Mode                      Memory
                                          VMCS
                VMCS
                         Hypervirsor on

2009   10   7                                      62
Current VMCS


                      VMPTRLD
                      Current VMCS



2009   10   7                        63
VMPTRST



                Kernel
                Mode                      Memory
                                          VMCS
 Current VMCS
                         Hypervirsor on

2009   10   7                                      64
VMCLEAR


                VMCS


2009   10   7                65
VMCLEAR



                Kernel
                Mode                      Memory
                                          VMCS
                         Hypervirsor on

2009   10   7                                      66
Intel
                (       )
                Volume 2B, 3B
2009   10   7                   67
2009   10   7   68

More Related Content

Viewers also liked (7)

Puppet Best Practices? at COOKPAD
Puppet Best Practices? at COOKPADPuppet Best Practices? at COOKPAD
Puppet Best Practices? at COOKPAD
 
2012 OSC Kyoto / 2012 OSC Tokyo Fall - OpenStack vps kvm
2012 OSC Kyoto / 2012 OSC Tokyo Fall - OpenStack vps kvm2012 OSC Kyoto / 2012 OSC Tokyo Fall - OpenStack vps kvm
2012 OSC Kyoto / 2012 OSC Tokyo Fall - OpenStack vps kvm
 
Performance and Scalability of Web Service
Performance and Scalability of Web ServicePerformance and Scalability of Web Service
Performance and Scalability of Web Service
 
Monit
MonitMonit
Monit
 
Shibuya.trac 2009新年会 - とある会社でのTrac利用事例
Shibuya.trac 2009新年会 - とある会社でのTrac利用事例Shibuya.trac 2009新年会 - とある会社でのTrac利用事例
Shibuya.trac 2009新年会 - とある会社でのTrac利用事例
 
20100520 【qpstudy01】 チームでトライ!インフラ構築のススメ
20100520 【qpstudy01】 チームでトライ!インフラ構築のススメ20100520 【qpstudy01】 チームでトライ!インフラ構築のススメ
20100520 【qpstudy01】 チームでトライ!インフラ構築のススメ
 
SSH力をつけよう
SSH力をつけようSSH力をつけよう
SSH力をつけよう
 

Similar to 第二回Bitvisor読書会 前半 Intel-VT について

intel PDF 32nm Technology Update Mark Bohr
intel  PDF  	32nm Technology Update Mark Bohrintel  PDF  	32nm Technology Update Mark Bohr
intel PDF 32nm Technology Update Mark Bohr
finance6
 
Placas base evolucion[1]
Placas base evolucion[1]Placas base evolucion[1]
Placas base evolucion[1]
zuzanitah
 
Dynamo 100107092845-phpapp02
Dynamo 100107092845-phpapp02Dynamo 100107092845-phpapp02
Dynamo 100107092845-phpapp02
Takefumi MIYOSHI
 
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be SlowELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
Benjamin Zores
 
iMinds The Conference: Jan Lemeire
iMinds The Conference: Jan LemeireiMinds The Conference: Jan Lemeire
iMinds The Conference: Jan Lemeire
imec
 
Intel® core™ i5 700 desktop processor
Intel® core™ i5 700 desktop processorIntel® core™ i5 700 desktop processor
Intel® core™ i5 700 desktop processor
Yara Ali
 
0xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp020xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp02
chon2010
 

Similar to 第二回Bitvisor読書会 前半 Intel-VT について (20)

Ibm cell
Ibm cell Ibm cell
Ibm cell
 
intel PDF 32nm Technology Update Mark Bohr
intel  PDF  	32nm Technology Update Mark Bohrintel  PDF  	32nm Technology Update Mark Bohr
intel PDF 32nm Technology Update Mark Bohr
 
Maximizing Application Performance on Cray XT6 and XE6 Supercomputers DOD-MOD...
Maximizing Application Performance on Cray XT6 and XE6 Supercomputers DOD-MOD...Maximizing Application Performance on Cray XT6 and XE6 Supercomputers DOD-MOD...
Maximizing Application Performance on Cray XT6 and XE6 Supercomputers DOD-MOD...
 
Memory Virtualization
Memory VirtualizationMemory Virtualization
Memory Virtualization
 
M7 vig400manual
M7 vig400manualM7 vig400manual
M7 vig400manual
 
Objectclub2009summer Youth Session Takkanm
Objectclub2009summer Youth Session TakkanmObjectclub2009summer Youth Session Takkanm
Objectclub2009summer Youth Session Takkanm
 
HPCMPUG2011 cray tutorial
HPCMPUG2011 cray tutorialHPCMPUG2011 cray tutorial
HPCMPUG2011 cray tutorial
 
Placas base evolucion[1]
Placas base evolucion[1]Placas base evolucion[1]
Placas base evolucion[1]
 
SRAM redundancy insertion
SRAM redundancy insertionSRAM redundancy insertion
SRAM redundancy insertion
 
Dynamo 100107092845-phpapp02
Dynamo 100107092845-phpapp02Dynamo 100107092845-phpapp02
Dynamo 100107092845-phpapp02
 
Fpga technology
Fpga technologyFpga technology
Fpga technology
 
Diy gps logger_20110618
Diy gps logger_20110618Diy gps logger_20110618
Diy gps logger_20110618
 
Mini Robot Fighter
Mini Robot FighterMini Robot Fighter
Mini Robot Fighter
 
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be SlowELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
 
iMinds The Conference: Jan Lemeire
iMinds The Conference: Jan LemeireiMinds The Conference: Jan Lemeire
iMinds The Conference: Jan Lemeire
 
Intel® core™ i5 700 desktop processor
Intel® core™ i5 700 desktop processorIntel® core™ i5 700 desktop processor
Intel® core™ i5 700 desktop processor
 
0xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp020xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp02
 
GlusterFS モジュール超概論
GlusterFS モジュール超概論GlusterFS モジュール超概論
GlusterFS モジュール超概論
 
System-on-Chip Design, Embedded System Design Challenges
System-on-Chip Design, Embedded System Design ChallengesSystem-on-Chip Design, Embedded System Design Challenges
System-on-Chip Design, Embedded System Design Challenges
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and Insights
 

More from Tsuyoshi OZAWA (10)

YARN: a resource manager for analytic platform
YARN: a resource manager for analytic platformYARN: a resource manager for analytic platform
YARN: a resource manager for analytic platform
 
Dynamic Resource Allocation Spark on YARN
Dynamic Resource Allocation Spark on YARNDynamic Resource Allocation Spark on YARN
Dynamic Resource Allocation Spark on YARN
 
Taming YARN @ Hadoop Conference Japan 2014
Taming YARN @ Hadoop Conference Japan 2014Taming YARN @ Hadoop Conference Japan 2014
Taming YARN @ Hadoop Conference Japan 2014
 
Taming YARN @ Hadoop conference Japan 2014
Taming YARN @ Hadoop conference Japan 2014Taming YARN @ Hadoop conference Japan 2014
Taming YARN @ Hadoop conference Japan 2014
 
Spark shark
Spark sharkSpark shark
Spark shark
 
Fluent logger-scala
Fluent logger-scalaFluent logger-scala
Fluent logger-scala
 
Multilevel aggregation for Hadoop/MapReduce
Multilevel aggregation for Hadoop/MapReduceMultilevel aggregation for Hadoop/MapReduce
Multilevel aggregation for Hadoop/MapReduce
 
Memcached as a Service for CloudFoundry
Memcached as a Service for CloudFoundryMemcached as a Service for CloudFoundry
Memcached as a Service for CloudFoundry
 
First step for dynticks in FreeBSD
First step for dynticks in FreeBSDFirst step for dynticks in FreeBSD
First step for dynticks in FreeBSD
 
Linux KVM のコードを追いかけてみよう
Linux KVM のコードを追いかけてみようLinux KVM のコードを追いかけてみよう
Linux KVM のコードを追いかけてみよう
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

第二回Bitvisor読書会 前半 Intel-VT について

  • 1. Bitvisor Tsuyoshi Ozawa 2009 10 7 1
  • 2. • x86 • x86 IO • Intel-VT • Intel-VT 2009 10 7 2
  • 3. x86 2009 10 7 3
  • 4. x86 ( ) Ring3 = User Mode Ring2 Ring1 (0 ) Ring0 Kernel Mode OS Ring 0 Ring 3 2009 10 7 4
  • 5. 1. 2. 2009 10 7 5
  • 6. Ring3 Ring0 Ring3 Ring2 Ring1 Ring0 Kernel Mode User Mode 2009 10 7 6
  • 7. Ring3 Ring0 Ring3 Ring2 out Ring1 Ring0 Kernel Mode User Mode 2009 10 7 6
  • 8. Ring3 Ring0 Ring3 Ring2 out Ring1 Ring0 Kernel Mode ( ) User Mode 2009 10 7 6
  • 9. Ring3 Ring0 Ring3 Ring2 out Ring1 Ring0 Kernel Mode User Mode 2009 10 7 7
  • 10. Ring3 Ring0 Ring3 Ring2 out Ring1 Ring0 Kernel Mode User Mode 2009 10 7 8
  • 11. x86 IO 2009 10 7 9
  • 12. x86 IO • Memory Mapped IO • • IO Mapped IO • IO 2009 10 7 10
  • 13. MMIO Kernel Memory Mapped IO mov %eax,(%ebx) Physical memory 2009 10 7 11
  • 14. MMIO • • Datasheet Intel G35 Express Chipset http://support.intel.co.jp/design/chipsets/ datashts/317607.htm 2009 10 7 12
  • 15. MMIO • • Datasheet Intel G35 Express Chipset http://support.intel.co.jp/design/chipsets/ datashts/317607.htm 2009 10 7 12
  • 16. IO mapped IO Memory address space Kernel IO address space outw %ax,$0xECDF Physical memory 2009 10 7 13
  • 17. IO mapped IO • 0x0000 - 0xFFFF 16 IO • 0x0000 IO • IO address TSS(Task State Segment) space 0xFFFF 2009 10 7 14
  • 18. Intel-VT 2009 10 7 15
  • 19. Intel-VT 1. 2.( )VM CPU 2009 10 7 16
  • 20. OS on Hypervisor 1. OS 2. OS 2009 10 7 17
  • 21. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 18
  • 22. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 18
  • 23. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 18
  • 24. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 19
  • 25. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 19
  • 26. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 19
  • 27. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 20
  • 28. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 20
  • 29. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 20
  • 30. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 21
  • 31. Kernel Kernel Mode Mode Hypervisor on Guest OS os CPU 2009 10 7 21
  • 32. ? 2009 10 7 22
  • 33. Xen VMWare Ring3 Ring2 Ring1 = Guest Kerel Ring0 HyperVisor OS 2009 10 7 23
  • 34. Xen VMWare Ring 1 Ring 2 Ring 1 Kernel Kernel Mode Mode Hypervirsor on Guest kernel on CPU 2009 10 7 24
  • 35. Intel-VT 2009 10 7 25
  • 36. Intel-VT Kernel Kernel Mode Mode Hypervirsor on Guest kernel on CPU 2009 10 7 26
  • 37. Intel-VT Guest OS Kernel Kernel Mode Mode Hypervirsor on Guest kernel on CPU 2009 10 7 27
  • 38. Intel-VT CPU . Kernel Kernel Mode Mode Hypervirsor on Guest kernel on CPU 2009 10 7 28
  • 39. Intel-VT VMX Root Mode Kernel Kernel Mode Mode Hypervirsor on Guest kernel on CPU 2009 10 7 29
  • 40. VMX Root Mode VMXON Kernel . Mode A20 VT Hypervirsor on 2009 10 7 30
  • 41. VMX Root Mode VMXOFF Kernel Mode VT . VT Hypervirsor on 2009 10 7 31
  • 42. Intel-VT VMX non Root Mode Kernel Kernel Mode Mode Hypervirsor on Guest kernel on CPU 2009 10 7 32
  • 43. Intel-VT VMX non Root Mode Kernel Kernel Mode Mode VMEntry Hypervirsor on Guest kernel on CPU 2009 10 7 32
  • 44. VMEntry VMLAUNCH VMRESUME VMX non Root Mode 2009 10 7 33
  • 45. VMLAUNCH VMRESUME 1. •Host State ( ) 2.VMX non Root ( )Host State Intel 2009 10 7 34
  • 46. Host State ? • • CR0,CR3,CR4 • DR7 • RSP, RIP • (CS,SS,DS,ES,FS,GS) • (FS,GS,TR,IDTR) 2009 10 7 35
  • 47. Host State ? • OS OS • Hypervisor OS 2009 10 7 36
  • 48. ? • VMCS(Virtual Machine Control Structure) • 4KB 0 byte revison 4 byte • 4KB VMX-abort indicator 8 byte VMCS Data 2009 10 7 37
  • 49. VMCS 0 byte VMCS revison identifier VMCS . 4 byte VMX-abort indicator CPU VMCS 8 byte VMCS Data ( ) 2009 10 7 38
  • 50. VMCS 0 byte VMCS revison identifier 4 byte VMX-abort indicator 8 byte abort VMCS Data abort 2009 10 7 39
  • 51. VMCS 0 byte VMCS revison identifier 4 byte VMX-abort indicator 8 byte VMCS Data Host State VMCS Data 2009 10 7 40
  • 52. VMCS Guest Visible Area Kernel Kernel Memory Mode Mode VMCS Hypervirsor on 2009 10 7 41
  • 53. VMCS Guest Visible Area Kernel Kernel Memory Mode Mode VMCS Hypervirsor on 2009 10 7 41
  • 54. • RAX,RBX,RCX... • - • CR2 • Shadow Paging • etc.. 2009 10 7 42
  • 55. • RAX,RBX,RCX... • - • CR2 • Shadow Paging • etc.. (RIP ) 2009 10 7 42
  • 56. Intel-VT VMExit Kernel Kernel Mode Mode Hypervirsor on Guest kernel on CPU 2009 10 7 43
  • 57. VMExit VMMCALL + VMX Root Mode 2009 10 7 44
  • 58. VMExit 1. •Guest State ( ) 2.VMX Root ( )Guest State Intel 2009 10 7 45
  • 59. Guest State ? 1. • CR0,CR3,CR4 • DR7 • RSP, RIP • (CS,SS,DS,ES,FS,GS) 2. Active State • 32bit Active/HLT/Wait for IPI 3. Interruptibility state • 32bit Active/HLT/Wait for IPI 4. VMCS Link pointer • .VMCS 2 2009 10 7 46
  • 60. . RDTSC ( ) • 2009 10 7 47
  • 61. . RDTSC ( ) • VMCS 2009 10 7 47
  • 62. 0 byte VMCS revison identifier 4 byte VMX-abort indicator 8 byte VMCS Data . 2009 10 7 48
  • 63. VMCS VMREAD/VMWRITE mov VMExit ... 2009 10 7 49
  • 64. VMWRITE Kernel Mode Memory VMCS Hypervirsor on 2009 10 7 50
  • 65. VMREAD Kernel Mode Memory VMCS Hypervirsor on 2009 10 7 51
  • 66. VMWRITE/VMREAD • vmwrite destreg srcreg • vmread destreg srcreg 2009 10 7 52
  • 67. VMWRITE/VMREAD • vmwrite destreg srcreg • vmread destreg srcreg srcreg 2009 10 7 52
  • 68. srcreg -encoding- Bit Posiotion(s) Contents 31:15 Reserved (must be 0) 14:15 Bit Width 12 Reserved (must be 0) 11:10 Type 9:1 Index 0 Access Type(32bit or 64bit?) • Appendix H.3 2009 10 7 53
  • 69. IO • • • 0 OS 1 VMEXIT 2009 10 7 54
  • 70. IO • IO 16bit bitmap VMCS • 0x0000 - 0xFFFF 0 OS 1 VMEXIT 2009 10 7 55
  • 71. IO -encoding- Bit Posiotion(s) Contents 31:15 Reserved (must be 0) 14:15 Bit Width 12 Reserved (must be 0) 11:10 Type 9:1 Index 0 Access Type(32bit or 64bit?) • Appendix H.3 2009 10 7 56
  • 72. IO -encoding- Bit Posiotion(s) Contents 31:15 Reserved (must be 0) 14:15 Bit Width 12 Reserved (must be 0) 11:10 64 bit access Type =2 9:1 Index 0 Access Type(32bit or 64bit?) • Appendix H.3 2009 10 7 56
  • 73. IO -encoding- Bit Posiotion(s) Contents 31:15 Reserved (must be 0) 14:15 Bit Width 12 Reserved (must be 0) 11:10 Type 9:1 Index 0 Access Type(32bit or 64bit?) • Appendix H.3 2009 10 7 57
  • 74. IO -encoding- Bit Posiotion(s) Contents 31:15 Reserved (must be 0) 14:15 Bit Width 12 Reserved (must be 0) 11:10 Control = 0 Type Index = 0 9:1 Index 0 Access Type(32bit or 64bit?) • Appendix H.3 2009 10 7 57
  • 75. IO -encoding- mov $bitmaptr, %rax /* val */ mov $0x0002000, %rdx /* index */ vmwrite %rax,%rdx 2009 10 7 58
  • 76. IO -encoding- core/asm.s core/constants.h core/vt_init.c 2009 10 7 59
  • 77. 2009 10 7 60
  • 78. VMCS VMPTRST Current VMCS Current VMCS . 2009 10 7 61
  • 79. VMPTRST Kernel Mode Memory VMCS VMCS Hypervirsor on 2009 10 7 62
  • 80. Current VMCS VMPTRLD Current VMCS 2009 10 7 63
  • 81. VMPTRST Kernel Mode Memory VMCS Current VMCS Hypervirsor on 2009 10 7 64
  • 82. VMCLEAR VMCS 2009 10 7 65
  • 83. VMCLEAR Kernel Mode Memory VMCS Hypervirsor on 2009 10 7 66
  • 84. Intel ( ) Volume 2B, 3B 2009 10 7 67
  • 85. 2009 10 7 68