[uClinux-dev] XIP broken in 2.4.31-uc0 ? (fwd)

David McCullough davidm at snapgear.com
Thu Oct 6 06:43:31 EDT 2005


Jivin Erwin Authried lays it down ...
> Hi David,
> it doesn't crash, I'm only getting those messages when an app is
> started:
> 
> kernel BUG at mmap.c:1343!

I don't understand that,  something must still be wrong.
There were a lot of things I fixed that should mean this bug can no
longer happen.  Obviously still more to go.

Are you getting this for every app or just a particular app ?
Can you run multiple copies of "sh" now without errors ?

What filesystem are you using ?  blkmem or MTD ?

> BTW, I found that "is_in_rom()" is now only used on two places in the
> whole kernel, in mmap.c and page_alloc2.c. Do you think that we can get
> rid of this kludgy function alltogether?

It's still the heart of XIP (as in from rom) under uClinux.  Once we get
all the membacked support done in romfs/MTD/blkmem as well as
appropriate mmap support, it has to stay.  Also is_in_rom is not part of the
current problem unfortunately :-(,  but it will go along with all the
romptr code as soon as the other support is done :-)

Cheers,
Davidm

> Am Don, den 06.10.2005 schrieb David McCullough um 6:10:
> > Erwin,
> > 
> > Can you back out the previous patches you have tried and get the latest
> > updates from cvs for these files:
> > 
> > 	linux-2.4.x/mmnommu/mmap.c
> > 	linux-2.4.x/fs/proc/nommu.c
> > 	linux-2.4.x/lib/rbtree.c
> > 	linux-2.4.x/fs/binfmt_flat.c
> > 	linux-2.4.x/drivers/block/blkmem.c
> > 
> > Otherwise I have attached a patch just in case :-)
> > 
> > This should see XIP working without errors and fix various problems
> > surrounding it and the VMA house keeping.  It is running ok for me on
> > Xcopilot and the ARMulator.  Actually it was previously running for the
> > simple "it boots test", unfortunately I didn't try much harder than that
> > before pushing out 2.4.31 :-(
> > 
> > Cheers,
> > Davidm
> > 
> > 
> > Jivin Erwin Authried lays it down ...
> > > Am Don, den 22.09.2005 schrieb Erwin Authried um 11:57:
> > > > Am Mit, den 21.09.2005 schrieb Michael Leslie um 22:27:
> > > > > Hi Erwin,
> > > > > 
> > > > > I sent Greg a couple of patches for this just recently, based on 
> > > > > suggestions from Greg and David Howells. Part of the solution also 
> > > > > required satisfying the requirements of MAGIC_ROM_PTR in the arch/ code.
> > > > > 
> > > > > I've attached the patches that got XIP going for me on Motorola 68VZ328.
> > > > > They also seem _not_ to break non-XIP (I've tested on Coldfire).
> > > > > 
> > > > > I hope these help.
> > > > > 
> > > > > 
> > > > > Regards,
> > > > > 
> > > > > Michael Leslie,
> > > > > Arcturus Networks Inc.
> > > > > 
> > > > Hello Michael,
> > > > 
> > > > thanks a lot! The patch still doesn't solve the problem completely. Now
> > > > I'm getting a alignment exception in put_vma when I invoke the
> > > > application a second time. from the backtrace, the functions are:
> > > > 
> > > > sys_exit -> do_exit -> mmput -> exit_mmap -> put_vma
> > > > 
> > > > I verified that there's no problem when the load-to-ram flag is set. The
> > > > same application works with XIP on an older kernel (2.4.27-uc1).
> > > > 
> > > > Regards,
> > > > Erwin
> > > > 
> > > I found the reason for the problem now. The execption occured in kfree
> > > that's called from put_vma, instead of in put_vma as reported before.
> > > kfree crashed because it was called with the address of the
> > > application's entry point in flash. 
> > > The base address of romfs is calculated in blkmem.c, with
> > > ioremap_nocache(). In most uclinux architectures, ioremap is just a 1:1
> > > translation. In my case (w90n740), ioremap returns a pointer to
> > > noncacheable memory, by setting Bit 31 in the address. I guess that this
> > > causes  is_in_rom() to return false. At least, after removing the
> > > ioremap_nocache line in blkmem.c, everything worked fine. 
> > > But still, I have some doubts about blkmem:
> > > 
> > > * ioremap_nocache returns a pointer to memory fro non-cached access by
> > > definition. That will slow down XIP execution considerably if ioremap
> > > isn't a dummy macro.
> > > 
> > > * If blkmem isn't inside flash, kfree would try to free non-malloced
> > > memory (just a guess, I haven't verified that) when the application
> > > exits.
> > > 
> > > Regards,
> > > Erwin
> > > 
> > > 
> 
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org

-- 
David McCullough, davidm at cyberguard.com.au, Custom Embedded Solutions + Security
Ph:+61 734352815 Fx:+61 738913630 http://www.uCdot.org http://www.cyberguard.com



More information about the uClinux-dev mailing list