Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1416874pxf; Fri, 19 Mar 2021 06:53:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaNHAFSs3+3WZFiLY5lkWhamgXKPm45j8Asrs0dWS6Dqt3mygnMicCCZ2xlldLgpq5XeIC X-Received: by 2002:aa7:c6da:: with SMTP id b26mr9768155eds.254.1616162039338; Fri, 19 Mar 2021 06:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616162039; cv=none; d=google.com; s=arc-20160816; b=ggAsqEbTxwsfas/vnu/InCefFE3CzaWBF4Diks9GpNtzUfnjgps2d/htN4mfW/tUrf mMEZYbTvLJfUEJxpoEJJiBFaKSPFsoC5LHZeOG+3THNDfDM7JvudpPudE0Uwp+sjVQ+m D8O/b2Ag3OrlUITtBayFtV6eQls3hzyb12n3eFgMjdzAx6pvoGtF9GXrmTTtltN9+W9/ os5N4WqbZKYtZfvJeOCQfF4BKzpCJ3/RuseQEQLMPCqFNWhJeFUstO1nSV2aSqzSGn/a kcag3I1dqipQzJ8D1jZb2Uy9ZTh9IXOG9IW9TWmx4s3y+5RtZw/tM00ioWgosDe4Ap9d 4igQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CQRUYlPssr7tEQfrFmciIthl3TwcqXqF65U6ThZOyFw=; b=Ap6vTlQdNdfmqrnfLwVkD5gH/EpmZKr1wnAqnjEb3vNIg0vBS8CSr+DnT8x66TswCg 7dGEoCJImYQCu4DZNQuTaeoUaPXYs9Cv4rV5HWYMY9EGSs/ZYQvANcBGxJ/WBnOkr/5o Z7pzhjYa4/ea+lpFCOk7jlOd+QQK7k5NCDbEQkqGW8Gn700c2at1TTkTTxNtvXsg+gHO +s6B6fB8YMgK9cZSSOQIvDWxEEfzkhPcQstnSPhXqtbyjka8bi1twuNaCmXW3HR/DIxz tCrPuEdewEuWh68K2H4t17AgU7xoTE4iH1dv0LQ70SFgnjn83owUC3/Ske3x0A5jdRDY b2aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HObBaYPh; 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 n16si4086009edw.216.2021.03.19.06.53.36; Fri, 19 Mar 2021 06:53:59 -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=HObBaYPh; 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 S230002AbhCSNuF (ORCPT + 99 others); Fri, 19 Mar 2021 09:50:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24434 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbhCSNuE (ORCPT ); Fri, 19 Mar 2021 09:50:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616161804; 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=CQRUYlPssr7tEQfrFmciIthl3TwcqXqF65U6ThZOyFw=; b=HObBaYPhnbN1fscreTzcfnZdIE4Ue7Ji8XYmGzutGB4/I/wXfB80KIT7MggmjFwoDKQdTw TIKCJX+ZvIEvw/W90zG7/96AgDa6A4mDiCjrA8zN65xJef8Is0g0kO2j2dnf54WRo8vIwc gv9cz/PjvcIROO3Gjys10be+V+mI4T0= 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-163-ET1b4oiTMxSPbZv3iVMPwA-1; Fri, 19 Mar 2021 09:50:02 -0400 X-MC-Unique: ET1b4oiTMxSPbZv3iVMPwA-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 456C318C89E4; Fri, 19 Mar 2021 13:50:01 +0000 (UTC) Received: from horse.redhat.com (ovpn-114-114.rdu2.redhat.com [10.10.114.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BAAF5C1D1; Fri, 19 Mar 2021 13:49:48 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 16CDD220BCF; Fri, 19 Mar 2021 09:49:48 -0400 (EDT) Date: Fri, 19 Mar 2021 09:49:48 -0400 From: Vivek Goyal To: Connor Kuehl Cc: virtio-fs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, stefanha@redhat.com, miklos@szeredi.hu, jasowang@redhat.com, mst@redhat.com Subject: Re: [PATCH 2/3] virtiofs: split requests that exceed virtqueue size Message-ID: <20210319134948.GA402287@redhat.com> References: <20210318135223.1342795-1-ckuehl@redhat.com> <20210318135223.1342795-3-ckuehl@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210318135223.1342795-3-ckuehl@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 18, 2021 at 08:52:22AM -0500, Connor Kuehl wrote: > If an incoming FUSE request can't fit on the virtqueue, the request is > placed onto a workqueue so a worker can try to resubmit it later where > there will (hopefully) be space for it next time. > > This is fine for requests that aren't larger than a virtqueue's maximum > capacity. However, if a request's size exceeds the maximum capacity of > the virtqueue (even if the virtqueue is empty), it will be doomed to a > life of being placed on the workqueue, removed, discovered it won't fit, > and placed on the workqueue yet again. > > Furthermore, from section 2.6.5.3.1 (Driver Requirements: Indirect > Descriptors) of the virtio spec: > > "A driver MUST NOT create a descriptor chain longer than the Queue > Size of the device." > > To fix this, limit the number of pages FUSE will use for an overall > request. This way, each request can realistically fit on the virtqueue > when it is decomposed into a scattergather list and avoid violating > section 2.6.5.3.1 of the virtio spec. Hi Connor, So as of now if a request is bigger than what virtqueue can support, it never gets dispatched and caller waits infinitely? So this patch will fix it by forcing fuse to split the request. That sounds good. [..] > diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c > index 8868ac31a3c0..a6ffba85d59a 100644 > --- a/fs/fuse/virtio_fs.c > +++ b/fs/fuse/virtio_fs.c > @@ -18,6 +18,12 @@ > #include > #include "fuse_i.h" > > +/* Used to help calculate the FUSE connection's max_pages limit for a request's > + * size. Parts of the struct fuse_req are sliced into scattergather lists in > + * addition to the pages used, so this can help account for that overhead. > + */ > +#define FUSE_HEADER_OVERHEAD 4 How did yo arrive at this overhead. Is it following. - One sg element for fuse_in_header. - One sg element for input arguments. - One sg element for fuse_out_header. - One sg element for output args. Thanks Vivek