All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Christian Schoenebeck <qemu_oss@crudebyte.com>,
	"Afsa, Baptiste" <Baptiste.Afsa@harman.com>,
	Eugenio Perez Martin <eperezma@redhat.com>,
	"virtio-comment@lists.oasis-open.org"
	<virtio-comment@lists.oasis-open.org>
Subject: [virtio-comment] Re: VIRTIO_RING_F_INDIRECT_SIZE status
Date: Mon, 6 Mar 2023 15:46:01 -0500	[thread overview]
Message-ID: <20230306204601.GC78491@fedora> (raw)
In-Reply-To: <20230306124013-mutt-send-email-mst@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 4884 bytes --]

On Mon, Mar 06, 2023 at 12:41:25PM -0500, Michael S. Tsirkin wrote:
> On Mon, Mar 06, 2023 at 04:00:37PM +0100, Christian Schoenebeck wrote:
> > On Wednesday, March 1, 2023 3:55:57 PM CET Michael S. Tsirkin wrote:
> > > On Wed, Mar 01, 2023 at 01:55:14PM +0100, Christian Schoenebeck wrote:
> > > >   2.8 Packed Virtqueues
> > > >   ...
> > > >   2.8.5 Scatter-Gather Support [1]
> > > >   ...
> > > >   While unusual (most implementations either create all lists solely using   
> > > >   non-indirect descriptors, or always use a single indirect element), if both 
> > > >   features have been negotiated, mixing indirect and non-indirect descriptors 
> > > >   in a ring is valid, as long as each list only contains descriptors of a 
> > > >   given type.
> > > > 
> > > >   [1] https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1-770005
> > > > 
> > > > To avoid misapprehensions: the way I understand it, same restrictions apply to
> > > > packed queues as split queues, in the sense that you may neither chain several
> > > > tables in a single message, nor multi-level nest tables, nor mix a list of
> > > > direct descriptors and indirect descriptors on the same level within one
> > > > message. So the explicit exception described here, only means you may use
> > > > *one* indirect table in one message, while using chained direct descriptors in
> > > > another message. But that's it, right?
> > > 
> > > 
> > > That's my understanding.
> > > 
> > > > > 2. Given this is a lot of work I am trying to find a way to
> > > > > make the impact bigger. In particular to cover the use-case
> > > > > of limiting s/g to 1k while making queues deeper (with
> > > > > or without indirect). For this I proposed:
> > > > > 
> > > > > 	So I think that given this, we can limit the total number
> > > > > 	of non-indirect descriptors, including non-indirect ones
> > > > > 	in a chain + all the ones in indirect pointer table if any,
> > > > > 	and excluding the indirect descriptor itself, and this
> > > > > 	will address the issue you are describing here, right?
> > > > > 
> > > > > people seemed to be ok with this idea?
> > > > 
> > > > IIUIC it would not make a difference from design perspective from what I
> > > > proposed, as virtio currently neither allows to mix, chain or mult-level nest
> > > > indirect descriptor tables within a single message), and hence it would just
> > > > boil down to adjusting the wording. So yes, it would therefore cover my
> > > > intended use case.
> > > > 
> > > > Best regards,
> > > > Christian Schoenebeck
> > > 
> > > 
> > > Sounds good to me. One interesting case is scsi and blk which have
> > > a seg_max field. This is defined as
> > > 
> > > \item[\field{seg_max}] is the maximum number of segments that can be in a
> > >     command. A bidirectional command can include \field{seg_max} input
> > >     segments and \field{seg_max} output segments.
> > > 
> > > it is never explained what *are* the segments, or how does it
> > > interact with VQ depth. Current drivers interpret this
> > > strictly and assume that this limits the s/g length but does not
> > > allow you to exceed vq size.
> > > 
> > > Do we thus want two limits (for read and write descriptors)?
> > 
> > No opinion on that, as my intended use case was just extending the buffer size
> > beyond queue size, not limiting it below queue size. Either way is fine with
> > me.
> > 
> > Anyhow, as this now gets broader scope, that also means the suggested flag
> > VIRTIO_RING_F_INDIRECT_SIZE needs to be renamed. VIRTIO_RING_F_BUFFER_SIZE?
> > 
> > Best regards,
> > Christian Schoenebeck
> 
> 
> Hmm that's unclear in that it might be in bytes too.
> Given blk and scsi call these "segments" how about
> VIRTIO_RING_F_SEG_MAX?

The VIRTIO equivalent of a "segment" is an "element". I don't think the
term "segment" is needed at the VIRTIO device model level since there is
already a word for it.

I'm confused because VIRTIO_RING_F_BUFFER_SIZE and VIRTIO_RING_F_SEG_MAX
mean different things to me and have different units (bytes vs number of
segments).

I wouldn't worry about virtio-blk/scsi seg_max. Although the segments
map to virtqueue elements, seg_max has a specific SCSI/block level
meaning related to data transfer and is not about constraints that apply
to all virtqueue requests. I/O requests have headers/footers, so they
can actually consume more elements than seg_max. Also, there could be
non-data transfer requests that happen to consume more than seg_max and
the storage controller would be happy with that (e.g. because VIRTIO
mandates flexible framing so you could break a request into 1-byte
elements). It's confusing the talk about seg_max at the VIRTIO device
model level - it's not about virtqueues at all.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2023-03-06 20:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13  7:45 [virtio-comment] [PATCH] Introduce VIRTIO_F_ISOLATE_INDIRECT_DESC feature Baptiste Afsa
2023-01-13 12:46 ` Michael S. Tsirkin
2023-01-17 15:19   ` Afsa, Baptiste
2023-01-17 18:27     ` Eugenio Perez Martin
2023-02-27 14:53       ` Afsa, Baptiste
2023-02-27 15:45         ` Stefan Hajnoczi
     [not found]           ` <2244126.gP0zCk8Q6A@silver>
2023-02-27 17:41             ` [virtio-comment] Re: VIRTIO_RING_F_INDIRECT_SIZE status Michael S. Tsirkin
     [not found]               ` <2494182.5W6NY9sLyD@silver>
2023-02-28 12:05                 ` Michael S. Tsirkin
     [not found] ` <6380471.4BWXO1n1mU@silver>
     [not found]   ` <Y/9Z5fphn34/HSKs@fedora>
     [not found]     ` <2458440.T3bEdP9vpG@silver>
2023-03-06 16:27       ` Stefan Hajnoczi
     [not found]   ` <20230301095017-mutt-send-email-mst@kernel.org>
     [not found]     ` <2812377.Px9Efocobp@silver>
2023-03-06 17:41       ` Michael S. Tsirkin
2023-03-06 20:46         ` Stefan Hajnoczi [this message]
2023-03-06 21:50           ` Michael S. Tsirkin
2023-03-07 12:40             ` Christian Schoenebeck
2023-03-13 11:48               ` Christian Schoenebeck
2023-03-13 13:06                 ` Michael S. Tsirkin
2023-03-13 13:48                   ` Christian Schoenebeck
2023-03-13 13:54                     ` Michael S. Tsirkin
2023-03-07 13:26             ` Stefan Hajnoczi
2023-03-07 16:47               ` Michael S. Tsirkin
2023-03-07 19:35                 ` Stefan Hajnoczi

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=20230306204601.GC78491@fedora \
    --to=stefanha@redhat.com \
    --cc=Baptiste.Afsa@harman.com \
    --cc=eperezma@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu_oss@crudebyte.com \
    --cc=virtio-comment@lists.oasis-open.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.