** Description changed: SRU Justification: [Impact] In the existing PKA driver implementation, in function pka_dev_init_shim, the shim->mutex is first used in the pka_dev_trng_read function. However, the mutex is initialized after the - pka_dev_trng_read function. This causes runtime kernel panic. + pka_dev_trng_read function. This causes runtime kernel lock warning: + + [ 10.090574] ------------[ cut here ]------------ + [ 10.095216] DEBUG_LOCKS_WARN_ON(lock->magic != lock) + [ 10.095227] WARNING: CPU: 5 PID: 588 at kernel/locking/mutex.c:575 __mutex_lock+0x2f0/0x394 + [ 10.108517] Modules linked in: mlxbf_pka(+) mlxbf_bootctl cppc_cpufreq(+) sch_fq_codel dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua drm ip_tables x_tables virtio_net crct10dif_ce net_failover ghash_ce sha2_ce failover sha256_arm64 sha1_ce nvme gpio_mlxbf3 nvme_core vitesse sdhci_of_dwcmshc mlxbf_gige sdhci_pltfm sdhci i2c_mlxbf pinctrl_mlxbf3 mlxbf_tmfifo pwr_mlxbf autofs4 aes_ce_blk crypto_simd cryptd aes_ce_cipher + [ 10.145869] CPU: 5 PID: 588 Comm: systemd-udevd Not tainted 5.15.189+ #2 + [ 10.152554] Hardware name: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.mellandx.com%2F&data=05%7C02%7Cxiangrongl%40nvidia.com%7C72557ef1627d4df6f3f008de075a7c82%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638956282380899240%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=eWlZXZ0fjdx1aJITItzCS7amq8ykmCO58lb7dai3FEA%3D&reserved=0 BlueField-3 DPU/BlueField-3 DPU, BIOS 4.13.0.13780 Sep 30 2025 + [ 10.162881] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) + [ 10.169825] pc : __mutex_lock+0x2f0/0x394 + [ 10.173820] lr : __mutex_lock+0x2f0/0x394 + [ 10.177813] sp : ffff800008bbb4d0 + [ 10.181112] x29: ffff800008bbb510 x28: 00000000140240e0 x27: ffff800008b79000 + [ 10.188231] x26: 0000000014012000 x25: ffff0003d3467180 x24: ffff800008bbb688 + [ 10.195350] x23: 0000000000000010 x22: 0000000000000002 x21: ffffd26c36d8d02c + [ 10.202469] x20: 0000000000000000 x19: ffff0003d3467180 x18: ffffd26cb196d000 + [ 10.209587] x17: ffff000091392490 x16: ffffd26caf046114 x15: ffff0003ddaf5d88 + [ 10.216705] x14: 0000000000000000 x13: 284e4f5f4e524157 x12: 5f534b434f4c5f47 + [ 10.223823] x11: 656820747563205b x10: 0000000000000029 x9 : ffffd26caf0cdeb4 + [ 10.230942] x8 : ffffd26cb0ac3008 x7 : 0000000000000001 x6 : 0000000000000001 + [ 10.238061] x5 : ffff800008bbb320 x4 : ffff2d972d030000 x3 : ffff000082f09f80 + [ 10.245179] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000082f09f80 + [ 10.252297] Call trace: + [ 10.254729] __mutex_lock+0x2f0/0x394 + [ 10.258376] mutex_lock_nested+0x68/0xdc + [ 10.262284] pka_dev_trng_read.part.0+0x3c/0x294 [mlxbf_pka] + [ 10.267933] pka_dev_register_shim+0x628/0xe40 [mlxbf_pka] + [ 10.273404] pka_drv_probe+0x4d4/0x6a0 [mlxbf_pka] + [ 10.278180] platform_probe+0x70/0x110 + [ 10.281917] really_probe+0xd0/0x490 + [ 10.285479] __driver_probe_device+0x148/0x190 + [ 10.289908] driver_probe_device+0x48/0x180 + [ 10.294077] __driver_attach+0x10c/0x250 + [ 10.297984] bus_for_each_dev+0x7c/0xdc + [ 10.301805] driver_attach+0x2c/0x40 + [ 10.305366] bus_add_driver+0x154/0x270 + [ 10.309188] driver_register+0x80/0x13c + [ 10.313008] __platform_driver_register+0x30/0x40 + [ 10.317696] pka_drv_register+0x124/0x1000 [mlxbf_pka] + [ 10.322820] do_one_initcall+0x80/0x310 + [ 10.326642] do_init_module+0x50/0x264 + [ 10.330378] load_module+0x22c0/0x2770 + [ 10.334113] __do_sys_finit_module+0xac/0x120 + [ 10.338456] __arm64_sys_finit_module+0x28/0x34 + [ 10.342972] invoke_syscall+0x78/0x100 + [ 10.346707] el0_svc_common.constprop.0+0x180/0x1a0 + [ 10.351570] do_el0_svc+0x30/0xb0 + [ 10.354871] el0_svc+0x64/0x200 + [ 10.357999] el0t_64_sync_handler+0xa4/0x130 + [ 10.362254] el0t_64_sync+0x1a4/0x1a8 + [ 10.365901] irq event stamp: 58021 + [ 10.369287] hardirqs last enabled at (58021): [<ffffd26cb00edf0c>] exit_to_kernel_mode+0x3c/0x1a0 + [ 10.378228] hardirqs last disabled at (58020): [<ffffd26cb00ed700>] enter_el1_irq_or_nmi+0x20/0x60 + [ 10.387167] softirqs last enabled at (58018): [<ffffd26caf021530>] handle_softirqs+0x450/0x560 + [ 10.395849] softirqs last disabled at (58011): [<ffffd26caf0217fc>] __irq_exit_rcu+0x10c/0x150 + [ 10.404442] ---[ end trace ba33d0d167a976f5 ]--- + [Fix] * Move the mutex initialization before the TRNG related function calls. [Test Case] * Verify the PKA devices can be successfully probed during kernel boot. [Other] * This code is likely to change depending on feedback we received from maintainers.
-- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux-bluefield in Ubuntu. https://bugs.launchpad.net/bugs/2127200 Title: mlxbf-pka: fix the PKA shim mutex initialization issue Status in linux-bluefield package in Ubuntu: New Bug description: SRU Justification: [Impact] In the existing PKA driver implementation, in function pka_dev_init_shim, the shim->mutex is first used in the pka_dev_trng_read function. However, the mutex is initialized after the pka_dev_trng_read function. This causes runtime kernel lock warning: [ 10.090574] ------------[ cut here ]------------ [ 10.095216] DEBUG_LOCKS_WARN_ON(lock->magic != lock) [ 10.095227] WARNING: CPU: 5 PID: 588 at kernel/locking/mutex.c:575 __mutex_lock+0x2f0/0x394 [ 10.108517] Modules linked in: mlxbf_pka(+) mlxbf_bootctl cppc_cpufreq(+) sch_fq_codel dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua drm ip_tables x_tables virtio_net crct10dif_ce net_failover ghash_ce sha2_ce failover sha256_arm64 sha1_ce nvme gpio_mlxbf3 nvme_core vitesse sdhci_of_dwcmshc mlxbf_gige sdhci_pltfm sdhci i2c_mlxbf pinctrl_mlxbf3 mlxbf_tmfifo pwr_mlxbf autofs4 aes_ce_blk crypto_simd cryptd aes_ce_cipher [ 10.145869] CPU: 5 PID: 588 Comm: systemd-udevd Not tainted 5.15.189+ #2 [ 10.152554] Hardware name: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.mellandx.com%2F&data=05%7C02%7Cxiangrongl%40nvidia.com%7C72557ef1627d4df6f3f008de075a7c82%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638956282380899240%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=eWlZXZ0fjdx1aJITItzCS7amq8ykmCO58lb7dai3FEA%3D&reserved=0 BlueField-3 DPU/BlueField-3 DPU, BIOS 4.13.0.13780 Sep 30 2025 [ 10.162881] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 10.169825] pc : __mutex_lock+0x2f0/0x394 [ 10.173820] lr : __mutex_lock+0x2f0/0x394 [ 10.177813] sp : ffff800008bbb4d0 [ 10.181112] x29: ffff800008bbb510 x28: 00000000140240e0 x27: ffff800008b79000 [ 10.188231] x26: 0000000014012000 x25: ffff0003d3467180 x24: ffff800008bbb688 [ 10.195350] x23: 0000000000000010 x22: 0000000000000002 x21: ffffd26c36d8d02c [ 10.202469] x20: 0000000000000000 x19: ffff0003d3467180 x18: ffffd26cb196d000 [ 10.209587] x17: ffff000091392490 x16: ffffd26caf046114 x15: ffff0003ddaf5d88 [ 10.216705] x14: 0000000000000000 x13: 284e4f5f4e524157 x12: 5f534b434f4c5f47 [ 10.223823] x11: 656820747563205b x10: 0000000000000029 x9 : ffffd26caf0cdeb4 [ 10.230942] x8 : ffffd26cb0ac3008 x7 : 0000000000000001 x6 : 0000000000000001 [ 10.238061] x5 : ffff800008bbb320 x4 : ffff2d972d030000 x3 : ffff000082f09f80 [ 10.245179] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000082f09f80 [ 10.252297] Call trace: [ 10.254729] __mutex_lock+0x2f0/0x394 [ 10.258376] mutex_lock_nested+0x68/0xdc [ 10.262284] pka_dev_trng_read.part.0+0x3c/0x294 [mlxbf_pka] [ 10.267933] pka_dev_register_shim+0x628/0xe40 [mlxbf_pka] [ 10.273404] pka_drv_probe+0x4d4/0x6a0 [mlxbf_pka] [ 10.278180] platform_probe+0x70/0x110 [ 10.281917] really_probe+0xd0/0x490 [ 10.285479] __driver_probe_device+0x148/0x190 [ 10.289908] driver_probe_device+0x48/0x180 [ 10.294077] __driver_attach+0x10c/0x250 [ 10.297984] bus_for_each_dev+0x7c/0xdc [ 10.301805] driver_attach+0x2c/0x40 [ 10.305366] bus_add_driver+0x154/0x270 [ 10.309188] driver_register+0x80/0x13c [ 10.313008] __platform_driver_register+0x30/0x40 [ 10.317696] pka_drv_register+0x124/0x1000 [mlxbf_pka] [ 10.322820] do_one_initcall+0x80/0x310 [ 10.326642] do_init_module+0x50/0x264 [ 10.330378] load_module+0x22c0/0x2770 [ 10.334113] __do_sys_finit_module+0xac/0x120 [ 10.338456] __arm64_sys_finit_module+0x28/0x34 [ 10.342972] invoke_syscall+0x78/0x100 [ 10.346707] el0_svc_common.constprop.0+0x180/0x1a0 [ 10.351570] do_el0_svc+0x30/0xb0 [ 10.354871] el0_svc+0x64/0x200 [ 10.357999] el0t_64_sync_handler+0xa4/0x130 [ 10.362254] el0t_64_sync+0x1a4/0x1a8 [ 10.365901] irq event stamp: 58021 [ 10.369287] hardirqs last enabled at (58021): [<ffffd26cb00edf0c>] exit_to_kernel_mode+0x3c/0x1a0 [ 10.378228] hardirqs last disabled at (58020): [<ffffd26cb00ed700>] enter_el1_irq_or_nmi+0x20/0x60 [ 10.387167] softirqs last enabled at (58018): [<ffffd26caf021530>] handle_softirqs+0x450/0x560 [ 10.395849] softirqs last disabled at (58011): [<ffffd26caf0217fc>] __irq_exit_rcu+0x10c/0x150 [ 10.404442] ---[ end trace ba33d0d167a976f5 ]--- [Fix] * Move the mutex initialization before the TRNG related function calls. [Test Case] * Verify the PKA devices can be successfully probed during kernel boot. [Other] * This code is likely to change depending on feedback we received from maintainers. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/2127200/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp