On Mon, Aug 13, 2012 at 02:12:41PM +0300, Gleb Natapov wrote: > On Mon, Aug 13, 2012 at 02:03:51PM +0300, Avi Kivity wrote: > > On 08/13/2012 02:01 PM, Gleb Natapov wrote: > > >> > > >> Actually this is overkill. Suppose we do an apicid->vcpu translation > > >> cache? Then we retain O(1) behaviour, no need for a huge cache. > > >> > > > Not sure I follow. > > > > Unicast MSIs and IPIs can be speeded up by looking up the vcpu using the > > apic id, using a static lookup table (only changed when the guest > > updates apicid or a vcpu is inserted). > > > To check that MSI/IPI is unicast you need to check a lot of things: delivery > mode, shorthand, dest mode, vector. In short everything but level. This > is exactly what kvm_irq_delivery_to_apic() is doing. Caching apicid->vcpu > is not enough, caching (delivery mode, shorthand, dest mode, > vector)->vcpu is enough and this is exactly what the patch does for irq > routing entries. At least for MSI I think it is simple. Here's the relevant code from my old patch: +static bool kvm_msi_is_multicast(unsigned dest, int dest_mode) +{ + if (dest_mode == 0) + /* Physical mode. */ + return dest == 0xff; + else + /* Logical mode. */ + return dest & (dest - 1); +} > -- > Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html