All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drm/amdkfd: Use real device for messages
@ 2022-02-19  0:57 Felix Kuehling
  2022-02-21 11:01 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Kuehling @ 2022-02-19  0:57 UTC (permalink / raw)
  To: amd-gfx; +Cc: kent.russell

kfd_chardev() doesn't provide much useful information in dev_... messages
on multi-GPU systems because there is only one KFD device, which doesn't
correspond to any particular GPU. Use the actual GPU device to indicate
the GPU that caused a message.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c   | 5 -----
 drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 ++++----
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h      | 1 -
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 7affec907fd1..ceeb0d5e9060 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -104,11 +104,6 @@ void kfd_chardev_exit(void)
 	kfd_device = NULL;
 }
 
-struct device *kfd_chardev(void)
-{
-	return kfd_device;
-}
-
 
 static int kfd_open(struct inode *inode, struct file *filep)
 {
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
index 7041a6714baa..9178cfe34f20 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
@@ -58,14 +58,14 @@ int kfd_interrupt_init(struct kfd_dev *kfd)
 		KFD_IH_NUM_ENTRIES * kfd->device_info.ih_ring_entry_size,
 		GFP_KERNEL);
 	if (r) {
-		dev_err(kfd_chardev(), "Failed to allocate IH fifo\n");
+		dev_err(kfd->adev->dev, "Failed to allocate IH fifo\n");
 		return r;
 	}
 
 	kfd->ih_wq = alloc_workqueue("KFD IH", WQ_HIGHPRI, 1);
 	if (unlikely(!kfd->ih_wq)) {
 		kfifo_free(&kfd->ih_fifo);
-		dev_err(kfd_chardev(), "Failed to allocate KFD IH workqueue\n");
+		dev_err(kfd->adev->dev, "Failed to allocate KFD IH workqueue\n");
 		return -ENOMEM;
 	}
 	spin_lock_init(&kfd->interrupt_lock);
@@ -117,7 +117,7 @@ bool enqueue_ih_ring_entry(struct kfd_dev *kfd,	const void *ih_ring_entry)
 	count = kfifo_in(&kfd->ih_fifo, ih_ring_entry,
 				kfd->device_info.ih_ring_entry_size);
 	if (count != kfd->device_info.ih_ring_entry_size) {
-		dev_dbg_ratelimited(kfd_chardev(),
+		dev_dbg_ratelimited(kfd->adev->dev,
 			"Interrupt ring overflow, dropping interrupt %d\n",
 			count);
 		return false;
@@ -148,7 +148,7 @@ static void interrupt_wq(struct work_struct *work)
 	uint32_t ih_ring_entry[KFD_MAX_RING_ENTRY_SIZE];
 
 	if (dev->device_info.ih_ring_entry_size > sizeof(ih_ring_entry)) {
-		dev_err_once(kfd_chardev(), "Ring entry too small\n");
+		dev_err_once(dev->adev->dev, "Ring entry too small\n");
 		return;
 	}
 
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 783d53a3dd9e..f36062be9ca8 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -355,7 +355,6 @@ enum kfd_mempool {
 /* Character device interface */
 int kfd_chardev_init(void);
 void kfd_chardev_exit(void);
-struct device *kfd_chardev(void);
 
 /**
  * enum kfd_unmap_queues_filter - Enum for queue filters.
-- 
2.32.0


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

* Re: [PATCH 1/1] drm/amdkfd: Use real device for messages
  2022-02-19  0:57 [PATCH 1/1] drm/amdkfd: Use real device for messages Felix Kuehling
@ 2022-02-21 11:01 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2022-02-21 11:01 UTC (permalink / raw)
  To: Felix Kuehling, amd-gfx; +Cc: kent.russell

Am 19.02.22 um 01:57 schrieb Felix Kuehling:
> kfd_chardev() doesn't provide much useful information in dev_... messages
> on multi-GPU systems because there is only one KFD device, which doesn't
> correspond to any particular GPU. Use the actual GPU device to indicate
> the GPU that caused a message.
>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>

Ah, yes somebody noted that to me as well a while ago. Good to see that 
changed.

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_chardev.c   | 5 -----
>   drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 ++++----
>   drivers/gpu/drm/amd/amdkfd/kfd_priv.h      | 1 -
>   3 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index 7affec907fd1..ceeb0d5e9060 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -104,11 +104,6 @@ void kfd_chardev_exit(void)
>   	kfd_device = NULL;
>   }
>   
> -struct device *kfd_chardev(void)
> -{
> -	return kfd_device;
> -}
> -
>   
>   static int kfd_open(struct inode *inode, struct file *filep)
>   {
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> index 7041a6714baa..9178cfe34f20 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> @@ -58,14 +58,14 @@ int kfd_interrupt_init(struct kfd_dev *kfd)
>   		KFD_IH_NUM_ENTRIES * kfd->device_info.ih_ring_entry_size,
>   		GFP_KERNEL);
>   	if (r) {
> -		dev_err(kfd_chardev(), "Failed to allocate IH fifo\n");
> +		dev_err(kfd->adev->dev, "Failed to allocate IH fifo\n");
>   		return r;
>   	}
>   
>   	kfd->ih_wq = alloc_workqueue("KFD IH", WQ_HIGHPRI, 1);
>   	if (unlikely(!kfd->ih_wq)) {
>   		kfifo_free(&kfd->ih_fifo);
> -		dev_err(kfd_chardev(), "Failed to allocate KFD IH workqueue\n");
> +		dev_err(kfd->adev->dev, "Failed to allocate KFD IH workqueue\n");
>   		return -ENOMEM;
>   	}
>   	spin_lock_init(&kfd->interrupt_lock);
> @@ -117,7 +117,7 @@ bool enqueue_ih_ring_entry(struct kfd_dev *kfd,	const void *ih_ring_entry)
>   	count = kfifo_in(&kfd->ih_fifo, ih_ring_entry,
>   				kfd->device_info.ih_ring_entry_size);
>   	if (count != kfd->device_info.ih_ring_entry_size) {
> -		dev_dbg_ratelimited(kfd_chardev(),
> +		dev_dbg_ratelimited(kfd->adev->dev,
>   			"Interrupt ring overflow, dropping interrupt %d\n",
>   			count);
>   		return false;
> @@ -148,7 +148,7 @@ static void interrupt_wq(struct work_struct *work)
>   	uint32_t ih_ring_entry[KFD_MAX_RING_ENTRY_SIZE];
>   
>   	if (dev->device_info.ih_ring_entry_size > sizeof(ih_ring_entry)) {
> -		dev_err_once(kfd_chardev(), "Ring entry too small\n");
> +		dev_err_once(dev->adev->dev, "Ring entry too small\n");
>   		return;
>   	}
>   
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> index 783d53a3dd9e..f36062be9ca8 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> @@ -355,7 +355,6 @@ enum kfd_mempool {
>   /* Character device interface */
>   int kfd_chardev_init(void);
>   void kfd_chardev_exit(void);
> -struct device *kfd_chardev(void);
>   
>   /**
>    * enum kfd_unmap_queues_filter - Enum for queue filters.


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

end of thread, other threads:[~2022-02-21 11:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-19  0:57 [PATCH 1/1] drm/amdkfd: Use real device for messages Felix Kuehling
2022-02-21 11:01 ` Christian König

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.