Re: [PATCH] KVM: APIC: avoid instruction emulation for EOI writes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2011-08-29 12:59, Avi Kivity wrote:
> On 08/29/2011 01:24 PM, Jan Kiszka wrote:
>>>
>>>   static int handle_apic_access(struct kvm_vcpu *vcpu)
>>>   {
>>>  +	unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
>>>  +	int access_type, offset;
>>>  +
>>>  +	access_type = (exit_qualification>>  12)&  0xf;
>>>  +	offset = exit_qualification&  0xfff;
>>>  +	/*
>>>  +	 * Sane guest uses MOV instead of string operations to
>>>  +	 * write EOI, with written value not cared. So make a
>>>  +	 * short-circuit here by avoiding heavy instruction
>>>  +	 * emulation.
>>>  +	 */
>>
>> Is there no cheap way to validate this assumption and fall back to the
>> slow path in case it doesn't apply? E.g. reading the first instruction
>> byte and matching it against a whitelist? Even if the ignored scenarios
>> are highly unlikely, I think we so far tried hard to provide both fast
>> and accurate results to the guest in all cases.
>>
> 
> Just reading the first byte requires a guest page table walk.  This is 
> probably the highest cost in emulation (which also requires a walk for 
> the data access).

And what about caching the result of the first walk? Usually, a "sane
guest" won't have many code pages that issue the EIO.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
--
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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux