On Mon, Mar 15, 2010 at 11:56:32AM +0200, Avi Kivity wrote: > On 03/15/2010 11:44 AM, Gleb Natapov wrote: > >On Mon, Mar 15, 2010 at 09:44:26AM +0200, Avi Kivity wrote: > >>On 03/14/2010 08:06 PM, Gleb Natapov wrote: > >>>>Suggest simply reentering every N executions. > >>>> > >>>This restart mechanism is, in fact, needed for ins read ahead to work. > >>>After reading ahead from IO port we need to avoid entering decoder > >>>until entire cache is consumed otherwise decoder will clear cache and > >>>data will be lost. So we can't just enter guest in arbitrary times, only > >>>when read ahead cache is empty. Since read ahead is never done across > >>>page boundary this is save place to re-enter guest. > >>Please make the two depend on each other directly then. We can't > >>expect the reader of the emulator code know that. > >> > >We can document that. I wouldn't want to have different conditions for > >guest re-entry for different opcodes. > > We now have a write buffer size of one. It's just a matter of > making the emulator know the size of the buffer (extra parameter to > ->write_emulated). > The buffer is maintained inside emulator, so emulator knows about it and can check it, but then for all other string instruction except INS we will re-enter guest on each iteration. > >>Have the emulator ask the buffer when it is empty. > >> > >It will be always empty for all string ops except INS. > > > > Or we can make the buffer larger for everyone (outside this patchset > though). > I am not sure what do you mean here. INS read ahead and MMIO read cache are different beasts. Former is needed to speed-up string pio reads, later (not yet implemented) is needed to reread previous MMIO read results in case instruction emulation is restarted due to need to exit to userspace. MMIO read cache need to be invalidated on each iteration of string instruction. -- 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