Re: [PATCH] drm/ttm: make sure pool pages are cleared

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 10, 2021 at 5:05 PM Christian König
<ckoenig.leichtzumerken@xxxxxxxxx> wrote:
>
> The old implementation wasn't consistend on this.
>
> But it looks like we depend on this so better bring it back.
>
> Signed-off-by: Christian König <christian.koenig@xxxxxxx>
> Reported-and-tested-by: Mike Galbraith <efault@xxxxxx>
> Fixes: d099fc8f540a ("drm/ttm: new TT backend allocation pool v3")

Well I think in general there's a bit an issue in ttm with not
clearing stuff everywhere. So definitely in favour of clearing stuff.
Looking at the code this only fixes the clearing, at alloc time we're
still very optional with clearing. I think we should just set
__GFP_ZERO unconditionally there too.

With that: Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> ---
>  drivers/gpu/drm/ttm/ttm_pool.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
> index 74bf1c84b637..6e27cb1bf48b 100644
> --- a/drivers/gpu/drm/ttm/ttm_pool.c
> +++ b/drivers/gpu/drm/ttm/ttm_pool.c
> @@ -33,6 +33,7 @@
>
>  #include <linux/module.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/highmem.h>
>
>  #ifdef CONFIG_X86
>  #include <asm/set_memory.h>
> @@ -218,6 +219,15 @@ static void ttm_pool_unmap(struct ttm_pool *pool, dma_addr_t dma_addr,
>  /* Give pages into a specific pool_type */
>  static void ttm_pool_type_give(struct ttm_pool_type *pt, struct page *p)
>  {
> +       unsigned int i, num_pages = 1 << pt->order;
> +
> +       for (i = 0; i < num_pages; ++i) {
> +               if (PageHighMem(p))
> +                       clear_highpage(p + i);
> +               else
> +                       clear_page(page_address(p + i));
> +       }
> +
>         spin_lock(&pt->lock);
>         list_add(&p->lru, &pt->pages);
>         spin_unlock(&pt->lock);
> --
> 2.25.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux