Message ID | 20240421215309.660018-6-mcanal@igalia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/v3d: Enable Big and Super Pages | expand |
Thanks Maíra, this patch is: Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Iago El dom, 21-04-2024 a las 18:44 -0300, Maíra Canal escribió: > Currently, we are using an alignment of 128 kB to insert a node, > which > ends up wasting memory as we perform plenty of small BOs allocations > (<= 4 kB). We require that allocations are aligned to 128Kb so for > any > allocation smaller than that, we are wasting the difference. > > This implies that we cannot effectively use the whole 4 GB address > space > available for the GPU in the RPi 4. Currently, we can allocate up to > 32000 BOs of 4 kB (~140 MB) and 3000 BOs of 400 kB (~1,3 GB). This > can be > quite limiting for applications that have a high memory requirement, > such > as vkoverhead [1]. > > By reducing the page alignment to 4 kB, we can allocate up to 1000000 > BOs > of 4 kB (~4 GB) and 10000 BOs of 400 kB (~4 GB). Moreover, by > performing > benchmarks, we were able to attest that reducing the page alignment > to > 4 kB can provide a general performance improvement in OpenGL > applications (e.g. glmark2). > > Therefore, this patch reduces the alignment of the node allocation to > 4 > kB, which will allow RPi users to explore the whole 4GB virtual > address space provided by the hardware. Also, this patch allow users > to > fully run vkoverhead in the RPi 4/5, solving the issue reported in > [1]. > > [1] https://github.com/zmike/vkoverhead/issues/14 > > Signed-off-by: Maíra Canal <mcanal@igalia.com> > --- > drivers/gpu/drm/v3d/v3d_bo.c | 2 +- > drivers/gpu/drm/v3d/v3d_drv.h | 2 -- > 2 files changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/v3d/v3d_bo.c > b/drivers/gpu/drm/v3d/v3d_bo.c > index a07ede668cc1..79e31c5299b1 100644 > --- a/drivers/gpu/drm/v3d/v3d_bo.c > +++ b/drivers/gpu/drm/v3d/v3d_bo.c > @@ -110,7 +110,7 @@ v3d_bo_create_finish(struct drm_gem_object *obj) > */ > ret = drm_mm_insert_node_generic(&v3d->mm, &bo->node, > obj->size >> > V3D_MMU_PAGE_SHIFT, > - GMP_GRANULARITY >> > V3D_MMU_PAGE_SHIFT, 0, 0); > + SZ_4K >> > V3D_MMU_PAGE_SHIFT, 0, 0); > spin_unlock(&v3d->mm_lock); > if (ret) > return ret; > diff --git a/drivers/gpu/drm/v3d/v3d_drv.h > b/drivers/gpu/drm/v3d/v3d_drv.h > index d2ce8222771a..17236ee23490 100644 > --- a/drivers/gpu/drm/v3d/v3d_drv.h > +++ b/drivers/gpu/drm/v3d/v3d_drv.h > @@ -17,8 +17,6 @@ struct clk; > struct platform_device; > struct reset_control; > > -#define GMP_GRANULARITY (128 * 1024) > - > #define V3D_MMU_PAGE_SHIFT 12 > > #define V3D_MAX_QUEUES (V3D_CPU + 1)
diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c index a07ede668cc1..79e31c5299b1 100644 --- a/drivers/gpu/drm/v3d/v3d_bo.c +++ b/drivers/gpu/drm/v3d/v3d_bo.c @@ -110,7 +110,7 @@ v3d_bo_create_finish(struct drm_gem_object *obj) */ ret = drm_mm_insert_node_generic(&v3d->mm, &bo->node, obj->size >> V3D_MMU_PAGE_SHIFT, - GMP_GRANULARITY >> V3D_MMU_PAGE_SHIFT, 0, 0); + SZ_4K >> V3D_MMU_PAGE_SHIFT, 0, 0); spin_unlock(&v3d->mm_lock); if (ret) return ret; diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h index d2ce8222771a..17236ee23490 100644 --- a/drivers/gpu/drm/v3d/v3d_drv.h +++ b/drivers/gpu/drm/v3d/v3d_drv.h @@ -17,8 +17,6 @@ struct clk; struct platform_device; struct reset_control; -#define GMP_GRANULARITY (128 * 1024) - #define V3D_MMU_PAGE_SHIFT 12 #define V3D_MAX_QUEUES (V3D_CPU + 1)
Currently, we are using an alignment of 128 kB to insert a node, which ends up wasting memory as we perform plenty of small BOs allocations (<= 4 kB). We require that allocations are aligned to 128Kb so for any allocation smaller than that, we are wasting the difference. This implies that we cannot effectively use the whole 4 GB address space available for the GPU in the RPi 4. Currently, we can allocate up to 32000 BOs of 4 kB (~140 MB) and 3000 BOs of 400 kB (~1,3 GB). This can be quite limiting for applications that have a high memory requirement, such as vkoverhead [1]. By reducing the page alignment to 4 kB, we can allocate up to 1000000 BOs of 4 kB (~4 GB) and 10000 BOs of 400 kB (~4 GB). Moreover, by performing benchmarks, we were able to attest that reducing the page alignment to 4 kB can provide a general performance improvement in OpenGL applications (e.g. glmark2). Therefore, this patch reduces the alignment of the node allocation to 4 kB, which will allow RPi users to explore the whole 4GB virtual address space provided by the hardware. Also, this patch allow users to fully run vkoverhead in the RPi 4/5, solving the issue reported in [1]. [1] https://github.com/zmike/vkoverhead/issues/14 Signed-off-by: Maíra Canal <mcanal@igalia.com> --- drivers/gpu/drm/v3d/v3d_bo.c | 2 +- drivers/gpu/drm/v3d/v3d_drv.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)