Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp724214ybg; Wed, 10 Jun 2020 11:59:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTepp3vBya/dvk5N3m0J51m35v9TUH8zJYSAU+Q8awwceXS86PxTme3qoJ79kiYe1Huvl2 X-Received: by 2002:a17:906:4350:: with SMTP id z16mr4691313ejm.139.1591815582133; Wed, 10 Jun 2020 11:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591815582; cv=none; d=google.com; s=arc-20160816; b=ZgvtzPNy1Idwl5mFl9HHymP9RpFq5UR486B+pNbkeFYiqR0xVZT7Jm+TIwpkmQlTfg nHxG8+LlnqTfu/IpBBG/nwD7xhAt9oD5SjiMuTG3uSD3YmPsi2JGDDY+sFqWCV/fMFNt QG/lZcWpnGDp6gFV0icjSPak1skbtjlnrPlyEYND4+P8BvwcsSsOJV/MrOsOVVQayTYF ilX3Vr87iP9BxvPbHN0cc9xx+yeDuD75c5sHCsIMbMhlnPDalTJZhlsUq7sgW2qQwJcN CFtppJwguMC8FWjIaEhpRDkjpRJfY/iZVm2uXyWRth//s/97fcUJQj7JJAC+ghIKuERQ dkmA== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=YfhNq/fazdZ8Eyi5klTe6PYJfVDAk96bmheZ7cnvsnc=; b=lvyDNivBUdw60k7JFCDLjXfISIMcsYDP0FNKhIqKvuRvPIAGztj5+clVFU8HUnDjOT y6Gf3renhFBvSoaiM3WwB7iCEFbtxUnwx3uWrzsO2K9F08yedYpfDL0Yl9g7E/DndSVv plmMZjGwd/jzr6bvJQcz+KJXASBqENYEfPCod0s/hoD0t+mRQN3KgdkCH8vCbbCoXfu9 xmCvHNf7ejoV/qNf4dXk8VglZkmsN7qloAgx1b6O+h7rl3UyD6HkKRiSKbXGnFhB3ncL DDYDezeXiDtiBPSs6t9nh+jV44xccqufdlbfCag8WdWAz9Od5WdeHDt7WF01t4mtCiVs LSaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CM8DWTXO; 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 a9si265185edm.76.2020.06.10.11.59.19; Wed, 10 Jun 2020 11:59:42 -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=CM8DWTXO; 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 S1730043AbgFJPNp (ORCPT + 99 others); Wed, 10 Jun 2020 11:13:45 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:48482 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728211AbgFJPNp (ORCPT ); Wed, 10 Jun 2020 11:13:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591802023; 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: in-reply-to:in-reply-to:references:references; bh=YfhNq/fazdZ8Eyi5klTe6PYJfVDAk96bmheZ7cnvsnc=; b=CM8DWTXOcm6czEgIiDsp3Eg8M02TF2L8NVCgAhh7JFvmw0DehBqIh1qb6rzHF8ur4LWGQN XxvSDpuOQlIntGCgVq5Vio7P0DwX3hYiuuAxY78rG1pgSR+mrSgOQfjEz3ac7Aq/MEGYJw D/IX6xdYbSIoeF9ueXDCgTz2GTQWmDI= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-363-WEFcBpmjOo2Bky5oZALk5w-1; Wed, 10 Jun 2020 11:13:41 -0400 X-MC-Unique: WEFcBpmjOo2Bky5oZALk5w-1 Received: by mail-wr1-f71.google.com with SMTP id p9so1217850wrx.10 for ; Wed, 10 Jun 2020 08:13:41 -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:in-reply-to; bh=YfhNq/fazdZ8Eyi5klTe6PYJfVDAk96bmheZ7cnvsnc=; b=Ugo5Zvr9zrk46Wm0/iX7R5ryFNPWaHSH7a1/Ljsw21+6rZn9jM/RNFt/8vHosvg5QL i7sWrf4NAZuoZEzjFMzMEOLK+ieMRQWpMFvgZo2eROBvr1D2BRJdDTrIyqnacCb+A7m2 etIdkFcML2GqkTlwbKIqF0HCiJrDDprrYNA4pEVSk5srPQW+MnGYlJI/5+kEKkJHI4uw tg013oSk/HdSYbq2h6Hs+zM1Yh6cR37EeuQTFBUACbhyvneVFh/URm1yCK3y6mj6PEEa SksmFKDVT7BMBbn1SyuiX9YTTVzhAYDRoA9BuoK+NguXhwJLwc9mHCwe4ucqxLDvpm2d 4mBw== X-Gm-Message-State: AOAM53305JIrOzbSb2mg2ltsAG3iIac3wYeKvgDiWysB/ufedoxk223o VO9zWmOjnm1hVQL5rbIg1r2OgMw24HT9Bvn3yPi5kqTtCddNDg82iOta6j/e3CL4ZhLVpTJN+Mq reneWCx8jzoHtNKax4LZYWkEb X-Received: by 2002:a1c:c3d7:: with SMTP id t206mr3730151wmf.69.1591802020717; Wed, 10 Jun 2020 08:13:40 -0700 (PDT) X-Received: by 2002:a1c:c3d7:: with SMTP id t206mr3730071wmf.69.1591802019527; Wed, 10 Jun 2020 08:13:39 -0700 (PDT) Received: from redhat.com ([212.92.121.57]) by smtp.gmail.com with ESMTPSA id m24sm51095wmi.14.2020.06.10.08.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 08:13:38 -0700 (PDT) Date: Wed, 10 Jun 2020 11:13:36 -0400 From: "Michael S. Tsirkin" To: Eugenio Perez Martin Cc: linux-kernel@vger.kernel.org, kvm list , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Jason Wang Subject: Re: [PATCH RFC v7 03/14] vhost: use batched get_vq_desc version Message-ID: <20200610111147-mutt-send-email-mst@kernel.org> References: <20200610113515.1497099-1-mst@redhat.com> <20200610113515.1497099-4-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 10, 2020 at 02:37:50PM +0200, Eugenio Perez Martin wrote: > > +/* This function returns a value > 0 if a descriptor was found, or 0 if none were found. > > + * A negative code is returned on error. */ > > +static int fetch_descs(struct vhost_virtqueue *vq) > > +{ > > + int ret; > > + > > + if (unlikely(vq->first_desc >= vq->ndescs)) { > > + vq->first_desc = 0; > > + vq->ndescs = 0; > > + } > > + > > + if (vq->ndescs) > > + return 1; > > + > > + for (ret = 1; > > + ret > 0 && vq->ndescs <= vhost_vq_num_batch_descs(vq); > > + ret = fetch_buf(vq)) > > + ; > > (Expanding comment in V6): > > We get an infinite loop this way: > * vq->ndescs == 0, so we call fetch_buf() here > * fetch_buf gets less than vhost_vq_num_batch_descs(vq); descriptors. ret = 1 > * This loop calls again fetch_buf, but vq->ndescs > 0 (and avail_vq == > last_avail_vq), so it just return 1 That's what [PATCH RFC v7 08/14] fixup! vhost: use batched get_vq_desc version is supposed to fix. -- MST