Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp804608ybe; Fri, 13 Sep 2019 06:39:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8sKPPgh0AR2au8DE1FTG/IBY1UuBmhrOuuwgaytm9q+30BJKizfgjzntZ8hncTyM6Xqw2 X-Received: by 2002:a50:ed0f:: with SMTP id j15mr39992070eds.127.1568381951306; Fri, 13 Sep 2019 06:39:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568381951; cv=none; d=google.com; s=arc-20160816; b=AE/0RE4++jEGbxvua4sNPFBwx36yXSTJWboMuYw5kRxqAl8r7xKRQHwAEmadQLf+bC jE3GZ3TTPiuO2W2ZzwcstWgEu+DcqLzqQ7YJ6YpioAcI9gQm13yc/FUL7xbyAB+njYkU 0hmWDhla/bI6U09R4M8IIzFsCtjZwRdC9+9pRaxwpz/JF6LrYW7JGIXUIwTm4tz8EI5f kuvuWsnZiWE0tLZG4pMjLK++alCa0mCw23ZAqSoyv9YB2LQ47e3ER0skVttMp4tTXMyH 9q+ef0I0rnDovAT6qEOK+RGSMFy9rz5Dz9De3cLzoZkTgdci/Wf4PJvjPdvU1XdBvGi0 27QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mKMdjOfOf7tzs659I09cm865L52FNdiYgMLKST4zAj8=; b=VxJmi5b+r4DAJaHiM7DfgPwfVgpB5RXjB0F7CuPCImecef2K2Nf+7LP8IXMWWBoGbt Z7hZ9Hk0YV72TxMCcR0Q5uWvB3yCiipKNc5ONiXtqomD1NYWI/kyrVU3NbtlJk2xeVjZ p0kdpA5pje/NN5ck+/1sjo1izUbpquBmreNjzGS6CyehIHXw7BoLDEHlYpYr7j3EkZhz OP1K+EENRhuTWWdCbkqRC2UO2PBcev3OO8XqawEvYgCQzASefNV8duXybEJ/Y5Xi2zYc kVDtqJXGeG4TST7Vh9a7u+TZCuzFzX//yE/KqwEhsqEWD8BSukDUk61+/MiaPX87eWk0 /4Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V6jwXCxY; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si14504406ejz.328.2019.09.13.06.38.47; Fri, 13 Sep 2019 06:39:11 -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; dkim=pass header.i=@kernel.org header.s=default header.b=V6jwXCxY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388644AbfIMNKC (ORCPT + 99 others); Fri, 13 Sep 2019 09:10:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:34736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388579AbfIMNKA (ORCPT ); Fri, 13 Sep 2019 09:10:00 -0400 Received: from localhost (unknown [104.132.45.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 18EB4206BB; Fri, 13 Sep 2019 13:09:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568380199; bh=qmIDS1RUIUlk4PqP13Ji4FuXvckwkFyjkjtsRyDYu4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V6jwXCxYsaSB8fdaR9LZg/QQQqyI5lfRrq862E95HrV33yLfUpH65Y8W0dvz0o5AH YjGX0DUIqSzCeuaOo/D/PFnQMy7VUiNpkvJLSv36wZhwAK6y/fIRrTYxJQ1JK0Rd2Z baZeRpCs9rfOlt75F5JauuU1gfI5xxhBSkJ+lhuM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tiwei Bie , "Michael S. Tsirkin" , Jason Wang Subject: [PATCH 4.14 11/21] vhost/test: fix build for vhost test Date: Fri, 13 Sep 2019 14:07:04 +0100 Message-Id: <20190913130505.580067115@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190913130501.285837292@linuxfoundation.org> References: <20190913130501.285837292@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tiwei Bie commit 264b563b8675771834419057cbe076c1a41fb666 upstream. 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 Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: Greg Kroah-Hartman --- drivers/vhost/test.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -23,6 +23,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, @@ -81,10 +87,8 @@ static void handle_vq(struct vhost_test } 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); @@ -116,7 +120,8 @@ static int vhost_test_open(struct inode 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); + vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, + VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT); f->private_data = n;