diff mbox

pass-through: drop pointless uses of __func__

Message ID 57BD6E110200007800108790@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich Aug. 24, 2016, 7:51 a.m. UTC
Non-debugging message text should be (and is in the cases here)
distinguishable without also logging function names. Additionally log
the PCI device coordinates for alloc_pdev() failure.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
pass-through: drop pointless uses of __func__

Non-debugging message text should be (and is in the cases here)
distinguishable without also logging function names. Additionally log
the PCI device coordinates for alloc_pdev() failure.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -379,8 +379,8 @@ static struct pci_dev *alloc_pdev(struct
             break;
 
         default:
-            printk(XENLOG_WARNING "%s: unknown type: %04x:%02x:%02x.%u\n",
-                   __func__, pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_WARNING "%04x:%02x:%02x.%u: unknown type %d\n",
+                   pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pdev->type);
             break;
     }
 
@@ -991,7 +991,8 @@ static int __init _scan_pci_devices(stru
                 pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
                 if ( !pdev )
                 {
-                    printk("%s: alloc_pdev failed.\n", __func__);
+                    printk(XENLOG_WARNING "%04x:%02x:%02x.%u: alloc_pdev failed\n",
+                           pseg->nr, bus, dev, func);
                     return -ENOMEM;
                 }

Comments

Konrad Rzeszutek Wilk Aug. 24, 2016, 8:28 p.m. UTC | #1
On Wed, Aug 24, 2016 at 01:51:13AM -0600, Jan Beulich wrote:
> Non-debugging message text should be (and is in the cases here)
> distinguishable without also logging function names. Additionally log
> the PCI device coordinates for alloc_pdev() failure.
> 

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -379,8 +379,8 @@ static struct pci_dev *alloc_pdev(struct
>              break;
>  
>          default:
> -            printk(XENLOG_WARNING "%s: unknown type: %04x:%02x:%02x.%u\n",
> -                   __func__, pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
> +            printk(XENLOG_WARNING "%04x:%02x:%02x.%u: unknown type %d\n",
> +                   pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pdev->type);
>              break;
>      }
>  
> @@ -991,7 +991,8 @@ static int __init _scan_pci_devices(stru
>                  pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
>                  if ( !pdev )
>                  {
> -                    printk("%s: alloc_pdev failed.\n", __func__);
> +                    printk(XENLOG_WARNING "%04x:%02x:%02x.%u: alloc_pdev failed\n",
> +                           pseg->nr, bus, dev, func);
>                      return -ENOMEM;
>                  }
>  
> 
> 
> 

> pass-through: drop pointless uses of __func__
> 
> Non-debugging message text should be (and is in the cases here)
> distinguishable without also logging function names. Additionally log
> the PCI device coordinates for alloc_pdev() failure.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -379,8 +379,8 @@ static struct pci_dev *alloc_pdev(struct
>              break;
>  
>          default:
> -            printk(XENLOG_WARNING "%s: unknown type: %04x:%02x:%02x.%u\n",
> -                   __func__, pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
> +            printk(XENLOG_WARNING "%04x:%02x:%02x.%u: unknown type %d\n",
> +                   pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pdev->type);
>              break;
>      }
>  
> @@ -991,7 +991,8 @@ static int __init _scan_pci_devices(stru
>                  pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
>                  if ( !pdev )
>                  {
> -                    printk("%s: alloc_pdev failed.\n", __func__);
> +                    printk(XENLOG_WARNING "%04x:%02x:%02x.%u: alloc_pdev failed\n",
> +                           pseg->nr, bus, dev, func);
>                      return -ENOMEM;
>                  }
>  

> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
Andrew Cooper Aug. 31, 2016, 6:36 p.m. UTC | #2
On 24/08/16 08:51, Jan Beulich wrote:
> Non-debugging message text should be (and is in the cases here)
> distinguishable without also logging function names. Additionally log
> the PCI device coordinates for alloc_pdev() failure.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

On this note, I have a series I never really started properly, which
introduces a single pci_sbdf_t, totalling 32 bits of bitfields, and a
custom %p handler.  The register shuffling required in all the function
calls taking 4 parameters for the PCI SBDF which total 32 bits seems
extremely wasteful.

~Andrew
Jan Beulich Sept. 1, 2016, 7:11 a.m. UTC | #3
>>> On 31.08.16 at 20:36, <andrew.cooper3@citrix.com> wrote:
> On this note, I have a series I never really started properly, which
> introduces a single pci_sbdf_t, totalling 32 bits of bitfields, and a
> custom %p handler.  The register shuffling required in all the function
> calls taking 4 parameters for the PCI SBDF which total 32 bits seems
> extremely wasteful.

Oh, yes, I've been meaning to get to this too, but never really did.

Jan
diff mbox

Patch

--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -379,8 +379,8 @@  static struct pci_dev *alloc_pdev(struct
             break;
 
         default:
-            printk(XENLOG_WARNING "%s: unknown type: %04x:%02x:%02x.%u\n",
-                   __func__, pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_WARNING "%04x:%02x:%02x.%u: unknown type %d\n",
+                   pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pdev->type);
             break;
     }
 
@@ -991,7 +991,8 @@  static int __init _scan_pci_devices(stru
                 pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
                 if ( !pdev )
                 {
-                    printk("%s: alloc_pdev failed.\n", __func__);
+                    printk(XENLOG_WARNING "%04x:%02x:%02x.%u: alloc_pdev failed\n",
+                           pseg->nr, bus, dev, func);
                     return -ENOMEM;
                 }