RE: starfive crypto list_add corruption

From: JiaJie Ho
Date: Thu Aug 31 2023 - 22:40:02 EST


Hi Aurelian/Conor,

Thanks for bringing this up.

> On 2023-08-30 11:26, Conor Dooley wrote:
> > Hi,
> >
> > There's been a report on the irc fedora-riscv irc of list_add
> > corruption with the starfive crypto stuff:
> > list_add corruption. next->prev should be prev (ffffffff02f65320), but
> was ffffffd8eef15848. (next=ffffffd8eef15840).
> > ------------[ cut here ]------------
> > kernel BUG at lib/list_debug.c:29!
> > Kernel BUG [#1]
>
> [snip]
>
> > I feel like this isn't the first report I saw, but the other might've
> > been for the equivalent driver in the vendor tree & I probably didn't
> > pay any attention to.
>
> I got this issue, if I remember correctly, I fixed it by enabling
> CONFIG_ARM_AMBA and CONFIG_AMBA_PL08X. It improved things a bit,

Thanks for bringing this up.
I'll submit a patch to fix the Kconfig dependencies.

> but now the driver is still not functional and instead I get this kind of trace
> appearing during the self test of the driver:
>
> ------------[ cut here ]------------
> WARNING: CPU: 3 PID: 292 at crypto/api.c:176
> crypto_wait_for_test+0x8e/0x92 Modules linked in: nvme_fabrics ad7418
> binfmt_misc jh7110_tdm snd_soc_core snd_pcm_dmaengine ofpart spi_nor
> snd_pcm starfive_wdt mtd watchdog jh7110_crypto(+) snd_timer
> jh7110_trng crypto_engine rng_core snd soundcore sfctemp cpufreq_dt drm
> loop fuse drm_panel_orientation_quirks configfs ip_tables x_tables autofs4
> ext4 crc32c_generic crc16 mbcache jbd2 rtc_ds1307 dm_mod dax nvme
> xhci_pci nvme_core t10_pi crc64_rocksoft crc64 crc_t10dif crct10dif_generic
> crct10dif_common xhci_hcd usbcore axp20x_regulator dwmac_starfive
> stmmac_platform usb_common dw_mmc_starfive dw_mmc_pltfm
> axp20x_i2c axp20x mfd_core regmap_i2c stmmac dw_mmc pcs_xpcs of_mdio
> fixed_phy phylink fwnode_mdio mmc_core libphy clk_starfive_jh7110_vout
> clk_starfive_jh7110_isp clk_starfive_jh7110_aon spi_cadence_quadspi
> i2c_designware_platform clk_starfive_jh7110_stg phy_jh7110_usb
> phy_jh7110_pcie i2c_designware_core
> CPU: 3 PID: 292 Comm: (udev-worker) Not tainted 6.5.0-rc7+ #1 Hardware
> name: StarFive VisionFive 2 v1.2A (DT) epc : crypto_wait_for_test+0x8e/0x92
[...]

I'll investigate this error.

Thanks,
Jia Jie