Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753240AbdHKRYH (ORCPT ); Fri, 11 Aug 2017 13:24:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56814 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752723AbdHKRYG (ORCPT ); Fri, 11 Aug 2017 13:24:06 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EB5F517D0A9 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=mst@redhat.com Date: Fri, 11 Aug 2017 20:23:58 +0300 From: "Michael S. Tsirkin" To: Paolo Bonzini Cc: "Richard W.M. Jones" , 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 Subject: Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. Message-ID: <20170811201843-mutt-send-email-mst@kernel.org> 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> <64d3c483-076b-1362-b284-30dda704f80c@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <64d3c483-076b-1362-b284-30dda704f80c@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 11 Aug 2017 17:24:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1307 Lines: 43 On Fri, Aug 11, 2017 at 04:09:26PM +0200, Paolo Bonzini wrote: > 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? So the host knows what it needs to support. > 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 No other device has it, and it seemed like a good idea to limit it generally at the time. we can fix the spec to relax the requirement for blk and scsi - want to submit a proposal? Alternatively, add a generic field for that. For a quick fix, make sure vq size is >= max sg. -- MST