Skip to contentSkip to conversation

what is the behavier precisely if a tb was interrupted by a interrupt or signal?

Qemu-devel tugouxp 2 participants 3 messages Dec 24, 2018 – Dec 25, 2018

lore
Share & tools
lore

tugouxp

author
#0 lore raw

hi folks:

think about the scenario like that, a tb block contain 9 native instructions execute sequentially

if a interrupt or a signal happens before instruction 6 executed, did the tb be finished before response to the interrupt or

the exited at once to response the interrupt?

tb start:
host instruction 1
host instruction 2
host instruction 4
host instruction 5

host instruction 6 <-------- interrupt or signal here

host instruction 7
host instruction 8
host instruction 9
exit tb

#1 lore raw
Quoted 5 lines · tugouxp

think about the scenario like that, a tb block contain 9 native instructions execute sequentially

if a interrupt or a signal happens before instruction 6 executed, did the tb be finished before response to the interrupt or

the exited at once to response the interrupt?

We don't check in the middle of a TB for conditions like interrupts. The only thing that can cause a TB to stop execution halfway through is if it does something that provokes a synchronous exception (for instance, if it does a guest memory access that triggers a guest CPU page fault, or if it emulates a guest instruction that is required to trap). Those we emulate by longjumping out from the generated code to the top level loop. Asynchronous events like emulated interrupts we only check at the beginning of the TB: we emit code which tests a flag and returns early.

thanks
-- PMM

author
#2 lore raw

thank you.

if so ,the interrupt granularity cant be instructions precisely, but tb precisely, for qemu cant check the interrupt at each instructions execution stage, right?

Quoted 21 lines · Peter Maydell
Quoted 5 lines · tugouxp

think about the scenario like that, a tb block contain 9 native instructions execute sequentially

if a interrupt or a signal happens before instruction 6 executed, did the tb be finished before response to the interrupt or

the exited at once to response the interrupt?

We don't check in the middle of a TB for conditions like interrupts. The only thing that can cause a TB to stop execution halfway through is if it does something that provokes a synchronous exception (for instance, if it does a guest memory access that triggers a guest CPU page fault, or if it emulates a guest instruction that is required to trap). Those we emulate by longjumping out from the generated code to the top level loop. Asynchronous events like emulated interrupts we only check at the beginning of the TB: we emit code which tests a flag and returns early.

thanks
-- PMM