Broadcast IPIs in Qemu

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
worldsapart
Member
Member
Posts: 36
Joined: Sat Jan 03, 2009 4:12 am

Broadcast IPIs in Qemu

Post by worldsapart »

Hi,

I was working with smp function in qemu. I am getting the APs to run a user level task. This is to check for synchronization issues. So i basically need all the CPUs to start executing task at the same to get a better simulation of concurrent threads.

So once the CPUs are started up I make them poll a certain flag. And then I thought I'll try out the broadcast IPI (to all but self). So i make the BSP send out an interrupt to all the CPUs. The interrupt handler sets the flag and the CPUs proceed to execute the task. On running this in Qemu I noticed that on each run i get a different results. sometimes all CPUs receive the interrupt, sometimes just a few and sometimes none.

I remember reading that it's not a good idea to try the broadcast IPI, because it is not reliable. I do understand the issues in hardware that could cause it. But why would it happen in an emulator? I was just curious and also a little worried as to whether there is something wrong in what I am doing. Hope someone can shed some light on this. Thanks.

David.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Broadcast IPIs in Qemu

Post by JamesM »

Hi,

I've noticed this behaviour in Qemu also - I can't explain it. Asking qemu developers might be the best idea.

On a related note, I wouldn't rely on all CPUs starting your task at the same time - qemu is singlethreaded and its timeslices come in fairly randomly.

Cheers,

James
worldsapart
Member
Member
Posts: 36
Joined: Sat Jan 03, 2009 4:12 am

Re: Broadcast IPIs in Qemu

Post by worldsapart »

I had a feeling that Qemu was single threaded. Anyways, thanks for the info. Will try to send a bug report to the developers.
Post Reply