From: andriy.shevchenko@intel.com (Shevchenko, Andriy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] dma: mv_xor: take channel spinlock in mv_xor_status()
Date: Mon, 30 Dec 2013 09:55:50 +0000 [thread overview]
Message-ID: <1388397319.1871.251.camel@smile> (raw)
In-Reply-To: <1388144314-1581-2-git-send-email-thomas.petazzoni@free-electrons.com>
On Fri, 2013-12-27 at 12:38 +0100, Thomas Petazzoni wrote:
> The mv_xor_status() function accesses the mv_xor_chan structure, but
> was not taking the corresponding spinlock. This patch fixes this
> problem.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> drivers/dma/mv_xor.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
> index 53fb0c8..526ab27 100644
> --- a/drivers/dma/mv_xor.c
> +++ b/drivers/dma/mv_xor.c
> @@ -701,14 +701,20 @@ static enum dma_status mv_xor_status(struct dma_chan *chan,
> struct mv_xor_chan *mv_chan = to_mv_xor_chan(chan);
> enum dma_status ret;
>
> + spin_lock_bh(&mv_chan->lock);
> +
I don't think it's a proper place for this spinlock since
dma_cookie_status is independent to that.
> ret = dma_cookie_status(chan, cookie, txstate);
> if (ret == DMA_COMPLETE) {
If you are caring about mv_chan access, better to take it here...
> mv_xor_clean_completed_slots(mv_chan);
> + spin_unlock_bh(&mv_chan->lock);
> return ret;
> }
...and here.
> - mv_xor_slot_cleanup(mv_chan);
> + __mv_xor_slot_cleanup(mv_chan);
>
> - return dma_cookie_status(chan, cookie, txstate);
> + ret = dma_cookie_status(chan, cookie, txstate);
> + spin_unlock_bh(&mv_chan->lock);
> +
> + return ret;
> }
>
> static void mv_dump_xor_regs(struct mv_xor_chan *chan)
--
Andy Shevchenko <andriy.shevchenko@intel.com>
Intel Finland Oy
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
next prev parent reply other threads:[~2013-12-30 9:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-27 11:38 [PATCH 0/3] dma: mv_xor: spinlock related improvements Thomas Petazzoni
2013-12-27 11:38 ` [PATCH 1/3] dma: mv_xor: take channel spinlock in mv_xor_status() Thomas Petazzoni
2013-12-30 9:55 ` Shevchenko, Andriy [this message]
2013-12-31 22:48 ` Dan Williams
2014-03-07 15:51 ` Ezequiel Garcia
2013-12-27 11:38 ` [PATCH 2/3] dma: mv_xor: use __mv_xor_slot_cleanup() in mv_xor_free_chan_resources() Thomas Petazzoni
2013-12-27 11:38 ` [PATCH 3/3] dma: mv_xor: rename __mv_xor_slot_cleanup() to mv_xor_slot_cleanup() Thomas Petazzoni
2013-12-27 15:54 ` [PATCH 0/3] dma: mv_xor: spinlock related improvements Ezequiel Garcia
2013-12-27 17:48 ` Jason Cooper
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=1388397319.1871.251.camel@smile \
--to=andriy.shevchenko@intel.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).