From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Alistair Popple <alistair@popple.id.au>, linuxppc-dev@lists.ozlabs.org
Cc: Mark Hairgrove <mhairgrove@nvidia.com>,
Alistair Popple <alistair@popple.id.au>
Subject: Re: [v3] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate
Date: Wed, 14 Mar 2018 20:28:21 +1100 (AEDT) [thread overview]
Message-ID: <401RH00Qp3z9sVQ@ozlabs.org> (raw)
In-Reply-To: <20180302051845.26844-1-alistair@popple.id.au>
On Fri, 2018-03-02 at 05:18:45 UTC, Alistair Popple wrote:
> When sending TLB invalidates to the NPU we need to send extra flushes due
> to a hardware issue. The original implementation would lock the all the
> ATSD MMIO registers sequentially before unlocking and relocking each of
> them sequentially to do the extra flush.
>
> This introduced a deadlock as it is possible for one thread to hold one
> ATSD register whilst waiting for another register to be freed while the
> other thread is holding that register waiting for the one in the first
> thread to be freed.
>
> For example if there are two threads and two ATSD registers:
>
> Thread A Thread B
> Acquire 1
> Acquire 2
> Release 1 Acquire 1
> Wait 1 Wait 2
>
> Both threads will be stuck waiting to acquire a register resulting in an
> RCU stall warning or soft lockup.
>
> This patch solves the deadlock by refactoring the code to ensure registers
> are not released between flushes and to ensure all registers are either
> acquired or released together and in order.
>
> Fixes: bbd5ff50afff ("powerpc/powernv/npu-dma: Add explicit flush when sending an ATSD")
> Signed-off-by: Alistair Popple <alistair@popple.id.au>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/2b74e2a9b39df40a2b489af2d24079
cheers
prev parent reply other threads:[~2018-03-14 9:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-02 5:18 [PATCH v3] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate Alistair Popple
2018-03-08 3:41 ` Alistair Popple
2018-03-08 8:22 ` Michael Ellerman
2018-03-08 8:59 ` Alistair Popple
2018-03-14 9:28 ` Michael Ellerman [this message]
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=401RH00Qp3z9sVQ@ozlabs.org \
--to=patch-notifications@ellerman.id.au \
--cc=alistair@popple.id.au \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mhairgrove@nvidia.com \
/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