On Tue, Jan 21, 2020 at 02:37:59PM +0000, Alex Bennée wrote: > > Nicholas Piggin writes: > > > Alex Bennée's on December 20, 2019 11:11 pm: > >> > >> Nicholas Piggin writes: > >> > >>> This is a bit of proof of concept in case mttcg becomes more important > >>> yield could be handled like this. You can have by accident or deliberately > >>> force vCPUs onto the same physical CPU and cause inversion issues when the > >>> lock holder was preempted by the waiter. This is lightly tested but not > >>> to the point of measuring performance difference. > >> > >> Sorry I'm so late replying. > > > > That's fine if you'll also forgive me :) > > > >> Really this comes down to what EXCP_YIELD semantics are meant to mean. > >> For ARM it's a hint operation because we also have WFE which should halt > >> until there is some sort of change of state. In those cases exiting the > >> main-loop and sitting in wait_for_io should be the correct response. If > >> a vCPU is suspended waiting on the halt condition doesn't it have the > >> same effect? > > > > For powerpc H_CONFER, the vCPU does not want to wait for ever, but just > > give up a some time slice on the physical CPU and allow other vCPUs to > > run. But it's not necessary that one does run (if they are all sleeping, > > the hypervisor must prevent deadlock). How would you wait on such a > > conditon? > > Isn't H_CONFER a hypercall rather than instruction though? In QEMU's TCG > emulation case I would expect it just to exit to the (guest) hypervisor > which then schedules the next (guest) vCPU. It shouldn't be something > QEMU has to deal with. That's true if you're emulating a whole system complete with hypervisor under TCG, which is what the "pnv" machine type does. However, a more common use of qemu is the "pseries" machine type, which emulates only a guest (in the cpu architectural sense) with qemu taking the place of the hypervisor as well as emulating the cpus. In that case the H_CONFER hypercall goes to qemu. > If you are running QEMU as a KVM monitor this is still outside of it's > scope as all the scheduling shenanigans are dealt with inside the > kernel. > > From QEMU's TCG point of view we want to concern ourselves with what the > real hardware would do - which I think in this case is drop to the > hypervisor and let it sort it out. Right, but with the "pseries" machine type qemu *is* the hypervisor. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson