Re: Re: [RFC PATCH 01/17] virtio_ring: Avoid reading unneeded used length

From: Yongji Xie
Date: Mon May 17 2021 - 05:41:45 EST


On Mon, May 17, 2021 at 5:12 PM Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote:
>
> On Mon, 2021-05-17 at 17:08 +0800, Xie Yongji wrote:
> > If device driver doesn't need used length, it can pass a NULL
> > len in virtqueue_get_buf()/virtqueue_get_buf_ctx().
> >
>
> Well, actually, it can't right now?
>

Yes.

> You should probably rephrase this, saying something like
>
> Allow passing NULL to len in ... if the device driver doesn't need
> the length, and don't read it in that case.
>
> or so?
>

Looks good to me.

> > Then
> > we can avoid reading and validating the len value in used
> > ring entries.
>
> Not sure what that "validating" is about, I only see reading?
>

The “validating" is actually done in the last patch of this series.
Will remove it.

Thanks,
Yongji