Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@intel.com>
To: Matthew Auld <matthew.auld@intel.com>, <intel-xe@lists.freedesktop.org>
Cc: Matthew Brost <matthew.brost@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Stuart Summers <stuart.summers@intel.com>
Subject: Re: [PATCH v2] drm/xe: Fix memory leak on xe_alloc_pf_queue failure
Date: Fri, 30 Aug 2024 11:40:35 +0200	[thread overview]
Message-ID: <b006b2ac-6a67-4121-8af5-3f34fe909b12@intel.com> (raw)
In-Reply-To: <0d95ca62-5d39-4be5-8714-beb465988cea@intel.com>


On 8/27/2024 11:48 AM, Nirmoy Das wrote:
>
> On 8/27/2024 10:48 AM, Matthew Auld wrote:
>> On 26/08/2024 17:20, Nirmoy Das wrote:
>>> Simplify memory unwinding on error also fixing current memory
>>> leak that can happen on error.
>>>
>>> v2: use devm_kcalloc(Matt A)
>>>
>>> Fixes: 3338e4f90c14 ("drm/xe: Use topology to determine page fault 
>>> queue size")
>>> Cc: Matthew Auld <matthew.auld@intel.com>
>>> Cc: Matthew Brost <matthew.brost@intel.com>
>>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>> Cc: Stuart Summers <stuart.summers@intel.com>
>>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>>> ---
>>>   drivers/gpu/drm/xe/xe_gt_pagefault.c | 7 +++----
>>>   1 file changed, 3 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c 
>>> b/drivers/gpu/drm/xe/xe_gt_pagefault.c
>>> index 0be4687bfc20..91810d0a9afc 100644
>>> --- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
>>> +++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
>>> @@ -388,7 +388,6 @@ static void pagefault_fini(void *arg)
>>>   {
>>>       struct xe_gt *gt = arg;
>>>       struct xe_device *xe = gt_to_xe(gt);
>>> -    int i;
>>>         if (!xe->info.has_usm)
>>>           return;
>>> @@ -396,12 +395,11 @@ static void pagefault_fini(void *arg)
>>>       destroy_workqueue(gt->usm.acc_wq);
>>>       destroy_workqueue(gt->usm.pf_wq);
>>
>> No need for the new line here?
>
>
> Me with my telescoping vision. I will remove that before merge, if 
> that is fine.

Merged it to dem-xe-next with removed extra line.


Thanks,

Nirmoy

>
>>
>> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
>
>
> Thanks,
>
> Nirmoy
>
>>
>>> -    for (i = 0; i < NUM_PF_QUEUE; ++i)
>>> -        kfree(gt->usm.pf_queue[i].data);
>>>   }
>>>     static int xe_alloc_pf_queue(struct xe_gt *gt, struct pf_queue 
>>> *pf_queue)
>>>   {
>>> +    struct xe_device *xe = gt_to_xe(gt);
>>>       xe_dss_mask_t all_dss;
>>>       int num_dss, num_eus;
>>>   @@ -417,7 +415,8 @@ static int xe_alloc_pf_queue(struct xe_gt *gt, 
>>> struct pf_queue *pf_queue)
>>>           (num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW;
>>>         pf_queue->gt = gt;
>>> -    pf_queue->data = kcalloc(pf_queue->num_dw, sizeof(u32), 
>>> GFP_KERNEL);
>>> +    pf_queue->data = devm_kcalloc(xe->drm.dev, pf_queue->num_dw,
>>> +                      sizeof(u32), GFP_KERNEL);
>>>       if (!pf_queue->data)
>>>           return -ENOMEM;

      reply	other threads:[~2024-08-30  9:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26 16:20 [PATCH v2] drm/xe: Fix memory leak on xe_alloc_pf_queue failure Nirmoy Das
2024-08-26 17:19 ` ✓ CI.Patch_applied: success for drm/xe: Fix memory leak on xe_alloc_pf_queue failure (rev2) Patchwork
2024-08-26 17:19 ` ✓ CI.checkpatch: " Patchwork
2024-08-26 17:20 ` ✓ CI.KUnit: " Patchwork
2024-08-26 17:32 ` ✓ CI.Build: " Patchwork
2024-08-26 17:34 ` ✓ CI.Hooks: " Patchwork
2024-08-26 17:35 ` ✓ CI.checksparse: " Patchwork
2024-08-26 17:56 ` ✓ CI.BAT: " Patchwork
2024-08-26 22:15 ` ✗ CI.FULL: failure " Patchwork
2024-08-27  8:48 ` [PATCH v2] drm/xe: Fix memory leak on xe_alloc_pf_queue failure Matthew Auld
2024-08-27  9:48   ` Nirmoy Das
2024-08-30  9:40     ` Nirmoy Das [this message]

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=b006b2ac-6a67-4121-8af5-3f34fe909b12@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=stuart.summers@intel.com \
    /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