[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] virtIO question
From: |
jack |
Subject: |
Re: [Qemu-devel] virtIO question |
Date: |
Fri, 11 Nov 2016 22:17:02 +0800 |
thanks,but i really do not found when the driver will add mutiple
buffers then call kick function,this is the key problem .
æ�¥è‡ª é…æ—� MX5
-------- 原始邮件 --------
�件人:Stefan Hajnoczi <address@hidden>
时间:周五 11月11日 20:03
address@hidden
抄�:qemu <address@hidden>
主题:Re: Re: [Qemu-devel] virtIO question
On Thu, Nov 10, 2016 at 08:16:38PM +0800, address@hidden wrote:
> From this point of view ,I think it make sense well, thank you very
much!
> but I have another question about notify mechanism between virtIO
driver and qemu.
> according the source code of Linux and qemu,
> when driver add a sg buffer to send queue named sq,
> sq->vq->vring.avail->idx++
> vq->num_added++
> and then use virtqueue_kick_prepare to make sure if need notify qemu.
> it (new_idx-event_idx)<(new_idx-old_idx)
This expression is wrong. The specification and Linux code both say:
(u16)(new_idx - event_idx - 1) < (u16)(new_idx - old_idx)
Both the (u16) and the -1 matter. Maybe that's why you are confused by
this?
> if it is true,then notify other side.
> However,every time driver add a sg,then virtqueue_kick_prepare is
called,and vq->num_added is reseted to 0,so in fact ,I think
vq->num_added is always 0 or 1。
A driver may add multiple buffers to the virtqueue by calling
virtqueue_add_sgs() or similar functions multiple times before kicking.
Therefore vq->num_added > 1 is possible.
> as to qemu side,every time when pop a elem from virtqueue,it set
VRingUsed.ring[vring.num] to the lastest VRingAvail.idx, this according
the arithmetic ((new_idx-event_idx)<(new_idx-old_idx)),it seems that
this mechanism does not make sense
You are basically asking "how does event_idx work?". The specification
says:
"The driver can ask the device to delay interrupts until an entry
with
an index specified by the “used_event� field is written in the
used ring
(equivalently, until the idx field in the used ring will reach the
value used_event + 1)."
and:
"The device can ask the driver to delay noti�cations until an entry
with an index specified by the “avail_event� field is written in
the
available ring (equivalently, until the idx field in the used ring
will
reach the value avail_event + 1)."
Whenever the device or driver wants to notify, it first checks if the
index update crossed the event index set by the other side.
signature.asc
Description: Binary data
- Re: [Qemu-devel] virtIO question, (continued)
- Re: [Qemu-devel] virtIO question, Peter Maydell, 2016/11/05
- Re: [Qemu-devel] virtIO question, jitendra kumar khasdev, 2016/11/05
- Re: [Qemu-devel] virtIO question, address@hidden, 2016/11/09
- Re: [Qemu-devel] virtIO question, Stefan Hajnoczi, 2016/11/10
- Re: [Qemu-devel] virtIO question, address@hidden, 2016/11/10
- Re: [Qemu-devel] virtIO question, Stefan Hajnoczi, 2016/11/11
- Re: [Qemu-devel] virtIO question, address@hidden, 2016/11/12
- Re: [Qemu-devel] virtIO question, Stefan Hajnoczi, 2016/11/14
- Re: [Qemu-devel] virtIO question, address@hidden, 2016/11/14
Re: [Qemu-devel] virtIO question, jack, 2016/11/05
Re: [Qemu-devel] virtIO question,
jack <=
[Qemu-devel] virtIO question, address@hidden, 2016/11/14