qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Why we need unlink tb when cpu_interrupt/cpu_exit get called?
@ 2012-04-02  3:45 陳韋任
  2012-04-02  9:15 ` malc
  0 siblings, 1 reply; 4+ messages in thread
From: 陳韋任 @ 2012-04-02  3:45 UTC (permalink / raw)
  To: qemu-devel

Hi all,

  I am wondering why we need to unlink tb when cpu_interrupt/cpu_exit is
called, and want to know what happened if we don't unlink tb. In theory,
QEMU want the execution flow comes back from code cache to QEMU itself
so that interrupts can be handled as soon as possible. However, I ran
linux-0.2.img with a modified QEMU whose cpu_unlink_tb does nothing.
Everything seems work fine. Is this experiment too trivial to show what
bad things happened when we don't unlink tb?

  Thanks! :)

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Why we need unlink tb when cpu_interrupt/cpu_exit get called?
  2012-04-02  3:45 [Qemu-devel] Why we need unlink tb when cpu_interrupt/cpu_exit get called? 陳韋任
@ 2012-04-02  9:15 ` malc
  2012-04-02 10:21   ` 陳韋任
  0 siblings, 1 reply; 4+ messages in thread
From: malc @ 2012-04-02  9:15 UTC (permalink / raw)
  To: 陳韋任; +Cc: qemu-devel

On Mon, 2 Apr 2012, ??? wrote:

> Hi all,
> 
>   I am wondering why we need to unlink tb when cpu_interrupt/cpu_exit is
> called, and want to know what happened if we don't unlink tb. In theory,
> QEMU want the execution flow comes back from code cache to QEMU itself
> so that interrupts can be handled as soon as possible. However, I ran
> linux-0.2.img with a modified QEMU whose cpu_unlink_tb does nothing.
> Everything seems work fine. Is this experiment too trivial to show what
> bad things happened when we don't unlink tb?
> 
>   Thanks! :)

Try following with and without tb unlinking on aforementioned image to
feel the difference:

sh-2.05b# echo "char main[]={0xeb,-2};" >h.c
sh-2.05b# tcc -run h.c

-- 
mailto:av1474@comtv.ru

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Why we need unlink tb when cpu_interrupt/cpu_exit get called?
  2012-04-02  9:15 ` malc
@ 2012-04-02 10:21   ` 陳韋任
  2012-04-02 10:32     ` malc
  0 siblings, 1 reply; 4+ messages in thread
From: 陳韋任 @ 2012-04-02 10:21 UTC (permalink / raw)
  To: malc; +Cc: qemu-devel, 陳韋任

> Try following with and without tb unlinking on aforementioned image to
> feel the difference:
> 
> sh-2.05b# echo "char main[]={0xeb,-2};" >h.c
> sh-2.05b# tcc -run h.c

  I think the example you gave me is an infinite loop, right? O.K., here is
what I got.

  Case 1. With tb unlinking
    - tcc runs infinitely and I can not stop it by using Ctrl + C. But I can use
      Ctrl + C to kill QEMU itself.

  Case 2. Without tb unlinking (I comment out the function body of cpu_unlink_tb)
    - tcc runs infinitely and without any responding. In case 1, the guest OS can
      respond to my keyboard. Besides, Ctrl + C can not terminate QEMU, I have to
      use `kill` to stop it.

Is this what you expect?

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Why we need unlink tb when cpu_interrupt/cpu_exit get called?
  2012-04-02 10:21   ` 陳韋任
@ 2012-04-02 10:32     ` malc
  0 siblings, 0 replies; 4+ messages in thread
From: malc @ 2012-04-02 10:32 UTC (permalink / raw)
  To: 陳韋任; +Cc: qemu-devel

On Mon, 2 Apr 2012, ??? wrote:

> > Try following with and without tb unlinking on aforementioned image to
> > feel the difference:
> > 
> > sh-2.05b# echo "char main[]={0xeb,-2};" >h.c
> > sh-2.05b# tcc -run h.c
> 
>   I think the example you gave me is an infinite loop, right? O.K., here is
> what I got.

Yes, it's "0: jmp 0b"

> 
>   Case 1. With tb unlinking
>     - tcc runs infinitely and I can not stop it by using Ctrl + C. But I can use
>       Ctrl + C to kill QEMU itself.

You can also interactw with monitor and whatnot, IOW I/O loops is
running, IEYOW QEMU is not 100% occupied with running the guest code,
since it can unlink the TB and do other work.

> 
>   Case 2. Without tb unlinking (I comment out the function body of cpu_unlink_tb)
>     - tcc runs infinitely and without any responding. In case 1, the guest OS can
>       respond to my keyboard. Besides, Ctrl + C can not terminate QEMU, I have to
>       use `kill` to stop it.
> 
> Is this what you expect?

Yes.

-- 
mailto:av1474@comtv.ru

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-02 10:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02  3:45 [Qemu-devel] Why we need unlink tb when cpu_interrupt/cpu_exit get called? 陳韋任
2012-04-02  9:15 ` malc
2012-04-02 10:21   ` 陳韋任
2012-04-02 10:32     ` malc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).