>>> On 09.01.18 at 16:43, <sergey.dya...@citrix.com> wrote:
> On Tue, 2018-01-09 at 02:13 -0700, Jan Beulich wrote:
>> > > > On 04.01.18 at 14:06, <wei.l...@citrix.com> wrote:
>> > +size_t consoled_guest_rx(void)
>> > +{
>> > +    size_t recv = 0, idx = 0;
>> > +    XENCONS_RING_IDX cons, prod;
>> > +
>> > +    if ( !cons_ring )
>> > +        return 0;
>> > +
>> > +    spin_lock(&rx_lock);
>> > +
>> > +    cons = cons_ring->out_cons;
>> > +    prod = ACCESS_ONCE(cons_ring->out_prod);
>> > +    ASSERT((prod - cons) <= sizeof(cons_ring->out));
>> > +
>> > +    /* Is the ring empty? */
>> > +    if ( cons == prod )
>> > +        goto out;
>> > +
>> > +    /* Update pointers before accessing the ring */
>> > +    smp_rmb();
>> 
>> I think this need to move up ahead of the if(). In the comment
>> perhaps s/Update/Latch/?
> 
> The read/write memory barriers here are between read/write accesses to
> ring->out_prod and ring->out array. So there is no need to move them.
> (the same goes for the input ring)

And there is no multiple-read issue here?

Jan


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

Reply via email to