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

On Thu, May 26, 2011 at 11:19:03AM +0300, Avi Kivity wrote:
> 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 initialize it in task switch and interrupt injection code too.

> 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.
> 

--
			Gleb.

      reply	other threads:[~2011-05-26  8:20 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
2011-05-26  8:20     ` Gleb Natapov [this message]

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=20110526082045.GD29458@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.