All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Christian Schoenebeck <qemu_oss@crudebyte.com>
Cc: virtio-comment@lists.oasis-open.org,
	Cornelia Huck <cohuck@redhat.com>, Greg Kurz <groug@kaod.org>
Subject: Re: [PATCH 2/2] Add common configuration field "queue_indirect_size"
Date: Mon, 21 Feb 2022 10:33:45 +0000	[thread overview]
Message-ID: <YhNqifSTxdOhy5tV@stefanha-x1.localdomain> (raw)
In-Reply-To: <4715621.MooAOXffm5@silver>

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

On Sat, Feb 19, 2022 at 05:36:24PM +0100, Christian Schoenebeck wrote:
> On Montag, 24. Januar 2022 14:53:45 CET Stefan Hajnoczi wrote:
> > On Tue, Dec 14, 2021 at 04:13:17PM +0100, Christian Schoenebeck wrote:
> > > This new common configuration field allows to negotiate a more fine
> > > graded maximum lenght of indirect descriptor chains.
> > > 
> > > Fixes: https://github.com/oasis-tcs/virtio-spec/issues/122
> > > Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> > > ---
> > > 
> > >  content.tex    | 25 ++++++++++++++++++++++++-
> > >  split-ring.tex |  3 +++
> > >  2 files changed, 27 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/content.tex b/content.tex
> 
> Stefan, while preparing the next version of patches for this issue (#122), I 
> noticed that I missed your email here ...
> 
> > > index 0aa4842..e3cfcae 100644
> > > --- a/content.tex
> > > +++ b/content.tex
> > > @@ -859,6 +859,7 @@ \subsubsection{Common configuration structure
> > > layout}\label{sec:Virtio Transport> 
> > >          le64 queue_driver;              /* read-write */
> > >          le64 queue_device;              /* read-write */
> > >          le16 queue_notify_data;         /* read-only for driver */
> > > 
> > > +        le32 queue_indirect_size;       /* read-write */
> > 
> > I see no other unaligned fields in this struct, so I think a le16
> > padding field is needed for safety:
> > 
> >            le64 queue_device;              /* read-write */
> >            le16 queue_notify_data;         /* read-only for driver */
> >   +        le16 reserved;                  /* no access */
> >   +        le32 queue_indirect_size;       /* read-write */
> > 
> 
> That's no longer needed as there's now the new 'queue_reset' field, i.e.:
> 
> diff --git a/content.tex b/content.tex
> index 685525d..da57d5d 100644
> --- a/content.tex
> +++ b/content.tex
> @@ -902,6 +902,7 @@ \subsubsection{Common configuration structure layout}
> \label{sec:Virtio Transport
>          le64 queue_device;              /* read-write */
>          le16 queue_notify_data;         /* read-only for driver */
>          le16 queue_reset;               /* read-write */
> +        le32 queue_indirect_size;       /* read-write */
>  };
>  \end{lstlisting}
> 
> > >  };
> > >  \end{lstlisting}
> > > 
> > > @@ -938,6 +939,16 @@ \subsubsection{Common configuration structure
> > > layout}\label{sec:Virtio Transport> 
> > >          may benefit from providing another value, for example an internal
> > >          virtqueue
> > >          identifier, or an internal offset related to the virtqueue
> > >          number.
> > >          \end{note}
> > > 
> > > +
> > > +\item[\field{queue_indirect_size}]
> > > +        This field is used to negotiate the maximum amount of descriptors
> > > per +        vring slot as in \ref{sec:Basic Facilities of a Virtio
> > > Device / +        Virtqueues / The Virtqueue Descriptor Table / Indirect
> > > Descriptors} if +        and only if the VIRTIO_RING_F_INDIRECT_SIZE
> > > feature has been negotiated. +
> > > +        The device specifies its maximum supported number of descriptors
> > > per +        vring slot. If the driver requires fewer descriptors, it
> > > writes its +        lower value to inform the device of the reduced
> > > resource requirements.
> > "vring slot" is a little vague, it means "indirect descriptor
> > table"? The two paragraphs could use "maximum number of descriptors per
> > indirect descriptor table" instead of referring to vring slots to imply
> > indirect descriptor tables.
> 
> The intended phrasing was intended to reflect that "Queue Indirect Size" is 
> meant to be the *sum* of all indirect descriptors:
> https://lists.oasis-open.org/archives/virtio-comment/202112/msg00008.html
> 
> Just to avoid that I am missing something here; as of now, there can only be 
> two indirect tables per round-trip message, right?

No, just one indirect descriptor table. An indirect descriptor table may
contain both IN and OUT descriptors so it can handle a round-trip
message.

2.6.5.3.1 Driver Requirements: Indirect Descriptors says:

  A driver MUST NOT set both VIRTQ_DESC_F_INDIRECT and VIRTQ_DESC_F_NEXT in flags.

It's unclear whether this statement is referring to 1) one descriptor,
2) to all descriptors in a buffer, or 3) to all descriptors ever made
available by the driver. QEMU's hw/virtio.c:virtqueue_pop() shows that
the interpretation is #2. So if a buffer uses an indirect descriptor
table then it has exactly 1 descriptor in the virtqueue's descriptor
table.

Stefan

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

  reply	other threads:[~2022-02-21 10:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14 15:13 [PATCH 0/2] Add VIRTIO_RING_F_INDIRECT_SIZE and queue_indirect_size Christian Schoenebeck
2021-12-14 15:13 ` [PATCH 1/2] Add VIRTIO_RING_F_INDIRECT_SIZE Christian Schoenebeck
2021-12-14 16:59   ` [virtio-comment] " Cornelia Huck
2021-12-14 18:28     ` Christian Schoenebeck
2021-12-23 10:54       ` Cornelia Huck
2022-01-24 13:08   ` Stefan Hajnoczi
2022-01-24 13:14     ` [virtio-comment] " Cornelia Huck
2022-01-24 14:24       ` Christian Schoenebeck
2021-12-14 15:13 ` [PATCH 2/2] Add common configuration field "queue_indirect_size" Christian Schoenebeck
2021-12-14 17:20   ` [virtio-comment] " Cornelia Huck
2021-12-15 13:59     ` Christian Schoenebeck
2021-12-23 11:03       ` [virtio-comment] " Cornelia Huck
2021-12-29 14:16         ` Christian Schoenebeck
2022-01-03 13:21           ` [virtio-comment] " Cornelia Huck
2022-01-05 13:52             ` Christian Schoenebeck
2022-01-24 13:39               ` [virtio-comment] " Stefan Hajnoczi
2022-01-24 14:31                 ` Christian Schoenebeck
2022-01-24 16:41                   ` Stefan Hajnoczi
2022-01-25 19:05                     ` Christian Schoenebeck
2022-01-26 10:01                       ` Stefan Hajnoczi
2022-01-24 13:53   ` Stefan Hajnoczi
2022-02-19 16:36     ` Christian Schoenebeck
2022-02-21 10:33       ` Stefan Hajnoczi [this message]
2022-02-21 13:28         ` Christian Schoenebeck
2022-01-24 13:54 ` [PATCH 0/2] Add VIRTIO_RING_F_INDIRECT_SIZE and queue_indirect_size 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=YhNqifSTxdOhy5tV@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=groug@kaod.org \
    --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.