Received: by 10.192.165.148 with SMTP id m20csp1995778imm; Sat, 28 Apr 2018 09:47:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZofIewtLVUPzj9G80E8l6P+0ZbPveNYz6X6fM43rBSsm3AkiHgVFHU96+w15HwLXFFjy74H X-Received: by 2002:a63:af44:: with SMTP id s4-v6mr5446537pgo.295.1524934067767; Sat, 28 Apr 2018 09:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524934067; cv=none; d=google.com; s=arc-20160816; b=T40F2JIawa+BfDxWcuRR5BVv+FHGNPorZIGaBhUN+n4Wk9DhCoQQEzch4ktdz/fkAW IcSAh3NU4nMMxLHYUyHwTAdFR//nt0A7YsV7B7zoDyTzX7Hcqk9XZaUWm16LfSeJHywW SdquOryaFYE0xfqEJ0yBUHlLPn1M00epK0l+eLqz+yZOHpZsUIjkpRgJqtmLDJIFMK28 OqMWxkcqat0i6+r+MTnN7nLzX1uFOw/c6vWvYDO0SWWU8sb8amPKre0Bf8i7N1RWm4LU MMwbJx2oALcG8QktOz94STMdhmiqZk5zzGvLlwaejhng4NWE1JIJqWybwhIicNZp9Ufb VD9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=GJ76vv9P93+gqySHHy+w3d80w01WMLOmCCH3MuC3+YQ=; b=mC5Pz+nzCQH5WMdzA+on1EjvBHlbOsL5ea3HMmz6+Gf0654iHUu6UwoOAAK0LKhdFN 0j2dMdrbHBdgiR5jgrCeBqFaPruPqn7h9dbYz724p1fTVt/+TfMpXMbEdydnfxHyVrX8 9Hc1DuqYRPBa6HUs8fGXpLviF74k0nr1SnWrYkufCZPEuGdxc8fRm8CauZCve8mnTk8l T+q6jTFw0BOFaYNJ1eu+GTq3MxvVF2SvSpOESg4SOam09NqWYOrz+QdKTDHqyZl4A00H PNnD4ESGgf1X72HMVLIMYsSRUZXXeQXUGXgC22Z3lidH0f758nO49pF63tZScwwfEEf9 yNVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Nt1mqle2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6-v6si3959654plo.534.2018.04.28.09.47.33; Sat, 28 Apr 2018 09:47:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Nt1mqle2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758857AbeD1Qq0 (ORCPT + 99 others); Sat, 28 Apr 2018 12:46:26 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:44843 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757613AbeD1QqY (ORCPT ); Sat, 28 Apr 2018 12:46:24 -0400 Received: by mail-oi0-f68.google.com with SMTP id e80-v6so4232676oig.11; Sat, 28 Apr 2018 09:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=GJ76vv9P93+gqySHHy+w3d80w01WMLOmCCH3MuC3+YQ=; b=Nt1mqle2o5re4upC1yM8gwx59mD57CyeRrcaVyLUWnckbKQkmAszv6mnpk1bIOo5CD hDMBPlvg11d9rgPbasvlMbFuCN5OI2fsmJQNiGbi4qQIaCKxwfP2kAfWAypVaCTuK/J4 8ETIip8D3fy1qTEjT+fsgNPq86noLOUcUjHi8ZGl36cOe5ha6uJE2qQiXamle4a0/Xsp Pchr7lTSaMqTw2qrZxM/aSc9mmPknKURJAiFBFfNIRORjgHjs89gUKS27YamzgysfjDz nMFYGxw8boxFvWci9AvXwTc2ZQ7TNykpgP5oJUFzs6z5DaAKBGB5IhQAT4msa7Myw1l8 zidw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GJ76vv9P93+gqySHHy+w3d80w01WMLOmCCH3MuC3+YQ=; b=sgvxqkjlvU3kmBRL0L4/tctDaMAWG3ZjDGwzRRvw3GkgjCdla1m9NUdmIgj1rNJiTK m3X7Ria4QY9uQfrcYIc1AThEcjXBGoRvxmdIBaaHFfhM3scegbIEGa5qwkToqYYACWdd YaH6KVHmrG1J+saFU9V9PiVzHkequ86K5H4uFxLtk/SfpTYuFOplWQ1HUEhiVMyoLQ3n T8/Uh+J5RTNF5nGiEHowFem7SicBHJ9opQ0679Z4mMuICtSJ3hjgCwqSzD9pwikusjOF 0DFcFQSTS9oEyFX/NMtRC8tJiim+MIQOjnud3tmcBGz+QCubIV/9qF2W4+q65YIFX5bq fjPg== X-Gm-Message-State: ALQs6tCINgTySCyty43Aw1+0/BWsoNpMqmu869rq2ZXAQ3/69hbKN62g VHZg+NkSKsoPdtD8ZV7kv4F3H6+b8oo= X-Received: by 2002:aca:d447:: with SMTP id l68-v6mr4021579oig.102.1524933983618; Sat, 28 Apr 2018 09:46:23 -0700 (PDT) Received: from nukespec.gtech ([2601:2c1:8500:500b::e4e]) by smtp.gmail.com with ESMTPSA id a6-v6sm2127599oti.70.2018.04.28.09.46.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Apr 2018 09:46:23 -0700 (PDT) Subject: Re: [PATCH RESEND] PCI/AER: Use a common function to print AER error bits To: Bjorn Helgaas Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, gregkh@linuxfoundation.org, fred@fredlawl.com, linux-kernel@vger.kernel.org, alex_gagniuc@dellteam.com, austin_bolen@dell.com, keith.busch@intel.com References: <20180417170943.1767-1-mr.nuke.me@gmail.com> <20180427224337.GC73256@bhelgaas-glaptop.roam.corp.google.com> From: "Alex G." Message-ID: <12343e44-2d8a-51e1-a0be-e6804e9bd8a3@gmail.com> Date: Sat, 28 Apr 2018 11:46:22 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180427224337.GC73256@bhelgaas-glaptop.roam.corp.google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/27/2018 05:43 PM, Bjorn Helgaas wrote: > On Tue, Apr 17, 2018 at 12:09:43PM -0500, Alexandru Gagniuc wrote: >> On errors reported from CPER, cper_print_bits() was used to log the >> AER bits. This resulted in hard-to-understand messages, without a >> prefix. Instead use __aer_print_error() for both native AER and CPER >> to provide a more consistent log format. >> >> Signed-off-by: Alexandru Gagniuc >> --- >> drivers/pci/pcie/aer/aerdrv_errprint.c | 16 +++++++++------- >> 1 file changed, 9 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c >> index cfc89dd57831..cfae4d52f848 100644 >> --- a/drivers/pci/pcie/aer/aerdrv_errprint.c >> +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c >> @@ -216,28 +216,30 @@ EXPORT_SYMBOL_GPL(cper_severity_to_aer); >> void cper_print_aer(struct pci_dev *dev, int aer_severity, >> struct aer_capability_regs *aer) >> { >> - int layer, agent, status_strs_size, tlp_header_valid = 0; >> + int layer, agent, tlp_header_valid = 0; >> u32 status, mask; >> - const char **status_strs; >> + struct aer_err_info info; >> >> if (aer_severity == AER_CORRECTABLE) { >> status = aer->cor_status; >> mask = aer->cor_mask; >> - status_strs = aer_correctable_error_string; >> - status_strs_size = ARRAY_SIZE(aer_correctable_error_string); >> } else { >> status = aer->uncor_status; >> mask = aer->uncor_mask; >> - status_strs = aer_uncorrectable_error_string; >> - status_strs_size = ARRAY_SIZE(aer_uncorrectable_error_string); >> tlp_header_valid = status & AER_LOG_TLP_MASKS; >> } >> >> layer = AER_GET_LAYER_ERROR(aer_severity, status); >> agent = AER_GET_AGENT(aer_severity, status); >> >> + memset(&info, 0, sizeof(info)); >> + info.severity = aer_severity; >> + info.status = status; >> + info.mask = mask; >> + info.first_error = 0x1f; > > I like this patch a lot, but where does this "first_error = 0x1f" come > from? aer_(un)correctable_error_string don't go to [0x1f], so this guarantees us we don't print "(First)". > I assume this is supposed to be the "First Error Pointer" in the > Advanced Error Capabilities and Control register (PCIe r4.0, sec > 7.8.4.7). There is a "cap_control" field in struct > aer_capability_regs; should we be using that here? There is a way to extract it from the PCI regs, and it's quite simple. IIRC, it should be all f's when the capability is not implemented. I wanted to avoid any further parsing of PCI regs in this patch. I can see a way to use even more common printk code, but that requires validating the PCI regs we get from firmware. That means we need to make a guarantee about CPER that is beyond the scope of this patch. Alex >> + >> pci_err(dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", status, mask); >> - cper_print_bits("", status, status_strs, status_strs_size); >> + __aer_print_error(dev, &info); >> pci_err(dev, "aer_layer=%s, aer_agent=%s\n", >> aer_error_layer[layer], aer_agent_string[agent]); >> >> -- >> 2.14.3 >>