Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp389506ybl; Tue, 27 Aug 2019 22:42:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYeDYiONRmQJ02w4aii9vJG+D6LPKEK1Oy5XMCIIOIHtkFuyRxYhgYKViJPmKqvrX0EFiP X-Received: by 2002:a63:6d8d:: with SMTP id i135mr1919544pgc.303.1566970919965; Tue, 27 Aug 2019 22:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566970919; cv=none; d=google.com; s=arc-20160816; b=GVS5YcUyfWiiRsP/hVmUgJZLaWx0mVWBjasWxZA/LyeqO7H9duFj0+OenoJ+usRXtr WGNxqJ0/Efo4Zc+sPtPdHxSjdsS6Ph+BD9VnQfKQ0AbZdD34JKm9kkLb95zr0YxfBKxG 3i5GJ0wgzaAVCZxvoUW0erqt1SimUQ5U3/ZAHWqYYG9wRIqLiKyHkFVtf/T1PwUjFQUJ Ww0NmZQ+QKsg/d3C5y9Hpsc9Y36O7YgDOQ9H0Xw0iGyX3n57cNP8v1E7XEcUUvWrrVQE oB8SU/xs742egtgZLhfj1/n5WHgyqMMnE2Eb4WTLpHAtGGf6uOF3Jc2r2BrUSiLOSSYN gb3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=TWGY8MZ5UOIY+1F45TdiWmIsFAsddLVMtGmOWTsqaGg=; b=YTx53ftvdwbTI7qCEwkkb2WCelxUrbAv6/bqp0fYtannfm8VEUsaucWJtpJRiTsiOA paoByHyQ7tgqWAxCXv0qaAL1YK0l25y+FMgmcbeN5H3AHtusFXItQfkf+pTwHOWWSDVb AaY2a6SkNFKC4KU7TxsCHhJAoXudjPZe31BWSk2bI4qRh1FzAAA6vOkpL10wO2ef8AQU 8pqCSV9pEGwXphfW+ahbbDch5dkoJBw5j7f8Nqm3zWeFKT5SSgz3gJAz7i4lB5MXIdt+ W60xjYAwVavGkeDaEl0pXDG/I6IEdc1PIMNUMvdgGTOMxbEPluN2HWgVWyy3eY23QRmX EG/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ds20si1060662pjb.9.2019.08.27.22.41.44; Tue, 27 Aug 2019 22:41:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726375AbfH1Fkt (ORCPT + 99 others); Wed, 28 Aug 2019 01:40:49 -0400 Received: from mga05.intel.com ([192.55.52.43]:18843 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726331AbfH1Fks (ORCPT ); Wed, 28 Aug 2019 01:40:48 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Aug 2019 22:40:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,440,1559545200"; d="scan'208";a="332049727" Received: from dpdk-virtio-tbie-2.sh.intel.com ([10.67.104.71]) by orsmga004.jf.intel.com with ESMTP; 27 Aug 2019 22:40:47 -0700 From: Tiwei Bie To: mst@redhat.com, jasowang@redhat.com Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 2/2] vhost/test: fix build for vhost test Date: Wed, 28 Aug 2019 13:37:00 +0800 Message-Id: <20190828053700.26022-2-tiwei.bie@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190828053700.26022-1-tiwei.bie@intel.com> References: <20190828053700.26022-1-tiwei.bie@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since vhost_exceeds_weight() was introduced, callers need to specify the packet weight and byte weight in vhost_dev_init(). Note that, the packet weight isn't counted in this patch to keep the original behavior unchanged. Fixes: e82b9b0727ff ("vhost: introduce vhost_exceeds_weight()") Cc: stable@vger.kernel.org Signed-off-by: Tiwei Bie --- drivers/vhost/test.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index ac4f762c4f65..7804869c6a31 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -22,6 +22,12 @@ * Using this limit prevents one virtqueue from starving others. */ #define VHOST_TEST_WEIGHT 0x80000 +/* Max number of packets transferred before requeueing the job. + * Using this limit prevents one virtqueue from starving others with + * pkts. + */ +#define VHOST_TEST_PKT_WEIGHT 256 + enum { VHOST_TEST_VQ = 0, VHOST_TEST_VQ_MAX = 1, @@ -80,10 +86,8 @@ static void handle_vq(struct vhost_test *n) } vhost_add_used_and_signal(&n->dev, vq, head, 0); total_len += len; - if (unlikely(total_len >= VHOST_TEST_WEIGHT)) { - vhost_poll_queue(&vq->poll); + if (unlikely(vhost_exceeds_weight(vq, 0, total_len))) break; - } } mutex_unlock(&vq->mutex); @@ -115,7 +119,8 @@ static int vhost_test_open(struct inode *inode, struct file *f) dev = &n->dev; vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ]; n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick; - vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV); + vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV, + VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT); f->private_data = n; -- 2.17.1