From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: virtio-comment@lists.oasis-open.org,
virtio-dev@lists.oasis-open.org, virtio@lists.oasis-open.org
Subject: Re: [virtio] Re: [virtio-dev] [PATCH] VIRTIO_F_RING_PACKED_USED: packing used descriptors
Date: Fri, 30 Oct 2020 11:01:10 -0400 [thread overview]
Message-ID: <20201030105945-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20201030113732.GG307361@stefanha-x1.localdomain>
On Fri, Oct 30, 2020 at 11:37:32AM +0000, Stefan Hajnoczi wrote:
> On Thu, Oct 29, 2020 at 03:50:57AM -0400, Michael S. Tsirkin wrote:
> > +When after processing the used descriptor, the batch counter
> > +exceeds the ring size, the batch counter is decremented by the
> > +ring size; both device and driver then skip to the
> > +beginning (offset 0) of the ring until processing (reading for
> > +the driver and writing for the device) the next used descriptor.
>
> This may be clearer:
>
> both device and driver then use ring index 0 for the next used
> descriptor
>
> Or:
>
> The device writes the next used descriptor at ring index 0. The driver
> reads the next used descriptor from ring index 0.
>
> I'm not sure I understand this scheme. Is this pseudo-code correct?
>
> batch_counter += num_used_descs
> if batch_counter > ring_size:
> batch_counter -= ring_size
> used_idx = 0
yes
> Can you share an explanation of how this scheme ensures that the
> driver's next avail descriptor index never overtakes the device's next
> used descriptor index?
Simply because to overtake it, it needs to wrap around to 0.
That happens when batch counter wraps over to 0, if we make
device wrap at that point all is well.
> Previously it was obvious that the two never cross because the used
> descriptor index jumped by the number of avail descriptors that were
> processed by the device.
>
> Stefan
it still does that, just at the time of wrap around, not
after each descriptor.
---------------------------------------------------------------------
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:[~2020-10-30 15:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 7:50 [virtio] [PATCH] VIRTIO_F_RING_PACKED_USED: packing used descriptors Michael S. Tsirkin
2020-10-30 11:37 ` [virtio] Re: [virtio-dev] " Stefan Hajnoczi
2020-10-30 15:01 ` Michael S. Tsirkin [this message]
2020-11-03 17:18 ` Stefan Hajnoczi
2020-11-03 21:42 ` Michael S. Tsirkin
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=20201030105945-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtio-comment@lists.oasis-open.org \
--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 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.