linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: mike.marciniszyn@cornelisnetworks.com,
	dennis.dalessandro@cornelisnetworks.com, dledford@redhat.com,
	jgg@ziepe.ca
Cc: linux-rdma@vger.kernel.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [BUG] infiniband: hw: hfi1: possible ABBA deadlock in pio_wait() and sc_disable()
Date: Wed, 15 Sep 2021 17:12:40 +0800	[thread overview]
Message-ID: <857df2fa-7d60-bff3-70f2-642201888977@gmail.com> (raw)

Hello,

My static analysis tool reports a possible ABBA deadlock in the hfi1 
driver in Linux 5.10:

sc_disable()
   write_seqlock(&sc->waitlock); --> Line 956 (Lock A)
   hfi1_qp_wakeup()
     spin_lock_irqsave(&qp->s_lock, flags); --> Line 441 (Lock B)

pio_wait()
   spin_lock_irqsave(&qp->s_lock, flags); --> Line 939 (Lock B)
   write_seqlock(&sc->waitlock); --> Line 941 (Lock A)

When sc_disable() and pio_wait() are concurrently executed, the deadlock 
can occur.

I am not quite sure whether this possible deadlock is real and how to 
fix it if it is real.
Any feedback would be appreciated, thanks :)

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


Best wishes,
Jia-Ju Bai

             reply	other threads:[~2021-09-15  9:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15  9:12 Jia-Ju Bai [this message]
2021-09-23 19:06 ` Marciniszyn, Mike

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=857df2fa-7d60-bff3-70f2-642201888977@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mike.marciniszyn@cornelisnetworks.com \
    --subject='Re: [BUG] infiniband: hw: hfi1: possible ABBA deadlock in pio_wait() and sc_disable()' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).