constrain drm alloc_pages() to dma range

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

constrain drm alloc_pages() to dma range

Jonathan Gray-11
When trying to use alloc_page from ttm with radeon on an amd64
machine with 8GB physmem the system would panic part way through
taking over the console along the lines of

'panic: Non dma-reachable buffer at paddr 0x1ef221000(raw)'

This adds the dma constraints ttm_uvm_alloc_page() has.

Index: drm_linux.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.c,v
retrieving revision 1.15
diff -u -p -r1.15 drm_linux.c
--- drm_linux.c 12 Jul 2017 20:12:19 -0000 1.15
+++ drm_linux.c 12 Jan 2018 03:36:20 -0000
@@ -204,8 +204,8 @@ alloc_pages(unsigned int gfp_mask, unsig
  flags |= UVM_PLA_ZERO;
 
  TAILQ_INIT(&mlist);
- if (uvm_pglistalloc(PAGE_SIZE << order, 0, -1, PAGE_SIZE, 0,
-    &mlist, 1, flags))
+ if (uvm_pglistalloc(PAGE_SIZE << order, dma_constraint.ucr_low,
+    dma_constraint.ucr_high, PAGE_SIZE, 0, &mlist, 1, flags))
  return NULL;
  return TAILQ_FIRST(&mlist);
 }

Reply | Threaded
Open this post in threaded view
|

Re: constrain drm alloc_pages() to dma range

David Gwynne-5

> On 12 Jan 2018, at 13:53, Jonathan Gray <[hidden email]> wrote:
>
> When trying to use alloc_page from ttm with radeon on an amd64
> machine with 8GB physmem the system would panic part way through
> taking over the console along the lines of
>
> 'panic: Non dma-reachable buffer at paddr 0x1ef221000(raw)'
>
> This adds the dma constraints ttm_uvm_alloc_page() has.

ok.

>
> Index: drm_linux.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 drm_linux.c
> --- drm_linux.c 12 Jul 2017 20:12:19 -0000 1.15
> +++ drm_linux.c 12 Jan 2018 03:36:20 -0000
> @@ -204,8 +204,8 @@ alloc_pages(unsigned int gfp_mask, unsig
> flags |= UVM_PLA_ZERO;
>
> TAILQ_INIT(&mlist);
> - if (uvm_pglistalloc(PAGE_SIZE << order, 0, -1, PAGE_SIZE, 0,
> -    &mlist, 1, flags))
> + if (uvm_pglistalloc(PAGE_SIZE << order, dma_constraint.ucr_low,
> +    dma_constraint.ucr_high, PAGE_SIZE, 0, &mlist, 1, flags))
> return NULL;
> return TAILQ_FIRST(&mlist);
> }
>

Reply | Threaded
Open this post in threaded view
|

Re: constrain drm alloc_pages() to dma range

Mark Kettenis
In reply to this post by Jonathan Gray-11
> Date: Fri, 12 Jan 2018 14:53:20 +1100
> From: Jonathan Gray <[hidden email]>
>
> When trying to use alloc_page from ttm with radeon on an amd64
> machine with 8GB physmem the system would panic part way through
> taking over the console along the lines of
>
> 'panic: Non dma-reachable buffer at paddr 0x1ef221000(raw)'
>
> This adds the dma constraints ttm_uvm_alloc_page() has.

At some point it would be good if at least for the graphics stuff we
could allocate "high" memory, but for now this is better to be safe
than sorry.  Might have some impact on inteldrm(4) users on modern
hardware but we probably won't find out until this gets committed.

ok kettenis@

> Index: drm_linux.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 drm_linux.c
> --- drm_linux.c 12 Jul 2017 20:12:19 -0000 1.15
> +++ drm_linux.c 12 Jan 2018 03:36:20 -0000
> @@ -204,8 +204,8 @@ alloc_pages(unsigned int gfp_mask, unsig
>   flags |= UVM_PLA_ZERO;
>  
>   TAILQ_INIT(&mlist);
> - if (uvm_pglistalloc(PAGE_SIZE << order, 0, -1, PAGE_SIZE, 0,
> -    &mlist, 1, flags))
> + if (uvm_pglistalloc(PAGE_SIZE << order, dma_constraint.ucr_low,
> +    dma_constraint.ucr_high, PAGE_SIZE, 0, &mlist, 1, flags))
>   return NULL;
>   return TAILQ_FIRST(&mlist);
>  }
>
>