All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Bottom halves VS timers
@ 2019-01-22  7:15 Pavel Dovgalyuk
  2019-01-22  8:49 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Dovgalyuk @ 2019-01-22  7:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, peter.maydell, stefanha, famz, kwolf

Hi!

 

I recently debugged record/replay for some platform which uses PIO access for IDE.

Handlers for these operations are called through BHs.

Scheduling new BH does not create a signal for the vCPU to suspend the execution and

process the main loop events (in record/replay we synchronize these two threads).

Therefore vCPU may execute 10000000 instruction until BH processing and the guest

software may get a timeout.

 

I thought about replacing BH to the timers with period=0. This solution has the following
properties:

1.       Avoid code duplication (BH and timers do virtually the same operations)

2.       Timers affect the vCPU - adding new virtual timer suspends the execution to process the
callback

3.       Timers are deterministic in record/replay mode (virtual ones of course). We have similar
deterministic concept for BHs, but selecting between virtual and realtime should be more familiar
for other developers.

4.       Timers require a little bit more code, but this could be solved with better interfaces

 

What do you think about this?

Did I miss anything?

 

Pavel Dovgalyuk

 

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

* Re: [Qemu-devel] Bottom halves VS timers
  2019-01-22  7:15 [Qemu-devel] Bottom halves VS timers Pavel Dovgalyuk
@ 2019-01-22  8:49 ` Paolo Bonzini
  2019-01-22 11:31   ` Pavel Dovgalyuk
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2019-01-22  8:49 UTC (permalink / raw)
  To: Pavel Dovgalyuk, qemu-devel; +Cc: peter.maydell, stefanha, famz, kwolf

On 22/01/19 08:15, Pavel Dovgalyuk wrote:
> Scheduling new BH does not create a signal for the vCPU to suspend the
> execution and process the main loop events (in record/replay we
> synchronize these two threads).

I think the bug is that in rr mode it should do so and cause a cpu_exit.
 If replace these bottom halves with timers, other bottom halves from
the block layer may have the same issue; if you replace _all_ bottom
halves with timers you have performance issues because bottom halves try
very hard to avoid locks.

Unfortunately this is getting really ugly...  Basically, rr is
reintroducing all the complications with iothread_requesting_mutex that
were removed with mtTCG.

Paolo

> Therefore vCPU may execute 10000000 instruction until BH processing and
> the guest
> software may get a timeout.
> 

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

* Re: [Qemu-devel] Bottom halves VS timers
  2019-01-22  8:49 ` Paolo Bonzini
@ 2019-01-22 11:31   ` Pavel Dovgalyuk
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Dovgalyuk @ 2019-01-22 11:31 UTC (permalink / raw)
  To: 'Paolo Bonzini', qemu-devel; +Cc: peter.maydell, stefanha, famz, kwolf

> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> On 22/01/19 08:15, Pavel Dovgalyuk wrote:
> > Scheduling new BH does not create a signal for the vCPU to suspend the
> > execution and process the main loop events (in record/replay we
> > synchronize these two threads).
> 
> I think the bug is that in rr mode it should do so and cause a cpu_exit.

Right. I combined adding cpu_exit (into our private version) and increasing
an icount command-line parameter.

>  If replace these bottom halves with timers, other bottom halves from
> the block layer may have the same issue; if you replace _all_ bottom
> halves with timers you have performance issues because bottom halves try
> very hard to avoid locks.

I see.

> Unfortunately this is getting really ugly...  Basically, rr is
> reintroducing all the complications with iothread_requesting_mutex that
> were removed with mtTCG.

True. There are too many non-synchronized entities: bottom halves,
worker threads, iothreads, timers...
But RR is only possible when we have kind of synchronization objects for them.

Pavel Dovgalyuk

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

end of thread, other threads:[~2019-01-22 11:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22  7:15 [Qemu-devel] Bottom halves VS timers Pavel Dovgalyuk
2019-01-22  8:49 ` Paolo Bonzini
2019-01-22 11:31   ` Pavel Dovgalyuk

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.