drm/amdkfd: fix clock counter retrieval for node without GPU
Subsystems (3)
PATCH 1/1 drm/amdkfd: fix clock counter retrieval for node without GPU
From: Andres Rodriguez <[email protected]>
Currently if a user requests clock counters for a node without a GPU resource we will always return EINVAL.
Instead if no GPU resource is attached, fill the gpu_clock_counter argument with zeroes so that we may proceed and return valid CPU counters.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +7 -6
@@ -749,12 +749,13 @@ static int kfd_ioctl_get_clock_counters(struct file *filep,struct timespec64 time; dev =kfd_device_by_id (args->gpu_id); -if (dev ==NULL ) -return -EINVAL ; - -/* Reading GPU clock counter from KGD */ - args->gpu_clock_counter = - dev->kfd2kgd->get_gpu_clock_counter (dev->kgd); +if (dev) +/* Reading GPU clock counter from KGD */ + args->gpu_clock_counter = + dev->kfd2kgd->get_gpu_clock_counter (dev->kgd); +else +/* Node without GPU resource */ + args->gpu_clock_counter =0 ;/* No access to rdtsc. Using raw monotonic time */ getrawmonotonic64 (&time);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1523395953-31264-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org
Oded Gabbay
Reviewed-byQuoted 40 lines · Felix Kuehling
From: Andres Rodriguez <[email protected]>
Currently if a user requests clock counters for a node without a GPU resource we will always return EINVAL.
Instead if no GPU resource is attached, fill the
gpu_clock_counterargument with zeroes so that we may proceed and return valid CPU counters.Signed-off-by Andres Rodriguez <[email protected]>Signed-off-by Felix Kuehling <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +7
-7@@ -749,12 +749,13 @@ static int kfd_ioctl_get_clock_counters(struct file *filep,struct timespec64 time; dev =kfd_device_by_id (args->gpu_id); -if (dev ==NULL ) -return -EINVAL ; - -/* Reading GPU clock counter from KGD */ - args->gpu_clock_counter = - dev->kfd2kgd->get_gpu_clock_counter (dev->kgd); +if (dev) +/* Reading GPU clock counter from KGD */ + args->gpu_clock_counter = + dev->kfd2kgd->get_gpu_clock_counter (dev->kgd); +else +/* Node without GPU resource */ + args->gpu_clock_counter =0 ;/* No access to rdtsc. Using raw monotonic time */ getrawmonotonic64 (&time); --
Quoted 2 lines
2.7.4
This patch is:
applied to -fixes
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx