From: "Christian König" <christian.koenig@amd.com>
To: Matthew Auld <matthew.auld@intel.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 09:54:54 +0100 [thread overview]
Message-ID: <07390c37-e1ac-5343-c5b5-6e1da10f8d5b@amd.com> (raw)
In-Reply-To: <40e7dc08-9d5c-4ddb-3875-e018eb2791b9@intel.com>
Am 04.11.21 um 09:49 schrieb Matthew Auld:
> 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)
Oh that's bad. In this case we either need a mutex here or some other
approach to avoid the allocation.
Christian.
>
>>
>> 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.
>>
next prev parent reply other threads:[~2021-11-04 8:55 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
2021-11-04 8:54 ` Christian König [this message]
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=07390c37-e1ac-5343-c5b5-6e1da10f8d5b@amd.com \
--to=christian.koenig@amd.com \
--cc=Arunpravin.PaneerSelvam@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=matthew.auld@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