Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1737082imu; Thu, 24 Jan 2019 00:40:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN6HFJqx4WdY4HQRTQflLVlKkaV0z30qZB4y3Rl7QiLSuiUQp82BQBezKKLQZqyd5vmPttLR X-Received: by 2002:a17:902:f091:: with SMTP id go17mr5806215plb.235.1548319237436; Thu, 24 Jan 2019 00:40:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548319237; cv=none; d=google.com; s=arc-20160816; b=z3djsXLwGcJdvD9qsmzI5P8WGbPbwvMLui093jmo3eTnu/Kv9U2wDJn3DXCRhLA+1C OxuWBII7HZIZJjuJhukNTt6R+u8CwW15zCVs38plm+Zd+oSimBW9VrLF1WcwCHkkAaVF qvucpsQbZvWsH/rePi0Tvmf/PEdEQD7p6TME2HbXSB3bddzUBYp1eR090ATVmPuBDgwB ptoeI+LT9Ryk9QDCeqCg/jNgg8HllxruQ4fdmtS9tLlkwYaH4qH1Mp7s7kdOtouhiek6 KQMVxBV8I6Mhc7v0kJYziuc4+d5D1OKRotB2zxDMOLeKrQYUeusztSbRktqFKbayTIIu RKfQ== 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=9g6R6VdVoy1fCnPPj+1LYL0JHVFpriQQicPIEtwov3Q=; b=kjTm/UKNEVo/zqeM5daFgBqG62cbhliaFe32cngPrJ+UQE9+2TZueISegLGN9G4M/d yG09jH4KSe/3aGIXWfwwb+2rsF+hWT1uOfTqj+VEJTSYPjmpgQZj68bLQbXI5QDBDo1A KuNViNdiSEocirfXWrbHpqyuxeVX3e7owVfkaSGIJ96lOxYpYzc9G5lL2UcKnnCxM7g+ A10W7HXmedFB7GeCC/DTs5ZKobz8ECMWISB2snyP2DrV+rxMSqpCngY12PlLHKHw8QNh 8hAd0Z9RjlRPPlcuQr+GQaP4EsLYk1RQW60cxxlbRn2DhO1BLI9yKZA90kbWtYEso9Fn iYfw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 73si2491011pfm.50.2019.01.24.00.40.19; Thu, 24 Jan 2019 00:40:37 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727128AbfAXIkO (ORCPT + 99 others); Thu, 24 Jan 2019 03:40:14 -0500 Received: from 8bytes.org ([81.169.241.247]:59470 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbfAXIkN (ORCPT ); Thu, 24 Jan 2019 03:40:13 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id A74AB3C8; Thu, 24 Jan 2019 09:40:11 +0100 (CET) Date: Thu, 24 Jan 2019 09:40:11 +0100 From: Joerg Roedel To: Christoph Hellwig Cc: "Michael S . Tsirkin" , Jason Wang , Konrad Rzeszutek Wilk , 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: <20190124084011.GJ32526@8bytes.org> References: <20190123163049.24863-1-joro@8bytes.org> <20190123163049.24863-6-joro@8bytes.org> <20190123213139.GD9032@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190123213139.GD9032@lst.de> User-Agent: Mutt/1.9.4 (2018-02-28) 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 10:31:39PM +0100, Christoph Hellwig wrote: > 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. In that case the limit would also apply to virtio-blk even if it doesn't use the DMA-API. If that is acceptable we can move the check to blk_queue_max_segment_size(). Regards, Joerg