Re: [PATCH 2/2] KVM: x86 emulator: Avoid clearing the whole decode_cache

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

 



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