qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] add 'monitor' and 'mwait' instruction (update)


From: Joachim Henke
Subject: Re: [Qemu-devel] add 'monitor' and 'mwait' instruction (update)
Date: Sun, 9 Jul 2006 10:54:40 +0200

R. Armiento wrote:
Is this hack really 'safe'? I don't claim to know much about modern x86 instructions, but some googling tells me that mwait is supposed to wake on a monitored memory write (but is allowed to wake up earlier, hence it is acceptable but CPU consuming to emulate it with a nop). Couldn't there be situations where someone depends on mwait waking up without there being an event that wakes hlt? Or are we sure qemu's hlt will happen to wake up anyway?

Currently the Linux kernel simply uses monitor/mwait as a faster 'hlt' replacement, so it should be "safe" there. I don't know about other guest OSs. Anyway, I proposed this hack only as a quick "solution" for local usage.

Again, excuse my lack of knowledge of the internals of qemu and kqemu. If 'hlt' can be emulated to give CPU time back to the host OS until an interrupt occurs in the guest; then it is not obvious why mwait couldn't be simulated in a similar way, only with the addition that qemu also restarts guest CPU execution should there be writes in monitored memory. While I have no idea of how much work it would be, it would much surprise me if this is truly un- doable, at least for non-kqemu emulation.

Problem is, at the moment I've no idea, how we could achieve this memory monitoring in a safe and simple way in user space. But, as you already told, we only need monitor/mwait emulation, when using kernel- kqemu _and_ having the MONITOR flag set in the host cpuid. So I'm sure, Fabrice would be able to do the trick - maybe by using the hosts monitor/mwait instructions.

--
Joachim Henke
http://he-jo.net/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]