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

2006-07-09 Thread Joachim Henke
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

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

2006-07-09 Thread R. Armiento
R. Armiento wrote: 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? Joachim Henke wrote: Currently the Linux kernel simply uses monitor/mwait as a faster 'hlt'

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

2006-07-09 Thread Paul Brook
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. I'm trying to read up on monitor and mwait. Apparently mwait puts the processor in low-power wait mode, waiting for a memory write in some select area defined by

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

2006-07-09 Thread Jamie Lokier
Joachim Henke wrote: 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. As long as there's only one CPU and 'mwait'

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

2006-07-09 Thread Jamie Lokier
R. Armiento wrote: I'm not sure if I have understood all sources from where such a memory write can come from while the processor is asleep. One source, I suppose, is from other processors in an SMP setup? Another source may be DMA? Does this mean that it is safe to emulate wmait as hlt if

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

2006-07-09 Thread Jamie Lokier
Paul Brook wrote: qemu hardware does support DMA, but I don't think this matters. By my reading DMA writes don't need to wake mwait. The exact wording is store operation, which I'd expect to mean execution of a store instruction (by a different CPU). Hmm. x86 CPUs snoop writes by DMA as well

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

2006-07-08 Thread Joachim Henke
R. Armiento wrote: However, as you probably know, despite not declaring MONITOR in qemu, kqemu sees MONITOR on the host processor and Linux CPU usage will still be 100%, even with your updated patch. So even with your patch applied one should use the 'idle=halt' kernel parameter when

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

2006-07-08 Thread R. Armiento
Hi, Again, thank you for helping out with updated patches, it is much appreciated. Joachim Henke wrote: R. Armiento wrote: So even with your patch applied one should use the 'idle=halt' kernel parameter when booting Linux with -kernel-kqemu on newer processors. [...] To lower the cpu