On 02/27/2018 03:11 PM, Michael S. Tsirkin wrote:
>> [..]
>>>>> +
>>>>> +\devicenormative{\subsection}{The Virtqueue Descriptor Table}{Basic
>>>>> Facilities of a Virtio Device / Packed Virtqueues / The Virtqueue
>>>>> Descriptor Table}
>>>>> +A device MUST NOT write to a device-readable buffer, and a device SHOULD
>>>>> NOT
>>>>> +read a device-writable buffer.
>>>>> +A device MUST NOT use a descriptor unless it observes
>>>>> +VIRTQ_DESC_F_AVAIL bit in its \field{flags} being changed.
>>>> I don't really understand this. How does the device observe
>>>> the VIRTQ_DESC_F_AVAIL bit being changed?
>>> By reading the descriptor.
>>>
>> :) My point is: to observe a change one usually either needs at
>> least one reading before and at least one reading after the change,
>> or one needs to know that a certain reading means change. The latter
>> is possible if we know that at the beginning of the time frame under
>> consideration (t_0) only a certain set of values,let's say B like before,
>> is possible, and after the change only a certain other set of values
>> let's say A like after, is possible, and A and B are disjunctive (
>> $A \cap B = \emtyset$).
> Well each descriptor is read each time ring wraps around,
> and the bit value changes each time ring wraps around.
> For example device knows it's zero initialized so
> if it reads bit value as 1 it knows the bit value has changed.
>
>
Yeah I kind of understand but I would like having a more straightforward
formulation here (than changes).
BTW does this mean that the vhost implementation (that is:
+static bool desc_is_avail(struct vhost_virtqueue *vq,
+ struct vring_desc_packed *desc)
+{
+ if (vq->used_wrap_counter)
+ if ((desc->flags & DESC_AVAIL) && !(desc->flags & DESC_USED))
+ return true;
+ if (vq->used_wrap_counter == false)
+ if (!(desc->flags & DESC_AVAIL) && (desc->flags & DESC_USED))
+ return true;
+
+ return false;
+}
) is needlessly looking at the 'used' bit? (I think that is the case.)
Bottom line is: I would like avail/used protocol described in a less
ambiguous fashion.
However if I'm the only one who finds this aspect hard to understand,
the problem probably lies with me and not with the text. I can accept
that too.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]