On 29/11/16 23:34, Stefano Stabellini wrote:
> 
> The producer (the backend for **in**, the frontend for **out**) writes to the
> array in the following way:
> 
- read memory barrier
> - read *cons*, *prod* from shared memory
> - write to array at position *prod* up to *cons*, wrapping around the circular
>   buffer when necessary
- write memory barrier
> - increase *prod*
> - notify the other end via evtchn
> 
> The consumer (the backend for **out**, the frontend for **in**) reads from the
> array in the following way:

- read memory barrier
> - read *prod*, *cons* from shared memory
> - read from array at position *cons* up to *prod*, wrapping around the 
> circular
>   buffer when necessary
> - memory barrier
> - increase *cons*
> - notify the other end via evtchn

Your barriers are wrong (see corrections above).

I think you should use a private copy of cons/prod in the
consumer/producer and use this to validate that the shared prod/cons is
within a sensible range.

You're missing a mechanism to omit unnecessary evtchn notifications
(like the standard ring protocol has).

This all looks like a generic "transfer byte stream" mechanism which
could be usefully made generic and not specific to 9pfs.

David

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to