Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3413512ybt; Tue, 23 Jun 2020 01:28:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzja7x8Kw1fkkAisFR/tX60SKTmzbGIYULMuPrdl2MA7JwNJv3V7dDbQLq3+4zEaA+35nA6 X-Received: by 2002:a05:6402:7cb:: with SMTP id u11mr19975172edy.316.1592900911354; Tue, 23 Jun 2020 01:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592900911; cv=none; d=google.com; s=arc-20160816; b=onDy/uHkZtGQwn23yig8uLxhFM9aFE+0Zn7gdLyj5gNkNtr/KWoVD15SV9ltK1G8Nh bPnznaiACK4n5tg3DwlAGBjjaHOaCnjMKvAgGtXQqhFqs15TIamT0qrTtkjzblKsB0nt Js+QXWLWBEBT4OEpqar+TbYOKrUVW48P69uCp8Ttkh+4ezcQfLftgvjQt3EOIak6Siu0 1uO6+hd032+1j1Pt9C8oN0VswsiudtJnPWllIWxhqHA/od/1S8hDE9y6xxAteWF902N6 84B+05Ic2Vv7KwhZcWzZ/NGj4/ubz017jlZ2tPYOs7OGCEycjP/p+kt4Nv0aGd6/FqXK oOew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uatLoTht3LpxtV8y54s42CvqtAcAPf7U2lYUBgXuz/c=; b=T6LVwE62l8xwY/MvohLsAPbXbQKTaKNj3HCWtrNr+mZawSwmneWJ23tXGNmkRulJUv 92OhADy2Ch3A2D0g82u8JIYfG+r4Bc9Yssf23hbC9DU/S3ZZ+f+7vWT50NCBlLsoAygg qNrQOmWpBpqz1abRQ3LMeBOafUAUhHKxnlgQoTszOWhDzb694WpqQghqx//1gTnAmT0N HsEjJs2GrQSd/4mokPJkKW5zmOF00tNrsjR7IyEMs3XYl0ru0nPoHujbd2FC1s/kkKZz ltielc9fSi0Ce/XWP3HjIsvjmctQiTgxGTPi4an0TrugPCm/ucAnXi+Fr6DhO3US2RsR RtUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fVb3U84p; 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 e13si1825314eja.400.2020.06.23.01.28.08; Tue, 23 Jun 2020 01:28:31 -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=fVb3U84p; 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 S1731812AbgFWIZz (ORCPT + 99 others); Tue, 23 Jun 2020 04:25:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:24456 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731783AbgFWIZy (ORCPT ); Tue, 23 Jun 2020 04:25:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592900752; 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=uatLoTht3LpxtV8y54s42CvqtAcAPf7U2lYUBgXuz/c=; b=fVb3U84p2K2Yg+P/gazZWZawGmI4PlUwIxqiyU/xOwJ46x7o8PuY/6PZmCGXjFeVPFbL2d kh5IEEmuSLpgzhBhboXsUUB2cXqXyU75nE1M69H3ROW2WVU22x0tocnY2gpH/Vga3wR6s6 DhFC3VDudS6Uh4nNWD4lM1AdnW8Hc/E= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-ytcp8kokMtmwT0Z6HcJ-Qg-1; Tue, 23 Jun 2020 04:25:50 -0400 X-MC-Unique: ytcp8kokMtmwT0Z6HcJ-Qg-1 Received: by mail-wr1-f70.google.com with SMTP id l3so5264191wrw.4 for ; Tue, 23 Jun 2020 01:25:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=uatLoTht3LpxtV8y54s42CvqtAcAPf7U2lYUBgXuz/c=; b=g1aB5aZNjzn9j4oIDZbrj9CrmcxJvRtr7dwOPnX/Gcfi/KR/u29b+fsTVuA9WNdZVq sFVjrbrGrI6XqFWRmlLVle1MO8gOnDKQoOQl+r8TE5MsYgd1ydOr1V6ogyxD26fYlXg+ lMHypBEVQ8Q/HuUKidH9HpJ6PcyXMlrFHe+kBIdT/FI1m6FzLmK4mjKUmuK1zXDwzewI YNRGnV66s8q5wNYY/mbfA14ZZKaNne8jMgo46SV6ppF2tXTtTWonidZsZrID2dRh8qFQ t8cGA4vSvpvzIG64aEQwrYiRvsEPPPgOzr+qwKy1+obidipnFXzHVjLZIZ8yJrcmF+LO 5ddQ== X-Gm-Message-State: AOAM533odQrE+8AWG0iKskpUXazU3hlkD6Vk6Vwvvopnbl8B50W3oEb0 cbA5rL1xwreWX9SQCHVlFFDRF1Y/dFUUlt5jQMPIcZbC1k3wzvnBTqsMh3Dm/ArGdb8uPZ5q5gv uxDoA6XNGurvzXBqlA7FRe82U X-Received: by 2002:adf:e482:: with SMTP id i2mr36534wrm.75.1592900749388; Tue, 23 Jun 2020 01:25:49 -0700 (PDT) X-Received: by 2002:adf:e482:: with SMTP id i2mr36515wrm.75.1592900749185; Tue, 23 Jun 2020 01:25:49 -0700 (PDT) Received: from redhat.com (bzq-79-182-31-92.red.bezeqint.net. [79.182.31.92]) by smtp.gmail.com with ESMTPSA id e5sm19713184wrs.33.2020.06.23.01.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 01:25:48 -0700 (PDT) Date: Tue, 23 Jun 2020 04:25:46 -0400 From: "Michael S. Tsirkin" To: Eugenio Perez Martin Cc: Jason Wang , linux-kernel@vger.kernel.org, kvm list , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org Subject: Re: [PATCH RFC v8 02/11] vhost: use batched get_vq_desc version Message-ID: <20200623042456-mutt-send-email-mst@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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2020 at 09:00:57AM +0200, 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? > > Thanks! Sorry about being unclear. I just meant that it seems cleaner to check for iov_limit being 0 not for worker thread. -- MST