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

Suniel Mahesh sunil at amarulasolutions.com
Fri Feb 26 17:26:42 CET 2021


On Fri, Feb 26, 2021 at 8:12 PM Jagan Teki <jagan at amarulasolutions.com> wrote:
>
> Hi Suniel,
>
> On Mon, Feb 8, 2021 at 7:02 PM Andre Przywara <andre.przywara at arm.com> wrote:
> >
> > At the moment nvme_read_completion_status() tries to invidate a single
> > 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!
>
> Can you test this on RK3399?

Hi Jagan/All

Here are the test results after applying this patch on mainline. The
patch has been tested on
roc-rk3399-pc an RK3399 based SBC. It looks fine, below is the log:

U-Boot TPL 2021.04-rc2-00169-g958c213e3f (Feb 26 2021 - 21:38:32)
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2021.04-rc2-00169-g958c213e3f (Feb 26 2021 - 21:38:32 +0530)
Loading Environment from SPIFlash... *** Warning -
spi_flash_probe_bus_cs() failed, using default environment

Trying to boot from MMC1

U-Boot 2021.04-rc2-00169-g958c213e3f (Feb 26 2021 - 21:38:32 +0530)

SoC: Rockchip rk3399
Reset cause: POR
Model: Firefly ROC-RK3399-PC Mezzanine Board
DRAM:  3.9 GiB
PMIC:  RK808
MMC:   mmc at fe310000: 2, mmc at fe320000: 1, sdhci at fe330000: 0
Loading Environment from SPIFlash... jedec_spi_nor flash at 0:
unrecognized JEDEC id bytes: ff, ff, ff
*** Warning - spi_flash_probe_bus_cs() failed, using default environment

In:    serial
Out:   serial
Err:   serial
Model: Firefly ROC-RK3399-PC Mezzanine Board
Net:
Error: ethernet at fe300000 address not set.
No ethernet found.

Hit any key to stop autoboot:  0
=>
=>
=> pci
Scanning PCI devices on bus 0
BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
_____________________________________________________________
00.00.00   0x1d87     0x0100     Bridge device           0x04

=> nvme scan

=> nvme info
Device 0: Vendor: 0x15b7 Rev: 21110001 Prod: 2031C2440521
            Type: Hard Disk
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)
=> nvme device

IDE device 0: Vendor: 0x15b7 Rev: 21110001 Prod: 2031C2440521
            Type: Hard Disk
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)


Tested-by: Suniel Mahesh <sunil at amarulasolutions.com>

>
> Jagan.


More information about the U-Boot mailing list