OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [virtio-dev] [PATCH] VIRTIO_F_RING_PACKED_USED: packing used descriptors

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


  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

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?

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.


Attachment: signature.asc
Description: PGP signature

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]