linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device
@ 2019-05-09 14:14 Bjorn Helgaas
  2019-05-09 14:14 ` [PATCH 01/10] PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info() Bjorn Helgaas
                   ` (12 more replies)
  0 siblings, 13 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

This is a collection of updates to Fred's v2 patches from:

  https://lore.kernel.org/lkml/20190503035946.23608-1-fred@fredlawl.com

and some follow-on discussion.

Bjorn Helgaas (3):
  PCI: pciehp: Remove pciehp_debug uses
  PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition
  PCI: pciehp: Remove pointless MY_NAME definition

Frederick Lawler (7):
  PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info()
  PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
  PCI/DPC: Log messages with pci_dev, not pcie_device
  PCI/AER: Log messages with pci_dev, not pcie_device
  PCI: pciehp: Replace pciehp_debug module param with dyndbg
  PCI: pciehp: Log messages with pci_dev, not pcie_device
  PCI: pciehp: Remove unused dbg/err/info/warn() wrappers

 drivers/pci/hotplug/pciehp.h      | 31 +++++++-------------------
 drivers/pci/hotplug/pciehp_core.c | 18 +++++++--------
 drivers/pci/hotplug/pciehp_ctrl.c |  2 ++
 drivers/pci/hotplug/pciehp_hpc.c  | 17 +++++++-------
 drivers/pci/hotplug/pciehp_pci.c  |  2 ++
 drivers/pci/pcie/aer.c            | 32 ++++++++++++++------------
 drivers/pci/pcie/aer_inject.c     | 22 +++++++++---------
 drivers/pci/pcie/dpc.c            | 37 +++++++++++++++----------------
 drivers/pci/pcie/pme.c            | 10 +++++----
 9 files changed, 82 insertions(+), 89 deletions(-)

-- 
2.21.0.1020.gf2820cf01a-goog


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

* [PATCH 01/10] PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info()
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
@ 2019-05-09 14:14 ` Bjorn Helgaas
  2019-05-09 17:36   ` Andy Shevchenko
  2019-05-09 14:14 ` [PATCH 02/10] PCI/PME: " Bjorn Helgaas
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Frederick Lawler <fred@fredlawl.com>

Replace dev_printk(KERN_DEBUG) with dev_info() or dev_err() to be more
consistent with other logging.

These could be converted to dev_dbg(), but that depends on
CONFIG_DYNAMIC_DEBUG and DEBUG, and we want most of these messages to
*always* be in the dmesg log.

Also remove a redundant kzalloc() failure message.

Link: https://lore.kernel.org/lkml/20190503035946.23608-2-fred@fredlawl.com
Signed-off-by: Frederick Lawler <fred@fredlawl.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pcie/aer.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index f8fc2114ad39..74f872e4e0cc 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -964,8 +964,8 @@ static bool find_source_device(struct pci_dev *parent,
 	pci_walk_bus(parent->subordinate, find_device_iter, e_info);
 
 	if (!e_info->error_dev_num) {
-		pci_printk(KERN_DEBUG, parent, "can't find device of ID%04x\n",
-			   e_info->id);
+		pci_info(parent, "can't find device of ID%04x\n",
+			 e_info->id);
 		return false;
 	}
 	return true;
@@ -1379,18 +1379,17 @@ static int aer_probe(struct pcie_device *dev)
 	struct device *device = &dev->device;
 
 	rpc = devm_kzalloc(device, sizeof(struct aer_rpc), GFP_KERNEL);
-	if (!rpc) {
-		dev_printk(KERN_DEBUG, device, "alloc AER rpc failed\n");
+	if (!rpc)
 		return -ENOMEM;
-	}
+
 	rpc->rpd = dev->port;
 	set_service_data(dev, rpc);
 
 	status = devm_request_threaded_irq(device, dev->irq, aer_irq, aer_isr,
 					   IRQF_SHARED, "aerdrv", dev);
 	if (status) {
-		dev_printk(KERN_DEBUG, device, "request AER IRQ %d failed\n",
-			   dev->irq);
+		dev_err(device, "request AER IRQ %d failed\n",
+			dev->irq);
 		return status;
 	}
 
@@ -1419,7 +1418,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
 	pci_write_config_dword(dev, pos + PCI_ERR_ROOT_COMMAND, reg32);
 
 	rc = pci_bus_error_reset(dev);
-	pci_printk(KERN_DEBUG, dev, "Root Port link has been reset\n");
+	pci_info(dev, "Root Port link has been reset\n");
 
 	/* Clear Root Error Status */
 	pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, &reg32);
-- 
2.21.0.1020.gf2820cf01a-goog


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

* [PATCH 02/10] PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
  2019-05-09 14:14 ` [PATCH 01/10] PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info() Bjorn Helgaas
@ 2019-05-09 14:14 ` Bjorn Helgaas
  2019-05-09 17:35   ` Andy Shevchenko
  2019-05-09 14:14 ` [PATCH 03/10] PCI/DPC: Log messages with pci_dev, not pcie_device Bjorn Helgaas
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Frederick Lawler <fred@fredlawl.com>

Replace dev_printk(KERN_DEBUG) with dev_info() or dev_err() to be more
consistent with other logging.

These could be converted to dev_dbg(), but that depends on
CONFIG_DYNAMIC_DEBUG and DEBUG, and we want most of these messages to
*always* be in the dmesg log.

Also, use dev_fmt() to add the service name.  Example output change:

  - pcieport 0000:80:10.0: Signaling PME with IRQ ...
  + pcieport 0000:80:10.0: PME: Signaling with IRQ ...

Link: https://lore.kernel.org/lkml/20190503035946.23608-4-fred@fredlawl.com
Signed-off-by: Frederick Lawler <fred@fredlawl.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pcie/pme.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
index 54d593d10396..f38e6c19dd50 100644
--- a/drivers/pci/pcie/pme.c
+++ b/drivers/pci/pcie/pme.c
@@ -7,6 +7,8 @@
  * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
  */
 
+#define dev_fmt(fmt) "PME: " fmt
+
 #include <linux/pci.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -194,14 +196,14 @@ static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id)
 		 * assuming that the PME was reported by a PCIe-PCI bridge that
 		 * used devfn different from zero.
 		 */
-		pci_dbg(port, "PME interrupt generated for non-existent device %02x:%02x.%d\n",
-			busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));
+		pci_info(port, "interrupt generated for non-existent device %02x:%02x.%d\n",
+			 busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));
 		found = pcie_pme_from_pci_bridge(bus, 0);
 	}
 
  out:
 	if (!found)
-		pci_dbg(port, "Spurious native PME interrupt!\n");
+		pci_info(port, "Spurious native interrupt!\n");
 }
 
 /**
@@ -341,7 +343,7 @@ static int pcie_pme_probe(struct pcie_device *srv)
 		return ret;
 	}
 
-	pci_info(port, "Signaling PME with IRQ %d\n", srv->irq);
+	pci_info(port, "Signaling with IRQ %d\n", srv->irq);
 
 	pcie_pme_mark_devices(port);
 	pcie_pme_interrupt_enable(port, true);
-- 
2.21.0.1020.gf2820cf01a-goog


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

* [PATCH 03/10] PCI/DPC: Log messages with pci_dev, not pcie_device
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
  2019-05-09 14:14 ` [PATCH 01/10] PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info() Bjorn Helgaas
  2019-05-09 14:14 ` [PATCH 02/10] PCI/PME: " Bjorn Helgaas
@ 2019-05-09 14:14 ` Bjorn Helgaas
  2019-05-09 17:39   ` Andy Shevchenko
  2019-05-09 14:14 ` [PATCH 04/10] PCI/AER: " Bjorn Helgaas
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Frederick Lawler <fred@fredlawl.com>

Log messages with pci_dev, not pcie_device.  Factor out common message
prefixes with dev_fmt().

Example output change:

  - dpc 0000:00:01.1:pcie008: DPC error containment capabilities...
  + pcieport 0000:00:01.1: DPC: error containment capabilities...

Link: https://lore.kernel.org/lkml/20190503035946.23608-3-fred@fredlawl.com
Signed-off-by: Frederick Lawler <fred@fredlawl.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pcie/dpc.c | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c
index 7b77754a82de..a32ec3487a8d 100644
--- a/drivers/pci/pcie/dpc.c
+++ b/drivers/pci/pcie/dpc.c
@@ -6,6 +6,8 @@
  * Copyright (C) 2016 Intel Corp.
  */
 
+#define dev_fmt(fmt) "DPC: " fmt
+
 #include <linux/aer.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
@@ -100,7 +102,6 @@ static int dpc_wait_rp_inactive(struct dpc_dev *dpc)
 {
 	unsigned long timeout = jiffies + HZ;
 	struct pci_dev *pdev = dpc->dev->port;
-	struct device *dev = &dpc->dev->device;
 	u16 cap = dpc->cap_pos, status;
 
 	pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status);
@@ -110,7 +111,7 @@ static int dpc_wait_rp_inactive(struct dpc_dev *dpc)
 		pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status);
 	}
 	if (status & PCI_EXP_DPC_RP_BUSY) {
-		dev_warn(dev, "DPC root port still busy\n");
+		pci_warn(pdev, "root port still busy\n");
 		return -EBUSY;
 	}
 	return 0;
@@ -148,7 +149,6 @@ static pci_ers_result_t dpc_reset_link(struct pci_dev *pdev)
 
 static void dpc_process_rp_pio_error(struct dpc_dev *dpc)
 {
-	struct device *dev = &dpc->dev->device;
 	struct pci_dev *pdev = dpc->dev->port;
 	u16 cap = dpc->cap_pos, dpc_status, first_error;
 	u32 status, mask, sev, syserr, exc, dw0, dw1, dw2, dw3, log, prefix;
@@ -156,13 +156,13 @@ static void dpc_process_rp_pio_error(struct dpc_dev *dpc)
 
 	pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_STATUS, &status);
 	pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_MASK, &mask);
-	dev_err(dev, "rp_pio_status: %#010x, rp_pio_mask: %#010x\n",
+	pci_err(pdev, "rp_pio_status: %#010x, rp_pio_mask: %#010x\n",
 		status, mask);
 
 	pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_SEVERITY, &sev);
 	pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_SYSERROR, &syserr);
 	pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_EXCEPTION, &exc);
-	dev_err(dev, "RP PIO severity=%#010x, syserror=%#010x, exception=%#010x\n",
+	pci_err(pdev, "RP PIO severity=%#010x, syserror=%#010x, exception=%#010x\n",
 		sev, syserr, exc);
 
 	/* Get First Error Pointer */
@@ -171,7 +171,7 @@ static void dpc_process_rp_pio_error(struct dpc_dev *dpc)
 
 	for (i = 0; i < ARRAY_SIZE(rp_pio_error_string); i++) {
 		if ((status & ~mask) & (1 << i))
-			dev_err(dev, "[%2d] %s%s\n", i, rp_pio_error_string[i],
+			pci_err(pdev, "[%2d] %s%s\n", i, rp_pio_error_string[i],
 				first_error == i ? " (First)" : "");
 	}
 
@@ -185,18 +185,18 @@ static void dpc_process_rp_pio_error(struct dpc_dev *dpc)
 			      &dw2);
 	pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_HEADER_LOG + 12,
 			      &dw3);
-	dev_err(dev, "TLP Header: %#010x %#010x %#010x %#010x\n",
+	pci_err(pdev, "TLP Header: %#010x %#010x %#010x %#010x\n",
 		dw0, dw1, dw2, dw3);
 
 	if (dpc->rp_log_size < 5)
 		goto clear_status;
 	pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_IMPSPEC_LOG, &log);
-	dev_err(dev, "RP PIO ImpSpec Log %#010x\n", log);
+	pci_err(pdev, "RP PIO ImpSpec Log %#010x\n", log);
 
 	for (i = 0; i < dpc->rp_log_size - 5; i++) {
 		pci_read_config_dword(pdev,
 			cap + PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG, &prefix);
-		dev_err(dev, "TLP Prefix Header: dw%d, %#010x\n", i, prefix);
+		pci_err(pdev, "TLP Prefix Header: dw%d, %#010x\n", i, prefix);
 	}
  clear_status:
 	pci_write_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_STATUS, status);
@@ -229,18 +229,17 @@ static irqreturn_t dpc_handler(int irq, void *context)
 	struct aer_err_info info;
 	struct dpc_dev *dpc = context;
 	struct pci_dev *pdev = dpc->dev->port;
-	struct device *dev = &dpc->dev->device;
 	u16 cap = dpc->cap_pos, status, source, reason, ext_reason;
 
 	pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status);
 	pci_read_config_word(pdev, cap + PCI_EXP_DPC_SOURCE_ID, &source);
 
