Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3377812ybt; Tue, 23 Jun 2020 00:20:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvS1GHe+0IG916SNK9WyQaqVwTsUXRki+Yd9zdeU82UeF+ChFzGH7sEqVv/h5h1YzBfmjj X-Received: by 2002:a17:906:1499:: with SMTP id x25mr3225337ejc.406.1592896824572; Tue, 23 Jun 2020 00:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592896824; cv=none; d=google.com; s=arc-20160816; b=PVt7CMp7pLGVC7zx9utX6fqyhf2qMLojVubcGicqCK3qZGkRAWf3+AOFwHkLLnFfdR 5uahBP0vpd8mMz1sSYJrHNQHN/mgjfOpq9hFU1yDXse+dbu25ZD2ztQGtSqt0i00eUMo rHi9Q1+TPm2mWjEGwJHV5LWLSVrloXdtILuv/jmAVeEDeClGM9HyB4D7noDadh8XEtMG q7LFRKGsnzv0RkbSpt9YHGzqqf0Zqybf01CO1ypoFxDpx2AwDnDt8+T+n+N5XRZ73fca Sqa9q/aXDZZGa6x4ofZEJ38AJuy4XYbVLdKJLsBcLgZtHokThKKMxyeMYANR/nYJmUu1 F0kA== 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:dkim-signature; bh=HjkVUr/S/a3Xewkk0G7CYjpjGpF5YBjTPi+qkO5aYLE=; b=FGLlHZV4NfgQkptzISGbXfVjMHYuT2pm5K2TMYcudmttlcRyq/Z6YpYZ5BgfRd9VQE gbSf/Mem9DPzwFdVJCZsjtfiTOlBudUTNTTNwy4apOwJsfX3TjVLgZ8wH6uIxymEFpXL SnhXfMonF0Iri7umPxT7JQ5uJsYrl39glMqtN8QECvd0s7705HujdbkQsLBEKNX1JUZx crCxn8ckj+dPMgJnSskHPDthm+bQ1klZ8W0cncLRXS0TkklTEyuq3GOoCGhROajJS+X2 aJyc/heFQOV6eXtu8FymVmjlurXkRBzqaA36ASHTO876oGQ1YWPJbo282jn28mH/xp46 r5Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dOzWxCSt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w24si11064584ejv.691.2020.06.23.00.20.02; Tue, 23 Jun 2020 00:20:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dOzWxCSt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731202AbgFWHPx (ORCPT + 99 others); Tue, 23 Jun 2020 03:15:53 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:30250 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730781AbgFWHPx (ORCPT ); Tue, 23 Jun 2020 03:15:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592896552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HjkVUr/S/a3Xewkk0G7CYjpjGpF5YBjTPi+qkO5aYLE=; b=dOzWxCSt1De9tmE1t9ZihGLvmfS3jXOufbS488aFatHOThBkk36RfsYPB780EOG3A95Mdq KVmQAY8lWiIvbUj1insLFe9MiwM61cSatLtMMx4m4IEQ49Sm5chMnHviMH1mNn+AvNT6AY 5gOVErTYdTXpxHW9Hu4AP7OAGHdkZAA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-464-0YPiTuEgM8O-Zx2HigyzCw-1; Tue, 23 Jun 2020 03:15:48 -0400 X-MC-Unique: 0YPiTuEgM8O-Zx2HigyzCw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 621081005512; Tue, 23 Jun 2020 07:15:47 +0000 (UTC) Received: from [10.72.12.144] (ovpn-12-144.pek2.redhat.com [10.72.12.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id E80E260F80; Tue, 23 Jun 2020 07:15:41 +0000 (UTC) Subject: Re: [PATCH RFC v8 02/11] vhost: use batched get_vq_desc version To: Eugenio Perez Martin Cc: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org, kvm list , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org References: <20200611113404.17810-1-mst@redhat.com> <20200611113404.17810-3-mst@redhat.com> <0332b0cf-cf00-9216-042c-e870efa33626@redhat.com> <20200622115946-mutt-send-email-mst@kernel.org> From: Jason Wang Message-ID: <6715f515-3db6-1006-09dd-19464e3ff676@redhat.com> Date: Tue, 23 Jun 2020 15:15:40 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/6/23 下午3:00, Eugenio Perez Martin wrote: > On Tue, Jun 23, 2020 at 4:51 AM Jason Wang wrote: >> >> On 2020/6/23 上午12:00, Michael S. Tsirkin wrote: >>> On Wed, Jun 17, 2020 at 11:19:26AM +0800, Jason Wang wrote: >>>> On 2020/6/11 下午7:34, Michael S. Tsirkin wrote: >>>>> static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) >>>>> { >>>>> kfree(vq->descs); >>>>> @@ -394,6 +400,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) >>>>> for (i = 0; i < dev->nvqs; ++i) { >>>>> vq = dev->vqs[i]; >>>>> vq->max_descs = dev->iov_limit; >>>>> + if (vhost_vq_num_batch_descs(vq) < 0) { >>>>> + return -EINVAL; >>>>> + } >>>> This check breaks vdpa which set iov_limit to zero. Consider iov_limit is >>>> meaningless to vDPA, I wonder we can skip the test when device doesn't use >>>> worker. >>>> >>>> Thanks >>> It doesn't need iovecs at all, right? >>> >>> -- MST >> >> Yes, so we may choose to bypass the iovecs as well. >> >> Thanks >> > I think that the kmalloc_array returns ZERO_SIZE_PTR for all of them > in that case, so I didn't bother to skip the kmalloc_array parts. > Would you prefer to skip them all and let them NULL? Or have I > misunderstood what you mean? I'm ok with either approach, but my understanding is that Michael wants to skip them all. Thanks > > Thanks! >