From: Sanjay R Mehta <Sanju.Mehta@amd.com>
To: <vkoul@kernel.org>
Cc: <gregkh@linuxfoundation.org>, <dan.j.williams@intel.com>,
<Thomas.Lendacky@amd.com>, <robh@kernel.org>,
<mchehab+samsung@kernel.org>, <davem@davemloft.net>,
<linux-kernel@vger.kernel.org>, <dmaengine@vger.kernel.org>,
Sanjay R Mehta <sanju.mehta@amd.com>
Subject: [PATCH v2 1/2] dmaengine: ptdma: fix concurrency issue with multiple dma transfer
Date: Wed, 2 Feb 2022 09:14:39 -0600 [thread overview]
Message-ID: <1643814880-3882-2-git-send-email-Sanju.Mehta@amd.com> (raw)
In-Reply-To: <1643814880-3882-1-git-send-email-Sanju.Mehta@amd.com>
From: Sanjay R Mehta <sanju.mehta@amd.com>
The command should be submitted only if the engine is idle,
for this, the next available descriptor is checked and set the flag
to false in case the descriptor is non-empty.
Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
---
drivers/dma/ptdma/ptdma-dmaengine.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/ptdma/ptdma-dmaengine.c b/drivers/dma/ptdma/ptdma-dmaengine.c
index c9e52f6..e38dca4 100644
--- a/drivers/dma/ptdma/ptdma-dmaengine.c
+++ b/drivers/dma/ptdma/ptdma-dmaengine.c
@@ -233,9 +233,14 @@ static void pt_issue_pending(struct dma_chan *dma_chan)
struct pt_dma_chan *chan = to_pt_chan(dma_chan);
struct pt_dma_desc *desc;
unsigned long flags;
+ bool engine_is_idle = true;
spin_lock_irqsave(&chan->vc.lock, flags);
+ desc = pt_next_dma_desc(chan);
+ if (desc)
+ engine_is_idle = false;
+
vchan_issue_pending(&chan->vc);
desc = pt_next_dma_desc(chan);
@@ -243,7 +248,7 @@ static void pt_issue_pending(struct dma_chan *dma_chan)
spin_unlock_irqrestore(&chan->vc.lock, flags);
/* If there was nothing active, start processing */
- if (desc)
+ if (engine_is_idle)
pt_cmd_callback(desc, 0);
}
--
2.7.4
next prev parent reply other threads:[~2022-02-02 15:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-02 15:14 [PATCH v2 0/2] Added few improvement and fixes Sanjay R Mehta
2022-02-02 15:14 ` Sanjay R Mehta [this message]
2022-02-02 15:14 ` [PATCH v2 2/2] dmaengine: ptdma: handle the cases based on DMA is complete Sanjay R Mehta
2022-02-15 5:25 ` [PATCH v2 0/2] Added few improvement and fixes Vinod Koul
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=1643814880-3882-2-git-send-email-Sanju.Mehta@amd.com \
--to=sanju.mehta@amd.com \
--cc=Thomas.Lendacky@amd.com \
--cc=dan.j.williams@intel.com \
--cc=davem@davemloft.net \
--cc=dmaengine@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab+samsung@kernel.org \
--cc=robh@kernel.org \
--cc=vkoul@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®