-	dev_info(dev, "DPC containment event, status:%#06x source:%#06x\n",
+	pci_info(pdev, "containment event, status:%#06x source:%#06x\n",
 		 status, source);
 
 	reason = (status & PCI_EXP_DPC_STATUS_TRIGGER_RSN) >> 1;
 	ext_reason = (status & PCI_EXP_DPC_STATUS_TRIGGER_RSN_EXT) >> 5;
-	dev_warn(dev, "DPC %s detected\n",
+	pci_warn(pdev, "%s detected\n",
 		 (reason == 0) ? "unmasked uncorrectable error" :
 		 (reason == 1) ? "ERR_NONFATAL" :
 		 (reason == 2) ? "ERR_FATAL" :
@@ -307,7 +306,7 @@ static int dpc_probe(struct pcie_device *dev)
 					   dpc_handler, IRQF_SHARED,
 					   "pcie-dpc", dpc);
 	if (status) {
-		dev_warn(device, "request IRQ%d failed: %d\n", dev->irq,
+		pci_warn(pdev, "request IRQ%d failed: %d\n", dev->irq,
 			 status);
 		return status;
 	}
@@ -319,7 +318,7 @@ static int dpc_probe(struct pcie_device *dev)
 	if (dpc->rp_extensions) {
 		dpc->rp_log_size = (cap & PCI_EXP_DPC_RP_PIO_LOG_SIZE) >> 8;
 		if (dpc->rp_log_size < 4 || dpc->rp_log_size > 9) {
-			dev_err(device, "RP PIO log size %u is invalid\n",
+			pci_err(pdev, "RP PIO log size %u is invalid\n",
 				dpc->rp_log_size);
 			dpc->rp_log_size = 0;
 		}
@@ -328,11 +327,11 @@ static int dpc_probe(struct pcie_device *dev)
 	ctl = (ctl & 0xfff4) | PCI_EXP_DPC_CTL_EN_FATAL | PCI_EXP_DPC_CTL_INT_EN;
 	pci_write_config_word(pdev, dpc->cap_pos + PCI_EXP_DPC_CTL, ctl);
 
-	dev_info(device, "DPC error containment capabilities: Int Msg #%d, RPExt%c PoisonedTLP%c SwTrigger%c RP PIO Log %d, DL_ActiveErr%c\n",
-		cap & PCI_EXP_DPC_IRQ, FLAG(cap, PCI_EXP_DPC_CAP_RP_EXT),
-		FLAG(cap, PCI_EXP_DPC_CAP_POISONED_TLP),
-		FLAG(cap, PCI_EXP_DPC_CAP_SW_TRIGGER), dpc->rp_log_size,
-		FLAG(cap, PCI_EXP_DPC_CAP_DL_ACTIVE));
+	pci_info(pdev, "error containment capabilities: Int Msg #%d, RPExt%c PoisonedTLP%c SwTrigger%c RP PIO Log %d, DL_ActiveErr%c\n",
+		 cap & PCI_EXP_DPC_IRQ, FLAG(cap, PCI_EXP_DPC_CAP_RP_EXT),
+		 FLAG(cap, PCI_EXP_DPC_CAP_POISONED_TLP),
+		 FLAG(cap, PCI_EXP_DPC_CAP_SW_TRIGGER), dpc->rp_log_size,
+		 FLAG(cap, PCI_EXP_DPC_CAP_DL_ACTIVE));
 
 	pci_add_ext_cap_save_buffer(pdev, PCI_EXT_CAP_ID_DPC, sizeof(u16));
 	return status;
-- 
2.21.0.1020.gf2820cf01a-goog


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

* [PATCH 04/10] PCI/AER: Log messages with pci_dev, not pcie_device
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2019-05-09 14:14 ` [PATCH 03/10] PCI/DPC: Log messages with pci_dev, not pcie_device Bjorn Helgaas
@ 2019-05-09 14:14 ` Bjorn Helgaas
  2019-05-09 17:42   ` Andy Shevchenko
  2019-05-09 14:14 ` [PATCH 05/10] PCI: pciehp: Remove pciehp_debug uses Bjorn Helgaas
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Frederick Lawler <fred@fredlawl.com>

Log messages with pci_dev, not pcie_device.  Factor out common message
prefixes with dev_fmt().

Example output change:

  - aer 0000:00:00.0:pci002: AER enabled with IRQ ...
  + pcieport 0000:00:00.0: AER: enabled with IRQ ...

Link: https://lore.kernel.org/lkml/20190503035946.23608-6-fred@fredlawl.com
Signed-off-by: Frederick Lawler <fred@fredlawl.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pcie/aer.c        | 19 ++++++++++++-------
 drivers/pci/pcie/aer_inject.c | 22 ++++++++++++----------
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 74f872e4e0cc..20a68e8546cc 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -12,6 +12,9 @@
  *    Andrew Patterson <andrew.patterson@hp.com>
  */
 
+#define pr_fmt(fmt) "AER: " fmt
+#define dev_fmt pr_fmt
+
 #include <linux/cper.h>
 #include <linux/pci.h>
 #include <linux/pci-acpi.h>
@@ -779,10 +782,11 @@ static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info)
 	u8 bus = info->id >> 8;
 	u8 devfn = info->id & 0xff;
 
-	pci_info(dev, "AER: %s%s error received: %04x:%02x:%02x.%d\n",
-		info->multi_error_valid ? "Multiple " : "",
-		aer_error_severity_string[info->severity],
-		pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+	pci_info(dev, "%s%s error received: %04x:%02x:%02x.%d\n",
+		 info->multi_error_valid ? "Multiple " : "",
+		 aer_error_severity_string[info->severity],
+		 pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn),
+		 PCI_FUNC(devfn));
 }
 
 #ifdef CONFIG_ACPI_APEI_PCIEAER
@@ -1377,24 +1381,25 @@ static int aer_probe(struct pcie_device *dev)
 	int status;
 	struct aer_rpc *rpc;
 	struct device *device = &dev->device;
+	struct pci_dev *port = dev->port;
 
 	rpc = devm_kzalloc(device, sizeof(struct aer_rpc), GFP_KERNEL);
 	if (!rpc)
 		return -ENOMEM;
 
-	rpc->rpd = dev->port;
+	rpc->rpd = port;
 	set_service_data(dev, rpc);
 
 	status = devm_request_threaded_irq(device, dev->irq, aer_irq, aer_isr,
 					   IRQF_SHARED, "aerdrv", dev);
 	if (status) {
-		dev_err(device, "request AER IRQ %d failed\n",
+		pci_err(port, "request AER IRQ %d failed\n",
 			dev->irq);
 		return status;
 	}
 
 	aer_enable_rootport(rpc);
-	dev_info(device, "AER enabled with IRQ %d\n", dev->irq);
+	pci_info(port, "enabled with IRQ %d\n", dev->irq);
 	return 0;
 }
 
diff --git a/drivers/pci/pcie/aer_inject.c b/drivers/pci/pcie/aer_inject.c
index 95d4759664b3..b05f0d728be8 100644
--- a/drivers/pci/pcie/aer_inject.c
+++ b/drivers/pci/pcie/aer_inject.c
@@ -12,6 +12,8 @@
  *     Huang Ying <ying.huang@intel.com>
  */
 
+#define dev_fmt(fmt) "aer_inject: " fmt
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/irq.h>
@@ -332,14 +334,14 @@ static int aer_inject(struct aer_error_inj *einj)
 		return -ENODEV;
 	rpdev = pcie_find_root_port(dev);
 	if (!rpdev) {
-		pci_err(dev, "aer_inject: Root port not found\n");
+		pci_err(dev, "Root port not found\n");
 		ret = -ENODEV;
 		goto out_put;
 	}
 
 	pos_cap_err = dev->aer_cap;
 	if (!pos_cap_err) {
-		pci_err(dev, "aer_inject: Device doesn't support AER\n");
+		pci_err(dev, "Device doesn't support AER\n");
 		ret = -EPROTONOSUPPORT;
 		goto out_put;
 	}
@@ -350,7 +352,7 @@ static int aer_inject(struct aer_error_inj *einj)
 
 	rp_pos_cap_err = rpdev->aer_cap;
 	if (!rp_pos_cap_err) {
-		pci_err(rpdev, "aer_inject: Root port doesn't support AER\n");
+		pci_err(rpdev, "Root port doesn't support AER\n");
 		ret = -EPROTONOSUPPORT;
 		goto out_put;
 	}
@@ -398,14 +400,14 @@ static int aer_inject(struct aer_error_inj *einj)
 	if (!aer_mask_override && einj->cor_status &&
 	    !(einj->cor_status & ~cor_mask)) {
 		ret = -EINVAL;
-		pci_warn(dev, "aer_inject: The correctable error(s) is masked by device\n");
+		pci_warn(dev, "The correctable error(s) is masked by device\n");
 		spin_unlock_irqrestore(&inject_lock, flags);
 		goto out_put;
 	}
 	if (!aer_mask_override && einj->uncor_status &&
 	    !(einj->uncor_status & ~uncor_mask)) {
 		ret = -EINVAL;
-		pci_warn(dev, "aer_inject: The uncorrectable error(s) is masked by device\n");
+		pci_warn(dev, "The uncorrectable error(s) is masked by device\n");
 		spin_unlock_irqrestore(&inject_lock, flags);
 		goto out_put;
 	}
@@ -460,19 +462,19 @@ static int aer_inject(struct aer_error_inj *einj)
 	if (device) {
 		edev = to_pcie_device(device);
 		if (!get_service_data(edev)) {
-			dev_warn(&edev->device,
-				 "aer_inject: AER service is not initialized\n");
+			pci_warn(edev->port,
+				 "AER service is not initialized\n");
 			ret = -EPROTONOSUPPORT;
 			goto out_put;
 		}
-		dev_info(&edev->device,
-			 "aer_inject: Injecting errors %08x/%08x into device %s\n",
+		pci_info(edev->port,
+			 "Injecting errors %08x/%08x into device %s\n",
 			 einj->cor_status, einj->uncor_status, pci_name(dev));
 		local_irq_disable();
 		generic_handle_irq(edev->irq);
 		local_irq_enable();
 	} else {
-		pci_err(rpdev, "aer_inject: AER device not found\n");
+		pci_err(rpdev, "AER device not found\n");
 		ret = -ENODEV;
 	}
 out_put:
-- 
2.21.0.1020.gf2820cf01a-goog


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

* [PATCH 05/10] PCI: pciehp: Remove pciehp_debug uses
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
                   ` (3 preceding siblings ...)
  2019-05-09 14:14 ` [PATCH 04/10] PCI/AER: " Bjorn Helgaas
@ 2019-05-09 14:14 ` Bjorn Helgaas
  2019-05-09 14:14 ` [PATCH 06/10] PCI: pciehp: Replace pciehp_debug module param with dyndbg Bjorn Helgaas
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

We're about to convert pciehp to the dyndbg mechanism, which means we can
eventually remove pciehp_debug.

Replace uses of pciehp_debug with dbg() and ctrl_dbg(), which check
pciehp_debug internally.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/hotplug/pciehp_hpc.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 6a2365cd794e..e121f1c06c21 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -232,8 +232,8 @@ static bool pci_bus_check_dev(struct pci_bus *bus, int devfn)
 		delay -= step;
 	} while (delay > 0);
 
-	if (count > 1 && pciehp_debug)
-		printk(KERN_DEBUG "pci %04x:%02x:%02x.%d id reading try %d times with interval %d ms to get %08x\n",
+	if (count > 1)
+		dbg("pci %04x:%02x:%02x.%d id reading try %d times with interval %d ms to get %08x\n",
 			pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
 			PCI_FUNC(devfn), count, step, l);
 
@@ -822,14 +822,11 @@ static inline void dbg_ctrl(struct controller *ctrl)
 	struct pci_dev *pdev = ctrl->pcie->port;
 	u16 reg16;
 
-	if (!pciehp_debug)
-		return;
-
-	ctrl_info(ctrl, "Slot Capabilities      : 0x%08x\n", ctrl->slot_cap);
+	ctrl_dbg(ctrl, "Slot Capabilities      : 0x%08x\n", ctrl->slot_cap);
 	pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &reg16);
-	ctrl_info(ctrl, "Slot Status            : 0x%04x\n", reg16);
+	ctrl_dbg(ctrl, "Slot Status            : 0x%04x\n", reg16);
 	pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &reg16);
-	ctrl_info(ctrl, "Slot Control           : 0x%04x\n", reg16);
+	ctrl_dbg(ctrl, "Slot Control           : 0x%04x\n", reg16);
 }
 
 #define FLAG(x, y)	(((x) & (y)) ? '+' : '-')
-- 
2.21.0.1020.gf2820cf01a-goog


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

* [PATCH 06/10] PCI: pciehp: Replace pciehp_debug module param with dyndbg
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
                   ` (4 preceding siblings ...)
  2019-05-09 14:14 ` [PATCH 05/10] PCI: pciehp: Remove pciehp_debug uses Bjorn Helgaas
@ 2019-05-09 14:14 ` Bjorn Helgaas
  2019-05-09 14:14 ` [PATCH 07/10] PCI: pciehp: Log messages with pci_dev, not pcie_device Bjorn Helgaas
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Frederick Lawler <fred@fredlawl.com>

Previously pciehp debug messages were enabled by the pciehp_debug module
parameter, e.g., by booting with this kernel command line option:

  pciehp.pciehp_debug=1

Convert this mechanism to use the generic dynamic debug (dyndbg) feature.
After this commit, pciehp debug messages are enabled by building the kernel
with CONFIG_DYNAMIC_DEBUG=y and booting with this command line option:

  dyndbg="file pciehp* +p"

The dyndbg facility is much more flexible: messages can be enabled at boot-
or run-time based on the file name, function name, line number, message
test, etc.  See Documentation/admin-guide/dynamic-debug-howto.rst for more
details.

Link: https://lore.kernel.org/lkml/20190503035946.23608-8-fred@fredlawl.com
Signed-off-by: Frederick Lawler <fred@fredlawl.com>
[bhelgaas: commit log, comment, remove pciehp_debug parameter]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/hotplug/pciehp.h      | 16 ++++++----------
 drivers/pci/hotplug/pciehp_core.c |  3 ---
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index 506e1d923a1f..af5d9f92e6d5 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -29,13 +29,13 @@
 
 extern bool pciehp_poll_mode;
 extern int pciehp_poll_time;
-extern bool pciehp_debug;
 
+/*
+ * Set CONFIG_DYNAMIC_DEBUG=y and boot with 'dyndbg="file pciehp* +p"' to
+ * enable debug messages.
+ */
 #define dbg(format, arg...)						\
-do {									\
-	if (pciehp_debug)						\
-		printk(KERN_DEBUG "%s: " format, MY_NAME, ## arg);	\
-} while (0)
+	pr_debug("%s: " format, MY_NAME, ## arg);
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME, ## arg)
 #define info(format, arg...)						\
@@ -44,11 +44,7 @@ do {									\
 	printk(KERN_WARNING "%s: " format, MY_NAME, ## arg)
 
 #define ctrl_dbg(ctrl, format, arg...)					\
-	do {								\
-		if (pciehp_debug)					\
-			dev_printk(KERN_DEBUG, &ctrl->pcie->device,	\
-					format, ## arg);		\
-	} while (0)
+	dev_dbg(&ctrl->pcie->device, format, ## arg)
 #define ctrl_err(ctrl, format, arg...)					\
 	dev_err(&ctrl->pcie->device, format, ## arg)
 #define ctrl_info(ctrl, format, arg...)					\
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index fc5366b50e95..6ff204c435bf 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -27,7 +27,6 @@
 #include "../pci.h"
 
 /* Global variables */
-bool pciehp_debug;
 bool pciehp_poll_mode;
 int pciehp_poll_time;
 
@@ -35,10 +34,8 @@ int pciehp_poll_time;
  * not really modular, but the easiest way to keep compat with existing
  * bootargs behaviour is to continue using module_param here.
  */
-module_param(pciehp_debug, bool, 0644);
 module_param(pciehp_poll_mode, bool, 0644);
 module_param(pciehp_poll_time, int, 0644);
-MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not");
 MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not");
 MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds");
 
-- 
2.21.0.1020.gf2820cf01a-goog


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

* [PATCH 07/10] PCI: pciehp: Log messages with pci_dev, not pcie_device
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
                   ` (5 preceding siblings ...)
  2019-05-09 14:14 ` [PATCH 06/10] PCI: pciehp: Replace pciehp_debug module param with dyndbg Bjorn Helgaas
@ 2019-05-09 14:14 ` Bjorn Helgaas
  2019-05-09 14:14 ` [PATCH 08/10] PCI: pciehp: Remove unused dbg/err/info/warn() wrappers Bjorn Helgaas
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Frederick Lawler <fred@fredlawl.com>

Log messages with pci_dev, not pcie_device.  Factor out common message
prefixes with dev_fmt().

Example output change:

  - pciehp 0000:00:06.0:pcie004: Slot(0) Powering on due to button press
  + pcieport 0000:00:06.0: pciehp: Slot(0) Powering on due to button press

Link: https://lore.kernel.org/lkml/20190503035946.23608-7-fred@fredlawl.com
Signed-off-by: Frederick Lawler <fred@fredlawl.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/hotplug/pciehp.h      | 16 ++++++++--------
 drivers/pci/hotplug/pciehp_core.c |  7 +++++--
 drivers/pci/hotplug/pciehp_ctrl.c |  2 ++
 drivers/pci/hotplug/pciehp_hpc.c  |  2 ++
 drivers/pci/hotplug/pciehp_pci.c  |  2 ++
 5 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index af5d9f92e6d5..2f0295b48d5d 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -35,22 +35,22 @@ extern int pciehp_poll_time;
  * enable debug messages.
  */
 #define dbg(format, arg...)						\
-	pr_debug("%s: " format, MY_NAME, ## arg);
+	pr_debug(format, ## arg);
 #define err(format, arg...)						\
-	printk(KERN_ERR "%s: " format, MY_NAME, ## arg)
+	pr_err(format, ## arg)
 #define info(format, arg...)						\
-	printk(KERN_INFO "%s: " format, MY_NAME, ## arg)
+	pr_info(format, ## arg)
 #define warn(format, arg...)						\
-	printk(KERN_WARNING "%s: " format, MY_NAME, ## arg)
+	pr_warn(format, ## arg)
 
 #define ctrl_dbg(ctrl, format, arg...)					\
-	dev_dbg(&ctrl->pcie->device, format, ## arg)
+	pci_dbg(ctrl->pcie->port, format, ## arg)
 #define ctrl_err(ctrl, format, arg...)					\
-	dev_err(&ctrl->pcie->device, format, ## arg)
+	pci_err(ctrl->pcie->port, format, ## arg)
 #define ctrl_info(ctrl, format, arg...)					\
-	dev_info(&ctrl->pcie->device, format, ## arg)
+	pci_info(ctrl->pcie->port, format, ## arg)
 #define ctrl_warn(ctrl, format, arg...)					\
-	dev_warn(&ctrl->pcie->device, format, ## arg)
+	pci_warn(ctrl->pcie->port, format, ## arg)
 
 #define SLOT_NAME_SIZE 10
 
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 6ff204c435bf..b85b22880c50 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -17,6 +17,9 @@
  *   Dely Sy <dely.l.sy@intel.com>"
  */
 
+#define pr_fmt(fmt) "pciehp: " fmt
+#define dev_fmt pr_fmt
+
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -179,14 +182,14 @@ static int pciehp_probe(struct pcie_device *dev)
 
 	if (!dev->port->subordinate) {
 		/* Can happen if we run out of bus numbers during probe */
-		dev_err(&dev->device,
+		pci_err(dev->port,
 			"Hotplug bridge without secondary bus, ignoring\n");
 		return -ENODEV;
 	}
 
 	ctrl = pcie_init(dev);
 	if (!ctrl) {
-		dev_err(&dev->device, "Controller initialization failed\n");
+		pci_err(dev->port, "Controller initialization failed\n");
 		return -ENODEV;
 	}
 	set_service_data(dev, ctrl);
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 3f3df4c29f6e..bf81f977a751 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -13,6 +13,8 @@
  *
  */
 
+#define dev_fmt(fmt) "pciehp: " fmt
+
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/pm_runtime.h>
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index e121f1c06c21..913c7e66504f 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -12,6 +12,8 @@
  * Send feedback to <greg@kroah.com>,<kristen.c.accardi@intel.com>
  */
 
+#define dev_fmt(fmt) "pciehp: " fmt
+
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/jiffies.h>
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
index b9c1396db6fe..d17f3bf36f70 100644
--- a/drivers/pci/hotplug/pciehp_pci.c
+++ b/drivers/pci/hotplug/pciehp_pci.c
@@ -13,6 +13,8 @@
  *
  */
 
+#define dev_fmt(fmt) "pciehp: " fmt
+
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/pci.h>
-- 
2.21.0.1020.gf2820cf01a-goog


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

* [PATCH 08/10] PCI: pciehp: Remove unused dbg/err/info/warn() wrappers
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
                   ` (6 preceding siblings ...)
  2019-05-09 14:14 ` [PATCH 07/10] PCI: pciehp: Log messages with pci_dev, not pcie_device Bjorn Helgaas
@ 2019-05-09 14:14 ` Bjorn Helgaas
  2019-05-09 14:14 ` [PATCH 09/10] PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition Bjorn Helgaas
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Frederick Lawler <fred@fredlawl.com>

Replace the last uses of dbg() with the equivalent pr_debug(), then remove
unused dbg(), err(), info(), and warn() wrappers.

Link: https://lore.kernel.org/lkml/20190503035946.23608-9-fred@fredlawl.com
Signed-off-by: Frederick Lawler <fred@fredlawl.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/hotplug/pciehp.h      | 9 ---------
 drivers/pci/hotplug/pciehp_core.c | 4 ++--
 drivers/pci/hotplug/pciehp_hpc.c  | 2 +-
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index 2f0295b48d5d..c206fd9cd3d7 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -34,15 +34,6 @@ extern int pciehp_poll_time;
  * Set CONFIG_DYNAMIC_DEBUG=y and boot with 'dyndbg="file pciehp* +p"' to
  * enable debug messages.
  */
-#define dbg(format, arg...)						\
-	pr_debug(format, ## arg);
-#define err(format, arg...)						\
-	pr_err(format, ## arg)
-#define info(format, arg...)						\
-	pr_info(format, ## arg)
-#define warn(format, arg...)						\
-	pr_warn(format, ## arg)
-
 #define ctrl_dbg(ctrl, format, arg...)					\
 	pci_dbg(ctrl->pcie->port, format, ## arg)
 #define ctrl_err(ctrl, format, arg...)					\
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index b85b22880c50..1643e9aa261c 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -328,9 +328,9 @@ int __init pcie_hp_init(void)
 	int retval = 0;
 
 	retval = pcie_port_service_register(&hpdriver_portdrv);
-	dbg("pcie_port_service_register = %d\n", retval);
+	pr_debug("pcie_port_service_register = %d\n", retval);
 	if (retval)
-		dbg("Failure to register service\n");
+		pr_debug("Failure to register service\n");
 
 	return retval;
 }
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 913c7e66504f..9ce93b1034bd 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -235,7 +235,7 @@ static bool pci_bus_check_dev(struct pci_bus *bus, int devfn)
 	} while (delay > 0);
 
 	if (count > 1)
-		dbg("pci %04x:%02x:%02x.%d id reading try %d times with interval %d ms to get %08x\n",
+		pr_debug("pci %04x:%02x:%02x.%d id reading try %d times with interval %d ms to get %08x\n",
 			pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
 			PCI_FUNC(devfn), count, step, l);
 
-- 
2.21.0.1020.gf2820cf01a-goog


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

* [PATCH 09/10] PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
                   ` (7 preceding siblings ...)
  2019-05-09 14:14 ` [PATCH 08/10] PCI: pciehp: Remove unused dbg/err/info/warn() wrappers Bjorn Helgaas
@ 2019-05-09 14:14 ` Bjorn Helgaas
  2019-05-09 14:14 ` [PATCH 10/10] PCI: pciehp: Remove pointless MY_NAME definition Bjorn Helgaas
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

PCIE_MODULE_NAME is only used once and offers no benefit, so remove it.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/hotplug/pciehp_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 1643e9aa261c..6ad0d86762cb 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -42,8 +42,6 @@ module_param(pciehp_poll_time, int, 0644);
 MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not");
 MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds");
 
-#define PCIE_MODULE_NAME "pciehp"
-
 static int set_attention_status(struct hotplug_slot *slot, u8 value);
 static int get_power_status(struct hotplug_slot *slot, u8 *value);
 static int get_latch_status(struct hotplug_slot *slot, u8 *value);
@@ -307,7 +305,7 @@ static int pciehp_runtime_resume(struct pcie_device *dev)
 #endif /* PM */
 
 static struct pcie_port_service_driver hpdriver_portdrv = {
-	.name		= PCIE_MODULE_NAME,
+	.name		= "pciehp",
 	.port_type	= PCIE_ANY_PORT,
 	.service	= PCIE_PORT_SERVICE_HP,
 
-- 
2.21.0.1020.gf2820cf01a-goog


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

* [PATCH 10/10] PCI: pciehp: Remove pointless MY_NAME definition
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
                   ` (8 preceding siblings ...)
  2019-05-09 14:14 ` [PATCH 09/10] PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition Bjorn Helgaas
@ 2019-05-09 14:14 ` Bjorn Helgaas
  2019-05-09 15:07 ` [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Keith Busch
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 14:14 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

MY_NAME is only used once and offers no benefit, so remove it.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/hotplug/pciehp.h     | 2 --
 drivers/pci/hotplug/pciehp_hpc.c | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index c206fd9cd3d7..8c51a04b8083 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -25,8 +25,6 @@
 
 #include "../pcie/portdrv.h"
 
-#define MY_NAME	"pciehp"
-
 extern bool pciehp_poll_mode;
 extern int pciehp_poll_time;
 
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 9ce93b1034bd..bd990e3371e3 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -48,7 +48,7 @@ static inline int pciehp_request_irq(struct controller *ctrl)
 
 	/* Installs the interrupt handler */
 	retval = request_threaded_irq(irq, pciehp_isr, pciehp_ist,
-				      IRQF_SHARED, MY_NAME, ctrl);
+				      IRQF_SHARED, "pciehp", ctrl);
 	if (retval)
 		ctrl_err(ctrl, "Cannot get irq %d for the hotplug controller\n",
 			 irq);
-- 
2.21.0.1020.gf2820cf01a-goog


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

* Re: [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
                   ` (9 preceding siblings ...)
  2019-05-09 14:14 ` [PATCH 10/10] PCI: pciehp: Remove pointless MY_NAME definition Bjorn Helgaas
@ 2019-05-09 15:07 ` Keith Busch
  2019-05-09 17:10 ` Bjorn Helgaas
  2019-05-09 17:49 ` Andy Shevchenko
  12 siblings, 0 replies; 25+ messages in thread
From: Keith Busch @ 2019-05-09 15:07 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	linux-kernel, Bjorn Helgaas

On Thu, May 09, 2019 at 09:14:46AM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> This is a collection of updates to Fred's v2 patches from:
> 
>   https://lore.kernel.org/lkml/20190503035946.23608-1-fred@fredlawl.com
> 
> and some follow-on discussion.

For the series:

Reviewed-by: Keith Busch <keith.busch@intel.com>

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

* Re: [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
                   ` (10 preceding siblings ...)
  2019-05-09 15:07 ` [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Keith Busch
@ 2019-05-09 17:10 ` Bjorn Helgaas
  2019-05-09 17:49 ` Andy Shevchenko
  12 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 17:10 UTC (permalink / raw)
  To: Frederick Lawler
  Cc: Mika Westerberg, Lukas Wunner, Andy Shevchenko, Keith Busch,
	Dongdong Liu, Sven Van Asbroeck, linux-pci, linux-kernel

On Thu, May 09, 2019 at 09:14:46AM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> This is a collection of updates to Fred's v2 patches from:
> 
>   https://lore.kernel.org/lkml/20190503035946.23608-1-fred@fredlawl.com
> 
> and some follow-on discussion.
> 
> Bjorn Helgaas (3):
>   PCI: pciehp: Remove pciehp_debug uses
>   PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition
>   PCI: pciehp: Remove pointless MY_NAME definition
> 
> Frederick Lawler (7):
>   PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info()
>   PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
>   PCI/DPC: Log messages with pci_dev, not pcie_device
>   PCI/AER: Log messages with pci_dev, not pcie_device
>   PCI: pciehp: Replace pciehp_debug module param with dyndbg
>   PCI: pciehp: Log messages with pci_dev, not pcie_device
>   PCI: pciehp: Remove unused dbg/err/info/warn() wrappers
> 
>  drivers/pci/hotplug/pciehp.h      | 31 +++++++-------------------
>  drivers/pci/hotplug/pciehp_core.c | 18 +++++++--------
>  drivers/pci/hotplug/pciehp_ctrl.c |  2 ++
>  drivers/pci/hotplug/pciehp_hpc.c  | 17 +++++++-------
>  drivers/pci/hotplug/pciehp_pci.c  |  2 ++
>  drivers/pci/pcie/aer.c            | 32 ++++++++++++++------------
>  drivers/pci/pcie/aer_inject.c     | 22 +++++++++---------
>  drivers/pci/pcie/dpc.c            | 37 +++++++++++++++----------------
>  drivers/pci/pcie/pme.c            | 10 +++++----
>  9 files changed, 82 insertions(+), 89 deletions(-)

I applied these to pci/printk-portdrv with Keith's reviewed-by, hoping to
still squeeze these into v5.2.

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

* Re: [PATCH 02/10] PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
  2019-05-09 14:14 ` [PATCH 02/10] PCI/PME: " Bjorn Helgaas
@ 2019-05-09 17:35   ` Andy Shevchenko
  2019-05-09 18:31     ` Joe Perches
  0 siblings, 1 reply; 25+ messages in thread
From: Andy Shevchenko @ 2019-05-09 17:35 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	Linux Kernel Mailing List, Bjorn Helgaas

On Thu, May 9, 2019 at 5:18 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> Replace dev_printk(KERN_DEBUG) with dev_info() or dev_err() to be more
> consistent with other logging.
>
> These could be converted to dev_dbg(), but that depends on
> CONFIG_DYNAMIC_DEBUG and DEBUG, and we want most of these messages to
> *always* be in the dmesg log.
>
> Also, use dev_fmt() to add the service name.  Example output change:
>
>   - pcieport 0000:80:10.0: Signaling PME with IRQ ...
>   + pcieport 0000:80:10.0: PME: Signaling with IRQ ...

> +               pci_info(port, "interrupt generated for non-existent device %02x:%02x.%d\n",

Can we be slightly more consistent here, i.e. start from Capital letter?

> +                        busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));

> +               pci_info(port, "Spurious native interrupt!\n");

> +       pci_info(port, "Signaling with IRQ %d\n", srv->irq);

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 01/10] PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info()
  2019-05-09 14:14 ` [PATCH 01/10] PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info() Bjorn Helgaas
@ 2019-05-09 17:36   ` Andy Shevchenko
  2019-05-09 21:08     ` Bjorn Helgaas
  0 siblings, 1 reply; 25+ messages in thread
From: Andy Shevchenko @ 2019-05-09 17:36 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	Linux Kernel Mailing List, Bjorn Helgaas

On Thu, May 9, 2019 at 5:17 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> From: Frederick Lawler <fred@fredlawl.com>
>
> Replace dev_printk(KERN_DEBUG) with dev_info() or dev_err() to be more
> consistent with other logging.
>
> These could be converted to dev_dbg(), but that depends on
> CONFIG_DYNAMIC_DEBUG and DEBUG, and we want most of these messages to
> *always* be in the dmesg log.
>
> Also remove a redundant kzalloc() failure message.

> +               pci_info(parent, "can't find device of ID%04x\n",
> +                        e_info->id);

Would it be a chance to take them one line instead of two?

> +               dev_err(device, "request AER IRQ %d failed\n",
> +                       dev->irq);

Ditto.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 03/10] PCI/DPC: Log messages with pci_dev, not pcie_device
  2019-05-09 14:14 ` [PATCH 03/10] PCI/DPC: Log messages with pci_dev, not pcie_device Bjorn Helgaas
@ 2019-05-09 17:39   ` Andy Shevchenko
  2019-05-09 21:18     ` Bjorn Helgaas
  0 siblings, 1 reply; 25+ messages in thread
From: Andy Shevchenko @ 2019-05-09 17:39 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	Linux Kernel Mailing List, Bjorn Helgaas

On Thu, May 9, 2019 at 5:18 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> Log messages with pci_dev, not pcie_device.  Factor out common message
> prefixes with dev_fmt().
>
> Example output change:
>
>   - dpc 0000:00:01.1:pcie008: DPC error containment capabilities...
>   + pcieport 0000:00:01.1: DPC: error containment capabilities...

Overall same question about Capitalizing sentences.

> +       pci_err(pdev, "rp_pio_status: %#010x, rp_pio_mask: %#010x\n",

And here perhaps RP PIO status: ... mask: ... ?
See below I left examples from this patch.

>                 status, mask);

> +       pci_err(pdev, "RP PIO severity=%#010x, syserror=%#010x, exception=%#010x\n",
>                 sev, syserr, exc);

> +       pci_err(pdev, "RP PIO ImpSpec Log %#010x\n", log);

> +                       pci_err(pdev, "RP PIO log size %u is invalid\n",
>                                 dpc->rp_log_size);

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 04/10] PCI/AER: Log messages with pci_dev, not pcie_device
  2019-05-09 14:14 ` [PATCH 04/10] PCI/AER: " Bjorn Helgaas
@ 2019-05-09 17:42   ` Andy Shevchenko
  2019-05-09 21:44     ` Bjorn Helgaas
  0 siblings, 1 reply; 25+ messages in thread
From: Andy Shevchenko @ 2019-05-09 17:42 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	Linux Kernel Mailing List, Bjorn Helgaas

On Thu, May 9, 2019 at 5:19 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> Log messages with pci_dev, not pcie_device.  Factor out common message
> prefixes with dev_fmt().
>
> Example output change:
>
>   - aer 0000:00:00.0:pci002: AER enabled with IRQ ...
>   + pcieport 0000:00:00.0: AER: enabled with IRQ ...

> +               pci_err(port, "request AER IRQ %d failed\n",
>                         dev->irq);

Possible to be on one line?

> +                       pci_warn(edev->port,
> +                                "AER service is not initialized\n");

checkpatch won't complain if it would be on one line.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device
  2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
                   ` (11 preceding siblings ...)
  2019-05-09 17:10 ` Bjorn Helgaas
@ 2019-05-09 17:49 ` Andy Shevchenko
  2019-05-09 21:49   ` Bjorn Helgaas
  12 siblings, 1 reply; 25+ messages in thread
From: Andy Shevchenko @ 2019-05-09 17:49 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	Linux Kernel Mailing List, Bjorn Helgaas

On Thu, May 9, 2019 at 5:18 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> This is a collection of updates to Fred's v2 patches from:
>
>   https://lore.kernel.org/lkml/20190503035946.23608-1-fred@fredlawl.com
>
> and some follow-on discussion.
>

For non-commented patches,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

For the commented ones, I hope you will address them, and then my tag
applies for them as well.

> Bjorn Helgaas (3):
>   PCI: pciehp: Remove pciehp_debug uses
>   PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition
>   PCI: pciehp: Remove pointless MY_NAME definition
>
> Frederick Lawler (7):
>   PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info()
>   PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
>   PCI/DPC: Log messages with pci_dev, not pcie_device
>   PCI/AER: Log messages with pci_dev, not pcie_device
>   PCI: pciehp: Replace pciehp_debug module param with dyndbg
>   PCI: pciehp: Log messages with pci_dev, not pcie_device
>   PCI: pciehp: Remove unused dbg/err/info/warn() wrappers
>
>  drivers/pci/hotplug/pciehp.h      | 31 +++++++-------------------
>  drivers/pci/hotplug/pciehp_core.c | 18 +++++++--------
>  drivers/pci/hotplug/pciehp_ctrl.c |  2 ++
>  drivers/pci/hotplug/pciehp_hpc.c  | 17 +++++++-------
>  drivers/pci/hotplug/pciehp_pci.c  |  2 ++
>  drivers/pci/pcie/aer.c            | 32 ++++++++++++++------------
>  drivers/pci/pcie/aer_inject.c     | 22 +++++++++---------
>  drivers/pci/pcie/dpc.c            | 37 +++++++++++++++----------------
>  drivers/pci/pcie/pme.c            | 10 +++++----
>  9 files changed, 82 insertions(+), 89 deletions(-)
>
> --
> 2.21.0.1020.gf2820cf01a-goog
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 02/10] PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
  2019-05-09 17:35   ` Andy Shevchenko
@ 2019-05-09 18:31     ` Joe Perches
  2019-05-09 21:12       ` Bjorn Helgaas
  0 siblings, 1 reply; 25+ messages in thread
From: Joe Perches @ 2019-05-09 18:31 UTC (permalink / raw)
  To: Andy Shevchenko, Bjorn Helgaas
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	Linux Kernel Mailing List, Bjorn Helgaas

On Thu, 2019-05-09 at 20:35 +0300, Andy Shevchenko wrote:
> On Thu, May 9, 2019 at 5:18 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > Replace dev_printk(KERN_DEBUG) with dev_info() or dev_err() to be more
> > consistent with other logging.
> > 
> > These could be converted to dev_dbg(), but that depends on
> > CONFIG_DYNAMIC_DEBUG and DEBUG, and we want most of these messages to
> > *always* be in the dmesg log.
> > 
> > Also, use dev_fmt() to add the service name.  Example output change:
> > 
> >   - pcieport 0000:80:10.0: Signaling PME with IRQ ...
> >   + pcieport 0000:80:10.0: PME: Signaling with IRQ ...
> > +               pci_info(port, "interrupt generated for non-existent device %02x:%02x.%d\n",
> 
> Can we be slightly more consistent here, i.e. start from Capital letter?
> 
> > +                        busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));
> > +               pci_info(port, "Spurious native interrupt!\n");
> > +       pci_info(port, "Signaling with IRQ %d\n", srv->irq);

Why change the logging level?
Why not use #define DEBUG and use pci_dbg ?



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

* Re: [PATCH 01/10] PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info()
  2019-05-09 17:36   ` Andy Shevchenko
@ 2019-05-09 21:08     ` Bjorn Helgaas
  0 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 21:08 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	Linux Kernel Mailing List

On Thu, May 09, 2019 at 08:36:16PM +0300, Andy Shevchenko wrote:
> On Thu, May 9, 2019 at 5:17 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> >
> > From: Frederick Lawler <fred@fredlawl.com>
> >
> > Replace dev_printk(KERN_DEBUG) with dev_info() or dev_err() to be more
> > consistent with other logging.
> >
> > These could be converted to dev_dbg(), but that depends on
> > CONFIG_DYNAMIC_DEBUG and DEBUG, and we want most of these messages to
> > *always* be in the dmesg log.
> >
> > Also remove a redundant kzalloc() failure message.
> 
> > +               pci_info(parent, "can't find device of ID%04x\n",
> > +                        e_info->id);
> 
> Would it be a chance to take them one line instead of two?
> 
> > +               dev_err(device, "request AER IRQ %d failed\n",
> > +                       dev->irq);
> 
> Ditto.

Indeed, fixed, thanks!

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

* Re: [PATCH 02/10] PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
  2019-05-09 18:31     ` Joe Perches
@ 2019-05-09 21:12       ` Bjorn Helgaas
  2019-05-10  2:22         ` Joe Perches
  0 siblings, 1 reply; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 21:12 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andy Shevchenko, Frederick Lawler, Mika Westerberg, Lukas Wunner,
	Andy Shevchenko, Keith Busch, Dongdong Liu, Sven Van Asbroeck,
	linux-pci, Linux Kernel Mailing List

On Thu, May 09, 2019 at 11:31:04AM -0700, Joe Perches wrote:
> On Thu, 2019-05-09 at 20:35 +0300, Andy Shevchenko wrote:
> > On Thu, May 9, 2019 at 5:18 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > > Replace dev_printk(KERN_DEBUG) with dev_info() or dev_err() to be more
> > > consistent with other logging.
> > > 
> > > These could be converted to dev_dbg(), but that depends on
> > > CONFIG_DYNAMIC_DEBUG and DEBUG, and we want most of these messages to
> > > *always* be in the dmesg log.
> > > 
> > > Also, use dev_fmt() to add the service name.  Example output change:
> > > 
> > >   - pcieport 0000:80:10.0: Signaling PME with IRQ ...
> > >   + pcieport 0000:80:10.0: PME: Signaling with IRQ ...
> > > +               pci_info(port, "interrupt generated for non-existent device %02x:%02x.%d\n",
> > > +                        busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));
> > > +               pci_info(port, "Spurious native interrupt!\n");
> > > +       pci_info(port, "Signaling with IRQ %d\n", srv->irq);
> 
> Why change the logging level?
> Why not use #define DEBUG and use pci_dbg ?

What would the benefit of using DEBUG be?  I don't want these
particular messages to be conditional.

For messages that *should* be conditional, there's a later patch in
the series to use pci_dbg() and convert them to dyndbg so we have a
single mechanism for turning them off/on.

Bjorn

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

* Re: [PATCH 03/10] PCI/DPC: Log messages with pci_dev, not pcie_device
  2019-05-09 17:39   ` Andy Shevchenko
@ 2019-05-09 21:18     ` Bjorn Helgaas
  0 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 21:18 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	Linux Kernel Mailing List

On Thu, May 09, 2019 at 08:39:28PM +0300, Andy Shevchenko wrote:
> On Thu, May 9, 2019 at 5:18 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > Log messages with pci_dev, not pcie_device.  Factor out common message
> > prefixes with dev_fmt().
> >
> > Example output change:
> >
> >   - dpc 0000:00:01.1:pcie008: DPC error containment capabilities...
> >   + pcieport 0000:00:01.1: DPC: error containment capabilities...
> 
> Overall same question about Capitalizing sentences.

I think that consistency would be nice.  But I'm not sure whether the
consensus is capitalize or not, and I would want to do all of
drivers/pci in a single patch so there's a clear precedent to follow,
so I think that's slightly out of scope for this series.

> > +       pci_err(pdev, "rp_pio_status: %#010x, rp_pio_mask: %#010x\n",
> 
> And here perhaps RP PIO status: ... mask: ... ?
> See below I left examples from this patch.

Same thing here.  I noticed this as well, but didn't want to pollute
these patches with other cleanups that were not really related, so
this could be done in the future.  But I certainly agree it's weird to
have "rp_pio_status:" and "RP PIO severity=".

> >                 status, mask);
> 
> > +       pci_err(pdev, "RP PIO severity=%#010x, syserror=%#010x, exception=%#010x\n",
> >                 sev, syserr, exc);
> 
> > +       pci_err(pdev, "RP PIO ImpSpec Log %#010x\n", log);
> 
> > +                       pci_err(pdev, "RP PIO log size %u is invalid\n",
> >                                 dpc->rp_log_size);
> 
> -- 
> With Best Regards,
> Andy Shevchenko

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

* Re: [PATCH 04/10] PCI/AER: Log messages with pci_dev, not pcie_device
  2019-05-09 17:42   ` Andy Shevchenko
@ 2019-05-09 21:44     ` Bjorn Helgaas
  0 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 21:44 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	Linux Kernel Mailing List

On Thu, May 09, 2019 at 08:42:10PM +0300, Andy Shevchenko wrote:
> On Thu, May 9, 2019 at 5:19 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > Log messages with pci_dev, not pcie_device.  Factor out common message
> > prefixes with dev_fmt().
> >
> > Example output change:
> >
> >   - aer 0000:00:00.0:pci002: AER enabled with IRQ ...
> >   + pcieport 0000:00:00.0: AER: enabled with IRQ ...
> 
> > +               pci_err(port, "request AER IRQ %d failed\n",
> >                         dev->irq);
> 
> Possible to be on one line?

Yep, fixed this in a previous patch.

> > +                       pci_warn(edev->port,
> > +                                "AER service is not initialized\n");
> 
> checkpatch won't complain if it would be on one line.

Right, thanks, fixed this too.

Bjorn

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

* Re: [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device
  2019-05-09 17:49 ` Andy Shevchenko
@ 2019-05-09 21:49   ` Bjorn Helgaas
  0 siblings, 0 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2019-05-09 21:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Frederick Lawler, Mika Westerberg, Lukas Wunner, Andy Shevchenko,
	Keith Busch, Dongdong Liu, Sven Van Asbroeck, linux-pci,
	Linux Kernel Mailing List

On Thu, May 09, 2019 at 08:49:08PM +0300, Andy Shevchenko wrote:
> On Thu, May 9, 2019 at 5:18 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> >
> > From: Bjorn Helgaas <bhelgaas@google.com>
> >
> > This is a collection of updates to Fred's v2 patches from:
> >
> >   https://lore.kernel.org/lkml/20190503035946.23608-1-fred@fredlawl.com
> >
> > and some follow-on discussion.
> >
> 
> For non-commented patches,
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> For the commented ones, I hope you will address them, and then my tag
> applies for them as well.

Thanks, Andy and Keith, I really appreciate you taking a look.  Andy,
I added your tag to all except these:

> >   PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
> >   PCI/DPC: Log messages with pci_dev, not pcie_device

because I didn't make the capitalization and other message changes you
pointed out.  I'd totally be fine with those changes, but I don't
think we have time to do a complete job of it for this cycle.

Bjorn

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

* Re: [PATCH 02/10] PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
  2019-05-09 21:12       ` Bjorn Helgaas
@ 2019-05-10  2:22         ` Joe Perches
  0 siblings, 0 replies; 25+ messages in thread
From: Joe Perches @ 2019-05-10  2:22 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Andy Shevchenko, Frederick Lawler, Mika Westerberg, Lukas Wunner,
	Andy Shevchenko, Keith Busch, Dongdong Liu, Sven Van Asbroeck,
	linux-pci, Linux Kernel Mailing List

On Thu, 2019-05-09 at 16:12 -0500, Bjorn Helgaas wrote:
> On Thu, May 09, 2019 at 11:31:04AM -0700, Joe Perches wrote:
> > On Thu, 2019-05-09 at 20:35 +0300, Andy Shevchenko wrote:
> > > On Thu, May 9, 2019 at 5:18 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > > > Replace dev_printk(KERN_DEBUG) with dev_info() or dev_err() to be more
> > > > consistent with other logging.
> > > > 
> > > > These could be converted to dev_dbg(), but that depends on
> > > > CONFIG_DYNAMIC_DEBUG and DEBUG, and we want most of these messages to
> > > > *always* be in the dmesg log.
> > > > 
> > > > Also, use dev_fmt() to add the service name.  Example output change:
> > > > 
> > > >   - pcieport 0000:80:10.0: Signaling PME with IRQ ...
> > > >   + pcieport 0000:80:10.0: PME: Signaling with IRQ ...
> > > > +               pci_info(port, "interrupt generated for non-existent device %02x:%02x.%d\n",
> > > > +                        busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));
> > > > +               pci_info(port, "Spurious native interrupt!\n");
> > > > +       pci_info(port, "Signaling with IRQ %d\n", srv->irq);
> > 
> > Why change the logging level?
> > Why not use #define DEBUG and use pci_dbg ?
> 
> What would the benefit of using DEBUG be?

It makes the <foo>_dbg output unconditional or
possible to be disabled via dynamic_debug

> I don't want these
> particular messages to be conditional.



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

end of thread, other threads:[~2019-05-10  2:22 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-09 14:14 [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Bjorn Helgaas
2019-05-09 14:14 ` [PATCH 01/10] PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info() Bjorn Helgaas
2019-05-09 17:36   ` Andy Shevchenko
2019-05-09 21:08     ` Bjorn Helgaas
2019-05-09 14:14 ` [PATCH 02/10] PCI/PME: " Bjorn Helgaas
2019-05-09 17:35   ` Andy Shevchenko
2019-05-09 18:31     ` Joe Perches
2019-05-09 21:12       ` Bjorn Helgaas
2019-05-10  2:22         ` Joe Perches
2019-05-09 14:14 ` [PATCH 03/10] PCI/DPC: Log messages with pci_dev, not pcie_device Bjorn Helgaas
2019-05-09 17:39   ` Andy Shevchenko
2019-05-09 21:18     ` Bjorn Helgaas
2019-05-09 14:14 ` [PATCH 04/10] PCI/AER: " Bjorn Helgaas
2019-05-09 17:42   ` Andy Shevchenko
2019-05-09 21:44     ` Bjorn Helgaas
2019-05-09 14:14 ` [PATCH 05/10] PCI: pciehp: Remove pciehp_debug uses Bjorn Helgaas
2019-05-09 14:14 ` [PATCH 06/10] PCI: pciehp: Replace pciehp_debug module param with dyndbg Bjorn Helgaas
2019-05-09 14:14 ` [PATCH 07/10] PCI: pciehp: Log messages with pci_dev, not pcie_device Bjorn Helgaas
2019-05-09 14:14 ` [PATCH 08/10] PCI: pciehp: Remove unused dbg/err/info/warn() wrappers Bjorn Helgaas
2019-05-09 14:14 ` [PATCH 09/10] PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition Bjorn Helgaas
2019-05-09 14:14 ` [PATCH 10/10] PCI: pciehp: Remove pointless MY_NAME definition Bjorn Helgaas
2019-05-09 15:07 ` [PATCH v4 00/10] PCI: Log with pci_dev, not pcie_device Keith Busch
2019-05-09 17:10 ` Bjorn Helgaas
2019-05-09 17:49 ` Andy Shevchenko
2019-05-09 21:49   ` Bjorn Helgaas

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 NNTP newsgroup(s).