Re: [drm:qxl] BUG: sleeping function called from invalid context - qxl_bo_kmap_atomic_page()...splat

From: Mike Galbraith
Date: Thu May 11 2017 - 13:24:31 EST


On Tue, 2017-05-09 at 04:37 +0200, Mike Galbraith wrote:
> On Mon, 2017-05-08 at 16:48 -0300, Gabriel Krisman Bertazi wrote:
>
> > Thanks for reporting this. Can you confirm the following patch prevents
> > the issue?
>
> Nope, it still gripes.

The reason for this gripe is that we find that we don't have memory
reserved.. a tad too late.

Xorg-2252 [000] .... 135.409756: qxl_release_map <-qxl_cursor_atomic_update
Xorg-2252 [000] .... 135.409756: qxl_bo_kmap_atomic_page <-qxl_release_map
Xorg-2252 [000] .... 135.409757: qxl_bo_kmap_atomic_page: ENTER
Xorg-2252 [000] .... 135.409757: ttm_mem_io_lock <-qxl_bo_kmap_atomic_page
Xorg-2252 [000] .... 135.409757: ttm_mem_io_reserve <-qxl_bo_kmap_atomic_page
Xorg-2252 [000] .... 135.409757: qxl_ttm_io_mem_reserve <-ttm_mem_io_reserve
Xorg-2252 [000] .... 135.409757: ttm_mem_io_unlock <-qxl_bo_kmap_atomic_page
Xorg-2252 [000] .... 135.409757: qxl_bo_kmap_atomic_page: PREEMPTION DISABLED
Xorg-2252 [000] ...1 135.409758: qxl_bo_kmap <-qxl_cursor_atomic_update
Xorg-2252 [000] ...1 135.409758: ttm_bo_kmap <-qxl_bo_kmap <== too late
Xorg-2252 [000] ...1 135.409758: ttm_mem_io_reserve <-ttm_bo_kmap
Xorg-2252 [000] ...1 135.409758: qxl_ttm_io_mem_reserve <-ttm_mem_io_reserve
Xorg-2252 [000] ...1 135.409759: ioremap_nocache <-ttm_bo_kmap <== game over
Xorg-2252 [000] ...1 135.409759: __ioremap_caller <-ioremap_nocache
Xorg-2252 [000] ...1 135.409759: walk_system_ram_range <-__ioremap_caller
Xorg-2252 [000] ...1 135.409759: find_next_iomem_res <-walk_system_ram_range
Xorg-2252 [000] ...1 135.409759: _raw_read_lock <-find_next_iomem_res
Xorg-2252 [000] ...1 135.409760: reserve_memtype <-__ioremap_caller
Xorg-2252 [000] ...1 135.409760: pat_pagerange_is_ram <-reserve_memtype
Xorg-2252 [000] ...1 135.409761: walk_system_ram_range <-pat_pagerange_is_ram
Xorg-2252 [000] ...1 135.409761: find_next_iomem_res <-walk_system_ram_range
Xorg-2252 [000] ...1 135.409761: _raw_read_lock <-find_next_iomem_res
Xorg-2252 [000] ...1 135.409761: kmem_cache_alloc_trace <-reserve_memtype
Xorg-2252 [000] ...1 135.409761: __might_sleep <-kmem_cache_alloc_trace
Xorg-2252 [000] ...1 135.409762: ___might_sleep <-__might_sleep