mirror_ubuntu-kernels/drivers/net/ethernet
Dean Nelson c1055b76ad net: thunderx: initialize VF's mailbox mutex before first usage
A VF's mailbox mutex is not getting initialized by nicvf_probe() until after
it is first used. And such usage is resulting in...

[   28.270927] ------------[ cut here ]------------
[   28.270934] DEBUG_LOCKS_WARN_ON(lock->magic != lock)
[   28.270980] WARNING: CPU: 9 PID: 675 at kernel/locking/mutex.c:938 __mutex_lock+0xdac/0x12f0
[   28.270985] Modules linked in: ast(+) nicvf(+) i2c_algo_bit drm_vram_helper drm_ttm_helper ttm nicpf(+) drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm ixgbe(+) sg thunder_bgx mdio i2c_thunderx mdio_thunder thunder_xcv mdio_cavium dm_mirror dm_region_hash dm_log dm_mod
[   28.271064] CPU: 9 PID: 675 Comm: systemd-udevd Not tainted 4.18.0+ #1
[   28.271070] Hardware name: GIGABYTE R120-T34-00/MT30-GS2-00, BIOS F02 08/06/2019
[   28.271078] pstate: 60000005 (nZCv daif -PAN -UAO)
[   28.271086] pc : __mutex_lock+0xdac/0x12f0
[   28.271092] lr : __mutex_lock+0xdac/0x12f0
[   28.271097] sp : ffff800d42146fb0
[   28.271103] x29: ffff800d42146fb0 x28: 0000000000000000
[   28.271113] x27: ffff800d24361180 x26: dfff200000000000
[   28.271122] x25: 0000000000000000 x24: 0000000000000002
[   28.271132] x23: ffff20001597cc80 x22: ffff2000139e9848
[   28.271141] x21: 0000000000000000 x20: 1ffff001a8428e0c
[   28.271151] x19: ffff200015d5d000 x18: 1ffff001ae0f2184
[   28.271160] x17: 0000000000000000 x16: 0000000000000000
[   28.271170] x15: ffff800d70790c38 x14: ffff20001597c000
[   28.271179] x13: ffff20001597cc80 x12: ffff040002b2f779
[   28.271189] x11: 1fffe40002b2f778 x10: ffff040002b2f778
[   28.271199] x9 : 0000000000000000 x8 : 00000000f1f1f1f1
[   28.271208] x7 : 00000000f2f2f2f2 x6 : 0000000000000000
[   28.271217] x5 : 1ffff001ae0f2186 x4 : 1fffe400027eb03c
[   28.271227] x3 : dfff200000000000 x2 : ffff1001a8428dbe
[   28.271237] x1 : c87fdfac7ea11d00 x0 : 0000000000000000
[   28.271246] Call trace:
[   28.271254]  __mutex_lock+0xdac/0x12f0
[   28.271261]  mutex_lock_nested+0x3c/0x50
[   28.271297]  nicvf_send_msg_to_pf+0x40/0x3a0 [nicvf]
[   28.271316]  nicvf_register_misc_interrupt+0x20c/0x328 [nicvf]
[   28.271334]  nicvf_probe+0x508/0xda0 [nicvf]
[   28.271344]  local_pci_probe+0xc4/0x180
[   28.271352]  pci_device_probe+0x3ec/0x528
[   28.271363]  driver_probe_device+0x21c/0xb98
[   28.271371]  device_driver_attach+0xe8/0x120
[   28.271379]  __driver_attach+0xe0/0x2a0
[   28.271386]  bus_for_each_dev+0x118/0x190
[   28.271394]  driver_attach+0x48/0x60
[   28.271401]  bus_add_driver+0x328/0x558
[   28.271409]  driver_register+0x148/0x398
[   28.271416]  __pci_register_driver+0x14c/0x1b0
[   28.271437]  nicvf_init_module+0x54/0x10000 [nicvf]
[   28.271447]  do_one_initcall+0x18c/0xc18
[   28.271457]  do_init_module+0x18c/0x618
[   28.271464]  load_module+0x2bc0/0x4088
[   28.271472]  __se_sys_finit_module+0x110/0x188
[   28.271479]  __arm64_sys_finit_module+0x70/0xa0
[   28.271490]  el0_svc_handler+0x15c/0x380
[   28.271496]  el0_svc+0x8/0xc
[   28.271502] irq event stamp: 52649
[   28.271513] hardirqs last  enabled at (52649): [<ffff200011b4d790>] _raw_spin_unlock_irqrestore+0xc0/0xd8
[   28.271522] hardirqs last disabled at (52648): [<ffff200011b4d3c4>] _raw_spin_lock_irqsave+0x3c/0xf0
[   28.271530] softirqs last  enabled at (52330): [<ffff200010082af4>] __do_softirq+0xacc/0x117c
[   28.271540] softirqs last disabled at (52313): [<ffff20001019b354>] irq_exit+0x3cc/0x500
[   28.271545] ---[ end trace a9b90324c8a0d4ee ]---

This problem is resolved by moving the call to mutex_init() up earlier
in nicvf_probe().

