Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1256395imu; Wed, 23 Jan 2019 13:32:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN6MbONAIECKWkNjlIG8hYX63PkrUNVht+nUGJnf+EaAUJybFn3QJWUndOWMyMmXecBqNLpJ X-Received: by 2002:a63:314d:: with SMTP id x74mr3532507pgx.10.1548279143581; Wed, 23 Jan 2019 13:32:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279143; cv=none; d=google.com; s=arc-20160816; b=cVH6gv4jPRK+aeR1501B3a6dIwhzlLu0dhCU9vl2WsBqVzCiTfJTVZU0w/rnkEtoKj YzHd3+n12/tLt1qJ1RDhgoyGGcRjVUVxvhaOOIYf9FkQXvJwAlBWcctJMTOPNgUmmeeV 5Pop1UjW1z8mRz0Uig6oYZV7R/JohT4nKVmJ2k7BIMSe/A+x9BdzmdcIPya0tJlBZEE7 C1pm9GDieQ57N50o4sljPubBftv9Euu1u738dzov39yhKiXHqvJ5jHvKxUtRqYu2nXhI KyIzxmzzzyiVEWaIkdsU0FZ+AIs/CGfOWllVRy9C/Qx75XnQ6RqMMoPfkTC0wSnt6KOK uM7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MdJ7R3f0pFjtTDvXN/f9KNlDzUHW6JhRogfu77xsiVI=; b=K87ExjVcg6CsLk7/bI0efvaDzD1DUshhhrmAAWq8eIj5FqMtpY9Go8VH7KeLGYQXqo omNM0egi+Zcg/Jdl13JJuvW4XSs6F9yrb8YE/Nm8fW62xBVPrvfd1Gfcux/FzRHO86e7 PJ8mwd67RbIst8lN1zzETT/cOq1VNEsCgWx7n4l3AUWaJlIUzDZbkuLhk9nNVEf7IjIn UTBhtfxkELCmgnS/Zdu87nPKlRwEsW7SWnXWgo98IcaKLdY0TGaF5KvtXmLAE4rYymwe Ipg8FxSnFI/WbeXNR1GW4U5n1auN4BqpB46GtBYnmkh7hzT7MnXnSTTMaAPb20HFSIxj 983A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si1764453pgw.294.2019.01.23.13.32.07; Wed, 23 Jan 2019 13:32:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726829AbfAWVbm (ORCPT + 99 others); Wed, 23 Jan 2019 16:31:42 -0500 Received: from verein.lst.de ([213.95.11.211]:45040 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726352AbfAWVbl (ORCPT ); Wed, 23 Jan 2019 16:31:41 -0500 Received: by newverein.lst.de (Postfix, from userid 2407) id C43B768CEC; Wed, 23 Jan 2019 22:31:39 +0100 (CET) Date: Wed, 23 Jan 2019 22:31:39 +0100 From: Christoph Hellwig To: Joerg Roedel Cc: "Michael S . Tsirkin" , Jason Wang , Konrad Rzeszutek Wilk , Christoph Hellwig , Jens Axboe , virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, jfehlig@suse.com, jon.grimm@amd.com, brijesh.singh@amd.com, jroedel@suse.de Subject: Re: [PATCH 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size Message-ID: <20190123213139.GD9032@lst.de> References: <20190123163049.24863-1-joro@8bytes.org> <20190123163049.24863-6-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190123163049.24863-6-joro@8bytes.org> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 23, 2019 at 05:30:49PM +0100, Joerg Roedel wrote: > + max_size = virtio_max_dma_size(vdev); > + > /* Host can optionally specify maximum segment size and number of > * segments. */ > err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SIZE_MAX, > struct virtio_blk_config, size_max, &v); > if (!err) > - blk_queue_max_segment_size(q, v); > - else > - blk_queue_max_segment_size(q, -1U); > + max_size = min(max_size, v); > + > + blk_queue_max_segment_size(q, max_size); I wonder if we should just move the dma max segment size check into blk_queue_max_segment_size so that all block drivers benefit from it. Even if not I think at least the SCSI midlayer should be updated to support it. Btw, I wonder why virtio-scsi sticks to the default segment size, unlike virtio-blk.