linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-debug: Make locking to work for RT
@ 2017-04-13  6:41 Pankaj Gupta
  0 siblings, 0 replies; only message in thread
From: Pankaj Gupta @ 2017-04-13  6:41 UTC (permalink / raw)
  To: linux-kernel, linux-rt-users
  Cc: akpm, mingo, niklas.soderlund+renesas, vinod.koul, luto,
	ville.syrjala, miles.chen, mtosatti

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-13  6:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-13  6:41 [PATCH] dma-debug: Make locking to work for RT Pankaj Gupta

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).