[PATCH 3/3] drm/amdgpu: do not use drm middle layer for debugfs
Nirmoy
nirmodas at amd.com
Mon Feb 15 11:20:55 UTC 2021
On 2/15/21 12:03 PM, Nirmoy wrote:
<snip>
>
>>> amdgpu_debugfs_autodump_init(adev);
>>> -
>>> amdgpu_rap_debugfs_init(adev);
>>> -
>>> amdgpu_securedisplay_debugfs_init(adev);
>>> -
>>> amdgpu_fw_attestation_debugfs_init(adev);
>>> - return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
>>> - ARRAY_SIZE(amdgpu_debugfs_list));
>>> + debugfs_create_file("amdgpu_evict_vram", S_IFREG | S_IRUGO,
>>> root, adev,
>>> + &amdgpu_evict_vram_fops);
>>> + debugfs_create_file("amdgpu_evict_gtt", S_IFREG | S_IRUGO,
>>> root, adev,
>>> + &amdgpu_evict_gtt_fops);
>>> + debugfs_create_file("amdgpu_test_ib", S_IFREG | S_IRUGO, root,
>>> adev,
>>> + &amdgpu_debugfs_test_ib_fops);
>>> + debugfs_create_file("amdgpu_vm_info", S_IFREG | S_IRUGO, root,
>>> adev,
>>> + &amdgpu_debugfs_vm_info_fops);
>>> +
>>> + vbios = devm_kzalloc(adev_to_drm(adev)->dev, sizeof(*vbios),
>>> GFP_KERNEL);
>>> + if (!vbios)
>>> + return -ENOMEM;
>>> +
>>> + vbios->data = adev->bios;
>>> + vbios->size = adev->bios_size;
>>> + debugfs_create_blob("amdgpu_vbios", S_IFREG | S_IRUGO, root,
>>> vbios);
>>
>> Is that vbios allocation ever freed? Maybe just change adev->bios and
>> adev->bios_dize into a debugfs_blob_wrapper structure.
>
>
> devm_kzalloc will get freed on driver removal.
Sorry, this requires a devm_kfree() call at the end.
>
>>
>> Or at least keep the debugfs_blob_wrapper structure inside adev.
I will update with above suggestion.
Regards,
Nirmoy
>>
>>> +
>>> + return 0;
>>> }
>>> #else
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h
>>> index 2803884d338d..0ed866da865e 100644
<snip>
More information about the amd-gfx
mailing list