linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
Subject: [PATCH 3/6] powerpc/eeh: Reduce lines of log dump
Date: Wed, 16 Jul 2014 15:50:16 +1000	[thread overview]
Message-ID: <1405489819-26211-4-git-send-email-gwshan@linux.vnet.ibm.com> (raw)
In-Reply-To: <1405489819-26211-1-git-send-email-gwshan@linux.vnet.ibm.com>

The patch prints 4 PCIE or AER config registers each line, which
is part of the EEH log so that it looks a bit more compact.

Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/eeh.c | 37 +++++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index aa33656..123c151 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -157,12 +157,13 @@ __setup("eeh=", eeh_setup);
  * This routine captures assorted PCI configuration space data,
  * and puts them into a buffer for RTAS error logging.
  */
-static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
+static size_t eeh_gather_pci_data(struct eeh_dev *edev, char *buf, size_t len)
 {
 	struct device_node *dn = eeh_dev_to_of_node(edev);
 	u32 cfg;
-	int cap, i;
+	int cap, i, j;
 	int n = 0;
+	char buffer[128];
 
 	n += scnprintf(buf+n, len-n, "%s\n", dn->full_name);
 	pr_warn("EEH: of node=%s\n", dn->full_name);
@@ -204,10 +205,22 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
 		n += scnprintf(buf+n, len-n, "pci-e cap10:\n");
 		pr_warn("EEH: PCI-E capabilities and status follow:\n");
 
-		for (i=0; i<=8; i++) {
+		for (i=0, j=0; i<=8; i++) {
 			eeh_ops->read_config(dn, cap+4*i, 4, &cfg);
 			n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
-			pr_warn("EEH: PCI-E %02x: %08x\n", i, cfg);
+
+			if ((i % 4) == 0) {
+				memset(buffer, 0, sizeof(buffer));
+				j = scnprintf(buffer, sizeof(buffer),
+					      "EEH: PCI-E %02x: %08x ",
+					      4*i, cfg);
+			} else {
+				j += scnprintf(buffer+j, sizeof(buffer)-j,
+					       "%08x ", cfg);
+			}
+
+			if ((i % 4) == 3 || i >= 8)
+				pr_warn("%s\n", buffer);
 		}
 	}
 
@@ -217,10 +230,22 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
 		n += scnprintf(buf+n, len-n, "pci-e AER:\n");
 		pr_warn("EEH: PCI-E AER capability register set follows:\n");
 
-		for (i=0; i<14; i++) {
+		for (i=0, j=0; i<=13; i++) {
 			eeh_ops->read_config(dn, cap+4*i, 4, &cfg);
 			n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
-			pr_warn("EEH: PCI-E AER %02x: %08x\n", i, cfg);
+
+			if ((i % 4) == 0) {
+				memset(buffer, 0, sizeof(buffer));
+				j = scnprintf(buffer, sizeof(buffer),
+					      "EEH: PCI-E AER %02x: %08x ",
+					      4*i, cfg);
+			} else {
+				j += scnprintf(buffer+j, sizeof(buffer)-j,
+					       "%08x ", cfg);
+			}
+
+			if ((i % 4) == 3 || i >= 13)
+				pr_warn("%s\n", buffer);
 		}
 	}
 
-- 
1.8.3.2

  parent reply	other threads:[~2014-07-16  5:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16  5:50 [PATCH 0/6] EEH Cleanup Gavin Shan
2014-07-16  5:50 ` [PATCH 1/6] powerpc/eeh: Refactor EEH flag accessors Gavin Shan
2014-07-16  8:24   ` David Laight
2014-07-16 12:10     ` Gavin Shan
2014-07-16  5:50 ` [PATCH 2/6] powerpc/eeh: Selectively enable IO for error log Gavin Shan
2014-07-16  5:50 ` Gavin Shan [this message]
2014-07-16  8:30   ` [PATCH 3/6] powerpc/eeh: Reduce lines of log dump David Laight
2014-07-16 12:26     ` Gavin Shan
2014-07-16  5:50 ` [PATCH 4/6] powerpc/eeh: Replace pr_warning() with pr_warn() Gavin Shan
2014-07-16  5:50 ` [PATCH 5/6] powerpc/eeh: Make diag-data not endian dependent Gavin Shan
2014-07-16  5:50 ` [PATCH 6/6] powerpc/eeh: Aux PE data for error log Gavin Shan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405489819-26211-4-git-send-email-gwshan@linux.vnet.ibm.com \
    --to=gwshan@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).