From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19E97C433DF for ; Wed, 8 Jul 2020 00:11:59 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 049B120771 for ; Wed, 8 Jul 2020 00:11:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="v/atDYLg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 049B120771 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4B1fqv3RbWzDr09 for ; Wed, 8 Jul 2020 10:11:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=helgaas@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=default header.b=v/atDYLg; dkim-atps=neutral Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4B1fnx3ShMzDqsj for ; Wed, 8 Jul 2020 10:10:12 +1000 (AEST) Received: from localhost (mobile-166-175-191-139.mycingular.net [166.175.191.139]) (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 D4ED820771; Wed, 8 Jul 2020 00:10:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594167010; bh=GRc7bmT28/LGGsLBxls6P/+Y6GitVFKoeGWw+LQ+Mwk=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=v/atDYLgMKucbXsAUe1GUdgPRkPL0yNf7YGKKHQ5z4/k3CbENeBvSIhGrAZdQO++g F+BN9MXxPyuUjI72ftoxL941QdlK0rC+FHFMMbVHlc2EekTddVVfTZQZk8wOjRotJR tAAsdF9mi1WNnSuqgWU9/OkjzUQewK+8X08x9dCY= Date: Tue, 7 Jul 2020 19:10:08 -0500 From: Bjorn Helgaas To: Matt Jolly Subject: Re: [PATCH] pci: pcie: AER: Fix logging of Correctable errors Message-ID: <20200708001008.GA404699@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200618155511.16009-1-Kangie@footclan.ninja> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sam Bobroff , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver O'Halloran , Bjorn Helgaas , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, Jun 19, 2020 at 01:55:11AM +1000, Matt Jolly wrote: > The AER documentation indicates that correctable (severity=Corrected) > errors should be output as a warning so that users can filter these > errors if they choose to; This functionality does not appear to have been implemented. > > This patch modifies the functions aer_print_error and __aer_print_error > to send correctable errors as a warning (pci_warn), rather than as an error (pci_err). It > partially addresses several bugs in relation to kernel message buffer > spam for misbehaving devices - the root cause (possibly device firmware?) isn't > addressed, but the dmesg output is less alarming for end users, and can > be filtered separately from uncorrectable errors. This should hopefully > reduce the need for users to disable AER to suppress corrected errors. > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=201517 > Link: https://bugzilla.kernel.org/show_bug.cgi?id=196183 > > Signed-off-by: Matt Jolly > --- > drivers/pci/pcie/aer.c | 36 ++++++++++++++++++++++++++---------- > 1 file changed, 26 insertions(+), 10 deletions(-) > > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c > index 3acf56683915..131ecc0df2cb 100644 > --- a/drivers/pci/pcie/aer.c > +++ b/drivers/pci/pcie/aer.c > @@ -662,12 +662,18 @@ static void __aer_print_error(struct pci_dev *dev, > errmsg = i < ARRAY_SIZE(aer_uncorrectable_error_string) ? > aer_uncorrectable_error_string[i] : NULL; > > - if (errmsg) > - pci_err(dev, " [%2d] %-22s%s\n", i, errmsg, > - info->first_error == i ? " (First)" : ""); > - else > + if (errmsg) { > + if (info->severity == AER_CORRECTABLE) { > + pci_warn(dev, " [%2d] %-22s%s\n", i, errmsg, I think we can use pci_printk() here to reduce the code duplication. And I think we can also simplify the aer_correctable_error_string/ aer_uncorrectable_error_string stuff above, which would make this even simpler. I'll respond to this with my proposal. > + info->first_error == i ? " (First)" : ""); > + } else { > + pci_err(dev, " [%2d] %-22s%s\n", i, errmsg, > + info->first_error == i ? " (First)" : ""); > + } > + } else { > pci_err(dev, " [%2d] Unknown Error Bit%s\n", > i, info->first_error == i ? " (First)" : ""); > + } > } > pci_dev_aer_stats_incr(dev, info); > } > @@ -686,13 +692,23 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) > layer = AER_GET_LAYER_ERROR(info->severity, info->status); > agent = AER_GET_AGENT(info->severity, info->status); > > - pci_err(dev, "PCIe Bus Error: severity=%s, type=%s, (%s)\n", > - aer_error_severity_string[info->severity], > - aer_error_layer[layer], aer_agent_string[agent]); > + if (info->severity == AER_CORRECTABLE) { > + pci_warn(dev, "PCIe Bus Error: severity=%s, type=%s, (%s)\n", > + aer_error_severity_string[info->severity], > + aer_error_layer[layer], aer_agent_string[agent]); > > - pci_err(dev, " device [%04x:%04x] error status/mask=%08x/%08x\n", > - dev->vendor, dev->device, > - info->status, info->mask); > + pci_warn(dev, " device [%04x:%04x] error status/mask=%08x/%08x\n", > + dev->vendor, dev->device, > + info->status, info->mask); > + } else { > + pci_err(dev, "PCIe Bus Error: severity=%s, type=%s, (%s)\n", > + aer_error_severity_string[info->severity], > + aer_error_layer[layer], aer_agent_string[agent]); > + > + pci_err(dev, " device [%04x:%04x] error status/mask=%08x/%08x\n", > + dev->vendor, dev->device, > + info->status, info->mask); > + } > > __aer_print_error(dev, info); > > -- > 2.26.2 >