From: Stefan Hajnoczi <stefanha@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: mst@redhat.com, virtualization@lists.linux-foundation.org,
virtio-comment@lists.oasis-open.org
Subject: Re: [virtio-comment] Re: virtio-sound linux driver conformance to spec
Date: Tue, 19 Sep 2023 11:10:41 -0400 [thread overview]
Message-ID: <20230919151041.GA1515067@fedora> (raw)
In-Reply-To: <64adaae1-28a6-b175-9fb0-f4f2c26e696e@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 3044 bytes --]
On Tue, Sep 19, 2023 at 08:58:32AM +0200, Paolo Bonzini wrote:
> On 9/19/23 02:35, Anton Yakovlev wrote:
> >
> > If the Linux virtio sound driver violates a specification, then there
> > must be
> > a conformance statement that the driver does not follow. As far as I know,
> > there is no such thing at the moment.
>
> There is one in 2.7.13.3: "The device MAY access the descriptor chains the
> driver created and the memory they refer to immediately"
>
> And likewise for packed virtqueues in 2.8.21.1: "The device MAY access the
> descriptor and any following descriptors the driver created and the memory
> they refer to immediately"
>
> I think it's a mistake to use MAY here, as opposed to "may". This is not an
> optional feature, it's a MUST NOT requirement on the driver's part that
> should be in 2.7.13.3.1 and 2.8.21.1.1.
>
> This does not prevent the virtio-snd spec from overriding this. If an
> override is desirable (for example because other hardware behaves like
> this), there should be a provision in 2.7.13.3.1 and 2.8.21.1.1. For
> example:
>
> 2.7.13.3.1 Unless the device specification specifies otherwise, the driver
> MUST NOT write to the descriptor chains and the memory they refer to,
> between the /idx/ update and the time the device places the driver on the
> used ring.
>
> 2.8.21.1.1 "Unless the device specification specifies otherwise, the driver
> MUST NOT write to the descriptor, to any following descriptors the driver
> created, nor to the memory the refer to, between the /flags/ update and the
> time the device places the driver on the used ring.
>
>
> In the virtio-snd there would be a normative statement like
>
> 5.14.6.8.1.1 The device MUST NOT read from available device-readable
> buffers beyond the first buffer_bytes / period_bytes periods.
>
> 5.14.6.8.1.2 The driver MAY write to device-readable buffers beyond the
> first buffer_bytes / period_bytes periods, even after offering them to the
> device.
>
>
>
> As an aside, here are two other statements that have a similar issue:
>
> - 2.6.1.1.2 "the driver MAY release any resource associated with that
> virtqueue" (instead 2.6.1.1.1 should have something like "After a queue has
> been reset by the driver, the device MUST NOT access any resource associated
> with a virtqueue").
>
> - 2.7.5.1 "[the device] MAY do so for debugging or diagnostic purposes"
> (this is not normative and can be just "may")
The spec should not make an exception for virtio-sound because the
virtqueue model was not intended as a shared memory mechanism. Allowing
it would prevent message-passing implementations of virtqueues.
Instead the device should use Shared Memory Regions:
https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-10200010
BTW, the virtio-sound spec already has VIRTIO_SND_PCM_F_SHMEM_HOST and
VIRTIO_SND_PCM_F_SHMEM_GUEST bits reserved but they currently have no
meaning. I wonder what that was intended for?
Stefan
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 183 bytes --]
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2023-09-19 15:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 15:04 virtio-sound linux driver conformance to spec Matias Ezequiel Vara Larsen
2023-09-13 15:50 ` [virtio-comment] " Paolo Bonzini
2023-09-18 11:13 ` Matias Ezequiel Vara Larsen
2023-09-18 11:26 ` Matias Ezequiel Vara Larsen
[not found] ` <CAAjaMXbjRn27fpZHK982m4MyJGXWQTR99WHPAZQfcun+pe3GBw@mail.gmail.com>
2023-09-18 12:50 ` Matias Ezequiel Vara Larsen
2023-09-18 18:20 ` Stefan Hajnoczi
2023-09-19 0:35 ` Anton Yakovlev via Virtualization
2023-09-19 6:58 ` [virtio-comment] " Paolo Bonzini
2023-09-19 15:10 ` Stefan Hajnoczi [this message]
2023-09-25 0:37 ` Anton Yakovlev via Virtualization
2023-09-25 0:24 ` Anton Yakovlev via Virtualization
2023-09-19 9:43 ` Michael S. Tsirkin
2023-09-19 14:18 ` Matias Ezequiel Vara Larsen
2023-09-19 15:52 ` Michael S. Tsirkin
2023-09-20 13:18 ` Matias Ezequiel Vara Larsen
2023-09-25 1:04 ` Anton Yakovlev via Virtualization
2023-09-25 14:33 ` Matias Ezequiel Vara Larsen
2023-09-25 0:55 ` Anton Yakovlev via Virtualization
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=20230919151041.GA1515067@fedora \
--to=stefanha@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=virtio-comment@lists.oasis-open.org \
--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