Thanks for your detailed explanation :). That's quite helpful for me
to understand KVM internals.

>
> > 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?
> >
>
> The incoming packet is processed by the host ethernet stack; it is
> forwarded to the bridge, which forwards it to the tap. When the tap
> queues the packet, it sends a signal to qemu (since the tap file
> descriptor has a signal associated). When the kernel delivers the
> signal, it notices the qemu thread is running on cpu 1, so it sends an
> inter-processor interrupt to cpu 1. The interrupt causes the processor
Is the behavior of "When the kernel delivers the signal, it notices the
qemu thread is running on cpu 1, so it sends an IPI to cpu 1" a generic
signal-delivery behavior in Linux kernel? Or KVM need to add some hook
to achieve this?

> to leave guest mode and exit to the hypervisor, which notices that a
> signal is pending, so it exits to qemu which dequeues the packet and
> notifies the guest (if necessary) by injecting an interrupt.
>
> Note that most of this path (including the IPI) is regular Linux code,
> not kvm related, and would happen for any other application in the same way.
>

Thanks,
Forrest

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to