Re: KVM architecture docs

Zhao Forrest
2008-03-04T04:12:32Z

>
> http://ols.108.redhat.com/2007/Reprints/kivity-Reprint.pdf
>
Hi Avi,

I have a question about KVM architecture after reading your paper.
It reads:
......
At the kernel level, the kernel causes the hardware
to enter guest mode. If the processor exits guest
mode due to an event such as an external interrupt
or a shadow page table fault, the kernel performs
the necessary handling and resumes guest execution.
If the exit reason is due to an I/O instruction
or a signal queued to the process, then the kernel
exits to userspace.
......
After reading your paper my understanding of KVM architecture is that
for a particular VM the user mode(QEMU), kernel mode and guest mode share
the same process context from host linux kernel's point of view, right?
If this is the case, see the below example:
1 physical NIC interrupt is received on physical CPU 0 and host kernel
determines that this is a network packet targeted to the emulated NIC
for a VM
2 at the same time this VM is running in guest mode on physical CPU 1
My question is: at this time can host kernel *actively* interrupt VM
and make it run in user mode to handle the incoming network data
packet in QEMU? Or host kernel has to wait for
VM(because of external interrupt or shadow page table fault or I/O
instruction) to quit guest mode and wait for VM to voluntarily detect
that incoming network packet is pending and switch to user space?
A further question is, how a VM detect the incoming pending network
packet? In kernel space or in user space?

Thanks,
Forrest