linux/drivers/infiniband/hw/qib
Mike Marciniszyn 30ab7e230b IB/qib: Fix panic in RC error flushing logic
The following panic can occur when flushing a QP:

    RIP: 0010:[<ffffffffa0168e8b>]  [<ffffffffa0168e8b>] qib_send_complete+0x3b/0x190 [ib_qib]
    RSP: 0018:ffff8803cdc6fc90  EFLAGS: 00010046
    RAX: 0000000000000000 RBX: ffff8803d84ba000 RCX: 0000000000000000
    RDX: 0000000000000005 RSI: ffffc90015a53430 RDI: ffff8803d84ba000
    RBP: ffff8803cdc6fce0 R08: ffff8803cdc6fc90 R09: 0000000000000001
    R10: 00000000ffffffff R11: 0000000000000000 R12: ffff8803d84ba0c0
    R13: ffff8803d84ba5cc R14: 0000000000000800 R15: 0000000000000246
    FS:  0000000000000000(0000) GS:ffff880036600000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
    CR2: 0000000000000034 CR3: 00000003e44f9000 CR4: 00000000000406f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process qib/0 (pid: 1350, threadinfo ffff8803cdc6e000, task ffff88042728a100)
    Stack:
     53544c5553455201 0000000100000005 0000000000000000 ffff8803d84ba000
     0000000000000000 0000000000000000 0000000000000000 0000000000000000
     0000000000000000 0000000000000001 ffff8803cdc6fd30 ffffffffa0165d7a
    Call Trace:
     [<ffffffffa0165d7a>] qib_make_rc_req+0x36a/0xe80 [ib_qib]
     [<ffffffffa0165a10>] ?  qib_make_rc_req+0x0/0xe80 [ib_qib]
     [<ffffffffa01698b3>] qib_do_send+0xf3/0xb60 [ib_qib]
     [<ffffffff814db757>] ? thread_return+0x4e/0x777
     [<ffffffffa01697c0>] ? qib_do_send+0x0/0xb60 [ib_qib]
     [<ffffffff81088bf0>] worker_thread+0x170/0x2a0
     [<ffffffff8108e530>] ?  autoremove_wake_function+0x0/0x40
     [<ffffffff81088a80>] ? worker_thread+0x0/0x2a0
     [<ffffffff8108e1c6>] kthread+0x96/0xa0
     [<ffffffff8100c1ca>] child_rip+0xa/0x20
     [<ffffffff8108e130>] ? kthread+0x0/0xa0
     [<ffffffff8100c1c0>] ? child_rip+0x0/0x20
    RIP  [<ffffffffa0168e8b>] qib_send_complete+0x3b/0x190 [ib_qib]

The RC error state flush logic in qib_make_rc_req() could return all
of the acked wqes and potentially have emptied the queue.  It would
then unconditionally try return a flush completion via
qib_send_complete() for an invalid wqe, or worse a valid one that is
not queued. The panic results when the completion code tries to
maintain an MR reference count for a NULL MR.

This fix modifies logic to only send one completion per
qib_make_rc_req() call and changing the completion status from
IB_WC_SUCCESS to IB_WC_WR_FLUSH_ERR as the completions progress.

The outer loop will call as many times as necessary to flush the queue.

