public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
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.
Date: Thu, 10 Aug 2017 22:50:12 +0100	[thread overview]
Message-ID: <20170810215012.GD20914@redhat.com> (raw)
In-Reply-To: <20170811003621-mutt-send-email-mst@kernel.org>

On Fri, Aug 11, 2017 at 12:41:47AM +0300, Michael S. Tsirkin wrote:
> 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.

Fair point.  I would have thought (not knowing anything about how this
works in the kernel) that the driver should be able to split up
scatter-gather lists if they are larger than what the driver supports?

Anyway the commit message is derived from what Paolo told me on IRC,
so let's see what he says.

Rich.

> 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

-- 
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

  reply	other threads:[~2017-08-10 21:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10 16:40 [PATCH 0/2] virtio_scsi: Set can_queue based on size of virtqueue Richard W.M. Jones
2017-08-10 16:40 ` [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN Richard W.M. Jones
2017-08-10 16:47   ` Paolo Bonzini
2017-08-10 21:21   ` Michael S. Tsirkin
2017-08-10 21:30     ` Richard W.M. Jones
2017-08-10 21:31       ` Michael S. Tsirkin
2017-08-10 21:35         ` Richard W.M. Jones
2017-08-10 21:41           ` Michael S. Tsirkin
2017-08-10 21:50             ` Richard W.M. Jones [this message]
2017-08-11 14:09             ` Paolo Bonzini
2017-08-11 17:23               ` Michael S. Tsirkin
2017-08-11 18:36                 ` Paolo Bonzini
2017-08-10 16:40 ` [PATCH 2/2] virtio: virtio_scsi: Set can_queue to the length of the virtqueue Richard W.M. Jones
2017-08-10 16:46   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170810215012.GD20914@redhat.com \
    --to=rjones@redhat.com \
    --cc=hch@lst.de \
    --cc=jasowang@redhat.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox