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

Re: [Xen-devel] [PATCH v3 07/15] argo: implement the register op



>>> On 15.01.19 at 08:56, <christopher.w.clark@xxxxxxxxx> wrote:
> On Mon, Jan 14, 2019 at 6:19 AM Jan Beulich <JBeulich@xxxxxxxx> wrote:
>> >>> On 07.01.19 at 08:42, <christopher.w.clark@xxxxxxxxx> wrote:
>> > +    /*
>> > +     * A ring must be large enough to transmit messages, so requires 
>> > space for:
>> > +     * * 1 message header, plus
>> > +     * * 1 payload slot (payload is always rounded to a multiple of 16 
>> > bytes)
>> > +     *   for the message payload to be written into, plus
>> > +     * * 1 more slot, so that the ring cannot be filled to capacity with a
>> > +     *   single message -- see the logic in ringbuf_insert -- allowing 
>> > for this
>> > +     *   ensures that there can be space remaining when a message is 
>> > present.
>> > +     * The above determines the minimum acceptable ring size.
>> > +     */
>> > +    if ( (reg.len < (sizeof(struct xen_argo_ring_message_header)
>> > +                      + ROUNDUP_MESSAGE(1) + ROUNDUP_MESSAGE(1))) ||
>>
>> These two summands don't look to fulfill the "cannot be filled to
>> capacity" constraint the comment describes, as (aiui) messages
>> can be larger than 16 bytes. What's the deal?
> 
> This is intended to be about bound checking reg.len against a minimum
> size: the smallest ring that you can fit a message onto, as determined
> by the logic in ringbuf_insert. The smallest message you can send is:
> sizeof(struct xen_argo_ring_message_header) + ROUNDUP_MESSAGE(1)
> 
> and then ringbuf_insert won't accept a message unless there is (at
> least) ROUNDUP_MESSAGE(1) space remaining, so that, plus the smallest
> message size, is the smallest viable ring. There's no point accepting
> registration of a ring smaller than that.
> 
> You're right that messages can be larger than 16 bytes, but they can
> only be sent to rings that are larger than that minimum - on a minimum
> sized ring, they'll be rejected by sendv.

So perhaps the comment wants to say "... cannot be filled to capacity
with a single, minimum size message"?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.