* [Qemu-devel] [virtio-net] why does the tx virtqueue have a timer?
@ 2015-03-03 9:21 Vasile Catalin-B50542
2015-03-03 15:36 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Vasile Catalin-B50542 @ 2015-03-03 9:21 UTC (permalink / raw)
To: qemu-devel
1. Why does virtio-net have a timer to handle tx virtqueue?
2. Why isn't the virtqueue kick enough? (I see that both are set to
handle jobs from virtqueue.)
3. What is the difference between regular timers and bh (bottom halves)?
Why would you choose one over another?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [virtio-net] why does the tx virtqueue have a timer?
2015-03-03 9:21 [Qemu-devel] [virtio-net] why does the tx virtqueue have a timer? Vasile Catalin-B50542
@ 2015-03-03 15:36 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2015-03-03 15:36 UTC (permalink / raw)
To: Vasile Catalin-B50542; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]
On Tue, Mar 03, 2015 at 11:21:32AM +0200, Vasile Catalin-B50542 wrote:
> 1. Why does virtio-net have a timer to handle tx virtqueue?
It's a performance optimization. By delaying tx virtqueue processing by
150 microseconds and turning guest->host virtqueue notifications off,
QEMU is able to batch transmit.
> 2. Why isn't the virtqueue kick enough? (I see that both are set to handle
> jobs from virtqueue.)
It is enough. The timer is not for functionality or correctness, it is
purely a performance optimization. The optimization is a gamble, there
are workloads where the extra 150 microseconds of latency causes worse
performance.
> 3. What is the difference between regular timers and bh (bottom halves)? Why
> would you choose one over another?
A bottom half is scheduled in the main loop "as soon as possible". A
timer has a specific duration (150 microseconds by default in this
case).
150 is a magic number. BH is another magic number, essentially. This
is just a bet that performance will be better if we delay a bit to allow
batching.
Hope this helps,
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-03 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 9:21 [Qemu-devel] [virtio-net] why does the tx virtqueue have a timer? Vasile Catalin-B50542
2015-03-03 15:36 ` Stefan Hajnoczi
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).