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

Matthew Auld matthew.auld at intel.com
Wed Nov 3 19:25:19 UTC 2021


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?

> +		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 Intel-gfx mailing list