Skip to contentSkip to conversation

question on virtio

DISCUSSION Michael S. Tsirkin 4 participants 9 messages May 5, 2010 – May 6, 2010

Subsystems (2)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

Hi!
I see this in virtio_ring.c:

/* Put entry in available array (but don't update avail->idx *
until they do sync). */

Why is it done this way?
It seems that updating the index straight away would be simpler, while this might allow the host to specilatively look up the buffer and handle it, without waiting for the kick.

Signature · 1 line
MST
#1 lore raw
Quoted 11 lines · Michael S. Tsirkin

Hi!
I see this in virtio_ring.c:

/* Put entry in available array (but don't update avail->idx *
until they do sync). */

Why is it done this way?
It seems that updating the index straight away would be simpler, while this might allow the host to specilatively look up the buffer and handle it, without waiting for the kick.

It should be okay as long as you don't update idx for partial vectors.

Regards,

Anthony Liguori

#2 lore raw
In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin

Hi!
I see this in virtio_ring.c:

/* Put entry in available array (but don't update avail->idx *
until they do sync). */

Why is it done this way?
It seems that updating the index straight away would be simpler, while this might allow the host to specilatively look up the buffer and handle it, without waiting for the kick.

It should be okay as long as you don't update idx for partial vectors.

Regards,

Anthony Liguori

author maintainer
#3 lore raw
Quoted 13 lines · Anthony Liguori
Quoted 11 lines · Michael S. Tsirkin

Hi!
I see this in virtio_ring.c:

/* Put entry in available array (but don't update avail->idx *
until they do sync). */

Why is it done this way?
It seems that updating the index straight away would be simpler, while this might allow the host to specilatively look up the buffer and handle it, without waiting for the kick.

Quoted 5 lines

It should be okay as long as you don't update idx for partial vectors.

Regards,

Anthony Liguori

Sorry, what do you mean by partial vectors here?

author maintainer
#4 lore raw
In reply to Anthony Liguori
Quoted 13 lines · Anthony Liguori
Quoted 11 lines · Michael S. Tsirkin

Hi!
I see this in virtio_ring.c:

/* Put entry in available array (but don't update avail->idx *
until they do sync). */

Why is it done this way?
It seems that updating the index straight away would be simpler, while this might allow the host to specilatively look up the buffer and handle it, without waiting for the kick.

Quoted 5 lines

It should be okay as long as you don't update idx for partial vectors.

Regards,

Anthony Liguori

Sorry, what do you mean by partial vectors here?

#5 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin

Hi!
I see this in virtio_ring.c:

/* Put entry in available array (but don't update avail->idx *
until they do sync). */

Why is it done this way?
It seems that updating the index straight away would be simpler, while this might allow the host to specilatively look up the buffer and handle it, without waiting for the kick.

I agree. From my TODO:

        what if we actually expose in ->add_buf?

I don't *think* anyone adds buffers without being ready for them to be used, so changing this should be safe.

Want to give it a try and report back?

Thanks!
Rusty.

#6 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin

Hi!
I see this in virtio_ring.c:

/* Put entry in available array (but don't update avail->idx *
until they do sync). */

Why is it done this way?
It seems that updating the index straight away would be simpler, while this might allow the host to specilatively look up the buffer and handle it, without waiting for the kick.

I agree. From my TODO:

        what if we actually expose in ->add_buf?

I don't *think* anyone adds buffers without being ready for them to be used, so changing this should be safe.

Want to give it a try and report back?

Thanks!
Rusty.

#7 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin

Hi!
I see this in virtio_ring.c:

/* Put entry in available array (but don't update avail->idx *
until they do sync). */

Why is it done this way?
It seems that updating the index straight away would be simpler, while this might allow the host to specilatively look up the buffer and handle it, without waiting for the kick.

Even better, if the host updates a location containing which index it has seen recently, you can avoid the kick entirely during sustained flows - just like your recent patch to avoid sending irqs to the guest.

-- Jamie

#8 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin

Hi!
I see this in virtio_ring.c:

/* Put entry in available array (but don't update avail->idx *
until they do sync). */

Why is it done this way?
It seems that updating the index straight away would be simpler, while this might allow the host to specilatively look up the buffer and handle it, without waiting for the kick.

Even better, if the host updates a location containing which index it has seen recently, you can avoid the kick entirely during sustained flows - just like your recent patch to avoid sending irqs to the guest.

-- Jamie