Received: by 10.223.185.116 with SMTP id b49csp4193369wrg; Mon, 26 Feb 2018 12:57:08 -0800 (PST) X-Google-Smtp-Source: AH8x225yrKNk7pU5MvdL0wgZODxxAJUUhcCn0f881Ag/eB7WlQ+ANbOZs8xXiHIcUhUCwaPFuiq9 X-Received: by 10.98.217.211 with SMTP id b80mr11999438pfl.107.1519678628212; Mon, 26 Feb 2018 12:57:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519678628; cv=none; d=google.com; s=arc-20160816; b=YfQ72hcp2pY+l3Eb6qYh254xLiILV2hM/5xkGgOhTcbpTC9hbMOWb2NVtm1MRiHRw6 cJLSKc6lIx9b+HfjQeNorhKd3vF0iNi/67l5Tj7EgtQD8ziHsc59OulzdTjap42g2YKl ZG3R1L576nA56CHi5VCGsjiIK59Zdk2lcX0Jn58fvtI6aN6OCs4rNXz96miXLaQDF7iV PY48K5t8NTsJeZOdEJX27GgSyg21P4zi5j9SWdzt8jVHp1LaDTXxvZJMZu0hyqnHYmMJ gAwyvhsh4ZnzL5YvLHO3BPXs6lQCHdJESnlRWOI6GA1AkowIr6T8FsWIpfqoKd52+8lH Yxsg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=6bEsiQ8lvijqgikSrEvWNuw/UeYtRL3ai26vhK0ppag=; b=GVFa57mOm8eLg/fa50IviwIuNQeBnwpYPFA9eum6kqGWTrhomeR8gV0bsmQJ8f63Lh Ytt45+Wfkbntpe+BTdcwqpFJnoh8EHLfJN5tWWf82hZcOOHCRp47U2ZzJkGaxhjJdu9A n/FFC1PXIeR3JFayYHe1mzpk7sVpYtIUBteyDNk/mKl4cD2gmz1H9iTHWYP/k7djm0H2 A3rTrKMGUwNjk9vmEYPirsGkWGAaPT11QJTg4KtSghhge4298+zRGnU2532eTXzh/xFr dPPCBLeiqzIyXzA64kauJEUPPvANkhyU6E/OKOD7jsfloDCplnqCpta+ZgLmi+LxA1il Afng== 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 o6-v6si7179710plh.287.2018.02.26.12.56.51; Mon, 26 Feb 2018 12:57:08 -0800 (PST) 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 S1752758AbeBZUzY (ORCPT + 99 others); Mon, 26 Feb 2018 15:55:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:38872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751233AbeBZUXW (ORCPT ); Mon, 26 Feb 2018 15:23:22 -0500 Received: from localhost (unknown [69.55.156.246]) (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 E6329205F4; Mon, 26 Feb 2018 20:23:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E6329205F4 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, 26 Feb 2018 14:23:21 -0600 From: Bjorn Helgaas To: poza@codeaurora.org Cc: Bjorn Helgaas , Philippe Ombredanne , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Dongdong Liu , Keith Busch , Wei Zhang , Sinan Kaya , Timur Tabi Subject: Re: [PATCH v11 2/7] PCI/AER: factor out error reporting from AER Message-ID: <20180226202321.GA63171@bhelgaas-glaptop.roam.corp.google.com> References: <1519374244-20539-1-git-send-email-poza@codeaurora.org> <1519374244-20539-3-git-send-email-poza@codeaurora.org> <20180223234232.GP14632@bhelgaas-glaptop.roam.corp.google.com> <3e536e31983d0bed397e10bb542f2a72@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3e536e31983d0bed397e10bb542f2a72@codeaurora.org> 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 Mon, Feb 26, 2018 at 11:02:50AM +0530, poza@codeaurora.org wrote: > On 2018-02-24 05:12, Bjorn Helgaas wrote: > > On Fri, Feb 23, 2018 at 01:53:59PM +0530, Oza Pawandeep wrote: > > > * handle_error_source - handle logging error into an event log > > > diff --git a/drivers/pci/pcie/pcie-err.c b/drivers/pci/pcie/pcie-err.c > > > new file mode 100644 > > > index 0000000..fcd5add > > > --- /dev/null > > > +++ b/drivers/pci/pcie/pcie-err.c > > > @@ -0,0 +1,334 @@ > > > +// SPDX-License-Identifier: GPL-2.0 > > > +/* > > > + * This file implements the error recovery as a core part of PCIe > > > error reporting. > > > + * When a PCIe error is delivered, an error message will be > > > collected and printed > > > + * to console, then, an error recovery procedure will be executed > > > by following > > > + * the PCI error recovery rules. > > > > Wrap this so it fits in 80 columns. > > I thought of keeping the way it was before (hence did not change it) > I would change it now. The original text fit in 80 columns, but you changed the text a little bit as part of making this code more generic, which made it not fit anymore. Ideally I would leave the text the same in this patch that only moves code, then update the text (and rewrap it) in the patch that makes the code more generic. > > > +static pci_ers_result_t reset_link(struct pci_dev *dev) > > > +{ > > > + struct pci_dev *udev; > > > + pci_ers_result_t status; > > > + struct pcie_port_service_driver *driver = NULL; > > > + > > > + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { > > > + /* Reset this port for all subordinates */ > > > + udev = dev; > > > + } else { > > > + /* Reset the upstream component (likely downstream port) */ > > > + udev = dev->bus->self; > > > + } > > > + > > > +#if IS_ENABLED(CONFIG_PCIEAER) > > > > AER can't be a module, so you can use just: > > > > #ifdef CONFIG_PCIEAER > > > > This ifdef should be added in the patch where you add a caller from > > non-AER > > code. This patch should only move code, not change it. > > ok, it can remain unchanged. but reset_link() is called by > pcie_do_recovery() > and pcie_do_recovery can be called by various agents such as AER, DPC. > so let us say if DPC calls pcie_do_recovery, then DPC has no way of knowing > that AER is enabled or not. > in fact it should not know, but err.c/reset_link() should take care somehow. If all you're doing is moving code, the functionality isn't changing and you shouldn't need to add the ifdef. At the point where you add a new caller and the #ifdef becomes necessary, you can add it there. Then it will make sense because we can connect the ifdef with the need for it. > I can make it a separate patch to do #ifdef CONFIG_PCIEAER inside > reset_link() > or > I can add severity parameter in reset_link() so based on severity it can > find the service. > > but I think you have comment to unify the find_aer_service and > find_dpc_service into a pcie_find_service (routine) > so I will see how I can club and take care of this comment. [without the > need of #ifdef]