From patchwork Mon Sep 7 08:16:45 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hidetoshi Seto X-Patchwork-Id: 46087 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n878H3fO012151 for ; Mon, 7 Sep 2009 08:17:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090AbZIGIQ6 (ORCPT ); Mon, 7 Sep 2009 04:16:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752105AbZIGIQ6 (ORCPT ); Mon, 7 Sep 2009 04:16:58 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:49906 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752090AbZIGIQ5 (ORCPT ); Mon, 7 Sep 2009 04:16:57 -0400 Received: from m5.gw.fujitsu.co.jp ([10.0.50.75]) by fgwmail6.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id n878GxQ5029704 for (envelope-from seto.hidetoshi@jp.fujitsu.com); Mon, 7 Sep 2009 17:16:59 +0900 Received: from smail (m5 [127.0.0.1]) by outgoing.m5.gw.fujitsu.co.jp (Postfix) with ESMTP id E196845DE38 for ; Mon, 7 Sep 2009 17:16:58 +0900 (JST) Received: from s5.gw.fujitsu.co.jp (s5.gw.fujitsu.co.jp [10.0.50.95]) by m5.gw.fujitsu.co.jp (Postfix) with ESMTP id B4D8345DE51 for ; Mon, 7 Sep 2009 17:16:58 +0900 (JST) Received: from s5.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s5.gw.fujitsu.co.jp (Postfix) with ESMTP id 9A1F0E1800D for ; Mon, 7 Sep 2009 17:16:58 +0900 (JST) Received: from m106.s.css.fujitsu.com (m106.s.css.fujitsu.com [10.249.87.106]) by s5.gw.fujitsu.co.jp (Postfix) with ESMTP id 150661DB805A for ; Mon, 7 Sep 2009 17:16:58 +0900 (JST) Received: from m106.css.fujitsu.com (m106 [127.0.0.1]) by m106.s.css.fujitsu.com (Postfix) with ESMTP id DD9E45B88E8; Mon, 7 Sep 2009 17:16:57 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.100.141]) by m106.s.css.fujitsu.com (Postfix) with ESMTP id 62A465B88E7; Mon, 7 Sep 2009 17:16:57 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Received: from FMVDA2A041[10.124.100.141] by FMVDA2A041 (FujitsuOutboundMailChecker v1.3.1/9992[10.124.100.141]); Mon, 07 Sep 2009 17:16:50 +0900 (JST) Message-ID: <4AA4C16D.3050105@jp.fujitsu.com> Date: Mon, 07 Sep 2009 17:16:45 +0900 From: Hidetoshi Seto User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: linux-pci@vger.kernel.org CC: Jesse Barnes , Andrew Patterson , Bjorn Helgaas Subject: [PATCH 11/12] pcie, aer: change error print format References: <4AA4BE86.60605@jp.fujitsu.com> In-Reply-To: <4AA4BE86.60605@jp.fujitsu.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Use dev_printk like format. Sample (real machine + dummy error injected by aer-inject): - Before: +------ PCI-Express Device Error ------+ Error Severity : Corrected PCIE Bus Error type : Data Link Layer Bad TLP : Receiver ID : 2800 VendorID=8086h, DeviceID=1096h, Bus=28h, Device=00h, Function=00h +------ PCI-Express Device Error ------+ Error Severity : Corrected PCIE Bus Error type : Data Link Layer Bad TLP : Bad DLLP : Receiver ID : 2801 VendorID=8086h, DeviceID=1096h, Bus=28h, Device=00h, Function=01h Error of this Agent(2801) is reported first - After: pcieport-driver 0000:00:02.0: AER: Multiple Corrected error received: id=2801 e1000e 0000:28:00.0: PCIE Bus Error: severity=Corrected, type=Data Link Layer, id=2800(Receiver ID) e1000e 0000:28:00.0: device [8086:1096] error status/mask=00000040/00000000 e1000e 0000:28:00.0: [ 6] Bad TLP e1000e 0000:28:00.1: PCIE Bus Error: severity=Corrected, type=Data Link Layer, id=2801(Receiver ID) e1000e 0000:28:00.1: device [8086:1096] error status/mask=000000c0/00000000 e1000e 0000:28:00.1: [ 6] Bad TLP e1000e 0000:28:00.1: [ 7] Bad DLLP e1000e 0000:28:00.1: Error of this Agent(2801) is reported first Signed-off-by: Hidetoshi Seto --- drivers/pci/pcie/aer/aerdrv.h | 1 + drivers/pci/pcie/aer/aerdrv_core.c | 2 + drivers/pci/pcie/aer/aerdrv_errprint.c | 68 +++++++++++++++++--------------- 3 files changed, 39 insertions(+), 32 deletions(-) diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h index 78c977c..f9979eb 100644 --- a/drivers/pci/pcie/aer/aerdrv.h +++ b/drivers/pci/pcie/aer/aerdrv.h @@ -124,6 +124,7 @@ extern void aer_delete_rootport(struct aer_rpc *rpc); extern int aer_init(struct pcie_device *dev); extern void aer_isr(struct work_struct *work); extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); +extern void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info); extern irqreturn_t aer_irq(int irq, void *context); #ifdef CONFIG_ACPI diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 9626469..d9185cd 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -813,6 +813,8 @@ static void aer_isr_one_error(struct pcie_device *p_device, PCI_ERR_ROOT_MULTI_UNCOR_RCV)) e_info->multi_error_valid = 1; + aer_print_port_info(p_device->port, e_info); + find_source_device(p_device->port, e_info); aer_process_err_devices(p_device, e_info); } diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index f0bdf0f..44acde7 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c @@ -57,9 +57,10 @@ (e & AER_DATA_LINK_LAYER_ERROR_MASK(t)) ? AER_DATA_LINK_LAYER_ERROR : \ AER_TRANSACTION_LAYER_ERROR) -#define AER_PR(info, fmt, args...) \ - printk("%s" fmt, (info->severity == AER_CORRECTABLE) ? \ - KERN_WARNING : KERN_ERR, ## args) +#define AER_PR(info, pdev, fmt, args...) \ + printk("%s%s %s: " fmt, (info->severity == AER_CORRECTABLE) ? \ + KERN_WARNING : KERN_ERR, dev_driver_string(&pdev->dev), \ + dev_name(&pdev->dev), ## args) /* * AER error strings @@ -152,7 +153,7 @@ static char *aer_agent_string[] = { "Transmitter ID" }; -static void aer_print_error_source(struct aer_err_info *info) +static void __aer_print_error(struct aer_err_info *info, struct pci_dev *dev) { int i, status; char *errmsg = NULL; @@ -169,48 +170,44 @@ static void aer_print_error_source(struct aer_err_info *info) errmsg = aer_uncorrectable_error_string[i]; if (errmsg) - AER_PR(info, "%s\t: %s\n", errmsg, - info->first_error == i ? "First" : ""); + AER_PR(info, dev, " [%2d] %s%s\n", i, errmsg, + info->first_error == i ? " (First)" : ""); else - AER_PR(info, "Unknown Error Bit %2d \t: %s\n", - i, info->first_error == i ? "First" : ""); + AER_PR(info, dev, " [%2d] Unknown Error Bit%s\n", i, + info->first_error == i ? " (First)" : ""); } } void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) { - int err_layer, agent; int id = ((dev->bus->number << 8) | dev->devfn); - AER_PR(info, "+------ PCI-Express Device Error ------+\n"); - AER_PR(info, "Error Severity\t\t: %s\n", - aer_error_severity_string[info->severity]); - if (info->status == 0) { - AER_PR(info, "PCIE Bus Error type\t: (Unaccessible)\n"); - AER_PR(info, "Unregistered Agent ID\t: %04x\n", id); + AER_PR(info, dev, + "PCIE Bus Error: severity=%s, type=Unaccessible, " + "id=%04x(Unregistered Agent ID)\n", + aer_error_severity_string[info->severity], id); } else { - err_layer = AER_GET_LAYER_ERROR(info->severity, info->status); - AER_PR(info, "PCIE Bus Error type\t: %s\n", - aer_error_layer[err_layer]); - - aer_print_error_source(info); + int layer, agent; + layer = AER_GET_LAYER_ERROR(info->severity, info->status); agent = AER_GET_AGENT(info->severity, info->status); - AER_PR(info, "%s\t\t: %04x\n", aer_agent_string[agent], id); - AER_PR(info, "VendorID=%04xh, DeviceID=%04xh," - " Bus=%02xh, Device=%02xh, Function=%02xh\n", - dev->vendor, - dev->device, - dev->bus->number, - PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn)); + AER_PR(info, dev, + "PCIE Bus Error: severity=%s, type=%s, id=%04x(%s)\n", + aer_error_severity_string[info->severity], + aer_error_layer[layer], id, aer_agent_string[agent]); + + AER_PR(info, dev, + " device [%04x:%04x] error status/mask=%08x/%08x\n", + dev->vendor, dev->device, info->status, info->mask); + + __aer_print_error(info, dev); if (info->tlp_header_valid) { unsigned char *tlp = (unsigned char *) &info->tlp; - AER_PR(info, "TLP Header:\n"); - AER_PR(info, "%02x%02x%02x%02x %02x%02x%02x%02x" + AER_PR(info, dev, " TLP Header:" + " %02x%02x%02x%02x %02x%02x%02x%02x" " %02x%02x%02x%02x %02x%02x%02x%02x\n", *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), @@ -221,6 +218,13 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) } if (info->id && info->error_dev_num > 1 && info->id == id) - AER_PR(info, "Error of this Agent(%04x) is reported first\n", - id); + AER_PR(info, dev, + " Error of this Agent(%04x) is reported first\n", id); +} + +void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) +{ + dev_info(&dev->dev, "AER: %s%s error received: id=%04x\n", + info->multi_error_valid ? "Multiple " : "", + aer_error_severity_string[info->severity], info->id); }