Re: [PATCH v2 2/2] drm/imagination: Size page table preallocation by device address

From: Alessio Belle

Date: Thu Oct 08 2026 - 10:29:50 EST


Hi Gyeyoung,

On Tue, 2026-10-06 at 17:16 +0900, Gyeyoung Baek wrote:
> Hi Alessio, Brajesh,
>
> >
> > Somewhere in the description, could you also point out that the previous MMU
> > page count calculation could underflow when a mapping crossed a page table
> > boundary, that would lead to the driver preallocating a huge number of MMU
> > pages, exhausting system memory (so more or less what Sashiko pointed out in v1
> > of your VM_BIND series and in one of Brajesh's recent patches), and that the new
> > calculation also fixes that? I think it's ok to fix these together, or anyway
> > I'm fine with it in this case, but up to you if you'd rather split them.
>
> Since it's all within one function, I think keeping it in a single
> patch makes more sense.
>
> > Due to all of these and the fact that these errors are easy to trigger from
> > userspace, I think this patch needs Cc: stable@xxxxxxxxxxxxxxx below.
> >
>
> Agreed, will add.
>
> > > @@ -2337,7 +2337,7 @@ void pvr_mmu_op_context_destroy(struct pvr_mmu_op_context *op_ctx)
> > > * @ctx: MMU context associated with owning VM context.
> > > * @sgt: Scatter gather table containing pages pinned for use by this context.
> > > * @device_addr: Virtual device address at the start of the requested mapping.
> > > - * @sgt_offset: Start offset of the requested device-virtual memory mapping.
> > > + * @sgt_offset: Offset into @sgt of the start of the requested mapping.
> >
> > nit: could you also update the other similar description inside struct
> > pvr_mmu_op_context?
>
> I'll address the rest in v3 as well.

Sorry for not waiting your v3, I wanted to be certain of having these bugs (OOM
panic in particular) fixed in the next release candidate or release, so I went
ahead and applied these patches to drm-misc-fixes. I've only updated the commit
message for this one and left the comment update for another time. Many thanks
for your patches.

Alessio

>
> Thanks to both of you for the reviews!
>