Skip to content
Snippets Groups Projects
  1. Aug 19, 2019
    • Rob Herring's avatar
      drm/panfrost: Use drm_gem_shmem_purge() · 1b44e186
      Rob Herring authored
      
      This fixes 2 lockdep problems. First, it uses mutex_trylock for the
      pages_lock. Second, it drops the call to panfrost_mmu_unmap which takes
      several locks due to runtime PM. The call is not necessary because the
      unmapping will get done in GEM close instead.
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
    • Rob Herring's avatar
      drm/shmem: Use mutex_trylock in drm_gem_shmem_purge · b096555f
      Rob Herring authored
      
      Avoids a potential deadlock found by lockdep.
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      b096555f
    • Rob Herring's avatar
      drm/shmem: Do DMA unmap on purge · aed8c8e7
      Rob Herring authored
      
      [  174.218372] Unable to handle kernel paging request at virtual address ffff8000098ed000
      [  174.219072] Mem abort info:
      [  174.219323]   ESR = 0x96000147
      [  174.219596]   Exception class = DABT (current EL), IL = 32 bits
      [  174.220158]   SET = 0, FnV = 0
      [  174.220432]   EA = 0, S1PTW = 0
      [  174.220712] Data abort info:
      [  174.220970]   ISV = 0, ISS = 0x00000147
      [  174.221310]   CM = 1, WnR = 1
      [  174.221583] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000002f51000
      [  174.222172] [ffff8000098ed000] pgd=00000000401f8003, pud=00000000401f7003, pmd=00000000401b1003, pte=00e80000098ed712
      [  174.223261] Internal error: Oops: 96000147 [#1] SMP
      [  174.223690] Modules linked in: panfrost gpu_sched
      [  174.224110] CPU: 5 PID: 902 Comm: gnome-shell Not tainted 5.3.0-rc1+ #95
      [  174.224694] Hardware name: 96boards Rock960 (DT)
      [  174.225100] pstate: 40000005 (nZcv daif -PAN -UAO)
      [  174.225528] pc : __dma_inv_area+0x40/0x58
      [  174.225881] lr : arch_sync_dma_for_cpu+0x28/0x30
      [  174.226287] sp : ffff00001321ba30
      [  174.226579] x29: ffff00001321ba30 x28: ffff00001321bd08
      [  174.227045] x27: 0000000000000000 x26: 0000000000000009
      [  174.227511] x25: 0000ffffc1f86170 x24: 0000000000000000
      [  174.227976] x23: 0000000000000000 x22: 0000000000000000
      [  174.228443] x21: 0000000000021000 x20: ffff80003bb2d810
      [  174.228908] x19: 00000000098ed000 x18: 0000000000000000
      [  174.229373] x17: 0000000000000000 x16: ffff800023fd9480
      [  174.229838] x15: 0000000000000000 x14: 0000000000000000
      [  174.230303] x13: 0000000000000000 x12: 0000000000000000
      [  174.230769] x11: 00000000fffb9fff x10: 0000000000000000
      [  174.231234] x9 : 0000000000000000 x8 : ffff800023fd9c18
      [  174.231699] x7 : 0000000000000000 x6 : 00000000ffffffff
      [  174.232164] x5 : 0000000000000000 x4 : 0000000000021000
      [  174.232276] Purging 5693440 bytes
      [  174.232630] x3 : 000000000000003f x2 : 0000000000000040
      [  174.232634] x1 : ffff80000990e000 x0 : ffff8000098ed000
      [  174.233851] Call trace:
      [  174.234071]  __dma_inv_area+0x40/0x58
      [  174.234397]  dma_direct_sync_single_for_cpu+0x7c/0x80
      [  174.234840]  dma_direct_unmap_page+0x80/0x88
      [  174.235214]  dma_direct_unmap_sg+0x54/0x80
      [  174.235577]  drm_gem_shmem_free_object+0xfc/0x108
      [  174.236009]  panfrost_gem_free_object+0x118/0x128 [panfrost]
      [  174.236510]  drm_gem_object_free+0x18/0x90
      [  174.236871]  drm_gem_object_put_unlocked+0x58/0x80
      [  174.237292]  drm_gem_object_handle_put_unlocked+0x64/0xb0
      [  174.237764]  drm_gem_object_release_handle+0x70/0x98
      [  174.238204]  drm_gem_handle_delete+0x64/0xb0
      [  174.238579]  drm_gem_close_ioctl+0x28/0x38
      [  174.238938]  drm_ioctl_kernel+0xb8/0x110
      [  174.239282]  drm_ioctl+0x244/0x3f0
      [  174.239585]  do_vfs_ioctl+0xbc/0x910
      [  174.239900]  ksys_ioctl+0x78/0xa8
      [  174.240192]  __arm64_sys_ioctl+0x1c/0x28
      [  174.240539]  el0_svc_common.constprop.0+0x88/0x150
      [  174.240958]  el0_svc_handler+0x28/0x78
      [  174.241289]  el0_svc+0x8/0xc
      [  174.241547] Code: 8a230000 54000060 d50b7e20 14000002 (d5087620)
      [  174.242081] ---[ end trace aebddb72b5a04754 ]---
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      aed8c8e7
    • Rob Herring's avatar
      drm/panfrost: Fix sleeping while atomic in panfrost_gem_open · a71e3397
      Rob Herring authored
      
      BUG: sleeping function called from invalid context at kernel/locking/mutex.c:909
      in_atomic(): 1, irqs_disabled(): 0, pid: 974, name: glmark2-es2-drm
      1 lock held by glmark2-es2-drm/974:
      CPU: 5 PID: 974 Comm: glmark2-es2-drm Tainted: G        W    L    5.3.0-rc1+ #94
      Hardware name: 96boards Rock960 (DT)
      Call trace:
       dump_backtrace+0x0/0x130
       show_stack+0x14/0x20
       dump_stack+0xc4/0x10c
       ___might_sleep+0x158/0x228
       __might_sleep+0x50/0x88
       __mutex_lock+0x58/0x800
       mutex_lock_interruptible_nested+0x1c/0x28
       drm_gem_shmem_get_pages+0x24/0xa0
       drm_gem_shmem_get_pages_sgt+0x48/0xd0
       panfrost_mmu_map+0x38/0xf8 [panfrost]
       panfrost_gem_open+0xc0/0xd8 [panfrost]
       drm_gem_handle_create_tail+0xe8/0x198
       drm_gem_handle_create+0x3c/0x50
       panfrost_gem_create_with_handle+0x70/0xa0 [panfrost]
       panfrost_ioctl_create_bo+0x48/0x80 [panfrost]
       drm_ioctl_kernel+0xb8/0x110
       drm_ioctl+0x244/0x3f0
       do_vfs_ioctl+0xbc/0x910
       ksys_ioctl+0x78/0xa8
       __arm64_sys_ioctl+0x1c/0x28
       el0_svc_common.constprop.0+0x90/0x168
       el0_svc_handler+0x28/0x78
       el0_svc+0x8/0xc
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      a71e3397
  2. Aug 13, 2019
    • Rob Herring's avatar
      drm/panfrost: Implement per FD address spaces · 73a0a6a5
      Rob Herring authored
      
      Up until now, a single shared GPU address space was used. This is not
      ideal as there's no protection between processes and doesn't work for
      supporting the same GPU/CPU VA feature. Most importantly, this will
      hopefully mitigate Alyssa's fear of WebGL, whatever that is.
      
      Most of the changes here are moving struct drm_mm and struct
      panfrost_mmu objects from the per device struct to the per FD struct.
      The critical function is panfrost_mmu_as_get() which handles allocating
      and switching the h/w address spaces.
      
      There's 3 states an AS can be in: free, allocated, and in use. When a
      job runs, it requests an address space and then marks it not in use when
      job is complete(but stays assigned). The first time thru, we find a free
      AS in the alloc_mask and assign the AS to the FD. Then the next time
      thru, we most likely already have our AS and we just mark it in use with
      a ref count. We need a ref count because we have multiple job slots. If
      the job/FD doesn't have an AS assigned and there are no free ones, then
      we pick an allocated one not in use from our LRU list and switch the AS
      from the old FD to the new one.
      
      Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Steven Price <steven.price@arm.com>
      Cc: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      73a0a6a5
  3. Aug 09, 2019
  4. Aug 08, 2019
  5. Aug 07, 2019
  6. Aug 06, 2019
Loading