Skip to contentSkip to conversation

drm/amdgpu: Remove sys file compute_partition_mem_alloc_mode at module unload

PATCH In review Xiaogang.Chen 2 participants 2 messages Apr 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Remove sys file compute_partition_mem_alloc_mode at module unload

From: Xiaogang Chen <[email protected]>

Fixes 147263e551eb("drm/amdgpu: add an option to allow gpu partition allocate

all available memory")

Module reload would fail when create sys file that was not removed during module unload.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2 -0
index 2956e45c9254..b8ca876694ff 100644
@@ -2013,6 +2013,8 @@ static void amdgpu_gfx_sysfs_xcp_fini(struct amdgpu_device *adev)
 		(xcp_mgr->funcs && xcp_mgr->funcs->switch_partition_mode);
 	device_remove_file(adev->dev, &dev_attr_current_compute_partition);
 
+	device_remove_file(adev->dev, &dev_attr_compute_partition_mem_alloc_mode);
+
 	if (xcp_switch_supported)
 		device_remove_file(adev->dev,
 				   &dev_attr_available_compute_partition);
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Xiaogang.Chen

From: Xiaogang Chen<[email protected]>

Fixes 147263e551eb("drm/amdgpu: add an option to allow gpu partition allocate

all available memory")

Module reload would fail when create sys file that was not removed during module unload.

The fix tag is eaa1281bfa2c on my upstream branch, with the tag fixed, this is

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2 -0
index 2956e45c9254..b8ca876694ff 100644
@@ -2013,6 +2013,8 @@ static void amdgpu_gfx_sysfs_xcp_fini(struct amdgpu_device *adev)
  		(xcp_mgr->funcs && xcp_mgr->funcs->switch_partition_mode);
  	device_remove_file(adev->dev, &dev_attr_current_compute_partition);
 
+	device_remove_file(adev->dev, &dev_attr_compute_partition_mem_alloc_mode);
+
  	if (xcp_switch_supported)
  		device_remove_file(adev->dev,
  				   &dev_attr_available_compute_partition);