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 Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB40AC2D0CD for ; Wed, 21 May 2025 09:43:44 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4b2RM328d4z3btX; Wed, 21 May 2025 19:43:43 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1747820623; cv=none; b=Q3LIn0KyT6Bw3FecRV6TKxOZBAJ+A0eFpKMkY2jS7KTGK7ofVO+cntRPRVlby2XMHvCR2TbnZ51ttkZTWZRKqX1WEGvLjQ3OmzGC3sLihP8X1JYlVdbCgTLluC3QS5DtuLOO26nYOfBg2m9E1EYuJqC0WIz3Vp4CTBJJWhMP/IhtHyBJN8N4AWZADwzzQU+Uk5RVrtHzzB0PoZ9btJjZZIKeWcRq3z72FCfnPpeFhOnFrNY6wfwUj4E/ggAHPkn4rialCEzjzoymOjIPF/zDBcYni9nVJKW+xCr87jxfdrb7revhEukfkuTmYop62Dfa41UHwSquyA/umPB0VFSJnw== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1747820623; c=relaxed/relaxed; bh=HFYrA7N43vhl8il3udAh0nx//GfeJKhcLQvUSPRxDW4=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VzwfR6RXWH3l7gU3HMPh20p9/ySOy3afewvyeHPQoYGkeKO0hQpe9myTNrdAwp/d72TN2PthiG4YbfSDBKx/OFnpKD3fp2TEuCvZTo8V/uSDd5JqkoP5k781aAEWplgjp7UUxQ9xM5k9NkVZE/sIiGHEPEBtuxondDgZuVeZTz1LFYlr6HJUYAcU1r+8qo1ByKMFCJqQ4EJiRIf2AGoo15TCmcBNnX8R6dj6R89ySDwLchGN+Uxdg7Ej70aiqWapJZyBPTbhyuW9yvsZNqvHAPEub4tmdkMuM4P5NMAW0Trx8KSAYADQpbz1zOBn6W6fZPJZmpaZ6nzyg2pfdpTJ0g== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass (client-ip=185.176.79.56; helo=frasgout.his.huawei.com; envelope-from=jonathan.cameron@huawei.com; receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=185.176.79.56; helo=frasgout.his.huawei.com; envelope-from=jonathan.cameron@huawei.com; receiver=lists.ozlabs.org) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 4b2RM16tFSz2xjQ for ; Wed, 21 May 2025 19:43:40 +1000 (AEST) Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4b2RHD2zfWz6L55h; Wed, 21 May 2025 17:40:24 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 5AF3614020A; Wed, 21 May 2025 17:43:35 +0800 (CST) Received: from localhost (10.203.177.66) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 21 May 2025 11:43:34 +0200 Date: Wed, 21 May 2025 10:43:31 +0100 From: Jonathan Cameron To: Bjorn Helgaas CC: , Jon Pan-Doh , "Karolina Stolarek" , Weinan Liu , Martin Petersen , Ben Fuller , Drew Walton , "Anil Agrawal" , Tony Luck , Ilpo =?UTF-8?Q?J=C3=A4rvinen?= , "Sathyanarayanan Kuppuswamy" , Lukas Wunner , Sargun Dhillon , "Paul E . McKenney" , Mahesh J Salgaonkar , "Oliver O'Halloran" , Kai-Heng Feng , "Keith Busch" , Robert Richter , Terry Bowman , Shiju Jose , Dave Jiang , , , Bjorn Helgaas , Krzysztof =?UTF-8?Q?Wilczy=C5=84ski?= Subject: Re: [PATCH v7 10/17] PCI/AER: Update statistics early in logging Message-ID: <20250521104331.00001a6a@huawei.com> In-Reply-To: <20250520215047.1350603-11-helgaas@kernel.org> References: <20250520215047.1350603-1-helgaas@kernel.org> <20250520215047.1350603-11-helgaas@kernel.org> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.203.177.66] X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To frapeml500008.china.huawei.com (7.182.85.71) On Tue, 20 May 2025 16:50:27 -0500 Bjorn Helgaas wrote: > From: Bjorn Helgaas >=20 > There are two AER logging entry points: >=20 > - aer_print_error() is used by DPC (dpc_process_error()) and native AER > handling (aer_process_err_devices()). >=20 > - pci_print_aer() is used by GHES (aer_recover_work_func()) and CXL > (cxl_handle_rdport_errors()) >=20 > Both use __aer_print_error() to print the AER error bits. Previously > __aer_print_error() also incremented the AER statistics via > pci_dev_aer_stats_incr(). >=20 > Call pci_dev_aer_stats_incr() early in the entry points instead of in > __aer_print_error() so we update the statistics even if the actual printi= ng > of error bits is rate limited by a future change. >=20 > Signed-off-by: Bjorn Helgaas > Tested-by: Krzysztof Wilczy=C5=84ski > Reviewed-by: Ilpo J=C3=A4rvinen > Reviewed-by: Kuppuswamy Sathyanarayanan Always felt odd that a stat got updated in a _print_ function so even without the other reasoning this is a good change. Reviewed-by: Jonathan Cameron > --- > drivers/pci/pcie/aer.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c > index d845079429f0..53b7559564a9 100644 > --- a/drivers/pci/pcie/aer.c > +++ b/drivers/pci/pcie/aer.c > @@ -693,7 +693,6 @@ static void __aer_print_error(struct pci_dev *dev, > aer_printk(level, dev, " [%2d] %-22s%s\n", i, errmsg, > info->first_error =3D=3D i ? " (First)" : ""); > } > - pci_dev_aer_stats_incr(dev, info); > } > =20 > static void aer_print_source(struct pci_dev *dev, struct aer_err_info *i= nfo, > @@ -714,6 +713,8 @@ void aer_print_error(struct pci_dev *dev, struct aer_= err_info *info) > int id =3D pci_dev_id(dev); > const char *level; > =20 > + pci_dev_aer_stats_incr(dev, info); > + > if (!info->status) { > pci_err(dev, "PCIe Bus Error: severity=3D%s, type=3DInaccessible, (Unr= egistered Agent ID)\n", > aer_error_severity_string[info->severity]); > @@ -782,6 +783,8 @@ void pci_print_aer(struct pci_dev *dev, int aer_sever= ity, > info.status =3D status; > info.mask =3D mask; > =20 > + pci_dev_aer_stats_incr(dev, &info); > + > layer =3D AER_GET_LAYER_ERROR(aer_severity, status); > agent =3D AER_GET_AGENT(aer_severity, status); > =20