pitch alignment questions

Yu Zhao yuzhao at google.com
Fri Jan 11 21:37:47 UTC 2019

On Fri, Jan 11, 2019 at 04:27:44PM +0100, Michel Dänzer wrote:
> On 2019-01-10 6:56 p.m., Przemek Socha wrote:
> >
> > [  147.846148] [drm:amdgpu_display_user_framebuffer_create [amdgpu]] Invalid 
> > pitch: expecting 10752 but got 10624
> > [  147.846155] [drm:drm_internal_framebuffer_create] could not create 
> > framebuffer"
> Thanks, this confirms that the check is too strict. I've sent a patch
> reverting this as well.
> Yu, I like the idea behind your changes, but unfortunately it's more
> complicated than that. If you want to work on similar checks which
> accurately reflect the hardware constraints, people on the amd-gfx list
> should be able to help with that.

Hi Michel, sorry for the troubles.

Background: after we turned on iommu with amd_iommu=force_isolation,
we saw io page faults from amd gpu (stoney ridge). We tracked it
down to userspace using 32-pixel pitch alignment, which seems smaller
than the minimum alignment supported by the hw. Instead of rejecting
the alignment, we suspect, it uses 64-pixel alignment to do dma. The
larger alignment sometimes causes out of bound memory accesses, thus
the io page faults.

I created the following patch and hoped it could fix the problem:
Well, it does on our stoney ridge based chromebook but also breaks
other platforms.

So my questions to the amd gpu experts here:
1) how do properly validate pitch alignment passed to kernel space?
2) if it's not easy, what would invalid alignment cause at worst?

Thank you.

More information about the amd-gfx mailing list