diff mbox

drm/ttm: specify DMA_ATTR_NO_WARN for huge page pools

Message ID 20180104141601.28555-1-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König Jan. 4, 2018, 2:16 p.m. UTC
Suppress warning messages when allocating huge pages fails since we can
always fall back to normal pages.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Alex Deucher Jan. 4, 2018, 4:15 p.m. UTC | #1
On Thu, Jan 4, 2018 at 9:16 AM, Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
> Suppress warning messages when allocating huge pages fails since we can
> always fall back to normal pages.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> index 3ac53918881e..4c659405a008 100644
> --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> @@ -333,14 +333,18 @@ static void __ttm_dma_free_page(struct dma_pool *pool, struct dma_page *d_page)
>  static struct dma_page *__ttm_dma_alloc_page(struct dma_pool *pool)
>  {
>         struct dma_page *d_page;
> +       unsigned long attrs = 0;
>         void *vaddr;
>
>         d_page = kmalloc(sizeof(struct dma_page), GFP_KERNEL);
>         if (!d_page)
>                 return NULL;
>
> -       vaddr = dma_alloc_coherent(pool->dev, pool->size, &d_page->dma,
> -                                  pool->gfp_flags);
> +       if (pool->type & IS_HUGE)
> +               attrs = DMA_ATTR_NO_WARN;
> +
> +       vaddr = dma_alloc_attrs(pool->dev, pool->size, &d_page->dma,
> +                               pool->gfp_flags, attrs);
>         if (vaddr) {
>                 if (is_vmalloc_addr(vaddr))
>                         d_page->p = vmalloc_to_page(vaddr);
> --
> 2.11.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 3ac53918881e..4c659405a008 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -333,14 +333,18 @@  static void __ttm_dma_free_page(struct dma_pool *pool, struct dma_page *d_page)
 static struct dma_page *__ttm_dma_alloc_page(struct dma_pool *pool)
 {
 	struct dma_page *d_page;
+	unsigned long attrs = 0;
 	void *vaddr;
 
 	d_page = kmalloc(sizeof(struct dma_page), GFP_KERNEL);
 	if (!d_page)
 		return NULL;
 
-	vaddr = dma_alloc_coherent(pool->dev, pool->size, &d_page->dma,
-				   pool->gfp_flags);
+	if (pool->type & IS_HUGE)
+		attrs = DMA_ATTR_NO_WARN;
+
+	vaddr = dma_alloc_attrs(pool->dev, pool->size, &d_page->dma,
+				pool->gfp_flags, attrs);
 	if (vaddr) {
 		if (is_vmalloc_addr(vaddr))
 			d_page->p = vmalloc_to_page(vaddr);