This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] Fast inter-VM signaling using monitor/mwait

On Apr 20, 2009, at 11:19 PM, Ian Pratt wrote:

The mwait instruction is privileged.  So I added a new hypercall that
wraps access to the mwait instruction.  Thus, my code has a Xen
component (the new hypercall) and a guest kernel component (code for
executing the hypercall and for turning off/on the timer interrupts
around the hypercall).  For this code to be merged into Xen, it would
need to add security checks and check whether the processor supports
such a feature.

I seem to recall that some newer CPUs have an mwait instruction accessible from ring3, using a different opcode -- you might want to check this out.

Thanks for the pointer. I'm not aware of these new instructions. A quick Google search didn't turn up anything. Can any of the Intel/AMD folks shed more light?

How do you deal with atomicity of the monitor and mwait? i.e. how do you stop the hypervisor pre-empting the VM and using monitor for its own purposes or letting another guest use it?

The monitor and mwait instructions are _both_ executed in the hypervisor. I should've been clearer: my new "mwait" hypercall executes both the monitor and mwait instructions.

Have you thought about HVM guests as well as PV?

No, I haven't thought about HVM. (I'm about to reply to Kevin TIan's response and hopefully we can figure this out.)


Thanks for the feedback!

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>