Re: ioremap()/iounmap() problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2009-01-19 at 12:53 +0000, ext Russell King - ARM Linux wrote:
> On Mon, Jan 19, 2009 at 02:27:34PM +0200, Tomi Valkeinen wrote:
> > On Mon, 2009-01-19 at 11:01 +0000, ext Russell King - ARM Linux wrote:
> > > On Mon, Jan 19, 2009 at 12:23:03PM +0200, Tomi Valkeinen wrote:
> > > > Hi,
> > > > 
> > > > Running with latest linux-omap kernel on OMAP3 SDP board, I have problem
> > > > with iounmap(). It looks like iounmap() does not properly free large
> > > > areas. Below is a test which fails for me in 6-7 loops.
> > > > 
> > > > OMAP spesific ioremap code doesn't do much, so I think it's somewhere in
> > > > generic ARM code. I looked at the ioremap code and for larger areas the
> > > > code uses area sections, and I believe the bug is somewhere there. 
> > > 
> > > In unmap_area_sections(), try changing:
> > > 
> > >         unsigned long addr = virt, end = virt + (size & ~SZ_1M);
> > > 
> > > to
> > > 
> > >         unsigned long addr = virt, end = virt + (size & ~(SZ_1M - 1));
> > 
> > This didn't help. I Added two debug prints, not sure if it means
> > anything but the size on the second unmap is not the same as in the
> > previous ones.
> 
> If you read the comments on unmap_area_sections, you'd understand why
> this is.
> 
> > remap_area_sections(virt=d2000000, size=1000000, end=d3000000, pfn=70000)
> > unmap_area_sections(virt=d2000000, size=1000000, end=d3000000)
> > ioremapped to d2000000
> > unmap_area_sections(virt=d2000000, size=1001000, end=d3000000)
> 
> Yes, so changing that line results in 'end' being the correct 0x1000000
> bytes greater than 'virt', as can be seen from the above.  Before this
> change, end would've been 0xd3001000 which is incorrect.
> 
> Now, if there's something else wrong, please be more expansive about it.
> Please given an exact description of the failure you're seeing.  (I'm
> not going to be able to try your test program for several days.)

The original problem remains, it looks to me that iounmap() doesn't free
the memory, and thus ioremap will fail after couple of loops.

I get the following error on console:

vmap allocation for size 16781312 failed: use vmalloc=<size> to increase
size.

I don't know too much about memory management, but I'll try to dig
deeper in to this.

What I don't understand is that in __arm_ioremap_pfn() there's
get_vm_area(), and later in the function, in case of error, that area is
vunmap()ed. But there's no vunmap() done anywhere else in the code for
area sections, so who does free it?

 Tomi


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux