On 2013-02-21 09:43, 张智 wrote: > > > >> Date: Thu, 21 Feb 2013 08:39:40 +0100 >> From: jan.kiszka@xxxxxx >> To: zhangzhi2022@xxxxxxxxxxx >> Subject: Re: kvm_external interrupt >> >> On 2013-02-21 06:49, zhang zhi wrote: >>> Hi Dear Jan, >>> >>> I have one question to ask : when I'm using the guest os to do some keyboard >>> input, I feel no time delay as if guest os were on the bare-metal machine. >> >> Your "measurement" can't reveal the existing delay. It's in the order of >> milliseconds, at most. >> > So regardless of ELI and posted interrupts, when user is using keyboard input to interact with guest os, the keyboard event is still intercepted by vmm, which handles the interrupt according to interrupt descriptor table of vmm. After that, vmm finally delivers the corresponding interrupt to guest os using inter-processor interrupt. > Is that so? In general (independent of KVM), if the hypervisor has to share a device between different guests or between itself (in case of KVM, the Linux host is the hypervisor) and a guest, it has to intercept access to and events from that device. The PC keyboard is usually shared (and you can't allow a guest direct access to it as that I/O port can reset the host). So its interrupt is in first handled by the host and then potentially forwarded to a guest. That may happen via posted interrupts in the future or via event injection into the VCPU. If the physical interrupt triggered on a different CPU than the target VCPU is running on (and you don't have posted interrupts), you also need a host-side IPI to kick the VCPU out of guest mode, enabling the injection of the virtual interrupt on re-entry. HTH, Jan
Attachment:
signature.asc
Description: OpenPGP digital signature