On 30/05/17 15:44, Russell Currey wrote:
Dumping the PE State Tables (PEST) can be highly verbose if a number of PEs
are affected, especially in the case where the whole PHB is frozen and 512
lines get printed.  Check for duplicates when dumping the PEST to reduce
useless output.

For example:

    PE[0f8] A/B: 9700002600000000 80000080d00000f8
    PE[0f9] A/B: 8000000000000000 0000000000000000
    PE[..0fe] A/B: as above
    PE[0ff] A/B: 8440002b00000000 0000000000000000

instead of:

    PE[0f8] A/B: 9700002600000000 80000080d00000f8
    PE[0f9] A/B: 8000000000000000 0000000000000000
    PE[0fa] A/B: 8000000000000000 0000000000000000
    PE[0fb] A/B: 8000000000000000 0000000000000000
    PE[0fc] A/B: 8000000000000000 0000000000000000
    PE[0fd] A/B: 8000000000000000 0000000000000000
    PE[0fe] A/B: 8000000000000000 0000000000000000
    PE[0ff] A/B: 8440002b00000000 0000000000000000

and you can imagine how much worse it can get for 512 PEs.

Signed-off-by: Russell Currey <rus...@russell.cc>

Minor comments below

Reviewed-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com>

---
This is essentially V2 of a previous patch I submitted, with some changes
thanks to feedback from Gavin.
---
 arch/powerpc/platforms/powernv/pci.c | 50 +++++++++++++++++++++---------------
 1 file changed, 30 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci.c 
b/arch/powerpc/platforms/powernv/pci.c
index 935ccb249a8a..4852ac8d0b4d 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -227,11 +227,38 @@ void pnv_teardown_msi_irqs(struct pci_dev *pdev)
 }
 #endif /* CONFIG_PCI_MSI */

+/* Nicely print the contents of the PE State Tables (PEST). */
+static void pnv_pci_dump_pest(__be64 pestA[], __be64 pestB[], int pest_size)
+{
+       __be64 prevA = ULONG_MAX, prevB = ULONG_MAX;
+       bool dup = false;
+       int i;
+
+       for (i = 0; i < pest_size; i++) {
+               __be64 peA = be64_to_cpu(pestA[i]);
+               __be64 peB = be64_to_cpu(pestB[i]);
+
+               if (peA != prevA || peB != prevB) {
+                       if (dup) {
+                               pr_info("PE[..%03x] A/B: as above\n", i-1);
+                               dup = false;
+                       }
+                       prevA = peA;
+                       prevB = peB;
+                       if (peA >> 63 || peB >> 63)
+                               pr_info("PE[%03x] A/B: %016llx %016llx\n",
+                                       i, peA, peB);
+               } else if (!dup && (peA >> 63 || peB >> 63)) {

I'd prefer "peA >> 63" to be expressed as "peA & PPC_BIT(0)" but that might just be me?


+                       /* Don't need to track zeroes */

This comment is less than clear

+                       dup = true;
+               }
+       }
+}
+


--
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnel...@au1.ibm.com  IBM Australia Limited

Reply via email to