From: Bob Liu <lliubbo@gmail.com>
To: Greg Ungerer <gerg@snapgear.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
dhowells@redhat.com, lethal@linux-sh.org, gerg@uclinux.org,
walken@google.com, daniel-gl@gmx.net, vapier@gentoo.org,
geert@linux-m68k.org, uclinux-dist-devel@blackfin.uclinux.org
Subject: Re: [PATCH v2] nommu: add page_align to mmap
Date: Thu, 9 Jun 2011 18:30:59 +0800 [thread overview]
Message-ID: <BANLkTi=AJ=0pFx2OXENZF4p4gh7V2RXmXw@mail.gmail.com> (raw)
In-Reply-To: <4DEF4CC5.7040403@snapgear.com>
On Wed, Jun 8, 2011 at 6:19 PM, Greg Ungerer <gerg@snapgear.com> wrote:
>
> Hi Bob,
>
> On 08/06/11 17:18, Bob Liu wrote:
>>
>> Hi, Greg
>>
>> On Wed, Jun 8, 2011 at 12:47 PM, Greg Ungerer<gerg@snapgear.com> wrote:
>>>
>>> Hi Bob,
>>>
>>> On 07/06/11 16:19, Bob Liu wrote:
>>>>
>>>> On Fri, Jun 3, 2011 at 2:37 PM, Greg Ungerer<gerg@snapgear.com>
>>>> áwrote:
>>>>>
>>>>> Hi Bob,
>>>>>
>>>>> On 06/05/11 16:03, Bob Liu wrote:
>>>>>>
>>>>>> Currently on nommu arch mmap(),mremap() and munmap() doesn't do
>>>>>> page_align()
>>>>>> which isn't consist with mmu arch and cause some issues.
>>>>>>
>>>>>> First, some drivers' mmap() function depends on vma->vm_end -
>>>>>> vma->start
>>>>>> is
>>>>>> page aligned which is true on mmu arch but not on nommu. eg: uvc
>>>>>> camera
>>>>>> driver.
>>>>>>
>>>>>> Second munmap() may return -EINVAL[split file] error in cases when end
>>>>>> is
>>>>>> not
>>>>>> page aligned(passed into from userspace) but vma->vm_end is aligned
>>>>>> dure
>>>>>> to
>>>>>> split or driver's mmap() ops.
>>>>>>
>>>>>> This patch add page align to fix those issues.
>>>>>
>>>>> This is actually causing me problems on head at the moment.
>>>>> git bisected to this patch as the cause.
>>>>>
>>>>> When booting on a ColdFire (m68knommu) target the init process (or
>>>>> there abouts at least) fails. Last console messages are:
>>>>>
>>>>> ├Ã...
>>>>> ├ÃVFS: Mounted root (romfs filesystem) readonly on device 31:0.
>>>>> ├ÃFreeing unused kernel memory: 52k freed (0x401aa000 - 0x401b6000)
>>>>> ├ÃUnable to mmap process text, errno 22
>>>>>
>>>>
>>>> Oh, bad news. I will try to reproduce it on my board.
>>>> If you are free please enable debug in nommu.c and then we can see what
>>>> caused the problem.
>>>
>>> Yep, with debug on:
>>>
>>> á...
>>> áVFS: Mounted root (romfs filesystem) readonly on device 31:0.
>>> áFreeing unused kernel memory: 52k freed (0x4018c000 - 0x40198000)
>>> á==> do_mmap_pgoff(,0,6780,5,1002,0)
>>> á<== do_mmap_pgoff() = -22
>>> áUnable to mmap process text, errno 22
>>>
>>
>> Since I can't reproduce this problem, could you please attach the
>> whole dmesg log with nommu debug on or
>> you can step into to see why errno 22 is returned, is it returned by
>> do_mmap_private()?
>
> There was no other debug messages with debug turned on in nommu.c.
> (I can give you the boot msgs before this if you want, but there
> was no nommu.c debug in it).
>
> But I did trace it into do_mmap_pgoff() to see what was failing.
> It fails based on the return value from:
>
> addr = file->f_op->get_unmapped_area(file, addr, len,
> pgoff, flags);
>
Thanks for this information.
But it's a callback function. I still can't know what's the problem maybe.
Would you do me a favor to do more trace to see where it callback to,
fs or some driver etc..?
>
> Theres only one call of this inside do_mmap_pgoff() so you its
> easy to find.
>
> Regards
> Greg
>
>
>
>>> I can confirm that the PAGE_ALIGN(len) change in do_mmap_pgoff()
>>> is enough to cause this too.
>>>
>>> Regards
>>> Greg
>>>
>>>
>>>
>>>
>>>>> I haven't really debugged it any further yet. But that error message
>>>>> comes from fs/binfmt_flat.c, it is reporting a failed do_mmap() call.
>>>>>
>>>>> Reverting that this patch and no more problem.
>>>>>
>>>>> Regards
>>>>> Greg
>>>>>
--
Regards,
--Bob
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-06-09 10:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 6:03 Bob Liu
2011-06-03 6:37 ` Greg Ungerer
2011-06-07 6:19 ` Bob Liu
2011-06-08 4:47 ` Greg Ungerer
2011-06-08 7:18 ` Bob Liu
2011-06-08 10:19 ` Greg Ungerer
2011-06-09 10:30 ` Bob Liu [this message]
2011-06-10 3:51 ` Greg Ungerer
2011-06-10 5:39 ` Bob Liu
2011-06-10 12:24 ` Greg Ungerer
2011-06-14 1:32 ` Greg Ungerer
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='BANLkTi=AJ=0pFx2OXENZF4p4gh7V2RXmXw@mail.gmail.com' \
--to=lliubbo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=daniel-gl@gmx.net \
--cc=dhowells@redhat.com \
--cc=geert@linux-m68k.org \
--cc=gerg@snapgear.com \
--cc=gerg@uclinux.org \
--cc=lethal@linux-sh.org \
--cc=linux-mm@kvack.org \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
--cc=vapier@gentoo.org \
--cc=walken@google.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