From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: APIC: avoid instruction emulation for EOI writes Date: Mon, 29 Aug 2011 14:11:08 +0300 Message-ID: <4E5B73CC.5080800@redhat.com> References: <625BA99ED14B2D499DC4E29D8138F15063045B0C0C@shsmsx502.ccr.corp.intel.com> <4E5B68DA.1090208@siemens.com> <4E5B70F8.30307@redhat.com> <4E5B7206.5070603@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "Tian, Kevin" , "kvm@vger.kernel.org" , "Nakajima, Jun" , "Dong, Eddie" , Marcelo Tosatti To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:22213 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753114Ab1H2LLP (ORCPT ); Mon, 29 Aug 2011 07:11:15 -0400 In-Reply-To: <4E5B7206.5070603@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/29/2011 02:03 PM, Jan Kiszka wrote: > > > > 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. > There's no way to know when to invalidate the cache. We could go a bit further, and cache the the whole thing. On the first exit, do the entire emulation, and remember %rip. On the second exit, if %rip matches, skip directly to kvm_lapic_eoi(). But I don't think it's worth it. This also has failure modes, and really, no guest will ever write to EOI with stosl. -- error compiling committee.c: too many arguments to function