AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: "Christian König" <christian.koenig@amd.com>,
	Arunpravin <Arunpravin.PaneerSelvam@amd.com>,
	dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org
Cc: alexander.deucher@amd.com, jani.nikula@linux.intel.com,
	tzimmermann@suse.de, daniel@ffwll.ch
Subject: Re: [PATCH 8/8] drm/amdgpu: add drm buddy support to amdgpu
Date: Thu, 4 Nov 2021 08:49:26 +0000	[thread overview]
Message-ID: <40e7dc08-9d5c-4ddb-3875-e018eb2791b9@intel.com> (raw)
In-Reply-To: <3b5fb9bb-13a0-a7db-cea2-1515aec96742@amd.com>

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@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()?

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.
> 

  reply	other threads:[~2021-11-04  8:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 13:00 [PATCH 3/8] drm: implement top-down allocation method Arunpravin
2021-10-25 13:00 ` [PATCH 4/8] drm/i915: add top-down alloc support to i915 Arunpravin
2021-10-25 13:00 ` [PATCH 5/8] drm: Implement method to free unused pages Arunpravin
2021-11-03 19:16   ` Matthew Auld
2021-11-09 14:06     ` Arunpravin
2021-10-25 13:00 ` [PATCH 6/8] drm/i915: add free_unused_pages support to i915 Arunpravin
2021-11-03 19:18   ` Matthew Auld
2021-11-08 22:04     ` Arunpravin
2021-10-25 13:00 ` [PATCH 7/8] drm/amdgpu: move vram inline functions into a header Arunpravin
2021-10-25 13:00 ` [PATCH 8/8] drm/amdgpu: add drm buddy support to amdgpu Arunpravin
2021-11-03 19:25   ` Matthew Auld
2021-11-04  7:34     ` Christian König
2021-11-04  8:49       ` Matthew Auld [this message]
2021-11-04  8:54         ` Christian König
2021-11-08 22:08           ` Arunpravin
2021-10-25 13:00 ` [PATCH v2 1/8] drm: move the buddy allocator from i915 into common drm Arunpravin
2021-10-25 13:00 ` [PATCH v2 2/8] drm: improve drm_buddy_alloc function Arunpravin
2021-11-03 18:41   ` Matthew Auld
2021-11-08 19:50     ` Arunpravin
2021-11-15 21:52       ` Arunpravin
2021-11-03 18:44 ` [PATCH 3/8] drm: implement top-down allocation method Matthew Auld
2021-11-08 21:45   ` Arunpravin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40e7dc08-9d5c-4ddb-3875-e018eb2791b9@intel.com \
    --to=matthew.auld@intel.com \
    --cc=Arunpravin.PaneerSelvam@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox