[RFC PATCH] nvme: Always invalidate whole cqes[] array

Michael Nazzareno Trimarchi michael at amarulasolutions.com
Tue Feb 9 12:32:13 CET 2021


Hi Jagan

On Tue, Feb 9, 2021 at 12:28 PM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> On Mon, Feb 8, 2021 at 9:32 PM Andre Przywara <andre.przywara at arm.com> wrote:
> >
> > At the moment nvme_read_completion_status() tries to invidate a single
>
> typo: invalidate
>
> > member of the cqes[] array, which is shady as just a single entry is
> > not cache line aligned.
> > The structure is dictated by hardware, and with 16 bytes is smaller than
> > any cache line we usually deal with. Also multiple entries need to be
> > consecutive in memory, so we can't pad them to cover a whole cache line.
> >
> > As a consequence we can only always invalidate all of them - U-Boot just
> > uses two of them anyway. This is fine, as they are only ever read by the
> > CPU (apart from the initial zeroing), so they can't become dirty.
> >
> > Make this obvious by always invalidating the whole array, regardless of
> > the entry number we are about to read.
> > Also blow up the allocation size to cover whole cache lines, to avoid
> > other heap allocations to sneak in.
> >
> > Signed-off-by: Andre Przywara <andre.przywara at arm.com>
> > ---
> > Hi,
> >
> > this is just compile tested, and should fix the only questionable
> > cache invalidate call in this driver.
> > Please verify if this fixes any issues!
> >
> > Cheers,
> > Andre
> >
> >  drivers/nvme/nvme.c | 16 ++++++++++++----
> >  1 file changed, 12 insertions(+), 4 deletions(-)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn at gmail.com>

Please test again. I don't have the hardware
Reviewed-by: Michael Trimarchi <michael at amarulasolutions.com>




-- 
Michael Nazzareno Trimarchi
Amarula Solutions BV
COO Co-Founder
Cruquiuskade 47 Amsterdam 1018 AM NL
T. +31(0)851119172
M. +39(0)3479132170
[`as] https://www.amarulasolutions.com


More information about the U-Boot mailing list