* [PATCH] drm/amdkfd: fix clock counter retrieval for node without GPU
@ 2018-04-10 21:32 Felix Kuehling
[not found] ` <1523395953-31264-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Felix Kuehling @ 2018-04-10 21:32 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w
Cc: Felix Kuehling, Andres Rodriguez
From: Andres Rodriguez <andres.rodriguez@amd.com>
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.
Signed-off-by: Andres Rodriguez <andres.rodriguez@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index cd679cf..b5e5f0e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -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);
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amdkfd: fix clock counter retrieval for node without GPU
[not found] ` <1523395953-31264-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-24 9:35 ` Oded Gabbay
0 siblings, 0 replies; 2+ messages in thread
From: Oded Gabbay @ 2018-04-24 9:35 UTC (permalink / raw)
To: Felix Kuehling; +Cc: Andres Rodriguez, amd-gfx list
On Wed, Apr 11, 2018 at 12:32 AM, Felix Kuehling <Felix.Kuehling@amd.com> wrote:
> From: Andres Rodriguez <andres.rodriguez@amd.com>
>
> 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.
>
> Signed-off-by: Andres Rodriguez <andres.rodriguez@amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index cd679cf..b5e5f0e 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -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);
> --
> 2.7.4
>
This patch is:
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
applied to -fixes
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-24 9:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10 21:32 [PATCH] drm/amdkfd: fix clock counter retrieval for node without GPU Felix Kuehling
[not found] ` <1523395953-31264-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-04-24 9:35 ` Oded Gabbay
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.