Received: by 10.192.165.148 with SMTP id m20csp4022413imm; Mon, 30 Apr 2018 10:17:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoMDZ+tEyQBVkknp8uDime2Fav1qHzMEXcUY8NaYCKkuU4r/msc0mHx5UDRADqtVDUYWn7W X-Received: by 10.98.229.13 with SMTP id n13mr12714678pff.125.1525108676212; Mon, 30 Apr 2018 10:17:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525108676; cv=none; d=google.com; s=arc-20160816; b=A7Fom6QwyHozJr7pFs5sw3naEZTQm2X0Jo5lOaolRsvQih8fbErl3Zu3mHlZDVQnjO p8XZ+CURU1BxwsyI5tjrtTp4tbBnEkgrYeNwOlIgMebrNwe0xY30DI2DyZGB3fs4oT0v 15Yo932AY3rEZ49qTuCujinUcQCkw4Y2eN6s968NmrT5yMuKKiadqUBJmvraf6syOeXr mHJv6KcB7+gbp0wUSBQdWXJwks3y6uxZjLOZmGQ1iHrW7kFSxtCUm28Tpq55uUF9bJ8A 5d21e7yOIyk8LxdH1/AyOcbyW7QyaFRHuLqR5RB6P/LcALqiS5Gh4OyhB1KljokLs/UJ gSSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dmarc-filter :arc-authentication-results; bh=dsSKODxO5Y7B4UwK7iCuFHtA3Fb2DHw0dcvzy7K4mZE=; b=cYayVxq//DJaQbneEwdi+sNMnQtG+waS1prXW5QpLnnGd0hhoeS8jKurBPLxcG/iHP ogID7uUv7pxyCSRsmkh84imNOiuOBcsxhQkiLmiMoqRCvb1pXnvJt0cGeL9qJbHDku+b 6DZY/XaLvC8Sjd8KetbrG7WBPIgIOXKYr5J5dEBGAmtOkQD0XGZo1TvAuZ2mPGEDtu5G lB/bmuKFbc77VnVPjY/2MN5Q8CWZO8vHSEOjFEyU3kNbC4pCwW4eavAfJplBzPF/vTIX rM0bd7cgj2wA60KtzXgPfPugd4s9fR6xq/hjmZlb966lN/r2ZRyD1RFxH/S4OyW2WKVX Z9fg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5-v6si6230374pgv.668.2018.04.30.10.17.41; Mon, 30 Apr 2018 10:17:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753119AbeD3RPe (ORCPT + 99 others); Mon, 30 Apr 2018 13:15:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:51048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751452AbeD3RPd (ORCPT ); Mon, 30 Apr 2018 13:15:33 -0400 Received: from localhost (unknown [69.71.5.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DA17B22D48; Mon, 30 Apr 2018 17:15:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA17B22D48 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Mon, 30 Apr 2018 12:15:31 -0500 From: Bjorn Helgaas To: "Alex G." 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 Subject: Re: [PATCH RESEND] PCI/AER: Use a common function to print AER error bits Message-ID: <20180430171531.GB95643@bhelgaas-glaptop.roam.corp.google.com> References: <20180417170943.1767-1-mr.nuke.me@gmail.com> <20180427224337.GC73256@bhelgaas-glaptop.roam.corp.google.com> <12343e44-2d8a-51e1-a0be-e6804e9bd8a3@gmail.com> <220bb125-b933-abf3-7b30-63446634e8d6@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <220bb125-b933-abf3-7b30-63446634e8d6@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 28, 2018 at 12:07:48PM -0500, Alex G. wrote: > On 04/28/2018 11:46 AM, Alex G. wrote: > > On 04/27/2018 05:43 PM, Bjorn Helgaas wrote: > > > On Tue, Apr 17, 2018 at 12:09:43PM -0500, Alexandru Gagniuc wrote: > (snip) > > > > +??? 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 could update the offending line to say: > + info.first_error = PCI_ERR_CAP_FEP(aer->cap_control); That's what I would have expected. So I'd say either do this, or add a comment about why it's not the right thing to do. > Though I still have the concerns with validating CPER data: > > > 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. Sounds like this is material for another patch, but if/when you do that, I'd like to understand your concern about validating the registers we get from firmware. Are you worried about getting incorrect register contents, then printing the wrong info, making the wrong decision about how to recover, something else? Bjorn