Hi Maxime,
> >
> > +   if (unlikely(vq == NULL)) {
> > +           VC_LOG_ERR("Invalid virtqueue %u", qid);
> > +           return 0;
> > +   }
> > +
> > +   if (unlikely(vq->avail == NULL)) {
> > +           VC_LOG_DBG("Virtqueue ring not yet initialized %u", qid);
> > +           return 0;
> > +   }
> > +
> 
> I think the proper fix to:
> 1. acquire the access_lock as reader
> 2. check whether vq is enabled
> 3. acquire the iotlb lock as a reader
> 4. check vq's access_ok
> 

Ack. Except for vq->enabled, next version of this patch would carry these 
checks.
Current virtio crypto for vhost_user does not request SET_VRING_ENABLE, so this 
flag would not be set.

Thanks,
Gowrishankar

> You can have a look at rte_vhost_dequeue_burst for example.
> 
> >     avail_idx = *((volatile uint16_t *)&vq->avail->idx);
> >     start_idx = vq->last_used_idx;
> >     count = avail_idx - start_idx;

Reply via email to