Re: [PATCH] virtio_net: free transmit skbs in a timer

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Rusty Russell
Date: Monday, May 19, 2008 - 6:37 pm

On Monday 19 May 2008 23:26:15 Avi Kivity wrote:

Sure, linux/virtio_ring.h:

/* The Host uses this in used->flags to advise the Guest: don't kick me when
 * you add a buffer.  It's unreliable, so it's simply an optimization.  Guest
 * will still kick if it's out of buffers. */
#define VRING_USED_F_NO_NOTIFY  1
/* The Guest uses this in avail->flags to advise the Host: don't interrupt me
 * when you consume a buffer.  It's unreliable, so it's simply an
 * optimization.  */
#define VRING_AVAIL_F_NO_INTERRUPT      1


No, you misunderstand; this is not a performance issue.  On xmit, the driver 
cleans up any old used packets before trying to send anyway.  So it doesn't 
care when xmit packets are used, and suppresses the 'used' interrupt on the 
xmit virtqueue.  Only if the xmit ring is full does it enable the xmit-used 
notification.  This is optimal.

The issue is that we *do* actually care when xmit packets are used: we're 
supposed to free them in a timely manner and if the packet flow stops, we 
don't.  By always sending a used interrupt when *all* packets are used, we 
would cover this case quite nicely without impacting the normal case of 
packet flow.


Right, this would be a threshold that the host would set, approx. "when you've 
put this many packets in the xmit ring, tell me" (the opposite direction of 
the discussion above).  Currently we will kick the host on the first packet, 
and qemu will suppress the notifications based on some timer and we'll notify 
it anyway if the ring fills (which is suboptimal).  With this technique the 
host could double the threshold up to some maximum percentage of the ring.

While I like the Xen scheme, we can do the same thing from within the guest 
with the existing scheme using an internal threshold.  We are always allowed 
to send "spurious" notifications to the host, so it can't break anything.

Added to TODO.

Thanks,
Rusty.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] virtio_net: free transmit skbs in a timer, Mark McLoughlin, (Wed Apr 30, 7:31 am)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Rusty Russell, (Fri May 2, 3:55 am)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Mark McLoughlin, (Mon May 12, 1:37 pm)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Avi Kivity, (Tue May 13, 12:47 am)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Rusty Russell, (Tue May 13, 11:07 pm)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Mark McLoughlin, (Thu May 15, 8:29 am)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Rusty Russell, (Thu May 15, 4:25 pm)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Avi Kivity, (Sat May 17, 11:40 pm)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Rusty Russell, (Sun May 18, 7:16 am)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Rusty Russell, (Sun May 18, 6:52 pm)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Rusty Russell, (Mon May 19, 5:21 am)
Re: [PATCH] virtio_net: free transmit skbs in a timer, Rusty Russell, (Mon May 19, 6:37 pm)