From: "Michael S. Tsirkin" <mst@redhat.com>
To: Halil Pasic <pasic@linux.vnet.ibm.com>
Cc: virtio@lists.oasis-open.org, virtio-dev@lists.oasis-open.org,
Cornelia Huck <cohuck@redhat.com>,
Tiwei Bie <tiwei.bie@intel.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Dhanoa, Kully" <kully.dhanoa@intel.com>
Subject: [virtio] Re: [virtio-dev] Re: [virtio] Re: [PATCH v8 08/16] packed virtqueues: more efficient virtqueue layout
Date: Thu, 1 Mar 2018 00:10:48 +0200 [thread overview]
Message-ID: <20180301000823-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <fc26698d-e214-9285-0482-cb6db9acada8@linux.vnet.ibm.com>
On Tue, Feb 27, 2018 at 06:03:01PM +0100, Halil Pasic wrote:
>
>
> On 02/27/2018 03:11 PM, Michael S. Tsirkin wrote:
> >> [..]
> >>>>> +
> >>>>> +\devicenormative{\subsection}{The Virtqueue Descriptor Table}{Basic Facilities of a Virtio Device / Packed Virtqueues / The Virtqueue Descriptor Table}
> >>>>> +A device MUST NOT write to a device-readable buffer, and a device SHOULD NOT
> >>>>> +read a device-writable buffer.
> >>>>> +A device MUST NOT use a descriptor unless it observes
> >>>>> +VIRTQ_DESC_F_AVAIL bit in its \field{flags} being changed.
> >>>> I don't really understand this. How does the device observe
> >>>> the VIRTQ_DESC_F_AVAIL bit being changed?
> >>> By reading the descriptor.
> >>>
> >> :) My point is: to observe a change one usually either needs at
> >> least one reading before and at least one reading after the change,
> >> or one needs to know that a certain reading means change. The latter
> >> is possible if we know that at the beginning of the time frame under
> >> consideration (t_0) only a certain set of values,let's say B like before,
> >> is possible, and after the change only a certain other set of values
> >> let's say A like after, is possible, and A and B are disjunctive (
> >> $A \cap B = \emtyset$).
> > Well each descriptor is read each time ring wraps around,
> > and the bit value changes each time ring wraps around.
> > For example device knows it's zero initialized so
> > if it reads bit value as 1 it knows the bit value has changed.
> >
> >
>
> Yeah I kind of understand but I would like having a more straightforward
> formulation here (than changes).
>
> BTW does this mean that the vhost implementation (that is:
>
> +static bool desc_is_avail(struct vhost_virtqueue *vq,
> + struct vring_desc_packed *desc)
> +{
> + if (vq->used_wrap_counter)
> + if ((desc->flags & DESC_AVAIL) && !(desc->flags & DESC_USED))
> + return true;
> + if (vq->used_wrap_counter == false)
> + if (!(desc->flags & DESC_AVAIL) && (desc->flags & DESC_USED))
> + return true;
> +
> + return false;
> +}
>
> ) is needlessly looking at the 'used' bit? (I think that is the case.)
>
> Bottom line is: I would like avail/used protocol described in a less
> ambiguous fashion.
>
> However if I'm the only one who finds this aspect hard to understand,
> the problem probably lies with me and not with the text. I can accept
> that too.
I don't want to over-specify it. There are many options.
For example, if driver sets ID to a value != 0 then
when it sees ID != 0 it knows it has been used.
I added pseudo-code for the driver, hopefully that is sufficient.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that
generates this mail. Follow this link to all your TCs in OASIS at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
next prev parent reply other threads:[~2018-02-28 22:10 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1518765602-8739-1-git-send-email-mst@redhat.com>
2018-02-16 7:21 ` [PATCH v8 01/16] content: move 1.0 queue format out to a separate section Michael S. Tsirkin
2018-02-16 7:21 ` [PATCH v8 02/16] content: move ring text out to a separate file Michael S. Tsirkin
2018-02-16 7:21 ` [PATCH v8 03/16] content: move virtqueue operation description Michael S. Tsirkin
2018-02-16 7:22 ` [PATCH v8 04/16] content: replace mentions of len with used length Michael S. Tsirkin
2018-02-16 16:35 ` [virtio] " Cornelia Huck
2018-02-16 7:22 ` [PATCH v8 05/16] content: generalize transport ring part naming Michael S. Tsirkin
2018-02-16 7:24 ` [PATCH v8 08/16] packed virtqueues: more efficient virtqueue layout Michael S. Tsirkin
2018-02-16 17:01 ` [virtio] " Cornelia Huck
2018-02-24 5:17 ` [virtio-dev] " Tiwei Bie
2018-02-25 18:49 ` [virtio] " Michael S. Tsirkin
2018-02-26 10:51 ` [virtio-dev] " Tiwei Bie
2018-02-26 20:38 ` [virtio] " Michael S. Tsirkin
2018-02-27 1:49 ` Tiwei Bie
2018-02-27 20:17 ` [virtio] " Michael S. Tsirkin
2018-02-28 9:19 ` Tiwei Bie
2018-02-28 15:20 ` [virtio] " Michael S. Tsirkin
2018-02-28 16:09 ` Cornelia Huck
2018-02-28 20:35 ` Michael S. Tsirkin
2018-02-26 17:19 ` [virtio] " Halil Pasic
2018-02-26 21:05 ` Michael S. Tsirkin
2018-02-27 10:23 ` [virtio-dev] " Jens Freimann
2018-02-27 11:29 ` [virtio] " Halil Pasic
2018-02-28 13:42 ` Jens Freimann
2018-02-28 13:59 ` [virtio] " Halil Pasic
2018-02-28 15:40 ` Michael S. Tsirkin
2018-02-28 16:29 ` Halil Pasic
2018-02-28 22:03 ` Michael S. Tsirkin
2018-02-28 22:01 ` Michael S. Tsirkin
2018-02-27 11:53 ` [virtio] " Halil Pasic
2018-02-27 14:11 ` Michael S. Tsirkin
2018-02-27 17:03 ` Halil Pasic
2018-02-28 13:25 ` [virtio-dev] " Jens Freimann
2018-02-28 22:10 ` Michael S. Tsirkin [this message]
2018-02-16 7:24 ` [PATCH v8 09/16] content: in-order buffer use Michael S. Tsirkin
2018-02-16 7:25 ` [PATCH v8 10/16] packed-ring: add in order support Michael S. Tsirkin
2018-02-16 7:25 ` [PATCH v8 11/16] split-ring: in order feature Michael S. Tsirkin
2018-02-16 7:25 ` [PATCH v8 12/16] makediff: update to show diff from master Michael S. Tsirkin
2018-02-16 16:45 ` [virtio] " Cornelia Huck
2018-02-16 7:26 ` [PATCH v8 13/16] REVISION: set to 1.1 wd07 Michael S. Tsirkin
2018-02-16 7:26 ` [PATCH v8 14/16] VIRTIO_F_NOTIFICATION_DATA: extra data to devices Michael S. Tsirkin
2018-02-16 17:00 ` [virtio] " Cornelia Huck
2018-02-16 7:26 ` [PATCH v8 15/16] conformance: link the new conformance clause Michael S. Tsirkin
2018-02-16 16:46 ` [virtio] " Cornelia Huck
2018-02-16 7:27 ` [PATCH v8 16/16] REVISION: set for packed-wd07.pdf Michael S. Tsirkin
2018-02-16 16:47 ` [virtio] " Cornelia Huck
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=20180301000823-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=cohuck@redhat.com \
--cc=kully.dhanoa@intel.com \
--cc=pasic@linux.vnet.ibm.com \
--cc=stefanha@redhat.com \
--cc=tiwei.bie@intel.com \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtio@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox