Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753123AbdHJVlu (ORCPT ); Thu, 10 Aug 2017 17:41:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48634 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192AbdHJVls (ORCPT ); Thu, 10 Aug 2017 17:41:48 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7C3B813A95 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=mst@redhat.com Date: Fri, 11 Aug 2017 00:41:47 +0300 From: "Michael S. Tsirkin" To: "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, pbonzini@redhat.com Subject: Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. Message-ID: <20170811003621-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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170810213511.GB10017@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 10 Aug 2017 21:41:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 919 Lines: 28 On Thu, Aug 10, 2017 at 10:35:11PM +0100, Richard W.M. Jones wrote: > On Fri, Aug 11, 2017 at 12:31:44AM +0300, Michael S. Tsirkin wrote: > > Then we probably should fail probe if vq size is too small. > > What does this mean? > > Rich. We must prevent driver from submitting s/g lists > vq size to device. 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. > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-builder quickly builds VMs from scratch > http://libguestfs.org/virt-builder.1.html