From: Pankaj Gupta <pagupta@redhat.com>
To: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org
Cc: akpm@linux-foundation.org, mingo@kernel.org,
niklas.soderlund+renesas@ragnatech.se, vinod.koul@intel.com,
luto@kernel.org, ville.syrjala@linux.intel.com,
miles.chen@mediatek.com, mtosatti@redhat.com
Subject: [PATCH] dma-debug: Make locking to work for RT
Date: Thu, 13 Apr 2017 12:11:06 +0530 [thread overview]
Message-ID: <1492065666-3816-1-git-send-email-pagupta@redhat.com> (raw)
Interrupt enable/disabled with spinlock is not a valid
implementation for RT as it can make executing task to
sleep from a non-sleepable context. So, converting it
to spin_lock_irq[save, restore].
Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
---
lib/dma-debug.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index b157b46..fe4d50c 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -942,21 +942,17 @@ static int device_dma_allocations(struct device *dev, struct dma_debug_entry **o
unsigned long flags;
int count = 0, i;
- local_irq_save(flags);
-
for (i = 0; i < HASH_SIZE; ++i) {
- spin_lock(&dma_entry_hash[i].lock);
+ spin_lock_irqsave(&dma_entry_hash[i].lock, flags);
list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
if (entry->dev == dev) {
count += 1;
*out_entry = entry;
}
}
- spin_unlock(&dma_entry_hash[i].lock);
+ spin_unlock_irqrestore(&dma_entry_hash[i].lock, flags);
}
- local_irq_restore(flags);
-
return count;
}
--
2.7.4
reply other threads:[~2017-04-13 6:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1492065666-3816-1-git-send-email-pagupta@redhat.com \
--to=pagupta@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=luto@kernel.org \
--cc=miles.chen@mediatek.com \
--cc=mingo@kernel.org \
--cc=mtosatti@redhat.com \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=ville.syrjala@linux.intel.com \
--cc=vinod.koul@intel.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;
as well as URLs for NNTP newsgroup(s).