VCPU 的指令执行流程(KVM View)

VCPU execution flow


可以大概推测出Guest IO指令的如下流程:

     Host user   |  Host kernel  | Guest mode   |
                      |               |              |
                      |               |              |
     +->kvm_run(vcpu)-------+         |              | 
     |                |     v         |              |
     |                | +->vm entry----------+       |     
     |                | |             |      v       |
     |                | |             |   Execute    |
     |                | |             |   Natively   |
     |                | |             |      |       |
     |                | |  vm exit<----------+       |  
     |                | |    |        |              |  
     |                | |    |        |              |
     |            Yes | |    v        |              |   
     |     +----------------I/O ?     |              |    
     |     |          | |    | No     |              |
     |     |          | |    |        |              |      
     |     |          | |    v        |              |
     |     v      Yes | |  Signal     |              |
     +--Handle IO<---------Pending?   |              |
                      | |    | No     |              |
                      | +----+        |              |