On 8 January 2015 at 15:06, Marc Zyngier <marc.zyngier@xxxxxxx> wrote: > On 08/01/15 13:16, Peter Maydell wrote: >>> ASID cached VIVT icaches are also VMID tagged. It is thus impossible for >>> stale cache lines to come with a new page. And if by synchronizing the >>> caches you obtain a different instruction stream, it means you've >>> restored the wrong page. >> >> ...is that true even if the dirty data in the dcache comes from >> the userspace process doing DMA or writing the initial boot >> image or whatever? > > We perform this on a page that is being brought in stage-2. Two cases: > > - This is a page is mapped for the first time: the icache should be > invalid for this page (the guest should have invalidated it the first > place), If this is the first instruction in the guest (ie we've just (warm) reset the VM and are running the kernel as loaded into the guest by QEMU/kvmtool) then the guest can't have invalidated the icache, and QEMU can't do the invalidate because it doesn't have the vaddr and VMID of the guest. > - This is a page that we bring back from swap: the page must match the > one that has been swapped out. If it has been DMA'ed in in the meantime, > then the guest surely has flushed its icache if it intends to branch to > it, hasn't it? I agree that for the DMA case the guest will have done the invalidate. -- PMM -- 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