From patchwork Mon Apr 10 05:53:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 748839 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w1fjS5hMZz9s7L for ; Mon, 10 Apr 2017 16:02:36 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="d7nSiDhK"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3w1fjS4Y61zDqJL for ; Mon, 10 Apr 2017 16:02:36 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="d7nSiDhK"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org X-Greylist: delayed 451 seconds by postgrey-1.36 at bilbo; Mon, 10 Apr 2017 16:01:16 AEST Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="d7nSiDhK"; dkim-atps=neutral Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3w1fgw5P7rzDq7Z for ; Mon, 10 Apr 2017 16:01:16 +1000 (AEST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id D5313F30; Mon, 10 Apr 2017 01:53:42 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Mon, 10 Apr 2017 01:53:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=DFEOGv NBZ+w+ci7UDPOCnWnvYT7bQo851jVDzR28V3s=; b=d7nSiDhKs8UgVgURvay+Dy 3infef5dVYj/BZeuJrLls34tvoJwvjBIw4p6OONXq48HwMJm9kxPGLqInUdvsZwd S58kmrNzkLhn2trXbZdNet9SLvtuKrjsGq2C/pScpv/GY7FGg2xaY4hDZVNb89b/ SfVD1knNwfJVZ8QlrflW9o1+MZbsaysJ15kfK2/6RmHUQoSc3YX0RlNNY+fQWGq6 8YBoijA5d+BjKkP1zHQl/50sijchSYSmGBlFS6z/DH96Ar7UfFjqkupz4PfT8Cfc DVvg8Xy7xp9Q05JJZz43TeAucio9NNv1HiSMSP3rmWtlZ2Rmuhw9D7Y5OdaZjJCg == X-ME-Sender: X-Sasl-enc: XuZzBiuKILPDPAMsbWaeQr+a8+27apFRK/EVj5SuCtnB 1491803621 Received: from snap.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 35A3C241D0; Mon, 10 Apr 2017 01:53:40 -0400 (EDT) From: Russell Currey To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc/powernv/pci: Reduce spam when dumping PEST Date: Mon, 10 Apr 2017 15:53:28 +1000 Message-Id: <20170410055328.11727-1-ruscur@russell.cc> X-Mailer: git-send-email 2.12.2 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell Currey Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 255 lines get printed. Check for duplicates when dumping the PEST to reduce useless output. For example: PE[f8] A/B: 9700002600000000 80000080d00000f8 PE[f9] A/B: 8000000000000000 0000000000000000 PE[..fe] A/B: as above PE[ff] A/B: 8440002b00000000 0000000000000000 instead of: PE[f8] A/B: 9700002600000000 80000080d00000f8 PE[f9] A/B: 8000000000000000 0000000000000000 PE[fa] A/B: 8000000000000000 0000000000000000 PE[fb] A/B: 8000000000000000 0000000000000000 PE[fc] A/B: 8000000000000000 0000000000000000 PE[fd] A/B: 8000000000000000 0000000000000000 PE[fe] A/B: 8000000000000000 0000000000000000 PE[ff] A/B: 8440002b00000000 0000000000000000 and you can imagine how much worse it can get for 255 PEs. Signed-off-by: Russell Currey Reviewed-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci.c | 52 ++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index eb835e977e33..303c9d84d3d4 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c @@ -227,11 +227,40 @@ 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) +{ + int i; + __be64 prevA, prevB; + bool dup = false; + prevA = prevB = ~0; + + 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[..%x] A/B: as above\n", i-1); + dup = false; + } + prevA = peA; + prevB = peB; + if (peA || peB) + pr_info("PE[%2x] A/B: %016llx %016llx\n", + i, peA, peB); + } else { + /* Don't need to track zeroes */ + if (!dup && (peA || peB)) + dup = true; + } + } +} + static void pnv_pci_dump_p7ioc_diag_data(struct pci_controller *hose, struct OpalIoPhbErrorCommon *common) { struct OpalIoP7IOCPhbErrorData *data; - int i; data = (struct OpalIoP7IOCPhbErrorData *)common; pr_info("P7IOC PHB#%x Diag-data (Version: %d)\n", @@ -308,22 +337,13 @@ static void pnv_pci_dump_p7ioc_diag_data(struct pci_controller *hose, be64_to_cpu(data->dma1ErrorLog0), be64_to_cpu(data->dma1ErrorLog1)); - for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) { - if ((be64_to_cpu(data->pestA[i]) >> 63) == 0 && - (be64_to_cpu(data->pestB[i]) >> 63) == 0) - continue; - - pr_info("PE[%3d] A/B: %016llx %016llx\n", - i, be64_to_cpu(data->pestA[i]), - be64_to_cpu(data->pestB[i])); - } + pnv_pci_dump_pest(data->pestA, data->pestB, OPAL_P7IOC_NUM_PEST_REGS); } static void pnv_pci_dump_phb3_diag_data(struct pci_controller *hose, struct OpalIoPhbErrorCommon *common) { struct OpalIoPhb3ErrorData *data; - int i; data = (struct OpalIoPhb3ErrorData*)common; pr_info("PHB3 PHB#%x Diag-data (Version: %d)\n", @@ -404,15 +424,7 @@ static void pnv_pci_dump_phb3_diag_data(struct pci_controller *hose, be64_to_cpu(data->dma1ErrorLog0), be64_to_cpu(data->dma1ErrorLog1)); - for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) { - if ((be64_to_cpu(data->pestA[i]) >> 63) == 0 && - (be64_to_cpu(data->pestB[i]) >> 63) == 0) - continue; - - pr_info("PE[%3d] A/B: %016llx %016llx\n", - i, be64_to_cpu(data->pestA[i]), - be64_to_cpu(data->pestB[i])); - } + pnv_pci_dump_pest(data->pestA, data->pestB, OPAL_PHB3_NUM_PEST_REGS); } void pnv_pci_dump_phb_diag_data(struct pci_controller *hose,