On 13 February 2015 at 07:16, Mark Burton <mark.bur...@greensocs.com> wrote: > If the kernel is doing this - then effectively - for X86, each CPU only > flush’s it’s own TLB (from the perspective of Qemu) - correct? > (in which case, for Qemu itself - for x86) - we dont need to implement > a global flush, and hence we dont need to build the mechanism to sync ?
The semantics you need are "flush the QEMU TLB for CPU X" (where X may not be the CPU you're running on). This is what tlb_flush() does: it takes a CPU argument to act on. (Ditto tlb_flush_page, etc.) We then use that to implement the target's required semantics (eg in ARM the tlbiall_is_write() function is handled by iterating through all CPUs and calling tlb_flush on them). If you don't want the pain of checking the semantics of every backend and figuring out a new set of primitives to implement, then what you need to do is continue to provide the guarantees the current tlb_flush function does: when it returns then the CPU it's supposed to have acted on has definitely done so. You can try and be cleverer if you want to, but personally I would recommend keeping the scope of your work simple where you can. -- PMM