Re: [Qemu-devel] [RFC] create a single workqueue for each vm to update vm irq routing table

Gleb Natapov
2013-11-28T11:09:20Z

On Thu, Nov 28, 2013 at 11:40:06AM +0100, Paolo Bonzini wrote:
> Il 28/11/2013 11:16, Avi Kivity ha scritto:
> >> The QRCU I linked would work great latency-wise (it has roughly the same
> >> latency of an rwsem but readers are lock-free). However, the locked
> >> operations in the read path would hurt because of cache misses, so it's
> >> not good either.
> >
> > I guess srcu would work. Do you know what's the typical write-side
> > latency there? (in terms of what it waits for, not nanoseconds).
>
> If there's no concurrent reader, it's zero if I read the code right.
> Otherwise it depends:
>
> - if there are many callbacks, only 10 of them are processed per
> millisecond. But unless there are concurrent synchronize_srcu calls
> there should not be any callback at all. If all VCPUs were to furiously
> change the MSIs, the latency could go up to #vcpu/10 milliseconds.
>
> - if there are no callbacks, but there are readers, synchronize_srcu
> busy-loops for some time checking if the readers complete. After a
> while (20 us for synchronize_srcu, 120 us for
> synchronize_srcu_expedited) it gives up and starts using a workqueue to
> poll every millisecond. This should never happen unless
>
Unless what ? :) Unless reader is scheduled out?

> So, given the very restricted usage this SRCU would have, we probably
> can expect synchronize_srcu_expedited to finish its job in the
> busy-looping phase, and 120 us should be the expected maximum
> latency---more likely to be an order of magnitude smaller, and in very
> rare cases higher.
>
> Paolo

--
Gleb.