Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752986AbdHKOJe (ORCPT ); Fri, 11 Aug 2017 10:09:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40998 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752631AbdHKOJc (ORCPT ); Fri, 11 Aug 2017 10:09:32 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5079AC0587D6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. To: "Michael S. Tsirkin" , "Richard W.M. Jones" Cc: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, jasowang@redhat.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, hch@lst.de References: <20170810164035.19963-1-rjones@redhat.com> <20170810164035.19963-2-rjones@redhat.com> <20170811001447-mutt-send-email-mst@kernel.org> <20170810213038.GC20914@redhat.com> <20170811003107-mutt-send-email-mst@kernel.org> <20170810213511.GB10017@redhat.com> <20170811003621-mutt-send-email-mst@kernel.org> From: Paolo Bonzini Message-ID: <64d3c483-076b-1362-b284-30dda704f80c@redhat.com> Date: Fri, 11 Aug 2017 16:09:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170811003621-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 11 Aug 2017 14:09:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 857 Lines: 26 On 10/08/2017 23:41, Michael S. Tsirkin wrote: >>> Then we probably should fail probe if vq size is too small. >> What does this mean? > > We must prevent driver from submitting s/g lists > vq size to device. What is the rationale for the limit? It makes no sense if indirect descriptors are available, especially because... > Either tell linux to avoid s/g lists that are too long, or > simply fail request if this happens, or refuse to attach driver to device. > > Later option would look something like this within probe: > > for (i = VIRTIO_SCSI_VQ_BASE; i < num_vqs; i++) > if (vqs[i]->num < MAX_SG_USED_BY_LINUX) > goto err; > > > I don't know what's MAX_SG_USED_BY_LINUX though. > ... both virtio-blk and virtio-scsi transmit their own value for the maximum sg list size (max_seg in virtio-scsi, seg_max in virtio-blk). Paolo