Re: [PATCH 8/8] drm/amdgpu: add drm buddy support to amdgpu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/11/2021 07:34, Christian König wrote:


Am 03.11.21 um 20:25 schrieb Matthew Auld:
On 25/10/2021 14:00, Arunpravin wrote:
- Remove drm_mm references and replace with drm buddy functionalities
- Add res cursor support for drm buddy

Signed-off-by: Arunpravin <Arunpravin.PaneerSelvam@xxxxxxx>

<snip>

+        spin_lock(&mgr->lock);
+        r = drm_buddy_alloc(mm, (uint64_t)place->fpfn << PAGE_SHIFT,
+                    (uint64_t)lpfn << PAGE_SHIFT,
+                    (uint64_t)n_pages << PAGE_SHIFT,
+                     min_page_size, &node->blocks,
+                     node->flags);


Is spinlock + GFP_KERNEL allowed?

Nope it isn't, but does that function really calls kmalloc()?

It calls kmem_cache_zalloc(..., GFP_KERNEL)


Christian.


+        spin_unlock(&mgr->lock);
+
+        if (unlikely(r))
+            goto error_free_blocks;
+
          pages_left -= pages;
          ++i;
            if (pages > pages_left)
              pages = pages_left;
      }
-    spin_unlock(&mgr->lock);
+
+    /* Free unused pages for contiguous allocation */
+    if (place->flags & TTM_PL_FLAG_CONTIGUOUS) {
+        uint64_t actual_size = (uint64_t)node->base.num_pages << PAGE_SHIFT;
+
+        r = drm_buddy_free_unused_pages(mm,
+                        actual_size,
+                        &node->blocks);

Needs some locking.




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux