From: Sasha Levin <sashal@kernel.org>
To: "Michael J. Ruhl" <michael.j.ruhl@intel.com>
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] IB/hfi1: Remove race conditions in user_sdma send path
Date: Tue, 18 Dec 2018 16:44:03 -0500 [thread overview]
Message-ID: <20181218214403.GG2746@sasha-vm> (raw)
In-Reply-To: <20181218210022.7019.83923.stgit@phstlrhel7.ph.intel.com>
On Tue, Dec 18, 2018 at 04:00:22PM -0500, Michael J. Ruhl wrote:
>From: Michael J. Ruhl <michael.j.ruhl@intel.com>
>
>commit 28a9a9e83ceae2cee25b9af9ad20d53aaa9ab951 upstream
>
>Packet queue state is over used to determine SDMA descriptor
>availablitity and packet queue request state.
>
>cpu 0 ret = user_sdma_send_pkts(req, pcount);
>cpu 0 if (atomic_read(&pq->n_reqs))
>cpu 1 IRQ user_sdma_txreq_cb calls pq_update() (state to _INACTIVE)
>cpu 0 xchg(&pq->state, SDMA_PKT_Q_ACTIVE);
>
>At this point pq->n_reqs == 0 and pq->state is incorrectly
>SDMA_PKT_Q_ACTIVE. The close path will hang waiting for the state
>to return to _INACTIVE.
>
>This can also change the state from _DEFERRED to _ACTIVE. However,
>this is a mostly benign race.
>
>Remove the racy code path.
>
>Use n_reqs to determine if a packet queue is active or not.
>
>Cc: <stable@vger.kernel.org> # 4.19.x
>Reviewed-by: Mitko Haralanov <mitko.haralanov@intel.com>
>Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
>Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
>Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
>Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
I've queued all 3 to their respective trees, thank you.
--
Thanks,
Sasha
next prev parent reply other threads:[~2018-12-18 21:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-18 21:00 [PATCH] IB/hfi1: Remove race conditions in user_sdma send path Michael J. Ruhl
2018-12-18 21:44 ` Sasha Levin [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-12-18 21:04 Michael J. Ruhl
2018-12-18 21:08 Michael J. Ruhl
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=20181218214403.GG2746@sasha-vm \
--to=sashal@kernel.org \
--cc=michael.j.ruhl@intel.com \
--cc=stable@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