mirror_ubuntu-kernels/drivers/infiniband/sw/rxe
Guoqing Jiang b5f3fe27c5 RDMA/rxe: Convert spin_{lock_bh,unlock_bh} to spin_{lock_irqsave,unlock_irqrestore}
We need to call spin_lock_irqsave()/spin_unlock_irqrestore() for
state_lock in rxe, otherwsie the callchain:

  ib_post_send_mad
	-> spin_lock_irqsave
	-> ib_post_send -> rxe_post_send
				-> spin_lock_bh
				-> spin_unlock_bh
	-> spin_unlock_irqrestore

Causes below traces during run block nvmeof-mp/001 test due to mismatched
spinlock nesting:

  WARNING: CPU: 0 PID: 94794 at kernel/softirq.c:376 __local_bh_enable_ip+0xc2/0x140
  [ ... ]
  CPU: 0 PID: 94794 Comm: kworker/u4:1 Tainted: G            E      6.4.0-rc1 #9
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014
  Workqueue: rdma_cm cma_work_handler [rdma_cm]
  RIP: 0010:__local_bh_enable_ip+0xc2/0x140
  Code: 48 85 c0 74 72 5b 41 5c 5d 31 c0 89 c2 89 c1 89 c6 89 c7 41 89 c0 e9 bd 0e 11 01 65 8b 05 f2 65 72 48 85 c0 0f 85 76 ff ff ff <0f> 0b e9 6f ff ff ff e8 d2 39 1c 00 eb 80 4c 89 e7 e8 68 ad 0a 00
  RSP: 0018:ffffb7cf818539f0 EFLAGS: 00010046
  RAX: 0000000000000000 RBX: 0000000000000201 RCX: 0000000000000000
  RDX: 0000000000000000 RSI: 0000000000000201 RDI: ffffffffc0f25f79
  RBP: ffffb7cf81853a00 R08: 0000000000000000 R09: 0000000000000000
  R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffc0f25f79
  R13: ffff8db1f0fa6000 R14: ffff8db2c63ff000 R15: 00000000000000e8
  FS:  0000000000000000(0000) GS:ffff8db33bc00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000559758db0f20 CR3: 0000000105124000 CR4: 00000000003506f0
  Call Trace:
   <TASK>
   _raw_spin_unlock_bh+0x31/0x40
   rxe_post_send+0x59/0x8b0 [rdma_rxe]
   ib_send_mad+0x26b/0x470 [ib_core]
   ib_post_send_mad+0x150/0xb40 [ib_core]
   ? cm_form_tid+0x5b/0x90 [ib_cm]
   ib_send_cm_req+0x7c8/0xb70 [ib_cm]
   rdma_connect_locked+0x433/0x940 [rdma_cm]
   nvme_rdma_cm_handler+0x5d7/0x9c0 [nvme_rdma]
   cma_cm_event_handler+0x4f/0x170 [rdma_cm]
   cma_work_handler+0x6a/0xe0 [rdma_cm]
   process_one_work+0x2a9/0x580
   worker_thread+0x52/0x3f0
   ? __pfx_worker_thread+0x10/0x10
   kthread+0x109/0x140
   ? __pfx_kthread+0x10/0x10
   ret_from_fork+0x2c/0x50
   </TASK>


  raw_local_irq_restore() called with IRQs enabled
  WARNING: CPU: 0 PID: 94794 at kernel/locking/irqflag-debug.c:10 warn_bogus_irq_restore+0x37/0x60
  [ ... ]
  CPU: 0 PID: 94794 Comm: kworker/u4:1 Tainted: G        W   E      6.4.0-rc1 #9
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014
  Workqueue: rdma_cm cma_work_handler [rdma_cm]
  RIP: 0010:warn_bogus_irq_restore+0x37/0x60
  Code: fb 01 77 36 83 e3 01 74 0e 48 8b 5d f8 c9 31 f6 89 f7 e9 ac ea 01 00 48 c7 c7 e0 52 33 b9 c6 05 bb 1c 69 01 01 e8 39 24 f0 fe <0f> 0b 48 8b 5d f8 c9 31 f6 89 f7 e9 89 ea 01 00 0f b6 f3 48 c7 c7
  RSP: 0018:ffffb7cf81853a58 EFLAGS: 00010246
  RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
  RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
  RBP: ffffb7cf81853a60 R08: 0000000000000000 R09: 0000000000000000
  R10: 0000000000000000 R11: 0000000000000000 R12: ffff8db2cfb1a9e8
  R13: ffff8db2cfb1a9d8 R14: ffff8db2c63ff000 R15: 0000000000000000
  FS:  0000000000000000(0000) GS:ffff8db33bc00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000559758db0f20 CR3: 0000000105124000 CR4: 00000000003506f0
  Call Trace:
   <TASK>
   _raw_spin_unlock_irqrestore+0x91/0xa0
   ib_send_mad+0x1e3/0x470 [ib_core]
   ib_post_send_mad+0x150/0xb40 [ib_core]
   ? cm_form_tid+0x5b/0x90 [ib_cm]
   ib_send_cm_req+0x7c8/0xb70 [ib_cm]
   rdma_connect_locked+0x433/0x940 [rdma_cm]
   nvme_rdma_cm_handler+0x5d7/0x9c0 [nvme_rdma]
   cma_cm_event_handler+0x4f/0x170 [rdma_cm]
   cma_work_handler+0x6a/0xe0 [rdma_cm]
   process_one_work+0x2a9/0x580
   worker_thread+0x52/0x3f0
   ? __pfx_worker_thread+0x10/0x10
   kthread+0x109/0x140
   ? __pfx_kthread+0x10/0x10
   ret_from_fork+0x2c/0x50
   </TASK>

