linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>, Ingo Molnar <mingo@redhat.com>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] dma-debug: add additional checks
Date: Wed, 18 Mar 2009 13:19:40 +0100	[thread overview]
Message-ID: <20090318121940.GT6159@amd.com> (raw)
In-Reply-To: <1237376327.5069.253.camel@laptop>

On Wed, Mar 18, 2009 at 12:38:47PM +0100, Peter Zijlstra wrote:
> On Wed, 2009-03-18 at 12:23 +0100, Ingo Molnar wrote:
> > another -tip testbox started triggering:
> > 
> >   BUG: MAX_LOCKDEP_ENTRIES too low!
> > 
> > it triggers due to CONFIG_DMA_API_DEBUG=y. Config attached.
> 
> 
> I still have this laying about.. could be we're just at the limit due to
> lock bloat in the kernel, could be dma_api_debug is doing something
> all-together iffy

I had a look and the maximum locking depth in dma-debug code was two.
Attached patch reduces this to one.

>From d28fc4a308bf66ed98c68e1db18e4e1434206541 Mon Sep 17 00:00:00 2001
From: Joerg Roedel <joerg.roedel@amd.com>
Date: Wed, 18 Mar 2009 13:15:20 +0100
Subject: [PATCH] dma-debug: serialize locking in unmap path

Impact: reduce maximum lockdepth to one

This patch reduces the maximum spin lock depth from two to one in the
dma-debug code.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 lib/dma-debug.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 9a350b4..3bd8d1d 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -542,7 +542,8 @@ static void check_unmap(struct dma_debug_entry *ref)
 			   "to free DMA memory it has not allocated "
 			   "[device address=0x%016llx] [size=%llu bytes]\n",
 			   ref->dev_addr, ref->size);
-		goto out;
+		put_hash_bucket(bucket, &flags);
+		return;
 	}
 
 	if (ref->size != entry->size) {
@@ -593,10 +594,8 @@ static void check_unmap(struct dma_debug_entry *ref)
 	}
 
 	hash_bucket_del(entry);
-	dma_entry_free(entry);
-
-out:
 	put_hash_bucket(bucket, &flags);
+	dma_entry_free(entry);
 }
 
 static void check_for_stack(struct device *dev, void *addr)
-- 
1.5.6.4


-- 
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Jochen Polster, Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632


  parent reply	other threads:[~2009-03-18 12:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-16 17:05 [PATCH 0/3] dma-debug: add additional checks Joerg Roedel
2009-03-16 17:05 ` [PATCH 1/3] dma-debug: add checks for kernel text and rodata Joerg Roedel
2009-03-16 17:05 ` [PATCH 2/3] dma-debug: add a check dma memory leaks Joerg Roedel
2009-03-16 17:05 ` [PATCH 3/3] dma-debug/x86: register pci bus for dma-debug leak detection Joerg Roedel
2009-03-17 12:01 ` [PATCH 0/3] dma-debug: add additional checks Joerg Roedel
2009-03-18  9:38   ` Ingo Molnar
2009-03-18 11:20     ` forcedeth 0000:00:0a.0: DMA-API: device driver frees DMA memory with wrong function [device address=0x0000000035992232] [size=42 bytes] [mapped as single] [unmapped as page] Ingo Molnar
2009-03-18 11:23     ` [PATCH 0/3] dma-debug: add additional checks Ingo Molnar
2009-03-18 11:38       ` Peter Zijlstra
2009-03-18 11:57         ` [tip:core/locking] lockdep: add stack dumps to asserts Peter Zijlstra
2009-03-18 12:19         ` Joerg Roedel [this message]
2009-03-18 12:28           ` [PATCH 0/3] dma-debug: add additional checks Peter Zijlstra
2009-03-18 12:45             ` Ingo Molnar
2009-03-31 12:57         ` [tip:core/locking] lockdep: add stack dumps to asserts Peter Zijlstra
2009-03-18 11:28     ` e1000e 0000:04:00.0: DMA-API: device driver frees DMA memory with wrong function [device address=0x000000003e5a2c02] [size=42 bytes] [mapped as single] [unmapped as page] Ingo Molnar
2009-03-18 11:56     ` [PATCH 0/3] dma-debug: add additional checks Joerg Roedel
2009-03-18 12:04       ` e1000e 0000:00:19.0: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x0000000052ff084a] [size=90 bytes] Ingo Molnar
2009-03-18 12:54         ` Lubomir Rintel
2009-03-18 14:09           ` Ingo Molnar
2009-03-18 14:21             ` forcedeth 0000:00:0a.0: DMA-API: device driver frees DMA memory with wrong function [device address=0x0000000035992232] [size=42 bytes] [mapped as single] [unmapped as page] Ingo Molnar
2009-03-18 16:43             ` e1000e 0000:00:19.0: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x0000000052ff084a] [size=90 bytes] Brandeburg, Jesse
2009-03-18 16:47               ` Ingo Molnar
2009-03-18 17:41                 ` Brandeburg, Jesse
2009-03-18 17:53                   ` Ingo Molnar
2009-03-20 17:33             ` 3c59x 0000:00:0b.0: DMA-API: device driver maps memory from kernel text or rodata [addr=c0fffe54] [size=428] Ingo Molnar
2009-03-18 10:00   ` [tip:core/iommu] dma-debug: fix dma_debug_add_bus() definition for !CONFIG_DMA_API_DEBUG Ingo Molnar
2009-03-18 11:54     ` Joerg Roedel

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=20090318121940.GT6159@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.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).