mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: Mark Haverkamp <markh@osdl.org>
Cc: Olof Johansson <olof@lixom.net>,
	"linuxppc64-dev@ozlabs.org" <linuxppc64-dev@ozlabs.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: iommu_alloc failure and panic
Date: Sat, 28 Jan 2006 12:34:43 +1300	[thread overview]
Message-ID: <20060127233443.GB26653@pb15.lixom.net> (raw)
In-Reply-To: <1138401590.11796.26.camel@markh3.pdx.osdl.net>

On Fri, Jan 27, 2006 at 02:39:50PM -0800, Mark Haverkamp wrote:

> I would have thought that the npages would be 1 now.

No, npages is the size of the allocation coming from the driver, that
won't chance. The table blocksize just says how wide the cacheline size
is, i.e. how far it should advance between allocations.

This is a patch that should probably have been added a while ago, to
give a bit more info. Can you apply it and give it a go?


Thanks,

Olof




Index: 2.6/arch/powerpc/kernel/iommu.c
===================================================================
--- 2.6.orig/arch/powerpc/kernel/iommu.c	2006-01-28 12:18:56.000000000 +1300
+++ 2.6/arch/powerpc/kernel/iommu.c	2006-01-28 12:31:20.000000000 +1300
@@ -146,6 +146,8 @@ static unsigned long iommu_range_alloc(s
 	if (handle)
 		*handle = end;
 
+	tbl->it_used += npages;
+
 	return n;
 }
 
@@ -214,6 +216,8 @@ static void __iommu_free(struct iommu_ta
 	
 	for (i = 0; i < npages; i++)
 		__clear_bit(free_entry+i, tbl->it_map);
+
+	tbl->it_used -= npages;
 }
 
 static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
@@ -281,9 +285,11 @@ int iommu_map_sg(struct device *dev, str
 
 		/* Handle failure */
 		if (unlikely(entry == DMA_ERROR_CODE)) {
-			if (printk_ratelimit())
-				printk(KERN_INFO "iommu_alloc failed, tbl %p vaddr %lx"
+			if (printk_ratelimit()) {
+				printk(KERN_INFO "iommu_alloc_sg failed, tbl %p vaddr %lx"
 				       " npages %lx\n", tbl, vaddr, npages);
+				printk(KERN_INFO "table size %lx used %lx\n", tbl->it_size, tbl->it_used);
+			}
 			goto failure;
 		}
 
@@ -422,6 +428,7 @@ struct iommu_table *iommu_init_table(str
 
 	tbl->it_hint = 0;
 	tbl->it_largehint = tbl->it_halfpoint;
+	tbl->it_used = 0;
 	spin_lock_init(&tbl->it_lock);
 
 	/* Clear the hardware table in case firmware left allocations in it */
@@ -496,6 +503,7 @@ dma_addr_t iommu_map_single(struct iommu
 				printk(KERN_INFO "iommu_alloc failed, "
 						"tbl %p vaddr %p npages %d\n",
 						tbl, vaddr, npages);
+				printk(KERN_INFO "table size %lx used %lx\n", tbl->it_size, tbl->it_used);
 			}
 		} else
 			dma_handle |= (uaddr & ~PAGE_MASK);
Index: 2.6/include/asm-powerpc/iommu.h
===================================================================
--- 2.6.orig/include/asm-powerpc/iommu.h	2006-01-21 03:14:30.000000000 +1300
+++ 2.6/include/asm-powerpc/iommu.h	2006-01-28 12:26:39.000000000 +1300
@@ -47,6 +47,7 @@ struct iommu_table {
 	unsigned long  it_largehint; /* Hint for large allocs */
 	unsigned long  it_halfpoint; /* Breaking point for small/large allocs */
 	spinlock_t     it_lock;      /* Protects it_map */
+	unsigned long  it_used;
 	unsigned long *it_map;       /* A simple allocation bitmap for now */
 };
 

  reply	other threads:[~2006-01-27 23:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-27 16:57 Mark Haverkamp
2006-01-27 20:40 ` Olof Johansson
2006-01-27 22:39   ` Mark Haverkamp
2006-01-27 23:34     ` Olof Johansson [this message]
2006-01-27 23:37       ` Mark Haverkamp
2006-01-30 15:32       ` Mark Haverkamp
2006-01-30 23:13         ` Olof Johansson
2006-01-31  1:18           ` Doug Maxey
2006-01-31 13:41             ` James Smart
2006-01-31 21:33               ` Mark Haverkamp
2006-01-27 23:48 ` Anton Blanchard
2006-01-28  0:00   ` Mark Haverkamp
2006-01-28  1:19     ` Anton Blanchard

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=20060127233443.GB26653@pb15.lixom.net \
    --to=olof@lixom.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc64-dev@ozlabs.org \
    --cc=markh@osdl.org \
    /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

all inboxes | Powered by JetHome®