Fixes: 609ea65c65 ("net: thunderx: add mutex to protect mailbox from concurrent calls for same VF")
Signed-off-by: Dean Nelson <dnelson@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-08-05 17:50:34 -07:00
..
3com typhoon: use generic power management 2020-07-01 12:58:33 -07:00
8390 ne2k-pci: Use netif_msg_init to initialize msg_enable bits 2020-07-17 19:04:06 -07:00
adaptec starfire: use generic power management 2020-07-01 12:58:33 -07:00
aeroflex Replace HTTP links with HTTPS ones: GRETH 10/100/1G Ethernet MAC device driver 2020-07-07 15:44:27 -07:00
agere net: ethernet: et131x: Remove redundant register read 2020-07-17 18:48:15 -07:00
alacritech
allwinner
alteon net: alteon: Avoid some useless memset 2020-07-17 12:57:59 -07:00
altera
amazon bpf, xdp: Remove XDP_QUERY_PROG and XDP_QUERY_PROG_HW XDP commands 2020-07-25 20:37:02 -07:00
amd xgbe: convert to new udp_tunnel_nic infra 2020-07-14 17:04:27 -07:00
apm
apple
aquantia net: ethernet: aquantia: Fix wrong return value 2020-08-03 15:57:02 -07:00
arc
atheros net: ag71xx: add missed clk_disable_unprepare in error path of probe 2020-07-20 18:37:38 -07:00
aurora
broadcom Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-08-03 18:27:40 -07:00
brocade bna: bfi.h: Avoid the use of one-element array 2020-07-22 18:12:11 -07:00
cadence net: macb: Properly handle phylink on at91sam9x 2020-08-04 16:04:17 -07:00
calxeda
cavium net: thunderx: initialize VF's mailbox mutex before first usage 2020-08-05 17:50:34 -07:00
chelsio cxgb4: add TC-MATCHALL IPv6 support 2020-08-03 18:17:08 -07:00
cirrus
cisco enic: convert to new udp_tunnel_nic infra 2020-07-14 17:04:27 -07:00
cortina Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-08-02 01:02:12 -07:00
davicom
dec
dlink net: sundance: Replace HTTP links with HTTPS ones 2020-07-15 17:41:34 -07:00
emulex be2net: convert to new udp_tunnel_nic infra 2020-07-14 17:04:27 -07:00
ezchip
faraday
freescale dpaa2-eth: Fix passing zero to 'PTR_ERR' warning 2020-08-04 16:10:24 -07:00
fujitsu
google
hisilicon Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-08-02 01:02:12 -07:00
huawei hinic: add check for mailbox msg from VF 2020-08-04 12:17:06 -07:00
i825xx
ibm ibmvnic: Fix IRQ mapping disposal in error path 2020-07-29 15:35:55 -07:00
intel Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-08-03 18:27:40 -07:00
marvell Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-08-03 18:27:40 -07:00
mediatek Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-08-02 01:02:12 -07:00
mellanox Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-08-03 18:27:40 -07:00
micrel ksz884x: switch from 'pci_' to 'dma_' API 2020-07-14 15:10:29 -07:00
microchip lan743x: remove redundant initialization of variable current_head_index 2020-07-22 17:55:35 -07:00
moxa
mscc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-08-02 01:02:12 -07:00
myricom ethernet: myri10ge: use generic power management 2020-07-20 18:01:07 -07:00
natsemi natsemi: use generic power management 2020-07-01 12:58:33 -07:00
neterion Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-07-25 17:49:04 -07:00
netronome bpf, xdp: Remove XDP_QUERY_PROG and XDP_QUERY_PROG_HW XDP commands 2020-07-25 20:37:02 -07:00
ni net: nixge: fix potential memory leak in nixge_probe() 2020-07-30 16:55:39 -07:00
nvidia
nxp
oki-semi
packetengines net: packetengines: switch from 'pci_' to 'dma_' API 2020-07-20 17:48:23 -07:00
pasemi
pensando ionic: separate interrupt for Tx and Rx 2020-08-03 15:32:02 -07:00
qlogic Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-08-03 18:27:40 -07:00
qualcomm net: rmnet: do not allow to add multiple bridge interfaces 2020-07-04 18:04:55 -07:00
rdc r6040: switch from 'pci_' to 'dma_' API 2020-07-20 17:49:50 -07:00
realtek r8169: allow to enable ASPM on RTL8125A 2020-07-21 16:12:19 -07:00
renesas net: ethernet: ravb: exit if re-initialization fails in tx timeout 2020-07-21 15:34:07 -07:00
rocker
samsung
seeq
sfc sfc: Fix build with CONFIG_RFS_ACCEL disabled. 2020-08-03 18:29:39 -07:00
sgi net: sgi: ioc3-eth: Fix the size used in some 'dma_free_coherent()' calls 2020-08-03 16:00:26 -07:00
silan sc92031: use generic power management 2020-07-30 17:43:01 -07:00
sis sis900: use generic power management 2020-07-30 17:43:01 -07:00
smsc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-07-25 17:49:04 -07:00
socionext bpf, xdp: Remove XDP_QUERY_PROG and XDP_QUERY_PROG_HW XDP commands 2020-07-25 20:37:02 -07:00
stmicro net: stmmac: fix failed to suspend if phy based WOL is enabled 2020-08-03 17:59:39 -07:00
sun net: sungem: switch from 'pci_' to 'dma_' API 2020-07-17 12:56:40 -07:00
synopsys
tehuti
ti Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-08-03 18:27:40 -07:00
toshiba net: spider_net: Remove a useless memset 2020-08-03 16:01:11 -07:00
tundra
via via-velocity: Use more typical logging styles 2020-08-04 12:54:49 -07:00
wiznet
xilinx net: ll_temac: Use devm_platform_ioremap_resource_byname() 2020-07-30 17:44:28 -07:00
xircom
xscale
dnet.c
dnet.h
ec_bhf.c
ethoc.c
fealnx.c net/fealnx: switch from 'pci_' to 'dma_' API 2020-07-20 18:32:49 -07:00
jme.c net: jme: Replace HTTP links with HTTPS ones 2020-07-13 17:45:04 -07:00
jme.h net: jme: Replace HTTP links with HTTPS ones 2020-07-13 17:45:04 -07:00
Kconfig
korina.c
lantiq_etop.c
lantiq_xrx200.c
Makefile