From: Alex Zhang <zhangalex@google.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: linux-mm@kvack.org, Greg Thelen <gthelen@google.com>
Subject: Re: remap_pfn_range addr page alignment
Date: Tue, 5 Nov 2019 09:46:12 -0800 [thread overview]
Message-ID: <CA+LcrS0qKXQDdjTDvC4DP+6OBMx1RZagqMSRUsEa6AKXtJqFqA@mail.gmail.com> (raw)
In-Reply-To: <01cff98a-697e-c1b4-ddc2-9491347078a6@suse.cz>
Ah yea, I was trying to do some device memory mapping where there's an
offset into the page.
Ok, I'll submit a patch that adds a VM_BUG_ON check that "addr" is
page aligned and modify the header to reflect that.
-Alex
On Tue, Nov 5, 2019 at 8:04 AM Vlastimil Babka <vbabka@suse.cz> wrote:
>
> On 10/16/19 9:57 PM, Alex Zhang wrote:
> > Hey there!
> >
> > I was seeing some weird behavior where I was hitting
> > random BUG_ONs in memory.c . After a bit of debugging,
> > I traced it back to remap_pfn_range being my entry point
> > into memory.c . Should the "addr" passed it be page aligned?
>
> Most likely yes. How would you map if not on page boundary? I suspect it
> was a bug in the caller?
>
> > I see no documentation stating that nor do I see any checks
> > in the code for it.
>
> I suspect it was implicitly assumed. Most callers seem to pass
> vma->vm_start as addr, which is page aligned. But 'size' parameter
> alignment is fixed up, and it should be a similar case as addr.
> Maybe a VM_BUG_ON check?
>
> > Alex
> >
>
>
prev parent reply other threads:[~2019-11-05 17:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-16 19:57 Alex Zhang
2019-11-05 16:04 ` Vlastimil Babka
2019-11-05 17:46 ` Alex Zhang [this message]
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=CA+LcrS0qKXQDdjTDvC4DP+6OBMx1RZagqMSRUsEa6AKXtJqFqA@mail.gmail.com \
--to=zhangalex@google.com \
--cc=gthelen@google.com \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
/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