Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp636323ybg; Wed, 10 Jun 2020 09:40:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyd4VYGjfW7noSBTo82EB3jSedMIasftgskaYn4XMi4H/pIY4Fqh6mE6anQYPwBypNpr86 X-Received: by 2002:a50:9d83:: with SMTP id w3mr3149239ede.95.1591807255956; Wed, 10 Jun 2020 09:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591807255; cv=none; d=google.com; s=arc-20160816; b=oRAiO9TK5eHJUoajnUub0RDkWDDcL14EHAAnex8Y/H1/B33Ddu91TOqrcYGfw8wy58 gi9BAUcdRhKT+6PD5TPKLslWTJw9DQAYxKiTDYqlAXudbyWf3UJq/E9kWdp2Ej/Wr6YS BPLaJkJZE9fVajcKgnfvJEFMyIKHVSTS+uoUE+WpB0PhVKzQ1pptRak1kDejhr06TeNH hWQLrHX/qJSwsFINC6oHYm7LyjDpbs7Zc+TStyU2PRRGsoIZO56yYQySnTmFWI2IbSnj gH/bbJ64Hd2A3hqpVMmyX4beQ2v1cULNLfHjGI2CrbGmz2i3HpbF2d0l5yRidHwB+Ds8 wlGA== 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 :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=W4ZJyuHZsqz6Dp/hV/6BFgchUFjowsw3OCjq+UXY+5M=; b=PX6HLLCwhnnW/zMOxCngZc1havwKS51HI4WRhGTCwTmUg2XxHSVN2qGkxDXVeE9aDn zOnKDkA/k4ffa40enuvzxQ5IVsGC1h6JvvqgwheO07lwgO/W5/slaVyWOqLagYGAe3UF oTuCU7QUIEPZ9SETcC/XCza13V71Xl9PtT9vanvP2eUtz9PUqMq/wYcKqGI1I/9i4Tzl l8TrNv5lXW2KyoDLuWYts5/G+VKLKSvzYo4e6/cb813bBA3v+Z7O6F80eRrp9gxpp4Av o1Ftiz6j6YOYqgHRJXIR69Fm/EM1kc20XWhTM8FNLtFH0BmNpfoLr/D7FTVyYDduD4PI tCQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E79NLLxB; 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 dm27si67599edb.308.2020.06.10.09.40.32; Wed, 10 Jun 2020 09:40:55 -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=E79NLLxB; 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 S1729653AbgFJOAN (ORCPT + 99 others); Wed, 10 Jun 2020 10:00:13 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40333 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729650AbgFJOAJ (ORCPT ); Wed, 10 Jun 2020 10:00:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591797608; 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=W4ZJyuHZsqz6Dp/hV/6BFgchUFjowsw3OCjq+UXY+5M=; b=E79NLLxBKerATWN1x46GrAwb+CznmFo9jzX88o4fu24onpU2xcbS3ijOWBOVySyg22lHFP S7Eq2cECdUUhzedjukCfddO6gyUdkuC2dKBCkX+TqsKwZx9hkGnMBl8x7CTV3LzAKLpHE0 ojG+iwJaeBt1ZgYWZD+d60OemFcIngA= 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-303-4gCwFW6hP_mWKpAfPzco5g-1; Wed, 10 Jun 2020 10:00:06 -0400 X-MC-Unique: 4gCwFW6hP_mWKpAfPzco5g-1 Received: by mail-wr1-f70.google.com with SMTP id l18so1144313wrm.0 for ; Wed, 10 Jun 2020 07:00:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=W4ZJyuHZsqz6Dp/hV/6BFgchUFjowsw3OCjq+UXY+5M=; b=dc319vyJTKaeL3OxhnzR42HspQ9p5C8uiCSVIO+SD8+vTPQ/a+bmKRM895Ve8uR3GD YvTuimbT/8q66r5BTpwATPCiZi7GREik/CaTA576YKcdf3bAFMuhWGbusk6bIia995iW il408wqdzvDzcDamWOqOcSe9g1i2wpMEwRiwFUhIhxnlCtQW1+cYg/5eJV850BDaaJpQ qGw0y3ZNvP5QqNnH/9Jk+mk7tmvNfhIiebwxQrk5VwvfeiTOs800l0dHuuoW0rSROuDa hyW0h7oJbn/DBORAIByl+yQmCw98pwdxLfc3uIGcxnRTdPamtmAv0pg0bJECqqp5+di0 KCVg== X-Gm-Message-State: AOAM532VDOKMObox46dGKlrvESvR/3NJOmgEMwhWssle+mYJb9IfeZal wk+w5X55X5YwvjcNb8+YYlPxt2j3400LVbjMi6+EViJBJv5FAMRq3Fn9cKxwDH65RVxOnjpMvtP 4YvEWIhvMKkM91SGWB/iL0LIX X-Received: by 2002:adf:e588:: with SMTP id l8mr4149038wrm.255.1591797603964; Wed, 10 Jun 2020 07:00:03 -0700 (PDT) X-Received: by 2002:adf:e588:: with SMTP id l8mr4149007wrm.255.1591797603762; Wed, 10 Jun 2020 07:00:03 -0700 (PDT) Received: from eperezma.remote.csb (109.141.78.188.dynamic.jazztel.es. [188.78.141.109]) by smtp.gmail.com with ESMTPSA id t129sm7723980wmf.41.2020.06.10.07.00.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 07:00:03 -0700 (PDT) Message-ID: <313ad30e073974d71ac4c2fc3bc75db690ec8c72.camel@redhat.com> Subject: Re: [PATCH RFC v7 02/14] fixup! vhost: option to fetch descriptors through an independent struct From: Eugenio =?ISO-8859-1?Q?P=E9rez?= To: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Jason Wang Date: Wed, 10 Jun 2020 16:00:01 +0200 In-Reply-To: <20200610113515.1497099-3-mst@redhat.com> References: <20200610113515.1497099-1-mst@redhat.com> <20200610113515.1497099-3-mst@redhat.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-6.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-06-10 at 07:35 -0400, Michael S. Tsirkin wrote: > --- > drivers/vhost/vhost.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > index 180b7b58c76b..11433d709651 100644 > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/vhost.c > @@ -2614,7 +2614,7 @@ int vhost_get_vq_desc_batch(struct vhost_virtqueue *vq, > err_fetch: > vq->ndescs = 0; > > - return ret; > + return ret ? ret : vq->num; > } > EXPORT_SYMBOL_GPL(vhost_get_vq_desc_batch); > I'm able to lock the vhost_get_vq_desc running virtio_test with no arguments against this patch. It does not happen if it returns vq->num early, appended below. Let me know if you prefer your conditional at the end of the function and I will investigate the cause. Thanks! diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 28f324fd77df..4d198994e7be 100644 @@ -2350,7 +2345,9 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq, int ret = fetch_descs(vq); int i; - if (ret <= 0) + if (ret == 0) + return vq->num; + else if (ret < 0) goto err; /* Now convert to IOV */