Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1123651ybe; Fri, 13 Sep 2019 11:23:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8rNV+TuBqtx8QWnk01DSHdMlS/f2Cg591Y74fDq6mmoEmvMFSew7TrvaLhGXzkgOwFyYo X-Received: by 2002:aa7:db02:: with SMTP id t2mr1387402eds.252.1568399018350; Fri, 13 Sep 2019 11:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568399018; cv=none; d=google.com; s=arc-20160816; b=kGkzXctvI85mdNVd9PhLgqfkeijln6oRHs8Hxyce4hmZi6qV7+hch4q8wcYKqCif9s kDMHOVh0XcLdNES7Eyl2gStNsLtBUewpCcY3s1wWHKArt1BRKC9pLgaDIPycfpX0ABWW DSa39I6Mtqunm+jITFeQDXz9xFgctQskBR7SwO92CFS2PwM3N8oKMxCzqePu0ZGviNHU uVC/jAV3lMzxV0FKeZjNZ4arjRSjJAI7eFyYDSSHWjRsbvdyxi5IM74eZg5cP/eyiRxt Tz8rTAtv94UGnpanCDlag42E3rrpoyPHooMeeJh2Kh8GZ2cPqoUUnsYh0wQDO4qAlKBN AItQ== 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=bJeDezRHRTmdo2jsvc+Enmzi/cw4spOXpX7VTLIr9+w=; b=u9grT6oYcoXaRR5Bb9897tuzLm6kO8Itj4g35L01PgO3JWWAv+oStujS9YJOVecBcU FLf6CwW9iAS5kOfoiej1ipsMN9loPs2TRzMZQKBMr5idJyYpsEiuHVf4qB/vXpn9KVZW KAqVGa6IlpVDwLP5Z9cckJcT4m3E/AC3ouLnJCda+JUQNpaqrjwvkR6pWTTuX8toMelZ SP2k6bW2IU+oH0gIaaUoKbPYUqVrG4RTXcJDNleCVoQHMTQeOw4BIn6OaZpWr1+MEiTo 13DgKrtHZsAQ5v7M2v5eVq2Qi7ZlEBnlrxkdb47JSxlDhMsbzNkPOUivW/F201Y0Cwxy YAsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GXvexKfZ; 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 w23si11357151edv.199.2019.09.13.11.23.15; Fri, 13 Sep 2019 11:23:38 -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=GXvexKfZ; 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 S2390859AbfIMNVh (ORCPT + 99 others); Fri, 13 Sep 2019 09:21:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:51282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390847AbfIMNVd (ORCPT ); Fri, 13 Sep 2019 09:21:33 -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 57CFE206BB; Fri, 13 Sep 2019 13:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568380892; bh=f1ussyl0yeIxmZBfMJ7r0itbq7fEnM3dbc1i3oePXxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GXvexKfZ3PZyJ2ICH5Xu1gZfX+T79akEzjIdk4GPSSRVRtO8OzmXC2Xxl/Tw5qiE3 HAG7pTARpZ0/g1vPKbm8JzIZZmkWDTDJ39A0+5E8TdKFn/3GsI2f2W6vTxeOobha0R Ab7CvM2iMH26cdK81wb7Dti8xz7Fr7jzjE5mdGtw= 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 5.2 12/37] vhost/test: fix build for vhost test - again Date: Fri, 13 Sep 2019 14:07:17 +0100 Message-Id: <20190913130515.217540495@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190913130510.727515099@linuxfoundation.org> References: <20190913130510.727515099@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 @@ -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 } 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 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;