public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Takuya Yoshikawa <takuya.yoshikawa@gmail.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org,
	yoshikawa.takuya@oss.ntt.co.jp, gleb@redhat.com
Subject: Re: [PATCH 2/2] KVM: x86 emulator: Avoid clearing the whole decode_cache
Date: Thu, 26 May 2011 11:19:03 +0300	[thread overview]
Message-ID: <4DDE0CF7.1030301@redhat.com> (raw)
In-Reply-To: <20110525110938.03bdc229.takuya.yoshikawa@gmail.com>

On 05/25/2011 05:09 AM, Takuya Yoshikawa wrote:
> From: Takuya Yoshikawa<yoshikawa.takuya@oss.ntt.co.jp>
>
> During tracing the emulator, we noticed that init_emulate_ctxt()
> sometimes took a bit longer time than we expected.
>
> This patch is for mitigating the problem by some degree.
>
> By looking into the function, we soon notice that it clears the whole
> decode_cache whose size is about 2.5K bytes now.  Furthermore, most of
> the bytes are taken for the two read_cache arrays, which are used only
> by a few instructions.
>
> Considering the fact that we are not assuming the cache arrays have
> been cleared when we store actual data, we do not need to clear the
> arrays: 2K bytes elimination.  In addition, we can avoid clearing the
> fetch_cache and regs arrays.
>
> This patch changes the initialization not to clear the arrays.
>
> On our 64-bit host, init_emulate_ctxt() becomes 0.3 to 0.5us faster with
> this patch applied.
>

Thanks, applied.

It strikes me that initializing the emulator in x86.c is the wrong 
thing.  We should move the entire thing to x86_decode_insn().

We'll need a few more callbacks for that, though (register, eflags); 
eventually we can read just registers that are used and write only 
registers that were updated.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  reply	other threads:[~2011-05-26  8:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25  2:06 [PATCH 1/2] KVM: x86 emulator: Clean up init_emulate_ctxt() Takuya Yoshikawa
2011-05-25  2:09 ` [PATCH 2/2] KVM: x86 emulator: Avoid clearing the whole decode_cache Takuya Yoshikawa
2011-05-26  8:19   ` Avi Kivity [this message]
2011-05-26  8:20     ` Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DDE0CF7.1030301@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=takuya.yoshikawa@gmail.com \
    --cc=yoshikawa.takuya@oss.ntt.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox