]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
dma-debug: change hash_bucket_find from first-fit to best-fit
authorJoerg Roedel <joerg.roedel@amd.com>
Fri, 5 Jun 2009 10:01:35 +0000 (12:01 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 2 Jul 2009 23:49:44 +0000 (16:49 -0700)
commitdfea2509864378e13b790278e6cec448342c3261
tree63a899f748326ecab84bd7951f2de90d03880ca6
parent8b735a0ff73b758aaf4010107defdada3b4561eb
dma-debug: change hash_bucket_find from first-fit to best-fit

commit 7caf6a49bb17d0377210693af5737563b31aa5ee upstream.

Some device drivers map the same physical address multiple times to a
dma address. Without an IOMMU this results in the same dma address being
put into the dma-debug hash multiple times. With a first-fit match in
hash_bucket_find() this function may return the wrong dma_debug_entry.

This can result in false positive warnings. This patch fixes it by
changing the first-fit behavior of hash_bucket_find() into a best-fit
algorithm.

Reported-by: Torsten Kaiser <just.for.lkml@googlemail.com>
Reported-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Cc: lethal@linux-sh.org
Cc: just.for.lkml@googlemail.com
Cc: hancockrwd@gmail.com
Cc: jens.axboe@oracle.com
Cc: bharrosh@panasas.com
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <20090605104132.GE24836@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/dma-debug.c