On Wed, Dec 26, 2018 at 12:03:50PM +0800, Jason Wang wrote:
> 
> On 2018/12/26 上午12:41, Michael S. Tsirkin wrote:
> > Hi!
> > I was just wondering: packed ring batches things naturally.
> > E.g.
> > 
> > user_access_begin
> > check descriptor valid
> > smp_rmb
> > copy descriptor
> > user_access_end
> 
> 
> But without speculation on the descriptor (which may only work for in-order
> or even a violation of spec). Only one two access of a single descriptor
> could be batched. For split ring, we can batch more since we know how many
> descriptors is pending. (avail_idx - last_avail_idx).
> 
> Anything I miss?
> 
> Thanks
> 

just check more descriptors in a loop:

 user_access_begin
 for (i = 0; i < 16; ++i) {
         if (!descriptor valid)
                break;
         smp_rmb
         copy descriptor
 }
 user_access_end

you don't really need to know how many there are
ahead of the time as you still copy them 1 by one.


> > 
> > So packed layout should show the gain with this approach.
> > That could be motivation enough to finally enable vhost packed ring
> > support.
> > 
> > Thoughts?
> > 

Reply via email to