Revert "drm/amdgpu: fix a mistake when removing mem_info_preempt_used sysfs"
Subsystems (2)
PATCH 1/3 Revert "drm/amdgpu: fix a mistake when removing mem_info_preempt_used sysfs"
From: "[email protected]" <[email protected]>
This reverts commit 10aec8943bcc5123288ded8c97e78312bcf17fb1. the dev->unplugged flag will also be set to true ,
Only uninstall the driver by amdgpu_exit, not actually unplug the device. that will cause a new issue.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c +1 -1
@@ -138,7 +138,7 @@ void amdgpu_preempt_mgr_fini(struct amdgpu_device *adev)if (ret)return ; -if (drm_dev_enter (adev_to_drm (adev), &idx)) { +if (!drm_dev_enter (adev_to_drm (adev), &idx)) {device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used);drm_dev_exit (idx); }
Signature · 1 line
2.25.1
PATCH 2/3 Revert "drm/amdgpu: fix warning when removing sysfs"
From: "[email protected]" <[email protected]>
This reverts commit 330d97e9b14e0c85cc8b63e0092e4abcb9ce99c8. the dev->unplugged flag will also be set to true ,
Only uninstall the driver by amdgpu_exit,not actually unplug the device. that will cause a new issue.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 12 +++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 10 ++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c | 8 ++------ drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 10 ++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 9 ++------- drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 9 ++------- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 8 ++------ 7 files changed, 15 insertions(+), 51 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -9
@@ -25,7 +25,6 @@#include <linux/firmware.h> #include <linux/pm_runtime.h> -#include <drm/drm_drv.h> #include "amdgpu.h" #include "amdgpu_gfx.h"
@@ -1779,14 +1778,9 @@ int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev)void amdgpu_gfx_sysfs_fini (struct amdgpu_device *adev) { -int idx; - -if (drm_dev_enter (adev_to_drm (adev), &idx)) { -amdgpu_gfx_sysfs_xcp_fini (adev); -amdgpu_gfx_sysfs_isolation_shader_fini (adev); -amdgpu_gfx_sysfs_reset_mask_fini (adev); -drm_dev_exit (idx); - } +amdgpu_gfx_sysfs_xcp_fini (adev); +amdgpu_gfx_sysfs_isolation_shader_fini (adev); +amdgpu_gfx_sysfs_reset_mask_fini (adev); } int amdgpu_gfx_cleaner_shader_sw_init(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +2 -8
@@ -24,7 +24,6 @@* */ -#include <drm/drm_drv.h> #include "amdgpu.h" #include "amdgpu_jpeg.h" #include "amdgpu_pm.h"
@@ -448,11 +447,6 @@ int amdgpu_jpeg_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_jpeg_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -int idx; - -if (drm_dev_enter (adev_to_drm (adev), &idx)) { -if (adev->jpeg.num_jpeg_inst) -device_remove_file (adev->dev, &dev_attr_jpeg_reset_mask); -drm_dev_exit (idx); - } +if (adev->jpeg.num_jpeg_inst) +device_remove_file (adev->dev, &dev_attr_jpeg_reset_mask); }
drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c +2 -6
@@ -23,7 +23,6 @@* Authors: Christian König, Felix Kuehling */ -#include <drm/drm_drv.h> #include "amdgpu.h" /**
@@ -130,7 +129,7 @@ int amdgpu_preempt_mgr_init(struct amdgpu_device *adev)void amdgpu_preempt_mgr_fini (struct amdgpu_device *adev) {struct ttm_resource_manager *man = &adev->mman.preempt_mgr; -int idx, ret; +int ret;ttm_resource_manager_set_used (man, false);
@@ -138,10 +137,7 @@ void amdgpu_preempt_mgr_fini(struct amdgpu_device *adev)if (ret)return ; -if (!drm_dev_enter (adev_to_drm (adev), &idx)) { -device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used); -drm_dev_exit (idx); - } +device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used);ttm_resource_manager_cleanup (man);ttm_set_driver_manager (&adev->mman.bdev,AMDGPU_PL_PREEMPT ,NULL );
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +2 -8
@@ -21,7 +21,6 @@* */ -#include <drm/drm_drv.h> #include <linux/firmware.h> #include "amdgpu.h" #include "amdgpu_sdma.h"
@@ -449,14 +448,9 @@ int amdgpu_sdma_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_sdma_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -int idx; -if (!amdgpu_gpu_recovery)return ; -if (drm_dev_enter (adev_to_drm (adev), &idx)) { -if (adev->sdma.num_instances) -device_remove_file (adev->dev, &dev_attr_sdma_reset_mask); -drm_dev_exit (idx); - } +if (adev->sdma.num_instances) +device_remove_file (adev->dev, &dev_attr_sdma_reset_mask); }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -7
@@ -1310,11 +1310,6 @@ int amdgpu_vcn_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_vcn_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -int idx; - -if (drm_dev_enter (adev_to_drm (adev), &idx)) { -if (adev->vcn.num_vcn_inst) -device_remove_file (adev->dev, &dev_attr_vcn_reset_mask); -drm_dev_exit (idx); - } +if (adev->vcn.num_vcn_inst) +device_remove_file (adev->dev, &dev_attr_vcn_reset_mask); }
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +2 -7
@@ -904,13 +904,8 @@ int amdgpu_vpe_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_vpe_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -int idx; - -if (drm_dev_enter (adev_to_drm (adev), &idx)) { -if (adev->vpe.num_instances) -device_remove_file (adev->dev, &dev_attr_vpe_reset_mask); -drm_dev_exit (idx); - } +if (adev->vpe.num_instances) +device_remove_file (adev->dev, &dev_attr_vpe_reset_mask); }static const struct amdgpu_ring_funcs vpe_ring_funcs = {
drivers/gpu/drm/amd/amdgpu/df_v3_6.c +2 -6
@@ -20,7 +20,6 @@* OTHER DEALINGS IN THE SOFTWARE. * */ -#include <drm/drm_drv.h> #include "amdgpu.h" #include "df_v3_6.h"
@@ -255,12 +254,9 @@ static void df_v3_6_sw_init(struct amdgpu_device *adev)static void df_v3_6_sw_fini (struct amdgpu_device *adev) { -int idx; -if (drm_dev_enter (adev_to_drm (adev), &idx)) { -device_remove_file (adev->dev, &dev_attr_df_cntr_avail); -drm_dev_exit (idx); - } +device_remove_file (adev->dev, &dev_attr_df_cntr_avail); + } static void df_v3_6_enable_broadcast_mode(struct amdgpu_device *adev,
Signature · 1 line
2.25.1
PATCH 3/3 drm/amdgpu: Fix sysfs warning when hotplugging
In reply to [email protected]Replace the check drm_dev_enter with sysfs directory entry. Because the dev->unplugged flag will also be set to true, Only uninstall the driver by amdgpu_exit, not actually unplug the device.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 +++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 4 ++-- 7 files changed, 25 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +5 -3
@@ -1778,9 +1778,11 @@ int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev)void amdgpu_gfx_sysfs_fini (struct amdgpu_device *adev) { -amdgpu_gfx_sysfs_xcp_fini (adev); -amdgpu_gfx_sysfs_isolation_shader_fini (adev); -amdgpu_gfx_sysfs_reset_mask_fini (adev); +if (adev->dev->kobj.sd) { +amdgpu_gfx_sysfs_xcp_fini (adev); +amdgpu_gfx_sysfs_isolation_shader_fini (adev); +amdgpu_gfx_sysfs_reset_mask_fini (adev); + } } int amdgpu_gfx_cleaner_shader_sw_init(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +4 -2
@@ -447,6 +447,8 @@ int amdgpu_jpeg_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_jpeg_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->jpeg.num_jpeg_inst) -device_remove_file (adev->dev, &dev_attr_jpeg_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->jpeg.num_jpeg_inst) +device_remove_file (adev->dev, &dev_attr_jpeg_reset_mask); + } }
drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c +2 -1
@@ -137,7 +137,8 @@ void amdgpu_preempt_mgr_fini(struct amdgpu_device *adev)if (ret)return ; -device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used); +if (adev->dev->kobj.sd) +device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used);ttm_resource_manager_cleanup (man);ttm_set_driver_manager (&adev->mman.bdev,AMDGPU_PL_PREEMPT ,NULL );
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +4 -2
@@ -451,6 +451,8 @@ void amdgpu_sdma_sysfs_reset_mask_fini(struct amdgpu_device *adev)if (!amdgpu_gpu_recovery)return ; -if (adev->sdma.num_instances) -device_remove_file (adev->dev, &dev_attr_sdma_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->sdma.num_instances) +device_remove_file (adev->dev, &dev_attr_sdma_reset_mask); + } }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4 -2
@@ -1310,6 +1310,8 @@ int amdgpu_vcn_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_vcn_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->vcn.num_vcn_inst) -device_remove_file (adev->dev, &dev_attr_vcn_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->vcn.num_vcn_inst) +device_remove_file (adev->dev, &dev_attr_vcn_reset_mask); + } }
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +4 -2
@@ -904,8 +904,10 @@ int amdgpu_vpe_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_vpe_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->vpe.num_instances) -device_remove_file (adev->dev, &dev_attr_vpe_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->vpe.num_instances) +device_remove_file (adev->dev, &dev_attr_vpe_reset_mask); + } }static const struct amdgpu_ring_funcs vpe_ring_funcs = {
drivers/gpu/drm/amd/amdgpu/df_v3_6.c +2 -2
@@ -254,8 +254,8 @@ static void df_v3_6_sw_init(struct amdgpu_device *adev)static void df_v3_6_sw_fini (struct amdgpu_device *adev) { - -device_remove_file (adev->dev, &dev_attr_df_cntr_avail); +if (adev->dev->kobj.sd) +device_remove_file (adev->dev, &dev_attr_df_cntr_avail); }
Signature · 1 line
2.25.1
RE: [PATCH 3/3] drm/amdgpu: Fix sysfs warning when hotplugging
[Public]
Hi Jesse,
Quoted 11 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of [email protected]
Sent: Monday, November 18, 2024 12:31 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Prosyak, Vitaly <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Dong, Andy <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: Fix sysfs warning when hotplugging
Quoted 3 lines
Replace the check
drm_dev_enterwith sysfs directory entry. Because thedev->unpluggedflag will also be set to true, Only uninstall the driver byamdgpu_exit, not actually unplug the device.
I am okay with this patch. If I recall correctly, this fixes a warning when running IGT tests? It would be helpful to add the comment specifying the types of warnings and the test cases that trigger them.
Best Regards,
Tim Huang
Quoted 135 lines
Signed-off-by Jesse Zhang <[email protected]>Reported-by Andy Dong <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 +++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 4 ++-- 7 files changed, 25 insertions(+), 14 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +5
-4@@ -1778,9 +1778,11 @@ int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev)void amdgpu_gfx_sysfs_fini (struct amdgpu_device *adev) { -amdgpu_gfx_sysfs_xcp_fini (adev); -amdgpu_gfx_sysfs_isolation_shader_fini (adev); -amdgpu_gfx_sysfs_reset_mask_fini (adev); +if (adev->dev->kobj.sd) { +amdgpu_gfx_sysfs_xcp_fini (adev); +amdgpu_gfx_sysfs_isolation_shader_fini (adev); +amdgpu_gfx_sysfs_reset_mask_fini (adev); + } } int amdgpu_gfx_cleaner_shader_sw_init(struct amdgpu_device *adev, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
index43ea76ebbad8..9a1a317d4fd9100644drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +4
-2@@ -447,6 +447,8 @@ int amdgpu_jpeg_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_jpeg_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->jpeg.num_jpeg_inst) -device_remove_file (adev->dev, &dev_attr_jpeg_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->jpeg.num_jpeg_inst) +device_remove_file (adev->dev, &dev_attr_jpeg_reset_mask); + } }drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c +2
-1@@ -137,7 +137,8 @@ void amdgpu_preempt_mgr_fini(struct amdgpu_device *adev)if (ret)return ; -device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used); +if (adev->dev->kobj.sd) +device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used);ttm_resource_manager_cleanup(man); ttm_set_driver_manager(&adev->mman.bdev, AMDGPU_PL_PREEMPT,NULL); diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.cb/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
index8c89b69edc20..113f0d242618100644drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +4
-2@@ -451,6 +451,8 @@ void amdgpu_sdma_sysfs_reset_mask_fini(struct amdgpu_device *adev)if (!amdgpu_gpu_recovery)return ; -if (adev->sdma.num_instances) -device_remove_file (adev->dev, &dev_attr_sdma_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->sdma.num_instances) +device_remove_file (adev->dev, &dev_attr_sdma_reset_mask); + }}
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4
-2@@ -1310,6 +1310,8 @@ int amdgpu_vcn_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_vcn_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->vcn.num_vcn_inst) -device_remove_file (adev->dev, &dev_attr_vcn_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->vcn.num_vcn_inst) +device_remove_file (adev->dev, &dev_attr_vcn_reset_mask); + } }drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +4
-2@@ -904,8 +904,10 @@ int amdgpu_vpe_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_vpe_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->vpe.num_instances) -device_remove_file (adev->dev, &dev_attr_vpe_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->vpe.num_instances) +device_remove_file (adev->dev, &dev_attr_vpe_reset_mask); + } } static const struct amdgpu_ring_funcs vpe_ring_funcs = { diff --git
a/drivers/gpu/drm/amd/amdgpu/df_v3_6.cb/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
index483a441b46aa..621aeca53880100644drivers/gpu/drm/amd/amdgpu/df_v3_6.c +2
-3@@ -254,8 +254,8 @@ static void df_v3_6_sw_init(struct amdgpu_device *adev)static void df_v3_6_sw_fini (struct amdgpu_device *adev) { - -device_remove_file (adev->dev, &dev_attr_df_cntr_avail); +if (adev->dev->kobj.sd) +device_remove_file (adev->dev, &dev_attr_df_cntr_avail); } --2.25.1
Christian König
maintainerRe: [PATCH 3/3] drm/amdgpu: Fix sysfs warning when hotplugging
In reply to [email protected]Am 18.11.24 um 05:31 schrieb [email protected]:
Quoted 3 lines
Replace the check
drm_dev_enterwith sysfs directory entry. Because thedev->unpluggedflag will also be set to true, Only uninstall the driver byamdgpu_exit, not actually unplug the device.
Clearly a NAK to this one. This looks strongly like you are just working around the issue that the functions are called twice.
What exactly is going on here?
Regards,
Christian.
Quoted 123 lines
Signed-off-by Jesse Zhang <[email protected]>Reported-by Andy Dong <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 +++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 4 ++-- 7 files changed, 25 insertions(+), 14 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +5
-3@@ -1778,9 +1778,11 @@ int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev)void amdgpu_gfx_sysfs_fini (struct amdgpu_device *adev) { -amdgpu_gfx_sysfs_xcp_fini (adev); -amdgpu_gfx_sysfs_isolation_shader_fini (adev); -amdgpu_gfx_sysfs_reset_mask_fini (adev); +if (adev->dev->kobj.sd) { +amdgpu_gfx_sysfs_xcp_fini (adev); +amdgpu_gfx_sysfs_isolation_shader_fini (adev); +amdgpu_gfx_sysfs_reset_mask_fini (adev); + } } int amdgpu_gfx_cleaner_shader_sw_init(struct amdgpu_device *adev,drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +4
-2@@ -447,6 +447,8 @@ int amdgpu_jpeg_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_jpeg_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->jpeg.num_jpeg_inst) -device_remove_file (adev->dev, &dev_attr_jpeg_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->jpeg.num_jpeg_inst) +device_remove_file (adev->dev, &dev_attr_jpeg_reset_mask); + } }drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c +2
-1@@ -137,7 +137,8 @@ void amdgpu_preempt_mgr_fini(struct amdgpu_device *adev)if (ret)return ; -device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used); +if (adev->dev->kobj.sd) +device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used);ttm_resource_manager_cleanup (man);ttm_set_driver_manager (&adev->mman.bdev,AMDGPU_PL_PREEMPT ,NULL );drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +4
-2@@ -451,6 +451,8 @@ void amdgpu_sdma_sysfs_reset_mask_fini(struct amdgpu_device *adev)if (!amdgpu_gpu_recovery)return ; -if (adev->sdma.num_instances) -device_remove_file (adev->dev, &dev_attr_sdma_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->sdma.num_instances) +device_remove_file (adev->dev, &dev_attr_sdma_reset_mask); + } }drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4
-2@@ -1310,6 +1310,8 @@ int amdgpu_vcn_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_vcn_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->vcn.num_vcn_inst) -device_remove_file (adev->dev, &dev_attr_vcn_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->vcn.num_vcn_inst) +device_remove_file (adev->dev, &dev_attr_vcn_reset_mask); + } }drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +4
-2@@ -904,8 +904,10 @@ int amdgpu_vpe_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_vpe_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->vpe.num_instances) -device_remove_file (adev->dev, &dev_attr_vpe_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->vpe.num_instances) +device_remove_file (adev->dev, &dev_attr_vpe_reset_mask); + } }static const struct amdgpu_ring_funcs vpe_ring_funcs = {drivers/gpu/drm/amd/amdgpu/df_v3_6.c +2
-2@@ -254,8 +254,8 @@ static void df_v3_6_sw_init(struct amdgpu_device *adev)static void df_v3_6_sw_fini (struct amdgpu_device *adev) { - -device_remove_file (adev->dev, &dev_attr_df_cntr_avail); +if (adev->dev->kobj.sd) +device_remove_file (adev->dev, &dev_attr_df_cntr_avail); }
RE: [PATCH 3/3] drm/amdgpu: Fix sysfs warning when hotplugging
[AMD Official Use Only - AMD Internal Distribution Only]
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Monday, November 18, 2024 5:58 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Prosyak, Vitaly <[email protected]>; Huang, Tim <[email protected]>; Dong, Andy <[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu: Fix sysfs warning when hotplugging
Am 18.11.24 um 05:31 schrieb [email protected]:
Quoted 3 lines
Replace the check
drm_dev_enterwith sysfs directory entry. Because thedev->unpluggedflag will also be set to true, Only uninstall the driver byamdgpu_exit, not actually unplug the device.
Clearly a NAK to this one. This looks strongly like you are just working around the issue that the functions are called twice.
What exactly is going on here?
This warning occurs when running hotplug tests in IGT.
When a device is unplugged, the PCI bus removes the device.
Then uninstall the amdgpu driver, and many similar warnings will be reported. There is V2 about the is patch and update the details in comments.
Thanks
Jesse
Regards,
Christian.
Quoted 135 lines
Signed-off-by Jesse Zhang <[email protected]>Reported-by Andy Dong <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 +++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++-- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 4 ++-- 7 files changed, 25 insertions(+), 14 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +5
-3@@ -1778,9 +1778,11 @@ int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev)void amdgpu_gfx_sysfs_fini (struct amdgpu_device *adev) { -amdgpu_gfx_sysfs_xcp_fini (adev); -amdgpu_gfx_sysfs_isolation_shader_fini (adev); -amdgpu_gfx_sysfs_reset_mask_fini (adev); +if (adev->dev->kobj.sd) { +amdgpu_gfx_sysfs_xcp_fini (adev); +amdgpu_gfx_sysfs_isolation_shader_fini (adev); +amdgpu_gfx_sysfs_reset_mask_fini (adev); + } }int amdgpu_gfx_cleaner_shader_sw_init(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +4
-2@@ -447,6 +447,8 @@ int amdgpu_jpeg_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_jpeg_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->jpeg.num_jpeg_inst) -device_remove_file (adev->dev, &dev_attr_jpeg_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->jpeg.num_jpeg_inst) +device_remove_file (adev->dev, &dev_attr_jpeg_reset_mask); + }}drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c +2
-1@@ -137,7 +137,8 @@ void amdgpu_preempt_mgr_fini(struct amdgpu_device *adev)if (ret)return ; -device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used); +if (adev->dev->kobj.sd) +device_remove_file (adev->dev, &dev_attr_mem_info_preempt_used);ttm_resource_manager_cleanup (man);ttm_set_driver_manager (&adev->mman.bdev,AMDGPU_PL_PREEMPT ,NULL );drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +4
-2@@ -451,6 +451,8 @@ void amdgpu_sdma_sysfs_reset_mask_fini(struct amdgpu_device *adev)if (!amdgpu_gpu_recovery)return ; -if (adev->sdma.num_instances) -device_remove_file (adev->dev, &dev_attr_sdma_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->sdma.num_instances) +device_remove_file (adev->dev, &dev_attr_sdma_reset_mask); + } }drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4
-2@@ -1310,6 +1310,8 @@ int amdgpu_vcn_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_vcn_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->vcn.num_vcn_inst) -device_remove_file (adev->dev, &dev_attr_vcn_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->vcn.num_vcn_inst) +device_remove_file (adev->dev, &dev_attr_vcn_reset_mask); + }}drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +4
-2@@ -904,8 +904,10 @@ int amdgpu_vpe_sysfs_reset_mask_init(struct amdgpu_device *adev)void amdgpu_vpe_sysfs_reset_mask_fini (struct amdgpu_device *adev) { -if (adev->vpe.num_instances) -device_remove_file (adev->dev, &dev_attr_vpe_reset_mask); +if (adev->dev->kobj.sd) { +if (adev->vpe.num_instances) +device_remove_file (adev->dev, &dev_attr_vpe_reset_mask); + } }static const struct
amdgpu_ring_funcsvpe_ring_funcs= { diff --gita/drivers/gpu/drm/amd/amdgpu/df_v3_6.cb/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
index483a441b46aa..621aeca53880100644drivers/gpu/drm/amd/amdgpu/df_v3_6.c +2
-2@@ -254,8 +254,8 @@ static void df_v3_6_sw_init(struct amdgpu_device *adev)static void df_v3_6_sw_fini (struct amdgpu_device *adev) { - -device_remove_file (adev->dev, &dev_attr_df_cntr_avail); +if (adev->dev->kobj.sd) +device_remove_file (adev->dev, &dev_attr_df_cntr_avail); }