diff mbox series

npu2: Improve log output of GPU-to-link mapping

Message ID 1524153167-5629-1-git-send-email-arbab@linux.ibm.com
State Accepted
Headers show
Series npu2: Improve log output of GPU-to-link mapping | expand

Commit Message

Reza Arbab April 19, 2018, 3:52 p.m. UTC
Debugging issues related to unconnected NVLinks can be a little less
irritating if we use the NPU2DEV{DBG,INF}() macros instead of prlog().

In short, change this:

  NPU2: comparing GPU 'GPU2' and NPU2 'GPU1'
  NPU2: comparing GPU 'GPU3' and NPU2 'GPU1'
  NPU2: comparing GPU 'GPU4' and NPU2 'GPU1'
  NPU2: comparing GPU 'GPU5' and NPU2 'GPU1'
  	:
  npu2_dev_bind_pci_dev: No PCI device for NPU2 device 0006:00:01.0 to bind to. If you expect a GPU to be there, this is a problem.

to this:

  NPU6:0:1.0 Comparing GPU 'GPU2' and NPU2 'GPU1'
  NPU6:0:1.0 Comparing GPU 'GPU3' and NPU2 'GPU1'
  NPU6:0:1.0 Comparing GPU 'GPU4' and NPU2 'GPU1'
  NPU6:0:1.0 Comparing GPU 'GPU5' and NPU2 'GPU1'
  	:
  NPU6:0:1.0 No PCI device found for slot 'GPU1'

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
---
 hw/npu2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Alistair Popple April 20, 2018, 4:18 a.m. UTC | #1
Good idea, I've been meaning to do that for a while. Thanks!

Reviewed-by: Alistair Popple <alistair@popple.id.au>

On Thursday, 19 April 2018 10:52:47 AM AEST Reza Arbab wrote:
> Debugging issues related to unconnected NVLinks can be a little less
> irritating if we use the NPU2DEV{DBG,INF}() macros instead of prlog().
> 
> In short, change this:
> 
>   NPU2: comparing GPU 'GPU2' and NPU2 'GPU1'
>   NPU2: comparing GPU 'GPU3' and NPU2 'GPU1'
>   NPU2: comparing GPU 'GPU4' and NPU2 'GPU1'
>   NPU2: comparing GPU 'GPU5' and NPU2 'GPU1'
>   	:
>   npu2_dev_bind_pci_dev: No PCI device for NPU2 device 0006:00:01.0 to bind to. If you expect a GPU to be there, this is a problem.
> 
> to this:
> 
>   NPU6:0:1.0 Comparing GPU 'GPU2' and NPU2 'GPU1'
>   NPU6:0:1.0 Comparing GPU 'GPU3' and NPU2 'GPU1'
>   NPU6:0:1.0 Comparing GPU 'GPU4' and NPU2 'GPU1'
>   NPU6:0:1.0 Comparing GPU 'GPU5' and NPU2 'GPU1'
>   	:
>   NPU6:0:1.0 No PCI device found for slot 'GPU1'
> 
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> ---
>  hw/npu2.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/npu2.c b/hw/npu2.c
> index 4122af9..dc9f220 100644
> --- a/hw/npu2.c
> +++ b/hw/npu2.c
> @@ -400,8 +400,8 @@ static int __npu2_dev_bind_pci_dev(struct phb *phb __unused,
>  
>  	pcislot = (char *)dt_prop_get(pci_dt_node, "ibm,slot-label");
>  
> -	prlog(PR_DEBUG, "NPU2: comparing GPU '%s' and NPU2 '%s'\n",
> -	      pcislot, dev->nvlink.slot_label);
> +	NPU2DEVDBG(dev, "Comparing GPU '%s' and NPU2 '%s'\n",
> +		   pcislot, dev->nvlink.slot_label);
>  
>  	if (streq(pcislot, dev->nvlink.slot_label))
>  		return 1;
> @@ -434,8 +434,8 @@ static void npu2_dev_bind_pci_dev(struct npu2_dev *dev)
>  		}
>  	}
>  
> -	prlog(PR_INFO, "%s: No PCI device for NPU2 device %04x:00:%02x.0 to bind to. If you expect a GPU to be there, this is a problem.\n",
> -	      __func__, dev->npu->phb_nvlink.opal_id, dev->index);
> +	NPU2DEVINF(dev, "No PCI device found for slot '%s'\n",
> +		   dev->nvlink.slot_label);
>  }
>  
>  static struct lock pci_npu_phandle_lock = LOCK_UNLOCKED;
>
Stewart Smith April 20, 2018, 7:22 a.m. UTC | #2
Reza Arbab <arbab@linux.ibm.com> writes:
> Debugging issues related to unconnected NVLinks can be a little less
> irritating if we use the NPU2DEV{DBG,INF}() macros instead of prlog().
>
> In short, change this:
>
>   NPU2: comparing GPU 'GPU2' and NPU2 'GPU1'
>   NPU2: comparing GPU 'GPU3' and NPU2 'GPU1'
>   NPU2: comparing GPU 'GPU4' and NPU2 'GPU1'
>   NPU2: comparing GPU 'GPU5' and NPU2 'GPU1'
>   	:
>   npu2_dev_bind_pci_dev: No PCI device for NPU2 device 0006:00:01.0 to bind to. If you expect a GPU to be there, this is a problem.
>
> to this:
>
>   NPU6:0:1.0 Comparing GPU 'GPU2' and NPU2 'GPU1'
>   NPU6:0:1.0 Comparing GPU 'GPU3' and NPU2 'GPU1'
>   NPU6:0:1.0 Comparing GPU 'GPU4' and NPU2 'GPU1'
>   NPU6:0:1.0 Comparing GPU 'GPU5' and NPU2 'GPU1'
>   	:
>   NPU6:0:1.0 No PCI device found for slot 'GPU1'
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> ---
>  hw/npu2.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Cheers, merged to master as of 58b1e05b08d35fcdbb4f21e89561bb4e4c3d58c0
diff mbox series

Patch

diff --git a/hw/npu2.c b/hw/npu2.c
index 4122af9..dc9f220 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -400,8 +400,8 @@  static int __npu2_dev_bind_pci_dev(struct phb *phb __unused,
 
 	pcislot = (char *)dt_prop_get(pci_dt_node, "ibm,slot-label");
 
-	prlog(PR_DEBUG, "NPU2: comparing GPU '%s' and NPU2 '%s'\n",
-	      pcislot, dev->nvlink.slot_label);
+	NPU2DEVDBG(dev, "Comparing GPU '%s' and NPU2 '%s'\n",
+		   pcislot, dev->nvlink.slot_label);
 
 	if (streq(pcislot, dev->nvlink.slot_label))
 		return 1;
@@ -434,8 +434,8 @@  static void npu2_dev_bind_pci_dev(struct npu2_dev *dev)
 		}
 	}
 
-	prlog(PR_INFO, "%s: No PCI device for NPU2 device %04x:00:%02x.0 to bind to. If you expect a GPU to be there, this is a problem.\n",
-	      __func__, dev->npu->phb_nvlink.opal_id, dev->index);
+	NPU2DEVINF(dev, "No PCI device found for slot '%s'\n",
+		   dev->nvlink.slot_label);
 }
 
 static struct lock pci_npu_phandle_lock = LOCK_UNLOCKED;