Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp157686ybl; Thu, 29 Aug 2019 20:40:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnJwEtLH5Sa2LiFhonr++Z3gIWlnDcYjXm2uQxs4enopeMuaK7gGfD4dg3XBtPhjtBqD3X X-Received: by 2002:a63:904:: with SMTP id 4mr953852pgj.36.1567136406494; Thu, 29 Aug 2019 20:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567136406; cv=none; d=google.com; s=arc-20160816; b=ywPMr9CRk84KKlJLy1zCxs8zog+5kfOzTwEh9MGzRnthD8WKOC6k+CnIhUcBrI6WO1 NKthwLB70lDz9OPhbI1ByjyGDKjGYNmQ7PnoXJqMP1ceeCDPL6VNuOgGhHZEm7g3azXI BEp16R2HsPbs9xIq81YWtb5EXwDQda9vdg5vHMJorqzqLKf6ei67iIYi/nQlHcZ6FA1H XjNm3kNF0OUBZ+vWcwRwBSGAIgaXhyccGPJ8GDXXPx0gSc8gmA3sLT2A4Vaq4hDhXmzd Aog/xJ4oj9NHGC/aS73eyjFMUscsFC5zSUhFV1dREVJ9GCgbVHJJ+SjOj4qEIFre3GB4 CK7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=GIm8EXNBXpMwG+4+HycW/GB33ao+4qXFHQREKayAghM=; b=UTCEJ2tM2cih3r5vWf8X+2HrdiN0GuP7jFg5RnDEPjPv+urJhySLW1RYhhpzoEI1sz odEHP7NheH4a1xkthIWEEvFbhfnvEABkzRuD3Ptr4Yi9TJmcDhftVhgCBZ/1SY+CPL+b CyFA70nR7JL7ETa9iCzW9/rSu8oqEAd4CWDZWX7D6ls4+qKRr2IQmusOelwCEdOxUDpd tc0eOEOu2GO9ir6yJ3/EBKmoSl64kjHKuyVZmT3maQufQu2T4OMflFt60SPhkXYkG+fp e/NTsHnLUEFQ5zHPmC7MYoFJ88i+Tn5INx/L/gGjR+bnZQdnJnzo7UI4gPPQyI0iD1Nt 1O2A== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g62si4551081pfb.219.2019.08.29.20.39.51; Thu, 29 Aug 2019 20:40:06 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728137AbfH3DiX (ORCPT + 99 others); Thu, 29 Aug 2019 23:38:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52001 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727770AbfH3DiW (ORCPT ); Thu, 29 Aug 2019 23:38:22 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9BEAB307D88C; Fri, 30 Aug 2019 03:38:22 +0000 (UTC) Received: from [10.72.12.92] (ovpn-12-92.pek2.redhat.com [10.72.12.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id A065A5C1D6; Fri, 30 Aug 2019 03:38:17 +0000 (UTC) Subject: Re: [PATCH 2/2] vhost/test: fix build for vhost test To: Tiwei Bie , mst@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 References: <20190828053700.26022-1-tiwei.bie@intel.com> <20190828053700.26022-2-tiwei.bie@intel.com> From: Jason Wang Message-ID: Date: Fri, 30 Aug 2019 11:38:16 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190828053700.26022-2-tiwei.bie@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 30 Aug 2019 03:38:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/8/28 下午1:37, Tiwei Bie wrote: > 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; > Acked-by: Jason Wang