dri-devel Archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: fix build failure without CONFIG_DYNAMIC_DEBUG
@ 2023-08-04 13:29 Arnd Bergmann
  2023-08-04 16:24 ` Felix Kuehling
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2023-08-04 13:29 UTC (permalink / raw
  To: Felix Kuehling, Alex Deucher, Christian König, Pan, Xinhui,
	Philip Yang, Alex Sierra
  Cc: Mukul Joshi, Arnd Bergmann, linux-kernel, amd-gfx, dri-devel,
	Graham Sider

From: Arnd Bergmann <arnd@arndb.de>

When CONFIG_DYNAMIC_DEBUG is disabled altogether, calling
_dynamic_func_call_no_desc() does not work:

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c: In function 'svm_range_set_attr':
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:52:9: error: implicit declaration of function '_dynamic_func_call_no_desc' [-Werror=implicit-function-declaration]
   52 |         _dynamic_func_call_no_desc("svm_range_dump", svm_range_debug_dump, svms)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:3564:9: note: in expansion of macro 'dynamic_svm_range_dump'
 3564 |         dynamic_svm_range_dump(svms);
      |         ^~~~~~~~~~~~~~~~~~~~~~

Add a compile-time conditional in addition to the runtime check.

Fixes: 8923137dbe4b2 ("drm/amdkfd: avoid svm dump when dynamic debug disabled")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 308384dbc502d..44e710821b6d9 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -23,6 +23,7 @@
 
 #include <linux/types.h>
 #include <linux/sched/task.h>
+#include <linux/dynamic_debug.h>
 #include <drm/ttm/ttm_tt.h>
 #include <drm/drm_exec.h>
 
@@ -48,8 +49,13 @@
  * page table is updated.
  */
 #define AMDGPU_SVM_RANGE_RETRY_FAULT_PENDING	(2UL * NSEC_PER_MSEC)
+#if IS_ENABLED(CONFIG_DYNAMIC_DEBUG)
 #define dynamic_svm_range_dump(svms) \
 	_dynamic_func_call_no_desc("svm_range_dump", svm_range_debug_dump, svms)
+#else
+#define dynamic_svm_range_dump(svms) \
+	do { if (0) svm_range_debug_dump(svms); } while (0)
+#endif
 
 /* Giant svm range split into smaller ranges based on this, it is decided using
  * minimum of all dGPU/APU 1/32 VRAM size, between 2MB to 1GB and alignment to
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdkfd: fix build failure without CONFIG_DYNAMIC_DEBUG
  2023-08-04 13:29 [PATCH] drm/amdkfd: fix build failure without CONFIG_DYNAMIC_DEBUG Arnd Bergmann
@ 2023-08-04 16:24 ` Felix Kuehling
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Kuehling @ 2023-08-04 16:24 UTC (permalink / raw
  To: Arnd Bergmann, Alex Deucher, Christian König, Pan, Xinhui,
	Philip Yang, Alex Sierra
  Cc: Mukul Joshi, Arnd Bergmann, linux-kernel, amd-gfx, dri-devel,
	Graham Sider

On 2023-08-04 9:29, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> When CONFIG_DYNAMIC_DEBUG is disabled altogether, calling
> _dynamic_func_call_no_desc() does not work:
>
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c: In function 'svm_range_set_attr':
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:52:9: error: implicit declaration of function '_dynamic_func_call_no_desc' [-Werror=implicit-function-declaration]
>     52 |         _dynamic_func_call_no_desc("svm_range_dump", svm_range_debug_dump, svms)
>        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:3564:9: note: in expansion of macro 'dynamic_svm_range_dump'
>   3564 |         dynamic_svm_range_dump(svms);
>        |         ^~~~~~~~~~~~~~~~~~~~~~
>
> Add a compile-time conditional in addition to the runtime check.
>
> Fixes: 8923137dbe4b2 ("drm/amdkfd: avoid svm dump when dynamic debug disabled")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

The patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

I'm applying it to amd-staging-drm-next.

Thanks,
   Felix


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 308384dbc502d..44e710821b6d9 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -23,6 +23,7 @@
>   
>   #include <linux/types.h>
>   #include <linux/sched/task.h>
> +#include <linux/dynamic_debug.h>
>   #include <drm/ttm/ttm_tt.h>
>   #include <drm/drm_exec.h>
>   
> @@ -48,8 +49,13 @@
>    * page table is updated.
>    */
>   #define AMDGPU_SVM_RANGE_RETRY_FAULT_PENDING	(2UL * NSEC_PER_MSEC)
> +#if IS_ENABLED(CONFIG_DYNAMIC_DEBUG)
>   #define dynamic_svm_range_dump(svms) \
>   	_dynamic_func_call_no_desc("svm_range_dump", svm_range_debug_dump, svms)
> +#else
> +#define dynamic_svm_range_dump(svms) \
> +	do { if (0) svm_range_debug_dump(svms); } while (0)
> +#endif
>   
>   /* Giant svm range split into smaller ranges based on this, it is decided using
>    * minimum of all dGPU/APU 1/32 VRAM size, between 2MB to 1GB and alignment to

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-04 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-04 13:29 [PATCH] drm/amdkfd: fix build failure without CONFIG_DYNAMIC_DEBUG Arnd Bergmann
2023-08-04 16:24 ` Felix Kuehling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).