Skip to contentSkip to conversation

QEMU timing requirements

Qemu-devel felix.matenaar@rwth-aachen 2 participants 7 messages Jun 25, 2011 – Jun 26, 2011

lore
Share & tools
lore
#0 lore raw

Hello,

I am currently implementing some heuristics using a patched qemu (i386-softmmu). Two of them take some time for each vm memory access. If I run them both, suddenly qemu segfaults while executing a BBL. Using just one of them never triggers this problem. Are there any known timing issues that could lead to the problem? Running Qemu with one cpu in one single process with a Windows XP guest OS.

Regards,
Felix

#1 lore raw
Quoted 6 lines · On Sat, Jun 25, 2011 at 09:34, felix.matenaar@rwth-aachen…

Hello,

I am currently implementing some heuristics using a patched qemu (i386-softmmu). Two of them take some time for each vm memory access. If I run them both, suddenly qemu segfaults while executing a BBL. Using just one of them never triggers this problem.

"Two" instances of Qemu running at the same time, you mean?

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
#2 lore raw
Quoted 10 lines · Mulyadi Santosa
Quoted 6 lines · On Sat, Jun 25, 2011 at 09:34, felix.matenaar@rwth-aachen…

Hello,

I am currently implementing some heuristics using a patched qemu (i386-softmmu). Two of them take some time for each vm memory access. If I run them both, suddenly qemu segfaults while executing a BBL. Using just one of them never triggers this problem.

"Two" instances of Qemu running at the same time, you mean?

No. What I do is using gen_helper_ to compile hooks into call/ret/jmp and memory access. The Heuristics can then hook the events so calculation is done during the execution of a basic block. I thought that it could be possible that Qemu sets a timeout for BBL execution to prevent CPU monopolization by e.g. a long sequence of rep. That would make sense because my heuristics calculation time falls into the BBL execution time for Qemu. Does anyone know more about that?

Regards,
Felix

#3 lore raw
Quoted 7 lines · On Sat, Jun 25, 2011 at 23:28, felix.matenaar@rwth-aachen…

No. What I do is using gen_helper_ to compile hooks into call/ret/jmp and memory access. The Heuristics can then hook the events so calculation is done during the execution of a basic block. I thought that it could be possible that Qemu sets a timeout for BBL execution to prevent CPU monopolization by e.g. a long sequence of rep. That would make sense because my heuristics calculation time falls into the BBL execution time for Qemu. Does anyone know more about that?

perhaps your heuristics code somehow coincide with the timer alarm (PIT, HPET etc) emulation in Qemu....and somewhere your code is not reentrant.....

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
#4 lore raw
Quoted 9 lines · Mulyadi Santosa
Quoted 7 lines · On Sat, Jun 25, 2011 at 23:28, felix.matenaar@rwth-aachen…

No. What I do is using gen_helper_ to compile hooks into call/ret/jmp and memory access. The Heuristics can then hook the events so calculation is done during the execution of a basic block. I thought that it could be possible that Qemu sets a timeout for BBL execution to prevent CPU monopolization by e.g. a long sequence of rep. That would make sense because my heuristics calculation time falls into the BBL execution time for Qemu. Does anyone know more about that?

Quoted 4 lines

perhaps your heuristics code somehow coincide with the timer alarm (PIT, HPET etc) emulation in Qemu....and somewhere your code is not reentrant.....

Think I found the problem. It was a bug in my code and because of some weird circumstances, backtrace and addresses seemed to be a segfault in a BBL.

#5 lore raw
Quoted 2 lines · On Sun, Jun 26, 2011 at 05:29, felix.matenaar@rwth-aachen…

Think I found the problem. It was a bug in my code and because of some weird circumstances, backtrace and addresses seemed to be a segfault in a BBL.

glad you find it..... care to share to everyone what's really goin' on? who knows it will reveal somekind of hidden problem in Qemu/TCG....

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
#6 lore raw
Quoted 8 lines · Mulyadi Santosa
Quoted 2 lines · On Sun, Jun 26, 2011 at 05:29, felix.matenaar@rwth-aachen…

Think I found the problem. It was a bug in my code and because of some weird circumstances, backtrace and addresses seemed to be a segfault in a BBL.

glad you find it..... care to share to everyone what's really goin' on? who knows it will reveal somekind of hidden problem in Qemu/TCG....

Yes I care. But the bug was not in Qemu. It was an integer underflow caused by a race condition. The behavior of the bug just seemed to be a problem with Qemu timers but it is not. So I thought it doesn't make much sense to share a bug in my code with the list...