Fixes: f605f26ea1 ("RDMA/rxe: Protect QP state with qp->state_lock")
Link: https://lore.kernel.org/r/20230510035056.881196-1-guoqing.jiang@linux.dev
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2023-05-16 21:07:33 -03:00
..
Kconfig RDMA/rxe: Fix missing kconfig dependency on CRYPTO 2021-03-01 14:46:31 -04:00
Makefile RDMA/rxe: Delete deprecated module parameters interface 2022-01-05 15:18:47 -04:00
rxe_av.c RDMA/rxe: Replace pr_xxx by rxe_dbg_xxx in rxe_av.c 2022-11-10 15:33:05 -04:00
rxe_comp.c RDMA/rxe: Convert spin_{lock_bh,unlock_bh} to spin_{lock_irqsave,unlock_irqrestore} 2023-05-16 21:07:33 -03:00
rxe_cq.c RDMA/rxe: Remove tasklet call from rxe_cq.c 2023-03-29 14:25:11 +03:00
rxe_hdr.h RDMA/rxe: Extend rxe packet format to support flush 2022-12-09 19:36:02 -04:00
rxe_hw_counters.c RDMA/counter: Add a descriptor in struct rdma_hw_stats 2021-10-12 12:48:04 -03:00
rxe_hw_counters.h RDMA: Split the alloc_hw_stats() ops to port and device variants 2021-06-16 20:58:29 -03:00
rxe_icrc.c RDMA/rxe: Change rxe_dbg to rxe_dbg_dev 2023-03-24 10:41:49 -03:00
rxe_loc.h RDMA/rxe: Convert tasklet args to queue pairs 2023-03-24 11:14:38 -03:00
rxe_mcast.c RDMA/rxe: Fix an error handling path in rxe_get_mcg() 2022-05-24 12:55:12 -03:00
rxe_mmap.c RDMA/rxe: Change rxe_dbg to rxe_dbg_dev 2023-03-24 10:41:49 -03:00
rxe_mr.c RDMA: Add ib_virt_dma_to_page() 2023-04-16 11:08:07 +03:00
rxe_mw.c RDMA/rxe: Replace pr_xxx by rxe_dbg_xxx in rxe_mw.c 2022-11-10 15:33:03 -04:00
rxe_net.c RDMA/rxe: Convert spin_{lock_bh,unlock_bh} to spin_{lock_irqsave,unlock_irqrestore} 2023-05-16 21:07:33 -03:00
rxe_net.h RDMA/rxe: Add SPDX hdrs to rxe source files 2020-08-31 12:20:02 -03:00
rxe_opcode.c RDMA/rxe: Extend rxe packet format to support flush 2022-12-09 19:36:02 -04:00
rxe_opcode.h RDMA/rxe: Extend rxe packet format to support flush 2022-12-09 19:36:02 -04:00
rxe_param.h RDMA/rxe: Prevent faulty rkey generation 2023-01-09 10:48:16 -04:00
rxe_pool.c v6.3 RDMA pull request 2023-02-24 15:11:03 -08:00
rxe_pool.h RDMA/rxe: Remove rxe_alloc() 2023-02-16 11:30:11 -04:00
rxe_qp.c RDMA/rxe: Convert spin_{lock_bh,unlock_bh} to spin_{lock_irqsave,unlock_irqrestore} 2023-05-16 21:07:33 -03:00
rxe_queue.c RDMA/rxe: Clean kzalloc failure paths 2023-03-30 09:54:32 +03:00
rxe_queue.h RDMA/rxe: Fix missing memory barriers in rxe_queue.h 2023-02-16 12:07:05 -04:00
rxe_recv.c RDMA/rxe: Convert spin_{lock_bh,unlock_bh} to spin_{lock_irqsave,unlock_irqrestore} 2023-05-16 21:07:33 -03:00
rxe_req.c RDMA/rxe: Convert spin_{lock_bh,unlock_bh} to spin_{lock_irqsave,unlock_irqrestore} 2023-05-16 21:07:33 -03:00
rxe_resp.c RDMA/rxe: Convert spin_{lock_bh,unlock_bh} to spin_{lock_irqsave,unlock_irqrestore} 2023-05-16 21:07:33 -03:00
rxe_srq.c RDMA/rxe: Change rxe_dbg to rxe_dbg_dev 2023-03-24 10:41:49 -03:00
rxe_task.c RDMA/rxe: Fix incorrect TASKLET_STATE_SCHED check in rxe_task.c 2023-04-12 13:11:51 -03:00
rxe_task.h RDMA/rxe: Rewrite rxe_task.c 2023-03-24 11:21:36 -03:00
rxe_verbs.c RDMA/rxe: Convert spin_{lock_bh,unlock_bh} to spin_{lock_irqsave,unlock_irqrestore} 2023-05-16 21:07:33 -03:00
rxe_verbs.h RDMA/rxe: Remove qp->req.state 2023-04-17 16:01:44 -03:00
rxe.c RDMA/rxe: Extend dbg log messages to err and info 2023-03-24 10:41:49 -03:00
rxe.h RDMA/rxe: Cleanup reset state handling in rxe_resp.c 2023-03-24 11:21:36 -03:00