From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: virtio-return-2922-cohuck=redhat.com@lists.oasis-open.org Sender: List-Post: List-Help: List-Unsubscribe: List-Subscribe: References: <1518765602-8739-1-git-send-email-mst@redhat.com> <20180216092412-mutt-send-email-mst@kernel.org> <55eb7e9c-97ee-f7d7-10db-190dd844160d@linux.vnet.ibm.com> <20180226224109-mutt-send-email-mst@kernel.org> <20180227161003-mutt-send-email-mst@kernel.org> From: Halil Pasic Date: Tue, 27 Feb 2018 18:03:01 +0100 MIME-Version: 1.0 In-Reply-To: <20180227161003-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Message-Id: Subject: Re: [virtio] Re: [PATCH v8 08/16] packed virtqueues: more efficient virtqueue layout To: "Michael S. Tsirkin" Cc: virtio@lists.oasis-open.org, virtio-dev@lists.oasis-open.org, Cornelia Huck , Tiwei Bie , Stefan Hajnoczi , "Dhanoa, Kully" List-ID: 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 from this mail list, you must leave the OASIS TC that generates this mail. Follow this link to all your TCs in OASIS at: https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php