Reviewed-by: Ram Vepa <ram.vepa@qlogic.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
2011-11-04 09:35:44 -07:00
..
Kconfig RDMA: Add netlink infrastructure 2011-05-20 11:46:11 -07:00
Makefile IB/qib: Use request_firmware() to load SD7220 firmware 2010-07-08 13:27:05 -07:00
qib.h IB/qib: Use RCU for qpn lookup 2011-10-21 09:38:54 -07:00
qib_6120_regs.h
qib_7220.h IB/qib: Use request_firmware() to load SD7220 firmware 2010-07-08 13:27:05 -07:00
qib_7220_regs.h
qib_7322_regs.h IB/qib: Mask hardware error during link reset 2010-07-06 14:13:20 -07:00
qib_common.h IB/qib: Allow PSM to select from multiple port assignment algorithms 2010-07-21 11:39:36 -07:00
qib_cq.c IB/qib: Generate completion callback on errors 2011-01-10 17:42:19 -08:00
qib_diag.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
qib_dma.c
qib_driver.c IB/qib: Remove s_lock around header validation 2011-10-21 09:38:57 -07:00
qib_eeprom.c
qib_file_ops.c IB/qib: Correct nfreectxts for multiple HCAs 2011-10-06 09:33:35 -07:00
qib_fs.c fs: dcache rationalise dget variants 2011-01-07 17:50:24 +11:00
qib_iba6120.c IB/qib: Eliminate divide/mod in converting idx to egr buf pointer 2011-10-21 09:38:52 -07:00
qib_iba7220.c IB/qib: Eliminate divide/mod in converting idx to egr buf pointer 2011-10-21 09:38:52 -07:00
qib_iba7322.c IB/qib: Fix issue with link states and QSFP cables 2011-10-31 10:57:59 -07:00
qib_init.c IB/qib: Hold links until tuning data is available 2011-10-21 15:08:20 -07:00
qib_intr.c IB/qib: Ensure that LOS and DFE are being turned off 2011-06-17 11:56:59 -07:00
qib_keys.c IB/qib: Fix refcount leak in lkey/rkey validation 2011-01-10 17:42:23 -08:00
qib_mad.c IB/pma: Add include file for IBA performance counters definitions 2011-07-18 21:04:35 -07:00
qib_mad.h IB/pma: Add include file for IBA performance counters definitions 2011-07-18 21:04:35 -07:00
qib_mmap.c
qib_mr.c IB/qib: RDMA lkey/rkey validation is inefficient for large MRs 2011-01-10 17:42:22 -08:00
qib_pcie.c IB/qib: Remove unnecessary read of PCI_CAP_ID_EXP 2011-07-18 11:57:52 -07:00
qib_pio_copy.c
qib_qp.c IB/qib: Precompute timeout jiffies to optimize latency 2011-10-21 09:38:56 -07:00
qib_qsfp.c IB/qib: Hold links until tuning data is available 2011-10-21 15:08:20 -07:00
qib_qsfp.h IB/qib: Fix issue with link states and QSFP cables 2011-10-31 10:57:59 -07:00
qib_rc.c IB/qib: Fix panic in RC error flushing logic 2011-11-04 09:35:44 -07:00
qib_ruc.c IB/qib: Remove s_lock around header validation 2011-10-21 09:38:57 -07:00
qib_sd7220.c IB/qib: Use request_firmware() to load SD7220 firmware 2010-07-08 13:27:05 -07:00
qib_sdma.c IB/qib: Fix race between qib_error_qp() and receive packet processing 2010-08-03 13:59:47 -07:00
qib_srq.c RDMA/core: Add SRQ type field 2011-10-13 09:13:26 -07:00
qib_sysfs.c IB/qib: Correct nfreectxts for multiple HCAs 2011-10-06 09:33:35 -07:00
qib_twsi.c Fix common misspellings 2011-03-31 11:26:23 -03:00
qib_tx.c IB/qib: Avoid variable-length array 2010-07-19 13:21:24 -07:00
qib_uc.c IB/qib: Remove s_lock around header validation 2011-10-21 09:38:57 -07:00
qib_ud.c Fix common misspellings 2011-03-31 11:26:23 -03:00
qib_user_pages.c mm: distinguish between mlocked and pinned pages 2011-10-31 17:30:46 -07:00
qib_user_sdma.c Fix common misspellings 2011-03-31 11:26:23 -03:00
qib_user_sdma.h
qib_verbs.c IB/qib: Use RCU for qpn lookup 2011-10-21 09:38:54 -07:00
qib_verbs.h IB/qib: Precompute timeout jiffies to optimize latency 2011-10-21 09:38:56 -07:00
qib_verbs_mcast.c
qib_wc_ppc64.c
qib_wc_x86_64.c