Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755754AbdDMGlU (ORCPT ); Thu, 13 Apr 2017 02:41:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59054 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750811AbdDMGlQ (ORCPT ); Thu, 13 Apr 2017 02:41:16 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DD882787F5 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pagupta@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DD882787F5 From: Pankaj Gupta 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 Message-Id: <1492065666-3816-1-git-send-email-pagupta@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 13 Apr 2017 06:41:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1070 Lines: 40 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 --- 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