qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: daleyoung4242@gmail.com
To: qemu-level <qemu-devel@nongnu.org>, Sahil <icegambit91@gmail.com>,
	Eugenio Perez Martin <eperezma@redhat.com>
Cc: Stefano Garzarella <sgarzare@redhat.com>
Subject: Re: Intention to work on GSoC project
Date: Tue, 02 Apr 2024 02:23:11 +0800	[thread overview]
Message-ID: <10693205.CDJkKcVGEf@arch> (raw)
In-Reply-To: <8390729.NyiUUSuA9g@valdaarhun>

Hi,

On Monday, March 25, 2024 21:20:32 CST Sahil wrote:
> Q1.
> Section 2.7.4 of the virtio spec [3] states that in an available descriptor,
> the "Element Length" stores the length of the buffer element. In the next
> few lines, it also states that the "Element Length" is reserved for used
> descriptors and is ignored by drivers. This sounds a little contradictory
> given that drivers write available desciptors in the descriptor ring.

When VIRTQ_DESC_F_WRITE is set, the device will use "Element Length" to 
specify the length it writes. When VIRTQ_DESC_F_WRITE is not set, which means 
the buffer is read-only for the device, "Element Length" will not be changed by 
the device, so drivers just ignore it.

> Q2.
> In the Red Hat article, just below the first listing ("Memory layout of a
> packed virtqueue descriptor"), there's the following line referring to the
> buffer id in
> "virtq_desc":
> > This time, the id field is not an index for the device to look for the
> > buffer: it is an opaque value for it, only has meaning for the driver.
> 
> But the device returns the buffer id when it writes the used descriptor to
> the descriptor ring. The "only has meaning for the driver" part has got me
> a little confused. Which buffer id is this that the device returns? Is it
> related to the buffer id in the available descriptor?

In my understanding, buffer id is the element that avail descriptor marks to 
identify when adding descriptors to table. Device will returns the buffer id in 
the processed descriptor or the last descriptor in a chain, and write it to 
the descriptor that used idx refers to (first one in the chain). Then used idx 
increments.

The Packed Virtqueue blog [1] is helpful, but some details in the examples are 
making me confused. 

Q1.
In the last step of the two-entries descriptor table example, it says both 
buffers #0 and #1 are available for the device. I understand descriptor[0] is 
available and descriptor[1] is not, but there is no ID #0 now. So does the 
device got buffer #0 by notification beforehand? If so, does it mean buffer #0 
will be lost when notifications are disabled?

Q2.
If I'm right, the buffer id of the first descriptor in chain will be overwritten 
with the last id. But in Figure: Using another descriptor chain in the last 
step of the chain example, the buffer id of the first descriptor (4th in the 
table) in second chain doesn't change to 1. Is this a typo or I'm wrong?

Thanks,
Dale Young

[1] https://www.redhat.com/en/blog/packed-virtqueue-how-reduce-overhead-virtio





  reply	other threads:[~2024-04-01 18:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-25 21:38 Intention to work on GSoC project Sahil
2024-02-29  8:32 ` Stefano Garzarella
2024-02-29 19:02   ` Sahil
2024-03-01  7:40   ` Eugenio Perez Martin
2024-03-01 18:29     ` Sahil
2024-03-14 15:09       ` Eugenio Perez Martin
2024-03-15  7:14         ` Sahil
2024-03-15 11:27           ` Eugenio Perez Martin
2024-03-16 20:26             ` Sahil
2024-03-18 19:47               ` Sahil
2024-03-20 16:29                 ` Eugenio Perez Martin
2024-03-25 13:20                   ` Sahil
2024-04-01 18:23                     ` daleyoung4242 [this message]
2024-04-02  4:58                       ` Sahil
2024-04-02 11:38                         ` Eugenio Perez Martin
2024-04-03 14:36                           ` Sahil
2024-04-03 18:37                             ` Eugenio Perez Martin
2024-04-04 19:06                               ` Sahil
2024-04-14 18:52                                 ` Sahil
2024-04-15  8:57                                   ` Eugenio Perez Martin
2024-04-15 19:42                                     ` Sahil
2024-04-16  8:41                                       ` Eugenio Perez Martin
2024-04-17  4:23                                         ` Sahil
2024-05-06 19:00                                           ` Sahil
2024-05-07  7:14                                             ` Eugenio Perez Martin
2024-05-08  3:23                                               ` Sahil
2024-05-13 13:49                                                 ` Sahil
2024-05-13 14:23                                                   ` Eugenio Perez Martin
2024-05-13 18:04                                                     ` Sahil
2024-03-20 15:57               ` Eugenio Perez Martin

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=10693205.CDJkKcVGEf@arch \
    --to=daleyoung4242@gmail.com \
    --cc=eperezma@redhat.com \
    --cc=icegambit91@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).