Re: constrain drm alloc_pages() to dma range

2018-01-12 Thread Mark Kettenis
> Date: Fri, 12 Jan 2018 14:53:20 +1100
> From: Jonathan Gray 
> 
> 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 -  1.15
> +++ drm_linux.c   12 Jan 2018 03:36:20 -
> @@ -204,8 +204,8 @@ alloc_pages(unsigned int gfp_mask, unsig
>   flags |= UVM_PLA_ZERO;
>  
>   TAILQ_INIT();
> - if (uvm_pglistalloc(PAGE_SIZE << order, 0, -1, PAGE_SIZE, 0,
> - , 1, flags))
> + if (uvm_pglistalloc(PAGE_SIZE << order, dma_constraint.ucr_low,
> + dma_constraint.ucr_high, PAGE_SIZE, 0, , 1, flags))
>   return NULL;
>   return TAILQ_FIRST();
>  }
> 
> 



Re: constrain drm alloc_pages() to dma range

2018-01-11 Thread David Gwynne

> On 12 Jan 2018, at 13:53, Jonathan Gray  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 -  1.15
> +++ drm_linux.c   12 Jan 2018 03:36:20 -
> @@ -204,8 +204,8 @@ alloc_pages(unsigned int gfp_mask, unsig
>   flags |= UVM_PLA_ZERO;
> 
>   TAILQ_INIT();
> - if (uvm_pglistalloc(PAGE_SIZE << order, 0, -1, PAGE_SIZE, 0,
> - , 1, flags))
> + if (uvm_pglistalloc(PAGE_SIZE << order, dma_constraint.ucr_low,
> + dma_constraint.ucr_high, PAGE_SIZE, 0, , 1, flags))
>   return NULL;
>   return TAILQ_FIRST();
> }
> 



constrain drm alloc_pages() to dma range

2018-01-11 Thread Jonathan Gray
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 -  1.15
+++ drm_linux.c 12 Jan 2018 03:36:20 -
@@ -204,8 +204,8 @@ alloc_pages(unsigned int gfp_mask, unsig
flags |= UVM_PLA_ZERO;
 
TAILQ_INIT();
-   if (uvm_pglistalloc(PAGE_SIZE << order, 0, -1, PAGE_SIZE, 0,
-   , 1, flags))
+   if (uvm_pglistalloc(PAGE_SIZE << order, dma_constraint.ucr_low,
+   dma_constraint.ucr_high, PAGE_SIZE, 0, , 1, flags))
return NULL;
return TAILQ_FIRST();
 }