From: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 8/9] drm/amdgpu/sriov:fix memory leak in psp_load_fw
Date: Wed, 25 Oct 2017 17:22:22 +0800 [thread overview]
Message-ID: <1508923343-24404-9-git-send-email-Monk.Liu@amd.com> (raw)
In-Reply-To: <1508923343-24404-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
for SR-IOV when doing gpu reset this routine shouldn't do
resource allocating otherwise memory leak
Change-Id: I25da3a5b475196c75c7e639adc40751754625968
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 76f531b..2157d45 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -334,23 +334,26 @@ static int psp_load_fw(struct amdgpu_device *adev)
int ret;
struct psp_context *psp = &adev->psp;
+ if (amdgpu_sriov_vf(adev) && adev->in_gpu_reset != 0)
+ goto skip_memalloc;
+
psp->cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
if (!psp->cmd)
return -ENOMEM;
ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
- AMDGPU_GEM_DOMAIN_GTT,
- &psp->fw_pri_bo,
- &psp->fw_pri_mc_addr,
- &psp->fw_pri_buf);
+ AMDGPU_GEM_DOMAIN_GTT,
+ &psp->fw_pri_bo,
+ &psp->fw_pri_mc_addr,
+ &psp->fw_pri_buf);
if (ret)
goto failed;
ret = amdgpu_bo_create_kernel(adev, PSP_FENCE_BUFFER_SIZE, PAGE_SIZE,
- AMDGPU_GEM_DOMAIN_VRAM,
- &psp->fence_buf_bo,
- &psp->fence_buf_mc_addr,
- &psp->fence_buf);
+ AMDGPU_GEM_DOMAIN_VRAM,
+ &psp->fence_buf_bo,
+ &psp->fence_buf_mc_addr,
+ &psp->fence_buf);
if (ret)
goto failed_mem2;
@@ -375,6 +378,7 @@ static int psp_load_fw(struct amdgpu_device *adev)
if (ret)
goto failed_mem;
+skip_memalloc:
ret = psp_hw_start(psp);
if (ret)
goto failed_mem;
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-10-25 9:22 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-25 9:22 [PATCH 0/9] *** patch series for new gpu recover*** Monk Liu
[not found] ` <1508923343-24404-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-25 9:22 ` [PATCH 1/9] drm/amdgpu:cleanup hw fence get&put Monk Liu
[not found] ` <1508923343-24404-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-25 11:38 ` Christian König
2017-10-25 9:22 ` [PATCH 2/9] amd/scheduler:imple job skip feature Monk Liu
[not found] ` <1508923343-24404-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26 7:06 ` Christian König
[not found] ` <79a7f228-3d63-e043-58c1-2986379b6296-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-26 8:11 ` Liu, Monk
2017-10-25 9:22 ` [PATCH 3/9] drm/amdgpu:implement new GPU recover(v2) Monk Liu
[not found] ` <1508923343-24404-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26 7:11 ` Christian König
2017-10-25 9:22 ` [PATCH 4/9] drm/amdgpu:replace deprecated gpu reset Monk Liu
[not found] ` <1508923343-24404-5-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26 7:13 ` Christian König
[not found] ` <13ad16b1-6357-1f0e-3cdd-ddc42d4462b0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-26 8:13 ` Liu, Monk
[not found] ` <BLUPR12MB04499B9B8F278BE639D144A184450-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-26 8:16 ` Christian König
2017-10-25 9:22 ` [PATCH 5/9] drm/amdgpu:cleanup in_sriov_reset and lock_reset Monk Liu
[not found] ` <1508923343-24404-6-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26 7:14 ` Christian König
2017-10-25 9:22 ` [PATCH 6/9] drm/amdgpu:cleanup ucode_init_bo Monk Liu
[not found] ` <1508923343-24404-7-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26 7:17 ` Christian König
2017-10-25 9:22 ` [PATCH 7/9] drm/amdgpu:block kms open during gpu_reset Monk Liu
[not found] ` <1508923343-24404-8-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26 7:18 ` Christian König
[not found] ` <46bc9872-0bd7-c2b7-4879-6cab5789f252-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-26 8:17 ` Liu, Monk
[not found] ` <BLUPR12MB0449D707ECAE76FFAA13C46684450-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-26 10:54 ` Christian König
[not found] ` <06a765e3-971e-698c-6d07-1dee69c1e0c8-5C7GfCeVMHo@public.gmane.org>
2017-10-26 11:08 ` Liu, Monk
[not found] ` <BLUPR12MB044997E32FD02ACDBD978C7084450-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-26 15:15 ` Christian König
[not found] ` <46a5317f-e606-5cfe-82c9-46df64818435-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-30 3:47 ` Liu, Monk
[not found] ` <BLUPR12MB0449DD842E46A942CF53484084590-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-30 7:37 ` Christian König
[not found] ` <f2213f71-9280-bb51-5283-5349878956f7-5C7GfCeVMHo@public.gmane.org>
2017-10-30 7:54 ` Liu, Monk
[not found] ` <SN1PR12MB04629FAC65DFD5F133D2E34484590-z7L1TMIYDg7VaWpRXmIMygdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-30 9:20 ` Christian König
2017-10-25 9:22 ` Monk Liu [this message]
[not found] ` <1508923343-24404-9-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26 7:21 ` [PATCH 8/9] drm/amdgpu/sriov:fix memory leak in psp_load_fw Christian König
2017-10-25 9:22 ` [PATCH 9/9] drm/amdgpu:fix random missing of FLR NOTIFY Monk Liu
[not found] ` <1508923343-24404-10-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26 7:22 ` Christian König
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=1508923343-24404-9-git-send-email-Monk.Liu@amd.com \
--to=monk.liu-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/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