]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sif: sqflush: Handle the race condition between sqflush and modify_qp
authorWei Lin Guay <wei.lin.guay@oracle.com>
Wed, 3 Aug 2016 12:07:14 +0000 (14:07 +0200)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Fri, 12 Aug 2016 19:18:10 +0000 (12:18 -0700)
commit9ea10ec37de3bd29a8aef23b1c2398065879bc3e
treef5f14a7720430dd7d1e47588f9a08c9399ea8522
parente9c650e30d8b1c0d56066284bb375c56f0120de2
sif: sqflush: Handle the race condition between sqflush and modify_qp

Orabug: 23759723

Due to a SIF HW bug where SIF might generate duplicate completions,
the QP state must be transitioned into shadowed ERR state (HW state is
in RESET).  In this case, modify_qp(ERR) will cause the QP state
transitions(HW/SW): from ERR (ERR) to RESET (ERR).

As a result, this means that SIF driver needs to generate
FLUSHED-IN-ERR completions when IB user performs post_send while the
QP is in shadowed ERR state. HW will not generate them as the HW QP
state is already in RESET state. The SIF driver generates
FLUSHED-IN-ERR if the last_set_state is in ERR state.  last_set_state
is a "best effort" tracked state because QP mutex cannot be held in a
non-sleep context (post_send).

The issue happens in a multi-threaded scenario where one thread is
constantly performing post_send whereas another thread is performing
modify_qp (ERR). During the QP state transition from ERR (ERR) to
RESET (ERR), both HW and SIF driver generate the FLUSHED-IN-ERR and
eventually causing duplicate completion. This patch adds a
test in post_wa4074 to mask out this condition.

Signed-off-by: Wei Lin Guay <wei.lin.guay@oracle.com>
Reviewed-by: Knut Omang <knut.omang@oracle.com>
drivers/infiniband/hw/sif/sif_r3.c