Skip to contentSkip to conversation

QEMU -- SMP and TIME

Qemu-devel françois Guerret 1 participant 1 message Jul 23, 2015 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi,
Further to my mail exchange with Victor I would like to ask you some help about time simulaion in Qemu when using SMP.
Context:-----------I use Qemu on Windows, I am booting bare metal programs and I am trying to test embedded code, so I need more or lessrepeatable executions (and I do not need the time simulated in Qemu to be synchronised with the "realtime" (watch time)).As a consequence I use the "-icount" option. What I need:---------------- * Time synchronisation between emulated cores, at least with a given time granularity. * For example, I would nice if Qemu could ensure that **all** the cores will execute code between two timer events
The two kind of solutions I imagine (if no one exists yet):-------------------------------------------------------------------------* The simplest (if possible): if Qemu is able to affect the scheduling of threads modelling the cores, it would be nice if the user could ask Qemu to ensure that every thread simulating a core will be executed at least every a given period of time.* If the above solution is not feasable, it will be probably necessary to add one *icount* (instruction counter) per core in order to avoid a core to discover than time has been running far further its next timer events while it was preempted by the host OS (because an other core has executed instructions and incremented *icount*). The problem would be then to synchronise this "instructions count" (representing time). This could be done adding synchronisation barriers between all the cores at each timer event. This would probably slow down Qemu but, once again, when coding for embedded boards, it is much preferable to have a consistent simulated time rather real time.
Thank you very much in advance for your help.
Best regards
Francois
PS: Could you please answer me on this mail address, I am just not able to deal with the hundreds of mails per day sent to the devel list ;)

Quoted 35 lines

Date: Thu, 23 Jul 2015 11:49:58 +0200
From: [email protected]
To: [email protected]
Subject: Re: QEMU smp and time

Hi,

I cannot help you deal with it as I do not know this part of Qemu (SMP).

I think you should ask your question to the mailing list, maybe with a little more precision as I am not sure if I really get your goal. I understand that you want to bind each virtual core with a host thread then ask the host to schedule it in order to get the same amount of execution time on each vcpu, is that right ?
I'm not sure that qemu can modify its host OS scheduling.

Regards,

Victor

Quoted 14 lines · françois Guerret

Hi,
I am trying to maintain more or less the same simulated time (in timer tick) on each core of the a9mpcore target (i am booting in bare metal). Because of windows threads scheduling, i just cannot manage to do it, even using software active waiting barriers.
Would you know a way to ask QEMU to ask the host OS to schedule the thread with a given period -- or even just to asleep a given thread (core) and execute an other one ?
I imagine that either as a kind of hypervisor call which could be catch by QEMU in c code or as an option which could enable to design the scheduling of thread ...
I hope I am clear enough
Thank you in advance
François