{"id":808592,"url":"http://patchwork.ozlabs.org/api/patches/808592/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1504256570-3488-1-git-send-email-jasowang@redhat.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504256570-3488-1-git-send-email-jasowang@redhat.com>","list_archive_url":null,"date":"2017-09-01T09:02:50","name":"[net] vhost_net: correctly check tx avail during rx busy polling","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"d4a2c9c18cd39fc0e0ccbad6e6282abbc95c21b2","submitter":{"id":5225,"url":"http://patchwork.ozlabs.org/api/people/5225/?format=json","name":"Jason Wang","email":"jasowang@redhat.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1504256570-3488-1-git-send-email-jasowang@redhat.com/mbox/","series":[{"id":978,"url":"http://patchwork.ozlabs.org/api/series/978/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=978","date":"2017-09-01T09:02:50","name":"[net] vhost_net: correctly check tx avail during rx busy polling","version":1,"mbox":"http://patchwork.ozlabs.org/series/978/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808592/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808592/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jasowang@redhat.com"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkCvM5lGVz9t2r\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 19:03:11 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751557AbdIAJDB (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 1 Sep 2017 05:03:01 -0400","from mx1.redhat.com ([209.132.183.28]:38090 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751457AbdIAJC7 (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tFri, 1 Sep 2017 05:02:59 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 443E75F723;\n\tFri,  1 Sep 2017 09:02:59 +0000 (UTC)","from jason-ThinkPad-T450s.redhat.com (ovpn-12-64.pek2.redhat.com\n\t[10.72.12.64])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 68A8B7E8E6;\n\tFri,  1 Sep 2017 09:02:52 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 443E75F723","From":"Jason Wang <jasowang@redhat.com>","To":"mst@redhat.com, jasowang@redhat.com","Cc":"kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,\n\tnetdev@vger.kernel.org, linux-kernel@vger.kernel.org","Subject":"[PATCH net] vhost_net: correctly check tx avail during rx busy\n\tpolling","Date":"Fri,  1 Sep 2017 17:02:50 +0800","Message-Id":"<1504256570-3488-1-git-send-email-jasowang@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tFri, 01 Sep 2017 09:02:59 +0000 (UTC)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"We check tx avail through vhost_enable_notify() in the past which is\nwrong since it only checks whether or not guest has filled more\navailable buffer since last avail idx synchronization which was just\ndone by vhost_vq_avail_empty() before. What we really want is checking\npending buffers in the avail ring. Fix this by calling\nvhost_vq_avail_empty() instead.\n\nThis issue could be noticed by doing netperf TCP_RR benchmark as\nclient from guest (but not host). With this fix, TCP_RR from guest to\nlocalhost restores from 1375.91 trans per sec to 55235.28 trans per\nsec on my laptop (Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz).\n\nFixes: 030881372460 (\"vhost_net: basic polling support\")\nSigned-off-by: Jason Wang <jasowang@redhat.com>\n---\n- The patch is needed for -stable\n---\n drivers/vhost/net.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c\nindex 06d0448..1b68253 100644\n--- a/drivers/vhost/net.c\n+++ b/drivers/vhost/net.c\n@@ -634,7 +634,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk)\n \n \t\tpreempt_enable();\n \n-\t\tif (vhost_enable_notify(&net->dev, vq))\n+\t\tif (!vhost_vq_avail_empty(&net->dev, vq))\n \t\t\tvhost_poll_queue(&vq->poll);\n \t\tmutex_unlock(&vq->mutex);\n \n","prefixes":["net"]}