On Tue, 2012-05-22 at 18:05 +0800, Jason Wang wrote:On 05/21/2012 11:42 PM, Shirley Ma wrote:I meant removing the code in handle_tx for zerocopy as below:On Mon, 2012-05-21 at 14:05 +0800, Jason Wang wrote:bedevice- tx polling depends on skb_orphan() which is often called byinsteaddriver when it place the packet into the queue of the devicesof when the packets were sent. So it was too early for vhost toherenotified.Then do you think it's better to replace with vhost_poll_queueit'sinstead?Just like what does this patch do - calling vhost_poll_queue() in
vhost_zerocopy_callback().
- it only works when the pending DMAs exceeds VHOST_MAX_PEND,onlyTXhighly possible that guest needs to be notified when the pendingIn which situation the guest needs to be notified when there is no
packets
isn't so much.
besides buffers run out?Consider guest call virtqueue_enable_cb_delayed() which means itinterruptneed to be notified when 3/4 of pending buffers ( about 178 buffers
(256-MAX_SKB_FRAGS-2)*3/4 ) were sent by host. So vhost_net would
notify
guest when about 60 buffers were pending. Since tx polling is only
enabled when pending packets exceeds VHOST_MAX_PEND 128, so tx work
would not be notified to run and guest would never get the
thereitSo it seems we still need vhost_enable_notify() in handle_tx when
expected to re-enable the queue.
is no tx in zerocopy case.vhost_poll_queue()
Do you know which one is more expensive: the cost ofin each zerocopy callback or calling vhost_enable_notify()?Didn't follow here, do you mean vhost_signal() here?
+ if (zcopy) {
/* If more outstanding DMAs, queue the work.
* Handle upend_idx wrap around
*/
num_pends = likely(vq->upend_idx>= vq->done_idx) ?
(vq->upend_idx - vq->done_idx) :
(vq->upend_idx + UIO_MAXIOV - vq->done_idx);
+ /* zerocopy vhost_enable_notify is under zerocopy callback
+ * since it could be too early to notify here */
+ break;
+ }
- if (unlikely(num_pends> VHOST_MAX_PEND)) {
- tx_poll_start(net, sock);
- set_bit(SOCK_ASYNC_NOSPACE,&sock->flags);
- break;
- }
if (unlikely(vhost_enable_notify(&net->dev, vq))) {
vhost_disable_notify(&net->dev, vq);
continue;
}
break;
Thanks
Shirley
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html