* remap_pfn_range addr page alignment
@ 2019-10-16 19:57 Alex Zhang
2019-11-05 16:04 ` Vlastimil Babka
0 siblings, 1 reply; 3+ messages in thread
From: Alex Zhang @ 2019-10-16 19:57 UTC (permalink / raw)
To: linux-mm; +Cc: Greg Thelen
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?
I see no documentation stating that nor do I see any checks
in the code for it.
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: remap_pfn_range addr page alignment
2019-10-16 19:57 remap_pfn_range addr page alignment Alex Zhang
@ 2019-11-05 16:04 ` Vlastimil Babka
2019-11-05 17:46 ` Alex Zhang
0 siblings, 1 reply; 3+ messages in thread
From: Vlastimil Babka @ 2019-11-05 16:04 UTC (permalink / raw)
To: Alex Zhang, linux-mm; +Cc: Greg Thelen
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: remap_pfn_range addr page alignment
2019-11-05 16:04 ` Vlastimil Babka
@ 2019-11-05 17:46 ` Alex Zhang
0 siblings, 0 replies; 3+ messages in thread
From: Alex Zhang @ 2019-11-05 17:46 UTC (permalink / raw)
To: Vlastimil Babka; +Cc: linux-mm, Greg Thelen
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
> >
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-05 17:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 19:57 remap_pfn_range addr page alignment Alex Zhang
2019-11-05 16:04 ` Vlastimil Babka
2019-11-05 17:46 ` Alex Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox