Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp752637imm; Fri, 11 May 2018 05:59:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq6+JnveNKxQNiNnCOJDjfjiAyC6dOMC2697AU6ud0Y7qavXNK41sB0rWSBmgQM1pMPdmYk X-Received: by 2002:a17:902:781:: with SMTP id 1-v6mr5503302plj.150.1526043576515; Fri, 11 May 2018 05:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526043576; cv=none; d=google.com; s=arc-20160816; b=vtw8zXySoXJ5+TxjS9J1QrpkyUR/hY2QZ7RSwK8j82DkGEW+EQJZY7ElWNeCocWLme ntn22QdxWM45Z0jb9+36ZbAUsjoZBWMilxL8GFUiORXJUhEPTab/JywfKGrgNJfUA12y xaeW7RHzIL5ucz3B62ut/F4ajt+c3XjtM1vCeIvpC4XgQz9IG9O/HXn68JDh1Am0xt8B e43gM8SZ2nkFmkveCjTSbKln9o5Gg03cU+EPBhUfibUO4s0oZoMhOYN1ksFmxMc/ejrW 4/2OtfGX+Hc/+YjjQt9RgJr+JFtdbfmFQJ3AQAoF83pFDAcfPqxDQIzHzBIZTiffKq8O bLCw== 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:arc-authentication-results; bh=4UmHbiaxj5l0n8coErbxRXN4tERTFM5/blMDH4l1jPs=; b=MdksECiXOX+f7BWXunQ0anYSw9FVVz9UqJaN8dquUyAbFXXkN+ecl1i3ynGPMhvq5u XAJqK+/DChyL5DV/BntsLBqh6TaQRRWoG2tdb3x+YVW6LqogtrGXGoBay23saNrsjuoj b7DTapCzFzp9CLN1xkBLZCZsOzH6H+U07c/8mILzlb7UEqxujjImWIvGh81MKxVVhHKy a29ysn0v+ejrq+UU/vSSRupTUSVTEI1xpp7XVMoJvdc6q3610PABt4n354nKp6I6oWx9 IfOuymQ4nBeFP1XUZrvZPgpZHjnOTcPGNL6sYLGNesH5Xmn0gch143wk4WWpubFduOWH V0xQ== 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 c20-v6si3161940pls.557.2018.05.11.05.59.21; Fri, 11 May 2018 05:59:36 -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 S1753118AbeEKM7D (ORCPT + 99 others); Fri, 11 May 2018 08:59:03 -0400 Received: from bmailout2.hostsharing.net ([83.223.90.240]:33831 "EHLO bmailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752563AbeEKM7B (ORCPT ); Fri, 11 May 2018 08:59:01 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id 929272801BBF7; Fri, 11 May 2018 14:58:57 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 2F57A1F487; Fri, 11 May 2018 14:58:57 +0200 (CEST) Date: Fri, 11 May 2018 14:58:57 +0200 From: Lukas Wunner To: Oza Pawandeep 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 v16 5/9] PCI/AER: Factor out error reporting from AER Message-ID: <20180511125857.GA23225@wunner.de> References: <1526035408-31328-1-git-send-email-poza@codeaurora.org> <1526035408-31328-6-git-send-email-poza@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526035408-31328-6-git-send-email-poza@codeaurora.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 11, 2018 at 06:43:24AM -0400, Oza Pawandeep wrote: > +void pcie_do_fatal_recovery(struct pci_dev *dev) > +{ > + struct pci_dev *udev; > + struct pci_bus *parent; > + struct pci_dev *pdev, *temp; > + pci_ers_result_t result = PCI_ERS_RESULT_RECOVERED; > + struct aer_broadcast_data result_data; > + > + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) > + udev = dev; > + else > + udev = dev->bus->self; > + > + parent = udev->subordinate; > + pci_lock_rescan_remove(); > + list_for_each_entry_safe_reverse(pdev, temp, &parent->devices, > + bus_list) { > + pci_dev_get(pdev); > + pci_dev_set_disconnected(pdev, NULL); > + if (pci_has_subordinate(pdev)) > + pci_walk_bus(pdev->subordinate, > + pci_dev_set_disconnected, NULL); > + pci_stop_and_remove_bus_device(pdev); > + pci_dev_put(pdev); > + } Any reason not to simply call pci_walk_bus(udev->subordinate, pci_dev_set_disconnected, NULL); before the list_for_each_entry_safe_reverse() iteration, instead of calling it for each device on the subordinate bus and for each device's children? Should be semantically identical, saves 3 LoC and saves wasted cycles of acquiring pci_bus_sem over and over again for each device on the subordinate bus. Thanks, Lukas