Re: [PATCH 1/2] xen-pciback: Use dev_printk() when possible

From: Joe Perches
Date: Thu May 28 2020 - 00:07:47 EST


On Wed, 2020-05-27 at 15:34 -0700, Boris Ostrovsky wrote:
> On 5/27/20 1:43 PM, Bjorn Helgaas wrote:
> > @@ -155,8 +157,8 @@ int xen_pcibk_config_read(struct pci_dev *dev, int offset, int size,
> > u32 value = 0, tmp_val;
> >
> > if (unlikely(verbose_request))
> > - printk(KERN_DEBUG DRV_NAME ": %s: read %d bytes at 0x%x\n",
> > - pci_name(dev), size, offset);
> > + dev_printk(KERN_DEBUG, &dev->dev, "read %d bytes at 0x%x\n",
> > + size, offset);
>
> Maybe then dev_dbg() ?

It likely would be better to remove verbose_request altogether
and just use dynamic debugging and dev_dbg for all the output.

$ git grep -w -A3 verbose_request
drivers/pci/xen-pcifront.c:static int verbose_request;
drivers/pci/xen-pcifront.c:module_param(verbose_request, int, 0644);
drivers/pci/xen-pcifront.c-
drivers/pci/xen-pcifront.c-static int errno_to_pcibios_err(int errno)
drivers/pci/xen-pcifront.c-{
--
drivers/pci/xen-pcifront.c: if (verbose_request)
drivers/pci/xen-pcifront.c- dev_info(&pdev->xdev->dev,
drivers/pci/xen-pcifront.c- "read dev=%04x:%02x:%02x.%d - offset %x size %d\n",
drivers/pci/xen-pcifront.c- pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
--
drivers/pci/xen-pcifront.c: if (verbose_request)
drivers/pci/xen-pcifront.c- dev_info(&pdev->xdev->dev, "read got back value %x\n",
drivers/pci/xen-pcifront.c- op.value);
drivers/pci/xen-pcifront.c-
--
drivers/pci/xen-pcifront.c: if (verbose_request)
drivers/pci/xen-pcifront.c- dev_info(&pdev->xdev->dev,
drivers/pci/xen-pcifront.c- "write dev=%04x:%02x:%02x.%d - "
drivers/pci/xen-pcifront.c- "offset %x size %d val %x\n",
--
drivers/xen/xen-pciback/conf_space.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/conf_space.c- printk(KERN_DEBUG DRV_NAME ": %s: read %d bytes at 0x%x\n",
drivers/xen/xen-pciback/conf_space.c- pci_name(dev), size, offset);
drivers/xen/xen-pciback/conf_space.c-
--
drivers/xen/xen-pciback/conf_space.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/conf_space.c- printk(KERN_DEBUG DRV_NAME ": %s: read %d bytes at 0x%x = %x\n",
drivers/xen/xen-pciback/conf_space.c- pci_name(dev), size, offset, value);
drivers/xen/xen-pciback/conf_space.c-
--
drivers/xen/xen-pciback/conf_space.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/conf_space.c- printk(KERN_DEBUG
drivers/xen/xen-pciback/conf_space.c- DRV_NAME ": %s: write request %d bytes at 0x%x = %x\n",
drivers/xen/xen-pciback/conf_space.c- pci_name(dev), size, offset, value);
--
drivers/xen/xen-pciback/conf_space_header.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/conf_space_header.c- printk(KERN_DEBUG DRV_NAME ": %s: enable\n",
drivers/xen/xen-pciback/conf_space_header.c- pci_name(dev));
drivers/xen/xen-pciback/conf_space_header.c- err = pci_enable_device(dev);
--
drivers/xen/xen-pciback/conf_space_header.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/conf_space_header.c- printk(KERN_DEBUG DRV_NAME ": %s: disable\n",
drivers/xen/xen-pciback/conf_space_header.c- pci_name(dev));
drivers/xen/xen-pciback/conf_space_header.c- pci_disable_device(dev);
--
drivers/xen/xen-pciback/conf_space_header.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/conf_space_header.c- printk(KERN_DEBUG DRV_NAME ": %s: set bus master\n",
drivers/xen/xen-pciback/conf_space_header.c- pci_name(dev));
drivers/xen/xen-pciback/conf_space_header.c- pci_set_master(dev);
--
drivers/xen/xen-pciback/conf_space_header.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/conf_space_header.c- printk(KERN_DEBUG DRV_NAME ": %s: clear bus master\n",
drivers/xen/xen-pciback/conf_space_header.c- pci_name(dev));
drivers/xen/xen-pciback/conf_space_header.c- pci_clear_master(dev);
--
drivers/xen/xen-pciback/conf_space_header.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/conf_space_header.c- printk(KERN_DEBUG
drivers/xen/xen-pciback/conf_space_header.c- DRV_NAME ": %s: enable memory-write-invalidate\n",
drivers/xen/xen-pciback/conf_space_header.c- pci_name(dev));
--
drivers/xen/xen-pciback/conf_space_header.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/conf_space_header.c- printk(KERN_DEBUG
drivers/xen/xen-pciback/conf_space_header.c- DRV_NAME ": %s: disable memory-write-invalidate\n",
drivers/xen/xen-pciback/conf_space_header.c- pci_name(dev));
--
drivers/xen/xen-pciback/pciback.h:extern int verbose_request;
drivers/xen/xen-pciback/pciback.h-
drivers/xen/xen-pciback/pciback.h-void xen_pcibk_test_and_schedule_op(struct xen_pcibk_device *pdev);
drivers/xen/xen-pciback/pciback.h-#endif
--
drivers/xen/xen-pciback/pciback_ops.c:int verbose_request;
drivers/xen/xen-pciback/pciback_ops.c:module_param(verbose_request, int, 0644);
drivers/xen/xen-pciback/pciback_ops.c-
drivers/xen/xen-pciback/pciback_ops.c-static irqreturn_t xen_pcibk_guest_interrupt(int irq, void *dev_id);
drivers/xen/xen-pciback/pciback_ops.c-
--
drivers/xen/xen-pciback/pciback_ops.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/pciback_ops.c- printk(KERN_DEBUG DRV_NAME ": %s: enable MSI\n", pci_name(dev));
drivers/xen/xen-pciback/pciback_ops.c-
drivers/xen/xen-pciback/pciback_ops.c- if (dev->msi_enabled)
--
drivers/xen/xen-pciback/pciback_ops.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/pciback_ops.c- printk(KERN_DEBUG DRV_NAME ": %s: MSI: %d\n", pci_name(dev),
drivers/xen/xen-pciback/pciback_ops.c- op->value);
drivers/xen/xen-pciback/pciback_ops.c-
--
drivers/xen/xen-pciback/pciback_ops.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/pciback_ops.c- printk(KERN_DEBUG DRV_NAME ": %s: disable MSI\n",
drivers/xen/xen-pciback/pciback_ops.c- pci_name(dev));
drivers/xen/xen-pciback/pciback_ops.c-
--
drivers/xen/xen-pciback/pciback_ops.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/pciback_ops.c- printk(KERN_DEBUG DRV_NAME ": %s: MSI: %d\n", pci_name(dev),
drivers/xen/xen-pciback/pciback_ops.c- op->value);
drivers/xen/xen-pciback/pciback_ops.c- return 0;
--
drivers/xen/xen-pciback/pciback_ops.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/pciback_ops.c- printk(KERN_DEBUG DRV_NAME ": %s: enable MSI-X\n",
drivers/xen/xen-pciback/pciback_ops.c- pci_name(dev));
drivers/xen/xen-pciback/pciback_ops.c-
--
drivers/xen/xen-pciback/pciback_ops.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/pciback_ops.c- printk(KERN_DEBUG DRV_NAME ": %s: " \
drivers/xen/xen-pciback/pciback_ops.c- "MSI-X[%d]: %d\n",
drivers/xen/xen-pciback/pciback_ops.c- pci_name(dev), i,
--
drivers/xen/xen-pciback/pciback_ops.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/pciback_ops.c- printk(KERN_DEBUG DRV_NAME ": %s: disable MSI-X\n",
drivers/xen/xen-pciback/pciback_ops.c- pci_name(dev));
drivers/xen/xen-pciback/pciback_ops.c-
--
drivers/xen/xen-pciback/pciback_ops.c: if (unlikely(verbose_request))
drivers/xen/xen-pciback/pciback_ops.c- printk(KERN_DEBUG DRV_NAME ": %s: MSI-X: %d\n",
drivers/xen/xen-pciback/pciback_ops.c- pci_name(dev), op->value);
drivers/xen/xen-pciback/pciback_ops.c- return 0;