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

Christian König christian.koenig at amd.com
Thu Nov 4 07:34:44 UTC 2021



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 at amd.com>
>
> <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()?

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.



More information about the amd-gfx mailing list