Op 18-10-2024 om 04:30 schreef jesse.zhang at amd.com ([email protected]):
compute/gfx may have multiple rings on some hardware.
In some cases, userspace wants to run jobs on a specific ring for validation
purposes.
This debugfs entry helps to disable or enable submitting jobs to a specific
ring.
This entry is populated only if there are at least two or more cores in the
gfx/compute ip.
Signed-off-by: Jesse Zhang <jesse.zhang at amd.com>
Suggested-by:Alex Deucher <alexander.deucher at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 142 ++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 +
3 files changed, 146 insertions(+)
[...]
+
+void amdgpu_debugfs_compute_sched_mask_init(struct amdgpu_device *adev)
+{
+#if defined(CONFIG_DEBUG_FS)
+ struct drm_minor *minor = adev_to_drm(adev)->primary;
+ struct dentry *root = minor->debugfs_root;
+ char name[32];
+
+ if (!(adev->gfx.num_compute_rings > 1))
+ return;
+ sprintf(name, "amdgpu_compute_sched_mask");
+ debugfs_create_file(name, 0600, root, adev,
+ &amdgpu_debugfs_compute_sched_mask_fops);
+#endif
+}
Hi Jesse,
Can you please eliminate name[32]? There is absolutely no need
to copy the filename in a buffer. Also, using sprintf this way is
weird too.
Just do
debugfs_create_file("amdgpu_compute_sched_mask", 0600, root, adev, ...
The same for amdgpu_debugfs_gfx_sched_mask_init() of course.
--
Kees