mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: dennis.dalessandro@cornelisnetworks.com, jgg@ziepe.ca,
	Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [BUG] infiniband: sw: rdmavt: possible ABBA deadlocks in rvt_ruc_loopback()
Date: Thu, 20 Oct 2022 21:37:47 +0800	[thread overview]
Message-ID: <afe67a8e-82b8-9a47-0832-527c652cc66e@gmail.com> (raw)

Hello,

My static analysis tool reports several possible ABBA deadlock in the 
rdmavt driver in Linux 5.18:

rvt_ruc_loopback()
   spin_lock_irqsave(&sqp->s_lock, flags); --> Line 3190 (Lock A)
   spin_lock(&sqp->r_lock); --> Line 3195 (Lock B)

rvt_qp_mr_clean()
   spin_lock_irq(&qp->r_lock); --> Line 698 (Lock B)
   spin_lock(&qp->s_lock); --> Line 700 (Lock A)

rvt_rc_timeout()
   spin_lock_irqsave(&qp->r_lock, flags); --> Line 2595 (Lock B)
   spin_lock(&qp->s_lock); --> Line 2596 (Lock A)

rvt_modify_qp()
   spin_lock_irq(&qp->r_lock); --> Line 1419 (Lock B)
   spin_lock(&qp->s_lock); --> Line 1421(Lock A)

_rvt_reset_qp()
   spin_lock_irq(&qp->r_lock); --> Line 907 (Lock B)
   spin_lock(&qp->s_lock); --> Line 909 (Lock A)

rvt_reset_qp()
   spin_lock_irq(&qp->r_lock); --> Line 936 (Lock B)
   spin_lock(&qp->s_lock); --> Line 938 (Lock A)

When rvt_ruc_loopback() is concurrently executed with rvt_qp_mr_clean(), 
rvt_rc_timeout(), rvt_modify_qp(), _rvt_reset_qp() or rvt_reset_qp(), 
the deadlocks can occur.

I am not quite sure whether these possible deadlocks are real and how to 
fix them if real.
Any feedback would be appreciated, thanks :)

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>


Best wishes,
Jia-Ju Bai

             reply	other threads:[~2022-10-20 13:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 13:37 Jia-Ju Bai [this message]
2022-10-20 16:15 ` Dennis Dalessandro
2022-10-20 17:13 ` Niels Dossche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afe67a8e-82b8-9a47-0832-527c652cc66e@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®