qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] hw/virtio/virtio.c: fix the vring_avail_event e


From: Bin Wu
Subject: Re: [Qemu-devel] [PATCH] hw/virtio/virtio.c: fix the vring_avail_event error
Date: Fri, 31 Oct 2014 08:49:35 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 2014/10/31 0:48, Stefan Hajnoczi wrote:
> On Tue, Oct 28, 2014 at 02:13:02AM +0000, Bin Wu wrote:
>> The event idx in virtio is an effective way to reduce the number of
>> interrupts and exits of the guest. When the guest puts an request
>> into the virtio ring, it doesn't exit immediately to inform the
>> backend. Instead, the guest checks the "avail" event idx to determine
>> the notification.
>>
>> In virtqueue_pop, when a request is poped, the current avail event
>> idx should be set to the number of vq->last_avail_idx.
>>
>> Signed-off-by: Bin Wu <address@hidden>
>> ---
>>  hw/virtio/virtio.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
>> index 2c236bf..013979a 100644
>> --- a/hw/virtio/virtio.c
>> +++ b/hw/virtio/virtio.c
>> @@ -469,7 +469,7 @@ int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem)
>>  
>>      i = head = virtqueue_get_head(vq, vq->last_avail_idx++);
>>      if (vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) {
>> -        vring_avail_event(vq, vring_avail_idx(vq));
>> +        vring_avail_event(vq, vq->last_avail_idx);
>>      }
> 
> hw/virtio/dataplane/vring.c:
> 
>   if (vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) {
>       vring_avail_event(&vring->vr) = vring->vr.avail->idx;
>   }
> 
> This is equivalent to the virtio.c code you are replacing, so it should
> be updated too.
> 
> Stefan
> 
Thanks, stefan. I'll send another patch later.
-- 
Bin Wu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]