Re: [PATCH v2 5/6] drm/panfrost: Implement generic DRM object RSS reporting function

From: Boris Brezillon
Date: Fri Sep 01 2023 - 02:45:07 EST


On Fri, 1 Sep 2023 01:03:23 +0100
Adrián Larumbe <adrian.larumbe@xxxxxxxxxxxxx> wrote:

> >> @@ -274,13 +286,23 @@ panfrost_gem_prime_import_sg_table(struct drm_device *dev,
> >> {
> >> struct drm_gem_object *obj;
> >> struct panfrost_gem_object *bo;
> >> + struct scatterlist *sgl;
> >> + unsigned int count;
> >> + size_t total = 0;
> >>
> >> obj = drm_gem_shmem_prime_import_sg_table(dev, attach, sgt);
> >> if (IS_ERR(obj))
> >> return ERR_CAST(obj);
> >>
> >> + for_each_sgtable_dma_sg(sgt, sgl, count) {
> >> + size_t len = sg_dma_len(sgl);
> >> +
> >> + total += len;
> >> + }
> >
> >Why not simply have bo->rss_size = obj->size here? Not sure I see a
> >reason to not trust dma_buf?
>
> Can PRIME-imported BO's ever be heap objects?

Nope, heap BOs can't be exported, and if they can, that's probably a
bug we need to fix.