* [PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel
@ 2018-12-26 6:23 Kangjie Lu
2018-12-26 8:29 ` Huang, Ray
2018-12-27 9:26 ` Qu, Jim
0 siblings, 2 replies; 5+ messages in thread
From: Kangjie Lu @ 2018-12-26 6:23 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Alex Deucher, Christian König,
David (ChunMing) Zhou, David Airlie, Daniel Vetter, Rex Zhu,
Huang Rui, Hawking Zhang, Feifei Xu, Likun Gao, David Francis,
amd-gfx, dri-devel, linux-kernel
adev->firmware.fw_buf being not NULL may not indicate kernel buffer is
created successful. A better way is to check the status (return value)
of it. The fix does so.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 7b33867036e7..ba3c1cfb2c35 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -422,13 +422,19 @@ static int amdgpu_ucode_patch_jt(struct amdgpu_firmware_info *ucode,
int amdgpu_ucode_create_bo(struct amdgpu_device *adev)
{
+ int ret;
+
if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) {
- amdgpu_bo_create_kernel(adev, adev->firmware.fw_size, PAGE_SIZE,
- amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
- &adev->firmware.fw_buf,
- &adev->firmware.fw_buf_mc,
- &adev->firmware.fw_buf_ptr);
- if (!adev->firmware.fw_buf) {
+ ret =
+ amdgpu_bo_create_kernel(adev,
+ adev->firmware.fw_size,
+ PAGE_SIZE,
+ amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM :
+ AMDGPU_GEM_DOMAIN_GTT,
+ &adev->firmware.fw_buf,
+ &adev->firmware.fw_buf_mc,
+ &adev->firmware.fw_buf_ptr);
+ if (ret) {
dev_err(adev->dev, "failed to create kernel buffer for firmware.fw_buf\n");
return -ENOMEM;
} else if (amdgpu_sriov_vf(adev)) {
--
2.17.2 (Apple Git-113)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel
@ 2018-12-26 8:29 ` Huang, Ray
0 siblings, 0 replies; 5+ messages in thread
From: Huang, Ray @ 2018-12-26 8:29 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Deucher, Alexander, Koenig, Christian, Zhou,
David(ChunMing),
David Airlie, Daniel Vetter, Zhu, Rex, Zhang, Hawking, Xu,
Feifei, Gao, Likun, Francis, David, amd-gfx, dri-devel,
linux-kernel
> -----Original Message-----
> From: Kangjie Lu [mailto:kjlu@umn.edu]
> Sent: Wednesday, December 26, 2018 2:24 PM
> To: kjlu@umn.edu
> Cc: pakki001@umn.edu; Deucher, Alexander
> <Alexander.Deucher@amd.com>; Koenig, Christian
> <Christian.Koenig@amd.com>; Zhou, David(ChunMing)
> <David1.Zhou@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter
> <daniel@ffwll.ch>; Zhu, Rex <Rex.Zhu@amd.com>; Huang, Ray
> <Ray.Huang@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Xu,
> Feifei <Feifei.Xu@amd.com>; Gao, Likun <Likun.Gao@amd.com>; Francis,
> David <David.Francis@amd.com>; amd-gfx@lists.freedesktop.org; dri-
> devel@lists.freedesktop.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] gpu: drm: fix an improper check of
> amdgpu_bo_create_kernel
>
> adev->firmware.fw_buf being not NULL may not indicate kernel buffer is
> created successful. A better way is to check the status (return value)
> of it. The fix does so.
Actually, it is the same. If bo is created successfully, the amdgpu_bo object will be created.
But using "ret" to align with other function should be better as the return status. Thanks.
Reviewed-by: Huang Rui <ray.huang@amd.com>
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> index 7b33867036e7..ba3c1cfb2c35 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> @@ -422,13 +422,19 @@ static int amdgpu_ucode_patch_jt(struct
> amdgpu_firmware_info *ucode,
>
> int amdgpu_ucode_create_bo(struct amdgpu_device *adev)
> {
> + int ret;
> +
> if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) {
> - amdgpu_bo_create_kernel(adev, adev->firmware.fw_size,
> PAGE_SIZE,
> - amdgpu_sriov_vf(adev) ?
> AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
> - &adev->firmware.fw_buf,
> - &adev->firmware.fw_buf_mc,
> - &adev->firmware.fw_buf_ptr);
> - if (!adev->firmware.fw_buf) {
> + ret =
> + amdgpu_bo_create_kernel(adev,
> + adev->firmware.fw_size,
> + PAGE_SIZE,
> + amdgpu_sriov_vf(adev) ?
> AMDGPU_GEM_DOMAIN_VRAM :
> + AMDGPU_GEM_DOMAIN_GTT,
> + &adev->firmware.fw_buf,
> + &adev->firmware.fw_buf_mc,
> + &adev->firmware.fw_buf_ptr);
> + if (ret) {
> dev_err(adev->dev, "failed to create kernel buffer
> for firmware.fw_buf\n");
> return -ENOMEM;
> } else if (amdgpu_sriov_vf(adev)) {
> --
> 2.17.2 (Apple Git-113)
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel
@ 2018-12-26 8:29 ` Huang, Ray
0 siblings, 0 replies; 5+ messages in thread
From: Huang, Ray @ 2018-12-26 8:29 UTC (permalink / raw)
To: Kangjie Lu
Cc: Zhou, David(ChunMing),
David Airlie, Xu, Feifei, Francis, David,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Daniel Vetter,
pakki001-OJFnDUYgAso, Deucher, Alexander, Gao, Likun, Zhu, Rex,
Koenig, Christian, Zhang, Hawking
> -----Original Message-----
> From: Kangjie Lu [mailto:kjlu@umn.edu]
> Sent: Wednesday, December 26, 2018 2:24 PM
> To: kjlu@umn.edu
> Cc: pakki001@umn.edu; Deucher, Alexander
> <Alexander.Deucher@amd.com>; Koenig, Christian
> <Christian.Koenig@amd.com>; Zhou, David(ChunMing)
> <David1.Zhou@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter
> <daniel@ffwll.ch>; Zhu, Rex <Rex.Zhu@amd.com>; Huang, Ray
> <Ray.Huang@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Xu,
> Feifei <Feifei.Xu@amd.com>; Gao, Likun <Likun.Gao@amd.com>; Francis,
> David <David.Francis@amd.com>; amd-gfx@lists.freedesktop.org; dri-
> devel@lists.freedesktop.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] gpu: drm: fix an improper check of
> amdgpu_bo_create_kernel
>
> adev->firmware.fw_buf being not NULL may not indicate kernel buffer is
> created successful. A better way is to check the status (return value)
> of it. The fix does so.
Actually, it is the same. If bo is created successfully, the amdgpu_bo object will be created.
But using "ret" to align with other function should be better as the return status. Thanks.
Reviewed-by: Huang Rui <ray.huang@amd.com>
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> index 7b33867036e7..ba3c1cfb2c35 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> @@ -422,13 +422,19 @@ static int amdgpu_ucode_patch_jt(struct
> amdgpu_firmware_info *ucode,
>
> int amdgpu_ucode_create_bo(struct amdgpu_device *adev)
> {
> + int ret;
> +
> if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) {
> - amdgpu_bo_create_kernel(adev, adev->firmware.fw_size,
> PAGE_SIZE,
> - amdgpu_sriov_vf(adev) ?
> AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
> - &adev->firmware.fw_buf,
> - &adev->firmware.fw_buf_mc,
> - &adev->firmware.fw_buf_ptr);
> - if (!adev->firmware.fw_buf) {
> + ret =
> + amdgpu_bo_create_kernel(adev,
> + adev->firmware.fw_size,
> + PAGE_SIZE,
> + amdgpu_sriov_vf(adev) ?
> AMDGPU_GEM_DOMAIN_VRAM :
> + AMDGPU_GEM_DOMAIN_GTT,
> + &adev->firmware.fw_buf,
> + &adev->firmware.fw_buf_mc,
> + &adev->firmware.fw_buf_ptr);
> + if (ret) {
> dev_err(adev->dev, "failed to create kernel buffer
> for firmware.fw_buf\n");
> return -ENOMEM;
> } else if (amdgpu_sriov_vf(adev)) {
> --
> 2.17.2 (Apple Git-113)
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* 答复: [PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel
@ 2018-12-27 9:26 ` Qu, Jim
0 siblings, 0 replies; 5+ messages in thread
From: Qu, Jim @ 2018-12-27 9:26 UTC (permalink / raw)
To: Kangjie Lu
Cc: Zhou, David(ChunMing),
David Airlie, Xu, Feifei, Francis, David, linux-kernel, amd-gfx,
Huang, Ray, dri-devel, Daniel Vetter, pakki001, Deucher,
Alexander, Gao, Likun, Zhu, Rex, Koenig, Christian, Zhang,
Hawking
Comments in line.
Thanks
JimQu
________________________________________
发件人: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> 代表 Kangjie Lu <kjlu@umn.edu>
发送时间: 2018年12月26日 14:23
收件人: kjlu@umn.edu
抄送: Zhou, David(ChunMing); David Airlie; Xu, Feifei; Francis, David; linux-kernel@vger.kernel.org; amd-gfx@lists.freedesktop.org; Huang, Ray; dri-devel@lists.freedesktop.org; Daniel Vetter; pakki001@umn.edu; Deucher, Alexander; Gao, Likun; Zhu, Rex; Koenig, Christian; Zhang, Hawking
主题: [PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel
adev->firmware.fw_buf being not NULL may not indicate kernel buffer is
created successful. A better way is to check the status (return value)
of it. The fix does so.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 7b33867036e7..ba3c1cfb2c35 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -422,13 +422,19 @@ static int amdgpu_ucode_patch_jt(struct amdgpu_firmware_info *ucode,
int amdgpu_ucode_create_bo(struct amdgpu_device *adev)
{
+ int ret;
+
if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) {
- amdgpu_bo_create_kernel(adev, adev->firmware.fw_size, PAGE_SIZE,
- amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
- &adev->firmware.fw_buf,
- &adev->firmware.fw_buf_mc,
- &adev->firmware.fw_buf_ptr);
- if (!adev->firmware.fw_buf) {
+ ret =
+ amdgpu_bo_create_kernel(adev,
+ adev->firmware.fw_size,
+ PAGE_SIZE,
+ amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM :
+ AMDGPU_GEM_DOMAIN_GTT,
+ &adev->firmware.fw_buf,
+ &adev->firmware.fw_buf_mc,
+ &adev->firmware.fw_buf_ptr);
+ if (ret) {
JimQu: Look into amdgpu_bo_create_kernel(), new bo will be created only if *bo_ptr = NULL, So if you encounter the issue the adev->firmware.fw_buf != NULL but new bo is not created, the only problem I can see are:
1. there is bug in amdgpu_bo_create_kernel()
2. adev->firmware.fw_buf != NULL before it is transferred into amdgpu_bo_create_kernel().
Could you commit what is environment you encounter the issue?
Thanks
JimQu
dev_err(adev->dev, "failed to create kernel buffer for firmware.fw_buf\n");
return -ENOMEM;
} else if (amdgpu_sriov_vf(adev)) {
--
2.17.2 (Apple Git-113)
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* 答复: [PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel
@ 2018-12-27 9:26 ` Qu, Jim
0 siblings, 0 replies; 5+ messages in thread
From: Qu, Jim @ 2018-12-27 9:26 UTC (permalink / raw)
To: Kangjie Lu
Cc: Zhou, David(ChunMing),
David Airlie, Xu, Feifei, Francis, David,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Huang, Ray,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Daniel Vetter,
pakki001-OJFnDUYgAso, Deucher, Alexander, Gao, Likun, Zhu, Rex,
Koenig, Christian, Zhang, Hawking
Comments in line.
Thanks
JimQu
________________________________________
发件人: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> 代表 Kangjie Lu <kjlu@umn.edu>
发送时间: 2018年12月26日 14:23
收件人: kjlu@umn.edu
抄送: Zhou, David(ChunMing); David Airlie; Xu, Feifei; Francis, David; linux-kernel@vger.kernel.org; amd-gfx@lists.freedesktop.org; Huang, Ray; dri-devel@lists.freedesktop.org; Daniel Vetter; pakki001@umn.edu; Deucher, Alexander; Gao, Likun; Zhu, Rex; Koenig, Christian; Zhang, Hawking
主题: [PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel
adev->firmware.fw_buf being not NULL may not indicate kernel buffer is
created successful. A better way is to check the status (return value)
of it. The fix does so.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 7b33867036e7..ba3c1cfb2c35 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -422,13 +422,19 @@ static int amdgpu_ucode_patch_jt(struct amdgpu_firmware_info *ucode,
int amdgpu_ucode_create_bo(struct amdgpu_device *adev)
{
+ int ret;
+
if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) {
- amdgpu_bo_create_kernel(adev, adev->firmware.fw_size, PAGE_SIZE,
- amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
- &adev->firmware.fw_buf,
- &adev->firmware.fw_buf_mc,
- &adev->firmware.fw_buf_ptr);
- if (!adev->firmware.fw_buf) {
+ ret =
+ amdgpu_bo_create_kernel(adev,
+ adev->firmware.fw_size,
+ PAGE_SIZE,
+ amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM :
+ AMDGPU_GEM_DOMAIN_GTT,
+ &adev->firmware.fw_buf,
+ &adev->firmware.fw_buf_mc,
+ &adev->firmware.fw_buf_ptr);
+ if (ret) {
JimQu: Look into amdgpu_bo_create_kernel(), new bo will be created only if *bo_ptr = NULL, So if you encounter the issue the adev->firmware.fw_buf != NULL but new bo is not created, the only problem I can see are:
1. there is bug in amdgpu_bo_create_kernel()
2. adev->firmware.fw_buf != NULL before it is transferred into amdgpu_bo_create_kernel().
Could you commit what is environment you encounter the issue?
Thanks
JimQu
dev_err(adev->dev, "failed to create kernel buffer for firmware.fw_buf\n");
return -ENOMEM;
} else if (amdgpu_sriov_vf(adev)) {
--
2.17.2 (Apple Git-113)
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-12-27 9:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26 6:23 [PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel Kangjie Lu
2018-12-26 8:29 ` Huang, Ray
2018-12-26 8:29 ` Huang, Ray
2018-12-27 9:26 ` 答复: " Qu, Jim
2018-12-27 9:26 ` Qu, Jim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.