All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] QEMU TB Unlinking due to interrupt.
@ 2011-12-09 18:44 Xin Tong
  2011-12-09 23:45 ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: Xin Tong @ 2011-12-09 18:44 UTC (permalink / raw)
  To: qemu-devel

Currently, QEMU unchains TBs if there is an interrupt pending. I would
like to know whether there is any reason behind this ? (why not
checking interrupt status in the beginning of every tb ?)

Thanks

Xin

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

* Re: [Qemu-devel] QEMU TB Unlinking due to interrupt.
  2011-12-09 18:44 [Qemu-devel] QEMU TB Unlinking due to interrupt Xin Tong
@ 2011-12-09 23:45 ` Peter Maydell
  2011-12-10  0:08   ` Xin Tong
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2011-12-09 23:45 UTC (permalink / raw)
  To: Xin Tong; +Cc: qemu-devel

On 9 December 2011 18:44, Xin Tong <xerox.time.tech@gmail.com> wrote:
> Currently, QEMU unchains TBs if there is an interrupt pending. I would
> like to know whether there is any reason behind this ? (why not
> checking interrupt status in the beginning of every tb ?)

The theory is that it's faster overall to do a slightly slow
operation (tb unlinking) on interrupts rather than do a check
at the beginning of every tb (happens a lot in the normal
code path).

However the tb unlinking code is racy and personally I think
we should get rid of it in favour of a simpler scheme like a
flag check. I have some prototype patches kicking around for
this.

-- PMM

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

* Re: [Qemu-devel] QEMU TB Unlinking due to interrupt.
  2011-12-09 23:45 ` Peter Maydell
@ 2011-12-10  0:08   ` Xin Tong
  2011-12-13  8:10     ` 陳韋任
  2012-01-20  7:41     ` 陳韋任
  0 siblings, 2 replies; 7+ messages in thread
From: Xin Tong @ 2011-12-10  0:08 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

can you forward me the patch please. Peter. Also, as far as I
understand, tb unlinking can only happen in 2 cases.

1. some other tbs being invalidated.
2. interrrupt pending

Am I right ?

Thanks

Xin


On Fri, Dec 9, 2011 at 6:45 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 9 December 2011 18:44, Xin Tong <xerox.time.tech@gmail.com> wrote:
>> Currently, QEMU unchains TBs if there is an interrupt pending. I would
>> like to know whether there is any reason behind this ? (why not
>> checking interrupt status in the beginning of every tb ?)
>
> The theory is that it's faster overall to do a slightly slow
> operation (tb unlinking) on interrupts rather than do a check
> at the beginning of every tb (happens a lot in the normal
> code path).
>
> However the tb unlinking code is racy and personally I think
> we should get rid of it in favour of a simpler scheme like a
> flag check. I have some prototype patches kicking around for
> this.
>
> -- PMM

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

* Re: [Qemu-devel] QEMU TB Unlinking due to interrupt.
  2011-12-10  0:08   ` Xin Tong
@ 2011-12-13  8:10     ` 陳韋任
  2011-12-14  1:29       ` Xin Tong
  2012-01-20  7:41     ` 陳韋任
  1 sibling, 1 reply; 7+ messages in thread
From: 陳韋任 @ 2011-12-13  8:10 UTC (permalink / raw)
  To: Xin Tong; +Cc: Peter Maydell, qemu-devel

> 1. some other tbs being invalidated.
> 2. interrrupt pending

  Could you point out "interrrupt pending" means where? I'd like to take a look,
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] 7+ messages in thread

* Re: [Qemu-devel] QEMU TB Unlinking due to interrupt.
  2011-12-13  8:10     ` 陳韋任
@ 2011-12-14  1:29       ` Xin Tong
  2011-12-14 14:29         ` 陳韋任
  0 siblings, 1 reply; 7+ messages in thread
From: Xin Tong @ 2011-12-14  1:29 UTC (permalink / raw)
  To: 陳韋任; +Cc: Peter Maydell, qemu-devel

QEMU performs a recursive unchaining on the current executing tb when
a timer fires.  This timer is set by setitimer in the qemu-timer.c.
This is what I mean by "interrupt pending". Of course, there are
interrupts from emulated devices as well, but i do not know how that
is set up, i.e. how tcg_handle_interrupt is called when the devices
finishes some work. I hope you can enlighten me on that.


Thanks


Xin


On Tue, Dec 13, 2011 at 3:10 AM, 陳韋任 <chenwj@iis.sinica.edu.tw> wrote:
>> 1. some other tbs being invalidated.
>> 2. interrrupt pending
>
>  Could you point out "interrrupt pending" means where? I'd like to take a look,
> 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] 7+ messages in thread

* Re: [Qemu-devel] QEMU TB Unlinking due to interrupt.
  2011-12-14  1:29       ` Xin Tong
@ 2011-12-14 14:29         ` 陳韋任
  0 siblings, 0 replies; 7+ messages in thread
From: 陳韋任 @ 2011-12-14 14:29 UTC (permalink / raw)
  To: Xin Tong; +Cc: Peter Maydell, qemu-devel, 陳韋任

On Tue, Dec 13, 2011 at 08:29:50PM -0500, Xin Tong wrote:
> QEMU performs a recursive unchaining on the current executing tb when
> a timer fires.  This timer is set by setitimer in the qemu-timer.c.
                        
  You mean dynticks_start_timer?

> This is what I mean by "interrupt pending". Of course, there are
> interrupts from emulated devices as well, but i do not know how that
> is set up, i.e. how tcg_handle_interrupt is called when the devices
> finishes some work. I hope you can enlighten me on that.

  I am not familiar with how QEMU deal with virtual devices. But AFAIK, virtual
devices will register IRQ to APIC (hw/apic.c), APIC will call cpu_interrupt
(cpu-all.h), which turns to call cpu_interrupt_handler. You can see cpu_interrupt_handler
is assigned as tcg_handle_interrupt in exec.c.  tcg_handle_interrupt raise env's
interrupt_request, and leave cpu_exec to check env's interrupt_request. 

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] 7+ messages in thread

* Re: [Qemu-devel] QEMU TB Unlinking due to interrupt.
  2011-12-10  0:08   ` Xin Tong
  2011-12-13  8:10     ` 陳韋任
@ 2012-01-20  7:41     ` 陳韋任
  1 sibling, 0 replies; 7+ messages in thread
From: 陳韋任 @ 2012-01-20  7:41 UTC (permalink / raw)
  To: Xin Tong; +Cc: Peter Maydell, qemu-devel

On Fri, Dec 09, 2011 at 07:08:43PM -0500, Xin Tong wrote:
> can you forward me the patch please. Peter. Also, as far as I
> understand, tb unlinking can only happen in 2 cases.
> 
> 1. some other tbs being invalidated.
> 2. interrrupt pending

  http://lists.gnu.org/archive/html/qemu-devel/2011-09/msg03643.html

HTH,
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] 7+ messages in thread

end of thread, other threads:[~2012-01-20  7:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09 18:44 [Qemu-devel] QEMU TB Unlinking due to interrupt Xin Tong
2011-12-09 23:45 ` Peter Maydell
2011-12-10  0:08   ` Xin Tong
2011-12-13  8:10     ` 陳韋任
2011-12-14  1:29       ` Xin Tong
2011-12-14 14:29         ` 陳韋任
2012-01-20  7:41     ` 陳韋任

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.